Debian Codegraph @

src/soc/intel/skylake/acpi/xhci.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <intelblocks/xhci.h>
4
5 /* Include UWES method for enabling USB wake */
6 #include <soc/intel/common/acpi/xhci_wake.asl>
7
8 /* XHCI Controller 0:14.0 */
9
10 Device (XHCI)
11 {
12 Name (_ADR, 0x00140000)
13
14 Name (_PRW, Package () { GPE0_PME_B0, 3 })
15
16 Method (_DSW, 3)
17 {
18 PMEE = Arg0
19 UWES ((\U2WE & 0x3FF), PORTSCN_OFFSET, XMEM)
20 UWES ((\U3WE & 0x3F ), PORTSCXUSB3_OFFSET, XMEM)
21 }
22
23 Name (_S3D, 3) /* D3 supported in S3 */
24 Name (_S4D, 3) /* D3 supported in S4 */
25 Name (_S0W, 3) /* D3 can wake device in S0 */
26 Name (_S3W, 3) /* D3 can wake system from S3 */
27 Name (_S4W, 3) /* D3 can wake system from S4 */
28
29 OperationRegion (XPRT, PCI_Config, 0x00, 0x100)
30 Field (XPRT, AnyAcc, NoLock, Preserve)
31 {
32 DVID, 16, /* VENDORID */
33 Offset (0x10),
34 , 16,
35 XMEM, 16, /* MEM_BASE */
36 Offset (0x50), /* XHCLKGTEN */
37 , 2,
38 STGE, 1, /* SS Link Trunk clock gating enable */
39 Offset (0x74),
40 D0D3, 2, /* POWERSTATE */
41 , 6,
42 PMEE, 1, /* PME_EN */
43 , 6,
44 PMES, 1, /* PME_STS */
45 Offset (0xA2),
46 , 2,
47 D3HE, 1, /* D3_hot_en */
48 }
49
50 OperationRegion (XREG, SystemMemory, (XMEM << 16) + 0x8000, 0x200)
51 Field (XREG, DWordAcc, Lock, Preserve)
52 {
53 Offset (0x1c4), /* USB2PMCTRL */
54 , 2,
55 UPSW, 2, /* U2PSUSPGP */
56 }
57
58 Method (_PSC, 0, Serialized)
59 {
60 Return (^D0D3)
61 }
62
63 Method (_PS0, 0, Serialized)
64 {
65 If (^DVID != 0xFFFF) {
66 If (!((^XMEM == 0xFFFF) || (^XMEM == 0x0000))) {
67
68 /* Disable d3hot and SS link trunk clock gating */
69 ^D3HE = 0
70 ^STGE = 0
71
72 /* If device is in D3, set back to D0 */
73 If (^D0D3 == 3) {
74 Local0 = 0
75 ^D0D3 = Local0
76 Local0 = ^D0D3
77 }
78
79 /* Disable USB2 PHY SUS Well Power Gating */
80 ^UPSW = 0
81
82 /*
83 * Apply USB2 PHPY Power Gating workaround if needed.
84 */
85 If (^^PMC.UWAB) {
86 /* Write to MTPMC to have PMC disable power gating */
87 ^^PMC.MPMC = 1
88
89 /* Wait for PCH_PM_STS.MSG_FULL_STS to be 0 */
90 Local0 = 10
91 While (^^PMC.PMFS) {
92 If (!Local0) {
93 Break
94 }
95 Local0--
96 Sleep (10)
97 }
98 }
99 }
100 }
101 }
102
103 Method (_PS3, 0, Serialized)
104 {
105 If (^DVID != 0xFFFF) {
106 If (!((^XMEM == 0xFFFF) || (^XMEM == 0x0000))) {
107
108 /* Clear PME Status */
109 ^PMES = 1
110
111 /* Enable PME */
112 ^PMEE= 1
113
114 /* If device is in D3, set back to D0 */
115 If (^D0D3 == 3) {
116 Local0 = 0
117 ^D0D3 = Local0
118 Local0 = ^D0D3
119 }
120
121 /* Enable USB2 PHY SUS Well Power Gating in D0/D0i2/D0i3/D3 */
122 ^UPSW = 3
123
124 /* Enable d3hot and SS link trunk clock gating */
125 ^D3HE = 1
126 ^STGE = 1
127
128 /* Now put device in D3 */
129 Local0 = 3
130 ^D0D3 = Local0
131 Local0 = ^D0D3
132
133 /*
134 * Apply USB2 PHPY Power Gating workaround if needed.
135 * This code assumes XDCI is disabled, if it is enabled
136 * then this must also check if it is in D3 state too.
137 */
138 If (^^PMC.UWAB) {
139 /* Write to MTPMC to have PMC enable power gating */
140 ^^PMC.MPMC = 3
141
142 /* Wait for PCH_PM_STS.MSG_FULL_STS to be 0 */
143 Local0 = 10
144 While (^^PMC.PMFS) {
145 If (!Local0) {
146 Break
147 }
148 Local0--
149 Sleep (10)
150 }
151 }
152 }
153 }
154 }
155
156 /* Root Hub for Skylake-LP PCH */
157 Device (RHUB)
158 {
159 Name (_ADR, 0)
160
161 // GPLD: Generate Port Location Data (PLD)
162 Method (GPLD, 1, Serialized)
163 {
164
165 Name (PCKG, Package (0x01)
166 {
167 Buffer (0x10) {}
168 })
169
170 // REV: Revision 0x02 for ACPI 5.0
171 CreateField (DerefOf (PCKG[0]), 0, 0x07, REV)
172 REV = 0x02
173
174 // VISI: Port visibility to user per port
175 CreateField (DerefOf (PCKG[0]), 0x40, 1, VISI)
176 VISI = Arg0
177
178 Return (PCKG)
179 }
180
181 /* USB2 */
182 Device (HS01) { Name (_ADR, 1) }
183 Device (HS02) { Name (_ADR, 2) }
184 Device (HS03) { Name (_ADR, 3) }
185 Device (HS04) { Name (_ADR, 4) }
186 Device (HS05) { Name (_ADR, 5) }
187 Device (HS06) { Name (_ADR, 6) }
188 Device (HS07) { Name (_ADR, 7) }
189 Device (HS08) { Name (_ADR, 8) }
190 Device (HS09) { Name (_ADR, 9) }
191 Device (HS10) { Name (_ADR, 10) }
192
193 /* USBr */
194 Device (USR1) { Name (_ADR, 11) }
195 Device (USR2) { Name (_ADR, 12) }
196
197 /* USB3 */
198 Device (SS01) { Name (_ADR, 13) }
199 Device (SS02) { Name (_ADR, 14) }
200 Device (SS03) { Name (_ADR, 15) }
201 Device (SS04) { Name (_ADR, 16) }
202 Device (SS05) { Name (_ADR, 17) }
203 Device (SS06) { Name (_ADR, 18) }
204 }
205 }