blob: e722ca368deba259b335e612cab85c20a37cbe21 [file] [log] [blame]
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000015 */
16
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000017/* The _PTS method (Prepare To Sleep) is called before the OS is
18 * entering a sleep state. The sleep state number is passed in Arg0
19 */
20
21Method(_PTS,1)
22{
23 TRAP(0xed)
24 Sleep(1000)
25
26 Store(0, \_SB.ACFG)
27
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000028 // Are we going to S4?
29 If (Lequal(Arg0, 4)) {
30 TRAP(0xe7)
31 TRAP(0xea)
32 }
33
34 // Are we going to S5?
35 If (Lequal(Arg0, 5)) {
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000036 TRAP(0xde)
37 }
38
39 // The 2.6.12.5 ACPI engine seems to optimize the
40 // If(LEqual(Arg0, 5)) path away. This keeps it from doing so:
41 TRAP(Arg0)
42 Store(Arg0, DBG0)
43 // End of ugly OS bug workaround
44}
45
46/* The _WAK method is called on system wakeup */
47
48Method(_WAK,1)
49{
50 // Enable GPS
51 Store (1, GP11) // GPSE
52
53 // Wake from S3 or S4?
54 If (LOr(LEqual(Arg0, 3), LEqual(Arg0, 4))) {
55 If (And(CFGD, 0x01000000)) {
56 If (LAnd(And(CFGD, 0xf0), LEqual(OSYS, 2001))) {
57 TRAP(0x3d)
58 }
59 }
60 }
61
62 // Notify PCI Express slots in case a card
63 // was inserted while a sleep state was active.
Patrick Georgi472efa62012-02-16 20:44:20 +010064
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000065 If (LEqual(RP1D, 0)) {
66 Notify(\_SB.PCI0.RP01, 0)
67 }
68
69 If (LEqual(RP3D, 0)) {
70 Notify(\_SB.PCI0.RP03, 0)
71 }
72
73 If (LEqual(RP4D, 0)) {
74 Notify(\_SB.PCI0.RP04, 0)
75 }
76
Patrick Georgi472efa62012-02-16 20:44:20 +010077 // Are we coming from S3?
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000078 If (LEqual(Arg0, 3)) {
79 TRAP(0xeb)
80 TRAP(0x46)
81 }
82
Patrick Georgi472efa62012-02-16 20:44:20 +010083 // Are we coming from S4?
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000084 If (LEqual(Arg0, 4)) {
85 Notify(SLPB, 0x02)
86 If (DTSE) {
87 TRAP(0x47)
88 }
89 }
90
91 // Windows XP SP2 P-State restore
92 If (LAnd(LEqual(OSYS, 2002), And(CFGD, 1))) {
Timothy Pearson033bb4b2015-02-10 22:21:39 -060093 If (LGreater(\_PR.CP00._PPC, 0)) {
94 Subtract(\_PR.CP00._PPC, 1, \_PR.CP00._PPC)
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000095 PNOT()
Timothy Pearson033bb4b2015-02-10 22:21:39 -060096 Add(\_PR.CP00._PPC, 1, \_PR.CP00._PPC)
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +000097 PNOT()
98 } Else {
Timothy Pearson033bb4b2015-02-10 22:21:39 -060099 Add(\_PR.CP00._PPC, 1, \_PR.CP00._PPC)
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +0000100 PNOT()
Timothy Pearson033bb4b2015-02-10 22:21:39 -0600101 Subtract(\_PR.CP00._PPC, 1, \_PR.CP00._PPC)
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +0000102 PNOT()
103 }
104 }
105
106 Return(Package(){0,0})
107}
108
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +0000109// Hardcoded for now..
110Name (CFGD, 0x113B69F1)
111
112/* System Bus */
113
114Scope(\_SB)
115{
116 /* This method is placed on the top level, so we can make sure it's the
117 * first executed _INI method.
118 */
119 Method(_INI, 0)
120 {
121 /* The DTS data in NVS is probably not up to date.
122 * Update temperature values and make sure AP thermal
123 * interrupts can happen
124 */
125 If (DTSE) {
126 TRAP(0x47)
127 }
128
Vladimir Serbinenko24813c12014-10-16 10:39:06 +0200129 \GOS()
Stefan Reinauer7cfa7f92010-05-16 14:24:41 +0000130
131 /* And the OS workarounds start right after we know what we're
132 * running: Windows XP SP1 needs to have C-State coordination
133 * enabled in SMM.
134 */
135 If (LAnd(LEqual(OSYS, 2001), MPEN)) {
136 TRAP(0x3d)
137 }
138
139 /* SMM power state and C4-on-C3 settings need to be updated */
140 // TRAP(43)
141
142 /* OS Init */
143 TRAP(0x32)
144 }
145}