Provide gpe _L0x methods.
[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 #define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
51        Package() { nr##ffff, 0, lnk0, 0 }, \
52        Package() { nr##ffff, 1, lnk1, 0 }, \
53        Package() { nr##ffff, 2, lnk2, 0 }, \
54        Package() { nr##ffff, 3, lnk3, 0 }
55
56 #define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
57 #define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
58 #define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
59 #define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
60                prt_slot0(0x0000),
61                prt_slot1(0x0001),
62                prt_slot2(0x0002),
63                prt_slot3(0x0003),
64                prt_slot0(0x0004),
65                prt_slot1(0x0005),
66             })
67
68             Name (_CRS, ResourceTemplate ()
69             {
70                 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
71                     0x0000,             // Address Space Granularity
72                     0x0000,             // Address Range Minimum
73                     0x00FF,             // Address Range Maximum
74                     0x0000,             // Address Translation Offset
75                     0x0100,             // Address Length
76                     ,, )
77                 IO (Decode16,
78                     0x0CF8,             // Address Range Minimum
79                     0x0CF8,             // Address Range Maximum
80                     0x01,               // Address Alignment
81                     0x08,               // Address Length
82                     )
83                 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
84                     0x0000,             // Address Space Granularity
85                     0x0000,             // Address Range Minimum
86                     0x0CF7,             // Address Range Maximum
87                     0x0000,             // Address Translation Offset
88                     0x0CF8,             // Address Length
89                     ,, , TypeStatic)
90                 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
91                     0x0000,             // Address Space Granularity
92                     0x0D00,             // Address Range Minimum
93                     0xFFFF,             // Address Range Maximum
94                     0x0000,             // Address Translation Offset
95                     0xF300,             // Address Length
96                     ,, , TypeStatic)
97                 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
98                     0x00000000,         // Address Space Granularity
99                     0x000A0000,         // Address Range Minimum
100                     0x000BFFFF,         // Address Range Maximum
101                     0x00000000,         // Address Translation Offset
102                     0x00020000,         // Address Length
103                     ,, , AddressRangeMemory, TypeStatic)
104                 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
105                     0x00000000,         // Address Space Granularity
106                     0xE0000000,         // Address Range Minimum
107                     0xFEBFFFFF,         // Address Range Maximum
108                     0x00000000,         // Address Translation Offset
109                     0x1EC00000,         // Address Length
110                     ,, , AddressRangeMemory, TypeStatic)
111             })
112         }
113     }
114
115     Scope(\_SB.PCI0) {
116         Device (VGA) {
117                  Name (_ADR, 0x00020000)
118                  Method (_S1D, 0, NotSerialized)
119                  {
120                          Return (0x00)
121                  }
122                  Method (_S2D, 0, NotSerialized)
123                  {
124                          Return (0x00)
125                  }
126                  Method (_S3D, 0, NotSerialized)
127                  {
128                          Return (0x00)
129                  }
130         }
131
132         /* PIIX3 ISA bridge */
133         Device (ISA) {
134             Name (_ADR, 0x00010000)
135
136             /* PIIX PCI to ISA irq remapping */
137             OperationRegion (P40C, PCI_Config, 0x60, 0x04)
138
139             /* Real-time clock */
140             Device (RTC)
141             {
142                 Name (_HID, EisaId ("PNP0B00"))
143                 Name (_CRS, ResourceTemplate ()
144                 {
145                     IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
146                     IRQNoFlags () {8}
147                     IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
148                 })
149             }
150
151             /* Keyboard seems to be important for WinXP install */
152             Device (KBD)
153             {
154                 Name (_HID, EisaId ("PNP0303"))
155                 Method (_STA, 0, NotSerialized)
156                 {
157                     Return (0x0f)
158                 }
159
160                 Method (_CRS, 0, NotSerialized)
161                 {
162                      Name (TMP, ResourceTemplate ()
163                      {
164                     IO (Decode16,
165                         0x0060,             // Address Range Minimum
166                         0x0060,             // Address Range Maximum
167                         0x01,               // Address Alignment
168                         0x01,               // Address Length
169                         )
170                     IO (Decode16,
171                         0x0064,             // Address Range Minimum
172                         0x0064,             // Address Range Maximum
173                         0x01,               // Address Alignment
174                         0x01,               // Address Length
175                         )
176                     IRQNoFlags ()
177                         {1}
178                     })
179                     Return (TMP)
180                 }
181             }
182
183             /* PS/2 mouse */
184             Device (MOU)
185             {
186                 Name (_HID, EisaId ("PNP0F13"))
187                 Method (_STA, 0, NotSerialized)
188                 {
189                     Return (0x0f)
190                 }
191
192                 Method (_CRS, 0, NotSerialized)
193                 {
194                     Name (TMP, ResourceTemplate ()
195                     {
196                          IRQNoFlags () {12}
197                     })
198                     Return (TMP)
199                 }
200             }
201
202             /* PS/2 floppy controller */
203             Device (FDC0)
204             {
205                 Name (_HID, EisaId ("PNP0700"))
206                 Method (_STA, 0, NotSerialized)
207                 {
208                     Return (0x0F)
209                 }
210                 Method (_CRS, 0, NotSerialized)
211                 {
212                     Name (BUF0, ResourceTemplate ()
213                     {
214                         IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
215                         IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
216                         IRQNoFlags () {6}
217                         DMA (Compatibility, NotBusMaster, Transfer8) {2}
218                     })
219                     Return (BUF0)
220                 }
221             }
222
223             /* Parallel port */
224             Device (LPT)
225             {
226                 Name (_HID, EisaId ("PNP0400"))
227                 Method (_STA, 0, NotSerialized)
228                 {
229                     Store (\_SB.PCI0.PX13.DRSA, Local0)
230                     And (Local0, 0x80000000, Local0)
231                     If (LEqual (Local0, 0))
232                     {
233                         Return (0x00)
234                     }
235                     Else
236                     {
237                         Return (0x0F)
238                     }
239                 }
240                 Method (_CRS, 0, NotSerialized)
241                 {
242                     Name (BUF0, ResourceTemplate ()
243                     {
244                         IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
245                         IRQNoFlags () {7}
246                     })
247                     Return (BUF0)
248                 }
249             }
250
251             /* Serial Ports */
252             Device (COM1)
253             {
254                 Name (_HID, EisaId ("PNP0501"))
255                 Name (_UID, 0x01)
256                 Method (_STA, 0, NotSerialized)
257                 {
258                     Store (\_SB.PCI0.PX13.DRSC, Local0)
259                     And (Local0, 0x08000000, Local0)
260                     If (LEqual (Local0, 0))
261                     {
262                         Return (0x00)
263                     }
264                     Else
265                     {
266                         Return (0x0F)
267                     }
268                 }
269                 Method (_CRS, 0, NotSerialized)
270                 {
271                     Name (BUF0, ResourceTemplate ()
272                     {
273                         IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
274                         IRQNoFlags () {4}
275                     })
276                     Return (BUF0)
277                 }
278             }
279
280             Device (COM2)
281             {
282                 Name (_HID, EisaId ("PNP0501"))
283                 Name (_UID, 0x02)
284                 Method (_STA, 0, NotSerialized)
285                 {
286                     Store (\_SB.PCI0.PX13.DRSC, Local0)
287                     And (Local0, 0x80000000, Local0)
288                     If (LEqual (Local0, 0))
289                     {
290                         Return (0x00)
291                     }
292                     Else
293                     {
294                         Return (0x0F)
295                     }
296                 }
297                 Method (_CRS, 0, NotSerialized)
298                 {
299                     Name (BUF0, ResourceTemplate ()
300                     {
301                         IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
302                         IRQNoFlags () {3}
303                     })
304                     Return (BUF0)
305                 }
306             }
307         }
308
309         /* PIIX4 PM */
310         Device (PX13) {
311             Name (_ADR, 0x00010003)
312
313             OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
314             Field (P13C, DWordAcc, NoLock, Preserve)
315             {
316                 DRSA, 32,
317                 DRSB, 32,
318                 DRSC, 32,
319                 DRSE, 32,
320                 DRSF, 32,
321                 DRSG, 32,
322                 DRSH, 32,
323                 DRSI, 32,
324                 DRSJ, 32
325             }
326         }
327     }
328
329     /* PCI IRQs */
330     Scope(\_SB) {
331          Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
332          {
333              PRQ0,   8,
334              PRQ1,   8,
335              PRQ2,   8,
336              PRQ3,   8
337          }
338
339         Device(LNKA){
340                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
341                 Name(_UID, 1)
342                 Name(_PRS, ResourceTemplate(){
343                     Interrupt (, Level, ActiveHigh, Shared)
344                         { 5, 10, 11 }
345                 })
346                 Method (_STA, 0, NotSerialized)
347                 {
348                     Store (0x0B, Local0)
349                     If (And (0x80, PRQ0, Local1))
350                     {
351                          Store (0x09, Local0)
352                     }
353                     Return (Local0)
354                 }
355                 Method (_DIS, 0, NotSerialized)
356                 {
357                     Or (PRQ0, 0x80, PRQ0)
358                 }
359                 Method (_CRS, 0, NotSerialized)
360                 {
361                     Name (PRR0, ResourceTemplate ()
362                     {
363                         Interrupt (, Level, ActiveHigh, Shared)
364                             {1}
365                     })
366                     CreateDWordField (PRR0, 0x05, TMP)
367                     Store (PRQ0, Local0)
368                     If (LLess (Local0, 0x80))
369                     {
370                         Store (Local0, TMP)
371                     }
372                     Else
373                     {
374                         Store (Zero, TMP)
375                     }
376                     Return (PRR0)
377                 }
378                 Method (_SRS, 1, NotSerialized)
379                 {
380                     CreateDWordField (Arg0, 0x05, TMP)
381                     Store (TMP, PRQ0)
382                 }
383         }
384         Device(LNKB){
385                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
386                 Name(_UID, 2)
387                 Name(_PRS, ResourceTemplate(){
388                     Interrupt (, Level, ActiveHigh, Shared)
389                         { 5, 10, 11 }
390                 })
391                 Method (_STA, 0, NotSerialized)
392                 {
393                     Store (0x0B, Local0)
394                     If (And (0x80, PRQ1, Local1))
395                     {
396                          Store (0x09, Local0)
397                     }
398                     Return (Local0)
399                 }
400                 Method (_DIS, 0, NotSerialized)
401                 {
402                     Or (PRQ1, 0x80, PRQ1)
403                 }
404                 Method (_CRS, 0, NotSerialized)
405                 {
406                     Name (PRR0, ResourceTemplate ()
407                     {
408                         Interrupt (, Level, ActiveHigh, Shared)
409                             {1}
410                     })
411                     CreateDWordField (PRR0, 0x05, TMP)
412                     Store (PRQ1, Local0)
413                     If (LLess (Local0, 0x80))
414                     {
415                         Store (Local0, TMP)
416                     }
417                     Else
418                     {
419                         Store (Zero, TMP)
420                     }
421                     Return (PRR0)
422                 }
423                 Method (_SRS, 1, NotSerialized)
424                 {
425                     CreateDWordField (Arg0, 0x05, TMP)
426                     Store (TMP, PRQ1)
427                 }
428         }
429         Device(LNKC){
430                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
431                 Name(_UID, 3)
432                 Name(_PRS, ResourceTemplate(){
433                     Interrupt (, Level, ActiveHigh, Shared)
434                         { 5, 10, 11 }
435                 })
436                 Method (_STA, 0, NotSerialized)
437                 {
438                     Store (0x0B, Local0)
439                     If (And (0x80, PRQ2, Local1))
440                     {
441                          Store (0x09, Local0)
442                     }
443                     Return (Local0)
444                 }
445                 Method (_DIS, 0, NotSerialized)
446                 {
447                     Or (PRQ2, 0x80, PRQ2)
448                 }
449                 Method (_CRS, 0, NotSerialized)
450                 {
451                     Name (PRR0, ResourceTemplate ()
452                     {
453                         Interrupt (, Level, ActiveHigh, Shared)
454                             {1}
455                     })
456                     CreateDWordField (PRR0, 0x05, TMP)
457                     Store (PRQ2, Local0)
458                     If (LLess (Local0, 0x80))
459                     {
460                         Store (Local0, TMP)
461                     }
462                     Else
463                     {
464                         Store (Zero, TMP)
465                     }
466                     Return (PRR0)
467                 }
468                 Method (_SRS, 1, NotSerialized)
469                 {
470                     CreateDWordField (Arg0, 0x05, TMP)
471                     Store (TMP, PRQ2)
472                 }
473         }
474         Device(LNKD){
475                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
476                 Name(_UID, 4)
477                 Name(_PRS, ResourceTemplate(){
478                     Interrupt (, Level, ActiveHigh, Shared)
479                         { 5, 10, 11 }
480                 })
481                 Method (_STA, 0, NotSerialized)
482                 {
483                     Store (0x0B, Local0)
484                     If (And (0x80, PRQ3, Local1))
485                     {
486                          Store (0x09, Local0)
487                     }
488                     Return (Local0)
489                 }
490                 Method (_DIS, 0, NotSerialized)
491                 {
492                     Or (PRQ3, 0x80, PRQ3)
493                 }
494                 Method (_CRS, 0, NotSerialized)
495                 {
496                     Name (PRR0, ResourceTemplate ()
497                     {
498                         Interrupt (, Level, ActiveHigh, Shared)
499                             {1}
500                     })
501                     CreateDWordField (PRR0, 0x05, TMP)
502                     Store (PRQ3, Local0)
503                     If (LLess (Local0, 0x80))
504                     {
505                         Store (Local0, TMP)
506                     }
507                     Else
508                     {
509                         Store (Zero, TMP)
510                     }
511                     Return (PRR0)
512                 }
513                 Method (_SRS, 1, NotSerialized)
514                 {
515                     CreateDWordField (Arg0, 0x05, TMP)
516                     Store (TMP, PRQ3)
517                 }
518         }
519     }
520
521     /*
522      * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
523      * must match piix4 emulation.
524      */
525     Name (\_S3, Package (0x04)
526     {
527         0x01,  /* PM1a_CNT.SLP_TYP */
528         0x01,  /* PM1b_CNT.SLP_TYP */
529         Zero,  /* reserved */
530         Zero   /* reserved */
531     })
532     Name (\_S4, Package (0x04)
533     {
534         Zero,  /* PM1a_CNT.SLP_TYP */
535         Zero,  /* PM1b_CNT.SLP_TYP */
536         Zero,  /* reserved */
537         Zero   /* reserved */
538     })
539     Name (\_S5, Package (0x04)
540     {
541         Zero,  /* PM1a_CNT.SLP_TYP */
542         Zero,  /* PM1b_CNT.SLP_TYP */
543         Zero,  /* reserved */
544         Zero   /* reserved */
545     })
546
547     Scope (\_GPE)
548     {
549         Name(_HID, "ACPI0006")
550
551         Method(_L00) {
552             Return(0x01)
553         }
554         Method(_L01) {
555             Return(0x01)
556         }
557         Method(_L02) {
558             Return(0x01)
559         }
560         Method(_L03) {
561             Return(0x01)
562         }
563         Method(_L04) {
564             Return(0x01)
565         }
566         Method(_L05) {
567             Return(0x01)
568         }
569         Method(_L06) {
570             Return(0x01)
571         }
572         Method(_L07) {
573             Return(0x01)
574         }
575         Method(_L08) {
576             Return(0x01)
577         }
578         Method(_L09) {
579             Return(0x01)
580         }
581         Method(_L0A) {
582             Return(0x01)
583         }
584         Method(_L0B) {
585             Return(0x01)
586         }
587         Method(_L0C) {
588             Return(0x01)
589         }
590         Method(_L0D) {
591             Return(0x01)
592         }
593         Method(_L0E) {
594             Return(0x01)
595         }
596         Method(_L0F) {
597             Return(0x01)
598         }
599     }
600
601 }