From 497766f70975b9c1f88df42228c79095198f2b4e Mon Sep 17 00:00:00 2001 From: Sam Kaynor Date: Wed, 10 Jan 2024 13:03:19 -0600 Subject: ShellPkg: UefiShellDebug1CommandsLib: Conformance Profiles in Dmem.c 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 Cc: Zhichao Gao Signed-off-by: Sam Kaynor Tested-by: Stuart Yoder Reviewed-by: Stuart Yoder --- ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c | 80 ++++++++++++++++++++++ .../UefiShellDebug1CommandsLib.inf | 4 ++ .../UefiShellDebug1CommandsLib.uni | 5 ++ 3 files changed, 89 insertions(+) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c index 80c779a..046cfd5 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -19,6 +19,7 @@ #include #include #include +#include /** Make a printable character. @@ -269,7 +270,77 @@ 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; + UINTN Profile; + EFI_CONFORMANCE_PROFILES_TABLE *ConfProfTable; + ShellStatus = SHELL_SUCCESS; + + if (Address != 0) { + EfiGetSystemConfigurationTable (&gEfiConfProfilesTableGuid, (VOID **)&ConfProfTable); + + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE), gShellDebug1HiiHandle); + + EntryGuid = (EFI_GUID *)(ConfProfTable + 1); + + for (Profile = 0; Profile < ConfProfTable->NumberOfProfiles; Profile++, EntryGuid++) { + GuidName = L"Unknown_Profile"; + + if (CompareGuid (EntryGuid, &gEfiConfProfilesUefiSpecGuid)) { + GuidName = L"EFI_CONFORMANCE_PROFILE_UEFI_SPEC_GUID"; + } + + 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 +532,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 ( @@ -505,6 +581,10 @@ ShellCommandRunDmem ( if (ShellStatus == SHELL_SUCCESS) { ShellStatus = DisplayImageExecutionEntries (ImageExecutionTableAddress); } + + if (ShellStatus == SHELL_SUCCESS) { + ShellStatus = DisplayConformanceProfiles (ConformanceProfileTableAddress); + } } } else { ShellStatus = DisplayMmioMemory (Address, (UINTN)Size); diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf index 3741dac..140e9dc 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf @@ -139,3 +139,7 @@ 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/UefiShellDebug1CommandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni index 3b73016..6ef923e 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" -- cgit v1.1