}\r
}\r
\r
+ //\r
+ // Install a protocol to notify that the ACPI table provided by Qemu is\r
+ // ready.\r
+ //\r
+ QemuAcpiHandle = NULL;\r
+ Status = gBS->InstallProtocolInterface (\r
+ &QemuAcpiHandle,\r
+ &gQemuAcpiTableNotifyProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto UninstallAcpiTables;\r
+ }\r
+\r
//\r
// Translating the condensed QEMU_LOADER_WRITE_POINTER commands to ACPI S3\r
// Boot Script opcodes has to be the last operation in this function, because\r
if (S3Context != NULL) {\r
Status = TransferS3ContextToBootScript (S3Context);\r
if (EFI_ERROR (Status)) {\r
- goto UninstallAcpiTables;\r
+ goto UninstallQemuAcpiTableNotifyProtocol;\r
}\r
\r
//\r
\r
DEBUG ((DEBUG_INFO, "%a: installed %d tables\n", __FUNCTION__, Installed));\r
\r
+UninstallQemuAcpiTableNotifyProtocol:\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->UninstallProtocolInterface (\r
+ QemuAcpiHandle,\r
+ &gQemuAcpiTableNotifyProtocolGuid,\r
+ NULL\r
+ );\r
+ }\r
+\r
UninstallAcpiTables:\r
if (EFI_ERROR (Status)) {\r
//\r
--Installed;\r
AcpiProtocol->UninstallAcpiTable (AcpiProtocol, InstalledKey[Installed]);\r
}\r
- } else {\r
- //\r
- // Install a protocol to notify that the ACPI table provided by Qemu is\r
- // ready.\r
- //\r
- QemuAcpiHandle = NULL;\r
- gBS->InstallProtocolInterface (\r
- &QemuAcpiHandle,\r
- &gQemuAcpiTableNotifyProtocolGuid,\r
- EFI_NATIVE_INTERFACE,\r
- NULL\r
- );\r
}\r
\r
for (SeenPointerEntry = OrderedCollectionMin (SeenPointers);\r