]>
Commit | Line | Data |
---|---|---|
74523b85 MT |
1 | /* |
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 | */ | |
19 | ||
20 | ACPI_EXTRACT_ALL_CODE AcpiDsdtAmlCode | |
21 | ||
22 | DefinitionBlock ( | |
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 | { | |
31 | ||
32 | #include "acpi-dsdt-dbug.dsl" | |
33 | ||
34 | ||
35 | /**************************************************************** | |
36 | * PCI Bus definition | |
37 | ****************************************************************/ | |
38 | ||
39 | Scope(\_SB) { | |
40 | Device(PCI0) { | |
41 | Name(_HID, EisaId("PNP0A03")) | |
42 | Name(_ADR, 0x00) | |
43 | Name(_UID, 1) | |
44 | } | |
45 | } | |
46 | ||
47 | #include "acpi-dsdt-pci-crs.dsl" | |
48 | #include "acpi-dsdt-hpet.dsl" | |
49 | ||
50 | ||
51 | /**************************************************************** | |
52 | * VGA | |
53 | ****************************************************************/ | |
54 | ||
55 | Scope(\_SB.PCI0) { | |
56 | Device(VGA) { | |
57 | Name(_ADR, 0x00020000) | |
58 | OperationRegion(PCIC, PCI_Config, Zero, 0x4) | |
59 | Field(PCIC, DWordAcc, NoLock, Preserve) { | |
60 | VEND, 32 | |
61 | } | |
62 | Method(_S1D, 0, NotSerialized) { | |
63 | Return (0x00) | |
64 | } | |
65 | Method(_S2D, 0, NotSerialized) { | |
66 | Return (0x00) | |
67 | } | |
68 | Method(_S3D, 0, NotSerialized) { | |
69 | If (LEqual(VEND, 0x1001b36)) { | |
70 | Return (0x03) // QXL | |
71 | } Else { | |
72 | Return (0x00) | |
73 | } | |
74 | } | |
75 | } | |
76 | } | |
77 | ||
78 | ||
79 | /**************************************************************** | |
80 | * PIIX4 PM | |
81 | ****************************************************************/ | |
82 | ||
83 | Scope(\_SB.PCI0) { | |
84 | Device(PX13) { | |
85 | Name(_ADR, 0x00010003) | |
86 | OperationRegion(P13C, PCI_Config, 0x00, 0xff) | |
87 | } | |
88 | } | |
89 | ||
90 | ||
91 | /**************************************************************** | |
92 | * PIIX3 ISA bridge | |
93 | ****************************************************************/ | |
94 | ||
95 | Scope(\_SB.PCI0) { | |
96 | Device(ISA) { | |
97 | Name(_ADR, 0x00010000) | |
98 | ||
99 | /* PIIX PCI to ISA irq remapping */ | |
100 | OperationRegion(P40C, PCI_Config, 0x60, 0x04) | |
101 | ||
102 | /* enable bits */ | |
103 | Field(\_SB.PCI0.PX13.P13C, AnyAcc, NoLock, Preserve) { | |
104 | Offset(0x5f), | |
105 | , 7, | |
106 | LPEN, 1, // LPT | |
107 | Offset(0x67), | |
108 | , 3, | |
109 | CAEN, 1, // COM1 | |
110 | , 3, | |
111 | CBEN, 1, // COM2 | |
112 | } | |
113 | Name(FDEN, 1) | |
114 | } | |
115 | } | |
116 | ||
117 | #include "acpi-dsdt-isa.dsl" | |
118 | ||
119 | ||
120 | /**************************************************************** | |
121 | * PCI hotplug | |
122 | ****************************************************************/ | |
123 | ||
124 | Scope(\_SB.PCI0) { | |
125 | OperationRegion(PCST, SystemIO, 0xae00, 0x08) | |
126 | Field(PCST, DWordAcc, NoLock, WriteAsZeros) { | |
127 | PCIU, 32, | |
128 | PCID, 32, | |
129 | } | |
130 | ||
131 | OperationRegion(SEJ, SystemIO, 0xae08, 0x04) | |
132 | Field(SEJ, DWordAcc, NoLock, WriteAsZeros) { | |
133 | B0EJ, 32, | |
134 | } | |
135 | ||
136 | /* Methods called by bulk generated PCI devices below */ | |
137 | ||
138 | /* Methods called by hotplug devices */ | |
139 | Method(PCEJ, 1, NotSerialized) { | |
140 | // _EJ0 method - eject callback | |
141 | Store(ShiftLeft(1, Arg0), B0EJ) | |
142 | Return (0x0) | |
143 | } | |
144 | ||
145 | /* Hotplug notification method supplied by SSDT */ | |
146 | External(\_SB.PCI0.PCNT, MethodObj) | |
147 | ||
148 | /* PCI hotplug notify method */ | |
149 | Method(PCNF, 0) { | |
150 | // Local0 = iterator | |
151 | Store(Zero, Local0) | |
152 | While (LLess(Local0, 31)) { | |
153 | Increment(Local0) | |
154 | If (And(PCIU, ShiftLeft(1, Local0))) { | |
155 | PCNT(Local0, 1) | |
156 | } | |
157 | If (And(PCID, ShiftLeft(1, Local0))) { | |
158 | PCNT(Local0, 3) | |
159 | } | |
160 | } | |
161 | } | |
162 | } | |
163 | ||
164 | ||
165 | /**************************************************************** | |
166 | * PCI IRQs | |
167 | ****************************************************************/ | |
168 | ||
169 | Scope(\_SB) { | |
170 | Scope(PCI0) { | |
171 | Name(_PRT, Package() { | |
172 | /* PCI IRQ routing table, example from ACPI 2.0a specification, | |
173 | section 6.2.8.1 */ | |
174 | /* Note: we provide the same info as the PCI routing | |
175 | table of the Bochs BIOS */ | |
176 | ||
177 | #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \ | |
178 | Package() { nr##ffff, 0, lnk0, 0 }, \ | |
179 | Package() { nr##ffff, 1, lnk1, 0 }, \ | |
180 | Package() { nr##ffff, 2, lnk2, 0 }, \ | |
181 | Package() { nr##ffff, 3, lnk3, 0 } | |
182 | ||
183 | #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC) | |
184 | #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD) | |
185 | #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA) | |
186 | #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB) | |
187 | ||
188 | prt_slot0(0x0000), | |
189 | /* Device 1 is power mgmt device, and can only use irq 9 */ | |
190 | prt_slot(0x0001, LNKS, LNKB, LNKC, LNKD), | |
191 | prt_slot2(0x0002), | |
192 | prt_slot3(0x0003), | |
193 | prt_slot0(0x0004), | |
194 | prt_slot1(0x0005), | |
195 | prt_slot2(0x0006), | |
196 | prt_slot3(0x0007), | |
197 | prt_slot0(0x0008), | |
198 | prt_slot1(0x0009), | |
199 | prt_slot2(0x000a), | |
200 | prt_slot3(0x000b), | |
201 | prt_slot0(0x000c), | |
202 | prt_slot1(0x000d), | |
203 | prt_slot2(0x000e), | |
204 | prt_slot3(0x000f), | |
205 | prt_slot0(0x0010), | |
206 | prt_slot1(0x0011), | |
207 | prt_slot2(0x0012), | |
208 | prt_slot3(0x0013), | |
209 | prt_slot0(0x0014), | |
210 | prt_slot1(0x0015), | |
211 | prt_slot2(0x0016), | |
212 | prt_slot3(0x0017), | |
213 | prt_slot0(0x0018), | |
214 | prt_slot1(0x0019), | |
215 | prt_slot2(0x001a), | |
216 | prt_slot3(0x001b), | |
217 | prt_slot0(0x001c), | |
218 | prt_slot1(0x001d), | |
219 | prt_slot2(0x001e), | |
220 | prt_slot3(0x001f), | |
221 | }) | |
222 | } | |
223 | ||
224 | Field(PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) { | |
225 | PRQ0, 8, | |
226 | PRQ1, 8, | |
227 | PRQ2, 8, | |
228 | PRQ3, 8 | |
229 | } | |
230 | ||
231 | Method(IQST, 1, NotSerialized) { | |
232 | // _STA method - get status | |
233 | If (And(0x80, Arg0)) { | |
234 | Return (0x09) | |
235 | } | |
236 | Return (0x0B) | |
237 | } | |
6b9b4405 | 238 | Method(IQCR, 1, Serialized) { |
74523b85 MT |
239 | // _CRS method - get current settings |
240 | Name(PRR0, ResourceTemplate() { | |
241 | Interrupt(, Level, ActiveHigh, Shared) { 0 } | |
242 | }) | |
243 | CreateDWordField(PRR0, 0x05, PRRI) | |
244 | If (LLess(Arg0, 0x80)) { | |
245 | Store(Arg0, PRRI) | |
246 | } | |
247 | Return (PRR0) | |
248 | } | |
249 | ||
250 | #define define_link(link, uid, reg) \ | |
251 | Device(link) { \ | |
252 | Name(_HID, EISAID("PNP0C0F")) \ | |
253 | Name(_UID, uid) \ | |
254 | Name(_PRS, ResourceTemplate() { \ | |
255 | Interrupt(, Level, ActiveHigh, Shared) { \ | |
256 | 5, 10, 11 \ | |
257 | } \ | |
258 | }) \ | |
259 | Method(_STA, 0, NotSerialized) { \ | |
260 | Return (IQST(reg)) \ | |
261 | } \ | |
262 | Method(_DIS, 0, NotSerialized) { \ | |
263 | Or(reg, 0x80, reg) \ | |
264 | } \ | |
265 | Method(_CRS, 0, NotSerialized) { \ | |
266 | Return (IQCR(reg)) \ | |
267 | } \ | |
268 | Method(_SRS, 1, NotSerialized) { \ | |
269 | CreateDWordField(Arg0, 0x05, PRRI) \ | |
270 | Store(PRRI, reg) \ | |
271 | } \ | |
272 | } | |
273 | ||
274 | define_link(LNKA, 0, PRQ0) | |
275 | define_link(LNKB, 1, PRQ1) | |
276 | define_link(LNKC, 2, PRQ2) | |
277 | define_link(LNKD, 3, PRQ3) | |
278 | ||
279 | Device(LNKS) { | |
280 | Name(_HID, EISAID("PNP0C0F")) | |
281 | Name(_UID, 4) | |
282 | Name(_PRS, ResourceTemplate() { | |
283 | Interrupt(, Level, ActiveHigh, Shared) { 9 } | |
284 | }) | |
285 | ||
286 | // The SCI cannot be disabled and is always attached to GSI 9, | |
287 | // so these are no-ops. We only need this link to override the | |
288 | // polarity to active high and match the content of the MADT. | |
289 | Method(_STA, 0, NotSerialized) { Return (0x0b) } | |
290 | Method(_DIS, 0, NotSerialized) { } | |
291 | Method(_CRS, 0, NotSerialized) { Return (_PRS) } | |
292 | Method(_SRS, 1, NotSerialized) { } | |
293 | } | |
294 | } | |
295 | ||
296 | #include "acpi-dsdt-cpu-hotplug.dsl" | |
297 | ||
298 | ||
299 | /**************************************************************** | |
300 | * General purpose events | |
301 | ****************************************************************/ | |
302 | ||
303 | Scope(\_GPE) { | |
304 | Name(_HID, "ACPI0006") | |
305 | ||
306 | Method(_L00) { | |
307 | } | |
308 | Method(_E01) { | |
309 | // PCI hotplug event | |
310 | \_SB.PCI0.PCNF() | |
311 | } | |
312 | Method(_E02) { | |
313 | // CPU hotplug event | |
314 | \_SB.PRSC() | |
315 | } | |
316 | Method(_L03) { | |
317 | } | |
318 | Method(_L04) { | |
319 | } | |
320 | Method(_L05) { | |
321 | } | |
322 | Method(_L06) { | |
323 | } | |
324 | Method(_L07) { | |
325 | } | |
326 | Method(_L08) { | |
327 | } | |
328 | Method(_L09) { | |
329 | } | |
330 | Method(_L0A) { | |
331 | } | |
332 | Method(_L0B) { | |
333 | } | |
334 | Method(_L0C) { | |
335 | } | |
336 | Method(_L0D) { | |
337 | } | |
338 | Method(_L0E) { | |
339 | } | |
340 | Method(_L0F) { | |
341 | } | |
342 | } | |
343 | } |