1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/ioapic.h>
5 Name(_HID,EISAID("PNP0A08")) // PCIe
6 Name(_CID,EISAID("PNP0A03")) // PCI
12 Name(_ADR, 0x00000000) /* 0:0.0 */
14 OperationRegion(MCHP, PCI_Config, 0x00, 0x100)
15 Field (MCHP, DWordAcc, NoLock, Preserve)
17 Offset (0x40), /* EPBAR */
22 Offset (0x48), /* MCHBAR */
25 MHBR, 22, /* MCHBAR */
27 Offset (0x60), /* PCIec BAR */
29 PXSZ, 2, /* BAR size */
31 PXBR, 10, /* PCIe BAR */
33 Offset (0x68), /* DMIBAR */
36 DMBR, 24, /* DMIBAR */
40 Offset (0x90), /* PAM0 */
44 Offset (0x91), /* PAM1 */
49 Offset (0x92), /* PAM2 */
54 Offset (0x93), /* PAM3 */
59 Offset (0x94), /* PAM4 */
64 Offset (0x95), /* PAM5 */
69 Offset (0x96), /* PAM6 */
75 Offset (0xa0), /* Top of Memory */
78 Offset (0xb0), /* Top of Low Used Memory */
84 Name (MCRS, ResourceTemplate()
86 /* Bus Numbers. Highest bus and length get updated later */
87 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
88 0, 0, 255, 0, 256,,, PB00)
91 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
92 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8,,, PI00)
94 /* PCI Config Space */
95 Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
98 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
99 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300,,, PI01)
101 /* VGA memory (0xa0000-0xbffff) */
102 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
103 Cacheable, ReadWrite,
104 0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
107 /* OPROM reserved (0xc0000-0xc3fff) */
108 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
109 Cacheable, ReadWrite,
110 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000,
113 /* OPROM reserved (0xc4000-0xc7fff) */
114 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
115 Cacheable, ReadWrite,
116 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000,
119 /* OPROM reserved (0xc8000-0xcbfff) */
120 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
121 Cacheable, ReadWrite,
122 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000,
125 /* OPROM reserved (0xcc000-0xcffff) */
126 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
127 Cacheable, ReadWrite,
128 0x00000000, 0x000cc000, 0x000cffff, 0x00000000,
131 /* OPROM reserved (0xd0000-0xd3fff) */
132 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
133 Cacheable, ReadWrite,
134 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000,
137 /* OPROM reserved (0xd4000-0xd7fff) */
138 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
139 Cacheable, ReadWrite,
140 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000,
143 /* OPROM reserved (0xd8000-0xdbfff) */
144 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
145 Cacheable, ReadWrite,
146 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000,
149 /* OPROM reserved (0xdc000-0xdffff) */
150 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
151 Cacheable, ReadWrite,
152 0x00000000, 0x000dc000, 0x000dffff, 0x00000000,
155 /* BIOS Extension (0xe0000-0xe3fff) */
156 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
157 Cacheable, ReadWrite,
158 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000,
161 /* BIOS Extension (0xe4000-0xe7fff) */
162 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
163 Cacheable, ReadWrite,
164 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000,
167 /* BIOS Extension (0xe8000-0xebfff) */
168 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
169 Cacheable, ReadWrite,
170 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000,
173 /* BIOS Extension (0xec000-0xeffff) */
174 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
175 Cacheable, ReadWrite,
176 0x00000000, 0x000ec000, 0x000effff, 0x00000000,
179 /* System BIOS (0xf0000-0xfffff) */
180 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
181 Cacheable, ReadWrite,
182 0x00000000, 0x000f0000, 0x000fffff, 0x00000000,
185 /* PCI Memory Region (Top of memory-0xfebfffff) */
186 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
187 Cacheable, ReadWrite,
188 0x00000000, 0x00000000, 0xfebfffff, 0x00000000,
189 IO_APIC_ADDR,,, PM01)
191 /* PCI Memory Region above 4G TOUUD -> 1 << cpu_addr_bits */
192 QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
193 Cacheable, ReadWrite,
194 0x00000000, 0x00000000, 0x00000000, 0x00000000,
197 /* TPM Area (0xfed40000-0xfed44fff) */
198 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
199 Cacheable, ReadWrite,
200 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000,
204 External (A4GS, IntObj)
205 External (A4GB, IntObj)
207 /* Current Resource Settings */
208 Method (_CRS, 0, Serialized)
210 /* Set highest PCI bus and length */
211 CreateWordField(MCRS, ^PB00._MAX, BMAX)
212 CreateWordField(MCRS, ^PB00._LEN, BLEN)
213 BLEN = CONFIG_ECAM_MMCONF_BUS_NUMBER
216 /* Find PCI resource area in MCRS */
217 CreateDwordField(MCRS, ^PM01._MIN, PMIN)
218 CreateDwordField(MCRS, ^PM01._MAX, PMAX)
219 CreateDwordField(MCRS, ^PM01._LEN, PLEN)
222 * Fix up PCI memory region:
223 * Enter actual TOLUD. The TOLUD register contains bits 20-31 of
224 * the top of memory address.
226 PMIN = ^MCHC.TLUD << 20
227 PLEN = PMAX - PMIN + 1
230 CreateQwordField(MCRS, ^PM02._MIN, MMIN)
231 CreateQwordField(MCRS, ^PM02._MAX, MMAX)
232 CreateQwordField(MCRS, ^PM02._LEN, MLEN)
233 /* Set 64bit MMIO resource base and length */
236 MMAX = MMIN + MLEN - 1