diff options
author | Corvin Köhne <corvink@freebsd.org> | 2023-06-06 11:21:38 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-06-06 10:55:41 +0000 |
commit | 1288c5415c81af7b184567c7cb02b59aeb662be9 (patch) | |
tree | 02970f6da36c6aac71a5b2518159e24c711fbb37 /OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c | |
parent | f211292711e53501c713fc38658522b695fb53de (diff) | |
download | edk2-1288c5415c81af7b184567c7cb02b59aeb662be9.tar.gz |
OvmfPkg/Xen: export AcpiTable installation into AcpiPlatformLib
This makes the function reuseable by bhyve.
Signed-off-by: Corvin Köhne <corvink@FreeBSD.org>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c')
-rw-r--r-- | OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c index e06bb25dfc..2dbc812953 100644 --- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c +++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c @@ -7,10 +7,15 @@ **/
-#include <Library/XenPlatformLib.h> // XenDetected()
+#include <Library/AcpiPlatformLib.h> // InstallAcpiTablesFromMemory()
+#include <Library/DebugLib.h> // DEBUG()
+#include <Library/XenPlatformLib.h> // XenDetected()
#include "AcpiPlatform.h"
+#define XEN_ACPI_PHYSICAL_ADDRESS 0x000EA020
+#define XEN_BIOS_PHYSICAL_END 0x000FFFFF
+
/**
Effective entrypoint of Acpi Platform driver.
@@ -28,10 +33,46 @@ InstallAcpiTables ( IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
)
{
- EFI_STATUS Status;
+ EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdpStructurePtr;
+ EFI_XEN_INFO *XenInfo;
+ EFI_STATUS Status;
if (XenDetected ()) {
- Status = InstallXenTables (AcpiTable);
+ //
+ // Detect the RSDP structure
+ //
+
+ //
+ // First look for PVH one
+ //
+ XenInfo = XenGetInfoHOB ();
+ ASSERT (XenInfo != NULL);
+ if (XenInfo->RsdpPvh != NULL) {
+ DEBUG ((
+ DEBUG_INFO,
+ "%a: Use ACPI RSDP table at 0x%p\n",
+ gEfiCallerBaseName,
+ XenInfo->RsdpPvh
+ ));
+ RsdpStructurePtr = XenInfo->RsdpPvh;
+ } else {
+ //
+ // Otherwise, look for the HVM one
+ //
+ Status = GetAcpiRsdpFromMemory (
+ XEN_ACPI_PHYSICAL_ADDRESS,
+ XEN_BIOS_PHYSICAL_END,
+ &RsdpStructurePtr
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ Status = InstallAcpiTablesFromRsdp (
+ AcpiTable,
+ RsdpStructurePtr
+ );
} else {
Status = EFI_UNSUPPORTED;
}
|