tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / soc / intel / skylake / acpi / systemagent.asl
blob842bb701a9d434270bc3f9f89b1a5c47118c5b62
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2009 coresystems GmbH
5  * Copyright (C) 2015 Google Inc.
6  * Copyright (C) 2015 Intel Corporation.
7  *
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.
11  *
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.
16  */
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 */
26 Name (_ADR, 0)
27 Name (_BBN, 0)
29 Device (MCHC)
31         Name (_ADR, 0x00000000)
33         OperationRegion (MCHP, PCI_Config, 0x00, 0x100)
34         Field (MCHP, DWordAcc, NoLock, Preserve)
35         {
36                 Offset(0x40),   /* EPBAR (0:0:0:40) */
37                 EPEN, 1,        /* Enable */
38                 , 11,
39                 EPBR, 20,       /* EPBAR [31:12] */
41                 Offset(0x48),   /* MCHBAR (0:0:0:48) */
42                 MHEN, 1,        /* Enable */
43                 , 14,
44                 MHBR, 17,       /* MCHBAR [31:15] */
46                 Offset(0x60),   /* PCIEXBAR (0:0:0:60) */
47                 PXEN, 1,        /* Enable */
48                 PXSZ, 2,        /* PCI Express Size */
49                 , 23,
50                 PXBR, 6,        /* PCI Express BAR [31:26] */
52                 Offset(0x68),   /* DMIBAR (0:0:0:68) */
53                 DIEN, 1,        /* Enable */
54                 , 11,
55                 DIBR, 20,       /* DMIBAR [31:12] */
57                 Offset (0x70),  /* ME Base Address */
58                 MEBA, 64,
60                 Offset (0xa0),  /* Top of Used Memory */
61                 TOM, 64,
63                 Offset (0xa8),  /* Top of Upper Used Memory */
64                 TUUD, 64,
66                 Offset (0xbc),  /* Top of Low Used Memory */
67                 TLUD, 32,
68         }
71 Name (MCRS, ResourceTemplate ()
73         /* Bus Numbers */
74         WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
75                         0x0000, 0x0000, 0x00ff, 0x0000, 0x0100)
77         /* IO Region 0 */
78         DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
79                         EntireRange,
80                         0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8)
82         /* PCI Config Space */
83         Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
85         /* IO Region 1 */
86         DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
87                         EntireRange,
88                         0x0000, 0x0d00, 0xffff, 0x0000, 0xf300)
90         /* VGA memory (0xa0000-0xbffff) */
91         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
92                         Cacheable, ReadWrite,
93                         0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
94                         0x00020000)
96         /*  OPROM reserved (0xc0000-0xc3fff) */
97         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
98                         Cacheable, ReadWrite,
99                         0x00000000, 0x000c0000, 0x000c3fff, 0x00000000,
100                         0x00004000)
102         /* OPROM reserved (0xc4000-0xc7fff) */
103         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
104                         Cacheable, ReadWrite,
105                         0x00000000, 0x000c4000, 0x000c7fff, 0x00000000,
106                         0x00004000)
108         /* OPROM reserved (0xc8000-0xcbfff) */
109         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
110                         Cacheable, ReadWrite,
111                         0x00000000, 0x000c8000, 0x000cbfff, 0x00000000,
112                         0x00004000)
114         /* OPROM reserved (0xcc000-0xcffff) */
115         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
116                         Cacheable, ReadWrite,
117                         0x00000000, 0x000cc000, 0x000cffff, 0x00000000,
118                         0x00004000)
120         /* OPROM reserved (0xd0000-0xd3fff) */
121         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
122                         Cacheable, ReadWrite,
123                         0x00000000, 0x000d0000, 0x000d3fff, 0x00000000,
124                         0x00004000)
126         /* OPROM reserved (0xd4000-0xd7fff) */
127         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
128                         Cacheable, ReadWrite,
129                         0x00000000, 0x000d4000, 0x000d7fff, 0x00000000,
130                         0x00004000)
132         /* OPROM reserved (0xd8000-0xdbfff) */
133         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
134                         Cacheable, ReadWrite,
135                         0x00000000, 0x000d8000, 0x000dbfff, 0x00000000,
136                         0x00004000)
138         /* OPROM reserved (0xdc000-0xdffff) */
139         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
140                         Cacheable, ReadWrite,
141                         0x00000000, 0x000dc000, 0x000dffff, 0x00000000,
142                         0x00004000)
144         /* BIOS Extension (0xe0000-0xe3fff) */
145         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
146                         Cacheable, ReadWrite,
147                         0x00000000, 0x000e0000, 0x000e3fff, 0x00000000,
148                         0x00004000)
150         /* BIOS Extension (0xe4000-0xe7fff) */
151         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
152                         Cacheable, ReadWrite,
153                         0x00000000, 0x000e4000, 0x000e7fff, 0x00000000,
154                         0x00004000)
156         /* BIOS Extension (0xe8000-0xebfff) */
157         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
158                         Cacheable, ReadWrite,
159                         0x00000000, 0x000e8000, 0x000ebfff, 0x00000000,
160                         0x00004000)
162         /* BIOS Extension (0xec000-0xeffff) */
163         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
164                         Cacheable, ReadWrite,
165                         0x00000000, 0x000ec000, 0x000effff, 0x00000000,
166                         0x00004000)
168         /* System BIOS (0xf0000-0xfffff) */
169         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
170                         Cacheable, ReadWrite,
171                         0x00000000, 0x000f0000, 0x000fffff, 0x00000000,
172                         0x00010000)
174         /* PCI Memory Region (TOLUD - 0xdfffffff) */
175         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
176                         NonCacheable, ReadWrite,
177                         0x00000000, 0x00000000, 0xdfffffff, 0x00000000,
178                         0xE0000000,,, PM01)
180         /* PCI Memory Region (TOUUD - (TOUUD + ABOVE_4G_MMIO_SIZE)) */
181         QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
182                         NonCacheable, ReadWrite,
183                         0x00000000, 0x10000, 0x1ffff, 0x00000000,
184                         0x10000,,, PM02)
186         /* PCH reserved resource (0xfd000000-0xfe7fffff) */
187         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
188                         Cacheable, ReadWrite,
189                         0x00000000, 0xfd000000, 0xfe7fffff, 0x00000000,
190                         0x1800000)
192         /* TPM Area (0xfed40000-0xfed44fff) */
193         DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
194                         Cacheable, ReadWrite,
195                         0x00000000, 0xfed40000, 0xfed44fff, 0x00000000,
196                         0x00005000)
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)
206         /*
207          * Fix up PCI memory region
208          * Start with Top of Lower Usable DRAM
209          */
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)
217         }
219         Store (Local0, PMIN)
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)
232         } Else {
233                 Store (0, MMIN)
234                 Store (0, MLEN)
235         }
236         Subtract (Add (MMIN, MLEN), 1, MMAX)
238         Return (^MCRS)
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 */
247 /* Get MCH BAR */
248 Method (GMHB, 0, Serialized)
250         If (LEqual (MH_B, 0)) {
251                 ShiftLeft (\_SB.PCI0.MCHC.MHBR, 15, MH_B)
252         }
253         Return (MH_B)
256 /* Get EP BAR */
257 Method (GEPB, 0, Serialized)
259         If (LEqual (EP_B, 0)) {
260                 ShiftLeft (\_SB.PCI0.MCHC.EPBR, 12, EP_B)
261         }
262         Return (EP_B)
265 /* Get PCIe BAR */
266 Method (GPCB, 0, Serialized)
268         If (LEqual (PC_B, 0)) {
269                 ShiftLeft (\_SB.PCI0.MCHC.PXBR, 26, PC_B)
270         }
271         Return (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)
279         }
280         Return (PC_L)
283 /* Get DMI BAR */
284 Method (GDMB, 0, Serialized)
286         If (LEqual (DM_B, 0)) {
287                 ShiftLeft (\_SB.PCI0.MCHC.DIBR, 12, DM_B)
288         }
289         Return (DM_B)
292 /* PCI Device Resource Consumption */
293 Device (PDRC)
295         Name (_HID, EISAID ("PNP0C02"))
296         Name (_UID, 1)
298         Name (BUF0, ResourceTemplate ()
299         {
300                 /* MCH BAR _BAS will be updated in _CRS below according to
301                  * B0:D0:F0:Reg.48h
302                  */
303                 Memory32Fixed (ReadWrite, 0, 0x08000, MCHB)
305                 /* DMI BAR _BAS will be updated in _CRS below according to
306                  * B0:D0:F0:Reg.68h
307                  */
308                 Memory32Fixed (ReadWrite, 0, 0x01000, DMIB)
310                 /* EP BAR _BAS will be updated in _CRS below according to
311                  * B0:D0:F0:Reg.40h
312                  */
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
317                  */
318                 Memory32Fixed (ReadWrite, 0, 0, PCIX)
320                 /* MISC ICH TTT base address reserved for the
321                  * TxT module use.
322                  */
323                 Memory32Fixed (ReadWrite, 0xFED20000, 0x20000)
325                 /* VTD engine memory range.
326                  * Check if the hard code meets the real configuration.
327                  */
328                 Memory32Fixed (ReadOnly, 0xFED90000, 0x00004000)
330                 /* MISC ICH. Check if the hard code meets the
331                  * real configuration.
332                  */
333                 Memory32Fixed (ReadWrite, 0xFED45000, 0x4B000, TPMM)
335                 /* FLASH range */
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
346                  */
347                 Memory32Fixed (ReadWrite, 0, 0, DBAD)
348         })
350         Method (_CRS, 0, Serialized)
351         {
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)
367                 Return (BUF0)
368         }
371 /* PCI IRQ assignment */
372 #include "pci_irqs.asl"