diff options
Diffstat (limited to 'OvmfPkg/AcpiPlatformDxe')
-rw-r--r-- | OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c index 4629214666..f0d81d6fd7 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -1248,6 +1248,21 @@ InstallQemuFwCfgTables ( }
//
+ // Install a protocol to notify that the ACPI table provided by Qemu is
+ // ready.
+ //
+ QemuAcpiHandle = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &QemuAcpiHandle,
+ &gQemuAcpiTableNotifyProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto UninstallAcpiTables;
+ }
+
+ //
// Translating the condensed QEMU_LOADER_WRITE_POINTER commands to ACPI S3
// Boot Script opcodes has to be the last operation in this function, because
// if it succeeds, it cannot be undone.
@@ -1255,7 +1270,7 @@ InstallQemuFwCfgTables ( if (S3Context != NULL) {
Status = TransferS3ContextToBootScript (S3Context);
if (EFI_ERROR (Status)) {
- goto UninstallAcpiTables;
+ goto UninstallQemuAcpiTableNotifyProtocol;
}
//
@@ -1266,6 +1281,15 @@ InstallQemuFwCfgTables ( DEBUG ((DEBUG_INFO, "%a: installed %d tables\n", __FUNCTION__, Installed));
+UninstallQemuAcpiTableNotifyProtocol:
+ if (EFI_ERROR (Status)) {
+ gBS->UninstallProtocolInterface (
+ QemuAcpiHandle,
+ &gQemuAcpiTableNotifyProtocolGuid,
+ NULL
+ );
+ }
+
UninstallAcpiTables:
if (EFI_ERROR (Status)) {
//
@@ -1275,18 +1299,6 @@ UninstallAcpiTables: --Installed;
AcpiProtocol->UninstallAcpiTable (AcpiProtocol, InstalledKey[Installed]);
}
- } else {
- //
- // Install a protocol to notify that the ACPI table provided by Qemu is
- // ready.
- //
- QemuAcpiHandle = NULL;
- gBS->InstallProtocolInterface (
- &QemuAcpiHandle,
- &gQemuAcpiTableNotifyProtocolGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
}
for (SeenPointerEntry = OrderedCollectionMin (SeenPointers);
|