]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
MdeModulePkg CapsuleApp: Fix VS2012 build failure caused by 5410502
[mirror_edk2.git] / ArmVirtPkg / PlatformHasAcpiDtDxe / PlatformHasAcpiDtDxe.c
index a718ce1b5a7b28fe690aa5360813f6a3cc9f007d..da3cee645cfbe8597aa543067f998e621b8d95ad 100644 (file)
@@ -18,6 +18,7 @@
 #include <Library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/QemuFwCfgLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 \r
 EFI_STATUS\r
@@ -27,18 +28,28 @@ PlatformHasAcpiDt (
   IN EFI_SYSTEM_TABLE *SystemTable\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
-  Status = EFI_SUCCESS;\r
+  EFI_STATUS           Status;\r
+  FIRMWARE_CONFIG_ITEM FwCfgItem;\r
+  UINTN                FwCfgSize;\r
 \r
   //\r
   // If we fail to install any of the necessary protocols below, the OS will be\r
   // unbootable anyway (due to lacking hardware description), so tolerate no\r
   // errors here.\r
   //\r
-  // Always make ACPI available on 64-bit systems.\r
-  //\r
-  if (MAX_UINTN == MAX_UINT64) {\r
+  if (MAX_UINTN == MAX_UINT64 &&\r
+      !PcdGetBool (PcdForceNoAcpi) &&\r
+      !EFI_ERROR (\r
+         QemuFwCfgFindFile (\r
+           "etc/table-loader",\r
+           &FwCfgItem,\r
+           &FwCfgSize\r
+           )\r
+         )) {\r
+    //\r
+    // Only make ACPI available on 64-bit systems, and only if QEMU generates\r
+    // (a subset of) the ACPI tables.\r
+    //\r
     Status = gBS->InstallProtocolInterface (\r
                     &ImageHandle,\r
                     &gEdkiiPlatformHasAcpiGuid,\r
@@ -48,21 +59,21 @@ PlatformHasAcpiDt (
     if (EFI_ERROR (Status)) {\r
       goto Failed;\r
     }\r
+\r
+    return Status;\r
   }\r
 \r
   //\r
-  // Expose the Device Tree unless PcdPureAcpiBoot is set.\r
+  // Expose the Device Tree otherwise.\r
   //\r
-  if (!FeaturePcdGet (PcdPureAcpiBoot)) {\r
-    Status = gBS->InstallProtocolInterface (\r
-                    &ImageHandle,\r
-                    &gEdkiiPlatformHasDeviceTreeGuid,\r
-                    EFI_NATIVE_INTERFACE,\r
-                    NULL\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      goto Failed;\r
-    }\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &ImageHandle,\r
+                  &gEdkiiPlatformHasDeviceTreeGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  NULL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Failed;\r
   }\r
 \r
   return Status;\r