Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [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. |
| 15 | * |
| 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, |
| 19 | * MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | |
| 23 | Name(_HID,EISAID("PNP0A08")) // PCIe |
| 24 | Name(_CID,EISAID("PNP0A03")) // PCI |
| 25 | |
| 26 | Name(_ADR, 0) |
| 27 | Name(_BBN, 0) |
| 28 | |
| 29 | Device (MCHC) |
| 30 | { |
| 31 | Name(_ADR, 0x00000000) // 0:0.0 |
| 32 | |
| 33 | OperationRegion(MCHP, PCI_Config, 0x00, 0x100) |
| 34 | Field (MCHP, DWordAcc, NoLock, Preserve) |
| 35 | { |
| 36 | Offset (0x40), // EPBAR |
| 37 | EPEN, 1, // Enable |
| 38 | , 11, // |
| 39 | EPBR, 24, // EPBAR |
| 40 | |
| 41 | Offset (0x48), // MCHBAR |
| 42 | MHEN, 1, // Enable |
| 43 | , 13, // |
| 44 | MHBR, 22, // MCHBAR |
| 45 | |
| 46 | Offset (0x60), // PCIe BAR |
| 47 | PXEN, 1, // Enable |
| 48 | PXSZ, 2, // BAR size |
| 49 | , 23, // |
| 50 | PXBR, 10, // PCIe BAR |
| 51 | |
| 52 | Offset (0x68), // DMIBAR |
| 53 | DMEN, 1, // Enable |
| 54 | , 11, // |
| 55 | DMBR, 24, // DMIBAR |
| 56 | |
| 57 | Offset (0x70), // ME Base Address |
| 58 | MEBA, 64, |
| 59 | |
| 60 | // ... |
| 61 | |
| 62 | Offset (0x80), // PAM0 |
| 63 | , 4, |
| 64 | PM0H, 2, |
| 65 | , 2, |
| 66 | Offset (0x81), // PAM1 |
| 67 | PM1L, 2, |
| 68 | , 2, |
| 69 | PM1H, 2, |
| 70 | , 2, |
| 71 | Offset (0x82), // PAM2 |
| 72 | PM2L, 2, |
| 73 | , 2, |
| 74 | PM2H, 2, |
| 75 | , 2, |
| 76 | Offset (0x83), // PAM3 |
| 77 | PM3L, 2, |
| 78 | , 2, |
| 79 | PM3H, 2, |
| 80 | , 2, |
| 81 | Offset (0x84), // PAM4 |
| 82 | PM4L, 2, |
| 83 | , 2, |
| 84 | PM4H, 2, |
| 85 | , 2, |
| 86 | Offset (0x85), // PAM5 |
| 87 | PM5L, 2, |
| 88 | , 2, |
| 89 | PM5H, 2, |
| 90 | , 2, |
| 91 | Offset (0x86), // PAM6 |
| 92 | PM6L, 2, |
| 93 | , 2, |
| 94 | PM6H, 2, |
| 95 | , 2, |
| 96 | |
| 97 | Offset (0xa0), // Top of Used Memory |
| 98 | TOM, 64, |
| 99 | |
| 100 | Offset (0xbc), // Top of Low Used Memory |
| 101 | TLUD, 32, |
| 102 | } |
| 103 | |
Duncan Laurie | 1b3207e | 2012-07-18 15:33:45 -0700 | [diff] [blame] | 104 | Mutex (CTCM, 1) /* CTDP Switch Mutex (sync level 1) */ |
| 105 | Name (CTCC, 0) /* CTDP Current Selection */ |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 106 | Name (CTCN, 0) /* CTDP Nominal Select */ |
| 107 | Name (CTCD, 1) /* CTDP Down Select */ |
| 108 | Name (CTCU, 2) /* CTDP Up Select */ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 109 | |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 110 | OperationRegion (MCHB, SystemMemory, DEFAULT_MCHBAR, 0x8000) |
| 111 | Field (MCHB, DWordAcc, Lock, Preserve) |
| 112 | { |
| 113 | Offset (0x5930), |
| 114 | CTDN, 15, /* CTDP Nominal PL1 */ |
| 115 | Offset (0x59a0), |
| 116 | PL1V, 15, /* Power Limit 1 Value */ |
| 117 | PL1E, 1, /* Power Limit 1 Enable */ |
| 118 | PL1C, 1, /* Power Limit 1 Clamp */ |
| 119 | PL1T, 7, /* Power Limit 1 Time */ |
| 120 | Offset (0x59a4), |
| 121 | PL2V, 15, /* Power Limit 2 Value */ |
| 122 | PL2E, 1, /* Power Limit 2 Enable */ |
| 123 | PL2C, 1, /* Power Limit 2 Clamp */ |
| 124 | PL2T, 7, /* Power Limit 2 Time */ |
| 125 | Offset (0x5f3c), |
| 126 | TARN, 8, /* CTDP Nominal Turbo Activation Ratio */ |
| 127 | Offset (0x5f40), |
| 128 | CTDD, 15, /* CTDP Down PL1 */ |
| 129 | , 1, |
| 130 | TARD, 8, /* CTDP Down Turbo Activation Ratio */ |
| 131 | Offset (0x5f48), |
| 132 | CTDU, 15, /* CTDP Up PL1 */ |
| 133 | , 1, |
| 134 | TARU, 8, /* CTDP Up Turbo Activation Ratio */ |
| 135 | Offset (0x5f50), |
| 136 | CTCS, 2, /* CTDP Select */ |
| 137 | Offset (0x5f54), |
| 138 | TARS, 8, /* Turbo Activation Ratio Select */ |
| 139 | } |
| 140 | |
| 141 | /* |
| 142 | * Search CPU0 _PSS looking for control=arg0 and then |
| 143 | * return previous P-state entry number for new _PPC |
| 144 | * |
| 145 | * Format of _PSS: |
| 146 | * Name (_PSS, Package () { |
| 147 | * Package (6) { freq, power, tlat, blat, control, status } |
| 148 | * } |
| 149 | */ |
Timothy Pearson | 033bb4b | 2015-02-10 22:21:39 -0600 | [diff] [blame^] | 150 | External (\_PR.CP00._PSS) |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 151 | Method (PSSS, 1, NotSerialized) |
| 152 | { |
| 153 | Store (One, Local0) /* Start at P1 */ |
Timothy Pearson | 033bb4b | 2015-02-10 22:21:39 -0600 | [diff] [blame^] | 154 | Store (SizeOf (\_PR.CP00._PSS), Local1) |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 155 | |
| 156 | While (LLess (Local0, Local1)) { |
| 157 | /* Store _PSS entry Control value to Local2 */ |
| 158 | ShiftRight (DeRefOf (Index (DeRefOf (Index |
Timothy Pearson | 033bb4b | 2015-02-10 22:21:39 -0600 | [diff] [blame^] | 159 | (\_PR.CP00._PSS, Local0)), 4)), 8, Local2) |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 160 | If (LEqual (Local2, Arg0)) { |
| 161 | Return (Subtract (Local0, 1)) |
| 162 | } |
| 163 | Increment (Local0) |
| 164 | } |
| 165 | |
| 166 | Return (0) |
| 167 | } |
| 168 | |
| 169 | /* Set TDP Down */ |
| 170 | Method (STND, 0, Serialized) |
| 171 | { |
Duncan Laurie | 1b3207e | 2012-07-18 15:33:45 -0700 | [diff] [blame] | 172 | If (Acquire (CTCM, 100)) { |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 173 | Return (0) |
| 174 | } |
Duncan Laurie | 1b3207e | 2012-07-18 15:33:45 -0700 | [diff] [blame] | 175 | If (LEqual (CTCD, CTCC)) { |
| 176 | Release (CTCM) |
| 177 | Return (0) |
| 178 | } |
| 179 | |
| 180 | Store ("Set TDP Down", Debug) |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 181 | |
| 182 | /* Set CTC */ |
| 183 | Store (CTCD, CTCS) |
| 184 | |
| 185 | /* Set TAR */ |
| 186 | Store (TARD, TARS) |
| 187 | |
| 188 | /* Set PPC limit and notify OS */ |
| 189 | Store (PSSS (TARD), PPCM) |
| 190 | PPCN () |
| 191 | |
| 192 | /* Set PL2 to 1.25 * PL1 */ |
| 193 | Divide (Multiply (CTDD, 125), 100, Local0, PL2V) |
| 194 | |
| 195 | /* Set PL1 */ |
| 196 | Store (CTDD, PL1V) |
| 197 | |
Duncan Laurie | 1b3207e | 2012-07-18 15:33:45 -0700 | [diff] [blame] | 198 | /* Store the new TDP Down setting */ |
| 199 | Store (CTCD, CTCC) |
| 200 | |
| 201 | Release (CTCM) |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 202 | Return (1) |
| 203 | } |
| 204 | |
| 205 | /* Set TDP Nominal from Down */ |
| 206 | Method (STDN, 0, Serialized) |
| 207 | { |
Duncan Laurie | 1b3207e | 2012-07-18 15:33:45 -0700 | [diff] [blame] | 208 | If (Acquire (CTCM, 100)) { |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 209 | Return (0) |
| 210 | } |
Duncan Laurie | 1b3207e | 2012-07-18 15:33:45 -0700 | [diff] [blame] | 211 | If (LEqual (CTCN, CTCC)) { |
| 212 | Release (CTCM) |
| 213 | Return (0) |
| 214 | } |
| 215 | |
| 216 | Store ("Set TDP Nominal", Debug) |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 217 | |
| 218 | /* Set PL1 */ |
| 219 | Store (CTDN, PL1V) |
| 220 | |
| 221 | /* Set PL2 to 1.25 * PL1 */ |
| 222 | Divide (Multiply (CTDN, 125), 100, Local0, PL2V) |
| 223 | |
| 224 | /* Set PPC limit and notify OS */ |
| 225 | Store (PSSS (TARN), PPCM) |
| 226 | PPCN () |
| 227 | |
| 228 | /* Set TAR */ |
| 229 | Store (TARN, TARS) |
| 230 | |
| 231 | /* Set CTC */ |
| 232 | Store (CTCN, CTCS) |
| 233 | |
Duncan Laurie | 1b3207e | 2012-07-18 15:33:45 -0700 | [diff] [blame] | 234 | /* Store the new TDP Nominal setting */ |
| 235 | Store (CTCN, CTCC) |
| 236 | |
| 237 | Release (CTCM) |
Duncan Laurie | 55864ef | 2012-07-16 12:27:42 -0700 | [diff] [blame] | 238 | Return (1) |
| 239 | } |
| 240 | } |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 241 | |
| 242 | // Current Resource Settings |
| 243 | |
| 244 | Method (_CRS, 0, Serialized) |
| 245 | { |
| 246 | Name (MCRS, ResourceTemplate() |
| 247 | { |
| 248 | // Bus Numbers |
| 249 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, |
| 250 | 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100,,, PB00) |
| 251 | |
| 252 | // IO Region 0 |
| 253 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 254 | 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8,,, PI00) |
| 255 | |
| 256 | // PCI Config Space |
| 257 | Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008) |
| 258 | |
| 259 | // IO Region 1 |
| 260 | DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 261 | 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300,,, PI01) |
| 262 | |
| 263 | // VGA memory (0xa0000-0xbffff) |
| 264 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 265 | Cacheable, ReadWrite, |
| 266 | 0x00000000, 0x000a0000, 0x000bffff, 0x00000000, |
| 267 | 0x00020000,,, ASEG) |
| 268 | |
| 269 | // OPROM reserved (0xc0000-0xc3fff) |
| 270 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 271 | Cacheable, ReadWrite, |
| 272 | 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000, |
| 273 | 0x00004000,,, OPR0) |
| 274 | |
| 275 | // OPROM reserved (0xc4000-0xc7fff) |
| 276 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 277 | Cacheable, ReadWrite, |
| 278 | 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000, |
| 279 | 0x00004000,,, OPR1) |
| 280 | |
| 281 | // OPROM reserved (0xc8000-0xcbfff) |
| 282 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 283 | Cacheable, ReadWrite, |
| 284 | 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000, |
| 285 | 0x00004000,,, OPR2) |
| 286 | |
| 287 | // OPROM reserved (0xcc000-0xcffff) |
| 288 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 289 | Cacheable, ReadWrite, |
| 290 | 0x00000000, 0x000cc000, 0x000cffff, 0x00000000, |
| 291 | 0x00004000,,, OPR3) |
| 292 | |
| 293 | // OPROM reserved (0xd0000-0xd3fff) |
| 294 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 295 | Cacheable, ReadWrite, |
| 296 | 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000, |
| 297 | 0x00004000,,, OPR4) |
| 298 | |
| 299 | // OPROM reserved (0xd4000-0xd7fff) |
| 300 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 301 | Cacheable, ReadWrite, |
| 302 | 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000, |
| 303 | 0x00004000,,, OPR5) |
| 304 | |
| 305 | // OPROM reserved (0xd8000-0xdbfff) |
| 306 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 307 | Cacheable, ReadWrite, |
| 308 | 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000, |
| 309 | 0x00004000,,, OPR6) |
| 310 | |
| 311 | // OPROM reserved (0xdc000-0xdffff) |
| 312 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 313 | Cacheable, ReadWrite, |
| 314 | 0x00000000, 0x000dc000, 0x000dffff, 0x00000000, |
| 315 | 0x00004000,,, OPR7) |
| 316 | |
| 317 | // BIOS Extension (0xe0000-0xe3fff) |
| 318 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 319 | Cacheable, ReadWrite, |
| 320 | 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000, |
| 321 | 0x00004000,,, ESG0) |
| 322 | |
| 323 | // BIOS Extension (0xe4000-0xe7fff) |
| 324 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 325 | Cacheable, ReadWrite, |
| 326 | 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000, |
| 327 | 0x00004000,,, ESG1) |
| 328 | |
| 329 | // BIOS Extension (0xe8000-0xebfff) |
| 330 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 331 | Cacheable, ReadWrite, |
| 332 | 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000, |
| 333 | 0x00004000,,, ESG2) |
| 334 | |
| 335 | // BIOS Extension (0xec000-0xeffff) |
| 336 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 337 | Cacheable, ReadWrite, |
| 338 | 0x00000000, 0x000ec000, 0x000effff, 0x00000000, |
| 339 | 0x00004000,,, ESG3) |
| 340 | |
| 341 | // System BIOS (0xf0000-0xfffff) |
| 342 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 343 | Cacheable, ReadWrite, |
| 344 | 0x00000000, 0x000f0000, 0x000fffff, 0x00000000, |
| 345 | 0x00010000,,, FSEG) |
| 346 | |
| 347 | // PCI Memory Region (Top of memory-0xfebfffff) |
| 348 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 349 | Cacheable, ReadWrite, |
| 350 | 0x00000000, 0x00000000, 0xfebfffff, 0x00000000, |
| 351 | 0xfec00000,,, PM01) |
| 352 | |
| 353 | // TPM Area (0xfed40000-0xfed44fff) |
| 354 | DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, |
| 355 | Cacheable, ReadWrite, |
| 356 | 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000, |
| 357 | 0x00005000,,, TPMR) |
| 358 | }) |
| 359 | |
| 360 | // Find PCI resource area in MCRS |
| 361 | CreateDwordField(MCRS, PM01._MIN, PMIN) |
| 362 | CreateDwordField(MCRS, PM01._MAX, PMAX) |
| 363 | CreateDwordField(MCRS, PM01._LEN, PLEN) |
| 364 | |
| 365 | // Fix up PCI memory region |
| 366 | // Start with Top of Lower Usable DRAM |
| 367 | Store (^MCHC.TLUD, Local0) |
| 368 | Store (^MCHC.MEBA, Local1) |
| 369 | |
| 370 | // Check if ME base is equal |
| 371 | If (LEqual (Local0, Local1)) { |
| 372 | // Use Top Of Memory instead |
| 373 | Store (^MCHC.TOM, Local0) |
| 374 | } |
| 375 | |
| 376 | Store (Local0, PMIN) |
| 377 | Add(Subtract(PMAX, PMIN), 1, PLEN) |
| 378 | |
| 379 | Return (MCRS) |
| 380 | } |