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
This commit is contained in:
@ -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.
|
||||
Find ACPI tables in an FV and parses them. This function is useful for QEMU and KVM.
|
||||
|
||||
@param ImageHandle
|
||||
@param SystemTable
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user