Statistics
| Branch: | Revision:

root / hw / acpi-dsdt.dsl @ 8f40c388

History | View | Annotate | Download (17.9 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
    Scope(\_SB.PCI0) {
165

    
166
	/* PIIX3 ISA bridge */
167
        Device (ISA) {
168
            Name (_ADR, 0x00010000)
169
        
170
            /* PIIX PCI to ISA irq remapping */
171
            OperationRegion (P40C, PCI_Config, 0x60, 0x04)
172

    
173

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

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

    
206
	    /* PS/2 mouse */
207
            Device (MOU) 
208
            {
209
                Name (_HID, EisaId ("PNP0F13"))
210
                Method (_STA, 0, NotSerialized)
211
                {
212
                    Return (0x0f)
213
                }
214

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

    
225
	    /* PS/2 floppy controller */
226
	    Device (FDC0)
227
	    {
228
	        Name (_HID, EisaId ("PNP0700"))
229
		Method (_STA, 0, NotSerialized)
230
		{
231
		    Return (0x0F)
232
		}
233
		Method (_CRS, 0, NotSerialized)
234
		{
235
		    Name (BUF0, ResourceTemplate ()
236
                    {
237
                        IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
238
                        IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
239
                        IRQNoFlags () {6}
240
                        DMA (Compatibility, NotBusMaster, Transfer8) {2}
241
                    })
242
		    Return (BUF0)
243
		}
244
	    }
245

    
246
	    /* Parallel port */
247
	    Device (LPT)
248
	    {
249
	        Name (_HID, EisaId ("PNP0400"))
250
		Method (_STA, 0, NotSerialized)
251
		{
252
		    Store (\_SB.PCI0.PX13.DRSA, Local0)
253
		    And (Local0, 0x80000000, Local0)
254
		    If (LEqual (Local0, 0))
255
		    {
256
			Return (0x00)
257
		    }
258
		    Else
259
		    {
260
			Return (0x0F)
261
		    }
262
		}
263
		Method (_CRS, 0, NotSerialized)
264
		{
265
		    Name (BUF0, ResourceTemplate ()
266
                    {
267
			IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
268
			IRQNoFlags () {7}
269
		    })
270
		    Return (BUF0)
271
		}
272
	    }
273

    
274
	    /* Serial Ports */
275
	    Device (COM1)
276
	    {
277
	        Name (_HID, EisaId ("PNP0501"))
278
		Name (_UID, 0x01)
279
		Method (_STA, 0, NotSerialized)
280
		{
281
		    Store (\_SB.PCI0.PX13.DRSC, Local0)
282
		    And (Local0, 0x08000000, Local0)
283
		    If (LEqual (Local0, 0))
284
		    {
285
			Return (0x00)
286
		    }
287
		    Else
288
		    {
289
			Return (0x0F)
290
		    }
291
		}
292
		Method (_CRS, 0, NotSerialized)
293
		{
294
		    Name (BUF0, ResourceTemplate ()
295
                    {
296
			IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
297
                	IRQNoFlags () {4}
298
		    })
299
		    Return (BUF0)
300
		}
301
	    }
302

    
303
	    Device (COM2)
304
	    {
305
	        Name (_HID, EisaId ("PNP0501"))
306
		Name (_UID, 0x02)
307
		Method (_STA, 0, NotSerialized)
308
		{
309
		    Store (\_SB.PCI0.PX13.DRSC, Local0)
310
		    And (Local0, 0x80000000, Local0)
311
		    If (LEqual (Local0, 0))
312
		    {
313
			Return (0x00)
314
		    }
315
		    Else
316
		    {
317
			Return (0x0F)
318
		    }
319
		}
320
		Method (_CRS, 0, NotSerialized)
321
		{
322
		    Name (BUF0, ResourceTemplate ()
323
                    {
324
			IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
325
                	IRQNoFlags () {3}
326
		    })
327
		    Return (BUF0)
328
		}
329
	    }
330
        }
331

    
332
	/* PIIX4 PM */
333
        Device (PX13) {
334
	    Name (_ADR, 0x00010003)
335

    
336
	    OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
337
	    Field (P13C, DWordAcc, NoLock, Preserve)
338
	    {
339
		DRSA, 32,
340
		DRSB, 32,
341
		DRSC, 32,
342
		DRSE, 32,
343
		DRSF, 32,
344
		DRSG, 32,
345
		DRSH, 32,
346
		DRSI, 32,
347
		DRSJ, 32
348
	    }
349
	}
350
    }
351

    
352
    /* PCI IRQs */
353
    Scope(\_SB) {
354
         Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
355
         {
356
             PRQ0,   8, 
357
             PRQ1,   8, 
358
             PRQ2,   8, 
359
             PRQ3,   8
360
         }
361

    
362
        Device(LNKA){
363
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
364
                Name(_UID, 1)
365
                Name(_PRS, ResourceTemplate(){
366
                    IRQ (Level, ActiveLow, Shared)
367
                        {3,4,5,6,7,9,10,11,12}
368
                })
369
                Method (_STA, 0, NotSerialized)
370
                {
371
                    Store (0x0B, Local0)
372
                    If (And (0x80, PRQ0, Local1))
373
                    {
374
                         Store (0x09, Local0)
375
                    }
376
                    Return (Local0)
377
                }
378
                Method (_DIS, 0, NotSerialized)
379
                {
380
                    Or (PRQ0, 0x80, PRQ0)
381
                }
382
                Method (_CRS, 0, NotSerialized)
383
                {
384
                    Name (PRR0, ResourceTemplate ()
385
                    {
386
                        IRQ (Level, ActiveLow, Shared)
387
                            {1}
388
                    })
389
                    CreateWordField (PRR0, 0x01, TMP)
390
                    Store (PRQ0, Local0)
391
                    If (LLess (Local0, 0x80))
392
                    {
393
                        ShiftLeft (One, Local0, TMP)
394
                    }
395
                    Else
396
                    {
397
                        Store (Zero, TMP)
398
                    }
399
                    Return (PRR0)
400
                }
401
                Method (_SRS, 1, NotSerialized)
402
                {
403
                    CreateWordField (Arg0, 0x01, TMP)
404
                    FindSetRightBit (TMP, Local0)
405
                    Decrement (Local0)
406
                    Store (Local0, PRQ0)
407
                }
408
        }
409
        Device(LNKB){
410
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
411
                Name(_UID, 2)
412
                Name(_PRS, ResourceTemplate(){
413
                    IRQ (Level, ActiveLow, Shared)
414
                        {3,4,5,6,7,9,10,11,12}
415
                })
416
                Method (_STA, 0, NotSerialized)
417
                {
418
                    Store (0x0B, Local0)
419
                    If (And (0x80, PRQ1, Local1))
420
                    {
421
                         Store (0x09, Local0)
422
                    }
423
                    Return (Local0)
424
                }
425
                Method (_DIS, 0, NotSerialized)
426
                {
427
                    Or (PRQ1, 0x80, PRQ1)
428
                }
429
                Method (_CRS, 0, NotSerialized)
430
                {
431
                    Name (PRR0, ResourceTemplate ()
432
                    {
433
                        IRQ (Level, ActiveLow, Shared)
434
                            {1}
435
                    })
436
                    CreateWordField (PRR0, 0x01, TMP)
437
                    Store (PRQ1, Local0)
438
                    If (LLess (Local0, 0x80))
439
                    {
440
                        ShiftLeft (One, Local0, TMP)
441
                    }
442
                    Else
443
                    {
444
                        Store (Zero, TMP)
445
                    }
446
                    Return (PRR0)
447
                }
448
                Method (_SRS, 1, NotSerialized)
449
                {
450
                    CreateWordField (Arg0, 0x01, TMP)
451
                    FindSetRightBit (TMP, Local0)
452
                    Decrement (Local0)
453
                    Store (Local0, PRQ1)
454
                }
455
        }
456
        Device(LNKC){
457
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
458
                Name(_UID, 3)
459
                Name(_PRS, ResourceTemplate(){
460
                    IRQ (Level, ActiveLow, Shared)
461
                        {3,4,5,6,7,9,10,11,12}
462
                })
463
                Method (_STA, 0, NotSerialized)
464
                {
465
                    Store (0x0B, Local0)
466
                    If (And (0x80, PRQ2, Local1))
467
                    {
468
                         Store (0x09, Local0)
469
                    }
470
                    Return (Local0)
471
                }
472
                Method (_DIS, 0, NotSerialized)
473
                {
474
                    Or (PRQ2, 0x80, PRQ2)
475
                }
476
                Method (_CRS, 0, NotSerialized)
477
                {
478
                    Name (PRR0, ResourceTemplate ()
479
                    {
480
                        IRQ (Level, ActiveLow, Shared)
481
                            {1}
482
                    })
483
                    CreateWordField (PRR0, 0x01, TMP)
484
                    Store (PRQ2, Local0)
485
                    If (LLess (Local0, 0x80))
486
                    {
487
                        ShiftLeft (One, Local0, TMP)
488
                    }
489
                    Else
490
                    {
491
                        Store (Zero, TMP)
492
                    }
493
                    Return (PRR0)
494
                }
495
                Method (_SRS, 1, NotSerialized)
496
                {
497
                    CreateWordField (Arg0, 0x01, TMP)
498
                    FindSetRightBit (TMP, Local0)
499
                    Decrement (Local0)
500
                    Store (Local0, PRQ2)
501
                }
502
        }
503
        Device(LNKD){
504
                Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
505
                Name(_UID, 4)
506
                Name(_PRS, ResourceTemplate(){
507
                    IRQ (Level, ActiveLow, Shared)
508
                        {3,4,5,6,7,9,10,11,12}
509
                })
510
                Method (_STA, 0, NotSerialized)
511
                {
512
                    Store (0x0B, Local0)
513
                    If (And (0x80, PRQ3, Local1))
514
                    {
515
                         Store (0x09, Local0)
516
                    }
517
                    Return (Local0)
518
                }
519
                Method (_DIS, 0, NotSerialized)
520
                {
521
                    Or (PRQ3, 0x80, PRQ3)
522
                }
523
                Method (_CRS, 0, NotSerialized)
524
                {
525
                    Name (PRR0, ResourceTemplate ()
526
                    {
527
                        IRQ (Level, ActiveLow, Shared)
528
                            {1}
529
                    })
530
                    CreateWordField (PRR0, 0x01, TMP)
531
                    Store (PRQ3, Local0)
532
                    If (LLess (Local0, 0x80))
533
                    {
534
                        ShiftLeft (One, Local0, TMP)
535
                    }
536
                    Else
537
                    {
538
                        Store (Zero, TMP)
539
                    }
540
                    Return (PRR0)
541
                }
542
                Method (_SRS, 1, NotSerialized)
543
                {
544
                    CreateWordField (Arg0, 0x01, TMP)
545
                    FindSetRightBit (TMP, Local0)
546
                    Decrement (Local0)
547
                    Store (Local0, PRQ3)
548
                }
549
        }
550
    }
551

    
552
    /* S5 = power off state */
553
    Name (_S5, Package (4) {
554
        0x00, // PM1a_CNT.SLP_TYP 
555
        0x00, // PM2a_CNT.SLP_TYP 
556
        0x00, // reserved
557
        0x00, // reserved
558
    })
559
}