From 7475ac5157962b570aa0d1afd0811518b729b5fd Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Mon, 27 Aug 2018 13:21:48 +0800 Subject: [PATCH] ShellPkg/SmbiosView: Update SmbiosView for SMBIOS3.2.0 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1099 Update SmbiosView to parse the new definitions which are introduced in SMBIOS3.2.0 V2: 1. Add structure length check before dump the fileds in Type 9 and Type 17 in case some fileds are not organized and reported by drivers. 2. Dump the InterfaceTypeSpecificData in Type 42. V3: 1. Correct the structure length in Type17. 2. Remove the redundant check "if (PeerGroupCount > 0)" in Type 9. 3. Use the Uint16 filed instead of Bits field in union MEMORY_DEVICE_OPERATING_MODE_CAPABILITY to dump data. Cc: Jaben Carsey Cc: Ruiyu Ni Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi Reviewed-by: Star Zeng --- .../SmbiosView/PrintInfo.c | 86 ++++++++--- .../SmbiosView/QueryTable.c | 135 +++++++++++++++++- .../SmbiosView/QueryTable.h | 26 +++- .../SmbiosView/SmbiosViewStrings.uni | 9 +- 4 files changed, 237 insertions(+), 19 deletions(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c index 93c6094df1..af8551fe2e 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c @@ -543,22 +543,45 @@ SmbiosPrintStructure ( // System Slots (Type 9) // case 9: - PRINT_PENDING_STRING (Struct, Type9, SlotDesignation); - DisplaySystemSlotType (Struct->Type9->SlotType, Option); - DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option); - DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option); - DisplaySystemSlotLength (Struct->Type9->SlotLength, Option); - DisplaySystemSlotId ( - Struct->Type9->SlotID, - Struct->Type9->SlotType, - Option - ); - DisplaySlotCharacteristics1 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics1), Option); - DisplaySlotCharacteristics2 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics2), Option); - if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) { - PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum); - PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum); - PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum); + { + MISC_SLOT_PEER_GROUP *PeerGroupPtr; + UINT8 PeerGroupCount; + + PRINT_PENDING_STRING (Struct, Type9, SlotDesignation); + DisplaySystemSlotType (Struct->Type9->SlotType, Option); + DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option); + DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option); + DisplaySystemSlotLength (Struct->Type9->SlotLength, Option); + DisplaySystemSlotId ( + Struct->Type9->SlotID, + Struct->Type9->SlotType, + Option + ); + DisplaySlotCharacteristics1 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics1), Option); + DisplaySlotCharacteristics2 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics2), Option); + if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) { + PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum); + PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum); + PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum); + } + if (AE_SMBIOS_VERSION (0x3, 0x2)) { + if (Struct->Hdr->Length > 0x11) { + PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth); + } + if (Struct->Hdr->Length > 0x12) { + PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount); + + PeerGroupCount = Struct->Type9->PeerGroupingCount; + PeerGroupPtr = Struct->Type9->PeerGroups; + for (Index = 0; Index < PeerGroupCount; Index++) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].SegmentGroupNum); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].BusNum); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, PeerGroupPtr[Index].DevFuncNum); + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, PeerGroupPtr[Index].DataBusWidth); + } + } + } } break; @@ -755,6 +778,29 @@ SmbiosPrintStructure ( PRINT_STRUCT_VALUE (Struct, Type17, MaximumVoltage); PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredVoltage); } + if (AE_SMBIOS_VERSION (0x3, 0x2)) { + if (Struct->Hdr->Length > 0x28) { + DisplayMemoryDeviceMemoryTechnology (Struct->Type17->MemoryTechnology, Option); + DisplayMemoryDeviceMemoryOperatingModeCapability (Struct->Type17->MemoryOperatingModeCapability.Uint16, Option); + PRINT_PENDING_STRING (Struct, Type17, FirwareVersion); + PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleManufacturerID); + PRINT_STRUCT_VALUE_H (Struct, Type17, ModuleProductID); + PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerManufacturerID); + PRINT_STRUCT_VALUE_H (Struct, Type17, MemorySubsystemControllerProductID); + } + if (Struct->Hdr->Length > 0x34) { + PRINT_STRUCT_VALUE_H (Struct, Type17, NonVolatileSize); + } + if (Struct->Hdr->Length > 0x3C) { + PRINT_STRUCT_VALUE_H (Struct, Type17, VolatileSize); + } + if (Struct->Hdr->Length > 0x44) { + PRINT_STRUCT_VALUE_H (Struct, Type17, CacheSize); + } + if (Struct->Hdr->Length > 0x4C) { + PRINT_STRUCT_VALUE_H (Struct, Type17, LogicalSize); + } + } break; // @@ -1108,6 +1154,10 @@ SmbiosPrintStructure ( // case 42: DisplayMCHostInterfaceType (Struct->Type42->InterfaceType, Option); + if (AE_SMBIOS_VERSION (0x3, 0x2)) { + PRINT_STRUCT_VALUE_H (Struct, Type42, InterfaceTypeSpecificDataLength); + PRINT_BIT_FIELD (Struct, Type42, InterfaceTypeSpecificData, Struct->Type42->InterfaceTypeSpecificDataLength); + } break; // @@ -2111,6 +2161,10 @@ DisplayProcessorFamily ( Print (L"Intel Core i3 processor\n"); break; + case 0xCF: + Print (L"Intel Core i9 processor\n"); + break; + case 0xD2: Print (L"ViaC7M\n"); break; diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c index b56cd61d07..9a1c33fbe0 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c @@ -579,6 +579,22 @@ TABLE_ITEM ProcessorUpgradeTable[] = { { 0x38, L"Socket SP3r2" + }, + { + 0x39, + L"Socket LGA2066" + }, + { + 0x3A, + L"Socket BGA1392" + }, + { + 0x3B, + L"Socket BGA1510" + }, + { + 0x3C, + L"Socket BGA1528" } }; @@ -1088,6 +1104,10 @@ TABLE_ITEM PortConnectorTypeTable[] = { 0x22, L"SAS/SATA Plug Receptacle" }, + { + 0x23, + L"USB Type-C Receptacle" + }, { 0xA0, L"PC-98" @@ -1251,6 +1271,14 @@ TABLE_ITEM PortTypeTable[] = { 0x21, L"SAS Port" }, + { + 0x22, + L"Multi-Function Display Port (MFDP)" + }, + { + 0x23, + L"Thunderbolt" + }, { 0xA0, L"8251 Compatible" @@ -1576,6 +1604,10 @@ TABLE_ITEM SystemSlotCurrentUsageTable[] = { 0x04, L" In use" }, + { + 0x05, + L" Unavailable" + } }; TABLE_ITEM SystemSlotLengthTable[] = { @@ -1645,6 +1677,10 @@ TABLE_ITEM SlotCharacteristics2Table[] = { { 2, L" PCI slot supports SMBus signal" + }, + { + 3, + L" PCIe slot supports bifurcation" } }; @@ -2468,6 +2504,10 @@ TABLE_ITEM MemoryDeviceTypeTable[] = { { 0x1E, L" LPDDR4" + }, + { + 0x1F, + L" Logical non-volatile device" } }; @@ -2530,6 +2570,61 @@ TABLE_ITEM MemoryDeviceTypeDetailTable[] = { } }; +TABLE_ITEM MemoryDeviceMemoryTechnologyTable[] = { + { + 0x01, + L" Other" + }, + { + 0x02, + L" Unknown" + }, + { + 0x03, + L" DRAM" + }, + { + 0x04, + L" NVDIMM-N" + }, + { + 0x05, + L" NVDIMM-F" + }, + { + 0x06, + L" NVDIMM-P" + }, + { + 0x07, + L" Intel persistent memory" + } +}; + +TABLE_ITEM MemoryDeviceMemoryOperatingModeCapabilityTable[] = { + { + 1, + L" Other" + }, + { + 2, + L" Unknown" + }, + { + 3, + L" Volatile memory" + }, + { + 4, + L" Byte-accessible persistent memory" + }, + { + 5, + L" Block-accessible persistent memory" + } +}; + + TABLE_ITEM MemoryErrorTypeTable[] = { { 0x01, @@ -3155,7 +3250,11 @@ TABLE_ITEM IPMIDIBMCInterfaceTypeTable[] = { L" BT: Block Transfer " }, { - 0xFF04, + 0x04, + L" SSIF: SMBus System Interface " + }, + { + 0xFF05, L" Reserved for future assignment by this specification " }, }; @@ -4222,6 +4321,40 @@ DisplayMemoryDeviceTypeDetail ( PRINT_BITS_INFO (MemoryDeviceTypeDetailTable, Para); } +/** + Display Memory Device (Type 17) memory technology. + + @param[in] Para The key of the structure. + @param[in] Option The optional information. +**/ +VOID +DisplayMemoryDeviceMemoryTechnology ( + IN UINT8 Para, + IN UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEMORY_TECHNOLOGY), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Para, Option); + PRINT_TABLE_ITEM (MemoryDeviceMemoryTechnologyTable, Para); +} + +/** + Display Memory Device (Type 17) memory operating mode capability. + + @param[in] Para The key of the structure. + @param[in] Option The optional information. +**/ +VOID +DisplayMemoryDeviceMemoryOperatingModeCapability ( + IN UINT16 Para, + IN UINT8 Option + ) +{ + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEM_OPER_MODE_CAPA), gShellDebug1HiiHandle); + PRINT_INFO_OPTION (Para, Option); + PRINT_BITS_INFO (MemoryDeviceMemoryOperatingModeCapabilityTable, Para); +} + /** Display 32-bit Memory Error Information (Type 18) type. diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h index bd9e6898d4..3449da357e 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h @@ -2,7 +2,7 @@ Build a table, each item is (key, info) pair. and give a interface of query a string out of a table. - Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2005 - 2018, 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 @@ -563,6 +563,30 @@ DisplayMemoryDeviceTypeDetail ( IN UINT8 Option ); +/** + Display Memory Device (Type 17) memory technology. + + @param[in] Para The key of the structure. + @param[in] Option The optional information. +**/ +VOID +DisplayMemoryDeviceMemoryTechnology ( + IN UINT8 Para, + IN UINT8 Option + ); + +/** + Display Memory Device (Type 17) memory operating mode capability. + + @param[in] Para The key of the structure. + @param[in] Option The optional information. +**/ +VOID +DisplayMemoryDeviceMemoryOperatingModeCapability ( + IN UINT16 Para, + IN UINT8 Option + ); + /** Display 32-bit Memory Error Information (Type 18) type. diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni index 2cd6826305..021ed62508 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni @@ -1,6 +1,6 @@ // /** // -// Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
+// Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
// (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
// (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
// This program and the accompanying materials @@ -104,6 +104,11 @@ #string STR_SMBIOSVIEW_PRINTINFO_INSTALLED #language en-US "Installed " #string STR_SMBIOSVIEW_PRINTINFO_ENABLED #language en-US "Enabled " #string STR_SMBIOSVIEW_PRINTINFO_EXTERNAL #language en-US "External " +#string STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS #language en-US "Peer Groups %d:\r\n" +#string STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM #language en-US " SegmentGroup Num: 0x%04x\r\n" +#string STR_SMBIOSVIEW_PRINTINFO_BUS_NUM #language en-US " Bus Num: 0x%02x\r\n" +#string STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM #language en-US " DevFunc Num: 0x%02x\r\n" +#string STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH #language en-US " DataBus Width: %d\r\n" #string STR_SMBIOSVIEW_PRINTINFO_DESC_STRING #language en-US "Description String: " #string STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT #language en-US "Supported Event Log Type Descriptors %d:\r\n" #string STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED #language en-US "Access Method %d has not supported\r\n" @@ -427,6 +432,8 @@ #string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_FORM_FACTOR #language en-US "Memory Device - Form Factor: " #string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE #language en-US "Memory Device - Type: " #string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL #language en-US "Memory Device - Type Detail: " +#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEMORY_TECHNOLOGY #language en-US "Memory Device - Memory Technology: " +#string STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_MEM_OPER_MODE_CAPA #language en-US "Memory Device - Memory Operating Mode Capability: " #string STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_INFO #language en-US "32-bit Memory Error Information - Type: " #string STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_GRANULARITY #language en-US "Memory Error - Error granularity: " #string STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_OP #language en-US "Memory Error - Error Operation: " -- 2.39.2