From 4a4aeaa446a28b16dba7d17af738281940a4103d Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Mon, 12 Oct 2020 08:23:44 -0700 Subject: PrmPkg: Replace PcdPrmPlatformGuid with EDKII_DSC_PLATFORM_GUID Bugzilla request https://bugzilla.tianocore.org/show_bug.cgi?id=2969 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 Acked-by: Michael D Kinney Acked-by: Liming Gao Acked-by: Leif Lindholm Reviewed-by: Ankit Sinha --- PrmPkg/Include/PrmExportDescriptor.h | 2 ++ PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c | 12 +++++------- PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf | 1 - PrmPkg/PrmPkg.dec | 10 ---------- PrmPkg/Readme.md | 23 +++++++++++++++++------ 5 files changed, 24 insertions(+), 24 deletions(-) (limited to 'PrmPkg') diff --git a/PrmPkg/Include/PrmExportDescriptor.h b/PrmPkg/Include/PrmExportDescriptor.h index fc313fd..76b67a0 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; @@ -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.c b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c index f78c682..e2779f5 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 = NULL; - PlatformGuid = (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 unique non-zero value.\n", _DBGMSGID_, __FUNCTION__ )); - ASSERT (!CompareGuid (PlatformGuid, &gZeroGuid)); + ASSERT (!CompareGuid (&gEdkiiDscPlatformGuid, &gZeroGuid)); } DEBUG ((DEBUG_INFO, " %a %a: %d total PRM modules to process.\n", _DBGMSGID_, __FUNCTION__, mPrmModuleCount)); @@ -118,7 +116,7 @@ ProcessPrmModules ( PrmAcpiTable->Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision); PrmAcpiTable->Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId); PrmAcpiTable->Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision); - CopyGuid (&PrmAcpiTable->PrmPlatformGuid, PlatformGuid); + CopyGuid (&PrmAcpiTable->PrmPlatformGuid, &gEdkiiDscPlatformGuid); PrmAcpiTable->PrmModuleInfoOffset = OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure); PrmAcpiTable->PrmModuleInfoCount = (UINT32) mPrmModuleCount; diff --git a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf index 7efefda..26e7cc1 100644 --- a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf +++ b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf @@ -52,7 +52,6 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## CONSUMES - gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid ## CONSUMES [Protocols] gEfiAcpiTableProtocolGuid diff --git a/PrmPkg/PrmPkg.dec b/PrmPkg/PrmPkg.dec index 6753ac6..94888d1 100644 --- a/PrmPkg/PrmPkg.dec +++ b/PrmPkg/PrmPkg.dec @@ -65,13 +65,3 @@ # report PRM handler execution time in the application. If such a TimerLib # 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 updates. 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 PRM runtime - # updates are not planned for a given platform, this value should still 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 f340eeb..4aec598 100644 --- a/PrmPkg/Readme.md +++ b/PrmPkg/Readme.md @@ -13,6 +13,10 @@ to be leveraged by platform firmware with minimal overhead to integrate PRM func formal design and is not validated at product quality. The development of this feature is shared in the edk2-staging branch to simplify collaboration by allowing direct code contributions and early feedback throughout its development. +> **Use recent edk2/master** - This code makes use of a very recent change in edk2 BaseTools. Specifically, commit +[b65afdd](https://github.com/tianocore/edk2/commit/b65afdde74d6c1fac1cdbd2efdad23ba26295808). 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 specifically introduced for PRM called `PlatformRtMechanism`. Support for this OperationRegion is planned for the next release of the ACPI specification. However, support for `PlatformRtMechanism` is already included in the iASL 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** -A configuration item that requires user attention is the PRM platform GUID. Each platform that uses PRM must be -uniquely identifiable so that various instances of a PRM module can target the correct platform in PRM module updates. +PRM has a concept of a "Platform GUID" which associates a specific platform with a set of PRM modules built for +that platform. This GUID is used to ensure system compatibility for a given collection of PRM modules. + +Therefore, each PRM module must only target a single platform and each platform 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. -To apply a unique platform GUID set the following PCD to a unique value in your platform DSC file. - ``gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid`` +The PRM Platform GUID is primarily used during PRM module runtime updates in the OS to ensure that the Platform GUID +in the system's ACPI table (PRMT) matches the Platform GUID of the module requested for update. Even if runtime +updates are not a planned feature for a given platform, still assign a unique 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. -The default value assigned in [PrmPkg.dec](PrmPkg/PrmPkg.dec) is zero. By design, this is an invalid value that will -cause an ASSERT if it is not updated. +In the `PrmPkg` implementation, the Platform GUID is automatically derived from the PLATFORM_GUID in the DSC file of +the package being built. ## Overview At a high-level, PRM can be viewed from three levels of granularity: -- cgit v1.1