From d50d9e55498c7ce8826316631cd4daa9a291f8b3 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 2 Mar 2022 21:31:35 +0800 Subject: OvmfPkg: CloudHv: Retrieve RSDP address from PVH Instead of hardcoding the address of the RSDP in the firmware, let's rely on the PVH structure hvm_start_info to retrieve this information. Acked-by: Gerd Hoffmann Signed-off-by: Sebastien Boeuf Reviewed-by: Jiewen Yao --- OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 2 ++ OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c | 39 ++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 12 deletions(-) (limited to 'OvmfPkg/AcpiPlatformDxe') diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf index b36b8413e0..f22bd7cb6d 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -56,6 +56,8 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr + gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize [Depex] gEfiAcpiTableProtocolGuid diff --git a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c index 44a6bb70fe..ff59600d3e 100644 --- a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c @@ -7,9 +7,11 @@ **/ -#include // CLOUDHV_RSDP_ADDRESS -#include // CpuDeadLoop() -#include // DEBUG() +#include // CLOUDHV_RSDP_ADDRESS +#include // hvm_start_info +#include // CpuDeadLoop() +#include // DEBUG() +#include // PcdGet32() #include "AcpiPlatform.h" @@ -23,20 +25,33 @@ InstallCloudHvTables ( EFI_STATUS Status; UINTN TableHandle; - EFI_ACPI_DESCRIPTION_HEADER *Xsdt; - VOID *CurrentTableEntry; - UINTN CurrentTablePointer; - EFI_ACPI_DESCRIPTION_HEADER *CurrentTable; - UINTN Index; - UINTN NumberOfTableEntries; - EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt2Table; - EFI_ACPI_DESCRIPTION_HEADER *DsdtTable; + EFI_ACPI_DESCRIPTION_HEADER *Xsdt; + VOID *CurrentTableEntry; + UINTN CurrentTablePointer; + EFI_ACPI_DESCRIPTION_HEADER *CurrentTable; + UINTN Index; + UINTN NumberOfTableEntries; + EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt2Table; + EFI_ACPI_DESCRIPTION_HEADER *DsdtTable; + EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *AcpiRsdpStructurePtr; + UINT32 *PVHResetVectorData; + struct hvm_start_info *pvh_start_info; Fadt2Table = NULL; DsdtTable = NULL; TableHandle = 0; NumberOfTableEntries = 0; - EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *AcpiRsdpStructurePtr = (VOID *)CLOUDHV_RSDP_ADDRESS; + AcpiRsdpStructurePtr = NULL; + PVHResetVectorData = NULL; + pvh_start_info = NULL; + + PVHResetVectorData = (VOID *)(UINTN)PcdGet32 (PcdXenPvhStartOfDayStructPtr); + if (PVHResetVectorData == 0) { + return EFI_NOT_FOUND; + } + + pvh_start_info = (struct hvm_start_info *)(UINTN)PVHResetVectorData[0]; + AcpiRsdpStructurePtr = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)pvh_start_info->rsdp_paddr; // If XSDT table is found, just install its tables. // Otherwise, try to find and install the RSDT tables. -- cgit v1.2.3