blob: 947bcff805f7d23bd11cbd11ce731d5dfaec2ceb [file] [log] [blame]
Kevin O'Connora4d35762008-03-08 15:43:03 -05001/*
2 * Bochs/QEMU ACPI DSDT ASL definition
3 *
4 * Copyright (c) 2006 Fabrice Bellard
5 *
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.
9 *
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.
14 *
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
18 */
Michael S. Tsirkin2e55b032011-10-26 23:28:02 +020019
20ACPI_EXTRACT_ALL_CODE AmlCode
21
Kevin O'Connora4d35762008-03-08 15:43:03 -050022DefinitionBlock (
23 "acpi-dsdt.aml", // Output Filename
24 "DSDT", // Signature
25 0x01, // DSDT Compliance Revision
26 "BXPC", // OEMID
27 "BXDSDT", // TABLE ID
28 0x1 // OEM Revision
29 )
30{
Kevin O'Connore9fe15b2011-09-21 19:58:42 -040031
Gerd Hoffmann0e25a252012-11-28 10:17:38 +010032#include "acpi-dsdt-dbug.dsl"
Kevin O'Connore9fe15b2011-09-21 19:58:42 -040033
34/****************************************************************
35 * PCI Bus definition
36 ****************************************************************/
37
Kevin O'Connora4d35762008-03-08 15:43:03 -050038 Scope(\_SB) {
39 Device(PCI0) {
40 Name (_HID, EisaId ("PNP0A03"))
41 Name (_ADR, 0x00)
42 Name (_UID, 1)
43 Name(_PRT, Package() {
44 /* PCI IRQ routing table, example from ACPI 2.0a specification,
45 section 6.2.8.1 */
46 /* Note: we provide the same info as the PCI routing
47 table of the Bochs BIOS */
Kevin O'Connor1f6c48a2009-10-08 21:59:13 -040048#define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
49 Package() { nr##ffff, 0, lnk0, 0 }, \
50 Package() { nr##ffff, 1, lnk1, 0 }, \
51 Package() { nr##ffff, 2, lnk2, 0 }, \
52 Package() { nr##ffff, 3, lnk3, 0 }
Kevin O'Connora4d35762008-03-08 15:43:03 -050053
Kevin O'Connor1f6c48a2009-10-08 21:59:13 -040054#define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
55#define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
56#define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
57#define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
58 prt_slot0(0x0000),
Kevin O'Connor5c99b6c2009-12-30 12:36:22 -050059 /* Device 1 is power mgmt device, and can only use irq 9 */
Paolo Bonzini45404092012-08-07 15:01:29 +020060 Package() { 0x1ffff, 0, 0, 9 },
61 Package() { 0x1ffff, 1, LNKB, 0 },
62 Package() { 0x1ffff, 2, LNKC, 0 },
63 Package() { 0x1ffff, 3, LNKD, 0 },
Kevin O'Connor1f6c48a2009-10-08 21:59:13 -040064 prt_slot2(0x0002),
65 prt_slot3(0x0003),
66 prt_slot0(0x0004),
67 prt_slot1(0x0005),
Kevin O'Connor0fee2c92009-10-08 22:06:06 -040068 prt_slot2(0x0006),
69 prt_slot3(0x0007),
70 prt_slot0(0x0008),
71 prt_slot1(0x0009),
72 prt_slot2(0x000a),
73 prt_slot3(0x000b),
74 prt_slot0(0x000c),
75 prt_slot1(0x000d),
76 prt_slot2(0x000e),
77 prt_slot3(0x000f),
78 prt_slot0(0x0010),
79 prt_slot1(0x0011),
80 prt_slot2(0x0012),
81 prt_slot3(0x0013),
82 prt_slot0(0x0014),
83 prt_slot1(0x0015),
84 prt_slot2(0x0016),
85 prt_slot3(0x0017),
86 prt_slot0(0x0018),
87 prt_slot1(0x0019),
88 prt_slot2(0x001a),
89 prt_slot3(0x001b),
90 prt_slot0(0x001c),
91 prt_slot1(0x001d),
92 prt_slot2(0x001e),
93 prt_slot3(0x001f),
Kevin O'Connora4d35762008-03-08 15:43:03 -050094 })
95
Kevin O'Connora56b6242009-10-08 22:04:05 -040096 OperationRegion(PCST, SystemIO, 0xae00, 0x08)
97 Field (PCST, DWordAcc, NoLock, WriteAsZeros)
98 {
99 PCIU, 32,
100 PCID, 32,
101 }
102
103 OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
104 Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
105 {
106 B0EJ, 32,
107 }
Kevin O'Connora4d35762008-03-08 15:43:03 -0500108 }
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400109 }
Kevin O'Connorf4343772009-10-08 22:05:21 -0400110
Gerd Hoffmann20886ab2012-11-28 10:17:42 +0100111#include "acpi-dsdt-pci-crs.dsl"
Gerd Hoffmann4dfa5472012-11-28 10:17:40 +0100112#include "acpi-dsdt-hpet.dsl"
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400113
114/****************************************************************
115 * VGA
116 ****************************************************************/
117
Kevin O'Connora4d35762008-03-08 15:43:03 -0500118 Scope(\_SB.PCI0) {
Kevin O'Connor9967ab72008-12-18 21:57:33 -0500119 Device (VGA) {
120 Name (_ADR, 0x00020000)
Kevin O'Connor67b059c2011-05-24 22:35:40 -0400121 OperationRegion(PCIC, PCI_Config, Zero, 0x4)
122 Field(PCIC, DWordAcc, NoLock, Preserve) {
123 VEND, 32
124 }
Kevin O'Connor9967ab72008-12-18 21:57:33 -0500125 Method (_S1D, 0, NotSerialized)
126 {
127 Return (0x00)
128 }
129 Method (_S2D, 0, NotSerialized)
130 {
131 Return (0x00)
132 }
133 Method (_S3D, 0, NotSerialized)
134 {
Kevin O'Connor67b059c2011-05-24 22:35:40 -0400135 If (LEqual(VEND, 0x1001b36)) {
136 Return (0x03) // QXL
137 } Else {
138 Return (0x00)
139 }
Kevin O'Connor9967ab72008-12-18 21:57:33 -0500140 }
141 }
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400142 }
Kevin O'Connora4d35762008-03-08 15:43:03 -0500143
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400144
145/****************************************************************
146 * PIIX3 ISA bridge
147 ****************************************************************/
148
149 Scope(\_SB.PCI0) {
Kevin O'Connora4d35762008-03-08 15:43:03 -0500150 Device (ISA) {
151 Name (_ADR, 0x00010000)
Kevin O'Connor3c241ed2011-01-05 21:25:18 -0500152
Kevin O'Connora4d35762008-03-08 15:43:03 -0500153 /* PIIX PCI to ISA irq remapping */
154 OperationRegion (P40C, PCI_Config, 0x60, 0x04)
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400155 }
156 }
Kevin O'Connora4d35762008-03-08 15:43:03 -0500157
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400158
159/****************************************************************
160 * SuperIO devices (kbd, mouse, etc.)
161 ****************************************************************/
162
163 Scope(\_SB.PCI0.ISA) {
Kevin O'Connora4d35762008-03-08 15:43:03 -0500164 /* Real-time clock */
165 Device (RTC)
166 {
167 Name (_HID, EisaId ("PNP0B00"))
168 Name (_CRS, ResourceTemplate ()
169 {
170 IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
171 IRQNoFlags () {8}
172 IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
173 })
174 }
175
176 /* Keyboard seems to be important for WinXP install */
177 Device (KBD)
178 {
179 Name (_HID, EisaId ("PNP0303"))
180 Method (_STA, 0, NotSerialized)
181 {
182 Return (0x0f)
183 }
184
185 Method (_CRS, 0, NotSerialized)
186 {
187 Name (TMP, ResourceTemplate ()
188 {
189 IO (Decode16,
190 0x0060, // Address Range Minimum
191 0x0060, // Address Range Maximum
192 0x01, // Address Alignment
193 0x01, // Address Length
194 )
195 IO (Decode16,
196 0x0064, // Address Range Minimum
197 0x0064, // Address Range Maximum
198 0x01, // Address Alignment
199 0x01, // Address Length
200 )
201 IRQNoFlags ()
202 {1}
203 })
204 Return (TMP)
205 }
206 }
207
208 /* PS/2 mouse */
209 Device (MOU)
210 {
211 Name (_HID, EisaId ("PNP0F13"))
212 Method (_STA, 0, NotSerialized)
213 {
214 Return (0x0f)
215 }
216
217 Method (_CRS, 0, NotSerialized)
218 {
219 Name (TMP, ResourceTemplate ()
220 {
221 IRQNoFlags () {12}
222 })
223 Return (TMP)
224 }
225 }
226
227 /* PS/2 floppy controller */
228 Device (FDC0)
229 {
230 Name (_HID, EisaId ("PNP0700"))
231 Method (_STA, 0, NotSerialized)
232 {
233 Return (0x0F)
234 }
235 Method (_CRS, 0, NotSerialized)
236 {
237 Name (BUF0, ResourceTemplate ()
238 {
239 IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
240 IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
241 IRQNoFlags () {6}
242 DMA (Compatibility, NotBusMaster, Transfer8) {2}
243 })
244 Return (BUF0)
245 }
246 }
247
248 /* Parallel port */
249 Device (LPT)
250 {
251 Name (_HID, EisaId ("PNP0400"))
252 Method (_STA, 0, NotSerialized)
253 {
254 Store (\_SB.PCI0.PX13.DRSA, Local0)
255 And (Local0, 0x80000000, Local0)
256 If (LEqual (Local0, 0))
257 {
258 Return (0x00)
259 }
260 Else
261 {
262 Return (0x0F)
263 }
264 }
265 Method (_CRS, 0, NotSerialized)
266 {
267 Name (BUF0, ResourceTemplate ()
268 {
269 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
270 IRQNoFlags () {7}
271 })
272 Return (BUF0)
273 }
274 }
275
276 /* Serial Ports */
277 Device (COM1)
278 {
279 Name (_HID, EisaId ("PNP0501"))
280 Name (_UID, 0x01)
281 Method (_STA, 0, NotSerialized)
282 {
283 Store (\_SB.PCI0.PX13.DRSC, Local0)
284 And (Local0, 0x08000000, Local0)
285 If (LEqual (Local0, 0))
286 {
287 Return (0x00)
288 }
289 Else
290 {
291 Return (0x0F)
292 }
293 }
294 Method (_CRS, 0, NotSerialized)
295 {
296 Name (BUF0, ResourceTemplate ()
297 {
298 IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
299 IRQNoFlags () {4}
300 })
301 Return (BUF0)
302 }
303 }
304
305 Device (COM2)
306 {
307 Name (_HID, EisaId ("PNP0501"))
308 Name (_UID, 0x02)
309 Method (_STA, 0, NotSerialized)
310 {
311 Store (\_SB.PCI0.PX13.DRSC, Local0)
312 And (Local0, 0x80000000, Local0)
313 If (LEqual (Local0, 0))
314 {
315 Return (0x00)
316 }
317 Else
318 {
319 Return (0x0F)
320 }
321 }
322 Method (_CRS, 0, NotSerialized)
323 {
324 Name (BUF0, ResourceTemplate ()
325 {
326 IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
327 IRQNoFlags () {3}
328 })
329 Return (BUF0)
330 }
331 }
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400332 }
Kevin O'Connora4d35762008-03-08 15:43:03 -0500333
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400334
335/****************************************************************
336 * PIIX4 PM
337 ****************************************************************/
338
339 Scope(\_SB.PCI0) {
Kevin O'Connora4d35762008-03-08 15:43:03 -0500340 Device (PX13) {
341 Name (_ADR, 0x00010003)
342
343 OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
344 Field (P13C, DWordAcc, NoLock, Preserve)
345 {
346 DRSA, 32,
347 DRSB, 32,
348 DRSC, 32,
349 DRSE, 32,
350 DRSF, 32,
351 DRSG, 32,
352 DRSH, 32,
353 DRSI, 32,
354 DRSJ, 32
355 }
356 }
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400357 }
358
359
360/****************************************************************
361 * PCI hotplug
362 ****************************************************************/
363
364 Scope(\_SB.PCI0) {
Kevin O'Connor9d3d7cb2011-09-21 21:19:51 -0400365 /* Methods called by bulk generated PCI devices below */
Kevin O'Connor3c241ed2011-01-05 21:25:18 -0500366
Michael S. Tsirkinc9737882011-11-20 19:56:59 +0200367 /* Methods called by hotplug devices */
Kevin O'Connor9d3d7cb2011-09-21 21:19:51 -0400368 Method (PCEJ, 1, NotSerialized) {
369 // _EJ0 method - eject callback
370 Store(ShiftLeft(1, Arg0), B0EJ)
371 Return (0x0)
372 }
373
Michael S. Tsirkinc9737882011-11-20 19:56:59 +0200374 /* Hotplug notification method supplied by SSDT */
375 External (\_SB.PCI0.PCNT, MethodObj)
Kevin O'Connor5eaed9c2011-09-21 20:14:42 -0400376
Kevin O'Connor5eaed9c2011-09-21 20:14:42 -0400377 /* PCI hotplug notify method */
378 Method(PCNF, 0) {
Kevin O'Connor9d3d7cb2011-09-21 21:19:51 -0400379 // Local0 = iterator
380 Store (Zero, Local0)
381 While (LLess(Local0, 31)) {
382 Increment(Local0)
383 If (And(PCIU, ShiftLeft(1, Local0))) {
384 PCNT(Local0, 1)
385 }
386 If (And(PCID, ShiftLeft(1, Local0))) {
387 PCNT(Local0, 3)
388 }
389 }
Kevin O'Connor9d3d7cb2011-09-21 21:19:51 -0400390 }
391
Kevin O'Connora4d35762008-03-08 15:43:03 -0500392 }
393
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400394
395/****************************************************************
396 * PCI IRQs
397 ****************************************************************/
398
Kevin O'Connora4d35762008-03-08 15:43:03 -0500399 Scope(\_SB) {
Kevin O'Connora65f4172011-09-25 23:08:58 -0400400 Field (PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
401 {
402 PRQ0, 8,
403 PRQ1, 8,
404 PRQ2, 8,
405 PRQ3, 8
406 }
Kevin O'Connora4d35762008-03-08 15:43:03 -0500407
Kevin O'Connora65f4172011-09-25 23:08:58 -0400408 Method (IQST, 1, NotSerialized) {
409 // _STA method - get status
410 If (And (0x80, Arg0)) {
411 Return (0x09)
412 }
413 Return (0x0B)
Kevin O'Connora4d35762008-03-08 15:43:03 -0500414 }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400415 Method (IQCR, 1, NotSerialized) {
416 // _CRS method - get current settings
417 Name (PRR0, ResourceTemplate ()
418 {
419 Interrupt (, Level, ActiveHigh, Shared)
420 { 0 }
421 })
422 CreateDWordField (PRR0, 0x05, PRRI)
423 If (LLess (Arg0, 0x80)) {
424 Store (Arg0, PRRI)
425 }
426 Return (PRR0)
Kevin O'Connora4d35762008-03-08 15:43:03 -0500427 }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500428 // _DIS method - disable interrupt
429#define DISIRQ(PRQVAR) \
430 Or(PRQVAR, 0x80, PRQVAR) \
431 // _SRS method - set interrupt
432#define SETIRQ(PRQVAR, IRQINFO) \
433 CreateDWordField (IRQINFO, 0x05, PRRI) \
434 Store (PRRI, PRQVAR)
Kevin O'Connora65f4172011-09-25 23:08:58 -0400435
436 Device(LNKA) {
437 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
438 Name(_UID, 1)
439 Name(_PRS, ResourceTemplate(){
440 Interrupt (, Level, ActiveHigh, Shared)
441 { 5, 10, 11 }
442 })
443 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ0)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500444 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ0) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400445 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ0)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500446 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ0, Arg0) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400447 }
448 Device(LNKB) {
449 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
450 Name(_UID, 2)
451 Name(_PRS, ResourceTemplate(){
452 Interrupt (, Level, ActiveHigh, Shared)
453 { 5, 10, 11 }
454 })
455 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ1)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500456 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ1) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400457 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ1)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500458 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ1, Arg0) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400459 }
460 Device(LNKC) {
461 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
462 Name(_UID, 3)
463 Name(_PRS, ResourceTemplate() {
464 Interrupt (, Level, ActiveHigh, Shared)
465 { 5, 10, 11 }
466 })
467 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ2)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500468 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ2) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400469 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ2)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500470 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ2, Arg0) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400471 }
472 Device(LNKD) {
473 Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
474 Name(_UID, 4)
475 Name(_PRS, ResourceTemplate() {
476 Interrupt (, Level, ActiveHigh, Shared)
477 { 5, 10, 11 }
478 })
479 Method (_STA, 0, NotSerialized) { Return (IQST(PRQ3)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500480 Method (_DIS, 0, NotSerialized) { DISIRQ(PRQ3) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400481 Method (_CRS, 0, NotSerialized) { Return (IQCR(PRQ3)) }
Kevin O'Connor891766f2011-12-17 10:26:17 -0500482 Method (_SRS, 1, NotSerialized) { SETIRQ(PRQ3, Arg0) }
Kevin O'Connora65f4172011-09-25 23:08:58 -0400483 }
Kevin O'Connora4d35762008-03-08 15:43:03 -0500484 }
485
Gerd Hoffmann3aab6ff2012-11-28 10:17:44 +0100486#include "acpi-dsdt-cpu-hotplug.dsl"
Kevin O'Connore9fe15b2011-09-21 19:58:42 -0400487
488/****************************************************************
489 * General purpose events
490 ****************************************************************/
491
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400492 Scope (\_GPE)
493 {
494 Name(_HID, "ACPI0006")
495
496 Method(_L00) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400497 }
Igor Mammedov9c6635b2012-04-03 23:48:44 +0200498 Method(_E01) {
Kevin O'Connor5eaed9c2011-09-21 20:14:42 -0400499 // PCI hotplug event
Kevin O'Connor475ce3f2012-10-27 21:31:12 -0400500 \_SB.PCI0.PCNF()
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400501 }
Igor Mammedov9c6635b2012-04-03 23:48:44 +0200502 Method(_E02) {
Kevin O'Connore2074bf2010-08-03 21:30:03 -0400503 // CPU hotplug event
Kevin O'Connor475ce3f2012-10-27 21:31:12 -0400504 \_SB.PRSC()
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400505 }
506 Method(_L03) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400507 }
508 Method(_L04) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400509 }
510 Method(_L05) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400511 }
512 Method(_L06) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400513 }
514 Method(_L07) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400515 }
516 Method(_L08) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400517 }
518 Method(_L09) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400519 }
520 Method(_L0A) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400521 }
522 Method(_L0B) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400523 }
524 Method(_L0C) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400525 }
526 Method(_L0D) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400527 }
528 Method(_L0E) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400529 }
530 Method(_L0F) {
Kevin O'Connor12a490b2009-10-08 22:03:28 -0400531 }
532 }
Kevin O'Connora4d35762008-03-08 15:43:03 -0500533}