19ac2f9c8587b0b8242f65731570efafeb1f7245
[seabios.git] / src / acpi-dsdt.dsl
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 DefinitionBlock (
20     "acpi-dsdt.aml",    // Output Filename
21     "DSDT",             // Signature
22     0x01,               // DSDT Compliance Revision
23     "BXPC",             // OEMID
24     "BXDSDT",           // TABLE ID
25     0x1                 // OEM Revision
26     )
27 {
28     Scope (\)
29     {
30         /* Debug Output */
31         OperationRegion (DBG, SystemIO, 0xb044, 0x04)
32         Field (DBG, DWordAcc, NoLock, Preserve)
33         {
34             DBGL,   32,
35         }
36     }
37
38
39     /* PCI Bus definition */
40     Scope(\_SB) {
41         Device(PCI0) {
42             Name (_HID, EisaId ("PNP0A03"))
43             Name (_ADR, 0x00)
44             Name (_UID, 1)
45             Name(_PRT, Package() {
46                 /* PCI IRQ routing table, example from ACPI 2.0a specification,
47                    section 6.2.8.1 */
48                 /* Note: we provide the same info as the PCI routing
49                    table of the Bochs BIOS */
50
51                 // PCI Slot 0
52                 Package() {0x0000ffff, 0, LNKD, 0},
53                 Package() {0x0000ffff, 1, LNKA, 0},
54                 Package() {0x0000ffff, 2, LNKB, 0},
55                 Package() {0x0000ffff, 3, LNKC, 0},
56
57                 // PCI Slot 1
58                 Package() {0x0001ffff, 0, LNKA, 0},
59                 Package() {0x0001ffff, 1, LNKB, 0},
60                 Package() {0x0001ffff, 2, LNKC, 0},
61                 Package() {0x0001ffff, 3, LNKD, 0},
62
63                 // PCI Slot 2
64                 Package() {0x0002ffff, 0, LNKB, 0},
65                 Package() {0x0002ffff, 1, LNKC, 0},
66                 Package() {0x0002ffff, 2, LNKD, 0},
67                 Package() {0x0002ffff, 3, LNKA, 0},
68
69                 // PCI Slot 3
70                 Package() {0x0003ffff, 0, LNKC, 0},
71                 Package() {0x0003ffff, 1, LNKD, 0},
72                 Package() {0x0003ffff, 2, LNKA, 0},
73                 Package() {0x0003ffff, 3, LNKB, 0},
74
75                 // PCI Slot 4
76                 Package() {0x0004ffff, 0, LNKD, 0},
77                 Package() {0x0004ffff, 1, LNKA, 0},
78                 Package() {0x0004ffff, 2, LNKB, 0},
79                 Package() {0x0004ffff, 3, LNKC, 0},
80
81                 // PCI Slot 5
82                 Package() {0x0005ffff, 0, LNKA, 0},
83                 Package() {0x0005ffff, 1, LNKB, 0},
84                 Package() {0x0005ffff, 2, LNKC, 0},
85                 Package() {0x0005ffff, 3, LNKD, 0},
86             })
87
88             Name (_CRS, ResourceTemplate ()
89             {
90                 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
91                     0x0000,             // Address Space Granularity
92                     0x0000,             // Address Range Minimum
93                     0x00FF,             // Address Range Maximum
94                     0x0000,             // Address Translation Offset
95                     0x0100,             // Address Length
96                     ,, )
97                 IO (Decode16,
98                     0x0CF8,             // Address Range Minimum
99                     0x0CF8,             // Address Range Maximum
100                     0x01,               // Address Alignment
101                     0x08,               // Address Length
102                     )
103                 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
104                     0x0000,             // Address Space Granularity
105                     0x0000,             // Address Range Minimum
106                     0x0CF7,             // Address Range Maximum
107                     0x0000,             // Address Translation Offset
108                     0x0CF8,             // Address Length
109                     ,, , TypeStatic)
110                 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
111                     0x0000,             // Address Space Granularity
112                     0x0D00,             // Address Range Minimum
113                     0xFFFF,             // Address Range Maximum
114                     0x0000,             // Address Translation Offset
115                     0xF300,             // Address Length
116                     ,, , TypeStatic)
117                 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
118                     0x00000000,         // Address Space Granularity
119                     0x000A0000,         // Address Range Minimum
120                     0x000BFFFF,         // Address Range Maximum
121                     0x00000000,         // Address Translation Offset
122                     0x00020000,         // Address Length
123                     ,, , AddressRangeMemory, TypeStatic)
124                 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
125                     0x00000000,         // Address Space Granularity
126                     0xE0000000,         // Address Range Minimum
127                     0xFEBFFFFF,         // Address Range Maximum
128                     0x00000000,         // Address Translation Offset
129                     0x1EC00000,         // Address Length
130                     ,, , AddressRangeMemory, TypeStatic)
131             })
132         }
133     }
134
135     Scope(\_SB.PCI0) {
136
137         /* PIIX3 ISA bridge */
138         Device (ISA) {
139             Name (_ADR, 0x00010000)
140
141             /* PIIX PCI to ISA irq remapping */
142             OperationRegion (P40C, PCI_Config, 0x60, 0x04)
143
144             /* Real-time clock */
145             Device (RTC)
146             {
147                 Name (_HID, EisaId ("PNP0B00"))
148                 Name (_CRS, ResourceTemplate ()
149                 {
150                     IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
151                     IRQNoFlags () {8}
152                     IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
153                 })
154             }
155
156             /* Keyboard seems to be important for WinXP install */
157             Device (KBD)
158             {
159                 Name (_HID, EisaId ("PNP0303"))
160                 Method (_STA, 0, NotSerialized)
161                 {
162                     Return (0x0f)
163                 }
164
165                 Method (_CRS, 0, NotSerialized)
166                 {
167                      Name (TMP, ResourceTemplate ()
168                      {
169                     IO (Decode16,
170                         0x0060,             // Address Range Minimum
171                         0x0060,             // Address Range Maximum
172                         0x01,               // Address Alignment
173                         0x01,               // Address Length
174                         )
175                     IO (Decode16,
176                         0x0064,             // Address Range Minimum
177                         0x0064,             // Address Range Maximum
178                         0x01,               // Address Alignment
179                         0x01,               // Address Length
180                         )
181                     IRQNoFlags ()
182                         {1}
183                     })
184                     Return (TMP)
185                 }
186             }
187
188             /* PS/2 mouse */
189             Device (MOU)
190             {
191                 Name (_HID, EisaId ("PNP0F13"))
192                 Method (_STA, 0, NotSerialized)
193                 {
194                     Return (0x0f)
195                 }
196
197                 Method (_CRS, 0, NotSerialized)
198                 {
199                     Name (TMP, ResourceTemplate ()
200                     {
201                          IRQNoFlags () {12}
202                     })
203                     Return (TMP)
204                 }
205             }
206
207             /* PS/2 floppy controller */
208             Device (FDC0)
209             {
210                 Name (_HID, EisaId ("PNP0700"))
211                 Method (_STA, 0, NotSerialized)
212                 {
213                     Return (0x0F)
214                 }
215                 Method (_CRS, 0, NotSerialized)
216                 {
217                     Name (BUF0, ResourceTemplate ()
218                     {
219                         IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
220                         IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
221                         IRQNoFlags () {6}
222                         DMA (Compatibility, NotBusMaster, Transfer8) {2}
223                     })
224                     Return (BUF0)
225                 }
226             }
227
228             /* Parallel port */
229             Device (LPT)
230             {
231                 Name (_HID, EisaId ("PNP0400"))
232                 Method (_STA, 0, NotSerialized)
233                 {
234                     Store (\_SB.PCI0.PX13.DRSA, Local0)
235                     And (Local0, 0x80000000, Local0)
236                     If (LEqual (Local0, 0))
237                     {
238                         Return (0x00)
239                     }
240                     Else
241                     {
242                         Return (0x0F)
243                     }
244                 }
245                 Method (_CRS, 0, NotSerialized)
246                 {
247                     Name (BUF0, ResourceTemplate ()
248                     {
249                         IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
250                         IRQNoFlags () {7}
251                     })
252                     Return (BUF0)
253                 }
254             }
255
256             /* Serial Ports */
257             Device (COM1)
258             {
259                 Name (_HID, EisaId ("PNP0501"))
260                 Name (_UID, 0x01)
261                 Method (_STA, 0, NotSerialized)
262                 {
263                     Store (\_SB.PCI0.PX13.DRSC, Local0)
264                     And (Local0, 0x08000000, Local0)
265                     If (LEqual (Local0, 0))
266                     {
267                         Return (0x00)
268                     }
269                     Else
270                     {
271                         Return (0x0F)
272                     }
273                 }
274                 Method (_CRS, 0, NotSerialized)
275                 {
276                     Name (BUF0, ResourceTemplate ()
277                     {
278                         IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
279                         IRQNoFlags () {4}
280                     })
281                     Return (BUF0)
282                 }
283             }
284
285             Device (COM2)
286             {
287                 Name (_HID, EisaId ("PNP0501"))
288                 Name (_UID, 0x02)
289                 Method (_STA, 0, NotSerialized)
290                 {
291                     Store (\_SB.PCI0.PX13.DRSC, Local0)
292                     And (Local0, 0x80000000, Local0)
293                     If (LEqual (Local0, 0))
294                     {
295                         Return (0x00)
296                     }
297                     Else
298                     {
299                         Return (0x0F)
300                     }
301                 }
302                 Method (_CRS, 0, NotSerialized)
303                 {
304                     Name (BUF0, ResourceTemplate ()
305                     {
306                         IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
307                         IRQNoFlags () {3}
308                     })
309                     Return (BUF0)
310                 }
311             }
312         }
313
314         /* PIIX4 PM */
315         Device (PX13) {
316             Name (_ADR, 0x00010003)
317
318             OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
319             Field (P13C, DWordAcc, NoLock, Preserve)
320             {
321                 DRSA, 32,
322                 DRSB, 32,
323                 DRSC, 32,
324                 DRSE, 32,
325                 DRSF, 32,
326                 DRSG, 32,
327                 DRSH, 32,
328                 DRSI, 32,
329                 DRSJ, 32
330             }
331         }
332     }
333
334     /* PCI IRQs */
335     Scope(\_SB) {
336          Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
337          {
338              PRQ0,   8,
339              PRQ1,   8,
340              PRQ2,   8,
341              PRQ3,   8
342          }
343
344         Device(LNKA){
345                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
346                 Name(_UID, 1)
347                 Name(_PRS, ResourceTemplate(){
348                     IRQ (Level, ActiveLow, Shared)
349                         {3,4,5,6,7,9,10,11,12}
350                 })
351                 Method (_STA, 0, NotSerialized)
352                 {
353                     Store (0x0B, Local0)
354                     If (And (0x80, PRQ0, Local1))
355                     {
356                          Store (0x09, Local0)
357                     }
358                     Return (Local0)
359                 }
360                 Method (_DIS, 0, NotSerialized)
361                 {
362                     Or (PRQ0, 0x80, PRQ0)
363                 }
364                 Method (_CRS, 0, NotSerialized)
365                 {
366                     Name (PRR0, ResourceTemplate ()
367                     {
368                         IRQ (Level, ActiveLow, Shared)
369                             {1}
370                     })
371                     CreateWordField (PRR0, 0x01, TMP)
372                     Store (PRQ0, Local0)
373                     If (LLess (Local0, 0x80))
374                     {
375                         ShiftLeft (One, Local0, TMP)
376                     }
377                     Else
378                     {
379                         Store (Zero, TMP)
380                     }
381                     Return (PRR0)
382                 }
383                 Method (_SRS, 1, NotSerialized)
384                 {
385                     CreateWordField (Arg0, 0x01, TMP)
386                     FindSetRightBit (TMP, Local0)
387                     Decrement (Local0)
388                     Store (Local0, PRQ0)
389                 }
390         }
391         Device(LNKB){
392                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
393                 Name(_UID, 2)
394                 Name(_PRS, ResourceTemplate(){
395                     IRQ (Level, ActiveLow, Shared)
396                         {3,4,5,6,7,9,10,11,12}
397                 })
398                 Method (_STA, 0, NotSerialized)
399                 {
400                     Store (0x0B, Local0)
401                     If (And (0x80, PRQ1, Local1))
402                     {
403                          Store (0x09, Local0)
404                     }
405                     Return (Local0)
406                 }
407                 Method (_DIS, 0, NotSerialized)
408                 {
409                     Or (PRQ1, 0x80, PRQ1)
410                 }
411                 Method (_CRS, 0, NotSerialized)
412                 {
413                     Name (PRR0, ResourceTemplate ()
414                     {
415                         IRQ (Level, ActiveLow, Shared)
416                             {1}
417                     })
418                     CreateWordField (PRR0, 0x01, TMP)
419                     Store (PRQ1, Local0)
420                     If (LLess (Local0, 0x80))
421                     {
422                         ShiftLeft (One, Local0, TMP)
423                     }
424                     Else
425                     {
426                         Store (Zero, TMP)
427                     }
428                     Return (PRR0)
429                 }
430                 Method (_SRS, 1, NotSerialized)
431                 {
432                     CreateWordField (Arg0, 0x01, TMP)
433                     FindSetRightBit (TMP, Local0)
434                     Decrement (Local0)
435                     Store (Local0, PRQ1)
436                 }
437         }
438         Device(LNKC){
439                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
440                 Name(_UID, 3)
441                 Name(_PRS, ResourceTemplate(){
442                     IRQ (Level, ActiveLow, Shared)
443                         {3,4,5,6,7,9,10,11,12}
444                 })
445                 Method (_STA, 0, NotSerialized)
446                 {
447                     Store (0x0B, Local0)
448                     If (And (0x80, PRQ2, Local1))
449                     {
450                          Store (0x09, Local0)
451                     }
452                     Return (Local0)
453                 }
454                 Method (_DIS, 0, NotSerialized)
455                 {
456                     Or (PRQ2, 0x80, PRQ2)
457                 }
458                 Method (_CRS, 0, NotSerialized)
459                 {
460                     Name (PRR0, ResourceTemplate ()
461                     {
462                         IRQ (Level, ActiveLow, Shared)
463                             {1}
464                     })
465                     CreateWordField (PRR0, 0x01, TMP)
466                     Store (PRQ2, Local0)
467                     If (LLess (Local0, 0x80))
468                     {
469                         ShiftLeft (One, Local0, TMP)
470                     }
471                     Else
472                     {
473                         Store (Zero, TMP)
474                     }
475                     Return (PRR0)
476                 }
477                 Method (_SRS, 1, NotSerialized)
478                 {
479                     CreateWordField (Arg0, 0x01, TMP)
480                     FindSetRightBit (TMP, Local0)
481                     Decrement (Local0)
482                     Store (Local0, PRQ2)
483                 }
484         }
485         Device(LNKD){
486                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
487                 Name(_UID, 4)
488                 Name(_PRS, ResourceTemplate(){
489                     IRQ (Level, ActiveLow, Shared)
490                         {3,4,5,6,7,9,10,11,12}
491                 })
492                 Method (_STA, 0, NotSerialized)
493                 {
494                     Store (0x0B, Local0)
495                     If (And (0x80, PRQ3, Local1))
496                     {
497                          Store (0x09, Local0)
498                     }
499                     Return (Local0)
500                 }
501                 Method (_DIS, 0, NotSerialized)
502                 {
503                     Or (PRQ3, 0x80, PRQ3)
504                 }
505                 Method (_CRS, 0, NotSerialized)
506                 {
507                     Name (PRR0, ResourceTemplate ()
508                     {
509                         IRQ (Level, ActiveLow, Shared)
510                             {1}
511                     })
512                     CreateWordField (PRR0, 0x01, TMP)
513                     Store (PRQ3, Local0)
514                     If (LLess (Local0, 0x80))
515                     {
516                         ShiftLeft (One, Local0, TMP)
517                     }
518                     Else
519                     {
520                         Store (Zero, TMP)
521                     }
522                     Return (PRR0)
523                 }
524                 Method (_SRS, 1, NotSerialized)
525                 {
526                     CreateWordField (Arg0, 0x01, TMP)
527                     FindSetRightBit (TMP, Local0)
528                     Decrement (Local0)
529                     Store (Local0, PRQ3)
530                 }
531         }
532     }
533
534     /* S5 = power off state */
535     Name (_S5, Package (4) {
536         0x00, // PM1a_CNT.SLP_TYP
537         0x00, // PM2a_CNT.SLP_TYP
538         0x00, // reserved
539         0x00, // reserved
540     })
541 }