Dandan, thanks.

Reviewed-by: Star Zeng <star.z...@intel.com>


Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Wednesday, August 29, 2018 4:53 PM
To: edk2-devel@lists.01.org
Cc: Carsey, Jaben <jaben.car...@intel.com>; Ni, Ruiyu <ruiyu...@intel.com>; 
Zeng, Star <star.z...@intel.com>
Subject: [edk2] [patch V3] 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 <jaben.car...@intel.com>
Cc: Ruiyu Ni <ruiyu...@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 .../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
@@ -541,26 +541,49 @@ 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;
 
   //
   // On Board Devices Information (Type 10) @@ -753,10 +776,33 @@ 
SmbiosPrintStructure (
     if (AE_SMBIOS_VERSION (0x2, 0x8) && (Struct->Hdr->Length > 0x22)) {
       PRINT_STRUCT_VALUE (Struct, Type17, MinimumVoltage);
       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;
 
   //
   // 32-bit Memory Error Information (Type 18)
   //
@@ -1106,10 +1152,14 @@ SmbiosPrintStructure (
   //
   // Management Controller Host Interface (Type 42)
   //
   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;
 
   //
   // TPM Device (Type 43)
   //
@@ -2109,10 +2159,14 @@ DisplayProcessorFamily (
 
   case 0xCE:
     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;
 
   case 0xD3:
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
@@ -577,10 +577,26 @@ TABLE_ITEM  ProcessorUpgradeTable[] = {
     L"Socket SP3"
   },
   {
     0x38,
     L"Socket SP3r2"
+  },
+  {
+    0x39,
+    L"Socket LGA2066"
+  },
+  {
+    0x3A,
+    L"Socket BGA1392"
+  },
+  {
+    0x3B,
+    L"Socket BGA1510"
+  },
+  {
+    0x3C,
+    L"Socket BGA1528"
   }
 };
 
 TABLE_ITEM  ProcessorCharacteristicsTable[] = {
   {
@@ -1086,10 +1102,14 @@ TABLE_ITEM  PortConnectorTypeTable[] = {
   },
   {
     0x22,
     L"SAS/SATA Plug Receptacle"
   },
+  {
+    0x23,
+    L"USB Type-C Receptacle"
+  },
   {
     0xA0,
     L"PC-98"
   },
   {
@@ -1249,10 +1269,18 @@ TABLE_ITEM  PortTypeTable[] = {
   },
   {
     0x21,
     L"SAS Port"
   },
+  {
+    0x22,
+    L"Multi-Function Display Port (MFDP)"
+  },
+  {
+    0x23,
+    L"Thunderbolt"
+  },
   {
     0xA0,
     L"8251 Compatible"
   },
   {
@@ -1574,10 +1602,14 @@ TABLE_ITEM  SystemSlotCurrentUsageTable[] = {
   },
   {
     0x04,
     L" In use"
   },
+  {
+    0x05,
+    L" Unavailable"
+  }
 };
 
 TABLE_ITEM  SystemSlotLengthTable[] = {
   {
     0x01,
@@ -1643,10 +1675,14 @@ TABLE_ITEM  SlotCharacteristics2Table[] = {
     L" Slot supports hot-plug devices"
   },
   {
     2,
     L" PCI slot supports SMBus signal"
+  },
+  {
+    3,
+    L" PCIe slot supports bifurcation"
   }
 };
 
 TABLE_ITEM  OnboardDeviceTypesTable[] = {
   {
@@ -2466,10 +2502,14 @@ TABLE_ITEM  MemoryDeviceTypeTable[] = {
     L"  LPDDR3"
   },
   {
     0x1E,
     L"  LPDDR4"
+  },
+  {
+    0x1F,
+    L"  Logical non-volatile device"
   }
 };
 
 TABLE_ITEM  MemoryDeviceTypeDetailTable[] = {
   {
@@ -2528,10 +2568,65 @@ TABLE_ITEM  MemoryDeviceTypeDetailTable[] = {
     14,
     L" Unbuffered(Unregistered)"
   }
 };
 
+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,
     L"  Other"
   },
@@ -3153,11 +3248,15 @@ TABLE_ITEM  IPMIDIBMCInterfaceTypeTable[] = {
   {
     0x03,
     L" BT: Block Transfer "
   },
   {
-    0xFF04,
+    0x04,
+    L" SSIF: SMBus System Interface "
+  },
+  {
+    0xFF05,
     L" Reserved for future assignment by this specification "
   },
 };
 
 TABLE_ITEM  MCHostInterfaceTypeTable[] = { @@ -4220,10 +4319,44 @@ 
DisplayMemoryDeviceTypeDetail (
   ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL), gShellDebug1HiiHandle);
   PRINT_INFO_OPTION (Para, Option);
   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.
 
   @param[in] ErrorType  The key of the structure.
   @param[in] Option     The optional information.
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
@@ -1,10 +1,10 @@
 /** @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 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2005 - 2018, Intel Corporation. All rights 
+ reserved.<BR>
   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
 
@@ -561,10 +561,34 @@ VOID
 DisplayMemoryDeviceTypeDetail (
   IN UINT16  Para,
   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.
 
   @param[in] ErrorType  The key of the structure.
   @param[in] Option     The optional information.
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/SmbiosViewS
+++ trings.uni
@@ -1,8 +1,8 @@
 // /**
 //
-// Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
+// Copyright (c) 2005 - 2018, Intel Corporation. All rights 
+reserved.<BR>
 // (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.<BR>  // 
(C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR>  // 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 @@ -102,10 +102,15 @@
 #string STR_SMBIOSVIEW_PRINTINFO_SUPOPRT                        #language 
en-US "Support "
 #string STR_SMBIOSVIEW_PRINTINFO_CURRENT                        #language 
en-US "Current "
 #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"
 #string STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31                  #language 
en-US "This structure is Type31, reserved by BIS (Boot Integrity Services)\r\n"
 #string STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE                     #language 
en-US "Memory Device %d:\r\n"
@@ -425,10 +430,12 @@
 #string STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_USE            #language 
en-US "Physical Memory Array Use: "
 #string STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ERROR          #language 
en-US "Physical Memory Array Error Correction Types: "
 #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: "
 #string STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_TYPE          #language 
en-US "Pointing Device - Type: "
 #string STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_INTERFACE     #language 
en-US "Pointing Device - Interface:"
--
2.14.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to