From nobody Sat Dec 21 13:26:25 2024 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+114354+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+114354+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706129855; cv=none; d=zohomail.com; s=zohoarc; b=g8HCnaZ0qyR1dqnZft23FrCiBVnhSjs7q0gfHlZmNozv1pwx7pXP8eH5iNJSvCdtDtalQ9vsT8em+j6Rl4OBlqXcTRQXcC6NNe0xpfBvPbUTZ0FtG/gL4DUPuk5GpBX0Zyp8O/PAZK7bmdJ+B2cHYV+UOzjdXvJjVyOzl+mEMMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706129855; 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=xPAn+b2fXQQNlmgMRs96fyYmNk98OCGsjcSCnsKNiIg=; b=e7IUPKwk/3WI5C6z2+2AOwD7dugZV3gbSwni1UnvxV7mFgmjeXOPv26GmdYmSIyiSB2BxMscfYhx3XUNyh21ThKHu+7RaGb3MKWKkbjx//pPLlXEaWxykvi5lf9Zj3y+0rCDn8iJovZagr9P572Br5F2L7CmyGfJipXdO3v1dWA= 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+114354+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 1706129855845781.8080153773819; Wed, 24 Jan 2024 12:57:35 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=xPAn+b2fXQQNlmgMRs96fyYmNk98OCGsjcSCnsKNiIg=; 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=1706129855; v=1; b=E+FkSaT4o8gNTkLzThsWMdTXpmK3A0CxnRCKLhTzbCIuFGkZvAdWk118blpzL8CKPIXXX36B HjEetbMz+kYFe2fjvlVUU/GH33z33hFucXw4GHe7pgp9/87jswQ1I+DXegKAPHFMxgCL2wyxhb7 5LB3ES9R47/RXfemo/qmwcwo= X-Received: by 127.0.0.2 with SMTP id Z0BqYY1788612xs3ViGp9Lna; Wed, 24 Jan 2024 12:57:35 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.35263.1706129854231029175 for ; Wed, 24 Jan 2024 12:57:34 -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 B34D6FEC; Wed, 24 Jan 2024 12:58:18 -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 D42903F73F; Wed, 24 Jan 2024 12:57:33 -0800 (PST) From: "Sam Kaynor" To: devel@edk2.groups.io Cc: stuart.yoder@arm.com, Sam Kaynor , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v1 1/3] ShellPkg: UefiShellDebug1CommandsLib: Dumping RT Properties in Dmem.c Date: Wed, 24 Jan 2024 14:56:04 -0600 Message-Id: <20240124205605.69439-2-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: oxbzeDnoCSMYhwasJsotsOqSx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706129856441100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4352 Implemented the dumping of the UEFI RT Properties Table using Dmem.c Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Sam Kaynor --- ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c = | 62 ++++++++++++++++++++ ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni= | 22 ++++++- 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/= Library/UefiShellDebug1CommandsLib/Dmem.c index a609971f345e..1ae7b1f3d85c 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -84,8 +84,63 @@ DisplayMmioMemory ( return (ShellStatus); } =20 +/** + Display the RtPropertiesTable entries + + @param[in] Address The pointer to the RtPropertiesTable. +**/ +SHELL_STATUS +DisplayRtProperties ( + IN UINT64 Address + ) +{ + EFI_RT_PROPERTIES_TABLE *RtPropertiesTable; + UINT32 RtServices; + SHELL_STATUS ShellStatus; + EFI_STATUS Status; + + ShellStatus =3D SHELL_SUCCESS; + + if (Address !=3D 0) { + Status =3D EfiGetSystemConfigurationTable (&gEfiRtPropertiesTableGuid,= (VOID **)&RtPropertiesTable); + if (EFI_ERROR (Status)) { + ShellStatus =3D SHELL_NOT_FOUND; + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL),= gShellDebug1HiiHandle, L"RtPropertiesTable"); + } else { + RtServices =3D (UINT32)RtPropertiesTable->RuntimeServicesSupported; + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_DMEM_RT_PROPERTIES), + gShellDebug1HiiHandle, + EFI_RT_PROPERTIES_TABLE_VERSION, + (RtServices & EFI_RT_SUPPORTED_GET_TIME) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_SET_TIME) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_GET_WAKEUP_TIME) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_SET_WAKEUP_TIME) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_GET_VARIABLE) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_SET_VARIABLE) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_CONVERT_POINTER) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) ? 1 = : 0, + (RtServices & EFI_RT_SUPPORTED_RESET_SYSTEM) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_UPDATE_CAPSULE) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES) ? 1 : 0, + (RtServices & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) ? 1 : 0 + ); + } + } else { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_NOT_FOUND), = gShellDebug1HiiHandle, L"RtPropertiesTable"); + } + + return (ShellStatus); +} + STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { { L"-mmio", TypeFlag }, + { L"-verbose", TypeFlag }, { NULL, TypeMax } }; =20 @@ -308,6 +363,13 @@ ShellCommandRunDmem ( ConformanceProfileTableAddress ); } + + if (ShellCommandLineGetFlag (Package, L"-verbose")) { + if (ShellStatus =3D=3D SHELL_SUCCESS) { + ShellStatus =3D DisplayRtProperties (RtPropertiesTableAddress); + } + } + } else { ShellStatus =3D DisplayMmioMemory (Address, (UINTN)Size); } diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com= mandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1C= ommandsLib.uni index 4041f0cd483e..299b0ba44f31 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.uni @@ -126,8 +126,26 @@ "Memory Range Capsule = %016LX\r\n" "Hii Database Export Buf= fer %016LX\r\n" "Conformance Profile Tab= le %016LX\r\n" - - +#string STR_DMEM_RT_PROPERTIES #language en-US "\r\nRT Properties Table= \r\n" + "-----------------------= -----------------\r\n" + "Version 0x%01= LX\r\n" + "Runtime Services Suppor= ted:\r\n" + " GET_TIME = %d\r\n" + " GET_WAKEUP_TIME = %d\r\n" + " SET_TIME = %d\r\n" + " SET_WAKEUP_TIME = %d\r\n" + " GET_VARIABLE = %d\r\n" + " GET_NEXT_VARIABLE_NAM= E %d\r\n" + " SET_VARIABLE = %d\r\n" + " SET_VIRTUAL_ADDRESS_M= AP %d\r\n" + " CONVERT_POINTERS = %d\r\n" + " GET_NEXT_HIGH_MONOTON= IC_COUNT %d\r\n" + " RESET_SYSTEM = %d\r\n" + " UPDATE_CAPSULE = %d\r\n" + " QUERY_CAPSULE_CAPABIL= ITIES %d\r\n" + " QUERY_VARIABLE_INFO = %d\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 #string STR_LOAD_PCI_ROM_RES #language en-US "Image '%B%s%N' load res= ult: %r\r\n" #string STR_LOADPCIROM_CORRUPT #language en-US "%H%s%N: File '%B%s%N' I= mage %d is corrupt.\r\n" --=20 2.25.1 From nobody Sat Dec 21 13:26:25 2024 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+114355+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+114355+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706129857; cv=none; d=zohomail.com; s=zohoarc; b=cWgkM+tYVaHfkEmpenOp5onjuXlTcRNOZyFYrvQMj9iQo3MvLs5GraRKDlLvFcp+f/8+SrKWyCsG0jvUkE54agT+sHwgkrNrgKlKdxqcqf4xZvmlb7ecsGe90ZiI2fUBT6h+QOb9LsQWPHAT3kNIkdPVjo6MSRbr1ooCikpUChI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706129857; 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=BTb9Ih3ot3/rIw3Cd4iJhuSFEZTiSam3/QGrQx94md0=; b=KDr92nw2Dtu8Yji8OIDRAh5Yn700NY1y2jaT99O+MUgYkXAON/zWep+qVOV49iS6/nJEjZ0n/gEF64BjztVad2IPhNBV4ySeHu/WFel2IK9GzHAVHeoER76zL+gUVv0v1CypYN1GVagAYDz9f2sP+kzt9lmBiTfj9vFRZkzFW/A= 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+114355+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 1706129857406281.10549531534696; Wed, 24 Jan 2024 12:57:37 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=BTb9Ih3ot3/rIw3Cd4iJhuSFEZTiSam3/QGrQx94md0=; 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=1706129856; v=1; b=CgAD1Dg7hEEJMCIIPNWwx5R023cdwx1cL3TEZ1BWN3TUvO0W8mZuMwFtbi6tnDuW27BvoWdG zz4BUVSmuLRfrBNilZZdJWswrTpgfKwPa+xewR9Zs6jbFCE+Ta4a3BbMVsJXd3GsGJ+dQZ2kqRv sr3boGxqj8yl9+B6OlxPA2Sg= X-Received: by 127.0.0.2 with SMTP id JyzJYY1788612xVWkGrneQ4X; Wed, 24 Jan 2024 12:57:36 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.35231.1706129856154771870 for ; Wed, 24 Jan 2024 12:57:36 -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 A954E1FB; Wed, 24 Jan 2024 12:58:20 -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 C9FFB3F73F; Wed, 24 Jan 2024 12:57:35 -0800 (PST) From: "Sam Kaynor" To: devel@edk2.groups.io Cc: stuart.yoder@arm.com, Sam Kaynor , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v1 2/3] ShellPkg: UefiShellDebug1CommandsLib: Image Execution Table in Dmem.c Date: Wed, 24 Jan 2024 14:56:05 -0600 Message-Id: <20240124205605.69439-3-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: 10qAK793eptBoZitI6RRCrMvx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706129858426100005 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4352 Implemented dumping of the Image Execution Table using Dmem.c Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Sam Kaynor --- ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c = | 139 ++++++++++++++++++++ ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni= | 3 + 2 files changed, 142 insertions(+) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/= Library/UefiShellDebug1CommandsLib/Dmem.c index 1ae7b1f3d85c..5b0730b75268 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -138,6 +138,142 @@ DisplayRtProperties ( return (ShellStatus); } =20 +/** + Retrieve the ImageExecutionTable Entry ImageName from Device Path + + @param[in] Address The pointer to the ImageExecutionTable. +**/ +EFI_STATUS +GetBaseName ( + IN CHAR16 *FileName, + OUT CHAR16 **BaseName + ) +{ + UINT32 StrLen; + CHAR16 *StrTail; + + StrLen =3D StrSize(FileName); + + for (StrTail =3D FileName + StrLen - 1; StrTail !=3D FileName && *StrTai= l !=3D L'\\'; StrTail--) { + } + + if (StrTail =3D=3D FileName) { + return EFI_NOT_FOUND; + } + *BaseName =3D StrTail+1; + + return EFI_SUCCESS; +} + +/** + Retrieve the ImageExecutionTable entries + + @param[in] Address The pointer to the ImageExecutionTable. +**/ +EFI_STATUS +GetImageExecutionInfo ( + IN UINT64 Address + ) +{ + EFI_STATUS Status; + EFI_IMAGE_EXECUTION_INFO *InfoPtr; + VOID *ptr; + CHAR16 *ImagePath; + CHAR16 *ImageName; + UINTN *NumberOfImages; + CHAR16 *ActionType; + + Status =3D EfiGetSystemConfigurationTable (&gEfiImageSecurityDatabaseGui= d, &ptr); + + NumberOfImages =3D ptr; + + ptr +=3D sizeof(NumberOfImages); + + for (int Image =3D 0; Image < *NumberOfImages; Image++) { + InfoPtr =3D ptr; + ImagePath =3D ptr + sizeof(EFI_IMAGE_EXECUTION_INFO); + + GetBaseName(ImagePath,&ImageName); + + switch(InfoPtr->Action) { + case EFI_IMAGE_EXECUTION_AUTHENTICATION: + ActionType =3D L"AUTHENTICATION"; + break; + case EFI_IMAGE_EXECUTION_AUTH_UNTESTED: + ActionType =3D L"AUTHENTICATION UNTESTED"; + break; + case EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED: + ActionType =3D L"AUTHENTICATION SIGNATURE FAILED"; + break; + case EFI_IMAGE_EXECUTION_AUTH_SIG_PASSED: + ActionType =3D L"AUTHENTICATION SIGNATURE PASSED"; + break; + case EFI_IMAGE_EXECUTION_AUTH_SIG_NOT_FOUND: + ActionType =3D L"AUTHENTICATION SIGNATURE NOT FOUND"; + break; + case EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND: + ActionType =3D L"AUTHENTICATION SIGNATURE FOUND"; + break; + case EFI_IMAGE_EXECUTION_POLICY_FAILED: + ActionType =3D L"POILCY FAILED"; + break; + case EFI_IMAGE_EXECUTION_INITIALIZED: + ActionType =3D L"INITIALIZED"; + break; + default: + ActionType =3D L"invalid action"; + } + + ShellPrintHiiEx( + -1, + -1, + NULL, + STRING_TOKEN (STR_DMEM_IMG_EXE_ENTRY), + gShellDebug1HiiHandle, + ImageName, + ActionType + ); + + ptr +=3D InfoPtr->InfoSize; + } + + return Status; +} + +/** + Display the ImageExecutionTable entries + + @param[in] Address The pointer to the ImageExecutionTable. +**/ +SHELL_STATUS +DisplayImageExecutionEntries ( + IN UINT64 Address + ) +{ + EFI_IMAGE_EXECUTION_INFO_TABLE *ImageExecutionTable; + SHELL_STATUS ShellStatus; + EFI_STATUS Status; + + ShellStatus =3D SHELL_SUCCESS; + + if (Address !=3D 0) { + Status =3D EfiGetSystemConfigurationTable (&gEfiImageSecurityDatabaseG= uid, (VOID **)&ImageExecutionTable); + if (EFI_ERROR (Status)) { + ShellStatus =3D SHELL_NOT_FOUND; + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL),= gShellDebug1HiiHandle, L"ImageExecutionTable"); + } else { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_IMG_EXE_TABLE)= , gShellDebug1HiiHandle); + Status =3D GetImageExecutionInfo(Address); + } + } else { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_NOT_FOUND), = gShellDebug1HiiHandle, L"ImageExecutionTable"); + } + + return (ShellStatus); +} + + + STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { { L"-mmio", TypeFlag }, { L"-verbose", TypeFlag }, @@ -368,6 +504,9 @@ ShellCommandRunDmem ( if (ShellStatus =3D=3D SHELL_SUCCESS) { ShellStatus =3D DisplayRtProperties (RtPropertiesTableAddress); } + if (ShellStatus =3D=3D SHELL_SUCCESS) { + ShellStatus =3D DisplayImageExecutionEntries (ImageExecutionTa= bleAddress); + } } =20 } else { diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com= mandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1C= ommandsLib.uni index 299b0ba44f31..eee9384e3ffb 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.uni @@ -144,6 +144,9 @@ " UPDATE_CAPSULE = %d\r\n" " QUERY_CAPSULE_CAPABIL= ITIES %d\r\n" " QUERY_VARIABLE_INFO = %d\r\n" +#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_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 From nobody Sat Dec 21 13:26:25 2024 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