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, LNKS, 0 },
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 OperationRegion(RMVC, SystemIO, 0xae0c, 0x04)
126 Field(RMVC, DWordAcc, NoLock, WriteAsZeros)
131 #define hotplug_slot(name, nr) \
133 Name (_ADR, nr##0000) \
135 Store(ShiftLeft(1, nr), B0EJ) \
141 hotplug_slot(1, 0x0001)
142 hotplug_slot(2, 0x0002)
143 hotplug_slot(3, 0x0003)
144 hotplug_slot(4, 0x0004)
145 hotplug_slot(5, 0x0005)
146 hotplug_slot(6, 0x0006)
147 hotplug_slot(7, 0x0007)
148 hotplug_slot(8, 0x0008)
149 hotplug_slot(9, 0x0009)
150 hotplug_slot(10, 0x000a)
151 hotplug_slot(11, 0x000b)
152 hotplug_slot(12, 0x000c)
153 hotplug_slot(13, 0x000d)
154 hotplug_slot(14, 0x000e)
155 hotplug_slot(15, 0x000f)
156 hotplug_slot(16, 0x0010)
157 hotplug_slot(17, 0x0011)
158 hotplug_slot(18, 0x0012)
159 hotplug_slot(19, 0x0013)
160 hotplug_slot(20, 0x0014)
161 hotplug_slot(21, 0x0015)
162 hotplug_slot(22, 0x0016)
163 hotplug_slot(23, 0x0017)
164 hotplug_slot(24, 0x0018)
165 hotplug_slot(25, 0x0019)
166 hotplug_slot(26, 0x001a)
167 hotplug_slot(27, 0x001b)
168 hotplug_slot(28, 0x001c)
169 hotplug_slot(29, 0x001d)
170 hotplug_slot(30, 0x001e)
171 hotplug_slot(31, 0x001f)
173 Name (_CRS, ResourceTemplate ()
175 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
176 0x0000, // Address Space Granularity
177 0x0000, // Address Range Minimum
178 0x00FF, // Address Range Maximum
179 0x0000, // Address Translation Offset
180 0x0100, // Address Length
183 0x0CF8, // Address Range Minimum
184 0x0CF8, // Address Range Maximum
185 0x01, // Address Alignment
186 0x08, // Address Length
188 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
189 0x0000, // Address Space Granularity
190 0x0000, // Address Range Minimum
191 0x0CF7, // Address Range Maximum
192 0x0000, // Address Translation Offset
193 0x0CF8, // Address Length
195 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
196 0x0000, // Address Space Granularity
197 0x0D00, // Address Range Minimum
198 0xFFFF, // Address Range Maximum
199 0x0000, // Address Translation Offset
200 0xF300, // Address Length
202 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
203 0x00000000, // Address Space Granularity
204 0x000A0000, // Address Range Minimum
205 0x000BFFFF, // Address Range Maximum
206 0x00000000, // Address Translation Offset
207 0x00020000, // Address Length
208 ,, , AddressRangeMemory, TypeStatic)
209 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
210 0x00000000, // Address Space Granularity
211 0xE0000000, // Address Range Minimum
212 0xFEBFFFFF, // Address Range Maximum
213 0x00000000, // Address Translation Offset
214 0x1EC00000, // Address Length
215 ,, , AddressRangeMemory, TypeStatic)
220 Name(_HID, EISAID("PNP0103"))
222 Method (_STA, 0, NotSerialized) {
225 Name(_CRS, ResourceTemplate() {
227 ResourceConsumer, PosDecode, MinFixed, MaxFixed,
228 NonCacheable, ReadWrite,
233 0x00000400 /* 1K memory: FED00000 - FED003FF */
241 Name (_ADR, 0x00020000)
242 OperationRegion(PCIC, PCI_Config, Zero, 0x4)
243 Field(PCIC, DWordAcc, NoLock, Preserve) {
246 Method (_S1D, 0, NotSerialized)
250 Method (_S2D, 0, NotSerialized)
254 Method (_S3D, 0, NotSerialized)
256 If (LEqual(VEND, 0x1001b36)) {
262 Method(_RMV) { Return (0x00) }
265 /* PIIX3 ISA bridge */
267 Name (_ADR, 0x00010000)
268 Method(_RMV) { Return (0x00) }
271 /* PIIX PCI to ISA irq remapping */
272 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
274 /* Real-time clock */
277 Name (_HID, EisaId ("PNP0B00"))
278 Name (_CRS, ResourceTemplate ()
280 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
282 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
286 /* Keyboard seems to be important for WinXP install */
289 Name (_HID, EisaId ("PNP0303"))
290 Method (_STA, 0, NotSerialized)
295 Method (_CRS, 0, NotSerialized)
297 Name (TMP, ResourceTemplate ()
300 0x0060, // Address Range Minimum
301 0x0060, // Address Range Maximum
302 0x01, // Address Alignment
303 0x01, // Address Length
306 0x0064, // Address Range Minimum
307 0x0064, // Address Range Maximum
308 0x01, // Address Alignment
309 0x01, // Address Length
321 Name (_HID, EisaId ("PNP0F13"))
322 Method (_STA, 0, NotSerialized)
327 Method (_CRS, 0, NotSerialized)
329 Name (TMP, ResourceTemplate ()
337 /* PS/2 floppy controller */
340 Name (_HID, EisaId ("PNP0700"))
341 Method (_STA, 0, NotSerialized)
345 Method (_CRS, 0, NotSerialized)
347 Name (BUF0, ResourceTemplate ()
349 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
350 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
352 DMA (Compatibility, NotBusMaster, Transfer8) {2}
361 Name (_HID, EisaId ("PNP0400"))
362 Method (_STA, 0, NotSerialized)
364 Store (\_SB.PCI0.PX13.DRSA, Local0)
365 And (Local0, 0x80000000, Local0)
366 If (LEqual (Local0, 0))
375 Method (_CRS, 0, NotSerialized)
377 Name (BUF0, ResourceTemplate ()
379 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
389 Name (_HID, EisaId ("PNP0501"))
391 Method (_STA, 0, NotSerialized)
393 Store (\_SB.PCI0.PX13.DRSC, Local0)
394 And (Local0, 0x08000000, Local0)
395 If (LEqual (Local0, 0))
404 Method (_CRS, 0, NotSerialized)
406 Name (BUF0, ResourceTemplate ()
408 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
417 Name (_HID, EisaId ("PNP0501"))
419 Method (_STA, 0, NotSerialized)
421 Store (\_SB.PCI0.PX13.DRSC, Local0)
422 And (Local0, 0x80000000, Local0)
423 If (LEqual (Local0, 0))
432 Method (_CRS, 0, NotSerialized)
434 Name (BUF0, ResourceTemplate ()
436 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
446 Name (_ADR, 0x00010003)
448 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
449 Field (P13C, DWordAcc, NoLock, Preserve)
463 #define gen_pci_device(name, nr) \
465 Name (_ADR, nr##0000) \
467 If (And(\_SB.PCI0.PCRM, ShiftLeft(1, nr))) { \
475 /* VGA (slot 1) and ISA bus (slot 2) defined above */
476 gen_pci_device(3, 0x0003)
477 gen_pci_device(4, 0x0004)
478 gen_pci_device(5, 0x0005)
479 gen_pci_device(6, 0x0006)
480 gen_pci_device(7, 0x0007)
481 gen_pci_device(8, 0x0008)
482 gen_pci_device(9, 0x0009)
483 gen_pci_device(10, 0x000a)
484 gen_pci_device(11, 0x000b)
485 gen_pci_device(12, 0x000c)
486 gen_pci_device(13, 0x000d)
487 gen_pci_device(14, 0x000e)
488 gen_pci_device(15, 0x000f)
489 gen_pci_device(16, 0x0010)
490 gen_pci_device(17, 0x0011)
491 gen_pci_device(18, 0x0012)
492 gen_pci_device(19, 0x0013)
493 gen_pci_device(20, 0x0014)
494 gen_pci_device(21, 0x0015)
495 gen_pci_device(22, 0x0016)
496 gen_pci_device(23, 0x0017)
497 gen_pci_device(24, 0x0018)
498 gen_pci_device(25, 0x0019)
499 gen_pci_device(26, 0x001a)
500 gen_pci_device(27, 0x001b)
501 gen_pci_device(28, 0x001c)
502 gen_pci_device(29, 0x001d)
503 gen_pci_device(30, 0x001e)
504 gen_pci_device(31, 0x001f)
509 Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
518 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
520 Name(_PRS, ResourceTemplate(){
521 Interrupt (, Level, ActiveHigh, Shared)
524 Method (_STA, 0, NotSerialized)
527 If (And (0x80, PRQ0, Local1))
533 Method (_DIS, 0, NotSerialized)
535 Or (PRQ0, 0x80, PRQ0)
537 Method (_CRS, 0, NotSerialized)
539 Name (PRR0, ResourceTemplate ()
541 Interrupt (, Level, ActiveHigh, Shared)
544 CreateDWordField (PRR0, 0x05, TMP)
546 If (LLess (Local0, 0x80))
556 Method (_SRS, 1, NotSerialized)
558 CreateDWordField (Arg0, 0x05, TMP)
563 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
565 Name(_PRS, ResourceTemplate(){
566 Interrupt (, Level, ActiveHigh, Shared)
569 Method (_STA, 0, NotSerialized)
572 If (And (0x80, PRQ1, Local1))
578 Method (_DIS, 0, NotSerialized)
580 Or (PRQ1, 0x80, PRQ1)
582 Method (_CRS, 0, NotSerialized)
584 Name (PRR0, ResourceTemplate ()
586 Interrupt (, Level, ActiveHigh, Shared)
589 CreateDWordField (PRR0, 0x05, TMP)
591 If (LLess (Local0, 0x80))
601 Method (_SRS, 1, NotSerialized)
603 CreateDWordField (Arg0, 0x05, TMP)
608 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
610 Name(_PRS, ResourceTemplate(){
611 Interrupt (, Level, ActiveHigh, Shared)
614 Method (_STA, 0, NotSerialized)
617 If (And (0x80, PRQ2, Local1))
623 Method (_DIS, 0, NotSerialized)
625 Or (PRQ2, 0x80, PRQ2)
627 Method (_CRS, 0, NotSerialized)
629 Name (PRR0, ResourceTemplate ()
631 Interrupt (, Level, ActiveHigh, Shared)
634 CreateDWordField (PRR0, 0x05, TMP)
636 If (LLess (Local0, 0x80))
646 Method (_SRS, 1, NotSerialized)
648 CreateDWordField (Arg0, 0x05, TMP)
653 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
655 Name(_PRS, ResourceTemplate(){
656 Interrupt (, Level, ActiveHigh, Shared)
659 Method (_STA, 0, NotSerialized)
662 If (And (0x80, PRQ3, Local1))
668 Method (_DIS, 0, NotSerialized)
670 Or (PRQ3, 0x80, PRQ3)
672 Method (_CRS, 0, NotSerialized)
674 Name (PRR0, ResourceTemplate ()
676 Interrupt (, Level, ActiveHigh, Shared)
679 CreateDWordField (PRR0, 0x05, TMP)
681 If (LLess (Local0, 0x80))
691 Method (_SRS, 1, NotSerialized)
693 CreateDWordField (Arg0, 0x05, TMP)
698 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
700 Name(_PRS, ResourceTemplate(){
701 Interrupt (, Level, ActiveHigh, Shared)
704 Method (_STA, 0, NotSerialized)
707 If (And (0x80, PRQ0, Local1))
713 Method (_DIS, 0, NotSerialized)
715 Or (PRQ0, 0x80, PRQ0)
717 Method (_CRS, 0, NotSerialized)
719 Name (PRR0, ResourceTemplate ()
721 Interrupt (, Level, ActiveHigh, Shared)
724 CreateDWordField (PRR0, 0x05, TMP)
726 If (LLess (Local0, 0x80))
740 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
741 * must match piix4 emulation.
743 Name (\_S3, Package (0x04)
745 0x01, /* PM1a_CNT.SLP_TYP */
746 0x01, /* PM1b_CNT.SLP_TYP */
750 Name (\_S4, Package (0x04)
752 Zero, /* PM1a_CNT.SLP_TYP */
753 Zero, /* PM1b_CNT.SLP_TYP */
757 Name (\_S5, Package (0x04)
759 Zero, /* PM1a_CNT.SLP_TYP */
760 Zero, /* PM1b_CNT.SLP_TYP */
767 /* Objects filled in by run-time generated SSDT */
768 External(NTFY, MethodObj)
769 External(CPON, PkgObj)
771 /* Methods called by run-time generated SSDT Processor objects */
772 Method (CPMA, 1, NotSerialized) {
773 // _MAT method - create an madt apic buffer
774 // Local0 = CPON flag for this cpu
775 Store(DerefOf(Index(CPON, Arg0)), Local0)
776 // Local1 = Buffer (in madt apic form) to return
777 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
778 // Update the processor id, lapic id, and enable/disable status
779 Store(Arg0, Index(Local1, 2))
780 Store(Arg0, Index(Local1, 3))
781 Store(Local0, Index(Local1, 4))
784 Method (CPST, 1, NotSerialized) {
785 // _STA method - return ON status of cpu
786 // Local0 = CPON flag for this cpu
787 Store(DerefOf(Index(CPON, Arg0)), Local0)
788 If (Local0) { Return(0xF) } Else { Return(0x0) }
790 Method (CPEJ, 2, NotSerialized) {
791 // _EJ0 method - eject callback
795 /* CPU hotplug notify method */
796 OperationRegion(PRST, SystemIO, 0xaf00, 32)
797 Field (PRST, ByteAcc, NoLock, Preserve)
802 // Local5 = active cpu bitmap
804 // Local2 = last read byte from bitmap
806 // Local0 = cpuid iterator
808 While (LLess(Local0, SizeOf(CPON))) {
809 // Local1 = CPON flag for this cpu
810 Store(DerefOf(Index(CPON, Local0)), Local1)
811 If (And(Local0, 0x07)) {
812 // Shift down previously read bitmap byte
813 ShiftRight(Local2, 1, Local2)
815 // Read next byte from cpu bitmap
816 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
818 // Local3 = active state for this cpu
819 Store(And(Local2, 1), Local3)
821 If (LNotEqual(Local1, Local3)) {
822 // State change - update CPON with new state
823 Store(Local3, Index(CPON, Local0))
825 If (LEqual(Local3, 1)) {
839 Name(_HID, "ACPI0006")
845 #define gen_pci_hotplug(nr) \
846 If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
847 Notify(\_SB.PCI0.S##nr, 1) \
849 If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
850 Notify(\_SB.PCI0.S##nr, 3) \