scsi: Document intentional fall through in scsi_req_length()
[qemu/armbru.git] / hw / i386 / q35-acpi-dsdt.dsl
blobf4d2a2daeef842d00bd788d13f9233fae6b15fed
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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
20  * Copyright (c) 2010 Isaku Yamahata
21  *                    yamahata at valinux co jp
22  * Based on acpi-dsdt.dsl, but heavily modified for q35 chipset.
23  */
25 ACPI_EXTRACT_ALL_CODE Q35AcpiDsdtAmlCode
27 DefinitionBlock (
28     "q35-acpi-dsdt.aml",// Output Filename
29     "DSDT",             // Signature
30     0x01,               // DSDT Compliance Revision
31     "BXPC",             // OEMID
32     "BXDSDT",           // TABLE ID
33     0x2                 // OEM Revision
34     )
37 #include "acpi-dsdt-dbug.dsl"
39     Scope(\_SB) {
40         OperationRegion(PCST, SystemIO, 0xae00, 0x0c)
41         OperationRegion(PCSB, SystemIO, 0xae0c, 0x01)
42         Field(PCSB, AnyAcc, NoLock, WriteAsZeros) {
43             PCIB, 8,
44         }
45     }
48 /****************************************************************
49  * PCI Bus definition
50  ****************************************************************/
51 #define BOARD_SPECIFIC_PCI_RESOURSES \
52      WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \
53          0x0000, \
54          0x0000, \
55          0x0CD7, \
56          0x0000, \
57          0x0CD8, \
58          ,, , TypeStatic) \
59      /* 0xcd8-0xcf7 hole for CPU hotplug, hw/acpi/ich9.c:ICH9_PROC_BASE */ \
60      WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \
61          0x0000, \
62          0x0D00, \
63          0xFFFF, \
64          0x0000, \
65          0xF300, \
66          ,, , TypeStatic)
68     Scope(\_SB) {
69         Device(PCI0) {
70             Name(_HID, EisaId("PNP0A08"))
71             Name(_CID, EisaId("PNP0A03"))
72             Name(_ADR, 0x00)
73             Name(_UID, 1)
75             External(ISA, DeviceObj)
77             // _OSC: based on sample of ACPI3.0b spec
78             Name(SUPP, 0) // PCI _OSC Support Field value
79             Name(CTRL, 0) // PCI _OSC Control Field value
80             Method(_OSC, 4) {
81                 // Create DWORD-addressable fields from the Capabilities Buffer
82                 CreateDWordField(Arg3, 0, CDW1)
84                 // Check for proper UUID
85                 If (LEqual(Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
86                     // Create DWORD-addressable fields from the Capabilities Buffer
87                     CreateDWordField(Arg3, 4, CDW2)
88                     CreateDWordField(Arg3, 8, CDW3)
90                     // Save Capabilities DWORD2 & 3
91                     Store(CDW2, SUPP)
92                     Store(CDW3, CTRL)
94                     // Always allow native PME, AER (no dependencies)
95                     // Never allow SHPC (no SHPC controller in this system)
96                     And(CTRL, 0x1D, CTRL)
98 #if 0 // For now, nothing to do
99                     If (Not(And(CDW1, 1))) { // Query flag clear?
100                         // Disable GPEs for features granted native control.
101                         If (And(CTRL, 0x01)) { // Hot plug control granted?
102                             Store(0, HPCE) // clear the hot plug SCI enable bit
103                             Store(1, HPCS) // clear the hot plug SCI status bit
104                         }
105                         If (And(CTRL, 0x04)) { // PME control granted?
106                             Store(0, PMCE) // clear the PME SCI enable bit
107                             Store(1, PMCS) // clear the PME SCI status bit
108                         }
109                         If (And(CTRL, 0x10)) { // OS restoring PCI Express cap structure?
110                             // Set status to not restore PCI Express cap structure
111                             // upon resume from S3
112                             Store(1, S3CR)
113                         }
114                     }
115 #endif
116                     If (LNotEqual(Arg1, One)) {
117                         // Unknown revision
118                         Or(CDW1, 0x08, CDW1)
119                     }
120                     If (LNotEqual(CDW3, CTRL)) {
121                         // Capabilities bits were masked
122                         Or(CDW1, 0x10, CDW1)
123                     }
124                     // Update DWORD3 in the buffer
125                     Store(CTRL, CDW3)
126                 } Else {
127                     Or(CDW1, 4, CDW1) // Unrecognized UUID
128                 }
129                 Return (Arg3)
130             }
131         }
132     }
134 #include "acpi-dsdt-pci-crs.dsl"
135 #include "acpi-dsdt-hpet.dsl"
138 /****************************************************************
139  * LPC ISA bridge
140  ****************************************************************/
142     Scope(\_SB.PCI0) {
143         /* PCI D31:f0 LPC ISA bridge */
144         Device(ISA) {
145             Name (_ADR, 0x001F0000)  // _ADR: Address
147             /* ICH9 PCI to ISA irq remapping */
148             OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
150             OperationRegion(LPCD, PCI_Config, 0x80, 0x2)
151             Field(LPCD, AnyAcc, NoLock, Preserve) {
152                 COMA,   3,
153                     ,   1,
154                 COMB,   3,
156                 Offset(0x01),
157                 LPTD,   2,
158                     ,   2,
159                 FDCD,   2
160             }
161             OperationRegion(LPCE, PCI_Config, 0x82, 0x2)
162             Field(LPCE, AnyAcc, NoLock, Preserve) {
163                 CAEN,   1,
164                 CBEN,   1,
165                 LPEN,   1,
166                 FDEN,   1
167             }
168         }
169     }
171 #define DSDT_APPLESMC_STA q35_dsdt_applesmc_sta
172 #include "acpi-dsdt-isa.dsl"
175 /****************************************************************
176  * PCI IRQs
177  ****************************************************************/
179     /* Zero => PIC mode, One => APIC Mode */
180     Name(\PICF, Zero)
181     Method(\_PIC, 1, NotSerialized) {
182         Store(Arg0, \PICF)
183     }
185     Scope(\_SB) {
186         Scope(PCI0) {
187 #define prt_slot_lnk(nr, lnk0, lnk1, lnk2, lnk3)  \
188     Package() { nr##ffff, 0, lnk0, 0 },           \
189     Package() { nr##ffff, 1, lnk1, 0 },           \
190     Package() { nr##ffff, 2, lnk2, 0 },           \
191     Package() { nr##ffff, 3, lnk3, 0 }
193 #define prt_slot_lnkA(nr) prt_slot_lnk(nr, LNKA, LNKB, LNKC, LNKD)
194 #define prt_slot_lnkB(nr) prt_slot_lnk(nr, LNKB, LNKC, LNKD, LNKA)
195 #define prt_slot_lnkC(nr) prt_slot_lnk(nr, LNKC, LNKD, LNKA, LNKB)
196 #define prt_slot_lnkD(nr) prt_slot_lnk(nr, LNKD, LNKA, LNKB, LNKC)
198 #define prt_slot_lnkE(nr) prt_slot_lnk(nr, LNKE, LNKF, LNKG, LNKH)
199 #define prt_slot_lnkF(nr) prt_slot_lnk(nr, LNKF, LNKG, LNKH, LNKE)
200 #define prt_slot_lnkG(nr) prt_slot_lnk(nr, LNKG, LNKH, LNKE, LNKF)
201 #define prt_slot_lnkH(nr) prt_slot_lnk(nr, LNKH, LNKE, LNKF, LNKG)
203             Name(PRTP, package() {
204                 prt_slot_lnkE(0x0000),
205                 prt_slot_lnkF(0x0001),
206                 prt_slot_lnkG(0x0002),
207                 prt_slot_lnkH(0x0003),
208                 prt_slot_lnkE(0x0004),
209                 prt_slot_lnkF(0x0005),
210                 prt_slot_lnkG(0x0006),
211                 prt_slot_lnkH(0x0007),
212                 prt_slot_lnkE(0x0008),
213                 prt_slot_lnkF(0x0009),
214                 prt_slot_lnkG(0x000a),
215                 prt_slot_lnkH(0x000b),
216                 prt_slot_lnkE(0x000c),
217                 prt_slot_lnkF(0x000d),
218                 prt_slot_lnkG(0x000e),
219                 prt_slot_lnkH(0x000f),
220                 prt_slot_lnkE(0x0010),
221                 prt_slot_lnkF(0x0011),
222                 prt_slot_lnkG(0x0012),
223                 prt_slot_lnkH(0x0013),
224                 prt_slot_lnkE(0x0014),
225                 prt_slot_lnkF(0x0015),
226                 prt_slot_lnkG(0x0016),
227                 prt_slot_lnkH(0x0017),
228                 prt_slot_lnkE(0x0018),
230                 /* INTA -> PIRQA for slot 25 - 31
231                    see the default value of D<N>IR */
232                 prt_slot_lnkA(0x0019),
233                 prt_slot_lnkA(0x001a),
234                 prt_slot_lnkA(0x001b),
235                 prt_slot_lnkA(0x001c),
236                 prt_slot_lnkA(0x001d),
238                 /* PCIe->PCI bridge. use PIRQ[E-H] */
239                 prt_slot_lnkE(0x001e),
241                 prt_slot_lnkA(0x001f)
242             })
244 #define prt_slot_gsi(nr, gsi0, gsi1, gsi2, gsi3)  \
245     Package() { nr##ffff, 0, gsi0, 0 },           \
246     Package() { nr##ffff, 1, gsi1, 0 },           \
247     Package() { nr##ffff, 2, gsi2, 0 },           \
248     Package() { nr##ffff, 3, gsi3, 0 }
250 #define prt_slot_gsiA(nr) prt_slot_gsi(nr, GSIA, GSIB, GSIC, GSID)
251 #define prt_slot_gsiB(nr) prt_slot_gsi(nr, GSIB, GSIC, GSID, GSIA)
252 #define prt_slot_gsiC(nr) prt_slot_gsi(nr, GSIC, GSID, GSIA, GSIB)
253 #define prt_slot_gsiD(nr) prt_slot_gsi(nr, GSID, GSIA, GSIB, GSIC)
255 #define prt_slot_gsiE(nr) prt_slot_gsi(nr, GSIE, GSIF, GSIG, GSIH)
256 #define prt_slot_gsiF(nr) prt_slot_gsi(nr, GSIF, GSIG, GSIH, GSIE)
257 #define prt_slot_gsiG(nr) prt_slot_gsi(nr, GSIG, GSIH, GSIE, GSIF)
258 #define prt_slot_gsiH(nr) prt_slot_gsi(nr, GSIH, GSIE, GSIF, GSIG)
260             Name(PRTA, package() {
261                 prt_slot_gsiE(0x0000),
262                 prt_slot_gsiF(0x0001),
263                 prt_slot_gsiG(0x0002),
264                 prt_slot_gsiH(0x0003),
265                 prt_slot_gsiE(0x0004),
266                 prt_slot_gsiF(0x0005),
267                 prt_slot_gsiG(0x0006),
268                 prt_slot_gsiH(0x0007),
269                 prt_slot_gsiE(0x0008),
270                 prt_slot_gsiF(0x0009),
271                 prt_slot_gsiG(0x000a),
272                 prt_slot_gsiH(0x000b),
273                 prt_slot_gsiE(0x000c),
274                 prt_slot_gsiF(0x000d),
275                 prt_slot_gsiG(0x000e),
276                 prt_slot_gsiH(0x000f),
277                 prt_slot_gsiE(0x0010),
278                 prt_slot_gsiF(0x0011),
279                 prt_slot_gsiG(0x0012),
280                 prt_slot_gsiH(0x0013),
281                 prt_slot_gsiE(0x0014),
282                 prt_slot_gsiF(0x0015),
283                 prt_slot_gsiG(0x0016),
284                 prt_slot_gsiH(0x0017),
285                 prt_slot_gsiE(0x0018),
287                 /* INTA -> PIRQA for slot 25 - 31, but 30
288                    see the default value of D<N>IR */
289                 prt_slot_gsiA(0x0019),
290                 prt_slot_gsiA(0x001a),
291                 prt_slot_gsiA(0x001b),
292                 prt_slot_gsiA(0x001c),
293                 prt_slot_gsiA(0x001d),
295                 /* PCIe->PCI bridge. use PIRQ[E-H] */
296                 prt_slot_gsiE(0x001e),
298                 prt_slot_gsiA(0x001f)
299             })
301             Method(_PRT, 0, NotSerialized) {
302                 /* PCI IRQ routing table, example from ACPI 2.0a specification,
303                    section 6.2.8.1 */
304                 /* Note: we provide the same info as the PCI routing
305                    table of the Bochs BIOS */
306                 If (LEqual(\PICF, Zero)) {
307                     Return (PRTP)
308                 } Else {
309                     Return (PRTA)
310                 }
311             }
312         }
314         Field(PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
315             PRQA,   8,
316             PRQB,   8,
317             PRQC,   8,
318             PRQD,   8,
320             Offset(0x08),
321             PRQE,   8,
322             PRQF,   8,
323             PRQG,   8,
324             PRQH,   8
325         }
327         Method(IQST, 1, NotSerialized) {
328             // _STA method - get status
329             If (And(0x80, Arg0)) {
330                 Return (0x09)
331             }
332             Return (0x0B)
333         }
334         Method(IQCR, 1, Serialized) {
335             // _CRS method - get current settings
336             Name(PRR0, ResourceTemplate() {
337                 Interrupt(, Level, ActiveHigh, Shared) { 0 }
338             })
339             CreateDWordField(PRR0, 0x05, PRRI)
340             Store(And(Arg0, 0x0F), PRRI)
341             Return (PRR0)
342         }
344 #define define_link(link, uid, reg)                             \
345         Device(link) {                                          \
346             Name(_HID, EISAID("PNP0C0F"))                       \
347             Name(_UID, uid)                                     \
348             Name(_PRS, ResourceTemplate() {                     \
349                 Interrupt(, Level, ActiveHigh, Shared) {        \
350                     5, 10, 11                                   \
351                 }                                               \
352             })                                                  \
353             Method(_STA, 0, NotSerialized) {                    \
354                 Return (IQST(reg))                              \
355             }                                                   \
356             Method(_DIS, 0, NotSerialized) {                    \
357                 Or(reg, 0x80, reg)                              \
358             }                                                   \
359             Method(_CRS, 0, NotSerialized) {                    \
360                 Return (IQCR(reg))                              \
361             }                                                   \
362             Method(_SRS, 1, NotSerialized) {                    \
363                 CreateDWordField(Arg0, 0x05, PRRI)              \
364                 Store(PRRI, reg)                                \
365             }                                                   \
366         }
368         define_link(LNKA, 0, PRQA)
369         define_link(LNKB, 1, PRQB)
370         define_link(LNKC, 2, PRQC)
371         define_link(LNKD, 3, PRQD)
372         define_link(LNKE, 4, PRQE)
373         define_link(LNKF, 5, PRQF)
374         define_link(LNKG, 6, PRQG)
375         define_link(LNKH, 7, PRQH)
377 #define define_gsi_link(link, uid, gsi)                         \
378         Device(link) {                                          \
379             Name(_HID, EISAID("PNP0C0F"))                       \
380             Name(_UID, uid)                                     \
381             Name(_PRS, ResourceTemplate() {                     \
382                 Interrupt(, Level, ActiveHigh, Shared) {        \
383                     gsi                                         \
384                 }                                               \
385             })                                                  \
386             Name(_CRS, ResourceTemplate() {                     \
387                 Interrupt(, Level, ActiveHigh, Shared) {        \
388                     gsi                                         \
389                 }                                               \
390             })                                                  \
391             Method(_SRS, 1, NotSerialized) {                    \
392             }                                                   \
393         }
395         define_gsi_link(GSIA, 0, 0x10)
396         define_gsi_link(GSIB, 0, 0x11)
397         define_gsi_link(GSIC, 0, 0x12)
398         define_gsi_link(GSID, 0, 0x13)
399         define_gsi_link(GSIE, 0, 0x14)
400         define_gsi_link(GSIF, 0, 0x15)
401         define_gsi_link(GSIG, 0, 0x16)
402         define_gsi_link(GSIH, 0, 0x17)
403     }
405 #include "hw/acpi/cpu_hotplug_defs.h"
406 #define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE
407 #include "acpi-dsdt-cpu-hotplug.dsl"
410 /****************************************************************
411  * General purpose events
412  ****************************************************************/
414     Scope(\_GPE) {
415         Name(_HID, "ACPI0006")
417         Method(_L00) {
418         }
419         Method(_L01) {
420         }
421         Method(_E02) {
422             // CPU hotplug event
423             \_SB.PRSC()
424         }
425         Method(_L03) {
426         }
427         Method(_L04) {
428         }
429         Method(_L05) {
430         }
431         Method(_L06) {
432         }
433         Method(_L07) {
434         }
435         Method(_L08) {
436         }
437         Method(_L09) {
438         }
439         Method(_L0A) {
440         }
441         Method(_L0B) {
442         }
443         Method(_L0C) {
444         }
445         Method(_L0D) {
446         }
447         Method(_L0E) {
448         }
449         Method(_L0F) {
450         }
451     }