Clean up ACPI:
[coreboot.git] / src / mainboard / via / epia-n / acpi / sb_physical.asl
1 /*
2  * Minimalist ACPI DSDT table for EPIA-N / NL
3  * Basic description of some hardware resources to allow
4  * interrupt assignments to be done. This is expected to be included
5  * into _SB.PCI0 namespace
6  * (C) Copyright 2009 Jon Harrison <jon.harrison@blueyonder.co.uk>
7  *
8  */
9
10
11 /* Basic description of the VT8237R LPC Interface
12  * PCI Configuration Space
13  */
14
15 Device (VT8R)
16 {
17     Name (_ADR, 0x00110000)
18     OperationRegion (USBC, PCI_Config, 0x50, 0x02)
19     Scope (\)
20     {
21         Field (\_SB.PCI0.VT8R.USBC, ByteAcc, NoLock, Preserve)
22         {
23                 IDEB,   8
24         }
25     }
26
27     OperationRegion (VTSB, PCI_Config, 0x00, 0xE8)
28     Scope (\)
29     {
30         Field (\_SB.PCI0.VT8R.VTSB, ByteAcc, NoLock, Preserve)
31         {
32                                 Offset (0x02),
33                 DEID,   16,
34                                 Offset (0x2C),
35                 ID2C,   8,
36                 ID2D,   8,
37                 ID2E,   8,
38                 ID2F,   8,
39                                 Offset (0x44),
40                 PIRE,   4,
41                 PIRF,   4,
42                 PIRG,   4,
43                 PIRH,   4,
44                 POLE,   1,
45                 POLF,   1,
46                 POLG,   1,
47                 POLH,   1,
48                 ENR8,   1,
49                                 Offset (0x50),
50                 ESB4,   1,
51                 ESB3,   1,
52                 ESB2,   1,
53                 EIDE,   1,
54                 EUSB,   1,
55                 ESB1,   1,
56                 EAMC,   2,
57                 EKBC,   1,
58                 KBCC,   1,
59                 EPS2,   1,
60                 ERTC,   1,
61                 ELAN,   1,
62                         ,       2,
63                 USBD,   1,
64                 SIRQ,   8,
65                                 Offset (0x55),
66                 PIRA,   8,
67                 PIBC,   8,
68                 PIRD,   8,
69                                 Offset (0x75),
70                 BSAT,   1,
71                                 Offset (0x94),
72                 PWC1,   2,
73                 GPO1,   1,
74                 GPO2,   1,
75                 GPO3,   1,
76                 PLLD,   1
77         }
78     }
79 }
80
81 /* Basic Description of Serial ATA Interface */
82 Device (SATA)
83 {
84     Name (_ADR, 0x000F0000)
85     Method (_STA, 0, NotSerialized)
86     {
87         If (LNotEqual (\_SB.PCI0.SATA.VID, 0x1106))
88         {
89             Return (0x00)
90         }
91         Else
92         {
93             If (LEqual (\_SB.PCI0.SATA.CMDR, 0x00))
94             {
95                 Return (0x0D)
96             }
97             Else
98             {
99                 Return (0x0F)
100             }
101         }
102     }
103
104     OperationRegion (SAPR, PCI_Config, 0x00, 0xC2)
105     Field (SAPR, ByteAcc, NoLock, Preserve)
106     {
107         VID,    16,
108                 Offset (0x04),
109         CMDR,   3,
110                 Offset (0x3C),
111         IDEI,   8,
112                 Offset (0x49),
113             ,   6,
114         EPHY,   1
115     }
116 }
117
118 /* Basic Description of Parallel ATA Interface */
119 /* An some initialisation of the interface     */
120 Device (PATA)
121 {
122     Name (_ADR, 0x000F0001)
123     Name (REGF, 0x01)
124     Method (_STA, 0, NotSerialized)
125     {
126         If (LNotEqual (\_SB.PCI0.PATA.VID, 0x1106))
127         {
128             Return (0x00)
129         }
130         Else
131         {
132             PMEX ()
133                         /* Check if the Interface is Enabled */
134             If (LEqual (\_SB.PCI0.PATA.CMDR, 0x00))
135             {
136                 Return (0x0D)
137             }
138             Else
139             {
140                 Return (0x0F)
141             }
142         }
143     }
144
145         /* ACPI Spec says to check that regions are accessible */
146         /* before trying to access them                        */
147     Method (_REG, 2, NotSerialized)
148     {
149                 /* Arg0 = Operating Region (0x02 == PCI_Config) */
150         If (LEqual (Arg0, 0x02))
151         {
152                         /* Arg1 = Handler Connection Mode (0x01 == Connect) */
153             Store (Arg1, REGF)
154         }
155     }
156
157         #include "pata_methods.asl"
158
159
160     OperationRegion (PAPR, PCI_Config, 0x00, 0xC2)
161     Field (PAPR, ByteAcc, NoLock, Preserve)
162     {
163         VID,    16,
164                 Offset (0x04),
165         CMDR,   3,
166                 Offset (0x09),
167         ENAT,   4,
168                 Offset (0x3C),
169         IDEI,   8,
170                 Offset (0x40),
171         ESCH,   1,
172         EPCH,   1,
173                 Offset (0x48),
174         SSPT,   8,
175         SMPT,   8,
176         PSPT,   8,
177         PMPT,   8,
178                 Offset (0x50),
179         SSUT,   4,
180         SSCT,   1,
181         SSUE,   3,
182         SMUT,   4,
183         SMCT,   1,
184         SMUE,   3,
185         PSUT,   4,
186         PSCT,   1,
187         PSUE,   3,
188         PMUT,   4,
189         PMCT,   1,
190         PMUE,   3
191     }
192
193
194     Device (CHN0)
195     {
196         Name (_ADR, 0x00)
197         Method (_STA, 0, NotSerialized)
198         {
199             If (LNotEqual (\_SB.PCI0.PATA.EPCH, 0x01))
200             {
201                 Return (0x00)
202             }
203             Else
204             {
205                 Return (0x0F)
206             }
207         }
208
209         Device (DRV0)
210         {
211             Name (_ADR, 0x00)
212             Method (_GTF, 0, NotSerialized)
213             {
214                 Return (GTF (0x00, PMUE, PMUT, PMPT))
215             }
216         }
217
218         Device (DRV1)
219         {
220             Name (_ADR, 0x01)
221             Method (_GTF, 0, NotSerialized)
222             {
223                 Return (GTF (0x01, PSUE, PSUT, PSPT))
224             }
225         }
226     }
227
228     Device (CHN1)
229     {
230         Name (_ADR, 0x01)
231         Method (_STA, 0, NotSerialized)
232         {
233             If (LNotEqual (ATFL, 0x02))
234             {
235                 If (LEqual (\_SB.PCI0.SATA.EPHY, 0x01))
236                 {
237                     Return (0x00)
238                 }
239                 Else
240                 {
241                     If (LNotEqual (\_SB.PCI0.PATA.ESCH, 0x01))
242                     {
243                         Return (0x00)
244                     }
245                     Else
246                     {
247                         Return (0x0F)
248                     }
249                 }
250             }
251                         Else
252                         {
253                If (LEqual (ATFL, 0x02))
254                {
255                    If (LNotEqual (\_SB.PCI0.PATA.ESCH, 0x01))
256                    {
257                            Return (0x00)
258                    }
259                    Else
260                    {
261                            Return (0x0F)
262                    }
263                }
264                            Else
265                            {
266                                         Return(0x00)
267                            }
268                         }
269         }
270
271         Device (DRV0)
272         {
273             Name (_ADR, 0x00)
274             Method (_GTF, 0, NotSerialized)
275             {
276                 Return (GTF (0x02, SMUE, SMUT, SMPT))
277             }
278         }
279
280         Device (DRV1)
281         {
282             Name (_ADR, 0x01)
283             Method (_GTF, 0, NotSerialized)
284             {
285                 Return (GTF (0x03, SSUE, SSUT, SSPT))
286             }
287         }
288     }
289 } // End of PATA Device
290
291
292 /* Implement Basic USB Presence detect and */
293 /* Power Management Event mask             */
294 Device (USB0)
295 {
296     Name (_ADR, 0x00100000)
297     Name (_PRW, Package (0x02)
298     {
299         0x0E,
300         0x03
301     })
302
303     OperationRegion (U2F0, PCI_Config, 0x00, 0xC2)
304     Field (U2F0, ByteAcc, NoLock, Preserve)
305     {
306         VID,    16,
307                 Offset (0x04),
308         CMDR,   3,
309                 Offset (0x3C),
310         U0IR,   4,
311                 Offset (0x84),
312         ECDX,   2
313     }
314
315     Method (_STA, 0, NotSerialized)
316     {
317         If (LNotEqual (\_SB.PCI0.USB0.VID, 0x1106))
318         {
319             Return (0x00)
320         }
321         Else
322         {
323             If (LEqual (\_SB.PCI0.USB0.CMDR, 0x00))
324             {
325                 Return (0x0D)
326             }
327             Else
328             {
329                 Return (0x0F)
330             }
331         }
332     }
333 }
334
335 Device (USB1)
336 {
337     Name (_ADR, 0x00100001)
338     Name (_PRW, Package (0x02)
339     {
340         0x0E,
341         0x03
342     })
343
344     OperationRegion (U2F1, PCI_Config, 0x00, 0xC2)
345     Field (U2F1, ByteAcc, NoLock, Preserve)
346     {
347         VID,    16,
348                 Offset (0x04),
349         CMDR,   3,
350                 Offset (0x3C),
351         U1IR,   4,
352                 Offset (0x84),
353         ECDX,   2
354     }
355
356     Method (_STA, 0, NotSerialized)
357     {
358         If (LNotEqual (\_SB.PCI0.USB1.VID, 0x1106))
359         {
360             Return (0x00)
361         }
362         Else
363         {
364             If (LEqual (\_SB.PCI0.USB1.CMDR, 0x00))
365             {
366                 Return (0x0D)
367             }
368             Else
369             {
370                 Return (0x0F)
371             }
372         }
373     }
374 }
375
376 Device (USB2)
377 {
378     Name (_ADR, 0x00100002)
379     Name (_PRW, Package (0x02)
380     {
381         0x0E,
382         0x03
383     })
384
385     OperationRegion (U2F2, PCI_Config, 0x00, 0xC2)
386     Field (U2F2, ByteAcc, NoLock, Preserve)
387     {
388         VID,    16,
389                 Offset (0x04),
390         CMDR,   3,
391                 Offset (0x3C),
392         U2IR,   4,
393                 Offset (0x84),
394         ECDX,   2
395     }
396
397     Method (_STA, 0, NotSerialized)
398     {
399         If (LNotEqual (\_SB.PCI0.USB2.VID, 0x1106))
400         {
401             Return (0x00)
402         }
403         Else
404         {
405             If (LEqual (\_SB.PCI0.USB2.CMDR, 0x00))
406             {
407                 Return (0x0D)
408             }
409             Else
410             {
411                 Return (0x0F)
412             }
413         }
414     }
415 }
416
417 Device (USB3)
418 {
419     Name (_ADR, 0x00100003)
420     Name (_PRW, Package (0x02)
421     {
422         0x0E,
423         0x03
424     })
425
426     OperationRegion (U2F3, PCI_Config, 0x00, 0xC2)
427     Field (U2F3, ByteAcc, NoLock, Preserve)
428     {
429         VID,    16,
430                 Offset (0x04),
431         CMDR,   3,
432                 Offset (0x3C),
433         U3IR,   4,
434                 Offset (0x84),
435         ECDX,   2
436     }
437
438     Method (_STA, 0, NotSerialized)
439     {
440         If (LNotEqual (\_SB.PCI0.USB3.VID, 0x1106))
441         {
442             Return (0x00)
443         }
444         Else
445         {
446             If (LEqual (\_SB.PCI0.USB3.CMDR, 0x00))
447             {
448                 Return (0x0D)
449             }
450             Else
451             {
452                 Return (0x0F)
453             }
454         }
455     }
456 }
457
458 Device (USB4)
459 {
460     Name (_ADR, 0x00100004)
461     Name (_PRW, Package (0x02)
462     {
463         0x0E,
464         0x03
465     })
466
467     OperationRegion (U2F4, PCI_Config, 0x00, 0xC2)
468     Field (U2F4, ByteAcc, NoLock, Preserve)
469     {
470         VID,    16,
471                 Offset (0x04),
472         CMDR,   3,
473                 Offset (0x3C),
474         U4IR,   4,
475                 Offset (0x84),
476         ECDX,   2
477     }
478
479     Method (_STA, 0, NotSerialized)
480     {
481         If (LNotEqual (\_SB.PCI0.USB4.VID, 0x1106))
482         {
483             Return (0x00)
484         }
485         Else
486         {
487             If (LEqual (\_SB.PCI0.USB4.CMDR, 0x00))
488             {
489                 Return (0x0D)
490             }
491             Else
492             {
493                 Return (0x0F)
494             }
495         }
496     }
497 }
498
499 /* Basic Definition of Ethernet Interface */
500 Device (NIC0)
501 {
502     Name (_ADR, 0x00120000)
503     Name (_PRW, Package (0x02)
504     {
505         0x03,
506         0x05
507     })
508
509     OperationRegion (NIC0, PCI_Config, 0x00, 0xC2)
510     Field (NIC0, ByteAcc, NoLock, Preserve)
511     {
512         VID,    16,
513                 Offset (0x04),
514         CMDR,   3,
515                 Offset (0x3C),
516         NIIR,   4,
517     }
518
519     Method (_STA, 0, NotSerialized)
520     {
521         If (LNotEqual (\_SB.PCI0.NIC0.VID, 0x1106))
522         {
523             Return (0x00)
524         }
525         Else
526         {
527             If (LEqual (\_SB.PCI0.NIC0.CMDR, 0x00))
528             {
529                 Return (0x0D)
530             }
531             Else
532             {
533                 Return (0x0F)
534             }
535         }
536     }
537 }
538
539 /* Very Basic Definition of Sound Controller */
540 Device (AC97)
541 {
542     Name (_ADR, 0x00110005)
543     Name (_PRW, Package (0x02)
544     {
545         0x0D,
546         0x05
547     })
548 }