]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiHobLib/HobLib.c
MdePkg: fix mixed dos and linux EOL format issue
[mirror_edk2.git] / MdePkg / Library / PeiHobLib / HobLib.c
index 32523d4277501d5e9d85d4e1c7caaf0eecc40a4d..f3ce93afc63eb4288a48920eef0d1f81b11569f4 100644 (file)
@@ -300,6 +300,47 @@ BuildModuleHob (
   Hob->EntryPoint = EntryPoint;\r
 }\r
 \r
+/**\r
+  Builds a HOB that describes a chunk of system memory with Owner GUID.\r
+\r
+  This function builds a HOB that describes a chunk of system memory.\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
+  \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
+  @param  OwnerGUID           GUID for the owner of this resource.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildResourceDescriptorWithOwnerHob (\r
+  IN EFI_RESOURCE_TYPE            ResourceType,\r
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,\r
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,\r
+  IN UINT64                       NumberOfBytes,\r
+  IN EFI_GUID                     *OwnerGUID\r
+  )\r
+{\r
+  EFI_HOB_RESOURCE_DESCRIPTOR  *Hob;\r
+\r
+  Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));\r
+  if (Hob == NULL) {\r
+    return;\r
+  }\r
+\r
+  Hob->ResourceType      = ResourceType;\r
+  Hob->ResourceAttribute = ResourceAttribute;\r
+  Hob->PhysicalStart     = PhysicalStart;\r
+  Hob->ResourceLength    = NumberOfBytes;\r
+\r
+  CopyGuid (&Hob->Owner, OwnerGUID);\r
+}\r
+\r
 /**\r
   Builds a HOB that describes a chunk of system memory.\r
 \r