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 ****************************************************************/
53 Name(_HID, EisaId("PNP0A08"))
54 Name(_CID, EisaId("PNP0A03"))
58 External(ISA, DeviceObj)
60 // _OSC: based on sample of ACPI3.0b spec
61 Name(SUPP, 0) // PCI _OSC Support Field value
62 Name(CTRL, 0) // PCI _OSC Control Field value
64 // Create DWORD-addressable fields from the Capabilities Buffer
65 CreateDWordField(Arg3, 0, CDW1)
67 // Check for proper UUID
68 If (LEqual(Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
69 // Create DWORD-addressable fields from the Capabilities Buffer
70 CreateDWordField(Arg3, 4, CDW2)
71 CreateDWordField(Arg3, 8, CDW3)
73 // Save Capabilities DWORD2 & 3
77 // Always allow native PME, AER (no dependencies)
78 // Never allow SHPC (no SHPC controller in this system)
81 #if 0 // For now, nothing to do
82 If (Not(And(CDW1, 1))) { // Query flag clear?
83 // Disable GPEs for features granted native control.
84 If (And(CTRL, 0x01)) { // Hot plug control granted?
85 Store(0, HPCE) // clear the hot plug SCI enable bit
86 Store(1, HPCS) // clear the hot plug SCI status bit
88 If (And(CTRL, 0x04)) { // PME control granted?
89 Store(0, PMCE) // clear the PME SCI enable bit
90 Store(1, PMCS) // clear the PME SCI status bit
92 If (And(CTRL, 0x10)) { // OS restoring PCI Express cap structure?
93 // Set status to not restore PCI Express cap structure
94 // upon resume from S3
99 If (LNotEqual(Arg1, One)) {
103 If (LNotEqual(CDW3, CTRL)) {
104 // Capabilities bits were masked
107 // Update DWORD3 in the buffer
110 Or(CDW1, 4, CDW1) // Unrecognized UUID
117 #include "acpi-dsdt-hpet.dsl"
120 /****************************************************************
122 ****************************************************************/
125 /* PCI D31:f0 LPC ISA bridge */
127 Name (_ADR, 0x001F0000) // _ADR: Address
129 /* ICH9 PCI to ISA irq remapping */
130 OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
132 OperationRegion(LPCD, PCI_Config, 0x80, 0x2)
133 Field(LPCD, AnyAcc, NoLock, Preserve) {
143 OperationRegion(LPCE, PCI_Config, 0x82, 0x2)
144 Field(LPCE, AnyAcc, NoLock, Preserve) {
153 #include "acpi-dsdt-isa.dsl"
156 /****************************************************************
158 ****************************************************************/
160 /* Zero => PIC mode, One => APIC Mode */
162 Method(\_PIC, 1, NotSerialized) {
168 #define prt_slot_lnk(nr, lnk0, lnk1, lnk2, lnk3) \
169 Package() { nr##ffff, 0, lnk0, 0 }, \
170 Package() { nr##ffff, 1, lnk1, 0 }, \
171 Package() { nr##ffff, 2, lnk2, 0 }, \
172 Package() { nr##ffff, 3, lnk3, 0 }
174 #define prt_slot_lnkA(nr) prt_slot_lnk(nr, LNKA, LNKB, LNKC, LNKD)
175 #define prt_slot_lnkB(nr) prt_slot_lnk(nr, LNKB, LNKC, LNKD, LNKA)
176 #define prt_slot_lnkC(nr) prt_slot_lnk(nr, LNKC, LNKD, LNKA, LNKB)
177 #define prt_slot_lnkD(nr) prt_slot_lnk(nr, LNKD, LNKA, LNKB, LNKC)
179 #define prt_slot_lnkE(nr) prt_slot_lnk(nr, LNKE, LNKF, LNKG, LNKH)
180 #define prt_slot_lnkF(nr) prt_slot_lnk(nr, LNKF, LNKG, LNKH, LNKE)
181 #define prt_slot_lnkG(nr) prt_slot_lnk(nr, LNKG, LNKH, LNKE, LNKF)
182 #define prt_slot_lnkH(nr) prt_slot_lnk(nr, LNKH, LNKE, LNKF, LNKG)
184 Name(PRTP, package() {
185 prt_slot_lnkE(0x0000),
186 prt_slot_lnkF(0x0001),
187 prt_slot_lnkG(0x0002),
188 prt_slot_lnkH(0x0003),
189 prt_slot_lnkE(0x0004),
190 prt_slot_lnkF(0x0005),
191 prt_slot_lnkG(0x0006),
192 prt_slot_lnkH(0x0007),
193 prt_slot_lnkE(0x0008),
194 prt_slot_lnkF(0x0009),
195 prt_slot_lnkG(0x000a),
196 prt_slot_lnkH(0x000b),
197 prt_slot_lnkE(0x000c),
198 prt_slot_lnkF(0x000d),
199 prt_slot_lnkG(0x000e),
200 prt_slot_lnkH(0x000f),
201 prt_slot_lnkE(0x0010),
202 prt_slot_lnkF(0x0011),
203 prt_slot_lnkG(0x0012),
204 prt_slot_lnkH(0x0013),
205 prt_slot_lnkE(0x0014),
206 prt_slot_lnkF(0x0015),
207 prt_slot_lnkG(0x0016),
208 prt_slot_lnkH(0x0017),
209 prt_slot_lnkE(0x0018),
211 /* INTA -> PIRQA for slot 25 - 31
212 see the default value of D<N>IR */
213 prt_slot_lnkA(0x0019),
214 prt_slot_lnkA(0x001a),
215 prt_slot_lnkA(0x001b),
216 prt_slot_lnkA(0x001c),
217 prt_slot_lnkA(0x001d),
219 /* PCIe->PCI bridge. use PIRQ[E-H] */
220 prt_slot_lnkE(0x001e),
222 prt_slot_lnkA(0x001f)
225 #define prt_slot_gsi(nr, gsi0, gsi1, gsi2, gsi3) \
226 Package() { nr##ffff, 0, gsi0, 0 }, \
227 Package() { nr##ffff, 1, gsi1, 0 }, \
228 Package() { nr##ffff, 2, gsi2, 0 }, \
229 Package() { nr##ffff, 3, gsi3, 0 }
231 #define prt_slot_gsiA(nr) prt_slot_gsi(nr, GSIA, GSIB, GSIC, GSID)
232 #define prt_slot_gsiB(nr) prt_slot_gsi(nr, GSIB, GSIC, GSID, GSIA)
233 #define prt_slot_gsiC(nr) prt_slot_gsi(nr, GSIC, GSID, GSIA, GSIB)
234 #define prt_slot_gsiD(nr) prt_slot_gsi(nr, GSID, GSIA, GSIB, GSIC)
236 #define prt_slot_gsiE(nr) prt_slot_gsi(nr, GSIE, GSIF, GSIG, GSIH)
237 #define prt_slot_gsiF(nr) prt_slot_gsi(nr, GSIF, GSIG, GSIH, GSIE)
238 #define prt_slot_gsiG(nr) prt_slot_gsi(nr, GSIG, GSIH, GSIE, GSIF)
239 #define prt_slot_gsiH(nr) prt_slot_gsi(nr, GSIH, GSIE, GSIF, GSIG)
241 Name(PRTA, package() {
242 prt_slot_gsiE(0x0000),
243 prt_slot_gsiF(0x0001),
244 prt_slot_gsiG(0x0002),
245 prt_slot_gsiH(0x0003),
246 prt_slot_gsiE(0x0004),
247 prt_slot_gsiF(0x0005),
248 prt_slot_gsiG(0x0006),
249 prt_slot_gsiH(0x0007),
250 prt_slot_gsiE(0x0008),
251 prt_slot_gsiF(0x0009),
252 prt_slot_gsiG(0x000a),
253 prt_slot_gsiH(0x000b),
254 prt_slot_gsiE(0x000c),
255 prt_slot_gsiF(0x000d),
256 prt_slot_gsiG(0x000e),
257 prt_slot_gsiH(0x000f),
258 prt_slot_gsiE(0x0010),
259 prt_slot_gsiF(0x0011),
260 prt_slot_gsiG(0x0012),
261 prt_slot_gsiH(0x0013),
262 prt_slot_gsiE(0x0014),
263 prt_slot_gsiF(0x0015),
264 prt_slot_gsiG(0x0016),
265 prt_slot_gsiH(0x0017),
266 prt_slot_gsiE(0x0018),
268 /* INTA -> PIRQA for slot 25 - 31, but 30
269 see the default value of D<N>IR */
270 prt_slot_gsiA(0x0019),
271 prt_slot_gsiA(0x001a),
272 prt_slot_gsiA(0x001b),
273 prt_slot_gsiA(0x001c),
274 prt_slot_gsiA(0x001d),
276 /* PCIe->PCI bridge. use PIRQ[E-H] */
277 prt_slot_gsiE(0x001e),
279 prt_slot_gsiA(0x001f)
282 Method(_PRT, 0, NotSerialized) {
283 /* PCI IRQ routing table, example from ACPI 2.0a specification,
285 /* Note: we provide the same info as the PCI routing
286 table of the Bochs BIOS */
287 If (LEqual(\PICF, Zero)) {
295 Field(PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
308 Method(IQST, 1, NotSerialized) {
309 // _STA method - get status
310 If (And(0x80, Arg0)) {
315 Method(IQCR, 1, Serialized) {
316 // _CRS method - get current settings
317 Name(PRR0, ResourceTemplate() {
318 Interrupt(, Level, ActiveHigh, Shared) { 0 }
320 CreateDWordField(PRR0, 0x05, PRRI)
321 Store(And(Arg0, 0x0F), PRRI)
325 #define define_link(link, uid, reg) \
327 Name(_HID, EISAID("PNP0C0F")) \
329 Name(_PRS, ResourceTemplate() { \
330 Interrupt(, Level, ActiveHigh, Shared) { \
334 Method(_STA, 0, NotSerialized) { \
337 Method(_DIS, 0, NotSerialized) { \
340 Method(_CRS, 0, NotSerialized) { \
343 Method(_SRS, 1, NotSerialized) { \
344 CreateDWordField(Arg0, 0x05, PRRI) \
349 define_link(LNKA, 0, PRQA)
350 define_link(LNKB, 1, PRQB)
351 define_link(LNKC, 2, PRQC)
352 define_link(LNKD, 3, PRQD)
353 define_link(LNKE, 4, PRQE)
354 define_link(LNKF, 5, PRQF)
355 define_link(LNKG, 6, PRQG)
356 define_link(LNKH, 7, PRQH)
358 #define define_gsi_link(link, uid, gsi) \
360 Name(_HID, EISAID("PNP0C0F")) \
362 Name(_PRS, ResourceTemplate() { \
363 Interrupt(, Level, ActiveHigh, Shared) { \
367 Name(_CRS, ResourceTemplate() { \
368 Interrupt(, Level, ActiveHigh, Shared) { \
372 Method(_SRS, 1, NotSerialized) { \
376 define_gsi_link(GSIA, 0, 0x10)
377 define_gsi_link(GSIB, 0, 0x11)
378 define_gsi_link(GSIC, 0, 0x12)
379 define_gsi_link(GSID, 0, 0x13)
380 define_gsi_link(GSIE, 0, 0x14)
381 define_gsi_link(GSIF, 0, 0x15)
382 define_gsi_link(GSIG, 0, 0x16)
383 define_gsi_link(GSIH, 0, 0x17)
386 #include "hw/acpi/pc-hotplug.h"
387 #define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE
388 #include "acpi-dsdt-cpu-hotplug.dsl"
389 #include "acpi-dsdt-mem-hotplug.dsl"
392 /****************************************************************
393 * General purpose events
394 ****************************************************************/
396 Name(_HID, "ACPI0006")
407 // Memory hotplug event
408 \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD()