]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/HobLib.h
Merge branch of PI tree to main trunk
[mirror_edk2.git] / MdePkg / Include / Library / HobLib.h
index 9789c693e7d3a8e1f440376c3e8c155c199a8e9c..50e0d1067630379359c54c3a552e01957a9e15fb 100644 (file)
@@ -1,16 +1,14 @@
 /** @file\r
-       Public include file for the HOB Library\r
+  Public include file for the HOB Library\r
 \r
-       Copyright (c) 2006, Intel Corporation                                                         \r
-       All rights reserved. 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
+  Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+  All rights reserved. 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
 \r
-       THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-       WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-\r
-       Module Name:    HobLib.h\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
 **/\r
 \r
@@ -122,6 +120,24 @@ GetFirstGuidHob (
   )\r
 ;\r
 \r
+/**\r
+  Get the Boot Mode from the HOB list.\r
+\r
+  This function returns the system boot mode information from the \r
+  PHIT HOB in HOB list.\r
+\r
+  @param  VOID\r
+\r
+  @return The Boot Mode.\r
+\r
+**/\r
+EFI_BOOT_MODE\r
+EFIAPI\r
+GetBootModeHob (\r
+  VOID\r
+  )\r
+;\r
+\r
 /**\r
   Builds a HOB for a loaded PE32 module.\r
 \r
@@ -134,7 +150,7 @@ GetFirstGuidHob (
   @param  ModuleName              The GUID File Name of the module.\r
   @param  MemoryAllocationModule  The 64 bit physical address of the module.\r
   @param  ModuleLength            The length of the module in bytes.\r
-  @param  EntryPoint              The 64 bit physical address of the module\92s entry point.\r
+  @param  EntryPoint              The 64 bit physical address of the module entry point.\r
 \r
 **/\r
 VOID\r
@@ -181,7 +197,7 @@ BuildResourceDescriptorHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
   If Guid is NULL, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength > (0x10000 - sizeof (EFI_HOB_TYPE_GUID)), then ASSERT().\r
+  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  DataLength    The size of the data payload for the GUID HOB.\r
@@ -208,7 +224,7 @@ BuildGuidHob (
   If Guid is NULL, then ASSERT().\r
   If Data is NULL and DataLength > 0, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength > (0x10000 - sizeof (EFI_HOB_TYPE_GUID)), then ASSERT().\r
+  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  Data          The data to be copied into the data field of the GUID HOB.\r
@@ -246,6 +262,30 @@ BuildFvHob (
   )\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
+\r
 /**\r
   Builds a Capsule Volume HOB.\r
 \r
@@ -350,4 +390,15 @@ BuildMemoryAllocationHob (
   )\r
 ;\r
 \r
+#define GET_HOB_TYPE(Hob)     ((Hob).Header->HobType)\r
+#define GET_HOB_LENGTH(Hob)   ((Hob).Header->HobLength)\r
+#define GET_NEXT_HOB(Hob)     ((Hob).Raw + GET_HOB_LENGTH (Hob))\r
+#define END_OF_HOB_LIST(Hob)  (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_END_OF_HOB_LIST)\r
+\r
+//\r
+// Get the data and data size field of GUID \r
+//\r
+#define GET_GUID_HOB_DATA(GuidHob)      ((VOID *) (((UINT8 *) &((GuidHob)->Name)) + sizeof (EFI_GUID)))\r
+#define GET_GUID_HOB_DATA_SIZE(GuidHob) (((GuidHob)->Header).HobLength - sizeof (EFI_HOB_GUID_TYPE))\r
+\r
 #endif\r