]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PrmPkg: Add PlatformGuid
authorMichael Kubacki <mikuback@microsoft.com>
Mon, 29 Jun 2020 22:54:01 +0000 (15:54 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Apr 2022 00:42:38 +0000 (00:42 +0000)
Adds a "platform GUID" field to the PRM ACPI table. This field
is used by a platform to uniquely identify itself such that it
can be targeted by runtime PRM module updates for that platform.

Platforms using PRM are currently required to set a unique value
for gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid in their platform
DSC.

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/PrmLoaderDxe/PrmAcpiTable.h
PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c
PrmPkg/PrmLoaderDxe/PrmLoaderDxe.inf
PrmPkg/PrmPkg.dec
PrmPkg/Readme.md

index ec3be529d1199690fd8b5f31d80a3faf65a1e2d4..6f9ba8f777245e7afa43c3f534f903b6b084bf2c 100644 (file)
@@ -56,6 +56,9 @@ typedef struct {
 \r
 typedef struct {\r
   EFI_ACPI_DESCRIPTION_HEADER         Header;                     ///< Standard ACPI description header\r
+  GUID                                PrmPlatformGuid;            ///< A GUID that uniquely identifies this platform.\r
+                                                                  ///< Used to check for compatibility in PRM module\r
+                                                                  ///< runtime updates.\r
   UINT32                              PrmModuleInfoOffset;        ///< Offset in bytes from the beginning of this\r
                                                                   ///< structure to the PRM Module Info array\r
   UINT32                              PrmModuleInfoCount;         ///< Number of entries in the PRM Module Info array\r
index aa7aab391e8c30cd70fabb2a09f8768326d52191..f78c682a654b930912c559cee6ab87925e2dd80e 100644 (file)
@@ -11,6 +11,7 @@
 \r
 #include "PrmAcpiTable.h"\r
 \r
+#include <Guid/ZeroGuid.h>\r
 #include <IndustryStandard/Acpi.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
@@ -52,6 +53,7 @@ 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
@@ -79,6 +81,20 @@ ProcessPrmModules (
   }\r
   *PrmAcpiDescriptionTable = NULL;\r
 \r
+  PlatformGuid = (EFI_GUID *) PcdGetPtr (PcdPrmPlatformGuid);\r
+  //\r
+  // The platform should set PcdPrmPlatformGuid to a non-zero value\r
+  //\r
+  if (CompareGuid (PlatformGuid, &gZeroGuid)) {\r
+    DEBUG ((\r
+      DEBUG_ERROR,\r
+      "  %a %a: PcdPrmPlatformGuid must be set to a unique value in the platform DSC file.\n",\r
+      _DBGMSGID_,\r
+      __FUNCTION__\r
+      ));\r
+    ASSERT (!CompareGuid (PlatformGuid, &gZeroGuid));\r
+  }\r
+\r
   DEBUG ((DEBUG_INFO, "  %a %a: %d total PRM modules to process.\n", _DBGMSGID_, __FUNCTION__, mPrmModuleCount));\r
   DEBUG ((DEBUG_INFO, "  %a %a: %d total PRM handlers to process.\n", _DBGMSGID_, __FUNCTION__, mPrmHandlerCount));\r
 \r
@@ -102,6 +118,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
   PrmAcpiTable->PrmModuleInfoOffset     = OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure);\r
   PrmAcpiTable->PrmModuleInfoCount      = (UINT32) mPrmModuleCount;\r
 \r
index 554d49685e2a839c9eca6e362c4bebefd5daba4b..7efefdae960f09477e6073b869321924dc55fa42 100644 (file)
@@ -31,6 +31,7 @@
 \r
 [Guids]\r
   gEfiEndOfDxeEventGroupGuid\r
+  gZeroGuid\r
 \r
 [LibraryClasses]\r
   BaseLib\r
@@ -51,6 +52,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision      ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId        ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## CONSUMES\r
+  gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid                      ## CONSUMES\r
 \r
 [Protocols]\r
   gEfiAcpiTableProtocolGuid\r
index 94888d1c70a4f3205f4c8a597966f95aebd268bf..6753ac6244448bb36f9175c0131add914c8e66bc 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 2a8a40c924c0a075dd01efa53fc5eda420a46ce9..40df8f00a0c826ff8be2f13985786456310cef83 100644 (file)
@@ -74,6 +74,18 @@ The following list are the currently defined build flags (if any) that may be pa
    This structure is passed as the context buffer to PRM handlers. The structure actually passed to PRM handlers is\r
    allocated and populated by the OS where it gets all the information to populate the context buffer from other structures.\r
 \r
+### 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
+\r
+To apply a unique platform GUID set the following PCD to a unique value in your platform DSC file.\r
+  ``gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid``\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
+\r
 ## Overview\r
 At a high-level, PRM can be viewed from three levels of granularity:\r
 \r