Debian Codegraph @

src/soc/intel/skylake/acpi/systemagent.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <arch/hpet.h>
4 #include <soc/iomap.h>
5
6 Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */)
7 Name (_CID, EisaId ("PNP0A03") /* PCI Bus */)
8 Name (_SEG, 0) // _SEG: PCI Segment
9 Name (_UID, 0)
10
11 Device (MCHC)
12 {
13 Name (_ADR, 0x00000000)
14
15 OperationRegion (MCHP, PCI_Config, 0x00, 0x100)
16 Field (MCHP, DWordAcc, NoLock, Preserve)
17 {
18 Offset(0x40), /* EPBAR (0:0:0:40) */
19 EPEN, 1, /* Enable */
20 , 11,
21 EPBR, 27, /* EPBAR [38:12] */
22
23 Offset(0x48), /* MCHBAR (0:0:0:48) */
24 MHEN, 1, /* Enable */
25 , 14,
26 MHBR, 24, /* MCHBAR [38:15] */
27
28 Offset(0x60), /* PCIEXBAR (0:0:0:60) */
29 PXEN, 1, /* Enable */
30 PXSZ, 2, /* PCI Express Size */
31 , 23,
32 PXBR, 13, /* PCI Express BAR [38:26] */
33
34 Offset(0x68), /* DMIBAR (0:0:0:68) */
35 DIEN, 1, /* Enable */
36 , 11,
37 DIBR, 27, /* DMIBAR [38:12] */
38
39 Offset (0x70), /* ME Base Address */
40 MEBA, 64,
41
42 Offset (0xa0),
43 TOM, 64, /* Top of Used Memory */
44 TUUD, 64, /* Top of Upper Used Memory */
45
46 Offset (0xbc), /* Top of Low Used Memory */
47 TLUD, 32,
48 }
49 }
50
51 External (A4GS, IntObj)
52 External (A4GB, IntObj)
53
54 Method (_CRS, 0, Serialized)
55 {
56 Name (MCRS, ResourceTemplate ()
57 {
58 /* Bus Numbers */
59 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
60 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100)
61
62 /* IO Region 0 */
63 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
64 EntireRange,
65 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8)
66
67 /* PCI Config Space */
68 Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
69
70 /* IO Region 1 */
71 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
72 EntireRange,
73 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300)
74
75 /* VGA memory (0xa0000-0xbffff) */
76 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
77 Cacheable, ReadWrite,
78 0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
79 0x00020000)
80
81 /* OPROM reserved (0xc0000-0xc3fff) */
82 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
83 Cacheable, ReadWrite,
84 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000,
85 0x00004000)
86
87 /* OPROM reserved (0xc4000-0xc7fff) */
88 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
89 Cacheable, ReadWrite,
90 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000,
91 0x00004000)
92
93 /* OPROM reserved (0xc8000-0xcbfff) */
94 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
95 Cacheable, ReadWrite,
96 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000,
97 0x00004000)
98
99 /* OPROM reserved (0xcc000-0xcffff) */
100 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
101 Cacheable, ReadWrite,
102 0x00000000, 0x000cc000, 0x000cffff, 0x00000000,
103 0x00004000)
104
105 /* OPROM reserved (0xd0000-0xd3fff) */
106 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
107 Cacheable, ReadWrite,
108 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000,
109 0x00004000)
110
111 /* OPROM reserved (0xd4000-0xd7fff) */
112 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
113 Cacheable, ReadWrite,
114 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000,
115 0x00004000)
116
117 /* OPROM reserved (0xd8000-0xdbfff) */
118 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
119 Cacheable, ReadWrite,
120 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000,
121 0x00004000)
122
123 /* OPROM reserved (0xdc000-0xdffff) */
124 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
125 Cacheable, ReadWrite,
126 0x00000000, 0x000dc000, 0x000dffff, 0x00000000,
127 0x00004000)
128
129 /* BIOS Extension (0xe0000-0xe3fff) */
130 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
131 Cacheable, ReadWrite,
132 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000,
133 0x00004000)
134
135 /* BIOS Extension (0xe4000-0xe7fff) */
136 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
137 Cacheable, ReadWrite,
138 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000,
139 0x00004000)
140
141 /* BIOS Extension (0xe8000-0xebfff) */
142 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
143 Cacheable, ReadWrite,
144 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000,
145 0x00004000)
146
147 /* BIOS Extension (0xec000-0xeffff) */
148 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
149 Cacheable, ReadWrite,
150 0x00000000, 0x000ec000, 0x000effff, 0x00000000,
151 0x00004000)
152
153 /* System BIOS (0xf0000-0xfffff) */
154 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
155 Cacheable, ReadWrite,
156 0x00000000, 0x000f0000, 0x000fffff, 0x00000000,
157 0x00010000)
158
159 /* PCI Memory Region (TLUD - 0xdfffffff) */
160 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
161 NonCacheable, ReadWrite,
162 0x00000000, 0x00000000, 0xdfffffff, 0x00000000,
163 0xE0000000,,, PM01)
164
165 /* PCI Memory Region (TUUD - (TUUD + ABOVE_4G_MMIO_SIZE)) */
166 QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
167 NonCacheable, ReadWrite,
168 0x00000000, 0x10000, 0x1ffff, 0x00000000,
169 0x10000,,, PM02)
170
171 /* PCH reserved resource (0xfc800000-0xfe7fffff) */
172 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
173 Cacheable, ReadWrite,
174 0x00000000, PCH_PRESERVED_BASE_ADDRESS, 0xfe7fffff,
175 0x00000000, PCH_PRESERVED_BASE_SIZE)
176
177 #if !CONFIG(TPM_GOOGLE)
178 /* TPM Area (0xfed40000-0xfed44fff) */
179 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
180 Cacheable, ReadWrite,
181 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000,
182 0x00005000)
183 #endif
184 })
185
186 /* Find PCI resource area in MCRS */
187 CreateDwordField (MCRS, PM01._MIN, PMIN)
188 CreateDwordField (MCRS, PM01._MAX, PMAX)
189 CreateDwordField (MCRS, PM01._LEN, PLEN)
190
191 /*
192 * Fix up PCI memory region
193 * Start with Top of Lower Usable DRAM
194 * Lower 20 bits of TOLUD register need to be masked since they contain lock and
195 * reserved bits.
196 */
197 Local0 = \_SB.PCI0.MCHC.TLUD & (0xfff << 20)
198 Local1 = \_SB.PCI0.MCHC.MEBA
199
200 /* Check if ME base is equal */
201 If (Local0 == Local1) {
202 /*
203 * Use Top Of Memory instead
204 * Lower 20 bits of TOM register need to be masked since they contain lock and
205 * reserved bits.
206 */
207 Local0 = \_SB.PCI0.MCHC.TOM & (0x7ffff << 20)
208 }
209
210 PMIN = Local0
211 PLEN = (PMAX - PMIN) + 1
212
213 /* Patch PM02 range based on Memory Size */
214 If (A4GS == 0) {
215 CreateQwordField (MCRS, PM02._LEN, MSEN)
216 MSEN = 0
217 } Else {
218 CreateQwordField (MCRS, PM02._MIN, MMIN)
219 CreateQwordField (MCRS, PM02._MAX, MMAX)
220 CreateQwordField (MCRS, PM02._LEN, MLEN)
221 /* Set 64bit MMIO resource base and length */
222 MLEN = A4GS
223 MMIN = A4GB
224 MMAX = (MMIN + MLEN) - 1
225 }
226
227 Return (MCRS)
228 }
229
230 /* Get MCH BAR */
231 Method (GMHB, 0, Serialized)
232 {
233 Local0 = \_SB.PCI0.MCHC.MHBR << 15
234 Return (Local0)
235 }
236
237 /* Get EP BAR */
238 Method (GEPB, 0, Serialized)
239 {
240 Local0 = \_SB.PCI0.MCHC.EPBR << 12
241 Return (Local0)
242 }
243
244 /* Get PCIe BAR */
245 Method (GPCB, 0, Serialized)
246 {
247 Local0 = \_SB.PCI0.MCHC.PXBR << 26
248 Return (Local0)
249 }
250
251 /* Get PCIe Length */
252 Method (GPCL, 0, Serialized)
253 {
254 Local0 = 0x10000000 >> \_SB.PCI0.MCHC.PXSZ
255 Return (Local0)
256 }
257
258 /* Get DMI BAR */
259 Method (GDMB, 0, Serialized)
260 {
261 Local0 = \_SB.PCI0.MCHC.DIBR << 12
262 Return (Local0)
263 }
264
265 /* PCI Device Resource Consumption */
266 Device (PDRC)
267 {
268 Name (_HID, EISAID ("PNP0C02"))
269 Name (_UID, 1)
270
271 Method (_CRS, 0, Serialized)
272 {
273 Name (BUF0, ResourceTemplate ()
274 {
275 /* MCH BAR _BAS will be updated in _CRS below according to
276 * B0:D0:F0:Reg.48h
277 */
278 Memory32Fixed (ReadWrite, 0, 0x08000, MCHB)
279
280 /* DMI BAR _BAS will be updated in _CRS below according to
281 * B0:D0:F0:Reg.68h
282 */
283 Memory32Fixed (ReadWrite, 0, 0x01000, DMIB)
284
285 /* EP BAR _BAS will be updated in _CRS below according to
286 * B0:D0:F0:Reg.40h
287 */
288 Memory32Fixed (ReadWrite, 0, 0x01000, EGPB)
289
290 /* VTD engine memory range. */
291 Memory32Fixed (ReadOnly, VTD_BASE_ADDRESS, VTD_BASE_SIZE)
292
293 /* FLASH range */
294 Memory32Fixed (ReadOnly, 0, CONFIG_ROM_SIZE, FIOH)
295
296 /* Local APIC range(0xFEE0_0000 to 0xFEEF_FFFF) */
297 Memory32Fixed (ReadOnly, 0xFEE00000, 0x100000)
298
299 /* HPET address decode range */
300 Memory32Fixed (ReadWrite, HPET_BASE_ADDRESS, 0x400)
301 })
302
303 CreateDwordField (BUF0, MCHB._BAS, MBR0)
304 MBR0 = \_SB.PCI0.GMHB ()
305
306 CreateDwordField (BUF0, DMIB._BAS, DBR0)
307 DBR0 = \_SB.PCI0.GDMB ()
308
309 CreateDwordField (BUF0, EGPB._BAS, EBR0)
310 EBR0 = \_SB.PCI0.GEPB ()
311
312 CreateDwordField (BUF0, FIOH._BAS, FBR0)
313 FBR0 = 0x100000000 - CONFIG_ROM_SIZE
314
315 Return (BUF0)
316 }
317 }
318
319 /* Integrated graphics 0:2.0 */
320 #include <drivers/intel/gma/acpi/gfx.asl>