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 <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Sam Kaynor <Sam.Kaynor@arm.com>
Tested-by: Stuart Yoder <stuart.yoder@arm.com>
Reviewed-by: Stuart Yoder <stuart.yoder@arm.com>
This commit is contained in:
Sam Kaynor 2024-01-10 13:03:19 -06:00 committed by mergify[bot]
parent 960b6e8309
commit 497766f709
3 changed files with 89 additions and 0 deletions

View File

@ -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,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);

View File

@ -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

View File

@ -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"