public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: Kun Qin <kun.q@outlook.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Subject: Re: [PATCH v1 02/15] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core
Date: Mon, 28 Dec 2020 00:12:06 +0000	[thread overview]
Message-ID: <CY4PR11MB1288F5E6BFD56F4A00CA33EA8CD90@CY4PR11MB1288.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MWHPR06MB310209F35ABC70C689E497A3F3C30@MWHPR06MB3102.namprd06.prod.outlook.com>

Can we merge the common part between X64 and AArch64 into one Common.c?

> -----Original Message-----
> From: Kun Qin <kun.q@outlook.com>
> Sent: Saturday, December 19, 2020 2:50 AM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>; Sami Mujawar
> <sami.mujawar@arm.com>; Yao, Jiewen <jiewen.yao@intel.com>; Supreeth
> Venkatesh <supreeth.venkatesh@arm.com>
> Subject: [PATCH v1 02/15] StandaloneMmPkg: StandaloneMmCoreHobLib:
> Extend support for x64 Mm Core
> 
> 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@arm.com>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> 
> Signed-off-by: Kun Qin <kun.q@outlook.com>
> ---
>  StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =>
> AArch64}/StandaloneMmCoreHobLib.c |   6 +-
>  StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =>
> X64}/StandaloneMmCoreHobLib.c     | 426 ++++++++++----------
> 
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore
> HobLib.inf             |   8 +-
>  3 files changed, 215 insertions(+), 225 deletions(-)
> 
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo
> reHobLib.c
> b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal
> oneMmCoreHobLib.c
> similarity index 96%
> copy from
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore
> HobLib.c
> copy to
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standalon
> eMmCoreHobLib.c
> index e3d4743b63f2..006bff816e39 100644
> ---
> a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo
> reHobLib.c
> +++
> b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal
> oneMmCoreHobLib.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/StandaloneMmCo
> reHobLib.c
> b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone
> MmCoreHobLib.c
> similarity index 70%
> rename from
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore
> HobLib.c
> rename to
> StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneM
> mCoreHobLib.c
> index e3d4743b63f2..69b20bf07a21 100644
> ---
> a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo
> reHobLib.c
> +++
> b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone
> MmCoreHobLib.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/StandaloneMmCo
> reHobLib.inf
> b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmC
> oreHobLib.inf
> index 0046cd804def..e43a1e63bf14 100644
> ---
> a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo
> reHobLib.inf
> +++
> b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmC
> oreHobLib.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


  reply	other threads:[~2020-12-28  0:12 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201218185011.1366-1-kun.q@outlook.com>
2020-12-18 18:49 ` [PATCH v1 01/15] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 Kun Qin
2020-12-28  0:11   ` [edk2-devel] " Yao, Jiewen
2020-12-18 18:49 ` [PATCH v1 02/15] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Kun Qin
2020-12-28  0:12   ` Yao, Jiewen [this message]
2021-03-24 20:33     ` [edk2-devel] " Dawn
2020-12-18 18:49 ` [PATCH v1 03/15] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning Kun Qin
2020-12-28  0:14   ` Yao, Jiewen
2020-12-28  4:07     ` Kun Qin
2020-12-18 18:50 ` [PATCH v1 04/15] StandaloneMmPkg: StandaloneMmMemLib: Extends support for X64 architecture Kun Qin
2020-12-28  0:18   ` Yao, Jiewen
2020-12-28  4:15     ` Kun Qin
2020-12-28  6:24       ` Yao, Jiewen
2020-12-28  6:36         ` Kun Qin
2020-12-28  6:37           ` [edk2-devel] " Yao, Jiewen
2020-12-18 18:50 ` [PATCH v1 05/15] MdeModulePkg: SmmLockBoxSmmLib: Support StandaloneMm for SmmLockBoxLib Kun Qin
2020-12-22  8:35   ` [edk2-devel] " Wu, Hao A
2020-12-18 18:50 ` [PATCH v1 06/15] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm Kun Qin
2020-12-22  8:35   ` [edk2-devel] " Wu, Hao A
2020-12-22 19:15     ` Kun Qin
2020-12-23  6:09       ` Wu, Hao A
2020-12-24  1:53         ` 回复: " gaoliming
2020-12-24  9:11           ` Kun Qin
2020-12-29  1:23             ` 回复: " gaoliming
2020-12-29  1:31               ` Kun Qin
2020-12-18 18:50 ` [PATCH v1 07/15] MdeModulePkg: FirmwarePerformanceDataTable: Added StandaloneMm support Kun Qin
2020-12-22  8:36   ` Wu, Hao A
2020-12-22 20:06     ` [edk2-devel] " Kun Qin
2020-12-18 18:50 ` [PATCH v1 08/15] MdeModulePkg: ReportStatusCodeRouter: Support StandaloneMm RSC Router Kun Qin
2020-12-22  8:42   ` Wu, Hao A
2020-12-18 18:50 ` [PATCH v1 09/15] MdePkg: UefiDevicePathLib: Support UefiDevicePathLib under StandaloneMm Kun Qin
2021-01-04 18:32   ` [edk2-devel] " Kun Qin
2021-01-05 13:25     ` 回复: " gaoliming
2020-12-18 18:50 ` [PATCH v1 10/15] PcAtChipsetPkg: AcpiTimerLib: Added StandaloneMm instance of AcpiTimerLib Kun Qin
2021-01-04 18:30   ` [edk2-devel] " Kun Qin
2020-12-18 18:50 ` [PATCH v1 11/15] SecurityPkg: Tcg2PhysicalPresenceLib: Introduce StandaloneMm instance Kun Qin
2020-12-28  0:08   ` Yao, Jiewen
2020-12-18 18:50 ` [PATCH v1 12/15] SecurityPkg: Tcg2PpVendorLibNull: Added support for MM_STANDALONE type Kun Qin
2020-12-28  0:08   ` Yao, Jiewen
2020-12-18 18:50 ` [PATCH v1 13/15] SecurityPkg: Tpm2DeviceLibDTpm: Introduce StandaloneMm instance Kun Qin
2020-12-28  0:08   ` Yao, Jiewen
2020-12-18 18:50 ` [PATCH v1 14/15] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm Kun Qin
2021-01-04 18:31   ` [edk2-devel] " Kun Qin
2020-12-18 18:50 ` [PATCH v1 15/15] UefiCpuPkg: SmmCpuExceptionHandlerLib: Added StandaloneMm module support Kun Qin
2021-01-04 18:30   ` [edk2-devel] " Kun Qin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR11MB1288F5E6BFD56F4A00CA33EA8CD90@CY4PR11MB1288.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox