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 OperationRegion(PRST, SystemIO, 0xaf00, 32)
31 Field (PRST, ByteAcc, NoLock, Preserve)
36 Name(PRSS, Buffer(32){}) /* shadow CPU status bitmask */
40 If (LEqual(SSVL, 0)) {
41 Store(PRS, PRSS) /* read CPUs status bitmaks from HW */
44 ShiftRight(Arg0, 3, Local1)
45 Store(DerefOf(Index(PRSS, Local1)), Local2)
46 Return(And(Local2, ShiftLeft(1, And(Arg0, 0x7))))
49 #define gen_processor(nr, name) \
50 Processor (CPU##name, nr, 0x0000b010, 0x06) { \
51 Name (PREN, Buffer(0x8) {0x0, 0x8, nr, nr, 0x1, 0x0, 0x0, 0x0}) \
52 Name (PRDS, Buffer(0x8) {0x0, 0x8, nr, nr, 0x0, 0x0, 0x0, 0x0}) \
54 If (CRST(nr)) { Return(PREN) } \
55 Else { Return(PRDS) } \
58 If (CRST(nr)) { Return(0xF) } \
59 Else { Return(0x9) } \
81 #define gen_ntfy(nr) \
82 If (LEqual(Arg0, 0x##nr)) { \
83 Notify(CPU##nr, Arg1) \
103 /* Works on 8 bit quentity.
104 * Arg1 - Shadow status bits
105 * Arg2 - Current status bits
108 Xor(Arg1, Arg2, Local0) /* figure out what chaged */
109 ShiftLeft(Arg0, 3, Local1)
110 While (LNotEqual(Local0, Zero)) {
111 If (And(Local0, 1)) { /* if staus have changed */
112 if(And(Arg2, 1)) { /* check previous status */
119 ShiftRight(Local0, 1, Local0)
120 ShiftRight(Arg2, 1, Arg2)
127 Store(Buffer(32){}, Local0)
128 Store(PRS, Local0) /* read CPUs status bitmask into Local0 */
130 /* loop over bitmask byte by byte to see what have chaged */
131 While(LLess(Local1, 32)) {
132 Store(DerefOf(Index(Local0, Local1)), Local2)
133 Store(DerefOf(Index(PRSS, Local1)), Local3)
134 PR1(Local1, Local2, Local3)
137 Store(Local0, PRSS) /* store curr satust bitmask into shadow */
145 OperationRegion (DBG, SystemIO, 0xb044, 0x04)
146 Field (DBG, DWordAcc, NoLock, Preserve)
153 /* PCI Bus definition */
156 Name (_HID, EisaId ("PNP0A03"))
159 Name(_PRT, Package() {
160 /* PCI IRQ routing table, example from ACPI 2.0a specification,
162 /* Note: we provide the same info as the PCI routing
163 table of the Bochs BIOS */
165 #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
166 Package() { nr##ffff, 0, lnk0, 0 }, \
167 Package() { nr##ffff, 1, lnk1, 0 }, \
168 Package() { nr##ffff, 2, lnk2, 0 }, \
169 Package() { nr##ffff, 3, lnk3, 0 }
171 #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
172 #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
173 #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
174 #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
210 OperationRegion(PCST, SystemIO, 0xae00, 0x08)
211 Field (PCST, DWordAcc, NoLock, WriteAsZeros)
217 OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
218 Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
223 #define hotplug_slot(name, nr) \
225 Name (_ADR, nr##0000) \
227 Store(ShiftLeft(1, nr), B0EJ) \
233 hotplug_slot(1, 0x0001)
234 hotplug_slot(2, 0x0002)
235 hotplug_slot(3, 0x0003)
236 hotplug_slot(4, 0x0004)
237 hotplug_slot(5, 0x0005)
238 hotplug_slot(6, 0x0006)
239 hotplug_slot(7, 0x0007)
240 hotplug_slot(8, 0x0008)
241 hotplug_slot(9, 0x0009)
242 hotplug_slot(10, 0x000a)
243 hotplug_slot(11, 0x000b)
244 hotplug_slot(12, 0x000c)
245 hotplug_slot(13, 0x000d)
246 hotplug_slot(14, 0x000e)
247 hotplug_slot(15, 0x000f)
248 hotplug_slot(16, 0x0010)
249 hotplug_slot(17, 0x0011)
250 hotplug_slot(18, 0x0012)
251 hotplug_slot(19, 0x0013)
252 hotplug_slot(20, 0x0014)
253 hotplug_slot(21, 0x0015)
254 hotplug_slot(22, 0x0016)
255 hotplug_slot(23, 0x0017)
256 hotplug_slot(24, 0x0018)
257 hotplug_slot(25, 0x0019)
258 hotplug_slot(26, 0x001a)
259 hotplug_slot(27, 0x001b)
260 hotplug_slot(28, 0x001c)
261 hotplug_slot(29, 0x001d)
262 hotplug_slot(30, 0x001e)
263 hotplug_slot(31, 0x001f)
265 Name (_CRS, ResourceTemplate ()
267 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
268 0x0000, // Address Space Granularity
269 0x0000, // Address Range Minimum
270 0x00FF, // Address Range Maximum
271 0x0000, // Address Translation Offset
272 0x0100, // Address Length
275 0x0CF8, // Address Range Minimum
276 0x0CF8, // Address Range Maximum
277 0x01, // Address Alignment
278 0x08, // Address Length
280 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
281 0x0000, // Address Space Granularity
282 0x0000, // Address Range Minimum
283 0x0CF7, // Address Range Maximum
284 0x0000, // Address Translation Offset
285 0x0CF8, // Address Length
287 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
288 0x0000, // Address Space Granularity
289 0x0D00, // Address Range Minimum
290 0xFFFF, // Address Range Maximum
291 0x0000, // Address Translation Offset
292 0xF300, // Address Length
294 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
295 0x00000000, // Address Space Granularity
296 0x000A0000, // Address Range Minimum
297 0x000BFFFF, // Address Range Maximum
298 0x00000000, // Address Translation Offset
299 0x00020000, // Address Length
300 ,, , AddressRangeMemory, TypeStatic)
301 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
302 0x00000000, // Address Space Granularity
303 0xE0000000, // Address Range Minimum
304 0xFEBFFFFF, // Address Range Maximum
305 0x00000000, // Address Translation Offset
306 0x1EC00000, // Address Length
307 ,, , AddressRangeMemory, TypeStatic)
314 Name (_ADR, 0x00020000)
315 Method (_S1D, 0, NotSerialized)
319 Method (_S2D, 0, NotSerialized)
323 Method (_S3D, 0, NotSerialized)
329 /* PIIX3 ISA bridge */
331 Name (_ADR, 0x00010000)
333 /* PIIX PCI to ISA irq remapping */
334 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
336 /* Real-time clock */
339 Name (_HID, EisaId ("PNP0B00"))
340 Name (_CRS, ResourceTemplate ()
342 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
344 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
348 /* Keyboard seems to be important for WinXP install */
351 Name (_HID, EisaId ("PNP0303"))
352 Method (_STA, 0, NotSerialized)
357 Method (_CRS, 0, NotSerialized)
359 Name (TMP, ResourceTemplate ()
362 0x0060, // Address Range Minimum
363 0x0060, // Address Range Maximum
364 0x01, // Address Alignment
365 0x01, // Address Length
368 0x0064, // Address Range Minimum
369 0x0064, // Address Range Maximum
370 0x01, // Address Alignment
371 0x01, // Address Length
383 Name (_HID, EisaId ("PNP0F13"))
384 Method (_STA, 0, NotSerialized)
389 Method (_CRS, 0, NotSerialized)
391 Name (TMP, ResourceTemplate ()
399 /* PS/2 floppy controller */
402 Name (_HID, EisaId ("PNP0700"))
403 Method (_STA, 0, NotSerialized)
407 Method (_CRS, 0, NotSerialized)
409 Name (BUF0, ResourceTemplate ()
411 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
412 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
414 DMA (Compatibility, NotBusMaster, Transfer8) {2}
423 Name (_HID, EisaId ("PNP0400"))
424 Method (_STA, 0, NotSerialized)
426 Store (\_SB.PCI0.PX13.DRSA, Local0)
427 And (Local0, 0x80000000, Local0)
428 If (LEqual (Local0, 0))
437 Method (_CRS, 0, NotSerialized)
439 Name (BUF0, ResourceTemplate ()
441 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
451 Name (_HID, EisaId ("PNP0501"))
453 Method (_STA, 0, NotSerialized)
455 Store (\_SB.PCI0.PX13.DRSC, Local0)
456 And (Local0, 0x08000000, Local0)
457 If (LEqual (Local0, 0))
466 Method (_CRS, 0, NotSerialized)
468 Name (BUF0, ResourceTemplate ()
470 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
479 Name (_HID, EisaId ("PNP0501"))
481 Method (_STA, 0, NotSerialized)
483 Store (\_SB.PCI0.PX13.DRSC, Local0)
484 And (Local0, 0x80000000, Local0)
485 If (LEqual (Local0, 0))
494 Method (_CRS, 0, NotSerialized)
496 Name (BUF0, ResourceTemplate ()
498 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
508 Name (_ADR, 0x00010003)
510 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
511 Field (P13C, DWordAcc, NoLock, Preserve)
528 Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
537 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
539 Name(_PRS, ResourceTemplate(){
540 Interrupt (, Level, ActiveHigh, Shared)
543 Method (_STA, 0, NotSerialized)
546 If (And (0x80, PRQ0, Local1))
552 Method (_DIS, 0, NotSerialized)
554 Or (PRQ0, 0x80, PRQ0)
556 Method (_CRS, 0, NotSerialized)
558 Name (PRR0, ResourceTemplate ()
560 Interrupt (, Level, ActiveHigh, Shared)
563 CreateDWordField (PRR0, 0x05, TMP)
565 If (LLess (Local0, 0x80))
575 Method (_SRS, 1, NotSerialized)
577 CreateDWordField (Arg0, 0x05, TMP)
582 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
584 Name(_PRS, ResourceTemplate(){
585 Interrupt (, Level, ActiveHigh, Shared)
588 Method (_STA, 0, NotSerialized)
591 If (And (0x80, PRQ1, Local1))
597 Method (_DIS, 0, NotSerialized)
599 Or (PRQ1, 0x80, PRQ1)
601 Method (_CRS, 0, NotSerialized)
603 Name (PRR0, ResourceTemplate ()
605 Interrupt (, Level, ActiveHigh, Shared)
608 CreateDWordField (PRR0, 0x05, TMP)
610 If (LLess (Local0, 0x80))
620 Method (_SRS, 1, NotSerialized)
622 CreateDWordField (Arg0, 0x05, TMP)
627 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
629 Name(_PRS, ResourceTemplate(){
630 Interrupt (, Level, ActiveHigh, Shared)
633 Method (_STA, 0, NotSerialized)
636 If (And (0x80, PRQ2, Local1))
642 Method (_DIS, 0, NotSerialized)
644 Or (PRQ2, 0x80, PRQ2)
646 Method (_CRS, 0, NotSerialized)
648 Name (PRR0, ResourceTemplate ()
650 Interrupt (, Level, ActiveHigh, Shared)
653 CreateDWordField (PRR0, 0x05, TMP)
655 If (LLess (Local0, 0x80))
665 Method (_SRS, 1, NotSerialized)
667 CreateDWordField (Arg0, 0x05, TMP)
672 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
674 Name(_PRS, ResourceTemplate(){
675 Interrupt (, Level, ActiveHigh, Shared)
678 Method (_STA, 0, NotSerialized)
681 If (And (0x80, PRQ3, Local1))
687 Method (_DIS, 0, NotSerialized)
689 Or (PRQ3, 0x80, PRQ3)
691 Method (_CRS, 0, NotSerialized)
693 Name (PRR0, ResourceTemplate ()
695 Interrupt (, Level, ActiveHigh, Shared)
698 CreateDWordField (PRR0, 0x05, TMP)
700 If (LLess (Local0, 0x80))
710 Method (_SRS, 1, NotSerialized)
712 CreateDWordField (Arg0, 0x05, TMP)
719 * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
720 * must match piix4 emulation.
722 Name (\_S3, Package (0x04)
724 0x01, /* PM1a_CNT.SLP_TYP */
725 0x01, /* PM1b_CNT.SLP_TYP */
729 Name (\_S4, Package (0x04)
731 Zero, /* PM1a_CNT.SLP_TYP */
732 Zero, /* PM1b_CNT.SLP_TYP */
736 Name (\_S5, Package (0x04)
738 Zero, /* PM1a_CNT.SLP_TYP */
739 Zero, /* PM1b_CNT.SLP_TYP */
746 Name(_HID, "ACPI0006")
752 #define gen_pci_hotplug(nr) \
753 If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
754 Notify(\_SB.PCI0.S##nr, 1) \
756 If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
757 Notify(\_SB.PCI0.S##nr, 3) \