<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="background-color:rgb(255, 255, 255);display:inline !important">Reviewed-by: Andrei Warkentin <awarkentin@vmware.com></span><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Jeremy Linton <jeremy.linton@arm.com><br>
<b>Sent:</b> Thursday, August 19, 2021 11:16 PM<br>
<b>To:</b> devel@edk2.groups.io <devel@edk2.groups.io><br>
<b>Cc:</b> pete@akeo.ie <pete@akeo.ie>; ardb+tianocore@kernel.org <ardb+tianocore@kernel.org>; Andrei Warkentin <awarkentin@vmware.com>; Sunny.Wang@arm.com <Sunny.Wang@arm.com>; samer.el-haj-mahmoud@arm.com <samer.el-haj-mahmoud@arm.com>; Jeremy Linton <jeremy.linton@arm.com><br>
<b>Subject:</b> [PATCH v3 2/7] Platform/RaspberryPi: Break XHCI into its own SSDT</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Lets prepare to switch between XHCI and PCI by moving<br>
the XHCI definition into its own SSDT. That way we can<br>
select it based on the menu settings. The resource<br>
producer/consumer flag is also corrected.<br>
<br>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com><br>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com><br>
---<br>
 Platform/RaspberryPi/AcpiTables/AcpiTables.inf     |  1 +<br>
 Platform/RaspberryPi/AcpiTables/Dsdt.asl           |  3 --<br>
 Platform/RaspberryPi/AcpiTables/Xhci.asl           | 35 ++++++++++++++--------<br>
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c |  8 +++++<br>
 4 files changed, 31 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf<br>
index 1ddc9ca5fe..f3e8d950c1 100644<br>
--- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf<br>
+++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf<br>
@@ -38,6 +38,7 @@<br>
   SpcrPl011.aslc<br>
   Pptt.aslc<br>
   SsdtThermal.asl<br>
+  Xhci.asl<br>
 <br>
 [Packages]<br>
   ArmPkg/ArmPkg.dec<br>
diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl<br>
index 1ee6379f46..b594d50bdf 100644<br>
--- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl<br>
+++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl<br>
@@ -64,9 +64,6 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)<br>
   Scope (\_SB_)<br>
   {<br>
     include ("Pep.asl")<br>
-#if (RPI_MODEL == 4)<br>
-    include ("Xhci.asl")<br>
-#endif<br>
 <br>
     Device (CPU0)<br>
     {<br>
diff --git a/Platform/RaspberryPi/AcpiTables/Xhci.asl b/Platform/RaspberryPi/AcpiTables/Xhci.asl<br>
index bc3fea60f9..9b37277956 100644<br>
--- a/Platform/RaspberryPi/AcpiTables/Xhci.asl<br>
+++ b/Platform/RaspberryPi/AcpiTables/Xhci.asl<br>
@@ -9,6 +9,8 @@<br>
 <br>
 #include <IndustryStandard/Bcm2711.h><br>
 <br>
+#include "AcpiTables.h"<br>
+<br>
 /*<br>
  * The following can be used to remove parenthesis from<br>
  * defined macros that the compiler complains about.<br>
@@ -24,12 +26,17 @@<br>
  */<br>
 #define XHCI_REG_LENGTH                 0x1000<br>
 <br>
-Device (SCB0) {<br>
-    Name (_HID, "ACPI0004")<br>
-    Name (_UID, 0x0)<br>
-    Name (_CCA, 0x0)<br>
+DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4XHCI", 2)<br>
+{<br>
+  Scope (\_SB_)<br>
+  {<br>
+<br>
+    Device (SCB0) {<br>
+      Name (_HID, "ACPI0004")<br>
+      Name (_UID, 0x0)<br>
+      Name (_CCA, 0x0)<br>
 <br>
-    Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings<br>
+      Method (_CRS, 0, Serialized) { // _CRS: Current Resource Settings<br>
         /*<br>
          * Container devices with _DMA must have _CRS, meaning SCB0<br>
          * to provide all resources that XHC0 consumes (except<br>
@@ -57,15 +64,15 @@ Device (SCB0) {<br>
         Add (MMBE, XHCI_REG_LENGTH - 1, MMBE)<br>
         Add (MMLE, XHCI_REG_LENGTH - 1, MMLE)<br>
         Return (RBUF)<br>
-    }<br>
+      }<br>
 <br>
-    Name (_DMA, ResourceTemplate() {<br>
+      Name (_DMA, ResourceTemplate() {<br>
         /*<br>
          * XHC0 is limited to DMA to first 3GB. Note this<br>
          * only applies to PCIe, not GENET or other devices<br>
          * next to the A72.<br>
          */<br>
-        QWordMemory (ResourceConsumer,<br>
+        QWordMemory (ResourceProducer,<br>
             ,<br>
             MinFixed,<br>
             MaxFixed,<br>
@@ -79,10 +86,10 @@ Device (SCB0) {<br>
             ,<br>
             ,<br>
             )<br>
-    })<br>
+      })<br>
 <br>
-    Device (XHC0)<br>
-    {<br>
+      Device (XHC0)<br>
+      {<br>
         Name (_HID, "PNP0D10")      // _HID: Hardware ID<br>
         Name (_UID, 0x0)            // _UID: Unique ID<br>
         Name (_CCA, 0x0)            // _CCA: Cache Coherency Attribute<br>
@@ -131,5 +138,7 @@ Device (SCB0) {<br>
             Debug = "xHCI enable"<br>
             Store (0x6, CMND)<br>
         }<br>
-    }<br>
-}<br>
+      } // end XHC0<br>
+    } //end SCB0<br>
+  } //end scope sb<br>
+} //end definition block<br>
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
index 87f6b4e7bb..7c5786303d 100644<br>
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
@@ -814,6 +814,14 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] = {<br>
     PcdToken(PcdSdIsArasan),<br>
     SsdtEmmcNameOpReplace<br>
   },<br>
+#if (RPI_MODEL == 4)<br>
+  {<br>
+    SIGNATURE_64 ('R', 'P', 'I', '4', 'X', 'H', 'C', 'I'),<br>
+    0,<br>
+    PcdToken(PcdXhciPci),<br>
+    NULL<br>
+  },<br>
+#endif<br>
   { // DSDT<br>
     SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0),<br>
     0,<br>
-- <br>
2.13.7<br>
<br>
</div>
</span></font></div>
</body>
</html>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/79648">View/Reply Online (#79648)</a> |    |  <a target="_blank" href="https://groups.io/mt/85014314/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>