* [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list [not found] <20210114223400.2596-1-kun.q@outlook.com> @ 2021-01-14 22:33 ` Kun Qin 2021-01-14 22:33 ` [PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 Kun Qin ` (4 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: Kun Qin @ 2021-01-14 22:33 UTC (permalink / raw) To: devel; +Cc: Bob Feng, Liming Gao, Yuwei Chen Function '_ModuleEntryPoint' is a pre-defined interface for various EFI module types and should not be caught violating EFI coding style. This change added '_ModuleEntryPoint' into exception list to fix EFI coding style error 8006 during CI build. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Kun Qin <kun.q@outlook.com> --- Notes: v3: - Newly added to fix CI build on changing '_ModuleEntryPoint' BaseTools/Source/Python/Ecc/exception.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/exception.xml b/BaseTools/Source/Python/Ecc/exception.xml index 8133904fbc7f..f2334aab8e52 100644 --- a/BaseTools/Source/Python/Ecc/exception.xml +++ b/BaseTools/Source/Python/Ecc/exception.xml @@ -296,6 +296,10 @@ <KeyWord>_DriverUnloadHandler</KeyWord> <ErrorID>8006</ErrorID> </Exception> + <Exception> + <KeyWord>_ModuleEntryPoint</KeyWord> + <ErrorID>8006</ErrorID> + </Exception> <Exception> <KeyWord>ASSERT</KeyWord> <ErrorID>10015</ErrorID> -- 2.30.0.windows.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 [not found] <20210114223400.2596-1-kun.q@outlook.com> 2021-01-14 22:33 ` [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Kun Qin @ 2021-01-14 22:33 ` Kun Qin 2021-01-14 22:33 ` [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Kun Qin ` (3 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: Kun Qin @ 2021-01-14 22:33 UTC (permalink / raw) To: devel Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh, Jiewen Yao This change extends StandaloneMmCoreEntryPoint library to support X64 architecture. 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> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> --- Notes: v3: - Reviewed previously. No change. v2: - Added Reviewed-by tag [Jiewen] StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/X64/StandaloneMmCoreEntryPoint.c | 71 ++++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf | 3 + 2 files changed, 74 insertions(+) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/X64/StandaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/X64/StandaloneMmCoreEntryPoint.c new file mode 100644 index 000000000000..dffa965b8425 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/X64/StandaloneMmCoreEntryPoint.c @@ -0,0 +1,71 @@ +/** @file + Entry point to the Standalone Mm Core. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include <PiMm.h> + +#include <Library/StandaloneMmCoreEntryPoint.h> +#include <Library/DebugLib.h> +#include <Library/BaseLib.h> + +// +// Cache copy of HobList pointer. +// +VOID *gHobList = NULL; + +/** + The entry point of PE/COFF Image for the STANDALONE MM Core. + + This function is the entry point for the STANDALONE MM Core. This function is required to call + ProcessModuleEntryPointList() and ProcessModuleEntryPointList() is never expected to return. + The STANDALONE MM Core is responsible for calling ProcessLibraryConstructorList() as soon as the EFI + System Table and the image handle for the STANDALONE MM Core itself have been established. + If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system. + + @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase. + +**/ +VOID +EFIAPI +_ModuleEntryPoint ( + IN VOID *HobStart + ) +{ + // + // Cache a pointer to the HobList + // + gHobList = HobStart; + + // + // Call the Standalone MM Core entry point + // + ProcessModuleEntryPointList (HobStart); + + // + // TODO: Set page table here?? AARCH64 has this step for some reason + // +} + + +/** + Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). + + This function is required to call _ModuleEntryPoint() passing in HobStart. + + @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase. + +**/ +VOID +EFIAPI +EfiMain ( + IN VOID *HobStart + ) +{ + _ModuleEntryPoint (HobStart); +} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf index 75a654b06d51..313bc6f7bdad 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf @@ -26,6 +26,9 @@ [Sources.AARCH64] AArch64/SetPermissions.c AArch64/CreateHobList.c +[Sources.X64] + X64/StandaloneMmCoreEntryPoint.c + [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec -- 2.30.0.windows.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core [not found] <20210114223400.2596-1-kun.q@outlook.com> 2021-01-14 22:33 ` [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Kun Qin 2021-01-14 22:33 ` [PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 Kun Qin @ 2021-01-14 22:33 ` Kun Qin 2021-01-14 22:33 ` [PATCH v3 04/18] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning Kun Qin ` (2 subsequent siblings) 5 siblings, 0 replies; 11+ messages in thread From: Kun Qin @ 2021-01-14 22:33 UTC (permalink / raw) To: devel; +Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh This change adds support of x64 version of StandaloneMmCoreHobLib. It brings in global variable "gHobList" through StandaloneMmCoreEntryPoint, imports implementation from DxeCoreHobLib.inf to support x64 Mm Core and moved shared functional plementations into a common file. 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> --- Notes: v3: - Pertains gHobList for AARCH64 instance. v2: - Moved common function implementations into Common.c [Jiewen] StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ => AArch64}/StandaloneMmCoreHobLib.c | 272 ------------------ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c | 291 +++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c | 298 ++++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf | 11 +- 4 files changed, 597 insertions(+), 275 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c similarity index 55% rename from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c rename to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c index e3d4743b63f2..0ec2d4ad6f6b 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c @@ -21,188 +21,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // VOID *gHobList = NULL; -/** - Returns the pointer to the HOB list. - - This function returns the pointer to first HOB in the list. - If the pointer to the HOB list is NULL, then ASSERT(). - - @return The pointer to the HOB list. - -**/ -VOID * -EFIAPI -GetHobList ( - VOID - ) -{ - ASSERT (gHobList != NULL); - return gHobList; -} - -/** - Returns the next instance of a HOB type from the starting HOB. - - This function searches the first instance of a HOB type from the starting HOB pointer. - If there does not exist such HOB type from the starting HOB pointer, it will return NULL. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If HobStart is NULL, then ASSERT(). - - @param Type The HOB type to return. - @param HobStart The starting HOB pointer to search from. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextHob ( - IN UINT16 Type, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS Hob; - - ASSERT (HobStart != NULL); - - Hob.Raw = (UINT8 *) HobStart; - // - // Parse the HOB list until end of list or matching type is found. - // - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == Type) { - return Hob.Raw; - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - return NULL; -} - -/** - Returns the first instance of a HOB type among the whole HOB list. - - This function searches the first instance of a HOB type among the whole HOB list. - If there does not exist such HOB type in the HOB list, it will return NULL. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param Type The HOB type to return. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetFirstHob ( - IN UINT16 Type - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextHob (Type, HobList); -} - -/** - Returns the next instance of the matched GUID HOB from the starting HOB. - - This function searches the first instance of a HOB from the starting HOB pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If Guid is NULL, then ASSERT(). - If HobStart is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - @param HobStart A pointer to a Guid. - - @return The next instance of the matched GUID HOB from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextGuidHob ( - IN CONST EFI_GUID *Guid, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS GuidHob; - - GuidHob.Raw = (UINT8 *) HobStart; - while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) { - if (CompareGuid (Guid, &GuidHob.Guid->Name)) { - break; - } - GuidHob.Raw = GET_NEXT_HOB (GuidHob); - } - return GuidHob.Raw; -} - -/** - Returns the first instance of the matched GUID HOB among the whole HOB list. - - This function searches the first instance of a HOB among the whole HOB list. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - - If the pointer to the HOB list is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - - @return The first instance of the matched GUID HOB among the whole HOB list. - -**/ -VOID * -EFIAPI -GetFirstGuidHob ( - IN CONST EFI_GUID *Guid - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextGuidHob (Guid, HobList); -} - -/** - Get the system boot mode from the HOB list. - - This function returns the system boot mode information from the - PHIT HOB in HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param VOID - - @return The Boot Mode. - -**/ -EFI_BOOT_MODE -EFIAPI -GetBootModeHob ( - VOID - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - - HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); - - return HandOffHob->BootMode; -} - VOID * CreateHob ( IN UINT16 HobType, @@ -510,93 +328,3 @@ BuildMemoryAllocationHob ( // 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); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the Stack. - @param Length The length of the stack in bytes. - -**/ -VOID -EFIAPI -BuildStackHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - ASSERT (FALSE); -} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c new file mode 100644 index 000000000000..8c535032315a --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c @@ -0,0 +1,291 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiMm.h> + +#include <Library/HobLib.h> +#include <Library/DebugLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/StandaloneMmCoreEntryPoint.h> + +#include <Guid/MemoryAllocationHob.h> + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + If the pointer to the HOB list is NULL, then ASSERT(). + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +GetHobList ( + VOID + ) +{ + ASSERT (gHobList != NULL); + return gHobList; +} + +/** + Returns the next instance of a HOB type from the starting HOB. + + This function searches the first instance of a HOB type from the starting HOB pointer. + If there does not exist such HOB type from the starting HOB pointer, it will return NULL. + In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. + + If HobStart is NULL, then ASSERT(). + + @param Type The HOB type to return. + @param HobStart The starting HOB pointer to search from. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextHob ( + IN UINT16 Type, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS Hob; + + ASSERT (HobStart != NULL); + + Hob.Raw = (UINT8 *) HobStart; + // + // Parse the HOB list until end of list or matching type is found. + // + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType == Type) { + return Hob.Raw; + } + Hob.Raw = GET_NEXT_HOB (Hob); + } + return NULL; +} + +/** + Returns the first instance of a HOB type among the whole HOB list. + + This function searches the first instance of a HOB type among the whole HOB list. + If there does not exist such HOB type in the HOB list, it will return NULL. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param Type The HOB type to return. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetFirstHob ( + IN UINT16 Type + ) +{ + VOID *HobList; + + HobList = GetHobList (); + return GetNextHob (Type, HobList); +} + +/** + Returns the next instance of the matched GUID HOB from the starting HOB. + + This function searches the first instance of a HOB from the starting HOB pointer. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () + to extract the data section and its size information, respectively. + In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. + + If Guid is NULL, then ASSERT(). + If HobStart is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + @param HobStart A pointer to a Guid. + + @return The next instance of the matched GUID HOB from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextGuidHob ( + IN CONST EFI_GUID *Guid, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS GuidHob; + + GuidHob.Raw = (UINT8 *) HobStart; + while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) { + if (CompareGuid (Guid, &GuidHob.Guid->Name)) { + break; + } + GuidHob.Raw = GET_NEXT_HOB (GuidHob); + } + return GuidHob.Raw; +} + +/** + Returns the first instance of the matched GUID HOB among the whole HOB list. + + This function searches the first instance of a HOB among the whole HOB list. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () + to extract the data section and its size information, respectively. + + If the pointer to the HOB list is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + + @return The first instance of the matched GUID HOB among the whole HOB list. + +**/ +VOID * +EFIAPI +GetFirstGuidHob ( + IN CONST EFI_GUID *Guid + ) +{ + VOID *HobList; + + HobList = GetHobList (); + return GetNextGuidHob (Guid, HobList); +} + +/** + Get the system boot mode from the HOB list. + + This function returns the system boot mode information from the + PHIT HOB in HOB list. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param VOID + + @return The Boot Mode. + +**/ +EFI_BOOT_MODE +EFIAPI +GetBootModeHob ( + VOID + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); + + return HandOffHob->BootMode; +} + + +/** + 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); +} + +/** + Builds a HOB for the Stack. + + This function builds a HOB for the stack. + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the Stack. + @param Length The length of the stack in bytes. + +**/ +VOID +EFIAPI +BuildStackHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + ASSERT (FALSE); +} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c new file mode 100644 index 000000000000..61afe8706486 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c @@ -0,0 +1,298 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiMm.h> + +#include <Library/HobLib.h> +#include <Library/DebugLib.h> +#include <Library/BaseMemoryLib.h> + +#include <Guid/MemoryAllocationHob.h> + +/** + 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(). + + @param ModuleName The GUID File Name of the module. + @param MemoryAllocationModule The 64 bit physical address of the module. + @param ModuleLength The length of the module in bytes. + @param EntryPoint The 64 bit physical address of the module entry point. + +**/ +VOID +EFIAPI +BuildModuleHob ( + IN CONST EFI_GUID *ModuleName, + IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, + IN UINT64 ModuleLength, + IN EFI_PHYSICAL_ADDRESS EntryPoint + ) +{ + // + // PEI HOB is read only for MM phase + // + 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. + @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. + +**/ +VOID +EFIAPI +BuildResourceDescriptorHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + 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 > (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. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidHob ( + IN CONST EFI_GUID *Guid, + IN UINTN DataLength + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); + return NULL; +} + +/** + 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 > (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. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidDataHob ( + IN CONST EFI_GUID *Guid, + IN VOID *Data, + IN UINTN 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. + +**/ +VOID +EFIAPI +BuildFvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 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 FileName The name of the file. + +**/ +VOID +EFIAPI +BuildFv2Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN CONST EFI_GUID *FvName, + IN CONST EFI_GUID *FileName + ) +{ + 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. + + 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 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 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. + @param SizeOfIoSpace The maximum physical I/O addressability of the processor. + +**/ +VOID +EFIAPI +BuildCpuHob ( + IN UINT8 SizeOfMemorySpace, + IN UINT8 SizeOfIoSpace + ) +{ + // + // 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..a2559920e887 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf @@ -22,16 +22,21 @@ [Defines] LIBRARY_CLASS = HobLib|MM_CORE_STANDALONE # -# VALID_ARCHITECTURES = AARCH64 +# VALID_ARCHITECTURES = X64 AARCH64 # -[Sources.Common] - StandaloneMmCoreHobLib.c +[Sources.common] + Common.c + +[Sources.X64] + X64/StandaloneMmCoreHobLib.c [Sources.AARCH64] + AArch64/StandaloneMmCoreHobLib.c AArch64/StandaloneMmCoreHobLibInternal.c [Packages] MdePkg/MdePkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec [LibraryClasses] -- 2.30.0.windows.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 04/18] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning [not found] <20210114223400.2596-1-kun.q@outlook.com> ` (2 preceding siblings ...) 2021-01-14 22:33 ` [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Kun Qin @ 2021-01-14 22:33 ` Kun Qin [not found] ` <165A3A1108D15505.7065@groups.io> [not found] ` <165A3A10BD6EE08F.30138@groups.io> 5 siblings, 0 replies; 11+ messages in thread From: Kun Qin @ 2021-01-14 22:33 UTC (permalink / raw) To: devel Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh, Jiewen Yao Assigning MmramRangeCount from MmCorePrivate (UINT64) to local variable MmramRangeCount (UINT32) will cause compilation failure due to "warning C4244: '=': conversion from 'UINT64' to 'UINT32', possible loss of data". This changes defines local MmramRangeCount as UINTN type and adds type cast before value assignment. 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> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> --- Notes: v3: - Added reviewed-by tag [Jiewen] v2: - Changed variable type to UINTN and cast before assignments [Jiewen] StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c index 8fbd4d934784..ba5470dd7156 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c @@ -841,7 +841,7 @@ MemoryAllocationLibConstructor ( VOID *HobStart; EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData; EFI_MMRAM_DESCRIPTOR *MmramRanges; - UINT32 MmramRangeCount; + UINTN MmramRangeCount; EFI_HOB_GUID_TYPE *MmramRangesHob; HobStart = GetHobList (); @@ -868,7 +868,7 @@ MemoryAllocationLibConstructor ( return EFI_UNSUPPORTED; } - MmramRangeCount = MmramRangesHobData->NumberOfMmReservedRegions; + MmramRangeCount = (UINTN) MmramRangesHobData->NumberOfMmReservedRegions; if (MmramRanges == NULL) { return EFI_UNSUPPORTED; } @@ -877,7 +877,7 @@ MemoryAllocationLibConstructor ( DataInHob = GET_GUID_HOB_DATA (GuidHob); MmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address; MmramRanges = (EFI_MMRAM_DESCRIPTOR *)(UINTN)MmCorePrivate->MmramRanges; - MmramRangeCount = MmCorePrivate->MmramRangeCount; + MmramRangeCount = (UINTN) MmCorePrivate->MmramRangeCount; } { -- 2.30.0.windows.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <165A3A1108D15505.7065@groups.io>]
* Re: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core [not found] ` <165A3A1108D15505.7065@groups.io> @ 2021-01-21 1:34 ` Kun Qin 2021-01-26 12:39 ` Yao, Jiewen 0 siblings, 1 reply; 11+ messages in thread From: Kun Qin @ 2021-01-21 1:34 UTC (permalink / raw) To: devel@edk2.groups.io, Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh [-- Attachment #1: Type: text/plain, Size: 30256 bytes --] Hi Jiewen/Ard/Sami/Supreeth, I updated this patch in v2 to centralize common implementations for certain library functions. Do you by any chance have more comments on this patch? Any input is appreciated. Regards, Kun From: Kun Qin<mailto:kun.q@outlook.com> Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Ard Biesheuvel<mailto:ard.biesheuvel@arm.com>; Sami Mujawar<mailto:sami.mujawar@arm.com>; Jiewen Yao<mailto:jiewen.yao@intel.com>; Supreeth Venkatesh<mailto:supreeth.venkatesh@arm.com> Subject: [edk2-devel] [PATCH v3 03/18] 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, imports implementation from DxeCoreHobLib.inf to support x64 Mm Core and moved shared functional plementations into a common file. 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> --- Notes: v3: - Pertains gHobList for AARCH64 instance. v2: - Moved common function implementations into Common.c [Jiewen] StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ => AArch64}/StandaloneMmCoreHobLib.c | 272 ------------------ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c | 291 +++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c | 298 ++++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf | 11 +- 4 files changed, 597 insertions(+), 275 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c similarity index 55% rename from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c rename to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c index e3d4743b63f2..0ec2d4ad6f6b 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c @@ -21,188 +21,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // VOID *gHobList = NULL; -/** - Returns the pointer to the HOB list. - - This function returns the pointer to first HOB in the list. - If the pointer to the HOB list is NULL, then ASSERT(). - - @return The pointer to the HOB list. - -**/ -VOID * -EFIAPI -GetHobList ( - VOID - ) -{ - ASSERT (gHobList != NULL); - return gHobList; -} - -/** - Returns the next instance of a HOB type from the starting HOB. - - This function searches the first instance of a HOB type from the starting HOB pointer. - If there does not exist such HOB type from the starting HOB pointer, it will return NULL. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If HobStart is NULL, then ASSERT(). - - @param Type The HOB type to return. - @param HobStart The starting HOB pointer to search from. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextHob ( - IN UINT16 Type, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS Hob; - - ASSERT (HobStart != NULL); - - Hob.Raw = (UINT8 *) HobStart; - // - // Parse the HOB list until end of list or matching type is found. - // - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == Type) { - return Hob.Raw; - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - return NULL; -} - -/** - Returns the first instance of a HOB type among the whole HOB list. - - This function searches the first instance of a HOB type among the whole HOB list. - If there does not exist such HOB type in the HOB list, it will return NULL. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param Type The HOB type to return. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetFirstHob ( - IN UINT16 Type - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextHob (Type, HobList); -} - -/** - Returns the next instance of the matched GUID HOB from the starting HOB. - - This function searches the first instance of a HOB from the starting HOB pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If Guid is NULL, then ASSERT(). - If HobStart is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - @param HobStart A pointer to a Guid. - - @return The next instance of the matched GUID HOB from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextGuidHob ( - IN CONST EFI_GUID *Guid, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS GuidHob; - - GuidHob.Raw = (UINT8 *) HobStart; - while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) { - if (CompareGuid (Guid, &GuidHob.Guid->Name)) { - break; - } - GuidHob.Raw = GET_NEXT_HOB (GuidHob); - } - return GuidHob.Raw; -} - -/** - Returns the first instance of the matched GUID HOB among the whole HOB list. - - This function searches the first instance of a HOB among the whole HOB list. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - - If the pointer to the HOB list is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - - @return The first instance of the matched GUID HOB among the whole HOB list. - -**/ -VOID * -EFIAPI -GetFirstGuidHob ( - IN CONST EFI_GUID *Guid - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextGuidHob (Guid, HobList); -} - -/** - Get the system boot mode from the HOB list. - - This function returns the system boot mode information from the - PHIT HOB in HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param VOID - - @return The Boot Mode. - -**/ -EFI_BOOT_MODE -EFIAPI -GetBootModeHob ( - VOID - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - - HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); - - return HandOffHob->BootMode; -} - VOID * CreateHob ( IN UINT16 HobType, @@ -510,93 +328,3 @@ BuildMemoryAllocationHob ( // 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); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the Stack. - @param Length The length of the stack in bytes. - -**/ -VOID -EFIAPI -BuildStackHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - ASSERT (FALSE); -} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c new file mode 100644 index 000000000000..8c535032315a --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c @@ -0,0 +1,291 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiMm.h> + +#include <Library/HobLib.h> +#include <Library/DebugLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/StandaloneMmCoreEntryPoint.h> + +#include <Guid/MemoryAllocationHob.h> + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + If the pointer to the HOB list is NULL, then ASSERT(). + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +GetHobList ( + VOID + ) +{ + ASSERT (gHobList != NULL); + return gHobList; +} + +/** + Returns the next instance of a HOB type from the starting HOB. + + This function searches the first instance of a HOB type from the starting HOB pointer. + If there does not exist such HOB type from the starting HOB pointer, it will return NULL. + In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. + + If HobStart is NULL, then ASSERT(). + + @param Type The HOB type to return. + @param HobStart The starting HOB pointer to search from. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextHob ( + IN UINT16 Type, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS Hob; + + ASSERT (HobStart != NULL); + + Hob.Raw = (UINT8 *) HobStart; + // + // Parse the HOB list until end of list or matching type is found. + // + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType == Type) { + return Hob.Raw; + } + Hob.Raw = GET_NEXT_HOB (Hob); + } + return NULL; +} + +/** + Returns the first instance of a HOB type among the whole HOB list. + + This function searches the first instance of a HOB type among the whole HOB list. + If there does not exist such HOB type in the HOB list, it will return NULL. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param Type The HOB type to return. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetFirstHob ( + IN UINT16 Type + ) +{ + VOID *HobList; + + HobList = GetHobList (); + return GetNextHob (Type, HobList); +} + +/** + Returns the next instance of the matched GUID HOB from the starting HOB. + + This function searches the first instance of a HOB from the starting HOB pointer. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () + to extract the data section and its size information, respectively. + In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. + + If Guid is NULL, then ASSERT(). + If HobStart is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + @param HobStart A pointer to a Guid. + + @return The next instance of the matched GUID HOB from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextGuidHob ( + IN CONST EFI_GUID *Guid, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS GuidHob; + + GuidHob.Raw = (UINT8 *) HobStart; + while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) { + if (CompareGuid (Guid, &GuidHob.Guid->Name)) { + break; + } + GuidHob.Raw = GET_NEXT_HOB (GuidHob); + } + return GuidHob.Raw; +} + +/** + Returns the first instance of the matched GUID HOB among the whole HOB list. + + This function searches the first instance of a HOB among the whole HOB list. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () + to extract the data section and its size information, respectively. + + If the pointer to the HOB list is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + + @return The first instance of the matched GUID HOB among the whole HOB list. + +**/ +VOID * +EFIAPI +GetFirstGuidHob ( + IN CONST EFI_GUID *Guid + ) +{ + VOID *HobList; + + HobList = GetHobList (); + return GetNextGuidHob (Guid, HobList); +} + +/** + Get the system boot mode from the HOB list. + + This function returns the system boot mode information from the + PHIT HOB in HOB list. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param VOID + + @return The Boot Mode. + +**/ +EFI_BOOT_MODE +EFIAPI +GetBootModeHob ( + VOID + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); + + return HandOffHob->BootMode; +} + + +/** + 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); +} + +/** + Builds a HOB for the Stack. + + This function builds a HOB for the stack. + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the Stack. + @param Length The length of the stack in bytes. + +**/ +VOID +EFIAPI +BuildStackHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + ASSERT (FALSE); +} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c new file mode 100644 index 000000000000..61afe8706486 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c @@ -0,0 +1,298 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiMm.h> + +#include <Library/HobLib.h> +#include <Library/DebugLib.h> +#include <Library/BaseMemoryLib.h> + +#include <Guid/MemoryAllocationHob.h> + +/** + 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(). + + @param ModuleName The GUID File Name of the module. + @param MemoryAllocationModule The 64 bit physical address of the module. + @param ModuleLength The length of the module in bytes. + @param EntryPoint The 64 bit physical address of the module entry point. + +**/ +VOID +EFIAPI +BuildModuleHob ( + IN CONST EFI_GUID *ModuleName, + IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, + IN UINT64 ModuleLength, + IN EFI_PHYSICAL_ADDRESS EntryPoint + ) +{ + // + // PEI HOB is read only for MM phase + // + 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. + @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. + +**/ +VOID +EFIAPI +BuildResourceDescriptorHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + 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 > (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. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidHob ( + IN CONST EFI_GUID *Guid, + IN UINTN DataLength + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); + return NULL; +} + +/** + 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 > (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. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidDataHob ( + IN CONST EFI_GUID *Guid, + IN VOID *Data, + IN UINTN 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. + +**/ +VOID +EFIAPI +BuildFvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 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 FileName The name of the file. + +**/ +VOID +EFIAPI +BuildFv2Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN CONST EFI_GUID *FvName, + IN CONST EFI_GUID *FileName + ) +{ + 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. + + 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 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 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. + @param SizeOfIoSpace The maximum physical I/O addressability of the processor. + +**/ +VOID +EFIAPI +BuildCpuHob ( + IN UINT8 SizeOfMemorySpace, + IN UINT8 SizeOfIoSpace + ) +{ + // + // 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..a2559920e887 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf @@ -22,16 +22,21 @@ [Defines] LIBRARY_CLASS = HobLib|MM_CORE_STANDALONE # -# VALID_ARCHITECTURES = AARCH64 +# VALID_ARCHITECTURES = X64 AARCH64 # -[Sources.Common] - StandaloneMmCoreHobLib.c +[Sources.common] + Common.c + +[Sources.X64] + X64/StandaloneMmCoreHobLib.c [Sources.AARCH64] + AArch64/StandaloneMmCoreHobLib.c AArch64/StandaloneMmCoreHobLibInternal.c [Packages] MdePkg/MdePkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec [LibraryClasses] -- 2.30.0.windows.1 [-- Attachment #2: Type: text/html, Size: 47504 bytes --] ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core 2021-01-21 1:34 ` [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Kun Qin @ 2021-01-26 12:39 ` Yao, Jiewen 0 siblings, 0 replies; 11+ messages in thread From: Yao, Jiewen @ 2021-01-26 12:39 UTC (permalink / raw) To: devel@edk2.groups.io, kun.q@outlook.com, Ard Biesheuvel, Sami Mujawar, Supreeth Venkatesh [-- Attachment #1: Type: text/plain, Size: 30877 bytes --] Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kun Qin Sent: Thursday, January 21, 2021 9:35 AM To: devel@edk2.groups.io; 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: Re: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Hi Jiewen/Ard/Sami/Supreeth, I updated this patch in v2 to centralize common implementations for certain library functions. Do you by any chance have more comments on this patch? Any input is appreciated. Regards, Kun From: Kun Qin<mailto:kun.q@outlook.com> Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Ard Biesheuvel<mailto:ard.biesheuvel@arm.com>; Sami Mujawar<mailto:sami.mujawar@arm.com>; Jiewen Yao<mailto:jiewen.yao@intel.com>; Supreeth Venkatesh<mailto:supreeth.venkatesh@arm.com> Subject: [edk2-devel] [PATCH v3 03/18] 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, imports implementation from DxeCoreHobLib.inf to support x64 Mm Core and moved shared functional plementations into a common file. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com<mailto:ard.biesheuvel@arm.com>> Cc: Sami Mujawar <sami.mujawar@arm.com<mailto:sami.mujawar@arm.com>> Cc: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com<mailto:supreeth.venkatesh@arm.com>> Signed-off-by: Kun Qin <kun.q@outlook.com<mailto:kun.q@outlook.com>> --- Notes: v3: - Pertains gHobList for AARCH64 instance. v2: - Moved common function implementations into Common.c [Jiewen] StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ => AArch64}/StandaloneMmCoreHobLib.c | 272 ------------------ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c | 291 +++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c | 298 ++++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf | 11 +- 4 files changed, 597 insertions(+), 275 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c similarity index 55% rename from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c rename to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c index e3d4743b63f2..0ec2d4ad6f6b 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c @@ -21,188 +21,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // VOID *gHobList = NULL; -/** - Returns the pointer to the HOB list. - - This function returns the pointer to first HOB in the list. - If the pointer to the HOB list is NULL, then ASSERT(). - - @return The pointer to the HOB list. - -**/ -VOID * -EFIAPI -GetHobList ( - VOID - ) -{ - ASSERT (gHobList != NULL); - return gHobList; -} - -/** - Returns the next instance of a HOB type from the starting HOB. - - This function searches the first instance of a HOB type from the starting HOB pointer. - If there does not exist such HOB type from the starting HOB pointer, it will return NULL. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If HobStart is NULL, then ASSERT(). - - @param Type The HOB type to return. - @param HobStart The starting HOB pointer to search from. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextHob ( - IN UINT16 Type, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS Hob; - - ASSERT (HobStart != NULL); - - Hob.Raw = (UINT8 *) HobStart; - // - // Parse the HOB list until end of list or matching type is found. - // - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType == Type) { - return Hob.Raw; - } - Hob.Raw = GET_NEXT_HOB (Hob); - } - return NULL; -} - -/** - Returns the first instance of a HOB type among the whole HOB list. - - This function searches the first instance of a HOB type among the whole HOB list. - If there does not exist such HOB type in the HOB list, it will return NULL. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param Type The HOB type to return. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetFirstHob ( - IN UINT16 Type - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextHob (Type, HobList); -} - -/** - Returns the next instance of the matched GUID HOB from the starting HOB. - - This function searches the first instance of a HOB from the starting HOB pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. - - If Guid is NULL, then ASSERT(). - If HobStart is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - @param HobStart A pointer to a Guid. - - @return The next instance of the matched GUID HOB from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextGuidHob ( - IN CONST EFI_GUID *Guid, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS GuidHob; - - GuidHob.Raw = (UINT8 *) HobStart; - while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) { - if (CompareGuid (Guid, &GuidHob.Guid->Name)) { - break; - } - GuidHob.Raw = GET_NEXT_HOB (GuidHob); - } - return GuidHob.Raw; -} - -/** - Returns the first instance of the matched GUID HOB among the whole HOB list. - - This function searches the first instance of a HOB among the whole HOB list. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will return NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () - to extract the data section and its size information, respectively. - - If the pointer to the HOB list is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - - @return The first instance of the matched GUID HOB among the whole HOB list. - -**/ -VOID * -EFIAPI -GetFirstGuidHob ( - IN CONST EFI_GUID *Guid - ) -{ - VOID *HobList; - - HobList = GetHobList (); - return GetNextGuidHob (Guid, HobList); -} - -/** - Get the system boot mode from the HOB list. - - This function returns the system boot mode information from the - PHIT HOB in HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param VOID - - @return The Boot Mode. - -**/ -EFI_BOOT_MODE -EFIAPI -GetBootModeHob ( - VOID - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - - HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); - - return HandOffHob->BootMode; -} - VOID * CreateHob ( IN UINT16 HobType, @@ -510,93 +328,3 @@ BuildMemoryAllocationHob ( // 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); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the Stack. - @param Length The length of the stack in bytes. - -**/ -VOID -EFIAPI -BuildStackHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - ASSERT (FALSE); -} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c new file mode 100644 index 000000000000..8c535032315a --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c @@ -0,0 +1,291 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiMm.h> + +#include <Library/HobLib.h> +#include <Library/DebugLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/StandaloneMmCoreEntryPoint.h> + +#include <Guid/MemoryAllocationHob.h> + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + If the pointer to the HOB list is NULL, then ASSERT(). + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +GetHobList ( + VOID + ) +{ + ASSERT (gHobList != NULL); + return gHobList; +} + +/** + Returns the next instance of a HOB type from the starting HOB. + + This function searches the first instance of a HOB type from the starting HOB pointer. + If there does not exist such HOB type from the starting HOB pointer, it will return NULL. + In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. + + If HobStart is NULL, then ASSERT(). + + @param Type The HOB type to return. + @param HobStart The starting HOB pointer to search from. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextHob ( + IN UINT16 Type, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS Hob; + + ASSERT (HobStart != NULL); + + Hob.Raw = (UINT8 *) HobStart; + // + // Parse the HOB list until end of list or matching type is found. + // + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType == Type) { + return Hob.Raw; + } + Hob.Raw = GET_NEXT_HOB (Hob); + } + return NULL; +} + +/** + Returns the first instance of a HOB type among the whole HOB list. + + This function searches the first instance of a HOB type among the whole HOB list. + If there does not exist such HOB type in the HOB list, it will return NULL. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param Type The HOB type to return. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetFirstHob ( + IN UINT16 Type + ) +{ + VOID *HobList; + + HobList = GetHobList (); + return GetNextHob (Type, HobList); +} + +/** + Returns the next instance of the matched GUID HOB from the starting HOB. + + This function searches the first instance of a HOB from the starting HOB pointer. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () + to extract the data section and its size information, respectively. + In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart. + + If Guid is NULL, then ASSERT(). + If HobStart is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + @param HobStart A pointer to a Guid. + + @return The next instance of the matched GUID HOB from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextGuidHob ( + IN CONST EFI_GUID *Guid, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS GuidHob; + + GuidHob.Raw = (UINT8 *) HobStart; + while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) { + if (CompareGuid (Guid, &GuidHob.Guid->Name)) { + break; + } + GuidHob.Raw = GET_NEXT_HOB (GuidHob); + } + return GuidHob.Raw; +} + +/** + Returns the first instance of the matched GUID HOB among the whole HOB list. + + This function searches the first instance of a HOB among the whole HOB list. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will return NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () + to extract the data section and its size information, respectively. + + If the pointer to the HOB list is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + + @return The first instance of the matched GUID HOB among the whole HOB list. + +**/ +VOID * +EFIAPI +GetFirstGuidHob ( + IN CONST EFI_GUID *Guid + ) +{ + VOID *HobList; + + HobList = GetHobList (); + return GetNextGuidHob (Guid, HobList); +} + +/** + Get the system boot mode from the HOB list. + + This function returns the system boot mode information from the + PHIT HOB in HOB list. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param VOID + + @return The Boot Mode. + +**/ +EFI_BOOT_MODE +EFIAPI +GetBootModeHob ( + VOID + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); + + return HandOffHob->BootMode; +} + + +/** + 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); +} + +/** + Builds a HOB for the Stack. + + This function builds a HOB for the stack. + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the Stack. + @param Length The length of the stack in bytes. + +**/ +VOID +EFIAPI +BuildStackHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + ASSERT (FALSE); +} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c new file mode 100644 index 000000000000..61afe8706486 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c @@ -0,0 +1,298 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include <PiMm.h> + +#include <Library/HobLib.h> +#include <Library/DebugLib.h> +#include <Library/BaseMemoryLib.h> + +#include <Guid/MemoryAllocationHob.h> + +/** + 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(). + + @param ModuleName The GUID File Name of the module. + @param MemoryAllocationModule The 64 bit physical address of the module. + @param ModuleLength The length of the module in bytes. + @param EntryPoint The 64 bit physical address of the module entry point. + +**/ +VOID +EFIAPI +BuildModuleHob ( + IN CONST EFI_GUID *ModuleName, + IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, + IN UINT64 ModuleLength, + IN EFI_PHYSICAL_ADDRESS EntryPoint + ) +{ + // + // PEI HOB is read only for MM phase + // + 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. + @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. + +**/ +VOID +EFIAPI +BuildResourceDescriptorHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + 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 > (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. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidHob ( + IN CONST EFI_GUID *Guid, + IN UINTN DataLength + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); + return NULL; +} + +/** + 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 > (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. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidDataHob ( + IN CONST EFI_GUID *Guid, + IN VOID *Data, + IN UINTN 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. + +**/ +VOID +EFIAPI +BuildFvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 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 FileName The name of the file. + +**/ +VOID +EFIAPI +BuildFv2Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN CONST EFI_GUID *FvName, + IN CONST EFI_GUID *FileName + ) +{ + 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. + + 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 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 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. + @param SizeOfIoSpace The maximum physical I/O addressability of the processor. + +**/ +VOID +EFIAPI +BuildCpuHob ( + IN UINT8 SizeOfMemorySpace, + IN UINT8 SizeOfIoSpace + ) +{ + // + // 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..a2559920e887 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf @@ -22,16 +22,21 @@ [Defines] LIBRARY_CLASS = HobLib|MM_CORE_STANDALONE # -# VALID_ARCHITECTURES = AARCH64 +# VALID_ARCHITECTURES = X64 AARCH64 # -[Sources.Common] - StandaloneMmCoreHobLib.c +[Sources.common] + Common.c + +[Sources.X64] + X64/StandaloneMmCoreHobLib.c [Sources.AARCH64] + AArch64/StandaloneMmCoreHobLib.c AArch64/StandaloneMmCoreHobLibInternal.c [Packages] MdePkg/MdePkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec [LibraryClasses] -- 2.30.0.windows.1 [-- Attachment #2: Type: text/html, Size: 49187 bytes --] ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <165A3A10BD6EE08F.30138@groups.io>]
* Re: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list [not found] ` <165A3A10BD6EE08F.30138@groups.io> @ 2021-01-21 1:36 ` Kun Qin 2021-01-21 1:45 ` 回复: " gaoliming 0 siblings, 1 reply; 11+ messages in thread From: Kun Qin @ 2021-01-21 1:36 UTC (permalink / raw) To: devel@edk2.groups.io; +Cc: Bob Feng, Liming Gao, Yuwei Chen [-- Attachment #1: Type: text/plain, Size: 1779 bytes --] Hi Bob/Liming/Yuwei, Do you mind providing some feedback on this patch? This is to unblock the second patch (adding driver entry point instance for Standalone X64) of this patch series. Thanks in advance! Regards, Kun From: Kun Qin<mailto:kun.q@outlook.com> Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Bob Feng<mailto:bob.c.feng@intel.com>; Liming Gao<mailto:gaoliming@byosoft.com.cn>; Yuwei Chen<mailto:yuwei.chen@intel.com> Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Function '_ModuleEntryPoint' is a pre-defined interface for various EFI module types and should not be caught violating EFI coding style. This change added '_ModuleEntryPoint' into exception list to fix EFI coding style error 8006 during CI build. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Kun Qin <kun.q@outlook.com> --- Notes: v3: - Newly added to fix CI build on changing '_ModuleEntryPoint' BaseTools/Source/Python/Ecc/exception.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/exception.xml b/BaseTools/Source/Python/Ecc/exception.xml index 8133904fbc7f..f2334aab8e52 100644 --- a/BaseTools/Source/Python/Ecc/exception.xml +++ b/BaseTools/Source/Python/Ecc/exception.xml @@ -296,6 +296,10 @@ <KeyWord>_DriverUnloadHandler</KeyWord> <ErrorID>8006</ErrorID> </Exception> + <Exception> + <KeyWord>_ModuleEntryPoint</KeyWord> + <ErrorID>8006</ErrorID> + </Exception> <Exception> <KeyWord>ASSERT</KeyWord> <ErrorID>10015</ErrorID> -- 2.30.0.windows.1 [-- Attachment #2: Type: text/html, Size: 4155 bytes --] ^ permalink raw reply related [flat|nested] 11+ messages in thread
* 回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list 2021-01-21 1:36 ` [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Kun Qin @ 2021-01-21 1:45 ` gaoliming 2021-01-21 1:54 ` Kun Qin 0 siblings, 1 reply; 11+ messages in thread From: gaoliming @ 2021-01-21 1:45 UTC (permalink / raw) To: 'Kun Qin', devel; +Cc: 'Bob Feng', 'Yuwei Chen' [-- Attachment #1: Type: text/plain, Size: 2428 bytes --] Qin: This change makes sense. Can you let me know which case trigs this ECC issue? Does your patch include such case? Thanks Liming 发件人: Kun Qin <kun.q@outlook.com> 发送时间: 2021年1月21日 9:37 收件人: devel@edk2.groups.io 抄送: Bob Feng <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com> 主题: RE: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Hi Bob/Liming/Yuwei, Do you mind providing some feedback on this patch? This is to unblock the second patch (adding driver entry point instance for Standalone X64) of this patch series. Thanks in advance! Regards, Kun From: Kun Qin <mailto:kun.q@outlook.com> Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> Cc: Bob Feng <mailto:bob.c.feng@intel.com> ; Liming Gao <mailto:gaoliming@byosoft.com.cn> ; Yuwei Chen <mailto:yuwei.chen@intel.com> Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Function '_ModuleEntryPoint' is a pre-defined interface for various EFI module types and should not be caught violating EFI coding style. This change added '_ModuleEntryPoint' into exception list to fix EFI coding style error 8006 during CI build. Cc: Bob Feng <bob.c.feng@intel.com <mailto:bob.c.feng@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > Cc: Yuwei Chen <yuwei.chen@intel.com <mailto:yuwei.chen@intel.com> > Signed-off-by: Kun Qin <kun.q@outlook.com <mailto:kun.q@outlook.com> > --- Notes: v3: - Newly added to fix CI build on changing '_ModuleEntryPoint' BaseTools/Source/Python/Ecc/exception.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/exception.xml b/BaseTools/Source/Python/Ecc/exception.xml index 8133904fbc7f..f2334aab8e52 100644 --- a/BaseTools/Source/Python/Ecc/exception.xml +++ b/BaseTools/Source/Python/Ecc/exception.xml @@ -296,6 +296,10 @@ <KeyWord>_DriverUnloadHandler</KeyWord> <ErrorID>8006</ErrorID> </Exception> + <Exception> + <KeyWord>_ModuleEntryPoint</KeyWord> + <ErrorID>8006</ErrorID> + </Exception> <Exception> <KeyWord>ASSERT</KeyWord> <ErrorID>10015</ErrorID> -- 2.30.0.windows.1 [-- Attachment #2: Type: text/html, Size: 6637 bytes --] ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list 2021-01-21 1:45 ` 回复: " gaoliming @ 2021-01-21 1:54 ` Kun Qin 2021-01-22 0:27 ` 回复: " gaoliming 0 siblings, 1 reply; 11+ messages in thread From: Kun Qin @ 2021-01-21 1:54 UTC (permalink / raw) To: devel@edk2.groups.io, gaoliming@byosoft.com.cn Cc: 'Bob Feng', 'Yuwei Chen' [-- Attachment #1.1: Type: text/plain, Size: 3455 bytes --] Hi Liming, It trips on the coding style where “Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters”. Please see detailed error info here: https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=18722&view=logs&j=dc79cb3a-f339-5fc0-73b1-0ff8c522379e&t=b5b21d01-2921-57ea-8401-4c0ebee10613&l=69 This patch ([PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 (groups.io)<https://edk2.groups.io/g/devel/message/70332>) added a new instance for StandaloneMmCoreEntryPoint library and failed on ECC check 8006 due to the function name involved. Regards, Kun From: gaoliming<mailto:gaoliming@byosoft.com.cn> Sent: Wednesday, January 20, 2021 17:45 To: 'Kun Qin'<mailto:kun.q@outlook.com>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: 'Bob Feng'<mailto:bob.c.feng@intel.com>; 'Yuwei Chen'<mailto:yuwei.chen@intel.com> Subject: 回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Qin: This change makes sense. Can you let me know which case trigs this ECC issue? Does your patch include such case? Thanks Liming 发件人: Kun Qin <kun.q@outlook.com> 发送时间: 2021年1月21日 9:37 收件人: devel@edk2.groups.io 抄送: Bob Feng <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com> 主题: RE: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Hi Bob/Liming/Yuwei, Do you mind providing some feedback on this patch? This is to unblock the second patch (adding driver entry point instance for Standalone X64) of this patch series. Thanks in advance! Regards, Kun From: Kun Qin<mailto:kun.q@outlook.com> Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Bob Feng<mailto:bob.c.feng@intel.com>; Liming Gao<mailto:gaoliming@byosoft.com.cn>; Yuwei Chen<mailto:yuwei.chen@intel.com> Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Function '_ModuleEntryPoint' is a pre-defined interface for various EFI module types and should not be caught violating EFI coding style. This change added '_ModuleEntryPoint' into exception list to fix EFI coding style error 8006 during CI build. Cc: Bob Feng <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Yuwei Chen <yuwei.chen@intel.com<mailto:yuwei.chen@intel.com>> Signed-off-by: Kun Qin <kun.q@outlook.com<mailto:kun.q@outlook.com>> --- Notes: v3: - Newly added to fix CI build on changing '_ModuleEntryPoint' BaseTools/Source/Python/Ecc/exception.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/exception.xml b/BaseTools/Source/Python/Ecc/exception.xml index 8133904fbc7f..f2334aab8e52 100644 --- a/BaseTools/Source/Python/Ecc/exception.xml +++ b/BaseTools/Source/Python/Ecc/exception.xml @@ -296,6 +296,10 @@ <KeyWord>_DriverUnloadHandler</KeyWord> <ErrorID>8006</ErrorID> </Exception> + <Exception> + <KeyWord>_ModuleEntryPoint</KeyWord> + <ErrorID>8006</ErrorID> + </Exception> <Exception> <KeyWord>ASSERT</KeyWord> <ErrorID>10015</ErrorID> -- 2.30.0.windows.1 [-- Attachment #1.2: Type: text/html, Size: 8095 bytes --] [-- Attachment #2: 07E2C116008D473D81BC880BBF94B67E.png --] [-- Type: image/png, Size: 140 bytes --] ^ permalink raw reply related [flat|nested] 11+ messages in thread
* 回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list 2021-01-21 1:54 ` Kun Qin @ 2021-01-22 0:27 ` gaoliming 2021-01-26 5:41 ` Bob Feng 0 siblings, 1 reply; 11+ messages in thread From: gaoliming @ 2021-01-22 0:27 UTC (permalink / raw) To: devel, kun.q; +Cc: 'Bob Feng', 'Yuwei Chen' [-- Attachment #1: Type: text/plain, Size: 4398 bytes --] Got it. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Thanks Liming 发件人: bounce+27952+70609+4905953+8761045@groups.io <bounce+27952+70609+4905953+8761045@groups.io> 代表 Kun Qin 发送时间: 2021年1月21日 9:54 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn 抄送: 'Bob Feng' <bob.c.feng@intel.com>; 'Yuwei Chen' <yuwei.chen@intel.com> 主题: Re: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Hi Liming, It trips on the coding style where “Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters”. Please see detailed error info here: https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=18722 <https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=18722&view=l ogs&j=dc79cb3a-f339-5fc0-73b1-0ff8c522379e&t=b5b21d01-2921-57ea-8401-4c0ebee 10613&l=69> &view=logs&j=dc79cb3a-f339-5fc0-73b1-0ff8c522379e&t=b5b21d01-2921-57ea-8401- 4c0ebee10613&l=69 This patch ([PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 (groups.io) <https://edk2.groups.io/g/devel/message/70332> ) added a new instance for StandaloneMmCoreEntryPoint library and failed on ECC check 8006 due to the function name involved. Regards, Kun From: gaoliming <mailto:gaoliming@byosoft.com.cn> Sent: Wednesday, January 20, 2021 17:45 To: 'Kun Qin' <mailto:kun.q@outlook.com> ; devel@edk2.groups.io <mailto:devel@edk2.groups.io> Cc: 'Bob Feng' <mailto:bob.c.feng@intel.com> ; 'Yuwei Chen' <mailto:yuwei.chen@intel.com> Subject: 回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Qin: This change makes sense. Can you let me know which case trigs this ECC issue? Does your patch include such case? Thanks Liming 发件人: Kun Qin <kun.q@outlook.com <mailto:kun.q@outlook.com> > 发送时间: 2021年1月21日 9:37 收件人: devel@edk2.groups.io <mailto:devel@edk2.groups.io> 抄送: Bob Feng <bob.c.feng@intel.com <mailto:bob.c.feng@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Yuwei Chen <yuwei.chen@intel.com <mailto:yuwei.chen@intel.com> > 主题: RE: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Hi Bob/Liming/Yuwei, Do you mind providing some feedback on this patch? This is to unblock the second patch (adding driver entry point instance for Standalone X64) of this patch series. Thanks in advance! Regards, Kun From: Kun Qin <mailto:kun.q@outlook.com> Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> Cc: Bob Feng <mailto:bob.c.feng@intel.com> ; Liming Gao <mailto:gaoliming@byosoft.com.cn> ; Yuwei Chen <mailto:yuwei.chen@intel.com> Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Function '_ModuleEntryPoint' is a pre-defined interface for various EFI module types and should not be caught violating EFI coding style. This change added '_ModuleEntryPoint' into exception list to fix EFI coding style error 8006 during CI build. Cc: Bob Feng <bob.c.feng@intel.com <mailto:bob.c.feng@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > Cc: Yuwei Chen <yuwei.chen@intel.com <mailto:yuwei.chen@intel.com> > Signed-off-by: Kun Qin <kun.q@outlook.com <mailto:kun.q@outlook.com> > --- Notes: v3: - Newly added to fix CI build on changing '_ModuleEntryPoint' BaseTools/Source/Python/Ecc/exception.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/exception.xml b/BaseTools/Source/Python/Ecc/exception.xml index 8133904fbc7f..f2334aab8e52 100644 --- a/BaseTools/Source/Python/Ecc/exception.xml +++ b/BaseTools/Source/Python/Ecc/exception.xml @@ -296,6 +296,10 @@ <KeyWord>_DriverUnloadHandler</KeyWord> <ErrorID>8006</ErrorID> </Exception> + <Exception> + <KeyWord>_ModuleEntryPoint</KeyWord> + <ErrorID>8006</ErrorID> + </Exception> <Exception> <KeyWord>ASSERT</KeyWord> <ErrorID>10015</ErrorID> -- 2.30.0.windows.1 [-- Attachment #2: Type: text/html, Size: 11381 bytes --] ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list 2021-01-22 0:27 ` 回复: " gaoliming @ 2021-01-26 5:41 ` Bob Feng 0 siblings, 0 replies; 11+ messages in thread From: Bob Feng @ 2021-01-26 5:41 UTC (permalink / raw) To: devel@edk2.groups.io, gaoliming@byosoft.com.cn, kun.q@outlook.com Cc: Chen, Christine [-- Attachment #1: Type: text/plain, Size: 4803 bytes --] Reviewed-by: Bob Feng <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming Sent: Friday, January 22, 2021 8:27 AM To: devel@edk2.groups.io; kun.q@outlook.com Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com> Subject: 回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Got it. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Thanks Liming 发件人: bounce+27952+70609+4905953+8761045@groups.io<mailto:bounce+27952+70609+4905953+8761045@groups.io> <bounce+27952+70609+4905953+8761045@groups.io<mailto:bounce+27952+70609+4905953+8761045@groups.io>> 代表 Kun Qin 发送时间: 2021年1月21日 9:54 收件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn> 抄送: 'Bob Feng' <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; 'Yuwei Chen' <yuwei.chen@intel.com<mailto:yuwei.chen@intel.com>> 主题: Re: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Hi Liming, It trips on the coding style where “Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters”. Please see detailed error info here: https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=18722&view=logs&j=dc79cb3a-f339-5fc0-73b1-0ff8c522379e&t=b5b21d01-2921-57ea-8401-4c0ebee10613&l=69 This patch ([PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 (groups.io)<https://edk2.groups.io/g/devel/message/70332>) added a new instance for StandaloneMmCoreEntryPoint library and failed on ECC check 8006 due to the function name involved. Regards, Kun From: gaoliming<mailto:gaoliming@byosoft.com.cn> Sent: Wednesday, January 20, 2021 17:45 To: 'Kun Qin'<mailto:kun.q@outlook.com>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: 'Bob Feng'<mailto:bob.c.feng@intel.com>; 'Yuwei Chen'<mailto:yuwei.chen@intel.com> Subject: 回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Qin: This change makes sense. Can you let me know which case trigs this ECC issue? Does your patch include such case? Thanks Liming 发件人: Kun Qin <kun.q@outlook.com<mailto:kun.q@outlook.com>> 发送时间: 2021年1月21日 9:37 收件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 抄送: Bob Feng <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Yuwei Chen <yuwei.chen@intel.com<mailto:yuwei.chen@intel.com>> 主题: RE: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Hi Bob/Liming/Yuwei, Do you mind providing some feedback on this patch? This is to unblock the second patch (adding driver entry point instance for Standalone X64) of this patch series. Thanks in advance! Regards, Kun From: Kun Qin<mailto:kun.q@outlook.com> Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Bob Feng<mailto:bob.c.feng@intel.com>; Liming Gao<mailto:gaoliming@byosoft.com.cn>; Yuwei Chen<mailto:yuwei.chen@intel.com> Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Function '_ModuleEntryPoint' is a pre-defined interface for various EFI module types and should not be caught violating EFI coding style. This change added '_ModuleEntryPoint' into exception list to fix EFI coding style error 8006 during CI build. Cc: Bob Feng <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Yuwei Chen <yuwei.chen@intel.com<mailto:yuwei.chen@intel.com>> Signed-off-by: Kun Qin <kun.q@outlook.com<mailto:kun.q@outlook.com>> --- Notes: v3: - Newly added to fix CI build on changing '_ModuleEntryPoint' BaseTools/Source/Python/Ecc/exception.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/exception.xml b/BaseTools/Source/Python/Ecc/exception.xml index 8133904fbc7f..f2334aab8e52 100644 --- a/BaseTools/Source/Python/Ecc/exception.xml +++ b/BaseTools/Source/Python/Ecc/exception.xml @@ -296,6 +296,10 @@ <KeyWord>_DriverUnloadHandler</KeyWord> <ErrorID>8006</ErrorID> </Exception> + <Exception> + <KeyWord>_ModuleEntryPoint</KeyWord> + <ErrorID>8006</ErrorID> + </Exception> <Exception> <KeyWord>ASSERT</KeyWord> <ErrorID>10015</ErrorID> -- 2.30.0.windows.1 [-- Attachment #2: Type: text/html, Size: 11633 bytes --] ^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-01-26 12:39 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20210114223400.2596-1-kun.q@outlook.com> 2021-01-14 22:33 ` [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Kun Qin 2021-01-14 22:33 ` [PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 Kun Qin 2021-01-14 22:33 ` [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Kun Qin 2021-01-14 22:33 ` [PATCH v3 04/18] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning Kun Qin [not found] ` <165A3A1108D15505.7065@groups.io> 2021-01-21 1:34 ` [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Kun Qin 2021-01-26 12:39 ` Yao, Jiewen [not found] ` <165A3A10BD6EE08F.30138@groups.io> 2021-01-21 1:36 ` [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Kun Qin 2021-01-21 1:45 ` 回复: " gaoliming 2021-01-21 1:54 ` Kun Qin 2021-01-22 0:27 ` 回复: " gaoliming 2021-01-26 5:41 ` Bob Feng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox