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-dsdt.aml", // Output Filename
22 0x01, // DSDT Compliance Revision
31 OperationRegion (DBG, SystemIO, 0x0402, 0x01)
32 Field (DBG, ByteAcc, NoLock, Preserve)
37 /* Debug method - use this method to send output to the QEMU
38 * BIOS debug port. This method handles strings, integers,
39 * and buffers. For example: DBUG("abc") DBUG(0x123) */
41 ToHexString(Arg0, Local0)
42 ToBuffer(Local0, Local0)
43 Subtract(SizeOf(Local0), 1, Local1)
45 While (LLess(Local2, Local1)) {
46 Store(DerefOf(Index(Local0, Local2)), DBGB)
53 /* PCI Bus definition */
56 Name (_HID, EisaId ("PNP0A03"))
59 Name(_PRT, Package() {
60 /* PCI IRQ routing table, example from ACPI 2.0a specification,
62 /* Note: we provide the same info as the PCI routing
63 table of the Bochs BIOS */
64 #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
65 Package() { nr##ffff, 0, lnk0, 0 }, \
66 Package() { nr##ffff, 1, lnk1, 0 }, \
67 Package() { nr##ffff, 2, lnk2, 0 }, \
68 Package() { nr##ffff, 3, lnk3, 0 }
70 #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
71 #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
72 #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
73 #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
75 /* Device 1 is power mgmt device, and can only use irq 9 */
76 Package() { 0x0001ffff, 0, 0, 9 },
77 Package() { 0x0001ffff, 1, LNKB, 0 },
78 Package() { 0x0001ffff, 2, LNKC, 0 },
79 Package() { 0x0001ffff, 3, LNKD, 0 },
112 OperationRegion(PCST, SystemIO, 0xae00, 0x08)
113 Field (PCST, DWordAcc, NoLock, WriteAsZeros)
119 OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
120 Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
125 #define hotplug_slot(name, nr) \
127 Name (_ADR, nr##0000) \
129 Store(ShiftLeft(1, nr), B0EJ) \
135 hotplug_slot(1, 0x0001)
136 hotplug_slot(2, 0x0002)
137 hotplug_slot(3, 0x0003)
138 hotplug_slot(4, 0x0004)
139 hotplug_slot(5, 0x0005)
140 hotplug_slot(6, 0x0006)
141 hotplug_slot(7, 0x0007)
142 hotplug_slot(8, 0x0008)
143 hotplug_slot(9, 0x0009)
144 hotplug_slot(10, 0x000a)
145 hotplug_slot(11, 0x000b)
146 hotplug_slot(12, 0x000c)
147 hotplug_slot(13, 0x000d)
148 hotplug_slot(14, 0x000e)
149 hotplug_slot(15, 0x000f)
150 hotplug_slot(16, 0x0010)
151 hotplug_slot(17, 0x0011)
152 hotplug_slot(18, 0x0012)
153 hotplug_slot(19, 0x0013)
154 hotplug_slot(20, 0x0014)
155 hotplug_slot(21, 0x0015)
156 hotplug_slot(22, 0x0016)
157 hotplug_slot(23, 0x0017)
158 hotplug_slot(24, 0x0018)
159 hotplug_slot(25, 0x0019)
160 hotplug_slot(26, 0x001a)
161 hotplug_slot(27, 0x001b)
162 hotplug_slot(28, 0x001c)
163 hotplug_slot(29, 0x001d)
164 hotplug_slot(30, 0x001e)
165 hotplug_slot(31, 0x001f)
167 Name (_CRS, ResourceTemplate ()
169 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
170 0x0000, // Address Space Granularity
171 0x0000, // Address Range Minimum
172 0x00FF, // Address Range Maximum
173 0x0000, // Address Translation Offset
174 0x0100, // Address Length
177 0x0CF8, // Address Range Minimum
178 0x0CF8, // Address Range Maximum
179 0x01, // Address Alignment
180 0x08, // Address Length
182 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
183 0x0000, // Address Space Granularity
184 0x0000, // Address Range Minimum
185 0x0CF7, // Address Range Maximum
186 0x0000, // Address Translation Offset
187 0x0CF8, // Address Length
189 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
190 0x0000, // Address Space Granularity
191 0x0D00, // Address Range Minimum
192 0xFFFF, // Address Range Maximum
193 0x0000, // Address Translation Offset
194 0xF300, // Address Length
196 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
197 0x00000000, // Address Space Granularity
198 0x000A0000, // Address Range Minimum
199 0x000BFFFF, // Address Range Maximum
200 0x00000000, // Address Translation Offset
201 0x00020000, // Address Length
202 ,, , AddressRangeMemory, TypeStatic)
203 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
204 0x00000000, // Address Space Granularity
205 0xE0000000, // Address Range Minimum
206 0xFEBFFFFF, // Address Range Maximum
207 0x00000000, // Address Translation Offset
208 0x1EC00000, // Address Length
209 ,, , AddressRangeMemory, TypeStatic)
214 Name(_HID, EISAID("PNP0103"))
216 Method (_STA, 0, NotSerialized) {
219 Name(_CRS, ResourceTemplate() {
221 ResourceConsumer, PosDecode, MinFixed, MaxFixed,
222 NonCacheable, ReadWrite,
227 0x00000400 /* 1K memory: FED00000 - FED003FF */
235 Name (_ADR, 0x00020000)
236 Method (_S1D, 0, NotSerialized)
240 Method (_S2D, 0, NotSerialized)
244 Method (_S3D, 0, NotSerialized)
250 /* PIIX3 ISA bridge */
252 Name (_ADR, 0x00010000)
254 /* PIIX PCI to ISA irq remapping */
255 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
257 /* Real-time clock */
260 Name (_HID, EisaId ("PNP0B00"))
261 Name (_CRS, ResourceTemplate ()
263 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
265 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
269 /* Keyboard seems to be important for WinXP install */
272 Name (_HID, EisaId ("PNP0303"))
273 Method (_STA, 0, NotSerialized)
278 Method (_CRS, 0, NotSerialized)
280 Name (TMP, ResourceTemplate ()
283 0x0060, // Address Range Minimum
284 0x0060, // Address Range Maximum
285 0x01, // Address Alignment
286 0x01, // Address Length
289 0x0064, // Address Range Minimum
290 0x0064, // Address Range Maximum
291 0x01, // Address Alignment
292 0x01, // Address Length
304 Name (_HID, EisaId ("PNP0F13"))
305 Method (_STA, 0, NotSerialized)
310 Method (_CRS, 0, NotSerialized)
312 Name (TMP, ResourceTemplate ()
320 /* PS/2 floppy controller */
323 Name (_HID, EisaId ("PNP0700"))
324 Method (_STA, 0, NotSerialized)
328 Method (_CRS, 0, NotSerialized)
330 Name (BUF0, ResourceTemplate ()
332 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
333 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
335 DMA (Compatibility, NotBusMaster, Transfer8) {2}
344 Name (_HID, EisaId ("PNP0400"))
345 Method (_STA, 0, NotSerialized)
347 Store (\_SB.PCI0.PX13.DRSA, Local0)
348 And (Local0, 0x80000000, Local0)
349 If (LEqual (Local0, 0))
358 Method (_CRS, 0, NotSerialized)
360 Name (BUF0, ResourceTemplate ()
362 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
372 Name (_HID, EisaId ("PNP0501"))
374 Method (_STA, 0, NotSerialized)
376 Store (\_SB.PCI0.PX13.DRSC, Local0)
377 And (Local0, 0x08000000, Local0)
378 If (LEqual (Local0, 0))
387 Method (_CRS, 0, NotSerialized)
389 Name (BUF0, ResourceTemplate ()
391 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
400 Name (_HID, EisaId ("PNP0501"))
402 Method (_STA, 0, NotSerialized)
404 Store (\_SB.PCI0.PX13.DRSC, Local0)
405 And (Local0, 0x80000000, Local0)
406 If (LEqual (Local0, 0))
415 Method (_CRS, 0, NotSerialized)
417 Name (BUF0, ResourceTemplate ()
419 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
429 Name (_ADR, 0x00010003)
431 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
432 Field (P13C, DWordAcc, NoLock, Preserve)
449 Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
458 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
460 Name(_PRS, ResourceTemplate(){
461 Interrupt (, Level, ActiveHigh, Shared)
464 Method (_STA, 0, NotSerialized)
467 If (And (0x80, PRQ0, Local1))
473 Method (_DIS, 0, NotSerialized)
475 Or (PRQ0, 0x80, PRQ0)
477 Method (_CRS, 0, NotSerialized)
479 Name (PRR0, ResourceTemplate ()
481 Interrupt (, Level, ActiveHigh, Shared)
484 CreateDWordField (PRR0, 0x05, TMP)
486 If (LLess (Local0, 0x80))
496 Method (_SRS, 1, NotSerialized)
498 CreateDWordField (Arg0, 0x05, TMP)
503 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
505 Name(_PRS, ResourceTemplate(){
506 Interrupt (, Level, ActiveHigh, Shared)
509 Method (_STA, 0, NotSerialized)
512 If (And (0x80, PRQ1, Local1))
518 Method (_DIS, 0, NotSerialized)
520 Or (PRQ1, 0x80, PRQ1)
522 Method (_CRS, 0, NotSerialized)
524 Name (PRR0, ResourceTemplate ()
526 Interrupt (, Level, ActiveHigh, Shared)
529 CreateDWordField (PRR0, 0x05, TMP)
531 If (LLess (Local0, 0x80))
541 Method (_SRS, 1, NotSerialized)
543 CreateDWordField (Arg0, 0x05, TMP)
548 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
550 Name(_PRS, ResourceTemplate(){
551 Interrupt (, Level, ActiveHigh, Shared)
554 Method (_STA, 0, NotSerialized)
557 If (And (0x80, PRQ2, Local1))
563 Method (_DIS, 0, NotSerialized)
565 Or (PRQ2, 0x80, PRQ2)
567 Method (_CRS, 0, NotSerialized)
569 Name (PRR0, ResourceTemplate ()
571 Interrupt (, Level, ActiveHigh, Shared)
574 CreateDWordField (PRR0, 0x05, TMP)
576 If (LLess (Local0, 0x80))
586 Method (_SRS, 1, NotSerialized)
588 CreateDWordField (Arg0, 0x05, TMP)
593 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
595 Name(_PRS, ResourceTemplate(){
596 Interrupt (, Level, ActiveHigh, Shared)
599 Method (_STA, 0, NotSerialized)
602 If (And (0x80, PRQ3, Local1))
608 Method (_DIS, 0, NotSerialized)
610 Or (PRQ3, 0x80, PRQ3)
612 Method (_CRS, 0, NotSerialized)
614 Name (PRR0, ResourceTemplate ()
616 Interrupt (, Level, ActiveHigh, Shared)
619 CreateDWordField (PRR0, 0x05, TMP)
621 If (LLess (Local0, 0x80))
631 Method (_SRS, 1, NotSerialized)
633 CreateDWordField (Arg0, 0x05, TMP)
640 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
641 * must match piix4 emulation.
643 Name (\_S3, Package (0x04)
645 0x01, /* PM1a_CNT.SLP_TYP */
646 0x01, /* PM1b_CNT.SLP_TYP */
650 Name (\_S4, Package (0x04)
652 Zero, /* PM1a_CNT.SLP_TYP */
653 Zero, /* PM1b_CNT.SLP_TYP */
657 Name (\_S5, Package (0x04)
659 Zero, /* PM1a_CNT.SLP_TYP */
660 Zero, /* PM1b_CNT.SLP_TYP */
667 /* Objects filled in by run-time generated SSDT */
668 External(NTFY, MethodObj)
669 External(CPON, PkgObj)
671 /* Methods called by run-time generated SSDT Processor objects */
672 Method (CPMA, 1, NotSerialized) {
673 // _MAT method - create an madt apic buffer
674 // Local0 = CPON flag for this cpu
675 Store(DerefOf(Index(CPON, Arg0)), Local0)
676 // Local1 = Buffer (in madt apic form) to return
677 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
678 // Update the processor id, lapic id, and enable/disable status
679 Store(Arg0, Index(Local1, 2))
680 Store(Arg0, Index(Local1, 3))
681 Store(Local0, Index(Local1, 4))
684 Method (CPST, 1, NotSerialized) {
685 // _STA method - return ON status of cpu
686 // Local0 = CPON flag for this cpu
687 Store(DerefOf(Index(CPON, Arg0)), Local0)
688 If (Local0) { Return(0xF) } Else { Return(0x0) }
690 Method (CPEJ, 2, NotSerialized) {
691 // _EJ0 method - eject callback
695 /* CPU hotplug notify method */
696 OperationRegion(PRST, SystemIO, 0xaf00, 32)
697 Field (PRST, ByteAcc, NoLock, Preserve)
702 // Local5 = active cpu bitmap
704 // Local2 = last read byte from bitmap
706 // Local0 = cpuid iterator
708 While (LLess(Local0, SizeOf(CPON))) {
709 // Local1 = CPON flag for this cpu
710 Store(DerefOf(Index(CPON, Local0)), Local1)
711 If (And(Local0, 0x07)) {
712 // Shift down previously read bitmap byte
713 ShiftRight(Local2, 1, Local2)
715 // Read next byte from cpu bitmap
716 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
718 // Local3 = active state for this cpu
719 Store(And(Local2, 1), Local3)
721 If (LNotEqual(Local1, Local3)) {
722 // State change - update CPON with new state
723 Store(Local3, Index(CPON, Local0))
725 If (LEqual(Local3, 1)) {
739 Name(_HID, "ACPI0006")
745 #define gen_pci_hotplug(nr) \
746 If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
747 Notify(\_SB.PCI0.S##nr, 1) \
749 If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
750 Notify(\_SB.PCI0.S##nr, 3) \