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 <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
This commit is contained in:
Michael Kubacki 2020-10-12 08:23:44 -07:00 committed by mergify[bot]
parent f8e68587e2
commit 4a4aeaa446
5 changed files with 24 additions and 24 deletions

View File

@ -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__ } \

View File

@ -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;

View File

@ -52,7 +52,6 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## CONSUMES
gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid ## CONSUMES
[Protocols]
gEfiAcpiTableProtocolGuid

View File

@ -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

View File

@ -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.
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 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.
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.
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.
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: