blob: ebaeaecd255a01e60de540e5605f04a45d2e44f5 [file] [log] [blame]
Shelley Chen9b230ae2023-09-15 16:01:31 -07001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3External (\_SB.PCI0.PEG0.PEGP.NPON, MethodObj)
4External (\_SB.PCI0.PEG0.PEGP.NPOF, MethodObj)
5
6OperationRegion (PCIC, PCI_Config, 0x00, 0x100)
7Field (PCIC, AnyAcc, NoLock, Preserve)
8{
9 Offset (0x4a),
10 CEDR, 1, /* Correctable Error Detected, RW/1C/V */
11 Offset (0x52),
12 , 13,
13 LASX, 1, /* Link Active Status */
14 Offset (0x69),
15 , 2,
16 LREN, 1, /* LTR Enabled */
17 Offset (0xe0),
18 , 7,
19 NCB7, 1, /* Scratch bit to save L2/3 state */
20 Offset (0xe2),
21 , 2,
22 L23E, 1, /* L23_Rdy Entry request */
23 L23R, 1 /* L23_Rdy Detect Transition */
24}
25
26/* L2/3 Entry sequence */
27Method (DL23, 0, Serialized)
28{
29 L23E = 1
30 Local0 = 8
31 While (Local0 > 0)
32 {
33 If (!L23E)
34 {
35 Break
36 }
37
38 Sleep (2)
39 Local0--
40 }
41 NCB7 = 1
42}
43
44/* L2/3 exit seqeuence */
45Method (LD23, 0, Serialized)
46{
47 If (!NCB7)
48 {
49 Return
50 }
51
52 L23R = 1
53 Local0 = 20
54 While (Local0 > 0)
55 {
56 If (!L23R)
57 {
58 Break
59 }
60
61 Sleep (2)
62 Local0--
63 }
64
65 NCB7 = 0
66 Local0 = 8
67 While (Local0 > 0)
68 {
69 If (LASX == 1)
70 {
71 Break
72 }
73
74 Sleep (2)
75 Local0--
76 }
77}
78
79/* PEG Power Resource */
80PowerResource (PGPR, 0, 0)
81{
82 Method (_ON, 0, Serialized)
83 {
84 /* Power up GPU from GCOFF (or GC6 exit if deferred) */
85 \_SB.PCI0.PEG0.PEGP.NPON ()
86 _STA = 1
87 }
88 Method (_OFF, 0, Serialized)
89 {
90 /* Power down GPU to GCOFF (or GC6 entry if deferred) */
91 _STA = 0
92 \_SB.PCI0.PEG0.PEGP.NPOF ()
93 }
94 Name (_STA, 0)
95}
96
97Name (_PR0, Package() { PGPR })
98Name (_PR2, Package() { PGPR })
99Name (_PR3, Package() { PGPR })