The LockBox Dependency DXE Driver is designed for use with standalone
mm where gBS are not accessible to indicates that LockBox API is ready
for 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
to the DXE driver that the LockBox API is ready for use.
Cc: Liming Gao
Cc: Jiaxin Wu
Cc: Ray Ni
Signed-off-by: Yuanhao Xie
---
StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c | 52
StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf | 37
+
StandaloneMmPkg/StandaloneMmPkg.dsc | 3
++-
3 files changed, 91 insertions(+), 1 deletion(-)
diff --git
a/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c
b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c
new file mode 100644
index 00..6445d4c569
--- /dev/null
+++ b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c
@@ -0,0 +1,52 @@
+/** @file
+ LockBox Dependency DXE Driver.
+
+ By installing the LockBox protocol with the gEfiLockBoxProtocolGuid,
+ it signals that the LockBox API is fully operational and ready for use.
+ Drivers that intend to utilize the LockBox functionality at their entry
+ point should declare this dependency explicitly.
+
+ Copyright (c) 2024, Intel Corporation. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include
+#include
+#include
+#include
+#include
+
+/**
+ It attempts to install the gEfiLockBoxProtocolGuid protocol into the
system's DXE database
+ with NULL as the protocol interface to mark the protocol as handled in the
system or to
+ act as a trigger.
+
+ @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 OthersAn error occurred while installing the
protocol.
+**/
+EFI_STATUS
+EFIAPI
+SmmLockBoxMmDependencyConstructor (
+ IN EFI_HANDLEImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Install NULL to DXE data base as notify
+ //
+ Status = gBS->InstallProtocolInterface (
+ ,
+ ,
+ 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 00..7fc7b67d21
--- /dev/null
+++ b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf
@@ -0,0 +1,37 @@
+## @file
+# LockBox Dependency DXE Driver.
+
+# By installing the LockBox protocol with the gEfiLockBoxProtocolGuid,
+# it signals that the LockBox API is fully operational and ready for use.
+# Drivers that intend to utilize the LockBox functionality at their entry
+# point should declare this dependency explicitly.
+#
+# Copyright (c) 2024, Intel Corporation. All rights reserved.
+#
+# 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
+ StandaloneMmPkg/StandaloneMmPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[Protocols]
+ gEfiLockBoxProtocolGuid
+
+[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc
b/StandaloneMmPkg/StandaloneMmPkg.dsc
index 8012f93b7d..8a4f9a20ec 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -1,7 +1,7 @@
## @file
# Standalone MM Platform.
#
-# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
# Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
# Copyright (C) Microsoft Corporation
#
@@ -117,6 +117,7 @@
StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf