Debian Codegraph @

src/mainboard/getac/p470/acpi/platform.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 /* The _PTS method (Prepare To Sleep) is called before the OS is
4 * entering a sleep state. The sleep state number is passed in Arg0
5 */
6
7 Method(_PTS,1)
8 {
9 TRAP(0xed)
10 Sleep(1000)
11
12 \_SB.ACFG = 0
13
14 // Are we going to S4?
15 If (Arg0 == 4) {
16 TRAP(0xe7)
17 TRAP(0xea)
18 }
19
20 // Are we going to S5?
21 If (Arg0 == 5) {
22 TRAP(0xde)
23 }
24
25 // The 2.6.12.5 ACPI engine seems to optimize the
26 // If(Arg0 == 5) path away. This keeps it from doing so:
27 TRAP(Arg0)
28 DBG0 = Arg0
29 // End of ugly OS bug workaround
30 }
31
32 /* The _WAK method is called on system wakeup */
33
34 Method(_WAK,1)
35 {
36 // Enable GPS
37 GP11 = 1 // GPSE
38
39 // Wake from S3 or S4?
40 If ((Arg0 == 0x03) || (Arg0 == 0x04)) {
41 If (CFGD & 0x01000000) {
42 If ((CFGD & 0xF0) && (OSYS == 2001)) {
43 TRAP(0x3d)
44 }
45 }
46 }
47
48 // Notify PCI Express slots in case a card
49 // was inserted while a sleep state was active.
50
51 If (RP1D == 0) {
52 Notify(\_SB.PCI0.RP01, 0)
53 }
54
55 If (RP3D == 0) {
56 Notify(\_SB.PCI0.RP03, 0)
57 }
58
59 If (RP4D == 0) {
60 Notify(\_SB.PCI0.RP04, 0)
61 }
62
63 // Are we coming from S3?
64 If (Arg0 == 3) {
65 TRAP(0xeb)
66 TRAP(0x46)
67 }
68
69 // Are we coming from S4?
70 If (Arg0 == 4) {
71 Notify(SLPB, 0x02)
72 If (DTSE) {
73 TRAP(0x47)
74 }
75 }
76
77 // Windows XP SP2 P-State restore
78 If ((OSYS == 2002) && (CFGD & 0x01)) {
79 If (\_SB.CP00._PPC > 0) {
80 \_SB.CP00._PPC -= 1
81 PNOT()
82 \_SB.CP00._PPC += 1
83 PNOT()
84 } Else {
85 \_SB.CP00._PPC += 1
86 PNOT()
87 \_SB.CP00._PPC -= 1
88 PNOT()
89 }
90 }
91
92 Return(Package(){0,0})
93 }
94
95 // Hardcoded for now..
96 Name (CFGD, 0x113B69F1)
97
98 /* System Bus */
99
100 Scope(\_SB)
101 {
102 /* This method is placed on the top level, so we can make sure it's the
103 * first executed _INI method.
104 */
105 Method(_INI, 0)
106 {
107 /* The DTS data in NVS is probably not up to date.
108 * Update temperature values and make sure AP thermal
109 * interrupts can happen
110 */
111 If (DTSE) {
112 TRAP(0x47)
113 }
114
115 \GOS()
116
117 /* And the OS workarounds start right after we know what we're
118 * running: Windows XP SP1 needs to have C-State coordination
119 * enabled in SMM.
120 */
121 If ((OSYS == 2001) && MPEN) {
122 TRAP(0x3d)
123 }
124
125 /* OS Init */
126 TRAP(0x32)
127 }
128 }