2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
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
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 /* The APM port can be used for generating software SMIs */
24 OperationRegion (APMP, SystemIO, 0xb2, 2)
25 Field (APMP, ByteAcc, NoLock, Preserve)
27 APMC, 8, // APM command
33 OperationRegion (POST, SystemIO, 0x80, 1)
34 Field (POST, ByteAcc, Lock, Preserve)
40 Method(TRAP, 1, Serialized)
42 Store (Arg0, SMIF) // SMI Function
43 Store (0, TRP0) // Generate trap
44 Return (SMIF) // Return value of SMI handler
47 /* SMI Function Trap */
48 OperationRegion(SMI1, SystemMemory, 0xC0DEDEAD, 0x100)
49 Field(SMI1, AnyAcc, NoLock, Preserve)
56 /* The _PIC method is called by the OS to choose between interrupt
57 * routing via the i8259 interrupt controller or the APIC.
59 * _PIC is called with a parameter of 0 for i8259 configuration and
60 * with a parameter of 1 for Local Apic/IOAPIC configuration.
65 // Remember the OS' IRQ routing choice.
69 /* The _PTS method (Prepare To Sleep) is called before the OS is
70 * entering a sleep state. The sleep state number is passed in Arg0
80 // Are we going to S3?
81 If (LEqual(Arg0, 3)) {
85 // Are we going to S4?
86 If (Lequal(Arg0, 4)) {
91 // Are we going to S5?
92 If (Lequal(Arg0, 5)) {
97 // The 2.6.12.5 ACPI engine seems to optimize the
98 // If(LEqual(Arg0, 5)) path away. This keeps it from doing so:
101 // End of ugly OS bug workaround
104 /* The _WAK method is called on system wakeup */
109 Store (1, GP11) // GPSE
111 // Wake from S3 or S4?
112 If (LOr(LEqual(Arg0, 3), LEqual(Arg0, 4))) {
113 If (And(CFGD, 0x01000000)) {
114 If (LAnd(And(CFGD, 0xf0), LEqual(OSYS, 2001))) {
120 // Notify PCI Express slots in case a card
121 // was inserted while a sleep state was active.
123 If (LEqual(RP1D, 0)) {
124 Notify(\_SB.PCI0.RP01, 0)
127 If (LEqual(RP3D, 0)) {
128 Notify(\_SB.PCI0.RP03, 0)
131 If (LEqual(RP4D, 0)) {
132 Notify(\_SB.PCI0.RP04, 0)
135 // Are we coming from S3?
136 If (LEqual(Arg0, 3)) {
141 // Are we coming from S4?
142 If (LEqual(Arg0, 4)) {
149 // Windows XP SP2 P-State restore
150 If (LAnd(LEqual(OSYS, 2002), And(CFGD, 1))) {
151 If (LGreater(\_PR.CPU0._PPC, 0)) {
152 Subtract(\_PR.CPU0._PPC, 1, \_PR.CPU0._PPC)
154 Add(\_PR.CPU0._PPC, 1, \_PR.CPU0._PPC)
157 Add(\_PR.CPU0._PPC, 1, \_PR.CPU0._PPC)
159 Subtract(\_PR.CPU0._PPC, 1, \_PR.CPU0._PPC)
164 Return(Package(){0,0})
167 // Power notification
169 External (\_PR_.CPU0, DeviceObj)
170 External (\_PR_.CPU1, DeviceObj)
171 External (\_PR_.CPU0._PPC)
172 External (\_PR_.CPU1._PPC)
173 /* These come from the dynamically created CPU SSDT */
180 If(And(PDC0, 0x08)) {
181 Notify (\_PR_.CPU0, 0x80) // _PPC
183 If (And(PDC0, 0x10)) {
185 Notify(\_PR_.CPU0, 0x81) // _CST
189 If(And(PDC1, 0x08)) {
190 Notify (\_PR_.CPU1, 0x80) // _PPC
191 If (And(PDC1, 0x10)) {
193 Notify(\_PR_.CPU1, 0x81) // _CST
198 Notify (\_PR_.CPU0, 0x80)
200 Notify(\_PR_.CPU0, 0x81)
203 // Notify the Batteries
204 Notify(\_SB.BAT0, 0x80) // Execute BAT0 _BST
205 Notify(\_SB.BAT1, 0x80) // Execute BAT1 _BST
208 // Hardcoded for now..
209 Name (CFGD, 0x113B69F1)
215 /* This method is placed on the top level, so we can make sure it's the
216 * first executed _INI method.
220 /* The DTS data in NVS is probably not up to date.
221 * Update temperature values and make sure AP thermal
222 * interrupts can happen
228 /* Determine the Operating System and save the value in OSYS.
229 * We have to do this in order to be able to work around
230 * certain windows bugs.
232 * OSYS value | Operating System
233 * -----------+------------------
234 * 2000 | Windows 2000
235 * 2001 | Windows XP(+SP1)
236 * 2002 | Windows XP SP2
237 * 2006 | Windows Vista
241 /* Let's assume we're running at least Windows 2000 */
244 If (CondRefOf(_OSI, Local0)) {
245 /* Linux answers _OSI with "True" for a couple of
246 * Windows version queries. But unlike Windows it
247 * needs a Video repost, so let's determine whether
248 * we're running Linux.
255 If (_OSI("Windows 2001")) {
259 If (_OSI("Windows 2001 SP1")) {
263 If (_OSI("Windows 2001 SP2")) {
267 If (_OSI("Windows 2006")) {
272 /* And the OS workarounds start right after we know what we're
273 * running: Windows XP SP1 needs to have C-State coordination
276 If (LAnd(LEqual(OSYS, 2001), MPEN)) {
280 /* SMM power state and C4-on-C3 settings need to be updated */