From nobody Fri Apr 17 09:26:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114356+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114356+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706129858; cv=none; d=zohomail.com; s=zohoarc; b=ZQruNUI7OJxaBNPXtVilD0w5na9KG9R/6x0TubsqqCRkrdtpOawrmVARL07O1zEopdETl4shwbCDJBCeVhawSQWyTeTkB229AkYqDdlzF9p4eYLWjRIXj0nyOarVMOBWHcIsqzYljZtmUmjsvG8Nk+7lZRqfQKqmBq/d046loFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706129858; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=c0AfqJDuuVJ6vKroLnrbc1YkBTX3aIepOOpa/Stef5U=; b=eBQTT8Hh+WLKkfSXHxL0oljZH2mvRjtmTm8vBHa5C1XsIh+9bwXKareiZep6RCeaVSDsz+kA/XigIeattZKt+JusbIetV57OpntQ5LBLJi6bYz/04neH/eKhH5LnHmcZ7Zml7nwR3tC2v9K5VSSFGVEuY+IdZb9Qkk3K7wDN9Qw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114356+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706129858951714.4526434717178; Wed, 24 Jan 2024 12:57:38 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=c0AfqJDuuVJ6vKroLnrbc1YkBTX3aIepOOpa/Stef5U=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1706129858; v=1; b=C3NVzCwhXI9YwZv7RjW9wj8zunecBJSor0XskupvB30i4Qgoyd2waozl6rM9Nyef5MOzYgg0 aozdHmNfRcVRUOhmNkVHVUlqn7oIkNtyUl+qJjvbze+tKGpFkYBAijxcA42PwA1D1JSew+OJt1Y x+GkepTB11rf5bOJaNoKMbR0= X-Received: by 127.0.0.2 with SMTP id pNQtYY1788612xWRh7kCXztC; Wed, 24 Jan 2024 12:57:38 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.35270.1706129857444723347 for ; Wed, 24 Jan 2024 12:57:37 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E73AFFEC; Wed, 24 Jan 2024 12:58:21 -0800 (PST) X-Received: from beelzebub.ast.arm.com (u203625-lin.austin.arm.com [10.118.28.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0EEF23F73F; Wed, 24 Jan 2024 12:57:37 -0800 (PST) From: "Sam Kaynor" To: devel@edk2.groups.io Cc: stuart.yoder@arm.com, Sam Kaynor , Ray Ni , Zhichao Gao , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH v1 3/3] ShellPkg: UefiShellDebug1CommandsLib: Conformance Profiles in Dmem.c Date: Wed, 24 Jan 2024 14:56:06 -0600 Message-Id: <20240124205605.69439-4-Sam.Kaynor@arm.com> In-Reply-To: <20240124205605.69439-1-Sam.Kaynor@arm.com> References: <20240124205605.69439-1-Sam.Kaynor@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sam.kaynor@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: XXZrzaxKB0tqpOMEHTli3upPx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706129860461100009 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4352 Implemented dumping of the UEFI Conformance Profiles Table using Dmem.c Additionally added the base support for the table with new header file ConformanceProfiles.h (Cc'd maintainers of MdePkg for this) Cc: Ray Ni Cc: Zhichao Gao Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Sam Kaynor --- MdePkg/MdePkg.dec = | 7 ++ ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf= | 3 + MdePkg/Include/Guid/ConformanceProfiles.h = | 57 +++++++++++++++ ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c = | 76 ++++++++++++++++++++ ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni= | 5 ++ 5 files changed, 148 insertions(+) diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 2ee112cc087a..d22320d7bdae 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -740,6 +740,13 @@ [Guids] ## Include/Protocol/SerilaIo.h gEfiSerialTerminalDeviceTypeGuid =3D { 0x6AD9A60F, 0x5815, 0x4C7C, { 0x8= A, 0x10, 0x50, 0x53, 0xD2, 0xBF, 0x7A, 0x1B }} =20 + # GUIDs defined in UEFI 2.10 + # + ## Include/Guid/ConformanceProfiles.h + gEfiConfProfilesTableGuid =3D { 0x36122546, 0xf7e7, 0x4c8f, { 0xb= d, 0x9b, 0xeb, 0x85, 0x25, 0xb5, 0x0c, 0x0b }} + gEfiConfProfilesUefiSpecGuid =3D { 0x523c91af, 0xa195, 0x4382, { 0x8= 1, 0x8d, 0x29, 0x5f, 0xe4, 0x00, 0x64, 0x65 }} + gEfiConfProfilesEbbrSpecGuid =3D { 0xcce33c35, 0x74ac, 0x4087, { 0xb= c, 0xe7, 0x8b, 0x29, 0xb0, 0x2e, 0xeb, 0x27 }} + # # GUID defined in PI1.0 # diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com= mandsLib.inf b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1C= ommandsLib.inf index 3741dac5d94c..172ac2862ba1 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.inf +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.inf @@ -139,3 +139,6 @@ [Guids] gEfiJsonConfigDataTableGuid ## SOMETIMES_CONSUMES ## SystemTable gEfiJsonCapsuleDataTableGuid ## SOMETIMES_CONSUMES ## SystemTable gEfiJsonCapsuleResultTableGuid ## SOMETIMES_CONSUMES ## SystemTable + gEfiConfProfilesTableGuid ## SOMETIMES_CONSUMES ## SystemTable + gEfiConfProfilesUefiSpecGuid ## SOMETIMES_CONSUMES ## GUID + gEfiConfProfilesEbbrSpecGuid ## SOMETIMES_CONSUMES ## GUID diff --git a/MdePkg/Include/Guid/ConformanceProfiles.h b/MdePkg/Include/Gui= d/ConformanceProfiles.h new file mode 100644 index 000000000000..88517eaaad25 --- /dev/null +++ b/MdePkg/Include/Guid/ConformanceProfiles.h @@ -0,0 +1,57 @@ +/** @file + Legal information + +**/ + +#ifndef __CONFORMANCE_PROFILES_TABLE_GUID_H__ +#define __CONFORMANCE_PROFILES_TABLE_GUID_H__ + + +// +// (This is copied straight from the 2.10 spec, to be modified) +// This table allows the platform to advertise its UEFI specification conf= ormance +// in the form of pre-defined profiles. Each profile is identified by a GU= ID, with +// known profiles listed in the section below. +// The absence of this table shall indicate that the platform implementati= on is +// conformant with the UEFI specification requirements, as defined in Sect= ion 2.6. +// This is equivalent to publishing this configuration table with the +// EFI_CONFORMANCE_PROFILES_UEFI_SPEC_GUID conformance profile. +// +#define EFI_CONFORMANCE_PROFILES_TABLE_GUID \ + { \ + 0x36122546, 0xf7e7, 0x4c8f, { 0xbd, 0x9b, 0xeb, 0x85, 0x25, 0xb5, 0x0c= , 0x0b } \ + } + +#pragma pack(1) + +typedef struct { + /// + /// Version of the table must be 0x1 + /// + UINT16 Version; + /// + /// The number of profiles GUIDs present in ConformanceProfiles + /// + UINT16 NumberOfProfiles; + /// + /// An array of conformance profile GUIDs that are supported by this sys= tem. + /// EFI_GUID ConformanceProfiles[]; + /// +} EFI_CONFORMANCE_PROFILES_TABLE; + +#define EFI_CONFORMANCE_PROFILES_TABLE_VERSION 0x1 + +// +// GUID defined in spec. +// +#define EFI_CONFORMANCE_PROFILES_UEFI_SPEC_GUID \ + { 0x523c91af, 0xa195, 0x4382, \ + { 0x81, 0x8d, 0x29, 0x5f, 0xe4, 0x00, 0x64, 0x65 }} +#define EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID \ + { 0xcce33c35, 0x74ac, 0x4087, \ + { 0xbc, 0xe7, 0x8b, 0x29, 0xb0, 0x2e, 0xeb, 0x27 }} + +extern EFI_GUID gEfiConfProfilesTableGuid; +extern EFI_GUID gEfiConfProfilesUefiSpecGuid; + +#endif diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/= Library/UefiShellDebug1CommandsLib/Dmem.c index 5b0730b75268..ad20ef028e99 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -19,6 +19,7 @@ #include #include #include +#include =20 /** Make a printable character. @@ -272,7 +273,74 @@ DisplayImageExecutionEntries ( return (ShellStatus); } =20 +/** + Display the ConformanceProfileTable entries =20 + @param[in] Address The pointer to the ConformanceProfileTable. +**/ +SHELL_STATUS +DisplayConformanceProfiles ( + IN UINT64 Address + ) +{ + SHELL_STATUS ShellStatus; + EFI_STATUS Status; + VOID *EntryPtr; + EFI_GUID *EntryGuid; + CHAR16 *GuidName; + EFI_CONFORMANCE_PROFILES_TABLE *ConfProfTable; + + ShellStatus =3D SHELL_SUCCESS; + + if (Address !=3D 0) { + Status =3D EfiGetSystemConfigurationTable (&gEfiConfProfilesTableGuid,= (VOID **)&ConfProfTable); + if (EFI_ERROR (Status)) { + ShellStatus =3D SHELL_NOT_FOUND; + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL),= gShellDebug1HiiHandle, L"ConformanceProfileTable"); + } else { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE= ), gShellDebug1HiiHandle); + + EntryPtr =3D ConfProfTable; + + EntryPtr +=3D sizeof(ConfProfTable->Version); + EntryPtr +=3D sizeof(ConfProfTable->NumberOfProfiles); + + for (int Profile =3D 0; Profile < ConfProfTable->NumberOfProfiles; P= rofile++) { + EntryGuid =3D EntryPtr; + GuidName =3D L"Unknown_Profile"; + + if (CompareGuid (EntryGuid, &gEfiConfProfilesEbbrSpecGuid)) { + GuidName =3D L"EBBR_2.1"; + } + + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_DMEM_CONF_PRO_ROW), + gShellDebug1HiiHandle, + GuidName, + EntryGuid + ); + + EntryPtr +=3D sizeof(EFI_GUID); + } + } + } else { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TAB= LE), gShellDebug1HiiHandle); + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_DMEM_CONF_PRO_ROW), + gShellDebug1HiiHandle, + L"EFI_CONFORMANCE_PROFILES_UEFI_SPEC_GUID", + &gEfiConfProfilesUefiSpecGuid + ); + } + + return (ShellStatus); +} =20 STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { { L"-mmio", TypeFlag }, @@ -464,6 +532,11 @@ ShellCommandRunDmem ( HiiDatabaseExportBufferAddress =3D (UINT64)(UINTN)gST->Confi= gurationTable[TableWalker].VendorTable; continue; } + + if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorG= uid, &gEfiConfProfilesTableGuid)) { + ConformanceProfileTableAddress =3D (UINT64)(UINTN)gST->Confi= gurationTable[TableWalker].VendorTable; + continue; + } } =20 ShellPrintHiiEx ( @@ -507,6 +580,9 @@ ShellCommandRunDmem ( if (ShellStatus =3D=3D SHELL_SUCCESS) { ShellStatus =3D DisplayImageExecutionEntries (ImageExecutionTa= bleAddress); } + if (ShellStatus =3D=3D SHELL_SUCCESS) { + ShellStatus =3D DisplayConformanceProfiles(ConformanceProfileT= ableAddress); + } } =20 } else { diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com= mandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1C= ommandsLib.uni index eee9384e3ffb..c99c881776b6 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.uni @@ -147,6 +147,11 @@ #string STR_DMEM_IMG_EXE_TABLE #language en-US "\r\nImage Execution Tab= le\r\n" "-----------------------= -----------------\r\n" #string STR_DMEM_IMG_EXE_ENTRY #language en-US "%s: %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 addre= ss not found.\r\n" #string STR_DMEM_ERR_GET_FAIL #language en-US "\r\n%H%s%N: Unable to g= et table information.\r\n" =20 --=20 2.25.1