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, 0xb044, 0x04)
32 Field (DBG, DWordAcc, NoLock, Preserve)
39 /* PCI Bus definition */
42 Name (_HID, EisaId ("PNP0A03"))
45 Name(_PRT, Package() {
46 /* PCI IRQ routing table, example from ACPI 2.0a specification,
48 /* Note: we provide the same info as the PCI routing
49 table of the Bochs BIOS */
50 #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
51 Package() { nr##ffff, 0, lnk0, 0 }, \
52 Package() { nr##ffff, 1, lnk1, 0 }, \
53 Package() { nr##ffff, 2, lnk2, 0 }, \
54 Package() { nr##ffff, 3, lnk3, 0 }
56 #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
57 #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
58 #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
59 #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
61 /* Device 1 is power mgmt device, and can only use irq 9 */
62 Package() { 0x0001ffff, 0, 0, 9 },
63 Package() { 0x0001ffff, 1, LNKB, 0 },
64 Package() { 0x0001ffff, 2, LNKC, 0 },
65 Package() { 0x0001ffff, 3, LNKD, 0 },
98 OperationRegion(PCST, SystemIO, 0xae00, 0x08)
99 Field (PCST, DWordAcc, NoLock, WriteAsZeros)
105 OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
106 Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
111 #define hotplug_slot(name, nr) \
113 Name (_ADR, nr##0000) \
115 Store(ShiftLeft(1, nr), B0EJ) \
121 hotplug_slot(1, 0x0001)
122 hotplug_slot(2, 0x0002)
123 hotplug_slot(3, 0x0003)
124 hotplug_slot(4, 0x0004)
125 hotplug_slot(5, 0x0005)
126 hotplug_slot(6, 0x0006)
127 hotplug_slot(7, 0x0007)
128 hotplug_slot(8, 0x0008)
129 hotplug_slot(9, 0x0009)
130 hotplug_slot(10, 0x000a)
131 hotplug_slot(11, 0x000b)
132 hotplug_slot(12, 0x000c)
133 hotplug_slot(13, 0x000d)
134 hotplug_slot(14, 0x000e)
135 hotplug_slot(15, 0x000f)
136 hotplug_slot(16, 0x0010)
137 hotplug_slot(17, 0x0011)
138 hotplug_slot(18, 0x0012)
139 hotplug_slot(19, 0x0013)
140 hotplug_slot(20, 0x0014)
141 hotplug_slot(21, 0x0015)
142 hotplug_slot(22, 0x0016)
143 hotplug_slot(23, 0x0017)
144 hotplug_slot(24, 0x0018)
145 hotplug_slot(25, 0x0019)
146 hotplug_slot(26, 0x001a)
147 hotplug_slot(27, 0x001b)
148 hotplug_slot(28, 0x001c)
149 hotplug_slot(29, 0x001d)
150 hotplug_slot(30, 0x001e)
151 hotplug_slot(31, 0x001f)
153 Name (_CRS, ResourceTemplate ()
155 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
156 0x0000, // Address Space Granularity
157 0x0000, // Address Range Minimum
158 0x00FF, // Address Range Maximum
159 0x0000, // Address Translation Offset
160 0x0100, // Address Length
163 0x0CF8, // Address Range Minimum
164 0x0CF8, // Address Range Maximum
165 0x01, // Address Alignment
166 0x08, // Address Length
168 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
169 0x0000, // Address Space Granularity
170 0x0000, // Address Range Minimum
171 0x0CF7, // Address Range Maximum
172 0x0000, // Address Translation Offset
173 0x0CF8, // Address Length
175 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
176 0x0000, // Address Space Granularity
177 0x0D00, // Address Range Minimum
178 0xFFFF, // Address Range Maximum
179 0x0000, // Address Translation Offset
180 0xF300, // Address Length
182 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
183 0x00000000, // Address Space Granularity
184 0x000A0000, // Address Range Minimum
185 0x000BFFFF, // Address Range Maximum
186 0x00000000, // Address Translation Offset
187 0x00020000, // Address Length
188 ,, , AddressRangeMemory, TypeStatic)
189 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
190 0x00000000, // Address Space Granularity
191 0xE0000000, // Address Range Minimum
192 0xFEBFFFFF, // Address Range Maximum
193 0x00000000, // Address Translation Offset
194 0x1EC00000, // Address Length
195 ,, , AddressRangeMemory, TypeStatic)
200 Name(_HID, EISAID("PNP0103"))
202 Method (_STA, 0, NotSerialized) {
205 Name(_CRS, ResourceTemplate() {
207 ResourceConsumer, PosDecode, MinFixed, MaxFixed,
208 NonCacheable, ReadWrite,
213 0x00000400 /* 1K memory: FED00000 - FED003FF */
221 Name (_ADR, 0x00020000)
222 Method (_S1D, 0, NotSerialized)
226 Method (_S2D, 0, NotSerialized)
230 Method (_S3D, 0, NotSerialized)
236 /* PIIX3 ISA bridge */
238 Name (_ADR, 0x00010000)
240 /* PIIX PCI to ISA irq remapping */
241 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
243 /* Real-time clock */
246 Name (_HID, EisaId ("PNP0B00"))
247 Name (_CRS, ResourceTemplate ()
249 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
251 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
255 /* Keyboard seems to be important for WinXP install */
258 Name (_HID, EisaId ("PNP0303"))
259 Method (_STA, 0, NotSerialized)
264 Method (_CRS, 0, NotSerialized)
266 Name (TMP, ResourceTemplate ()
269 0x0060, // Address Range Minimum
270 0x0060, // Address Range Maximum
271 0x01, // Address Alignment
272 0x01, // Address Length
275 0x0064, // Address Range Minimum
276 0x0064, // Address Range Maximum
277 0x01, // Address Alignment
278 0x01, // Address Length
290 Name (_HID, EisaId ("PNP0F13"))
291 Method (_STA, 0, NotSerialized)
296 Method (_CRS, 0, NotSerialized)
298 Name (TMP, ResourceTemplate ()
306 /* PS/2 floppy controller */
309 Name (_HID, EisaId ("PNP0700"))
310 Method (_STA, 0, NotSerialized)
314 Method (_CRS, 0, NotSerialized)
316 Name (BUF0, ResourceTemplate ()
318 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
319 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
321 DMA (Compatibility, NotBusMaster, Transfer8) {2}
330 Name (_HID, EisaId ("PNP0400"))
331 Method (_STA, 0, NotSerialized)
333 Store (\_SB.PCI0.PX13.DRSA, Local0)
334 And (Local0, 0x80000000, Local0)
335 If (LEqual (Local0, 0))
344 Method (_CRS, 0, NotSerialized)
346 Name (BUF0, ResourceTemplate ()
348 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
358 Name (_HID, EisaId ("PNP0501"))
360 Method (_STA, 0, NotSerialized)
362 Store (\_SB.PCI0.PX13.DRSC, Local0)
363 And (Local0, 0x08000000, Local0)
364 If (LEqual (Local0, 0))
373 Method (_CRS, 0, NotSerialized)
375 Name (BUF0, ResourceTemplate ()
377 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
386 Name (_HID, EisaId ("PNP0501"))
388 Method (_STA, 0, NotSerialized)
390 Store (\_SB.PCI0.PX13.DRSC, Local0)
391 And (Local0, 0x80000000, Local0)
392 If (LEqual (Local0, 0))
401 Method (_CRS, 0, NotSerialized)
403 Name (BUF0, ResourceTemplate ()
405 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
415 Name (_ADR, 0x00010003)
417 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
418 Field (P13C, DWordAcc, NoLock, Preserve)
435 Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
444 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
446 Name(_PRS, ResourceTemplate(){
447 Interrupt (, Level, ActiveHigh, Shared)
450 Method (_STA, 0, NotSerialized)
453 If (And (0x80, PRQ0, Local1))
459 Method (_DIS, 0, NotSerialized)
461 Or (PRQ0, 0x80, PRQ0)
463 Method (_CRS, 0, NotSerialized)
465 Name (PRR0, ResourceTemplate ()
467 Interrupt (, Level, ActiveHigh, Shared)
470 CreateDWordField (PRR0, 0x05, TMP)
472 If (LLess (Local0, 0x80))
482 Method (_SRS, 1, NotSerialized)
484 CreateDWordField (Arg0, 0x05, TMP)
489 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
491 Name(_PRS, ResourceTemplate(){
492 Interrupt (, Level, ActiveHigh, Shared)
495 Method (_STA, 0, NotSerialized)
498 If (And (0x80, PRQ1, Local1))
504 Method (_DIS, 0, NotSerialized)
506 Or (PRQ1, 0x80, PRQ1)
508 Method (_CRS, 0, NotSerialized)
510 Name (PRR0, ResourceTemplate ()
512 Interrupt (, Level, ActiveHigh, Shared)
515 CreateDWordField (PRR0, 0x05, TMP)
517 If (LLess (Local0, 0x80))
527 Method (_SRS, 1, NotSerialized)
529 CreateDWordField (Arg0, 0x05, TMP)
534 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
536 Name(_PRS, ResourceTemplate(){
537 Interrupt (, Level, ActiveHigh, Shared)
540 Method (_STA, 0, NotSerialized)
543 If (And (0x80, PRQ2, Local1))
549 Method (_DIS, 0, NotSerialized)
551 Or (PRQ2, 0x80, PRQ2)
553 Method (_CRS, 0, NotSerialized)
555 Name (PRR0, ResourceTemplate ()
557 Interrupt (, Level, ActiveHigh, Shared)
560 CreateDWordField (PRR0, 0x05, TMP)
562 If (LLess (Local0, 0x80))
572 Method (_SRS, 1, NotSerialized)
574 CreateDWordField (Arg0, 0x05, TMP)
579 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
581 Name(_PRS, ResourceTemplate(){
582 Interrupt (, Level, ActiveHigh, Shared)
585 Method (_STA, 0, NotSerialized)
588 If (And (0x80, PRQ3, Local1))
594 Method (_DIS, 0, NotSerialized)
596 Or (PRQ3, 0x80, PRQ3)
598 Method (_CRS, 0, NotSerialized)
600 Name (PRR0, ResourceTemplate ()
602 Interrupt (, Level, ActiveHigh, Shared)
605 CreateDWordField (PRR0, 0x05, TMP)
607 If (LLess (Local0, 0x80))
617 Method (_SRS, 1, NotSerialized)
619 CreateDWordField (Arg0, 0x05, TMP)
626 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
627 * must match piix4 emulation.
629 Name (\_S3, Package (0x04)
631 0x01, /* PM1a_CNT.SLP_TYP */
632 0x01, /* PM1b_CNT.SLP_TYP */
636 Name (\_S4, Package (0x04)
638 Zero, /* PM1a_CNT.SLP_TYP */
639 Zero, /* PM1b_CNT.SLP_TYP */
643 Name (\_S5, Package (0x04)
645 Zero, /* PM1a_CNT.SLP_TYP */
646 Zero, /* PM1b_CNT.SLP_TYP */
653 /* Objects filled in by run-time generated SSDT */
654 External(NTFY, MethodObj)
655 External(CPON, PkgObj)
657 /* Methods called by run-time generated SSDT Processor objects */
658 Method (CPMA, 1, NotSerialized) {
659 // _MAT method - create an madt apic buffer
660 // Local0 = CPON flag for this cpu
661 Store(DerefOf(Index(CPON, Arg0)), Local0)
662 // Local1 = Buffer (in madt apic form) to return
663 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
664 // Update the processor id, lapic id, and enable/disable status
665 Store(Arg0, Index(Local1, 2))
666 Store(Arg0, Index(Local1, 3))
667 Store(Local0, Index(Local1, 4))
670 Method (CPST, 1, NotSerialized) {
671 // _STA method - return ON status of cpu
672 // Local0 = CPON flag for this cpu
673 Store(DerefOf(Index(CPON, Arg0)), Local0)
674 If (Local0) { Return(0xF) } Else { Return(0x0) }
676 Method (CPEJ, 2, NotSerialized) {
677 // _EJ0 method - eject callback
681 /* CPU hotplug notify method */
682 OperationRegion(PRST, SystemIO, 0xaf00, 32)
683 Field (PRST, ByteAcc, NoLock, Preserve)
688 // Local5 = active cpu bitmap
690 // Local2 = last read byte from bitmap
692 // Local0 = cpuid iterator
694 While (LLess(Local0, SizeOf(CPON))) {
695 // Local1 = CPON flag for this cpu
696 Store(DerefOf(Index(CPON, Local0)), Local1)
697 If (And(Local0, 0x07)) {
698 // Shift down previously read bitmap byte
699 ShiftRight(Local2, 1, Local2)
701 // Read next byte from cpu bitmap
702 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
704 // Local3 = active state for this cpu
705 Store(And(Local2, 1), Local3)
707 If (LNotEqual(Local1, Local3)) {
708 // State change - update CPON with new state
709 Store(Local3, Index(CPON, Local0))
711 If (LEqual(Local3, 1)) {
725 Name(_HID, "ACPI0006")
731 #define gen_pci_hotplug(nr) \
732 If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
733 Notify(\_SB.PCI0.S##nr, 1) \
735 If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
736 Notify(\_SB.PCI0.S##nr, 3) \