Revert "This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS."
[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         /* 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             /* Real-time clock */
174             Device (RTC)
175             {
176                 Name (_HID, EisaId ("PNP0B00"))
177                 Name (_CRS, ResourceTemplate ()
178                 {
179                     IO (Decode16, 0x0070, 0x0070, 0x10, 0x02)
180                     IRQNoFlags () {8}
181                     IO (Decode16, 0x0072, 0x0072, 0x02, 0x06)
182                 })
183             }
184
185             /* Keyboard seems to be important for WinXP install */
186             Device (KBD)
187             {
188                 Name (_HID, EisaId ("PNP0303"))
189                 Method (_STA, 0, NotSerialized)
190                 {
191                     Return (0x0f)
192                 }
193
194                 Method (_CRS, 0, NotSerialized)
195                 {
196                      Name (TMP, ResourceTemplate ()
197                      {
198                     IO (Decode16,
199                         0x0060,             // Address Range Minimum
200                         0x0060,             // Address Range Maximum
201                         0x01,               // Address Alignment
202                         0x01,               // Address Length
203                         )
204                     IO (Decode16,
205                         0x0064,             // Address Range Minimum
206                         0x0064,             // Address Range Maximum
207                         0x01,               // Address Alignment
208                         0x01,               // Address Length
209                         )
210                     IRQNoFlags ()
211                         {1}
212                     })
213                     Return (TMP)
214                 }
215             }
216
217             /* PS/2 mouse */
218             Device (MOU)
219             {
220                 Name (_HID, EisaId ("PNP0F13"))
221                 Method (_STA, 0, NotSerialized)
222                 {
223                     Return (0x0f)
224                 }
225
226                 Method (_CRS, 0, NotSerialized)
227                 {
228                     Name (TMP, ResourceTemplate ()
229                     {
230                          IRQNoFlags () {12}
231                     })
232                     Return (TMP)
233                 }
234             }
235
236             /* PS/2 floppy controller */
237             Device (FDC0)
238             {
239                 Name (_HID, EisaId ("PNP0700"))
240                 Method (_STA, 0, NotSerialized)
241                 {
242                     Return (0x0F)
243                 }
244                 Method (_CRS, 0, NotSerialized)
245                 {
246                     Name (BUF0, ResourceTemplate ()
247                     {
248                         IO (Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
249                         IO (Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
250                         IRQNoFlags () {6}
251                         DMA (Compatibility, NotBusMaster, Transfer8) {2}
252                     })
253                     Return (BUF0)
254                 }
255             }
256
257             /* Parallel port */
258             Device (LPT)
259             {
260                 Name (_HID, EisaId ("PNP0400"))
261                 Method (_STA, 0, NotSerialized)
262                 {
263                     Store (\_SB.PCI0.PX13.DRSA, Local0)
264                     And (Local0, 0x80000000, 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, 0x0378, 0x0378, 0x08, 0x08)
279                         IRQNoFlags () {7}
280                     })
281                     Return (BUF0)
282                 }
283             }
284
285             /* Serial Ports */
286             Device (COM1)
287             {
288                 Name (_HID, EisaId ("PNP0501"))
289                 Name (_UID, 0x01)
290                 Method (_STA, 0, NotSerialized)
291                 {
292                     Store (\_SB.PCI0.PX13.DRSC, Local0)
293                     And (Local0, 0x08000000, Local0)
294                     If (LEqual (Local0, 0))
295                     {
296                         Return (0x00)
297                     }
298                     Else
299                     {
300                         Return (0x0F)
301                     }
302                 }
303                 Method (_CRS, 0, NotSerialized)
304                 {
305                     Name (BUF0, ResourceTemplate ()
306                     {
307                         IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
308                         IRQNoFlags () {4}
309                     })
310                     Return (BUF0)
311                 }
312             }
313
314             Device (COM2)
315             {
316                 Name (_HID, EisaId ("PNP0501"))
317                 Name (_UID, 0x02)
318                 Method (_STA, 0, NotSerialized)
319                 {
320                     Store (\_SB.PCI0.PX13.DRSC, Local0)
321                     And (Local0, 0x80000000, Local0)
322                     If (LEqual (Local0, 0))
323                     {
324                         Return (0x00)
325                     }
326                     Else
327                     {
328                         Return (0x0F)
329                     }
330                 }
331                 Method (_CRS, 0, NotSerialized)
332                 {
333                     Name (BUF0, ResourceTemplate ()
334                     {
335                         IO (Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
336                         IRQNoFlags () {3}
337                     })
338                     Return (BUF0)
339                 }
340             }
341         }
342
343         /* PIIX4 PM */
344         Device (PX13) {
345             Name (_ADR, 0x00010003)
346
347             OperationRegion (P13C, PCI_Config, 0x5c, 0x24)
348             Field (P13C, DWordAcc, NoLock, Preserve)
349             {
350                 DRSA, 32,
351                 DRSB, 32,
352                 DRSC, 32,
353                 DRSE, 32,
354                 DRSF, 32,
355                 DRSG, 32,
356                 DRSH, 32,
357                 DRSI, 32,
358                 DRSJ, 32
359             }
360         }
361     }
362
363     /* PCI IRQs */
364     Scope(\_SB) {
365          Field (\_SB.PCI0.ISA.P40C, ByteAcc, NoLock, Preserve)
366          {
367              PRQ0,   8,
368              PRQ1,   8,
369              PRQ2,   8,
370              PRQ3,   8
371          }
372
373         Device(LNKA){
374                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
375                 Name(_UID, 1)
376                 Name(_PRS, ResourceTemplate(){
377                     IRQ (Level, ActiveLow, Shared)
378                         {3,4,5,6,7,9,10,11,12}
379                 })
380                 Method (_STA, 0, NotSerialized)
381                 {
382                     Store (0x0B, Local0)
383                     If (And (0x80, PRQ0, Local1))
384                     {
385                          Store (0x09, Local0)
386                     }
387                     Return (Local0)
388                 }
389                 Method (_DIS, 0, NotSerialized)
390                 {
391                     Or (PRQ0, 0x80, PRQ0)
392                 }
393                 Method (_CRS, 0, NotSerialized)
394                 {
395                     Name (PRR0, ResourceTemplate ()
396                     {
397                         IRQ (Level, ActiveLow, Shared)
398                             {1}
399                     })
400                     CreateWordField (PRR0, 0x01, TMP)
401                     Store (PRQ0, Local0)
402                     If (LLess (Local0, 0x80))
403                     {
404                         ShiftLeft (One, Local0, TMP)
405                     }
406                     Else
407                     {
408                         Store (Zero, TMP)
409                     }
410                     Return (PRR0)
411                 }
412                 Method (_SRS, 1, NotSerialized)
413                 {
414                     CreateWordField (Arg0, 0x01, TMP)
415                     FindSetRightBit (TMP, Local0)
416                     Decrement (Local0)
417                     Store (Local0, PRQ0)
418                 }
419         }
420         Device(LNKB){
421                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
422                 Name(_UID, 2)
423                 Name(_PRS, ResourceTemplate(){
424                     IRQ (Level, ActiveLow, Shared)
425                         {3,4,5,6,7,9,10,11,12}
426                 })
427                 Method (_STA, 0, NotSerialized)
428                 {
429                     Store (0x0B, Local0)
430                     If (And (0x80, PRQ1, Local1))
431                     {
432                          Store (0x09, Local0)
433                     }
434                     Return (Local0)
435                 }
436                 Method (_DIS, 0, NotSerialized)
437                 {
438                     Or (PRQ1, 0x80, PRQ1)
439                 }
440                 Method (_CRS, 0, NotSerialized)
441                 {
442                     Name (PRR0, ResourceTemplate ()
443                     {
444                         IRQ (Level, ActiveLow, Shared)
445                             {1}
446                     })
447                     CreateWordField (PRR0, 0x01, TMP)
448                     Store (PRQ1, Local0)
449                     If (LLess (Local0, 0x80))
450                     {
451                         ShiftLeft (One, Local0, TMP)
452                     }
453                     Else
454                     {
455                         Store (Zero, TMP)
456                     }
457                     Return (PRR0)
458                 }
459                 Method (_SRS, 1, NotSerialized)
460                 {
461                     CreateWordField (Arg0, 0x01, TMP)
462                     FindSetRightBit (TMP, Local0)
463                     Decrement (Local0)
464                     Store (Local0, PRQ1)
465                 }
466         }
467         Device(LNKC){
468                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
469                 Name(_UID, 3)
470                 Name(_PRS, ResourceTemplate(){
471                     IRQ (Level, ActiveLow, Shared)
472                         {3,4,5,6,7,9,10,11,12}
473                 })
474                 Method (_STA, 0, NotSerialized)
475                 {
476                     Store (0x0B, Local0)
477                     If (And (0x80, PRQ2, Local1))
478                     {
479                          Store (0x09, Local0)
480                     }
481                     Return (Local0)
482                 }
483                 Method (_DIS, 0, NotSerialized)
484                 {
485                     Or (PRQ2, 0x80, PRQ2)
486                 }
487                 Method (_CRS, 0, NotSerialized)
488                 {
489                     Name (PRR0, ResourceTemplate ()
490                     {
491                         IRQ (Level, ActiveLow, Shared)
492                             {1}
493                     })
494                     CreateWordField (PRR0, 0x01, TMP)
495                     Store (PRQ2, Local0)
496                     If (LLess (Local0, 0x80))
497                     {
498                         ShiftLeft (One, Local0, TMP)
499                     }
500                     Else
501                     {
502                         Store (Zero, TMP)
503                     }
504                     Return (PRR0)
505                 }
506                 Method (_SRS, 1, NotSerialized)
507                 {
508                     CreateWordField (Arg0, 0x01, TMP)
509                     FindSetRightBit (TMP, Local0)
510                     Decrement (Local0)
511                     Store (Local0, PRQ2)
512                 }
513         }
514         Device(LNKD){
515                 Name(_HID, EISAID("PNP0C0F"))     // PCI interrupt link
516                 Name(_UID, 4)
517                 Name(_PRS, ResourceTemplate(){
518                     IRQ (Level, ActiveLow, Shared)
519                         {3,4,5,6,7,9,10,11,12}
520                 })
521                 Method (_STA, 0, NotSerialized)
522                 {
523                     Store (0x0B, Local0)
524                     If (And (0x80, PRQ3, Local1))
525                     {
526                          Store (0x09, Local0)
527                     }
528                     Return (Local0)
529                 }
530                 Method (_DIS, 0, NotSerialized)
531                 {
532                     Or (PRQ3, 0x80, PRQ3)
533                 }
534                 Method (_CRS, 0, NotSerialized)
535                 {
536                     Name (PRR0, ResourceTemplate ()
537                     {
538                         IRQ (Level, ActiveLow, Shared)
539                             {1}
540                     })
541                     CreateWordField (PRR0, 0x01, TMP)
542                     Store (PRQ3, Local0)
543                     If (LLess (Local0, 0x80))
544                     {
545                         ShiftLeft (One, Local0, TMP)
546                     }
547                     Else
548                     {
549                         Store (Zero, TMP)
550                     }
551                     Return (PRR0)
552                 }
553                 Method (_SRS, 1, NotSerialized)
554                 {
555                     CreateWordField (Arg0, 0x01, TMP)
556                     FindSetRightBit (TMP, Local0)
557                     Decrement (Local0)
558                     Store (Local0, PRQ3)
559                 }
560         }
561     }
562
563     /* S5 = power off state */
564     Name (_S5, Package (4) {
565         0x00, // PM1a_CNT.SLP_TYP
566         0x00, // PM2a_CNT.SLP_TYP
567         0x00, // reserved
568         0x00, // reserved
569     })
570 }