From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id F314D7803D1 for ; Mon, 4 Mar 2024 19:31:43 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=uzMiaYwjzdN9TcyOgSsNMTtPyGIJk2d8J1GDpGSA2g4=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1709580702; v=1; b=vYgb0AePxwYBYHNIByfkrhZ4qHFjPcu/UO6R2960n0yZHkRbnLqysJYCeIftP4VJOC2GVg1p +ok+sw+kWcSbgiTm+WOkisokI0o4VPsxfvsv2HM75Lsmp9Ug+w0p/Mf2ng/TgMJb5iFVXyxe+R/ W14ZpYOGIxqS9VKMJtXYsBLM= X-Received: by 127.0.0.2 with SMTP id ZzBpYY7687511xLDFOE5JPOT; Mon, 04 Mar 2024 11:31:42 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.855.1709580701821821897 for ; Mon, 04 Mar 2024 11:31:41 -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 B57FC2F4; Mon, 4 Mar 2024 11:32:17 -0800 (PST) X-Received: from [10.119.35.208] (unknown [10.119.35.208]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 78AB03F738; Mon, 4 Mar 2024 11:31:40 -0800 (PST) Message-ID: <89d87f2e-7fc8-4123-91bb-06eb09e5e25c@arm.com> Date: Mon, 4 Mar 2024 13:31:39 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v1 3/3] ShellPkg: UefiShellDebug1CommandsLib: Conformance Profiles in Dmem.c To: Sam Kaynor , devel@edk2.groups.io Cc: Ray Ni , Zhichao Gao , Michael D Kinney , Liming Gao , Zhiguang Liu References: <20240124205605.69439-1-Sam.Kaynor@arm.com> <20240124205605.69439-4-Sam.Kaynor@arm.com> From: "Stuart Yoder" In-Reply-To: <20240124205605.69439-4-Sam.Kaynor@arm.com> 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,stuart.yoder@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: HZZYmThkWPBmPMAp1TbpRKXVx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=vYgb0AeP; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Hi Sam, See inline comments... On 1/24/24 2:56 PM, Sam Kaynor wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4352 >=20 > 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) >=20 > 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(+) >=20 > 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, { = 0x8A, 0x10, 0x50, 0x53, 0xD2, 0xBF, 0x7A, 0x1B }} > =20 > + # GUIDs defined in UEFI 2.10 > + # > + ## Include/Guid/ConformanceProfiles.h > + gEfiConfProfilesTableGuid =3D { 0x36122546, 0xf7e7, 0x4c8f, { 0= xbd, 0x9b, 0xeb, 0x85, 0x25, 0xb5, 0x0c, 0x0b }} > + gEfiConfProfilesUefiSpecGuid =3D { 0x523c91af, 0xa195, 0x4382, { 0= x81, 0x8d, 0x29, 0x5f, 0xe4, 0x00, 0x64, 0x65 }} > + gEfiConfProfilesEbbrSpecGuid =3D { 0xcce33c35, 0x74ac, 0x4087, { 0= xbc, 0xe7, 0x8b, 0x29, 0xb0, 0x2e, 0xeb, 0x27 }} > + > # > # GUID defined in PI1.0 > # > diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1C= ommandsLib.inf b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug= 1CommandsLib.inf > index 3741dac5d94c..172ac2862ba1 100644 > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands= Lib.inf > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands= Lib.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/G= uid/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) Is the "to be modified" comment supposed to be here? > +// This table allows the platform to advertise its UEFI specification co= nformance > +// in the form of pre-defined profiles. Each profile is identified by a = GUID, with > +// known profiles listed in the section below. > +// The absence of this table shall indicate that the platform implementa= tion is > +// conformant with the UEFI specification requirements, as defined in Se= ction 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, 0x= 0c, 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 s= ystem. > + /// 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/ShellPk= g/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 (&gEfiConfProfilesTableGui= d, (VOID **)&ConfProfTable); Why do you get the table address here, when it was already passed in as a parameter to this function? > + 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_TAB= LE), gShellDebug1HiiHandle); > + > + EntryPtr =3D ConfProfTable; > + > + EntryPtr +=3D sizeof(ConfProfTable->Version); > + EntryPtr +=3D sizeof(ConfProfTable->NumberOfProfiles); Similar to my comment on the exec info table I would suggest something like: EntryGuid =3D (EFI_CONFORMANCE_PROFILES_TABLE *)(ConfProfTable + 1); > + > + for (int Profile =3D 0; Profile < ConfProfTable->NumberOfProfiles;= Profile++) { > + EntryGuid =3D EntryPtr; You shouldn't need EntryPtr. I think the loop works with just the EntryGuid ptr which you increment on each iteration. > + 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); Move the above to the part of the for() loop that increments on each iteration. > + } > + } > + } else { > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_T= ABLE), 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->Co= nfigurationTable[TableWalker].VendorTable; > continue; > } > + > + if (CompareGuid (&gST->ConfigurationTable[TableWalker].Vendo= rGuid, &gEfiConfProfilesTableGuid)) { > + ConformanceProfileTableAddress =3D (UINT64)(UINTN)gST->Con= figurationTable[TableWalker].VendorTable; > + continue; > + } > } > =20 > ShellPrintHiiEx ( > @@ -507,6 +580,9 @@ ShellCommandRunDmem ( > if (ShellStatus =3D=3D SHELL_SUCCESS) { > ShellStatus =3D DisplayImageExecutionEntries (ImageExecutio= nTableAddress); > } > + if (ShellStatus =3D=3D SHELL_SUCCESS) { > + ShellStatus =3D DisplayConformanceProfiles(ConformanceProfil= eTableAddress); > + } > } > =20 > } else { > diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1C= ommandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug= 1CommandsLib.uni > index eee9384e3ffb..c99c881776b6 100644 > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands= Lib.uni > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands= Lib.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 "%s: %s\r\n" > +#string STR_DMEM_CONF_PRO_TABLE #language en-US "\r\nConformance Profi= le 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 ad= dress not found.\r\n" > #string STR_DMEM_ERR_GET_FAIL #language en-US "\r\n%H%s%N: Unable t= o get table information.\r\n" > =20 Thanks, Stuart -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116341): https://edk2.groups.io/g/devel/message/116341 Mute This Topic: https://groups.io/mt/103940860/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-