]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/HobLib.h
Code have been checked with spec
[mirror_edk2.git] / MdePkg / Include / Library / HobLib.h
index 7f999e1ab8e468e35b66976241dfcacc96908dba..08cb63e936a541381aa7044582d4b16c2a4f82c7 100644 (file)
@@ -422,10 +422,11 @@ BuildMemoryAllocationHob (
 \r
   @param  Hob   A pointer to a HOB.\r
   \r
-  @return HobType\r
+  @return HobType.\r
   \r
 **/\r
-#define GET_HOB_TYPE(Hob)     ((Hob).Header->HobType)\r
+#define GET_HOB_TYPE(HobStart) \\r
+  ((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType)\r
 \r
 /**\r
   Returns the length, in bytes, of a HOB.\r
@@ -435,10 +436,11 @@ BuildMemoryAllocationHob (
 \r
   @param  Hob   A pointer to a HOB.\r
 \r
-  @return HobLength\r
+  @return HobLength.\r
 \r
 **/\r
-#define GET_HOB_LENGTH(Hob)   ((Hob).Header->HobLength)\r
+#define GET_HOB_LENGTH(HobStart) \\r
+  ((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength)\r
 \r
 /**\r
   Returns a pointer to the next HOB in the HOB list.\r
@@ -451,7 +453,8 @@ BuildMemoryAllocationHob (
   @return A pointer to the next HOB in the HOB list.\r
 \r
 **/\r
-#define GET_NEXT_HOB(Hob)     ((Hob).Raw + GET_HOB_LENGTH (Hob))\r
+#define GET_NEXT_HOB(HobStart) \\r
+  (VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart))\r
 \r
 /**\r
   Determines if a HOB is the last HOB in the HOB list.\r
@@ -474,12 +477,13 @@ BuildMemoryAllocationHob (
   This macro returns a pointer to the data buffer in a HOB specified by Hob.\r
   Hob is assumed to be a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.   \r
 \r
-  @param   Hob   A pointer to a HOB.\r
+  @param   GuidHob   A pointer to a HOB.\r
 \r
-  @return  A pointer to the data buffer in a HOB\r
+  @return  A pointer to the data buffer in a HOB.\r
   \r
 **/\r
-#define GET_GUID_HOB_DATA(GuidHob)      ((VOID *) (((UINT8 *) &((GuidHob)->Name)) + sizeof (EFI_GUID)))\r
+#define GET_GUID_HOB_DATA(HobStart) \\r
+  (VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE))\r
 \r
 /**\r
   Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r
@@ -487,10 +491,11 @@ BuildMemoryAllocationHob (
   This macro returns the size, in bytes, of the data buffer in a HOB specified by Hob.\r
   Hob is assumed to be a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r
 \r
-  @param   Hob   A pointer to a HOB.\r
+  @param   GuidHob   A pointer to a HOB.\r
 \r
-  @return  The size of the data buffer\r
+  @return  The size of the data buffer.\r
 **/\r
-#define GET_GUID_HOB_DATA_SIZE(GuidHob) (((GuidHob)->Header).HobLength - sizeof (EFI_HOB_GUID_TYPE))\r
+#define GET_GUID_HOB_DATA_SIZE(HobStart) \\r
+  (UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE))\r
 \r
 #endif\r