public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmVirtPkg/PlatformHasAcpiDtDxe: allow manual override for DT installation
@ 2017-03-29 15:19 Ard Biesheuvel
  2017-03-29 16:00 ` Laszlo Ersek
  0 siblings, 1 reply; 18+ messages in thread
From: Ard Biesheuvel @ 2017-03-29 15:19 UTC (permalink / raw)
  To: edk2-devel, lersek; +Cc: marc.zyngier, Ard Biesheuvel

In general, we should not present two separate (and inevitably different)
hardware descriptions to the OS, in the form of ACPI tables and a device
tree blob. For this reason, we recently added the logic to ArmVirtQemu to
only expose the ACPI 2.0 entry point if no DT binary is being passed, and
vice versa.

However, this is arguably a regression for those who rely on both
descriptions being available, even if the use cases in question are
uncommon.

So allow a secret handshake with the UEFI Shell, to set a variable that
will result in both descriptions being exposed on the next boot, if
executing in the default 'ACPI-only' mode.

  setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceDt =01

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmVirtPkg/ArmVirtPkg.dec                                | 8 ++++++++
 ArmVirtPkg/ArmVirtQemu.dsc                               | 3 +++
 ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c   | 7 ++++++-
 ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf | 5 +++++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index efe83a383d55..ae5473a3f3f3 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -34,6 +34,8 @@ [Guids.common]
   gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } }
   gEarlyPL011BaseAddressGuid       = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
 
+  gArmVirtVariableGuid   = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } }
+
 [Protocols]
   gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } }
 
@@ -58,3 +60,9 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   # EFI_VT_100_GUID.
   #
   gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}|VOID*|0x00000007
+
+[PcdsDynamic]
+  #
+  # Whether to force the DT to be exposed to the OS, even in the presence of
+  # ACPI tables.
+  gArmVirtTokenSpaceGuid.PcdAcpiDtForceDt|0x0|UINT8|0x00000003
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 4075b92aa2cb..bbb517e40242 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -210,6 +210,9 @@ [PcdsDynamicDefault.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated|FALSE
 
+[PcdsDynamicHii]
+  gArmVirtTokenSpaceGuid.PcdAcpiDtForceDt|L"ForceDt"|gArmVirtVariableGuid|0x0|0|NV,BS
+
 ################################################################################
 #
 # Components Section - list of all EDK II Modules needed by this Platform
diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
index 8932dacabec5..4c53825d54ad 100644
--- a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
+++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
@@ -58,7 +58,12 @@ PlatformHasAcpiDt (
       goto Failed;
     }
 
-    return Status;
+    if (!PcdGet8 (PcdAcpiDtForceDt)) {
+      return EFI_SUCCESS;
+    }
+    DEBUG ((DEBUG_WARN,
+      "%a: ForceDt is set: installing both ACPI and DT tables\n",
+      __FUNCTION__));
   }
 
   //
diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
index 4466bead57c2..5bc9ea43c05b 100644
--- a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
+++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
@@ -25,6 +25,7 @@ [Sources]
   PlatformHasAcpiDtDxe.c
 
 [Packages]
+  ArmVirtPkg/ArmVirtPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
@@ -32,6 +33,7 @@ [Packages]
 [LibraryClasses]
   BaseLib
   DebugLib
+  PcdLib
   QemuFwCfgLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
@@ -40,5 +42,8 @@ [Guids]
   gEdkiiPlatformHasAcpiGuid       ## SOMETIMES_PRODUCES ## PROTOCOL
   gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
 
+[Pcd]
+  gArmVirtTokenSpaceGuid.PcdAcpiDtForceDt
+
 [Depex]
   TRUE
-- 
2.9.3



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

end of thread, other threads:[~2017-03-29 18:04 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29 15:19 [PATCH] ArmVirtPkg/PlatformHasAcpiDtDxe: allow manual override for DT installation Ard Biesheuvel
2017-03-29 16:00 ` Laszlo Ersek
2017-03-29 16:02   ` Ard Biesheuvel
2017-03-29 16:03     ` Laszlo Ersek
2017-03-29 16:07       ` Ard Biesheuvel
2017-03-29 16:40         ` Laszlo Ersek
     [not found]           ` <2fb8acda-2786-e3de-e035-32d13e3f5868@arm.com>
2017-03-29 17:07             ` Ard Biesheuvel
2017-03-29 17:23               ` Laszlo Ersek
2017-03-29 17:30                 ` Ard Biesheuvel
2017-03-29 17:50                   ` Laszlo Ersek
2017-03-29 17:15             ` Laszlo Ersek
     [not found]               ` <010325b6-1c23-5da7-9df5-337619c519bb@arm.com>
2017-03-29 18:04                 ` Laszlo Ersek
2017-03-29 17:16           ` Ard Biesheuvel
     [not found]       ` <e78f315f-1e84-cc6c-ab41-fe98b842af21@arm.com>
2017-03-29 17:03         ` Laszlo Ersek
     [not found]   ` <7F72156F-3814-4CF1-8847-A7272409A85E@redhat.com>
2017-03-29 16:17     ` Ard Biesheuvel
2017-03-29 16:55       ` Laszlo Ersek
2017-03-29 17:44         ` Mark Rutland
2017-03-29 17:58           ` Laszlo Ersek

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