blob: f36895d481d933a07a37f397f661145dacd94eca [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
Angel Ponsc5381e02020-10-25 12:56:29 +01003Name (_HID, EISAID ("PNP0A08")) // PCIe
4Name (_CID, EISAID ("PNP0A03")) // PCI
Aaron Durbin76c37002012-10-30 09:03:43 -05005
Angel Ponsc5381e02020-10-25 12:56:29 +01006Name (_BBN, 0)
Aaron Durbin76c37002012-10-30 09:03:43 -05007
8Device (MCHC)
9{
Angel Ponsc5381e02020-10-25 12:56:29 +010010 Name (_ADR, 0x00000000) // 0:0.0
Aaron Durbin76c37002012-10-30 09:03:43 -050011
Angel Ponsc5381e02020-10-25 12:56:29 +010012 OperationRegion (MCHP, PCI_Config, 0x00, 0x100)
Aaron Durbin76c37002012-10-30 09:03:43 -050013 Field (MCHP, DWordAcc, NoLock, Preserve)
14 {
15 Offset (0x40), // EPBAR
16 EPEN, 1, // Enable
17 , 11, //
Angel Pons05f996d2020-07-06 22:10:37 +020018 EPBR, 27, // EPBAR
Aaron Durbin76c37002012-10-30 09:03:43 -050019
20 Offset (0x48), // MCHBAR
21 MHEN, 1, // Enable
Angel Pons05f996d2020-07-06 22:10:37 +020022 , 14, //
23 MHBR, 24, // MCHBAR
Chris Morgan5e5e7892020-02-07 09:40:42 -060024 Offset (0x54),
25 DVEN, 32,
Aaron Durbin76c37002012-10-30 09:03:43 -050026 Offset (0x60), // PCIe BAR
27 PXEN, 1, // Enable
28 PXSZ, 2, // BAR size
29 , 23, //
Angel Pons05f996d2020-07-06 22:10:37 +020030 PXBR, 13, // PCIe BAR
Aaron Durbin76c37002012-10-30 09:03:43 -050031
32 Offset (0x68), // DMIBAR
33 DMEN, 1, // Enable
34 , 11, //
Angel Pons05f996d2020-07-06 22:10:37 +020035 DMBR, 27, // DMIBAR
Aaron Durbin76c37002012-10-30 09:03:43 -050036
37 Offset (0x70), // ME Base Address
38 MEBA, 64,
39
40 // ...
41
42 Offset (0x80), // PAM0
43 , 4,
44 PM0H, 2,
45 , 2,
46 Offset (0x81), // PAM1
47 PM1L, 2,
48 , 2,
49 PM1H, 2,
50 , 2,
51 Offset (0x82), // PAM2
52 PM2L, 2,
53 , 2,
54 PM2H, 2,
55 , 2,
56 Offset (0x83), // PAM3
57 PM3L, 2,
58 , 2,
59 PM3H, 2,
60 , 2,
61 Offset (0x84), // PAM4
62 PM4L, 2,
63 , 2,
64 PM4H, 2,
65 , 2,
66 Offset (0x85), // PAM5
67 PM5L, 2,
68 , 2,
69 PM5H, 2,
70 , 2,
71 Offset (0x86), // PAM6
72 PM6L, 2,
73 , 2,
74 PM6H, 2,
75 , 2,
76
77 Offset (0xa0), // Top of Used Memory
78 TOM, 64,
79
80 Offset (0xbc), // Top of Low Used Memory
81 TLUD, 32,
82 }
83
Angel Ponsc5381e02020-10-25 12:56:29 +010084 #include "ctdp.asl"
Aaron Durbin76c37002012-10-30 09:03:43 -050085}
86
87// Current Resource Settings
Martin Rothfc706432015-08-18 16:56:05 -060088Name (MCRS, ResourceTemplate()
89{
90 // Bus Numbers
91 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
92 0x0000, 0x0000, 0x00ff, 0x0000, 0x0100,,, PB00)
93
94 // IO Region 0
95 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
96 0x0000, 0x0000, 0x0cf7, 0x0000, 0x0cf8,,, PI00)
97
98 // PCI Config Space
99 Io (Decode16, 0x0cf8, 0x0cf8, 0x0001, 0x0008)
100
101 // IO Region 1
102 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
103 0x0000, 0x0d00, 0xffff, 0x0000, 0xf300,,, PI01)
104
105 // VGA memory (0xa0000-0xbffff)
106 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
107 Cacheable, ReadWrite,
108 0x00000000, 0x000a0000, 0x000bffff, 0x00000000,
109 0x00020000,,, ASEG)
110
111 // OPROM reserved (0xc0000-0xc3fff)
112 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
113 Cacheable, ReadWrite,
114 0x00000000, 0x000c0000, 0x000c3fff, 0x00000000,
115 0x00004000,,, OPR0)
116
117 // OPROM reserved (0xc4000-0xc7fff)
118 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
119 Cacheable, ReadWrite,
120 0x00000000, 0x000c4000, 0x000c7fff, 0x00000000,
121 0x00004000,,, OPR1)
122
123 // OPROM reserved (0xc8000-0xcbfff)
124 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
125 Cacheable, ReadWrite,
126 0x00000000, 0x000c8000, 0x000cbfff, 0x00000000,
127 0x00004000,,, OPR2)
128
129 // OPROM reserved (0xcc000-0xcffff)
130 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
131 Cacheable, ReadWrite,
132 0x00000000, 0x000cc000, 0x000cffff, 0x00000000,
133 0x00004000,,, OPR3)
134
135 // OPROM reserved (0xd0000-0xd3fff)
136 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
137 Cacheable, ReadWrite,
138 0x00000000, 0x000d0000, 0x000d3fff, 0x00000000,
139 0x00004000,,, OPR4)
140
141 // OPROM reserved (0xd4000-0xd7fff)
142 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
143 Cacheable, ReadWrite,
144 0x00000000, 0x000d4000, 0x000d7fff, 0x00000000,
145 0x00004000,,, OPR5)
146
147 // OPROM reserved (0xd8000-0xdbfff)
148 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
149 Cacheable, ReadWrite,
150 0x00000000, 0x000d8000, 0x000dbfff, 0x00000000,
151 0x00004000,,, OPR6)
152
153 // OPROM reserved (0xdc000-0xdffff)
154 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
155 Cacheable, ReadWrite,
156 0x00000000, 0x000dc000, 0x000dffff, 0x00000000,
157 0x00004000,,, OPR7)
158
159 // BIOS Extension (0xe0000-0xe3fff)
160 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
161 Cacheable, ReadWrite,
162 0x00000000, 0x000e0000, 0x000e3fff, 0x00000000,
163 0x00004000,,, ESG0)
164
165 // BIOS Extension (0xe4000-0xe7fff)
166 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
167 Cacheable, ReadWrite,
168 0x00000000, 0x000e4000, 0x000e7fff, 0x00000000,
169 0x00004000,,, ESG1)
170
171 // BIOS Extension (0xe8000-0xebfff)
172 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
173 Cacheable, ReadWrite,
174 0x00000000, 0x000e8000, 0x000ebfff, 0x00000000,
175 0x00004000,,, ESG2)
176
177 // BIOS Extension (0xec000-0xeffff)
178 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
179 Cacheable, ReadWrite,
180 0x00000000, 0x000ec000, 0x000effff, 0x00000000,
181 0x00004000,,, ESG3)
182
183 // System BIOS (0xf0000-0xfffff)
184 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
185 Cacheable, ReadWrite,
186 0x00000000, 0x000f0000, 0x000fffff, 0x00000000,
187 0x00010000,,, FSEG)
188
189 // PCI Memory Region (Top of memory-CONFIG_MMCONF_BASE_ADDRESS)
190 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
191 Cacheable, ReadWrite,
192 0x00000000, 0x00000000, 0x00000000, 0x00000000,
193 0x00000000,,, PM01)
194
195 // TPM Area (0xfed40000-0xfed44fff)
196 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed,
197 Cacheable, ReadWrite,
198 0x00000000, 0xfed40000, 0xfed44fff, 0x00000000,
199 0x00005000,,, TPMR)
200})
Aaron Durbin76c37002012-10-30 09:03:43 -0500201
202Method (_CRS, 0, Serialized)
203{
Aaron Durbin76c37002012-10-30 09:03:43 -0500204 // Find PCI resource area in MCRS
Angel Ponsc5381e02020-10-25 12:56:29 +0100205 CreateDwordField (MCRS, ^PM01._MIN, PMIN)
206 CreateDwordField (MCRS, ^PM01._MAX, PMAX)
207 CreateDwordField (MCRS, ^PM01._LEN, PLEN)
Aaron Durbin76c37002012-10-30 09:03:43 -0500208
209 // Fix up PCI memory region
210 // Start with Top of Lower Usable DRAM
Furquan Shaikh506479d2020-06-01 13:27:16 -0700211 // Lower 20 bits of TOLUD register need to be masked since they contain lock and
212 // reserved bits.
213 Local0 = ^MCHC.TLUD & (0xfff << 20)
Furquan Shaikh181e2d42020-06-01 13:03:45 -0700214 Local1 = ^MCHC.MEBA
Aaron Durbin76c37002012-10-30 09:03:43 -0500215
216 // Check if ME base is equal
Furquan Shaikh181e2d42020-06-01 13:03:45 -0700217 If (Local0 == Local1) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500218 // Use Top Of Memory instead
Furquan Shaikh506479d2020-06-01 13:27:16 -0700219 // Lower 20 bits of TOM register need to be masked since they contain lock and
220 // reserved bits.
221 Local0 = ^MCHC.TOM & (0x7ffff << 20)
Aaron Durbin76c37002012-10-30 09:03:43 -0500222 }
223
Furquan Shaikh181e2d42020-06-01 13:03:45 -0700224 PMIN = Local0
225 PMAX = CONFIG_MMCONF_BASE_ADDRESS - 1
Angel Ponsc5381e02020-10-25 12:56:29 +0100226 PLEN = (PMAX - PMIN) + 1
Aaron Durbin76c37002012-10-30 09:03:43 -0500227
228 Return (MCRS)
229}