2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2014 Google Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 // XHCI Controller 0:14.0
21 Name (_ADR, 0x00140000)
23 Name (PLSD, 5) // Port Link State - RxDetect
24 Name (PLSP, 7) // Port Link State - Polling
26 OperationRegion (XPRT, PCI_Config, 0x00, 0x100)
27 Field (XPRT, AnyAcc, NoLock, Preserve)
60 Method (LPCL, 0, Serialized)
62 OperationRegion (XREG, SystemMemory,
63 ShiftLeft (^XMEM, 16), 0x600)
64 Field (XREG, DWordAcc, Lock, Preserve)
66 Offset (0x510), // PORTSCNUSB3[0]
68 Offset (0x520), // PORTSCNUSB3[1]
70 Offset (0x530), // PORTSCNUSB3[2]
72 Offset (0x540), // PORTSCNUSB3[3]
76 // Port Enabled/Disabled (Bit 1)
77 Name (PEDB, ShiftLeft (1, 1))
79 // Change Status (Bits 23:17)
80 Name (CHST, ShiftLeft (0x7f, 17))
83 And (PSC0, Not (PEDB), Local0)
84 Or (Local0, CHST, PSC0)
87 And (PSC1, Not (PEDB), Local0)
88 Or (Local0, CHST, PSC1)
91 And (PSC2, Not (PEDB), Local0)
92 Or (Local0, CHST, PSC2)
95 And (PSC3, Not (PEDB), Local0)
96 Or (Local0, CHST, PSC3)
99 Method (LPS0, 0, Serialized)
101 OperationRegion (XREG, SystemMemory,
102 ShiftLeft (^XMEM, 16), 0x600)
103 Field (XREG, DWordAcc, Lock, Preserve)
105 Offset (0x510), // PORTSCNUSB3
107 PLS1, 4, // [8:5] Port Link State
108 PPR1, 1, // [9] Port Power
110 CSC1, 1, // [17] Connect Status Change
112 WRC1, 1, // [19] Warm Port Reset Change
114 WPR1, 1, // [31] Warm Port Reset
115 Offset (0x520), // PORTSCNUSB3
117 PLS2, 4, // [8:5] Port Link State
118 PPR2, 1, // [9] Port Power
120 CSC2, 1, // [17] Connect Status Change
122 WRC2, 1, // [19] Warm Port Reset Change
124 WPR2, 1, // [31] Warm Port Reset
125 Offset (0x530), // PORTSCNUSB3
127 PLS3, 4, // [8:5] Port Link State
128 PPR3, 1, // [9] Port Power
130 CSC3, 1, // [17] Connect Status Change
132 WRC3, 1, // [19] Warm Port Reset Change
134 WPR3, 1, // [31] Warm Port Reset
135 Offset (0x540), // PORTSCNUSB3
137 PLS4, 4, // [8:5] Port Link State
138 PPR4, 1, // [9] Port Power
140 CSC4, 1, // [17] Connect Status Change
142 WRC4, 1, // [19] Warm Port Reset Change
144 WPR4, 1, // [31] Warm Port Reset
147 // Wait for all powered ports to finish polling
149 While (LOr (LOr (LAnd (LEqual (PPR1, 1), LEqual (PLS1, PLSP)),
150 LAnd (LEqual (PPR2, 1), LEqual (PLS2, PLSP))),
151 LOr (LAnd (LEqual (PPR3, 1), LEqual (PLS3, PLSP)),
152 LAnd (LEqual (PPR4, 1), LEqual (PLS4, PLSP)))))
154 If (LEqual (Local0, 0)) {
161 // For each USB3 Port:
162 // If port is disconnected (PLS=5 PP=1 CSC=0)
163 // 1) Issue warm reset (WPR=1)
164 // 2) Poll for warm reset complete (WRC=0)
165 // 3) Write 1 to port status to clear
167 // Local# indicate if port is reset
173 If (LAnd (LEqual (PLS1, PLSD),
174 LAnd (LEqual (CSC1, 0), LEqual (PPR1, 1)))) {
175 Store (1, WPR1) // Issue warm reset
178 If (LAnd (LEqual (PLS2, PLSD),
179 LAnd (LEqual (CSC2, 0), LEqual (PPR2, 1)))) {
180 Store (1, WPR2) // Issue warm reset
183 If (LAnd (LEqual (PLS3, PLSD),
184 LAnd (LEqual (CSC3, 0), LEqual (PPR3, 1)))) {
185 Store (1, WPR3) // Issue warm reset
188 If (LAnd (LEqual (PLS4, PLSD),
189 LAnd (LEqual (CSC4, 0), LEqual (PPR4, 1)))) {
190 Store (1, WPR4) // Issue warm reset
194 // Poll for warm reset complete on all ports that were reset
196 While (LOr (LOr (LAnd (LEqual (Local1, 1), LEqual (WRC1, 0)),
197 LAnd (LEqual (Local2, 1), LEqual (WRC2, 0))),
198 LOr (LAnd (LEqual (Local3, 1), LEqual (WRC3, 0)),
199 LAnd (LEqual (Local4, 1), LEqual (WRC4, 0)))))
201 If (LEqual (Local0, 0)) {
208 // Clear status bits in all ports
212 Method (_PSC, 0, NotSerialized)
217 Method (_PS0, 0, Serialized)
219 If (LEqual (^DVID, 0xFFFF)) {
222 If (LOr (LEqual (^XMEM, 0xFFFF), LEqual (^XMEM, 0x0000))) {
226 OperationRegion (XREG, SystemMemory,
227 Add (ShiftLeft (^XMEM, 16), 0x8000), 0x200)
228 Field (XREG, DWordAcc, Lock, Preserve)
230 Offset (0x0e0), // AUX Reset Control 1
233 Offset (0x154), // AUX Domain PM Control Register 2
236 Offset (0x16c), // AUX Clock Control
240 CLK1, 1, // USB3 Port Aux/Core Clock Gating Enable
243 // If device is in D3, set back to D0
244 Store (^D0D3, Local0)
245 if (LEqual (Local0, 3)) {
249 if (LNot (\ISWP())) {
250 // Clear PCI 0xB0[14:13]
254 // Clear MMIO 0x816C[14,2]
258 // Set MMIO 0x8154[31]
261 // Handle per-port reset if needed
264 // Set MMIO 0x80e0[15]
267 // Clear PCI CFG offset 0x40[11]
270 // Clear PCI CFG offset 0x44[13:12]
277 Method (_PS3, 0, Serialized)
279 If (LEqual (^DVID, 0xFFFF)) {
282 If (LOr (LEqual (^XMEM, 0xFFFF), LEqual (^XMEM, 0x0000))) {
286 OperationRegion (XREG, SystemMemory,
287 Add (ShiftLeft (^XMEM, 16), 0x8000), 0x200)
288 Field (XREG, DWordAcc, Lock, Preserve)
290 Offset (0x0e0), // AUX Reset Control 1
293 Offset (0x154), // AUX Domain PM Control Register 2
296 Offset (0x16c), // AUX Clock Control
300 CLK1, 1, // USB3 Port Aux/Core Clock Gating Enable
303 Store (1, ^PMES) // Clear PME Status
304 Store (1, ^PMEE) // Enable PME
306 // If device is in D3, set back to D0
307 Store (^D0D3, Local0)
308 if (LEqual (Local0, 3)) {
312 if (LNot (\ISWP())) {
313 // Set PCI 0xB0[14:13]
317 // Set MMIO 0x816C[14,2]
321 // Clear MMIO 0x8154[31]
324 // Clear MMIO 0x80e0[15]
327 // Set PCI CFG offset 0x40[11]
330 // Set PCI CFG offset 0x44[13:12]
340 Name (_PRW, Package(){ 0x6d, 3 })
342 // Leave USB ports on for to allow Wake from USB
344 Method(_S3D,0) // Highest D State in S3 State
349 Method(_S4D,0) // Highest D State in S4 State
356 Name (_ADR, 0x00000000)
358 // How many are there?
359 Device (PRT1) { Name (_ADR, 1) } // USB Port 0
360 Device (PRT2) { Name (_ADR, 2) } // USB Port 1
361 Device (PRT3) { Name (_ADR, 3) } // USB Port 2
362 Device (PRT4) { Name (_ADR, 4) } // USB Port 3
363 Device (PRT5) { Name (_ADR, 5) } // USB Port 4
364 Device (PRT6) { Name (_ADR, 6) } // USB Port 5