blob: 1626bb6f0c62bc7c0c169138a056d8aef92e259e [file] [log] [blame]
Angel Ponsae593872020-04-04 18:50:57 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Marc Jones24484842017-05-04 21:17:45 -06002
Marc Jones2e8476c2017-10-05 21:56:15 -06003/* 0:12.0 - EHCI */
4Device(EHC0) {
Marc Jones24484842017-05-04 21:17:45 -06005 Name(_ADR, 0x00120000)
Marshall Dawsonfdb846d2018-09-26 15:43:21 -06006 Name(_PRW, Package() { 0xb, 3 })
Duncan Laurie32bdffa2018-05-07 15:37:28 -07007 Device (RHUB) {
Felix Singer9df60d32022-12-26 09:43:07 +01008 Name (_ADR, 0)
Duncan Laurie32bdffa2018-05-07 15:37:28 -07009 Device (HS01) { Name (_ADR, 1) }
10 Device (HS02) { Name (_ADR, 2) }
11 Device (HS03) { Name (_ADR, 3) }
12 Device (HS04) { Name (_ADR, 4) }
13 Device (HS05) { Name (_ADR, 5) }
14 Device (HS06) { Name (_ADR, 6) }
15 Device (HS07) { Name (_ADR, 7) }
16 Device (HS08) { Name (_ADR, 8) }
17 }
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060018
19 Name(_PR0, Package() { P0U2 }) /* Indicate support for D0 */
20 Name(_PR3, Package() { P3U2 }) /* Indicate support for D3cold */
21
22 Method(_S0W,0) {
23 Return(0)
24 }
25
26 Method(_S3W,0) {
27 Return(4)
28 }
29
30 Method(_S4W,0) {
31 Return(4)
32 }
Marc Jones2e8476c2017-10-05 21:56:15 -060033} /* end EHC0 */
Marc Jones24484842017-05-04 21:17:45 -060034
Marc Jones24484842017-05-04 21:17:45 -060035
36/* 0:10.0 - XHCI 0*/
37Device(XHC0) {
38 Name(_ADR, 0x00100000)
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060039 Name(_PRW, Package() { 0xb, 3 })
Duncan Laurie32bdffa2018-05-07 15:37:28 -070040 Device (SS01) { Name (_ADR, 1) }
41 Device (SS02) { Name (_ADR, 2) }
42 Device (SS03) { Name (_ADR, 3) }
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060043
44 Name(_PR0, Package() { P0U3 }) /* Indicate support for D0 */
45 Name(_PR3, Package() { P3U3 }) /* Indicate support for D3cold */
46
47 Method(_S0W,0) {
48 Return(0)
49 }
50
51 Method(_S3W,0) {
52 Return(4)
53 }
54
55 Method(_S4W,0) {
56 Return(4)
57 }
58
Marc Jones24484842017-05-04 21:17:45 -060059} /* end XHC0 */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060060
61Scope(\_SB)
62{
63 Name(XHD0, 0)
64 Name(XHD3, 0)
65 PowerResource(P0U3, 0, 0) {
66 Method(_STA) {
67 Return(XHD0)
68 }
69 Method(_ON) {
Elyes HAOUAS86846432020-09-24 15:47:34 +020070 XHD0 = 0x01
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060071 }
72 Method(_OFF) {
Elyes HAOUAS86846432020-09-24 15:47:34 +020073 XHD0 = 0x00
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060074 }
75 }
76 PowerResource(P3U3, 0, 0) {
77 Method(_STA) {
78 Return(XHD3)
79 }
80 Method(_ON) {
Elyes HAOUAS86846432020-09-24 15:47:34 +020081 XHD3 = 0x01
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060082 }
83 Method(_OFF) {
Elyes HAOUAS86846432020-09-24 15:47:34 +020084 XHD3 = 0x00
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060085 }
86 }
87
88 Name(EHD0, 0)
89 Name(EHD3, 0)
90 PowerResource(P0U2, 0, 0) {
91 Method(_STA) {
92 Return(EHD0)
93 }
94 Method(_ON) {
Elyes HAOUAS86846432020-09-24 15:47:34 +020095 EHD0 = 0x01
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060096 }
97 Method(_OFF) {
Elyes HAOUAS86846432020-09-24 15:47:34 +020098 EHD0 = 0x00
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060099 }
100 }
101 PowerResource(P3U2, 0, 0) {
102 Method(_STA) {
103 Return(EHD3)
104 }
105 Method(_ON) {
Elyes HAOUAS86846432020-09-24 15:47:34 +0200106 EHD3 = 0x01
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600107 }
108 Method(_OFF) {
Elyes HAOUAS86846432020-09-24 15:47:34 +0200109 EHD3 = 0x00
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600110 }
111 }
112}
113
114OperationRegion(EHMC, SystemMemory, EH10, 0x100)
115Field(EHMC, DwordAcc, NoLock, Preserve)
116{
117 Offset(0xb0),
118 , 5,
119 ESIM, 1,
120}
121
122Method(U2D3,0, Serialized)
123{
Felix Singer9df60d32022-12-26 09:43:07 +0100124 if (EH10 != 0) {
Elyes HAOUAS86846432020-09-24 15:47:34 +0200125 EHBA = EH10
Felix Singer7b8ac002022-12-26 08:45:56 +0100126 EHME = 1
Elyes HAOUAS86846432020-09-24 15:47:34 +0200127 SSIM = ESIM
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600128 }
129
Elyes HAOUAS86846432020-09-24 15:47:34 +0200130 if (E_PS == 3) {
Felix Singer9df60d32022-12-26 09:43:07 +0100131 RQTY = 0
Felix Singer7b8ac002022-12-26 08:45:56 +0100132 RQ18 = 1
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600133
Elyes HAOUAS86846432020-09-24 15:47:34 +0200134 Local0 = U2SR
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600135 while (Local0) {
Elyes HAOUAS86846432020-09-24 15:47:34 +0200136 Local0 = U2SR
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600137 }
138
Felix Singer9df60d32022-12-26 09:43:07 +0100139 U2PD = 0
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600140
Elyes HAOUAS86846432020-09-24 15:47:34 +0200141 Local0 = U2DS
Felix Singer9df60d32022-12-26 09:43:07 +0100142 while (Local0 != 0) {
Elyes HAOUAS86846432020-09-24 15:47:34 +0200143 Local0 = U2DS
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600144 }
145
Elyes HAOUAS86846432020-09-24 15:47:34 +0200146 U2TD = 0x03
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600147
Elyes HAOUAS86846432020-09-24 15:47:34 +0200148 if (U3TD == 0x03) { /* Shutdown USB2 PLL */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600149 PWGC (0x40, 0)
Felix Singer7b8ac002022-12-26 08:45:56 +0100150 U2RP = 1
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600151 }
152 }
153}
154
155Method(U2D0,0, Serialized)
156{
157 PWGC (0x40, 1)
Felix Singer9df60d32022-12-26 09:43:07 +0100158 U2RP = 0
Elyes HAOUAS86846432020-09-24 15:47:34 +0200159 U2TD = 0x00
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600160
Felix Singer9df60d32022-12-26 09:43:07 +0100161 U2TD = 0
Felix Singer7b8ac002022-12-26 08:45:56 +0100162 U2PD = 1
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600163
Elyes HAOUAS86846432020-09-24 15:47:34 +0200164 Local0 = U2DS
165 while (Local0 != 0x7) {
166 Local0 = U2DS
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600167 }
168
Felix Singer7b8ac002022-12-26 08:45:56 +0100169 RQTY = 1
170 RQ18 = 1
Elyes HAOUAS86846432020-09-24 15:47:34 +0200171 Local0 = U2SR
172 while (!Local0) {
173 Local0 = U2SR
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600174 }
Elyes HAOUAS86846432020-09-24 15:47:34 +0200175 EH2C = EHID
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600176
177
Felix Singer9df60d32022-12-26 09:43:07 +0100178 if (EH10 != 0) {
Elyes HAOUAS86846432020-09-24 15:47:34 +0200179 EHBA = EH10
Felix Singer7b8ac002022-12-26 08:45:56 +0100180 EHME = 1
Elyes HAOUAS86846432020-09-24 15:47:34 +0200181 ESIM = SSIM
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600182 }
183
Elyes HAOUAS86846432020-09-24 15:47:34 +0200184 EH54 = ES54
185 EH64 = ES64
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600186}
187
188Method(LXFW,3, Serialized) //Load Xhci FirmWare
189{
Felix Singer7b8ac002022-12-26 08:45:56 +0100190 FWLM = 1 /* Firmware Load Mode */
Elyes HAOUAS86846432020-09-24 15:47:34 +0200191 ROAM = Arg0 /* ROM/RAM */
192 UA04 = Arg1
193 UA08 = Arg2
Felix Singer7b8ac002022-12-26 08:45:56 +0100194 FPLS = 1 /* Firmware Preload Start */
Elyes HAOUAS86846432020-09-24 15:47:34 +0200195 Local0 = FPLC /* Firmware Preload Complete */
196 while (!Local0) {
197 Local0 = FPLC
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600198 }
Felix Singer9df60d32022-12-26 09:43:07 +0100199 FPLS = 0
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600200}
201
202Method(U3D3,0, Serialized)
203{
Elyes HAOUAS86846432020-09-24 15:47:34 +0200204 if (U_PS == 3) {
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600205 X0_S ()
206
Elyes HAOUAS86846432020-09-24 15:47:34 +0200207 PGA3 |= 0x20 /* SwUsb3SlpShutdown */
208 Local0 = PGA3 & 0x20
209 while (!Local0) { /* wait for it to complete */
210 Local0 = PGA3 & 0x20
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600211 }
Felix Singer7b8ac002022-12-26 08:45:56 +0100212 UD3P = 1 /* U3P_D3Cold_PWRDN */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600213
Felix Singer9df60d32022-12-26 09:43:07 +0100214 U3PD = 0 /* PwrOnDev */
Elyes HAOUAS86846432020-09-24 15:47:34 +0200215 Local0 = U3DS
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600216 while (Local0) { /* RstBState, RefClkOkState, PwrRstBState */
Elyes HAOUAS86846432020-09-24 15:47:34 +0200217 Local0 = U3DS
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600218 }
219
Elyes HAOUAS86846432020-09-24 15:47:34 +0200220 U3TD = 0x3 /* TargetedDeviceState */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600221
Felix Singer7b8ac002022-12-26 08:45:56 +0100222 U3RP = 1 /* USB3_RefClk_Pwdn */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600223
Elyes HAOUAS86846432020-09-24 15:47:34 +0200224 if (U2TD == 0x3) { /* If EHCI targeted in D3cold */
225 PGA3 &= 0x9f /* SwUsb2S5RstB */
Felix Singer7b8ac002022-12-26 08:45:56 +0100226 U2RP = 1 /* USB2_RefClk_Pwdn */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600227 }
Felix Singer9df60d32022-12-26 09:43:07 +0100228 U3PG = 0 /* XhcPwrGood */
Felix Singer7b8ac002022-12-26 08:45:56 +0100229 U3PS = 1 /* Usb3PowerSel */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600230 }
231}
232
233Method(U3D0,0, Serialized)
234{
Felix Singer9df60d32022-12-26 09:43:07 +0100235 U3PS = 0 /* Usb3PowerSel */
Felix Singer7b8ac002022-12-26 08:45:56 +0100236 U3PG = 1 /* XhcPwrGood */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600237
Felix Singer9df60d32022-12-26 09:43:07 +0100238 U2RP = 0
239 U3RP = 0
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600240
Elyes HAOUAS86846432020-09-24 15:47:34 +0200241 Local0 = PGA3 & 0xdf
242 Local0 |= 0x40
243 PGA3 = Local0 /* SwUsb2S5RstB */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600244
Felix Singer9df60d32022-12-26 09:43:07 +0100245 U3TD = 0 /* TargetedDeviceState */
Felix Singer7b8ac002022-12-26 08:45:56 +0100246 U3PD = 1 /* PwrOnDev */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600247
Elyes HAOUAS86846432020-09-24 15:47:34 +0200248 Local0 = U3DS /* wait for RstBState, RefClkOkState, PwrRstBState */
249 while (Local0 != 0x7) {
250 Local0 = U3DS
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600251 }
252
Elyes HAOUAS86846432020-09-24 15:47:34 +0200253 Local0 = U3PY /* USB3 PHY Lock */
254 while (!Local0) {
255 Local0 = U3PY
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600256 }
257
Felix Singer9df60d32022-12-26 09:43:07 +0100258 U3PR = 0 /* U3P_RESTORE_RESET */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600259
Elyes HAOUAS86846432020-09-24 15:47:34 +0200260 Local0 = AUSS /* AutoSizeStart */
261 if (Local0 != 1) {
Felix Singer7b8ac002022-12-26 08:45:56 +0100262 AUSS = 1
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600263 }
Elyes HAOUAS86846432020-09-24 15:47:34 +0200264 Local0 = AUSS
265 while (Local0 != 1) {
266 Local0 = AUSS
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600267 }
268
269 LXFW (1, FW00, FW01)
270 LXFW (0, FW02, FW03)
271
272 X0_R ()
273
Felix Singer7b8ac002022-12-26 08:45:56 +0100274 U3PR = 1 /* U3P_RESTORE_RESET */
Felix Singer9df60d32022-12-26 09:43:07 +0100275 UD3P = 0 /* U3P_D3Cold_PWRDN */
Felix Singer7b8ac002022-12-26 08:45:56 +0100276 U3TD = 1 /* TargetedDeviceState */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600277}
278
279Name (SVBF, Buffer (0x1000) {0}) /* length from FchCarrizo.asl, new fields */
280CreateDWordField(SVBF, 0x000, S000) /* will be easier to add from there */
281CreateDWordField(SVBF, 0x004, S004)
282CreateDWordField(SVBF, 0x008, S008)
283CreateDWordField(SVBF, 0x00C, S00C)
284CreateDWordField(SVBF, 0x018, S018)
285CreateDWordField(SVBF, 0x01C, S01C)
286CreateDWordField(SVBF, 0x020, S020)
287CreateDWordField(SVBF, 0x030, S030)
288CreateDWordField(SVBF, 0x118, S118)
289CreateDWordField(SVBF, 0x158, S158)
290CreateDWordField(SVBF, 0x198, S198)
291CreateDWordField(SVBF, 0x1D8, S1D8)
292CreateDWordField(SVBF, 0x300, S300)
293CreateDWordField(SVBF, 0x304, S304)
294CreateDWordField(SVBF, 0x308, S308)
295CreateDWordField(SVBF, 0x30C, S30C)
296CreateDWordField(SVBF, 0x310, S310)
297CreateDWordField(SVBF, 0x428, S428)
298CreateDWordField(SVBF, 0x438, S438)
299CreateDWordField(SVBF, 0x43C, S43C)
300CreateDWordField(SVBF, 0x458, S458)
301CreateDWordField(SVBF, 0x468, S468)
302CreateDWordField(SVBF, 0x46C, S46C)
303CreateDWordField(SVBF, 0x470, S470)
304CreateDWordField(SVBF, 0x480, S480)
305CreateDWordField(SVBF, 0x484, S484)
306CreateDWordField(SVBF, 0x488, S488)
307CreateDWordField(SVBF, 0x48C, S48C)
308CreateDWordField(SVBF, 0x730, EHID) /* EHCI SSID */
309CreateDWordField(SVBF, 0x734, XHID) /* XHCI SSID */
310CreateByteField(SVBF, 0x740, ES54) /* EHCI PCIx54 */
311CreateByteField(SVBF, 0x741, ES64) /* EHCI PCIx64 */
312CreateDWordField(SVBF, 0x7B0, SSIM) /* EHCI SIM BIT */
313
314Method(X0_S,0)
315{
Elyes HAOUAS86846432020-09-24 15:47:34 +0200316 XHID = XH2C
Felix Singer9df60d32022-12-26 09:43:07 +0100317 IDEX = 0
Elyes HAOUAS86846432020-09-24 15:47:34 +0200318 S000 = DATA
319 IDEX = 0x00000004
320 S004 = DATA
321 IDEX = 0x00000008
322 S008 = DATA
323 IDEX = 0x0000000C
324 S00C = DATA
325 IDEX = 0x00000018
326 S018 = DATA
327 IDEX = 0x0000001C
328 S01C = DATA
329 IDEX = 0x00000020
330 S020 = DATA
331 IDEX = 0x00000030
332 S030 = DATA
333 IDEX = 0x00000118
334 S118 = DATA
335 IDEX = 0x00000158
336 S158 = DATA
337 IDEX = 0x00000198
338 S198 = DATA
339 IDEX = 0x000001D8
340 S1D8 = DATA
341 IDEX = 0x00000300
342 S300 = DATA
343 IDEX = 0x00000304
344 S304 = DATA
345 IDEX = 0x00000308
346 S308 = DATA
347 IDEX = 0x0000030C
348 S30C = DATA
349 IDEX = 0x00000310
350 S310 = DATA
351 IDEX = 0x40000028
352 S428 = DATA
353 IDEX = 0x40000038
354 S438 = DATA
355 IDEX = 0x4000003C
356 S43C = DATA
357 IDEX = 0x40000058
358 S458 = DATA
359 IDEX = 0x40000068
360 S468 = DATA
361 IDEX = 0x4000006C
362 S46C = DATA
363 IDEX = 0x40000070
364 S470 = DATA
365 IDEX = 0x40000080
366 S480 = DATA
367 IDEX = 0x40000084
368 S484 = DATA
369 IDEX = 0x40000088
370 S488 = DATA
371 IDEX = 0x4000008C
372 S48C = DATA
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600373}
374
375Method(X0_R,0)
376{
Elyes HAOUAS86846432020-09-24 15:47:34 +0200377 XH2C = XHID
Felix Singer9df60d32022-12-26 09:43:07 +0100378 IDEX = 0
Elyes HAOUAS86846432020-09-24 15:47:34 +0200379 DATA = S000
380 IDEX = 0x000000004
381 DATA = S004
382 IDEX = 0x000000008
383 DATA = S008
384 IDEX = 0x00000000C
385 DATA = S00C
386 IDEX = 0x000000018
387 DATA = S018
388 IDEX = 0x00000001C
389 DATA = S01C
390 IDEX = 0x000000020
391 DATA = S020
392 IDEX = 0x00000030
393 DATA = S030
394 IDEX = 0x00000118
395 DATA = S118
396 IDEX = 0x00000158
397 DATA = S158
398 IDEX = 0x00000198
399 DATA = S198
400 IDEX = 0x000001D8
401 DATA = S1D8
402 IDEX = 0x00000300
403 DATA = S300
404 IDEX = 0x00000304
405 DATA = S304
406 IDEX = 0x00000308
407 DATA = S308
408 IDEX = 0x0000030C
409 DATA = S30C
410 IDEX = 0x00000310
411 DATA = S310
412 IDEX = 0x40000028
413 DATA = S428
414 IDEX = 0x40000038
415 DATA = S438
416 IDEX = 0x4000003C
417 DATA = S43C
418 IDEX = 0x40000058
419 DATA = S458
420 IDEX = 0x40000068
421 DATA = S468
422 IDEX = 0x4000006C
423 DATA = S46C
424 IDEX = 0x40000070
425 DATA = S470
426 IDEX = 0x40000080
427 DATA = S480
428 IDEX = 0x40000084
429 DATA = S484
430 IDEX = 0x40000088
431 DATA = S488
432 IDEX = 0x4000008C
433 DATA = S48C
Marshall Dawsonfdb846d2018-09-26 15:43:21 -0600434}