Debian Codegraph @

src/soc/intel/tigerlake/acpi/tcss_pcierp.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 OperationRegion (PXCS, SystemMemory, BASE(_ADR), 0x800)
4 Field (PXCS, AnyAcc, NoLock, Preserve)
5 {
6 VDID, 32,
7 Offset(0x50), /* LCTL - Link Control Register */
8 L0SE, 1, /* 0, L0s Entry Enabled */
9 , 3,
10 LDIS, 1, /* 1, Link Disable */
11 , 3,
12 Offset(0x52), /* LSTS - Link Status Register */
13 , 13,
14 LASX, 1, /* 0, Link Active Status */
15 Offset(0x5A), /* SLSTS[7:0] - Slot Status Register */
16 ABPX, 1, /* 0, Attention Button Pressed */
17 , 2,
18 PDCX, 1, /* 3, Presence Detect Changed */
19 , 2,
20 PDSX, 1, /* 6, Presence Detect State */
21 , 1,
22 DLSC, 1, /* 8, Data Link Layer State Changed */
23 Offset(0x60), /* RSTS - Root Status Register */
24 , 16,
25 PSPX, 1, /* 16, PME Status */
26 Offset(0xA4),
27 D3HT, 2, /* Power State */
28 Offset(0xD8), /* 0xD8, MPC - Miscellaneous Port Configuration Register */
29 , 30,
30 HPEX, 1, /* 30, Hot Plug SCI Enable */
31 PMEX, 1, /* 31, Power Management SCI Enable */
32 Offset(0xE2), /* 0xE2, RPPGEN - Root Port Power Gating Enable */
33 , 2,
34 L23E, 1, /* 2, L23_Rdy Entry Request (L23ER) */
35 L23R, 1, /* 3, L23_Rdy to Detect Transition (L23R2DT) */
36 Offset(0x420), /* 0x420, PCIEPMECTL (PCIe PM Extension Control) */
37 , 30,
38 DPGE, 1, /* PCIEPMECTL[30]: Disabled, Detect and L23_Rdy State PHY Lane */
39 /* Power Gating Enable (DLSULPPGE) */
40 Offset(0x5BC), /* 0x5BC, PCIE ADVMCTRL */
41 , 3,
42 RPER, 1, /* RTD3PERST[3] */
43 RPFE, 1, /* RTD3PFETDIS[4] */
44 }
45
46 Field (PXCS, AnyAcc, NoLock, WriteAsZeros)
47 {
48 Offset(0xDC), /* 0xDC, SMSCS - SMI/SCI Status Register */
49 , 30,
50 HPSX, 1, /* 30, Hot Plug SCI Status */
51 PMSX, 1 /* 31, Power Management SCI Status */
52 }
53
54 /*
55 * _DSM Device Specific Method
56 *
57 * Arg0: UUID Unique function identifier
58 * Arg1: Integer Revision Level
59 * Arg2: Integer Function Index (0 = Return Supported Functions)
60 * Arg3: Package Parameters
61 */
62 Method (_DSM, 4, Serialized)
63 {
64 Return (Buffer() { 0x00 })
65 }
66
67 /*
68 * A bitmask of functions support
69 */
70 Name(OPTS, Buffer(2) {0, 0})
71
72 Device (PXSX)
73 {
74 Name (_ADR, 0x00000000)
75
76 /*
77 * _DSM Device Specific Method
78 *
79 * Arg0: UUID: E5C937D0-3553-4d7a-9117-EA4D19C3434D
80 * Arg1: Revision ID: 3
81 * Arg2: Function index: 0, 9
82 * Arg3: Empty package
83 */
84 Method (_DSM, 4, Serialized)
85 {
86 If (Arg0 == ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D")) {
87 If (Arg1 >= 3) {
88 If (Arg2 == 0) {
89 /*
90 * Function index: 0
91 * Standard query - A bitmask of functions supported
92 */
93 CreateBitField(OPTS, 9, FUN9)
94 FUN9 = 1
95 Return (OPTS)
96 } ElseIf (Arg2 == 9) {
97 /*
98 * Function index: 9
99 * Specifying device readiness durations
100 */
101 Return (Package() { FW_RESET_TIME, FW_DL_UP_TIME,
102 FW_FLR_RESET_TIME, FW_D3HOT_TO_D0_TIME,
103 FW_VF_ENABLE_TIME })
104 }
105 }
106 }
107 Return (Buffer() { 0x0 })
108 }
109
110 Method (_PRW, 0)
111 {
112 Return (Package() { 0x69, 4 })
113 }
114 }
115
116 Method (_DSW, 3)
117 {
118 /* If entering Sx (Arg1 > 1), need to skip TCSS D3Cold & TBT RTD3/D3Cold. */
119 If ((TUID == 0) || (TUID == 1)) {
120 \_SB.PCI0.TDM0.SD3C = Arg1
121 } Else {
122 \_SB.PCI0.TDM1.SD3C = Arg1
123 }
124
125 C2PM (Arg0, Arg1, Arg2, DCPM)
126 }
127
128 Method (_PRW, 0)
129 {
130 Return (Package() { 0x69, 4 })
131 }
132
133 /*
134 * Sub-Method of _L61 Hot-Plug event
135 * _L61 event handler should invoke this method to support HotPlug wake event from TBT RP.
136 */
137 Method (HPEV, 0, Serialized)
138 {
139 If ((VDID != 0xFFFFFFFF) && HPSX) {
140 If ((PDCX == 1) && (DLSC == 1)) {
141 /* Clear all status bits first. */
142 PDCX = 1
143 HPSX = 1
144
145 /* Perform proper notification to the OS. */
146 Notify (^, 0)
147 } Else {
148 /* False event. Clear Hot-Plug Status, then exit. */
149 HPSX = 1
150 }
151 }
152 }
153
154 /*
155 * Power Management routine for D3
156 */
157 Name (STAT, 0x1) /* Variable to save power state 1 - D0, 0 - D3C */
158
159 /*
160 * RTD3 Exit Method to bring TBT controller out of RTD3 mode.
161 */
162 Method (D3CX, 0, Serialized)
163 {
164 If (STAT == 0x1) {
165 Return
166 }
167
168 RPFE = 0 /* Set RTD3PFETDIS = 0 */
169 RPER = 0 /* Set RTD3PERST = 0 */
170 L23R = 1 /* Set L23r2dt = 1 */
171
172 /*
173 * Poll for L23r2dt == 0. Wait for transition to Detect.
174 */
175 Local0 = 0
176 Local1 = L23R
177 While (Local1) {
178 If (Local0 > 20) {
179 Break
180 }
181 Sleep(5)
182 Local0++
183 Local1 = L23R
184 }
185 STAT = 0x1
186 }
187
188 /*
189 * RTD3 Entry method to enable TBT controller RTD3 mode.
190 */
191 Method (D3CE, 0, Serialized)
192 {
193 If (STAT == 0x0) {
194 Return
195 }
196
197 L23E = 1 /* Set L23er = 1 */
198
199 /* Poll until L23er == 0 */
200 Local0 = 0
201 Local1 = L23E
202 While (Local1) {
203 If (Local0 > 20) {
204 Break
205 }
206 Sleep(5)
207 Local0++
208 Local1 = L23E
209 }
210
211 STAT = 0 /* D3Cold */
212 RPFE = 1 /* Set RTD3PFETDIS = 1 */
213 RPER = 1 /* Set RTD3PERST = 1 */
214 }
215
216 Method (_PS0, 0, Serialized)
217 {
218 HPEV () /* Check and handle Hot Plug SCI status. */
219 If (HPEX == 1) {
220 HPEX = 0 /* Disable Hot Plug SCI */
221 }
222 HPME () /* Check and handle PME SCI status */
223 If (PMEX == 1) {
224 PMEX = 0 /* Disable Power Management SCI */
225 }
226 }
227
228 Method (_PS3, 0, Serialized)
229 {
230 /* Check it is hotplug SCI or not, then clear PDC accordingly */
231 If (PDCX == 1) {
232 If (DLSC == 0) {
233 /* Clear PDC since it is not a hotplug. */
234 PDCX = 1
235 }
236 }
237
238 If (HPEX == 0) {
239 HPEX = 1 /* Enable Hot Plug SCI. */
240 HPEV () /* Check and handle Hot Plug SCI status. */
241 }
242 If (PMEX == 0) {
243 PMEX = 1 /* Enable Power Management SCI. */
244 HPME () /* Check and handle PME SCI status. */
245 }
246 }
247
248 Method (_S0W, 0x0, NotSerialized)
249 {
250 #if CONFIG(D3COLD_SUPPORT)
251 Return (0x4)
252 #else
253 Return (0x3)
254 #endif // D3COLD_SUPPORT
255 }
256
257 Method (_PR0)
258 {
259 #if CONFIG(D3COLD_SUPPORT)
260 If ((TUID == 0) || (TUID == 1)) {
261 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
262 } Else {
263 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
264 }
265 #else
266 If ((TUID == 0) || (TUID == 1)) {
267 Return (Package() { \_SB.PCI0.TBT0 })
268 } Else {
269 Return (Package() { \_SB.PCI0.TBT1 })
270 }
271 #endif // D3COLD_SUPPORT
272 }
273
274 Method (_PR3)
275 {
276 #if CONFIG(D3COLD_SUPPORT)
277 If ((TUID == 0) || (TUID == 1)) {
278 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
279 } Else {
280 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
281 }
282 #else
283 If ((TUID == 0) || (TUID == 1)) {
284 Return (Package() { \_SB.PCI0.TBT0 })
285 } Else {
286 Return (Package() { \_SB.PCI0.TBT1 })
287 }
288 #endif // D3COLD_SUPPORT
289 }
290
291 /*
292 * PCI_EXP_STS Handler for PCIE Root Port
293 */
294 Method (HPME, 0, Serialized)
295 {
296 If ((VDID != 0xFFFFFFFF) && (PMSX == 1)) { /* if port exists and PME SCI Status set */
297 /*
298 * Notify child device; this will cause its driver to clear PME_Status from
299 * device.
300 */
301 Notify (PXSX, 0x2)
302 PMSX = 1 /* clear rootport's PME SCI status */
303 /*
304 * Consume one pending PME notification to prevent it from blocking the queue.
305 */
306 PSPX = 1
307 Return (0x01)
308 }
309 Return (0x00)
310 }