Add support for ITE IT8772F SuperI/O chip
[coreboot.git] / src / superio / ite / it8772f / acpi / superio.asl
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 The ChromiumOS Authors.  All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19
20 // Scope is \_SB.PCI0.LPCB
21
22 Device (SIO) {
23         Name (_ADR, 0x2E)
24         OperationRegion (SIOA, SystemIO, 0x2E, 0x02)
25         Field (SIOA, ByteAcc, NoLock, Preserve)
26         {
27                 SI2E, 8,
28                 SI2F, 8,
29         }
30
31         IndexField (SI2E, SI2F, ByteAcc, NoLock, Preserve)
32         {
33                 Offset (0x02),
34                 SCNT, 8,        /* Configure Control */
35                 Offset (0x07),
36                 SLDN, 8,        /* Logical Device Number */
37                 Offset (0x30),
38                 SACT, 8,        /* Activate */
39                 Offset (0x60),
40                 IO0H, 8,        /* Base Address 0 MSB */
41                 IO0L, 8,        /* Base Address 0 LSB */
42                 Offset (0x62),
43                 IO1H, 8,        /* Base Address 1 MSB */
44                 IO1L, 8,        /* Base Address 1 LSB */
45                 Offset (0x70),
46                 IQ00, 8,        /* Interrupt Select */
47         }
48
49         Name (SFDC, 0)          /* Floppy Disk Controller */
50         Name (SSP1, 1)          /* Serial Port 1 */
51         Name (SENV, 4)          /* Environment Controller */
52         Name (SKBC, 5)          /* Keyboard */
53         Name (SKBM, 6)          /* Mouse */
54         Name (SGPI, 7)          /* GPIO */
55         Name (SINF, 10)         /* Consumer IR */
56
57         Method (ENTR, 0, NotSerialized)
58         {
59                 Store (0x87, SI2E)
60                 Store (0x01, SI2E)
61                 Store (0x55, SI2E)
62                 Store (0x55, SI2E)
63         }
64
65         Method (EXIT, 0, NotSerialized)
66         {
67                 Store (0x02, SCNT)
68         }
69
70         /* Parse activate register for an LDN */
71         Method (ISEN, 1, NotSerialized)
72         {
73                 ENTR ()
74                 Store (Arg0, SLDN)
75                 Store (SACT, Local0)
76                 EXIT ()
77
78                 /* Check if it exists */
79                 If (LEqual (Local0, 0xFF))
80                 {
81                         Return (0x00)
82                 }
83
84                 /* Check if activated */
85                 If (LEqual (Local0, One))
86                 {
87                         Return (0x0F)
88                 }
89                 Else
90                 {
91                         Return (0x0D)
92                 }
93         }
94
95         /* Enable an LDN via the activate register */
96         Method (SENA, 1, NotSerialized)
97         {
98                 ENTR ()
99                 Store (Arg0, SLDN)
100                 Store (One, SACT)
101                 EXIT ()
102         }
103
104         /* Disable an LDN via the activate register */
105         Method (SDIS, 1, NotSerialized)
106         {
107                 ENTR ()
108                 Store (Arg0, SLDN)
109                 Store (Zero, SACT)
110                 EXIT ()
111         }
112
113 #ifdef SIO_ENABLE_ENVC
114         Device (ENVC) {
115                 Name (_HID, EISAID ("PNP0C02"))
116                 Name (_UID, 10)
117
118                 Method (_STA, 0, NotSerialized) {
119                         Return (ISEN (SENV))
120                 }
121
122                 Name (_CRS, ResourceTemplate ()
123                 {
124                         IO (Decode16, SIO_ENVC_IO0, SIO_ENVC_IO0, 0x08, 0x08)
125                         IO (Decode16, SIO_ENVC_IO1, SIO_ENVC_IO1, 0x04, 0x04)
126                 })
127
128                 Name (_PRS, ResourceTemplate ()
129                 {
130                         IO (Decode16, SIO_ENVC_IO0, SIO_ENVC_IO0, 0x08, 0x08)
131                         IO (Decode16, SIO_ENVC_IO1, SIO_ENVC_IO1, 0x04, 0x04)
132                 })
133
134                 OperationRegion (ECAP, SystemIO, SIO_ENVC_IO0, 0x07)
135                 Field (ECAP, ByteAcc, NoLock, Preserve)
136                 {
137                         Offset (0x05),
138                         ECAI, 8,  // Address Index Register
139                         ECAD, 8,  // Address Data Register
140                 }
141
142                 // Registers for thermal zone implementations
143                 IndexField (ECAI, ECAD, ByteAcc, NoLock, Preserve)
144                 {
145                         Offset (0x29),
146                         TIN1, 8,  // TMPIN1 Reading
147                         TIN2, 8,  // TMPIN2 Reading
148                         TIN3, 8,  // TMPIN3 Reading
149                         Offset (0x6b),
150                         F2PS, 8,  // FAN2 PWM Setting
151                         Offset (0x73),
152                         F3PS, 8,  // FAN3 PWM Setting
153                 }
154         }
155 #endif
156
157 #ifdef SIO_ENABLE_GPIO
158         Device (GPIO) {
159                 Name (_HID, EISAID ("PNP0C02"))
160                 Name (_UID, 11)
161
162                 Method (_STA, 0, NotSerialized) {
163                         Return (0x0F)
164                 }
165
166                 Name (_CRS, ResourceTemplate ()
167                 {
168                         IO (Decode16, SIO_GPIO_IO0, SIO_GPIO_IO0, 0x01, 0x01)
169                         IO (Decode16, SIO_GPIO_IO1, SIO_GPIO_IO1, 0x08, 0x08)
170                 })
171
172                 Name (_PRS, ResourceTemplate ()
173                 {
174                         IO (Decode16, SIO_GPIO_IO0, SIO_GPIO_IO0, 0x01, 0x01)
175                         IO (Decode16, SIO_GPIO_IO1, SIO_GPIO_IO1, 0x08, 0x08)
176                 })
177         }
178 #endif
179
180 #ifdef SIO_ENABLE_COM1
181         Device (COM1) {
182                 Name (_HID, EISAID ("PNP0501"))
183                 Name (_UID, 1)
184
185                 Method (_STA, 0, NotSerialized) {
186                         Return (ISEN (SSP1))
187                 }
188
189                 Name (_CRS, ResourceTemplate ()
190                 {
191                         IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08)
192                         IRQNoFlags () {4}
193                 })
194
195                 Name (_PRS, ResourceTemplate ()
196                 {
197                         IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08)
198                         IRQNoFlags () {4}
199                 })
200         }
201 #endif
202
203 #ifdef SIO_ENABLE_PS2K
204         Device (PS2K)           // Keyboard
205         {
206                 Name (_HID, EISAID("PNP0303"))
207                 Name (_CID, EISAID("PNP030B"))
208
209                 Method (_STA, 0, NotSerialized) {
210                         Return (ISEN (SKBC))
211                 }
212
213                 Name (_CRS, ResourceTemplate()
214                 {
215                         IO (Decode16, 0x60, 0x60, 0x01, 0x01)
216                         IO (Decode16, 0x64, 0x64, 0x01, 0x01)
217                         IRQNoFlags () {1}
218                 })
219
220                 Name (_PRS, ResourceTemplate()
221                 {
222                         IO (Decode16, 0x60, 0x60, 0x01, 0x01)
223                         IO (Decode16, 0x64, 0x64, 0x01, 0x01)
224                         IRQNoFlags () {1}
225                 })
226         }
227 #endif
228
229 #ifdef SIO_ENABLE_PS2M
230         Device (PS2M)           // Mouse
231         {
232                 Name (_HID, EISAID("PNP0F13"))
233
234                 Method (_STA, 0, NotSerialized) {
235                         Return (ISEN (SKBM))
236                 }
237
238                 Name (_CRS, ResourceTemplate()
239                 {
240                         IRQNoFlags () {12}
241                 })
242
243                 Name (_PRS, ResourceTemplate()
244                 {
245                         IRQNoFlags () {12}
246                 })
247         }
248 #endif
249
250 #ifdef SIO_ENABLE_FDC0
251         Device (FDC0)           // Floppy controller
252         {
253                 Name (_HID, EISAID ("PNP0700"))
254
255                 Method (_STA, 0, NotSerialized) {
256                         Return (ISEN (SFDC))
257                 }
258
259                 Name (_CRS, ResourceTemplate()
260                 {
261                         IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
262                         IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
263                         IRQNoFlags () {6}
264                         DMA (Compatibility, NotBusMaster, Transfer8) {2}
265                 })
266
267                 Name (_PRS, ResourceTemplate()
268                 {
269                         IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
270                         IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
271                         IRQNoFlags () {6}
272                         DMA (Compatibility, NotBusMaster, Transfer8) {2}
273                 })
274         }
275 #endif
276
277 #ifdef SIO_ENABLE_INFR
278         Device (INFR)           // Infrared controller
279         {
280                 Name (_HID, EISAID ("PNP0510"))
281
282                 Method (_STA, 0, NotSerialized) {
283                         Return (ISEN (SINF))
284                 }
285
286                 Name (_CRS, ResourceTemplate()
287                 {
288                         IO (Decode16, SIO_INFR_IO0, SIO_INFR_IO0, 0x08, 0x08)
289                         IRQNoFlags () { SIO_INFR_IRQ }
290                 })
291
292                 Name (_PRS, ResourceTemplate()
293                 {
294                         IO (Decode16, SIO_INFR_IO0, SIO_INFR_IO0, 0x08, 0x08)
295                         IRQNoFlags () { SIO_INFR_IRQ }
296                 })
297         }
298 #endif
299 }