public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>
To: devel@edk2.groups.io
Cc: Leif Lindholm <quic_llindhol@quicinc.com>,
	 Ard Biesheuvel <ardb+tianocore@kernel.org>,
	 Jeremy Linton <jeremy.linton@arm.com>
Subject: [edk2-devel] [PATCH edk2-platforms WIP 3/5] SbsaQemu: move XHCI to SSDT
Date: Fri, 13 Oct 2023 14:28:51 +0200	[thread overview]
Message-ID: <20231013-ehci-xhci-fix-v1-3-f56f28e70e36@linaro.org> (raw)
In-Reply-To: <20231013-ehci-xhci-fix-v1-0-f56f28e70e36@linaro.org>

I want to add EHCI/XHCI switching so platforms older than 0.3
would not complain about missing XHCI.
---
 Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf |   1 +
 Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl       | 116 -----------------
 Silicon/Qemu/SbsaQemu/AcpiTables/Xhci.asl       | 132 ++++++++++++++++++++
 3 files changed, 133 insertions(+), 116 deletions(-)

diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
index 42cc203eeb7b..cd89ab346aa7 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
@@ -21,6 +21,7 @@ [Sources]
   Fadt.aslc
   Mcfg.aslc
   Spcr.aslc
+  Xhci.asl
 
 [Packages]
   ArmPlatformPkg/ArmPlatformPkg.dec
diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
index 4ff267e00802..714636b518a5 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl
@@ -68,122 +68,6 @@ DefinitionBlock ("DsdtTable.aml", "DSDT",
       }
     }
 
-    // USB XHCI Host Controller
-    Device (USB0) {
-        Name (_HID, "PNP0D10")      // _HID: Hardware ID
-        Name (_UID, 0x00)            // _UID: Unique ID
-        Name (_CCA, 0x01)            // _CCA: Cache Coherency Attribute
-        Method (_STA) {
-          Return (0xF)
-        }
-        Method (_CRS, 0x0, Serialized) {
-            Name (RBUF, ResourceTemplate() {
-                Memory32Fixed (ReadWrite,
-                               FixedPcdGet32 (PcdPlatformUsbBase),
-                               FixedPcdGet32 (PcdPlatformUsbSize))
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 43 }
-            })
-            Return (RBUF)
-        }
-
-        // Root Hub
-        Device (RHUB) {
-            Name (_ADR, 0x00000000)  // Address of Root Hub should be 0 as per ACPI 5.0 spec
-            Method (_STA) {
-              Return (0xF)
-            }
-
-            // Ports connected to Root Hub
-            Device (HUB1) {
-                Name (_ADR, 0x00000001)
-                Name (_UPC, Package() {
-                    0x00,       // Port is NOT connectable
-                    0xFF,       // Don't care
-                    0x00000000, // Reserved 0 must be zero
-                    0x00000000  // Reserved 1 must be zero
-                })
-                Method (_STA) {
-                  Return (0xF)
-                }
-
-                Device (PRT1) {
-                    Name (_ADR, 0x00000001)
-                    Name (_UPC, Package() {
-                        0xFF,        // Port is connectable
-                        0x00,        // Port connector is A
-                        0x00000000,
-                        0x00000000
-                    })
-                    Name (_PLD, Package() {
-                        Buffer(0x10) {
-                            0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                            0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-                        }
-                    })
-                    Method (_STA) {
-                      Return (0xF)
-                    }
-                } // USB0_RHUB_HUB1_PRT1
-                Device (PRT2) {
-                    Name (_ADR, 0x00000002)
-                    Name (_UPC, Package() {
-                        0xFF,        // Port is connectable
-                        0x00,        // Port connector is A
-                        0x00000000,
-                        0x00000000
-                    })
-                    Name (_PLD, Package() {
-                        Buffer(0x10) {
-                            0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                            0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-                        }
-                    })
-                    Method (_STA) {
-                      Return (0xF)
-                    }
-                } // USB0_RHUB_HUB1_PRT2
-
-                Device (PRT3) {
-                    Name (_ADR, 0x00000003)
-                    Name (_UPC, Package() {
-                        0xFF,        // Port is connectable
-                        0x09,        // Type C connector - USB2 and SS with Switch
-                        0x00000000,
-                        0x00000000
-                    })
-                    Name (_PLD, Package() {
-                        Buffer (0x10) {
-                            0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                            0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-                        }
-                    })
-                    Method (_STA) {
-                      Return (0xF)
-                    }
-                } // USB0_RHUB_HUB1_PRT3
-
-                Device (PRT4) {
-                    Name (_ADR, 0x00000004)
-                    Name (_UPC, Package() {
-                        0xFF,        // Port is connectable
-                        0x09,        // Type C connector - USB2 and SS with Switch
-                        0x00000000,
-                        0x00000000
-                    })
-                    Name (_PLD, Package() {
-                        Buffer (0x10){
-                            0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                            0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-                        }
-                    })
-                    Method (_STA) {
-                      Return (0xF)
-                    }
-                } // USB0_RHUB_HUB1_PRT4
-            } // USB0_RHUB_HUB1
-        } // USB0_RHUB
-    } // USB0
-
     Device (PCI0)
     {
       Name (_HID, EISAID ("PNP0A08")) // PCI Express Root Bridge
diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Xhci.asl b/Silicon/Qemu/SbsaQemu/AcpiTables/Xhci.asl
new file mode 100644
index 000000000000..bfdcb09b28f0
--- /dev/null
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Xhci.asl
@@ -0,0 +1,132 @@
+/** @file
+*  [DSDT] XHCI Usb Host controller
+*
+*  Copyright (c) 2023, Linaro Ltd. All rights reserved.
+*
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <IndustryStandard/Acpi60.h>
+#include <IndustryStandard/SbsaQemuAcpi.h>
+
+DefinitionBlock (__FILE__, "SSDT", 2, "LINARO", "SBSAXHCI", 2)
+{
+  Scope (\_SB_)
+  {
+    // USB XHCI Host Controller
+    Device (USB3) {
+    Name (_HID, "PNP0D10")      // _HID: Hardware ID
+    Name (_UID, 0x00)            // _UID: Unique ID
+    Name (_CCA, 0x01)            // _CCA: Cache Coherency Attribute
+    Method (_STA) {
+    Return (0xF)
+    }
+    Method (_CRS, 0x0, Serialized) {
+        Name (RBUF, ResourceTemplate() {
+        Memory32Fixed (ReadWrite,
+                        FixedPcdGet32 (PcdPlatformUsbBase),
+                        FixedPcdGet32 (PcdPlatformUsbSize))
+        Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { 43 }
+        })
+        Return (RBUF)
+    }
+
+    // Root Hub
+    Device (RHUB) {
+        Name (_ADR, 0x00000000)  // Address of Root Hub should be 0 as per ACPI 5.0 spec
+        Method (_STA) {
+        Return (0xF)
+        }
+
+        // Ports connected to Root Hub
+        Device (HUB1) {
+        Name (_ADR, 0x00000001)
+        Name (_UPC, Package() {
+                0x00,       // Port is NOT connectable
+                0xFF,       // Don't care
+                0x00000000, // Reserved 0 must be zero
+                0x00000000  // Reserved 1 must be zero
+        })
+        Method (_STA) {
+        Return (0xF)
+        }
+
+        Device (PRT1) {
+                Name (_ADR, 0x00000001)
+                Name (_UPC, Package() {
+                0xFF,        // Port is connectable
+                0x00,        // Port connector is A
+                0x00000000,
+                0x00000000
+                })
+                Name (_PLD, Package() {
+                Buffer(0x10) {
+                        0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                        0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+                }
+                })
+                Method (_STA) {
+                Return (0xF)
+                }
+        } // USB0_RHUB_HUB1_PRT1
+        Device (PRT2) {
+                Name (_ADR, 0x00000002)
+                Name (_UPC, Package() {
+                0xFF,        // Port is connectable
+                0x00,        // Port connector is A
+                0x00000000,
+                0x00000000
+                })
+                Name (_PLD, Package() {
+                Buffer(0x10) {
+                        0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                        0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+                }
+                })
+                Method (_STA) {
+                Return (0xF)
+                }
+        } // USB0_RHUB_HUB1_PRT2
+
+        Device (PRT3) {
+                Name (_ADR, 0x00000003)
+                Name (_UPC, Package() {
+                0xFF,        // Port is connectable
+                0x09,        // Type C connector - USB2 and SS with Switch
+                0x00000000,
+                0x00000000
+                })
+                Name (_PLD, Package() {
+                Buffer (0x10) {
+                        0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                        0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+                }
+                })
+                Method (_STA) {
+                Return (0xF)
+                }
+        } // USB0_RHUB_HUB1_PRT3
+
+        Device (PRT4) {
+                Name (_ADR, 0x00000004)
+                Name (_UPC, Package() {
+                0xFF,        // Port is connectable
+                0x09,        // Type C connector - USB2 and SS with Switch
+                0x00000000,
+                0x00000000
+                })
+                Name (_PLD, Package() {
+                Buffer (0x10){
+                        0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                        0x31, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+                }
+                })
+                Method (_STA) {
+                Return (0xF)
+                }
+        } // USB0_RHUB_HUB1_PRT4
+        } // USB0_RHUB_HUB1
+    } // USB0_RHUB
+    } // USB0
+  } //\SB
+}

-- 
2.41.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109589): https://edk2.groups.io/g/devel/message/109589
Mute This Topic: https://groups.io/mt/101938742/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-10-13 12:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13 12:28 [edk2-devel] [PATCH edk2-platforms WIP 0/5] Provide EHCI or XHCI USB controller Marcin Juszkiewicz
2023-10-13 12:28 ` [edk2-devel] [PATCH edk2-platforms WIP 1/5] SbsaQemu: introduce macro to compare platform version Marcin Juszkiewicz
2023-10-13 12:28 ` [edk2-devel] [PATCH edk2-platforms WIP 2/5] WIP: SbsaQemu: rename USB controller variables to be generic Marcin Juszkiewicz
2023-10-13 12:28 ` Marcin Juszkiewicz [this message]
2023-10-13 12:28 ` [edk2-devel] [PATCH edk2-platforms WIP 4/5] SbsaQemu: add EHCI to SSDT Marcin Juszkiewicz
2023-10-13 12:28 ` [edk2-devel] [PATCH edk2-platforms WIP 5/5] WIP: try to enable/disable proper USB controller Marcin Juszkiewicz
2023-10-13 13:24 ` [edk2-devel] [PATCH edk2-platforms WIP 0/5] Provide EHCI or XHCI " Gerd Hoffmann
2023-10-13 13:31   ` Marcin Juszkiewicz
     [not found]   ` <178DADF696DC483E.8679@groups.io>
2023-10-13 17:29     ` Marcin Juszkiewicz

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=20231013-ehci-xhci-fix-v1-3-f56f28e70e36@linaro.org \
    --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