blob: 435bcb5824da639ee0f50568811986aeea92f8c2 [file] [log] [blame]
Mike Loptien573a1d62013-03-18 11:19:26 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20Scope(\) {
21 /* PCI IRQ mapping registers, C00h-C01h. */
22 OperationRegion(PRQM, SystemIO, 0x00000C00, 0x00000002)
23 Field(PRQM, ByteAcc, NoLock, Preserve) {
24 PRQI, 0x00000008,
25 PRQD, 0x00000008, /* Offset: 1h */
26 }
27 IndexField(PRQI, PRQD, ByteAcc, NoLock, Preserve) {
28 PIRA, 0x00000008, /* Index 0 */
29 PIRB, 0x00000008, /* Index 1 */
30 PIRC, 0x00000008, /* Index 2 */
31 PIRD, 0x00000008, /* Index 3 */
32 PIRE, 0x00000008, /* Index 4 */
33 PIRF, 0x00000008, /* Index 5 */
34 PIRG, 0x00000008, /* Index 6 */
35 PIRH, 0x00000008, /* Index 7 */
36 }
37
38 /* PCI Error control register */
39 OperationRegion(PERC, SystemIO, 0x00000C14, 0x00000001)
40 Field(PERC, ByteAcc, NoLock, Preserve) {
41 SENS, 0x00000001,
42 PENS, 0x00000001,
43 SENE, 0x00000001,
44 PENE, 0x00000001,
45 }
46}
47
48Scope(\_SB) {
49 /* PCIe Configuration Space for 16 busses */
50 OperationRegion(PCFG, SystemMemory, PCBA, 0x01000000) /* Each bus consumes 1MB */
51 Field(PCFG, ByteAcc, NoLock, Preserve) {
52 /* Byte offsets are computed using the following technique:
53 * ((bus number + 1) * ((device number * 8) * 4096)) + register offset
54 * The 8 comes from 8 functions per device, and 4096 bytes per function config space
55 */
56 Offset(0x00088024), /* SATA reg 24h Bus 0, Device 17, Function 0 */
57 STB5, 32,
58 Offset(0x00098042), /* OHCI0 reg 42h - Bus 0, Device 19, Function 0 */
59 PT0D, 1,
60 PT1D, 1,
61 PT2D, 1,
62 PT3D, 1,
63 PT4D, 1,
64 PT5D, 1,
65 PT6D, 1,
66 PT7D, 1,
67 PT8D, 1,
68 PT9D, 1,
69 Offset(0x000A0004), /* SMBUS reg 4h - Bus 0, Device 20, Function 0 */
70 SBIE, 1,
71 SBME, 1,
72 Offset(0x000A0008), /* SMBUS reg 8h - Bus 0, Device 20, Function 0 */
73 SBRI, 8,
74 Offset(0x000A0014), /* SMBUS reg 14h - Bus 0, Device 20, Function 0 */
75 SBB1, 32,
76 Offset(0x000A0078), /* SMBUS reg 78h - Bus 0, Device 20, Function 0 */
77 ,14,
78 P92E, 1, /* Port92 decode enable */
79 }
80
81 OperationRegion(SB5, SystemMemory, STB5, 0x1000)
82 Field(SB5, AnyAcc, NoLock, Preserve){
83 /* Port 0 */
84 Offset(0x120), /* Port 0 Task file status */
85 P0ER, 1,
86 , 2,
87 P0DQ, 1,
88 , 3,
89 P0BY, 1,
90 Offset(0x128), /* Port 0 Serial ATA status */
91 P0DD, 4,
92 , 4,
93 P0IS, 4,
94 Offset(0x12C), /* Port 0 Serial ATA control */
95 P0DI, 4,
96 Offset(0x130), /* Port 0 Serial ATA error */
97 , 16,
98 P0PR, 1,
99
100 /* Port 1 */
101 offset(0x1A0), /* Port 1 Task file status */
102 P1ER, 1,
103 , 2,
104 P1DQ, 1,
105 , 3,
106 P1BY, 1,
107 Offset(0x1A8), /* Port 1 Serial ATA status */
108 P1DD, 4,
109 , 4,
110 P1IS, 4,
111 Offset(0x1AC), /* Port 1 Serial ATA control */
112 P1DI, 4,
113 Offset(0x1B0), /* Port 1 Serial ATA error */
114 , 16,
115 P1PR, 1,
116
117 /* Port 2 */
118 Offset(0x220), /* Port 2 Task file status */
119 P2ER, 1,
120 , 2,
121 P2DQ, 1,
122 , 3,
123 P2BY, 1,
124 Offset(0x228), /* Port 2 Serial ATA status */
125 P2DD, 4,
126 , 4,
127 P2IS, 4,
128 Offset(0x22C), /* Port 2 Serial ATA control */
129 P2DI, 4,
130 Offset(0x230), /* Port 2 Serial ATA error */
131 , 16,
132 P2PR, 1,
133
134 /* Port 3 */
135 Offset(0x2A0), /* Port 3 Task file status */
136 P3ER, 1,
137 , 2,
138 P3DQ, 1,
139 , 3,
140 P3BY, 1,
141 Offset(0x2A8), /* Port 3 Serial ATA status */
142 P3DD, 4,
143 , 4,
144 P3IS, 4,
145 Offset(0x2AC), /* Port 3 Serial ATA control */
146 P3DI, 4,
147 Offset(0x2B0), /* Port 3 Serial ATA error */
148 , 16,
149 P3PR, 1,
150 }
151
152 Method(_PIC, 0x01, NotSerialized)
153 {
154 If (Arg0)
155 {
156 \_SB.CIRQ()
157 }
158 Store(Arg0, PMOD)
159 }
160
161 Method(CIRQ, 0x00, NotSerialized){
162 Store(0, PIRA)
163 Store(0, PIRB)
164 Store(0, PIRC)
165 Store(0, PIRD)
166 Store(0, PIRE)
167 Store(0, PIRF)
168 Store(0, PIRG)
169 Store(0, PIRH)
170 }
171
172 Name(IRQB, ResourceTemplate(){
173 IRQ(Level,ActiveLow,Shared){15}
174 })
175
176 Name(IRQP, ResourceTemplate(){
177 IRQ(Level,ActiveLow,Exclusive){3, 4, 5, 7, 10, 11, 12, 15}
178 })
179
180 Name(PITF, ResourceTemplate(){
181 IRQ(Level,ActiveLow,Exclusive){9}
182 })
183
184 Device(INTA) {
185 Name(_HID, EISAID("PNP0C0F"))
186 Name(_UID, 1)
187
188 Method(_STA, 0) {
189 if (PIRA) {
190 Return(0x0B) /* sata is invisible */
191 } else {
192 Return(0x09) /* sata is disabled */
193 }
194 } /* End Method(_SB.INTA._STA) */
195
196 Method(_DIS ,0) {
197 /* DBGO("\\_SB\\LNKA\\_DIS\n") */
198 Store(0, PIRA)
199 } /* End Method(_SB.INTA._DIS) */
200
201 Method(_PRS ,0) {
202 /* DBGO("\\_SB\\LNKA\\_PRS\n") */
203 Return(IRQP)
204 } /* Method(_SB.INTA._PRS) */
205
206 Method(_CRS ,0) {
207 /* DBGO("\\_SB\\LNKA\\_CRS\n") */
208 CreateWordField(IRQB, 0x1, IRQN)
209 ShiftLeft(1, PIRA, IRQN)
210 Return(IRQB)
211 } /* Method(_SB.INTA._CRS) */
212
213 Method(_SRS, 1) {
214 /* DBGO("\\_SB\\LNKA\\_SRS\n") */
215 CreateWordField(ARG0, 1, IRQM)
216
217 /* Use lowest available IRQ */
218 FindSetRightBit(IRQM, Local0)
219 if (Local0) {
220 Decrement(Local0)
221 }
222 Store(Local0, PIRA)
223 } /* End Method(_SB.INTA._SRS) */
224 } /* End Device(INTA) */
225
226 Device(INTB) {
227 Name(_HID, EISAID("PNP0C0F"))
228 Name(_UID, 2)
229
230 Method(_STA, 0) {
231 if (PIRB) {
232 Return(0x0B) /* sata is invisible */
233 } else {
234 Return(0x09) /* sata is disabled */
235 }
236 } /* End Method(_SB.INTB._STA) */
237
238 Method(_DIS ,0) {
239 /* DBGO("\\_SB\\LNKB\\_DIS\n") */
240 Store(0, PIRB)
241 } /* End Method(_SB.INTB._DIS) */
242
243 Method(_PRS ,0) {
244 /* DBGO("\\_SB\\LNKB\\_PRS\n") */
245 Return(IRQP)
246 } /* Method(_SB.INTB._PRS) */
247
248 Method(_CRS ,0) {
249 /* DBGO("\\_SB\\LNKB\\_CRS\n") */
250 CreateWordField(IRQB, 0x1, IRQN)
251 ShiftLeft(1, PIRB, IRQN)
252 Return(IRQB)
253 } /* Method(_SB.INTB._CRS) */
254
255 Method(_SRS, 1) {
256 /* DBGO("\\_SB\\LNKB\\_CRS\n") */
257 CreateWordField(ARG0, 1, IRQM)
258
259 /* Use lowest available IRQ */
260 FindSetRightBit(IRQM, Local0)
261 if (Local0) {
262 Decrement(Local0)
263 }
264 Store(Local0, PIRB)
265 } /* End Method(_SB.INTB._SRS) */
266 } /* End Device(INTB) */
267
268 Device(INTC) {
269 Name(_HID, EISAID("PNP0C0F"))
270 Name(_UID, 3)
271
272 Method(_STA, 0) {
273 if (PIRC) {
274 Return(0x0B) /* sata is invisible */
275 } else {
276 Return(0x09) /* sata is disabled */
277 }
278 } /* End Method(_SB.INTC._STA) */
279
280 Method(_DIS ,0) {
281 /* DBGO("\\_SB\\LNKC\\_DIS\n") */
282 Store(0, PIRC)
283 } /* End Method(_SB.INTC._DIS) */
284
285 Method(_PRS ,0) {
286 /* DBGO("\\_SB\\LNKC\\_PRS\n") */
287 Return(IRQP)
288 } /* Method(_SB.INTC._PRS) */
289
290 Method(_CRS ,0) {
291 /* DBGO("\\_SB\\LNKC\\_CRS\n") */
292 CreateWordField(IRQB, 0x1, IRQN)
293 ShiftLeft(1, PIRC, IRQN)
294 Return(IRQB)
295 } /* Method(_SB.INTC._CRS) */
296
297 Method(_SRS, 1) {
298 /* DBGO("\\_SB\\LNKC\\_CRS\n") */
299 CreateWordField(ARG0, 1, IRQM)
300
301 /* Use lowest available IRQ */
302 FindSetRightBit(IRQM, Local0)
303 if (Local0) {
304 Decrement(Local0)
305 }
306 Store(Local0, PIRC)
307 } /* End Method(_SB.INTC._SRS) */
308 } /* End Device(INTC) */
309
310 Device(INTD) {
311 Name(_HID, EISAID("PNP0C0F"))
312 Name(_UID, 4)
313
314 Method(_STA, 0) {
315 if (PIRD) {
316 Return(0x0B) /* sata is invisible */
317 } else {
318 Return(0x09) /* sata is disabled */
319 }
320 } /* End Method(_SB.INTD._STA) */
321
322 Method(_DIS ,0) {
323 /* DBGO("\\_SB\\LNKD\\_DIS\n") */
324 Store(0, PIRD)
325 } /* End Method(_SB.INTD._DIS) */
326
327 Method(_PRS ,0) {
328 /* DBGO("\\_SB\\LNKD\\_PRS\n") */
329 Return(IRQP)
330 } /* Method(_SB.INTD._PRS) */
331
332 Method(_CRS ,0) {
333 /* DBGO("\\_SB\\LNKD\\_CRS\n") */
334 CreateWordField(IRQB, 0x1, IRQN)
335 ShiftLeft(1, PIRD, IRQN)
336 Return(IRQB)
337 } /* Method(_SB.INTD._CRS) */
338
339 Method(_SRS, 1) {
340 /* DBGO("\\_SB\\LNKD\\_CRS\n") */
341 CreateWordField(ARG0, 1, IRQM)
342
343 /* Use lowest available IRQ */
344 FindSetRightBit(IRQM, Local0)
345 if (Local0) {
346 Decrement(Local0)
347 }
348 Store(Local0, PIRD)
349 } /* End Method(_SB.INTD._SRS) */
350 } /* End Device(INTD) */
351
352 Device(INTE) {
353 Name(_HID, EISAID("PNP0C0F"))
354 Name(_UID, 5)
355
356 Method(_STA, 0) {
357 if (PIRE) {
358 Return(0x0B) /* sata is invisible */
359 } else {
360 Return(0x09) /* sata is disabled */
361 }
362 } /* End Method(_SB.INTE._STA) */
363
364 Method(_DIS ,0) {
365 /* DBGO("\\_SB\\LNKE\\_DIS\n") */
366 Store(0, PIRE)
367 } /* End Method(_SB.INTE._DIS) */
368
369 Method(_PRS ,0) {
370 /* DBGO("\\_SB\\LNKE\\_PRS\n") */
371 Return(IRQP)
372 } /* Method(_SB.INTE._PRS) */
373
374 Method(_CRS ,0) {
375 /* DBGO("\\_SB\\LNKE\\_CRS\n") */
376 CreateWordField(IRQB, 0x1, IRQN)
377 ShiftLeft(1, PIRE, IRQN)
378 Return(IRQB)
379 } /* Method(_SB.INTE._CRS) */
380
381 Method(_SRS, 1) {
382 /* DBGO("\\_SB\\LNKE\\_CRS\n") */
383 CreateWordField(ARG0, 1, IRQM)
384
385 /* Use lowest available IRQ */
386 FindSetRightBit(IRQM, Local0)
387 if (Local0) {
388 Decrement(Local0)
389 }
390 Store(Local0, PIRE)
391 } /* End Method(_SB.INTE._SRS) */
392 } /* End Device(INTE) */
393
394 Device(INTF) {
395 Name(_HID, EISAID("PNP0C0F"))
396 Name(_UID, 6)
397
398 Method(_STA, 0) {
399 if (PIRF) {
400 Return(0x0B) /* sata is invisible */
401 } else {
402 Return(0x09) /* sata is disabled */
403 }
404 } /* End Method(_SB.INTF._STA) */
405
406 Method(_DIS ,0) {
407 /* DBGO("\\_SB\\LNKF\\_DIS\n") */
408 Store(0, PIRF)
409 } /* End Method(_SB.INTF._DIS) */
410
411 Method(_PRS ,0) {
412 /* DBGO("\\_SB\\LNKF\\_PRS\n") */
413 Return(PITF)
414 } /* Method(_SB.INTF._PRS) */
415
416 Method(_CRS ,0) {
417 /* DBGO("\\_SB\\LNKF\\_CRS\n") */
418 CreateWordField(IRQB, 0x1, IRQN)
419 ShiftLeft(1, PIRF, IRQN)
420 Return(IRQB)
421 } /* Method(_SB.INTF._CRS) */
422
423 Method(_SRS, 1) {
424 /* DBGO("\\_SB\\LNKF\\_CRS\n") */
425 CreateWordField(ARG0, 1, IRQM)
426
427 /* Use lowest available IRQ */
428 FindSetRightBit(IRQM, Local0)
429 if (Local0) {
430 Decrement(Local0)
431 }
432 Store(Local0, PIRF)
433 } /* End Method(_SB.INTF._SRS) */
434 } /* End Device(INTF) */
435
436 Device(INTG) {
437 Name(_HID, EISAID("PNP0C0F"))
438 Name(_UID, 7)
439
440 Method(_STA, 0) {
441 if (PIRG) {
442 Return(0x0B) /* sata is invisible */
443 } else {
444 Return(0x09) /* sata is disabled */
445 }
446 } /* End Method(_SB.INTG._STA) */
447
448 Method(_DIS ,0) {
449 /* DBGO("\\_SB\\LNKG\\_DIS\n") */
450 Store(0, PIRG)
451 } /* End Method(_SB.INTG._DIS) */
452
453 Method(_PRS ,0) {
454 /* DBGO("\\_SB\\LNKG\\_PRS\n") */
455 Return(IRQP)
456 } /* Method(_SB.INTG._CRS) */
457
458 Method(_CRS ,0) {
459 /* DBGO("\\_SB\\LNKG\\_CRS\n") */
460 CreateWordField(IRQB, 0x1, IRQN)
461 ShiftLeft(1, PIRG, IRQN)
462 Return(IRQB)
463 } /* Method(_SB.INTG._CRS) */
464
465 Method(_SRS, 1) {
466 /* DBGO("\\_SB\\LNKG\\_CRS\n") */
467 CreateWordField(ARG0, 1, IRQM)
468
469 /* Use lowest available IRQ */
470 FindSetRightBit(IRQM, Local0)
471 if (Local0) {
472 Decrement(Local0)
473 }
474 Store(Local0, PIRG)
475 } /* End Method(_SB.INTG._SRS) */
476 } /* End Device(INTG) */
477
478 Device(INTH) {
479 Name(_HID, EISAID("PNP0C0F"))
480 Name(_UID, 8)
481
482 Method(_STA, 0) {
483 if (PIRH) {
484 Return(0x0B) /* sata is invisible */
485 } else {
486 Return(0x09) /* sata is disabled */
487 }
488 } /* End Method(_SB.INTH._STA) */
489
490 Method(_DIS ,0) {
491 /* DBGO("\\_SB\\LNKH\\_DIS\n") */
492 Store(0, PIRH)
493 } /* End Method(_SB.INTH._DIS) */
494
495 Method(_PRS ,0) {
496 /* DBGO("\\_SB\\LNKH\\_PRS\n") */
497 Return(IRQP)
498 } /* Method(_SB.INTH._CRS) */
499
500 Method(_CRS ,0) {
501 /* DBGO("\\_SB\\LNKH\\_CRS\n") */
502 CreateWordField(IRQB, 0x1, IRQN)
503 ShiftLeft(1, PIRH, IRQN)
504 Return(IRQB)
505 } /* Method(_SB.INTH._CRS) */
506
507 Method(_SRS, 1) {
508 /* DBGO("\\_SB\\LNKH\\_CRS\n") */
509 CreateWordField(ARG0, 1, IRQM)
510
511 /* Use lowest available IRQ */
512 FindSetRightBit(IRQM, Local0)
513 if (Local0) {
514 Decrement(Local0)
515 }
516 Store(Local0, PIRH)
517 } /* End Method(_SB.INTH._SRS) */
518 } /* End Device(INTH) */
519
520 } /* End Scope(_SB) */
521