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 /* Methods called by hotplug devices */
478 Method (PCEJ, 1, NotSerialized) {
479 // _EJ0 method - eject callback
480 Store(ShiftLeft(1, Arg0), B0EJ)
484 /* Hotplug notification method supplied by SSDT */
485 External (\_SB.PCI0.PCNT, MethodObj)
487 /* PCI hotplug notify method */
491 While (LLess(Local0, 31)) {
493 If (And(PCIU, ShiftLeft(1, Local0))) {
496 If (And(PCID, ShiftLeft(1, Local0))) {
506 /****************************************************************
508 ****************************************************************/
511 Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
519 Method (IQST, 1, NotSerialized) {
520 // _STA method - get status
521 If (And (0x80, Arg0)) {
526 Method (IQDI, 1, NotSerialized) {
527 // _DIS method - disable interrupt
528 Or(DerefOf(Arg0), 0x80, Arg0)
530 Method (IQCR, 1, NotSerialized) {
531 // _CRS method - get current settings
532 Name (PRR0, ResourceTemplate ()
534 Interrupt (, Level, ActiveHigh, Shared)
537 CreateDWordField (PRR0, 0x05, PRRI)
538 If (LLess (Arg0, 0x80)) {
543 Method (IQSR, 2, NotSerialized) {
544 // _SRS method - set interrupt
545 CreateDWordField (Arg1, 0x05, PRRI)
550 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
552 Name(_PRS, ResourceTemplate(){
553 Interrupt (, Level, ActiveHigh, Shared)
556 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
557 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
558 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
559 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ0), Arg0) }
562 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
564 Name(_PRS, ResourceTemplate(){
565 Interrupt (, Level, ActiveHigh, Shared)
568 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) }
569 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ1)) }
570 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) }
571 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ1), Arg0) }
574 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
576 Name(_PRS, ResourceTemplate() {
577 Interrupt (, Level, ActiveHigh, Shared)
580 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) }
581 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ2)) }
582 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) }
583 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ2), Arg0) }
586 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
588 Name(_PRS, ResourceTemplate() {
589 Interrupt (, Level, ActiveHigh, Shared)
592 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) }
593 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ3)) }
594 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) }
595 Method (_SRS, 1, NotSerialized) { IQSR(RefOf(PRQ3), Arg0) }
598 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
600 Name(_PRS, ResourceTemplate() {
601 Interrupt (, Level, ActiveHigh, Shared)
604 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
605 Method (_DIS, 0, NotSerialized) { IQDI(RefOf(PRQ0)) }
606 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
611 /****************************************************************
613 ****************************************************************/
616 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
617 * must match piix4 emulation.
619 Name (\_S3, Package (0x04)
621 0x01, /* PM1a_CNT.SLP_TYP */
622 0x01, /* PM1b_CNT.SLP_TYP */
626 Name (\_S4, Package (0x04)
628 Zero, /* PM1a_CNT.SLP_TYP */
629 Zero, /* PM1b_CNT.SLP_TYP */
633 Name (\_S5, Package (0x04)
635 Zero, /* PM1a_CNT.SLP_TYP */
636 Zero, /* PM1b_CNT.SLP_TYP */
642 /****************************************************************
644 ****************************************************************/
647 /* Objects filled in by run-time generated SSDT */
648 External(NTFY, MethodObj)
649 External(CPON, PkgObj)
651 /* Methods called by run-time generated SSDT Processor objects */
652 Method (CPMA, 1, NotSerialized) {
653 // _MAT method - create an madt apic buffer
654 // Local0 = CPON flag for this cpu
655 Store(DerefOf(Index(CPON, Arg0)), Local0)
656 // Local1 = Buffer (in madt apic form) to return
657 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
658 // Update the processor id, lapic id, and enable/disable status
659 Store(Arg0, Index(Local1, 2))
660 Store(Arg0, Index(Local1, 3))
661 Store(Local0, Index(Local1, 4))
664 Method (CPST, 1, NotSerialized) {
665 // _STA method - return ON status of cpu
666 // Local0 = CPON flag for this cpu
667 Store(DerefOf(Index(CPON, Arg0)), Local0)
668 If (Local0) { Return(0xF) } Else { Return(0x0) }
670 Method (CPEJ, 2, NotSerialized) {
671 // _EJ0 method - eject callback
675 /* CPU hotplug notify method */
676 OperationRegion(PRST, SystemIO, 0xaf00, 32)
677 Field (PRST, ByteAcc, NoLock, Preserve)
682 // Local5 = active cpu bitmap
684 // Local2 = last read byte from bitmap
686 // Local0 = cpuid iterator
688 While (LLess(Local0, SizeOf(CPON))) {
689 // Local1 = CPON flag for this cpu
690 Store(DerefOf(Index(CPON, Local0)), Local1)
691 If (And(Local0, 0x07)) {
692 // Shift down previously read bitmap byte
693 ShiftRight(Local2, 1, Local2)
695 // Read next byte from cpu bitmap
696 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
698 // Local3 = active state for this cpu
699 Store(And(Local2, 1), Local3)
701 If (LNotEqual(Local1, Local3)) {
702 // State change - update CPON with new state
703 Store(Local3, Index(CPON, Local0))
705 If (LEqual(Local3, 1)) {
718 /****************************************************************
719 * General purpose events
720 ****************************************************************/
724 Name(_HID, "ACPI0006")
731 Return(\_SB.PCI0.PCNF())