]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c
ArmVirtPkg/VirtFdtDxe: make installation of FDT as config table optional
[mirror_edk2.git] / ArmVirtPkg / VirtFdtDxe / VirtFdtDxe.c
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