Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 The Chromium OS Authors. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | /* |
| 17 | * The mainboard must define a PNOT method to handle power |
| 18 | * state notifications and Notify CPU device objects to |
| 19 | * re-evaluate their _PPC and _CST tables. |
| 20 | */ |
| 21 | |
| 22 | Device (EC0) |
| 23 | { |
| 24 | Name (_HID, EISAID ("PNP0C09")) |
| 25 | Name (_UID, 1) |
| 26 | Name (_GPE, EC_GPE) // GPE for Runtime SCI |
| 27 | |
| 28 | OperationRegion (ERAM, EmbeddedControl, 0x00, 0xff) |
| 29 | Field (ERAM, ByteAcc, Lock, Preserve) |
| 30 | { |
| 31 | Offset (0x80), |
| 32 | BTEX, 1, // Battery Exists |
| 33 | , 1, |
| 34 | ACEX, 1, // AC Exists |
| 35 | , 5, |
| 36 | Offset (0x83), |
| 37 | LIDS, 1, // Lid Switch State |
| 38 | , 7, |
| 39 | BTST, 8, // Battery State |
| 40 | Offset (0xA2), |
| 41 | BTRA, 16, // Battery Remaining Capacity |
| 42 | BTPR, 16, // Battery Present Rate |
| 43 | BTVO, 16, // Battery Present Voltage |
| 44 | Offset (0xB0), |
| 45 | BTDA, 16, // Battery Design Capacity |
| 46 | BTDF, 16, // Battery Last Full Charge Capacity |
| 47 | BTDV, 16, // Battery Design Voltage |
| 48 | BTDL, 16, // Battery Design Low |
| 49 | Offset (0xC0), |
| 50 | CPUT, 8, // CPU Temperature |
| 51 | Offset (0xCA), |
| 52 | FSL0, 1, // Fan Speed Level 0 |
| 53 | FSL1, 1, // Fan Speed Level 1 |
| 54 | FSL2, 1, // Fan Speed Level 2 |
| 55 | FSL3, 1, // Fan Speed Level 3 |
| 56 | FSL4, 1, // Fan Speed Level 4 |
| 57 | , 2, |
| 58 | FCOS, 1, // Fan Speed OS Control |
| 59 | } |
| 60 | |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 61 | Method (_CRS, 0, Serialized) |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 62 | { |
| 63 | Name (ECMD, ResourceTemplate() |
| 64 | { |
| 65 | IO (Decode16, 0x62, 0x62, 0, 1) |
| 66 | IO (Decode16, 0x66, 0x66, 0, 1) |
| 67 | }) |
| 68 | Return (ECMD) |
| 69 | } |
| 70 | |
| 71 | Method (_REG, 2, NotSerialized) |
| 72 | { |
| 73 | // Initialize AC power state |
| 74 | Store (ACEX, \PWRS) |
| 75 | |
| 76 | // Initialize LID switch state |
| 77 | Store (LIDS, \LIDS) |
| 78 | |
| 79 | // Enable OS control of fan speed |
| 80 | Store (One, FCOS) |
| 81 | |
| 82 | // Force a read of CPU temperature |
| 83 | Store (CPUT, Local0) |
Vladimir Serbinenko | b27c24f | 2016-02-08 00:10:44 +0100 | [diff] [blame] | 84 | /* So that we don't get a warning that Local0 is unused. */ |
| 85 | Increment (Local0) |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | PowerResource (FNP0, 0, 0) |
| 89 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 90 | Method (_STA) { |
| 91 | If (LLessEqual (\FLVL, 0)) { |
| 92 | Return (One) |
| 93 | } Else { |
| 94 | Return (Zero) |
| 95 | } |
| 96 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 97 | Method (_ON) { |
| 98 | If (FCOS) { |
| 99 | Store (One, FSL0) |
| 100 | Store (0, \FLVL) |
| 101 | Notify (\_TZ.THRM, 0x81) |
| 102 | } |
| 103 | } |
| 104 | Method (_OFF) { |
| 105 | If (FCOS) { |
| 106 | Store (Zero, FSL0) |
| 107 | Store (1, \FLVL) |
| 108 | Notify (\_TZ.THRM, 0x81) |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | PowerResource (FNP1, 0, 0) |
| 114 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 115 | Method (_STA) { |
| 116 | If (LLessEqual (\FLVL, 1)) { |
| 117 | Return (One) |
| 118 | } Else { |
| 119 | Return (Zero) |
| 120 | } |
| 121 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 122 | Method (_ON) { |
| 123 | If (FCOS) { |
| 124 | Store (One, FSL1) |
| 125 | Store (1, \FLVL) |
| 126 | Notify (\_TZ.THRM, 0x81) |
| 127 | } |
| 128 | } |
| 129 | Method (_OFF) { |
| 130 | If (FCOS) { |
| 131 | Store (Zero, FSL1) |
| 132 | Store (2, \FLVL) |
| 133 | Notify (\_TZ.THRM, 0x81) |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | PowerResource (FNP2, 0, 0) |
| 139 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 140 | Method (_STA) { |
| 141 | If (LLessEqual (\FLVL, 2)) { |
| 142 | Return (One) |
| 143 | } Else { |
| 144 | Return (Zero) |
| 145 | } |
| 146 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 147 | Method (_ON) { |
| 148 | If (FCOS) { |
| 149 | Store (One, FSL2) |
| 150 | Store (2, \FLVL) |
| 151 | Notify (\_TZ.THRM, 0x81) |
| 152 | } |
| 153 | } |
| 154 | Method (_OFF) { |
| 155 | If (FCOS) { |
| 156 | Store (Zero, FSL2) |
| 157 | Store (3, \FLVL) |
| 158 | Notify (\_TZ.THRM, 0x81) |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | PowerResource (FNP3, 0, 0) |
| 164 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 165 | Method (_STA) { |
| 166 | If (LLessEqual (\FLVL, 3)) { |
| 167 | Return (One) |
| 168 | } Else { |
| 169 | Return (Zero) |
| 170 | } |
| 171 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 172 | Method (_ON) { |
| 173 | If (FCOS) { |
| 174 | Store (One, FSL3) |
| 175 | Store (3, \FLVL) |
| 176 | Notify (\_TZ.THRM, 0x81) |
| 177 | } |
| 178 | } |
| 179 | Method (_OFF) { |
| 180 | If (FCOS) { |
| 181 | Store (Zero, FSL3) |
| 182 | Store (4, \FLVL) |
| 183 | Notify (\_TZ.THRM, 0x81) |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | PowerResource (FNP4, 0, 0) |
| 189 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 190 | Method (_STA) { |
| 191 | If (LLessEqual (\FLVL, 4)) { |
| 192 | Return (One) |
| 193 | } Else { |
| 194 | Return (Zero) |
| 195 | } |
Elyes HAOUAS | 88607a4 | 2018-10-05 10:36:45 +0200 | [diff] [blame] | 196 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 197 | Method (_ON) { |
| 198 | If (FCOS) { |
| 199 | Store (One, FSL4) |
| 200 | Store (4, \FLVL) |
| 201 | Notify (\_TZ.THRM, 0x81) |
| 202 | } |
| 203 | } |
| 204 | Method (_OFF) { |
| 205 | If (FCOS) { |
| 206 | Store (Zero, FSL4) |
| 207 | Store (5, \FLVL) |
| 208 | Notify (\_TZ.THRM, 0x81) |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | Device (FAN0) |
| 214 | { |
| 215 | Name (_HID, EISAID ("PNP0C0B")) |
| 216 | Name (_UID, 0) |
| 217 | Name (_PR0, Package () { FNP0 }) |
| 218 | } |
| 219 | |
| 220 | Device (FAN1) |
| 221 | { |
| 222 | Name (_HID, EISAID ("PNP0C0B")) |
| 223 | Name (_UID, 1) |
| 224 | Name (_PR0, Package () { FNP1 }) |
| 225 | } |
| 226 | |
| 227 | Device (FAN2) |
| 228 | { |
| 229 | Name (_HID, EISAID ("PNP0C0B")) |
| 230 | Name (_UID, 2) |
| 231 | Name (_PR0, Package () { FNP2 }) |
| 232 | } |
| 233 | |
| 234 | Device (FAN3) |
| 235 | { |
| 236 | Name (_HID, EISAID ("PNP0C0B")) |
| 237 | Name (_UID, 3) |
| 238 | Name (_PR0, Package () { FNP3 }) |
| 239 | } |
| 240 | |
| 241 | Device (FAN4) |
| 242 | { |
| 243 | Name (_HID, EISAID ("PNP0C0B")) |
| 244 | Name (_UID, 4) |
| 245 | Name (_PR0, Package () { FNP4 }) |
| 246 | } |
| 247 | |
| 248 | // AC Power Connected |
| 249 | Method (_Q51, 0, NotSerialized) |
| 250 | { |
| 251 | Store (One, \PWRS) |
| 252 | Notify (AC, 0x80) |
| 253 | \PNOT () |
| 254 | } |
| 255 | |
| 256 | // AC Power Removed |
| 257 | Method (_Q52, 0, NotSerialized) |
| 258 | { |
| 259 | Store (Zero, \PWRS) |
| 260 | Notify (AC, 0x80) |
| 261 | \PNOT () |
| 262 | } |
| 263 | |
| 264 | // Battery State Change |
| 265 | Method (_Q53, 0, NotSerialized) |
| 266 | { |
| 267 | Notify (BAT0, 0x80) |
| 268 | Notify (BAT0, 0x81) |
| 269 | } |
| 270 | |
| 271 | // Battery State Change |
| 272 | Method (_Q54, 0, NotSerialized) |
| 273 | { |
| 274 | Notify (BAT0, 0x80) |
| 275 | Notify (BAT0, 0x81) |
| 276 | } |
| 277 | |
| 278 | // Power State Change |
| 279 | Method (_Q55, 0, NotSerialized) |
| 280 | { |
| 281 | \PNOT () |
| 282 | } |
| 283 | |
| 284 | // Lid Switch Event |
| 285 | Method (_Q5E, 0, NotSerialized) |
| 286 | { |
| 287 | Store (LIDS, \LIDS) |
| 288 | Notify (\_SB.LID0, 0x80) |
| 289 | } |
| 290 | |
| 291 | // Lid Switch Event |
| 292 | Method (_Q5F, 0, NotSerialized) |
| 293 | { |
| 294 | Store (LIDS, \LIDS) |
| 295 | Notify (\_SB.LID0, 0x80) |
| 296 | } |
| 297 | |
| 298 | #include "ac.asl" |
| 299 | #include "battery.asl" |
| 300 | } |