[edk2-devel] [PATCH v1 02/15] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core

Kun Qin kun.q at outlook.com
Fri Dec 18 18:49:58 UTC 2020


This change adds support of x64 version of StandaloneMmCoreHobLib. It
brings in global variable "gHobList" through StandaloneMmCoreEntryPoint
and imports implementation from DxeCoreHobLib.inf to support x64 Mm Core.

Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
Cc: Sami Mujawar <sami.mujawar at arm.com>
Cc: Jiewen Yao <jiewen.yao at intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh at arm.com>

Signed-off-by: Kun Qin <kun.q at outlook.com>
---
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ => AArch64}/StandaloneMmCoreHobLib.c |   6 +-
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ => X64}/StandaloneMmCoreHobLib.c     | 426 ++++++++++----------
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf             |   8 +-
 3 files changed, 215 insertions(+), 225 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
similarity index 96%
copy from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c
copy to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
index e3d4743b63f2..006bff816e39 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
@@ -13,14 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/HobLib.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseMemoryLib.h>
+#include <Library/StandaloneMmCoreEntryPoint.h>
 
 #include <Guid/MemoryAllocationHob.h>
 
-//
-// Cache copy of HobList pointer.
-//
-VOID *gHobList = NULL;
-
 /**
   Returns the pointer to the HOB list.
 
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c
similarity index 70%
rename from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c
rename to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c
index e3d4743b63f2..69b20bf07a21 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c
@@ -13,14 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/HobLib.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseMemoryLib.h>
+#include <Library/StandaloneMmCoreEntryPoint.h>
 
 #include <Guid/MemoryAllocationHob.h>
 
-//
-// Cache copy of HobList pointer.
-//
-VOID *gHobList = NULL;
-
 /**
   Returns the pointer to the HOB list.
 
@@ -203,48 +199,13 @@ GetBootModeHob (
   return HandOffHob->BootMode;
 }
 
-VOID *
-CreateHob (
-  IN  UINT16    HobType,
-  IN  UINT16    HobLength
-  )
-{
-  EFI_HOB_HANDOFF_INFO_TABLE  *HandOffHob;
-  EFI_HOB_GENERIC_HEADER      *HobEnd;
-  EFI_PHYSICAL_ADDRESS        FreeMemory;
-  VOID                        *Hob;
-
-  HandOffHob = GetHobList ();
-
-  HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
-
-  FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
-
-  if (FreeMemory < HobLength) {
-    return NULL;
-  }
-
-  Hob = (VOID*) (UINTN) HandOffHob->EfiEndOfHobList;
-  ((EFI_HOB_GENERIC_HEADER*) Hob)->HobType = HobType;
-  ((EFI_HOB_GENERIC_HEADER*) Hob)->HobLength = HobLength;
-  ((EFI_HOB_GENERIC_HEADER*) Hob)->Reserved = 0;
-
-  HobEnd = (EFI_HOB_GENERIC_HEADER*) ((UINTN)Hob + HobLength);
-  HandOffHob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;
-
-  HobEnd->HobType   = EFI_HOB_TYPE_END_OF_HOB_LIST;
-  HobEnd->HobLength = sizeof (EFI_HOB_GENERIC_HEADER);
-  HobEnd->Reserved  = 0;
-  HobEnd++;
-  HandOffHob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;
-
-  return Hob;
-}
-
 /**
   Builds a HOB for a loaded PE32 module.
 
   This function builds a HOB for a loaded PE32 module.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If ModuleName is NULL, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
 
@@ -263,31 +224,51 @@ BuildModuleHob (
   IN EFI_PHYSICAL_ADDRESS   EntryPoint
   )
 {
-  EFI_HOB_MEMORY_ALLOCATION_MODULE  *Hob;
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
 
-  ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&
-          ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0));
+/**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.
 
-  Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() since PEI HOB is read-only for MM phase.
 
-  CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);
-  Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
-  Hob->MemoryAllocationHeader.MemoryLength      = ModuleLength;
-  Hob->MemoryAllocationHeader.MemoryType        = EfiBootServicesCode;
+  If there is no additional space for HOB creation, then ASSERT().
 
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
   //
-  // Zero the reserved space to match HOB spec
+  // PEI HOB is read only for MM phase
   //
-  ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));
-
-  CopyGuid (&Hob->ModuleName, ModuleName);
-  Hob->EntryPoint = EntryPoint;
+  ASSERT (FALSE);
 }
 
 /**
   Builds a HOB that describes a chunk of system memory.
 
   This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If there is no additional space for HOB creation, then ASSERT().
 
   @param  ResourceType        The type of resource described by this HOB.
@@ -305,31 +286,32 @@ BuildResourceDescriptorHob (
   IN UINT64                       NumberOfBytes
   )
 {
-  EFI_HOB_RESOURCE_DESCRIPTOR  *Hob;
-
-  Hob = CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
-  ASSERT (Hob != NULL);
-
-  Hob->ResourceType      = ResourceType;
-  Hob->ResourceAttribute = ResourceAttribute;
-  Hob->PhysicalStart     = PhysicalStart;
-  Hob->ResourceLength    = NumberOfBytes;
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
 }
 
 /**
-  Builds a GUID HOB with a certain data length.
+  Builds a customized HOB tagged with a GUID for identification and returns
+  the start address of GUID HOB data.
 
   This function builds a customized HOB tagged with a GUID for identification
   and returns the start address of GUID HOB data so that caller can fill the customized data.
   The HOB Header and Name field is already stripped.
+  It can only be invoked during PEI phase.
+  For MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If Guid is NULL, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
   @param  DataLength    The size of the data payload for the GUID HOB.
 
-  @return The start address of GUID HOB data.
+  @retval  NULL         The GUID HOB could not be allocated.
+  @retval  others       The start address of GUID HOB data.
 
 **/
 VOID *
@@ -339,35 +321,36 @@ BuildGuidHob (
   IN UINTN                       DataLength
   )
 {
-  EFI_HOB_GUID_TYPE *Hob;
-
   //
-  // Make sure that data length is not too long.
+  // PEI HOB is read only for MM phase
   //
-  ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE)));
-
-  Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));
-  CopyGuid (&Hob->Name, Guid);
-  return Hob + 1;
+  ASSERT (FALSE);
+  return NULL;
 }
 
-
 /**
-  Copies a data buffer to a newly-built HOB.
+  Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB
+  data field, and returns the start address of the GUID HOB data.
 
-  This function builds a customized HOB tagged with a GUID for identification,
-  copies the input data to the HOB data field and returns the start address of the GUID HOB data.
+  This function builds a customized HOB tagged with a GUID for identification and copies the input
+  data to the HOB data field and returns the start address of the GUID HOB data.  It can only be
+  invoked during PEI phase; for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
   The HOB Header and Name field is already stripped.
+  It can only be invoked during PEI phase.
+  For MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If Guid is NULL, then ASSERT().
   If Data is NULL and DataLength > 0, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
   @param  Data          The data to be copied into the data field of the GUID HOB.
   @param  DataLength    The size of the data payload for the GUID HOB.
 
-  @return The start address of GUID HOB data.
+  @retval  NULL         The GUID HOB could not be allocated.
+  @retval  others       The start address of GUID HOB data.
 
 **/
 VOID *
@@ -378,20 +361,22 @@ BuildGuidDataHob (
   IN UINTN                       DataLength
   )
 {
-  VOID  *HobData;
-
-  ASSERT (Data != NULL || DataLength == 0);
-
-  HobData = BuildGuidHob (Guid, DataLength);
-
-  return CopyMem (HobData, Data, DataLength);
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+  return NULL;
 }
 
 /**
   Builds a Firmware Volume HOB.
 
   This function builds a Firmware Volume HOB.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -404,24 +389,25 @@ BuildFvHob (
   IN UINT64                      Length
   )
 {
-  EFI_HOB_FIRMWARE_VOLUME  *Hob;
-
-  Hob = CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));
-
-  Hob->BaseAddress = BaseAddress;
-  Hob->Length      = Length;
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
 }
 
-
 /**
   Builds a EFI_HOB_TYPE_FV2 HOB.
 
   This function builds a EFI_HOB_TYPE_FV2 HOB.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
-  @param  FvName       The name of the Firmware Volume.
+  @param  FvName        The name of the Firmware Volume.
   @param  FileName      The name of the file.
 
 **/
@@ -434,21 +420,78 @@ BuildFv2Hob (
   IN CONST    EFI_GUID                    *FileName
   )
 {
-  EFI_HOB_FIRMWARE_VOLUME2  *Hob;
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a EFI_HOB_TYPE_FV3 HOB.
+
+  This function builds a EFI_HOB_TYPE_FV3 HOB.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() since PEI HOB is read-only for MM phase.
 
-  Hob = CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2));
+  If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
-  Hob->BaseAddress = BaseAddress;
-  Hob->Length      = Length;
-  CopyGuid (&Hob->FvName, FvName);
-  CopyGuid (&Hob->FileName, FileName);
+  @param BaseAddress            The base address of the Firmware Volume.
+  @param Length                 The size of the Firmware Volume in bytes.
+  @param AuthenticationStatus   The authentication status.
+  @param ExtractedFv            TRUE if the FV was extracted as a file within
+                                another firmware volume. FALSE otherwise.
+  @param FvName                 The name of the Firmware Volume.
+                                Valid only if IsExtractedFv is TRUE.
+  @param FileName               The name of the file.
+                                Valid only if IsExtractedFv is TRUE.
+
+**/
+VOID
+EFIAPI
+BuildFv3Hob (
+  IN          EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN          UINT64                      Length,
+  IN          UINT32                      AuthenticationStatus,
+  IN          BOOLEAN                     ExtractedFv,
+  IN CONST    EFI_GUID                    *FvName, OPTIONAL
+  IN CONST    EFI_GUID                    *FileName OPTIONAL
+  )
+{
+  ASSERT (FALSE);
 }
 
+/**
+  Builds a Capsule Volume HOB.
+
+  This function builds a Capsule Volume HOB.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
+  If the platform does not support Capsule Volume HOBs, then ASSERT().
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  BaseAddress   The base address of the Capsule Volume.
+  @param  Length        The size of the Capsule Volume in bytes.
+
+**/
+VOID
+EFIAPI
+BuildCvHob (
+  IN EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN UINT64                      Length
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
 
 /**
   Builds a HOB for the CPU.
 
   This function builds a HOB for the CPU.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If there is no additional space for HOB creation, then ASSERT().
 
   @param  SizeOfMemorySpace   The maximum physical memory addressability of the processor.
@@ -462,122 +505,9 @@ BuildCpuHob (
   IN UINT8                       SizeOfIoSpace
   )
 {
-  EFI_HOB_CPU  *Hob;
-
-  Hob = CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));
-
-  Hob->SizeOfMemorySpace = SizeOfMemorySpace;
-  Hob->SizeOfIoSpace     = SizeOfIoSpace;
-
   //
-  // Zero the reserved space to match HOB spec
+  // PEI HOB is read only for MM phase
   //
-  ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));
-}
-
-/**
-  Builds a HOB for the memory allocation.
-
-  This function builds a HOB for the memory allocation.
-  If there is no additional space for HOB creation, then ASSERT().
-
-  @param  BaseAddress   The 64 bit physical address of the memory.
-  @param  Length        The length of the memory allocation in bytes.
-  @param  MemoryType    Type of memory allocated by this HOB.
-
-**/
-VOID
-EFIAPI
-BuildMemoryAllocationHob (
-  IN EFI_PHYSICAL_ADDRESS        BaseAddress,
-  IN UINT64                      Length,
-  IN EFI_MEMORY_TYPE             MemoryType
-  )
-{
-  EFI_HOB_MEMORY_ALLOCATION  *Hob;
-
-  ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
-          ((Length & (EFI_PAGE_SIZE - 1)) == 0));
-
-  Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));
-
-  ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
-  Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
-  Hob->AllocDescriptor.MemoryLength      = Length;
-  Hob->AllocDescriptor.MemoryType        = MemoryType;
-  //
-  // Zero the reserved space to match HOB spec
-  //
-  ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));
-}
-
-/**
-  Builds a HOB that describes a chunk of system memory with Owner GUID.
-
-  This function builds a HOB that describes a chunk of system memory.
-  If there is no additional space for HOB creation, then ASSERT().
-
-  @param  ResourceType        The type of resource described by this HOB.
-  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
-  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
-  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
-  @param  OwnerGUID           GUID for the owner of this resource.
-
-**/
-VOID
-EFIAPI
-BuildResourceDescriptorWithOwnerHob (
-  IN EFI_RESOURCE_TYPE            ResourceType,
-  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
-  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
-  IN UINT64                       NumberOfBytes,
-  IN EFI_GUID                     *OwnerGUID
-  )
-{
-  ASSERT (FALSE);
-}
-
-/**
-  Builds a Capsule Volume HOB.
-
-  This function builds a Capsule Volume HOB.
-  If the platform does not support Capsule Volume HOBs, then ASSERT().
-  If there is no additional space for HOB creation, then ASSERT().
-
-  @param  BaseAddress   The base address of the Capsule Volume.
-  @param  Length        The size of the Capsule Volume in bytes.
-
-**/
-VOID
-EFIAPI
-BuildCvHob (
-  IN EFI_PHYSICAL_ADDRESS        BaseAddress,
-  IN UINT64                      Length
-  )
-{
-  ASSERT (FALSE);
-}
-
-
-/**
-  Builds a HOB for the BSP store.
-
-  This function builds a HOB for BSP store.
-  If there is no additional space for HOB creation, then ASSERT().
-
-  @param  BaseAddress   The 64 bit physical address of the BSP.
-  @param  Length        The length of the BSP store in bytes.
-  @param  MemoryType    Type of memory allocated by this HOB.
-
-**/
-VOID
-EFIAPI
-BuildBspStoreHob (
-  IN EFI_PHYSICAL_ADDRESS        BaseAddress,
-  IN UINT64                      Length,
-  IN EFI_MEMORY_TYPE             MemoryType
-  )
-{
   ASSERT (FALSE);
 }
 
@@ -585,6 +515,9 @@ BuildBspStoreHob (
   Builds a HOB for the Stack.
 
   This function builds a HOB for the stack.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
   If there is no additional space for HOB creation, then ASSERT().
 
   @param  BaseAddress   The 64 bit physical address of the Stack.
@@ -598,5 +531,64 @@ BuildStackHob (
   IN UINT64                      Length
   )
 {
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a HOB for the BSP store.
+
+  This function builds a HOB for BSP store.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  BaseAddress   The 64 bit physical address of the BSP.
+  @param  Length        The length of the BSP store in bytes.
+  @param  MemoryType    Type of memory allocated by this HOB.
+
+**/
+VOID
+EFIAPI
+BuildBspStoreHob (
+  IN EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN UINT64                      Length,
+  IN EFI_MEMORY_TYPE             MemoryType
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a HOB for the memory allocation.
+
+  This function builds a HOB for the memory allocation.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM phase.
+
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  BaseAddress   The 64 bit physical address of the memory.
+  @param  Length        The length of the memory allocation in bytes.
+  @param  MemoryType    Type of memory allocated by this HOB.
+
+**/
+VOID
+EFIAPI
+BuildMemoryAllocationHob (
+  IN EFI_PHYSICAL_ADDRESS        BaseAddress,
+  IN UINT64                      Length,
+  IN EFI_MEMORY_TYPE             MemoryType
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
   ASSERT (FALSE);
 }
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
index 0046cd804def..e43a1e63bf14 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
@@ -22,16 +22,18 @@ [Defines]
   LIBRARY_CLASS                  = HobLib|MM_CORE_STANDALONE
 
 #
-#  VALID_ARCHITECTURES           = AARCH64
+#  VALID_ARCHITECTURES           = X64 AARCH64
 #
-[Sources.Common]
-  StandaloneMmCoreHobLib.c
+[Sources.X64]
+  X64/StandaloneMmCoreHobLib.c
 
 [Sources.AARCH64]
+  AArch64/StandaloneMmCoreHobLib.c
   AArch64/StandaloneMmCoreHobLibInternal.c
 
 [Packages]
   MdePkg/MdePkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
 
 
 [LibraryClasses]
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69219): https://edk2.groups.io/g/devel/message/69219
Mute This Topic: https://groups.io/mt/79068285/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list