1 /* SPDX-License-Identifier: GPL-2.0-only */
3 Name(_HID,EISAID("PNP0A08")) // PCIe
4 Name(_CID,EISAID("PNP0A03")) // PCI
10 Name(_ADR, 0x00000000) // 0:0.0
12 OperationRegion(MCHP, PCI_Config, 0x00, 0x100)
13 Field (MCHP, DWordAcc, NoLock, Preserve)
15 Offset (0x40), // EPBAR
20 Offset (0x48), // MCHBAR
26 Offset (0x60), // PCIe BAR
32 Offset (0x68), // DMIBAR
37 Offset (0x70), // ME Base Address
42 Offset (0x80), // PAM0
46 Offset (0x81), // PAM1
51 Offset (0x82), // PAM2
56 Offset (0x83), // PAM3
61 Offset (0x84), // PAM4
66 Offset (0x85), // PAM5
71 Offset (0x86), // PAM6
77 Offset (0xa0), // Top of Used Memory
80 Offset (0xbc), // Top of Low Used Memory
84 Mutex (CTCM, 1) /* CTDP Switch Mutex (sync level 1) */
85 Name (CTCC, 0) /* CTDP Current Selection */
86 Name (CTCN, 0) /* CTDP Nominal Select */
87 Name (CTCD, 1) /* CTDP Down Select */
88 Name (CTCU, 2) /* CTDP Up Select */
90 OperationRegion (MCHB, SystemMemory, \_SB.PCI0.MCHC.MHBR << 15, 0x8000)
91 Field (MCHB, DWordAcc, Lock, Preserve)
94 CTDN, 15, /* CTDP Nominal PL1 */
96 PL1V, 15, /* Power Limit 1 Value */
97 PL1E, 1, /* Power Limit 1 Enable */
98 PL1C, 1, /* Power Limit 1 Clamp */
99 PL1T, 7, /* Power Limit 1 Time */
101 PL2V, 15, /* Power Limit 2 Value */
102 PL2E, 1, /* Power Limit 2 Enable */
103 PL2C, 1, /* Power Limit 2 Clamp */
104 PL2T, 7, /* Power Limit 2 Time */
106 TARN, 8, /* CTDP Nominal Turbo Activation Ratio */
108 CTDD, 15, /* CTDP Down PL1 */
110 TARD, 8, /* CTDP Down Turbo Activation Ratio */
112 CTDU, 15, /* CTDP Up PL1 */
114 TARU, 8, /* CTDP Up Turbo Activation Ratio */
116 CTCS, 2, /* CTDP Select */
118 TARS, 8, /* Turbo Activation Ratio Select */
122 * Search CPU0 _PSS looking for control=arg0 and then
123 * return previous P-state entry number for new _PPC
126 * Name (_PSS, Package () {
127 * Package (6) { freq, power, tlat, blat, control, status }
130 External (\_SB.CP00._PSS)
131 Method (PSSS, 1, NotSerialized)
133 Local0 = 1 /* Start at P1 */
134 Local1 = SizeOf (\_SB.CP00._PSS)
136 While (Local0 < Local1) {
137 /* Store _PSS entry Control value to Local2 */
138 Local2 = DeRefOf (DeRefOf (\_SB.CP00._PSS[Local0])[4]) >> 8
139 If (Local2 == Arg0) {
149 Method (STND, 0, Serialized)
151 If (Acquire (CTCM, 100)) {
159 Printf ("Set TDP Down")
167 /* Set PPC limit and notify OS */
171 /* Set PL2 to 1.25 * PL1 */
172 PL2V = (CTDD * 125) / 100
177 /* Store the new TDP Down setting */
184 /* Set TDP Nominal from Down */
185 Method (STDN, 0, Serialized)
187 If (Acquire (CTCM, 100)) {
195 Printf ("Set TDP Nominal")
200 /* Set PL2 to 1.25 * PL1 */
201 PL2V = (CTDN * 125) / 100
203 /* Set PPC limit and notify OS */
213 /* Store the new TDP Nominal setting */
221 // Current Resource Settings
222 Name (MCRS, ResourceTemplate()
225 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
226 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100,,, PB00)
229 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
230 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8,,, PI00)
233 Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
236 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
237 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300,,, PI01)
239 // VGA memory (0xa0000-0xbffff)
240 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
241 Cacheable, ReadWrite,
242 0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
245 // OPROM reserved (0xc0000-0xc3fff)
246 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
247 Cacheable, ReadWrite,
248 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000,
251 // OPROM reserved (0xc4000-0xc7fff)
252 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
253 Cacheable, ReadWrite,
254 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000,
257 // OPROM reserved (0xc8000-0xcbfff)
258 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
259 Cacheable, ReadWrite,
260 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000,
263 // OPROM reserved (0xcc000-0xcffff)
264 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
265 Cacheable, ReadWrite,
266 0x00000000, 0x000cc000, 0x000cffff, 0x00000000,
269 // OPROM reserved (0xd0000-0xd3fff)
270 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
271 Cacheable, ReadWrite,
272 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000,
275 // OPROM reserved (0xd4000-0xd7fff)
276 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
277 Cacheable, ReadWrite,
278 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000,
281 // OPROM reserved (0xd8000-0xdbfff)
282 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
283 Cacheable, ReadWrite,
284 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000,
287 // OPROM reserved (0xdc000-0xdffff)
288 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
289 Cacheable, ReadWrite,
290 0x00000000, 0x000dc000, 0x000dffff, 0x00000000,
293 // BIOS Extension (0xe0000-0xe3fff)
294 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
295 Cacheable, ReadWrite,
296 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000,
299 // BIOS Extension (0xe4000-0xe7fff)
300 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
301 Cacheable, ReadWrite,
302 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000,
305 // BIOS Extension (0xe8000-0xebfff)
306 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
307 Cacheable, ReadWrite,
308 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000,
311 // BIOS Extension (0xec000-0xeffff)
312 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
313 Cacheable, ReadWrite,
314 0x00000000, 0x000ec000, 0x000effff, 0x00000000,
317 // System BIOS (0xf0000-0xfffff)
318 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
319 Cacheable, ReadWrite,
320 0x00000000, 0x000f0000, 0x000fffff, 0x00000000,
323 // PCI Memory Region (Top of memory-CONFIG_ECAM_MMCONF_BASE_ADDRESS)
324 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
325 Cacheable, ReadWrite,
326 0x00000000, 0x00000000, 0x00000000, 0x00000000,
329 // PCI Memory Region above 4G TOUUD -> 1 << cpu_addr_bits
330 QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
331 Cacheable, ReadWrite,
332 0x00000000, 0x00000000, 0x00000000, 0x00000000,
335 // TPM Area (0xfed40000-0xfed44fff)
336 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
337 Cacheable, ReadWrite,
338 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000,
342 External (\A4GS, IntObj)
343 External (\A4GB, IntObj)
345 Method (_CRS, 0, Serialized)
347 // Find PCI resource area in MCRS
348 CreateDwordField(MCRS, ^PM01._MIN, PMIN)
349 CreateDwordField(MCRS, ^PM01._MAX, PMAX)
350 CreateDwordField(MCRS, ^PM01._LEN, PLEN)
352 // Fix up PCI memory region
353 // Start with Top of Lower Usable DRAM
354 // Lower 20 bits of TOLUD register need to be masked since they contain lock and
356 Local0 = ^MCHC.TLUD & (0xfff << 20)
359 // Check if ME base is equal
360 If (Local0 == Local1) {
361 // Use Top Of Memory instead
362 // Lower 20 bits of TOM register need to be masked since they contain lock and
364 Local0 = ^MCHC.TOM & (0x7ffff << 20)
368 PMAX = CONFIG_ECAM_MMCONF_BASE_ADDRESS - 1
369 PLEN = PMAX - PMIN + 1
372 CreateQwordField(MCRS, ^PM02._MIN, MMIN)
373 CreateQwordField(MCRS, ^PM02._MAX, MMAX)
374 CreateQwordField(MCRS, ^PM02._LEN, MLEN)
375 /* Set 64bit MMIO resource base and length */
378 MMAX = MMIN + MLEN - 1