]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support
authorMichael Kubacki <michael.kubacki@microsoft.com>
Mon, 8 Jun 2020 23:59:01 +0000 (16:59 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Apr 2022 00:42:38 +0000 (00:42 +0000)
Adds support to PrmLoaderDxe to move the ACPI parameter buffer
address for a given PRM handler to the corresponding field
in the PRM handler information structure (PRMT ACPI table).

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/PrmLoaderDxe.c

index 433d81cf8009a7100edde185ff261d1eb0f349d5..6416e388a668200a2f110a3296cfc85cd9a8fef3 100644 (file)
@@ -621,6 +621,7 @@ ProcessPrmModules (
   PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY     *TempListEntry;\r
   CONST CHAR8                             *CurrentExportDescriptorHandlerName;\r
 \r
+  ACPI_PARAMETER_BUFFER_DESCRIPTOR        *CurrentModuleAcpiParamDescriptors;\r
   PRM_CONTEXT_BUFFER                      *CurrentContextBuffer;\r
   PRM_MODULE_CONTEXT_BUFFERS              *CurrentModuleContextBuffers;\r
   PRM_MODULE_INFORMATION_STRUCT           *CurrentModuleInfoStruct;\r
@@ -628,6 +629,7 @@ ProcessPrmModules (
 \r
   EFI_STATUS                              Status;\r
   EFI_PHYSICAL_ADDRESS                    CurrentImageAddress;\r
+  UINTN                                   AcpiParamIndex;\r
   UINTN                                   HandlerIndex;\r
   UINT32                                  PrmAcpiDescriptionTableBufferSize;\r
 \r
@@ -677,6 +679,7 @@ ProcessPrmModules (
     CurrentImageAddress = TempListEntry->Context->PeCoffImageContext.ImageAddress;\r
     CurrentImageExportDirectory = TempListEntry->Context->ExportDirectory;\r
     CurrentExportDescriptorStruct = TempListEntry->Context->ExportDescriptor;\r
+    CurrentModuleAcpiParamDescriptors = NULL;\r
 \r
     DEBUG ((\r
       DEBUG_INFO,\r
@@ -715,6 +718,7 @@ ProcessPrmModules (
     ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);\r
     if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {\r
       CurrentModuleInfoStruct->RuntimeMmioRanges = (UINT64) (UINTN) CurrentModuleContextBuffers->RuntimeMmioRanges;\r
+      CurrentModuleAcpiParamDescriptors = CurrentModuleContextBuffers->AcpiParameterBufferDescriptors;\r
     }\r
 \r
     //\r
@@ -759,6 +763,19 @@ ProcessPrmModules (
           CurrentHandlerInfoStruct->PhysicalAddress\r
           ));\r
       }\r
+\r
+      //\r
+      // Update the handler ACPI parameter buffer address if applicable\r
+      //\r
+      if (CurrentModuleAcpiParamDescriptors != NULL) {\r
+        for (AcpiParamIndex = 0; AcpiParamIndex < CurrentModuleContextBuffers->AcpiParameterBufferDescriptorCount; AcpiParamIndex++) {\r
+          if (CompareGuid (&CurrentModuleAcpiParamDescriptors[AcpiParamIndex].HandlerGuid, &CurrentHandlerInfoStruct->Identifier)) {\r
+            CurrentHandlerInfoStruct->AcpiParameterBuffer = (UINT64) (UINTN) (\r
+                                                              CurrentModuleAcpiParamDescriptors[AcpiParamIndex].AcpiParameterBufferAddress\r
+                                                              );\r
+          }\r
+        }\r
+      }\r
     }\r
     CurrentModuleInfoStruct = (PRM_MODULE_INFORMATION_STRUCT *) ((UINTN) CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength);\r
   }\r