]>
Commit | Line | Data |
---|---|---|
3cbfba02 DW |
1 | /*++\r |
2 | \r | |
3 | Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved\r | |
4 | \r | |
7ede8060 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
3cbfba02 DW |
6 | \r |
7 | \r | |
8 | \r | |
9 | Module Name:\r | |
10 | \r | |
11 | HOST_BUS.ASL\r | |
12 | \r | |
13 | Abstract:\r | |
14 | \r | |
15 | Baytrail PCI configuration space definition.\r | |
16 | \r | |
17 | ---*/\r | |
18 | Device(VLVC)\r | |
19 | {\r | |
20 | Name(_ADR, 0x00000000) // Device 0, Function 0\r | |
21 | \r | |
22 | // Define various MCH Controller PCI Configuration Space\r | |
23 | // registers which will be used to dynamically produce all\r | |
24 | // resources in the Host Bus _CRS.\r | |
25 | OperationRegion(HBUS, PCI_Config, 0x00, 0xFF)\r | |
26 | Field(HBUS, DWordAcc, NoLock, Preserve)\r | |
27 | {\r | |
28 | Offset(0xD0),\r | |
29 | SMCR, 32, // VLV Message Control Register (0xD0)\r | |
30 | Offset(0xD4),\r | |
31 | SMDR, 32, // VLV Message Data Register (0xD4)\r | |
32 | Offset(0xD8),\r | |
33 | MCRX, 32, // VLV Message Control Register Extension (0xD8)\r | |
34 | }\r | |
35 | \r | |
36 | // Define a method to read a 32-bit register on the VLV Message bus.\r | |
37 | // Arg0 = Port\r | |
38 | // Arg1 = Register\r | |
39 | //\r | |
40 | // Returns 32-bit register value\r | |
41 | \r | |
42 | Method(RMBR, 2, Serialized)\r | |
43 | {\r | |
44 | \r | |
45 | // Initiate regsiter read message on VLV Message Bus MCR\r | |
46 | \r | |
47 | Or(ShiftLeft(Arg0, 16), ShiftLeft(Arg1, 8), Local0)\r | |
48 | Or(0x100000F0, Local0, SMCR)\r | |
49 | \r | |
50 | // Read register value from Message Data Register\r | |
51 | \r | |
52 | Return(SMDR)\r | |
53 | }\r | |
54 | \r | |
55 | \r | |
56 | // Define a method to write a 32-bit register on the VLV Message bus MDR.\r | |
57 | // Arg0 = Port\r | |
58 | // Arg1 = Register\r | |
59 | // Arg2 = 32-bit value\r | |
60 | \r | |
61 | Method(WMBR, 3, Serialized)\r | |
62 | {\r | |
63 | \r | |
64 | // Write register value to Message Data Register\r | |
65 | \r | |
66 | Store(Arg2, SMDR)\r | |
67 | \r | |
68 | // Initiate register write message on VLV Message Bus\r | |
69 | \r | |
70 | Or(ShiftLeft(Arg0, 16), ShiftLeft(Arg1, 8), Local0)\r | |
71 | Or(0x110000F0, Local0, SMCR)\r | |
72 | }\r | |
73 | }\r | |
74 | \r | |
75 | //\r | |
76 | // BUS, I/O, and MMIO resources\r | |
77 | //\r | |
78 | Method(_CRS,0,Serialized)\r | |
79 | {\r | |
80 | //Update ISP0 reserved memory\r | |
81 | CreateDwordField(RES0, ^ISP0._MIN,ISMN)\r | |
82 | CreateDwordField(RES0, ^ISP0._MAX,ISMX)\r | |
83 | CreateDwordField(RES0, ^ISP0._LEN,ISLN)\r | |
84 | If (LEqual(ISPD,1))\r | |
85 | {\r | |
86 | Store (ISPA, ISMN)\r | |
87 | Add (ISMN, ISLN, ISMX)\r | |
88 | Subtract(ISMX, 1, ISMX)\r | |
89 | } Else\r | |
90 | {\r | |
91 | Store (0, ISMN)\r | |
92 | Store (0, ISMX)\r | |
93 | Store (0, ISLN)\r | |
94 | }\r | |
95 | \r | |
96 | //PCI MMIO SPACE\r | |
97 | CreateDwordField(RES0, ^PM01._MIN,M1MN)\r | |
98 | CreateDwordField(RES0, ^PM01._MAX,M1MX)\r | |
99 | CreateDwordField(RES0, ^PM01._LEN,M1LN)\r | |
100 | \r | |
101 | //Get dBMBOUND Base\r | |
102 | And(BMBD, 0xFF000000, M1MN)\r | |
103 | \r | |
104 | //Get ECBASE\r | |
105 | Store(PCIT, M1MX)\r | |
106 | Add(Subtract(M1MX, M1MN), 1, M1LN)\r | |
107 | Subtract(M1MX, 1, M1MX)\r | |
108 | \r | |
109 | // Create pointers to Gfx Stolen Memory Sizing values.\r | |
110 | CreateDwordField(RES0, ^STOM._MIN,GSMN)\r | |
111 | CreateDwordField(RES0, ^STOM._MAX,GSMX)\r | |
112 | CreateDwordField(RES0, ^STOM._LEN,GSLN)\r | |
113 | \r | |
114 | If (LNotEqual (\_SB.PCI0.GFX0.GSTM, 0xFFFFFFFF))\r | |
115 | {\r | |
116 | Store(0x00, GSMN) //Read the Stolen memory base from B0:D2:F0:R5C\r | |
117 | } else\r | |
118 | {\r | |
119 | Store(\_SB.PCI0.GFX0.GSTM, GSMN) //Read the Stolen memory base from B0:D2:F0:R5C\r | |
120 | }\r | |
121 | If (LNotEqual (\_SB.PCI0.GFX0.GUMA, 0xFFFFFFFF))\r | |
122 | {\r | |
123 | Store(0x00, GSLN) //Read the Stolen memory base from B0:D2:F0:R5C\r | |
124 | } else\r | |
125 | {\r | |
126 | ShiftLeft(\_SB.PCI0.GFX0.GUMA, 25, GSLN) //Read Stolen memory base form B0:D2:F0:R50\r | |
127 | }\r | |
128 | Add(GSMN, GSLN, GSMX) //Store the Stolen Memory Size\r | |
129 | Subtract(GSMX, 1, GSMX)\r | |
130 | \r | |
131 | Return(RES0)\r | |
132 | }\r | |
133 | \r | |
134 | Name( RES0,ResourceTemplate()\r | |
135 | {\r | |
136 | WORDBusNumber ( // Bus number resource (0); the bridge produces bus numbers for its subsequent buses\r | |
137 | ResourceProducer, // bit 0 of general flags is 1\r | |
138 | MinFixed, // Range is fixed\r | |
139 | MaxFixed, // Range is fixed\r | |
140 | PosDecode, // PosDecode\r | |
141 | 0x0000, // Granularity\r | |
142 | 0x0000, // Min\r | |
143 | 0x00FF, // Max\r | |
144 | 0x0000, // Translation\r | |
145 | 0x0100 // Range Length = Max-Min+1\r | |
146 | )\r | |
147 | \r | |
148 | IO (Decode16, 0x70, 0x77, 0x01, 0x08) //Consumed resource (0xCF8-0xCFF)\r | |
149 | IO (Decode16, 0xCF8, 0xCF8, 0x01, 0x08) //Consumed resource (0xCF8-0xCFF)\r | |
150 | \r | |
151 | WORDIO ( // Consumed-and-produced resource (all I/O below CF8)\r | |
152 | ResourceProducer, // bit 0 of general flags is 0\r | |
153 | MinFixed, // Range is fixed\r | |
154 | MaxFixed, // Range is fixed\r | |
155 | PosDecode,\r | |
156 | EntireRange,\r | |
157 | 0x0000, // Granularity\r | |
158 | 0x0000, // Min\r | |
159 | 0x006F, // Max\r | |
160 | 0x0000, // Translation\r | |
161 | 0x0070 // Range Length\r | |
162 | )\r | |
163 | \r | |
164 | WORDIO ( // Consumed-and-produced resource\r | |
165 | ResourceProducer, // bit 0 of general flags is 0\r | |
166 | MinFixed, // Range is fixed\r | |
167 | MaxFixed, // Range is fixed\r | |
168 | PosDecode,\r | |
169 | EntireRange,\r | |
170 | 0x0000, // Granularity\r | |
171 | 0x0078, // Min\r | |
172 | 0x0CF7, // Max\r | |
173 | 0x0000, // Translation\r | |
174 | 0x0C80 // Range Length\r | |
175 | )\r | |
176 | \r | |
177 | WORDIO ( // Consumed-and-produced resource (all I/O above CFF)\r | |
178 | ResourceProducer, // bit 0 of general flags is 0\r | |
179 | MinFixed, // Range is fixed\r | |
180 | MaxFixed, // Range is fixed\r | |
181 | PosDecode,\r | |
182 | EntireRange,\r | |
183 | 0x0000, // Granularity\r | |
184 | 0x0D00, // Min\r | |
185 | 0xFFFF, // Max\r | |
186 | 0x0000, // Translation\r | |
187 | 0xF300 // Range Length\r | |
188 | )\r | |
189 | \r | |
190 | DWORDMEMORY ( // Descriptor for legacy VGA video RAM\r | |
191 | ResourceProducer, // bit 0 of general flags is 0\r | |
192 | PosDecode,\r | |
193 | MinFixed, // Range is fixed\r | |
194 | MaxFixed, // Range is fixed\r | |
195 | Cacheable,\r | |
196 | ReadWrite,\r | |
197 | 0x00000000, // Granularity\r | |
198 | 0x000A0000, // Min\r | |
199 | 0x000BFFFF, // Max\r | |
200 | 0x00000000, // Translation\r | |
201 | 0x00020000 // Range Length\r | |
202 | )\r | |
203 | \r | |
204 | DWORDMEMORY ( // Descriptor for legacy OptionRom\r | |
205 | ResourceProducer, // bit 0 of general flags is 0\r | |
206 | PosDecode,\r | |
207 | MinFixed, // Range is fixed\r | |
208 | MaxFixed, // Range is fixed\r | |
209 | Cacheable,\r | |
210 | ReadWrite,\r | |
211 | 0x00000000, // Granularity\r | |
212 | 0x000C0000, // Min\r | |
213 | 0x000DFFFF, // Max\r | |
214 | 0x00000000, // Translation\r | |
215 | 0x00020000 // Range Length\r | |
216 | )\r | |
217 | \r | |
218 | DWORDMEMORY ( // Descriptor for BIOS Area\r | |
219 | ResourceProducer, // bit 0 of general flags is 0\r | |
220 | PosDecode,\r | |
221 | MinFixed, // Range is fixed\r | |
222 | MaxFixed, // Range is fixed\r | |
223 | Cacheable,\r | |
224 | ReadWrite,\r | |
225 | 0x00000000, // Granularity\r | |
226 | 0x000E0000, // Min\r | |
227 | 0x000FFFFF, // Max\r | |
228 | 0x00000000, // Translation\r | |
229 | 0x00020000 // Range Length\r | |
230 | )\r | |
231 | \r | |
232 | DWORDMEMORY ( // Descriptor for ISP0 reserved Mem\r | |
233 | ResourceProducer, // bit 0 of general flags is 0\r | |
234 | PosDecode,\r | |
235 | MinFixed, // Range is fixed\r | |
236 | MaxFixed, // Range is fixed\r | |
237 | Cacheable,\r | |
238 | ReadWrite,\r | |
239 | 0x00000000, // Granularity\r | |
240 | 0x7A000000, // Min\r | |
241 | 0x7A3FFFFF, // Max\r | |
242 | 0x00000000, // Translation\r | |
243 | 0x00400000 // Range Length\r | |
244 | ,,,\r | |
245 | ISP0\r | |
246 | )\r | |
247 | \r | |
248 | DWORDMEMORY ( // Descriptor for VGA Stolen Mem\r | |
249 | ResourceProducer, // bit 0 of general flags is 0\r | |
250 | PosDecode,\r | |
251 | MinFixed, // Range is fixed\r | |
252 | MaxFixed, // Range is fixed\r | |
253 | Cacheable,\r | |
254 | ReadWrite,\r | |
255 | 0x00000000, // Granularity\r | |
256 | 0x7C000000, // Min\r | |
257 | 0x7FFFFFFF, // Max\r | |
258 | 0x00000000, // Translation\r | |
259 | 0x04000000 // Range Length\r | |
260 | ,,,\r | |
261 | STOM\r | |
262 | )\r | |
263 | \r | |
264 | DWORDMEMORY ( // Descriptor for PCI MMIO\r | |
265 | ResourceProducer, // bit 0 of general flags is 0\r | |
266 | PosDecode,\r | |
267 | MinFixed, // Range is fixed\r | |
268 | MaxFixed, // Range is fixed\r | |
269 | Cacheable,\r | |
270 | ReadWrite,\r | |
271 | 0x00000000, // Granularity\r | |
272 | 0x80000000, // Min\r | |
273 | 0xDFFFFFFF, // Max\r | |
274 | 0x00000000, // Translation\r | |
275 | 0x60000000 // Range Length\r | |
276 | ,,,\r | |
277 | PM01\r | |
278 | )\r | |
279 | })\r | |
280 | \r | |
281 | //Name(GUID,UUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))\r | |
282 | Name(GUID,Buffer()\r | |
283 | {\r | |
284 | 0x5b, 0x4d, 0xdb, 0x33,\r | |
285 | 0xf7, 0x1f,\r | |
286 | 0x1c, 0x40,\r | |
287 | 0x96, 0x57,\r | |
288 | 0x74, 0x41, 0xc0, 0x3d, 0xd7, 0x66\r | |
289 | })\r | |
290 | \r | |
291 | \r | |
292 | Name(SUPP,0) // PCI _OSC Support Field value\r | |
293 | Name(CTRL,0) // PCI _OSC Control Field value\r | |
294 | \r | |
295 | Method(_OSC,4,Serialized)\r | |
296 | {\r | |
297 | // Check for proper UUID\r | |
298 | // Save the capabilities buffer\r | |
299 | Store(Arg3,Local0)\r | |
300 | \r | |
301 | // Create DWord-adressable fields from the Capabilties Buffer\r | |
302 | CreateDWordField(Local0,0,CDW1)\r | |
303 | CreateDWordField(Local0,4,CDW2)\r | |
304 | CreateDWordField(Local0,8,CDW3)\r | |
305 | \r | |
306 | // Check for proper UUID\r | |
307 | If(LAnd(LEqual(Arg0,GUID),NEXP))\r | |
308 | {\r | |
309 | // Save Capabilities DWord2 & 3\r | |
310 | Store(CDW2,SUPP)\r | |
311 | Store(CDW3,CTRL)\r | |
312 | \r | |
313 | If(Not(And(CDW1,1))) // Query flag clear?\r | |
314 | {\r | |
315 | // Disable GPEs for features granted native control.\r | |
316 | If(And(CTRL,0x02))\r | |
317 | {\r | |
318 | NHPG()\r | |
319 | }\r | |
320 | If(And(CTRL,0x04)) // PME control granted?\r | |
321 | {\r | |
322 | NPME()\r | |
323 | }\r | |
324 | }\r | |
325 | \r | |
326 | If(LNotEqual(Arg1,One))\r | |
327 | {\r | |
328 | // Unknown revision\r | |
329 | Or(CDW1,0x08,CDW1)\r | |
330 | }\r | |
331 | \r | |
332 | If(LNotEqual(CDW3,CTRL))\r | |
333 | {\r | |
334 | // Capabilities bits were masked\r | |
335 | Or(CDW1,0x10,CDW1)\r | |
336 | }\r | |
337 | // Update DWORD3 in the buffer\r | |
338 | And(CTRL,0xfe,CTRL) \r | |
339 | Store(CTRL,CDW3)\r | |
340 | Store(CTRL,OSCC)\r | |
341 | Return(Local0)\r | |
342 | } Else\r | |
343 | {\r | |
344 | Or(CDW1,4,CDW1) // Unrecognized UUID\r | |
345 | Return(Local0)\r | |
346 | }\r | |
347 | } // End _OSC\r |