2 * Bochs/QEMU ACPI DSDT ASL definition
4 * Copyright (c) 2006 Fabrice Bellard
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 ACPI_EXTRACT_ALL_CODE AmlCode
23 "acpi-dsdt.aml", // Output Filename
25 0x01, // DSDT Compliance Revision
33 /****************************************************************
35 ****************************************************************/
40 OperationRegion (DBG, SystemIO, 0x0402, 0x01)
41 Field (DBG, ByteAcc, NoLock, Preserve)
46 /* Debug method - use this method to send output to the QEMU
47 * BIOS debug port. This method handles strings, integers,
48 * and buffers. For example: DBUG("abc") DBUG(0x123) */
50 ToHexString(Arg0, Local0)
51 ToBuffer(Local0, Local0)
52 Subtract(SizeOf(Local0), 1, Local1)
54 While (LLess(Local2, Local1)) {
55 Store(DerefOf(Index(Local0, Local2)), DBGB)
63 /****************************************************************
65 ****************************************************************/
69 Name (_HID, EisaId ("PNP0A03"))
72 Name(_PRT, Package() {
73 /* PCI IRQ routing table, example from ACPI 2.0a specification,
75 /* Note: we provide the same info as the PCI routing
76 table of the Bochs BIOS */
77 #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
78 Package() { nr##ffff, 0, lnk0, 0 }, \
79 Package() { nr##ffff, 1, lnk1, 0 }, \
80 Package() { nr##ffff, 2, lnk2, 0 }, \
81 Package() { nr##ffff, 3, lnk3, 0 }
83 #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
84 #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
85 #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
86 #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
88 /* Device 1 is power mgmt device, and can only use irq 9 */
89 prt_slot(0x0001, LNKS, LNKB, LNKC, LNKD),
122 OperationRegion(PCST, SystemIO, 0xae00, 0x08)
123 Field (PCST, DWordAcc, NoLock, WriteAsZeros)
129 OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
130 Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
135 Name (_CRS, ResourceTemplate ()
137 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
138 0x0000, // Address Space Granularity
139 0x0000, // Address Range Minimum
140 0x00FF, // Address Range Maximum
141 0x0000, // Address Translation Offset
142 0x0100, // Address Length
145 0x0CF8, // Address Range Minimum
146 0x0CF8, // Address Range Maximum
147 0x01, // Address Alignment
148 0x08, // Address Length
150 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
151 0x0000, // Address Space Granularity
152 0x0000, // Address Range Minimum
153 0x0CF7, // Address Range Maximum
154 0x0000, // Address Translation Offset
155 0x0CF8, // Address Length
157 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
158 0x0000, // Address Space Granularity
159 0x0D00, // Address Range Minimum
160 0xFFFF, // Address Range Maximum
161 0x0000, // Address Translation Offset
162 0xF300, // Address Length
164 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
165 0x00000000, // Address Space Granularity
166 0x000A0000, // Address Range Minimum
167 0x000BFFFF, // Address Range Maximum
168 0x00000000, // Address Translation Offset
169 0x00020000, // Address Length
170 ,, , AddressRangeMemory, TypeStatic)
171 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
172 0x00000000, // Address Space Granularity
173 0xE0000000, // Address Range Minimum
174 0xFEBFFFFF, // Address Range Maximum
175 0x00000000, // Address Translation Offset
176 0x1EC00000, // Address Length
177 ,, , AddressRangeMemory, TypeStatic)
183 /****************************************************************
185 ****************************************************************/
189 Name(_HID, EISAID("PNP0103"))
191 Method (_STA, 0, NotSerialized) {
194 Name(_CRS, ResourceTemplate() {
196 ResourceConsumer, PosDecode, MinFixed, MaxFixed,
197 NonCacheable, ReadWrite,
202 0x00000400 /* 1K memory: FED00000 - FED003FF */
209 /****************************************************************
211 ****************************************************************/
215 Name (_ADR, 0x00020000)
216 OperationRegion(PCIC, PCI_Config, Zero, 0x4)
217 Field(PCIC, DWordAcc, NoLock, Preserve) {
220 Method (_S1D, 0, NotSerialized)
224 Method (_S2D, 0, NotSerialized)
228 Method (_S3D, 0, NotSerialized)
230 If (LEqual(VEND, 0x1001b36)) {
240 /****************************************************************
242 ****************************************************************/
246 Name (_ADR, 0x00010000)
248 /* PIIX PCI to ISA irq remapping */
249 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
254 /****************************************************************
255 * SuperIO devices (kbd, mouse, etc.)
256 ****************************************************************/
258 Scope(\_SB.PCI0.ISA) {
259 /* Real-time clock */
262 Name (_HID, EisaId ("PNP0B00"))
263 Name (_CRS, ResourceTemplate ()
265 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
267 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
271 /* Keyboard seems to be important for WinXP install */
274 Name (_HID, EisaId ("PNP0303"))
275 Method (_STA, 0, NotSerialized)
280 Method (_CRS, 0, NotSerialized)
282 Name (TMP, ResourceTemplate ()
285 0x0060, // Address Range Minimum
286 0x0060, // Address Range Maximum
287 0x01, // Address Alignment
288 0x01, // Address Length
291 0x0064, // Address Range Minimum
292 0x0064, // Address Range Maximum
293 0x01, // Address Alignment
294 0x01, // Address Length
306 Name (_HID, EisaId ("PNP0F13"))
307 Method (_STA, 0, NotSerialized)
312 Method (_CRS, 0, NotSerialized)
314 Name (TMP, ResourceTemplate ()
322 /* PS/2 floppy controller */
325 Name (_HID, EisaId ("PNP0700"))
326 Method (_STA, 0, NotSerialized)
330 Method (_CRS, 0, NotSerialized)
332 Name (BUF0, ResourceTemplate ()
334 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
335 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
337 DMA (Compatibility, NotBusMaster, Transfer8) {2}
346 Name (_HID, EisaId ("PNP0400"))
347 Method (_STA, 0, NotSerialized)
349 Store (\_SB.PCI0.PX13.DRSA, Local0)
350 And (Local0, 0x80000000, Local0)
351 If (LEqual (Local0, 0))
360 Method (_CRS, 0, NotSerialized)
362 Name (BUF0, ResourceTemplate ()
364 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
374 Name (_HID, EisaId ("PNP0501"))
376 Method (_STA, 0, NotSerialized)
378 Store (\_SB.PCI0.PX13.DRSC, Local0)
379 And (Local0, 0x08000000, Local0)
380 If (LEqual (Local0, 0))
389 Method (_CRS, 0, NotSerialized)
391 Name (BUF0, ResourceTemplate ()
393 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
402 Name (_HID, EisaId ("PNP0501"))
404 Method (_STA, 0, NotSerialized)
406 Store (\_SB.PCI0.PX13.DRSC, Local0)
407 And (Local0, 0x80000000, Local0)
408 If (LEqual (Local0, 0))
417 Method (_CRS, 0, NotSerialized)
419 Name (BUF0, ResourceTemplate ()
421 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
430 /****************************************************************
432 ****************************************************************/
436 Name (_ADR, 0x00010003)
438 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
439 Field (P13C, DWordAcc, NoLock, Preserve)
455 /****************************************************************
457 ****************************************************************/
460 /* Methods called by bulk generated PCI devices below */
462 /* Methods called by hotplug devices */
463 Method (PCEJ, 1, NotSerialized) {
464 // _EJ0 method - eject callback
465 Store(ShiftLeft(1, Arg0), B0EJ)
469 /* Hotplug notification method supplied by SSDT */
470 External (\_SB.PCI0.PCNT, MethodObj)
472 /* PCI hotplug notify method */
476 While (LLess(Local0, 31)) {
478 If (And(PCIU, ShiftLeft(1, Local0))) {
481 If (And(PCID, ShiftLeft(1, Local0))) {
491 /****************************************************************
493 ****************************************************************/
496 Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
504 Method (IQST, 1, NotSerialized) {
505 // _STA method - get status
506 If (And (0x80, Arg0)) {
511 Method (IQCR, 1, NotSerialized) {
512 // _CRS method - get current settings
513 Name (PRR0, ResourceTemplate ()
515 Interrupt (, Level, ActiveHigh, Shared)
518 CreateDWordField (PRR0, 0x05, PRRI)
519 If (LLess (Arg0, 0x80)) {
524 // _DIS method - disable interrupt
525 #define DISIRQ(PRQVAR) \
526 Or(PRQVAR, 0x80, PRQVAR) \
527 // _SRS method - set interrupt
528 #define SETIRQ(PRQVAR, IRQINFO) \
529 CreateDWordField (IRQINFO, 0x05, PRRI) \
533 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
535 Name(_PRS, ResourceTemplate(){
536 Interrupt (, Level, ActiveHigh, Shared)
539 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
540 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ0) }
541 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
542 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ0, Arg0) }
545 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
547 Name(_PRS, ResourceTemplate(){
548 Interrupt (, Level, ActiveHigh, Shared)
551 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) }
552 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ1) }
553 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) }
554 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ1, Arg0) }
557 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
559 Name(_PRS, ResourceTemplate() {
560 Interrupt (, Level, ActiveHigh, Shared)
563 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) }
564 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ2) }
565 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) }
566 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ2, Arg0) }
569 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
571 Name(_PRS, ResourceTemplate() {
572 Interrupt (, Level, ActiveHigh, Shared)
575 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) }
576 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ3) }
577 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) }
578 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ3, Arg0) }
581 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
583 Name(_PRS, ResourceTemplate() {
584 Interrupt (, Level, ActiveHigh, Shared)
587 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
588 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ0) }
589 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
594 /****************************************************************
596 ****************************************************************/
599 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
600 * must match piix4 emulation.
602 Name (\_S3, Package (0x04)
604 0x01, /* PM1a_CNT.SLP_TYP */
605 0x01, /* PM1b_CNT.SLP_TYP */
609 Name (\_S4, Package (0x04)
611 Zero, /* PM1a_CNT.SLP_TYP */
612 Zero, /* PM1b_CNT.SLP_TYP */
616 Name (\_S5, Package (0x04)
618 Zero, /* PM1a_CNT.SLP_TYP */
619 Zero, /* PM1b_CNT.SLP_TYP */
625 /****************************************************************
627 ****************************************************************/
630 /* Objects filled in by run-time generated SSDT */
631 External(NTFY, MethodObj)
632 External(CPON, PkgObj)
634 /* Methods called by run-time generated SSDT Processor objects */
635 Method (CPMA, 1, NotSerialized) {
636 // _MAT method - create an madt apic buffer
637 // Local0 = CPON flag for this cpu
638 Store(DerefOf(Index(CPON, Arg0)), Local0)
639 // Local1 = Buffer (in madt apic form) to return
640 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
641 // Update the processor id, lapic id, and enable/disable status
642 Store(Arg0, Index(Local1, 2))
643 Store(Arg0, Index(Local1, 3))
644 Store(Local0, Index(Local1, 4))
647 Method (CPST, 1, NotSerialized) {
648 // _STA method - return ON status of cpu
649 // Local0 = CPON flag for this cpu
650 Store(DerefOf(Index(CPON, Arg0)), Local0)
651 If (Local0) { Return(0xF) } Else { Return(0x0) }
653 Method (CPEJ, 2, NotSerialized) {
654 // _EJ0 method - eject callback
658 /* CPU hotplug notify method */
659 OperationRegion(PRST, SystemIO, 0xaf00, 32)
660 Field (PRST, ByteAcc, NoLock, Preserve)
665 // Local5 = active cpu bitmap
667 // Local2 = last read byte from bitmap
669 // Local0 = cpuid iterator
671 While (LLess(Local0, SizeOf(CPON))) {
672 // Local1 = CPON flag for this cpu
673 Store(DerefOf(Index(CPON, Local0)), Local1)
674 If (And(Local0, 0x07)) {
675 // Shift down previously read bitmap byte
676 ShiftRight(Local2, 1, Local2)
678 // Read next byte from cpu bitmap
679 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
681 // Local3 = active state for this cpu
682 Store(And(Local2, 1), Local3)
684 If (LNotEqual(Local1, Local3)) {
685 // State change - update CPON with new state
686 Store(Local3, Index(CPON, Local0))
688 If (LEqual(Local3, 1)) {
701 /****************************************************************
702 * General purpose events
703 ****************************************************************/
707 Name(_HID, "ACPI0006")
714 Return(\_SB.PCI0.PCNF())