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