Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008 Advanced Micro Devices, Inc. |
| 5 | * Copyright (C) 2010 Siemens AG, Inc. |
| 6 | * (Written by Josef Kellermann <joseph.kellermann@heitec.de> for Siemens AG, Inc.) |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; version 2 of the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 16 | */ |
Patrick Georgi | 472efa6 | 2012-02-16 20:44:20 +0100 | [diff] [blame] | 17 | |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 18 | /* Supported sleep states: */ |
| 19 | Name(\_S0, Package () {0x00, 0x00, 0x00, 0x00} ) /* (S0) - working state */ |
| 20 | Name(\_S1, Package () {0x01, 0x01, 0x00, 0x00} ) /* (S1) - sleeping w/CPU context */ |
| 21 | Name(\_S2, Package () {0x02, 0x02, 0x00, 0x00} ) /* (S2) - "light" Suspend to RAM */ |
| 22 | Name(\_S3, Package () {0x03, 0x03, 0x00, 0x00} ) /* (S3) - Suspend to RAM */ |
| 23 | Name(\_S4, Package () {0x04, 0x04, 0x00, 0x00} ) /* (S4) - Suspend to Disk */ |
| 24 | Name(\_S5, Package () {0x05, 0x05, 0x00, 0x00} ) /* (S5) - Soft Off */ |
| 25 | |
| 26 | Name(\_SB.CSPS ,0) /* Current Sleep State (S0, ... , S5) */ |
| 27 | Name(CSMS, 0) /* Current System State */ |
| 28 | |
| 29 | /* Wake status package */ |
| 30 | Name(WKST,Package(){Zero, Zero}) |
| 31 | |
| 32 | /* |
| 33 | * \_PTS - Prepare to Sleep method |
| 34 | * |
| 35 | * Entry: |
| 36 | * Arg0=The value of the sleeping state S1=1, S2=2, etc |
| 37 | * |
| 38 | * Exit: |
| 39 | * -none- |
| 40 | * |
| 41 | * The _PTS control method is executed at the beginning of the sleep process |
Marshall Dawson | a8025db | 2016-12-16 13:17:34 -0500 | [diff] [blame] | 42 | * for S1-S5. The sleeping value is passed to the _PTS control method. This |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 43 | * control method may be executed a relatively long time before entering the |
Marshall Dawson | a8025db | 2016-12-16 13:17:34 -0500 | [diff] [blame] | 44 | * sleep state and the OS may abort the operation without notification to |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 45 | * the ACPI driver. This method cannot modify the configuration or power |
| 46 | * state of any device in the system. |
| 47 | */ |
| 48 | Method(\_PTS, 1) { |
| 49 | /* DBGO("\\_PTS\n") */ |
| 50 | /* DBGO("From S0 to S") */ |
| 51 | /* DBGO(Arg0) */ |
| 52 | /* DBGO("\n") */ |
| 53 | |
| 54 | /* Don't allow PCIRST# to reset USB */ |
| 55 | if (LEqual(Arg0,3)){ |
| 56 | Store(0,URRE) |
| 57 | } |
| 58 | |
| 59 | /* Clear sleep SMI status flag and enable sleep SMI trap. */ |
| 60 | /*Store(One, CSSM) |
| 61 | Store(One, SSEN)*/ |
| 62 | |
| 63 | /* On older chips, clear PciExpWakeDisEn */ |
| 64 | /*if (LLessEqual(\_SB.SBRI, 0x13)) { |
| 65 | * Store(0,\_SB.PWDE) |
| 66 | *} |
| 67 | */ |
| 68 | |
| 69 | /* Clear wake status structure. */ |
| 70 | Store(0, Index(WKST,0)) |
| 71 | Store(0, Index(WKST,1)) |
| 72 | \_SB.PCI0.SIOS (Arg0) |
| 73 | } /* End Method(\_PTS) */ |
| 74 | |
| 75 | /* |
| 76 | * The following method results in a "not a valid reserved NameSeg" |
| 77 | * warning so I have commented it out for the duration. It isn't |
| 78 | * used, so it could be removed. |
| 79 | * |
| 80 | * |
| 81 | * \_GTS OEM Going To Sleep method |
| 82 | * |
| 83 | * Entry: |
| 84 | * Arg0=The value of the sleeping state S1=1, S2=2 |
| 85 | * |
| 86 | * Exit: |
| 87 | * -none- |
| 88 | * |
| 89 | * Method(\_GTS, 1) { |
| 90 | * DBGO("\\_GTS\n") |
| 91 | * DBGO("From S0 to S") |
| 92 | * DBGO(Arg0) |
| 93 | * DBGO("\n") |
| 94 | * } |
| 95 | */ |
| 96 | |
| 97 | /* |
| 98 | * \_BFS OEM Back From Sleep method |
| 99 | * |
| 100 | * Entry: |
| 101 | * Arg0=The value of the sleeping state S1=1, S2=2 |
| 102 | * |
| 103 | * Exit: |
| 104 | * -none- |
| 105 | */ |
| 106 | Method(\_BFS, 1) { |
| 107 | /* DBGO("\\_BFS\n") */ |
| 108 | /* DBGO("From S") */ |
| 109 | /* DBGO(Arg0) */ |
| 110 | /* DBGO(" to S0\n") */ |
| 111 | } |
| 112 | |
| 113 | /* |
| 114 | * \_WAK System Wake method |
| 115 | * |
| 116 | * Entry: |
| 117 | * Arg0=The value of the sleeping state S1=1, S2=2 |
| 118 | * |
| 119 | * Exit: |
| 120 | * Return package of 2 DWords |
| 121 | * Dword 1 - Status |
| 122 | * 0x00000000 wake succeeded |
| 123 | * 0x00000001 Wake was signaled but failed due to lack of power |
| 124 | * 0x00000002 Wake was signaled but failed due to thermal condition |
| 125 | * Dword 2 - Power Supply state |
| 126 | * if non-zero the effective S-state the power supply entered |
| 127 | */ |
| 128 | Method(\_WAK, 1) { |
| 129 | /* DBGO("\\_WAK\n") */ |
| 130 | /* DBGO("From S") */ |
| 131 | /* DBGO(Arg0) */ |
| 132 | /* DBGO(" to S0\n") */ |
| 133 | |
| 134 | /* Re-enable HPET */ |
| 135 | Store(1,HPDE) |
| 136 | |
| 137 | /* Restore PCIRST# so it resets USB */ |
| 138 | if (LEqual(Arg0,3)){ |
| 139 | Store(1,URRE) |
| 140 | } |
| 141 | |
| 142 | /* Arbitrarily clear PciExpWakeStatus */ |
Martin Roth | f77516c | 2015-12-08 14:00:07 -0700 | [diff] [blame] | 143 | Store(PWST, Local1) |
| 144 | Store(Local1, PWST) |
Josef Kellermann | bfa7ee5 | 2011-05-11 07:47:43 +0000 | [diff] [blame] | 145 | |
| 146 | /* if(DeRefOf(Index(WKST,0))) { |
| 147 | * Store(0, Index(WKST,1)) |
| 148 | * } else { |
| 149 | * Store(Arg0, Index(WKST,1)) |
| 150 | * } |
| 151 | */ |
| 152 | \_SB.PCI0.SIOW (Arg0) |
| 153 | Return(WKST) |
| 154 | } /* End Method(\_WAK) */ |
| 155 | |
| 156 | Scope(\_GPE) { /* Start Scope GPE */ |
| 157 | /* General event 3 */ |
| 158 | Method(_L03) { |
| 159 | /* DBGO("\\_GPE\\_L00\n") */ |
| 160 | Notify(\_SB.PWRB, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 161 | } |
| 162 | |
| 163 | /* Legacy PM event */ |
| 164 | Method(_L08) { |
| 165 | /* DBGO("\\_GPE\\_L08\n") */ |
| 166 | } |
| 167 | |
| 168 | /* Temp warning (TWarn) event */ |
| 169 | Method(_L09) { |
| 170 | /* DBGO("\\_GPE\\_L09\n") */ |
| 171 | Notify (\_TZ.TZ00, 0x80) |
| 172 | } |
| 173 | |
| 174 | /* Reserved */ |
| 175 | /* Method(_L0A) { |
| 176 | * DBGO("\\_GPE\\_L0A\n") |
| 177 | * } |
| 178 | */ |
| 179 | |
| 180 | /* USB controller PME# */ |
| 181 | Method(_L0B) { |
| 182 | /* DBGO("\\_GPE\\_L0B\n") */ |
| 183 | Notify(\_SB.PCI0.UOH1, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 184 | Notify(\_SB.PCI0.UOH2, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 185 | Notify(\_SB.PCI0.UOH3, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 186 | Notify(\_SB.PCI0.UOH4, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 187 | Notify(\_SB.PCI0.UOH5, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 188 | Notify(\_SB.PCI0.UEH1, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 189 | Notify(\_SB.PWRB, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 190 | } |
| 191 | |
| 192 | /* AC97 controller PME# */ |
| 193 | /* Method(_L0C) { |
| 194 | * DBGO("\\_GPE\\_L0C\n") |
| 195 | * } |
| 196 | */ |
| 197 | |
| 198 | /* OtherTherm PME# */ |
| 199 | /* Method(_L0D) { |
| 200 | * DBGO("\\_GPE\\_L0D\n") |
| 201 | * } |
| 202 | */ |
| 203 | |
| 204 | /* GPM9 SCI event - Moved to USB.asl */ |
| 205 | /* Method(_L0E) { |
| 206 | * DBGO("\\_GPE\\_L0E\n") |
| 207 | * } |
| 208 | */ |
| 209 | |
| 210 | /* PCIe HotPlug event */ |
| 211 | /* Method(_L0F) { |
| 212 | * DBGO("\\_GPE\\_L0F\n") |
| 213 | * } |
| 214 | */ |
| 215 | |
| 216 | /* ExtEvent0 SCI event */ |
| 217 | Method(_L10) { |
| 218 | /* DBGO("\\_GPE\\_L10\n") */ |
| 219 | } |
| 220 | |
| 221 | |
| 222 | /* ExtEvent1 SCI event */ |
| 223 | Method(_L11) { |
| 224 | /* DBGO("\\_GPE\\_L11\n") */ |
| 225 | } |
| 226 | |
| 227 | /* PCIe PME# event */ |
| 228 | /* Method(_L12) { |
| 229 | * DBGO("\\_GPE\\_L12\n") |
| 230 | * } |
| 231 | */ |
| 232 | |
| 233 | /* GPM0 SCI event - Moved to USB.asl */ |
| 234 | /* Method(_L13) { |
| 235 | * DBGO("\\_GPE\\_L13\n") |
| 236 | * } |
| 237 | */ |
| 238 | |
| 239 | /* GPM1 SCI event - Moved to USB.asl */ |
| 240 | /* Method(_L14) { |
| 241 | * DBGO("\\_GPE\\_L14\n") |
| 242 | * } |
| 243 | */ |
| 244 | |
| 245 | /* GPM2 SCI event - Moved to USB.asl */ |
| 246 | /* Method(_L15) { |
| 247 | * DBGO("\\_GPE\\_L15\n") |
| 248 | * } |
| 249 | */ |
| 250 | |
| 251 | /* GPM3 SCI event - Moved to USB.asl */ |
| 252 | /* Method(_L16) { |
| 253 | * DBGO("\\_GPE\\_L16\n") |
| 254 | * } |
| 255 | */ |
| 256 | |
| 257 | /* GPM8 SCI event - Moved to USB.asl */ |
| 258 | /* Method(_L17) { |
| 259 | * DBGO("\\_GPE\\_L17\n") |
| 260 | * } |
| 261 | */ |
| 262 | |
| 263 | /* GPIO0 or GEvent8 event */ |
| 264 | Method(_L18) { |
| 265 | /* DBGO("\\_GPE\\_L18\n") */ |
| 266 | Notify(\_SB.PCI0.PBR2, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 267 | Notify(\_SB.PCI0.PBR4, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 268 | Notify(\_SB.PCI0.PBR5, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 269 | Notify(\_SB.PCI0.PBR6, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 270 | Notify(\_SB.PCI0.PBR7, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 271 | Notify(\_SB.PWRB, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 272 | } |
| 273 | |
| 274 | /* GPM4 SCI event - Moved to USB.asl */ |
| 275 | /* Method(_L19) { |
| 276 | * DBGO("\\_GPE\\_L19\n") |
| 277 | * } |
| 278 | */ |
| 279 | |
| 280 | /* GPM5 SCI event - Moved to USB.asl */ |
| 281 | /* Method(_L1A) { |
| 282 | * DBGO("\\_GPE\\_L1A\n") |
| 283 | * } |
| 284 | */ |
| 285 | |
| 286 | /* Azalia SCI event */ |
| 287 | Method(_L1B) { |
| 288 | /* DBGO("\\_GPE\\_L1B\n") */ |
| 289 | Notify(\_SB.PCI0.AZHD, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 290 | Notify(\_SB.PWRB, 0x02) /* NOTIFY_DEVICE_WAKE */ |
| 291 | } |
| 292 | |
| 293 | /* GPM6 SCI event - Reassigned to _L06 */ |
| 294 | /* Method(_L1C) { |
| 295 | * DBGO("\\_GPE\\_L1C\n") |
| 296 | * } |
| 297 | */ |
| 298 | |
| 299 | /* GPM7 SCI event - Reassigned to _L07 */ |
| 300 | /* Method(_L1D) { |
| 301 | * DBGO("\\_GPE\\_L1D\n") |
| 302 | * } |
| 303 | */ |
| 304 | |
| 305 | /* GPIO2 or GPIO66 SCI event */ |
| 306 | /* Method(_L1E) { |
| 307 | * DBGO("\\_GPE\\_L1E\n") |
| 308 | * } |
| 309 | */ |
| 310 | |
| 311 | /* SATA SCI event */ |
| 312 | /* SATA Hot Plug Support -> acpi/sata.asl */ |
| 313 | } /* End Scope GPE */ |