]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PrmPkg: Replace PcdPrmPlatformGuid with EDKII_DSC_PLATFORM_GUID
authorMichael Kubacki <michael.kubacki@microsoft.com>
Mon, 12 Oct 2020 15:23:44 +0000 (08:23 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Apr 2022 00:42:38 +0000 (00:42 +0000)
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>
PrmPkg/Include/PrmExportDescriptor.h
PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c
PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf
PrmPkg/PrmPkg.dec
PrmPkg/Readme.md

index fc313fd1acc76c6c3289678499f82ea7a73c3f27..76b67a05458a5a230d69516d1315e83648be1e9b 100644 (file)
@@ -30,6 +30,7 @@ typedef struct {
   UINT64                                Signature;\r
   UINT16                                Revision;\r
   UINT16                                NumberPrmHandlers;\r
+  GUID                                  PlatformGuid;\r
   GUID                                  ModuleGuid;\r
 } PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER;\r
 \r
@@ -98,6 +99,7 @@ typedef struct {
       PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE,                                                             \\r
       PRM_MODULE_EXPORT_REVISION,                                                                         \\r
       VA_ARG_COUNT(__VA_ARGS__),                                                                          \\r
+      EDKII_DSC_PLATFORM_GUID,                                                                            \\r
       EFI_CALLER_ID_GUID                                                                                  \\r
     },                                                                                                    \\r
     { __VA_ARGS__ }                                                                                       \\r
index f78c682a654b930912c559cee6ab87925e2dd80e..e2779f5c1786c52f6ec2f131be366f954a94c6bd 100644 (file)
@@ -53,7 +53,6 @@ ProcessPrmModules (
   OUT PRM_ACPI_DESCRIPTION_TABLE          **PrmAcpiDescriptionTable\r
   )\r
 {\r
-  EFI_GUID                                *PlatformGuid;\r
   EFI_IMAGE_EXPORT_DIRECTORY              *CurrentImageExportDirectory;\r
   PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT     *CurrentExportDescriptorStruct;\r
   PRM_ACPI_DESCRIPTION_TABLE              *PrmAcpiTable;\r
@@ -81,18 +80,17 @@ ProcessPrmModules (
   }\r
   *PrmAcpiDescriptionTable = NULL;\r
 \r
-  PlatformGuid = (EFI_GUID *) PcdGetPtr (PcdPrmPlatformGuid);\r
   //\r
-  // The platform should set PcdPrmPlatformGuid to a non-zero value\r
+  // The platform DSC GUID must be set to a non-zero value\r
   //\r
-  if (CompareGuid (PlatformGuid, &gZeroGuid)) {\r
+  if (CompareGuid (&gEdkiiDscPlatformGuid, &gZeroGuid)) {\r
     DEBUG ((\r
       DEBUG_ERROR,\r
-      "  %a %a: PcdPrmPlatformGuid must be set to a unique value in the platform DSC file.\n",\r
+      "  %a %a: The Platform GUID in the DSC file must be set to a unique non-zero value.\n",\r
       _DBGMSGID_,\r
       __FUNCTION__\r
       ));\r
-    ASSERT (!CompareGuid (PlatformGuid, &gZeroGuid));\r
+    ASSERT (!CompareGuid (&gEdkiiDscPlatformGuid, &gZeroGuid));\r
   }\r
 \r
   DEBUG ((DEBUG_INFO, "  %a %a: %d total PRM modules to process.\n", _DBGMSGID_, __FUNCTION__, mPrmModuleCount));\r
@@ -118,7 +116,7 @@ ProcessPrmModules (
   PrmAcpiTable->Header.OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);\r
   PrmAcpiTable->Header.CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);\r
   PrmAcpiTable->Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);\r
-  CopyGuid (&PrmAcpiTable->PrmPlatformGuid, PlatformGuid);\r
+  CopyGuid (&PrmAcpiTable->PrmPlatformGuid, &gEdkiiDscPlatformGuid);\r
   PrmAcpiTable->PrmModuleInfoOffset     = OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure);\r
   PrmAcpiTable->PrmModuleInfoCount      = (UINT32) mPrmModuleCount;\r
 \r
index 7efefdae960f09477e6073b869321924dc55fa42..26e7cc169897c88f44497b59950c21bb32e8c4fe 100644 (file)
@@ -52,7 +52,6 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision      ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId        ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## CONSUMES\r
-  gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid                      ## CONSUMES\r
 \r
 [Protocols]\r
   gEfiAcpiTableProtocolGuid\r
index 6753ac6244448bb36f9175c0131add914c8e66bc..94888d1c70a4f3205f4c8a597966f95aebd268bf 100644 (file)
   #  report PRM handler execution time in the application. If such a TimerLib\r
   #  instance is not available, set this PCD to FALSE in the package DSC file.\r
   gPrmPkgTokenSpaceGuid.PcdPrmInfoPrintHandlerExecutionTime|TRUE|BOOLEAN|0x00000003\r
-\r
-  ## PRM Platform GUID\r
-  #\r
-  #  Uniquely identifies a specific platform targeted for PRM module updates. Each\r
-  #  platform MUST provide a new GUID. This GUID is checked against the platform\r
-  #  GUID in the PRM module export descriptor during PRM runtime updates to determine\r
-  #  if a given PRM module update is valid for a given system. Even if PRM runtime\r
-  #  updates are not planned for a given platform, this value should still be given\r
-  #  a unique value in the platform DSC.\r
-  gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000004\r
index f340eeb6425851e55cf695d6e028407f02651234..4aec5982af54283b6817cc77a9f8e18b4ef2e605 100644 (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\r
 branch to simplify collaboration by allowing direct code contributions and early feedback throughout its development.\r
 \r
+> **Use recent edk2/master** - This code makes use of a very recent change in edk2 BaseTools. Specifically, commit\r
+[b65afdd](https://github.com/tianocore/edk2/commit/b65afdde74d6c1fac1cdbd2efdad23ba26295808). Ensure you have that\r
+change to build the code in this repo as-is.\r
+\r
 > By default, the build makes use of a new ACPI OperationRegion type specifically introduced for PRM called\r
 `PlatformRtMechanism`. Support for this OperationRegion is planned for the next release of the ACPI specification.\r
 However, support for `PlatformRtMechanism` is already included in the iASL Compiler/Disassembler for early prototyping\r
@@ -100,14 +104,21 @@ The following list are the currently defined build flags (if any) that may be pa
 ### PRM Platform GUID\r
 **IMPORTANT**\r
 \r
-A configuration item that requires user attention is the PRM platform GUID. Each platform that uses PRM must be\r
-uniquely identifiable so that various instances of a PRM module can target the correct platform in PRM module updates.\r
+PRM has a concept of a "Platform GUID" which associates a specific platform with a set of PRM modules built for\r
+that platform. This GUID is used to ensure system compatibility for a given collection of PRM modules.\r
+\r
+Therefore, each PRM module must only target a single platform and each platform must have a unique GUID. Even if a\r
+PRM module is unchanged between two different platforms now, there is no guarantee that will remain the case so always\r
+assign a unique Platform GUID for each platform.\r
 \r
-To apply a unique platform GUID set the following PCD to a unique value in your platform DSC file.\r
-  ``gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid``\r
+The PRM Platform GUID is primarily used during PRM module runtime updates in the OS to ensure that the Platform GUID\r
+in the system's ACPI table (PRMT) matches the Platform GUID of the module requested for update. Even if runtime\r
+updates are not a planned feature for a given platform, still assign a unique Platform GUID for binary module\r
+identification (the Platform GUID is in the module's export descriptor) and to ensure such updates can be seamlessly\r
+supported in the future if needed.\r
 \r
-The default value assigned in [PrmPkg.dec](PrmPkg/PrmPkg.dec) is zero. By design, this is an invalid value that will\r
-cause an ASSERT if it is not updated.\r
+In the `PrmPkg` implementation, the Platform GUID is automatically derived from the PLATFORM_GUID in the DSC file of\r
+the package being built.\r
 \r
 ## Overview\r
 At a high-level, PRM can be viewed from three levels of granularity:\r