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
30 /****************************************************************
32 ****************************************************************/
37 OperationRegion (DBG, SystemIO, 0x0402, 0x01)
38 Field (DBG, ByteAcc, NoLock, Preserve)
43 /* Debug method - use this method to send output to the QEMU
44 * BIOS debug port. This method handles strings, integers,
45 * and buffers. For example: DBUG("abc") DBUG(0x123) */
47 ToHexString(Arg0, Local0)
48 ToBuffer(Local0, Local0)
49 Subtract(SizeOf(Local0), 1, Local1)
51 While (LLess(Local2, Local1)) {
52 Store(DerefOf(Index(Local0, Local2)), DBGB)
60 /****************************************************************
62 ****************************************************************/
66 Name (_HID, EisaId ("PNP0A03"))
69 Name(_PRT, Package() {
70 /* PCI IRQ routing table, example from ACPI 2.0a specification,
72 /* Note: we provide the same info as the PCI routing
73 table of the Bochs BIOS */
74 #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
75 Package() { nr##ffff, 0, lnk0, 0 }, \
76 Package() { nr##ffff, 1, lnk1, 0 }, \
77 Package() { nr##ffff, 2, lnk2, 0 }, \
78 Package() { nr##ffff, 3, lnk3, 0 }
80 #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
81 #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
82 #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
83 #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
85 /* Device 1 is power mgmt device, and can only use irq 9 */
86 Package() { 0x0001ffff, 0, LNKS, 0 },
87 Package() { 0x0001ffff, 1, LNKB, 0 },
88 Package() { 0x0001ffff, 2, LNKC, 0 },
89 Package() { 0x0001ffff, 3, LNKD, 0 },
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 ****************************************************************/
469 #define gen_pci_device(slot) \
471 Name (_ADR, 0x##slot##0000) \
473 If (And(\_SB.PCI0.PCRM, ShiftLeft(1, 0x##slot))) { \
478 Name (_SUN, 0x##slot) \
481 /* VGA (slot 1) and ISA bus (slot 2) defined above */
512 #define hotplug_slot(slot) \
514 Name (_ADR, 0x##slot##0000) \
516 Store(ShiftLeft(1, 0x##slot), B0EJ) \
519 Name (_SUN, 0x##slot) \
554 #define gen_pci_hotplug(slot) \
555 If (And(\_SB.PCI0.PCIU, ShiftLeft(1, 0x##slot))) { \
556 Notify(\_SB.PCI0.S##slot, 1) \
558 If (And(\_SB.PCI0.PCID, ShiftLeft(1, 0x##slot))) { \
559 Notify(\_SB.PCI0.S##slot, 3) \
562 /* PCI hotplug notify method */
601 /****************************************************************
603 ****************************************************************/
606 Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
615 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
617 Name(_PRS, ResourceTemplate(){
618 Interrupt (, Level, ActiveHigh, Shared)
621 Method (_STA, 0, NotSerialized)
624 If (And (0x80, PRQ0, Local1))
630 Method (_DIS, 0, NotSerialized)
632 Or (PRQ0, 0x80, PRQ0)
634 Method (_CRS, 0, NotSerialized)
636 Name (PRR0, ResourceTemplate ()
638 Interrupt (, Level, ActiveHigh, Shared)
641 CreateDWordField (PRR0, 0x05, TMP)
643 If (LLess (Local0, 0x80))
653 Method (_SRS, 1, NotSerialized)
655 CreateDWordField (Arg0, 0x05, TMP)
660 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
662 Name(_PRS, ResourceTemplate(){
663 Interrupt (, Level, ActiveHigh, Shared)
666 Method (_STA, 0, NotSerialized)
669 If (And (0x80, PRQ1, Local1))
675 Method (_DIS, 0, NotSerialized)
677 Or (PRQ1, 0x80, PRQ1)
679 Method (_CRS, 0, NotSerialized)
681 Name (PRR0, ResourceTemplate ()
683 Interrupt (, Level, ActiveHigh, Shared)
686 CreateDWordField (PRR0, 0x05, TMP)
688 If (LLess (Local0, 0x80))
698 Method (_SRS, 1, NotSerialized)
700 CreateDWordField (Arg0, 0x05, TMP)
705 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
707 Name(_PRS, ResourceTemplate(){
708 Interrupt (, Level, ActiveHigh, Shared)
711 Method (_STA, 0, NotSerialized)
714 If (And (0x80, PRQ2, Local1))
720 Method (_DIS, 0, NotSerialized)
722 Or (PRQ2, 0x80, PRQ2)
724 Method (_CRS, 0, NotSerialized)
726 Name (PRR0, ResourceTemplate ()
728 Interrupt (, Level, ActiveHigh, Shared)
731 CreateDWordField (PRR0, 0x05, TMP)
733 If (LLess (Local0, 0x80))
743 Method (_SRS, 1, NotSerialized)
745 CreateDWordField (Arg0, 0x05, TMP)
750 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
752 Name(_PRS, ResourceTemplate(){
753 Interrupt (, Level, ActiveHigh, Shared)
756 Method (_STA, 0, NotSerialized)
759 If (And (0x80, PRQ3, Local1))
765 Method (_DIS, 0, NotSerialized)
767 Or (PRQ3, 0x80, PRQ3)
769 Method (_CRS, 0, NotSerialized)
771 Name (PRR0, ResourceTemplate ()
773 Interrupt (, Level, ActiveHigh, Shared)
776 CreateDWordField (PRR0, 0x05, TMP)
778 If (LLess (Local0, 0x80))
788 Method (_SRS, 1, NotSerialized)
790 CreateDWordField (Arg0, 0x05, TMP)
795 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
797 Name(_PRS, ResourceTemplate(){
798 Interrupt (, Level, ActiveHigh, Shared)
801 Method (_STA, 0, NotSerialized)
804 If (And (0x80, PRQ0, Local1))
810 Method (_DIS, 0, NotSerialized)
812 Or (PRQ0, 0x80, PRQ0)
814 Method (_CRS, 0, NotSerialized)
816 Name (PRR0, ResourceTemplate ()
818 Interrupt (, Level, ActiveHigh, Shared)
821 CreateDWordField (PRR0, 0x05, TMP)
823 If (LLess (Local0, 0x80))
837 /****************************************************************
839 ****************************************************************/
842 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
843 * must match piix4 emulation.
845 Name (\_S3, Package (0x04)
847 0x01, /* PM1a_CNT.SLP_TYP */
848 0x01, /* PM1b_CNT.SLP_TYP */
852 Name (\_S4, Package (0x04)
854 Zero, /* PM1a_CNT.SLP_TYP */
855 Zero, /* PM1b_CNT.SLP_TYP */
859 Name (\_S5, Package (0x04)
861 Zero, /* PM1a_CNT.SLP_TYP */
862 Zero, /* PM1b_CNT.SLP_TYP */
868 /****************************************************************
870 ****************************************************************/
873 /* Objects filled in by run-time generated SSDT */
874 External(NTFY, MethodObj)
875 External(CPON, PkgObj)
877 /* Methods called by run-time generated SSDT Processor objects */
878 Method (CPMA, 1, NotSerialized) {
879 // _MAT method - create an madt apic buffer
880 // Local0 = CPON flag for this cpu
881 Store(DerefOf(Index(CPON, Arg0)), Local0)
882 // Local1 = Buffer (in madt apic form) to return
883 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
884 // Update the processor id, lapic id, and enable/disable status
885 Store(Arg0, Index(Local1, 2))
886 Store(Arg0, Index(Local1, 3))
887 Store(Local0, Index(Local1, 4))
890 Method (CPST, 1, NotSerialized) {
891 // _STA method - return ON status of cpu
892 // Local0 = CPON flag for this cpu
893 Store(DerefOf(Index(CPON, Arg0)), Local0)
894 If (Local0) { Return(0xF) } Else { Return(0x0) }
896 Method (CPEJ, 2, NotSerialized) {
897 // _EJ0 method - eject callback
901 /* CPU hotplug notify method */
902 OperationRegion(PRST, SystemIO, 0xaf00, 32)
903 Field (PRST, ByteAcc, NoLock, Preserve)
908 // Local5 = active cpu bitmap
910 // Local2 = last read byte from bitmap
912 // Local0 = cpuid iterator
914 While (LLess(Local0, SizeOf(CPON))) {
915 // Local1 = CPON flag for this cpu
916 Store(DerefOf(Index(CPON, Local0)), Local1)
917 If (And(Local0, 0x07)) {
918 // Shift down previously read bitmap byte
919 ShiftRight(Local2, 1, Local2)
921 // Read next byte from cpu bitmap
922 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
924 // Local3 = active state for this cpu
925 Store(And(Local2, 1), Local3)
927 If (LNotEqual(Local1, Local3)) {
928 // State change - update CPON with new state
929 Store(Local3, Index(CPON, Local0))
931 If (LEqual(Local3, 1)) {
944 /****************************************************************
945 * General purpose events
946 ****************************************************************/
950 Name(_HID, "ACPI0006")
957 Return(\_SB.PCI0.PCNF())