summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Wang <simowang@nvidia.com>2023-05-04 10:34:20 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-06-08 07:11:06 +0000
commit8314a85893f5b75baa0031a5138028188a626243 (patch)
treeacda28b3bf2b536ba39c3ad02f8f34efcb64ba9e
parent69abcf1e78b67e7ce9ac53a9fe1ce61877df984c (diff)
downloadedk2-8314a85893f5b75baa0031a5138028188a626243.tar.gz
edk2-8314a85893f5b75baa0031a5138028188a626243.tar.bz2
edk2-8314a85893f5b75baa0031a5138028188a626243.zip
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> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c111
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h25
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c81
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni9
4 files changed, 222 insertions, 4 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index fe5e85f790..f55d5f953c 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -6,6 +6,7 @@
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
(C) Copyright 2015-2019 Hewlett Packard Enterprise Development LP<BR>
Copyright (c) 2023 Apple Inc. All rights reserved.<BR>
+ Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -306,9 +307,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;
@@ -1305,6 +1307,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,
@@ -5127,6 +5174,40 @@ DisplayProcessorArchitectureType (
}
/**
+ 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.
@param[in] Key The key of the structure.
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/SmbiosViewStrings.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"