]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility
authorAshish Singhal <ashishsingha@nvidia.com>
Mon, 4 Nov 2019 17:49:31 +0000 (10:49 -0700)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 7 Nov 2019 11:54:53 +0000 (12:54 +0100)
Add a PCD to govern whether to use DT or ACPI in case the
variable governing this is not found or is not valid.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
EmbeddedPkg/EmbeddedPkg.dec

index 907d46a495e3bf76220e44a498e98adaf9c1a3c4..a6ac30c32a6fcfe0ef34f2eddd19f3cb7e654135 100644 (file)
@@ -124,18 +124,21 @@ DtPlatformDxeEntryPoint (
     Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,\r
                     NULL, &BufferSize, &DtAcpiPref);\r
     if (EFI_ERROR (Status)) {\r
     Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,\r
                     NULL, &BufferSize, &DtAcpiPref);\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to DT\n",\r
-        __FUNCTION__));\r
-      DtAcpiPref.Pref = DT_ACPI_SELECT_DT;\r
+      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to %a\n",\r
+        __FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"));\r
+      DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? DT_ACPI_SELECT_DT\r
+                                                      : DT_ACPI_SELECT_ACPI;\r
     }\r
   }\r
 \r
   if (!EFI_ERROR (Status) &&\r
       DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&\r
       DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {\r
     }\r
   }\r
 \r
   if (!EFI_ERROR (Status) &&\r
       DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&\r
       DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {\r
-    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to DT\n",\r
-      __FUNCTION__, DT_ACPI_VARIABLE_NAME));\r
-    DtAcpiPref.Pref = DT_ACPI_SELECT_DT;\r
+    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to %a\n",\r
+      __FUNCTION__, DT_ACPI_VARIABLE_NAME,\r
+      PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"));\r
+    DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? DT_ACPI_SELECT_DT\r
+                                                    : DT_ACPI_SELECT_ACPI;\r
     Status = EFI_INVALID_PARAMETER; // trigger setvar below\r
   }\r
 \r
     Status = EFI_INVALID_PARAMETER; // trigger setvar below\r
   }\r
 \r
index b68f154182a67bf7293507a8e5041006ee9ea0bc..450ea29b4a2631b9ee7f5b3cdf7fa20faf1fee63 100644 (file)
@@ -46,6 +46,9 @@
   gEdkiiPlatformHasAcpiGuid\r
   gFdtTableGuid\r
 \r
   gEdkiiPlatformHasAcpiGuid\r
   gFdtTableGuid\r
 \r
+[Pcd]\r
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref\r
+\r
 [Depex]\r
   gEfiVariableArchProtocolGuid        AND\r
   gEfiVariableWriteArchProtocolGuid\r
 [Depex]\r
   gEfiVariableArchProtocolGuid        AND\r
   gEfiVariableWriteArchProtocolGuid\r
index bbaadc5a17ab54c763972b3659d8d46cfbcf694c..8812a6db7c30e9a481d5308b94c2b64414100884 100644 (file)
   # truncation on overflow to specify negative offsets.\r
   #\r
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x0|UINT64|0x0000058\r
   # truncation on overflow to specify negative offsets.\r
   #\r
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x0|UINT64|0x0000058\r
+\r
+  #\r
+  # Selection between DT and ACPI as a default\r
+  #\r
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref|TRUE|BOOLEAN|0x0000059\r