]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/HobLib.h
Add new interface GetVariable2 and GetEfiGlobalVariable2 to return more info. Also...
[mirror_edk2.git] / MdePkg / Include / Library / HobLib.h
index 7f999e1ab8e468e35b66976241dfcacc96908dba..8af7fbe0e1bc4c7e8da1ca5622e00d8d2982cd45 100644 (file)
@@ -8,8 +8,8 @@
   allows the PEI phase to pass information to the DXE phase. HOBs are position \r
   independent and can be relocated easily to different memory memory locations.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -225,7 +225,8 @@ BuildResourceDescriptorHob (
   @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
+  @retval  NULL         The GUID HOB could not be allocated.\r
+  @retval  others       The start address of GUID HOB data.\r
 \r
 **/\r
 VOID *\r
@@ -255,7 +256,8 @@ BuildGuidHob (
   @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
+  @retval  NULL         The GUID HOB could not be allocated.\r
+  @retval  others       The start address of GUID HOB data.\r
 \r
 **/\r
 VOID *\r
@@ -317,6 +319,7 @@ BuildFv2Hob (
   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 the platform does not support Capsule Volume HOBs, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
 \r
   @param  BaseAddress   The base address of the Capsule Volume.\r
@@ -418,79 +421,84 @@ BuildMemoryAllocationHob (
   Returns the type of a HOB.\r
 \r
   This macro returns the HobType field from the HOB header for the \r
-  HOB specified by Hob.\r
+  HOB specified by HobStart.\r
 \r
-  @param  Hob   A pointer to a HOB.\r
+  @param  HobStart   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
 \r
   This macro returns the HobLength field from the HOB header for the \r
-  HOB specified by Hob.\r
+  HOB specified by HobStart.\r
 \r
-  @param  Hob   A pointer to a HOB.\r
+  @param  HobStart   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
 \r
   This macro returns a pointer to HOB that follows the \r
-  HOB specified by Hob in the HOB List.\r
+  HOB specified by HobStart in the HOB List.\r
 \r
-  @param  Hob   A pointer to a HOB.\r
+  @param  HobStart   A pointer to a HOB.\r
 \r
   @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
   \r
-  This macro determine if the HOB specified by Hob is the \r
-  last HOB in the HOB list.  If Hob is last HOB in the HOB list, \r
+  This macro determine if the HOB specified by HobStart is the \r
+  last HOB in the HOB list.  If HobStart is last HOB in the HOB list, \r
   then TRUE is returned.  Otherwise, FALSE is returned.\r
 \r
-  @param  Hob   A pointer to a HOB.\r
+  @param  HobStart   A pointer to a HOB.\r
 \r
-  @retval TRUE       The HOB specified by Hob is the last HOB in the HOB list.\r
-  @retval FALSE      The HOB specified by Hob is not the last HOB in the HOB list.\r
+  @retval TRUE       The HOB specified by HobStart is the last HOB in the HOB list.\r
+  @retval FALSE      The HOB specified by HobStart is not the last HOB in the HOB list.\r
 \r
 **/\r
-#define END_OF_HOB_LIST(Hob)  (GET_HOB_TYPE (Hob) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)\r
+#define END_OF_HOB_LIST(HobStart)  (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)\r
 \r
 /**\r
   Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r
 \r
-  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
+  This macro returns a pointer to the data buffer in a HOB specified by HobStart.\r
+  HobStart 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
 \r
-  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
+  This macro returns the size, in bytes, of the data buffer in a HOB specified by HobStart.\r
+  HobStart 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