REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4352
Implemented dumping of the UEFI Conformance Profiles Table using Dmem.c Uses header file for GUIDs added in previous patches Cc: Ray Ni <ray...@intel.com> Cc: Zhichao Gao <zhichao....@intel.com> Signed-off-by: Sam Kaynor <sam.kay...@arm.com> Tested-by: Stuart Yoder <stuart.yo...@arm.com> Reviewed-by: Stuart Yoder <stuart.yo...@arm.com> --- Notes: v7: - Added output for EBBR 2.2 Guid v6: - Moved MdePkg changes to separate patch v5: - corrected style error (spaces before '(') v3: - fixed build errors - properly using Address variable - removed unecessary comment in header file ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf | 4 ++ ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c | 73 ++++++++++++++++++++ ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni | 5 ++ 3 files changed, 82 insertions(+) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf index 3741dac5d94c..140e9dc64418 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf @@ -139,3 +139,7 @@ [Guids] gEfiJsonConfigDataTableGuid ## SOMETIMES_CONSUMES ## SystemTable gEfiJsonCapsuleDataTableGuid ## SOMETIMES_CONSUMES ## SystemTable gEfiJsonCapsuleResultTableGuid ## SOMETIMES_CONSUMES ## SystemTable + gEfiConfProfilesTableGuid ## SOMETIMES_CONSUMES ## SystemTable + gEfiConfProfilesUefiSpecGuid ## SOMETIMES_CONSUMES ## GUID + gEfiConfProfilesEbbrSpec21Guid ## SOMETIMES_CONSUMES ## GUID + gEfiConfProfilesEbbrSpec22Guid ## SOMETIMES_CONSUMES ## GUID diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c index a4f404c1cdbd..f3c01d141118 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -19,6 +19,7 @@ #include <Guid/SystemResourceTable.h> #include <Guid/DebugImageInfoTable.h> #include <Guid/ImageAuthentication.h> +#include <Guid/ConformanceProfiles.h> /** Make a printable character. @@ -269,7 +270,71 @@ DisplayImageExecutionEntries ( return (ShellStatus); } +/** + Display the ConformanceProfileTable entries + @param[in] Address The pointer to the ConformanceProfileTable. +**/ +SHELL_STATUS +DisplayConformanceProfiles ( + IN UINT64 Address + ) +{ + SHELL_STATUS ShellStatus; + EFI_STATUS Status; + EFI_GUID *EntryGuid; + CHAR16 *GuidName; + EFI_CONFORMANCE_PROFILES_TABLE *ConfProfTable; + + ShellStatus = SHELL_SUCCESS; + + if (Address != 0) { + ConfProfTable = (EFI_CONFORMANCE_PROFILES_TABLE *)Address; + + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE), gShellDebug1HiiHandle); + + EntryGuid = (EFI_GUID *) (ConfProfTable + 1); + + for (int Profile = 0; Profile < ConfProfTable->NumberOfProfiles; Profile++, EntryGuid++) { + GuidName = L"Unknown_Profile"; + + if (CompareGuid (EntryGuid, &gEfiConfProfilesEbbrSpec21Guid)) { + GuidName = L"EBBR_2.1"; + } + + if (CompareGuid (EntryGuid, &gEfiConfProfilesEbbrSpec22Guid)) { + GuidName = L"EBBR_2.2"; + } + + Status = ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_DMEM_CONF_PRO_ROW), + gShellDebug1HiiHandle, + GuidName, + EntryGuid + ); + } + if (EFI_ERROR (Status)) { + ShellStatus = SHELL_ABORTED; + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL), gShellDebug1HiiHandle, L"ComformanceProfilesTable"); + } + } else { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE), gShellDebug1HiiHandle); + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_DMEM_CONF_PRO_ROW), + gShellDebug1HiiHandle, + L"EFI_CONFORMANCE_PROFILES_UEFI_SPEC_GUID", + &gEfiConfProfilesUefiSpecGuid + ); + } + + return (ShellStatus); +} STATIC CONST SHELL_PARAM_ITEM ParamList[] = { { L"-mmio", TypeFlag }, @@ -461,6 +526,11 @@ ShellCommandRunDmem ( HiiDatabaseExportBufferAddress = (UINT64) (UINTN)gST->ConfigurationTable[TableWalker].VendorTable; continue; } + + if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiConfProfilesTableGuid)) { + ConformanceProfileTableAddress = (UINT64) (UINTN)gST->ConfigurationTable[TableWalker].VendorTable; + continue; + } } ShellPrintHiiEx ( @@ -504,6 +574,9 @@ ShellCommandRunDmem ( if (ShellStatus == SHELL_SUCCESS) { ShellStatus = DisplayImageExecutionEntries (ImageExecutionTableAddress); } + if (ShellStatus == SHELL_SUCCESS) { + ShellStatus = DisplayConformanceProfiles (ConformanceProfileTableAddress); + } } } else { diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni index 3b730164ddce..6ef923e4fd5e 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni @@ -147,6 +147,11 @@ #string STR_DMEM_IMG_EXE_TABLE #language en-US "\r\nImage Execution Table\r\n" "----------------------------------------\r\n" #string STR_DMEM_IMG_EXE_ENTRY #language en-US "%20s: %s\r\n" +#string STR_DMEM_CONF_PRO_TABLE #language en-US "\r\nConformance Profile Table\r\n" + "----------------------------------------\r\n" + "Version 0x1\r\n" + "Profile GUIDs:\r\n" +#string STR_DMEM_CONF_PRO_ROW #language en-US " %s %g\r\n" #string STR_DMEM_ERR_NOT_FOUND #language en-US "\r\n%H%s%N: Table address not found.\r\n" #string STR_DMEM_ERR_GET_FAIL #language en-US "\r\n%H%s%N: Unable to get table information.\r\n" -- 2.34.1