From: "Gao, Zhichao" <zhichao.gao@intel.com>
To: Simon Wang <simowang@nvidia.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [PATCH] ShellPkg/SmbiosView: type 45 and type 46 support.
Date: Fri, 19 May 2023 02:09:54 +0000 [thread overview]
Message-ID: <PH7PR11MB637787885052FB96C3B1CECAF67C9@PH7PR11MB6377.namprd11.prod.outlook.com> (raw)
In-Reply-To: <763ffe5fb3ad78efc8d3cd693d97dff527a9eb33.1683166519.git.simowang@nvidia.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Thanks,
Zhichao
-----Original Message-----
From: Simon Wang <simowang@nvidia.com>
Sent: Thursday, May 4, 2023 10:34 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
Subject: [PATCH] ShellPkg/SmbiosView: type 45 and type 46 support.
The initial version of Smbios Specification 3.6.0 type 45 and type 46 support.
Signed-off-by: Simon Wang <simowang@nvidia.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
---
.../SmbiosView/PrintInfo.c | 111 +++++++++++++++++-
.../SmbiosView/PrintInfo.h | 25 ++++
.../SmbiosView/QueryTable.c | 81 +++++++++++++
.../SmbiosView/SmbiosViewStrings.uni | 9 +-
4 files changed, 222 insertions(+), 4 deletions(-)
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index 1811cf0c44..e6a110beee 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -5,6 +5,7 @@
Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
(C) Copyright 2015-2019 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -305,9 +306,10 @@ SmbiosPrintStructure (
IN UINT8 Option
)
{
- UINT8 Index;
- UINT8 Index2;
- UINT8 *Buffer;
+ UINT8 Index;
+ UINT8 Index2;
+ UINT8 *Buffer;
+ EFI_STRING String;
if (Struct == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1302,6 +1304,109 @@ SmbiosPrintStructure (
break;
//
+ // Firmware Inventory (Type 45)
+ //
+ case 45:
+ PRINT_PENDING_STRING (Struct, Type45, FirmwareComponentName);
+ PRINT_PENDING_STRING (Struct, Type45, FirmwareVersion);
+ if (Struct->Type45->FirmwareVersionFormat == VersionFormatTypeFreeForm) {
+ String = L"Free-form string";
+ } else if (Struct->Type45->FirmwareVersionFormat == VersionFormatTypeMajorMinor) {
+ String = L"MAJOR.MINOR";
+ } else if (Struct->Type45->FirmwareVersionFormat == VersionFormatType32BitHex) {
+ String = L"32-bit hexadecimal string";
+ } else if (Struct->Type45->FirmwareVersionFormat == VersionFormatTypeMajorMinor) {
+ String = L"64-bit hexadecimal string";
+ } else if (Struct->Type45->FirmwareVersionFormat >= 0x80) {
+ String = L"BIOS Vendor/OEM-specific";
+ } else {
+ String = L"Reserved";
+ }
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_VERSION_FORMAT),
+ gShellDebug1HiiHandle,
+ String
+ );
+ PRINT_PENDING_STRING (Struct, Type45, FirmwareId);
+ if (Struct->Type45->FirmwareIdFormat == FirmwareIdFormatTypeFreeForm) {
+ String = L"Free-form string";
+ } else if (Struct->Type45->FirmwareIdFormat == FirmwareIdFormatTypeUuid) {
+ String = L"RFC4122 UUID string";
+ } else if (Struct->Type45->FirmwareIdFormat >= 0x80) {
+ String = L"BIOS Vendor/OEM-specific";
+ } else {
+ String = L"Reserved";
+ }
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_ID_FORMAT),
+ gShellDebug1HiiHandle,
+ String
+ );
+ PRINT_PENDING_STRING (Struct, Type45, ReleaseDate);
+ PRINT_PENDING_STRING (Struct, Type45, Manufacturer);
+ PRINT_PENDING_STRING (Struct, Type45, LowestSupportedVersion);
+ if (Struct->Type45->ImageSize != MAX_UINT64) {
+ PRINT_STRUCT_VALUE_H (Struct, Type45, ImageSize);
+ } else {
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_IMAGE_SIZE_UNKNOWN),
+ gShellDebug1HiiHandle
+ );
+ }
+
+ DisplayFirmwareCharacteristics (ReadUnaligned16 ((UINT16 *)(UINTN)&(Struct->Type45->Characteristics)), Option);
+ DisplayFirmwareState (*(UINT8 *)(UINTN)&(Struct->Type45->State),
+ Option);
+
+ PRINT_STRUCT_VALUE_H (Struct, Type45, AssociatedComponentCount);
+ if (Struct->Hdr->Length > sizeof (*Struct->Type45)) {
+ for (Index = 0; Index < Struct->Type45->AssociatedComponentCount; Index++) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_INVENTORY_ASSOCIATED), gShellDebug1HiiHandle);
+ Print (L" 0x%04X ", Buffer[sizeof (*Struct->Type45) + (Index * sizeof (SMBIOS_HANDLE))]);
+ Print (L"\n");
+ }
+ }
+
+ break;
+
+ //
+ // String Property (Type 46)
+ //
+ case 46:
+ if (Struct->Type46->StringPropertyId == StringPropertyIdDevicePath) {
+ String = L"UEFI device path";
+ } else if ((Struct->Type46->StringPropertyId >= StringPropertyIdBiosVendor) &&
+ (Struct->Type46->StringPropertyId < StringPropertyIdOem))
+ {
+ String = L"BIOS vendor defined";
+ } else if (Struct->Type46->StringPropertyId >= StringPropertyIdOem) {
+ String = L"OEM defined";
+ } else {
+ String = L"Reserved";
+ }
+
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRING_PROPERTY_ID),
+ gShellDebug1HiiHandle,
+ String
+ );
+ PRINT_PENDING_STRING (Struct, Type46, StringPropertyValue);
+ PRINT_STRUCT_VALUE_H (Struct, Type46, ParentHandle);
+ break;
+ //
// Inactive (Type 126)
//
case 126:
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h
index 8ecec693ad..4f52932a4d 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) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -439,4 +440,28 @@ DisplayProcessorArchitectureType (
IN UINT8 Option
);
+/**
+ Display Firmware Characteristics (Type 45) details.
+
+ @param[in] Chara The information bits.
+ @param[in] Option The optional information.
+**/
+VOID
+DisplayFirmwareCharacteristics (
+ IN UINT16 Chara,
+ IN UINT8 Option
+ );
+
+/**
+ Display Firmware state (Type 45) details.
+
+ @param[in] Key The key of the structure.
+ @param[in] Option The optional information.
+**/
+VOID
+DisplayFirmwareState (
+ IN UINT8 Key,
+ IN UINT8 Option
+ );
+
#endif
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
index edb46817e4..29b5a29001 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) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -3622,6 +3623,52 @@ TABLE_ITEM ProcessorArchitectureTypesTable[] = {
}
};
+TABLE_ITEM FirmwareInventoryCharTable[] = {
+ {
+ 0,
+ L"Updatable"
+ },
+ {
+ 1,
+ L"Write-Protect"
+ }
+};
+
+TABLE_ITEM FirmwareInventoryStateTable[] = {
+ {
+ 1,
+ L" Other"
+ },
+ {
+ 2,
+ L" Unknown "
+ },
+ {
+ 3,
+ L" Disabled: This firmware component is disabled. "
+ },
+ {
+ 4,
+ L" Enabled: This firmware component is enabled. "
+ },
+ {
+ 5,
+ L" Absent: This firmware component is either not present or not detected "
+ },
+ {
+ 6,
+ L" StandbyOffline: This firmware is enabled but awaits an external action to activate it. "
+ },
+ {
+ 7,
+ L" StandbySpare: This firmware is part of a redundancy set and awaits a failover or other external action to activate it. "
+ },
+ {
+ 8,
+ L" UnavailableOffline: This firmware component is present but cannot be used. "
+ },
+};
+
TABLE_ITEM StructureTypeInfoTable[] = {
{
0,
@@ -5126,6 +5173,40 @@ DisplayProcessorArchitectureType (
PRINT_TABLE_ITEM (ProcessorArchitectureTypesTable, Key); }
+/**
+ Display Firmware Characteristics (Type 45) details.
+
+ @param[in] Chara The information bits.
+ @param[in] Option The optional information.
+**/
+VOID
+DisplayFirmwareCharacteristics (
+ IN UINT16 Chara,
+ IN UINT8 Option
+ )
+{
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
+(STR_SMBIOSVIEW_QUERYTABLE_FIRMWARE_INVENTORY_CHAR),
+gShellDebug1HiiHandle);
+ PRINT_INFO_OPTION (Chara, Option);
+ PRINT_BITS_INFO (FirmwareInventoryCharTable, Chara); }
+
+/**
+ Display Firmware state (Type 45) details.
+
+ @param[in] Key The key of the structure.
+ @param[in] Option The optional information.
+**/
+VOID
+DisplayFirmwareState (
+ IN UINT8 Key,
+ IN UINT8 Option
+ )
+{
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
+(STR_SMBIOSVIEW_QUERYTABLE_FIRMWARE_INVENTORY_STATE),
+gShellDebug1HiiHandle);
+ PRINT_INFO_OPTION (Key, Option);
+ PRINT_TABLE_ITEM (FirmwareInventoryStateTable, Key); }
+
/**
Display the structure type information.
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni
index 73f7b2ab19..971e0d09bd 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewS
+++ trings.uni
@@ -4,6 +4,7 @@
// Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR> // (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.<BR> // (C) Copyright 2015-2019 Hewlett Packard Enterprise Development LP<BR>
+// Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: BSD-2-Clause-Patent // // Module Name:
@@ -511,4 +512,10 @@
#string STR_SMBIOSVIEW_PRINTINFO_IPMI_SPECIFICATION_REVISION #language en-US "IPMISpecificationRevision: %d.%d\n"
#string STR_SMBIOSVIEW_PRINTINFO_NV_STORAGE_DEVICE_NOT_PRESENT #language en-US "NVStorageDevice: Not Present\n"
#string STR_SMBIOSVIEW_PRINTINFO_BASE_ADDRESS #language en-US "BaseAddress: 0x%x\n"
-
+#string STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_VERSION_FORMAT #language en-US "FirmwareVersionFormat: %s\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_ID_FORMAT #language en-US "FirmwareIdFormat: %s\r\n"
+#string STR_SMBIOSVIEW_QUERYTABLE_FIRMWARE_INVENTORY_CHAR #language en-US "Characteristics:\r\n"
+#string STR_SMBIOSVIEW_QUERYTABLE_FIRMWARE_INVENTORY_STATE #language en-US "State:\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_INVENTORY_ASSOCIATED #language en-US " Associated handle:\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_IMAGE_SIZE_UNKNOWN #language en-US "ImageSize: Unknown\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_STRING_PROPERTY_ID #language en-US "String Property ID: %s\r\n"
--
2.40.0
next prev parent reply other threads:[~2023-05-19 2:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-04 2:34 [PATCH] ShellPkg/SmbiosView: type 45 and type 46 support simowang
2023-05-09 1:32 ` [edk2-devel] " Simon Wang
2023-05-14 13:40 ` Simon Wang
2023-05-19 2:09 ` Gao, Zhichao [this message]
2023-06-01 13:01 ` Simon Wang
2023-06-02 1:22 ` 回复: " gaoliming
2023-06-08 1:22 ` Gao, Zhichao
2023-06-08 6:12 ` Simon Wang
2023-06-08 6:41 ` Gao, Zhichao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH7PR11MB637787885052FB96C3B1CECAF67C9@PH7PR11MB6377.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox