blob: 2586ecbbc7502d9c5818f21ebe973ac418273ac5 [file] [log] [blame]
Elyes HAOUASf50b6622020-07-19 14:00:43 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
John Zhaoca584082020-03-16 15:33:06 -07002
3OperationRegion (DPME, SystemMemory, BASE(_ADR), 0x100)
4Field (DPME, AnyAcc, NoLock, Preserve)
5{
6 VDID, 32,
7 Offset(0x84), /* 0x84, DMA CFG PM CAP */
8 PMST, 2, /* 1:0, PM_STATE */
9 , 6,
10 PMEE, 1, /* 8, PME_EN */
11 , 6,
12 PMES, 1, /* 15, PME_STATUS */
13 Offset(0xC8), /* 0xC8, TBT NVM FW Revision */
CoolStar377845a2024-02-23 12:09:22 -080014 , 30,
15 IF30, 1, /* ITBT FW Version Bit30 */
John Zhaoca584082020-03-16 15:33:06 -070016 INFR, 1, /* TBT NVM FW Ready */
17 Offset(0xEC), /* 0xEC, TBT TO PCIE Register */
18 TB2P, 32, /* TBT to PCIe */
19 P2TB, 32, /* PCIe to TBT */
20 Offset(0xFC), /* 0xFC, DMA RTD3 Force Power */
21 DD3E, 1, /* 0:0 DMA RTD3 Enable */
22 DFPE, 1, /* 1:1 DMA Force Power */
23 , 22,
24 DMAD, 8 /* 31:24 DMA Active Delay */
25}
26
John Zhaoca584082020-03-16 15:33:06 -070027Name (STAT, 0x1) /* Variable to save power state 1 - D0, 0 - D3C */
John Zhaoca584082020-03-16 15:33:06 -070028
29Method (_S0W, 0x0)
30{
Sean Rhodes5f0cda72023-04-13 12:17:38 +010031#if CONFIG(D3COLD_SUPPORT)
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000032 Return (0x04)
33#else
34 Return (0x03)
Sean Rhodes5f0cda72023-04-13 12:17:38 +010035#endif // D3COLD_SUPPORT
John Zhaoca584082020-03-16 15:33:06 -070036}
37
Sean Rhodes56226662021-11-08 21:34:34 +000038/*
39 * Get power resources that are dependent on this device for Operating System Power Management
40 * to put the device in the D0 device state
41 */
John Zhaoca584082020-03-16 15:33:06 -070042Method (_PR0)
43{
Sean Rhodes5f0cda72023-04-13 12:17:38 +010044#if CONFIG(D3COLD_SUPPORT)
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000045 If (DUID == 0) {
46 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
John Zhaoac2cb422021-05-21 16:46:49 -070047 } Else {
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000048 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
John Zhaoac2cb422021-05-21 16:46:49 -070049 }
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000050#else
51 If (DUID == 0) {
52 Return (Package() { \_SB.PCI0.TBT0 })
53 } Else {
54 Return (Package() { \_SB.PCI0.TBT1 })
55 }
Sean Rhodes5f0cda72023-04-13 12:17:38 +010056#endif // D3COLD_SUPPORT
John Zhaoca584082020-03-16 15:33:06 -070057}
58
59Method (_PR3)
60{
Sean Rhodes5f0cda72023-04-13 12:17:38 +010061#if CONFIG(D3COLD_SUPPORT)
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000062 If (DUID == 0) {
63 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
John Zhaoac2cb422021-05-21 16:46:49 -070064 } Else {
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000065 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
John Zhaoac2cb422021-05-21 16:46:49 -070066 }
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000067#else
68 If (DUID == 0) {
69 Return (Package() { \_SB.PCI0.TBT0 })
70 } Else {
71 Return (Package() { \_SB.PCI0.TBT1 })
72 }
Sean Rhodes5f0cda72023-04-13 12:17:38 +010073#endif // D3COLD_SUPPORT
John Zhaoca584082020-03-16 15:33:06 -070074}
75
76/*
77 * RTD3 Exit Method to bring TBT controller out of RTD3 mode.
78 */
79Method (D3CX, 0, Serialized)
80{
Sean Rhodes56226662021-11-08 21:34:34 +000081 DD3E = 0x00 /* Disable DMA RTD3 */
82 STAT = 0x01
John Zhaoca584082020-03-16 15:33:06 -070083}
84
85/*
86 * RTD3 Entry method to enable TBT controller RTD3 mode.
87 */
88Method (D3CE, 0, Serialized)
89{
Sean Rhodes56226662021-11-08 21:34:34 +000090 DD3E = 0x01 /* Enable DMA RTD3 */
91 STAT = 0x00
John Zhaoca584082020-03-16 15:33:06 -070092}
93
94/*
95 * Variable to skip TCSS/TBT D3 cold; 1+: Skip D3CE, 0 - Enable D3CE
96 * TCSS D3 Cold and TBT RTD3 is only available when system power state is in S0.
97 */
98Name (SD3C, 0)
John Zhao6e8d38e2020-09-01 15:04:18 -070099
John Zhaoca584082020-03-16 15:33:06 -0700100Method (_DSW, 3)
101{
102 /* If entering Sx (Arg1 > 1), need to skip TCSS D3Cold & TBT RTD3/D3Cold. */
103 SD3C = Arg1
104}
105
106Method (_PRW, 0)
107{
108 Return (Package() { 0x6D, 4 })
109}