]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiHobLib/HobLib.c
changed the guid assignment from constant array to hi and low UINT64s (Intel compiler...
[mirror_edk2.git] / MdePkg / Library / PeiHobLib / HobLib.c
index 1f0c66acd092fb26f7a905dc0032c04d53b035c4..fdefd0ea51a654d20a90dd1d5627d85288361a9a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HOB Library.\r
 \r
-  Copyright (c) 2006, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2007, 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
@@ -33,7 +33,7 @@ GetHobList (
   EFI_STATUS            Status;\r
   VOID                  *HobList;\r
 \r
-  Status = PeiCoreGetHobList (&HobList);\r
+  Status = PeiServicesGetHobList (&HobList);\r
   ASSERT_EFI_ERROR (Status);\r
   ASSERT (HobList != NULL);\r
 \r
@@ -167,6 +167,32 @@ GetFirstGuidHob (
   return GetNextGuidHob (Guid, HobList);\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
+  EFI_STATUS             Status;\r
+  EFI_BOOT_MODE          BootMode;\r
+\r
+  Status = PeiServicesGetBootMode (&BootMode);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return BootMode;\r
+}\r
+\r
 /**\r
   Adds a new HOB to the HOB List.\r
 \r
@@ -178,6 +204,7 @@ GetFirstGuidHob (
   @return The address of new HOB.\r
 \r
 **/\r
+STATIC\r
 VOID *\r
 InternalPeiCreateHob (\r
   IN UINT16                      Type,\r
@@ -187,7 +214,7 @@ InternalPeiCreateHob (
   EFI_STATUS        Status;\r
   VOID              *Hob;\r
 \r
-  Status = PeiCoreCreateHob (Type, Length, &Hob);\r
+  Status = PeiServicesCreateHob (Type, Length, &Hob);\r
   //\r
   // Assume the process of HOB building is always successful.\r
   //\r
@@ -207,7 +234,7 @@ InternalPeiCreateHob (
   @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's entry point.\r
 \r
 **/\r
 VOID\r
@@ -228,6 +255,11 @@ BuildModuleHob (
   Hob->MemoryAllocationHeader.MemoryLength      = ModuleLength;\r
   Hob->MemoryAllocationHeader.MemoryType        = EfiBootServicesCode;\r
 \r
+  //\r
+  // Zero the reserved space to match HOB spec\r
+  //\r
+  ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));\r
+  \r
   CopyGuid (&Hob->ModuleName, ModuleName);\r
   Hob->EntryPoint = EntryPoint;\r
 }\r
@@ -418,6 +450,11 @@ BuildCpuHob (
 \r
   Hob->SizeOfMemorySpace = SizeOfMemorySpace;\r
   Hob->SizeOfIoSpace     = SizeOfIoSpace;\r
+\r
+  //\r
+  // Zero the reserved space to match HOB spec\r
+  //\r
+  ZeroMem (Hob->Reserved, sizeof (Hob->Reserved)); \r
 }\r
 \r
 /**\r
@@ -447,6 +484,11 @@ BuildStackHob (
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
   Hob->AllocDescriptor.MemoryLength      = Length;\r
   Hob->AllocDescriptor.MemoryType        = EfiConventionalMemory;\r
+\r
+  //\r
+  // Zero the reserved space to match HOB spec\r
+  //\r
+  ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));\r
 }\r
 \r
 /**\r
@@ -478,6 +520,11 @@ BuildBspStoreHob (
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
   Hob->AllocDescriptor.MemoryLength      = Length;\r
   Hob->AllocDescriptor.MemoryType        = MemoryType;\r
+\r
+  //\r
+  // Zero the reserved space to match HOB spec\r
+  //\r
+  ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));\r
 }\r
 \r
 /**\r
@@ -509,4 +556,8 @@ BuildMemoryAllocationHob (
   Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r
   Hob->AllocDescriptor.MemoryLength      = Length;\r
   Hob->AllocDescriptor.MemoryType        = MemoryType;\r
+  //\r
+  // Zero the reserved space to match HOB spec\r
+  //\r
+  ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));\r
 }\r