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.
26 ACPI_EXTRACT_ALL_CODE Q35AcpiDsdtAmlCode
29 "q35-acpi-dsdt.aml",// Output Filename
31 0x01, // DSDT Compliance Revision
38 #include "acpi-dsdt-dbug.dsl"
41 OperationRegion(PCST, SystemIO, 0xae00, 0x0c)
42 OperationRegion(PCSB, SystemIO, 0xae0c, 0x01)
43 Field(PCSB, AnyAcc, NoLock, WriteAsZeros) {
49 /****************************************************************
51 ****************************************************************/
54 Name(_HID, EisaId("PNP0A08"))
55 Name(_CID, EisaId("PNP0A03"))
59 External(ISA, DeviceObj)
61 // _OSC: based on sample of ACPI3.0b spec
62 Name(SUPP, 0) // PCI _OSC Support Field value
63 Name(CTRL, 0) // PCI _OSC Control Field value
65 // Create DWORD-addressable fields from the Capabilities Buffer
66 CreateDWordField(Arg3, 0, CDW1)
68 // Check for proper UUID
69 If (LEqual(Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
70 // Create DWORD-addressable fields from the Capabilities Buffer
71 CreateDWordField(Arg3, 4, CDW2)
72 CreateDWordField(Arg3, 8, CDW3)
74 // Save Capabilities DWORD2 & 3
78 // Always allow native PME, AER (no dependencies)
79 // Never allow SHPC (no SHPC controller in this system)
82 #if 0 // For now, nothing to do
83 If (Not(And(CDW1, 1))) { // Query flag clear?
84 // Disable GPEs for features granted native control.
85 If (And(CTRL, 0x01)) { // Hot plug control granted?
86 Store(0, HPCE) // clear the hot plug SCI enable bit
87 Store(1, HPCS) // clear the hot plug SCI status bit
89 If (And(CTRL, 0x04)) { // PME control granted?
90 Store(0, PMCE) // clear the PME SCI enable bit
91 Store(1, PMCS) // clear the PME SCI status bit
93 If (And(CTRL, 0x10)) { // OS restoring PCI Express cap structure?
94 // Set status to not restore PCI Express cap structure
95 // upon resume from S3
100 If (LNotEqual(Arg1, One)) {
104 If (LNotEqual(CDW3, CTRL)) {
105 // Capabilities bits were masked
108 // Update DWORD3 in the buffer
111 Or(CDW1, 4, CDW1) // Unrecognized UUID
118 #include "acpi-dsdt-hpet.dsl"
121 /****************************************************************
123 ****************************************************************/
126 /* PCI D31:f0 LPC ISA bridge */
128 Name (_ADR, 0x001F0000) // _ADR: Address
130 /* ICH9 PCI to ISA irq remapping */
131 OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
133 OperationRegion(LPCD, PCI_Config, 0x80, 0x2)
134 Field(LPCD, AnyAcc, NoLock, Preserve) {
144 OperationRegion(LPCE, PCI_Config, 0x82, 0x2)
145 Field(LPCE, AnyAcc, NoLock, Preserve) {
154 #include "acpi-dsdt-isa.dsl"
157 /****************************************************************
159 ****************************************************************/
161 /* Zero => PIC mode, One => APIC Mode */
163 Method(\_PIC, 1, NotSerialized) {
169 #define prt_slot_lnk(nr, lnk0, lnk1, lnk2, lnk3) \
170 Package() { nr##ffff, 0, lnk0, 0 }, \
171 Package() { nr##ffff, 1, lnk1, 0 }, \
172 Package() { nr##ffff, 2, lnk2, 0 }, \
173 Package() { nr##ffff, 3, lnk3, 0 }
175 #define prt_slot_lnkA(nr) prt_slot_lnk(nr, LNKA, LNKB, LNKC, LNKD)
176 #define prt_slot_lnkB(nr) prt_slot_lnk(nr, LNKB, LNKC, LNKD, LNKA)
177 #define prt_slot_lnkC(nr) prt_slot_lnk(nr, LNKC, LNKD, LNKA, LNKB)
178 #define prt_slot_lnkD(nr) prt_slot_lnk(nr, LNKD, LNKA, LNKB, LNKC)
180 #define prt_slot_lnkE(nr) prt_slot_lnk(nr, LNKE, LNKF, LNKG, LNKH)
181 #define prt_slot_lnkF(nr) prt_slot_lnk(nr, LNKF, LNKG, LNKH, LNKE)
182 #define prt_slot_lnkG(nr) prt_slot_lnk(nr, LNKG, LNKH, LNKE, LNKF)
183 #define prt_slot_lnkH(nr) prt_slot_lnk(nr, LNKH, LNKE, LNKF, LNKG)
185 Name(PRTP, package() {
186 prt_slot_lnkE(0x0000),
187 prt_slot_lnkF(0x0001),
188 prt_slot_lnkG(0x0002),
189 prt_slot_lnkH(0x0003),
190 prt_slot_lnkE(0x0004),
191 prt_slot_lnkF(0x0005),
192 prt_slot_lnkG(0x0006),
193 prt_slot_lnkH(0x0007),
194 prt_slot_lnkE(0x0008),
195 prt_slot_lnkF(0x0009),
196 prt_slot_lnkG(0x000a),
197 prt_slot_lnkH(0x000b),
198 prt_slot_lnkE(0x000c),
199 prt_slot_lnkF(0x000d),
200 prt_slot_lnkG(0x000e),
201 prt_slot_lnkH(0x000f),
202 prt_slot_lnkE(0x0010),
203 prt_slot_lnkF(0x0011),
204 prt_slot_lnkG(0x0012),
205 prt_slot_lnkH(0x0013),
206 prt_slot_lnkE(0x0014),
207 prt_slot_lnkF(0x0015),
208 prt_slot_lnkG(0x0016),
209 prt_slot_lnkH(0x0017),
210 prt_slot_lnkE(0x0018),
212 /* INTA -> PIRQA for slot 25 - 31
213 see the default value of D<N>IR */
214 prt_slot_lnkA(0x0019),
215 prt_slot_lnkA(0x001a),
216 prt_slot_lnkA(0x001b),
217 prt_slot_lnkA(0x001c),
218 prt_slot_lnkA(0x001d),
220 /* PCIe->PCI bridge. use PIRQ[E-H] */
221 prt_slot_lnkE(0x001e),
223 prt_slot_lnkA(0x001f)
226 #define prt_slot_gsi(nr, gsi0, gsi1, gsi2, gsi3) \
227 Package() { nr##ffff, 0, gsi0, 0 }, \
228 Package() { nr##ffff, 1, gsi1, 0 }, \
229 Package() { nr##ffff, 2, gsi2, 0 }, \
230 Package() { nr##ffff, 3, gsi3, 0 }
232 #define prt_slot_gsiA(nr) prt_slot_gsi(nr, GSIA, GSIB, GSIC, GSID)
233 #define prt_slot_gsiB(nr) prt_slot_gsi(nr, GSIB, GSIC, GSID, GSIA)
234 #define prt_slot_gsiC(nr) prt_slot_gsi(nr, GSIC, GSID, GSIA, GSIB)
235 #define prt_slot_gsiD(nr) prt_slot_gsi(nr, GSID, GSIA, GSIB, GSIC)
237 #define prt_slot_gsiE(nr) prt_slot_gsi(nr, GSIE, GSIF, GSIG, GSIH)
238 #define prt_slot_gsiF(nr) prt_slot_gsi(nr, GSIF, GSIG, GSIH, GSIE)
239 #define prt_slot_gsiG(nr) prt_slot_gsi(nr, GSIG, GSIH, GSIE, GSIF)
240 #define prt_slot_gsiH(nr) prt_slot_gsi(nr, GSIH, GSIE, GSIF, GSIG)
242 Name(PRTA, package() {
243 prt_slot_gsiE(0x0000),
244 prt_slot_gsiF(0x0001),
245 prt_slot_gsiG(0x0002),
246 prt_slot_gsiH(0x0003),
247 prt_slot_gsiE(0x0004),
248 prt_slot_gsiF(0x0005),
249 prt_slot_gsiG(0x0006),
250 prt_slot_gsiH(0x0007),
251 prt_slot_gsiE(0x0008),
252 prt_slot_gsiF(0x0009),
253 prt_slot_gsiG(0x000a),
254 prt_slot_gsiH(0x000b),
255 prt_slot_gsiE(0x000c),
256 prt_slot_gsiF(0x000d),
257 prt_slot_gsiG(0x000e),
258 prt_slot_gsiH(0x000f),
259 prt_slot_gsiE(0x0010),
260 prt_slot_gsiF(0x0011),
261 prt_slot_gsiG(0x0012),
262 prt_slot_gsiH(0x0013),
263 prt_slot_gsiE(0x0014),
264 prt_slot_gsiF(0x0015),
265 prt_slot_gsiG(0x0016),
266 prt_slot_gsiH(0x0017),
267 prt_slot_gsiE(0x0018),
269 /* INTA -> PIRQA for slot 25 - 31, but 30
270 see the default value of D<N>IR */
271 prt_slot_gsiA(0x0019),
272 prt_slot_gsiA(0x001a),
273 prt_slot_gsiA(0x001b),
274 prt_slot_gsiA(0x001c),
275 prt_slot_gsiA(0x001d),
277 /* PCIe->PCI bridge. use PIRQ[E-H] */
278 prt_slot_gsiE(0x001e),
280 prt_slot_gsiA(0x001f)
283 Method(_PRT, 0, NotSerialized) {
284 /* PCI IRQ routing table, example from ACPI 2.0a specification,
286 /* Note: we provide the same info as the PCI routing
287 table of the Bochs BIOS */
288 If (LEqual(\PICF, Zero)) {
296 Field(PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
309 Method(IQST, 1, NotSerialized) {
310 // _STA method - get status
311 If (And(0x80, Arg0)) {
316 Method(IQCR, 1, Serialized) {
317 // _CRS method - get current settings
318 Name(PRR0, ResourceTemplate() {
319 Interrupt(, Level, ActiveHigh, Shared) { 0 }
321 CreateDWordField(PRR0, 0x05, PRRI)
322 Store(And(Arg0, 0x0F), PRRI)
326 #define define_link(link, uid, reg) \
328 Name(_HID, EISAID("PNP0C0F")) \
330 Name(_PRS, ResourceTemplate() { \
331 Interrupt(, Level, ActiveHigh, Shared) { \
335 Method(_STA, 0, NotSerialized) { \
338 Method(_DIS, 0, NotSerialized) { \
341 Method(_CRS, 0, NotSerialized) { \
344 Method(_SRS, 1, NotSerialized) { \
345 CreateDWordField(Arg0, 0x05, PRRI) \
350 define_link(LNKA, 0, PRQA)
351 define_link(LNKB, 1, PRQB)
352 define_link(LNKC, 2, PRQC)
353 define_link(LNKD, 3, PRQD)
354 define_link(LNKE, 4, PRQE)
355 define_link(LNKF, 5, PRQF)
356 define_link(LNKG, 6, PRQG)
357 define_link(LNKH, 7, PRQH)
359 #define define_gsi_link(link, uid, gsi) \
361 Name(_HID, EISAID("PNP0C0F")) \
363 Name(_PRS, ResourceTemplate() { \
364 Interrupt(, Level, ActiveHigh, Shared) { \
368 Name(_CRS, ResourceTemplate() { \
369 Interrupt(, Level, ActiveHigh, Shared) { \
373 Method(_SRS, 1, NotSerialized) { \
377 define_gsi_link(GSIA, 0, 0x10)
378 define_gsi_link(GSIB, 0, 0x11)
379 define_gsi_link(GSIC, 0, 0x12)
380 define_gsi_link(GSID, 0, 0x13)
381 define_gsi_link(GSIE, 0, 0x14)
382 define_gsi_link(GSIF, 0, 0x15)
383 define_gsi_link(GSIG, 0, 0x16)
384 define_gsi_link(GSIH, 0, 0x17)
387 #include "hw/acpi/pc-hotplug.h"
388 #define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE
389 #include "acpi-dsdt-cpu-hotplug.dsl"
390 #include "acpi-dsdt-mem-hotplug.dsl"
393 /****************************************************************
394 * General purpose events
395 ****************************************************************/
397 Name(_HID, "ACPI0006")
408 // Memory hotplug event
409 \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD()