From: Michael Kubacki Date: Mon, 8 Jun 2020 23:59:01 +0000 (-0700) Subject: PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support X-Git-Tag: edk2-stable202205~149 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=be2c927d7c61bedbf898d346c536368708e57c0c PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer support 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 Cc: Kang Gao Cc: Michael D Kinney Cc: Michael Kubacki Cc: Leif Lindholm Cc: Benjamin You Cc: Liu Yun Cc: Ankit Sinha Cc: Nate DeSimone Signed-off-by: Michael Kubacki Acked-by: Michael D Kinney Acked-by: Liming Gao Acked-by: Leif Lindholm Reviewed-by: Ankit Sinha --- diff --git a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c index 433d81cf80..6416e388a6 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); }