diff options
author | Dun Tan <dun.tan@intel.com> | 2024-05-24 10:16:22 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-28 15:25:27 +0000 |
commit | 43e88014109e76909c21686783470b4d4b5d5b14 (patch) | |
tree | caad25bc7f48d8bfd5cee929450637068fb77eda | |
parent | 0f36b5fa0a7834c0a4bf66125f6d37ebd0ce6c01 (diff) | |
download | edk2-43e88014109e76909c21686783470b4d4b5d5b14.tar.gz edk2-43e88014109e76909c21686783470b4d4b5d5b14.tar.bz2 edk2-43e88014109e76909c21686783470b4d4b5d5b14.zip |
StandaloneMmPkg: Add MmPlatformHobProducerLib library class
CreateMmPlatformHob() is defined in the MmPlatformHobProducerLib
library class. The function is for StandaloneMm IPL to create all
Platform specific HOBs that required by the Standalone MM env.
Signed-off-by: Dun Tan <dun.tan@intel.com>
Co-authored-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Co-authored-by: Ray Ni <ray.ni@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
-rw-r--r-- | StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h | 54 | ||||
-rw-r--r-- | StandaloneMmPkg/StandaloneMmPkg.dec | 3 |
2 files changed, 57 insertions, 0 deletions
diff --git a/StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h b/StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h new file mode 100644 index 0000000000..2f302bb5b1 --- /dev/null +++ b/StandaloneMmPkg/Include/Library/MmPlatformHobProducerLib.h @@ -0,0 +1,54 @@ +/** @file
+ MM Platform HOB Producer Library Class.
+
+ CreateMmPlatformHob() function is called by StandaloneMm IPL to create all
+ Platform specific HOBs that required by Standalone MM environment.
+
+ Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MM_PLATFORM_HOB_PRODUCER_LIB_H_
+#define MM_PLATFORM_HOB_PRODUCER_LIB_H_
+
+/**
+ Create the platform specific HOBs needed by the Standalone MM environment.
+
+ The following HOBs are created by StandaloneMm IPL common logic
+ hence they should NOT be created by this function:
+ * Single EFI_HOB_TYPE_FV to describe the Firmware Volume where MM Core resides.
+ * Single GUIDed (gEfiSmmSmramMemoryGuid) HOB to describe the MM regions.
+ * Single EFI_HOB_MEMORY_ALLOCATION_MODULE to describe the MM region used by MM Core.
+ * Multiple EFI_HOB_RESOURCE_DESCRIPTOR to describe the non-MM regions and their access permissions.
+ Note: All accessible non-MM regions should be described by EFI_HOB_RESOURCE_DESCRIPTOR HOBs.
+ * Single GUIDed (gMmCommBufferHobGuid) HOB to identify MM Communication buffer in non-MM region.
+ * Multiple GUIDed (gSmmBaseHobGuid) HOB to describe the SMM base address of each processor.
+ * Multiple GUIDed (gMpInformation2HobGuid) HOB to describe the MP information.
+ * Single GUIDed (gMmCpuSyncConfigHobGuid) HOB to describe how BSP synchronizes with APs in x86 SMM.
+ * Single GUIDed (gMmAcpiS3EnableHobGuid) HOB to describe the ACPI S3 enable status.
+ * Single GUIDed (gEfiAcpiVariableGuid) HOB to identify the S3 data root region in x86.
+ * Single GUIDed (gMmProfileDataHobGuid) HOB to describe the MM profile data region.
+
+ @param[in] Buffer The free buffer to be used for HOB creation.
+ @param[in, out] BufferSize The buffer size.
+ On return, the expected/used size.
+
+ @retval RETURN_INVALID_PARAMETER BufferSize is NULL.
+ @retval RETURN_INVALID_PARAMETER Buffer is NULL and BufferSize is not 0.
+ @retval RETURN_BUFFER_TOO_SMALL The buffer is too small for HOB creation.
+ BufferSize is updated to indicate the expected buffer size.
+ When the input BufferSize is bigger than the expected buffer size,
+ the BufferSize value will be changed to the used buffer size.
+ @retval RETURN_SUCCESS The HOB list is created successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+CreateMmPlatformHob (
+ IN VOID *Buffer,
+ IN OUT UINTN *BufferSize
+ );
+
+#endif
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dec b/StandaloneMmPkg/StandaloneMmPkg.dec index fc91bb4c3e..a23a0f8f2f 100644 --- a/StandaloneMmPkg/StandaloneMmPkg.dec +++ b/StandaloneMmPkg/StandaloneMmPkg.dec @@ -29,6 +29,9 @@ ## MM Memory Operation.
MemLib|Include/Library/StandaloneMmMemLib.h
+[LibraryClasses.X64.PEIM]
+ MmPlatformHobProducerLib|Include/Library/MmPlatformHobProducerLib.h
+
[LibraryClasses.AArch64, LibraryClasses.ARM]
## @libraryclass Defines a set of interfaces for the MM core entrypoint for
## AArch64 and ARM.
|