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 #define hotplug_slot(name, nr) \
143 Name (_ADR, nr##0000) \
145 Store(ShiftLeft(1, nr), B0EJ) \
151 hotplug_slot(1, 0x0001)
152 hotplug_slot(2, 0x0002)
153 hotplug_slot(3, 0x0003)
154 hotplug_slot(4, 0x0004)
155 hotplug_slot(5, 0x0005)
156 hotplug_slot(6, 0x0006)
157 hotplug_slot(7, 0x0007)
158 hotplug_slot(8, 0x0008)
159 hotplug_slot(9, 0x0009)
160 hotplug_slot(10, 0x000a)
161 hotplug_slot(11, 0x000b)
162 hotplug_slot(12, 0x000c)
163 hotplug_slot(13, 0x000d)
164 hotplug_slot(14, 0x000e)
165 hotplug_slot(15, 0x000f)
166 hotplug_slot(16, 0x0010)
167 hotplug_slot(17, 0x0011)
168 hotplug_slot(18, 0x0012)
169 hotplug_slot(19, 0x0013)
170 hotplug_slot(20, 0x0014)
171 hotplug_slot(21, 0x0015)
172 hotplug_slot(22, 0x0016)
173 hotplug_slot(23, 0x0017)
174 hotplug_slot(24, 0x0018)
175 hotplug_slot(25, 0x0019)
176 hotplug_slot(26, 0x001a)
177 hotplug_slot(27, 0x001b)
178 hotplug_slot(28, 0x001c)
179 hotplug_slot(29, 0x001d)
180 hotplug_slot(30, 0x001e)
181 hotplug_slot(31, 0x001f)
183 Name (_CRS, ResourceTemplate ()
185 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
186 0x0000, // Address Space Granularity
187 0x0000, // Address Range Minimum
188 0x00FF, // Address Range Maximum
189 0x0000, // Address Translation Offset
190 0x0100, // Address Length
193 0x0CF8, // Address Range Minimum
194 0x0CF8, // Address Range Maximum
195 0x01, // Address Alignment
196 0x08, // Address Length
198 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
199 0x0000, // Address Space Granularity
200 0x0000, // Address Range Minimum
201 0x0CF7, // Address Range Maximum
202 0x0000, // Address Translation Offset
203 0x0CF8, // Address Length
205 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
206 0x0000, // Address Space Granularity
207 0x0D00, // Address Range Minimum
208 0xFFFF, // Address Range Maximum
209 0x0000, // Address Translation Offset
210 0xF300, // Address Length
212 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
213 0x00000000, // Address Space Granularity
214 0x000A0000, // Address Range Minimum
215 0x000BFFFF, // Address Range Maximum
216 0x00000000, // Address Translation Offset
217 0x00020000, // Address Length
218 ,, , AddressRangeMemory, TypeStatic)
219 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
220 0x00000000, // Address Space Granularity
221 0xE0000000, // Address Range Minimum
222 0xFEBFFFFF, // Address Range Maximum
223 0x00000000, // Address Translation Offset
224 0x1EC00000, // Address Length
225 ,, , AddressRangeMemory, TypeStatic)
231 /****************************************************************
233 ****************************************************************/
237 Name(_HID, EISAID("PNP0103"))
239 Method (_STA, 0, NotSerialized) {
242 Name(_CRS, ResourceTemplate() {
244 ResourceConsumer, PosDecode, MinFixed, MaxFixed,
245 NonCacheable, ReadWrite,
250 0x00000400 /* 1K memory: FED00000 - FED003FF */
257 /****************************************************************
259 ****************************************************************/
263 Name (_ADR, 0x00020000)
264 OperationRegion(PCIC, PCI_Config, Zero, 0x4)
265 Field(PCIC, DWordAcc, NoLock, Preserve) {
268 Method (_S1D, 0, NotSerialized)
272 Method (_S2D, 0, NotSerialized)
276 Method (_S3D, 0, NotSerialized)
278 If (LEqual(VEND, 0x1001b36)) {
284 Method(_RMV) { Return (0x00) }
289 /****************************************************************
291 ****************************************************************/
295 Name (_ADR, 0x00010000)
296 Method(_RMV) { Return (0x00) }
298 /* PIIX PCI to ISA irq remapping */
299 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
304 /****************************************************************
305 * SuperIO devices (kbd, mouse, etc.)
306 ****************************************************************/
308 Scope(\_SB.PCI0.ISA) {
309 /* Real-time clock */
312 Name (_HID, EisaId ("PNP0B00"))
313 Name (_CRS, ResourceTemplate ()
315 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
317 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
321 /* Keyboard seems to be important for WinXP install */
324 Name (_HID, EisaId ("PNP0303"))
325 Method (_STA, 0, NotSerialized)
330 Method (_CRS, 0, NotSerialized)
332 Name (TMP, ResourceTemplate ()
335 0x0060, // Address Range Minimum
336 0x0060, // Address Range Maximum
337 0x01, // Address Alignment
338 0x01, // Address Length
341 0x0064, // Address Range Minimum
342 0x0064, // Address Range Maximum
343 0x01, // Address Alignment
344 0x01, // Address Length
356 Name (_HID, EisaId ("PNP0F13"))
357 Method (_STA, 0, NotSerialized)
362 Method (_CRS, 0, NotSerialized)
364 Name (TMP, ResourceTemplate ()
372 /* PS/2 floppy controller */
375 Name (_HID, EisaId ("PNP0700"))
376 Method (_STA, 0, NotSerialized)
380 Method (_CRS, 0, NotSerialized)
382 Name (BUF0, ResourceTemplate ()
384 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
385 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
387 DMA (Compatibility, NotBusMaster, Transfer8) {2}
396 Name (_HID, EisaId ("PNP0400"))
397 Method (_STA, 0, NotSerialized)
399 Store (\_SB.PCI0.PX13.DRSA, Local0)
400 And (Local0, 0x80000000, Local0)
401 If (LEqual (Local0, 0))
410 Method (_CRS, 0, NotSerialized)
412 Name (BUF0, ResourceTemplate ()
414 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
424 Name (_HID, EisaId ("PNP0501"))
426 Method (_STA, 0, NotSerialized)
428 Store (\_SB.PCI0.PX13.DRSC, Local0)
429 And (Local0, 0x08000000, Local0)
430 If (LEqual (Local0, 0))
439 Method (_CRS, 0, NotSerialized)
441 Name (BUF0, ResourceTemplate ()
443 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
452 Name (_HID, EisaId ("PNP0501"))
454 Method (_STA, 0, NotSerialized)
456 Store (\_SB.PCI0.PX13.DRSC, Local0)
457 And (Local0, 0x80000000, Local0)
458 If (LEqual (Local0, 0))
467 Method (_CRS, 0, NotSerialized)
469 Name (BUF0, ResourceTemplate ()
471 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
480 /****************************************************************
482 ****************************************************************/
486 Name (_ADR, 0x00010003)
488 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
489 Field (P13C, DWordAcc, NoLock, Preserve)
505 /****************************************************************
507 ****************************************************************/
511 #define gen_pci_device(name, nr) \
513 Name (_ADR, nr##0000) \
515 If (And(\_SB.PCI0.PCRM, ShiftLeft(1, nr))) { \
523 /* VGA (slot 1) and ISA bus (slot 2) defined above */
524 gen_pci_device(3, 0x0003)
525 gen_pci_device(4, 0x0004)
526 gen_pci_device(5, 0x0005)
527 gen_pci_device(6, 0x0006)
528 gen_pci_device(7, 0x0007)
529 gen_pci_device(8, 0x0008)
530 gen_pci_device(9, 0x0009)
531 gen_pci_device(10, 0x000a)
532 gen_pci_device(11, 0x000b)
533 gen_pci_device(12, 0x000c)
534 gen_pci_device(13, 0x000d)
535 gen_pci_device(14, 0x000e)
536 gen_pci_device(15, 0x000f)
537 gen_pci_device(16, 0x0010)
538 gen_pci_device(17, 0x0011)
539 gen_pci_device(18, 0x0012)
540 gen_pci_device(19, 0x0013)
541 gen_pci_device(20, 0x0014)
542 gen_pci_device(21, 0x0015)
543 gen_pci_device(22, 0x0016)
544 gen_pci_device(23, 0x0017)
545 gen_pci_device(24, 0x0018)
546 gen_pci_device(25, 0x0019)
547 gen_pci_device(26, 0x001a)
548 gen_pci_device(27, 0x001b)
549 gen_pci_device(28, 0x001c)
550 gen_pci_device(29, 0x001d)
551 gen_pci_device(30, 0x001e)
552 gen_pci_device(31, 0x001f)
556 /****************************************************************
558 ****************************************************************/
561 Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
570 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
572 Name(_PRS, ResourceTemplate(){
573 Interrupt (, Level, ActiveHigh, Shared)
576 Method (_STA, 0, NotSerialized)
579 If (And (0x80, PRQ0, Local1))
585 Method (_DIS, 0, NotSerialized)
587 Or (PRQ0, 0x80, PRQ0)
589 Method (_CRS, 0, NotSerialized)
591 Name (PRR0, ResourceTemplate ()
593 Interrupt (, Level, ActiveHigh, Shared)
596 CreateDWordField (PRR0, 0x05, TMP)
598 If (LLess (Local0, 0x80))
608 Method (_SRS, 1, NotSerialized)
610 CreateDWordField (Arg0, 0x05, TMP)
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, PRQ1, Local1))
630 Method (_DIS, 0, NotSerialized)
632 Or (PRQ1, 0x80, PRQ1)
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, PRQ2, Local1))
675 Method (_DIS, 0, NotSerialized)
677 Or (PRQ2, 0x80, PRQ2)
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, PRQ3, Local1))
720 Method (_DIS, 0, NotSerialized)
722 Or (PRQ3, 0x80, PRQ3)
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, PRQ0, Local1))
765 Method (_DIS, 0, NotSerialized)
767 Or (PRQ0, 0x80, PRQ0)
769 Method (_CRS, 0, NotSerialized)
771 Name (PRR0, ResourceTemplate ()
773 Interrupt (, Level, ActiveHigh, Shared)
776 CreateDWordField (PRR0, 0x05, TMP)
778 If (LLess (Local0, 0x80))
792 /****************************************************************
794 ****************************************************************/
797 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
798 * must match piix4 emulation.
800 Name (\_S3, Package (0x04)
802 0x01, /* PM1a_CNT.SLP_TYP */
803 0x01, /* PM1b_CNT.SLP_TYP */
807 Name (\_S4, Package (0x04)
809 Zero, /* PM1a_CNT.SLP_TYP */
810 Zero, /* PM1b_CNT.SLP_TYP */
814 Name (\_S5, Package (0x04)
816 Zero, /* PM1a_CNT.SLP_TYP */
817 Zero, /* PM1b_CNT.SLP_TYP */
823 /****************************************************************
825 ****************************************************************/
828 /* Objects filled in by run-time generated SSDT */
829 External(NTFY, MethodObj)
830 External(CPON, PkgObj)
832 /* Methods called by run-time generated SSDT Processor objects */
833 Method (CPMA, 1, NotSerialized) {
834 // _MAT method - create an madt apic buffer
835 // Local0 = CPON flag for this cpu
836 Store(DerefOf(Index(CPON, Arg0)), Local0)
837 // Local1 = Buffer (in madt apic form) to return
838 Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
839 // Update the processor id, lapic id, and enable/disable status
840 Store(Arg0, Index(Local1, 2))
841 Store(Arg0, Index(Local1, 3))
842 Store(Local0, Index(Local1, 4))
845 Method (CPST, 1, NotSerialized) {
846 // _STA method - return ON status of cpu
847 // Local0 = CPON flag for this cpu
848 Store(DerefOf(Index(CPON, Arg0)), Local0)
849 If (Local0) { Return(0xF) } Else { Return(0x0) }
851 Method (CPEJ, 2, NotSerialized) {
852 // _EJ0 method - eject callback
856 /* CPU hotplug notify method */
857 OperationRegion(PRST, SystemIO, 0xaf00, 32)
858 Field (PRST, ByteAcc, NoLock, Preserve)
863 // Local5 = active cpu bitmap
865 // Local2 = last read byte from bitmap
867 // Local0 = cpuid iterator
869 While (LLess(Local0, SizeOf(CPON))) {
870 // Local1 = CPON flag for this cpu
871 Store(DerefOf(Index(CPON, Local0)), Local1)
872 If (And(Local0, 0x07)) {
873 // Shift down previously read bitmap byte
874 ShiftRight(Local2, 1, Local2)
876 // Read next byte from cpu bitmap
877 Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
879 // Local3 = active state for this cpu
880 Store(And(Local2, 1), Local3)
882 If (LNotEqual(Local1, Local3)) {
883 // State change - update CPON with new state
884 Store(Local3, Index(CPON, Local0))
886 If (LEqual(Local3, 1)) {
899 /****************************************************************
900 * General purpose events
901 ****************************************************************/
905 Name(_HID, "ACPI0006")
911 #define gen_pci_hotplug(nr) \
912 If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
913 Notify(\_SB.PCI0.S##nr, 1) \
915 If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
916 Notify(\_SB.PCI0.S##nr, 3) \