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