- implemented INT 15h/89h (patch by Sebastian Herbszt)
[gplbios.git] / acpi-dsdt.dsl
blobd35886df0172ef55071680c54690095604b03082
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  */
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     )
28     Scope (\)
29     {
30         /* Debug Output */
31         OperationRegion (DBG, SystemIO, 0xb044, 0x04)
32         Field (DBG, DWordAcc, NoLock, Preserve)
33         {
34             DBGL,   32,
35         }
36     }
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 */
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},
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},
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},
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},
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},
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             })
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 #ifdef BX_QEMU
134         Device(HPET) {
135             Name(_HID,  EISAID("PNP0103"))
136             Name(_UID, 0)
137             Method (_STA, 0, NotSerialized) {
138                     Return(0x0F)
139             }
140             Name(_CRS, ResourceTemplate() {
141                 DWordMemory(
142                     ResourceConsumer, PosDecode, MinFixed, MaxFixed,
143                     NonCacheable, ReadWrite,
144                     0x00000000,
145                     0xFED00000,
146                     0xFED003FF,
147                     0x00000000,
148                     0x00000400 /* 1K memory: FED00000 - FED003FF */
149                 )
150             })
151         }
152 #endif
153     }
155     Scope(\_SB.PCI0) {
156         Device (VGA) {
157                  Name (_ADR, 0x00020000)
158                  Method (_S1D, 0, NotSerialized)
159                  {
160                          Return (0x00)
161                  }
162                  Method (_S2D, 0, NotSerialized)
163                  {
164                          Return (0x00)
165                  }
166                  Method (_S3D, 0, NotSerialized)
167                  {
168                          Return (0x00)
169                  }
170         }
172         /* PIIX3 ISA bridge */
173         Device (ISA) {
174             Name (_ADR, 0x00010000)
176             /* PIIX PCI to ISA irq remapping */
177             OperationRegion (P40C, PCI_Config, 0x60, 0x04)
179             /* Real-time clock */
180             Device (RTC)
181             {
182                 Name (_HID, EisaId ("PNP0B00"))
183                 Name (_CRS, ResourceTemplate ()
184                 {
185                     IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
186                     IRQNoFlags () {8}
187                     IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
188                 })
189             }
191             /* Keyboard seems to be important for WinXP install */
192             Device (KBD)
193             {
194                 Name (_HID, EisaId ("PNP0303"))
195                 Method (_STA, 0, NotSerialized)
196                 {
197                     Return (0x0f)
198                 }
200                 Method (_CRS, 0, NotSerialized)
201                 {
202                      Name (TMP, ResourceTemplate ()
203                      {
204                     IO (Decode16,
205                         0x0060,             // Address Range Minimum
206                         0x0060,             // Address Range Maximum
207                         0x01,               // Address Alignment
208                         0x01,               // Address Length
209                         )
210                     IO (Decode16,
211                         0x0064,             // Address Range Minimum
212                         0x0064,             // Address Range Maximum
213                         0x01,               // Address Alignment
214                         0x01,               // Address Length
215                         )
216                     IRQNoFlags ()
217                         {1}
218                     })
219                     Return (TMP)
220                 }
221             }
223             /* PS/2 mouse */
224             Device (MOU)
225             {
226                 Name (_HID, EisaId ("PNP0F13"))
227                 Method (_STA, 0, NotSerialized)
228                 {
229                     Return (0x0f)
230                 }
232                 Method (_CRS, 0, NotSerialized)
233                 {
234                     Name (TMP, ResourceTemplate ()
235                     {
236                          IRQNoFlags () {12}
237                     })
238                     Return (TMP)
239                 }
240             }
242             /* PS/2 floppy controller */
243             Device (FDC0)
244             {
245                 Name (_HID, EisaId ("PNP0700"))
246                 Method (_STA, 0, NotSerialized)
247                 {
248                     Return (0x0F)
249                 }
250                 Method (_CRS, 0, NotSerialized)
251                 {
252                     Name (BUF0, ResourceTemplate ()
253                     {
254                         IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
255                         IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
256                         IRQNoFlags () {6}
257                         DMA (Compatibility, NotBusMaster, Transfer8) {2}
258                     })
259                     Return (BUF0)
260                 }
261             }
263             /* Parallel port */
264             Device (LPT)
265             {
266                 Name (_HID, EisaId ("PNP0400"))
267                 Method (_STA, 0, NotSerialized)
268                 {
269                     Store (\_SB.PCI0.PX13.DRSA, Local0)
270                     And (Local0, 0x80000000, Local0)
271                     If (LEqual (Local0, 0))
272                     {
273                         Return (0x00)
274                     }
275                     Else
276                     {
277                         Return (0x0F)
278                     }
279                 }
280                 Method (_CRS, 0, NotSerialized)
281                 {
282                     Name (BUF0, ResourceTemplate ()
283                     {
284                         IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
285                         IRQNoFlags () {7}
286                     })
287                     Return (BUF0)
288                 }
289             }
291             /* Serial Ports */
292             Device (COM1)
293             {
294                 Name (_HID, EisaId ("PNP0501"))
295                 Name (_UID, 0x01)
296                 Method (_STA, 0, NotSerialized)
297                 {
298                     Store (\_SB.PCI0.PX13.DRSC, Local0)
299                     And (Local0, 0x08000000, Local0)
300                     If (LEqual (Local0, 0))
301                     {
302                         Return (0x00)
303                     }
304                     Else
305                     {
306                         Return (0x0F)
307                     }
308                 }
309                 Method (_CRS, 0, NotSerialized)
310                 {
311                     Name (BUF0, ResourceTemplate ()
312                     {
313                         IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
314                         IRQNoFlags () {4}
315                     })
316                     Return (BUF0)
317                 }
318             }
320             Device (COM2)
321             {
322                 Name (_HID, EisaId ("PNP0501"))
323                 Name (_UID, 0x02)
324                 Method (_STA, 0, NotSerialized)
325                 {
326                     Store (\_SB.PCI0.PX13.DRSC, Local0)
327                     And (Local0, 0x80000000, Local0)
328                     If (LEqual (Local0, 0))
329                     {
330                         Return (0x00)
331                     }
332                     Else
333                     {
334                         Return (0x0F)
335                     }
336                 }
337                 Method (_CRS, 0, NotSerialized)
338                 {
339                     Name (BUF0, ResourceTemplate ()
340                     {
341                         IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
342                         IRQNoFlags () {3}
343                     })
344                     Return (BUF0)
345                 }
346             }
347         }
349         /* PIIX4 PM */
350         Device (PX13) {
351             Name (_ADR, 0x00010003)
353             OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
354             Field (P13C, DWordAcc, NoLock, Preserve)
355             {
356                 DRSA, 32,
357                 DRSB, 32,
358                 DRSC, 32,
359                 DRSE, 32,
360                 DRSF, 32,
361                 DRSG, 32,
362                 DRSH, 32,
363                 DRSI, 32,
364                 DRSJ, 32
365             }
366         }
367     }
369     /* PCI IRQs */
370     Scope(\_SB) {
371          Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
372          {
373              PRQ0,   8,
374              PRQ1,   8,
375              PRQ2,   8,
376              PRQ3,   8
377          }
379         Device(LNKA){
380                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
381                 Name(_UID, 1)
382                 Name(_PRS, ResourceTemplate(){
383                     IRQ (Level, ActiveLow, Shared)
384                         {3,4,5,6,7,9,10,11,12}
385                 })
386                 Method (_STA, 0, NotSerialized)
387                 {
388                     Store (0x0B, Local0)
389                     If (And (0x80, PRQ0, Local1))
390                     {
391                          Store (0x09, Local0)
392                     }
393                     Return (Local0)
394                 }
395                 Method (_DIS, 0, NotSerialized)
396                 {
397                     Or (PRQ0, 0x80, PRQ0)
398                 }
399                 Method (_CRS, 0, NotSerialized)
400                 {
401                     Name (PRR0, ResourceTemplate ()
402                     {
403                         IRQ (Level, ActiveLow, Shared)
404                             {1}
405                     })
406                     CreateWordField (PRR0, 0x01, TMP)
407                     Store (PRQ0, Local0)
408                     If (LLess (Local0, 0x80))
409                     {
410                         ShiftLeft (One, Local0, TMP)
411                     }
412                     Else
413                     {
414                         Store (Zero, TMP)
415                     }
416                     Return (PRR0)
417                 }
418                 Method (_SRS, 1, NotSerialized)
419                 {
420                     CreateWordField (Arg0, 0x01, TMP)
421                     FindSetRightBit (TMP, Local0)
422                     Decrement (Local0)
423                     Store (Local0, PRQ0)
424                 }
425         }
426         Device(LNKB){
427                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
428                 Name(_UID, 2)
429                 Name(_PRS, ResourceTemplate(){
430                     IRQ (Level, ActiveLow, Shared)
431                         {3,4,5,6,7,9,10,11,12}
432                 })
433                 Method (_STA, 0, NotSerialized)
434                 {
435                     Store (0x0B, Local0)
436                     If (And (0x80, PRQ1, Local1))
437                     {
438                          Store (0x09, Local0)
439                     }
440                     Return (Local0)
441                 }
442                 Method (_DIS, 0, NotSerialized)
443                 {
444                     Or (PRQ1, 0x80, PRQ1)
445                 }
446                 Method (_CRS, 0, NotSerialized)
447                 {
448                     Name (PRR0, ResourceTemplate ()
449                     {
450                         IRQ (Level, ActiveLow, Shared)
451                             {1}
452                     })
453                     CreateWordField (PRR0, 0x01, TMP)
454                     Store (PRQ1, Local0)
455                     If (LLess (Local0, 0x80))
456                     {
457                         ShiftLeft (One, Local0, TMP)
458                     }
459                     Else
460                     {
461                         Store (Zero, TMP)
462                     }
463                     Return (PRR0)
464                 }
465                 Method (_SRS, 1, NotSerialized)
466                 {
467                     CreateWordField (Arg0, 0x01, TMP)
468                     FindSetRightBit (TMP, Local0)
469                     Decrement (Local0)
470                     Store (Local0, PRQ1)
471                 }
472         }
473         Device(LNKC){
474                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
475                 Name(_UID, 3)
476                 Name(_PRS, ResourceTemplate(){
477                     IRQ (Level, ActiveLow, Shared)
478                         {3,4,5,6,7,9,10,11,12}
479                 })
480                 Method (_STA, 0, NotSerialized)
481                 {
482                     Store (0x0B, Local0)
483                     If (And (0x80, PRQ2, Local1))
484                     {
485                          Store (0x09, Local0)
486                     }
487                     Return (Local0)
488                 }
489                 Method (_DIS, 0, NotSerialized)
490                 {
491                     Or (PRQ2, 0x80, PRQ2)
492                 }
493                 Method (_CRS, 0, NotSerialized)
494                 {
495                     Name (PRR0, ResourceTemplate ()
496                     {
497                         IRQ (Level, ActiveLow, Shared)
498                             {1}
499                     })
500                     CreateWordField (PRR0, 0x01, TMP)
501                     Store (PRQ2, Local0)
502                     If (LLess (Local0, 0x80))
503                     {
504                         ShiftLeft (One, Local0, TMP)
505                     }
506                     Else
507                     {
508                         Store (Zero, TMP)
509                     }
510                     Return (PRR0)
511                 }
512                 Method (_SRS, 1, NotSerialized)
513                 {
514                     CreateWordField (Arg0, 0x01, TMP)
515                     FindSetRightBit (TMP, Local0)
516                     Decrement (Local0)
517                     Store (Local0, PRQ2)
518                 }
519         }
520         Device(LNKD){
521                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
522                 Name(_UID, 4)
523                 Name(_PRS, ResourceTemplate(){
524                     IRQ (Level, ActiveLow, Shared)
525                         {3,4,5,6,7,9,10,11,12}
526                 })
527                 Method (_STA, 0, NotSerialized)
528                 {
529                     Store (0x0B, Local0)
530                     If (And (0x80, PRQ3, Local1))
531                     {
532                          Store (0x09, Local0)
533                     }
534                     Return (Local0)
535                 }
536                 Method (_DIS, 0, NotSerialized)
537                 {
538                     Or (PRQ3, 0x80, PRQ3)
539                 }
540                 Method (_CRS, 0, NotSerialized)
541                 {
542                     Name (PRR0, ResourceTemplate ()
543                     {
544                         IRQ (Level, ActiveLow, Shared)
545                             {1}
546                     })
547                     CreateWordField (PRR0, 0x01, TMP)
548                     Store (PRQ3, Local0)
549                     If (LLess (Local0, 0x80))
550                     {
551                         ShiftLeft (One, Local0, TMP)
552                     }
553                     Else
554                     {
555                         Store (Zero, TMP)
556                     }
557                     Return (PRR0)
558                 }
559                 Method (_SRS, 1, NotSerialized)
560                 {
561                     CreateWordField (Arg0, 0x01, TMP)
562                     FindSetRightBit (TMP, Local0)
563                     Decrement (Local0)
564                     Store (Local0, PRQ3)
565                 }
566         }
567     }
569     /*
570      * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
571      * must match piix4 emulation.
572      */
573     Name (\_S3, Package (0x04)
574     {
575         0x01,  /* PM1a_CNT.SLP_TYP */
576         0x01,  /* PM1b_CNT.SLP_TYP */
577         Zero,  /* reserved */
578         Zero   /* reserved */
579     })
580     Name (\_S4, Package (0x04)
581     {
582         Zero,  /* PM1a_CNT.SLP_TYP */
583         Zero,  /* PM1b_CNT.SLP_TYP */
584         Zero,  /* reserved */
585         Zero   /* reserved */
586     })
587     Name (\_S5, Package (0x04)
588     {
589         Zero,  /* PM1a_CNT.SLP_TYP */
590         Zero,  /* PM1b_CNT.SLP_TYP */
591         Zero,  /* reserved */
592         Zero   /* reserved */
593     })