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 OperationRegion(RMVC, SystemIO, 0xae0c, 0x04)
136 Field(RMVC, DWordAcc, NoLock, WriteAsZeros)
141 Name (_CRS, ResourceTemplate ()
143 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
144 0x0000, // Address Space Granularity
145 0x0000, // Address Range Minimum
146 0x00FF, // Address Range Maximum
147 0x0000, // Address Translation Offset
148 0x0100, // Address Length
151 0x0CF8, // Address Range Minimum
152 0x0CF8, // Address Range Maximum
153 0x01, // Address Alignment
154 0x08, // Address Length
156 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
157 0x0000, // Address Space Granularity
158 0x0000, // Address Range Minimum
159 0x0CF7, // Address Range Maximum
160 0x0000, // Address Translation Offset
161 0x0CF8, // Address Length
163 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
164 0x0000, // Address Space Granularity
165 0x0D00, // Address Range Minimum
166 0xFFFF, // Address Range Maximum
167 0x0000, // Address Translation Offset
168 0xF300, // Address Length
170 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
171 0x00000000, // Address Space Granularity
172 0x000A0000, // Address Range Minimum
173 0x000BFFFF, // Address Range Maximum
174 0x00000000, // Address Translation Offset
175 0x00020000, // Address Length
176 ,, , AddressRangeMemory, TypeStatic)
177 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
178 0x00000000, // Address Space Granularity
179 0xE0000000, // Address Range Minimum
180 0xFEBFFFFF, // Address Range Maximum
181 0x00000000, // Address Translation Offset
182 0x1EC00000, // Address Length
183 ,, , AddressRangeMemory, TypeStatic)
189 /****************************************************************
191 ****************************************************************/
195 Name(_HID, EISAID("PNP0103"))
197 Method (_STA, 0, NotSerialized) {
200 Name(_CRS, ResourceTemplate() {
202 ResourceConsumer, PosDecode, MinFixed, MaxFixed,
203 NonCacheable, ReadWrite,
208 0x00000400 /* 1K memory: FED00000 - FED003FF */
215 /****************************************************************
217 ****************************************************************/
221 Name (_ADR, 0x00020000)
222 OperationRegion(PCIC, PCI_Config, Zero, 0x4)
223 Field(PCIC, DWordAcc, NoLock, Preserve) {
226 Method (_S1D, 0, NotSerialized)
230 Method (_S2D, 0, NotSerialized)
234 Method (_S3D, 0, NotSerialized)
236 If (LEqual(VEND, 0x1001b36)) {
242 Method(_RMV) { Return (0x00) }
247 /****************************************************************
249 ****************************************************************/
253 Name (_ADR, 0x00010000)
254 Method(_RMV) { Return (0x00) }
256 /* PIIX PCI to ISA irq remapping */
257 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
262 /****************************************************************
263 * SuperIO devices (kbd, mouse, etc.)
264 ****************************************************************/
266 Scope(\_SB.PCI0.ISA) {
267 /* Real-time clock */
270 Name (_HID, EisaId ("PNP0B00"))
271 Name (_CRS, ResourceTemplate ()
273 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
275 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
279 /* Keyboard seems to be important for WinXP install */
282 Name (_HID, EisaId ("PNP0303"))
283 Method (_STA, 0, NotSerialized)
288 Method (_CRS, 0, NotSerialized)
290 Name (TMP, ResourceTemplate ()
293 0x0060, // Address Range Minimum
294 0x0060, // Address Range Maximum
295 0x01, // Address Alignment
296 0x01, // Address Length
299 0x0064, // Address Range Minimum
300 0x0064, // Address Range Maximum
301 0x01, // Address Alignment
302 0x01, // Address Length
314 Name (_HID, EisaId ("PNP0F13"))
315 Method (_STA, 0, NotSerialized)
320 Method (_CRS, 0, NotSerialized)
322 Name (TMP, ResourceTemplate ()
330 /* PS/2 floppy controller */
333 Name (_HID, EisaId ("PNP0700"))
334 Method (_STA, 0, NotSerialized)
338 Method (_CRS, 0, NotSerialized)
340 Name (BUF0, ResourceTemplate ()
342 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
343 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
345 DMA (Compatibility, NotBusMaster, Transfer8) {2}
354 Name (_HID, EisaId ("PNP0400"))
355 Method (_STA, 0, NotSerialized)
357 Store (\_SB.PCI0.PX13.DRSA, Local0)
358 And (Local0, 0x80000000, Local0)
359 If (LEqual (Local0, 0))
368 Method (_CRS, 0, NotSerialized)
370 Name (BUF0, ResourceTemplate ()
372 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
382 Name (_HID, EisaId ("PNP0501"))
384 Method (_STA, 0, NotSerialized)
386 Store (\_SB.PCI0.PX13.DRSC, Local0)
387 And (Local0, 0x08000000, Local0)
388 If (LEqual (Local0, 0))
397 Method (_CRS, 0, NotSerialized)
399 Name (BUF0, ResourceTemplate ()
401 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
410 Name (_HID, EisaId ("PNP0501"))
412 Method (_STA, 0, NotSerialized)
414 Store (\_SB.PCI0.PX13.DRSC, Local0)
415 And (Local0, 0x80000000, Local0)
416 If (LEqual (Local0, 0))
425 Method (_CRS, 0, NotSerialized)
427 Name (BUF0, ResourceTemplate ()
429 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
438 /****************************************************************
440 ****************************************************************/
444 Name (_ADR, 0x00010003)
446 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
447 Field (P13C, DWordAcc, NoLock, Preserve)
463 /****************************************************************
465 ****************************************************************/
468 /* Methods called by bulk generated PCI devices below */
469 Method (PRMV, 1, NotSerialized) {
470 // _RMV method - check if device can be removed
471 If (And(\_SB.PCI0.PCRM, ShiftLeft(1, Arg0))) {
477 #define gen_pci_device(slot) \
479 Name (_ADR, 0x##slot##0000) \
480 Method (_RMV) { Return (PRMV(0x##slot)) } \
481 Name (_SUN, 0x##slot) \
484 /* VGA (slot 1) and ISA bus (slot 2) defined above */
515 /* Methods called by bulk generated hotplug devices below */
516 Method (PCEJ, 1, NotSerialized) {
517 // _EJ0 method - eject callback
518 Store(ShiftLeft(1, Arg0), B0EJ)
522 /* Bulk generated PCI hotplug devices */
523 #define hotplug_slot(slot) \
525 Name (_ADR, 0x##slot##0000) \
526 Method (_EJ0, 1) { Return(PCEJ(0x##slot)) } \
527 Name (_SUN, 0x##slot) \
562 /* PCI hotplug notify method */
566 While (LLess(Local0, 31)) {
568 If (And(PCIU, ShiftLeft(1, Local0))) {
571 If (And(PCID, ShiftLeft(1, Local0))) {
578 #define gen_pci_hotplug(slot) \
579 If (LEqual(Arg0, 0x##slot)) { Notify(S##slot, Arg1) }
617 /****************************************************************
619 ****************************************************************/
622 Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
630 Method (IQST, 1, NotSerialized) {
631 // _STA method - get status
632 If (And (0x80, Arg0)) {
637 Method (IQDI, 1, NotSerialized) {
638 // _DIS method - disable interrupt
639 Or(DerefOf(Arg0), 0x80, Arg0)
641 Method (IQCR, 1, NotSerialized) {
642 // _CRS method - get current settings
643 Name (PRR0, ResourceTemplate ()
645 Interrupt (, Level, ActiveHigh, Shared)
648 CreateDWordField (PRR0, 0x05, PRRI)
649 If (LLess (Arg0, 0x80)) {
654 Method (IQSR, 2, NotSerialized) {
655 // _SRS method - set interrupt
656 CreateDWordField (Arg1, 0x05, PRRI)
661 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
663 Name(_PRS, ResourceTemplate(){
664 Interrupt (, Level, ActiveHigh, Shared)
667 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
668 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
669 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
670 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ0), Arg0) }
673 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
675 Name(_PRS, ResourceTemplate(){
676 Interrupt (, Level, ActiveHigh, Shared)
679 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) }
680 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ1)) }
681 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) }
682 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ1), Arg0) }
685 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
687 Name(_PRS, ResourceTemplate() {
688 Interrupt (, Level, ActiveHigh, Shared)
691 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) }
692 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ2)) }
693 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) }
694 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ2), Arg0) }
697 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
699 Name(_PRS, ResourceTemplate() {
700 Interrupt (, Level, ActiveHigh, Shared)
703 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) }
704 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ3)) }
705 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) }
706 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ3), Arg0) }
709 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
711 Name(_PRS, ResourceTemplate() {
712 Interrupt (, Level, ActiveHigh, Shared)
715 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
716 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
717 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
722 /****************************************************************
724 ****************************************************************/
727 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
728 * must match piix4 emulation.
730 Name (\_S3, Package (0x04)
732 0x01, /* PM1a_CNT.SLP_TYP */
733 0x01, /* PM1b_CNT.SLP_TYP */
737 Name (\_S4, Package (0x04)
739 Zero, /* PM1a_CNT.SLP_TYP */
740 Zero, /* PM1b_CNT.SLP_TYP */
744 Name (\_S5, Package (0x04)
746 Zero, /* PM1a_CNT.SLP_TYP */
747 Zero, /* PM1b_CNT.SLP_TYP */
753 /****************************************************************
755 ****************************************************************/
758 /* Objects filled in by run-time generated SSDT */
759 External(NTFY, MethodObj)
760 External(CPON, PkgObj)
762 /* Methods called by run-time generated SSDT Processor objects */
763 Method (CPMA, 1, NotSerialized) {
764 // _MAT method - create an madt apic buffer
765 // Local0 = CPON flag for this cpu
766 Store(DerefOf(Index(CPON, Arg0)), Local0)
767 // Local1 = Buffer (in madt apic form) to return
768 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
769 // Update the processor id, lapic id, and enable/disable status
770 Store(Arg0, Index(Local1, 2))
771 Store(Arg0, Index(Local1, 3))
772 Store(Local0, Index(Local1, 4))
775 Method (CPST, 1, NotSerialized) {
776 // _STA method - return ON status of cpu
777 // Local0 = CPON flag for this cpu
778 Store(DerefOf(Index(CPON, Arg0)), Local0)
779 If (Local0) { Return(0xF) } Else { Return(0x0) }
781 Method (CPEJ, 2, NotSerialized) {
782 // _EJ0 method - eject callback
786 /* CPU hotplug notify method */
787 OperationRegion(PRST, SystemIO, 0xaf00, 32)
788 Field (PRST, ByteAcc, NoLock, Preserve)
793 // Local5 = active cpu bitmap
795 // Local2 = last read byte from bitmap
797 // Local0 = cpuid iterator
799 While (LLess(Local0, SizeOf(CPON))) {
800 // Local1 = CPON flag for this cpu
801 Store(DerefOf(Index(CPON, Local0)), Local1)
802 If (And(Local0, 0x07)) {
803 // Shift down previously read bitmap byte
804 ShiftRight(Local2, 1, Local2)
806 // Read next byte from cpu bitmap
807 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
809 // Local3 = active state for this cpu
810 Store(And(Local2, 1), Local3)
812 If (LNotEqual(Local1, Local3)) {
813 // State change - update CPON with new state
814 Store(Local3, Index(CPON, Local0))
816 If (LEqual(Local3, 1)) {
829 /****************************************************************
830 * General purpose events
831 ****************************************************************/
835 Name(_HID, "ACPI0006")
842 Return(\_SB.PCI0.PCNF())