summaryrefslogtreecommitdiff
path: root/StandaloneMmPkg
diff options
context:
space:
mode:
Diffstat (limited to 'StandaloneMmPkg')
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.c4
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.h2
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.inf1
-rw-r--r--StandaloneMmPkg/Include/Library/FvLib.h2
-rw-r--r--StandaloneMmPkg/Library/FvLib/FvLib.c14
-rw-r--r--StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c50
-rw-r--r--StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf34
-rw-r--r--StandaloneMmPkg/StandaloneMmPkg.dsc4
8 files changed, 101 insertions, 10 deletions
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c
index 1074f30..81db9a9 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.c
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.c
@@ -512,6 +512,10 @@ StandaloneMmMain (
DEBUG ((DEBUG_INFO, "MmMain - 0x%x\n", HobStart));
+ DEBUG_CODE (
+ PrintHobList (HobStart, NULL);
+ );
+
//
// Determine if the caller has passed a reference to a MM_CORE_PRIVATE_DATA
// structure in the Hoblist. This choice will govern how boot information is
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h b/StandaloneMmPkg/Core/StandaloneMmCore.h
index cfb417d..a8fda6d 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.h
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.h
@@ -40,7 +40,7 @@
#include <Library/ReportStatusCodeLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
-
+#include <Library/HobPrintLib.h>
#include <Library/StandaloneMmMemLib.h>
#include <Library/HobLib.h>
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.inf b/StandaloneMmPkg/Core/StandaloneMmCore.inf
index 02ecd68..8cc9638 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.inf
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.inf
@@ -52,6 +52,7 @@
PeCoffLib
ReportStatusCodeLib
StandaloneMmCoreEntryPoint
+ HobPrintLib
[Protocols]
gEfiDxeMmReadyToLockProtocolGuid ## UNDEFINED # SmiHandlerRegister
diff --git a/StandaloneMmPkg/Include/Library/FvLib.h b/StandaloneMmPkg/Include/Library/FvLib.h
index 1eb9ea7..3b603e4 100644
--- a/StandaloneMmPkg/Include/Library/FvLib.h
+++ b/StandaloneMmPkg/Include/Library/FvLib.h
@@ -87,7 +87,7 @@ FindFfsSectionInSections (
@param FfsFileHeader Pointer to the current file to search.
@param SectionData Pointer to the Section matching SectionType in FfsFileHeader.
NULL if section not found
- @param SectionDataSize The size of SectionData
+ @param SectionDataSize The size of SectionData, excluding the section header.
@retval EFI_NOT_FOUND No files matching the search criteria were found
@retval EFI_SUCCESS
diff --git a/StandaloneMmPkg/Library/FvLib/FvLib.c b/StandaloneMmPkg/Library/FvLib/FvLib.c
index 89504b9..e0f344a 100644
--- a/StandaloneMmPkg/Library/FvLib/FvLib.c
+++ b/StandaloneMmPkg/Library/FvLib/FvLib.c
@@ -338,11 +338,11 @@ FfsFindSection (
Given the input file pointer, search for the next matching section in the
FFS volume.
- @param SearchType Filter to find only sections of this type.
- @param FfsFileHeader Pointer to the current file to search.
- @param SectionData Pointer to the Section matching SectionType in FfsFileHeader.
- NULL if section not found
- @param SectionDataSize The size of SectionData
+ @param[in] SectionType Filter to find only sections of this type.
+ @param[in] FfsFileHeader Pointer to the current file to search.
+ @param[in,out] SectionData Pointer to the Section matching SectionType in FfsFileHeader.
+ NULL if section not found
+ @param[in,out] SectionDataSize The size of SectionData, excluding the section header.
@retval EFI_NOT_FOUND No files matching the search criteria were found
@retval EFI_SUCCESS
@@ -380,10 +380,10 @@ FfsFindSectionData (
if (Section->Type == SectionType) {
if (IS_SECTION2 (Section)) {
*SectionData = (VOID *)((EFI_COMMON_SECTION_HEADER2 *)Section + 1);
- *SectionDataSize = SECTION2_SIZE (Section);
+ *SectionDataSize = SECTION2_SIZE (Section) - sizeof (EFI_COMMON_SECTION_HEADER2);
} else {
*SectionData = (VOID *)(Section + 1);
- *SectionDataSize = SECTION_SIZE (Section);
+ *SectionDataSize = SECTION_SIZE (Section) - sizeof (EFI_COMMON_SECTION_HEADER);
}
return EFI_SUCCESS;
diff --git a/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c b/StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.c
new file mode 100644
index 0000000..143a62c
--- /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 0000000..14931a2
--- /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
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index 8012f93..39aea89 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.<BR>
+# Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
# Copyright (C) Microsoft Corporation<BR>
#
@@ -59,6 +59,7 @@
StandaloneMmCoreEntryPoint|StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
VariableMmDependency|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+ HobPrintLib|MdeModulePkg/Library/HobPrintLib/HobPrintLib.inf
[LibraryClasses.AARCH64, LibraryClasses.ARM]
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
@@ -117,6 +118,7 @@
StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+ StandaloneMmPkg/Library/SmmLockBoxMmDependency/SmmLockBoxMmDependency.inf
[Components.AARCH64, Components.ARM]
StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf