]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
StandaloneMmPkg: build for 32bit arm machines
[mirror_edk2.git] / StandaloneMmPkg / Library / StandaloneMmCoreHobLib / AArch64 / StandaloneMmCoreHobLib.c
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
deleted file mode 100644 (file)
index 0ec2d4a..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-/** @file\r
-  HOB Library implementation for Standalone MM Core.\r
-\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
-Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR>\r
-\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <PiMm.h>\r
-\r
-#include <Library/HobLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-\r
-#include <Guid/MemoryAllocationHob.h>\r
-\r
-//\r
-// Cache copy of HobList pointer.\r
-//\r
-VOID *gHobList = NULL;\r
-\r
-VOID *\r
-CreateHob (\r
-  IN  UINT16    HobType,\r
-  IN  UINT16    HobLength\r
-  )\r
-{\r
-  EFI_HOB_HANDOFF_INFO_TABLE  *HandOffHob;\r
-  EFI_HOB_GENERIC_HEADER      *HobEnd;\r
-  EFI_PHYSICAL_ADDRESS        FreeMemory;\r
-  VOID                        *Hob;\r
-\r
-  HandOffHob = GetHobList ();\r
-\r
-  HobLength = (UINT16)((HobLength + 0x7) & (~0x7));\r
-\r
-  FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;\r
-\r
-  if (FreeMemory < HobLength) {\r
-    return NULL;\r
-  }\r
-\r
-  Hob = (VOID*) (UINTN) HandOffHob->EfiEndOfHobList;\r
-  ((EFI_HOB_GENERIC_HEADER*) Hob)->HobType = HobType;\r
-  ((EFI_HOB_GENERIC_HEADER*) Hob)->HobLength = HobLength;\r
-  ((EFI_HOB_GENERIC_HEADER*) Hob)->Reserved = 0;\r
-\r
-  HobEnd = (EFI_HOB_GENERIC_HEADER*) ((UINTN)Hob + HobLength);\r
-  HandOffHob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;\r
-\r
-  HobEnd->HobType   = EFI_HOB_TYPE_END_OF_HOB_LIST;\r
-  HobEnd->HobLength = sizeof (EFI_HOB_GENERIC_HEADER);\r
-  HobEnd->Reserved  = 0;\r
-  HobEnd++;\r
-  HandOffHob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;\r
-\r
-  return Hob;\r
-}\r
-\r
-/**\r
-  Builds a HOB for a loaded PE32 module.\r
-\r
-  This function builds a HOB for a loaded PE32 module.\r
-  If ModuleName is NULL, then ASSERT().\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-\r
-  @param  ModuleName              The GUID File Name of the module.\r
-  @param  MemoryAllocationModule  The 64 bit physical address of the module.\r
-  @param  ModuleLength            The length of the module in bytes.\r
-  @param  EntryPoint              The 64 bit physical address of the module entry point.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BuildModuleHob (\r
-  IN CONST EFI_GUID         *ModuleName,\r
-  IN EFI_PHYSICAL_ADDRESS   MemoryAllocationModule,\r
-  IN UINT64                 ModuleLength,\r
-  IN EFI_PHYSICAL_ADDRESS   EntryPoint\r
-  )\r
-{\r
-  EFI_HOB_MEMORY_ALLOCATION_MODULE  *Hob;\r
-\r
-  ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&\r
-          ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0));\r
-\r
-  Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));\r
-\r
-  CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);\r
-  Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;\r
-  Hob->MemoryAllocationHeader.MemoryLength      = ModuleLength;\r
-  Hob->MemoryAllocationHeader.MemoryType        = EfiBootServicesCode;\r
-\r
-  //\r
-  // Zero the reserved space to match HOB spec\r
-  //\r
-  ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));\r
-\r
-  CopyGuid (&Hob->ModuleName, ModuleName);\r
-  Hob->EntryPoint = EntryPoint;\r
-}\r
-\r
-/**\r
-  Builds a HOB that describes a chunk of system memory.\r
-\r
-  This function builds a HOB that describes a chunk of system memory.\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-\r
-  @param  ResourceType        The type of resource described by this HOB.\r
-  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.\r
-  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.\r
-  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BuildResourceDescriptorHob (\r
-  IN EFI_RESOURCE_TYPE            ResourceType,\r
-  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,\r
-  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,\r
-  IN UINT64                       NumberOfBytes\r
-  )\r
-{\r
-  EFI_HOB_RESOURCE_DESCRIPTOR  *Hob;\r
-\r
-  Hob = CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));\r
-  ASSERT (Hob != NULL);\r
-\r
-  Hob->ResourceType      = ResourceType;\r
-  Hob->ResourceAttribute = ResourceAttribute;\r
-  Hob->PhysicalStart     = PhysicalStart;\r
-  Hob->ResourceLength    = NumberOfBytes;\r
-}\r
-\r
-/**\r
-  Builds a GUID HOB with a certain data length.\r
-\r
-  This function builds a customized HOB tagged with a GUID for identification\r
-  and returns the start address of GUID HOB data so that caller can fill the customized data.\r
-  The HOB Header and Name field is already stripped.\r
-  If Guid is NULL, then ASSERT().\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
-\r
-  @param  Guid          The GUID to tag the customized HOB.\r
-  @param  DataLength    The size of the data payload for the GUID HOB.\r
-\r
-  @return The start address of GUID HOB data.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-BuildGuidHob (\r
-  IN CONST EFI_GUID              *Guid,\r
-  IN UINTN                       DataLength\r
-  )\r
-{\r
-  EFI_HOB_GUID_TYPE *Hob;\r
-\r
-  //\r
-  // Make sure that data length is not too long.\r
-  //\r
-  ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE)));\r
-\r
-  Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));\r
-  CopyGuid (&Hob->Name, Guid);\r
-  return Hob + 1;\r
-}\r
-\r
-\r
-/**\r
-  Copies a data buffer to a newly-built HOB.\r
-\r
-  This function builds a customized HOB tagged with a GUID for identification,\r
-  copies the input data to the HOB data field and returns the start address of the GUID HOB data.\r
-  The HOB Header and Name field is already stripped.\r
-  If Guid is NULL, then ASSERT().\r
-  If Data is NULL and DataLength > 0, then ASSERT().\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
-\r
-  @param  Guid          The GUID to tag the customized HOB.\r
-  @param  Data          The data to be copied into the data field of the GUID HOB.\r
-  @param  DataLength    The size of the data payload for the GUID HOB.\r
-\r
-  @return The start address of GUID HOB data.\r
-\r
-**/\r
-VOID *\r
-EFIAPI\r
-BuildGuidDataHob (\r
-  IN CONST EFI_GUID              *Guid,\r
-  IN VOID                        *Data,\r
-  IN UINTN                       DataLength\r
-  )\r
-{\r
-  VOID  *HobData;\r
-\r
-  ASSERT (Data != NULL || DataLength == 0);\r
-\r
-  HobData = BuildGuidHob (Guid, DataLength);\r
-\r
-  return CopyMem (HobData, Data, DataLength);\r
-}\r
-\r
-/**\r
-  Builds a Firmware Volume HOB.\r
-\r
-  This function builds a Firmware Volume HOB.\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-\r
-  @param  BaseAddress   The base address of the Firmware Volume.\r
-  @param  Length        The size of the Firmware Volume in bytes.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BuildFvHob (\r
-  IN EFI_PHYSICAL_ADDRESS        BaseAddress,\r
-  IN UINT64                      Length\r
-  )\r
-{\r
-  EFI_HOB_FIRMWARE_VOLUME  *Hob;\r
-\r
-  Hob = CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));\r
-\r
-  Hob->BaseAddress = BaseAddress;\r
-  Hob->Length      = Length;\r
-}\r
-\r
-\r
-/**\r
-  Builds a EFI_HOB_TYPE_FV2 HOB.\r
-\r
-  This function builds a EFI_HOB_TYPE_FV2 HOB.\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-\r
-  @param  BaseAddress   The base address of the Firmware Volume.\r
-  @param  Length        The size of the Firmware Volume in bytes.\r
-  @param  FvName       The name of the Firmware Volume.\r
-  @param  FileName      The name of the file.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BuildFv2Hob (\r
-  IN          EFI_PHYSICAL_ADDRESS        BaseAddress,\r
-  IN          UINT64                      Length,\r
-  IN CONST    EFI_GUID                    *FvName,\r
-  IN CONST    EFI_GUID                    *FileName\r
-  )\r
-{\r
-  EFI_HOB_FIRMWARE_VOLUME2  *Hob;\r
-\r
-  Hob = CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2));\r
-\r
-  Hob->BaseAddress = BaseAddress;\r
-  Hob->Length      = Length;\r
-  CopyGuid (&Hob->FvName, FvName);\r
-  CopyGuid (&Hob->FileName, FileName);\r
-}\r
-\r
-\r
-/**\r
-  Builds a HOB for the CPU.\r
-\r
-  This function builds a HOB for the CPU.\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-\r
-  @param  SizeOfMemorySpace   The maximum physical memory addressability of the processor.\r
-  @param  SizeOfIoSpace       The maximum physical I/O addressability of the processor.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BuildCpuHob (\r
-  IN UINT8                       SizeOfMemorySpace,\r
-  IN UINT8                       SizeOfIoSpace\r
-  )\r
-{\r
-  EFI_HOB_CPU  *Hob;\r
-\r
-  Hob = CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));\r
-\r
-  Hob->SizeOfMemorySpace = SizeOfMemorySpace;\r
-  Hob->SizeOfIoSpace     = SizeOfIoSpace;\r
-\r
-  //\r
-  // Zero the reserved space to match HOB spec\r
-  //\r
-  ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));\r
-}\r
-\r
-/**\r
-  Builds a HOB for the memory allocation.\r
-\r
-  This function builds a HOB for the memory allocation.\r
-  If there is no additional space for HOB creation, then ASSERT().\r
-\r
-  @param  BaseAddress   The 64 bit physical address of the memory.\r
-  @param  Length        The length of the memory allocation in bytes.\r
-  @param  MemoryType    Type of memory allocated by this HOB.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BuildMemoryAllocationHob (\r
-  IN EFI_PHYSICAL_ADDRESS        BaseAddress,\r
-  IN UINT64                      Length,\r
-  IN EFI_MEMORY_TYPE             MemoryType\r
-  )\r
-{\r
-  EFI_HOB_MEMORY_ALLOCATION  *Hob;\r
-\r
-  ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&\r
-          ((Length & (EFI_PAGE_SIZE - 1)) == 0));\r
-\r
-  Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));\r
-\r
-  ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));\r
-  Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
-  Hob->AllocDescriptor.MemoryLength      = Length;\r
-  Hob->AllocDescriptor.MemoryType        = MemoryType;\r
-  //\r
-  // Zero the reserved space to match HOB spec\r
-  //\r
-  ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));\r
-}\r