soc/intel: Add Alder Lake's GT device ID
[coreboot.git] / src / soc / intel / alderlake / acpi / tcss_pcierp.asl
blob589a3e96680752f2573878af30cc20e1e4dc8bbd
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 OperationRegion (PXCS, SystemMemory, BASE(_ADR), 0x800)
4 Field (PXCS, AnyAcc, NoLock, Preserve)
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] */
46 Field (PXCS, AnyAcc, NoLock, WriteAsZeros)
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 */
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)
64         Return (Buffer() { 0x00 })
67 Device (PXSX)
69         Name (_ADR, 0x00000000)
71         Method (_PRW, 0)
72         {
73                 Return (Package() { 0x69, 4 })
74         }
77 Method (_DSW, 3)
79         /* If entering Sx (Arg1 > 1), need to skip TCSS D3Cold & TBT RTD3/D3Cold. */
80         If ((TUID == 0) || (TUID == 1)) {
81                 \_SB.PCI0.TDM0.SD3C = Arg1
82         } Else {
83                 \_SB.PCI0.TDM1.SD3C = Arg1
84         }
86         C2PM (Arg0, Arg1, Arg2, DCPM)
89 Method (_PRW, 0)
91         Return (Package() { 0x69, 4 })
95  * Sub-Method of _L61 Hot-Plug event
96  * _L61 event handler should invoke this method to support HotPlug wake event from TBT RP.
97  */
98 Method (HPEV, 0, Serialized)
100         If ((VDID != 0xFFFFFFFF) && HPSX) {
101                 If ((PDCX == 1) && (DLSC == 1)) {
102                         /* Clear all status bits first. */
103                         PDCX = 1
104                         HPSX = 1
106                         /* Perform proper notification to the OS. */
107                         Notify (^, 0)
108                 } Else {
109                         /* False event. Clear Hot-Plug Status, then exit. */
110                         HPSX = 1
111                 }
112         }
116  * Power Management routine for D3
117  */
118 Name (STAT, 0x1)  /* Variable to save power state 1 - D0, 0 - D3C */
121  * RTD3 Exit Method to bring TBT controller out of RTD3 mode.
122  */
123 Method (D3CX, 0, Serialized)
125         If (STAT == 0x1) {
126                 Return
127         }
129         RPFE = 0  /* Set RTD3PFETDIS = 0 */
130         RPER = 0  /* Set RTD3PERST = 0 */
131         L23R = 1  /* Set L23r2dt = 1 */
133         /*
134          * Poll for L23r2dt == 0. Wait for transition to Detect.
135          */
136         Local0 = 0
137         Local1 = L23R
138         While (Local1) {
139                 If (Local0 > 20) {
140                         Break
141                 }
142                 Sleep(5)
143                 Local0++
144                 Local1 = L23R
145         }
146         STAT = 0x1
150  * RTD3 Entry method to enable TBT controller RTD3 mode.
151  */
152 Method (D3CE, 0, Serialized)
154         If (STAT == 0x0) {
155                 Return
156         }
158         L23E = 1  /* Set L23er = 1 */
160         /* Poll until L23er == 0 */
161         Local0 = 0
162         Local1 = L23E
163         While (Local1) {
164                 If (Local0 > 20) {
165                         Break
166                 }
167                 Sleep(5)
168                 Local0++
169                 Local1 = L23E
170         }
172         STAT = 0  /* D3Cold */
173         RPFE = 1  /* Set RTD3PFETDIS = 1 */
174         RPER = 1  /* Set RTD3PERST = 1 */
177 Method (_PS0, 0, Serialized)
179         HPEV ()  /* Check and handle Hot Plug SCI status. */
180         If (HPEX == 1) {
181                 HPEX = 0  /* Disable Hot Plug SCI */
182         }
183         HPME ()  /* Check and handle PME SCI status */
184         If (PMEX == 1) {
185                 PMEX = 0  /* Disable Power Management SCI */
186         }
189 Method (_PS3, 0, Serialized)
191         /* Check it is hotplug SCI or not, then clear PDC accordingly */
192         If (PDCX == 1) {
193                 If (DLSC == 0) {
194                         /* Clear PDC since it is not a hotplug. */
195                         PDCX = 1
196                 }
197         }
199         If (HPEX == 0) {
200                 HPEX = 1  /* Enable Hot Plug SCI. */
201                 HPEV ()   /* Check and handle Hot Plug SCI status. */
202         }
203         If (PMEX == 0) {
204                 PMEX = 1  /* Enable Power Management SCI. */
205                 HPME ()   /* Check and handle PME SCI status. */
206         }
209 Method (_S0W, 0x0, NotSerialized)
211         Return (0x4)
214 Method (_PR0)
216         If ((TUID == 0) || (TUID == 1)) {
217                 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
218         } Else {
219                 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
220         }
223 Method (_PR3)
225         If ((TUID == 0) || (TUID == 1)) {
226                 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
227         } Else {
228                 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
229         }
233  * PCI_EXP_STS Handler for PCIE Root Port
234  */
235 Method (HPME, 0, Serialized)
237         If ((VDID != 0xFFFFFFFF) && (PMSX == 1)) {  /* if port exists and PME SCI Status set */
238                 /*
239                  * Notify child device; this will cause its driver to clear PME_Status from
240                  * device.
241                  */
242                 Notify (PXSX, 0x2)
243                 PMSX = 1  /* clear rootport's PME SCI status */
244                 /*
245                  * Consume one pending PME notification to prevent it from blocking the queue.
246                  */
247                 PSPX = 1
248                 Return (0x01)
249         }
250         Return (0x00)