pc: acpi: move COM devices from DSDT to SSDT
[qemu/cris-port.git] / hw / i386 / acpi-dsdt.dsl
blob6048cc70579d10f8fecd28db674cd29c2b826c4e
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  */
20 ACPI_EXTRACT_ALL_CODE AcpiDsdtAmlCode
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     )
32     Scope(\_SB) {
33         Device(PCI0) {
34             Name(_HID, EisaId("PNP0A03"))
35             Name(_ADR, 0x00)
36             Name(_UID, 1)
37 //#define PX13 S0B_
38 //            External(PX13, DeviceObj)
39         }
40     }
42 /****************************************************************
43  * PIIX4 PM
44  ****************************************************************/
46     Scope(\_SB.PCI0) {
47         Device(PX13) {
48             Name(_ADR, 0x00010003)
49             OperationRegion(P13C, PCI_Config, 0x00, 0xff)
50         }
51     }
54 /****************************************************************
55  * PIIX3 ISA bridge
56  ****************************************************************/
58     Scope(\_SB.PCI0) {
60         External(ISA, DeviceObj)
62         Device(ISA) {
63             Name(_ADR, 0x00010000)
65             /* PIIX PCI to ISA irq remapping */
66             OperationRegion(P40C, PCI_Config, 0x60, 0x04)
68             /* enable bits */
69             Field(\_SB.PCI0.PX13.P13C, AnyAcc, NoLock, Preserve) {
70                 Offset(0x5f),
71                 , 7,
72                 LPEN, 1,         // LPT
73                 Offset(0x67),
74                 , 3,
75                 CAEN, 1,         // COM1
76                 , 3,
77                 CBEN, 1,         // COM2
78             }
79             Name(FDEN, 1)
80         }
81     }
83 /****************************************************************
84  * PCI hotplug
85  ****************************************************************/
87     Scope(\_SB.PCI0) {
88         OperationRegion(PCST, SystemIO, 0xae00, 0x08)
89         Field(PCST, DWordAcc, NoLock, WriteAsZeros) {
90             PCIU, 32,
91             PCID, 32,
92         }
94         OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
95         Field(SEJ, DWordAcc, NoLock, WriteAsZeros) {
96             B0EJ, 32,
97         }
99         OperationRegion(BNMR, SystemIO, 0xae10, 0x04)
100         Field(BNMR, DWordAcc, NoLock, WriteAsZeros) {
101             BNUM, 32,
102         }
104         /* Lock to protect access to fields above. */
105         Mutex(BLCK, 0)
107         /* Methods called by bulk generated PCI devices below */
109         /* Methods called by hotplug devices */
110         Method(PCEJ, 2, NotSerialized) {
111             // _EJ0 method - eject callback
112             Acquire(BLCK, 0xFFFF)
113             Store(Arg0, BNUM)
114             Store(ShiftLeft(1, Arg1), B0EJ)
115             Release(BLCK)
116             Return (0x0)
117         }
119         /* Hotplug notification method supplied by SSDT */
120         External(\_SB.PCI0.PCNT, MethodObj)
121     }
124 /****************************************************************
125  * PCI IRQs
126  ****************************************************************/
128     Scope(\_SB) {
129         Scope(PCI0) {
130             Method (_PRT, 0) {
131                 Store(Package(128) {}, Local0)
132                 Store(Zero, Local1)
133                 While(LLess(Local1, 128)) {
134                     // slot = pin >> 2
135                     Store(ShiftRight(Local1, 2), Local2)
137                     // lnk = (slot + pin) & 3
138                     Store(And(Add(Local1, Local2), 3), Local3)
139                     If (LEqual(Local3, 0)) {
140                         Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
141                     }
142                     If (LEqual(Local3, 1)) {
143                         // device 1 is the power-management device, needs SCI
144                         If (LEqual(Local1, 4)) {
145                             Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
146                         } Else {
147                             Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
148                         }
149                     }
150                     If (LEqual(Local3, 2)) {
151                         Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
152                     }
153                     If (LEqual(Local3, 3)) {
154                         Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
155                     }
157                     // Complete the interrupt routing entry:
158                     //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
160                     Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
161                     Store(And(Local1, 3),                    Index(Local4, 1))
162                     Store(Local4,                            Index(Local0, Local1))
164                     Increment(Local1)
165                 }
167                 Return(Local0)
168             }
169         }
171         Field(PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) {
172             PRQ0,   8,
173             PRQ1,   8,
174             PRQ2,   8,
175             PRQ3,   8
176         }
178         Method(IQST, 1, NotSerialized) {
179             // _STA method - get status
180             If (And(0x80, Arg0)) {
181                 Return (0x09)
182             }
183             Return (0x0B)
184         }
185         Method(IQCR, 1, Serialized) {
186             // _CRS method - get current settings
187             Name(PRR0, ResourceTemplate() {
188                 Interrupt(, Level, ActiveHigh, Shared) { 0 }
189             })
190             CreateDWordField(PRR0, 0x05, PRRI)
191             If (LLess(Arg0, 0x80)) {
192                 Store(Arg0, PRRI)
193             }
194             Return (PRR0)
195         }
197 #define define_link(link, uid, reg)                             \
198         Device(link) {                                          \
199             Name(_HID, EISAID("PNP0C0F"))                       \
200             Name(_UID, uid)                                     \
201             Name(_PRS, ResourceTemplate() {                     \
202                 Interrupt(, Level, ActiveHigh, Shared) {        \
203                     5, 10, 11                                   \
204                 }                                               \
205             })                                                  \
206             Method(_STA, 0, NotSerialized) {                    \
207                 Return (IQST(reg))                              \
208             }                                                   \
209             Method(_DIS, 0, NotSerialized) {                    \
210                 Or(reg, 0x80, reg)                              \
211             }                                                   \
212             Method(_CRS, 0, NotSerialized) {                    \
213                 Return (IQCR(reg))                              \
214             }                                                   \
215             Method(_SRS, 1, NotSerialized) {                    \
216                 CreateDWordField(Arg0, 0x05, PRRI)              \
217                 Store(PRRI, reg)                                \
218             }                                                   \
219         }
221         define_link(LNKA, 0, PRQ0)
222         define_link(LNKB, 1, PRQ1)
223         define_link(LNKC, 2, PRQ2)
224         define_link(LNKD, 3, PRQ3)
226         Device(LNKS) {
227             Name(_HID, EISAID("PNP0C0F"))
228             Name(_UID, 4)
229             Name(_PRS, ResourceTemplate() {
230                 Interrupt(, Level, ActiveHigh, Shared) { 9 }
231             })
233             // The SCI cannot be disabled and is always attached to GSI 9,
234             // so these are no-ops.  We only need this link to override the
235             // polarity to active high and match the content of the MADT.
236             Method(_STA, 0, NotSerialized) { Return (0x0b) }
237             Method(_DIS, 0, NotSerialized) { }
238             Method(_CRS, 0, NotSerialized) { Return (_PRS) }
239             Method(_SRS, 1, NotSerialized) { }
240         }
241     }
243 /****************************************************************
244  * General purpose events
245  ****************************************************************/
246     Scope(\_GPE) {
247         Name(_HID, "ACPI0006")
249         Method(_L00) {
250         }
251         Method(_E01) {
252             // PCI hotplug event
253             Acquire(\_SB.PCI0.BLCK, 0xFFFF)
254             \_SB.PCI0.PCNT()
255             Release(\_SB.PCI0.BLCK)
256         }
257         Method(_L04) {
258         }
259         Method(_L05) {
260         }
261         Method(_L06) {
262         }
263         Method(_L07) {
264         }
265         Method(_L08) {
266         }
267         Method(_L09) {
268         }
269         Method(_L0A) {
270         }
271         Method(_L0B) {
272         }
273         Method(_L0C) {
274         }
275         Method(_L0D) {
276         }
277         Method(_L0E) {
278         }
279         Method(_L0F) {
280         }
281     }