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