tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / getac / p470 / acpi / superio.asl
blobe9b5f0cf0d2ee279dcb0ab11bcc6429544e6a21e
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007-2009 coresystems GmbH
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; version 2 of
9  * the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  */
17 /* SMSC SIO10N268 */
19 Device (SIO1)
21         Name (_HID, EISAID("PNP0A05"))
22         Name (_UID, 1)
24         OperationRegion(SIOR, SystemIO, 0x4e, 0x02)
25         Field (SIOR, ByteAcc, Nolock, Preserve)
26         {
27                 INDX,   8,
28                 DATA,   8
29         }
31         Mutex (SIOM, 0x00)
33         Method (READ, 3)
34         {
35                 Acquire (SIOM, 0xffff)
36                 If (LEqual(Arg0, 0)) {
37                         Store (0x55, INDX)
38                         Store (Arg1, INDX)
39                         Store (DATA, Local1)
40                         Store (0xaa, INDX)
41                 }
42                 And (Local1, Arg2, Local1)
43                 Release(SIOM)
44                 Return(Local1)
45         }
47         Method (WRIT, 3)
48         {
49                 Acquire (SIOM, 0xffff)
50                 If (LEqual(Arg0, 0)) {
51                         Store (0x55, INDX)
52                         Store (Arg1, INDX)
53                         Store (Arg2, DATA)
54                         Store (0xaa, INDX)
55                 }
56                 Release(SIOM)
57         }
59         Device (UAR1)
60         {
61                 Name(_HID, EISAID("PNP0501"))
62                 Name(_UID, 1)
63                 Name(_DDN, "COM1")
64                 Name(_PRW, Package() { 0x08, 0x03 })
66                 /* Device Status */
67                 Method (_STA, 0)
68                 {
69                         Acquire (SIOM, 0xffff)
71                         // Is the hardware enabled?
72                         Store (READ(0, 0x24, 0xff), Local0)
73                         If (LEqual(Local0, 0)) {
74                                 Return (0xd)
75                         } Else {
76                                 // Power Enabled?
77                                 Store (READ(0, 0x02, 0x08), Local0)
78                                 If (LEqual(Local0, 0)) {
79                                         Return (0x0d)
80                                 } Else {
81                                         Return (0x0f)
82                                 }
83                         }
84                 }
86                 /* Device Disable */
87                 Method (_DIS, 0)
88                 {
89                         WRIT(0, 0x24, 0x00)
91                         Store(READ(0, 0x28, 0x0f), Local0)
92                         WRIT(0, 0x28, Local0)
94                         Store(READ(0, 0x02, 0xff), Local0)
95                         Not(0x08, Local1)
96                         And(Local0, Local1, Local0)
97                         WRIT(0, 0x02, Local0)
98                 }
100                 /* Possible Resource Settings */
101                 Name(_PRS, ResourceTemplate() {
102                         StartDependentFn(0, 1) {
103                                 IO(Decode16, 0x3f8, 0x3f8, 0x8, 0x8)
104                                 IRQNoFlags() { 4 }
105                         } EndDependentFn()
106                 })
108                 /* Current Resource Settings */
109                 Method(_CRS, 0)
110                 {
111                         Name(NONE, ResourceTemplate() {
112                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
113                                 IRQNoFlags() { }
114                         })
116                         Name(RSRC, ResourceTemplate() {
117                                 IO(Decode16, 0x3f8, 0x3f8, 0x8, 0x8, _IOA)
118                                 IRQNoFlags(_IRA) { 4 }
119                         })
121                         And (_STA(), 0x02, Local0)
122                         If (LEqual(Local0, 0)) {
123                                 Return(NONE)
124                         }
126                         CreateWordField(RSRC,
127                                 \_SB.PCI0.LPCB.SIO1.UAR1._CRS._IOA._MIN, IOMN)
128                         CreateWordField(RSRC,
129                                 \_SB.PCI0.LPCB.SIO1.UAR1._CRS._IOA._MAX, IOMX)
130                         CreateWordField(RSRC,
131                                 \_SB.PCI0.LPCB.SIO1.UAR1._CRS._IRA._INT, IRQ)
133                         /* I/O Base */
134                         Store (READ(0, 0x24, 0xfe), Local0)
135                         ShiftLeft(Local0, 0x02, Local0)
136                         Store(Local0, IOMN)
137                         Store(Local0, IOMX)
139                         /* Interrupt */
140                         Store(READ(0, 0x28, 0xf0), Local0)
141                         ShiftRight(Local0, 4, Local0)
142                         ShiftLeft(1, Local0, IRQ)
143                         Return(RSRC)
144                 }
146                 /* Set Resource Settings */
147                 Method(_SRS, 1)
148                 {
149                         CreateByteField(Arg0, 0x02, IOLO)
150                         CreateByteField(Arg0, 0x03, IOHI)
151                         CreateByteField(Arg0, 0x09, IRQL)
153                         WRIT(0, 0x24, 0)
154                         FindSetRightBit(IRQL, Local0)
155                         Decrement(Local0)
156                         ShiftLeft(Local0, 4, Local0)
158                         Store(READ(0, 0x28, 0x0f), Local1)
159                         Or(Local0, Local1, Local0)
160                         WRIT(0, 0x28, Local0)
162                         Store(IOLO, Local0)
163                         ShiftRight(Local0, 2, Local0)
164                         And(Local0, 0xfe, Local0)
166                         Store(IOHI, Local1)
167                         ShiftLeft(Local1, 6, Local1)
168                         Or (Local0, Local1, Local0)
169                         WRIT(0, 0x24, Local0)
171                         Store(READ(0, 0x02, 0xff), Local0)
172                         Or(Local0, 0x08, Local0)
173                         WRIT(0, 0x02, Local0)
175                         Store(READ(0, 0x07, 0xff), Local0)
176                         Not(0x40, Local1)
177                         And (Local0, Local1, Local0)
178                         WRIT(0, 0x07, Local0)
179                 }
182                 /* D0 state - Line drivers are on */
183                 Method (_PS0, 0)
184                 {
185                         Store(READ(0, 0x02, 0xff), Local0)
186                         Or(Local0, 0x08, Local0)
187                         WRIT(0, 0x02, Local0)
189                         Store (READ(0, 0x07, 0xff), Local0)
190                         Not(0x40, Local1)
191                         And(Local0, Local1, Local0)
192                         WRIT(0, 0x07, Local0)
193                 }
195                 /* D3 State - Line drivers are off */
196                 Method(_PS3, 0)
197                 {
198                         Store(READ(0, 0x02, 0xff), Local0)
199                         Not(0x08, Local1)
200                         And(Local0, Local1, Local0)
201                         WRIT(0, 0x02, Local0)
202                 }
203         }
205         Device (UAR2)
206         {
207                 Name(_HID, EISAID("PNP0501"))
208                 Name(_UID, 2)
209                 Name(_DDN, "COM2")
210                 Name(_PRW, Package() { 0x08, 0x03 })
212                 /* Device Status */
213                 Method (_STA, 0)
214                 {
215                         /* IRDA? */
216                         Store(READ(0, 0x0c, 0x38), Local0)
217                         If (LNotEqual(Local0, Zero)) {
218                                 Return (0)
219                         }
221                         // Is the hardware enabled?
222                         Store (READ(0, 0x25, 0xff), Local0)
223                         If (LEqual(Local0, 0)) {
224                                 Return (0xd)
225                         } Else {
226                                 // Power Enabled?
227                                 Store (READ(0, 0x02, 0x80), Local0)
228                                 If (LEqual(Local0, 0)) {
229                                         Return (0x0d)
230                                 } Else {
231                                         Return (0x0f)
232                                 }
233                         }
234                 }
236                 /* Device Disable */
237                 Method (_DIS, 0)
238                 {
239                         WRIT(0, 0x25, 0x00)
241                         Store(READ(0, 0x28, 0xf0), Local0)
242                         WRIT(0, 0x28, Local0)
244                         Store(READ(0, 0x02, 0xff), Local0)
245                         Not(0x80, Local1)
246                         And(Local0, Local1, Local0)
247                         WRIT(0, 0x02, Local0)
248                 }
250                 /* Possible Resource Settings */
251                 Name(_PRS, ResourceTemplate() {
252                         StartDependentFn(0, 1) {
253                                 IO(Decode16, 0x2f8, 0x2f8, 0x8, 0x8)
254                                 IRQNoFlags() { 3 }
255                         } EndDependentFn()
256                 })
258                 /* Current Resource Settings */
259                 Method(_CRS, 0)
260                 {
261                         Name(NONE, ResourceTemplate() {
262                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
263                                 IRQNoFlags() { }
264                         })
266                         Name(RSRC, ResourceTemplate() {
267                                 IO(Decode16, 0x2f8, 0x2f8, 0x8, 0x8, _IOB)
268                                 IRQNoFlags(_IRB) { 3 }
269                         })
271                         And (_STA(), 0x02, Local0)
272                         If (LEqual(Local0, 0)) {
273                                 Return(NONE)
274                         }
276                         CreateWordField(RSRC,
277                                 \_SB.PCI0.LPCB.SIO1.UAR2._CRS._IOB._MIN, IOMN)
278                         CreateWordField(RSRC,
279                                 \_SB.PCI0.LPCB.SIO1.UAR2._CRS._IOB._MAX, IOMX)
280                         CreateWordField(RSRC,
281                                 \_SB.PCI0.LPCB.SIO1.UAR2._CRS._IRB._INT, IRQ)
283                         /* I/O Base */
284                         Store (READ(0, 0x25, 0xfe), Local0)
285                         ShiftLeft(Local0, 0x02, Local0)
286                         Store(Local0, IOMN)
287                         Store(Local0, IOMX)
289                         /* Interrupt */
290                         Store(READ(0, 0x28, 0x0f), Local0)
291                         ShiftRight(Local0, 4, Local0)
292                         ShiftLeft(1, Local0, IRQ)
293                         Return(RSRC)
294                 }
296                 /* Set Resource Settings */
297                 Method(_SRS, 1)
298                 {
299                         CreateByteField(Arg0, 0x02, IOLO)
300                         CreateByteField(Arg0, 0x03, IOHI)
301                         CreateByteField(Arg0, 0x09, IRQL)
303                         WRIT(0, 0x25, 0)
304                         FindSetRightBit(IRQL, Local0)
305                         Decrement(Local0)
307                         Store(READ(0, 0x28, 0xf0), Local1)
308                         Or(Local0, Local1, Local0)
309                         WRIT(0, 0x28, Local0)
311                         Store(IOLO, Local0)
312                         ShiftRight(Local0, 2, Local0)
313                         And(Local0, 0xfe, Local0)
315                         Store(IOHI, Local1)
316                         ShiftLeft(Local1, 6, Local1)
317                         Or (Local0, Local1, Local0)
318                         WRIT(0, 0x25, Local0)
320                         Store(READ(0, 0x0c, 0xff), Local0)
321                         Not(0x38, Local1)
322                         And(Local0, Local1, Local0)
323                         WRIT(0, 0x0c, Local0)
325                         Store(READ(0, 0x02, 0xff), Local0)
326                         Or(Local0, 0x80, Local0)
327                         WRIT(0, 0x02, Local0)
329                         Store(READ(0, 0x07, 0xff), Local0)
330                         Not(0x20, Local1)
331                         And (Local0, Local1, Local0)
332                         WRIT(0, 0x07, Local0)
333                 }
335                 /* D0 state - Line drivers are on */
336                 Method (_PS0, 0)
337                 {
338                         Store(READ(0, 0x02, 0xff), Local0)
339                         Or(Local0, 0x80, Local0)
340                         WRIT(0, 0x02, Local0)
342                         Store (READ(0, 0x07, 0xff), Local0)
343                         Not(0x20, Local1)
344                         And(Local0, Local1, Local0)
345                         WRIT(0, 0x07, Local0)
346                 }
348                 /* D3 State - Line drivers are off */
349                 Method(_PS3, 0)
350                 {
351                         Store(READ(0, 0x02, 0xff), Local0)
352                         Not(0x80, Local1)
353                         And(Local0, Local1, Local0)
354                         WRIT(0, 0x02, Local0)
355                 }
356         }
358         Device (UAR3)
359         {
360                 Name(_HID, EISAID("PNP0501"))
361                 Name(_UID, 3)
362                 Name(_DDN, "COM3")
363                 Name(_PRW, Package() { 0x08, 0x03 })
365                 /* Device Status */
366                 Method (_STA, 0)
367                 {
368                         Acquire (SIOM, 0xffff)
370                         // Is the hardware enabled?
371                         Store (READ(0, 0x1b, 0xff), Local0)
372                         If (LEqual(Local0, 0)) {
373                                 Return (0xd)
374                         } Else {
375                                 // Power Enabled?
376                                 Store (READ(0, 0x02, 0x02), Local0)
377                                 If (LEqual(Local0, 0)) {
378                                         Return (0x0d)
379                                 } Else {
380                                         Return (0x0f)
381                                 }
382                         }
383                 }
385                 /* Device Disable */
386                 Method (_DIS, 0)
387                 {
388                         WRIT(0, 0x1b, 0x00)
390                         Store(READ(0, 0x1d, 0x0f), Local0)
391                         WRIT(0, 0x1d, Local0)
393                         Store(READ(0, 0x02, 0xff), Local0)
394                         Not(0x02, Local1)
395                         And(Local0, Local1, Local0)
396                         WRIT(0, 0x02, Local0)
397                 }
399                 /* Possible Resource Settings */
400                 Name(_PRS, ResourceTemplate() {
401                         StartDependentFn(0, 1) {
402                                 IO(Decode16, 0x3e8, 0x3e8, 0x8, 0x8)
403                                 IRQNoFlags() { 5 }
404                         } EndDependentFn()
405                 })
407                 /* Current Resource Settings */
408                 Method(_CRS, 0)
409                 {
410                         Name(NONE, ResourceTemplate() {
411                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
412                                 IRQNoFlags() { }
413                         })
415                         Name(RSRC, ResourceTemplate() {
416                                 IO(Decode16, 0x3e8, 0x3e8, 0x8, 0x8, _IOA)
417                                 IRQNoFlags(_IRA) { 5 }
418                         })
420                         And (_STA(), 0x02, Local0)
421                         If (LEqual(Local0, 0)) {
422                                 Return(NONE)
423                         }
425                         CreateWordField(RSRC,
426                                 \_SB.PCI0.LPCB.SIO1.UAR3._CRS._IOA._MIN, IOMN)
427                         CreateWordField(RSRC,
428                                 \_SB.PCI0.LPCB.SIO1.UAR3._CRS._IOA._MAX, IOMX)
429                         CreateWordField(RSRC,
430                                 \_SB.PCI0.LPCB.SIO1.UAR3._CRS._IRA._INT, IRQ)
432                         /* I/O Base */
433                         Store (READ(0, 0x1b, 0xfe), Local0)
434                         ShiftLeft(Local0, 0x02, Local0)
435                         Store(Local0, IOMN)
436                         Store(Local0, IOMX)
438                         /* Interrupt */
439                         Store(READ(0, 0x1d, 0xf0), Local0)
440                         ShiftRight(Local0, 4, Local0)
441                         ShiftLeft(1, Local0, IRQ)
442                         Return(RSRC)
443                 }
445                 /* Set Resource Settings */
446                 Method(_SRS, 1)
447                 {
448                         CreateByteField(Arg0, 0x02, IOLO)
449                         CreateByteField(Arg0, 0x03, IOHI)
450                         CreateByteField(Arg0, 0x09, IRQL)
452                         WRIT(0, 0x1b, 0)
453                         FindSetRightBit(IRQL, Local0)
454                         Decrement(Local0)
455                         ShiftLeft(Local0, 4, Local0)
457                         Store(READ(0, 0x1d, 0x0f), Local1)
458                         Or(Local0, Local1, Local0)
459                         WRIT(0, 0x1d, Local0)
461                         Store(IOLO, Local0)
462                         ShiftRight(Local0, 2, Local0)
463                         And(Local0, 0xfe, Local0)
465                         Store(IOHI, Local1)
466                         ShiftLeft(Local1, 6, Local1)
467                         Or (Local0, Local1, Local0)
468                         WRIT(0, 0x1b, Local0)
470                         Store(READ(0, 0x02, 0xff), Local0)
471                         Or(Local0, 0x02, Local0)
472                         WRIT(0, 0x02, Local0)
474                         Store(READ(0, 0x07, 0xff), Local0)
475                         Not(0x04, Local1)
476                         And (Local0, Local1, Local0)
477                         WRIT(0, 0x07, Local0)
478                 }
481                 /* D0 state - Line drivers are on */
482                 Method (_PS0, 0)
483                 {
484                         Store(READ(0, 0x02, 0xff), Local0)
485                         Or(Local0, 0x02, Local0)
486                         WRIT(0, 0x02, Local0)
488                         Store (READ(0, 0x07, 0xff), Local0)
489                         Not(0x04, Local1)
490                         And(Local0, Local1, Local0)
491                         WRIT(0, 0x07, Local0)
492                 }
494                 /* D3 State - Line drivers are off */
495                 Method(_PS3, 0)
496                 {
497                         Store(READ(0, 0x02, 0xff), Local0)
498                         Not(0x02, Local1)
499                         And(Local0, Local1, Local0)
500                         WRIT(0, 0x02, Local0)
501                 }
502         }
505         Device (UAR4)
506         {
507                 Name(_HID, EISAID("PNP0501"))
508                 Name(_UID, 4)
509                 Name(_DDN, "COM4")
510                 Name(_PRW, Package() { 0x08, 0x03 })
512                 /* Device Status */
513                 Method (_STA, 0)
514                 {
515                         Acquire (SIOM, 0xffff)
517                         // Is the hardware enabled?
518                         Store (READ(0, 0x1c, 0xff), Local0)
519                         If (LEqual(Local0, 0)) {
520                                 Return (0xd)
521                         } Else {
522                                 // Power Enabled?
523                                 Store (READ(0, 0x02, 0x04), Local0)
524                                 If (LEqual(Local0, 0)) {
525                                         Return (0x0d)
526                                 } Else {
527                                         Return (0x0f)
528                                 }
529                         }
530                 }
532                 /* Device Disable */
533                 Method (_DIS, 0)
534                 {
535                         WRIT(0, 0x1c, 0x00)
537                         Store(READ(0, 0x1d, 0x0f), Local0)
538                         WRIT(0, 0x1d, Local0)
540                         Store(READ(0, 0x02, 0xff), Local0)
541                         Not(0x04, Local1)
542                         And(Local0, Local1, Local0)
543                         WRIT(0, 0x02, Local0)
544                 }
546                 /* Possible Resource Settings */
547                 Name(_PRS, ResourceTemplate() {
548                         StartDependentFn(0, 1) {
549                                 IO(Decode16, 0x2e8, 0x2e8, 0x8, 0x8)
550                                 IRQNoFlags() { 11 }
551                         } EndDependentFn()
552                 })
554                 /* Current Resource Settings */
555                 Method(_CRS, 0)
556                 {
557                         Name(NONE, ResourceTemplate() {
558                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
559                                 IRQNoFlags() { }
560                         })
562                         Name(RSRC, ResourceTemplate() {
563                                 IO(Decode16, 0x2e8, 0x2e8, 0x8, 0x8, _IOA)
564                                 IRQNoFlags(_IRA) { 11 }
565                         })
567                         And (_STA(), 0x02, Local0)
568                         If (LEqual(Local0, 0)) {
569                                 Return(NONE)
570                         }
572                         CreateWordField(RSRC,
573                                 \_SB.PCI0.LPCB.SIO1.UAR4._CRS._IOA._MIN, IOMN)
574                         CreateWordField(RSRC,
575                                 \_SB.PCI0.LPCB.SIO1.UAR4._CRS._IOA._MAX, IOMX)
576                         CreateWordField(RSRC,
577                                 \_SB.PCI0.LPCB.SIO1.UAR4._CRS._IRA._INT, IRQ)
579                         /* I/O Base */
580                         Store (READ(0, 0x1c, 0xfe), Local0)
581                         ShiftLeft(Local0, 0x02, Local0)
582                         Store(Local0, IOMN)
583                         Store(Local0, IOMX)
585                         /* Interrupt */
586                         Store(READ(0, 0x1d, 0xf0), Local0)
587                         ShiftRight(Local0, 4, Local0)
588                         ShiftLeft(1, Local0, IRQ)
589                         Return(RSRC)
590                 }
592                 /* Set Resource Settings */
593                 Method(_SRS, 1)
594                 {
595                         CreateByteField(Arg0, 0x02, IOLO)
596                         CreateByteField(Arg0, 0x03, IOHI)
597                         CreateByteField(Arg0, 0x09, IRQL)
599                         WRIT(0, 0x1c, 0)
600                         FindSetRightBit(IRQL, Local0)
601                         Decrement(Local0)
602                         ShiftLeft(Local0, 4, Local0)
604                         Store(READ(0, 0x1d, 0x0f), Local1)
605                         Or(Local0, Local1, Local0)
606                         WRIT(0, 0x1d, Local0)
608                         Store(IOLO, Local0)
609                         ShiftRight(Local0, 2, Local0)
610                         And(Local0, 0xfe, Local0)
612                         Store(IOHI, Local1)
613                         ShiftLeft(Local1, 6, Local1)
614                         Or (Local0, Local1, Local0)
615                         WRIT(0, 0x1c, Local0)
617                         Store(READ(0, 0x02, 0xff), Local0)
618                         Or(Local0, 0x04, Local0)
619                         WRIT(0, 0x02, Local0)
621                         Store(READ(0, 0x07, 0xff), Local0)
622                         Not(0x08, Local1)
623                         And (Local0, Local1, Local0)
624                         WRIT(0, 0x07, Local0)
625                 }
628                 /* D0 state - Line drivers are on */
629                 Method (_PS0, 0)
630                 {
631                         Store(READ(0, 0x02, 0xff), Local0)
632                         Or(Local0, 0x04, Local0)
633                         WRIT(0, 0x02, Local0)
635                         Store (READ(0, 0x07, 0xff), Local0)
636                         Not(0x08, Local1)
637                         And(Local0, Local1, Local0)
638                         WRIT(0, 0x07, Local0)
639                 }
641                 /* D3 State - Line drivers are off */
642                 Method(_PS3, 0)
643                 {
644                         Store(READ(0, 0x02, 0xff), Local0)
645                         Not(0x04, Local1)
646                         And(Local0, Local1, Local0)
647                         WRIT(0, 0x02, Local0)
648                 }
649         }