diff options
author | xieyuanh <yuanhao.xie@intel.com> | 2024-04-15 13:23:17 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-07-31 19:49:24 +0000 |
commit | 3ada6c0db6a416a5bd539de6693a60cd57133e0b (patch) | |
tree | 945c23f637ff092ca6c564666c746a4b92f67fe0 /StandaloneMmPkg | |
parent | 1fc55a3933b0d17430c2857629ee54abefaad7eb (diff) | |
download | edk2-3ada6c0db6a416a5bd539de6693a60cd57133e0b.tar.gz edk2-3ada6c0db6a416a5bd539de6693a60cd57133e0b.tar.bz2 edk2-3ada6c0db6a416a5bd539de6693a60cd57133e0b.zip |
StandaloneMmPkg: Add LockBox Dependency Library
The LockBox Dependency Library is designed for standalone MM
environments where gBS are not accessible to indicates that LockBox API
is readyfor use.
For DXE drivers use lockbox APIs via a communication mechanism
triggering an SMI, it's must to have the corresponding SMI handler
pre-installed for interrupt management. To ensure orderly operations
and proper notification, besides specified the guid in
the [Depex] section of the .inf file. The installation of smi handler,
along with the LockBox protocol marked by gEfiLockBoxProtocolGuid,
must be informed to the DXE driver. This protocol installation signifies
that the LockBox API is ready for use, and this functionality is
implemented in the constructor of this library.
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Diffstat (limited to 'StandaloneMmPkg')
-rw-r--r-- | StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c | 50 | ||||
-rw-r--r-- | StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf | 34 |
2 files changed, 84 insertions, 0 deletions
diff --git a/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c new file mode 100644 index 0000000000..143a62c200 --- /dev/null +++ b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c @@ -0,0 +1,50 @@ +/** @file
+ LockBox Dependency DXE Library.
+
+ By installing the LockBox protocol with the gEfiLockBoxProtocolGuid,
+ it signals that the LockBox API is fully operational and ready for use.
+
+ Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Protocol/LockBox.h>
+
+/**
+ The constructor function of SmmLockBoxMmDependency.
+
+ It attempts to install the gEfiLockBoxProtocolGuid protocol into the system's DXE database
+ with NULL as notify.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the Management mode System Table.
+
+ @retval EFI_SUCCESS The protocol was successfully installed into the DXE database.
+ @retval Others An error occurred while installing the protocol.
+**/
+EFI_STATUS
+EFIAPI
+SmmLockBoxMmDependencyConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Install NULL to DXE data base as notify
+ //
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEfiLockBoxProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf new file mode 100644 index 0000000000..14931a2925 --- /dev/null +++ b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf @@ -0,0 +1,34 @@ +## @file
+# LockBox Dependency DXE Library.
+#
+# By installing the LockBox protocol with the gEfiLockBoxProtocolGuid,
+# it signals that the LockBox API is fully operational and ready for use.
+#
+# Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010006
+ BASE_NAME = SmmLockBoxMmDependency
+ FILE_GUID = c45ce910-7f8b-4f49-88e2-2c26c5743ee2
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = NULL
+ CONSTRUCTOR = SmmLockBoxMmDependencyConstructor
+
+[Sources]
+ SmmLockBoxMmDependency.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[Protocols]
+ gEfiLockBoxProtocolGuid
+
+[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
|