public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility
  2019-10-30  3:38 [PATCH] " Ashish Singhal
@ 2019-10-30  3:38 ` Ashish Singhal
  0 siblings, 0 replies; 4+ messages in thread
From: Ashish Singhal @ 2019-10-30  3:38 UTC (permalink / raw)
  To: devel, leif.lindholm, ard.biesheuvel; +Cc: Ashish Singhal

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>
---
 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c   | 16 ++++++++++------
 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf |  3 +++
 EmbeddedPkg/EmbeddedPkg.dec                         |  5 +++++
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
index 907d46a..e35ca33 100644
--- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
+++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
@@ -124,18 +124,22 @@ DtPlatformDxeEntryPoint (
     Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,
                     NULL, &BufferSize, &DtAcpiPref);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to DT\n",
-        __FUNCTION__));
-      DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
+      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to %s\n",
+        __FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
+      DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
+                          DT_ACPI_SELECT_DT :
+                          DT_ACPI_SELECT_ACPI;
     }
   }
 
   if (!EFI_ERROR (Status) &&
       DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&
       DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {
-    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to DT\n",
-      __FUNCTION__, DT_ACPI_VARIABLE_NAME));
-    DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
+    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to %s\n",
+      __FUNCTION__, DT_ACPI_VARIABLE_NAME, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
+    DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
+                        DT_ACPI_SELECT_DT :
+                        DT_ACPI_SELECT_ACPI;
     Status = EFI_INVALID_PARAMETER; // trigger setvar below
   }
 
diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
index b68f154..450ea29 100644
--- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
+++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
@@ -46,6 +46,9 @@
   gEdkiiPlatformHasAcpiGuid
   gFdtTableGuid
 
+[Pcd]
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref
+
 [Depex]
   gEfiVariableArchProtocolGuid        AND
   gEfiVariableWriteArchProtocolGuid
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index bbaadc5..8812a6d 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -185,3 +185,8 @@
   # truncation on overflow to specify negative offsets.
   #
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x0|UINT64|0x0000058
+
+  #
+  # Selection between DT and ACPI as a default
+  #
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref|TRUE|BOOLEAN|0x0000059
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility
@ 2019-11-04 17:49 Ashish Singhal
  2019-11-06 23:09 ` Ashish Singhal
  2019-11-07 11:56 ` Ard Biesheuvel
  0 siblings, 2 replies; 4+ messages in thread
From: Ashish Singhal @ 2019-11-04 17:49 UTC (permalink / raw)
  To: devel, leif.lindholm, ard.biesheuvel; +Cc: Ashish Singhal

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>
---
 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c   | 16 ++++++++++------
 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf |  3 +++
 EmbeddedPkg/EmbeddedPkg.dec                         |  5 +++++
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
index 907d46a..e35ca33 100644
--- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
+++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
@@ -124,18 +124,22 @@ DtPlatformDxeEntryPoint (
     Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,
                     NULL, &BufferSize, &DtAcpiPref);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to DT\n",
-        __FUNCTION__));
-      DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
+      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to %s\n",
+        __FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
+      DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
+                          DT_ACPI_SELECT_DT :
+                          DT_ACPI_SELECT_ACPI;
     }
   }
 
   if (!EFI_ERROR (Status) &&
       DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&
       DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {
-    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to DT\n",
-      __FUNCTION__, DT_ACPI_VARIABLE_NAME));
-    DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
+    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to %s\n",
+      __FUNCTION__, DT_ACPI_VARIABLE_NAME, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
+    DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
+                        DT_ACPI_SELECT_DT :
+                        DT_ACPI_SELECT_ACPI;
     Status = EFI_INVALID_PARAMETER; // trigger setvar below
   }
 
diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
index b68f154..450ea29 100644
--- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
+++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
@@ -46,6 +46,9 @@
   gEdkiiPlatformHasAcpiGuid
   gFdtTableGuid
 
+[Pcd]
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref
+
 [Depex]
   gEfiVariableArchProtocolGuid        AND
   gEfiVariableWriteArchProtocolGuid
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index bbaadc5..8812a6d 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -185,3 +185,8 @@
   # truncation on overflow to specify negative offsets.
   #
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x0|UINT64|0x0000058
+
+  #
+  # Selection between DT and ACPI as a default
+  #
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref|TRUE|BOOLEAN|0x0000059
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility
  2019-11-04 17:49 [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility Ashish Singhal
@ 2019-11-06 23:09 ` Ashish Singhal
  2019-11-07 11:56 ` Ard Biesheuvel
  1 sibling, 0 replies; 4+ messages in thread
From: Ashish Singhal @ 2019-11-06 23:09 UTC (permalink / raw)
  To: devel@edk2.groups.io, leif.lindholm@linaro.org,
	ard.biesheuvel@linaro.org

[-- Attachment #1: Type: text/plain, Size: 4004 bytes --]

Hello Leif/Ard,

Any comments/suggestions on this one?

Thanks
Ashish
________________________________
From: Ashish Singhal <ashishsingha@nvidia.com>
Sent: Monday, November 4, 2019 10:49 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>; leif.lindholm@linaro.org <leif.lindholm@linaro.org>; ard.biesheuvel@linaro.org <ard.biesheuvel@linaro.org>
Cc: Ashish Singhal <ashishsingha@nvidia.com>
Subject: [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility

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>
---
 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c   | 16 ++++++++++------
 EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf |  3 +++
 EmbeddedPkg/EmbeddedPkg.dec                         |  5 +++++
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
index 907d46a..e35ca33 100644
--- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
+++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
@@ -124,18 +124,22 @@ DtPlatformDxeEntryPoint (
     Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,
                     NULL, &BufferSize, &DtAcpiPref);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to DT\n",
-        __FUNCTION__));
-      DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
+      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to %s\n",
+        __FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
+      DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
+                          DT_ACPI_SELECT_DT :
+                          DT_ACPI_SELECT_ACPI;
     }
   }

   if (!EFI_ERROR (Status) &&
       DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&
       DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {
-    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to DT\n",
-      __FUNCTION__, DT_ACPI_VARIABLE_NAME));
-    DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
+    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to %s\n",
+      __FUNCTION__, DT_ACPI_VARIABLE_NAME, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
+    DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
+                        DT_ACPI_SELECT_DT :
+                        DT_ACPI_SELECT_ACPI;
     Status = EFI_INVALID_PARAMETER; // trigger setvar below
   }

diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
index b68f154..450ea29 100644
--- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
+++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
@@ -46,6 +46,9 @@
   gEdkiiPlatformHasAcpiGuid
   gFdtTableGuid

+[Pcd]
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref
+
 [Depex]
   gEfiVariableArchProtocolGuid        AND
   gEfiVariableWriteArchProtocolGuid
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index bbaadc5..8812a6d 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -185,3 +185,8 @@
   # truncation on overflow to specify negative offsets.
   #
   gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x0|UINT64|0x0000058
+
+  #
+  # Selection between DT and ACPI as a default
+  #
+  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref|TRUE|BOOLEAN|0x0000059
--
2.7.4


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

[-- Attachment #2: Type: text/html, Size: 7154 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility
  2019-11-04 17:49 [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility Ashish Singhal
  2019-11-06 23:09 ` Ashish Singhal
@ 2019-11-07 11:56 ` Ard Biesheuvel
  1 sibling, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2019-11-07 11:56 UTC (permalink / raw)
  To: Ashish Singhal; +Cc: edk2-devel-groups-io, Leif Lindholm

On Mon, 4 Nov 2019 at 18:49, Ashish Singhal <ashishsingha@nvidia.com> wrote:
>
> 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>

Pushed as 3a63c17ebc85..601a18bf08ca

Thanks!

> ---
>  EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c   | 16 ++++++++++------
>  EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf |  3 +++
>  EmbeddedPkg/EmbeddedPkg.dec                         |  5 +++++
>  3 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
> index 907d46a..e35ca33 100644
> --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
> +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
> @@ -124,18 +124,22 @@ DtPlatformDxeEntryPoint (
>      Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,
>                      NULL, &BufferSize, &DtAcpiPref);
>      if (EFI_ERROR (Status)) {
> -      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to DT\n",
> -        __FUNCTION__));
> -      DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
> +      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to %s\n",
> +        __FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
> +      DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
> +                          DT_ACPI_SELECT_DT :
> +                          DT_ACPI_SELECT_ACPI;
>      }
>    }
>
>    if (!EFI_ERROR (Status) &&
>        DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&
>        DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {
> -    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to DT\n",
> -      __FUNCTION__, DT_ACPI_VARIABLE_NAME));
> -    DtAcpiPref.Pref = DT_ACPI_SELECT_DT;
> +    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to %s\n",
> +      __FUNCTION__, DT_ACPI_VARIABLE_NAME, PcdGetBool (PcdDefaultDtPref) ? L"DT" : L"ACPI"));
> +    DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ?
> +                        DT_ACPI_SELECT_DT :
> +                        DT_ACPI_SELECT_ACPI;
>      Status = EFI_INVALID_PARAMETER; // trigger setvar below
>    }
>
> diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
> index b68f154..450ea29 100644
> --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
> +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
> @@ -46,6 +46,9 @@
>    gEdkiiPlatformHasAcpiGuid
>    gFdtTableGuid
>
> +[Pcd]
> +  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref
> +
>  [Depex]
>    gEfiVariableArchProtocolGuid        AND
>    gEfiVariableWriteArchProtocolGuid
> diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
> index bbaadc5..8812a6d 100644
> --- a/EmbeddedPkg/EmbeddedPkg.dec
> +++ b/EmbeddedPkg/EmbeddedPkg.dec
> @@ -185,3 +185,8 @@
>    # truncation on overflow to specify negative offsets.
>    #
>    gEmbeddedTokenSpaceGuid.PcdDmaDeviceOffset|0x0|UINT64|0x0000058
> +
> +  #
> +  # Selection between DT and ACPI as a default
> +  #
> +  gEmbeddedTokenSpaceGuid.PcdDefaultDtPref|TRUE|BOOLEAN|0x0000059
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-07 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 17:49 [PATCH] EmbeddedPkg/DtPlatformDxe: Add DT/ACPI Default Flexibility Ashish Singhal
2019-11-06 23:09 ` Ashish Singhal
2019-11-07 11:56 ` Ard Biesheuvel
  -- strict thread matches above, loose matches on Subject: below --
2019-10-30  3:38 [PATCH] " Ashish Singhal
2019-10-30  3:38 ` [PATCH] EmbeddedPkg/DtPlatformDxe: " Ashish Singhal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox