blob: 709e1f78c5e02f3da1338dae7aaccf9fecca8ade [file] [log] [blame]
Angel Pons3bd1e3d2020-04-05 15:47:17 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahyb0005132015-05-12 18:19:47 -07002
3#include <soc/iomap.h>
4
Subrata Banik36eb5002020-01-22 16:01:14 +05305Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
6Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
7Name (_SEG, Zero) // _SEG: PCI Segment
8Name (_UID, Zero) // _UID: Unique ID
Lee Leahyb0005132015-05-12 18:19:47 -07009
Lee Leahyb0005132015-05-12 18:19:47 -070010Device (MCHC)
11{
Duncan Laurief966d3b2015-08-27 17:19:24 -070012 Name (_ADR, 0x00000000)
Lee Leahyb0005132015-05-12 18:19:47 -070013
14 OperationRegion (MCHP, PCI_Config, 0x00, 0x100)
15 Field (MCHP, DWordAcc, NoLock, Preserve)
16 {
Duncan Laurief966d3b2015-08-27 17:19:24 -070017 Offset(0x40), /* EPBAR (0:0:0:40) */
18 EPEN, 1, /* Enable */
19 , 11,
Subrata Banik4f65b872020-01-22 16:05:16 +053020 EPBR, 27, /* EPBAR [38:12] */
Lee Leahy1d14b3e2015-05-12 18:23:27 -070021
Duncan Laurief966d3b2015-08-27 17:19:24 -070022 Offset(0x48), /* MCHBAR (0:0:0:48) */
23 MHEN, 1, /* Enable */
24 , 14,
Subrata Banik4f65b872020-01-22 16:05:16 +053025 MHBR, 24, /* MCHBAR [38:15] */
Lee Leahy1d14b3e2015-05-12 18:23:27 -070026
Duncan Laurief966d3b2015-08-27 17:19:24 -070027 Offset(0x60), /* PCIEXBAR (0:0:0:60) */
28 PXEN, 1, /* Enable */
29 PXSZ, 2, /* PCI Express Size */
30 , 23,
Subrata Banik4f65b872020-01-22 16:05:16 +053031 PXBR, 13, /* PCI Express BAR [38:26] */
Lee Leahy1d14b3e2015-05-12 18:23:27 -070032
Duncan Laurief966d3b2015-08-27 17:19:24 -070033 Offset(0x68), /* DMIBAR (0:0:0:68) */
34 DIEN, 1, /* Enable */
35 , 11,
Subrata Banik4f65b872020-01-22 16:05:16 +053036 DIBR, 27, /* DMIBAR [38:12] */
Lee Leahy1d14b3e2015-05-12 18:23:27 -070037
Duncan Laurief966d3b2015-08-27 17:19:24 -070038 Offset (0x70), /* ME Base Address */
Lee Leahy1d14b3e2015-05-12 18:23:27 -070039 MEBA, 64,
Subrata Banik4f65b872020-01-22 16:05:16 +053040
Subrata Banike938fb72020-01-03 14:02:50 +053041 Offset (0xa0),
42 TOM, 64, /* Top of Used Memory */
43 TUUD, 64, /* Top of Upper Used Memory */
Lee Leahy1d14b3e2015-05-12 18:23:27 -070044
Duncan Laurief966d3b2015-08-27 17:19:24 -070045 Offset (0xbc), /* Top of Low Used Memory */
Lee Leahy1d14b3e2015-05-12 18:23:27 -070046 TLUD, 32,
Lee Leahyb0005132015-05-12 18:19:47 -070047 }
48}
49
Lee Leahyb0005132015-05-12 18:19:47 -070050Method (_CRS, 0, Serialized)
51{
Subrata Banike938fb72020-01-03 14:02:50 +053052 Name (MCRS, ResourceTemplate ()
53 {
54 /* Bus Numbers */
55 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
56 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100)
57
58 /* IO Region 0 */
59 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
60 EntireRange,
61 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8)
62
63 /* PCI Config Space */
64 Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
65
66 /* IO Region 1 */
67 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
68 EntireRange,
69 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300)
70
71 /* VGA memory (0xa0000-0xbffff) */
72 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
73 Cacheable, ReadWrite,
74 0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
75 0x00020000)
76
77 /* OPROM reserved (0xc0000-0xc3fff) */
78 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
79 Cacheable, ReadWrite,
80 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000,
81 0x00004000)
82
83 /* OPROM reserved (0xc4000-0xc7fff) */
84 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
85 Cacheable, ReadWrite,
86 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000,
87 0x00004000)
88
89 /* OPROM reserved (0xc8000-0xcbfff) */
90 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
91 Cacheable, ReadWrite,
92 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000,
93 0x00004000)
94
95 /* OPROM reserved (0xcc000-0xcffff) */
96 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
97 Cacheable, ReadWrite,
98 0x00000000, 0x000cc000, 0x000cffff, 0x00000000,
99 0x00004000)
100
101 /* OPROM reserved (0xd0000-0xd3fff) */
102 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
103 Cacheable, ReadWrite,
104 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000,
105 0x00004000)
106
107 /* OPROM reserved (0xd4000-0xd7fff) */
108 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
109 Cacheable, ReadWrite,
110 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000,
111 0x00004000)
112
113 /* OPROM reserved (0xd8000-0xdbfff) */
114 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
115 Cacheable, ReadWrite,
116 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000,
117 0x00004000)
118
119 /* OPROM reserved (0xdc000-0xdffff) */
120 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
121 Cacheable, ReadWrite,
122 0x00000000, 0x000dc000, 0x000dffff, 0x00000000,
123 0x00004000)
124
125 /* BIOS Extension (0xe0000-0xe3fff) */
126 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
127 Cacheable, ReadWrite,
128 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000,
129 0x00004000)
130
131 /* BIOS Extension (0xe4000-0xe7fff) */
132 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
133 Cacheable, ReadWrite,
134 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000,
135 0x00004000)
136
137 /* BIOS Extension (0xe8000-0xebfff) */
138 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
139 Cacheable, ReadWrite,
140 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000,
141 0x00004000)
142
143 /* BIOS Extension (0xec000-0xeffff) */
144 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
145 Cacheable, ReadWrite,
146 0x00000000, 0x000ec000, 0x000effff, 0x00000000,
147 0x00004000)
148
149 /* System BIOS (0xf0000-0xfffff) */
150 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
151 Cacheable, ReadWrite,
152 0x00000000, 0x000f0000, 0x000fffff, 0x00000000,
153 0x00010000)
154
155 /* PCI Memory Region (TLUD - 0xdfffffff) */
156 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
157 NonCacheable, ReadWrite,
158 0x00000000, 0x00000000, 0xdfffffff, 0x00000000,
159 0xE0000000,,, PM01)
160
161 /* PCI Memory Region (TUUD - (TUUD + ABOVE_4G_MMIO_SIZE)) */
162 QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
163 NonCacheable, ReadWrite,
164 0x00000000, 0x10000, 0x1ffff, 0x00000000,
165 0x10000,,, PM02)
166
167 /* PCH reserved resource (0xfc800000-0xfe7fffff) */
168 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
169 Cacheable, ReadWrite,
170 0x00000000, PCH_PRESERVED_BASE_ADDRESS, 0xfe7fffff,
171 0x00000000, PCH_PRESERVED_BASE_SIZE)
172
Subrata Banikfa8f9ec2020-01-22 15:58:39 +0530173#if !CONFIG(TPM_CR50)
Subrata Banike938fb72020-01-03 14:02:50 +0530174 /* TPM Area (0xfed40000-0xfed44fff) */
175 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
176 Cacheable, ReadWrite,
177 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000,
178 0x00005000)
Subrata Banikfa8f9ec2020-01-22 15:58:39 +0530179#endif
Subrata Banike938fb72020-01-03 14:02:50 +0530180})
181
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700182 /* Find PCI resource area in MCRS */
Subrata Banike938fb72020-01-03 14:02:50 +0530183 CreateDwordField (MCRS, PM01._MIN, PMIN)
184 CreateDwordField (MCRS, PM01._MAX, PMAX)
185 CreateDwordField (MCRS, PM01._LEN, PLEN)
Lee Leahyb0005132015-05-12 18:19:47 -0700186
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700187 /*
188 * Fix up PCI memory region
189 * Start with Top of Lower Usable DRAM
Furquan Shaikh01750ef2020-05-16 21:41:35 -0700190 * Lower 20 bits of TOLUD register need to be masked since they contain lock and
191 * reserved bits.
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700192 */
Furquan Shaikh01750ef2020-05-16 21:41:35 -0700193 Local0 = \_SB.PCI0.MCHC.TLUD & (0xfff << 20)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700194 Local1 = \_SB.PCI0.MCHC.MEBA
Lee Leahyb0005132015-05-12 18:19:47 -0700195
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700196 /* Check if ME base is equal */
Furquan Shaikhc3361302020-05-16 21:38:33 -0700197 If (Local0 == Local1) {
Furquan Shaikh01750ef2020-05-16 21:41:35 -0700198 /*
199 * Use Top Of Memory instead
200 * Lower 20 bits of TOM register need to be masked since they contain lock and
201 * reserved bits.
202 */
203 Local0 = \_SB.PCI0.MCHC.TOM & (0x7ffff << 20)
Lee Leahyb0005132015-05-12 18:19:47 -0700204 }
205
Elyes HAOUASfc29afb2020-10-09 15:05:28 +0200206 PMIN = Local0
Furquan Shaikhc3361302020-05-16 21:38:33 -0700207 PLEN = (PMAX - PMIN) + 1
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700208
209 /* Patch PM02 range based on Memory Size */
Furquan Shaikhc3361302020-05-16 21:38:33 -0700210 If (A4GS == 0) {
Subrata Banikb6df6b02020-01-03 15:29:02 +0530211 CreateQwordField (MCRS, PM02._LEN, MSEN)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700212 MSEN = 0
Duncan Laurief966d3b2015-08-27 17:19:24 -0700213 } Else {
Subrata Banikb6df6b02020-01-03 15:29:02 +0530214 CreateQwordField (MCRS, PM02._MIN, MMIN)
215 CreateQwordField (MCRS, PM02._MAX, MMAX)
216 CreateQwordField (MCRS, PM02._LEN, MLEN)
217 /* Set 64bit MMIO resource base and length */
Furquan Shaikhc3361302020-05-16 21:38:33 -0700218 MLEN = A4GS
219 MMIN = A4GB
220 MMAX = (MMIN + MLEN) - 1
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700221 }
Lee Leahyb0005132015-05-12 18:19:47 -0700222
Subrata Banike938fb72020-01-03 14:02:50 +0530223 Return (MCRS)
Lee Leahyb0005132015-05-12 18:19:47 -0700224}
225
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700226/* Get MCH BAR */
Duncan Laurief966d3b2015-08-27 17:19:24 -0700227Method (GMHB, 0, Serialized)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700228{
Furquan Shaikhc3361302020-05-16 21:38:33 -0700229 Local0 = \_SB.PCI0.MCHC.MHBR << 15
Subrata Banike938fb72020-01-03 14:02:50 +0530230 Return (Local0)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700231}
232
233/* Get EP BAR */
Duncan Laurief966d3b2015-08-27 17:19:24 -0700234Method (GEPB, 0, Serialized)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700235{
Furquan Shaikhc3361302020-05-16 21:38:33 -0700236 Local0 = \_SB.PCI0.MCHC.EPBR << 12
Subrata Banike938fb72020-01-03 14:02:50 +0530237 Return (Local0)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700238}
239
240/* Get PCIe BAR */
Duncan Laurief966d3b2015-08-27 17:19:24 -0700241Method (GPCB, 0, Serialized)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700242{
Furquan Shaikhc3361302020-05-16 21:38:33 -0700243 Local0 = \_SB.PCI0.MCHC.PXBR << 26
Subrata Banike938fb72020-01-03 14:02:50 +0530244 Return (Local0)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700245}
246
247/* Get PCIe Length */
Duncan Laurief966d3b2015-08-27 17:19:24 -0700248Method (GPCL, 0, Serialized)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700249{
Furquan Shaikhc3361302020-05-16 21:38:33 -0700250 Local0 = 0x10000000 >> \_SB.PCI0.MCHC.PXSZ
Subrata Banike938fb72020-01-03 14:02:50 +0530251 Return (Local0)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700252}
253
254/* Get DMI BAR */
Duncan Laurief966d3b2015-08-27 17:19:24 -0700255Method (GDMB, 0, Serialized)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700256{
Furquan Shaikhc3361302020-05-16 21:38:33 -0700257 Local0 = \_SB.PCI0.MCHC.DIBR << 12
Subrata Banike938fb72020-01-03 14:02:50 +0530258 Return (Local0)
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700259}
260
Lee Leahyb0005132015-05-12 18:19:47 -0700261/* PCI Device Resource Consumption */
262Device (PDRC)
263{
Duncan Laurief966d3b2015-08-27 17:19:24 -0700264 Name (_HID, EISAID ("PNP0C02"))
Lee Leahyb0005132015-05-12 18:19:47 -0700265 Name (_UID, 1)
266
Lee Leahyb0005132015-05-12 18:19:47 -0700267 Method (_CRS, 0, Serialized)
268 {
Subrata Banike938fb72020-01-03 14:02:50 +0530269 Name (BUF0, ResourceTemplate ()
270 {
271 /* MCH BAR _BAS will be updated in _CRS below according to
272 * B0:D0:F0:Reg.48h
273 */
274 Memory32Fixed (ReadWrite, 0, 0x08000, MCHB)
275
276 /* DMI BAR _BAS will be updated in _CRS below according to
277 * B0:D0:F0:Reg.68h
278 */
279 Memory32Fixed (ReadWrite, 0, 0x01000, DMIB)
280
281 /* EP BAR _BAS will be updated in _CRS below according to
282 * B0:D0:F0:Reg.40h
283 */
284 Memory32Fixed (ReadWrite, 0, 0x01000, EGPB)
285
286 /* PCI Express BAR _BAS and _LEN will be updated in
287 * _CRS below according to B0:D0:F0:Reg.60h
288 */
289 Memory32Fixed (ReadWrite, 0, 0, PCIX)
290
Subrata Banike938fb72020-01-03 14:02:50 +0530291 /* VTD engine memory range. */
292 Memory32Fixed (ReadOnly, VTD_BASE_ADDRESS, VTD_BASE_SIZE)
293
Subrata Banike938fb72020-01-03 14:02:50 +0530294 /* FLASH range */
295 Memory32Fixed (ReadOnly, 0, CONFIG_ROM_SIZE, FIOH)
296
297 /* Local APIC range(0xFEE0_0000 to 0xFEEF_FFFF) */
298 Memory32Fixed (ReadOnly, 0xFEE00000, 0x100000)
299
300 /* HPET address decode range */
301 Memory32Fixed (ReadWrite, HPET_BASE_ADDRESS, 0x400)
302 })
303
304 CreateDwordField (BUF0, MCHB._BAS, MBR0)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700305 MBR0 = \_SB.PCI0.GMHB ()
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700306
Subrata Banike938fb72020-01-03 14:02:50 +0530307 CreateDwordField (BUF0, DMIB._BAS, DBR0)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700308 DBR0 = \_SB.PCI0.GDMB ()
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700309
Subrata Banike938fb72020-01-03 14:02:50 +0530310 CreateDwordField (BUF0, EGPB._BAS, EBR0)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700311 EBR0 = \_SB.PCI0.GEPB ()
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700312
Subrata Banike938fb72020-01-03 14:02:50 +0530313 CreateDwordField (BUF0, PCIX._BAS, XBR0)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700314 XBR0 = \_SB.PCI0.GPCB ()
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700315
Subrata Banike938fb72020-01-03 14:02:50 +0530316 CreateDwordField (BUF0, PCIX._LEN, XSZ0)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700317 XSZ0 = \_SB.PCI0.GPCL ()
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700318
Subrata Banike938fb72020-01-03 14:02:50 +0530319 CreateDwordField (BUF0, FIOH._BAS, FBR0)
Furquan Shaikhc3361302020-05-16 21:38:33 -0700320 FBR0 = 0x100000000 - CONFIG_ROM_SIZE
Subrata Banike938fb72020-01-03 14:02:50 +0530321
Lee Leahy1d14b3e2015-05-12 18:23:27 -0700322 Return (BUF0)
Lee Leahyb0005132015-05-12 18:19:47 -0700323 }
324}
Angel Pons09f06052021-01-05 20:30:16 +0100325
326/* Integrated graphics 0:2.0 */
327#include <drivers/intel/gma/acpi/gfx.asl>