From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.12303.1647966181766098755 for ; Tue, 22 Mar 2022 09:23:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=TN0yVWqT; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [47.202.59.224]) by linux.microsoft.com (Postfix) with ESMTPSA id 7299520DE481; Tue, 22 Mar 2022 09:23:00 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7299520DE481 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1647966181; bh=e4Vmj1u+irl3ZhwAR24ZcEZxas1mD94FfhYFfo1Ee+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TN0yVWqTQ67Ah1H9e8d6Kqsh+6OK6dJTIPZdfdSn1idkc+SvX2eXTWJ08SmSJtJnI m+mkWLQAW9MAaiI8nRe5jejZ8RDScGzsSfHgK8k3+BaOzymeLzzlfkewjRR5PfEFyT LJ8pjmlTNiPPKASNJMOtE4xoxYIk7etDl3koUNqU= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Andrew Fish , Kang Gao , Michael D Kinney , Michael Kubacki , Leif Lindholm , Benjamin You , Liu Yun , Ankit Sinha , Nate DeSimone Subject: [PATCH v1 35/41] PrmPkg: Replace PcdPrmPlatformGuid with EDKII_DSC_PLATFORM_GUID Date: Tue, 22 Mar 2022 12:19:41 -0400 Message-Id: <20220322161947.9319-36-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20220322161947.9319-1-mikuback@linux.microsoft.com> References: <20220322161947.9319-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki Bugzilla request https://bugzilla.tianocore.org/show_bug.cgi?id=3D2969 was recently completed which causes the PLATFORM_GUID value from the DSC file to be placed into Autogen file .c & .h files. With this change, the PRM Platform GUID can be directly matched to the DSC PLATFORM_GUID value. Cc: Andrew Fish Cc: Kang Gao Cc: Michael D Kinney Cc: Michael Kubacki Cc: Leif Lindholm Cc: Benjamin You Cc: Liu Yun Cc: Ankit Sinha Cc: Nate DeSimone Signed-off-by: Michael Kubacki --- PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c | 12 +++++----- PrmPkg/Include/PrmExportDescriptor.h | 2 ++ PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf | 1 - PrmPkg/PrmPkg.dec | 10 --------- PrmPkg/Readme.md | 23 +++++++++++++++----- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c b/PrmPkg/PrmLoaderDxe/Prm= LoaderDxe.c index f78c682a654b..e2779f5c1786 100644 --- a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c +++ b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c @@ -53,7 +53,6 @@ ProcessPrmModules ( OUT PRM_ACPI_DESCRIPTION_TABLE **PrmAcpiDescriptionTable ) { - EFI_GUID *PlatformGuid; EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory; PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct= ; PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiTable; @@ -81,18 +80,17 @@ ProcessPrmModules ( } *PrmAcpiDescriptionTable =3D NULL; =20 - PlatformGuid =3D (EFI_GUID *) PcdGetPtr (PcdPrmPlatformGuid); // - // The platform should set PcdPrmPlatformGuid to a non-zero value + // The platform DSC GUID must be set to a non-zero value // - if (CompareGuid (PlatformGuid, &gZeroGuid)) { + if (CompareGuid (&gEdkiiDscPlatformGuid, &gZeroGuid)) { DEBUG (( DEBUG_ERROR, - " %a %a: PcdPrmPlatformGuid must be set to a unique value in the = platform DSC file.\n", + " %a %a: The Platform GUID in the DSC file must be set to a uniqu= e non-zero value.\n", _DBGMSGID_, __FUNCTION__ )); - ASSERT (!CompareGuid (PlatformGuid, &gZeroGuid)); + ASSERT (!CompareGuid (&gEdkiiDscPlatformGuid, &gZeroGuid)); } =20 DEBUG ((DEBUG_INFO, " %a %a: %d total PRM modules to process.\n", _DB= GMSGID_, __FUNCTION__, mPrmModuleCount)); @@ -118,7 +116,7 @@ ProcessPrmModules ( PrmAcpiTable->Header.OemRevision =3D PcdGet32 (PcdAcpiDefaultOemR= evision); PrmAcpiTable->Header.CreatorId =3D PcdGet32 (PcdAcpiDefaultCrea= torId); PrmAcpiTable->Header.CreatorRevision =3D PcdGet32 (PcdAcpiDefaultCrea= torRevision); - CopyGuid (&PrmAcpiTable->PrmPlatformGuid, PlatformGuid); + CopyGuid (&PrmAcpiTable->PrmPlatformGuid, &gEdkiiDscPlatformGuid); PrmAcpiTable->PrmModuleInfoOffset =3D OFFSET_OF (PRM_ACPI_DESCRIPT= ION_TABLE, PrmModuleInfoStructure); PrmAcpiTable->PrmModuleInfoCount =3D (UINT32) mPrmModuleCount; =20 diff --git a/PrmPkg/Include/PrmExportDescriptor.h b/PrmPkg/Include/PrmExp= ortDescriptor.h index fc313fd1acc7..76b67a05458a 100644 --- a/PrmPkg/Include/PrmExportDescriptor.h +++ b/PrmPkg/Include/PrmExportDescriptor.h @@ -30,6 +30,7 @@ typedef struct { UINT64 Signature; UINT16 Revision; UINT16 NumberPrmHandlers; + GUID PlatformGuid; GUID ModuleGuid; } PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER; =20 @@ -98,6 +99,7 @@ typedef struct { PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE, = \ PRM_MODULE_EXPORT_REVISION, = \ VA_ARG_COUNT(__VA_ARGS__), = \ + EDKII_DSC_PLATFORM_GUID, = \ EFI_CALLER_ID_GUID = \ }, = \ { __VA_ARGS__ } = \ diff --git a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf b/PrmPkg/PrmLoaderDxe/P= rmLoaderDxe.inf index 7efefdae960f..26e7cc169897 100644 --- a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf +++ b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf @@ -52,7 +52,6 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision ## CONSU= MES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## CONSU= MES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## CONSU= MES - gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid ## CONSU= MES =20 [Protocols] gEfiAcpiTableProtocolGuid diff --git a/PrmPkg/PrmPkg.dec b/PrmPkg/PrmPkg.dec index 6753ac624444..94888d1c70a4 100644 --- a/PrmPkg/PrmPkg.dec +++ b/PrmPkg/PrmPkg.dec @@ -65,13 +65,3 @@ [PcdsFixedAtBuild] # report PRM handler execution time in the application. If such a Tim= erLib # instance is not available, set this PCD to FALSE in the package DSC= file. gPrmPkgTokenSpaceGuid.PcdPrmInfoPrintHandlerExecutionTime|TRUE|BOOLEAN= |0x00000003 - - ## PRM Platform GUID - # - # Uniquely identifies a specific platform targeted for PRM module upd= ates. Each - # platform MUST provide a new GUID. This GUID is checked against the = platform - # GUID in the PRM module export descriptor during PRM runtime updates= to determine - # if a given PRM module update is valid for a given system. Even if P= RM runtime - # updates are not planned for a given platform, this value should sti= ll be given - # a unique value in the platform DSC. - gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid|{0x00, 0x00, 0x00, 0x00, 0x00= , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*= |0x00000004 diff --git a/PrmPkg/Readme.md b/PrmPkg/Readme.md index f340eeb64258..4aec5982af54 100644 --- a/PrmPkg/Readme.md +++ b/PrmPkg/Readme.md @@ -13,6 +13,10 @@ to be leveraged by platform firmware with minimal over= head to integrate PRM func formal design and is not validated at product quality. The development o= f this feature is shared in the edk2-staging branch to simplify collaboration by allowing direct code contributions a= nd early feedback throughout its development. =20 +> **Use recent edk2/master** - This code makes use of a very recent chan= ge in edk2 BaseTools. Specifically, commit +[b65afdd](https://github.com/tianocore/edk2/commit/b65afdde74d6c1fac1cdb= d2efdad23ba26295808). Ensure you have that +change to build the code in this repo as-is. + > By default, the build makes use of a new ACPI OperationRegion type spe= cifically introduced for PRM called `PlatformRtMechanism`. Support for this OperationRegion is planned for t= he next release of the ACPI specification. However, support for `PlatformRtMechanism` is already included in the iA= SL Compiler/Disassembler for early prototyping @@ -100,14 +104,21 @@ The following list are the currently defined build = flags (if any) that may be pa ### PRM Platform GUID **IMPORTANT** =20 -A configuration item that requires user attention is the PRM platform GU= ID. Each platform that uses PRM must be -uniquely identifiable so that various instances of a PRM module can targ= et the correct platform in PRM module updates. +PRM has a concept of a "Platform GUID" which associates a specific platf= orm with a set of PRM modules built for +that platform. This GUID is used to ensure system compatibility for a gi= ven collection of PRM modules. =20 -To apply a unique platform GUID set the following PCD to a unique value = in your platform DSC file. - ``gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid`` +Therefore, each PRM module must only target a single platform and each p= latform must have a unique GUID. Even if a +PRM module is unchanged between two different platforms now, there is no= guarantee that will remain the case so always +assign a unique Platform GUID for each platform. =20 -The default value assigned in [PrmPkg.dec](PrmPkg/PrmPkg.dec) is zero. B= y design, this is an invalid value that will -cause an ASSERT if it is not updated. +The PRM Platform GUID is primarily used during PRM module runtime update= s in the OS to ensure that the Platform GUID +in the system's ACPI table (PRMT) matches the Platform GUID of the modul= e requested for update. Even if runtime +updates are not a planned feature for a given platform, still assign a u= nique Platform GUID for binary module +identification (the Platform GUID is in the module's export descriptor) = and to ensure such updates can be seamlessly +supported in the future if needed. + +In the `PrmPkg` implementation, the Platform GUID is automatically deriv= ed from the PLATFORM_GUID in the DSC file of +the package being built. =20 ## Overview At a high-level, PRM can be viewed from three levels of granularity: --=20 2.28.0.windows.1