Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 1 | /* |
| 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 Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 17 | /* 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 | |
| 21 | Method(_PTS,1) |
| 22 | { |
| 23 | TRAP(0xed) |
| 24 | Sleep(1000) |
| 25 | |
| 26 | Store(0, \_SB.ACFG) |
| 27 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 28 | // 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 Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 36 | 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 | |
| 48 | Method(_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 Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 64 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 65 | 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 Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 77 | // Are we coming from S3? |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 78 | If (LEqual(Arg0, 3)) { |
| 79 | TRAP(0xeb) |
| 80 | TRAP(0x46) |
| 81 | } |
| 82 | |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 83 | // Are we coming from S4? |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 84 | 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 Pearson | 033bb4b | 2015-02-10 22:21:39 -0600 | [diff] [blame] | 93 | If (LGreater(\_PR.CP00._PPC, 0)) { |
| 94 | Subtract(\_PR.CP00._PPC, 1, \_PR.CP00._PPC) |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 95 | PNOT() |
Timothy Pearson | 033bb4b | 2015-02-10 22:21:39 -0600 | [diff] [blame] | 96 | Add(\_PR.CP00._PPC, 1, \_PR.CP00._PPC) |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 97 | PNOT() |
| 98 | } Else { |
Timothy Pearson | 033bb4b | 2015-02-10 22:21:39 -0600 | [diff] [blame] | 99 | Add(\_PR.CP00._PPC, 1, \_PR.CP00._PPC) |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 100 | PNOT() |
Timothy Pearson | 033bb4b | 2015-02-10 22:21:39 -0600 | [diff] [blame] | 101 | Subtract(\_PR.CP00._PPC, 1, \_PR.CP00._PPC) |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 102 | PNOT() |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | Return(Package(){0,0}) |
| 107 | } |
| 108 | |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 109 | // Hardcoded for now.. |
| 110 | Name (CFGD, 0x113B69F1) |
| 111 | |
| 112 | /* System Bus */ |
| 113 | |
| 114 | Scope(\_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 Serbinenko | 24813c1 | 2014-10-16 10:39:06 +0200 | [diff] [blame] | 129 | \GOS() |
Stefan Reinauer | 7cfa7f9 | 2010-05-16 14:24:41 +0000 | [diff] [blame] | 130 | |
| 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 | } |