2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2015 Google Inc.
6 * Copyright (C) 2015 Intel Corporation.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #include <soc/iomap.h>
20 #define BASE_32GB 0x800000000
21 #define SIZE_16GB 0x400000000
23 Name (_HID, EISAID ("PNP0A08")) /* PCIe */
24 Name (_CID, EISAID ("PNP0A03")) /* PCI */
31 Name (_ADR, 0x00000000)
33 OperationRegion (MCHP, PCI_Config, 0x00, 0x100)
34 Field (MCHP, DWordAcc, NoLock, Preserve)
36 Offset(0x40), /* EPBAR (0:0:0:40) */
39 EPBR, 20, /* EPBAR [31:12] */
41 Offset(0x48), /* MCHBAR (0:0:0:48) */
44 MHBR, 17, /* MCHBAR [31:15] */
46 Offset(0x60), /* PCIEXBAR (0:0:0:60) */
48 PXSZ, 2, /* PCI Express Size */
50 PXBR, 6, /* PCI Express BAR [31:26] */
52 Offset(0x68), /* DMIBAR (0:0:0:68) */
55 DIBR, 20, /* DMIBAR [31:12] */
57 Offset (0x70), /* ME Base Address */
60 Offset (0xa0), /* Top of Used Memory */
63 Offset (0xa8), /* Top of Upper Used Memory */
66 Offset (0xbc), /* Top of Low Used Memory */
71 Name (MCRS, ResourceTemplate ()
74 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
75 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100)
78 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
80 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8)
82 /* PCI Config Space */
83 Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
86 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
88 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300)
90 /* VGA memory (0xa0000-0xbffff) */
91 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
93 0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
96 /* OPROM reserved (0xc0000-0xc3fff) */
97 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
99 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000,
102 /* OPROM reserved (0xc4000-0xc7fff) */
103 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
104 Cacheable, ReadWrite,
105 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000,
108 /* OPROM reserved (0xc8000-0xcbfff) */
109 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
110 Cacheable, ReadWrite,
111 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000,
114 /* OPROM reserved (0xcc000-0xcffff) */
115 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
116 Cacheable, ReadWrite,
117 0x00000000, 0x000cc000, 0x000cffff, 0x00000000,
120 /* OPROM reserved (0xd0000-0xd3fff) */
121 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
122 Cacheable, ReadWrite,
123 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000,
126 /* OPROM reserved (0xd4000-0xd7fff) */
127 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
128 Cacheable, ReadWrite,
129 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000,
132 /* OPROM reserved (0xd8000-0xdbfff) */
133 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
134 Cacheable, ReadWrite,
135 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000,
138 /* OPROM reserved (0xdc000-0xdffff) */
139 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
140 Cacheable, ReadWrite,
141 0x00000000, 0x000dc000, 0x000dffff, 0x00000000,
144 /* BIOS Extension (0xe0000-0xe3fff) */
145 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
146 Cacheable, ReadWrite,
147 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000,
150 /* BIOS Extension (0xe4000-0xe7fff) */
151 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
152 Cacheable, ReadWrite,
153 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000,
156 /* BIOS Extension (0xe8000-0xebfff) */
157 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
158 Cacheable, ReadWrite,
159 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000,
162 /* BIOS Extension (0xec000-0xeffff) */
163 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
164 Cacheable, ReadWrite,
165 0x00000000, 0x000ec000, 0x000effff, 0x00000000,
168 /* System BIOS (0xf0000-0xfffff) */
169 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
170 Cacheable, ReadWrite,
171 0x00000000, 0x000f0000, 0x000fffff, 0x00000000,
174 /* PCI Memory Region (TOLUD - 0xdfffffff) */
175 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
176 NonCacheable, ReadWrite,
177 0x00000000, 0x00000000, 0xdfffffff, 0x00000000,
180 /* PCI Memory Region (TOUUD - (TOUUD + ABOVE_4G_MMIO_SIZE)) */
181 QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
182 NonCacheable, ReadWrite,
183 0x00000000, 0x10000, 0x1ffff, 0x00000000,
186 /* PCH reserved resource (0xfd000000-0xfe7fffff) */
187 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
188 Cacheable, ReadWrite,
189 0x00000000, 0xfd000000, 0xfe7fffff, 0x00000000,
192 /* TPM Area (0xfed40000-0xfed44fff) */
193 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
194 Cacheable, ReadWrite,
195 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000,
199 Method (_CRS, 0, Serialized)
201 /* Find PCI resource area in MCRS */
202 CreateDwordField (^MCRS, ^PM01._MIN, PMIN)
203 CreateDwordField (^MCRS, ^PM01._MAX, PMAX)
204 CreateDwordField (^MCRS, ^PM01._LEN, PLEN)
207 * Fix up PCI memory region
208 * Start with Top of Lower Usable DRAM
210 Store (^MCHC.TLUD, Local0)
211 Store (^MCHC.MEBA, Local1)
213 /* Check if ME base is equal */
214 If (LEqual (Local0, Local1)) {
215 /* Use Top Of Memory instead */
216 Store (^MCHC.TOM, Local0)
220 Add (Subtract (PMAX, PMIN), 1, PLEN)
222 /* Patch PM02 range based on Memory Size */
223 CreateQwordField (^MCRS, ^PM02._MIN, MMIN)
224 CreateQwordField (^MCRS, ^PM02._MAX, MMAX)
225 CreateQwordField (^MCRS, ^PM02._LEN, MLEN)
227 Store (^MCHC.TUUD, Local0)
229 If (LLessEqual (Local0, BASE_32GB)) {
230 Store (BASE_32GB, MMIN)
231 Store (SIZE_16GB, MLEN)
236 Subtract (Add (MMIN, MLEN), 1, MMAX)
241 Name (EP_B, 0) /* to store EP BAR */
242 Name (MH_B, 0) /* to store MCH BAR */
243 Name (PC_B, 0) /* to store PCIe BAR */
244 Name (PC_L, 0) /* to store PCIe BAR Length */
245 Name (DM_B, 0) /* to store DMI BAR */
248 Method (GMHB, 0, Serialized)
250 If (LEqual (MH_B, 0)) {
251 ShiftLeft (\_SB.PCI0.MCHC.MHBR, 15, MH_B)
257 Method (GEPB, 0, Serialized)
259 If (LEqual (EP_B, 0)) {
260 ShiftLeft (\_SB.PCI0.MCHC.EPBR, 12, EP_B)
266 Method (GPCB, 0, Serialized)
268 If (LEqual (PC_B, 0)) {
269 ShiftLeft (\_SB.PCI0.MCHC.PXBR, 26, PC_B)
274 /* Get PCIe Length */
275 Method (GPCL, 0, Serialized)
277 If (LEqual (PC_L, 0)) {
278 ShiftRight (0x10000000, \_SB.PCI0.MCHC.PXSZ, PC_L)
284 Method (GDMB, 0, Serialized)
286 If (LEqual (DM_B, 0)) {
287 ShiftLeft (\_SB.PCI0.MCHC.DIBR, 12, DM_B)
292 /* PCI Device Resource Consumption */
295 Name (_HID, EISAID ("PNP0C02"))
298 Name (BUF0, ResourceTemplate ()
300 /* MCH BAR _BAS will be updated in _CRS below according to
303 Memory32Fixed (ReadWrite, 0, 0x08000, MCHB)
305 /* DMI BAR _BAS will be updated in _CRS below according to
308 Memory32Fixed (ReadWrite, 0, 0x01000, DMIB)
310 /* EP BAR _BAS will be updated in _CRS below according to
313 Memory32Fixed (ReadWrite, 0, 0x01000, EGPB)
315 /* PCI Express BAR _BAS and _LEN will be updated in
316 * _CRS below according to B0:D0:F0:Reg.60h
318 Memory32Fixed (ReadWrite, 0, 0, PCIX)
320 /* MISC ICH TTT base address reserved for the
323 Memory32Fixed (ReadWrite, 0xFED20000, 0x20000)
325 /* VTD engine memory range.
326 * Check if the hard code meets the real configuration.
328 Memory32Fixed (ReadOnly, 0xFED90000, 0x00004000)
330 /* MISC ICH. Check if the hard code meets the
331 * real configuration.
333 Memory32Fixed (ReadWrite, 0xFED45000, 0x4B000, TPMM)
336 Memory32Fixed (ReadOnly, 0xFF000000, 0x1000000, FIOH) /* 16MB */
338 /* Local APIC range(0xFEE0_0000 to 0xFEEF_FFFF) */
339 Memory32Fixed (ReadOnly, 0xFEE00000, 0x100000, LIOH)
341 /* HPET address decode range */
342 Memory32Fixed (ReadWrite, HPET_BASE_ADDRESS, 0x400)
344 /* Debug Base Address
345 * Base Address for ACPI debug output memory buffer
347 Memory32Fixed (ReadWrite, 0, 0, DBAD)
350 Method (_CRS, 0, Serialized)
352 CreateDwordField (BUF0, ^MCHB._BAS, MBR0)
353 Store (\_SB.PCI0.GMHB (), MBR0)
355 CreateDwordField (BUF0, ^DMIB._BAS, DBR0)
356 Store (\_SB.PCI0.GDMB (), DBR0)
358 CreateDwordField (BUF0, ^EGPB._BAS, EBR0)
359 Store (\_SB.PCI0.GEPB (), EBR0)
361 CreateDwordField (BUF0, ^PCIX._BAS, XBR0)
362 Store (\_SB.PCI0.GPCB (), XBR0)
364 CreateDwordField (BUF0, ^PCIX._LEN, XSZ0)
365 Store (\_SB.PCI0.GPCL (), XSZ0)
371 /* PCI IRQ assignment */
372 #include "pci_irqs.asl"