2 Build a table, each item is (Key, Info) pair.
3 And give a interface of query a string out of a table.
5 Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
6 (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "UefiShellDebug1CommandsLib.h"
18 #include "QueryTable.h"
19 #include "PrintInfo.h"
21 TABLE_ITEM SystemWakeupTypeTable
[] = {
56 TABLE_ITEM BaseBoardFeatureFlagsTable
[] = {
63 L
" Requires at least one daughter board or auxiliary card"
79 TABLE_ITEM BaseBoardBoardTypeTable
[] = {
94 L
" Connectivity Switch"
98 L
" System Management Module"
122 L
" Processor/Memory Module"
126 L
" Processor/IO Module"
130 L
" Interconnect Board"
134 TABLE_ITEM SystemEnclosureTypeTable
[] = {
149 L
" Low Profile Desktop"
197 L
" Main Server Chassis"
201 L
" Expansion Chassis"
213 L
" Bus Expansion Chassis"
217 L
" Peripheral Chassis"
225 L
" Rack Mount Chassis"
233 L
" Multi-system Chassis"
281 TABLE_ITEM SystemEnclosureStatusTable
[] = {
308 TABLE_ITEM SESecurityStatusTable
[] = {
323 L
" External interface locked out"
327 L
" External interface enabled"
331 TABLE_ITEM ProcessorTypeTable
[] = {
342 L
" Central Processor"
358 TABLE_ITEM ProcessorUpgradeTable
[] = {
377 L
"Replaceable Piggy Back"
585 TABLE_ITEM ProcessorCharacteristicsTable
[] = {
604 L
" Execute Protection"
608 L
" Enhanced Virtualization"
612 L
" Power/Performance Control"
617 TABLE_ITEM McErrorDetectMethodTable
[] = {
652 TABLE_ITEM McErrorCorrectCapabilityTable
[] = {
667 L
"Single Bit Error Correcting"
671 L
"Double Bit Error Correcting"
679 TABLE_ITEM McInterleaveSupportTable
[] = {
690 L
"One Way Interleave"
694 L
"Two Way Interleave"
698 L
"Four Way Interleave"
702 L
"Eight Way Interleave"
706 L
"Sixteen Way Interleave"
710 TABLE_ITEM McMemorySpeedsTable
[] = {
733 TABLE_ITEM MemoryModuleVoltageTable
[] = {
748 TABLE_ITEM MmMemoryTypeTable
[] = {
795 TABLE_ITEM MmErrorStatusTable
[] = {
798 L
" Uncorrectable errors received"
802 L
" Correctable errors received"
806 L
" Error Status obtained from the event log"
810 TABLE_ITEM CacheSRAMTypeTable
[] = {
841 TABLE_ITEM CacheErrCorrectingTypeTable
[] = {
868 TABLE_ITEM CacheSystemCacheTypeTable
[] = {
891 TABLE_ITEM CacheAssociativityTable
[] = {
906 L
"2-way Set-Associative"
910 L
"4-way Set-Associative"
918 L
"8-way Set-Associative"
922 L
"16-way Set-Associative"
926 L
"12-way Set-Associative"
930 L
"24-way Set-Associative"
934 L
"32-way Set-Associative"
938 L
"48-way Set-Associative"
942 L
"64-way Set-Associative"
946 L
"20-way Set-Associative"
950 TABLE_ITEM PortConnectorTypeTable
[] = {
1033 L
"Circular DIN-8 male"
1037 L
"Circular DIN-8 female"
1049 L
"9 Pin Dual Inline (pin 10 cut)"
1053 L
"25 Pin Dual Inline (pin 26 cut)"
1057 L
"50 Pin Dual Inline"
1061 L
"68 Pin Dual Inline"
1065 L
"On Board Sound Input from CD-ROM"
1069 L
"Mini-Centronics Type-14"
1073 L
"Mini-Centronics Type-26"
1077 L
"Mini-jack (headphones)"
1089 L
"SAS/SATA Plug Receptacle"
1117 TABLE_ITEM PortTypeTable
[] = {
1124 L
"Parallel Port XT/AT Compatible"
1128 L
"Parallel Port PS/2"
1132 L
"Parallel Port ECP"
1136 L
"Parallel Port EPP"
1140 L
"Parallel Port ECP/EPP"
1144 L
"Serial Port XT/AT Compatible"
1148 L
"Serial Port 16450 Compatible"
1152 L
"Serial Port 16550 Compatible"
1156 L
"Serial Port 16550A Compatible"
1188 L
"FireWire (IEEE P1394)"
1260 L
"8251 FIFO Compatible"
1268 TABLE_ITEM SystemSlotTypeTable
[] = {
1307 L
"Processor Card Slot"
1311 L
"Proprietary Memory Card Slot"
1315 L
"I/O Riser Card Slot"
1323 L
"PCI - 66MHz Capable"
1347 L
"M.2 Socket 1-DP (Mechanical Key A)"
1351 L
"M.2 Socket 1-SD (Mechanical Key E)"
1355 L
"M.2 Socket 2 (Mechanical Key B)"
1359 L
"M.2 Socket 3 (Mechanical Key M)"
1371 L
"MXM Type III (standard connector)"
1375 L
"MXM Type III (HE connector)"
1391 L
"PCI Express Gen 2 SFF-8639"
1395 L
"PCI Express Gen 3 SFF-8639"
1399 L
"PCI Express Mini 52-pin (CEM spec. 2.0) with bottom-side keep-outs"
1403 L
"PCI Express Mini 52-pin (CEM spec. 2.0) without bottom-side keep-outs"
1407 L
"PCI Express Mini 76-pin (CEM spec. 2.0) Corresponds to Display-Mini card"
1455 L
"PCI Express Gen 2"
1459 L
"PCI Express Gen 2 X1"
1463 L
"PCI Express Gen 2 X2"
1467 L
"PCI Express Gen 2 X4"
1471 L
"PCI Express Gen 2 X8"
1475 L
"PCI Express Gen 2 X16"
1479 L
"PCI Express Gen 3"
1483 L
"PCI Express Gen 3 X1"
1487 L
"PCI Express Gen 3 X2"
1491 L
"PCI Express Gen 3 X4"
1495 L
"PCI Express Gen 3 X8"
1499 L
"PCI Express Gen 3 X16"
1503 TABLE_ITEM SystemSlotDataBusWidthTable
[] = {
1562 TABLE_ITEM SystemSlotCurrentUsageTable
[] = {
1581 TABLE_ITEM SystemSlotLengthTable
[] = {
1600 TABLE_ITEM SlotCharacteristics1Table
[] = {
1603 L
" Characteristics Unknown"
1607 L
" Provides 5.0 Volts"
1611 L
" Provides 3.3 Volts"
1615 L
" Slot's opening is shared with another slot, e.g. PCI/EISA shared slot."
1620 L
" PC Card slot supports PC Card-16"
1624 L
" PC Card slot supports CardBus"
1628 L
" PC Card slot supports Zoom Video "
1632 L
" PC Card slot supports Modem Ring Resume "
1636 TABLE_ITEM SlotCharacteristics2Table
[] = {
1639 L
" PCI slot supports Power Management Enable (PME#) signal"
1643 L
" Slot supports hot-plug devices"
1647 L
" PCI slot supports SMBus signal"
1651 TABLE_ITEM OnboardDeviceTypesTable
[] = {
1694 TABLE_ITEM SELTypesTable
[] = {
1701 L
" Single-bit ECC memory error"
1705 L
" Multi-bit ECC memory error"
1709 L
" Parity memory error"
1717 L
" I/O Channel Check"
1725 L
" POST Memory Resize"
1733 L
" PCI Parity Error"
1737 L
" PCI System Error"
1745 L
" EISA FailSafe Timer time-out"
1749 L
" Correctable memory log disabled"
1753 L
" Logging disabled for a specific Event Type"
1761 L
" System Limit Exceeded"
1765 L
" Asynchronous hardware timer expired and issued a system reset"
1769 L
" System configuration information"
1773 L
" Hard-disk information"
1777 L
" System reconfigured"
1781 L
" Uncorrectable CPU-complex error"
1785 L
" Log Area Reset/Cleared"
1793 L
" Unused by SMBIOS specification"
1797 L
" System and OEM specified"
1805 TABLE_ITEM SELVarDataFormatTypeTable
[] = {
1820 L
" Multiple-Event Handle "
1824 L
" POST Results Bitmap "
1831 L
" System Management Type"
1838 L
" Multiple-Event System Management Type "
1850 TABLE_ITEM PostResultsBitmapDw1Table
[] = {
1853 L
" Channel 2 Timer error "
1857 L
" Master PIC (8259 #1) error "
1861 L
" Slave PIC (8259 #2) error "
1865 L
" CMOS Battery Failure "
1869 L
" CMOS System Options Not Set "
1873 L
" CMOS Checksum Error "
1877 L
" CMOS Configuration Error "
1881 L
" Mouse and Keyboard Swapped "
1885 L
" Keyboard Locked "
1889 L
" Keyboard Not Functional "
1893 L
" Keyboard Controller Not Functional "
1897 L
" CMOS Memory Size Different "
1901 L
" Memory Decreased in Size "
1905 L
" Cache Memory Error "
1909 L
" Floppy Drive 0 Error "
1913 L
" Floppy Drive 1 Error "
1917 L
" Floppy Controller Failure "
1921 L
" Number of ATA Drives Reduced Error "
1925 L
" CMOS Time Not Set "
1929 L
" DDC Monitor Configuration Change "
1933 L
" Reserved, set to 0 "
1937 L
" Reserved, set to 0 "
1941 L
" Reserved, set to 0 "
1945 L
" Reserved, set to 0 "
1949 L
" Second DWORD has valid data "
1953 L
" Reserved, set to 0 "
1957 L
" Reserved, set to 0 "
1961 L
" Reserved, set to 0 "
1965 L
" Normally 0; available for OEM assignment "
1969 L
" Normally 0; available for OEM assignment "
1973 L
" Normally 0; available for OEM assignment "
1977 L
" Normally 0; available for OEM assignment "
1981 TABLE_ITEM PostResultsBitmapDw2Table
[] = {
1984 L
" Normally 0; available for OEM assignment "
1988 L
" Normally 0; available for OEM assignment "
1992 L
" Normally 0; available for OEM assignment "
1996 L
" Normally 0; available for OEM assignment "
2000 L
" Normally 0; available for OEM assignment "
2004 L
" Normally 0; available for OEM assignment "
2008 L
" Normally 0; available for OEM assignment "
2012 L
" PCI Memory Conflict "
2016 L
" PCI I/O Conflict "
2020 L
" PCI IRQ Conflict "
2024 L
" PNP Memory Conflict "
2028 L
" PNP 32 bit Memory Conflict "
2032 L
" PNP I/O Conflict "
2036 L
" PNP IRQ Conflict "
2040 L
" PNP DMA Conflict "
2044 L
" Bad PNP Serial ID Checksum "
2048 L
" Bad PNP Resource Data Checksum "
2052 L
" Static Resource Conflict "
2056 L
" NVRAM Checksum Error, NVRAM Cleared "
2060 L
" System Board Device Resource Conflict "
2064 L
" Primary Output Device Not Found "
2068 L
" Primary Input Device Not Found "
2072 L
" Primary Boot Device Not Found "
2076 L
" NVRAM Cleared By Jumper "
2080 L
" NVRAM Data Invalid, NVRAM Cleared "
2084 L
" FDC Resource Conflict "
2088 L
" Primary ATA Controller Resource Conflict "
2092 L
" Secondary ATA Controller Resource Conflict "
2096 L
" Parallel Port Resource Conflict "
2100 L
" Serial Port 1 Resource Conflict "
2104 L
" Serial Port 2 Resource Conflict "
2108 L
" Audio Resource Conflict "
2112 TABLE_ITEM SELSysManagementTypesTable
[] = {
2115 L
" +2.5V Out of range, #2 "
2119 L
" +3.3V Out of range "
2123 L
" +5V Out of range "
2127 L
" -5V Out of range "
2131 L
" +12V Out of range "
2135 L
" -12V Out of range "
2139 L
" Reserved for future out-of-range voltage levels "
2143 L
" System board temperature out of range "
2147 L
" Processor #1 temperature out of range "
2151 L
" Processor #2 temperature out of range "
2155 L
" Processor #3 temperature out of range "
2159 L
" Processor #4 temperature out of range "
2163 L
" Reserved for future out-of-range temperatures"
2167 L
" Fan n (n = 0 to 7) Out of range "
2171 L
" Reserved for future assignment via this specification "
2175 L
" Chassis secure switch activated "
2179 TABLE_ITEM PMALocationTable
[] = {
2190 L
" System board or motherboard"
2198 L
" EISA add-on card"
2210 L
" PCMCIA add-on card"
2214 L
" Proprietary add-on card"
2222 L
" PC-98/C20 add-on card"
2226 L
" PC-98/C24 add-on card"
2230 L
" PC-98/E add-on card"
2234 L
" PC-98/Local bus add-on card"
2238 TABLE_ITEM PMAUseTable
[] = {
2261 L
" Non-volatile RAM"
2269 TABLE_ITEM PMAErrorCorrectionTypesTable
[] = {
2300 TABLE_ITEM MemoryDeviceFormFactorTable
[] = {
2331 L
" Proprietary Card"
2363 TABLE_ITEM MemoryDeviceTypeTable
[] = {
2474 TABLE_ITEM MemoryDeviceTypeDetailTable
[] = {
2525 L
" Registered(Buffered)"
2529 L
" Unbuffered(Unregistered)"
2533 TABLE_ITEM MemoryErrorTypeTable
[] = {
2556 L
" Single-bit error"
2560 L
" Double-bit error"
2580 L
" Corrected single-bit error"
2588 L
" Uncorrectable error"
2592 TABLE_ITEM MemoryErrorGranularityTable
[] = {
2607 L
" Memory partition level"
2611 TABLE_ITEM MemoryErrorOperationTable
[] = {
2634 TABLE_ITEM PointingDeviceTypeTable
[] = {
2665 TABLE_ITEM PointingDeviceInterfaceTable
[] = {
2696 L
" ADB(Apple Desktop Bus"
2704 L
" Bus mouse mirco-DIN"
2712 TABLE_ITEM PBDeviceChemistryTable
[] = {
2731 L
" Nickel metal hydride "
2743 L
" Lithium Polymer "
2747 TABLE_ITEM VPLocationTable
[] = {
2770 L
" Non-recoverable "
2774 TABLE_ITEM VPStatusTable
[] = {
2797 L
" System Management Module "
2809 L
" Processor Module "
2821 TABLE_ITEM CoolingDeviceStatusTable
[] = {
2844 L
" Non-recoverable "
2848 TABLE_ITEM CoolingDeviceTypeTable
[] = {
2863 L
" Centrifugal Blower "
2875 L
" Power Supply Fan "
2883 L
" Integrated Refrigeration "
2891 L
" Passive Cooling "
2895 TABLE_ITEM TemperatureProbeStatusTable
[] = {
2918 L
" Non-recoverable "
2922 TABLE_ITEM TemperatureProbeLocTable
[] = {
2945 L
" System Management Module "
2957 L
" Processor Module "
2969 TABLE_ITEM ECPStatusTable
[] = {
2992 L
" Non-recoverable "
2996 TABLE_ITEM ECPLocTable
[] = {
3019 L
" System Management Module "
3031 L
" Processor Module "
3043 TABLE_ITEM MDTypeTable
[] = {
3054 L
" National Semiconductor LM75 "
3058 L
" National Semiconductor LM78 "
3062 L
" National Semiconductor LM79 "
3066 L
" National Semiconductor LM80 "
3070 L
" National Semiconductor LM81 "
3074 L
" Analog Devices ADM9240 "
3078 L
" Dallas Semiconductor DS1780 "
3086 L
" Genesys GL518SM "
3090 L
" Winbond W83781D "
3094 L
" Holtek HT82H791 "
3098 TABLE_ITEM MDAddressTypeTable
[] = {
3121 TABLE_ITEM MemoryChannelTypeTable
[] = {
3140 TABLE_ITEM IPMIDIBMCInterfaceTypeTable
[] = {
3147 L
" KCS: Keyboard Controller Style "
3151 L
" SMIC: Server Management Interface Chip "
3155 L
" BT: Block Transfer "
3159 L
" Reserved for future assignment by this specification "
3163 TABLE_ITEM MCHostInterfaceTypeTable
[] = {
3166 L
" MCTP Host Interface "
3170 L
" Network Host Interface "
3179 TABLE_ITEM StructureTypeInfoTable
[] = {
3182 L
" BIOS Information"
3186 L
" System Information"
3190 L
" Base Board Information"
3194 L
" System Enclosure"
3198 L
" Processor Information"
3202 L
" Memory Controller Information "
3206 L
" Memory Module Information "
3210 L
" Cache Information "
3214 L
" Port Connector Information "
3222 L
" On Board Devices Information "
3230 L
" System Configuration Options "
3234 L
" BIOS Language Information "
3238 L
" Group Associations "
3242 L
" System Event Log "
3246 L
" Physical Memory Array "
3254 L
" 32-bit Memory Error Information "
3258 L
" Memory Array Mapped Address "
3262 L
" Memory Device Mapped Address "
3266 L
" Built-in Pointing Device "
3270 L
" Portable Battery "
3278 L
" Hardware Security "
3282 L
" System Power Controls "
3294 L
" Temperature Probe "
3298 L
" Electrical Current Probe "
3302 L
" Out-of-Band Remote Access "
3306 L
" Boot Integrity Services (BIS) Entry Point"
3310 L
" System Boot Information "
3314 L
" 64-bit Memory Error Information "
3318 L
" Management Device "
3322 L
" Management Device Component "
3326 L
" Management Device Threshold Data "
3334 L
" IPMI Device Information "
3338 L
" System Power Supply"
3342 L
" Additional Information"
3346 L
" Onboard Devices Extended Information"
3350 L
" Management Controller Host Interface"
3368 Given a table and a Key, return the responding info.
3371 Table[Index].Key is change from UINT8 to UINT16,
3372 in order to deal with "0xaa - 0xbb".
3375 DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option)
3378 Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07.
3379 Then all the Key Value between Low and High gets the same string
3382 @param[in] Table The begin address of table.
3383 @param[in] Number The number of table items.
3384 @param[in] Key The query Key.
3385 @param[in, out] Info Input as empty buffer; output as data buffer.
3386 @param[in] InfoLen The max number of characters for Info.
3388 @return the found Key and Info is valid.
3389 @retval QUERY_TABLE_UNFOUND and Info should be NULL.
3393 IN TABLE_ITEM
*Table
,
3396 IN OUT CHAR16
*Info
,
3402 // High byte and Low byte of word
3407 for (Index
= 0; Index
< Number
; Index
++) {
3408 High
= (UINT8
) (Table
[Index
].Key
>> 8);
3409 Low
= (UINT8
) (Table
[Index
].Key
& 0x00FF);
3412 // Check if Key is in the range
3413 // or if Key == Value in the table
3415 if ((High
> Low
&& Key
>= Low
&& Key
<= High
)
3416 || (Table
[Index
].Key
== Key
)) {
3417 StrnCpyS (Info
, InfoLen
, Table
[Index
].Info