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 prt_slot(0x0001, LNKS, LNKB, LNKC, LNKD),
119 OperationRegion(PCST, SystemIO, 0xae00, 0x08)
120 Field (PCST, DWordAcc, NoLock, WriteAsZeros)
126 OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
127 Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
132 OperationRegion(RMVC, SystemIO, 0xae0c, 0x04)
133 Field(RMVC, DWordAcc, NoLock, WriteAsZeros)
138 Name (_CRS, ResourceTemplate ()
140 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
141 0x0000, // Address Space Granularity
142 0x0000, // Address Range Minimum
143 0x00FF, // Address Range Maximum
144 0x0000, // Address Translation Offset
145 0x0100, // Address Length
148 0x0CF8, // Address Range Minimum
149 0x0CF8, // Address Range Maximum
150 0x01, // Address Alignment
151 0x08, // Address Length
153 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
154 0x0000, // Address Space Granularity
155 0x0000, // Address Range Minimum
156 0x0CF7, // Address Range Maximum
157 0x0000, // Address Translation Offset
158 0x0CF8, // Address Length
160 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
161 0x0000, // Address Space Granularity
162 0x0D00, // Address Range Minimum
163 0xFFFF, // Address Range Maximum
164 0x0000, // Address Translation Offset
165 0xF300, // Address Length
167 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
168 0x00000000, // Address Space Granularity
169 0x000A0000, // Address Range Minimum
170 0x000BFFFF, // Address Range Maximum
171 0x00000000, // Address Translation Offset
172 0x00020000, // Address Length
173 ,, , AddressRangeMemory, TypeStatic)
174 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
175 0x00000000, // Address Space Granularity
176 0xE0000000, // Address Range Minimum
177 0xFEBFFFFF, // Address Range Maximum
178 0x00000000, // Address Translation Offset
179 0x1EC00000, // Address Length
180 ,, , AddressRangeMemory, TypeStatic)
186 /****************************************************************
188 ****************************************************************/
192 Name(_HID, EISAID("PNP0103"))
194 Method (_STA, 0, NotSerialized) {
197 Name(_CRS, ResourceTemplate() {
199 ResourceConsumer, PosDecode, MinFixed, MaxFixed,
200 NonCacheable, ReadWrite,
205 0x00000400 /* 1K memory: FED00000 - FED003FF */
212 /****************************************************************
214 ****************************************************************/
218 Name (_ADR, 0x00020000)
219 OperationRegion(PCIC, PCI_Config, Zero, 0x4)
220 Field(PCIC, DWordAcc, NoLock, Preserve) {
223 Method (_S1D, 0, NotSerialized)
227 Method (_S2D, 0, NotSerialized)
231 Method (_S3D, 0, NotSerialized)
233 If (LEqual(VEND, 0x1001b36)) {
239 Method(_RMV) { Return (0x00) }
244 /****************************************************************
246 ****************************************************************/
250 Name (_ADR, 0x00010000)
251 Method(_RMV) { Return (0x00) }
253 /* PIIX PCI to ISA irq remapping */
254 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
259 /****************************************************************
260 * SuperIO devices (kbd, mouse, etc.)
261 ****************************************************************/
263 Scope(\_SB.PCI0.ISA) {
264 /* Real-time clock */
267 Name (_HID, EisaId ("PNP0B00"))
268 Name (_CRS, ResourceTemplate ()
270 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
272 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
276 /* Keyboard seems to be important for WinXP install */
279 Name (_HID, EisaId ("PNP0303"))
280 Method (_STA, 0, NotSerialized)
285 Method (_CRS, 0, NotSerialized)
287 Name (TMP, ResourceTemplate ()
290 0x0060, // Address Range Minimum
291 0x0060, // Address Range Maximum
292 0x01, // Address Alignment
293 0x01, // Address Length
296 0x0064, // Address Range Minimum
297 0x0064, // Address Range Maximum
298 0x01, // Address Alignment
299 0x01, // Address Length
311 Name (_HID, EisaId ("PNP0F13"))
312 Method (_STA, 0, NotSerialized)
317 Method (_CRS, 0, NotSerialized)
319 Name (TMP, ResourceTemplate ()
327 /* PS/2 floppy controller */
330 Name (_HID, EisaId ("PNP0700"))
331 Method (_STA, 0, NotSerialized)
335 Method (_CRS, 0, NotSerialized)
337 Name (BUF0, ResourceTemplate ()
339 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
340 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
342 DMA (Compatibility, NotBusMaster, Transfer8) {2}
351 Name (_HID, EisaId ("PNP0400"))
352 Method (_STA, 0, NotSerialized)
354 Store (\_SB.PCI0.PX13.DRSA, Local0)
355 And (Local0, 0x80000000, Local0)
356 If (LEqual (Local0, 0))
365 Method (_CRS, 0, NotSerialized)
367 Name (BUF0, ResourceTemplate ()
369 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
379 Name (_HID, EisaId ("PNP0501"))
381 Method (_STA, 0, NotSerialized)
383 Store (\_SB.PCI0.PX13.DRSC, Local0)
384 And (Local0, 0x08000000, Local0)
385 If (LEqual (Local0, 0))
394 Method (_CRS, 0, NotSerialized)
396 Name (BUF0, ResourceTemplate ()
398 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
407 Name (_HID, EisaId ("PNP0501"))
409 Method (_STA, 0, NotSerialized)
411 Store (\_SB.PCI0.PX13.DRSC, Local0)
412 And (Local0, 0x80000000, Local0)
413 If (LEqual (Local0, 0))
422 Method (_CRS, 0, NotSerialized)
424 Name (BUF0, ResourceTemplate ()
426 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
435 /****************************************************************
437 ****************************************************************/
441 Name (_ADR, 0x00010003)
443 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
444 Field (P13C, DWordAcc, NoLock, Preserve)
460 /****************************************************************
462 ****************************************************************/
465 /* Methods called by bulk generated PCI devices below */
466 Method (PRMV, 1, NotSerialized) {
467 // _RMV method - check if device can be removed
468 If (And(\_SB.PCI0.PCRM, ShiftLeft(1, Arg0))) {
474 #define gen_pci_device(slot) \
476 Name (_ADR, 0x##slot##0000) \
477 Method (_RMV) { Return (PRMV(0x##slot)) } \
478 Name (_SUN, 0x##slot) \
481 /* VGA (slot 1) and ISA bus (slot 2) defined above */
512 /* Methods called by bulk generated hotplug devices below */
513 Method (PCEJ, 1, NotSerialized) {
514 // _EJ0 method - eject callback
515 Store(ShiftLeft(1, Arg0), B0EJ)
519 /* Bulk generated PCI hotplug devices */
520 #define hotplug_slot(slot) \
522 Name (_ADR, 0x##slot##0000) \
523 Method (_EJ0, 1) { Return(PCEJ(0x##slot)) } \
524 Name (_SUN, 0x##slot) \
559 /* PCI hotplug notify method */
563 While (LLess(Local0, 31)) {
565 If (And(PCIU, ShiftLeft(1, Local0))) {
568 If (And(PCID, ShiftLeft(1, Local0))) {
575 #define gen_pci_hotplug(slot) \
576 If (LEqual(Arg0, 0x##slot)) { Notify(S##slot, Arg1) }
614 /****************************************************************
616 ****************************************************************/
619 Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
627 Method (IQST, 1, NotSerialized) {
628 // _STA method - get status
629 If (And (0x80, Arg0)) {
634 Method (IQDI, 1, NotSerialized) {
635 // _DIS method - disable interrupt
636 Or(DerefOf(Arg0), 0x80, Arg0)
638 Method (IQCR, 1, NotSerialized) {
639 // _CRS method - get current settings
640 Name (PRR0, ResourceTemplate ()
642 Interrupt (, Level, ActiveHigh, Shared)
645 CreateDWordField (PRR0, 0x05, PRRI)
646 If (LLess (Arg0, 0x80)) {
651 Method (IQSR, 2, NotSerialized) {
652 // _SRS method - set interrupt
653 CreateDWordField (Arg1, 0x05, PRRI)
658 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
660 Name(_PRS, ResourceTemplate(){
661 Interrupt (, Level, ActiveHigh, Shared)
664 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
665 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
666 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
667 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ0), Arg0) }
670 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
672 Name(_PRS, ResourceTemplate(){
673 Interrupt (, Level, ActiveHigh, Shared)
676 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) }
677 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ1)) }
678 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) }
679 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ1), Arg0) }
682 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
684 Name(_PRS, ResourceTemplate() {
685 Interrupt (, Level, ActiveHigh, Shared)
688 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) }
689 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ2)) }
690 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) }
691 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ2), Arg0) }
694 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
696 Name(_PRS, ResourceTemplate() {
697 Interrupt (, Level, ActiveHigh, Shared)
700 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) }
701 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ3)) }
702 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) }
703 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ3), Arg0) }
706 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
708 Name(_PRS, ResourceTemplate() {
709 Interrupt (, Level, ActiveHigh, Shared)
712 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
713 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
714 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
719 /****************************************************************
721 ****************************************************************/
724 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
725 * must match piix4 emulation.
727 Name (\_S3, Package (0x04)
729 0x01, /* PM1a_CNT.SLP_TYP */
730 0x01, /* PM1b_CNT.SLP_TYP */
734 Name (\_S4, Package (0x04)
736 Zero, /* PM1a_CNT.SLP_TYP */
737 Zero, /* PM1b_CNT.SLP_TYP */
741 Name (\_S5, Package (0x04)
743 Zero, /* PM1a_CNT.SLP_TYP */
744 Zero, /* PM1b_CNT.SLP_TYP */
750 /****************************************************************
752 ****************************************************************/
755 /* Objects filled in by run-time generated SSDT */
756 External(NTFY, MethodObj)
757 External(CPON, PkgObj)
759 /* Methods called by run-time generated SSDT Processor objects */
760 Method (CPMA, 1, NotSerialized) {
761 // _MAT method - create an madt apic buffer
762 // Local0 = CPON flag for this cpu
763 Store(DerefOf(Index(CPON, Arg0)), Local0)
764 // Local1 = Buffer (in madt apic form) to return
765 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
766 // Update the processor id, lapic id, and enable/disable status
767 Store(Arg0, Index(Local1, 2))
768 Store(Arg0, Index(Local1, 3))
769 Store(Local0, Index(Local1, 4))
772 Method (CPST, 1, NotSerialized) {
773 // _STA method - return ON status of cpu
774 // Local0 = CPON flag for this cpu
775 Store(DerefOf(Index(CPON, Arg0)), Local0)
776 If (Local0) { Return(0xF) } Else { Return(0x0) }
778 Method (CPEJ, 2, NotSerialized) {
779 // _EJ0 method - eject callback
783 /* CPU hotplug notify method */
784 OperationRegion(PRST, SystemIO, 0xaf00, 32)
785 Field (PRST, ByteAcc, NoLock, Preserve)
790 // Local5 = active cpu bitmap
792 // Local2 = last read byte from bitmap
794 // Local0 = cpuid iterator
796 While (LLess(Local0, SizeOf(CPON))) {
797 // Local1 = CPON flag for this cpu
798 Store(DerefOf(Index(CPON, Local0)), Local1)
799 If (And(Local0, 0x07)) {
800 // Shift down previously read bitmap byte
801 ShiftRight(Local2, 1, Local2)
803 // Read next byte from cpu bitmap
804 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
806 // Local3 = active state for this cpu
807 Store(And(Local2, 1), Local3)
809 If (LNotEqual(Local1, Local3)) {
810 // State change - update CPON with new state
811 Store(Local3, Index(CPON, Local0))
813 If (LEqual(Local3, 1)) {
826 /****************************************************************
827 * General purpose events
828 ****************************************************************/
832 Name(_HID, "ACPI0006")
839 Return(\_SB.PCI0.PCNF())