1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 OperationRegion (PXCS, SystemMemory, BASE(_ADR), 0x800)
4 Field (PXCS, AnyAcc, NoLock, Preserve)
7 Offset(0x50), /* LCTL - Link Control Register */
8 L0SE, 1, /* 0, L0s Entry Enabled */
10 LDIS, 1, /* 1, Link Disable */
12 Offset(0x52), /* LSTS - Link Status Register */
14 LASX, 1, /* 0, Link Active Status */
15 Offset(0x5A), /* SLSTS[7:0] - Slot Status Register */
16 ABPX, 1, /* 0, Attention Button Pressed */
18 PDCX, 1, /* 3, Presence Detect Changed */
20 PDSX, 1, /* 6, Presence Detect State */
22 DLSC, 1, /* 8, Data Link Layer State Changed */
23 Offset(0x60), /* RSTS - Root Status Register */
25 PSPX, 1, /* 16, PME Status */
27 D3HT, 2, /* Power State */
28 Offset(0xD8), /* 0xD8, MPC - Miscellaneous Port Configuration Register */
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 */
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) */
38 DPGE, 1, /* PCIEPMECTL[30]: Disabled, Detect and L23_Rdy State PHY Lane */
39 /* Power Gating Enable (DLSULPPGE) */
40 Offset(0x5BC), /* 0x5BC, PCIE ADVMCTRL */
42 RPER, 1, /* RTD3PERST[3] */
43 RPFE, 1, /* RTD3PFETDIS[4] */
46 Field (PXCS, AnyAcc, NoLock, WriteAsZeros)
48 Offset(0xDC), /* 0xDC, SMSCS - SMI/SCI Status Register */
50 HPSX, 1, /* 30, Hot Plug SCI Status */
51 PMSX, 1 /* 31, Power Management SCI Status */
55 * _DSM Device Specific Method
57 * Arg0: UUID Unique function identifier
58 * Arg1: Integer Revision Level
59 * Arg2: Integer Function Index (0 = Return Supported Functions)
60 * Arg3: Package Parameters
62 Method (_DSM, 4, Serialized)
64 Return (Buffer() { 0x00 })
68 * A bitmask of functions support
70 Name(OPTS, Buffer(2) {0, 0})
74 Name (_ADR, 0x00000000)
77 * _DSM Device Specific Method
79 * Arg0: UUID: E5C937D0-3553-4d7a-9117-EA4D19C3434D
80 * Arg1: Revision ID: 3
81 * Arg2: Function index: 0, 9
84 Method (_DSM, 4, Serialized)
86 If (Arg0 == ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D")) {
91 * Standard query - A bitmask of functions supported
93 CreateBitField(OPTS, 9, FUN9)
96 } ElseIf (Arg2 == 9) {
99 * Specifying device readiness durations
101 Return (Package() { FW_RESET_TIME, FW_DL_UP_TIME,
102 FW_FLR_RESET_TIME, FW_D3HOT_TO_D0_TIME,
107 Return (Buffer() { 0x0 })
112 Return (Package() { 0x69, 4 })
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
122 \_SB.PCI0.TDM1.SD3C = Arg1
125 C2PM (Arg0, Arg1, Arg2, DCPM)
130 Return (Package() { 0x69, 4 })
134 * Sub-Method of _L61 Hot-Plug event
135 * _L61 event handler should invoke this method to support HotPlug wake event from TBT RP.
137 Method (HPEV, 0, Serialized)
139 If ((VDID != 0xFFFFFFFF) && HPSX) {
140 If ((PDCX == 1) && (DLSC == 1)) {
141 /* Clear all status bits first. */
145 /* Perform proper notification to the OS. */
148 /* False event. Clear Hot-Plug Status, then exit. */
155 * Power Management routine for D3
157 Name (STAT, 0x1) /* Variable to save power state 1 - D0, 0 - D3C */
160 * RTD3 Exit Method to bring TBT controller out of RTD3 mode.
162 Method (D3CX, 0, Serialized)
168 RPFE = 0 /* Set RTD3PFETDIS = 0 */
169 RPER = 0 /* Set RTD3PERST = 0 */
170 L23R = 1 /* Set L23r2dt = 1 */
173 * Poll for L23r2dt == 0. Wait for transition to Detect.
189 * RTD3 Entry method to enable TBT controller RTD3 mode.
191 Method (D3CE, 0, Serialized)
197 L23E = 1 /* Set L23er = 1 */
199 /* Poll until L23er == 0 */
211 STAT = 0 /* D3Cold */
212 RPFE = 1 /* Set RTD3PFETDIS = 1 */
213 RPER = 1 /* Set RTD3PERST = 1 */
216 Method (_PS0, 0, Serialized)
218 HPEV () /* Check and handle Hot Plug SCI status. */
220 HPEX = 0 /* Disable Hot Plug SCI */
222 HPME () /* Check and handle PME SCI status */
224 PMEX = 0 /* Disable Power Management SCI */
228 Method (_PS3, 0, Serialized)
230 /* Check it is hotplug SCI or not, then clear PDC accordingly */
233 /* Clear PDC since it is not a hotplug. */
239 HPEX = 1 /* Enable Hot Plug SCI. */
240 HPEV () /* Check and handle Hot Plug SCI status. */
243 PMEX = 1 /* Enable Power Management SCI. */
244 HPME () /* Check and handle PME SCI status. */
248 Method (_S0W, 0x0, NotSerialized)
250 #if CONFIG(D3COLD_SUPPORT)
254 #endif // D3COLD_SUPPORT
259 #if CONFIG(D3COLD_SUPPORT)
260 If ((TUID == 0) || (TUID == 1)) {
261 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
263 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
266 If ((TUID == 0) || (TUID == 1)) {
267 Return (Package() { \_SB.PCI0.TBT0 })
269 Return (Package() { \_SB.PCI0.TBT1 })
271 #endif // D3COLD_SUPPORT
276 #if CONFIG(D3COLD_SUPPORT)
277 If ((TUID == 0) || (TUID == 1)) {
278 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
280 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
283 If ((TUID == 0) || (TUID == 1)) {
284 Return (Package() { \_SB.PCI0.TBT0 })
286 Return (Package() { \_SB.PCI0.TBT1 })
288 #endif // D3COLD_SUPPORT
292 * PCI_EXP_STS Handler for PCIE Root Port
294 Method (HPME, 0, Serialized)
296 If ((VDID != 0xFFFFFFFF) && (PMSX == 1)) { /* if port exists and PME SCI Status set */
298 * Notify child device; this will cause its driver to clear PME_Status from
302 PMSX = 1 /* clear rootport's PME SCI status */
304 * Consume one pending PME notification to prevent it from blocking the queue.