From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=sughosh.ganu@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 84984209884DA for ; Fri, 13 Jul 2018 08:06:02 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 656BC7A9; Fri, 13 Jul 2018 08:06:02 -0700 (PDT) Received: from usa.arm.com (a074948-lin.blr.arm.com [10.162.4.138]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9EAAA3F5B1; Fri, 13 Jul 2018 08:06:00 -0700 (PDT) From: Sughosh Ganu To: edk2-devel@lists.01.org Cc: Achin Gupta , Jiewen Yao , Supreeth Venkatesh , Sughosh Ganu Date: Fri, 13 Jul 2018 20:35:25 +0530 Message-Id: <1531494330-1280-6-git-send-email-sughosh.ganu@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531494330-1280-1-git-send-email-sughosh.ganu@arm.com> References: <1531494330-1280-1-git-send-email-sughosh.ganu@arm.com> Subject: [PATCH v2 05/10] StandaloneMmPkg/HobLib: Add HOB Library for management mode. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 15:06:02 -0000 From: Supreeth Venkatesh The Standalone MM environment is initialized during the SEC phase on ARM Standard Platforms. The MM Core driver implements an entry point module which is architecture specific and runs prior to the generic core driver code. The former creates a Hob list that the latter consumes. This happens in the same phase. This patch implements a Hob library that can be used by the entry point module to produce a Hob list and by the core driver code to consume it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Achin Gupta Signed-off-by: Supreeth Venkatesh Reviewed-by: Jiewen Yao Signed-off-by: Sughosh Ganu --- .../AArch64/StandaloneMmCoreHobLibInternal.c | 64 +++ .../StandaloneMmCoreHobLib.c | 433 +++++++++++---------- .../StandaloneMmCoreHobLib.inf | 47 +++ 3 files changed, 330 insertions(+), 214 deletions(-) create mode 100644 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLibInternal.c copy MdePkg/Library/DxeCoreHobLib/HobLib.c => StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c (67%) create mode 100644 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLibInternal.c new file mode 100644 index 000000000000..90e1cd479cb2 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLibInternal.c @@ -0,0 +1,64 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+ +This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include + +#include +#include +#include + +#include + +// +// Cache copy of HobList pointer. +// +extern VOID *gHobList; + +EFI_HOB_HANDOFF_INFO_TABLE* +HobConstructor ( + IN VOID *EfiMemoryBegin, + IN UINTN EfiMemoryLength, + IN VOID *EfiFreeMemoryBottom, + IN VOID *EfiFreeMemoryTop + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *Hob; + EFI_HOB_GENERIC_HEADER *HobEnd; + + Hob = EfiFreeMemoryBottom; + HobEnd = (EFI_HOB_GENERIC_HEADER *)(Hob+1); + + Hob->Header.HobType = EFI_HOB_TYPE_HANDOFF; + Hob->Header.HobLength = sizeof (EFI_HOB_HANDOFF_INFO_TABLE); + Hob->Header.Reserved = 0; + + HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST; + HobEnd->HobLength = sizeof (EFI_HOB_GENERIC_HEADER); + HobEnd->Reserved = 0; + + Hob->Version = EFI_HOB_HANDOFF_TABLE_VERSION; + Hob->BootMode = BOOT_WITH_FULL_CONFIGURATION; + + Hob->EfiMemoryTop = (UINTN)EfiMemoryBegin + EfiMemoryLength; + Hob->EfiMemoryBottom = (UINTN)EfiMemoryBegin; + Hob->EfiFreeMemoryTop = (UINTN)EfiFreeMemoryTop; + Hob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS)(UINTN)(HobEnd+1); + Hob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd; + + gHobList = Hob; + + return Hob; +} diff --git a/MdePkg/Library/DxeCoreHobLib/HobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c similarity index 67% copy from MdePkg/Library/DxeCoreHobLib/HobLib.c copy to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c index 6aac20dd4d8d..e2fcda813d1b 100644 --- a/MdePkg/Library/DxeCoreHobLib/HobLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c @@ -1,7 +1,9 @@ /** @file - HOB Library implementation for DxeCore driver. + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -12,24 +14,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include #include #include #include -#include + +#include + +// +// Cache copy of HobList pointer. +// +VOID *gHobList = NULL; /** Returns the pointer to the HOB list. This function returns the pointer to first HOB in the list. - For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer - to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through - the EFI System Table by looking up theHOB list GUID in the System Configuration Table. - Since the System Configuration Table does not exist that the time the DXE Core is - launched, the DXE Core uses a global variable from the DXE Core Entry Point Library - to manage the pointer to the HOB list. - If the pointer to the HOB list is NULL, then ASSERT(). @return The pointer to the HOB list. @@ -205,16 +206,51 @@ GetBootModeHob ( HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); - return HandOffHob->BootMode; + return HandOffHob->BootMode; +} + +VOID * +CreateHob ( + IN UINT16 HobType, + IN UINT16 HobLength + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + EFI_HOB_GENERIC_HEADER *HobEnd; + EFI_PHYSICAL_ADDRESS FreeMemory; + VOID *Hob; + + HandOffHob = GetHobList (); + + HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); + + FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom; + + if (FreeMemory < HobLength) { + return NULL; + } + + Hob = (VOID*) (UINTN) HandOffHob->EfiEndOfHobList; + ((EFI_HOB_GENERIC_HEADER*) Hob)->HobType = HobType; + ((EFI_HOB_GENERIC_HEADER*) Hob)->HobLength = HobLength; + ((EFI_HOB_GENERIC_HEADER*) Hob)->Reserved = 0; + + HobEnd = (EFI_HOB_GENERIC_HEADER*) ((UINTN)Hob + HobLength); + HandOffHob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd; + + HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST; + HobEnd->HobLength = sizeof (EFI_HOB_GENERIC_HEADER); + HobEnd->Reserved = 0; + HobEnd++; + HandOffHob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd; + + return Hob; } /** Builds a HOB for a loaded PE32 module. This function builds a HOB for a loaded PE32 module. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - If ModuleName is NULL, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). @@ -233,51 +269,31 @@ BuildModuleHob ( IN EFI_PHYSICAL_ADDRESS EntryPoint ) { - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} + EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob; -/** - Builds a HOB that describes a chunk of system memory with Owner GUID. + ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) && + ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0)); - This function builds a HOB that describes a chunk of system memory. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE)); - If there is no additional space for HOB creation, then ASSERT(). + CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid); + Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule; + Hob->MemoryAllocationHeader.MemoryLength = ModuleLength; + Hob->MemoryAllocationHeader.MemoryType = EfiBootServicesCode; - @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 - ) -{ // - // PEI HOB is read only for DXE phase + // Zero the reserved space to match HOB spec // - ASSERT (FALSE); + ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved)); + + CopyGuid (&Hob->ModuleName, ModuleName); + Hob->EntryPoint = EntryPoint; } /** 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 DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - If there is no additional space for HOB creation, then ASSERT(). @param ResourceType The type of resource described by this HOB. @@ -295,32 +311,31 @@ BuildResourceDescriptorHob ( IN UINT64 NumberOfBytes ) { - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); + EFI_HOB_RESOURCE_DESCRIPTOR *Hob; + + Hob = CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR)); + ASSERT (Hob != NULL); + + Hob->ResourceType = ResourceType; + Hob->ResourceAttribute = ResourceAttribute; + Hob->PhysicalStart = PhysicalStart; + Hob->ResourceLength = NumberOfBytes; } /** - Builds a customized HOB tagged with a GUID for identification and returns - the start address of GUID HOB data. + Builds a GUID HOB with a certain data length. 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 DXE phase, it will ASSERT() because PEI HOB is read-only for DXE 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. + If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). @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. + @return The start address of GUID HOB data. **/ VOID * @@ -330,36 +345,35 @@ BuildGuidHob ( IN UINTN DataLength ) { + EFI_HOB_GUID_TYPE *Hob; + // - // PEI HOB is read only for DXE phase + // Make sure that data length is not too long. // - ASSERT (FALSE); - return NULL; + ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE))); + + Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength)); + CopyGuid (&Hob->Name, Guid); + return Hob + 1; } + /** - 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. + Copies a data buffer to a newly-built HOB. - 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 DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. + This function builds a customized HOB tagged with a GUID for identification, + copies the input data to the HOB data field and returns the start address of the GUID HOB data. The HOB Header and Name field is already stripped. - It can only be invoked during PEI phase. - For DXE phase, it will ASSERT() because PEI HOB is read-only for DXE 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. + If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). @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. + @return The start address of GUID HOB data. **/ VOID * @@ -370,22 +384,20 @@ BuildGuidDataHob ( IN UINTN DataLength ) { - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); - return NULL; + VOID *HobData; + + ASSERT (Data != NULL || DataLength == 0); + + HobData = BuildGuidHob (Guid, DataLength); + + return CopyMem (HobData, Data, DataLength); } /** Builds a Firmware Volume HOB. This function builds a Firmware Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE 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. @@ -398,25 +410,24 @@ BuildFvHob ( IN UINT64 Length ) { - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); + EFI_HOB_FIRMWARE_VOLUME *Hob; + + Hob = CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME)); + + Hob->BaseAddress = BaseAddress; + Hob->Length = Length; } + /** 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 DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). @param BaseAddress The base address of the Firmware Volume. @param Length The size of the Firmware Volume in bytes. - @param FvName The name of the Firmware Volume. + @param FvName The name of the Firmware Volume. @param FileName The name of the file. **/ @@ -429,78 +440,21 @@ BuildFv2Hob ( 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 DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + EFI_HOB_FIRMWARE_VOLUME2 *Hob; - If there is no additional space for HOB creation, then ASSERT(). - If the FvImage buffer is not at its required alignment, then ASSERT(). + Hob = CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2)); - @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); + Hob->BaseAddress = BaseAddress; + Hob->Length = Length; + CopyGuid (&Hob->FvName, FvName); + CopyGuid (&Hob->FileName, FileName); } -/** - Builds a Capsule Volume HOB. - - This function builds a Capsule Volume HOB. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - If the platform does not support Capsule Volume HOBs, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The base address of the Capsule Volume. - @param Length The size of the Capsule Volume in bytes. - -**/ -VOID -EFIAPI -BuildCvHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} /** Builds a HOB for the CPU. This function builds a HOB for the CPU. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - If there is no additional space for HOB creation, then ASSERT(). @param SizeOfMemorySpace The maximum physical memory addressability of the processor. @@ -514,73 +468,23 @@ BuildCpuHob ( IN UINT8 SizeOfIoSpace ) { - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - - 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 - ) -{ - // - // PEI HOB is read only for DXE phase - // - ASSERT (FALSE); -} - -/** - Builds a HOB for the BSP store. - - This function builds a HOB for BSP store. - It can only be invoked during PEI phase; - for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. + EFI_HOB_CPU *Hob; - If there is no additional space for HOB creation, then ASSERT(). + Hob = CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU)); - @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. + Hob->SizeOfMemorySpace = SizeOfMemorySpace; + Hob->SizeOfIoSpace = SizeOfIoSpace; -**/ -VOID -EFIAPI -BuildBspStoreHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_MEMORY_TYPE MemoryType - ) -{ // - // PEI HOB is read only for DXE phase + // Zero the reserved space to match HOB spec // - ASSERT (FALSE); + ZeroMem (Hob->Reserved, sizeof (Hob->Reserved)); } /** 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 DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase. - If there is no additional space for HOB creation, then ASSERT(). @param BaseAddress The 64 bit physical address of the memory. @@ -596,8 +500,109 @@ BuildMemoryAllocationHob ( IN EFI_MEMORY_TYPE MemoryType ) { + EFI_HOB_MEMORY_ALLOCATION *Hob; + + ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) && + ((Length & (EFI_PAGE_SIZE - 1)) == 0)); + + Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION)); + + ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID)); + Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress; + Hob->AllocDescriptor.MemoryLength = Length; + Hob->AllocDescriptor.MemoryType = MemoryType; // - // PEI HOB is read only for DXE phase + // Zero the reserved space to match HOB spec // + ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved)); +} + +/** + Builds a HOB that describes a chunk of system memory with Owner GUID. + + This function builds a HOB that describes a chunk of system memory. + If there is no additional space for HOB creation, then ASSERT(). + + @param ResourceType The type of resource described by this HOB. + @param ResourceAttribute The resource attributes of the memory described by this HOB. + @param PhysicalStart The 64 bit physical address of memory described by this HOB. + @param NumberOfBytes The length of the memory described by this HOB in bytes. + @param OwnerGUID GUID for the owner of this resource. + +**/ +VOID +EFIAPI +BuildResourceDescriptorWithOwnerHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes, + IN EFI_GUID *OwnerGUID + ) +{ + ASSERT (FALSE); +} + +/** + Builds a Capsule Volume HOB. + + This function builds a Capsule Volume HOB. + If the platform does not support Capsule Volume HOBs, then ASSERT(). + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The base address of the Capsule Volume. + @param Length The size of the Capsule Volume in bytes. + +**/ +VOID +EFIAPI +BuildCvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + ASSERT (FALSE); +} + + +/** + Builds a HOB for the BSP store. + + This function builds a HOB for BSP store. + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the BSP. + @param Length The length of the BSP store in bytes. + @param MemoryType Type of memory allocated by this HOB. + +**/ +VOID +EFIAPI +BuildBspStoreHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN EFI_MEMORY_TYPE MemoryType + ) +{ + ASSERT (FALSE); +} + +/** + 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/StandaloneMmCoreHobLib.inf b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf new file mode 100644 index 000000000000..db19d3c926e8 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf @@ -0,0 +1,47 @@ +## @file +# Instance of HOB Library for Standalone MM Core. +# +# HOB Library implementation for the Standalone MM Core. Does not have a constructor. +# Uses gHobList defined in the Standalone MM Core Entry Point Library. +# +# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +## + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = HobLib + FILE_GUID = CF56EF2C-68D8-4BD5-9A8B-8A7BFCFF751C + MODULE_TYPE = MM_CORE_STANDALONE + VERSION_STRING = 1.0 + PI_SPECIFICATION_VERSION = 0x00010032 + LIBRARY_CLASS = HobLib|MM_CORE_STANDALONE MM_STANDALONE + +# +# VALID_ARCHITECTURES = AARCH64 +# +[Sources.Common] + StandaloneMmCoreHobLib.c + +[Sources.AARCH64] + AArch64/StandaloneMmCoreHobLibInternal.c + +[Packages] + MdePkg/MdePkg.dec + + +[LibraryClasses] + BaseMemoryLib + DebugLib + +[Guids] + gEfiHobListGuid ## CONSUMES ## SystemTable -- 2.7.4