public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg: Changes to display Type 45 table in smbiosview and improved Type 3 table.
@ 2022-09-29  8:06 Kalaivani Palanikumar
  0 siblings, 0 replies; only message in thread
From: Kalaivani Palanikumar @ 2022-09-29  8:06 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kalaivani Palanikumar
  Cc: Sundaresan S, Vasudevan S, Liming Gao

Add support in smbiosview command to display Type 45 table. There is a bug in Type 3 table which displays SystemEnclosureType as Undefined. As per Smbios spec, BIT7 in SMBIOS_TABLE_TYPE3.Type denotes whether chassis lock is present or not. But, currently BIT7 considered to display SystemEnclosureType.

Signed-off by: kalaivani P <kalaivanip@ami.com>

cc: Vasudevan S <vasudevans@ami.com>
cc: Sundaresan S <sundaresans@ami.com>
cc: Liming Gao <gaoliming@byosoft.com.cn>

---
 .../SmbiosView/PrintInfo.c                    |  28 +++
 .../SmbiosView/PrintInfo.h                    |  48 +++++
 .../SmbiosView/QueryTable.c                   | 165 +++++++++++++++++-
 .../SmbiosView/SmbiosViewStrings.uni          |   7 +-
 4 files changed, 246 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index bf5306205b..2b2a18bdce 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -1274,6 +1274,34 @@ SmbiosPrintStructure (
       DisplayProcessorArchitectureType (Struct->Type44->ProcessorSpecificBlock.ProcessorArchType, Option);

       break;



+    //

+    // Firmware Inventory Information (Type 45)

+    //

+    case 45:

+    {

+        UINT16  *AssociatedComponentHandles;

+

+        PRINT_PENDING_STRING  (Struct, Type45, FirmwareComponentName);

+        PRINT_PENDING_STRING  (Struct, Type45, FirmwareVersion);

+        DisplayFirmwareVersionFormat (Struct->Type45->FirmwareVersionFormat, Option);

+        PRINT_PENDING_STRING  (Struct, Type45, FirmwareId);

+        DisplayFirmwareIdFormat (Struct->Type45->FirmwareIdFormat, Option);

+        PRINT_PENDING_STRING  (Struct, Type45, ReleaseDate);

+        PRINT_PENDING_STRING  (Struct, Type45, Manufacturer);

+        PRINT_PENDING_STRING  (Struct, Type45, LowestSupportedVersion);

+        PRINT_STRUCT_VALUE_LH (Struct, Type45, ImageSize);

+        DisplayFirmwareCharacteristics (*(UINT16 *)(UINTN)&Struct->Type45->Characteristics, Option);

+        DisplayFirmwareStateInformation (Struct->Type45->State, Option);

+        PRINT_STRUCT_VALUE_H (Struct, Type45, AssociatedComponentCount);

+

+        AssociatedComponentHandles = (UINT16 *)((UINTN)Struct->Type45 + sizeof(SMBIOS_TABLE_TYPE45));

+        for (Index = 0; Index < Struct->Type45->AssociatedComponentCount; Index++) {

+            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FW_INVENTORY_HANDLE), gShellDebug1HiiHandle, Index + 1, AssociatedComponentHandles[Index]);

+        }

+

+        break;

+    }

+

     //

     // Inactive (Type 126)

     //

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h
index 8ecec693ad..43dbfcb94f 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h
@@ -3,6 +3,7 @@


   Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>

   (C) Copyright 2017 - 2019 Hewlett Packard Enterprise Development LP<BR>

+  Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent



 **/

@@ -439,4 +440,51 @@ DisplayProcessorArchitectureType (
   IN UINT8  Option

   );



+/**

+  Display Firmware Version Format (Type 45).

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareVersionFormat (

+  IN UINT8  Key,

+  IN UINT8  Option

+  );

+

+/**

+  Display Firmware ID Format (Type 45)

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareIdFormat (

+  IN UINT8  Key,

+  IN UINT8  Option

+  );

+

+/**

+  Display Firmware State Information (Type 45)

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareStateInformation (

+  IN UINT8  Key,

+  IN UINT8  Option

+  );

+

+/**

+  Display Firmware Inventory Characteristics (Type 45)

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareCharacteristics (

+  IN UINT16  Key,

+  IN UINT8   Option

+  );

 #endif

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
index 2e62ae3a34..06b24b55cd 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
@@ -4,6 +4,7 @@


   Copyright (c) 2005 - 2021, Intel Corporation. All rights reserved.<BR>

   (C) Copyright 2016-2019 Hewlett Packard Enterprise Development LP<BR>

+  Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent



 **/

@@ -3586,6 +3587,71 @@ TABLE_ITEM  ProcessorArchitectureTypesTable[] = {
   }

 };



+TABLE_ITEM  FirmwareVersionFormatTable[] = {

+  {

+    VersionFormatTypeFreeForm,

+    L" Free Form "

+  },

+  {

+    VersionFormatTypeMajorMinor,

+    L" MAJOR.MINOR "

+  },

+  {

+    VersionFormatType32BitHex,

+    L" 32-bit Numeric in Hex "

+  },

+  {

+    VersionFormatType64BitHex,

+    L" 64-bit Numeric in Hex "

+  }

+};

+

+TABLE_ITEM  FirmwareIdFormatTable[] = {

+  {

+    FirmwareIdFormatTypeFreeForm,

+    L" Free Form "

+  },

+  {

+    FirmwareIdFormatTypeUuid,

+    L" UUID "

+  }

+};

+

+TABLE_ITEM  FirmwareStateTable[] = {

+  {

+    FirmwareInventoryStateOther,

+    L" Other "

+  },

+  {

+    FirmwareInventoryStateUnknown,

+    L" Unknown "

+  },

+  {

+    FirmwareInventoryStateDisabled,

+    L" Disabled "

+  },

+  {

+    FirmwareInventoryStateEnabled,

+    L" Enabled "

+  },

+  {

+    FirmwareInventoryStateAbsent,

+    L" Absent "

+  },

+  {

+    FirmwareInventoryStateStandbyOffline,

+    L" Standby Offline "

+  },

+  {

+    FirmwareInventoryStateStandbySpare,

+    L" Standby Spare "

+  },

+  {

+    FirmwareInventoryStateUnavailableOffline,

+    L" Unavailable Offline "

+  }

+};

+

 TABLE_ITEM  StructureTypeInfoTable[] = {

   {

     0,

@@ -3767,6 +3833,10 @@ TABLE_ITEM  StructureTypeInfoTable[] = {
     44,

     L" Processor Additional Information"

   },

+  {

+    45,

+    L" Firmware Inventory Information"

+  },

   {

     0x7E,

     L" Inactive"

@@ -4002,7 +4072,7 @@ DisplaySystemEnclosureType (
   //

   // query table and print info

   //

-  PRINT_TABLE_ITEM (SystemEnclosureTypeTable, Type);

+  PRINT_TABLE_ITEM (SystemEnclosureTypeTable, (Type & ~BIT7));



   if (BIT (Type, 7) != 0) {

     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CHASSIS_LOCK_PRESENT), gShellDebug1HiiHandle);

@@ -5090,6 +5160,99 @@ DisplayProcessorArchitectureType (
   PRINT_TABLE_ITEM (ProcessorArchitectureTypesTable, Key);

 }



+/**

+  Display Firmware Version Format (Type 45).

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareVersionFormat (

+  IN UINT8  Key,

+  IN UINT8  Option

+  )

+{

+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_FW_VERSION_FORMAT), gShellDebug1HiiHandle);

+    PRINT_INFO_OPTION (Key, Option);

+

+    if (Key <= VersionFormatType64BitHex) {

+        PRINT_TABLE_ITEM (FirmwareVersionFormatTable, Key);

+    } else if ((Key >= VersionFormatTypeReserved) && (Key < VersionFormatTypeOem)) {

+        ShellPrintEx (-1, -1, L" Reserved\n");

+    } else {

+        ShellPrintEx (-1, -1, L" BIOS Vendor / OEM-specific\n");

+    }

+}

+

+/**

+  Display Firmware ID Format (Type 45)

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareIdFormat (

+  IN UINT8  Key,

+  IN UINT8  Option

+  )

+{

+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_FW_ID_FORMAT), gShellDebug1HiiHandle);

+    PRINT_INFO_OPTION (Key, Option);

+

+    if (Key <= FirmwareIdFormatTypeUuid) {

+        PRINT_TABLE_ITEM (FirmwareIdFormatTable, Key);

+    } else if ((Key >= FirmwareIdFormatTypeReserved) && (Key < InventoryFirmwareIdFormatTypeOem)) {

+        ShellPrintEx (-1, -1, L" Reserved\n");

+    } else {

+        ShellPrintEx (-1, -1, L" BIOS Vendor / OEM-specific\n");

+    }

+}

+

+/**

+  Display Firmware Inventory Characteristics (Type 45)

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareCharacteristics (

+  IN UINT16  Key,

+  IN UINT8   Option

+  )

+{

+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FW_INVENTORY_CHAR), gShellDebug1HiiHandle);

+    PRINT_INFO_OPTION (Key, Option);

+

+    if (BIT (Key, 0) == 1) {

+        ShellPrintEx (-1, -1, L"Updatable\n");

+    } else {

+        ShellPrintEx (-1, -1, L"Not Updatable\n");

+    }

+

+    if (BIT (Key, 1) == 1) {

+        ShellPrintEx (-1, -1, L"Write Protected\n");

+    } else {

+        ShellPrintEx (-1, -1, L"Not Write Protected\n");

+    }

+}

+

+/**

+  Display Firmware State Information (Type 45)

+

+  @param[in] Key            The key of the structure.

+  @param[in] Option         The optional information.

+**/

+VOID

+DisplayFirmwareStateInformation (

+  IN UINT8  Key,

+  IN UINT8  Option

+  )

+{

+    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_FW_STATE), gShellDebug1HiiHandle);

+    PRINT_INFO_OPTION (Key, Option);

+    PRINT_TABLE_ITEM (FirmwareStateTable, Key);

+}

+

 /**

   Display the structure type information.



diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni
index 68211ce7ab..fc8ff317e6 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni
@@ -3,6 +3,7 @@
 // Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>

 // (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.<BR>

 // (C) Copyright 2015-2019 Hewlett Packard Enterprise Development LP<BR>

+// Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>

 // SPDX-License-Identifier: BSD-2-Clause-Patent

 //

 // Module Name:

@@ -504,4 +505,8 @@
 #string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_PLAT_SW      #language en-US "Family configurable via platform software support\r\n"

 #string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_OEM          #language en-US "Family configurable via OEM proprietary mechanism\r\n"

 #string STR_SMBIOSVIEW_PRINTINFO_BITS_06_63                     #language en-US "Bits 6:63 are reserved\r\n"

-

+#string STR_SMBIOSVIEW_PRINTINFO_FW_INVENTORY_CHAR              #language en-US "Firmware Characteristics: \r\n"

+#string STR_SMBIOSVIEW_PRINTINFO_FW_INVENTORY_HANDLE            #language en-US "Associated Component Handle %d: 0x%x\r\n"

+#string STR_SMBIOSVIEW_QUERYTABLE_FW_VERSION_FORMAT             #language en-US "Firmware Version Format:"

+#string STR_SMBIOSVIEW_QUERYTABLE_FW_ID_FORMAT                  #language en-US "Firmware ID Format:"

+#string STR_SMBIOSVIEW_QUERYTABLE_FW_STATE                      #language en-US "Firmware State:"

--
2.36.0.windows.1
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-29  8:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-29  8:06 [PATCH] ShellPkg: Changes to display Type 45 table in smbiosview and improved Type 3 table Kalaivani Palanikumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox