]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/VirtFdtDxe: make installation of FDT as config table optional
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 31 Mar 2016 11:00:07 +0000 (13:00 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 31 Mar 2016 14:37:33 +0000 (16:37 +0200)
The arm64 kernel is hardwired to prefer DT over ACPI, unless 'acpi=force'
is passed on the kernel command line. The only other way to force the
kernel to use ACPI is not to pass an FDT to it in the first place. So
introduce a PCD that inhibits the installation of the QEMU supplied FDT
as a configuration table.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ArmVirtPkg/ArmVirtPkg.dec
ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf

index 89e8448a8443652525e83e20b7a6349bfea608a4..b6ff63677837fe02e41c599e90efba0a8e4e58f7 100644 (file)
   # The default is to turn off the kludge; DSC's can selectively enable it.\r
   #\r
   gArmVirtTokenSpaceGuid.PcdKludgeMapPciMmioAsCached|FALSE|BOOLEAN|0x00000006\r
+\r
+  #\r
+  # Pure ACPI boot\r
+  #\r
+  # Inhibit installation of the FDT as a configuration table if this feature\r
+  # PCD is TRUE. Otherwise, the OS is presented with both a DT and an ACPI\r
+  # description of the platform, and it is up to the OS to choose.\r
+  #\r
+  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot|FALSE|BOOLEAN|0x0000000a\r
index 437b2a8792160626d826970bde84d6c8da67db4d..d3043fa9b877da9636ca5d859ec0108ddd57f749 100644 (file)
@@ -317,9 +317,6 @@ InitializeVirtFdtDxe (
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
   DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, DeviceTreeBase));\r
 \r
   RtcNode = -1;\r
@@ -571,39 +568,47 @@ InitializeVirtFdtDxe (
     }\r
   }\r
 \r
-  //\r
-  // UEFI takes ownership of the RTC hardware, and exposes its functionality\r
-  // through the UEFI Runtime Services GetTime, SetTime, etc. This means we\r
-  // need to disable it in the device tree to prevent the OS from attaching its\r
-  // device driver as well.\r
-  //\r
-  if ((RtcNode != -1) &&\r
-      fdt_setprop_string (DeviceTreeBase, RtcNode, "status",\r
-        "disabled") != 0) {\r
-    DEBUG ((EFI_D_WARN, "Failed to set PL031 status to 'disabled'\n"));\r
-  }\r
-\r
-  if (HavePci) {\r
+  if (!FeaturePcdGet (PcdPureAcpiBoot)) {\r
+    //\r
+    // Only install the FDT as a configuration table if we want to leave it up\r
+    // to the OS to decide whether it prefers ACPI over DT.\r
     //\r
-    // Set the /chosen/linux,pci-probe-only property to 1, so that the PCI\r
-    // setup we will perform in the firmware is honored by the Linux OS,\r
-    // rather than torn down and done from scratch. This is generally a more\r
-    // sensible approach, and aligns with what ACPI based OSes do in general.\r
+    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
     //\r
-    // In case we are exposing an emulated VGA PCI device to the guest, which\r
-    // may subsequently get exposed via the Graphics Output protocol and\r
-    // driven as an efifb by Linux, we need this setting to prevent the\r
-    // framebuffer from becoming unresponsive.\r
+    // UEFI takes ownership of the RTC hardware, and exposes its functionality\r
+    // through the UEFI Runtime Services GetTime, SetTime, etc. This means we\r
+    // need to disable it in the device tree to prevent the OS from attaching its\r
+    // device driver as well.\r
     //\r
-    Node = fdt_path_offset (DeviceTreeBase, "/chosen");\r
-    if (Node < 0) {\r
-      Node = fdt_add_subnode (DeviceTreeBase, 0, "/chosen");\r
+    if ((RtcNode != -1) &&\r
+        fdt_setprop_string (DeviceTreeBase, RtcNode, "status",\r
+          "disabled") != 0) {\r
+      DEBUG ((EFI_D_WARN, "Failed to set PL031 status to 'disabled'\n"));\r
     }\r
-    if (Node < 0 ||\r
-        fdt_setprop_u32 (DeviceTreeBase, Node, "linux,pci-probe-only", 1) < 0) {\r
-      DEBUG ((EFI_D_WARN, "Failed to set /chosen/linux,pci-probe-only property\n"));\r
+\r
+    if (HavePci) {\r
+      //\r
+      // Set the /chosen/linux,pci-probe-only property to 1, so that the PCI\r
+      // setup we will perform in the firmware is honored by the Linux OS,\r
+      // rather than torn down and done from scratch. This is generally a more\r
+      // sensible approach, and aligns with what ACPI based OSes do in general.\r
+      //\r
+      // In case we are exposing an emulated VGA PCI device to the guest, which\r
+      // may subsequently get exposed via the Graphics Output protocol and\r
+      // driven as an efifb by Linux, we need this setting to prevent the\r
+      // framebuffer from becoming unresponsive.\r
+      //\r
+      Node = fdt_path_offset (DeviceTreeBase, "/chosen");\r
+      if (Node < 0) {\r
+        Node = fdt_add_subnode (DeviceTreeBase, 0, "/chosen");\r
+      }\r
+      if (Node < 0 ||\r
+          fdt_setprop_u32 (DeviceTreeBase, Node, "linux,pci-probe-only", 1) < 0) {\r
+        DEBUG ((EFI_D_WARN, "Failed to set /chosen/linux,pci-probe-only property\n"));\r
+      }\r
     }\r
   }\r
-\r
   return EFI_SUCCESS;\r
 }\r
index ee2503ac4a7e7b2e726f1e7a111d33a042fac7d9..f807bf76bb4b55d184e7ab5dfb170e1d724aaf52 100644 (file)
@@ -73,6 +73,9 @@
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration\r
 \r
+[FeaturePcd]\r
+  gArmVirtTokenSpaceGuid.PcdPureAcpiBoot\r
+\r
 [Protocols]\r
   gEfiDevicePathProtocolGuid\r
 \r