]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Conf/Migration/R8Lib.c
Fix a bug to convert EFI_PEI_HOB_POINTER to VOID*.
[mirror_edk2.git] / Tools / Conf / Migration / R8Lib.c
index b1494d45202ce2e05225543814a5a108e032690b..c705187219aed3aaf23c9c2d48bb9a21bfe1710f 100644 (file)
@@ -1013,7 +1013,7 @@ Returns:
   }\r
 \r
   GuidHob.Raw = GetNextGuidHob (Guid, *HobStart);\r
-  if (GuidHob == NULL) {\r
+  if (GuidHob.Raw == NULL) {\r
     return EFI_NOT_FOUND;\r
   }\r
   \r
@@ -1105,3 +1105,46 @@ Returns:
 }\r
 ////~\r
 \r
+////#HobLib\r
+EFI_STATUS\r
+R8_PeiBuildHobGuid (\r
+  IN  EFI_GUID          *Guid,\r
+  IN  UINTN             DataLength,\r
+  OUT VOID              **Hob\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Builds a custom HOB that is tagged with a GUID for identification\r
+\r
+Arguments:\r
+\r
+  Guid        - The GUID of the custome HOB type\r
+  DataLength  - The size of the data payload for the GUIDed HOB\r
+  Hob         - Pointer to pointer to the created Hob\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS - Hob is successfully built.\r
+  Others      - Errors occur while creating new Hob\r
+\r
+--*/\r
+{\r
+  //\r
+  // Porting Guide: Apply the new interface of BuildGuidHob in R9 HobLib.\r
+  // Pay attention that the return value has been changed to the start address of\r
+  // GUID HOB data so that caller can fill the customized data. \r
+  // For BuildGuidHob (), the HOB Header and Name field is already stripped..\r
+  //\r
+  VOID   *HobData; \r
+\r
+  HobData = BuildGuidHob (Guid, DataLength);\r
+  //\r
+  // This step is necessary to be compatible with R8 interface!\r
+  //\r
+  *Hob    = (VOID *) ((UINT8 *) HobData - sizeof (EFI_HOB_GUID_TYPE)); \r
+\r
+  return EFI_SUCCESS; \r
+}\r
+////~\r