X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=MdePkg%2FLibrary%2FDxeCoreHobLib%2FHobLib.c;h=d94225e0a4037861ebfd85287203fb27607b6ecf;hb=8693ca5d75564ee4869a3044b1c9b0982f425498;hp=45336c5e543ecff23610327bfee03e6b2641ffff;hpb=5f10fa0140f7100aa04c12f87d63a66755d20d58;p=mirror_edk2.git diff --git a/MdePkg/Library/DxeCoreHobLib/HobLib.c b/MdePkg/Library/DxeCoreHobLib/HobLib.c index 45336c5e54..d94225e0a4 100644 --- a/MdePkg/Library/DxeCoreHobLib/HobLib.c +++ b/MdePkg/Library/DxeCoreHobLib/HobLib.c @@ -1,7 +1,7 @@ /** @file HOB Library. - Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -15,9 +15,21 @@ **/ +// +// The package level header files this module uses +// +#include +// +// The protocols, PPI and GUID defintions for this module +// +// +// The Library classes this module consumes +// +#include +#include +#include -extern VOID *gHobList; - +#include "InternalHobLib.h" /** Returns the pointer to the HOB list. @@ -39,7 +51,7 @@ GetHobList ( /** Returns the next instance of a HOB type from the starting HOB. - This function searches the first instance of a HOB type from the starting HOB pointer. + This function searches the first instance of a HOB type from the starting HOB pointer. If there does not exist such HOB type from the starting HOB pointer, it will return NULL. In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer unconditionally: it returns HobStart back if HobStart itself meets the requirement; @@ -62,7 +74,7 @@ GetNextHob ( EFI_PEI_HOB_POINTERS Hob; ASSERT (HobStart != NULL); - + Hob.Raw = (UINT8 *) HobStart; // // Parse the HOB list until end of list or matching type is found. @@ -79,8 +91,8 @@ GetNextHob ( /** Returns the first instance of a HOB type among the whole HOB list. - This function searches the first instance of a HOB type among the whole HOB list. - If there does not exist such HOB type in the HOB list, it will return NULL. + This function searches the first instance of a HOB type among the whole HOB list. + If there does not exist such HOB type in the HOB list, it will return NULL. @param Type The HOB type to return. @@ -100,10 +112,10 @@ GetFirstHob ( } /** - This function searches the first instance of a HOB from the starting HOB pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. - If there does not exist such HOB from the starting HOB pointer, it will return NULL. + This function searches the first instance of a HOB from the starting HOB pointer. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. + If there does not exist such HOB from the starting HOB pointer, it will return NULL. Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its size info respectively. In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer @@ -138,7 +150,7 @@ GetNextGuidHob ( } /** - This function searches the first instance of a HOB among the whole HOB list. + This function searches the first instance of a HOB among the whole HOB list. Such HOB should satisfy two conditions: its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. If there does not exist such HOB from the starting HOB pointer, it will return NULL. @@ -163,6 +175,29 @@ GetFirstGuidHob ( return GetNextGuidHob (Guid, HobList); } +/** + Get the Boot Mode from the HOB list. + + This function returns the system boot mode information from the + PHIT HOB in HOB list. + + @param VOID + + @return The Boot Mode. + +**/ +EFI_BOOT_MODE +EFIAPI +GetBootModeHob ( + VOID + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); + + return HandOffHob->BootMode; +} /** Builds a HOB for a loaded PE32 module. @@ -175,7 +210,7 @@ GetFirstGuidHob ( @param ModuleName The GUID File Name of the module. @param MemoryAllocationModule The 64 bit physical address of the module. @param ModuleLength The length of the module in bytes. - @param EntryPoint The 64 bit physical address of the module’s entry point. + @param EntryPoint The 64 bit physical address of the module's entry point. **/ VOID @@ -225,14 +260,14 @@ BuildResourceDescriptorHob ( /** Builds a GUID HOB with a certain data length. - This function builds a customized HOB tagged with a GUID for identification - and returns the start address of GUID HOB data so that caller can fill the customized data. + This function builds a customized HOB tagged with a GUID for identification + and returns the start address of GUID HOB data so that caller can fill the customized data. The HOB Header and Name field is already stripped. It can only be invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. If Guid is NULL, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0x10000 - sizeof (EFI_HOB_TYPE_GUID)), then ASSERT(). + If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). @param Guid The GUID to tag the customized HOB. @param DataLength The size of the data payload for the GUID HOB. @@ -265,7 +300,7 @@ BuildGuidHob ( If Guid is NULL, then ASSERT(). If Data is NULL and DataLength > 0, then ASSERT(). If there is no additional space for HOB creation, then ASSERT(). - If DataLength > (0x10000 - sizeof (EFI_HOB_TYPE_GUID)), then ASSERT(). + If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). @param Guid The GUID to tag the customized HOB. @param Data The data to be copied into the data field of the GUID HOB.