blob: f0ee414b528a12df3d05cc2a004abcff9e9480cf [file] [log] [blame]
Lee Leahyb0005132015-05-12 18:19:47 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2014 Google Inc.
Lee Leahy1d14b3e2015-05-12 18:23:27 -07006 * Copyright (C) 2015 Intel Corporation.
Lee Leahyb0005132015-05-12 18:19:47 -07007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
Lee Leahy1d14b3e2015-05-12 18:23:27 -070019 * Foundation, Inc.
Lee Leahyb0005132015-05-12 18:19:47 -070020 */
21
Lee Leahy1d14b3e2015-05-12 18:23:27 -070022/* XHCI Controller 0:14.0 */
Lee Leahyb0005132015-05-12 18:19:47 -070023
24Device (XHCI)
25{
26 Name (_ADR, 0x00140000)
27
Lee Leahy1d14b3e2015-05-12 18:23:27 -070028 Name (PLSD, 5) /* Port Link State - RxDetect */
29 Name (PLSP, 7) /* Port Link State - Polling */
Lee Leahyb0005132015-05-12 18:19:47 -070030
31 OperationRegion (XPRT, PCI_Config, 0x00, 0x100)
32 Field (XPRT, AnyAcc, NoLock, Preserve)
33 {
34 Offset (0x0),
35 DVID, 16,
36 Offset (0x10),
37 , 16,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070038 XMEM, 16, /* MEM_BASE */
Lee Leahyb0005132015-05-12 18:19:47 -070039 Offset (0x74),
40 D0D3, 2,
41 , 6,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070042 PMEE, 1, /* PME_EN */
Lee Leahyb0005132015-05-12 18:19:47 -070043 , 6,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070044 PMES, 1, /* PME_STS */
45 Offset (0xA8),
46 , 13,
47 MW13, 1,
48 MW14, 1,
49 , 17,
Lee Leahyb0005132015-05-12 18:19:47 -070050 Offset (0xb0),
51 , 13,
52 MB13, 1,
53 MB14, 1,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070054 , 17,
Lee Leahyb0005132015-05-12 18:19:47 -070055 Offset (0xd0),
Lee Leahy1d14b3e2015-05-12 18:23:27 -070056 PR2, 32, /* USB2PR */
57 PR2M, 32, /* USB2PRM */
58 PR3, 32, /* USB3PR */
59 PR3M, 32, /* USB3PRM */
Lee Leahyb0005132015-05-12 18:19:47 -070060 }
61
Lee Leahy1d14b3e2015-05-12 18:23:27 -070062 Method (USRA,0){
63 Return(11)
64 }
65
66 Method (SSPA,0){
67 Return (13)
68 }
69
70 /* Clear status bits */
Lee Leahyb0005132015-05-12 18:19:47 -070071 Method (LPCL, 0, Serialized)
72 {
73 OperationRegion (XREG, SystemMemory,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070074 ShiftLeft (^XMEM, 16), 0x600)
Lee Leahyb0005132015-05-12 18:19:47 -070075 Field (XREG, DWordAcc, Lock, Preserve)
76 {
Lee Leahy1d14b3e2015-05-12 18:23:27 -070077 Offset (0x510), /* PORTSCNUSB3[0]*/
Lee Leahyb0005132015-05-12 18:19:47 -070078 PSC0, 32,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070079 Offset (0x520), /* PORTSCNUSB3[1]*/
Lee Leahyb0005132015-05-12 18:19:47 -070080 PSC1, 32,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070081 Offset (0x530), /* PORTSCNUSB3[2]*/
Lee Leahyb0005132015-05-12 18:19:47 -070082 PSC2, 32,
Lee Leahy1d14b3e2015-05-12 18:23:27 -070083 Offset (0x540), /* PORTSCNUSB3[3]*/
Lee Leahyb0005132015-05-12 18:19:47 -070084 PSC3, 32,
85 }
86
Lee Leahy1d14b3e2015-05-12 18:23:27 -070087 /* Port Enabled/Disabled (Bit 1)*/
Lee Leahyb0005132015-05-12 18:19:47 -070088 Name (PEDB, ShiftLeft (1, 1))
89
Lee Leahy1d14b3e2015-05-12 18:23:27 -070090 /* Change Status (Bits 23:17)*/
Lee Leahyb0005132015-05-12 18:19:47 -070091 Name (CHST, ShiftLeft (0x7f, 17))
92
Lee Leahy1d14b3e2015-05-12 18:23:27 -070093 /* Port 0 */
Lee Leahyb0005132015-05-12 18:19:47 -070094 And (PSC0, Not (PEDB), Local0)
95 Or (Local0, CHST, PSC0)
96
Lee Leahy1d14b3e2015-05-12 18:23:27 -070097 /* Port 1 */
Lee Leahyb0005132015-05-12 18:19:47 -070098 And (PSC1, Not (PEDB), Local0)
99 Or (Local0, CHST, PSC1)
100
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700101 /* Port 2 */
Lee Leahyb0005132015-05-12 18:19:47 -0700102 And (PSC2, Not (PEDB), Local0)
103 Or (Local0, CHST, PSC2)
104
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700105 /* Port 3 */
Lee Leahyb0005132015-05-12 18:19:47 -0700106 And (PSC3, Not (PEDB), Local0)
107 Or (Local0, CHST, PSC3)
108 }
109
110 Method (LPS0, 0, Serialized)
111 {
112 OperationRegion (XREG, SystemMemory,
113 ShiftLeft (^XMEM, 16), 0x600)
114 Field (XREG, DWordAcc, Lock, Preserve)
115 {
116 Offset (0x510), // PORTSCNUSB3
117 , 5,
118 PLS1, 4, // [8:5] Port Link State
119 PPR1, 1, // [9] Port Power
120 , 7,
121 CSC1, 1, // [17] Connect Status Change
122 , 1,
123 WRC1, 1, // [19] Warm Port Reset Change
124 , 11,
125 WPR1, 1, // [31] Warm Port Reset
126 Offset (0x520), // PORTSCNUSB3
127 , 5,
128 PLS2, 4, // [8:5] Port Link State
129 PPR2, 1, // [9] Port Power
130 , 7,
131 CSC2, 1, // [17] Connect Status Change
132 , 1,
133 WRC2, 1, // [19] Warm Port Reset Change
134 , 11,
135 WPR2, 1, // [31] Warm Port Reset
136 Offset (0x530), // PORTSCNUSB3
137 , 5,
138 PLS3, 4, // [8:5] Port Link State
139 PPR3, 1, // [9] Port Power
140 , 7,
141 CSC3, 1, // [17] Connect Status Change
142 , 1,
143 WRC3, 1, // [19] Warm Port Reset Change
144 , 11,
145 WPR3, 1, // [31] Warm Port Reset
146 Offset (0x540), // PORTSCNUSB3
147 , 5,
148 PLS4, 4, // [8:5] Port Link State
149 PPR4, 1, // [9] Port Power
150 , 7,
151 CSC4, 1, // [17] Connect Status Change
152 , 1,
153 WRC4, 1, // [19] Warm Port Reset Change
154 , 11,
155 WPR4, 1, // [31] Warm Port Reset
156 }
157
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700158 /* Wait for all powered ports to finish polling*/
Lee Leahyb0005132015-05-12 18:19:47 -0700159 Store (10, Local0)
160 While (LOr (LOr (LAnd (LEqual (PPR1, 1), LEqual (PLS1, PLSP)),
161 LAnd (LEqual (PPR2, 1), LEqual (PLS2, PLSP))),
162 LOr (LAnd (LEqual (PPR3, 1), LEqual (PLS3, PLSP)),
163 LAnd (LEqual (PPR4, 1), LEqual (PLS4, PLSP)))))
164 {
165 If (LEqual (Local0, 0)) {
166 Break
167 }
168 Decrement (Local0)
169 Stall (10)
170 }
171
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700172 /* For each USB3 Port:*/
173 /* If port is disconnected (PLS=5 PP=1 CSC=0)*/
174 /* 1) Issue warm reset (WPR=1)*/
175 /* 2) Poll for warm reset complete (WRC=0)*/
176 /* 3) Write 1 to port status to clear*/
Lee Leahyb0005132015-05-12 18:19:47 -0700177
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700178 /* Local# indicate if port is reset*/
Lee Leahyb0005132015-05-12 18:19:47 -0700179 Store (0, Local1)
180 Store (0, Local2)
181 Store (0, Local3)
182 Store (0, Local4)
183
184 If (LAnd (LEqual (PLS1, PLSD),
185 LAnd (LEqual (CSC1, 0), LEqual (PPR1, 1)))) {
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700186 Store (1, WPR1) /* Issue warm reset*/
Lee Leahyb0005132015-05-12 18:19:47 -0700187 Store (1, Local1)
188 }
189 If (LAnd (LEqual (PLS2, PLSD),
190 LAnd (LEqual (CSC2, 0), LEqual (PPR2, 1)))) {
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700191 Store (1, WPR2) /* Issue warm reset*/
Lee Leahyb0005132015-05-12 18:19:47 -0700192 Store (1, Local2)
193 }
194 If (LAnd (LEqual (PLS3, PLSD),
195 LAnd (LEqual (CSC3, 0), LEqual (PPR3, 1)))) {
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700196 Store (1, WPR3) /* Issue warm reset*/
Lee Leahyb0005132015-05-12 18:19:47 -0700197 Store (1, Local3)
198 }
199 If (LAnd (LEqual (PLS4, PLSD),
200 LAnd (LEqual (CSC4, 0), LEqual (PPR4, 1)))) {
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700201 Store (1, WPR4) /* Issue warm reset*/
Lee Leahyb0005132015-05-12 18:19:47 -0700202 Store (1, Local4)
203 }
204
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700205 /* Poll for warm reset complete on all ports that were reset*/
Lee Leahyb0005132015-05-12 18:19:47 -0700206 Store (10, Local0)
207 While (LOr (LOr (LAnd (LEqual (Local1, 1), LEqual (WRC1, 0)),
208 LAnd (LEqual (Local2, 1), LEqual (WRC2, 0))),
209 LOr (LAnd (LEqual (Local3, 1), LEqual (WRC3, 0)),
210 LAnd (LEqual (Local4, 1), LEqual (WRC4, 0)))))
211 {
212 If (LEqual (Local0, 0)) {
213 Break
214 }
215 Decrement (Local0)
216 Stall (10)
217 }
218
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700219 /* Clear status bits in all ports */
Lee Leahyb0005132015-05-12 18:19:47 -0700220 LPCL ()
221 }
222
223 Method (_PSC, 0, NotSerialized)
224 {
225 Return (^D0D3)
226 }
227
228 Method (_PS0, 0, Serialized)
229 {
Lee Leahyb0005132015-05-12 18:19:47 -0700230 }
Lee Leahyb0005132015-05-12 18:19:47 -0700231 Method (_PS3, 0, Serialized)
232 {
Lee Leahyb0005132015-05-12 18:19:47 -0700233 }
234
235 Name (_PRW, Package(){ 0x6d, 3 })
236
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700237 /* Leave USB ports on for to allow Wake from USB */
Lee Leahyb0005132015-05-12 18:19:47 -0700238
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700239 Method (_S3D,0) /* Highest D State in S3 State*/
Lee Leahyb0005132015-05-12 18:19:47 -0700240 {
241 Return (3)
242 }
243
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700244 Method (_S4D,0) /* Highest D State in S4 State*/
Lee Leahyb0005132015-05-12 18:19:47 -0700245 {
246 Return (3)
247 }
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700248 Device (HS01)
Lee Leahyb0005132015-05-12 18:19:47 -0700249 {
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700250 Name(_ADR, 0x01)
251 }
252 Device (HS02)
253 {
254 Name(_ADR, 0x02)
255 }
256 Device (HS03)
257 {
258 Name(_ADR, 0x03)
259 }
260 Device (HS04)
261 {
262 Name(_ADR, 0x04)
263 }
264 Device (HS05)
265 {
266 Name(_ADR, 0x05)
267 }
268 Device (HS06)
269 {
270 Name(_ADR, 0x06)
271 }
272 Device (HS07)
273 {
274 Name(_ADR, 0x07)
275 }
276 Device (HS08)
277 {
278 Name(_ADR, 0x08)
279 }
280 Device (HS09)
281 {
282 Name(_ADR, 0x09)
283 }
284 Device (HS10)
285 {
286 Name(_ADR, 0x10)
287 }
288 Device (USR1)
289 {
290 Method(_ADR) { Return (Add(USRA(),0)) }
291 }
292 Device (USR2)
293 {
294 Method(_ADR) { Return (Add(USRA(),1)) }
295 }
296 Device (SS01)
297 {
298 Method(_ADR) { Return (Add(SSPA(),0)) }
299 }
300 Device (SS02)
301 {
302 Method(_ADR) { Return (Add(SSPA(),1)) }
303 }
304 Device (SS03)
305 {
306 Method(_ADR) { Return (Add(SSPA(),2)) }
307 }
308 Device (SS04)
309 {
310 Method(_ADR) { Return (Add(SSPA(),3)) }
311 }
312 Device (SS05)
313 {
314 Method(_ADR) { Return (Add(SSPA(),4)) }
315 }
316 Device (SS06)
317 {
318 Method(_ADR) { Return (Add(SSPA(),5)) }
Lee Leahyb0005132015-05-12 18:19:47 -0700319 }
320}
321