[edk2-devel] [PATCH v1 19/41] PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support

Michael Kubacki mikuback at linux.microsoft.com
Tue Mar 22 16:19:25 UTC 2022


From: Michael Kubacki <michael.kubacki at microsoft.com>

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 at apple.com>
Cc: Kang Gao <kang.gao at intel.com>
Cc: Michael D Kinney <michael.d.kinney at intel.com>
Cc: Michael Kubacki <michael.kubacki at microsoft.com>
Cc: Leif Lindholm <leif at nuviainc.com>
Cc: Benjamin You <benjamin.you at intel.com>
Cc: Liu Yun <yun.y.liu at intel.com>
Cc: Ankit Sinha <ankit.sinha at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki at microsoft.com>
---
 PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87861): https://edk2.groups.io/g/devel/message/87861
Mute This Topic: https://groups.io/mt/89956001/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list