1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * TCSS PCIE RP Channel Configuration (CCFG) Config Space register offsets
5 * MPC - Miscellaneous Port Configuration Register
6 * RPPGEN - Root Port Power Gating Enable Register
7 * SMSCS - SMI/SCI Status Register
9 #if CONFIG(SOC_INTEL_METEORLAKE_PRE_PRODUCTION_SILICON)
10 #define PXCS_OPREGION_SIZE 0x800
11 #define TCSS_CFG_MPC_FROM_CCFG 0xD8
12 #define TCSS_CFG_SMSCS_FROM_CCFG 0xDC
13 #define TCSS_CFG_RPPGEN_FROM_CCFG 0xE2
15 #define PXCS_OPREGION_SIZE 0xC00
16 #define TCSS_CFG_MPC_FROM_CCFG 0xBA8
17 #define TCSS_CFG_SMSCS_FROM_CCFG 0xBAC
18 #define TCSS_CFG_RPPGEN_FROM_CCFG 0xBB2
21 OperationRegion (PXCS, SystemMemory, BASE(_ADR), PXCS_OPREGION_SIZE)
22 Field (PXCS, AnyAcc, NoLock, Preserve)
25 Offset(0x50), /* LCTL - Link Control Register */
26 L0SE, 1, /* 0, L0s Entry Enabled */
28 LDIS, 1, /* 1, Link Disable */
30 Offset(0x52), /* LSTS - Link Status Register */
32 LASX, 1, /* 0, Link Active Status */
33 Offset(0x5A), /* SLSTS[7:0] - Slot Status Register */
34 ABPX, 1, /* 0, Attention Button Pressed */
36 PDCX, 1, /* 3, Presence Detect Changed */
38 PDSX, 1, /* 6, Presence Detect State */
40 DLSC, 1, /* 8, Data Link Layer State Changed */
41 Offset(0x60), /* RSTS - Root Status Register */
43 PSPX, 1, /* 16, PME Status */
45 D3HT, 2, /* Power State */
46 #if CONFIG(SOC_INTEL_METEORLAKE_PRE_PRODUCTION_SILICON)
47 Offset(TCSS_CFG_MPC_FROM_CCFG),
49 HPEX, 1, /* 30, Hot Plug SCI Enable */
50 PMEX, 1, /* 31, Power Management SCI Enable */
51 Offset(TCSS_CFG_RPPGEN_FROM_CCFG),
53 L23E, 1, /* 2, L23_Rdy Entry Request (L23ER) */
54 L23R, 1, /* 3, L23_Rdy to Detect Transition (L23R2DT) */
55 Offset(0x420), /* 0x420, PCIEPMECTL (PCIe PM Extension Control) */
57 DPGE, 1, /* PCIEPMECTL[30]: Disabled, Detect and L23_Rdy State PHY Lane */
58 /* Power Gating Enable (DLSULPPGE) */
59 Offset(0x5BC), /* 0x5BC, PCIE ADVMCTRL */
61 RPER, 1, /* RTD3PERST[3] */
62 RPFE, 1, /* RTD3PFETDIS[4] */
64 Offset(0x420), /* 0x420, PCIEPMECTL (PCIe PM Extension Control) */
66 DPGE, 1, /* PCIEPMECTL[30]: Disabled, Detect and L23_Rdy State PHY Lane */
67 /* Power Gating Enable (DLSULPPGE) */
68 Offset(0x5BC), /* 0x5BC, PCIE ADVMCTRL */
70 RPER, 1, /* RTD3PERST[3] */
71 RPFE, 1, /* RTD3PFETDIS[4] */
72 Offset(TCSS_CFG_MPC_FROM_CCFG),
74 HPEX, 1, /* 30, Hot Plug SCI Enable */
75 PMEX, 1, /* 31, Power Management SCI Enable */
76 Offset(TCSS_CFG_RPPGEN_FROM_CCFG),
78 L23E, 1, /* 2, L23_Rdy Entry Request (L23ER) */
79 L23R, 1, /* 3, L23_Rdy to Detect Transition (L23R2DT) */
83 Field (PXCS, AnyAcc, NoLock, WriteAsZeros)
85 Offset(TCSS_CFG_SMSCS_FROM_CCFG),
87 HPSX, 1, /* 30, Hot Plug SCI Status */
88 PMSX, 1 /* 31, Power Management SCI Status */
92 * _DSM Device Specific Method
94 * Arg0: UUID Unique function identifier
95 * Arg1: Integer Revision Level
96 * Arg2: Integer Function Index (0 = Return Supported Functions)
97 * Arg3: Package Parameters
99 Method (_DSM, 4, Serialized)
101 Return (Buffer() { 0x00 })
105 * A bitmask of functions support
107 Name(OPTS, Buffer(2) {0, 0})
111 Name (_ADR, 0x00000000)
114 * _DSM Device Specific Method
116 * Arg0: UUID: E5C937D0-3553-4d7a-9117-EA4D19C3434D
117 * Arg1: Revision ID: 3
118 * Arg2: Function index: 0, 9
119 * Arg3: Empty package
121 Method (_DSM, 4, Serialized)
123 If (Arg0 == ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D")) {
128 * Standard query - A bitmask of functions supported
130 CreateBitField(OPTS, 9, FUN9)
133 } ElseIf (Arg2 == 9) {
136 * Specifying device readiness durations
138 Return (Package() { FW_RESET_TIME, FW_DL_UP_TIME,
139 FW_FLR_RESET_TIME, FW_D3HOT_TO_D0_TIME,
144 Return (Buffer() { 0x0 })
149 Return (Package() { 0x69, 4 })
155 /* If entering Sx (Arg1 > 1), need to skip TCSS D3Cold & TBT RTD3/D3Cold. */
156 If ((TUID == 0) || (TUID == 1)) {
157 \_SB.PCI0.TDM0.SD3C = Arg1
159 \_SB.PCI0.TDM1.SD3C = Arg1
162 C2PM (Arg0, Arg1, Arg2, DCPM)
167 Return (Package() { 0x69, 4 })
171 * Sub-Method of _L61 Hot-Plug event
172 * _L61 event handler should invoke this method to support HotPlug wake event from TBT RP.
174 Method (HPEV, 0, Serialized)
176 If ((VDID != 0xFFFFFFFF) && HPSX) {
177 If ((PDCX == 1) && (DLSC == 1)) {
178 /* Clear all status bits first. */
182 /* Perform proper notification to the OS. */
185 /* False event. Clear Hot-Plug Status, then exit. */
192 * Power Management routine for D3
194 Name (STAT, 0x1) /* Variable to save power state 1 - D0, 0 - D3C */
197 * RTD3 Exit Method to bring TBT controller out of RTD3 mode.
199 Method (D3CX, 0, Serialized)
205 RPFE = 0 /* Set RTD3PFETDIS = 0 */
206 RPER = 0 /* Set RTD3PERST = 0 */
207 L23R = 1 /* Set L23r2dt = 1 */
210 * Poll for L23r2dt == 0. Wait for transition to Detect.
226 * RTD3 Entry method to enable TBT controller RTD3 mode.
228 Method (D3CE, 0, Serialized)
234 L23E = 1 /* Set L23er = 1 */
236 /* Poll until L23er == 0 */
248 STAT = 0 /* D3Cold */
249 RPFE = 1 /* Set RTD3PFETDIS = 1 */
250 RPER = 1 /* Set RTD3PERST = 1 */
253 Method (_PS0, 0, Serialized)
255 HPEV () /* Check and handle Hot Plug SCI status. */
257 HPEX = 0 /* Disable Hot Plug SCI */
259 HPME () /* Check and handle PME SCI status */
261 PMEX = 0 /* Disable Power Management SCI */
265 Method (_PS3, 0, Serialized)
267 /* Check it is hotplug SCI or not, then clear PDC accordingly */
270 /* Clear PDC since it is not a hotplug. */
276 HPEX = 1 /* Enable Hot Plug SCI. */
277 HPEV () /* Check and handle Hot Plug SCI status. */
280 PMEX = 1 /* Enable Power Management SCI. */
281 HPME () /* Check and handle PME SCI status. */
285 Method (_S0W, 0x0, NotSerialized)
287 #if CONFIG(D3COLD_SUPPORT)
291 #endif // D3COLD_SUPPORT
296 #if CONFIG(D3COLD_SUPPORT)
297 If ((TUID == 0) || (TUID == 1)) {
298 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
300 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
303 If ((TUID == 0) || (TUID == 1)) {
304 Return (Package() { \_SB.PCI0.TBT0 })
306 Return (Package() { \_SB.PCI0.TBT1 })
308 #endif // D3COLD_SUPPORT
313 #if CONFIG(D3COLD_SUPPORT)
314 If ((TUID == 0) || (TUID == 1)) {
315 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
317 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
320 If ((TUID == 0) || (TUID == 1)) {
321 Return (Package() { \_SB.PCI0.TBT0 })
323 Return (Package() { \_SB.PCI0.TBT1 })
325 #endif // D3COLD_SUPPORT
329 * PCI_EXP_STS Handler for PCIE Root Port
331 Method (HPME, 0, Serialized)
333 If ((VDID != 0xFFFFFFFF) && (PMSX == 1)) { /* if port exists and PME SCI Status set */
335 * Notify child device; this will cause its driver to clear PME_Status from
339 PMSX = 1 /* clear rootport's PME SCI status */
341 * Consume one pending PME notification to prevent it from blocking the queue.