From e9f0be021b7649c15d823e193110c0088cda9a89 Mon Sep 17 00:00:00 2001 From: Linson Augustine Date: Thu, 12 Jan 2017 14:59:36 +0800 Subject: [PATCH] ShellPkg/SmbiosView: Add decoding of SMBIOS record type 43 Added decoding of the new SMBIOS Type 43 record. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Augustine Linson P Reviewed-by: Star Zeng --- .../SmbiosView/PrintInfo.c | 70 +++++++++++++++++++ .../SmbiosView/PrintInfo.h | 13 ++++ .../SmbiosView/QueryTable.c | 6 +- .../SmbiosView/SmbiosViewStrings.uni | 8 ++- 4 files changed, 95 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c index 000bbe53a7..d9adb1a7ab 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c @@ -1095,6 +1095,20 @@ SmbiosPrintStructure ( PRINT_STRUCT_VALUE_H (Struct, Type42, InterfaceType); break; + // + // TPM Device (Type 43) + // + case 43: + PRINT_BIT_FIELD (Struct, Type43, VendorID, 4); + PRINT_STRUCT_VALUE_H (Struct, Type43, MajorSpecVersion); + PRINT_STRUCT_VALUE_H (Struct, Type43, MinorSpecVersion); + PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion1); + PRINT_STRUCT_VALUE_H (Struct, Type43, FirmwareVersion2); + PRINT_PENDING_STRING (Struct, Type43, Description); + DisplayTpmDeviceCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type43->Characteristics)), Option); + PRINT_STRUCT_VALUE_H (Struct, Type43, OemDefined); + break; + // // Inactive (Type 126) // @@ -3238,3 +3252,59 @@ DisplaySPSCharacteristics ( ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE), gShellDebug1HiiHandle); } } + +/** + Display TPM Device (Type 43) Characteristics. + + @param[in] Chara The information bits. + @param[in] Option The optional information. +**/ +VOID +DisplayTpmDeviceCharacteristics ( + IN UINT64 Chara, + IN UINT8 Option + ) +{ + // + // Print header + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR), gShellDebug1HiiHandle); + // + // print option + // + PRINT_INFO_OPTION (Chara, Option); + + // + // Check all the bits and print information + // This function does not use Table because table of bits + // are designed not to deal with UINT64 + // + if (BIT (Chara, 0) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); + } + + if (BIT (Chara, 1) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle); + } + if (BIT (Chara, 2) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle); + } + + if (BIT (Chara, 3) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_FWU), gShellDebug1HiiHandle); + } + + if (BIT (Chara, 4) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_PLAT_SW), gShellDebug1HiiHandle); + } + + if (BIT (Chara, 5) != 0) { + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_OEM), gShellDebug1HiiHandle); + } + + // + // Just print the Reserved + // + ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_06_63), gShellDebug1HiiHandle); + +} diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h index 50667b684c..1aa5bee08f 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h @@ -2,6 +2,7 @@ Module to clarify the element info of the smbios structure. Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
+ (C) Copyright 2017 Hewlett Packard Enterprise Development LP
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 @@ -420,4 +421,16 @@ DisplaySPSCharacteristics ( IN UINT8 Option ); +/** + Display TPM Device (Type 43) Characteristics. + + @param[in] Chara The information bits. + @param[in] Option The optional information. +**/ +VOID +DisplayTpmDeviceCharacteristics ( + IN UINT64 Chara, + IN UINT8 Option + ); + #endif diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c index d0106c0b55..b802c54509 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c @@ -3,7 +3,7 @@ And give a interface of query a string out of a table. Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
- (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+ (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
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 @@ -3189,6 +3189,10 @@ TABLE_ITEM StructureTypeInfoTable[] = { 42, L" Management Controller Host Interface" }, + { + 43, + L" TPM Device" + }, { 0x7E, L" Inactive" diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni index 9811542013..0596f1fb31 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni @@ -2,7 +2,7 @@ // // Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
// (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
-// (C) Copyright 2015 Hewlett Packard Enterprise Development LP
+// (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
// 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 @@ -488,4 +488,10 @@ #string STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE #language en-US "SmbiosView: SMBIOS table damaged\r\n" #string STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM #language en-US "SmbiosView: Out of memory\r\n" #string STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS #language en-US "SmbiosView: Cannot access statistics table\r\n" +#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR #language en-US "TPM Device Characteristics: \r\n" +#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CHAR_NOT_SUPPORTED #language en-US "TPM Device Characteristics Not Supported\r\n" +#string STR_SMBIOSVIEW_PRINTINFO_TPM_DEVICE_CONFIG_FWU #language en-US "Family configurable via firmware update\r\n" +#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" -- 2.39.2