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 Method (_S1D, 0, NotSerialized)
246 Method (_S2D, 0, NotSerialized)
250 Method (_S3D, 0, NotSerialized)
254 Method(_RMV) { Return (0x00) }
257 /* PIIX3 ISA bridge */
259 Name (_ADR, 0x00010000)
260 Method(_RMV) { Return (0x00) }
263 /* PIIX PCI to ISA irq remapping */
264 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
266 /* Real-time clock */
269 Name (_HID, EisaId ("PNP0B00"))
270 Name (_CRS, ResourceTemplate ()
272 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
274 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
278 /* Keyboard seems to be important for WinXP install */
281 Name (_HID, EisaId ("PNP0303"))
282 Method (_STA, 0, NotSerialized)
287 Method (_CRS, 0, NotSerialized)
289 Name (TMP, ResourceTemplate ()
292 0x0060, // Address Range Minimum
293 0x0060, // Address Range Maximum
294 0x01, // Address Alignment
295 0x01, // Address Length
298 0x0064, // Address Range Minimum
299 0x0064, // Address Range Maximum
300 0x01, // Address Alignment
301 0x01, // Address Length
313 Name (_HID, EisaId ("PNP0F13"))
314 Method (_STA, 0, NotSerialized)
319 Method (_CRS, 0, NotSerialized)
321 Name (TMP, ResourceTemplate ()
329 /* PS/2 floppy controller */
332 Name (_HID, EisaId ("PNP0700"))
333 Method (_STA, 0, NotSerialized)
337 Method (_CRS, 0, NotSerialized)
339 Name (BUF0, ResourceTemplate ()
341 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
342 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
344 DMA (Compatibility, NotBusMaster, Transfer8) {2}
353 Name (_HID, EisaId ("PNP0400"))
354 Method (_STA, 0, NotSerialized)
356 Store (\_SB.PCI0.PX13.DRSA, Local0)
357 And (Local0, 0x80000000, Local0)
358 If (LEqual (Local0, 0))
367 Method (_CRS, 0, NotSerialized)
369 Name (BUF0, ResourceTemplate ()
371 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
381 Name (_HID, EisaId ("PNP0501"))
383 Method (_STA, 0, NotSerialized)
385 Store (\_SB.PCI0.PX13.DRSC, Local0)
386 And (Local0, 0x08000000, Local0)
387 If (LEqual (Local0, 0))
396 Method (_CRS, 0, NotSerialized)
398 Name (BUF0, ResourceTemplate ()
400 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
409 Name (_HID, EisaId ("PNP0501"))
411 Method (_STA, 0, NotSerialized)
413 Store (\_SB.PCI0.PX13.DRSC, Local0)
414 And (Local0, 0x80000000, Local0)
415 If (LEqual (Local0, 0))
424 Method (_CRS, 0, NotSerialized)
426 Name (BUF0, ResourceTemplate ()
428 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
438 Name (_ADR, 0x00010003)
440 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
441 Field (P13C, DWordAcc, NoLock, Preserve)
455 #define gen_pci_device(name, nr) \
457 Name (_ADR, nr##0000) \
459 If (And(\_SB.PCI0.PCRM, ShiftLeft(1, nr))) { \
467 /* VGA (slot 1) and ISA bus (slot 2) defined above */
468 gen_pci_device(3, 0x0003)
469 gen_pci_device(4, 0x0004)
470 gen_pci_device(5, 0x0005)
471 gen_pci_device(6, 0x0006)
472 gen_pci_device(7, 0x0007)
473 gen_pci_device(8, 0x0008)
474 gen_pci_device(9, 0x0009)
475 gen_pci_device(10, 0x000a)
476 gen_pci_device(11, 0x000b)
477 gen_pci_device(12, 0x000c)
478 gen_pci_device(13, 0x000d)
479 gen_pci_device(14, 0x000e)
480 gen_pci_device(15, 0x000f)
481 gen_pci_device(16, 0x0010)
482 gen_pci_device(17, 0x0011)
483 gen_pci_device(18, 0x0012)
484 gen_pci_device(19, 0x0013)
485 gen_pci_device(20, 0x0014)
486 gen_pci_device(21, 0x0015)
487 gen_pci_device(22, 0x0016)
488 gen_pci_device(23, 0x0017)
489 gen_pci_device(24, 0x0018)
490 gen_pci_device(25, 0x0019)
491 gen_pci_device(26, 0x001a)
492 gen_pci_device(27, 0x001b)
493 gen_pci_device(28, 0x001c)
494 gen_pci_device(29, 0x001d)
495 gen_pci_device(30, 0x001e)
496 gen_pci_device(31, 0x001f)
501 Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
510 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
512 Name(_PRS, ResourceTemplate(){
513 Interrupt (, Level, ActiveHigh, Shared)
516 Method (_STA, 0, NotSerialized)
519 If (And (0x80, PRQ0, Local1))
525 Method (_DIS, 0, NotSerialized)
527 Or (PRQ0, 0x80, PRQ0)
529 Method (_CRS, 0, NotSerialized)
531 Name (PRR0, ResourceTemplate ()
533 Interrupt (, Level, ActiveHigh, Shared)
536 CreateDWordField (PRR0, 0x05, TMP)
538 If (LLess (Local0, 0x80))
548 Method (_SRS, 1, NotSerialized)
550 CreateDWordField (Arg0, 0x05, TMP)
555 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
557 Name(_PRS, ResourceTemplate(){
558 Interrupt (, Level, ActiveHigh, Shared)
561 Method (_STA, 0, NotSerialized)
564 If (And (0x80, PRQ1, Local1))
570 Method (_DIS, 0, NotSerialized)
572 Or (PRQ1, 0x80, PRQ1)
574 Method (_CRS, 0, NotSerialized)
576 Name (PRR0, ResourceTemplate ()
578 Interrupt (, Level, ActiveHigh, Shared)
581 CreateDWordField (PRR0, 0x05, TMP)
583 If (LLess (Local0, 0x80))
593 Method (_SRS, 1, NotSerialized)
595 CreateDWordField (Arg0, 0x05, TMP)
600 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
602 Name(_PRS, ResourceTemplate(){
603 Interrupt (, Level, ActiveHigh, Shared)
606 Method (_STA, 0, NotSerialized)
609 If (And (0x80, PRQ2, Local1))
615 Method (_DIS, 0, NotSerialized)
617 Or (PRQ2, 0x80, PRQ2)
619 Method (_CRS, 0, NotSerialized)
621 Name (PRR0, ResourceTemplate ()
623 Interrupt (, Level, ActiveHigh, Shared)
626 CreateDWordField (PRR0, 0x05, TMP)
628 If (LLess (Local0, 0x80))
638 Method (_SRS, 1, NotSerialized)
640 CreateDWordField (Arg0, 0x05, TMP)
645 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
647 Name(_PRS, ResourceTemplate(){
648 Interrupt (, Level, ActiveHigh, Shared)
651 Method (_STA, 0, NotSerialized)
654 If (And (0x80, PRQ3, Local1))
660 Method (_DIS, 0, NotSerialized)
662 Or (PRQ3, 0x80, PRQ3)
664 Method (_CRS, 0, NotSerialized)
666 Name (PRR0, ResourceTemplate ()
668 Interrupt (, Level, ActiveHigh, Shared)
671 CreateDWordField (PRR0, 0x05, TMP)
673 If (LLess (Local0, 0x80))
683 Method (_SRS, 1, NotSerialized)
685 CreateDWordField (Arg0, 0x05, TMP)
690 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
692 Name(_PRS, ResourceTemplate(){
693 Interrupt (, Level, ActiveHigh, Shared)
696 Method (_STA, 0, NotSerialized)
699 If (And (0x80, PRQ0, Local1))
705 Method (_DIS, 0, NotSerialized)
707 Or (PRQ0, 0x80, PRQ0)
709 Method (_CRS, 0, NotSerialized)
711 Name (PRR0, ResourceTemplate ()
713 Interrupt (, Level, ActiveHigh, Shared)
716 CreateDWordField (PRR0, 0x05, TMP)
718 If (LLess (Local0, 0x80))
732 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
733 * must match piix4 emulation.
735 Name (\_S3, Package (0x04)
737 0x01, /* PM1a_CNT.SLP_TYP */
738 0x01, /* PM1b_CNT.SLP_TYP */
742 Name (\_S4, Package (0x04)
744 Zero, /* PM1a_CNT.SLP_TYP */
745 Zero, /* PM1b_CNT.SLP_TYP */
749 Name (\_S5, Package (0x04)
751 Zero, /* PM1a_CNT.SLP_TYP */
752 Zero, /* PM1b_CNT.SLP_TYP */
759 /* Objects filled in by run-time generated SSDT */
760 External(NTFY, MethodObj)
761 External(CPON, PkgObj)
763 /* Methods called by run-time generated SSDT Processor objects */
764 Method (CPMA, 1, NotSerialized) {
765 // _MAT method - create an madt apic buffer
766 // Local0 = CPON flag for this cpu
767 Store(DerefOf(Index(CPON, Arg0)), Local0)
768 // Local1 = Buffer (in madt apic form) to return
769 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
770 // Update the processor id, lapic id, and enable/disable status
771 Store(Arg0, Index(Local1, 2))
772 Store(Arg0, Index(Local1, 3))
773 Store(Local0, Index(Local1, 4))
776 Method (CPST, 1, NotSerialized) {
777 // _STA method - return ON status of cpu
778 // Local0 = CPON flag for this cpu
779 Store(DerefOf(Index(CPON, Arg0)), Local0)
780 If (Local0) { Return(0xF) } Else { Return(0x0) }
782 Method (CPEJ, 2, NotSerialized) {
783 // _EJ0 method - eject callback
787 /* CPU hotplug notify method */
788 OperationRegion(PRST, SystemIO, 0xaf00, 32)
789 Field (PRST, ByteAcc, NoLock, Preserve)
794 // Local5 = active cpu bitmap
796 // Local2 = last read byte from bitmap
798 // Local0 = cpuid iterator
800 While (LLess(Local0, SizeOf(CPON))) {
801 // Local1 = CPON flag for this cpu
802 Store(DerefOf(Index(CPON, Local0)), Local1)
803 If (And(Local0, 0x07)) {
804 // Shift down previously read bitmap byte
805 ShiftRight(Local2, 1, Local2)
807 // Read next byte from cpu bitmap
808 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
810 // Local3 = active state for this cpu
811 Store(And(Local2, 1), Local3)
813 If (LNotEqual(Local1, Local3)) {
814 // State change - update CPON with new state
815 Store(Local3, Index(CPON, Local0))
817 If (LEqual(Local3, 1)) {
831 Name(_HID, "ACPI0006")
837 #define gen_pci_hotplug(nr) \
838 If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
839 Notify(\_SB.PCI0.S##nr, 1) \
841 If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
842 Notify(\_SB.PCI0.S##nr, 3) \