Statistics
| Branch: | Revision:

root / hw / acpi-dsdt.dsl @ 0986ac3b

History | View | Annotate | Download (15.5 kB)

1
/*
2
 * 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
DefinitionBlock (
20
    "acpi-dsdt.aml",    // Output Filename
21
    "DSDT",             // Signature
22
    0x01,               // DSDT Compliance Revision
23
    "QEMU",             // OEMID
24
    "QEMUDSDT",         // TABLE ID
25
    0x1                 // OEM Revision
26
    )
27
{
28
    Scope (\)
29
    {
30
        /* CMOS memory access */
31
        OperationRegion (CMS, SystemIO, 0x70, 0x02)
32
        Field (CMS, ByteAcc, NoLock, Preserve)
33
        {
34
            CMSI,   8, 
35
            CMSD,   8
36
        }
37
        Method (CMRD, 1, NotSerialized)
38
        {
39
            Store (Arg0, CMSI)
40
            Store (CMSD, Local0)
41
            Return (Local0)
42
        }
43

    
44
        /* Debug Output */
45
        OperationRegion (DBG, SystemIO, 0xb044, 0x04)
46
        Field (DBG, DWordAcc, NoLock, Preserve)
47
        {
48
            DBGL,   32, 
49
        }
50
    }
51

    
52

    
53
    /* PCI Bus definition */
54
    Scope(\_SB) {
55
        Device(PCI0) {
56
            Name (_HID, EisaId ("PNP0A03"))
57
            Name (_ADR, 0x00)
58
            Name (_UID, 1)
59
            Name(_PRT, Package() {
60
                /* PCI IRQ routing table, example from ACPI 2.0a specification,
61
                   section 6.2.8.1 */
62
                /* Note: we provide the same info as the PCI routing
63
                   table of the Bochs BIOS */
64
                   
65
                // PCI Slot 0
66
                Package() {0x0000ffff, 0, LNKD, 0}, 
67
                Package() {0x0000ffff, 1, LNKA, 0}, 
68
                Package() {0x0000ffff, 2, LNKB, 0}, 
69
                Package() {0x0000ffff, 3, LNKC, 0}, 
70

    
71
                // PCI Slot 1
72
                Package() {0x0001ffff, 0, LNKA, 0}, 
73
                Package() {0x0001ffff, 1, LNKB, 0}, 
74
                Package() {0x0001ffff, 2, LNKC, 0}, 
75
                Package() {0x0001ffff, 3, LNKD, 0}, 
76
                
77
                // PCI Slot 2
78
                Package() {0x0002ffff, 0, LNKB, 0}, 
79
                Package() {0x0002ffff, 1, LNKC, 0}, 
80
                Package() {0x0002ffff, 2, LNKD, 0}, 
81
                Package() {0x0002ffff, 3, LNKA, 0}, 
82

    
83
                // PCI Slot 3
84
                Package() {0x0003ffff, 0, LNKC, 0}, 
85
                Package() {0x0003ffff, 1, LNKD, 0}, 
86
                Package() {0x0003ffff, 2, LNKA, 0}, 
87
                Package() {0x0003ffff, 3, LNKB, 0}, 
88

    
89
                // PCI Slot 4
90
                Package() {0x0004ffff, 0, LNKD, 0}, 
91
                Package() {0x0004ffff, 1, LNKA, 0}, 
92
                Package() {0x0004ffff, 2, LNKB, 0}, 
93
                Package() {0x0004ffff, 3, LNKC, 0}, 
94

    
95
                // PCI Slot 5
96
                Package() {0x0005ffff, 0, LNKA, 0}, 
97
                Package() {0x0005ffff, 1, LNKB, 0}, 
98
                Package() {0x0005ffff, 2, LNKC, 0}, 
99
                Package() {0x0005ffff, 3, LNKD, 0}, 
100
            })
101

    
102
            Method (_CRS, 0, NotSerialized)
103
            {
104
            Name (MEMP, ResourceTemplate ()
105
            {
106
                WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
107
                    0x0000,             // Address Space Granularity
108
                    0x0000,             // Address Range Minimum
109
                    0x00FF,             // Address Range Maximum
110
                    0x0000,             // Address Translation Offset
111
                    0x0100,             // Address Length
112
                    ,, )
113
                IO (Decode16,
114
                    0x0CF8,             // Address Range Minimum
115
                    0x0CF8,             // Address Range Maximum
116
                    0x01,               // Address Alignment
117
                    0x08,               // Address Length
118
                    )
119
                WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
120
                    0x0000,             // Address Space Granularity
121
                    0x0000,             // Address Range Minimum
122
                    0x0CF7,             // Address Range Maximum
123
                    0x0000,             // Address Translation Offset
124
                    0x0CF8,             // Address Length
125
                    ,, , TypeStatic)
126
                WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
127
                    0x0000,             // Address Space Granularity
128
                    0x0D00,             // Address Range Minimum
129
                    0xFFFF,             // Address Range Maximum
130
                    0x0000,             // Address Translation Offset
131
                    0xF300,             // Address Length
132
                    ,, , TypeStatic)
133
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
134
                    0x00000000,         // Address Space Granularity
135
                    0x000A0000,         // Address Range Minimum
136
                    0x000BFFFF,         // Address Range Maximum
137
                    0x00000000,         // Address Translation Offset
138
                    0x00020000,         // Address Length
139
                    ,, , AddressRangeMemory, TypeStatic)
140
                DWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, NonCacheable, ReadWrite,
141
                    0x00000000,         // Address Space Granularity
142
                    0x00000000,         // Address Range Minimum
143
                    0xFEBFFFFF,         // Address Range Maximum
144
                    0x00000000,         // Address Translation Offset
145
                    0x00000000,         // Address Length
146
                    ,, MEMF, AddressRangeMemory, TypeStatic)
147
            })
148
                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MIN, PMIN)
149
                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MAX, PMAX)
150
                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._LEN, PLEN)
151
                /* compute available RAM */
152
                Add(CMRD(0x34), ShiftLeft(CMRD(0x35), 8), Local0)
153
                ShiftLeft(Local0, 16, Local0)
154
                Add(Local0, 0x1000000, Local0)
155
                /* update field of last region */
156
                Store(Local0, PMIN)
157
                Subtract (PMAX, PMIN, PLEN)
158
                Increment (PLEN)
159
                Return (MEMP)
160
            }
161
        }
162
    }
163

    
164
    /* PIIX3 ISA bridge */
165
    Scope(\_SB.PCI0) {
166
        Device (ISA) {
167
            Name (_ADR, 0x00010000)
168
        
169
            /* PIIX PCI to ISA irq remapping */
170
            OperationRegion (P40C, PCI_Config, 0x60, 0x04)
171

    
172

    
173
            /* Keyboard seems to be important for WinXP install */
174
            Device (KBD)
175
            {
176
                Name (_HID, EisaId ("PNP0303"))
177
                Method (_STA, 0, NotSerialized)
178
                {
179
                    Return (0x0f)
180
                }
181

    
182
                Method (_CRS, 0, NotSerialized)
183
                {
184
                     Name (TMP, ResourceTemplate ()
185
                     {
186
                    IO (Decode16,
187
                        0x0060,             // Address Range Minimum
188
                        0x0060,             // Address Range Maximum
189
                        0x01,               // Address Alignment
190
                        0x01,               // Address Length
191
                        )
192
                    IO (Decode16,
193
                        0x0064,             // Address Range Minimum
194
                        0x0064,             // Address Range Maximum
195
                        0x01,               // Address Alignment
196
                        0x01,               // Address Length
197
                        )
198
                    IRQNoFlags ()
199
                        {1}
200
                    })
201
                    Return (TMP)
202
                }
203
            }
204

    
205
            Device (MOU) 
206
            {
207
                Name (_HID, EisaId ("PNP0F13"))
208
                Method (_STA, 0, NotSerialized)
209
                {
210
                    Return (0x0f)
211
                }
212

    
213
                Method (_CRS, 0, NotSerialized)
214
                {
215
                    Name (TMP, ResourceTemplate ()
216
                    {
217
                         IRQNoFlags () {12}
218
                    })
219
                    Return (TMP)
220
                }
221
            }
222
        }
223
    }
224

    
225
    /* PCI IRQs */
226
    Scope(\_SB) {
227
         Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
228
         {
229
             PRQ0,   8, 
230
             PRQ1,   8, 
231
             PRQ2,   8, 
232
             PRQ3,   8
233
         }
234

    
235
        Device(LNKA){
236
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
237
                Name(_UID, 1)
238
                Name(_PRS, ResourceTemplate(){
239
                    IRQ (Level, ActiveLow, Shared)
240
                        {3,4,5,6,7,9,10,11,12}
241
                })
242
                Method (_STA, 0, NotSerialized)
243
                {
244
                    Store (0x0B, Local0)
245
                    If (And (0x80, PRQ0, Local1))
246
                    {
247
                         Store (0x09, Local0)
248
                    }
249
                    Return (Local0)
250
                }
251
                Method (_DIS, 0, NotSerialized)
252
                {
253
                    Or (PRQ0, 0x80, PRQ0)
254
                }
255
                Method (_CRS, 0, NotSerialized)
256
                {
257
                    Name (PRR0, ResourceTemplate ()
258
                    {
259
                        IRQ (Level, ActiveLow, Shared)
260
                            {1}
261
                    })
262
                    CreateWordField (PRR0, 0x01, TMP)
263
                    Store (PRQ0, Local0)
264
                    If (LLess (Local0, 0x80))
265
                    {
266
                        ShiftLeft (One, Local0, TMP)
267
                    }
268
                    Else
269
                    {
270
                        Store (Zero, TMP)
271
                    }
272
                    Return (PRR0)
273
                }
274
                Method (_SRS, 1, NotSerialized)
275
                {
276
                    CreateWordField (Arg0, 0x01, TMP)
277
                    FindSetRightBit (TMP, Local0)
278
                    Decrement (Local0)
279
                    Store (Local0, PRQ0)
280
                }
281
        }
282
        Device(LNKB){
283
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
284
                Name(_UID, 2)
285
                Name(_PRS, ResourceTemplate(){
286
                    IRQ (Level, ActiveLow, Shared)
287
                        {3,4,5,6,7,9,10,11,12}
288
                })
289
                Method (_STA, 0, NotSerialized)
290
                {
291
                    Store (0x0B, Local0)
292
                    If (And (0x80, PRQ1, Local1))
293
                    {
294
                         Store (0x09, Local0)
295
                    }
296
                    Return (Local0)
297
                }
298
                Method (_DIS, 0, NotSerialized)
299
                {
300
                    Or (PRQ1, 0x80, PRQ1)
301
                }
302
                Method (_CRS, 0, NotSerialized)
303
                {
304
                    Name (PRR0, ResourceTemplate ()
305
                    {
306
                        IRQ (Level, ActiveLow, Shared)
307
                            {1}
308
                    })
309
                    CreateWordField (PRR0, 0x01, TMP)
310
                    Store (PRQ1, Local0)
311
                    If (LLess (Local0, 0x80))
312
                    {
313
                        ShiftLeft (One, Local0, TMP)
314
                    }
315
                    Else
316
                    {
317
                        Store (Zero, TMP)
318
                    }
319
                    Return (PRR0)
320
                }
321
                Method (_SRS, 1, NotSerialized)
322
                {
323
                    CreateWordField (Arg0, 0x01, TMP)
324
                    FindSetRightBit (TMP, Local0)
325
                    Decrement (Local0)
326
                    Store (Local0, PRQ1)
327
                }
328
        }
329
        Device(LNKC){
330
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
331
                Name(_UID, 3)
332
                Name(_PRS, ResourceTemplate(){
333
                    IRQ (Level, ActiveLow, Shared)
334
                        {3,4,5,6,7,9,10,11,12}
335
                })
336
                Method (_STA, 0, NotSerialized)
337
                {
338
                    Store (0x0B, Local0)
339
                    If (And (0x80, PRQ2, Local1))
340
                    {
341
                         Store (0x09, Local0)
342
                    }
343
                    Return (Local0)
344
                }
345
                Method (_DIS, 0, NotSerialized)
346
                {
347
                    Or (PRQ2, 0x80, PRQ2)
348
                }
349
                Method (_CRS, 0, NotSerialized)
350
                {
351
                    Name (PRR0, ResourceTemplate ()
352
                    {
353
                        IRQ (Level, ActiveLow, Shared)
354
                            {1}
355
                    })
356
                    CreateWordField (PRR0, 0x01, TMP)
357
                    Store (PRQ2, Local0)
358
                    If (LLess (Local0, 0x80))
359
                    {
360
                        ShiftLeft (One, Local0, TMP)
361
                    }
362
                    Else
363
                    {
364
                        Store (Zero, TMP)
365
                    }
366
                    Return (PRR0)
367
                }
368
                Method (_SRS, 1, NotSerialized)
369
                {
370
                    CreateWordField (Arg0, 0x01, TMP)
371
                    FindSetRightBit (TMP, Local0)
372
                    Decrement (Local0)
373
                    Store (Local0, PRQ2)
374
                }
375
        }
376
        Device(LNKD){
377
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
378
                Name(_UID, 4)
379
                Name(_PRS, ResourceTemplate(){
380
                    IRQ (Level, ActiveLow, Shared)
381
                        {3,4,5,6,7,9,10,11,12}
382
                })
383
                Method (_STA, 0, NotSerialized)
384
                {
385
                    Store (0x0B, Local0)
386
                    If (And (0x80, PRQ3, Local1))
387
                    {
388
                         Store (0x09, Local0)
389
                    }
390
                    Return (Local0)
391
                }
392
                Method (_DIS, 0, NotSerialized)
393
                {
394
                    Or (PRQ3, 0x80, PRQ3)
395
                }
396
                Method (_CRS, 0, NotSerialized)
397
                {
398
                    Name (PRR0, ResourceTemplate ()
399
                    {
400
                        IRQ (Level, ActiveLow, Shared)
401
                            {1}
402
                    })
403
                    CreateWordField (PRR0, 0x01, TMP)
404
                    Store (PRQ3, Local0)
405
                    If (LLess (Local0, 0x80))
406
                    {
407
                        ShiftLeft (One, Local0, TMP)
408
                    }
409
                    Else
410
                    {
411
                        Store (Zero, TMP)
412
                    }
413
                    Return (PRR0)
414
                }
415
                Method (_SRS, 1, NotSerialized)
416
                {
417
                    CreateWordField (Arg0, 0x01, TMP)
418
                    FindSetRightBit (TMP, Local0)
419
                    Decrement (Local0)
420
                    Store (Local0, PRQ3)
421
                }
422
        }
423
    }
424

    
425
    /* S5 = power off state */
426
    Name (_S5, Package (4) {
427
        0x00, // PM1a_CNT.SLP_TYP 
428
        0x00, // PM2a_CNT.SLP_TYP 
429
        0x00, // reserved
430
        0x00, // reserved
431
    })
432
}