blob: 90824698bb519ae3c448d84c4d53b338168fc3fa [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 */
Ravi Sarawadiebd4c3d2023-10-26 13:25:35 -070014 , 31,
John Zhaoca584082020-03-16 15:33:06 -070015 INFR, 1, /* TBT NVM FW Ready */
16 Offset(0xEC), /* 0xEC, TBT TO PCIE Register */
17 TB2P, 32, /* TBT to PCIe */
18 P2TB, 32, /* PCIe to TBT */
19 Offset(0xFC), /* 0xFC, DMA RTD3 Force Power */
20 DD3E, 1, /* 0:0 DMA RTD3 Enable */
21 DFPE, 1, /* 1:1 DMA Force Power */
22 , 22,
23 DMAD, 8 /* 31:24 DMA Active Delay */
24}
25
John Zhaoca584082020-03-16 15:33:06 -070026Name (STAT, 0x1) /* Variable to save power state 1 - D0, 0 - D3C */
John Zhaoca584082020-03-16 15:33:06 -070027
28Method (_S0W, 0x0)
29{
Sean Rhodes5f0cda72023-04-13 12:17:38 +010030#if CONFIG(D3COLD_SUPPORT)
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000031 Return (0x04)
32#else
33 Return (0x03)
Sean Rhodes5f0cda72023-04-13 12:17:38 +010034#endif // D3COLD_SUPPORT
John Zhaoca584082020-03-16 15:33:06 -070035}
36
Sean Rhodes56226662021-11-08 21:34:34 +000037/*
38 * Get power resources that are dependent on this device for Operating System Power Management
39 * to put the device in the D0 device state
40 */
John Zhaoca584082020-03-16 15:33:06 -070041Method (_PR0)
42{
Sean Rhodes5f0cda72023-04-13 12:17:38 +010043#if CONFIG(D3COLD_SUPPORT)
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000044 If (DUID == 0) {
45 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
John Zhaoac2cb422021-05-21 16:46:49 -070046 } Else {
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000047 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
John Zhaoac2cb422021-05-21 16:46:49 -070048 }
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000049#else
50 If (DUID == 0) {
51 Return (Package() { \_SB.PCI0.TBT0 })
52 } Else {
53 Return (Package() { \_SB.PCI0.TBT1 })
54 }
Sean Rhodes5f0cda72023-04-13 12:17:38 +010055#endif // D3COLD_SUPPORT
John Zhaoca584082020-03-16 15:33:06 -070056}
57
58Method (_PR3)
59{
Sean Rhodes5f0cda72023-04-13 12:17:38 +010060#if CONFIG(D3COLD_SUPPORT)
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000061 If (DUID == 0) {
62 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT0 })
John Zhaoac2cb422021-05-21 16:46:49 -070063 } Else {
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000064 Return (Package() { \_SB.PCI0.D3C, \_SB.PCI0.TBT1 })
John Zhaoac2cb422021-05-21 16:46:49 -070065 }
Sean Rhodes6b5b7e02023-02-06 09:09:16 +000066#else
67 If (DUID == 0) {
68 Return (Package() { \_SB.PCI0.TBT0 })
69 } Else {
70 Return (Package() { \_SB.PCI0.TBT1 })
71 }
Sean Rhodes5f0cda72023-04-13 12:17:38 +010072#endif // D3COLD_SUPPORT
John Zhaoca584082020-03-16 15:33:06 -070073}
74
75/*
76 * RTD3 Exit Method to bring TBT controller out of RTD3 mode.
77 */
78Method (D3CX, 0, Serialized)
79{
Sean Rhodes56226662021-11-08 21:34:34 +000080 DD3E = 0x00 /* Disable DMA RTD3 */
81 STAT = 0x01
John Zhaoca584082020-03-16 15:33:06 -070082}
83
84/*
85 * RTD3 Entry method to enable TBT controller RTD3 mode.
86 */
87Method (D3CE, 0, Serialized)
88{
Sean Rhodes56226662021-11-08 21:34:34 +000089 DD3E = 0x01 /* Enable DMA RTD3 */
90 STAT = 0x00
John Zhaoca584082020-03-16 15:33:06 -070091}
92
93/*
94 * Variable to skip TCSS/TBT D3 cold; 1+: Skip D3CE, 0 - Enable D3CE
95 * TCSS D3 Cold and TBT RTD3 is only available when system power state is in S0.
96 */
97Name (SD3C, 0)
John Zhao6e8d38e2020-09-01 15:04:18 -070098
John Zhaoca584082020-03-16 15:33:06 -070099Method (_DSW, 3)
100{
101 /* If entering Sx (Arg1 > 1), need to skip TCSS D3Cold & TBT RTD3/D3Cold. */
102 SD3C = Arg1
103}
104
105Method (_PRW, 0)
106{
107 Return (Package() { 0x6D, 4 })
108}