]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c
PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support
[mirror_edk2.git] / 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