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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * Copyright (c) 2010 Isaku Yamahata
21 * yamahata at valinux co jp
22 * Based on acpi-dsdt.dsl, but heavily modified for q35 chipset.
25 ACPI_EXTRACT_ALL_CODE Q35AcpiDsdtAmlCode
28 "q35-acpi-dsdt.aml",// Output Filename
30 0x01, // DSDT Compliance Revision
37 #include "acpi-dsdt-dbug.dsl"
40 OperationRegion(PCST, SystemIO, 0xae00, 0x0c)
41 OperationRegion(PCSB, SystemIO, 0xae0c, 0x01)
42 Field(PCSB, AnyAcc, NoLock, WriteAsZeros) {
48 /****************************************************************
50 ****************************************************************/
54 Name(_HID, EisaId("PNP0A08"))
55 Name(_CID, EisaId("PNP0A03"))
59 // _OSC: based on sample of ACPI3.0b spec
60 Name(SUPP, 0) // PCI _OSC Support Field value
61 Name(CTRL, 0) // PCI _OSC Control Field value
63 // Create DWORD-addressable fields from the Capabilities Buffer
64 CreateDWordField(Arg3, 0, CDW1)
66 // Check for proper UUID
67 If (LEqual(Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
68 // Create DWORD-addressable fields from the Capabilities Buffer
69 CreateDWordField(Arg3, 4, CDW2)
70 CreateDWordField(Arg3, 8, CDW3)
72 // Save Capabilities DWORD2 & 3
76 // Always allow native PME, AER (no dependencies)
77 // Never allow SHPC (no SHPC controller in this system)
80 #if 0 // For now, nothing to do
81 If (Not(And(CDW1, 1))) { // Query flag clear?
82 // Disable GPEs for features granted native control.
83 If (And(CTRL, 0x01)) { // Hot plug control granted?
84 Store(0, HPCE) // clear the hot plug SCI enable bit
85 Store(1, HPCS) // clear the hot plug SCI status bit
87 If (And(CTRL, 0x04)) { // PME control granted?
88 Store(0, PMCE) // clear the PME SCI enable bit
89 Store(1, PMCS) // clear the PME SCI status bit
91 If (And(CTRL, 0x10)) { // OS restoring PCI Express cap structure?
92 // Set status to not restore PCI Express cap structure
93 // upon resume from S3
98 If (LNotEqual(Arg1, One)) {
102 If (LNotEqual(CDW3, CTRL)) {
103 // Capabilities bits were masked
106 // Update DWORD3 in the buffer
109 Or(CDW1, 4, CDW1) // Unrecognized UUID
116 #include "acpi-dsdt-pci-crs.dsl"
117 #include "acpi-dsdt-hpet.dsl"
120 /****************************************************************
122 ****************************************************************/
126 Name(_ADR, 0x00010000)
127 Method(_S1D, 0, NotSerialized) {
130 Method(_S2D, 0, NotSerialized) {
133 Method(_S3D, 0, NotSerialized) {
140 /****************************************************************
142 ****************************************************************/
145 /* PCI D31:f0 LPC ISA bridge */
148 Name(_ADR, 0x001f0000)
150 /* ICH9 PCI to ISA irq remapping */
151 OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
153 OperationRegion(LPCD, PCI_Config, 0x80, 0x2)
154 Field(LPCD, AnyAcc, NoLock, Preserve) {
164 OperationRegion(LPCE, PCI_Config, 0x82, 0x2)
165 Field(LPCE, AnyAcc, NoLock, Preserve) {
174 #define DSDT_APPLESMC_STA q35_dsdt_applesmc_sta
175 #include "acpi-dsdt-isa.dsl"
178 /****************************************************************
180 ****************************************************************/
182 /* Zero => PIC mode, One => APIC Mode */
184 Method(\_PIC, 1, NotSerialized) {
190 #define prt_slot_lnk(nr, lnk0, lnk1, lnk2, lnk3) \
191 Package() { nr##ffff, 0, lnk0, 0 }, \
192 Package() { nr##ffff, 1, lnk1, 0 }, \
193 Package() { nr##ffff, 2, lnk2, 0 }, \
194 Package() { nr##ffff, 3, lnk3, 0 }
196 #define prt_slot_lnkA(nr) prt_slot_lnk(nr, LNKA, LNKB, LNKC, LNKD)
197 #define prt_slot_lnkB(nr) prt_slot_lnk(nr, LNKB, LNKC, LNKD, LNKA)
198 #define prt_slot_lnkC(nr) prt_slot_lnk(nr, LNKC, LNKD, LNKA, LNKB)
199 #define prt_slot_lnkD(nr) prt_slot_lnk(nr, LNKD, LNKA, LNKB, LNKC)
201 #define prt_slot_lnkE(nr) prt_slot_lnk(nr, LNKE, LNKF, LNKG, LNKH)
202 #define prt_slot_lnkF(nr) prt_slot_lnk(nr, LNKF, LNKG, LNKH, LNKE)
203 #define prt_slot_lnkG(nr) prt_slot_lnk(nr, LNKG, LNKH, LNKE, LNKF)
204 #define prt_slot_lnkH(nr) prt_slot_lnk(nr, LNKH, LNKE, LNKF, LNKG)
206 Name(PRTP, package() {
207 prt_slot_lnkE(0x0000),
208 prt_slot_lnkF(0x0001),
209 prt_slot_lnkG(0x0002),
210 prt_slot_lnkH(0x0003),
211 prt_slot_lnkE(0x0004),
212 prt_slot_lnkF(0x0005),
213 prt_slot_lnkG(0x0006),
214 prt_slot_lnkH(0x0007),
215 prt_slot_lnkE(0x0008),
216 prt_slot_lnkF(0x0009),
217 prt_slot_lnkG(0x000a),
218 prt_slot_lnkH(0x000b),
219 prt_slot_lnkE(0x000c),
220 prt_slot_lnkF(0x000d),
221 prt_slot_lnkG(0x000e),
222 prt_slot_lnkH(0x000f),
223 prt_slot_lnkE(0x0010),
224 prt_slot_lnkF(0x0011),
225 prt_slot_lnkG(0x0012),
226 prt_slot_lnkH(0x0013),
227 prt_slot_lnkE(0x0014),
228 prt_slot_lnkF(0x0015),
229 prt_slot_lnkG(0x0016),
230 prt_slot_lnkH(0x0017),
231 prt_slot_lnkE(0x0018),
233 /* INTA -> PIRQA for slot 25 - 31
234 see the default value of D<N>IR */
235 prt_slot_lnkA(0x0019),
236 prt_slot_lnkA(0x001a),
237 prt_slot_lnkA(0x001b),
238 prt_slot_lnkA(0x001c),
239 prt_slot_lnkA(0x001d),
241 /* PCIe->PCI bridge. use PIRQ[E-H] */
242 prt_slot_lnkE(0x001e),
244 prt_slot_lnkA(0x001f)
247 #define prt_slot_gsi(nr, gsi0, gsi1, gsi2, gsi3) \
248 Package() { nr##ffff, 0, gsi0, 0 }, \
249 Package() { nr##ffff, 1, gsi1, 0 }, \
250 Package() { nr##ffff, 2, gsi2, 0 }, \
251 Package() { nr##ffff, 3, gsi3, 0 }
253 #define prt_slot_gsiA(nr) prt_slot_gsi(nr, GSIA, GSIB, GSIC, GSID)
254 #define prt_slot_gsiB(nr) prt_slot_gsi(nr, GSIB, GSIC, GSID, GSIA)
255 #define prt_slot_gsiC(nr) prt_slot_gsi(nr, GSIC, GSID, GSIA, GSIB)
256 #define prt_slot_gsiD(nr) prt_slot_gsi(nr, GSID, GSIA, GSIB, GSIC)
258 #define prt_slot_gsiE(nr) prt_slot_gsi(nr, GSIE, GSIF, GSIG, GSIH)
259 #define prt_slot_gsiF(nr) prt_slot_gsi(nr, GSIF, GSIG, GSIH, GSIE)
260 #define prt_slot_gsiG(nr) prt_slot_gsi(nr, GSIG, GSIH, GSIE, GSIF)
261 #define prt_slot_gsiH(nr) prt_slot_gsi(nr, GSIH, GSIE, GSIF, GSIG)
263 Name(PRTA, package() {
264 prt_slot_gsiE(0x0000),
265 prt_slot_gsiF(0x0001),
266 prt_slot_gsiG(0x0002),
267 prt_slot_gsiH(0x0003),
268 prt_slot_gsiE(0x0004),
269 prt_slot_gsiF(0x0005),
270 prt_slot_gsiG(0x0006),
271 prt_slot_gsiH(0x0007),
272 prt_slot_gsiE(0x0008),
273 prt_slot_gsiF(0x0009),
274 prt_slot_gsiG(0x000a),
275 prt_slot_gsiH(0x000b),
276 prt_slot_gsiE(0x000c),
277 prt_slot_gsiF(0x000d),
278 prt_slot_gsiG(0x000e),
279 prt_slot_gsiH(0x000f),
280 prt_slot_gsiE(0x0010),
281 prt_slot_gsiF(0x0011),
282 prt_slot_gsiG(0x0012),
283 prt_slot_gsiH(0x0013),
284 prt_slot_gsiE(0x0014),
285 prt_slot_gsiF(0x0015),
286 prt_slot_gsiG(0x0016),
287 prt_slot_gsiH(0x0017),
288 prt_slot_gsiE(0x0018),
290 /* INTA -> PIRQA for slot 25 - 31, but 30
291 see the default value of D<N>IR */
292 prt_slot_gsiA(0x0019),
293 prt_slot_gsiA(0x001a),
294 prt_slot_gsiA(0x001b),
295 prt_slot_gsiA(0x001c),
296 prt_slot_gsiA(0x001d),
298 /* PCIe->PCI bridge. use PIRQ[E-H] */
299 prt_slot_gsiE(0x001e),
301 prt_slot_gsiA(0x001f)
304 Method(_PRT, 0, NotSerialized) {
305 /* PCI IRQ routing table, example from ACPI 2.0a specification,
307 /* Note: we provide the same info as the PCI routing
308 table of the Bochs BIOS */
309 If (LEqual(\PICF, Zero)) {
317 Field(PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
330 Method(IQST, 1, NotSerialized) {
331 // _STA method - get status
332 If (And(0x80, Arg0)) {
337 Method(IQCR, 1, Serialized) {
338 // _CRS method - get current settings
339 Name(PRR0, ResourceTemplate() {
340 Interrupt(, Level, ActiveHigh, Shared) { 0 }
342 CreateDWordField(PRR0, 0x05, PRRI)
343 Store(And(Arg0, 0x0F), PRRI)
347 #define define_link(link, uid, reg) \
349 Name(_HID, EISAID("PNP0C0F")) \
351 Name(_PRS, ResourceTemplate() { \
352 Interrupt(, Level, ActiveHigh, Shared) { \
356 Method(_STA, 0, NotSerialized) { \
359 Method(_DIS, 0, NotSerialized) { \
362 Method(_CRS, 0, NotSerialized) { \
365 Method(_SRS, 1, NotSerialized) { \
366 CreateDWordField(Arg0, 0x05, PRRI) \
371 define_link(LNKA, 0, PRQA)
372 define_link(LNKB, 1, PRQB)
373 define_link(LNKC, 2, PRQC)
374 define_link(LNKD, 3, PRQD)
375 define_link(LNKE, 4, PRQE)
376 define_link(LNKF, 5, PRQF)
377 define_link(LNKG, 6, PRQG)
378 define_link(LNKH, 7, PRQH)
380 #define define_gsi_link(link, uid, gsi) \
382 Name(_HID, EISAID("PNP0C0F")) \
384 Name(_PRS, ResourceTemplate() { \
385 Interrupt(, Level, ActiveHigh, Shared) { \
389 Name(_CRS, ResourceTemplate() { \
390 Interrupt(, Level, ActiveHigh, Shared) { \
394 Method(_SRS, 1, NotSerialized) { \
398 define_gsi_link(GSIA, 0, 0x10)
399 define_gsi_link(GSIB, 0, 0x11)
400 define_gsi_link(GSIC, 0, 0x12)
401 define_gsi_link(GSID, 0, 0x13)
402 define_gsi_link(GSIE, 0, 0x14)
403 define_gsi_link(GSIF, 0, 0x15)
404 define_gsi_link(GSIG, 0, 0x16)
405 define_gsi_link(GSIH, 0, 0x17)
408 #include "acpi-dsdt-cpu-hotplug.dsl"
411 /****************************************************************
412 * General purpose events
413 ****************************************************************/
416 Name(_HID, "ACPI0006")