EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

MdePkg/Library/DxeHobLib/HobLib.c

Go to the documentation of this file.
00001 
00015 #include <PiDxe.h>
00016 
00017 #include <Guid/HobList.h>
00018 
00019 #include <Library/HobLib.h>
00020 #include <Library/UefiLib.h>
00021 #include <Library/DebugLib.h>
00022 #include <Library/BaseMemoryLib.h>
00023 
00024 VOID  *mHobList = NULL;
00025 
00039 EFI_STATUS
00040 EFIAPI
00041 HobLibConstructor (
00042   IN EFI_HANDLE        ImageHandle,
00043   IN EFI_SYSTEM_TABLE  *SystemTable
00044   )
00045 {
00046   EFI_STATUS  Status;
00047 
00048   Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &mHobList);
00049   ASSERT_EFI_ERROR (Status);
00050   ASSERT (mHobList != NULL);
00051 
00052   return Status;
00053 }
00054 
00071 VOID *
00072 EFIAPI
00073 GetHobList (
00074   VOID
00075   )
00076 {
00077   ASSERT (mHobList != NULL);
00078   return mHobList;
00079 }
00080 
00098 VOID *
00099 EFIAPI
00100 GetNextHob (
00101   IN UINT16                 Type,
00102   IN CONST VOID             *HobStart
00103   )
00104 {
00105   EFI_PEI_HOB_POINTERS  Hob;
00106 
00107   ASSERT (HobStart != NULL);
00108    
00109   Hob.Raw = (UINT8 *) HobStart;
00110   //
00111   // Parse the HOB list until end of list or matching type is found.
00112   //
00113   while (!END_OF_HOB_LIST (Hob)) {
00114     if (Hob.Header->HobType == Type) {
00115       return Hob.Raw;
00116     }
00117     Hob.Raw = GET_NEXT_HOB (Hob);
00118   }
00119   return NULL;
00120 }
00121 
00135 VOID *
00136 EFIAPI
00137 GetFirstHob (
00138   IN UINT16                 Type
00139   )
00140 {
00141   VOID      *HobList;
00142 
00143   HobList = GetHobList ();
00144   return GetNextHob (Type, HobList);
00145 }
00146 
00169 VOID *
00170 EFIAPI
00171 GetNextGuidHob (
00172   IN CONST EFI_GUID         *Guid,
00173   IN CONST VOID             *HobStart
00174   )
00175 {
00176   EFI_PEI_HOB_POINTERS  GuidHob;
00177 
00178   GuidHob.Raw = (UINT8 *) HobStart;
00179   while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
00180     if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
00181       break;
00182     }
00183     GuidHob.Raw = GET_NEXT_HOB (GuidHob);
00184   }
00185   return GuidHob.Raw;
00186 }
00187 
00206 VOID *
00207 EFIAPI
00208 GetFirstGuidHob (
00209   IN CONST EFI_GUID         *Guid
00210   )
00211 {
00212   VOID      *HobList;
00213 
00214   HobList = GetHobList ();
00215   return GetNextGuidHob (Guid, HobList);
00216 }
00217 
00231 EFI_BOOT_MODE
00232 EFIAPI
00233 GetBootModeHob (
00234   VOID
00235   )
00236 {
00237   EFI_HOB_HANDOFF_INFO_TABLE    *HandOffHob;
00238 
00239   HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
00240 
00241   return  HandOffHob->BootMode;
00242 }
00243 
00260 VOID
00261 EFIAPI
00262 BuildModuleHob (
00263   IN CONST EFI_GUID         *ModuleName,
00264   IN EFI_PHYSICAL_ADDRESS   MemoryAllocationModule,
00265   IN UINT64                 ModuleLength,
00266   IN EFI_PHYSICAL_ADDRESS   EntryPoint
00267   )
00268 {
00269   //
00270   // PEI HOB is read only for DXE phase
00271   //
00272   ASSERT (FALSE);
00273 }
00274 
00290 VOID
00291 EFIAPI
00292 BuildResourceDescriptorHob (
00293   IN EFI_RESOURCE_TYPE            ResourceType,
00294   IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
00295   IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
00296   IN UINT64                       NumberOfBytes
00297   )
00298 {
00299   //
00300   // PEI HOB is read only for DXE phase
00301   //
00302   ASSERT (FALSE);
00303 }
00304 
00326 VOID *
00327 EFIAPI
00328 BuildGuidHob (
00329   IN CONST EFI_GUID              *Guid,
00330   IN UINTN                       DataLength
00331   )
00332 {
00333   //
00334   // PEI HOB is read only for DXE phase
00335   //
00336   ASSERT (FALSE);
00337   return NULL;
00338 }
00339 
00364 VOID *
00365 EFIAPI
00366 BuildGuidDataHob (
00367   IN CONST EFI_GUID              *Guid,
00368   IN VOID                        *Data,
00369   IN UINTN                       DataLength
00370   )
00371 {
00372   //
00373   // PEI HOB is read only for DXE phase
00374   //
00375   ASSERT (FALSE);
00376   return NULL;
00377 }
00378 
00392 VOID
00393 EFIAPI
00394 BuildFvHob (
00395   IN EFI_PHYSICAL_ADDRESS        BaseAddress,
00396   IN UINT64                      Length
00397   )
00398 {
00399   //
00400   // PEI HOB is read only for DXE phase
00401   //
00402   ASSERT (FALSE);
00403 }
00404 
00420 VOID
00421 EFIAPI
00422 BuildFv2Hob (
00423   IN          EFI_PHYSICAL_ADDRESS        BaseAddress,
00424   IN          UINT64                      Length,
00425   IN CONST    EFI_GUID                    *FvName,
00426   IN CONST    EFI_GUID                    *FileName
00427   )
00428 {
00429   ASSERT (FALSE);
00430 }
00431 
00432 
00447 VOID
00448 EFIAPI
00449 BuildCvHob (
00450   IN EFI_PHYSICAL_ADDRESS        BaseAddress,
00451   IN UINT64                      Length
00452   )
00453 {
00454   //
00455   // PEI HOB is read only for DXE phase
00456   //
00457   ASSERT (FALSE);
00458 }
00459 
00473 VOID
00474 EFIAPI
00475 BuildCpuHob (
00476   IN UINT8                       SizeOfMemorySpace,
00477   IN UINT8                       SizeOfIoSpace
00478   )
00479 {
00480   //
00481   // PEI HOB is read only for DXE phase
00482   //
00483   ASSERT (FALSE);
00484 }
00485 
00499 VOID
00500 EFIAPI
00501 BuildStackHob (
00502   IN EFI_PHYSICAL_ADDRESS        BaseAddress,
00503   IN UINT64                      Length
00504   )
00505 {
00506   //
00507   // PEI HOB is read only for DXE phase
00508   //
00509   ASSERT (FALSE);
00510 }
00511 
00526 VOID
00527 EFIAPI
00528 BuildBspStoreHob (
00529   IN EFI_PHYSICAL_ADDRESS        BaseAddress,
00530   IN UINT64                      Length,
00531   IN EFI_MEMORY_TYPE             MemoryType
00532   )
00533 {
00534   //
00535   // PEI HOB is read only for DXE phase
00536   //
00537   ASSERT (FALSE);
00538 }
00539 
00554 VOID
00555 EFIAPI
00556 BuildMemoryAllocationHob (
00557   IN EFI_PHYSICAL_ADDRESS        BaseAddress,
00558   IN UINT64                      Length,
00559   IN EFI_MEMORY_TYPE             MemoryType
00560   )
00561 {
00562   //
00563   // PEI HOB is read only for DXE phase
00564   //
00565   ASSERT (FALSE);
00566 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines