summaryrefslogtreecommitdiffstats
path: root/PrmPkg
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2020-10-12 08:23:44 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-04-05 00:42:38 +0000
commit4a4aeaa446a28b16dba7d17af738281940a4103d (patch)
tree0c23187a6fbddbff98b4f17c76981b41d35eab11 /PrmPkg
parentf8e68587e2d1be4b1d635f6867e7fac92c153bf4 (diff)
downloadedk2-4a4aeaa446a28b16dba7d17af738281940a4103d.tar.gz
edk2-4a4aeaa446a28b16dba7d17af738281940a4103d.tar.bz2
edk2-4a4aeaa446a28b16dba7d17af738281940a4103d.zip
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>
Diffstat (limited to 'PrmPkg')
-rw-r--r--PrmPkg/Include/PrmExportDescriptor.h2
-rw-r--r--PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c12
-rw-r--r--PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf1
-rw-r--r--PrmPkg/PrmPkg.dec10
-rw-r--r--PrmPkg/Readme.md23
5 files changed, 24 insertions, 24 deletions
diff --git a/PrmPkg/Include/PrmExportDescriptor.h b/PrmPkg/Include/PrmExportDescriptor.h
index fc313fd1ac..76b67a0545 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 f78c682a65..e2779f5c17 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 7efefdae96..26e7cc1698 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 6753ac6244..94888d1c70 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 f340eeb642..4aec5982af 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: