diff options
Diffstat (limited to 'OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c')
-rw-r--r-- | OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c | 97 |
1 files changed, 62 insertions, 35 deletions
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c index 0b05942..47f32e2 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;
+}
+
|