public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeremy Linton" <jeremy.linton@arm.com>
To: devel@edk2.groups.io
Cc: pete@akeo.ie, awarkentin@vmware.com,
	samer.el-haj-mahmoud@arm.com, leif@nuviainc.com,
	ard.biesheuvel@arm.com, Jeremy Linton <jeremy.linton@arm.com>
Subject: [RFC 2/3] rpi4/acpi/dsdt: break XHCI into its own SSDT
Date: Tue, 12 Jan 2021 16:27:07 -0600	[thread overview]
Message-ID: <20210112222708.1757044-3-jeremy.linton@arm.com> (raw)
In-Reply-To: <20210112222708.1757044-1-jeremy.linton@arm.com>

Lets prepare to switch between XHCI and PCI by moving
the XHCI definition into its own SSDT. That way we can
select it based on the menu settings.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 Platform/RaspberryPi/AcpiTables/AcpiTables.inf     |  1 +
 Platform/RaspberryPi/AcpiTables/Dsdt.asl           |  4 +--
 Platform/RaspberryPi/AcpiTables/Xhci.asl           | 33 ++++++++++++++--------
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  5 ++++
 4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
index 2867c83b71..17dee581a0 100644
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf
@@ -36,6 +36,7 @@
   Pptt.aslc
   Pcct.aslc
   SsdtThermal.asl
+  Xhci.asl
 
 [Packages]
   ArmPkg/ArmPkg.dec
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
index ae3bd129d6..5a665d7dd1 100644
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
@@ -63,9 +63,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
   Scope (\_SB_)
   {
     include ("Pep.asl")
-#if (RPI_MODEL == 4)
-    include ("Xhci.asl")
-#endif
+
     Method (_OSC, 4, Serialized)  { // _OSC: Operating System Capabilities
       CreateDWordField (Arg3, 0x00, STS0)
       CreateDWordField (Arg3, 0x04, CAP0)
diff --git a/Platform/RaspberryPi/AcpiTables/Xhci.asl b/Platform/RaspberryPi/AcpiTables/Xhci.asl
index bc3fea60f9..6d18adf590 100644
--- a/Platform/RaspberryPi/AcpiTables/Xhci.asl
+++ b/Platform/RaspberryPi/AcpiTables/Xhci.asl
@@ -9,6 +9,8 @@
 
 #include <IndustryStandard/Bcm2711.h>
 
+#include "AcpiTables.h"
+
 /*
  * The following can be used to remove parenthesis from
  * defined macros that the compiler complains about.
@@ -24,12 +26,17 @@
  */
 #define XHCI_REG_LENGTH                 0x1000
 
-Device (SCB0) {
-    Name (_HID, "ACPI0004")
-    Name (_UID, 0x0)
-    Name (_CCA, 0x0)
+DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4XHCI", 2)
+{
+  Scope (\_SB_)
+  {
+
+    Device (SCB0) {
+      Name (_HID, "ACPI0004")
+      Name (_UID, 0x0)
+      Name (_CCA, 0x0)
 
-    Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings
+      Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings
         /*
          * Container devices with _DMA must have _CRS, meaning SCB0
          * to provide all resources that XHC0 consumes (except
@@ -57,9 +64,9 @@ Device (SCB0) {
         Add (MMBE, XHCI_REG_LENGTH - 1, MMBE)
         Add (MMLE, XHCI_REG_LENGTH - 1, MMLE)
         Return (RBUF)
-    }
+      }
 
-    Name (_DMA, ResourceTemplate() {
+      Name (_DMA, ResourceTemplate() {
         /*
          * XHC0 is limited to DMA to first 3GB. Note this
          * only applies to PCIe, not GENET or other devices
@@ -79,10 +86,10 @@ Device (SCB0) {
             ,
             ,
             )
-    })
+      })
 
-    Device (XHC0)
-    {
+      Device (XHC0)
+      {
         Name (_HID, "PNP0D10")      // _HID: Hardware ID
         Name (_UID, 0x0)            // _UID: Unique ID
         Name (_CCA, 0x0)            // _CCA: Cache Coherency Attribute
@@ -131,5 +138,7 @@ Device (SCB0) {
             Debug = "xHCI enable"
             Store (0x6, CMND)
         }
-    }
-}
+      } // end XHC0
+    } //end SCB0
+  } //end scope sb
+} //end definition block
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 7a3b8e9068..f13abd67c0 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -755,6 +755,11 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] = {
     SsdtNameOpReplace
   },
   {
+    SIGNATURE_64 ('R', 'P', 'I', '4', 'X', 'H', 'C', 'I'),
+    PcdToken(PcdXhci),
+	NULL
+  },
+  {
     SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0),
     0,
     NULL
-- 
2.13.7


  parent reply	other threads:[~2021-01-12 22:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 22:27 [RFC 0/3] Rpi4: Enable ACPI PCIe conduit Jeremy Linton
2021-01-12 22:27 ` [RFC 1/3] rpi4: Add XHCI/PCI selection menu Jeremy Linton
2021-02-08 17:39   ` [edk2-devel] " Andrei Warkentin
2021-01-12 22:27 ` Jeremy Linton [this message]
2021-01-12 22:27 ` [RFC 3/3] rpi4/acpi: Add PCIe SSDT Jeremy Linton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210112222708.1757044-3-jeremy.linton@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox