summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-18 22:33:33 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-18 22:33:33 +0000
commit377e758c3f10216c2638a3ae4bc75fd4d70fbfef (patch)
tree5d128cc410c83db14c6ead4dd43f6e7dd8ddac25 /OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
parentad07c107f752a1ff71a22660afa2b9f8bcaaec9a (diff)
downloadedk2-377e758c3f10216c2638a3ae4bc75fd4d70fbfef.tar.gz
edk2-377e758c3f10216c2638a3ae4bc75fd4d70fbfef.tar.bz2
edk2-377e758c3f10216c2638a3ae4bc75fd4d70fbfef.zip
OvmfPkg/AcpiPlatformDxe: Add Xen ACPI tables support
This patch adds Xen ACPI tables support to OVMF. Use EFI_ACPI_TABLE_PROTOCOL to publish all Xen ACPI tables in OVMF, while keeping the Qemu and KVM support. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bei Guan <gbtju85@gmail.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13541 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c')
-rw-r--r--OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c97
1 files changed, 62 insertions, 35 deletions
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
index 0b05942f71..47f32e2f76 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
@@ -78,12 +78,9 @@ LocateFvInstanceWithTables (
return Status;
}
-
-
//
// Looking for FV with ACPI storage file
//
-
for (Index = 0; Index < NumberOfHandles; Index++) {
//
// Get the protocol on this handle
@@ -160,52 +157,34 @@ AcpiPlatformChecksum (
Buffer[ChecksumOffset] = CalculateCheckSum8(Buffer, Size);
}
-
/**
- Entrypoint of Acpi Platform driver.
-
- @param ImageHandle
- @param SystemTable
+ Find ACPI tables in an FV and parses them. This function is useful for QEMU and KVM.
- @return EFI_SUCCESS
- @return EFI_LOAD_ERROR
- @return EFI_OUT_OF_RESOURCES
+ @param AcpiTable Protocol instance pointer
**/
EFI_STATUS
EFIAPI
-AcpiPlatformEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+FindAcpiTablesInFv (
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
)
{
- EFI_STATUS Status;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
- INTN Instance;
- EFI_ACPI_COMMON_HEADER *CurrentTable;
- UINTN TableHandle;
- UINT32 FvStatus;
- UINTN TableSize;
- UINTN Size;
- EFI_ACPI_TABLE_INSTALL_ACPI_TABLE TableInstallFunction;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *CurrentTable;
+ UINTN TableHandle;
+ UINT32 FvStatus;
+ UINTN TableSize;
+ UINTN Size;
+ EFI_ACPI_TABLE_INSTALL_ACPI_TABLE TableInstallFunction;
Instance = 0;
CurrentTable = NULL;
TableHandle = 0;
- //
- // Find the AcpiTable protocol
- //
- Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
if (QemuDetected ()) {
TableInstallFunction = QemuInstallAcpiTable;
- } else if (XenDetected ()) {
- TableInstallFunction = XenInstallAcpiTable;
} else {
TableInstallFunction = InstallAcpiTable;
}
@@ -231,7 +210,7 @@ AcpiPlatformEntryPoint (
&Size,
&FvStatus
);
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
//
// Add the table
//
@@ -275,3 +254,51 @@ AcpiPlatformEntryPoint (
return EFI_SUCCESS;
}
+/**
+ Entrypoint of Acpi Platform driver.
+
+ @param ImageHandle
+ @param SystemTable
+
+ @return EFI_SUCCESS
+ @return EFI_LOAD_ERROR
+ @return EFI_OUT_OF_RESOURCES
+
+**/
+EFI_STATUS
+EFIAPI
+AcpiPlatformEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+ //
+ // Find the AcpiTable protocol
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiAcpiTableProtocolGuid,
+ NULL,
+ (VOID**)&AcpiTable
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+
+ if (XenDetected ()) {
+ Status = InstallXenTables (AcpiTable);
+ if (EFI_ERROR (Status)) {
+ Status = FindAcpiTablesInFv (AcpiTable);
+ }
+ } else {
+ Status = FindAcpiTablesInFv (AcpiTable);
+ }
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
+