blob: 15b5e084e1320deab6a1d93af4840015b7479059 [file] [log] [blame]
Kyösti Mälkki91162702011-11-03 15:22:01 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Kyösti Mälkki <kyosti.malkki@gmail.com>
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
21/* SuperIO GPIO configuration via logical device 0x0A */
22
23Name (MSBF, ResourceTemplate ()
24{
25 IO (Decode16, 0x0000, 0x0000, 0x01, 0x80, _Y1B)
26})
27
28OperationRegion (LPC0, SystemIO, 0x0E00, 0x60)
29Field (LPC0, ByteAcc, NoLock, Preserve)
30{
31 PME0, 8,
32 Offset (0x02), PME2,8,
33 Offset (0x04), PME4,8,
34 Offset (0x0A), PMEA,8,
35 Offset (0x23),
36 GC10,8, GC11,8, GC12,8, GC13,8, GC14,8, GC15,8, GC16,8, GC17,8,
37 GC20,8, GC21,8, GC22,8, GC23,8, GC24,8, GC25,8, GC26,8, GC27,8,
38 GC30,8, GC31,8, GC32,8, GC33,8, GC34,8, GC35,8, GC36,8, GC37,8,
39 GC40,8, GC41,8, GC42,8, GC43,8,
40
41 Offset (0x3F),
42 GC50,8, GC51,8, GC52,8, GC53,8, GC54,8, GC55,8, GC56,8, GC57,8,
43 GC60,8, GC61,8,
44
45 Offset (0x4B),
46 GP_1,8, GP_2,8, GP_3,8, GP_4,8, GP_5,8, GP_6,8,
47 Offset (0x56), FAN1,8,
48 Offset (0x5D), LED1,8, LED2,8,
49}
50
51OperationRegion (SMC1, SystemIO, 0x2E, 0x02)
52Field (SMC1, ByteAcc, NoLock, Preserve)
53{
54 INDX, 8, DATA, 8
55}
56
57IndexField (INDX, DATA, ByteAcc, NoLock, Preserve)
58{
59 Offset (0x07), LDN, 8,
60 Offset (0x22), PWRC, 8,
61 Offset (0x30), ACTR, 8,
62 Offset (0x60),
63 IOAH, 8, IOAL, 8,
64 IOBH, 8, IOBL, 8,
65
66 Offset (0x70), INTR, 8,
67 Offset (0x72), INT1, 8,
68 Offset (0x74), DMCH, 8,
69 Offset (0xB2), SPS1, 8, SPS2, 8,
70 Offset (0xB8), D2TS, 8,
71 Offset (0xF0), OPT1, 8, OPT2, 8, OPT3, 8,
72 Offset (0xF4), WDTC, 8,
73 Offset (0xF6), GP01, 8, GP02, 8, GP04, 8
74}
75
76Method (ECFG, 0, NotSerialized)
77{
78 Store (0x55, INDX)
79}
80Method (XCFG, 0, NotSerialized)
81{
82 Store (0xAA, INDX)
83}
84
85Method (_CRS, 0, NotSerialized)
86{
87 CreateWordField (MSBF, \_SB.PCI0.ICH0.SMSC._Y1B._MIN, IOM1)
88 CreateWordField (MSBF, \_SB.PCI0.ICH0.SMSC._Y1B._MAX, IOM2)
89 CreateByteField (MSBF, \_SB.PCI0.ICH0.SMSC._Y1B._LEN, IOML)
90
91 ECFG ()
92 Store (0x0A, \_SB.PCI0.ICH0.SMSC.LDN)
93 Store (0x00, IOM1)
94 Store (0x00, IOM2)
95 Or (\_SB.PCI0.ICH0.SMSC.IOAH, IOM1, IOM1)
96 ShiftLeft (IOM1, 0x08, IOM1)
97 Or (\_SB.PCI0.ICH0.SMSC.IOAL, IOM1, IOM1)
98 Store (IOM1, IOM2)
99 If (LNotEqual (IOM1, 0x00))
100 {
101 Store (0x80, IOML)
102 }
103 XCFG ()
104
105 Return (MSBF)
106}
107
108
109Method (_INI, 0, NotSerialized)
110{
111 /* GPIO configuration */
112 Store (0x00, GC10)
113 Store (0x81, GC11)
114 Store (0x00, GC17)
115 Store (0x0c, GC21)
116 Store (0x00, GC22)
117 Store (0x04, GC27)
118 Store (0x04, GC30)
119 Store (0x01, GC31)
120 Store (0x01, GC32)
121 Store (0x01, GC33)
122 Store (0x01, GC34) /* GPI password jumper */
123 Store (0x01, GC35) /* GPI scsi enable jumper */
124#if 1
125 Store (0x01, GC42) /* GPI */
126#else
127 Store (0x84, GC42) /* nIO_PME */
128#endif
129 Store (0x86, GC60) /* led 1 */
130 Store (0x81, GC61) /* led 2 ?? */
131
132 /* GPIO initial output levels */
133 Store (GP_1, Local0)
134 And( Local0, 0x7C, Local0)
135 Or ( Local0, 0x81, Local0)
136 Store (Local0, GP_1)
137
138 Store (GP_2, Local0)
139 And( Local0, 0xFE, Local0)
140 Or ( Local0, 0x00, Local0)
141 Store (Local0, GP_2)
142
143 Store (GP_3, Local0)
144 And( Local0, 0x7F, Local0)
145 Or ( Local0, 0x80, Local0)
146 Store (Local0, GP_3)
147
148 Store (GP_4, Local0)
149 And( Local0, 0x7F, Local0)
150 Or ( Local0, 0x00, Local0)
151 Store (Local0, GP_4)
152
153 /* Power Led */
154 Store (LED1, Local0)
155 And( Local0, 0xfc, Local0)
156 Or ( Local0, 0x01, Local0)
157 Store (Local0, LED1)
158
159}
160
161Method (MLED, 1, NotSerialized)
162{
163 If (LEqual (Arg0, 0x00))
164 {
165 Store (0x00, LED1)
166 }
167
168 If (LOr (LEqual (Arg0, 0x01), LEqual (Arg0, 0x02)))
169 {
170 Store (0x01, LED1)
171 }
172
173 If (LEqual (Arg0, 0x03))
174 {
175 Store (0x02, LED1)
176 }
177
178 If (LOr (LEqual (Arg0, 0x04), LEqual (Arg0, 0x05)))
179 {
180 Store (0x03, LED1)
181 }
182}
183