17UINT8 gShowType = SHOW_DETAIL;
21UINT8 SmbiosMajorVersion;
22UINT8 SmbiosMinorVersion;
24UINTN mNumberOfSmbios64BitStructures;
25UINTN mSmbios64BitTableLength;
59 mStatisticsTable =
NULL;
60 mSmbios64BitStatisticsTable =
NULL;
65 if (EFI_ERROR (Status)) {
66 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
100 if (EFI_ERROR (Status1) && EFI_ERROR (Status2)) {
106 StructType = STRUCTURE_TYPE_RANDOM;
115 gShowType = SHOW_ALL;
118 if (!EFI_ERROR (Status1)) {
122 StructHandle = INVALID_HANDLE;
135 if (EFI_ERROR (Status)) {
142 if (EFI_ERROR (Status)) {
152 Status =
SMBiosView (StructType, StructHandle, gShowType, RandomView);
153 if (EFI_ERROR (Status)) {
160 if (!EFI_ERROR (Status2)) {
165 if (EFI_ERROR (Status)) {
173 StructHandle = INVALID_HANDLE;
184 if (EFI_ERROR (Status)) {
194 Status =
SMBios64View (StructType, StructHandle, gShowType, RandomView);
195 if (EFI_ERROR (Status)) {
206 if (mStatisticsTable !=
NULL) {
211 mStatisticsTable =
NULL;
214 if (mSmbios64BitStatisticsTable !=
NULL) {
218 FreePool (mSmbios64BitStatisticsTable);
219 mSmbios64BitStatisticsTable =
NULL;
222 if (Package !=
NULL) {
247 IN UINT16 QueryHandle,
249 IN BOOLEAN RandomView
262 if (SMBiosTable ==
NULL) {
264 return EFI_BAD_BUFFER_SIZE;
273 SmbiosMajorVersion = SMBiosTable->MajorVersion;
274 SmbiosMinorVersion = SMBiosTable->MinorVersion;
276 ShellPrintEx (-1, -1, L
"=========================================================\n");
279 if (QueryType == STRUCTURE_TYPE_RANDOM) {
312 Handle = QueryHandle;
313 for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) {
317 if (Handle == INVALID_HANDLE) {
328 SmbiosStruct.Raw = Buffer;
335 if ((QueryType != STRUCTURE_TYPE_RANDOM) && (SmbiosStruct.Hdr->Type != QueryType)) {
339 ShellPrintEx (-1, -1, L
"\n=========================================================\n");
344 STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),
345 gShellDebug1HiiHandle,
346 SmbiosStruct.Hdr->Type,
347 SmbiosStruct.Hdr->Handle
354 DumpHex (0, 0, Length, Buffer);
370 if (gShowType != SHOW_NONE) {
404 ShellPrintEx (-1, -1, L
"\n=========================================================\n");
408 return EFI_BAD_BUFFER_SIZE;
426 IN UINT16 QueryHandle,
428 IN BOOLEAN RandomView
440 if (SMBiosTable ==
NULL) {
442 return EFI_BAD_BUFFER_SIZE;
451 SmbiosMajorVersion = SMBiosTable->MajorVersion;
452 SmbiosMinorVersion = SMBiosTable->MinorVersion;
454 ShellPrintEx (-1, -1, L
"=========================================================\n");
457 if (QueryType == STRUCTURE_TYPE_RANDOM) {
490 Handle = QueryHandle;
491 for (Index = 0; Index < mNumberOfSmbios64BitStructures; Index++) {
495 if (Handle == INVALID_HANDLE) {
506 SmbiosStruct.Raw = Buffer;
513 if ((QueryType != STRUCTURE_TYPE_RANDOM) && (SmbiosStruct.Hdr->Type != QueryType)) {
517 ShellPrintEx (-1, -1, L
"\n=========================================================\n");
522 STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),
523 gShellDebug1HiiHandle,
524 SmbiosStruct.Hdr->Type,
525 SmbiosStruct.Hdr->Handle
532 DumpHex (0, 0, Length, Buffer);
548 if (gShowType != SHOW_NONE) {
582 ShellPrintEx (-1, -1, L
"\n=========================================================\n");
586 return EFI_BAD_BUFFER_SIZE;
611 if (SMBiosTable ==
NULL) {
613 return EFI_NOT_FOUND;
618 return EFI_INVALID_PARAMETER;
624 if (mStatisticsTable !=
NULL) {
626 mStatisticsTable =
NULL;
631 if (mStatisticsTable ==
NULL) {
633 return EFI_OUT_OF_RESOURCES;
637 StatisticsPointer = mStatisticsTable;
642 Handle = INVALID_HANDLE;
644 for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) {
648 if (Handle == INVALID_HANDLE) {
659 SmbiosStruct.Raw = Buffer;
664 StatisticsPointer->Index = Index;
665 StatisticsPointer->Type = SmbiosStruct.Hdr->Type;
666 StatisticsPointer->Handle = SmbiosStruct.Hdr->Handle;
667 StatisticsPointer->Length = Length;
668 StatisticsPointer->Addr = Offset;
670 Offset = (UINT16)(Offset + Length);
672 StatisticsPointer = &mStatisticsTable[Index];
688 UINTN *NumberOfSmbios64Structures,
689 UINTN *Smbios64TableLength
695 *Smbios64TableLength = 0;
696 *NumberOfSmbios64Structures = 0;
698 Smbios.Raw = (UINT8 *)(
UINTN)(Smbios64EntryPoint->TableAddress);
700 if (Smbios.Hdr->Type == 127) {
704 (*NumberOfSmbios64Structures)++;
717 (*Smbios64TableLength) += ((
UINTN)Smbios.Raw - (
UINTN)Raw);
718 if ((*Smbios64TableLength) > Smbios64EntryPoint->TableMaximumSize) {
723 return EFI_INVALID_PARAMETER;
726 (*NumberOfSmbios64Structures)++;
752 if (SMBiosTable ==
NULL) {
754 return EFI_NOT_FOUND;
759 return EFI_INVALID_PARAMETER;
765 if (mSmbios64BitStatisticsTable !=
NULL) {
766 FreePool (mSmbios64BitStatisticsTable);
767 mSmbios64BitStatisticsTable =
NULL;
774 if ((EFI_ERROR (Status)) || (mSmbios64BitTableLength > SMBiosTable->TableMaximumSize)) {
775 return EFI_INVALID_PARAMETER;
780 if (mSmbios64BitStatisticsTable ==
NULL) {
782 return EFI_OUT_OF_RESOURCES;
786 StatisticsPointer = mSmbios64BitStatisticsTable;
791 Handle = INVALID_HANDLE;
793 for (Index = 1; (
UINTN)Index <= mNumberOfSmbios64BitStructures; Index++) {
797 if (Handle == INVALID_HANDLE) {
808 SmbiosStruct.Raw = Buffer;
813 StatisticsPointer->Index = Index;
814 StatisticsPointer->Type = SmbiosStruct.Hdr->Type;
815 StatisticsPointer->Handle = SmbiosStruct.Hdr->Handle;
816 StatisticsPointer->Length = Length;
817 StatisticsPointer->Addr = Offset;
819 Offset = (UINT16)(Offset + Length);
821 StatisticsPointer = &mSmbios64BitStatisticsTable[Index];
845 if (Option < SHOW_OUTLINE) {
853 if (SMBiosTable ==
NULL) {
855 return EFI_UNSUPPORTED;
858 ShellPrintEx (-1, -1, L
"\n============================================================\n");
861 if (Option < SHOW_NORMAL) {
865 if (mStatisticsTable ==
NULL) {
867 return EFI_NOT_FOUND;
870 ShellPrintEx (-1, -1, L
"============================================================\n");
871 StatisticsPointer = &mStatisticsTable[0];
872 Num = SMBiosTable->NumberOfSmbiosStructures;
876 for (Index = 1; Index <= Num; Index++) {
880 if (Option >= SHOW_DETAIL) {
886 StatisticsPointer = &mStatisticsTable[Index];
927 if (Option < SHOW_OUTLINE) {
935 if (SMBiosTable ==
NULL) {
937 return EFI_UNSUPPORTED;
940 ShellPrintEx (-1, -1, L
"\n============================================================\n");
943 if (Option < SHOW_NORMAL) {
947 if (mSmbios64BitStatisticsTable ==
NULL) {
949 return EFI_NOT_FOUND;
952 ShellPrintEx (-1, -1, L
"============================================================\n");
953 StatisticsPointer = &mSmbios64BitStatisticsTable[0];
954 Num = mNumberOfSmbios64BitStructures;
958 for (Index = 1; Index <= Num; Index++) {
962 if (Option >= SHOW_DETAIL) {
968 StatisticsPointer = &mSmbios64BitStatisticsTable[Index];
1008 return L
"SHOW_NONE";
1011 return L
"SHOW_OUTLINE";
1014 return L
"SHOW_NORMAL";
1017 return L
"SHOW_DETAIL";
1023 return L
"Undefined type";
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define SMBIOS_3_0_ANCHOR_STRING
#define SMBIOS_ANCHOR_STRING
EFI_STATUS LibSmbiosInit(VOID)
EFI_STATUS LibGetSmbios64BitStructure(IN OUT UINT16 *Handle, OUT UINT8 **Buffer, OUT UINT16 *Length)
VOID LibSmbios64BitGetEPS(OUT SMBIOS_TABLE_3_0_ENTRY_POINT **EntryPointStructure)
EFI_STATUS LibGetSmbiosStructure(IN OUT UINT16 *Handle, OUT UINT8 **Buffer, OUT UINT16 *Length)
EFI_STATUS LibSmbios64BitInit(VOID)
CHAR8 * LibGetSmbiosString(IN SMBIOS_STRUCTURE_POINTER *Smbios, IN UINT16 StringNumber)
VOID LibSmbios64BitCleanup(VOID)
VOID LibSmbiosCleanup(VOID)
VOID LibSmbiosGetEPS(OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure)
@ SHELL_INVALID_PARAMETER
EFI_STATUS SmbiosPrintStructure(IN SMBIOS_STRUCTURE_POINTER *Struct, IN UINT8 Option)
VOID SmbiosPrintEPSInfo(IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable, IN UINT8 Option)
VOID Smbios64BitPrintEPSInfo(IN SMBIOS_TABLE_3_0_ENTRY_POINT *SmbiosTable, IN UINT8 Option)
VOID EFIAPI DumpHex(IN UINTN Indent, IN UINTN Offset, IN UINTN DataSize, IN VOID *UserData)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
BOOLEAN EFIAPI ShellGetExecutionBreakFlag(VOID)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
@ TypeFlag
A flag that is present or not present only (IE "-a").
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
EFI_STATUS DisplayStatisticsTable(IN UINT8 Option)
EFI_STATUS DisplaySmbios64BitStatisticsTable(IN UINT8 Option)
EFI_STATUS SMBios64View(IN UINT8 QueryType, IN UINT16 QueryHandle, IN UINT8 Option, IN BOOLEAN RandomView)
EFI_STATUS InitSmbiosTableStatistics(VOID)
EFI_STATUS CalculateSmbios64BitStructureCountAndLength(SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios64EntryPoint, UINTN *NumberOfSmbios64Structures, UINTN *Smbios64TableLength)
CHAR16 * GetShowTypeString(UINT8 ShowType)
EFI_STATUS InitSmbios64BitTableStatistics(VOID)
SHELL_STATUS EFIAPI ShellCommandRunSmbiosView(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS SMBiosView(IN UINT8 QueryType, IN UINT16 QueryHandle, IN UINT8 Option, IN BOOLEAN RandomView)