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