From 5d73d92f560b079f41f62e91d15ddc1fda897867 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Tue, 16 Nov 2010 22:36:37 +0000 Subject: Add "Debug1" profile (all but Edit and HexEdit commands) git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11068 6f19259b-4bc3-4df7-8a09-765794883524 --- .../SmbiosView/EventLogInfo.c | 394 ++ .../SmbiosView/EventLogInfo.h | 117 + .../SmbiosView/LibSmbios.h | 638 ++++ .../SmbiosView/LibSmbiosView.c | 349 ++ .../SmbiosView/LibSmbiosView.h | 120 + .../SmbiosView/PrintInfo.c | 2679 ++++++++++++++ .../SmbiosView/PrintInfo.h | 192 + .../SmbiosView/QueryTable.c | 3798 ++++++++++++++++++++ .../SmbiosView/QueryTable.h | 430 +++ .../UefiShellDebug1CommandsLib/SmbiosView/Smbios.c | 126 + .../SmbiosView/SmbiosView.c | 547 +++ .../SmbiosView/SmbiosViewStrings.uni | Bin 0 -> 93278 bytes .../SmbiosView/smbiosview.h | 91 + 13 files changed, 9481 insertions(+) create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbios.h create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni create mode 100644 ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/smbiosview.h (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView') diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c new file mode 100644 index 0000000000..f0a9d54b73 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c @@ -0,0 +1,394 @@ +/** + Module for clarifying the content of the smbios structure element info. + + Copyright (c) 2005-2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "../UefiShellDebug1CommandsLib.h" +#include "PrintInfo.h" +#include "QueryTable.h" +#include "EventLogInfo.h" + +/** + Function to display system event log access information. + + @param[in] Key Additional information to print. + @param[in] Option Whether to print the additional information. +**/ +VOID +EFIAPI +DisplaySELAccessMethod ( + IN CONST UINT8 Key, + IN CONST UINT8 Option + ) +{ + // + // Print prompt + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + + // + // Print value info + // + switch (Key) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle); + break; + + case 4: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle); + break; + + default: + if (Key <= 0x7f) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle); + } + } +} + +/** + Function to display system event log status information. + + @param[in] Key Additional information to print. + @param[in] Option Whether to print the additional information. +**/ +VOID +EFIAPI +DisplaySELLogStatus ( + UINT8 Key, + UINT8 Option + ) +{ + // + // Print prompt + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + + // + // Print value info + // + if ((Key & 0x01) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle); + } + + if ((Key & 0x02) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle); + } + + if ((Key & 0xFC) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC); + } +} + +/** + Function to display system event log header format information. + + @param[in] Key Additional information to print. + @param[in] Option Whether to print the additional information. +**/ +VOID +EFIAPI +DisplaySysEventLogHeaderFormat ( + UINT8 Key, + UINT8 Option + ) +{ + // + // Print prompt + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + + // + // Print value info + // + if (Key == 0x00) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle); + } else if (Key == 0x01) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle); + } else if (Key <= 0x7f) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle); + } +} + +VOID +DisplaySELLogHeaderLen ( + UINT8 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F); + + // + // The most-significant bit of the field specifies + // whether (0) or not (1) the record has been read + // + if ((Key & 0x80) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle); + } +} + +VOID +DisplaySysEventLogHeaderType1 ( + UINT8 *LogHeader + ) +{ + LOG_HEADER_TYPE1_FORMAT *Header; + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle); + + // + // Print Log Header Type1 Format info + // + Header = (LOG_HEADER_TYPE1_FORMAT *) (LogHeader); + + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED), + gShellDebug1HiiHandle, + Header->OEMReserved[0], + Header->OEMReserved[1], + Header->OEMReserved[2], + Header->OEMReserved[3], + Header->OEMReserved[4] + ); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->METW); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->MECI); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset); + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED), + gShellDebug1HiiHandle, + Header->OEMReserved[0], + Header->OEMReserved[1], + Header->OEMReserved[2] + ); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision); +} + +/** + Function to display system event log header information. + + @param[in] LogHeaderFormat Format identifier. + @param[in] LogHeader Format informcation. +**/ +VOID +EFIAPI +DisplaySysEventLogHeader ( + UINT8 LogHeaderFormat, + UINT8 *LogHeader + ) +{ + // + // Print prompt + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle); + + // + // Print value info + // + if (LogHeaderFormat == 0x00) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle); + } else if (LogHeaderFormat == 0x01) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle); + DisplaySysEventLogHeaderType1 (LogHeader); + } else if (LogHeaderFormat <= 0x7f) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle); + } +} + +VOID +DisplayElVdfInfo ( + UINT8 ElVdfType, + UINT8 *VarData + ) +{ + UINT16 *Word; + UINT32 *Dword; + + // + // Display Type Name + // + DisplaySELVarDataFormatType (ElVdfType, SHOW_DETAIL); + + // + // Display Type description + // + switch (ElVdfType) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle); + break; + + case 1: + Word = (UINT16 *) (VarData + 1); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word); + break; + + case 2: + Dword = (UINT32 *) (VarData + 1); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword); + break; + + case 3: + Word = (UINT16 *) (VarData + 1); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word); + // + // Followed by a multiple-event counter + // + Dword = (UINT32 *) (VarData + 1); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword); + break; + + case 4: + Dword = (UINT32 *) (VarData + 1); + DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL); + Dword++; + DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL); + break; + + case 5: + Dword = (UINT32 *) (VarData + 1); + DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL); + break; + + case 6: + Dword = (UINT32 *) (VarData + 1); + DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL); + // + // Followed by a multiple-event counter + // + Dword = (UINT32 *) (VarData + 1); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword); + break; + + default: + if (ElVdfType <= 0x7F) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle); + } + } +} + +/** + Function to display system event log data. + + @param[in] LogData The data information. + @param[in] LogAreaLength Length of the data. +**/ +VOID +EFIAPI +DisplaySysEventLogData ( + UINT8 *LogData, + UINT16 LogAreaLength + ) +{ + LOG_RECORD_FORMAT *Log; + UINT8 ElVdfType; + // + // Event Log Variable Data Format Types + // + UINTN Offset; + + // + // Print prompt + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle); + + // + // Print Log info + // + Offset = 0; + Log = (LOG_RECORD_FORMAT *) LogData; + while (Log->Type != END_OF_LOG && Offset < LogAreaLength) { + // + // Get a Event Log Record + // + Log = (LOG_RECORD_FORMAT *) (LogData + Offset); + + // + // Display Event Log Record Information + // + DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL); + DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL); + + Offset += Log->Length; + + // + // Display Log Header Date/Time Fields + // These fields contain the BCD representation of the date and time + // (as read from CMOS) of the occurrence of the event + // So Print as hex and represent decimal + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle); + if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) { + Print (L"19"); + } else if (Log != NULL && Log->Year <= 79) { + Print (L"20"); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle); + continue; + } + + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS), + gShellDebug1HiiHandle, + Log->Year, + Log->Month, + Log->Day, + Log->Hour, + Log->Minute, + Log->Second + ); + + // + // Display Variable Data Format + // + if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) { + continue; + } + + ElVdfType = Log->LogVariableData[0]; + DisplayElVdfInfo (ElVdfType, Log->LogVariableData); + } +} diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h new file mode 100644 index 0000000000..62d7d77fdf --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.h @@ -0,0 +1,117 @@ +/** + Module to clarify system event log of smbios structure. + + Copyright (c) 2005-2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _SMBIOS_EVENT_LOG_INFO_H +#define _SMBIOS_EVENT_LOG_INFO_H + +#define END_OF_LOG 0xFF + +#pragma pack(1) + +typedef struct { + UINT8 Type; + UINT8 Length; + UINT8 Year; + UINT8 Month; + UINT8 Day; + UINT8 Hour; + UINT8 Minute; + UINT8 Second; + UINT8 LogVariableData[1]; +} LOG_RECORD_FORMAT; + +typedef struct { + UINT8 OEMReserved[5]; + UINT8 METW; // Multiple Event Time Window + UINT8 MECI; // Multiple Event Count Increment + UINT8 CMOSAddress; // Pre-boot Event Log Reset - CMOS Address + UINT8 CMOSBitIndex; // Pre-boot Event Log Reset - CMOS Bit Index + UINT8 StartingOffset; // CMOS Checksum - Starting Offset + UINT8 ByteCount; // CMOS Checksum - Byte Count + UINT8 ChecksumOffset; // CMOS Checksum - Checksum Offset + UINT8 Reserved[3]; + UINT8 HeaderRevision; +} LOG_HEADER_TYPE1_FORMAT; + +#pragma pack() +// +// System Event Log (Type 15) +// + +/** + Function to display system event log access information. + + @param[in] Key Additional information to print. + @param[in] Option Whether to print the additional information. +**/ +VOID +EFIAPI +DisplaySELAccessMethod ( + IN CONST UINT8 Key, + IN CONST UINT8 Option + ); + +/** + Function to display system event log status information. + + @param[in] Key Additional information to print. + @param[in] Option Whether to print the additional information. +**/ +VOID +EFIAPI +DisplaySELLogStatus ( + UINT8 Key, + UINT8 Option + ); + +/** + Function to display system event log header format information. + + @param[in] Key Additional information to print. + @param[in] Option Whether to print the additional information. +**/ +VOID +EFIAPI +DisplaySysEventLogHeaderFormat ( + UINT8 Key, + UINT8 Option + ); + +/** + Function to display system event log header information. + + @param[in] LogHeaderFormat Format identifier. + @param[in] LogHeader Format informcation. +**/ +VOID +EFIAPI +DisplaySysEventLogHeader ( + UINT8 LogHeaderFormat, + UINT8 *LogHeader + ); + +/** + Function to display system event log data. + + @param[in] LogData The data information. + @param[in] LogAreaLength Length of the data. +**/ +VOID +EFIAPI +DisplaySysEventLogData ( + UINT8 *LogData, + UINT16 LogAreaLength + ); + +#endif diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbios.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbios.h new file mode 100644 index 0000000000..d1ecc858ac --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbios.h @@ -0,0 +1,638 @@ +/** @file + Lib include for SMBIOS services. Used to get system serial number and GUID + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _LIB_SMBIOS_H +#define _LIB_SMBIOS_H + +// +// Define SMBIOS tables. +// +#pragma pack(1) + +typedef UINT8 SMBIOS_STRING; + +typedef struct { + UINT8 AnchorString[4]; + UINT8 EntryPointStructureChecksum; + UINT8 EntryPointLength; + UINT8 MajorVersion; + UINT8 MinorVersion; + UINT16 MaxStructureSize; + UINT8 EntryPointRevision; + UINT8 FormattedArea[5]; + UINT8 IntermediateAnchorString[5]; + UINT8 IntermediateChecksum; + UINT16 TableLength; + UINT32 TableAddress; + UINT16 NumberOfSmbiosStructures; + UINT8 SmbiosBcdRevision; +} SMBIOS_STRUCTURE_TABLE; + +// +// Please note that SMBIOS structures can be odd byte aligned since the +// unformated section of each record is a set of arbitrary size strings. +// +typedef struct { + UINT8 Type; + UINT8 Length; + UINT16 Handle; +} SMBIOS_HEADER; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Vendor; + SMBIOS_STRING BiosVersion; + UINT16 BiosSegment; + SMBIOS_STRING BiosReleaseDate; + UINT8 BiosSize; + UINT64 BiosCharacteristics; + UINT8 BIOSCharacteristicsExtensionBytes[2]; + UINT8 SystemBiosMajorRelease; + UINT8 SystemBiosMinorRelease; + UINT8 EmbeddedControllerFirmwareMajorRelease; + UINT8 EmbeddedControllerFirmwareMinorRelease; +} SMBIOS_TYPE0; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Manufacturer; + SMBIOS_STRING ProductName; + SMBIOS_STRING Version; + SMBIOS_STRING SerialNumber; + EFI_GUID Uuid; + UINT8 WakeUpType; + SMBIOS_STRING SKUNumber; + SMBIOS_STRING Family; +} SMBIOS_TYPE1; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Manufacturer; + SMBIOS_STRING ProductName; + SMBIOS_STRING Version; + SMBIOS_STRING SerialNumber; + SMBIOS_STRING AssetTag; + UINT8 FeatureFlag; + SMBIOS_STRING LocationInChassis; + UINT16 ChassisHandle; + UINT8 BoardType; + UINT8 NumberOfContainedObjectHandles; + UINT16 ContainedObjectHandles[1]; +} SMBIOS_TYPE2; + +typedef struct { + UINT8 ContainedElementType; + UINT8 ContainedElementMinimum; + UINT8 ContainedElementMaximum; +} CONTAINED_ELEMENT; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Manufacturer; + UINT8 Type; + SMBIOS_STRING Version; + SMBIOS_STRING SerialNumber; + SMBIOS_STRING AssetTag; + UINT8 BootupState; + UINT8 PowerSupplyState; + UINT8 ThermalState; + UINT8 SecurityStatus; + UINT8 OemDefined[4]; + UINT8 Height; + UINT8 NumberofPowerCords; + UINT8 ContainedElementCount; + UINT8 ContainedElementRecordLength; + CONTAINED_ELEMENT ContainedElements[1]; +} SMBIOS_TYPE3; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 Socket; + UINT8 ProcessorType; + UINT8 ProcessorFamily; + SMBIOS_STRING ProcessorManufacture; + UINT8 ProcessorId[8]; + SMBIOS_STRING ProcessorVersion; + UINT8 Voltage; + UINT16 ExternalClock; + UINT16 MaxSpeed; + UINT16 CurrentSpeed; + UINT8 Status; + UINT8 ProcessorUpgrade; + UINT16 L1CacheHandle; + UINT16 L2CacheHandle; + UINT16 L3CacheHandle; + SMBIOS_STRING SerialNumber; + SMBIOS_STRING AssetTag; + SMBIOS_STRING PartNumber; + // + // Add for smbios 2.5 + // + UINT8 CoreCount; + UINT8 EnabledCoreCount; + UINT8 ThreadCount; + UINT16 ProcessorCharacteristics; + // + // Add for smbios 2.6 + // + UINT16 ProcessorFamily2; +} SMBIOS_TYPE4; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 ErrDetectMethod; + UINT8 ErrCorrectCapability; + UINT8 SupportInterleave; + UINT8 CurrentInterleave; + UINT8 MaxMemoryModuleSize; + UINT16 SupportSpeed; + UINT16 SupportMemoryType; + UINT8 MemoryModuleVoltage; + UINT8 AssociatedMemorySlotNum; + UINT16 MemoryModuleConfigHandles[1]; +} SMBIOS_TYPE5; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING SocketDesignation; + UINT8 BankConnections; + UINT8 CurrentSpeed; + UINT16 CurrentMemoryType; + UINT8 InstalledSize; + UINT8 EnabledSize; + UINT8 ErrorStatus; +} SMBIOS_TYPE6; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING SocketDesignation; + UINT16 CacheConfiguration; + UINT16 MaximumCacheSize; + UINT16 InstalledSize; + UINT16 SupportedSRAMType; + UINT16 CurrentSRAMType; + UINT8 CacheSpeed; + UINT8 ErrorCorrectionType; + UINT8 SystemCacheType; + UINT8 Associativity; +} SMBIOS_TYPE7; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING InternalReferenceDesignator; + UINT8 InternalConnectorType; + SMBIOS_STRING ExternalReferenceDesignator; + UINT8 ExternalConnectorType; + UINT8 PortType; +} SMBIOS_TYPE8; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING SlotDesignation; + UINT8 SlotType; + UINT8 SlotDataBusWidth; + UINT8 CurrentUsage; + UINT8 SlotLength; + UINT16 SlotID; + UINT8 SlotCharacteristics1; + UINT8 SlotCharacteristics2; + // + // Add for smbios 2.6 + // + UINT16 SegmentGroupNum; + UINT8 BusNum; + UINT8 DevFuncNum; +} SMBIOS_TYPE9; + +typedef struct DeviceStruct { + UINT8 DeviceType; + SMBIOS_STRING DescriptionString; +} DeviceStruct; + +typedef struct { + SMBIOS_HEADER Hdr; + DeviceStruct Device[1]; +} SMBIOS_TYPE10; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 StringCount; +} SMBIOS_TYPE11; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 StringCount; +} SMBIOS_TYPE12; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 InstallableLanguages; + UINT8 Flags; + UINT8 reserved[15]; + SMBIOS_STRING CurrentLanguages; +} SMBIOS_TYPE13; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING GroupName; + UINT8 ItemType; + UINT16 ItemHandle; +} SMBIOS_TYPE14; + +typedef struct EVENTLOGTYPE { + UINT8 LogType; + UINT8 DataFormatType; +} EVENTLOGTYPE; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT16 LogAreaLength; + UINT16 LogHeaderStartOffset; + UINT16 LogDataStartOffset; + UINT8 AccessMethod; + UINT8 LogStatus; + UINT32 LogChangeToken; + UINT32 AccessMethodAddress; + UINT8 LogHeaderFormat; + UINT8 NumberOfSupportedLogTypeDescriptors; + UINT8 LengthOfLogTypeDescriptor; + EVENTLOGTYPE EventLogTypeDescriptors[1]; +} SMBIOS_TYPE15; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 Location; + UINT8 Use; + UINT8 MemoryErrorCorrection; + UINT32 MaximumCapacity; + UINT16 MemoryErrorInformationHandle; + UINT16 NumberOfMemoryDevices; +} SMBIOS_TYPE16; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT16 MemoryArrayHandle; + UINT16 MemoryErrorInformationHandle; + UINT16 TotalWidth; + UINT16 DataWidth; + UINT16 Size; + UINT8 FormFactor; + UINT8 DeviceSet; + SMBIOS_STRING DeviceLocator; + SMBIOS_STRING BankLocator; + UINT8 MemoryType; + UINT16 TypeDetail; + UINT16 Speed; + SMBIOS_STRING Manufacturer; + SMBIOS_STRING SerialNumber; + SMBIOS_STRING AssetTag; + SMBIOS_STRING PartNumber; + // + // Add for smbios 2.6 + // + UINT8 Attributes; +} SMBIOS_TYPE17; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 ErrorType; + UINT8 ErrorGranularity; + UINT8 ErrorOperation; + UINT32 VendorSyndrome; + UINT32 MemoryArrayErrorAddress; + UINT32 DeviceErrorAddress; + UINT32 ErrorResolution; +} SMBIOS_TYPE18; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT32 StartingAddress; + UINT32 EndingAddress; + UINT16 MemoryArrayHandle; + UINT8 PartitionWidth; +} SMBIOS_TYPE19; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT32 StartingAddress; + UINT32 EndingAddress; + UINT16 MemoryDeviceHandle; + UINT16 MemoryArrayMappedAddressHandle; + UINT8 PartitionRowPosition; + UINT8 InterleavePosition; + UINT8 InterleavedDataDepth; +} SMBIOS_TYPE20; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 Type; + UINT8 Interface; + UINT8 NumberOfButtons; +} SMBIOS_TYPE21; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Location; + SMBIOS_STRING Manufacturer; + SMBIOS_STRING ManufactureDate; + SMBIOS_STRING SerialNumber; + SMBIOS_STRING DeviceName; + UINT8 DeviceChemistry; + UINT16 DeviceCapacity; + UINT16 DesignVoltage; + SMBIOS_STRING SBDSVersionNumber; + UINT8 MaximumErrorInBatteryData; + UINT16 SBDSSerialNumber; + UINT16 SBDSManufactureDate; + SMBIOS_STRING SBDSDeviceChemistry; + UINT8 DesignCapacityMultiplier; + UINT32 OEMSpecific; +} SMBIOS_TYPE22; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 Capabilities; + UINT16 ResetCount; + UINT16 ResetLimit; + UINT16 TimerInterval; + UINT16 Timeout; +} SMBIOS_TYPE23; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 HardwareSecuritySettings; +} SMBIOS_TYPE24; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 NextScheduledPowerOnMonth; + UINT8 NextScheduledPowerOnDayOfMonth; + UINT8 NextScheduledPowerOnHour; + UINT8 NextScheduledPowerOnMinute; + UINT8 NextScheduledPowerOnSecond; +} SMBIOS_TYPE25; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Description; + UINT8 LocationAndStatus; + UINT16 MaximumValue; + UINT16 MinimumValue; + UINT16 Resolution; + UINT16 Tolerance; + UINT16 Accuracy; + UINT32 OEMDefined; + UINT16 NominalValue; +} SMBIOS_TYPE26; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT16 TemperatureProbeHandle; + UINT8 DeviceTypeAndStatus; + UINT8 CoolingUnitGroup; + UINT32 OEMDefined; + UINT16 NominalSpeed; +} SMBIOS_TYPE27; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Description; + UINT8 LocationAndStatus; + UINT16 MaximumValue; + UINT16 MinimumValue; + UINT16 Resolution; + UINT16 Tolerance; + UINT16 Accuracy; + UINT32 OEMDefined; + UINT16 NominalValue; +} SMBIOS_TYPE28; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Description; + UINT8 LocationAndStatus; + UINT16 MaximumValue; + UINT16 MinimumValue; + UINT16 Resolution; + UINT16 Tolerance; + UINT16 Accuracy; + UINT32 OEMDefined; + UINT16 NominalValue; +} SMBIOS_TYPE29; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING ManufacturerName; + UINT8 Connections; +} SMBIOS_TYPE30; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 Checksum; + UINT8 Reserved1; + UINT16 Reserved2; + UINT32 BisEntry16; + UINT32 BisEntry32; + UINT64 Reserved3; + UINT32 Reserved4; +} SMBIOS_TYPE31; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 Reserved[6]; + UINT8 BootStatus[1]; +} SMBIOS_TYPE32; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 ErrorType; + UINT8 ErrorGranularity; + UINT8 ErrorOperation; + UINT32 VendorSyndrome; + UINT64 MemoryArrayErrorAddress; + UINT64 DeviceErrorAddress; + UINT32 ErrorResolution; +} SMBIOS_TYPE33; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Description; + UINT8 Type; + UINT32 Address; + UINT8 AddressType; +} SMBIOS_TYPE34; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING Description; + UINT16 ManagementDeviceHandle; + UINT16 ComponentHandle; + UINT16 ThresholdHandle; +} SMBIOS_TYPE35; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT16 LowerThresholdNonCritical; + UINT16 UpperThresholdNonCritical; + UINT16 LowerThresholdCritical; + UINT16 UpperThresholdCritical; + UINT16 LowerThresholdNonRecoverable; + UINT16 UpperThresholdNonRecoverable; +} SMBIOS_TYPE36; + +typedef struct MEMORYDEVICE { + UINT8 DeviceLoad; + UINT16 DeviceHandle; +} MEMORYDEVICE; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 ChannelType; + UINT8 MaximumChannelLoad; + UINT8 MemoryDeviceCount; + MEMORYDEVICE MemoryDevice[1]; +} SMBIOS_TYPE37; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 InterfaceType; + UINT8 IPMISpecificationRevision; + UINT8 I2CSlaveAddress; + UINT8 NVStorageDeviceAddress; + UINT64 BaseAddress; +} SMBIOS_TYPE38; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 PowerUnitGroup; + SMBIOS_STRING Location; + SMBIOS_STRING DeviceName; + SMBIOS_STRING Manufacturer; + SMBIOS_STRING SerialNumber; + SMBIOS_STRING AssetTagNumber; + SMBIOS_STRING ModelPartNumber; + SMBIOS_STRING RevisionLevel; + UINT16 MaxPowerCapacity; + UINT16 PowerSupplyCharacteristics; + UINT16 InputVoltageProbeHandle; + UINT16 CoolingDeviceHandle; + UINT16 InputCurrentProbeHandle; +} SMBIOS_TYPE39; + +// +// Add type 40 and type 41 for smbios 2.6 +// +typedef struct { + UINT8 EntryLength; + UINT16 ReferencedHandle; + UINT8 ReferencedOffset; + SMBIOS_STRING EntryString; + UINT8 Value[1]; +} ADDITIONAL_INFORMATION_ENTRY; + +typedef struct { + SMBIOS_HEADER Hdr; + UINT8 NumberOfAdditionalInformationEntries; + ADDITIONAL_INFORMATION_ENTRY AdditionalInfoEntries[1]; +} SMBIOS_TYPE40; + +typedef struct { + SMBIOS_HEADER Hdr; + SMBIOS_STRING ReferenceDesignation; + UINT8 DeviceType; + UINT8 DeviceTypeInstance; + UINT16 SegmentGroupNum; + UINT8 BusNum; + UINT8 DevFuncNum; +} SMBIOS_TYPE41; + +typedef struct { + SMBIOS_HEADER Hdr; +} SMBIOS_TYPE126; + +typedef struct { + SMBIOS_HEADER Hdr; +} SMBIOS_TYPE127; + +/* + Notes: + Among the following 42 type of structues for SMBIOS Stucture table, + There are only 11 Types(0,1,3,4,7,9,16,17,19,20,32) are required, + The other types is optional. +*/ +typedef union { + SMBIOS_HEADER *Hdr; + SMBIOS_TYPE0 *Type0; + SMBIOS_TYPE1 *Type1; + SMBIOS_TYPE2 *Type2; + SMBIOS_TYPE3 *Type3; + SMBIOS_TYPE4 *Type4; + SMBIOS_TYPE5 *Type5; + SMBIOS_TYPE6 *Type6; + SMBIOS_TYPE7 *Type7; + SMBIOS_TYPE8 *Type8; + SMBIOS_TYPE9 *Type9; + SMBIOS_TYPE10 *Type10; + SMBIOS_TYPE11 *Type11; + SMBIOS_TYPE12 *Type12; + SMBIOS_TYPE13 *Type13; + SMBIOS_TYPE14 *Type14; + SMBIOS_TYPE15 *Type15; + SMBIOS_TYPE16 *Type16; + SMBIOS_TYPE17 *Type17; + SMBIOS_TYPE18 *Type18; + SMBIOS_TYPE19 *Type19; + SMBIOS_TYPE20 *Type20; + SMBIOS_TYPE21 *Type21; + SMBIOS_TYPE22 *Type22; + SMBIOS_TYPE23 *Type23; + SMBIOS_TYPE24 *Type24; + SMBIOS_TYPE25 *Type25; + SMBIOS_TYPE26 *Type26; + SMBIOS_TYPE27 *Type27; + SMBIOS_TYPE28 *Type28; + SMBIOS_TYPE29 *Type29; + SMBIOS_TYPE30 *Type30; + SMBIOS_TYPE31 *Type31; + SMBIOS_TYPE32 *Type32; + SMBIOS_TYPE33 *Type33; + SMBIOS_TYPE34 *Type34; + SMBIOS_TYPE35 *Type35; + SMBIOS_TYPE36 *Type36; + SMBIOS_TYPE37 *Type37; + SMBIOS_TYPE38 *Type38; + SMBIOS_TYPE39 *Type39; + SMBIOS_TYPE40 *Type40; + SMBIOS_TYPE41 *Type41; + SMBIOS_TYPE126 *Type126; + SMBIOS_TYPE127 *Type127; + UINT8 *Raw; +} SMBIOS_STRUCTURE_POINTER; + +#pragma pack() + +CHAR8 * +LibGetSmbiosString ( + IN SMBIOS_STRUCTURE_POINTER *Smbios, + IN UINT16 StringNumber + ); + +EFI_STATUS +LibGetSmbiosSystemGuidAndSerialNumber ( + IN EFI_GUID *SystemGuid, + OUT CHAR8 **SystemSerialNumber + ); + + +#endif diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c new file mode 100644 index 0000000000..22a8065a01 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c @@ -0,0 +1,349 @@ +/** @file + API for SMBIOS table. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + + +#include "../UefiShellDebug1CommandsLib.h" +#include +#include "LIbSmbios.h" +#include "LibSmbiosView.h" +#include "smbiosview.h" + +STATIC UINT8 mInit = 0; +STATIC SMBIOS_STRUCTURE_TABLE *mSmbiosTable = NULL; +STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct; +STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct; + +EFI_STATUS +LibSmbiosInit ( + VOID + ) +/*++ + +Routine Description: + Init the SMBIOS VIEW API's environment. + + Arguments: + None + +Returns: + EFI_SUCCESS - Successful to init the SMBIOS VIEW Lib + Others - Cannot get SMBIOS Table + +**/ +{ + EFI_STATUS Status; + + // + // Init only once + // + if (mInit == 1) { + return EFI_SUCCESS; + } + // + // Get SMBIOS table from System Configure table + // + Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID**)&mSmbiosTable); + + if (mSmbiosTable == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle); + return EFI_NOT_FOUND; + } + + if (EFI_ERROR (Status)) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status); + return Status; + } + // + // Init SMBIOS structure table address + // + mSmbiosStruct->Raw = (UINT8 *) (UINTN) (mSmbiosTable->TableAddress); + + mInit = 1; + return EFI_SUCCESS; +} + +VOID +LibSmbiosCleanup ( + VOID + ) +{ + // + // Release resources + // + if (mSmbiosTable != NULL) { + mSmbiosTable = NULL; + } + + mInit = 0; +} + +VOID +LibSmbiosGetEPS ( + SMBIOS_STRUCTURE_TABLE **pEntryPointStructure + ) +{ + // + // return SMBIOS Table address + // + *pEntryPointStructure = mSmbiosTable; +} + +VOID +LibSmbiosGetStructHead ( + SMBIOS_STRUCTURE_POINTER *pHead + ) +{ + // + // return SMBIOS structure table address + // + pHead = mSmbiosStruct; +} + +EFI_STATUS +LibGetSmbiosInfo ( + OUT CHAR8 *dmiBIOSRevision, + OUT UINT16 *NumStructures, + OUT UINT16 *StructureSize, + OUT UINT32 *dmiStorageBase, + OUT UINT16 *dmiStorageSize + ) +/*++ + +Routine Description: + Get SMBIOS Information. + + Arguments: + dmiBIOSRevision - Revision of the SMBIOS Extensions. + NumStructures - Max. Number of Structures the BIOS will return. + StructureSize - Size of largest SMBIOS Structure. + dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data. + dmiStorageSize - Size of the memory-mapped SMBIOS data. + + Returns: + DMI_SUCCESS - successful. + DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability. + +**/ +{ + // + // If no SMIBOS table, unsupported. + // + if (mSmbiosTable == NULL) { + return DMI_FUNCTION_NOT_SUPPORTED; + } + + *dmiBIOSRevision = mSmbiosTable->SmbiosBcdRevision; + *NumStructures = mSmbiosTable->NumberOfSmbiosStructures; + *StructureSize = mSmbiosTable->MaxStructureSize; + *dmiStorageBase = mSmbiosTable->TableAddress; + *dmiStorageSize = mSmbiosTable->TableLength; + + return DMI_SUCCESS; +} + +EFI_STATUS +LibGetSmbiosStructure ( + IN OUT UINT16 *Handle, + IN OUT UINT8 *Buffer, + OUT UINT16 *Length + ) +/*++ + + Routine Description: + Get SMBIOS structure given the Handle,copy data to the Buffer, + Handle is changed to the next handle or 0xFFFF when the end is + reached or the handle is not found. + + Arguments: + Handle: - 0xFFFF: get the first structure + - Others: get a structure according to this value. + Buffter: - The pointer to the caller's memory buffer. + Length: - Length of return buffer in bytes. + + Returns: + DMI_SUCCESS - Buffer contains the required structure data + - Handle is updated with next structure handle or + 0xFFFF(end-of-list). + + DMI_INVALID_HANDLE - Buffer not contain the requiring structure data + - Handle is updated with next structure handle or + 0xFFFF(end-of-list). +**/ +{ + SMBIOS_STRUCTURE_POINTER Smbios; + SMBIOS_STRUCTURE_POINTER SmbiosEnd; + UINT8 *Raw; + + if (*Handle == INVALIDE_HANDLE) { + *Handle = mSmbiosStruct->Hdr->Handle; + return DMI_INVALID_HANDLE; + } + + if (Buffer == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_SPEC), gShellDebug1HiiHandle); + return DMI_INVALID_HANDLE; + } + + *Length = 0; + Smbios.Hdr = mSmbiosStruct->Hdr; + SmbiosEnd.Raw = Smbios.Raw + mSmbiosTable->TableLength; + while (Smbios.Raw < SmbiosEnd.Raw) { + if (Smbios.Hdr->Handle == *Handle) { + Raw = Smbios.Raw; + // + // Walk to next structure + // + LibGetSmbiosString (&Smbios, (UINT16) (-1)); + // + // Length = Next structure head - this structure head + // + *Length = (UINT16) (Smbios.Raw - Raw); + CopyMem (Buffer, Raw, *Length); + // + // update with the next structure handle. + // + if (Smbios.Raw < SmbiosEnd.Raw) { + *Handle = Smbios.Hdr->Handle; + } else { + *Handle = INVALIDE_HANDLE; + } + return DMI_SUCCESS; + } + // + // Walk to next structure + // + LibGetSmbiosString (&Smbios, (UINT16) (-1)); + } + + *Handle = INVALIDE_HANDLE; + return DMI_INVALID_HANDLE; +} + +EFI_STATUS +SmbiosCheckStructure ( + IN SMBIOS_STRUCTURE_POINTER *Smbios + ) +/*++ + + Routine Description: + Check the structure to see if it is legal. + + Arguments: + Smbios - Pointer to the structure that will be checked. + + Returns: + DMI_SUCCESS - Structure data is legal. + DMI_BAD_PARAMETER - Structure data contains bad parameter + +**/ +{ + // + // If key != value, then error. + // +#define CHECK_VALUE(key, value) (((key) == (value)) ? EFI_SUCCESS : DMI_BAD_PARAMETER) + + EFI_STATUS Status; + // + // Assume staus is EFI_SUCCESS, + // but if check is error, then EFI_ERROR. + // + Status = EFI_SUCCESS; + + switch (Smbios->Hdr->Type) { + case 0: + break; + + case 1: + if (Smbios->Type1->Hdr.Length == 0x08 || Smbios->Type0->Hdr.Length == 0x19) { + Status = EFI_SUCCESS; + } else { + Status = DMI_BAD_PARAMETER; + } + break; + + case 2: + Status = CHECK_VALUE (Smbios->Type2->Hdr.Length, 0x08); + break; + + case 6: + Status = CHECK_VALUE (Smbios->Type6->Hdr.Length, 0x0C); + break; + + case 11: + Status = CHECK_VALUE (Smbios->Type11->Hdr.Length, 0x05); + break; + + case 12: + Status = CHECK_VALUE (Smbios->Type12->Hdr.Length, 0x05); + break; + + case 13: + Status = CHECK_VALUE (Smbios->Type13->Hdr.Length, 0x16); + break; + + case 16: + Status = CHECK_VALUE (Smbios->Type16->Hdr.Length, 0x0F); + break; + + case 19: + Status = CHECK_VALUE (Smbios->Type19->Hdr.Length, 0x0F); + break; + + case 20: + Status = CHECK_VALUE (Smbios->Type20->Hdr.Length, 0x13); + break; + + case 32: + // + // Because EFI_SUCCESS == 0, + // So errors added up is also error. + // + Status = CHECK_VALUE (Smbios->Type32->Reserved[0], 0x00) + + CHECK_VALUE (Smbios->Type32->Reserved[1], 0x00) + + CHECK_VALUE (Smbios->Type32->Reserved[2], 0x00) + + CHECK_VALUE (Smbios->Type32->Reserved[3], 0x00) + + CHECK_VALUE (Smbios->Type32->Reserved[4], 0x00) + + CHECK_VALUE (Smbios->Type32->Reserved[5], 0x00); + break; + + default: + Status = DMI_BAD_PARAMETER; + } + + return Status; +} + +VOID +SmbiosGetPendingString ( + IN SMBIOS_STRUCTURE_POINTER *Smbios, + IN UINT16 StringNumber, + OUT CHAR8 *Buffer + ) +{ + CHAR8 *String; + if (Buffer == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUF_SPEC_WHEN_STRUCT), gShellDebug1HiiHandle); + return ; + } + // + // Get string and copy to buffer. + // Caller should provide the buffer. + // + String = LibGetSmbiosString (Smbios, StringNumber); + if (String != NULL) { + CopyMem (Buffer, String, AsciiStrLen(String)); + } else { + Buffer = NULL; + } +} diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h new file mode 100644 index 0000000000..7ef341b0d6 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h @@ -0,0 +1,120 @@ +/** @file + API for SMBIOS Plug and Play functions, access to SMBIOS table and structures. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _LIB_SMBIOS_VIEW_H +#define _LIB_SMBIOS_VIEW_H + +#include "LibSmbios.h" + +#define DMI_SUCCESS 0x00 +#define DMI_UNKNOWN_FUNCTION 0x81 +#define DMI_FUNCTION_NOT_SUPPORTED 0x82 +#define DMI_INVALID_HANDLE 0x83 +#define DMI_BAD_PARAMETER 0x84 +#define DMI_INVALID_SUBFUNCTION 0x85 +#define DMI_NO_CHANGE 0x86 +#define DMI_ADD_STRUCTURE_FAILED 0x87 +#define DMI_READ_ONLY 0x8D +#define DMI_LOCK_NOT_SUPPORTED 0x90 +#define DMI_CURRENTLY_LOCKED 0x91 +#define DMI_INVALID_LOCK 0x92 + +#define INVALIDE_HANDLE (UINT16) (-1) + +#define EFI_SMBIOSERR(val) EFIERR (0x30000 | val) + +#define EFI_SMBIOSERR_FAILURE EFI_SMBIOSERR (1) +#define EFI_SMBIOSERR_STRUCT_NOT_FOUND EFI_SMBIOSERR (2) +#define EFI_SMBIOSERR_TYPE_UNKNOWN EFI_SMBIOSERR (3) +#define EFI_SMBIOSERR_UNSUPPORTED EFI_SMBIOSERR (4) + +EFI_STATUS +LibSmbiosInit ( + VOID + ); + +VOID +LibSmbiosCleanup ( + VOID + ); + +VOID +LibSmbiosGetEPS ( + SMBIOS_STRUCTURE_TABLE **pEntryPointStructure + ); + +VOID +LibSmbiosGetStructHead ( + SMBIOS_STRUCTURE_POINTER *pHead + ); + +EFI_STATUS +LibGetSmbiosInfo ( + OUT CHAR8 *dmiBIOSRevision, + OUT UINT16 *NumStructures, + OUT UINT16 *StructureSize, + OUT UINT32 *dmiStorageBase, + OUT UINT16 *dmiStorageSize + ); + +/*++ + Description: + Get SMBIOS Information. + + Arguments: + dmiBIOSRevision - Revision of the SMBIOS Extensions. + NumStructures - Max. Number of Structures the BIOS will return. + StructureSize - Size of largest SMBIOS Structure. + dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data. + dmiStorageSize - Size of the memory-mapped SMBIOS data. + + Returns: + DMI_SUCCESS - successful. + DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability. +**/ +EFI_STATUS +LibGetSmbiosStructure ( + IN OUT UINT16 *Handle, + IN OUT UINT8 *Buffer, + OUT UINT16 *Length + ); + +/*++ + Description: + Get SMBIOS structure given the Handle,copy data to the Buffer,Handle is then the next. + + Arguments: + Handle: - 0x0: get the first structure + - Others: get a certain structure according to this value. + Buffter: - contains the pointer to the caller's memory buffer. + + Returns: + DMI_SUCCESS - Buffer contains the required structure data + - Handle is updated with next structure handle or 0xFFFF(end-of-list). + DMI_INVALID_HANDLE - Buffer not contain the requiring structure data + - Handle is updated with next structure handle or 0xFFFF(end-of-list). +**/ +VOID +SmbiosGetPendingString ( + IN SMBIOS_STRUCTURE_POINTER *Smbios, + IN UINT16 StringNumber, + OUT CHAR8 *Buffer + ); + +EFI_STATUS +SmbiosCheckStructure ( + IN SMBIOS_STRUCTURE_POINTER *Smbios + ); + +#endif diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c new file mode 100644 index 0000000000..91835106d5 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c @@ -0,0 +1,2679 @@ +/** @file + Module for clarifying the content of the smbios structure element information. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "../UefiShellDebug1CommandsLib.h" +#include "PrintInfo.h" +#include "LibSmbiosView.h" +#include "QueryTable.h" +#include "EventLogInfo.h" + + +// +// Get the certain bit of 'value' +// +#define BIT(value, bit) ((value) & ((UINT64) 1) << (bit)) + +// +////////////////////////////////////////////////////////// +// Macros of print structure element, simplify coding. +// +#define PrintPendingString(pStruct, type, element) \ + do { \ + CHAR8 StringBuf[64]; \ + SetMem (StringBuf, sizeof (StringBuf), 0x00); \ + SmbiosGetPendingString ((pStruct), (pStruct->type->element), StringBuf); \ + ShellPrintEx(-1,-1,L"%a",#element); \ + ShellPrintEx(-1,-1,L": %a\n", StringBuf); \ + } while (0); + +#define PrintSmbiosString(pStruct, stringnumber, element) \ + do { \ + CHAR8 StringBuf[64]; \ + SetMem (StringBuf, sizeof (StringBuf), 0x00); \ + SmbiosGetPendingString ((pStruct), (stringnumber), StringBuf); \ + ShellPrintEx(-1,-1,L"%a",#element); \ + ShellPrintEx(-1,-1,L": %a\n", StringBuf); \ + } while (0); + +#define PrintStructValue(pStruct, type, element) \ + do { \ + ShellPrintEx(-1,-1,L"%a",#element); \ + ShellPrintEx(-1,-1,L": %d\n", (pStruct->type->element)); \ + } while (0); + +#define PrintStructValueH(pStruct, type, element) \ + do { \ + ShellPrintEx(-1,-1,L"%a",#element); \ + ShellPrintEx(-1,-1,L": 0x%x\n", (pStruct->type->element)); \ + } while (0); + +#define PrintBitField(pStruct, type, element, size) \ + do { \ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \ + ShellPrintEx(-1,-1,L"%a",#element); \ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \ + DumpHex (0, 0, size, &(pStruct->type->element)); \ + } while (0); + +#define PrintSmbiosBitField(pStruct, startaddress, element, size) \ + do { \ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \ + ShellPrintEx(-1,-1,L"%a",#element); \ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \ + DumpHex (0, 0, size, startaddress); \ + } while (0); + +// +///////////////////////////////////////// +// +VOID +MemToString ( + IN OUT VOID *Dest, + IN VOID *Src, + IN UINTN Length + ) +/*++ + +Routine Description: + Copy Length of Src buffer to Dest buffer, + add a NULL termination to Dest buffer. + +Arguments: + Dest - Destination buffer head + Src - Source buffer head + Length - Length of buffer to be copied + +Returns: + None. + +**/ +{ + UINT8 *SrcBuffer; + UINT8 *DestBuffer; + SrcBuffer = (UINT8 *) Src; + DestBuffer = (UINT8 *) Dest; + // + // copy byte by byte + // + while ((Length--)!=0) { + *DestBuffer++ = *SrcBuffer++; + } + // + // append a NULL terminator + // + *DestBuffer = '\0'; +} + +// +////////////////////////////////////////////// +// +// Functions below is to show the information +// +VOID +SmbiosPrintEPSInfo ( + IN SMBIOS_STRUCTURE_TABLE *SmbiosTable, + IN UINT8 Option + ) +/*++ + +Routine Description: + Print the info of EPS(Entry Point Structure) + +Arguments: + SmbiosTable - Pointer to the SMBIOS table entry point + Option - Display option + +Returns: None + +**/ +{ + UINT8 Anchor[5]; + UINT8 InAnchor[6]; + + if (SmbiosTable == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle); + return ; + } + + if (Option == SHOW_NONE) { + return ; + } + + if (Option >= SHOW_NORMAL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN), gShellDebug1HiiHandle); + MemToString (Anchor, SmbiosTable->AnchorString, 4); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor); + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM), + gShellDebug1HiiHandle, + SmbiosTable->EntryPointStructureChecksum + ); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength); + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION), + gShellDebug1HiiHandle, + SmbiosTable->MajorVersion, + SmbiosTable->MinorVersion + ); + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NUMBER_STRUCT), + gShellDebug1HiiHandle, + SmbiosTable->NumberOfSmbiosStructures + ); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_STRUCT_SIZE), gShellDebug1HiiHandle, SmbiosTable->MaxStructureSize); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_LENGTH), gShellDebug1HiiHandle, SmbiosTable->TableLength); + + } + // + // If SHOW_ALL, also print followings. + // + if (Option >= SHOW_DETAIL) { + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION), + gShellDebug1HiiHandle, + SmbiosTable->EntryPointRevision + ); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BCD_REVISION), gShellDebug1HiiHandle, SmbiosTable->SmbiosBcdRevision); + // + // Since raw data is not string, add a NULL terminater. + // + MemToString (InAnchor, SmbiosTable->IntermediateAnchorString, 5); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_ACHOR), gShellDebug1HiiHandle, InAnchor); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_CHECKSUM), gShellDebug1HiiHandle, SmbiosTable->IntermediateChecksum); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA), gShellDebug1HiiHandle); + DumpHex (2, 0, 5, SmbiosTable->FormattedArea); + } + + Print (L"\n"); +} + +EFI_STATUS +SmbiosPrintStructure ( + IN SMBIOS_STRUCTURE_POINTER *pStruct, + IN UINT8 Option + ) +/*++ + +Routine Description: + This function print the content of the structure pointed by pStruct + +Arguments: + pStruct - point to the structure to be printed + Option - print option of information detail + +Returns: + EFI_SUCCESS - Successfully Printing this function + EFI_INVALID_PARAMETER - Invalid Structure + EFI_UNSUPPORTED - Unsupported + +**/ +{ + UINT8 Index; + UINT8 *Buffer; + + Buffer = (UINT8 *) (UINTN) (pStruct->Raw); + + if (pStruct == NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Option == SHOW_NONE) { + return EFI_SUCCESS; + } + // + // Display structure header + // + DisplayStructureTypeInfo (pStruct->Hdr->Type, SHOW_DETAIL); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMAT_PART_LEN), gShellDebug1HiiHandle, pStruct->Hdr->Length); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, pStruct->Hdr->Handle); + + if (Option == SHOW_OUTLINE) { + return EFI_SUCCESS; + } + + switch (pStruct->Hdr->Type) { + // + // + // + case 0: + PrintPendingString (pStruct, Type0, Vendor); + PrintPendingString (pStruct, Type0, BiosVersion); + PrintStructValue (pStruct, Type0, BiosSegment); + PrintPendingString (pStruct, Type0, BiosReleaseDate); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (pStruct->Type0->BiosSize + 1)); + + if (Option < SHOW_DETAIL) { + PrintStructValueH (pStruct, Type0, BiosCharacteristics); + } else { + DisplayBiosCharacteristics (pStruct->Type0->BiosCharacteristics, Option); + + // + // The length of above format part is 0x12 bytes, + // Ext bytes are following, size = 'len-0x12'. + // If len-0x12 > 0, then + // there are extension bytes (byte1, byte2, byte3...) + // And byte3 not stated in spec, so dump all extension bytes(1, 2, 3..) + // + if ((Buffer[1] - (CHAR8) 0x12) > 0) { + DisplayBiosCharacteristicsExt1 (Buffer[0x12], Option); + } + + if ((Buffer[1] - (CHAR8) 0x12) > 1) { + DisplayBiosCharacteristicsExt2 (Buffer[0x13], Option); + } + + if ((Buffer[1] - (CHAR8) 0x12) > 2) { + PrintBitField ( + pStruct, + Type0, + BiosCharacteristics, + Buffer[1] - (CHAR8) 0x12 + ); + } + } + break; + + // + // System Information (Type 1) + // + case 1: + PrintPendingString (pStruct, Type1, Manufacturer); + PrintPendingString (pStruct, Type1, ProductName); + PrintPendingString (pStruct, Type1, Version); + PrintPendingString (pStruct, Type1, SerialNumber); + PrintBitField (pStruct, Type1, Uuid, 16); + DisplaySystemWakeupType (pStruct->Type1->WakeUpType, Option); + break; + + case 2: + PrintPendingString (pStruct, Type2, Manufacturer); + PrintPendingString (pStruct, Type2, ProductName); + PrintPendingString (pStruct, Type2, Version); + PrintPendingString (pStruct, Type2, SerialNumber); + break; + + // + // System Enclosure (Type 3) + // + case 3: + PrintPendingString (pStruct, Type3, Manufacturer); + PrintStructValue (pStruct, Type3, Type); + DisplaySystemEnclosureType (pStruct->Type3->Type, Option); + PrintPendingString (pStruct, Type3, Version); + PrintPendingString (pStruct, Type3, SerialNumber); + PrintPendingString (pStruct, Type3, AssetTag); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOTUP_STATE), gShellDebug1HiiHandle); + DisplaySystemEnclosureStatus (pStruct->Type3->BootupState, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_STATE), gShellDebug1HiiHandle); + DisplaySystemEnclosureStatus (pStruct->Type3->PowerSupplyState, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THERMAL_STATE), gShellDebug1HiiHandle); + DisplaySystemEnclosureStatus (pStruct->Type3->ThermalState, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS), gShellDebug1HiiHandle); + DisplaySESecurityStatus (pStruct->Type3->SecurityStatus, Option); + PrintBitField (pStruct, Type3, OemDefined, 4); + break; + + // + // Processor Information (Type 4) + // + case 4: + PrintStructValue (pStruct, Type4, Socket); + DisplayProcessorType (pStruct->Type4->ProcessorType, Option); + if ((SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) && + (pStruct->Type4->ProcessorFamily == 0xFE)) { + // + // Get family from ProcessorFamily2 field + // + DisplayProcessorFamily2 (pStruct->Type4->ProcessorFamily2, Option); + } else { + DisplayProcessorFamily (pStruct->Type4->ProcessorFamily, Option); + } + PrintPendingString (pStruct, Type4, ProcessorManufacture); + PrintBitField (pStruct, Type4, ProcessorId, 8); + PrintPendingString (pStruct, Type4, ProcessorVersion); + DisplayProcessorVoltage (pStruct->Type4->Voltage, Option); + PrintStructValue (pStruct, Type4, ExternalClock); + PrintStructValue (pStruct, Type4, MaxSpeed); + PrintStructValue (pStruct, Type4, CurrentSpeed); + DisplayProcessorStatus (pStruct->Type4->Status, Option); + DisplayProcessorUpgrade (pStruct->Type4->ProcessorUpgrade, Option); + PrintStructValueH (pStruct, Type4, L1CacheHandle); + PrintStructValueH (pStruct, Type4, L2CacheHandle); + PrintStructValueH (pStruct, Type4, L3CacheHandle); + PrintPendingString (pStruct, Type4, SerialNumber); + PrintPendingString (pStruct, Type4, AssetTag); + PrintPendingString (pStruct, Type4, PartNumber); + if (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x5)) { + PrintStructValue (pStruct, Type4, CoreCount); + PrintStructValue (pStruct, Type4, EnabledCoreCount); + PrintStructValue (pStruct, Type4, ThreadCount); + PrintStructValueH (pStruct, Type4, ProcessorCharacteristics); + } + break; + + // + // Memory Controller Information (Type 5) + // + case 5: + { + UINT8 SlotNum; + SlotNum = pStruct->Type5->AssociatedMemorySlotNum; + + DisplayMcErrorDetectMethod (pStruct->Type5->ErrDetectMethod, Option); + DisplayMcErrorCorrectCapability (pStruct->Type5->ErrCorrectCapability, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRT), gShellDebug1HiiHandle); + DisplayMcInterleaveSupport (pStruct->Type5->SupportInterleave, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CURRENT), gShellDebug1HiiHandle); + DisplayMcInterleaveSupport (pStruct->Type5->CurrentInterleave, Option); + DisplayMaxMemoryModuleSize (pStruct->Type5->MaxMemoryModuleSize, SlotNum, Option); + DisplayMcMemorySpeeds (pStruct->Type5->SupportSpeed, Option); + DisplayMmMemoryType (pStruct->Type5->SupportMemoryType, Option); + DisplayMemoryModuleVoltage (pStruct->Type5->MemoryModuleVoltage, Option); + PrintStructValue (pStruct, Type5, AssociatedMemorySlotNum); + // + // According to SMBIOS Specification, offset 0x0F + // + DisplayMemoryModuleConfigHandles ((UINT16 *) (&Buffer[0x0F]), SlotNum, Option); + DisplayMcErrorCorrectCapability (Buffer[0x0F + 2 * SlotNum], Option); + } + break; + + // + // Memory Module Information (Type 6) + // + case 6: + PrintPendingString (pStruct, Type6, SocketDesignation); + DisplayMmBankConnections (pStruct->Type6->BankConnections, Option); + PrintStructValue (pStruct, Type6, CurrentSpeed); + DisplayMmMemoryType (pStruct->Type6->CurrentMemoryType, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INSTALLED), gShellDebug1HiiHandle); + DisplayMmMemorySize (pStruct->Type6->InstalledSize, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle); + DisplayMmMemorySize (pStruct->Type6->EnabledSize, Option); + DisplayMmErrorStatus (pStruct->Type6->ErrorStatus, Option); + break; + + // + // Cache Information (Type 7) + // + case 7: + PrintPendingString (pStruct, Type7, SocketDesignation); + PrintStructValueH (pStruct, Type7, CacheConfiguration); + PrintStructValueH (pStruct, Type7, MaximumCacheSize); + PrintStructValueH (pStruct, Type7, InstalledSize); + PrintStructValueH (pStruct, Type7, SupportedSRAMType); + PrintStructValueH (pStruct, Type7, CurrentSRAMType); + DisplayCacheSRAMType (pStruct->Type7->CurrentSRAMType, Option); + PrintStructValueH (pStruct, Type7, CacheSpeed); + DisplayCacheErrCorrectingType (pStruct->Type7->ErrorCorrectionType, Option); + DisplayCacheSystemCacheType (pStruct->Type7->SystemCacheType, Option); + DisplayCacheAssociativity (pStruct->Type7->Associativity, Option); + break; + + // + // Port Connector Information (Type 8) + // + case 8: + PrintPendingString (pStruct, Type8, InternalReferenceDesignator); + Print (L"Internal "); + DisplayPortConnectorType (pStruct->Type8->InternalConnectorType, Option); + PrintPendingString (pStruct, Type8, ExternalReferenceDesignator); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTERNAL), gShellDebug1HiiHandle); + DisplayPortConnectorType (pStruct->Type8->ExternalConnectorType, Option); + DisplayPortType (pStruct->Type8->PortType, Option); + break; + + // + // System Slots (Type 9) + // + case 9: + PrintPendingString (pStruct, Type9, SlotDesignation); + DisplaySystemSlotType (pStruct->Type9->SlotType, Option); + DisplaySystemSlotDataBusWidth (pStruct->Type9->SlotDataBusWidth, Option); + DisplaySystemSlotCurrentUsage (pStruct->Type9->CurrentUsage, Option); + DisplaySystemSlotLength (pStruct->Type9->SlotLength, Option); + DisplaySystemSlotId ( + pStruct->Type9->SlotID, + pStruct->Type9->SlotType, + Option + ); + DisplaySlotCharacteristics1 (pStruct->Type9->SlotCharacteristics1, Option); + DisplaySlotCharacteristics2 (pStruct->Type9->SlotCharacteristics2, Option); + if (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) { + PrintStructValueH (pStruct, Type9, SegmentGroupNum); + PrintStructValueH (pStruct, Type9, BusNum); + PrintStructValueH (pStruct, Type9, DevFuncNum); + } + break; + + // + // On Board Devices Information (Type 10) + // + case 10: + { + UINTN NumOfDevice; + NumOfDevice = (pStruct->Type10->Hdr.Length - sizeof (SMBIOS_HEADER)) / (2 * sizeof (UINT8)); + for (Index = 0; Index < NumOfDevice; Index++) { + DisplayOnboardDeviceTypes (pStruct->Type10->Device[Index].DeviceType, Option); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DESC_STRING), gShellDebug1HiiHandle); + ShellPrintEx(-1,-1,L"%a",LibGetSmbiosString (pStruct, pStruct->Type10->Device[Index].DescriptionString)); + } + } + break; + + case 11: + PrintStructValue (pStruct, Type11, StringCount); + for (Index = 1; Index <= pStruct->Type11->StringCount; Index++) { + ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (pStruct, Index)); + } + break; + + case 12: + PrintStructValue (pStruct, Type12, StringCount); + for (Index = 1; Index <= pStruct->Type12->StringCount; Index++) { + ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (pStruct, Index)); + } + break; + + case 13: + PrintStructValue (pStruct, Type13, InstallableLanguages); + PrintStructValue (pStruct, Type13, Flags); + PrintBitField (pStruct, Type13, reserved, 15); + PrintPendingString (pStruct, Type13, CurrentLanguages); + break; + + case 14: + PrintPendingString (pStruct, Type14, GroupName); + PrintStructValue (pStruct, Type14, ItemType); + PrintStructValue (pStruct, Type14, ItemHandle); + break; + + // + // System Event Log (Type 15) + // + case 15: + { + EVENTLOGTYPE *Ptr; + UINT8 Count; + UINT8 *AccessMethodAddress; + + PrintStructValueH (pStruct, Type15, LogAreaLength); + PrintStructValueH (pStruct, Type15, LogHeaderStartOffset); + PrintStructValueH (pStruct, Type15, LogDataStartOffset); + DisplaySELAccessMethod (pStruct->Type15->AccessMethod, Option); + PrintStructValueH (pStruct, Type15, AccessMethodAddress); + DisplaySELLogStatus (pStruct->Type15->LogStatus, Option); + PrintStructValueH (pStruct, Type15, LogChangeToken); + DisplaySysEventLogHeaderFormat (pStruct->Type15->LogHeaderFormat, Option); + PrintStructValueH (pStruct, Type15, NumberOfSupportedLogTypeDescriptors); + PrintStructValueH (pStruct, Type15, LengthOfLogTypeDescriptor); + + Count = pStruct->Type15->NumberOfSupportedLogTypeDescriptors; + if (Count > 0) { + Ptr = pStruct->Type15->EventLogTypeDescriptors; + + // + // Display all Event Log type descriptors supported by system + // + for (Index = 0; Index < Count; Index++, Ptr++) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT), gShellDebug1HiiHandle, Index + 1); + DisplaySELTypes (Ptr->LogType, Option); + DisplaySELVarDataFormatType (Ptr->DataFormatType, Option); + } + + if (Option >= SHOW_DETAIL) { + switch (pStruct->Type15->AccessMethod) { + case 03: + AccessMethodAddress = (UINT8 *) (UINTN) (pStruct->Type15->AccessMethodAddress); + break; + + case 00: + case 01: + case 02: + case 04: + default: + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED), + gShellDebug1HiiHandle, + pStruct->Type15->AccessMethod + ); + return EFI_UNSUPPORTED; + } + // + // Display Event Log Header + // + // Starting offset (or index) within the nonvolatile storage + // of the event-log's header, from the Access Method Address + // + DisplaySysEventLogHeader ( + pStruct->Type15->LogHeaderFormat, + AccessMethodAddress + pStruct->Type15->LogHeaderStartOffset + ); + + // + // Display all Event Log data + // + // Starting offset (or index) within the nonvolatile storage + // of the event-log's first data byte, from the Access Method Address(0x14) + // + DisplaySysEventLogData ( + AccessMethodAddress + pStruct->Type15->LogDataStartOffset, + (UINT16) + ( + pStruct->Type15->LogAreaLength - + (pStruct->Type15->LogDataStartOffset - pStruct->Type15->LogDataStartOffset) + ) + ); + } + + } + } + break; + + // + // Physical Memory Array (Type 16) + // + case 16: + DisplayPMALocation (pStruct->Type16->Location, Option); + DisplayPMAUse (pStruct->Type16->Use, Option); + DisplayPMAErrorCorrectionTypes ( + pStruct->Type16->MemoryErrorCorrection, + Option + ); + PrintStructValueH (pStruct, Type16, MaximumCapacity); + PrintStructValueH (pStruct, Type16, MemoryErrorInformationHandle); + PrintStructValueH (pStruct, Type16, NumberOfMemoryDevices); + break; + + // + // Memory Device (Type 17) + // + case 17: + PrintStructValueH (pStruct, Type17, MemoryArrayHandle); + PrintStructValueH (pStruct, Type17, MemoryErrorInformationHandle); + PrintStructValue (pStruct, Type17, TotalWidth); + PrintStructValue (pStruct, Type17, DataWidth); + PrintStructValue (pStruct, Type17, Size); + DisplayMemoryDeviceFormFactor (pStruct->Type17->FormFactor, Option); + PrintStructValueH (pStruct, Type17, DeviceSet); + PrintPendingString (pStruct, Type17, DeviceLocator); + PrintPendingString (pStruct, Type17, BankLocator); + DisplayMemoryDeviceType (pStruct->Type17->MemoryType, Option); + DisplayMemoryDeviceTypeDetail (pStruct->Type17->TypeDetail, Option); + PrintStructValueH (pStruct, Type17, Speed); + PrintPendingString (pStruct, Type17, Manufacturer); + PrintPendingString (pStruct, Type17, SerialNumber); + PrintPendingString (pStruct, Type17, AssetTag); + PrintPendingString (pStruct, Type17, PartNumber); + if (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) { + PrintStructValueH (pStruct, Type17, Attributes); + } + break; + + // + // 32-bit Memory Error Information (Type 18) + // + case 18: + DisplayMemoryErrorType (pStruct->Type18->ErrorType, Option); + DisplayMemoryErrorGranularity ( + pStruct->Type18->ErrorGranularity, + Option + ); + DisplayMemoryErrorOperation (pStruct->Type18->ErrorOperation, Option); + PrintStructValueH (pStruct, Type18, VendorSyndrome); + PrintStructValueH (pStruct, Type18, MemoryArrayErrorAddress); + PrintStructValueH (pStruct, Type18, DeviceErrorAddress); + PrintStructValueH (pStruct, Type18, ErrorResolution); + break; + + // + // Memory Array Mapped Address (Type 19) + // + case 19: + PrintStructValueH (pStruct, Type19, StartingAddress); + PrintStructValueH (pStruct, Type19, EndingAddress); + PrintStructValueH (pStruct, Type19, MemoryArrayHandle); + PrintStructValueH (pStruct, Type19, PartitionWidth); + break; + + // + // Memory Device Mapped Address (Type 20) + // + case 20: + PrintStructValueH (pStruct, Type20, StartingAddress); + PrintStructValueH (pStruct, Type20, EndingAddress); + PrintStructValueH (pStruct, Type20, MemoryDeviceHandle); + PrintStructValueH (pStruct, Type20, MemoryArrayMappedAddressHandle); + PrintStructValueH (pStruct, Type20, PartitionRowPosition); + PrintStructValueH (pStruct, Type20, InterleavePosition); + PrintStructValueH (pStruct, Type20, InterleavedDataDepth); + break; + + // + // Built-in Pointing Device (Type 21) + // + case 21: + DisplayPointingDeviceType (pStruct->Type21->Type, Option); + DisplayPointingDeviceInterface (pStruct->Type21->Interface, Option); + PrintStructValue (pStruct, Type21, NumberOfButtons); + break; + + // + // Portable Battery (Type 22) + // + case 22: + PrintPendingString (pStruct, Type22, Location); + PrintPendingString (pStruct, Type22, Manufacturer); + PrintPendingString (pStruct, Type22, ManufactureDate); + PrintPendingString (pStruct, Type22, SerialNumber); + PrintPendingString (pStruct, Type22, DeviceName); + DisplayPBDeviceChemistry ( + pStruct->Type22->DeviceChemistry, + Option + ); + PrintStructValueH (pStruct, Type22, DeviceCapacity); + PrintStructValueH (pStruct, Type22, DesignVoltage); + PrintPendingString (pStruct, Type22, SBDSVersionNumber); + PrintStructValueH (pStruct, Type22, MaximumErrorInBatteryData); + PrintStructValueH (pStruct, Type22, SBDSSerialNumber); + DisplaySBDSManufactureDate ( + pStruct->Type22->SBDSManufactureDate, + Option + ); + PrintPendingString (pStruct, Type22, SBDSDeviceChemistry); + PrintStructValueH (pStruct, Type22, DesignCapacityMultiplier); + PrintStructValueH (pStruct, Type22, OEMSpecific); + break; + + case 23: + DisplaySystemResetCapabilities ( + pStruct->Type23->Capabilities, + Option + ); + PrintStructValueH (pStruct, Type23, ResetCount); + PrintStructValueH (pStruct, Type23, ResetLimit); + PrintStructValueH (pStruct, Type23, TimerInterval); + PrintStructValueH (pStruct, Type23, Timeout); + break; + + case 24: + DisplayHardwareSecuritySettings ( + pStruct->Type24->HardwareSecuritySettings, + Option + ); + break; + + case 25: + PrintStructValueH (pStruct, Type25, NextScheduledPowerOnMonth); + PrintStructValueH (pStruct, Type25, NextScheduledPowerOnDayOfMonth); + PrintStructValueH (pStruct, Type25, NextScheduledPowerOnHour); + PrintStructValueH (pStruct, Type25, NextScheduledPowerOnMinute); + PrintStructValueH (pStruct, Type25, NextScheduledPowerOnSecond); + break; + + case 26: + PrintPendingString (pStruct, Type26, Description); + DisplayVPLocation (pStruct->Type26->LocationAndStatus, Option); + DisplayVPStatus (pStruct->Type26->LocationAndStatus, Option); + PrintStructValueH (pStruct, Type26, MaximumValue); + PrintStructValueH (pStruct, Type26, MinimumValue); + PrintStructValueH (pStruct, Type26, Resolution); + PrintStructValueH (pStruct, Type26, Tolerance); + PrintStructValueH (pStruct, Type26, Accuracy); + PrintStructValueH (pStruct, Type26, OEMDefined); + PrintStructValueH (pStruct, Type26, NominalValue); + break; + + case 27: + PrintStructValueH (pStruct, Type27, TemperatureProbeHandle); + DisplayCoolingDeviceStatus (pStruct->Type27->DeviceTypeAndStatus, Option); + DisplayCoolingDeviceType (pStruct->Type27->DeviceTypeAndStatus, Option); + PrintStructValueH (pStruct, Type27, CoolingUnitGroup); + PrintStructValueH (pStruct, Type27, OEMDefined); + PrintStructValueH (pStruct, Type27, NominalSpeed); + break; + + case 28: + PrintPendingString (pStruct, Type28, Description); + DisplayTemperatureProbeStatus (pStruct->Type28->LocationAndStatus, Option); + DisplayTemperatureProbeLoc (pStruct->Type28->LocationAndStatus, Option); + PrintStructValueH (pStruct, Type28, MaximumValue); + PrintStructValueH (pStruct, Type28, MinimumValue); + PrintStructValueH (pStruct, Type28, Resolution); + PrintStructValueH (pStruct, Type28, Tolerance); + PrintStructValueH (pStruct, Type28, Accuracy); + PrintStructValueH (pStruct, Type28, OEMDefined); + PrintStructValueH (pStruct, Type28, NominalValue); + break; + + case 29: + PrintPendingString (pStruct, Type29, Description); + DisplayECPStatus (pStruct->Type29->LocationAndStatus, Option); + DisplayECPLoc (pStruct->Type29->LocationAndStatus, Option); + PrintStructValueH (pStruct, Type29, MaximumValue); + PrintStructValueH (pStruct, Type29, MinimumValue); + PrintStructValueH (pStruct, Type29, Resolution); + PrintStructValueH (pStruct, Type29, Tolerance); + PrintStructValueH (pStruct, Type29, Accuracy); + PrintStructValueH (pStruct, Type29, OEMDefined); + PrintStructValueH (pStruct, Type29, NominalValue); + break; + + case 30: + PrintPendingString (pStruct, Type30, ManufacturerName); + DisplayOBRAConnections (pStruct->Type30->Connections, Option); + break; + + case 31: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31), gShellDebug1HiiHandle); + break; + + case 32: + PrintBitField (pStruct, Type32, Reserved, 6); + DisplaySystemBootStatus (pStruct->Type32->BootStatus[0], Option); + break; + + case 33: + DisplayMemoryErrorType (pStruct->Type33->ErrorType, Option); + DisplayMemoryErrorGranularity ( + pStruct->Type33->ErrorGranularity, + Option + ); + DisplayMemoryErrorOperation (pStruct->Type33->ErrorOperation, Option); + PrintStructValueH (pStruct, Type33, VendorSyndrome); + PrintStructValueH (pStruct, Type33, MemoryArrayErrorAddress); + PrintStructValueH (pStruct, Type33, DeviceErrorAddress); + PrintStructValueH (pStruct, Type33, ErrorResolution); + break; + + // + // Management Device (Type 34) + // + case 34: + PrintPendingString (pStruct, Type34, Description); + DisplayMDType (pStruct->Type34->Type, Option); + PrintStructValueH (pStruct, Type34, Address); + PrintStructValueH (pStruct, Type34, AddressType); + break; + + case 35: + PrintPendingString (pStruct, Type35, Description); + PrintStructValueH (pStruct, Type35, ManagementDeviceHandle); + PrintStructValueH (pStruct, Type35, ComponentHandle); + PrintStructValueH (pStruct, Type35, ThresholdHandle); + break; + + case 36: + PrintStructValueH (pStruct, Type36, LowerThresholdNonCritical); + PrintStructValueH (pStruct, Type36, UpperThresholdNonCritical); + PrintStructValueH (pStruct, Type36, LowerThresholdCritical); + PrintStructValueH (pStruct, Type36, UpperThresholdCritical); + PrintStructValueH (pStruct, Type36, LowerThresholdNonRecoverable); + PrintStructValueH (pStruct, Type36, UpperThresholdNonRecoverable); + break; + + // + // Memory Channel (Type 37) + // + case 37: + { + UINT8 Count; + MEMORYDEVICE *Ptr; + DisplayMemoryChannelType (pStruct->Type37->ChannelType, Option); + PrintStructValueH (pStruct, Type37, MaximumChannelLoad); + PrintStructValueH (pStruct, Type37, MemoryDeviceCount); + + Count = pStruct->Type37->MemoryDeviceCount; + Ptr = pStruct->Type37->MemoryDevice; + for (Index = 0; Index < Count; Index++) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE), gShellDebug1HiiHandle, Index + 1); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr->DeviceLoad); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr->DeviceHandle); + } + } + break; + + // + // IPMI Device Information (Type 38) + // + case 38: + DisplayIPMIDIBMCInterfaceType (pStruct->Type38->InterfaceType, Option); + PrintStructValueH (pStruct, Type38, IPMISpecificationRevision); + PrintStructValueH (pStruct, Type38, I2CSlaveAddress); + PrintStructValueH (pStruct, Type38, NVStorageDeviceAddress); + PrintStructValueH (pStruct, Type38, BaseAddress); + break; + + // + // System Power Supply (Type 39) + // + case 39: + PrintStructValueH (pStruct, Type39, PowerUnitGroup); + PrintPendingString (pStruct, Type39, Location); + PrintPendingString (pStruct, Type39, DeviceName); + PrintPendingString (pStruct, Type39, Manufacturer); + PrintPendingString (pStruct, Type39, SerialNumber); + PrintPendingString (pStruct, Type39, AssetTagNumber); + PrintPendingString (pStruct, Type39, ModelPartNumber); + PrintPendingString (pStruct, Type39, RevisionLevel); + PrintStructValueH (pStruct, Type39, MaxPowerCapacity); + DisplaySPSCharacteristics ( + pStruct->Type39->PowerSupplyCharacteristics, + Option + ); + PrintStructValueH (pStruct, Type39, InputVoltageProbeHandle); + PrintStructValueH (pStruct, Type39, CoolingDeviceHandle); + PrintStructValueH (pStruct, Type39, InputCurrentProbeHandle); + break; + + // + // Additional Information (Type 40) + // + case 40: + { + UINT8 NumberOfEntries; + UINT8 EntryLength; + ADDITIONAL_INFORMATION_ENTRY *Entries; + + EntryLength = 0; + Entries = pStruct->Type40->AdditionalInfoEntries; + NumberOfEntries = pStruct->Type40->NumberOfAdditionalInformationEntries; + + PrintStructValueH (pStruct, Type40, NumberOfAdditionalInformationEntries); + + for (Index = 0; Index < NumberOfEntries; Index++) { + EntryLength = Entries->EntryLength; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTRYLEN), gShellDebug1HiiHandle, EntryLength); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDHANDLE), gShellDebug1HiiHandle, Entries->ReferencedHandle); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDOFFSET), gShellDebug1HiiHandle, Entries->ReferencedOffset); + PrintSmbiosString (pStruct, Entries->EntryString, String); + PrintSmbiosBitField (pStruct, Entries->Value, Value, EntryLength - 5); + Entries = (ADDITIONAL_INFORMATION_ENTRY *) ((UINT8 *)Entries + EntryLength); + } + } + break; + + // + // Onboard Devices Extended Information (Type 41) + // + case 41: + PrintPendingString (pStruct, Type41, ReferenceDesignation); + PrintStructValueH (pStruct, Type41, DeviceType); + PrintStructValueH (pStruct, Type41, DeviceTypeInstance); + PrintStructValueH (pStruct, Type41, SegmentGroupNum); + PrintStructValueH (pStruct, Type41, BusNum); + PrintStructValueH (pStruct, Type41, DevFuncNum); + break; + + case 126: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT), gShellDebug1HiiHandle); + break; + + case 127: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE), gShellDebug1HiiHandle); + break; + + default: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE_UNDEFINED), gShellDebug1HiiHandle); + break; + } + + return EFI_SUCCESS; +} + +VOID +DisplayBiosCharacteristics ( + UINT64 chara, + UINT8 Option + ) +{ + // + // Print header + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR), gShellDebug1HiiHandle); + // + // print option + // + PRINT_INFO_OPTION (chara, Option); + + // + // Check all the bits and print information + // This function does not use Table because table of bits + // are designed not to deal with UINT64 + // + if (BIT (chara, 0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 1) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 2) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 3) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 4) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 5) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 6) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 7) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 8) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 9) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 10) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 11) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE), gShellDebug1HiiHandle); + } + + if (BIT (chara, 12) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING), gShellDebug1HiiHandle); + } + + if (BIT (chara, 13) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 14) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 15) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FORM_CD_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 16) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 17) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 18) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD), gShellDebug1HiiHandle); + } + + if (BIT (chara, 19) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER), gShellDebug1HiiHandle); + } + + if (BIT (chara, 20) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC), gShellDebug1HiiHandle); + } + + if (BIT (chara, 21) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA), gShellDebug1HiiHandle); + } + + if (BIT (chara, 22) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (chara, 23) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB), gShellDebug1HiiHandle); + } + + if (BIT (chara, 24) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_720_KB), gShellDebug1HiiHandle); + } + + if (BIT (chara, 25) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB), gShellDebug1HiiHandle); + } + + if (BIT (chara, 26) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 27) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 28) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 29) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 30) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT), gShellDebug1HiiHandle); + } + + if (BIT (chara, 31) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98), gShellDebug1HiiHandle); + } + // + // Just print the reserved + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_32_47), gShellDebug1HiiHandle); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_64), gShellDebug1HiiHandle); +} + +VOID +DisplayBiosCharacteristicsExt1 ( + UINT8 byte1, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION), gShellDebug1HiiHandle); + // + // Print option + // + PRINT_INFO_OPTION (byte1, Option); + + // + // check bit and print + // + if (BIT (byte1, 0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (byte1, 1) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (byte1, 2) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (byte1, 3) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (byte1, 4) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (byte1, 5) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE), gShellDebug1HiiHandle); + } + + if (BIT (byte1, 6) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (byte1, 7) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED), gShellDebug1HiiHandle); + } +} + +VOID +DisplayBiosCharacteristicsExt2 ( + UINT8 byte2, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2), gShellDebug1HiiHandle); + // + // Print option + // + PRINT_INFO_OPTION (byte2, Option); + + if (BIT (byte2, 0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP), gShellDebug1HiiHandle); + } + + if (BIT (byte2, 1) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT), gShellDebug1HiiHandle); + } + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle); +} + +VOID +DisplayProcessorFamily ( + UINT8 Family, + UINT8 Option + ) +{ + // + // Print prompt message + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle); + // + // Print option + // + PRINT_INFO_OPTION (Family, Option); + + // + // Use switch to check + // + switch (Family) { + case 0x01: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER), gShellDebug1HiiHandle); + break; + + case 0x02: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + + case 0x03: + Print (L"8086\n"); + break; + + case 0x04: + Print (L"80286\n"); + break; + + case 0x05: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL386_PROCESSOR), gShellDebug1HiiHandle); + break; + + case 0x06: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL486_PROCESSOR), gShellDebug1HiiHandle); + break; + + case 0x07: + Print (L"8087\n"); + break; + + case 0x08: + Print (L"80287\n"); + break; + + case 0x09: + Print (L"80387\n"); + break; + + case 0x0A: + Print (L"80487\n"); + break; + + case 0x0B: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x0C: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PRO_PROC), gShellDebug1HiiHandle); + break; + + case 0x0D: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_II_PROC), gShellDebug1HiiHandle); + break; + + case 0x0E: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_MMX), gShellDebug1HiiHandle); + break; + + case 0x0F: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CELERON_PROC), gShellDebug1HiiHandle); + break; + + case 0x10: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_XEON_PROC), gShellDebug1HiiHandle); + break; + + case 0x11: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_PROC), gShellDebug1HiiHandle); + break; + + case 0x12: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_M1_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x18: + Print (L"AMD Duron\n"); + break; + + case 0x19: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_K5_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x20: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x21: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_601), gShellDebug1HiiHandle); + break; + + case 0x22: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603), gShellDebug1HiiHandle); + break; + + case 0x23: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603_PLUS), gShellDebug1HiiHandle); + break; + + case 0x24: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_604), gShellDebug1HiiHandle); + break; + + case 0x25: + Print (L"Power PC 620\n"); + break; + + case 0x26: + Print (L"Power PC 704\n"); + break; + + case 0x27: + Print (L"Power PC 750\n"); + break; + + case 0x28: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO), gShellDebug1HiiHandle); + break; + + case 0x29: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO_MOBILE), gShellDebug1HiiHandle); + break; + + case 0x2A: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_SOLO_MOBILE), gShellDebug1HiiHandle); + break; + + case 0x2B: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_ATOM), gShellDebug1HiiHandle); + break; + + case 0x30: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ALPHA_FAMILY_2), gShellDebug1HiiHandle); + break; + + case 0x31: + Print (L"Alpha 21064\n"); + break; + + case 0x32: + Print (L"Alpha 21066\n"); + break; + + case 0x33: + Print (L"Alpha 21164\n"); + break; + + case 0x34: + Print (L"Alpha 21164PC\n"); + break; + + case 0x35: + Print (L"Alpha 21164a\n"); + break; + + case 0x36: + Print (L"Alpha 21264\n"); + break; + + case 0x37: + Print (L"Alpha 21364\n"); + break; + + case 0x40: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x41: + Print (L"MIPS R4000\n"); + break; + + case 0x42: + Print (L"MIPS R4200\n"); + break; + + case 0x43: + Print (L"MIPS R4400\n"); + break; + + case 0x44: + Print (L"MIPS R4600\n"); + break; + + case 0x45: + Print (L"MIPS R10000\n"); + break; + + case 0x50: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x51: + Print (L"SuperSparc\n"); + break; + + case 0x52: + Print (L"microSparc II\n"); + break; + + case 0x53: + Print (L"microSparc IIep\n"); + break; + + case 0x54: + Print (L"UltraSparc\n"); + break; + + case 0x55: + Print (L"UltraSparc II\n"); + break; + + case 0x56: + Print (L"UltraSparcIIi\n"); + break; + + case 0x57: + Print (L"UltraSparcIII\n"); + break; + + case 0x58: + Print (L"UltraSparcIIIi\n"); + break; + + case 0x60: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_68040_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x61: + Print (L"68xx\n"); + break; + + case 0x62: + Print (L"68000\n"); + break; + + case 0x63: + Print (L"68010\n"); + break; + + case 0x64: + Print (L"68020\n"); + break; + + case 0x65: + Print (L"68030\n"); + break; + + case 0x70: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HOBBIT_FAMILY), gShellDebug1HiiHandle); + break; + + case 0x78: + Print (L"Crusoe TM5000\n"); + break; + + case 0x79: + Print (L"Crusoe TM3000\n"); + break; + + case 0x7A: + Print (L"Efficeon TM8000\n"); + break; + + case 0x80: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WEITEK), gShellDebug1HiiHandle); + break; + + case 0x82: + Print (L"Itanium\n"); + break; + + case 0x83: + Print (L"AMD Athlon64\n"); + break; + + case 0x84: + Print (L"AMD Opteron\n"); + break; + + case 0x85: + Print (L"AMD Sempron\n"); + break; + + case 0x86: + Print (L"AMD Turion64 Mobile\n"); + break; + + case 0x87: + Print (L"Dual-Core AMD Opteron\n"); + break; + + case 0x88: + Print (L"AMD Athlon 64X2 DualCore\n"); + break; + + case 0x89: + Print (L"AMD Turion 64X2 Mobile\n"); + break; + + case 0x8A: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0x8B: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_THIRD_GENERATION), gShellDebug1HiiHandle); + break; + + case 0x8C: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_FX_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0x8D: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X4_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0x8E: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X2_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0x8F: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_X2_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0x90: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PA_RISC_FAMILY), gShellDebug1HiiHandle); + break; + + case 0xA0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY), gShellDebug1HiiHandle); + break; + + case 0xA1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3200_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xA2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3000_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xA3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5300_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xA4: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5100_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xA5: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5000_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xA6: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_LV_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xA7: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_ULV_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xA8: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7100_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xA9: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5400_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xAA: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xAB: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5200_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xAC: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7200_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xAD: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7300_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xAE: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xAF: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_MULTI_CORE), gShellDebug1HiiHandle); + break; + + case 0xB0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_XEON), gShellDebug1HiiHandle); + break; + + case 0xC0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO), gShellDebug1HiiHandle); + break; + + case 0xC1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle); + break; + + case 0xC2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_QUAD), gShellDebug1HiiHandle); + break; + + case 0xC3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle); + break; + + case 0xC4: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_DUO_MOBILE), gShellDebug1HiiHandle); + break; + + case 0xC5: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO_MOBILE), gShellDebug1HiiHandle); + break; + + case 0xC6: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_I7), gShellDebug1HiiHandle); + break; + + case 0xC7: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CELERON_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xC8: + Print (L"IBM 390\n"); + break; + + case 0xC9: + Print (L"G4\n"); + break; + + case 0xCA: + Print (L"G5\n"); + break; + + case 0xCB: + Print (L"G6\n"); + break; + + case 0xCC: + Print (L"zArchitectur\n"); + break; + + case 0xD2: + Print (L"ViaC7M\n"); + break; + + case 0xD3: + Print (L"ViaC7D\n"); + break; + + case 0xD4: + Print (L"ViaC7\n"); + break; + + case 0xD5: + Print (L"Eden\n"); + break; + + case 0xD6: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_MULTI_CORE), gShellDebug1HiiHandle); + break; + + case 0xD7: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xD8: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xDA: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xDB: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xDD: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xDE: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xDF: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_MULTI_CORE), gShellDebug1HiiHandle); + break; + + case 0xE6: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE), gShellDebug1HiiHandle); + break; + + case 0xE7: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_TRIPLE_CORE), gShellDebug1HiiHandle); + break; + + case 0xE8: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_ULTRA_DUAL_CORE_MOBILE), gShellDebug1HiiHandle); + break; + + case 0xE9: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_DUAL_CORE_MOBILE), gShellDebug1HiiHandle); + break; + + case 0xEA: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_DUAL_CORE), gShellDebug1HiiHandle); + break; + + case 0xEB: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_SI), gShellDebug1HiiHandle); + break; + + case 0xFA: + Print (L"i860\n"); + break; + + case 0xFB: + Print (L"i960\n"); + break; + + default: + // + // In order to reduce code quality notice of + // case & break not pair, so + // move multiple case into the else part and + // use if/else to check value. + // + if (Family >= 0x13 && Family <= 0x17) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_M1), gShellDebug1HiiHandle); + } else if (Family >= 0x1A && Family <= 0x1F) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_K5), gShellDebug1HiiHandle); + } else if (Family >= 0xB1 && Family <= 0xBF) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_PENTIUM), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle); + } + } + // + // end switch + // +} + +VOID +DisplayProcessorFamily2 ( + UINT16 Family2, + UINT8 Option + ) +{ + // + // Print prompt message + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle); + + // + // Print option + // + PRINT_INFO_OPTION (Family2, Option); + + // + // Use switch to check + // + switch (Family2) { + case 0x104: + Print (L"SH-3\n"); + break; + + case 0x105: + Print (L"SH-4\n"); + break; + + case 0x118: + Print (L"ARM\n"); + break; + + case 0x119: + Print (L"StrongARM\n"); + break; + + case 0x12C: + Print (L"6x86\n"); + break; + + case 0x12D: + Print (L"MediaGX\n"); + break; + + case 0x12E: + Print (L"MII\n"); + break; + + case 0x140: + Print (L"WinChip\n"); + break; + + case 0x15E: + Print (L"DSP\n"); + break; + + case 0x1F4: + Print (L"Video Processor\n"); + break; + + default: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle); + } + +} + +VOID +DisplayProcessorVoltage ( + UINT8 Voltage, + UINT8 Option + ) +/*++ +Routine Description: + Bit 7 Set to 0, indicating 'legacy' mode for processor voltage + Bits 6:4 Reserved, must be zero + Bits 3:0 Voltage Capability. + A Set bit indicates that the voltage is supported. + Bit 0 - 5V + Bit 1 - 3.3V + Bit 2 - 2.9V + Bit 3 - Reserved, must be zero. + + Note: + Setting of multiple bits indicates the socket is configurable + If bit 7 is set to 1, the remaining seven bits of the field are set to + contain the processor's current voltage times 10. + For example, the field value for a processor voltage of 1.8 volts would be + 92h = 80h + (1.8 * 10) = 80h + 18 = 80h +12h. + +Arguments: + Voltage - The Voltage + Option - The option + +Returns: + +**/ +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_INFO), gShellDebug1HiiHandle); + // + // Print option + // + PRINT_INFO_OPTION (Voltage, Option); + + if (BIT (Voltage, 7) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_CURRENT_VOLTAGE), gShellDebug1HiiHandle, (Voltage - 0x80)); + } else { + if (BIT (Voltage, 0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_5V_SUPOPRTED), gShellDebug1HiiHandle); + } + + if (BIT (Voltage, 1) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_33V_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (Voltage, 2) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_29V_SUPPORTED), gShellDebug1HiiHandle); + } + // + // check the reserved zero bits: + // + if (BIT (Voltage, 3) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle); + } + + if (BIT (Voltage, 4) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle); + } + + if (BIT (Voltage, 5) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle); + } + + if (BIT (Voltage, 6) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT6_NOT_ZERO), gShellDebug1HiiHandle); + } + } +} + +VOID +DisplayProcessorStatus ( + UINT8 Status, + UINT8 Option + ) +/*++ +Routine Description: + +Bit 7 Reserved, must be 0 +Bit 6 CPU Socket Populated + 1 - CPU Socket Populated + 0 - CPU Socket UnpopulatedBits + 5:3 Reserved, must be zero + Bits 2:0 CPU Status + 0h - Unknown + 1h - CPU Enabled + 2h - CPU Disabled by User via BIOS Setup + 3h - CPU Disabled By BIOS (POST Error) + 4h - CPU is Idle, waiting to be enabled. + 5-6h - Reserved + 7h - Other + +Arguments: + Status - The status + Option - The option + +Returns: + +**/ +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_STATUS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + + if (BIT (Status, 7) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT7), gShellDebug1HiiHandle); + } else if (BIT (Status, 5) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT5), gShellDebug1HiiHandle); + } else if (BIT (Status, 4) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT4), gShellDebug1HiiHandle); + } else if (BIT (Status, 3) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT3), gShellDebug1HiiHandle); + } + // + // Check BIT 6 + // + if (BIT (Status, 6) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_POPULATED), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_UNPOPULATED), gShellDebug1HiiHandle); + } + // + // Check BITs 2:0 + // + switch (Status & 0x07) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_ENABLED), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DISABLED_BY_USER), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DIABLED_BY_BIOS), gShellDebug1HiiHandle); + break; + + case 4: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_IDLE), gShellDebug1HiiHandle); + break; + + case 7: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHERS), gShellDebug1HiiHandle); + break; + + default: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); + } +} + +VOID +DisplayMaxMemoryModuleSize ( + UINT8 Size, + UINT8 SlotNum, + UINT8 Option + ) +{ + UINTN MaxSize; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE_LARGEST_MEM), gShellDebug1HiiHandle); + // + // MaxSize is determined by follow formula + // + MaxSize = (UINTN) 1 << Size; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize); + + if (Option >= SHOW_DETAIL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_AMOUNT_MEM), gShellDebug1HiiHandle); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize, SlotNum, MaxSize * SlotNum); + } +} + +VOID +DisplayMemoryModuleConfigHandles ( + UINT16 *Handles, + UINT8 SlotNum, + UINT8 Option + ) +{ + UINT8 Index; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_CONTROLLED), gShellDebug1HiiHandle, SlotNum); + + if (Option >= SHOW_DETAIL) { + // + // No handle, Handles is INVALID. + // + if (SlotNum == 0) { + return ; + } + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_LIST_CONTROLLED), gShellDebug1HiiHandle); + for (Index = 0; Index < SlotNum; Index++) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLE), gShellDebug1HiiHandle, Index + 1, Handles[Index]); + } + } +} +// +// Memory Module Information (Type 6) +// +VOID +DisplayMmBankConnections ( + UINT8 BankConnections, + UINT8 Option + ) +{ + UINT8 High; + UINT8 Low; + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_CONNECTIONS), gShellDebug1HiiHandle); + // + // Print option + // + PRINT_INFO_OPTION (BankConnections, Option); + + // + // Divide it to high and low + // + High = (UINT8) (BankConnections & 0xF0); + Low = (UINT8) (BankConnections & 0x0F); + if (High != 0xF) { + if (Low != 0xF) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS), gShellDebug1HiiHandle, High, Low, High, Low); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, High, High); + } + } else { + if (Low != 0xF) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, Low, Low); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BANKS_CONNECTED), gShellDebug1HiiHandle); + } + } +} + +VOID +DisplayMmMemorySize ( + UINT8 Size, + UINT8 Option + ) +/*++ +Routine Description: + Bits 0:6 Size (n), + where 2**n is the size in MB with three special-case values: + 7Dh Not determinable (Installed Size only) + 7Eh Module is installed, but no memory has been enabled + 7Fh Not installed + Bit 7 Defines whether the memory module has a single- (0) + or double-bank (1) connection. + +Arguments: + Size - The size + Option - The option + +Returns: + +**/ +{ + UINT8 Value; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEMORY_SIZE), gShellDebug1HiiHandle); + // + // Print option + // + PRINT_INFO_OPTION (Size, Option); + + // + // Get the low bits(0-6 bit) + // + Value = (UINT8) (Size & 0x7F); + if (Value == 0x7D) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE_NOT_DETERMINABLE), gShellDebug1HiiHandle); + } else if (Value == 0x7E) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MODULE_INSTALLED), gShellDebug1HiiHandle); + } else if (Value == 0x7F) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_INSTALLED), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE), gShellDebug1HiiHandle, 1 << Value); + } + + if (BIT (Size, 7) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_DOUBLE_BANK), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_SINGLE_BANK), gShellDebug1HiiHandle); + } +} + +VOID +DisplaySystemSlotId ( + UINT16 SlotId, + UINT8 SlotType, + UINT8 Option + ) +/*++ +Routine Description: + + The Slot ID field of the System Slot structure provides a mechanism to + correlate the physical attributes of the slot to its logical access method + (which varies based on the Slot Type field). + +Arguments: + + SlotId - The slot ID + SlotType - The slot type + Option - The Option + +Returns: + +**/ +{ + // + // Display slot type first + // + DisplaySystemSlotType (SlotType, Option); + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_ID), gShellDebug1HiiHandle); + // + // print option + // + PRINT_INFO_OPTION (SlotType, Option); + + switch (SlotType) { + // + // Slot Type: MCA + // + case 0x04: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_MICRO_CHAN), gShellDebug1HiiHandle); + if (SlotId > 0 && SlotId < 15) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle); + } + break; + + // + // EISA + // + case 0x05: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_EISA_NUM), gShellDebug1HiiHandle); + if (SlotId > 0 && SlotId < 15) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle); + } + break; + + // + // Slot Type: PCI + // + case 0x06: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId); + break; + + // + // PCMCIA + // + case 0x07: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_IDENTIFIES_ADAPTER_NUM), gShellDebug1HiiHandle, SlotId); + break; + + // + // Slot Type: PCI-E + // + case 0xA5: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId); + break; + + default: + if (SlotType >= 0x0E && SlotType <= 0x12) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_SLOT_ID), gShellDebug1HiiHandle); + } + } +} + +VOID +DisplaySystemBootStatus ( + UINT8 Parameter, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_BOOT_STATUS), gShellDebug1HiiHandle); + // + // Print option + // + PRINT_INFO_OPTION (Parameter, Option); + + // + // Check value and print + // + if (Parameter == 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_ERRORS_DETECTED), gShellDebug1HiiHandle); + } else if (Parameter == 1) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BOOTABLE_MEDIA), gShellDebug1HiiHandle); + } else if (Parameter == 2) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NORMAL_OP_SYSTEM), gShellDebug1HiiHandle); + } else if (Parameter == 3) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_DETECTED), gShellDebug1HiiHandle); + } else if (Parameter == 4) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM), gShellDebug1HiiHandle); + } else if (Parameter == 5) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USER_REQUESTED_BOOT), gShellDebug1HiiHandle); + } else if (Parameter == 6) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_SECURITY_VIOLATION), gShellDebug1HiiHandle); + } else if (Parameter == 7) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PREV_REQ_IMAGE), gShellDebug1HiiHandle); + } else if (Parameter == 8) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER), gShellDebug1HiiHandle); + } else if (Parameter >= 9 && Parameter <= 127) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FUTURE_ASSIGNMENT), gShellDebug1HiiHandle); + } else if (Parameter >= 128 && Parameter <= 191) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VENDOR_OEM_SPECIFIC), gShellDebug1HiiHandle); + } else if (Parameter >= 192 && Parameter <= 255) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRODUCT_SPEC_IMPLMENTATION), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_VALUE), gShellDebug1HiiHandle); + } +} +// +// Portable Battery (Type 22) +// +VOID +DisplaySBDSManufactureDate ( + UINT16 Date, + UINT8 Option + ) +/*++ +Routine Description: + The date the cell pack was manufactured, in packed format: + Bits 15:9 Year, biased by 1980, in the range 0 to 127. + Bits 8:5 Month, in the range 1 to 12. + Bits 4:0 Date, in the range 1 to 31. + For example, 01 February 2000 would be identified as + 0010 1000 0100 0001b (0x2841). + +Arguments: + Date - The date + Option - The option + +Returns: + +**/ +{ + UINTN Day; + UINTN Month; + UINTN Year; + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SBDS_MANUFACTURE_DATE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Date, Option); + // + // Print date + // + Day = Date & 0x001F; + Month = (Date & 0x00E0) >> 5; + Year = ((Date & 0xFF00) >> 8) + 1980; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR), gShellDebug1HiiHandle, Day, Month, Year); + +} +// +// System Reset (Type 23) +// +VOID +DisplaySystemResetCapabilities ( + UINT8 Reset, + UINT8 Option + ) +/*++ +Routine Description: +Identifies the system-reset capabilities for the system. + Bits 7:6 Reserved for future assignment via this specification, set to 00b. + Bit 5 System contains a watchdog timer, either True (1) or False (0). + Bits 4:3 Boot Option on Limit. + Identifies the system action to be taken when the Reset Limit is reached, one of: + 00b Reserved, do not use. + 01b Operating system + 10b System utilities + 11b Do not rebootBits + 2:1 Boot Option. Indicates the action to be taken following a watchdog reset, one of: + 00b Reserved, do not use. + 01b Operating system + 10b System utilities + 11b Do not reboot + Bit 0 Status. + 1b The system reset is enabled by the user + 0b The system reset is not enabled by the user + +Arguments: + Reset - Reset + Option - The option + +Returns: + +**/ +{ + UINTN Temp; + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_RESET_CAPABILITIES), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Reset, Option); + + // + // Check reserved bits 7:6 + // + if ((Reset & 0xC0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO), gShellDebug1HiiHandle); + } + // + // Watch dog + // + if (BIT (Reset, 5) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER_2), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_NOT_CONTAIN_TIMER), gShellDebug1HiiHandle); + } + // + // Boot Option on Limit + // + Temp = (Reset & 0x18) >> 3; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION_LIMIT), gShellDebug1HiiHandle); + switch (Temp) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT_BITS), gShellDebug1HiiHandle); + break; + } + // + // Boot Option + // + Temp = (Reset & 0x06) >> 1; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION), gShellDebug1HiiHandle); + switch (Temp) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle); + break; + } + // + // Reset enable flag + // + if ((Reset & 0x01) != 0) { + Print (L"The system reset is enabled by the user\n"); + } else { + Print (L"The system reset is disabled by the user\n"); + } +} +// +// Hardware Security (Type 24) +// +VOID +DisplayHardwareSecuritySettings ( + UINT8 Settings, + UINT8 Option + ) +/*++ +Routine Description: +Identifies the password and reset status for the system: + +Bits 7:6 Power-on Password Status, one of: + 00b Disabled + 01b Enabled + 10b Not Implemented + 11b Unknown +Bits 5:4 Keyboard Password Status, one of: + 00b Disabled + 01b Enabled + 10b Not Implemented + 11b Unknown +Bits 3:2 Administrator Password Status, one of: + 00b Disabled + 01b Enabled + 10b Not Implemented + 11b Unknown +Bits 1:0 Front Panel Reset Status, one of: + 00b Disabled + 01b Enabled + 10b Not Implemented + 11b Unknown + +Arguments: + Settings - The settings + Option - the option + +Returns: + +**/ +{ + UINTN Temp; + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HARDWARE_SECURITY_SET), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Settings, Option); + + // + // Power-on Password Status + // + Temp = (Settings & 0xC0) >> 6; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_ON_PASSWORD), gShellDebug1HiiHandle); + switch (Temp) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + } + // + // Keyboard Password Status + // + Temp = (Settings & 0x30) >> 4; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_PASSWORD), gShellDebug1HiiHandle); + switch (Temp) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + } + // + // Administrator Password Status + // + Temp = (Settings & 0x0C) >> 2; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ADMIN_PASSWORD_STATUS), gShellDebug1HiiHandle); + switch (Temp) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + } + // + // Front Panel Reset Status + // + Temp = Settings & 0x3; + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FRONT_PANEL_RESET), gShellDebug1HiiHandle); + switch (Temp) { + case 0: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); + break; + + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + } +} +// +// Out-of-Band Remote Access (Type 30) +// +VOID +DisplayOBRAConnections ( + UINT8 Connections, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONNECTIONS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Connections, Option); + + // + // Check reserved bits 7:2 + // + if ((Connections & 0xFC) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO_2), gShellDebug1HiiHandle); + } + // + // Outbound Connection + // + if (BIT (Connections, 1) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OUTBOUND_CONN_ENABLED), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTUBOUND_CONN_DISABLED), gShellDebug1HiiHandle); + } + // + // Inbound Connection + // + if (BIT (Connections, 0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOIUND_CONN_ENABLED), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOUND_CONN_DISABLED), gShellDebug1HiiHandle); + } +} +// +// System Power Supply (Type 39) +// +VOID +DisplaySPSCharacteristics ( + UINT16 Characteristics, + UINT8 Option + ) +{ + UINTN Temp; + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_CHAR), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Characteristics, Option); + + // + // Check reserved bits 15:14 + // + if ((Characteristics & 0xC000) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_15_14_RSVD), gShellDebug1HiiHandle); + } + // + // Bits 13:10 - DMTF Power Supply Type + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TYPE), gShellDebug1HiiHandle); + Temp = (Characteristics & 0x1C00) << 10; + switch (Temp) { + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LINEAR), gShellDebug1HiiHandle); + break; + + case 4: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SWITCHING), gShellDebug1HiiHandle); + break; + + case 5: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BATTERY), gShellDebug1HiiHandle); + break; + + case 6: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UPS), gShellDebug1HiiHandle); + break; + + case 7: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONVERTER), gShellDebug1HiiHandle); + break; + + case 8: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_REGULATOR), gShellDebug1HiiHandle); + break; + + default: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_2), gShellDebug1HiiHandle); + } + // + // Bits 9:7 - Status + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STATUS_DASH), gShellDebug1HiiHandle); + Temp = (Characteristics & 0x380) << 7; + switch (Temp) { + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OK), gShellDebug1HiiHandle); + break; + + case 4: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NON_CRITICAL), gShellDebug1HiiHandle); + break; + + case 5: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CRITICAL_POWER_SUPPLY), gShellDebug1HiiHandle); + break; + + default: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED), gShellDebug1HiiHandle); + } + // + // Bits 6:3 - DMTF Input Voltage Range Switching + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INPUT_VOLTAGE_RANGE), gShellDebug1HiiHandle); + Temp = (Characteristics & 0x78) << 3; + switch (Temp) { + case 1: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle); + break; + + case 2: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); + break; + + case 3: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MANUAL), gShellDebug1HiiHandle); + break; + + case 4: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AUTO_SWITCH), gShellDebug1HiiHandle); + break; + + case 5: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WIDE_RANGE), gShellDebug1HiiHandle); + break; + + case 6: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_APPLICABLE), gShellDebug1HiiHandle); + break; + + default: + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_3), gShellDebug1HiiHandle); + break; + } + // + // Power supply is unplugged from the wall + // + if (BIT (Characteristics, 2) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_UNPLUGGED), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PLUGGED), gShellDebug1HiiHandle); + } + // + // Power supply is present + // + if (BIT (Characteristics, 1) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PRESENT), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_PRESENT), gShellDebug1HiiHandle); + } + // + // hot replaceable + // + if (BIT (Characteristics, 0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_REPLACE), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE), gShellDebug1HiiHandle); + } +} diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h new file mode 100644 index 0000000000..a6c8ef6ba8 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h @@ -0,0 +1,192 @@ +/** @file + Module to clarify the element info of the smbios structure. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _SMBIOS_PRINT_INFO_H +#define _SMBIOS_PRINT_INFO_H + +#include "LibSmbios.h" + +extern UINT8 SmbiosMajorVersion; +extern UINT8 SmbiosMinorVersion; + +#define SHOW_NONE 0x00 +#define SHOW_OUTLINE 0x01 +#define SHOW_NORMAL 0x02 +#define SHOW_DETAIL 0x03 +// +// SHOW_ALL: WaitEnter() not wait input. +// +#define SHOW_ALL 0x04 +#define SHOW_STATISTICS 0x05 + +#define AS_UINT16(pData) (*((UINT16 *) pData)) +#define AS_UINT32(pData) (*((UINT32 *) pData)) +#define AS_UINT64(pData) (*((UINT64 *) pData)) + +VOID +SmbiosPrintEPSInfo ( + IN SMBIOS_STRUCTURE_TABLE *pSmbiosTable, + IN UINT8 Option + ); + +EFI_STATUS +SmbiosPrintStructure ( + IN SMBIOS_STRUCTURE_POINTER *pStruct, + IN UINT8 Option + ); + +// +// BIOS Information (Type 0) +// +VOID +DisplayBiosCharacteristics ( + UINT64 chara, + UINT8 Option + ); +VOID +DisplayBiosCharacteristicsExt1 ( + UINT8 byte1, + UINT8 Option + ); +VOID +DisplayBiosCharacteristicsExt2 ( + UINT8 byte2, + UINT8 Option + ); + +// +// Processor Information (Type 4) +// +VOID +DisplayProcessorFamily ( + UINT8 Family, + UINT8 Option + ); + +VOID +DisplayProcessorFamily2 ( + UINT16 Family2, + UINT8 Option + ); + +VOID +DisplayProcessorVoltage ( + UINT8 Voltage, + UINT8 Option + ); +VOID +DisplayProcessorStatus ( + UINT8 Status, + UINT8 Option + ); + +// +// Memory Controller Information (Type 5) +// +VOID +DisplayMaxMemoryModuleSize ( + UINT8 Size, + UINT8 SlotNum, + UINT8 Option + ); +VOID +DisplayMemoryModuleConfigHandles ( + UINT16 *pHandles, + UINT8 SlotNum, + UINT8 Option + ); + +// +// Memory Module Information (Type 6) +// +VOID +DisplayMmBankConnections ( + UINT8 BankConnections, + UINT8 Option + ); +VOID +DisplayMmMemorySize ( + UINT8 Size, + UINT8 Option + ); + +// +// System Slots (Type 9) +// +VOID +DisplaySystemSlotId ( + UINT16 SlotId, + UINT8 SlotType, + UINT8 Option + ); + +// +// Physical Memory Array (Type 16) +// Memory Device (Type 17) +// Memory Array Mapped Address (Type 19) +// Memory Device Mapped Address (Type 20) +// Portable Battery (Type 22) +// +VOID +DisplaySBDSManufactureDate ( + UINT16 Date, + UINT8 Option + ); + +// +// System Reset (Type 23) +// +VOID +DisplaySystemResetCapabilities ( + UINT8 Reset, + UINT8 Option + ); + +// +// Hardware Security (Type 24) +// +VOID +DisplayHardwareSecuritySettings ( + UINT8 Settings, + UINT8 Option + ); + +// +// Out-of-Band Remote Access (Type 30) +// +VOID +DisplayOBRAConnections ( + UINT8 Connections, + UINT8 Option + ); + +// +// System Boot Information (Type 32) +// +VOID +DisplaySystemBootStatus ( + UINT8 Parameter, + UINT8 Option + ); + +// +// System Power Supply (Type 39) +// +VOID +DisplaySPSCharacteristics ( + UINT16 Characteristics, + UINT8 Option + ); + +#endif diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c new file mode 100644 index 0000000000..c04dba5b76 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c @@ -0,0 +1,3798 @@ +/** @file + Build a table, each item is (Key, Info) pair. + And give a interface of query a string out of a table. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "../UefiShellDebug1CommandsLib.h" +#include "QueryTable.h" +#include "PrintInfo.h" + +TABLE_ITEM SystemWakeupTypeTable[] = { + { + 0x0, + L" Reserved" + }, + { + 0x1, + L" Other" + }, + { + 0x2, + L" Unknown" + }, + { + 0x3, + L" APM Timer" + }, + { + 0x4, + L" Modem Ring" + }, + { + 0x5, + L" LAN Remote" + }, + { + 0x6, + L" Power Switch" + }, + { + 0x7, + L" AC Power Restored" + } +}; + +TABLE_ITEM SystemEnclosureTypeTable[] = { + { + 0x01, + L" None" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Desktop" + }, + { + 0x04, + L" Low Profile Desktop" + }, + { + 0x05, + L" Pizza Box" + }, + { + 0x06, + L" Mini Tower" + }, + { + 0x07, + L" Tower" + }, + { + 0x08, + L" Portable" + }, + { + 0x09, + L" LapTop" + }, + { + 0x0A, + L" Notebook" + }, + { + 0x0B, + L" Hand Held" + }, + { + 0x0C, + L" Docking Station" + }, + { + 0x0D, + L" All in One" + }, + { + 0x0E, + L" Sub Notebook" + }, + { + 0x0F, + L" Space-saving" + }, + { + 0x10, + L" Main Server Chassis" + }, + { + 0x11, + L" Expansion Chassis" + }, + { + 0x12, + L" SubChassis" + }, + { + 0x13, + L" Sub Notebook" + }, + { + 0x14, + L" Bus Expansion Chassis" + }, + { + 0x15, + L" Peripheral Chassis" + }, + { + 0x16, + L" RAID Chassis" + }, + { + 0x17, + L" Rack Mount Chassis" + }, + { + 0x18, + L" Sealed-case PC" + }, + { + 0x19, + L" Multi-system Chassis" + }, + { + 0x1A, + L" CompactPCI" + }, + { + 0x1B, + L" AdvancedTCA" + }, + { + 0x1C, + L" Blade" + }, + { + 0x1D, + L" Blade Enclosure" + }, +}; + +TABLE_ITEM SystemEnclosureStatusTable[] = { + { + 0x1, + L" Other" + }, + { + 0x2, + L" Unknown" + }, + { + 0x3, + L" Safe" + }, + { + 0x4, + L" Warning" + }, + { + 0x5, + L" Critical" + }, + { + 0x6, + L" Non-recoverable" + } +}; + +TABLE_ITEM SESecurityStatusTable[] = { + { + 0x1, + L" Other" + }, + { + 0x2, + L" Unknown" + }, + { + 0x3, + L" None" + }, + { + 0x4, + L" External interface locked out" + }, + { + 0x5, + L" External interface enabled" + } +}; + +TABLE_ITEM ProcessorTypeTable[] = { + { + 0x1, + L" Other" + }, + { + 0x2, + L" Unknown" + }, + { + 0x3, + L" Central Processor" + }, + { + 0x4, + L" Math Processor" + }, + { + 0x5, + L" DSP Processor" + }, + { + 0x6, + L" Video Processor " + }, +}; + +TABLE_ITEM ProcessorUpgradeTable[] = { + { + 0x01, + L"Other" + }, + { + 0x02, + L"Unknown" + }, + { + 0x03, + L"Daughter Board" + }, + { + 0x04, + L"ZIF Socket" + }, + { + 0x05, + L"Replaceable Piggy Back" + }, + { + 0x06, + L"None" + }, + { + 0x07, + L"LIF Socket" + }, + { + 0x08, + L"Slot 1" + }, + { + 0x09, + L"Slot 2" + }, + { + 0x0A, + L"370-pin socket" + }, + { + 0x0B, + L"Slot A" + }, + { + 0x0C, + L"Slot M" + }, + { + 0x0D, + L"Socket 423" + }, + { + 0x0E, + L"Socket A" + }, + { + 0x0F, + L"Socket 478" + }, + { + 0x10, + L"Socket 754" + }, + { + 0x11, + L"Socket 940" + }, + { + 0x12, + L"Socket 939" + }, + { + 0x13, + L"Socket mPGA604" + }, + { + 0x14, + L"Socket LGA771" + }, + { + 0x15, + L"Socket LGA775" + }, + { + 0x16, + L"Socket S1" + }, + { + 0x17, + L"Socket AM2" + }, + { + 0x18, + L"Socket F" + }, + { + 0x19, + L"Socket LGA1366" + }\ +}; + +TABLE_ITEM McErrorDetectMethodTable[] = { + { + 0x01, + L"Other" + }, + { + 0x02, + L"Unknown" + }, + { + 0x03, + L"None" + }, + { + 0x04, + L"8-bit Parity" + }, + { + 0x05, + L"32-bit ECC" + }, + { + 0x06, + L"64-bit ECC" + }, + { + 0x07, + L"128-bit ECC" + }, + { + 0x08, + L"CRC" + }, +}; + +TABLE_ITEM McErrorCorrectCapabilityTable[] = { + { + 0, + L"Other" + }, + { + 1, + L"Unknown" + }, + { + 2, + L"None" + }, + { + 3, + L"Single Bit Error Correcting" + }, + { + 4, + L"Double Bit Error Correcting" + }, + { + 5, + L"Error Scrubbing" + }, +}; + +TABLE_ITEM McInterleaveSupportTable[] = { + { + 0x01, + L"Other" + }, + { + 0x02, + L"Unknown" + }, + { + 0x03, + L"One Way Interleave" + }, + { + 0x04, + L"Two Way Interleave" + }, + { + 0x05, + L"Four Way Interleave" + }, + { + 0x06, + L"Eight Way Interleave" + }, + { + 0x07, + L"Sixteen Way Interleave" + } +}; + +TABLE_ITEM McMemorySpeedsTable[] = { + { + 0, + L" Other" + }, + { + 1, + L" Unknown" + }, + { + 2, + L" 70ns" + }, + { + 3, + L" 60ns" + }, + { + 4, + L" 50ns" + }, +}; + +TABLE_ITEM MemoryModuleVoltageTable[] = { + { + 0, + L" 5V" + }, + { + 1, + L" 3.3V" + }, + { + 2, + L" 2.9V" + }, +}; + +TABLE_ITEM MmMemoryTypeTable[] = { + { + 0, + L" Other" + }, + { + 1, + L" Unknown" + }, + { + 2, + L" Standard" + }, + { + 3, + L" Fast Page Mode" + }, + { + 4, + L" EDO" + }, + { + 5, + L" Parity" + }, + { + 6, + L" ECC " + }, + { + 7, + L" SIMM" + }, + { + 8, + L" DIMM" + }, + { + 9, + L" Burst EDO" + }, + { + 10, + L" SDRAM" + } +}; + +TABLE_ITEM MmErrorStatusTable[] = { + { + 0, + L" Uncorrectable errors received" + }, + { + 1, + L" Correctable errors received" + }, + { + 2, + L" Error Status obtained from the event log" + } +}; + +TABLE_ITEM CacheSRAMTypeTable[] = { + { + 0, + L" Other" + }, + { + 1, + L" Unknown" + }, + { + 2, + L" Non-Burst" + }, + { + 3, + L" Burst" + }, + { + 4, + L" Pipeline Burst" + }, + { + 5, + L" Synchronous" + }, + { + 6, + L" Asynchronous" + }, +}; + +TABLE_ITEM CacheErrCorrectingTypeTable[] = { + { + 0x01, + L"Other" + }, + { + 0x02, + L"Unknown" + }, + { + 0x03, + L"None" + }, + { + 0x04, + L"Parity" + }, + { + 0x05, + L"Single-bit ECC" + }, + { + 0x06, + L"Multi-bit ECC" + }, + { + 0x07, + L"Sixteen Way Interleave" + } +}; + +TABLE_ITEM CacheSystemCacheTypeTable[] = { + { + 0x01, + L"Other" + }, + { + 0x02, + L"Unknown" + }, + { + 0x03, + L"Instruction" + }, + { + 0x04, + L"Data" + }, + { + 0x05, + L"Unified" + } +}; + +TABLE_ITEM CacheAssociativityTable[] = { + { + 0x01, + L"Other" + }, + { + 0x02, + L"Unknown" + }, + { + 0x03, + L"Direct Mapped" + }, + { + 0x04, + L"2-way Set-Associative" + }, + { + 0x05, + L"4-way Set-Associative" + }, + { + 0x06, + L"Fully Associative" + }, + { + 0x07, + L"8-way Set-Associative" + }, + { + 0x08, + L"16-way Set-Associative" + }, + { + 0x09, + L"12-way Set-Associative" + }, + { + 0x0A, + L"24-way Set-Associative" + }, + { + 0x0B, + L"32-way Set-Associative" + }, + { + 0x0C, + L"48-way Set-Associative" + }, + { + 0x0D, + L"64-way Set-Associative" + } +}; + +TABLE_ITEM PortConnectorTypeTable[] = { + { + 0x00, + L"None" + }, + { + 0x01, + L"Centronics" + }, + { + 0x02, + L"Mini Centronics" + }, + { + 0x03, + L"Proprietary" + }, + { + 0x04, + L"DB-25 pin male" + }, + { + 0x05, + L"DB-25 pin female" + }, + { + 0x06, + L"DB-15 pin male" + }, + { + 0x07, + L"DB-15 pin female" + }, + { + 0x08, + L"DB-9 pin male" + }, + { + 0x09, + L"DB-9 pin female" + }, + { + 0x0A, + L"RJ-11" + }, + { + 0x0B, + L"RJ-45" + }, + { + 0x0C, + L"50 Pin MiniSCSI" + }, + { + 0x0D, + L"Mini-DIN" + }, + { + 0x0E, + L"Micro-DIN" + }, + { + 0x0F, + L"PS/2" + }, + { + 0x10, + L"Infrared" + }, + { + 0x11, + L"HP-HIL" + }, + { + 0x12, + L"Access Bus (USB)" + }, + { + 0x13, + L"SSA SCSI" + }, + { + 0x14, + L"Circular DIN-8 male" + }, + { + 0x15, + L"Circular DIN-8 female" + }, + { + 0x16, + L"On Board IDE" + }, + { + 0x17, + L"On Board Floppy" + }, + { + 0x18, + L"9 Pin Dual Inline (pin 10 cut)" + }, + { + 0x19, + L"25 Pin Dual Inline (pin 26 cut)" + }, + { + 0x1A, + L"50 Pin Dual Inline" + }, + { + 0x1B, + L"68 Pin Dual Inline" + }, + { + 0x1C, + L"On Board Sound Input from CD-ROM" + }, + { + 0x1D, + L"Mini-Centronics Type-14" + }, + { + 0x1E, + L"Mini-Centronics Type-26" + }, + { + 0x1F, + L"Mini-jack (headphones)" + }, + { + 0x20, + L"BNC" + }, + { + 0x21, + L"1394" + }, + { + 0x22, + L"SAS/SATA Plug Receptacle" + }, + { + 0xA0, + L"PC-98" + }, + { + 0xA1, + L"PC-98Hireso" + }, + { + 0xA2, + L"PC-H98" + }, + { + 0xA3, + L"PC-98Note" + }, + { + 0xA4, + L"PC-98Full" + }, + { + 0xFF, + L"Other" + }, +}; + +TABLE_ITEM PortTypeTable[] = { + { + 0x00, + L"None" + }, + { + 0x01, + L"Parallel Port XT/AT Compatible" + }, + { + 0x02, + L"Parallel Port PS/2" + }, + { + 0x03, + L"Parallel Port ECP" + }, + { + 0x04, + L"Parallel Port EPP" + }, + { + 0x05, + L"Parallel Port ECP/EPP" + }, + { + 0x06, + L"Serial Port XT/AT Compatible" + }, + { + 0x07, + L"Serial Port 16450 Compatible" + }, + { + 0x08, + L"Serial Port 16550 Compatible" + }, + { + 0x09, + L"Serial Port 16550A Compatible" + }, + { + 0x0A, + L"SCSI Port" + }, + { + 0x0B, + L"MIDI Port" + }, + { + 0x0C, + L"Joy Stick Port" + }, + { + 0x0D, + L"Keyboard Port" + }, + { + 0x0E, + L"Mouse Port" + }, + { + 0x0F, + L"SSA SCSI" + }, + { + 0x10, + L"USB" + }, + { + 0x11, + L"FireWire (IEEE P1394)" + }, + { + 0x12, + L"PCMCIA Type II" + }, + { + 0x13, + L"PCMCIA Type II" + }, + { + 0x14, + L"PCMCIA Type III" + }, + { + 0x15, + L"Cardbus" + }, + { + 0x16, + L"Access Bus Port" + }, + { + 0x17, + L"SCSI II" + }, + { + 0x18, + L"SCSI Wide" + }, + { + 0x19, + L"PC-98" + }, + { + 0x1A, + L"PC-98-Hireso" + }, + { + 0x1B, + L"PC-H98" + }, + { + 0x1C, + L"Video Port" + }, + { + 0x1D, + L"Audio Port" + }, + { + 0x1E, + L"Modem Port" + }, + { + 0x1F, + L"Network Port" + }, + { + 0x20, + L"SATA Port" + }, + { + 0x21, + L"SAS Port" + }, + { + 0xA0, + L"8251 Compatible" + }, + { + 0xA1, + L"8251 FIFO Compatible" + }, + { + 0xFF, + L"Other " + }, +}; + +TABLE_ITEM SystemSlotTypeTable[] = { + { + 0x01, + L"Other" + }, + { + 0x02, + L"Unknown" + }, + { + 0x03, + L"ISA" + }, + { + 0x04, + L"MCA" + }, + { + 0x05, + L"EISA" + }, + { + 0x06, + L"PCI" + }, + { + 0x07, + L"PC Card (PCMCIA)" + }, + { + 0x08, + L"VL-VESA" + }, + { + 0x09, + L"Proprietary" + }, + { + 0x0A, + L"Processor Card Slot" + }, + { + 0x0B, + L"Proprietary Memory Card Slot" + }, + { + 0x0C, + L"I/O Riser Card Slot" + }, + { + 0x0D, + L"NuBus" + }, + { + 0x0E, + L"PCI - 66MHz Capable" + }, + { + 0x0F, + L"AGP" + }, + { + 0x10, + L"AGP 2X" + }, + { + 0x11, + L"AGP 4X" + }, + { + 0x12, + L"PCI-X" + }, + { + 0xA0, + L"PC-98/C20 " + }, + { + 0xA1, + L"PC-98/C24 " + }, + { + 0xA2, + L"PC-98/E " + }, + { + 0xA3, + L"PC-98/Local Bus " + }, + { + 0xA4, + L"PC-98/Card " + }, + { + 0xA5, + L"PCI Express " + }, + { + 0xA6, + L"PCI Express X1" + }, + { + 0xA7, + L"PCI Express X2" + }, + { + 0xA8, + L"PCI Express X4" + }, + { + 0xA9, + L"PCI Express X8" + }, + { + 0xAA, + L"PCI Express X16" + }, + { + 0xAB, + L"PCI Express Gen 26" + }, + { + 0xAC, + L"PCI Express Gen 2 X1" + }, + { + 0xAD, + L"PCI Express Gen 2 X2" + }, + { + 0xAE, + L"PCI Express Gen 2 X4" + }, + { + 0xAF, + L"PCI Express Gen 2 X8" + }, + { + 0xB0, + L"PCI Express Gen 2 X16" + } +}; + +TABLE_ITEM SystemSlotDataBusWidthTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" 8 bit" + }, + { + 0x04, + L" 16 bit" + }, + { + 0x05, + L" 32 bit" + }, + { + 0x06, + L" 64 bit" + }, + { + 0x07, + L" 128 bit" + }, +}; + +TABLE_ITEM SystemSlotCurrentUsageTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Available" + }, + { + 0x04, + L" In use" + }, +}; + +TABLE_ITEM SystemSlotLengthTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Short length" + }, + { + 0x04, + L" Long Length" + }, +}; + +TABLE_ITEM SlotCharacteristics1Table[] = { + { + 0, + L" Characteristics Unknown" + }, + { + 1, + L" Provides 5.0 Volts" + }, + { + 2, + L" Provides 3.3 Volts" + }, + { + 3, + L" Slot's opening is shared with another slot, e.g. PCI/EISA shared slot." + }, + + { + 4, + L" PC Card slot supports PC Card-16" + }, + { + 5, + L" PC Card slot supports CardBus" + }, + { + 6, + L" PC Card slot supports Zoom Video " + }, + { + 7, + L" PC Card slot supports Modem Ring Resume " + } +}; + +TABLE_ITEM SlotCharacteristics2Table[] = { + { + 0, + L" PCI slot supports Power Management Enable (PME#) signal" + }, + { + 1, + L" Slot supports hot-plug devices" + }, + { + 2, + L" PCI slot supports SMBus signal" + } +}; + +TABLE_ITEM OnboardDeviceTypesTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Video" + }, + { + 0x04, + L" SCSI Controller" + }, + { + 0x05, + L" Ethernet" + }, + { + 0x06, + L" Token Ring" + }, + { + 0x07, + L" Sound" + }, + { + 0x08, + L" Pata Controller" + }, + { + 0x09, + L" Sata Controller" + }, + { + 0x0A, + L" Sas Controller" + }, +}; + +TABLE_ITEM SELTypesTable[] = { + { + 0x00, + L" Reserved." + }, + { + 0x01, + L" Single-bit ECC memory error" + }, + { + 0x02, + L" Multi-bit ECC memory error" + }, + { + 0x03, + L" Parity memory error" + }, + { + 0x04, + L" Bus time-out" + }, + { + 0x05, + L" I/O Channel Check" + }, + { + 0x06, + L" Software NMI" + }, + { + 0x07, + L" POST Memory Resize" + }, + { + 0x08, + L" POST Error" + }, + { + 0x09, + L" PCI Parity Error" + }, + { + 0x0A, + L" PCI System Error" + }, + { + 0x0B, + L" CPU Failure" + }, + { + 0x0C, + L" EISA FailSafe Timer time-out" + }, + { + 0x0D, + L" Correctable memory log disabled" + }, + { + 0x0E, + L" Logging disabled for a specific Event Type" + }, + { + 0x0F, + L" Reserved" + }, + { + 0x10, + L" System Limit Exceeded" + }, + { + 0x11, + L" Asynchronous hardware timer expired and issued a system reset" + }, + { + 0x12, + L" System configuration information" + }, + { + 0x13, + L" Hard-disk information" + }, + { + 0x14, + L" System reconfigured" + }, + { + 0x15, + L" Uncorrectable CPU-complex error" + }, + { + 0x16, + L" Log Area Reset/Cleared" + }, + { + 0x17, + L" System boot" + }, + { + 0x7F18, + L" Unused by SMBIOS specification" + }, + { + 0xFE80, + L" System and OEM specified" + }, + { + 0xFF, + L" End-of-log" + }, +}; + +TABLE_ITEM SELVarDataFormatTypeTable[] = { + { + 0x00, + L" None " + }, + { + 0x01, + L" Handle " + }, + { + 0x02, + L" Multiple-Event " + }, + { + 0x03, + L" Multiple-Event Handle " + }, + { + 0x04, + L" POST Results Bitmap " + }, + // + // Defined below + // + { + 0x05, + L" System Management Type" + }, + // + // Defined below + // + { + 0x06, + L" Multiple-Event System Management Type " + }, + { + 0x7F07, + L" Unused " + }, + { + 0xFF80, + L" OEM assigned " + }, +}; + +TABLE_ITEM PostResultsBitmapDw1Table[] = { + { + 0, + L" Channel 2 Timer error " + }, + { + 1, + L" Master PIC (8259 #1) error " + }, + { + 2, + L" Slave PIC (8259 #2) error " + }, + { + 3, + L" CMOS Battery Failure " + }, + { + 4, + L" CMOS System Options Not Set " + }, + { + 5, + L" CMOS Checksum Error " + }, + { + 6, + L" CMOS Configuration Error " + }, + { + 7, + L" Mouse and Keyboard Swapped " + }, + { + 8, + L" Keyboard Locked " + }, + { + 9, + L" Keyboard Not Functional " + }, + { + 10, + L" Keyboard Controller Not Functional " + }, + { + 11, + L" CMOS Memory Size Different " + }, + { + 12, + L" Memory Decreased in Size " + }, + { + 13, + L" Cache Memory Error " + }, + { + 14, + L" Floppy Drive 0 Error " + }, + { + 15, + L" Floppy Drive 1 Error " + }, + { + 16, + L" Floppy Controller Failure " + }, + { + 17, + L" Number of ATA Drives Reduced Error " + }, + { + 18, + L" CMOS Time Not Set " + }, + { + 19, + L" DDC Monitor Configuration Change " + }, + { + 20, + L" Reserved, set to 0 " + }, + { + 21, + L" Reserved, set to 0 " + }, + { + 22, + L" Reserved, set to 0 " + }, + { + 23, + L" Reserved, set to 0 " + }, + { + 24, + L" Second DWORD has valid data " + }, + { + 25, + L" Reserved, set to 0 " + }, + { + 26, + L" Reserved, set to 0 " + }, + { + 27, + L" Reserved, set to 0 " + }, + { + 28, + L" Normally 0; available for OEM assignment " + }, + { + 29, + L" Normally 0; available for OEM assignment " + }, + { + 30, + L" Normally 0; available for OEM assignment " + }, + { + 31, + L" Normally 0; available for OEM assignment " + }, +}; + +TABLE_ITEM PostResultsBitmapDw2Table[] = { + { + 0, + L" Normally 0; available for OEM assignment " + }, + { + 1, + L" Normally 0; available for OEM assignment " + }, + { + 2, + L" Normally 0; available for OEM assignment " + }, + { + 3, + L" Normally 0; available for OEM assignment " + }, + { + 4, + L" Normally 0; available for OEM assignment " + }, + { + 5, + L" Normally 0; available for OEM assignment " + }, + { + 6, + L" Normally 0; available for OEM assignment " + }, + { + 7, + L" PCI Memory Conflict " + }, + { + 8, + L" PCI I/O Conflict " + }, + { + 9, + L" PCI IRQ Conflict " + }, + { + 10, + L" PNP Memory Conflict " + }, + { + 11, + L" PNP 32 bit Memory Conflict " + }, + { + 12, + L" PNP I/O Conflict " + }, + { + 13, + L" PNP IRQ Conflict " + }, + { + 14, + L" PNP DMA Conflict " + }, + { + 15, + L" Bad PNP Serial ID Checksum " + }, + { + 16, + L" Bad PNP Resource Data Checksum " + }, + { + 17, + L" Static Resource Conflict " + }, + { + 18, + L" NVRAM Checksum Error, NVRAM Cleared " + }, + { + 19, + L" System Board Device Resource Conflict " + }, + { + 20, + L" Primary Output Device Not Found " + }, + { + 21, + L" Primary Input Device Not Found " + }, + { + 22, + L" Primary Boot Device Not Found " + }, + { + 23, + L" NVRAM Cleared By Jumper " + }, + { + 24, + L" NVRAM Data Invalid, NVRAM Cleared " + }, + { + 25, + L" FDC Resource Conflict " + }, + { + 26, + L" Primary ATA Controller Resource Conflict " + }, + { + 27, + L" Secondary ATA Controller Resource Conflict " + }, + { + 28, + L" Parallel Port Resource Conflict " + }, + { + 29, + L" Serial Port 1 Resource Conflict " + }, + { + 30, + L" Serial Port 2 Resource Conflict " + }, + { + 31, + L" Audio Resource Conflict " + }, +}; + +TABLE_ITEM SELSysManagementTypesTable[] = { + { + 0x01, + L" +2.5V Out of range, #2 " + }, + { + 0x02, + L" +3.3V Out of range " + }, + { + 0x03, + L" +5V Out of range " + }, + { + 0x04, + L" -5V Out of range " + }, + { + 0x05, + L" +12V Out of range " + }, + { + 0x06, + L" -12V Out of range " + }, + { + 0x0F07, + L" Reserved for future out-of-range voltage levels " + }, + { + 0x10, + L" System board temperature out of range " + }, + { + 0x11, + L" Processor #1 temperature out of range " + }, + { + 0x12, + L" Processor #2 temperature out of range " + }, + { + 0x13, + L" Processor #3 temperature out of range " + }, + { + 0x14, + L" Processor #4 temperature out of range " + }, + { + 0x1F15, + L" Reserved for future out-of-range temperatures" + }, + { + 0x2720, + L" Fan n (n = 0 to 7) Out of range " + }, + { + 0x2F28, + L" Reserved for future assignment via this specification " + }, + { + 0x30, + L" Chassis secure switch activated " + }, +}; + +TABLE_ITEM PMALocationTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" System board or motherboard" + }, + { + 0x04, + L" ISA add-on card" + }, + { + 0x05, + L" EISA add-on card" + }, + { + 0x06, + L" PCI add-on card" + }, + { + 0x07, + L" MCA add-on card" + }, + { + 0x08, + L" PCMCIA add-on card" + }, + { + 0x09, + L" Proprietary add-on card" + }, + { + 0x0A, + L" NuBus" + }, + { + 0xA0, + L" PC-98/C20 add-on card" + }, + { + 0xA1, + L" PC-98/C24 add-on card" + }, + { + 0xA2, + L" PC-98/E add-on card" + }, + { + 0xA3, + L" PC-98/Local bus add-on card" + } +}; + +TABLE_ITEM PMAUseTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" System memory" + }, + { + 0x04, + L" Video memory" + }, + { + 0x05, + L" Flash memory" + }, + { + 0x06, + L" Non-volatile RAM" + }, + { + 0x07, + L" Cache memory" + } +}; + +TABLE_ITEM PMAErrorCorrectionTypesTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" None" + }, + { + 0x04, + L" Parity" + }, + { + 0x05, + L" Single-bit ECC" + }, + { + 0x06, + L" Multi-bit ECC" + }, + { + 0x07, + L" CRC" + } +}; + +TABLE_ITEM MemoryDeviceFormFactorTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" SIMM" + }, + { + 0x04, + L" SIP" + }, + { + 0x05, + L" Chip" + }, + { + 0x06, + L" DIP" + }, + { + 0x07, + L" ZIP" + }, + { + 0x08, + L" Proprietary Card" + }, + { + 0x09, + L" DIMM" + }, + { + 0x0A, + L" TSOP" + }, + { + 0x0B, + L" Row of chips" + }, + { + 0x0C, + L" RIMM" + }, + { + 0x0D, + L" SODIMM" + }, + { + 0x0E, + L" SRIMM" + }, + { + 0x0F, + L" FB-DIMM" + } +}; + +TABLE_ITEM MemoryDeviceTypeTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" DRAM" + }, + { + 0x04, + L" EDRAM" + }, + { + 0x05, + L" VRAM" + }, + { + 0x06, + L" SRAM" + }, + { + 0x07, + L" RAM" + }, + { + 0x08, + L" ROM" + }, + { + 0x09, + L" FLASH" + }, + { + 0x0A, + L" EEPROM" + }, + { + 0x0B, + L" FEPROM" + }, + { + 0x0C, + L" EPROM" + }, + { + 0x0D, + L" CDRAM" + }, + { + 0x0E, + L" 3DRAM" + }, + { + 0x0F, + L" SDRAM" + }, + { + 0x10, + L" SGRAM" + }, + { + 0x11, + L" RDRAM" + }, + { + 0x12, + L" DDR" + }, + { + 0x13, + L" DDR2" + }, + { + 0x14, + L" DDR2 FB-DIMM" + }, + { + 0x18, + L" DDR3" + }, + { + 0x19, + L" FBD2" + } +}; + +TABLE_ITEM MemoryDeviceTypeDetailTable[] = { + { + 1, + L" Other" + }, + { + 2, + L" Unknown" + }, + { + 3, + L" Fast-paged" + }, + { + 4, + L" Static column" + }, + { + 5, + L" Pseudo-STATIC" + }, + { + 6, + L" RAMBUS " + }, + { + 7, + L" Synchronous" + }, + { + 8, + L" CMOS" + }, + { + 9, + L" EDO" + }, + { + 10, + L" Window DRAM" + }, + { + 11, + L" Cache DRAM" + }, + { + 12, + L" Non-volatile" + }, +}; + +TABLE_ITEM MemoryErrorTypeTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" OK" + }, + { + 0x04, + L" Bad read" + }, + { + 0x05, + L" Parity error" + }, + { + 0x06, + L" Single-bit error" + }, + { + 0x07, + L" Double-bit error" + }, + { + 0x08, + L" Multi-bit error" + }, + { + 0x09, + L" Nibble error" + }, + { + 0x0A, + L" Checksum error" + }, + { + 0x0B, + L" CRC error" + }, + { + 0x0C, + L" Corrected single-bit error" + }, + { + 0x0D, + L" Corrected error" + }, + { + 0x0E, + L" Uncorrectable error" + }, +}; + +TABLE_ITEM MemoryErrorGranularityTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Device level" + }, + { + 0x04, + L" Memory partition level" + }, +}; + +TABLE_ITEM MemoryErrorOperationTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Read" + }, + { + 0x04, + L" Write" + }, + { + 0x05, + L" Partial Write" + }, +}; + +TABLE_ITEM PointingDeviceTypeTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Mouse" + }, + { + 0x04, + L" Track Ball" + }, + { + 0x05, + L" Track Point" + }, + { + 0x06, + L" Glide Point" + }, + { + 0x07, + L" Touch Pad" + }, +}; + +TABLE_ITEM PointingDeviceInterfaceTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" Serial" + }, + { + 0x04, + L" PS/2" + }, + { + 0x05, + L" Infrared" + }, + { + 0x06, + L" HP-HIL" + }, + { + 0x07, + L" Bus mouse" + }, + { + 0x08, + L" ADB(Apple Desktop Bus" + }, + { + 0xA0, + L" Bus mouse DB-9" + }, + { + 0xA1, + L" Bus mouse mirco-DIN" + }, + { + 0xA2, + L" USB" + }, +}; + +TABLE_ITEM PBDeviceChemistryTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" Lead Acid " + }, + { + 0x04, + L" Nickel Cadmium " + }, + { + 0x05, + L" Nickel metal hydride " + }, + { + 0x06, + L" Lithium-ion " + }, + { + 0x07, + L" Zinc air " + }, + { + 0x08, + L" Lithium Polymer " + }, +}; + +TABLE_ITEM VPLocationTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" OK " + }, + { + 0x04, + L" Non-critical " + }, + { + 0x05, + L" Critical " + }, + { + 0x06, + L" Non-recoverable " + }, +}; + +TABLE_ITEM VPStatusTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" Processor " + }, + { + 0x04, + L" Disk " + }, + { + 0x05, + L" Peripheral Bay " + }, + { + 0x06, + L" System Management Module " + }, + { + 0x07, + L" Motherboard " + }, + { + 0x08, + L" Memory Module " + }, + { + 0x09, + L" Processor Module " + }, + { + 0x0A, + L" Power Unit " + }, + { + 0x0B, + L" Add-in Card " + }, +}; + +TABLE_ITEM CoolingDeviceStatusTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" OK " + }, + { + 0x04, + L" Non-critical " + }, + { + 0x05, + L" Critical " + }, + { + 0x06, + L" Non-recoverable " + }, +}; + +TABLE_ITEM CoolingDeviceTypeTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" Fan " + }, + { + 0x04, + L" Centrifugal Blower " + }, + { + 0x05, + L" Chip Fan " + }, + { + 0x06, + L" Cabinet Fan " + }, + { + 0x07, + L" Power Supply Fan " + }, + { + 0x08, + L" Heat Pipe " + }, + { + 0x09, + L" Integrated Refrigeration " + }, + { + 0x0A, + L" Active Cooling " + }, + { + 0x0B, + L" Passive Cooling " + }, +}; + +TABLE_ITEM TemperatureProbeStatusTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" OK " + }, + { + 0x04, + L" Non-critical " + }, + { + 0x05, + L" Critical " + }, + { + 0x06, + L" Non-recoverable " + }, +}; + +TABLE_ITEM TemperatureProbeLocTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" Processor " + }, + { + 0x04, + L" Disk " + }, + { + 0x05, + L" Peripheral Bay " + }, + { + 0x06, + L" System Management Module " + }, + { + 0x07, + L" Motherboard " + }, + { + 0x08, + L" Memory Module " + }, + { + 0x09, + L" Processor Module " + }, + { + 0x0A, + L" Power Unit " + }, + { + 0x0B, + L" Add-in Card " + }, +}; + +TABLE_ITEM ECPStatusTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" OK " + }, + { + 0x04, + L" Non-critical " + }, + { + 0x05, + L" Critical " + }, + { + 0x06, + L" Non-recoverable " + }, +}; + +TABLE_ITEM ECPLocTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" Processor " + }, + { + 0x04, + L" Disk " + }, + { + 0x05, + L" Peripheral Bay " + }, + { + 0x06, + L" System Management Module " + }, + { + 0x07, + L" Motherboard " + }, + { + 0x08, + L" Memory Module " + }, + { + 0x09, + L" Processor Module " + }, + { + 0x0A, + L" Power Unit " + }, + { + 0x0B, + L" Add-in Card " + }, +}; + +TABLE_ITEM MDTypeTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" National Semiconductor LM75 " + }, + { + 0x04, + L" National Semiconductor LM78 " + }, + { + 0x05, + L" National Semiconductor LM79 " + }, + { + 0x06, + L" National Semiconductor LM80 " + }, + { + 0x07, + L" National Semiconductor LM81 " + }, + { + 0x08, + L" Analog Devices ADM9240 " + }, + { + 0x09, + L" Dallas Semiconductor DS1780 " + }, + { + 0x0A, + L" Maxim 1617 " + }, + { + 0x0B, + L" Genesys GL518SM " + }, + { + 0x0C, + L" Winbond W83781D " + }, + { + 0x0D, + L" Holtek HT82H791 " + }, +}; + +TABLE_ITEM MDAddressTypeTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" I/O Port " + }, + { + 0x04, + L" Memory " + }, + { + 0x05, + L" SM Bus " + }, +}; + +TABLE_ITEM MemoryChannelTypeTable[] = { + { + 0x01, + L" Other " + }, + { + 0x02, + L" Unknown " + }, + { + 0x03, + L" RamBus " + }, + { + 0x04, + L" SyncLink " + }, +}; + +TABLE_ITEM IPMIDIBMCInterfaceTypeTable[] = { + { + 0x00, + L" Unknown " + }, + { + 0x01, + L" KCS: Keyboard Controller Style " + }, + { + 0x02, + L" SMIC: Server Management Interface Chip " + }, + { + 0x03, + L" BT: Block Transfer " + }, + { + 0xFF04, + L" Reserved for future assignment by this specification " + }, +}; + +TABLE_ITEM StructureTypeInfoTable[] = { + { + 0, + L" BIOS Information" + }, + { + 1, + L" System Information" + }, + { + 2, + L" Base Board Information" + }, + { + 3, + L" System Enclosure" + }, + { + 4, + L" Processor Information" + }, + { + 5, + L" Memory Controller Information " + }, + { + 6, + L" Memory Module Information " + }, + { + 7, + L" Cache Information " + }, + { + 8, + L" Port Connector Information " + }, + { + 9, + L" System Slots " + }, + { + 10, + L" On Board Devices Information " + }, + { + 11, + L" OEM Strings" + }, + { + 12, + L" System Configuration Options " + }, + { + 13, + L" BIOS Language Information " + }, + { + 14, + L" Group Associations " + }, + { + 15, + L" System Event Log " + }, + { + 16, + L" Physical Memory Array " + }, + { + 17, + L" Memory Device " + }, + { + 18, + L" 32-bit Memory Error Information " + }, + { + 19, + L" Memory Array Mapped Address " + }, + { + 20, + L" Memory Device Mapped Address " + }, + { + 21, + L" Built-in Pointing Device " + }, + { + 22, + L" Portable Battery " + }, + { + 23, + L" System Reset " + }, + { + 24, + L" Hardware Security " + }, + { + 25, + L" System Power Controls " + }, + { + 26, + L" Voltage Probe " + }, + { + 27, + L" Cooling Device " + }, + { + 28, + L" Temperature Probe " + }, + { + 29, + L" Electrical Current Probe " + }, + { + 30, + L" Out-of-Band Remote Access " + }, + { + 31, + L" Boot Integrity Services (BIS) Entry Point" + }, + { + 32, + L" System Boot Information " + }, + { + 33, + L" 64-bit Memory Error Information " + }, + { + 34, + L" Management Device " + }, + { + 35, + L" Management Device Component " + }, + { + 36, + L" Management Device Threshold Data " + }, + { + 37, + L" Memory Channel " + }, + { + 38, + L" IPMI Device Information " + }, + { + 39, + L" System Power Supply" + }, + { + 0x7E, + L" Inactive" + }, + { + 0x7F, + L" End-of-Table " + }, +}; + + +UINT8 +QueryTable ( + IN TABLE_ITEM *Table, + IN UINTN Number, + IN UINT8 Key, + IN OUT CHAR16 *Info + ) +/*++ +Routine Description: + Function Description + Given a table and a Key, return the responding info. + + Arguments: + Table - The begin address of table + Number - The number of table items + Key - The query Key + Info - Input as empty buffer; output as data buffer. + + Returns: + if Key found - return found Key and Info + if Key unfound - return QUERY_TABLE_UNFOUND, Info=NULL + + Notes: + Table[Index].Key is change from UINT8 to UINT16, + in order to deal with "0xaa - 0xbb". + + For example: + DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option) + has a item: + "0x07-0x7F, Unused" + Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07. + Then all the Key Value between Low and High gets the same string + L"Unused". + +**/ +{ + UINTN Index; + // + // High byte and Low byte of word + // + UINT8 High; + UINT8 Low; + + for (Index = 0; Index < Number; Index++) { + High = (UINT8) (Table[Index].Key >> 8); + Low = (UINT8) (Table[Index].Key & 0x00FF); + // + // Check if Key is in the range + // + if (High > Low && Key >= Low && Key <= High) { + StrCpy (Info, Table[Index].Info); + StrCat (Info, L"\n"); + return Key; + } + // + // Check if Key == Value in the table + // + if (Table[Index].Key == Key) { + StrCpy (Info, Table[Index].Info); + StrCat (Info, L"\n"); + return Key; + } + } + + StrCpy (Info, L"Undefined Value\n"); + return QUERY_TABLE_UNFOUND; +} + +VOID +PrintBitsInfo ( + IN TABLE_ITEM *Table, + IN UINTN Number, + IN UINT32 Bits + ) +/*++ + + Routine Description: + Given a table of bit info and a Key, + return the responding info to the Key. + + Arguments: + Table - Point to a table which maintains a map of 'bit' to 'message' + Number - Number of table items. + Bits - The Key of query the bit map information. + + Returns: + None + +**/ +{ + // + // Get certain bit of 'Value': + // +#define BIT(Value, bit) ((Value) & ((UINT32) 1) << (bit)) + // + // Clear certain bit of 'Value': + // +#define CLR_BIT(Value, bit) ((Value) -= (BIT (Value, bit))) + + UINTN Index; + UINT32 Value; + BOOLEAN NoInfo; + + NoInfo = TRUE; + Value = Bits; + // + // query the table and print information + // + for (Index = 0; Index < Number; Index++) { + if (BIT (Value, Table[Index].Key) != 0) { + Print (Table[Index].Info); + Print (L" | "); + + NoInfo = FALSE; + // + // clear the bit, for reserved bits test + // + CLR_BIT (Value, Table[Index].Key); + } + } + + if (NoInfo) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_NO_INFO), gShellDebug1HiiHandle); + } + + if (Value != 0) { + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_BITS_SET), + gShellDebug1HiiHandle, + Value + ); + } + + Print (L"\n"); +} +// +// ////////////////////////////////////////////////////////////////// +// +// Following uses QueryTable functions to simplify the coding. +// QueryTable(), PrintBitsInfo() +// +// +#define PRINT_TABLE_ITEM(Table, Key) \ + do { \ + UINTN Num; \ + CHAR16 Info[66]; \ + Num = sizeof (Table) / sizeof (TABLE_ITEM); \ + ZeroMem (Info, sizeof (Info)); \ + QueryTable (Table, Num, Key, Info); \ + Print (Info); \ + } while (0); + +#define PRINT_BITS_INFO(Table, bits) \ + do { \ + UINTN Num; \ + Num = sizeof (Table) / sizeof (TABLE_ITEM); \ + PrintBitsInfo (Table, Num, (UINT32) bits); \ + } while (0); + +// +//////////////////////////////////////////////////////////////////// +// +// System Information (Type 1) +// +VOID +DisplaySystemWakeupType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_WAKEUP_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (SystemWakeupTypeTable, Type); +} +// +// System Enclosure (Type 3) +// +VOID +DisplaySystemEnclosureType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + // + // query table and print info + // + PRINT_TABLE_ITEM (SystemEnclosureTypeTable, Type); + + if (BIT (Type, 7) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CHASSIS_LOCK_PRESENT), gShellDebug1HiiHandle); + } +} + +VOID +DisplaySystemEnclosureStatus ( + UINT8 Status, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_STATUS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + PRINT_TABLE_ITEM (SystemEnclosureStatusTable, Status); +} + +VOID +DisplaySESecurityStatus ( + UINT8 Status, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_SECURITY), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + PRINT_TABLE_ITEM (SESecurityStatusTable, Status); +} +// +// Processor Information (Type 4) +// +VOID +DisplayProcessorType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (ProcessorTypeTable, Type); +} + +VOID +DisplayProcessorUpgrade ( + UINT8 Upgrade, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_UPDATE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Upgrade, Option); + PRINT_TABLE_ITEM (ProcessorUpgradeTable, Upgrade); +} +// +// Memory Controller Information (Type 5) +// +VOID +DisplayMcErrorDetectMethod ( + UINT8 Method, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DETECTMETHOD), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Method, Option); + PRINT_TABLE_ITEM (McErrorDetectMethodTable, Method); +} + +VOID +DisplayMcErrorCorrectCapability ( + UINT8 Capability, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CORRECT_CAPABILITY), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Capability, Option); + PRINT_BITS_INFO (McErrorCorrectCapabilityTable, Capability); +} + +VOID +DisplayMcInterleaveSupport ( + UINT8 Support, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_INTERLEAVE_SUPPORT), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Support, Option); + PRINT_TABLE_ITEM (McInterleaveSupportTable, Support); +} + +VOID +DisplayMcMemorySpeeds ( + UINT16 Speed, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MEMORY_SPEED), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Speed, Option); + PRINT_BITS_INFO (McMemorySpeedsTable, Speed); +} + +VOID +DisplayMemoryModuleVoltage ( + UINT8 Voltage, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_REQUIRED_VOLTAGES), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Voltage, Option); + PRINT_BITS_INFO (MemoryModuleVoltageTable, Voltage); +} +// +// Memory Module Information (Type 6) +// +VOID +DisplayMmMemoryType ( + UINT16 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_BITS_INFO (MmMemoryTypeTable, Type); +} + +VOID +DisplayMmErrorStatus ( + UINT8 Status, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_ERROR_STATUS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + PRINT_BITS_INFO (MmErrorStatusTable, Status); +} +// +// Cache Information (Type 7) +// +VOID +DisplayCacheSRAMType ( + UINT16 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SRAM_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION ((UINT8) Type, Option); + PRINT_BITS_INFO (CacheSRAMTypeTable, (UINT8) Type); +} + +VOID +DisplayCacheErrCorrectingType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ERROR_CORRECTING), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (CacheErrCorrectingTypeTable, Type); +} + +VOID +DisplayCacheSystemCacheType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SYSTEM_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (CacheSystemCacheTypeTable, Type); +} + +VOID +DisplayCacheAssociativity ( + UINT8 Associativity, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ASSOCIATIVITY), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Associativity, Option); + PRINT_TABLE_ITEM (CacheAssociativityTable, Associativity); +} +// +// Port Connector Information (Type 8) +// +VOID +DisplayPortConnectorType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_CONNECTOR_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (PortConnectorTypeTable, Type); +} + +VOID +DisplayPortType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (PortTypeTable, Type); +} +// +// System Slots (Type 9) +// +VOID +DisplaySystemSlotType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (SystemSlotTypeTable, Type); +} + +VOID +DisplaySystemSlotDataBusWidth ( + UINT8 Width, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_DATA), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Width, Option); + PRINT_TABLE_ITEM (SystemSlotDataBusWidthTable, Width); +} + +VOID +DisplaySystemSlotCurrentUsage ( + UINT8 Usage, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_CURRENT_USAGE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Usage, Option); + PRINT_TABLE_ITEM (SystemSlotCurrentUsageTable, Usage); +} + +VOID +DisplaySystemSlotLength ( + UINT8 Length, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_LENGTH), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Length, Option); + PRINT_TABLE_ITEM (SystemSlotLengthTable, Length); +} + +VOID +DisplaySlotCharacteristics1 ( + UINT8 Chara1, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Chara1, Option); + PRINT_BITS_INFO (SlotCharacteristics1Table, Chara1); +} + +VOID +DisplaySlotCharacteristics2 ( + UINT8 Chara2, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS_2), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Chara2, Option); + PRINT_BITS_INFO (SlotCharacteristics2Table, Chara2); +} +// +// On Board Devices Information (Type 10) +// +VOID +DisplayOnboardDeviceTypes ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ONBOARD_DEVICE_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (OnboardDeviceTypesTable, Type); +} +// +// System Event Log (Type 15) +// +VOID +DisplaySELTypes ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_EVENT_LOG_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (SELTypesTable, Type); +} + +VOID +DisplaySELVarDataFormatType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_EVENT_LOG_VAR_DATA_FORMAT), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (SELVarDataFormatTypeTable, Type); +} + +VOID +DisplayPostResultsBitmapDw1 ( + UINT32 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_BITMAP), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_BITS_INFO (PostResultsBitmapDw1Table, Key); +} + +VOID +DisplayPostResultsBitmapDw2 ( + UINT32 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_SECOND_DWORD), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_BITS_INFO (PostResultsBitmapDw2Table, Key); +} + +VOID +DisplaySELSysManagementTypes ( + UINT32 SMType, + UINT8 Option + ) +{ + UINT8 Temp; + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_TYPES), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (SMType, Option); + + // + // Deal with wide range Value + // + if (SMType >= 0x80000000) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_OEM_ASSIGNED), gShellDebug1HiiHandle); + } else if (SMType >= 0x00020000) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle); + } else if (SMType >= 0x00010000) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_PROBE), gShellDebug1HiiHandle); + } else if (SMType >= 0x31) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle); + } else { + // + // Deal with One byte data + // + Temp = (UINT8) (SMType & 0x3F); + PRINT_TABLE_ITEM (SELSysManagementTypesTable, Temp); + } +} +// +// Physical Memory Array (Type 16) +// +VOID +DisplayPMALocation ( + UINT8 Location, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Location, Option); + PRINT_TABLE_ITEM (PMALocationTable, Location); +} + +VOID +DisplayPMAUse ( + UINT8 Use, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Use, Option); + PRINT_TABLE_ITEM (PMAUseTable, Use); +} + +VOID +DisplayPMAErrorCorrectionTypes ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ERROR), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (PMAErrorCorrectionTypesTable, Type); +} +// +// Memory Device (Type 17) +// +VOID +DisplayMemoryDeviceFormFactor ( + UINT8 FormFactor, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_FORM_FACTOR), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (FormFactor, Option); + PRINT_TABLE_ITEM (MemoryDeviceFormFactorTable, FormFactor); +} + +VOID +DisplayMemoryDeviceType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (MemoryDeviceTypeTable, Type); +} + +VOID +DisplayMemoryDeviceTypeDetail ( + UINT16 para, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (para, Option); + PRINT_BITS_INFO (MemoryDeviceTypeDetailTable, para); +} +// +// 32-bit Memory Error Information (Type 18) +// +VOID +DisplayMemoryErrorType ( + UINT8 ErrorType, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_INFO), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (ErrorType, Option); + PRINT_TABLE_ITEM (MemoryErrorTypeTable, ErrorType); +} + +VOID +DisplayMemoryErrorGranularity ( + UINT8 Granularity, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_GRANULARITY), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Granularity, Option); + PRINT_TABLE_ITEM (MemoryErrorGranularityTable, Granularity); +} + +VOID +DisplayMemoryErrorOperation ( + UINT8 Operation, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_OP), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Operation, Option); + PRINT_TABLE_ITEM (MemoryErrorOperationTable, Operation); +} +// +// Built-in Pointing Device (Type 21) +// +VOID +DisplayPointingDeviceType ( + UINT8 Type, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (PointingDeviceTypeTable, Type); +} + +VOID +DisplayPointingDeviceInterface ( + UINT8 Interface, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_INTERFACE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Interface, Option); + PRINT_TABLE_ITEM (PointingDeviceInterfaceTable, Interface); +} +// +// Portable Battery (Type 22) +// +VOID +DisplayPBDeviceChemistry ( + UINT8 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORTABLE_BATT_DEV_CHEM), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_TABLE_ITEM (PBDeviceChemistryTable, Key); +} +// +// Voltage Probe (Type 26) +// +VOID +DisplayVPLocation ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Loc; + + Loc = (UINT8) ((Key & 0xE0) >> 5); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Loc, Option); + PRINT_TABLE_ITEM (VPLocationTable, Loc); +} + +VOID +DisplayVPStatus ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Status; + + Status = (UINT8) (Key & 0x1F); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_STATUS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + PRINT_TABLE_ITEM (VPStatusTable, Status); +} +// +// Voltage Probe (Type 27) +// +VOID +DisplayCoolingDeviceStatus ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Status; + + Status = (UINT8) ((Key & 0xE0) >> 5); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_STATUS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + PRINT_TABLE_ITEM (CoolingDeviceStatusTable, Status); +} + +VOID +DisplayCoolingDeviceType ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Type; + + Type = (UINT8) (Key & 0x1F); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Type, Option); + PRINT_TABLE_ITEM (CoolingDeviceTypeTable, Type); +} +// +// Temperature Probe (Type 28) +// +VOID +DisplayTemperatureProbeStatus ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Status; + + Status = (UINT8) ((Key & 0xE0) >> 5); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_TEMP_PROBE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + PRINT_TABLE_ITEM (TemperatureProbeStatusTable, Status); +} + +VOID +DisplayTemperatureProbeLoc ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Loc; + + Loc = (UINT8) (Key & 0x1F); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Loc, Option); + PRINT_TABLE_ITEM (TemperatureProbeLocTable, Loc); +} +// +// Electrical Current Probe (Type 29) +// +VOID +DisplayECPStatus ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Status; + + Status = (UINT8) ((Key & 0xE0) >> 5); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_STATUS), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Status, Option); + PRINT_TABLE_ITEM (ECPStatusTable, Status); +} + +VOID +DisplayECPLoc ( + UINT8 Key, + UINT8 Option + ) +{ + UINT8 Loc; + + Loc = (UINT8) (Key & 0x1F); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_LOC), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Loc, Option); + PRINT_TABLE_ITEM (ECPLocTable, Loc); +} +// +// Management Device (Type 34) +// +VOID +DisplayMDType ( + UINT8 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_TABLE_ITEM (MDTypeTable, Key); +} + +VOID +DisplayMDAddressType ( + UINT8 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_TABLE_ITEM (MDAddressTypeTable, Key); +} +// +// Memory Channel (Type 37) +// +VOID +DisplayMemoryChannelType ( + UINT8 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CHANNEL_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_TABLE_ITEM (MemoryChannelTypeTable, Key); +} +// +// IPMI Device Information (Type 38) +// +VOID +DisplayIPMIDIBMCInterfaceType ( + UINT8 Key, + UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BMC_INTERFACE_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_TABLE_ITEM (IPMIDIBMCInterfaceTypeTable, Key); +} + +VOID +DisplayStructureTypeInfo ( + UINT8 Key, + UINT8 Option + ) +{ + // + // display + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_STRUCT_TYPE), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Key, Option); + PRINT_TABLE_ITEM (StructureTypeInfoTable, Key); +} diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h new file mode 100644 index 0000000000..adacc41cf3 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h @@ -0,0 +1,430 @@ +/** @file + Build a table, each item is (key, info) pair. + and give a interface of query a string out of a table. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _SMBIOS_QUERY_TABLE_H +#define _SMBIOS_QUERY_TABLE_H + +#define QUERY_TABLE_UNFOUND 0xFF + +typedef struct TABLE_ITEM { + UINT16 Key; + CHAR16 *Info; +} TABLE_ITEM; + +// +// Print info by option +// +#define PRINT_INFO_OPTION(Value, Option) \ + do { \ + if (Option == SHOW_NONE) { \ + return ; \ + } \ + if (Option < SHOW_DETAIL) { \ + Print (L"0x%x\n", Value); \ + return ; \ + } \ + } while (0); + +UINT8 +QueryTable ( + IN TABLE_ITEM *Table, + IN UINTN Number, + IN UINT8 Key, + IN OUT CHAR16 *Info + ); + +VOID +PrintBitsInfo ( + IN TABLE_ITEM *Table, + IN UINTN Number, + IN UINT32 Bits + ); + +// +// Display the element detail information +// +VOID +DisplayStructureTypeInfo ( + UINT8 Key, + UINT8 Option + ); + +// +// System Information (Type 1) +// +VOID +DisplaySystemWakeupType ( + UINT8 Type, + UINT8 Option + ); + +// +// System Enclosure (Type 3) +// +VOID +DisplaySystemEnclosureType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplaySystemEnclosureStatus ( + UINT8 Status, + UINT8 Option + ); +VOID +DisplaySESecurityStatus ( + UINT8 Status, + UINT8 Option + ); + +// +// Processor Information (Type 4) +// +VOID +DisplayProcessorType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplayProcessorUpgrade ( + UINT8 Upgrade, + UINT8 Option + ); + +// +// Memory Controller Information (Type 5) +// +VOID +DisplayMcErrorDetectMethod ( + UINT8 Method, + UINT8 Option + ); +VOID +DisplayMcErrorCorrectCapability ( + UINT8 Capability, + UINT8 Option + ); +VOID +DisplayMcInterleaveSupport ( + UINT8 Support, + UINT8 Option + ); +VOID +DisplayMcMemorySpeeds ( + UINT16 Speed, + UINT8 Option + ); +VOID +DisplayMemoryModuleVoltage ( + UINT8 Voltage, + UINT8 Option + ); + +// +// Memory Module Information (Type 6) +// +VOID +DisplayMmMemoryType ( + UINT16 Type, + UINT8 Option + ); +VOID +DisplayMmErrorStatus ( + UINT8 Status, + UINT8 Option + ); + +// +// Cache Information (Type 7) +// +VOID +DisplayCacheSRAMType ( + UINT16 Type, + UINT8 Option + ); +VOID +DisplayCacheErrCorrectingType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplayCacheSystemCacheType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplayCacheAssociativity ( + UINT8 Associativity, + UINT8 Option + ); + +// +// Port Connector Information (Type 8) +// +VOID +DisplayPortConnectorType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplayPortType ( + UINT8 Type, + UINT8 Option + ); + +// +// System Slots (Type 9) +// +VOID +DisplaySystemSlotType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplaySystemSlotDataBusWidth ( + UINT8 Width, + UINT8 Option + ); +VOID +DisplaySystemSlotCurrentUsage ( + UINT8 Usage, + UINT8 Option + ); +VOID +DisplaySystemSlotLength ( + UINT8 Length, + UINT8 Option + ); +VOID +DisplaySlotCharacteristics1 ( + UINT8 Chara1, + UINT8 Option + ); +VOID +DisplaySlotCharacteristics2 ( + UINT8 Chara2, + UINT8 Option + ); + +// +// On Board Devices Information (Type 10) +// +VOID +DisplayOnboardDeviceTypes ( + UINT8 Type, + UINT8 Option + ); + +// +// System Event Log (Type 15) +// +VOID +DisplaySELTypes ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplaySELVarDataFormatType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplayPostResultsBitmapDw1 ( + UINT32 Key, + UINT8 Option + ); +VOID +DisplayPostResultsBitmapDw2 ( + UINT32 Key, + UINT8 Option + ); +VOID +DisplaySELSysManagementTypes ( + UINT32 SMType, + UINT8 Option + ); + +// +// Physical Memory Array (Type 16) +// +VOID +DisplayPMALocation ( + UINT8 Location, + UINT8 Option + ); +VOID +DisplayPMAUse ( + UINT8 Use, + UINT8 Option + ); +VOID +DisplayPMAErrorCorrectionTypes ( + UINT8 Type, + UINT8 Option + ); + +// +// Memory Device (Type 17) +// +VOID +DisplayMemoryDeviceFormFactor ( + UINT8 FormFactor, + UINT8 Option + ); +VOID +DisplayMemoryDeviceType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplayMemoryDeviceTypeDetail ( + UINT16 Parameter, + UINT8 Option + ); + +// +// 32-bit Memory Error Information (Type 18) +// +VOID +DisplayMemoryErrorType ( + UINT8 ErrorType, + UINT8 Option + ); +VOID +DisplayMemoryErrorGranularity ( + UINT8 Granularity, + UINT8 Option + ); +VOID +DisplayMemoryErrorOperation ( + UINT8 Operation, + UINT8 Option + ); + +// +// Memory Array Mapped Address (Type 19) +// Memory Device Mapped Address (Type 20) +// +// Built-in Pointing Device (Type 21) +// +VOID +DisplayPointingDeviceType ( + UINT8 Type, + UINT8 Option + ); +VOID +DisplayPointingDeviceInterface ( + UINT8 Interface, + UINT8 Option + ); + +// +// Portable Battery (Type 22) +// +VOID +DisplayPBDeviceChemistry ( + UINT8 Key, + UINT8 Option + ); + +// +// Voltage Probe (Type 26) +// +VOID +DisplayVPLocation ( + UINT8 Key, + UINT8 Option + ); +VOID +DisplayVPStatus ( + UINT8 Key, + UINT8 Option + ); + +// +// Voltage Probe (Type 27) +// +VOID +DisplayCoolingDeviceStatus ( + UINT8 Key, + UINT8 Option + ); +VOID +DisplayCoolingDeviceType ( + UINT8 Key, + UINT8 Option + ); + +// +// Temperature Probe (Type 28) +// +VOID +DisplayTemperatureProbeStatus ( + UINT8 Key, + UINT8 Option + ); +VOID +DisplayTemperatureProbeLoc ( + UINT8 Key, + UINT8 Option + ); + +// +// Electrical Current Probe (Type 29) +// +VOID +DisplayECPStatus ( + UINT8 Key, + UINT8 Option + ); +VOID +DisplayECPLoc ( + UINT8 Key, + UINT8 Option + ); + +// +// Management Device (Type 34) +// +VOID +DisplayMDType ( + UINT8 Key, + UINT8 Option + ); +VOID +DisplayMDAddressType ( + UINT8 Key, + UINT8 Option + ); + +// +// Memory Channel (Type 37) +// +VOID +DisplayMemoryChannelType ( + UINT8 Key, + UINT8 Option + ); + +// +// IPMI Device Information (Type 38) +// +VOID +DisplayIPMIDIBMCInterfaceType ( + UINT8 Key, + UINT8 Option + ); + +#endif diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c new file mode 100644 index 0000000000..8d21967dcc --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c @@ -0,0 +1,126 @@ +/** @file + Lib fucntions for SMBIOS. Used to get system serial number and GUID + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "../UefiShellDebug1CommandsLib.h" +#include +#include "LibSmbios.h" + +EFI_STATUS +LibGetSmbiosSystemGuidAndSerialNumber ( + IN EFI_GUID *SystemGuid, + OUT CHAR8 **SystemSerialNumber + ) +{ + EFI_STATUS Status; + SMBIOS_STRUCTURE_TABLE *SmbiosTable; + SMBIOS_STRUCTURE_POINTER Smbios; + SMBIOS_STRUCTURE_POINTER SmbiosEnd; + UINT16 Index; + + Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + Smbios.Hdr = (SMBIOS_HEADER *) ((UINTN) (SmbiosTable->TableAddress)); + + SmbiosEnd.Raw = (UINT8 *) ((UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength)); + for (Index = 0; Index < SmbiosTable->TableLength; Index++) { + if (Smbios.Hdr->Type == 1) { + if (Smbios.Hdr->Length < 0x19) { + // + // Older version did not support Guid and Serial number + // + continue; + } + // + // SMBIOS tables are byte packed so we need to do a byte copy to + // prevend alignment faults on Itanium-based platform. + // + CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof (EFI_GUID)); + *SystemSerialNumber = LibGetSmbiosString (&Smbios, Smbios.Type1->SerialNumber); + return EFI_SUCCESS; + } + // + // Make Smbios point to the next record + // + LibGetSmbiosString (&Smbios, (UINT16) (-1)); + + if (Smbios.Raw >= SmbiosEnd.Raw) { + // + // SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e. + // given this we must double check against the lenght of + // the structure. My home PC has this bug.ruthard + // + return EFI_SUCCESS; + } + } + + return EFI_SUCCESS; +} + +CHAR8 * +LibGetSmbiosString ( + IN SMBIOS_STRUCTURE_POINTER *Smbios, + IN UINT16 StringNumber + ) +/*++ +Routine Description: + Return SMBIOS string given the string number. + + Arguments: + Smbios - Pointer to SMBIOS structure + StringNumber - String number to return. -1 is used to skip all strings and + point to the next SMBIOS structure. + + Returns: + Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1 +**/ +{ + UINT16 Index; + CHAR8 *String; + + ASSERT (Smbios != NULL); + + // + // Skip over formatted section + // + String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length); + + // + // Look through unformated section + // + for (Index = 1; Index <= StringNumber; Index++) { + if (StringNumber == Index) { + return String; + } + // + // Skip string + // + for (; *String != 0; String++); + String++; + + if (*String == 0) { + // + // If double NULL then we are done. + // Retrun pointer to next structure in Smbios. + // if you pass in a -1 you will always get here + // + Smbios->Raw = (UINT8 *)++String; + return NULL; + } + } + + return NULL; +} diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c new file mode 100644 index 0000000000..b9ff013d60 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c @@ -0,0 +1,547 @@ +/** @file + Tools of clarify the content of the smbios table. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "../UefiShellDebug1CommandsLib.h" +#include "LibSmbiosView.h" +#include "smbiosview.h" +#include "PrintInfo.h" +#include "QueryTable.h" + +UINT8 gShowType = SHOW_DETAIL; +STATIC STRUCTURE_STATISTICS *mStatisticsTable = NULL; + +UINT8 SmbiosMajorVersion; +UINT8 SmbiosMinorVersion; + +STATIC CONST SHELL_PARAM_ITEM ParamList[] = { + {L"-t", TypeValue}, + {L"-h", TypeValue}, + {L"-s", TypeFlag}, + {L"-a", TypeFlag}, + {NULL, TypeMax} + }; + +SHELL_STATUS +EFIAPI +ShellCommandRunSmbiosView ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINT8 StructType; + UINT16 StructHandle; + EFI_STATUS Status; + BOOLEAN RandomView; + LIST_ENTRY *Package; + CHAR16 *ProblemParam; + SHELL_STATUS ShellStatus; + CONST CHAR16 *Temp; + + mStatisticsTable = NULL; + Package = NULL; + ShellStatus = SHELL_SUCCESS; + + Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE); + if (EFI_ERROR(Status)) { + if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam); + FreePool(ProblemParam); + ShellStatus = SHELL_INVALID_PARAMETER; + } else { + ASSERT(FALSE); + } + } else { + if (ShellCommandLineGetCount(Package) > 1) { + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle); + ShellStatus = SHELL_INVALID_PARAMETER; + } else { + + // + // Init Lib + // + Status = LibSmbiosInit (); + if (EFI_ERROR (Status)) { + ShellStatus = SHELL_NOT_FOUND; + goto Done; + } + // + // build statistics table + // + Status = InitSmbiosTableStatistics (); + if (EFI_ERROR (Status)) { + ShellStatus = SHELL_NOT_FOUND; + goto Done; + } + + StructType = STRUCTURE_TYPE_RANDOM; + RandomView = TRUE; + // + // Initialize the StructHandle to be the first handle + // + StructHandle = STRUCTURE_HANDLE_INVALID; + LibGetSmbiosStructure (&StructHandle, NULL, NULL); + + Temp = ShellCommandLineGetValue(Package, L"-t"); + if (Temp != NULL) { + StructType = (UINT8) ShellStrToUintn (Temp); + } + + Temp = ShellCommandLineGetValue(Package, L"-h"); + if (Temp != NULL) { + RandomView = FALSE; + StructHandle = (UINT16) ShellStrToUintn(Temp); + } + + if (ShellCommandLineGetFlag(Package, L"-s")) { + Status = DisplayStatisticsTable (SHOW_DETAIL); + if (EFI_ERROR(Status)) { + ShellStatus = SHELL_NOT_FOUND; + } + goto Done; + } + + if (ShellCommandLineGetFlag(Package, L"-a")) { + gShowType = SHOW_ALL; + } + // + // Show SMBIOS structure information + // + Status = SMBiosView (StructType, StructHandle, gShowType, RandomView); + if (EFI_ERROR(Status)) { + ShellStatus = SHELL_NOT_FOUND; + } + } + } +Done: + // + // Release resources + // + if (mStatisticsTable != NULL) { + // + // Release statistics table + // + FreePool (mStatisticsTable); + mStatisticsTable = NULL; + } + + if (Package != NULL) { + ShellCommandLineFreeVarList (Package); + } + + LibSmbiosCleanup (); + + return ShellStatus; +} + +/** + Query all structures Data from SMBIOS table and Display + the information to users as required display option. + + @param[in] QueryType Structure type to view. + @param[in] QueryHandle Structure handle to view. + @param[in] Option Display option: none,outline,normal,detail. + @param[in] RandomView Support for -h parameter. + + @retval EFI_SUCCESS print is successful. + @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table. +**/ +EFI_STATUS +EFIAPI +SMBiosView ( + IN UINT8 QueryType, + IN UINT16 QueryHandle, + IN UINT8 Option, + IN BOOLEAN RandomView + ) +{ + UINT16 Handle; + UINT8 Buffer[1024]; + // + // bigger than SMBIOS_STRUCTURE_TABLE.MaxStructureSize + // + UINT16 Length; + UINTN Index; + UINT16 Offset; + // + // address offset from structure table head. + // + UINT32 TableHead; + // + // structure table head. + // + + SMBIOS_STRUCTURE_POINTER pStruct; + SMBIOS_STRUCTURE_TABLE *SMBiosTable; + + SMBiosTable = NULL; + LibSmbiosGetEPS (&SMBiosTable); + if (SMBiosTable == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); + return EFI_BAD_BUFFER_SIZE; + } + + if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) == 0) { + // + // Have get SMBIOS table + // + SmbiosPrintEPSInfo (SMBiosTable, Option); + + SmbiosMajorVersion = SMBiosTable->MajorVersion; + SmbiosMinorVersion = SMBiosTable->MinorVersion; + + ShellPrintEx(-1,-1,L"=========================================================\n"); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle); + + if (QueryType == STRUCTURE_TYPE_RANDOM) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType); + } + + if (RandomView) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle); + } else { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle); + } + + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle); + ShellPrintEx(-1,-1,GetShowTypeString (gShowType)); + ShellPrintEx(-1,-1,L"\n\n"); + +/* + // + // Get internal commands, such as change options. + // + Status = WaitEnter (); + if (EFI_ERROR (Status)) { + if (Status == EFI_ABORTED) { + return EFI_SUCCESS; + } + + return Status; + } +*/ + + // + // Searching and display structure info + // + Handle = QueryHandle; + TableHead = SMBiosTable->TableAddress; + Offset = 0; + for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) { + // + // if reach the end of table, break.. + // + if (Handle == STRUCTURE_HANDLE_INVALID) { + break; + } + // + // handle then point to the next! + // + if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) { + break; + } + Offset = (UINT16) (Offset + Length); + pStruct.Raw = Buffer; + + // + // if QueryType==Random, print this structure. + // if QueryType!=Random, but Hdr->Type==QueryType, also print it. + // only if QueryType != Random and Hdr->Type != QueryType, skiped it. + // + if (QueryType != STRUCTURE_TYPE_RANDOM && pStruct.Hdr->Type != QueryType) { + continue; + } + + ShellPrintEx(-1,-1,L"\n=========================================================\n"); + ShellPrintHiiEx(-1,-1,NULL, + STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT), + gShellDebug1HiiHandle, + pStruct.Hdr->Type, + pStruct.Hdr->Handle + ); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length); + // + // Addr of structure in structure in table + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, TableHead + Offset); + DumpHex (0, 0, Length, Buffer); + +/* + // + // Get internal commands, such as change options. + // + Status = WaitEnter (); + if (EFI_ERROR (Status)) { + if (Status == EFI_ABORTED) { + return EFI_SUCCESS; + } + + return Status; + } +*/ + + if (gShowType != SHOW_NONE) { + // + // check structure legality + // + SmbiosCheckStructure (&pStruct); + + // + // Print structure information + // + SmbiosPrintStructure (&pStruct, gShowType); + ShellPrintEx(-1,-1,L"\n"); + +/* + // + // Get internal commands, such as change options. + // + Status = WaitEnter (); + if (EFI_ERROR (Status)) { + if (Status == EFI_ABORTED) { + return EFI_SUCCESS; + } + + return Status; + } +*/ + } + if (!RandomView) { + break; + } + } + + ShellPrintEx(-1,-1,L"\n=========================================================\n"); + return EFI_SUCCESS; + } + + return EFI_BAD_BUFFER_SIZE; +} + +/** + Function to initialize the global mStatisticsTable object. + + @retval EFI_SUCCESS print is successful. +**/ +EFI_STATUS +EFIAPI +InitSmbiosTableStatistics ( + VOID + ) +{ + UINT16 Handle; + UINT8 Buffer[1024]; + UINT16 Length; + UINT16 Offset; + UINT16 Index; + + SMBIOS_STRUCTURE_POINTER pStruct; + SMBIOS_STRUCTURE_TABLE *SMBiosTable; + STRUCTURE_STATISTICS *pStatistics; + + SMBiosTable = NULL; + LibSmbiosGetEPS (&SMBiosTable); + if (SMBiosTable == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); + return EFI_NOT_FOUND; + } + + if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle); + return EFI_INVALID_PARAMETER; + } + // + // Allocate memory to mStatisticsTable + // + if (mStatisticsTable != NULL) { + FreePool (mStatisticsTable); + mStatisticsTable = NULL; + } + + mStatisticsTable = (STRUCTURE_STATISTICS *) AllocatePool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS)); + + if (mStatisticsTable == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle); + return EFI_OUT_OF_RESOURCES; + } + + Offset = 0; + pStatistics = mStatisticsTable; + + // + // search from the first one + // + Handle = STRUCTURE_HANDLE_INVALID; + LibGetSmbiosStructure (&Handle, NULL, NULL); + for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) { + // + // If reach the end of table, break.. + // + if (Handle == STRUCTURE_HANDLE_INVALID) { + break; + } + // + // After LibGetSmbiosStructure(), handle then point to the next! + // + if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) { + break; + } + + pStruct.Raw = Buffer; + Offset = (UINT16) (Offset + Length); + + // + // general statistics + // + pStatistics->Index = Index; + pStatistics->Type = pStruct.Hdr->Type; + pStatistics->Handle = pStruct.Hdr->Handle; + pStatistics->Length = Length; + pStatistics->Addr = Offset; + + pStatistics = &mStatisticsTable[Index]; + } + + return EFI_SUCCESS; +} + +/** + Function to display the global mStatisticsTable object. + + @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed. + + @retval EFI_SUCCESS print is successful. +**/ +EFI_STATUS +EFIAPI +DisplayStatisticsTable ( + IN UINT8 Option + ) +{ + UINTN Index; + UINTN Num; + STRUCTURE_STATISTICS *pStatistics; + SMBIOS_STRUCTURE_TABLE *SMBiosTable; + + SMBiosTable = NULL; + if (Option < SHOW_OUTLINE) { + return EFI_SUCCESS; + } + // + // display EPS information firstly + // + LibSmbiosGetEPS (&SMBiosTable); + if (SMBiosTable == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle); + return EFI_UNSUPPORTED; + } + + ShellPrintEx(-1,-1,L"\n============================================================\n"); + SmbiosPrintEPSInfo (SMBiosTable, Option); + + if (Option < SHOW_NORMAL) { + return EFI_SUCCESS; + } + + if (mStatisticsTable == NULL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle); + return EFI_NOT_FOUND; + } + + ShellPrintEx(-1,-1,L"============================================================\n"); + pStatistics = &mStatisticsTable[0]; + Num = SMBiosTable->NumberOfSmbiosStructures; + // + // display statistics table content + // + for (Index = 1; Index <= Num; Index++) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, pStatistics->Index); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, pStatistics->Type); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, pStatistics->Handle); + if (Option >= SHOW_DETAIL) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, pStatistics->Addr); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, pStatistics->Length); + } + + ShellPrintEx(-1,-1,L"\n"); + pStatistics = &mStatisticsTable[Index]; +/* + // + // Display 20 lines and wait for a page break + // + if (Index % 20 == 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle); + Status = WaitEnter (); + if (EFI_ERROR (Status)) { + if (Status == EFI_ABORTED) { + return EFI_SUCCESS; + } + + return Status; + } + } +*/ + } + + return EFI_SUCCESS; +} + +/** + function to return a string of the detail level. + + @param[in] ShowType The detail level whose name is desired in clear text. + + @return A pointer to a string representing the ShowType (or 'undefined type' if not known). +**/ +CHAR16 * +EFIAPI +GetShowTypeString ( + UINT8 ShowType + ) +{ + // + // show type + // + switch (ShowType) { + + case SHOW_NONE: + return L"SHOW_NONE"; + + case SHOW_OUTLINE: + return L"SHOW_OUTLINE"; + + case SHOW_NORMAL: + return L"SHOW_NORMAL"; + + case SHOW_DETAIL: + return L"SHOW_DETAIL"; + + case SHOW_ALL: + return L"SHOW_ALL"; + + default: + return L"Undefined type"; + } +} + +/* +EFI_STATUS +InitializeSmbiosViewApplicationGetLineHelp ( + OUT CHAR16 **Str + ) +{ + return LibCmdGetStringByToken (STRING_ARRAY_NAME, &EfiSmbiosViewGuid, STRING_TOKEN (STR_SMBIOSVIEW_LINE_HELP), Str); +} +*/ diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni new file mode 100644 index 0000000000..94f95bd176 Binary files /dev/null and b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni differ diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/smbiosview.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/smbiosview.h new file mode 100644 index 0000000000..3d532b4ab1 --- /dev/null +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/smbiosview.h @@ -0,0 +1,91 @@ +/** @file + Tools of clarify the content of the smbios table. + + Copyright (c) 2005 - 2010, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _SMBIOS_VIEW_H +#define _SMBIOS_VIEW_H + +#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE +#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF + +#define STRUCTURE_HANDLE_INVALID (UINT16) 0xFFFF + +typedef struct { + UINT16 Index; + UINT8 Type; + UINT16 Handle; + UINT16 Addr; // offset from table head + UINT16 Length; // total structure length +} STRUCTURE_STATISTICS; + +/** + Query all structures Data from SMBIOS table and Display + the information to users as required display option. + + @param[in] QueryType Structure type to view. + @param[in] QueryHandle Structure handle to view. + @param[in] Option Display option: none,outline,normal,detail. + @param[in] RandomView Support for -h parameter. + + @retval EFI_SUCCESS print is successful. + @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table. +**/ +EFI_STATUS +EFIAPI +SMBiosView ( + IN UINT8 QueryType, + IN UINT16 QueryHandle, + IN UINT8 Option, + IN BOOLEAN RandomView + ); + +/** + Function to initialize the global mStatisticsTable object. + + @retval EFI_SUCCESS print is successful. +**/ +EFI_STATUS +EFIAPI +InitSmbiosTableStatistics ( + VOID + ); + +/** + Function to display the global mStatisticsTable object. + + @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed. + + @retval EFI_SUCCESS print is successful. +**/ +EFI_STATUS +EFIAPI +DisplayStatisticsTable ( + IN UINT8 Option + ); + +/** + function to return a string of the detail level. + + @param[in] ShowType The detail level whose name is desired in clear text. + + @return A pointer to a string representing the ShowType (or 'undefined type' if not known). +**/ +CHAR16* +EFIAPI +GetShowTypeString ( + UINT8 ShowType + ); + +extern UINT8 gShowType; + +#endif -- cgit v1.2.3