blob: 3032ff6eaa3eb62503d4ca5260af43289c02e7fc [file] [log] [blame]
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +01001/*
2 * Bochs/QEMU ACPI DSDT ASL definition
3 *
4 * Copyright (c) 2006 Fabrice Bellard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2 as published by the Free Software Foundation.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19/*
20 * Copyright (c) 2010 Isaku Yamahata
21 * yamahata at valinux co jp
22 * Based on acpi-dsdt.dsl, but heavily modified for q35 chipset.
23 */
24
25DefinitionBlock (
26 "q35-acpi-dsdt.aml",// Output Filename
27 "DSDT", // Signature
28 0x01, // DSDT Compliance Revision
29 "BXPC", // OEMID
30 "BXDSDT", // TABLE ID
31 0x2 // OEM Revision
32 )
33{
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +010034
Gerd Hoffmannbeaedaa2012-11-28 10:17:39 +010035#include "acpi-dsdt-dbug.dsl"
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +010036
37 Scope (\_SB)
38 {
39 OperationRegion(PCST, SystemIO, 0xae00, 0x0c)
40 OperationRegion(PCSB, SystemIO, 0xae0c, 0x01)
41 Field (PCSB, AnyAcc, NoLock, WriteAsZeros)
42 {
43 PCIB, 8,
44 }
45 }
46
47 /* Zero => PIC mode, One => APIC Mode */
48 Name (\PICF, Zero)
49 Method (\_PIC, 1, NotSerialized)
50 {
51 Store (Arg0, \PICF)
52 }
53
54 /* PCI Bus definition */
55 Scope(\_SB) {
56
57 Device(PCI0) {
58 Name (_HID, EisaId ("PNP0A08"))
59 Name (_CID, EisaId ("PNP0A03"))
60 Name (_ADR, 0x00)
61 Name (_UID, 1)
62
63 // _OSC: based on sample of ACPI3.0b spec
64 Name(SUPP,0) // PCI _OSC Support Field value
65 Name(CTRL,0) // PCI _OSC Control Field value
66 Method(_OSC,4)
67 {
68 // Create DWORD-addressable fields from the Capabilities Buffer
69 CreateDWordField(Arg3,0,CDW1)
70
71 // Check for proper UUID
72 If(LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766")))
73 {
74 // Create DWORD-addressable fields from the Capabilities Buffer
75 CreateDWordField(Arg3,4,CDW2)
76 CreateDWordField(Arg3,8,CDW3)
77
78 // Save Capabilities DWORD2 & 3
79 Store(CDW2,SUPP)
80 Store(CDW3,CTRL)
81
82 // Always allow native PME, AER (no dependencies)
83 // Never allow SHPC (no SHPC controller in this system)
84 And(CTRL,0x1D,CTRL)
85
86#if 0 // For now, nothing to do
87 If(Not(And(CDW1,1))) // Query flag clear?
88 { // Disable GPEs for features granted native control.
89 If(And(CTRL,0x01)) // Hot plug control granted?
90 {
91 Store(0,HPCE) // clear the hot plug SCI enable bit
92 Store(1,HPCS) // clear the hot plug SCI status bit
93 }
94 If(And(CTRL,0x04)) // PME control granted?
95 {
96 Store(0,PMCE) // clear the PME SCI enable bit
97 Store(1,PMCS) // clear the PME SCI status bit
98 }
99 If(And(CTRL,0x10)) // OS restoring PCI Express cap structure?
100 {
101 // Set status to not restore PCI Express cap structure
102 // upon resume from S3
103 Store(1,S3CR)
104 }
105
106 }
107#endif
108 If(LNotEqual(Arg1,One))
109 { // Unknown revision
110 Or(CDW1,0x08,CDW1)
111 }
112 If(LNotEqual(CDW3,CTRL))
113 { // Capabilities bits were masked
114 Or(CDW1,0x10,CDW1)
115 }
116 // Update DWORD3 in the buffer
117 Store(CTRL,CDW3)
118 } Else {
119 Or(CDW1,4,CDW1) // Unrecognized UUID
120 }
121 Return(Arg3)
122 }
123
124#define prt_slot_lnk(nr, lnk0, lnk1, lnk2, lnk3) \
125 Package() { nr##ffff, 0, lnk0, 0 }, \
126 Package() { nr##ffff, 1, lnk1, 0 }, \
127 Package() { nr##ffff, 2, lnk2, 0 }, \
128 Package() { nr##ffff, 3, lnk3, 0 }
129
130#define prt_slot_lnkA(nr) prt_slot_lnk(nr, LNKA, LNKB, LNKC, LNKD)
131#define prt_slot_lnkB(nr) prt_slot_lnk(nr, LNKB, LNKC, LNKD, LNKA)
132#define prt_slot_lnkC(nr) prt_slot_lnk(nr, LNKC, LNKD, LNKA, LNKB)
133#define prt_slot_lnkD(nr) prt_slot_lnk(nr, LNKD, LNKA, LNKB, LNKC)
134
135#define prt_slot_lnkE(nr) prt_slot_lnk(nr, LNKE, LNKF, LNKG, LNKH)
136#define prt_slot_lnkF(nr) prt_slot_lnk(nr, LNKF, LNKG, LNKH, LNKE)
137#define prt_slot_lnkG(nr) prt_slot_lnk(nr, LNKG, LNKH, LNKE, LNKF)
138#define prt_slot_lnkH(nr) prt_slot_lnk(nr, LNKH, LNKE, LNKF, LNKG)
139
140#define prt_slot_gsi(nr, gsi0, gsi1, gsi2, gsi3) \
Jan Kiszka2114f502012-11-28 10:17:37 +0100141 Package() { nr##ffff, 0, gsi0, 0 }, \
142 Package() { nr##ffff, 1, gsi1, 0 }, \
143 Package() { nr##ffff, 2, gsi2, 0 }, \
144 Package() { nr##ffff, 3, gsi3, 0 }
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100145
146#define prt_slot_gsiA(nr) prt_slot_gsi(nr, GSIA, GSIB, GSIC, GSID)
147#define prt_slot_gsiB(nr) prt_slot_gsi(nr, GSIB, GSIC, GSID, GSIA)
148#define prt_slot_gsiC(nr) prt_slot_gsi(nr, GSIC, GSID, GSIA, GSIB)
149#define prt_slot_gsiD(nr) prt_slot_gsi(nr, GSID, GSIA, GSIB, GSIC)
150
151#define prt_slot_gsiE(nr) prt_slot_gsi(nr, GSIE, GSIF, GSIG, GSIH)
152#define prt_slot_gsiF(nr) prt_slot_gsi(nr, GSIF, GSIG, GSIH, GSIE)
153#define prt_slot_gsiG(nr) prt_slot_gsi(nr, GSIG, GSIH, GSIE, GSIF)
154#define prt_slot_gsiH(nr) prt_slot_gsi(nr, GSIH, GSIE, GSIF, GSIG)
155
156 NAME(PRTP, package()
157 {
158 prt_slot_lnkE(0x0000),
159 prt_slot_lnkF(0x0001),
160 prt_slot_lnkG(0x0002),
161 prt_slot_lnkH(0x0003),
162 prt_slot_lnkE(0x0004),
163 prt_slot_lnkF(0x0005),
164 prt_slot_lnkG(0x0006),
165 prt_slot_lnkH(0x0007),
166 prt_slot_lnkE(0x0008),
167 prt_slot_lnkF(0x0009),
168 prt_slot_lnkG(0x000a),
169 prt_slot_lnkH(0x000b),
170 prt_slot_lnkE(0x000c),
171 prt_slot_lnkF(0x000d),
172 prt_slot_lnkG(0x000e),
173 prt_slot_lnkH(0x000f),
174 prt_slot_lnkE(0x0010),
175 prt_slot_lnkF(0x0011),
176 prt_slot_lnkG(0x0012),
177 prt_slot_lnkH(0x0013),
178 prt_slot_lnkE(0x0014),
179 prt_slot_lnkF(0x0015),
180 prt_slot_lnkG(0x0016),
181 prt_slot_lnkH(0x0017),
182 prt_slot_lnkE(0x0018),
183
184 /* INTA -> PIRQA for slot 25 - 31
185 see the default value of D<N>IR */
186 prt_slot_lnkA(0x0019),
187 prt_slot_lnkA(0x001a),
188 prt_slot_lnkA(0x001b),
189 prt_slot_lnkA(0x001c),
190 prt_slot_lnkA(0x001d),
191
192 /* PCIe->PCI bridge. use PIRQ[E-H] */
193 prt_slot_lnkE(0x001e),
194
195 prt_slot_lnkA(0x001f)
196 })
197
198 NAME(PRTA, package()
199 {
200 prt_slot_gsiE(0x0000),
201 prt_slot_gsiF(0x0001),
202 prt_slot_gsiG(0x0002),
203 prt_slot_gsiH(0x0003),
204 prt_slot_gsiE(0x0004),
205 prt_slot_gsiF(0x0005),
206 prt_slot_gsiG(0x0006),
207 prt_slot_gsiH(0x0007),
208 prt_slot_gsiE(0x0008),
209 prt_slot_gsiF(0x0009),
210 prt_slot_gsiG(0x000a),
211 prt_slot_gsiH(0x000b),
212 prt_slot_gsiE(0x000c),
213 prt_slot_gsiF(0x000d),
214 prt_slot_gsiG(0x000e),
215 prt_slot_gsiH(0x000f),
216 prt_slot_gsiE(0x0010),
217 prt_slot_gsiF(0x0011),
218 prt_slot_gsiG(0x0012),
219 prt_slot_gsiH(0x0013),
220 prt_slot_gsiE(0x0014),
221 prt_slot_gsiF(0x0015),
222 prt_slot_gsiG(0x0016),
223 prt_slot_gsiH(0x0017),
224 prt_slot_gsiE(0x0018),
225
226 /* INTA -> PIRQA for slot 25 - 31, but 30
227 see the default value of D<N>IR */
228 prt_slot_gsiA(0x0019),
229 prt_slot_gsiA(0x001a),
230 prt_slot_gsiA(0x001b),
231 prt_slot_gsiA(0x001c),
232 prt_slot_gsiA(0x001d),
233
234 /* PCIe->PCI bridge. use PIRQ[E-H] */
235 prt_slot_gsiE(0x001e),
236
237 prt_slot_gsiA(0x001f)
238 })
239
240 Method(_PRT, 0, NotSerialized)
241 {
242 /* PCI IRQ routing table, example from ACPI 2.0a specification,
243 section 6.2.8.1 */
244 /* Note: we provide the same info as the PCI routing
245 table of the Bochs BIOS */
246 If (LEqual (\PICF, Zero))
247 {
248 Return (PRTP)
249 }
250 Else
251 {
252 Return (PRTA)
253 }
254 }
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100255 }
256 }
257
Gerd Hoffmannaa3defc2012-11-28 10:17:43 +0100258#include "acpi-dsdt-pci-crs.dsl"
Gerd Hoffmann7464aea2012-11-28 10:17:41 +0100259#include "acpi-dsdt-hpet.dsl"
260
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100261 Scope(\_SB.PCI0) {
262 Device (VGA) {
Gerd Hoffmann3d111082012-11-28 10:17:49 +0100263 Name (_ADR, 0x00010000)
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100264 Method (_S1D, 0, NotSerialized)
265 {
266 Return (0x00)
267 }
268 Method (_S2D, 0, NotSerialized)
269 {
270 Return (0x00)
271 }
272 Method (_S3D, 0, NotSerialized)
273 {
274 Return (0x00)
275 }
276 }
277
278
279 /* PCI D31:f0 LPC ISA bridge */
280 Device (LPC) {
281 /* PCI D31:f0 */
282 Name (_ADR, 0x001f0000)
283
284 /* ICH9 PCI to ISA irq remapping */
285 OperationRegion (PIRQ, PCI_Config, 0x60, 0x0C)
286 Field (PIRQ, ByteAcc, NoLock, Preserve)
287 {
288 PRQA, 8,
289 PRQB, 8,
290 PRQC, 8,
291 PRQD, 8,
292
293 Offset (0x08),
294 PRQE, 8,
295 PRQF, 8,
296 PRQG, 8,
297 PRQH, 8
298 }
299
300 OperationRegion (LPCD, PCI_Config, 0x80, 0x2)
301 Field (LPCD, AnyAcc, NoLock, Preserve)
302 {
303 COMA, 3,
304 , 1,
305 COMB, 3,
306
307 Offset(0x01),
308 LPTD, 2,
309 , 2,
310 FDCD, 2
311 }
312 OperationRegion (LPCE, PCI_Config, 0x82, 0x2)
313 Field (LPCE, AnyAcc, NoLock, Preserve)
314 {
315 CAEN, 1,
316 CBEN, 1,
317 LPEN, 1,
318 FDEN, 1
319 }
320
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100321 /* Real-time clock */
322 Device (RTC)
323 {
324 Name (_HID, EisaId ("PNP0B00"))
325 Name (_CRS, ResourceTemplate ()
326 {
327 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
328 IRQNoFlags () {8}
329 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
330 })
331 }
332
333 /* Keyboard seems to be important for WinXP install */
334 Device (KBD)
335 {
336 Name (_HID, EisaId ("PNP0303"))
337 Method (_STA, 0, NotSerialized)
338 {
339 Return (0x0f)
340 }
341
342 Method (_CRS, 0, NotSerialized)
343 {
344 Name (TMP, ResourceTemplate ()
345 {
346 IO (Decode16,
347 0x0060, // Address Range Minimum
348 0x0060, // Address Range Maximum
349 0x01, // Address Alignment
350 0x01, // Address Length
351 )
352 IO (Decode16,
353 0x0064, // Address Range Minimum
354 0x0064, // Address Range Maximum
355 0x01, // Address Alignment
356 0x01, // Address Length
357 )
358 IRQNoFlags ()
359 {1}
360 })
361 Return (TMP)
362 }
363 }
364
365 /* PS/2 mouse */
366 Device (MOU)
367 {
368 Name (_HID, EisaId ("PNP0F13"))
369 Method (_STA, 0, NotSerialized)
370 {
371 Return (0x0f)
372 }
373
374 Method (_CRS, 0, NotSerialized)
375 {
376 Name (TMP, ResourceTemplate ()
377 {
378 IRQNoFlags () {12}
379 })
380 Return (TMP)
381 }
382 }
383
384 /* PS/2 floppy controller */
385 Device (FDC0)
386 {
387 Name (_HID, EisaId ("PNP0700"))
388 Method (_STA, 0, NotSerialized)
389 {
390 Store (\_SB.PCI0.LPC.FDEN, Local0)
391 If (LEqual (Local0, 0))
392 {
393 Return (0x00)
394 }
395 Else
396 {
397 Return (0x0F)
398 }
399 }
400 Method (_CRS, 0, NotSerialized)
401 {
402 Name (BUF0, ResourceTemplate ()
403 {
404 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
405 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
406 IRQNoFlags () {6}
407 DMA (Compatibility, NotBusMaster, Transfer8) {2}
408 })
409 Return (BUF0)
410 }
411 }
412
413 /* Parallel port */
414 Device (LPT)
415 {
416 Name (_HID, EisaId ("PNP0400"))
417 Method (_STA, 0, NotSerialized)
418 {
419 Store (\_SB.PCI0.LPC.LPEN, Local0)
420 If (LEqual (Local0, 0))
421 {
422 Return (0x00)
423 }
424 Else
425 {
426 Return (0x0F)
427 }
428 }
429 Method (_CRS, 0, NotSerialized)
430 {
431 Name (BUF0, ResourceTemplate ()
432 {
433 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
434 IRQNoFlags () {7}
435 })
436 Return (BUF0)
437 }
438 }
439
440 /* Serial Ports */
441 Device (COM1)
442 {
443 Name (_HID, EisaId ("PNP0501"))
444 Name (_UID, 0x01)
445 Method (_STA, 0, NotSerialized)
446 {
447 Store (\_SB.PCI0.LPC.CAEN, Local0)
448 If (LEqual (Local0, 0))
449 {
450 Return (0x00)
451 }
452 Else
453 {
454 Return (0x0F)
455 }
456 }
457 Method (_CRS, 0, NotSerialized)
458 {
459 Name (BUF0, ResourceTemplate ()
460 {
461 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
462 IRQNoFlags () {4}
463 })
464 Return (BUF0)
465 }
466 }
467
468 Device (COM2)
469 {
470 Name (_HID, EisaId ("PNP0501"))
471 Name (_UID, 0x02)
472 Method (_STA, 0, NotSerialized)
473 {
474 Store (\_SB.PCI0.LPC.CBEN, Local0)
475 If (LEqual (Local0, 0))
476 {
477 Return (0x00)
478 }
479 Else
480 {
481 Return (0x0F)
482 }
483 }
484 Method (_CRS, 0, NotSerialized)
485 {
486 Name (BUF0, ResourceTemplate ()
487 {
488 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
489 IRQNoFlags () {3}
490 })
491 Return (BUF0)
492 }
493 }
494 }
495 }
496
497 /* PCI IRQs */
498 Scope(\_SB) {
499#define define_link(link, uid, reg) \
500 Device(link){ \
501 Name(_HID, EISAID("PNP0C0F")) \
502 Name(_UID, uid) \
503 Name(_PRS, ResourceTemplate(){ \
504 Interrupt (, Level, ActiveHigh, \
505 Shared) \
506 { 5, 10, 11 } \
507 }) \
508 Method (_STA, 0, NotSerialized) \
509 { \
510 Store (0x0B, Local0) \
511 If (And (0x80, reg, Local1)) \
512 { \
513 Store (0x09, Local0) \
514 } \
515 Return (Local0) \
516 } \
517 Method (_DIS, 0, NotSerialized) \
518 { \
519 Or (reg, 0x80, reg) \
520 } \
521 Method (_CRS, 0, NotSerialized) \
522 { \
523 Name (PRR0, ResourceTemplate () \
524 { \
525 Interrupt (, Level, ActiveHigh, \
526 Shared) \
527 {1} \
528 }) \
529 CreateDWordField (PRR0, 0x05, TMP) \
530 And (reg, 0x0F, Local0) \
531 Store (Local0, TMP) \
532 Return (PRR0) \
533 } \
534 Method (_SRS, 1, NotSerialized) \
535 { \
536 CreateDWordField (Arg0, 0x05, TMP) \
537 Store (TMP, reg) \
538 } \
539 }
540
541 define_link(LNKA, 0, \_SB.PCI0.LPC.PRQA)
542 define_link(LNKB, 1, \_SB.PCI0.LPC.PRQB)
543 define_link(LNKC, 2, \_SB.PCI0.LPC.PRQC)
544 define_link(LNKD, 3, \_SB.PCI0.LPC.PRQD)
545 define_link(LNKE, 4, \_SB.PCI0.LPC.PRQE)
546 define_link(LNKF, 5, \_SB.PCI0.LPC.PRQF)
547 define_link(LNKG, 6, \_SB.PCI0.LPC.PRQG)
548 define_link(LNKH, 7, \_SB.PCI0.LPC.PRQH)
Jan Kiszka2114f502012-11-28 10:17:37 +0100549
550#define define_gsi_link(link, uid, gsi) \
551 Device(link){ \
552 Name(_HID, EISAID("PNP0C0F")) \
553 Name(_UID, uid) \
554 Name(_PRS, ResourceTemplate() { \
555 Interrupt (, Level, ActiveHigh, \
556 Shared) \
557 { gsi } \
558 }) \
559 Method (_CRS, 0, NotSerialized) \
560 { \
561 Return (ResourceTemplate () { \
562 Interrupt (, Level, ActiveHigh, \
563 Shared) \
564 { gsi } \
565 }) \
566 } \
567 Method (_SRS, 1, NotSerialized) { } \
568 } \
569
570 define_gsi_link(GSIA, 0, 0x10)
571 define_gsi_link(GSIB, 0, 0x11)
572 define_gsi_link(GSIC, 0, 0x12)
573 define_gsi_link(GSID, 0, 0x13)
574 define_gsi_link(GSIE, 0, 0x14)
575 define_gsi_link(GSIF, 0, 0x15)
576 define_gsi_link(GSIG, 0, 0x16)
577 define_gsi_link(GSIH, 0, 0x17)
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100578 }
579
Gerd Hoffmannf50a55c2012-11-28 10:17:45 +0100580#include "acpi-dsdt-cpu-hotplug.dsl"
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100581
582 Scope (\_GPE)
583 {
584 Name(_HID, "ACPI0006")
585
586 Method(_L00) {
587 Return(0x01)
588 }
589 Method(_L01) {
590 // CPU hotplug event
Gerd Hoffmannf50a55c2012-11-28 10:17:45 +0100591 \_SB.PRSC()
Isaku Yamahataecbe3fd2012-11-28 10:17:36 +0100592 }
593 Method(_L02) {
594 Return(0x01)
595 }
596 Method(_L03) {
597 Return(0x01)
598 }
599 Method(_L04) {
600 Return(0x01)
601 }
602 Method(_L05) {
603 Return(0x01)
604 }
605 Method(_L06) {
606 Return(0x01)
607 }
608 Method(_L07) {
609 Return(0x01)
610 }
611 Method(_L08) {
612 Return(0x01)
613 }
614 Method(_L09) {
615 Return(0x01)
616 }
617 Method(_L0A) {
618 Return(0x01)
619 }
620 Method(_L0B) {
621 Return(0x01)
622 }
623 Method(_L0C) {
624 Return(0x01)
625 }
626 Method(_L0D) {
627 Return(0x01)
628 }
629 Method(_L0E) {
630 Return(0x01)
631 }
632 Method(_L0F) {
633 Return(0x01)
634 }
635 }
636}