\r
**/\r
\r
-//\r
-// The package level header files this module uses\r
-//\r
+\r
#include <PiPei.h>\r
-//\r
-// The protocols, PPI and GUID defintions for this module\r
-//\r
+\r
#include <Guid/MemoryAllocationHob.h>\r
-//\r
-// The Library classes this module consumes\r
-//\r
+\r
#include <Library/HobLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/PeiServicesLib.h>\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 = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));\r
\r
CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);\r
Hob->Length = Length;\r
}\r
\r
+/**\r
+ Builds a EFI_HOB_TYPE_FV2 HOB.\r
+\r
+ This function builds a EFI_HOB_TYPE_FV2 HOB.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\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 = InternalPeiCreateHob (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
Builds a Capsule Volume HOB.\r
\r
{\r
EFI_HOB_MEMORY_ALLOCATION_STACK *Hob;\r
\r
+ ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&\r
+ ((Length & (EFI_PAGE_SIZE - 1)) == 0));\r
+\r
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));\r
\r
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);\r
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
Hob->AllocDescriptor.MemoryLength = Length;\r
- Hob->AllocDescriptor.MemoryType = EfiConventionalMemory;\r
+ Hob->AllocDescriptor.MemoryType = EfiBootServicesData;\r
\r
//\r
// Zero the reserved space to match HOB spec\r
{\r
EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *Hob;\r
\r
+ ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&\r
+ ((Length & (EFI_PAGE_SIZE - 1)) == 0));\r
+\r
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));\r
\r
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocBspStoreGuid);\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 = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));\r
-\r
+ \r
ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));\r
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
Hob->AllocDescriptor.MemoryLength = Length;\r