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

EmbeddedPkg/Ebl/Hob.c

Go to the documentation of this file.
00001 
00089 #include "Ebl.h"
00090 // BugBug: Autogen does not allow this to be included currently 
00091 //#include <EdkModulePkg/Include/EdkDxe.h>
00092 
00093 GLOBAL_REMOVE_IF_UNREFERENCED char *mHobResourceType[] = {
00094   "Memory     ",
00095   "MMIO       ",
00096   "IO         ",
00097   "Firmware   ",
00098   "MMIO Port  ",
00099   "Reserved   ",
00100   "IO Reserved",
00101   "Illegal    "
00102 };
00103 
00104 
00118 EFI_STATUS
00119 EblHobCmd (
00120   IN UINTN  Argc,
00121   IN CHAR8  **Argv
00122   )
00123 {
00124   UINTN                         CurrentRow;
00125   EFI_PEI_HOB_POINTERS          Hob;
00126   EFI_MEMORY_TYPE_INFORMATION   *EfiMemoryTypeInformation;
00127   UINTN                         Index;
00128 
00129   CurrentRow = 0;
00130   for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
00131     if (Hob.Header->HobType == EFI_HOB_TYPE_HANDOFF) {
00132       AsciiPrint ("PHIT HOB Ver %x Boot Mode %02x Top %lx  Bottom %lx\n", 
00133         Hob.HandoffInformationTable->Version, 
00134         Hob.HandoffInformationTable->BootMode, 
00135         Hob.HandoffInformationTable->EfiMemoryTop,
00136         Hob.HandoffInformationTable->EfiMemoryBottom
00137         );
00138 
00139       if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
00140         return EFI_SUCCESS;
00141       }
00142 
00143       AsciiPrint ("    Free Top %lx Free Bottom %lx  End Of HOB %lx\n", 
00144         Hob.HandoffInformationTable->EfiFreeMemoryTop,
00145         Hob.HandoffInformationTable->EfiFreeMemoryBottom,
00146         Hob.HandoffInformationTable->EfiEndOfHobList
00147         );
00148 
00149     } else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
00150       // mod(%) on array index is just to prevent buffer overrun
00151       AsciiPrint ("Mem Alloc HOB %a %g %08lx:%lx\n",
00152         (Hob.MemoryAllocation->AllocDescriptor.MemoryType < EfiMaxMemoryType) ? gMemMapType[Hob.MemoryAllocation->AllocDescriptor.MemoryType] : "ILLEGAL TYPE", 
00153         &Hob.MemoryAllocation->AllocDescriptor.Name, 
00154         Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress, 
00155         Hob.MemoryAllocation->AllocDescriptor.MemoryLength
00156         );
00157       if (CompareGuid (&gEfiHobMemoryAllocModuleGuid, &Hob.MemoryAllocation->AllocDescriptor.Name)) {
00158         if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
00159           return EFI_SUCCESS;
00160         }
00161         AsciiPrint ("    Module Name %g EntryPoint %lx\n", &Hob.MemoryAllocationModule->ModuleName, Hob.MemoryAllocationModule->EntryPoint);
00162       }
00163     } else if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
00164       AsciiPrint ("Resource HOB %a %g %08lx:%lx\n    Attributes: %08x\n",
00165         (Hob.ResourceDescriptor->ResourceType < EFI_RESOURCE_MAX_MEMORY_TYPE) ? mHobResourceType[Hob.ResourceDescriptor->ResourceType] : mHobResourceType[EFI_RESOURCE_MAX_MEMORY_TYPE],
00166         &Hob.ResourceDescriptor->Owner, 
00167         Hob.ResourceDescriptor->PhysicalStart, 
00168         Hob.ResourceDescriptor->ResourceLength, 
00169         Hob.ResourceDescriptor->ResourceAttribute
00170         );
00171         if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
00172           return EFI_SUCCESS;
00173         }
00174     } else if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) {
00175       AsciiPrint ("GUID HOB %g\n", &Hob.Guid->Name);
00176       if (CompareGuid (&gEfiMemoryTypeInformationGuid, &Hob.Guid->Name)) {
00177         EfiMemoryTypeInformation = GET_GUID_HOB_DATA (Hob.Guid);
00178         for (Index = 0; Index < (GET_GUID_HOB_DATA_SIZE (Hob.Guid)/sizeof (EFI_MEMORY_TYPE_INFORMATION)); Index++, EfiMemoryTypeInformation++) {
00179           if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
00180             return EFI_SUCCESS;
00181           }
00182           AsciiPrint ("    %a 0x%08x\n", 
00183             (EfiMemoryTypeInformation->Type < EfiMaxMemoryType) ? gMemMapType[EfiMemoryTypeInformation->Type] : "END       ", 
00184             EfiMemoryTypeInformation->NumberOfPages
00185             );
00186        }
00187       }
00188     } else if (Hob.Header->HobType == EFI_HOB_TYPE_FV) {
00189       AsciiPrint ("FV HOB %08lx:%08lx\n", Hob.FirmwareVolume->BaseAddress, Hob.FirmwareVolume->Length);  
00190     } else if (Hob.Header->HobType == EFI_HOB_TYPE_CPU) {
00191       AsciiPrint ("CPU HOB: Mem %x IO %x\n", Hob.Cpu->SizeOfMemorySpace, Hob.Cpu->SizeOfIoSpace);  
00192     } else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_POOL) {
00193       AsciiPrint ("Mem Pool HOB:\n");
00194 /* Not in PI
00195     } else if (Hob.Header->HobType == EFI_HOB_TYPE_CV) {
00196       AsciiPrint ("CV HOB: %08lx:%08lx\n", Hob.CapsuleVolume->BaseAddress, Hob.CapsuleVolume->Length);
00197  */
00198     }
00199 
00200     if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
00201       break;
00202     }    
00203   }
00204 
00205   return EFI_SUCCESS;
00206 }
00207 
00208 
00209 GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdHobTemplate[] =
00210 {
00211   {
00212     "hob",
00213     "; dump HOBs",
00214     NULL,
00215     EblHobCmd
00216   }
00217 };
00218 
00219 
00223 VOID
00224 EblInitializeHobCmd (
00225   VOID
00226   )
00227 {
00228   if (FeaturePcdGet (PcdEmbeddedHobCmd)) {
00229     EblAddCommands (mCmdHobTemplate, sizeof (mCmdHobTemplate)/sizeof (EBL_COMMAND_TABLE));
00230   }
00231 }
00232 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines