]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeHobLib/HobLib.c
Detab
[mirror_edk2.git] / MdePkg / Library / DxeHobLib / HobLib.c
index 672dd3e46829c5ad2510512de550b331f11c9f27..2e41453a16a4fbd05ccfbe9f7dfa7d9286c7bc12 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  HOB Library.\r
+  HOB Library implemenation for Dxe Phase.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\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
   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.c\r
-\r
 **/\r
 \r
 \r
 \r
-STATIC VOID  *mHobList = NULL;\r
+#include <PiDxe.h>\r
+\r
+#include <Guid/HobList.h>\r
+\r
+#include <Library/HobLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+\r
+VOID  *mHobList = NULL;\r
 \r
 /**\r
   The constructor function caches the pointer to HOB list.\r
@@ -27,7 +34,8 @@ STATIC VOID  *mHobList = NULL;
   @param  ImageHandle   The firmware allocated handle for the EFI image.\r
   @param  SystemTable   A pointer to the EFI System Table.\r
   \r
-  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
+  @retval EFI_SUCCESS   The constructor successfully gets HobList.\r
+  @retval Other value   The constructor can't get HobList.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -42,11 +50,13 @@ HobLibConstructor (
   Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &mHobList);\r
   ASSERT_EFI_ERROR (Status);\r
   ASSERT (mHobList != NULL);\r
+\r
   return Status;\r
 }\r
 \r
 /**\r
   Returns the pointer to the HOB list.\r
+  ASSERT() if the HOB list returned by GetHobList() is NULL.\r
 \r
   This function returns the pointer to first HOB in the list.\r
 \r
@@ -59,6 +69,7 @@ GetHobList (
   VOID\r
   )\r
 {\r
+  ASSERT (mHobList != NULL);\r
   return mHobList;\r
 }\r
 \r
@@ -193,7 +204,7 @@ GetFirstGuidHob (
   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
+  PHIT HOB in HOB list. If PHIT HOB is NULL, then ASSERT().\r
 \r
   @param  VOID\r
 \r
@@ -364,6 +375,33 @@ BuildFvHob (
   ASSERT (FALSE);\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
+  ASSERT (FALSE);\r
+}\r
+\r
+\r
 /**\r
   Builds a Capsule Volume HOB.\r
 \r