add support for 2 new SMSC superio chips. Information is a bit ambiguous
[coreboot.git] / util / superiotool / smsc.c
1 /*
2  * This file is part of the superiotool project.
3  *
4  * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
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; either version 2 of the License, or
9  * (at your option) any later version.
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  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19  */
20
21 #include "superiotool.h"
22
23 #define DEVICE_ID_REG_OLD       0x0d
24 #define DEVICE_REV_REG_OLD      0x0e
25
26 #define DEVICE_ID_REG           0x20
27 #define DEVICE_REV_REG          0x21
28
29 static const struct superio_registers reg_table[] = {
30         /* The following Super I/Os use the 0x20/0x21 ID registers. */
31         {0x03, "FDC37C93xFR", {
32                 /* FIXME: There's another 0x03 but found on port 0x0d/0x0e! */
33                 {EOT}}},
34         {0x0a, "FDC37N971", {
35                 {NOLDN, NULL,
36                         {0x02,0x07,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
37                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
38                         {0x00,0x00,0x0a,0x00,0x00,0x00,0x04,0x04,NANA,NANA,
39                          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
40                 {0x0, "Floppy",
41                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf3,0xf4,
42                          0xf5,EOT},
43                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,RSVD,0x00,
44                          0x00,EOT}},
45                 {0x1, "Power Management (PM1)",
46                         {0x30,0x60,0x61,EOT},
47                         {0x00,0x00,0x00,EOT}},
48                 {0x3, "Parallel port",
49                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
50                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
51                 {0x4, "COM1",
52                         {0x30,0x60,0x61,0x70,0xf0,EOT},
53                         {0x00,0x00,0x00,0x00,0x00,EOT}},
54                 {0x5, "COM2",
55                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,
56                          0xf2,0xf7,0xf8,EOT},
57                         {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,
58                          0x03,0x00,0x00,EOT}},
59                 {0x6, "Real-time clock (RTC)",
60                         {0x30,0x60,0x61,0x62,0x63,0x70,0xf0,0xf1,EOT},
61                         {0x00,0x00,0x70,0x00,0x74,0x00,0x00,NANA,EOT}},
62                 {0x7, "Keyboard",
63                         {0x30,0x60,0x61,0x70,0x72,0xf0,EOT},
64                         {0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
65                 {0x8, "Embedded Controller (EC)",
66                         {0x30,0x60,0x61,EOT},
67                         {0x00,0x00,0x62,EOT}},
68                 {0x9, "Mailbox",
69                         {0x30,0x60,0x61,EOT},
70                         {0x00,0x00,0x00,EOT}},
71                 {EOT}}},
72         {0x0b, "FDC37N972", {
73                 {NOLDN, NULL,
74                         {0x02,0x07,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
75                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
76                         {0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x04,NANA,NANA,
77                          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
78                 {0x0, "Floppy",
79                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf3,0xf4,
80                          0xf5,EOT},
81                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,RSVD,0x00,
82                          0x00,EOT}},
83                 {0x1, "Power Management (PM1)",
84                         {0x30,0x60,0x61,EOT},
85                         {0x00,0x00,0x00,EOT}},
86                 {0x3, "Parallel port",
87                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
88                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
89                 {0x4, "COM1",
90                         {0x30,0x60,0x61,0x70,0xf0,EOT},
91                         {0x00,0x00,0x00,0x00,0x00,EOT}},
92                 {0x5, "COM2",
93                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,
94                          0xf2,0xf7,0xf8,EOT},
95                         {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,
96                          0x03,0x00,0x00,EOT}},
97                 {0x6, "Real-time clock (RTC)",
98                         {0x30,0x60,0x61,0x62,0x63,0x70,0xf0,0xf1,EOT},
99                         {0x00,0x00,0x70,0x00,0x74,0x00,0x00,NANA,EOT}},
100                 {0x7, "Keyboard",
101                         {0x30,0x60,0x61,0x70,0x72,0xf0,EOT},
102                         {0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
103                 {0x8, "Embedded Controller (EC)",
104                         {0x30,0x60,0x61,EOT},
105                         {0x00,0x00,0x62,EOT}},
106                 {0x9, "Mailbox",
107                         {0x30,0x60,0x61,EOT},
108                         {0x00,0x00,0x00,EOT}},
109                 {EOT}}},
110         {0x0e, "LPC47N252", {   /* From sensors-detect */
111                 {EOT}}},
112         {0x14, "LPC47M172", {
113                 {EOT}}},
114         {0x30, "FDC37C93xAPM", {
115                 {EOT}}},
116         {0x40, "FDC37C67x", {   /* E.g. FDC37C672. Chiprev: 0x01 */
117                 {NOLDN, NULL,
118                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,0x2c,
119                          0x2d,0x2e,0x2f,EOT},
120                         {0x03,0x40,NANA,0x00,0x00,0x04,MISC,MISC,NANA,NANA,
121                          NANA,NANA,NANA,EOT}},
122                 {0x0, "Floppy",
123                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
124                          EOT},
125                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
126                          EOT}},
127                 {0x3, "Parallel port",
128                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
129                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
130                 {0x4, "COM1",
131                         {0x30,0x60,0x61,0x70,0xf0,EOT},
132                         {0x00,0x00,0x00,0x00,0x00,EOT}},
133                 {0x5, "COM2",
134                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
135                          EOT},
136                         {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
137                          EOT}},
138                 {0x7, "Keyboard",
139                         {0x30,0x70,0x72,0xf0,EOT},
140                         {0x00,0x00,0x00,0x00,EOT}},
141                 {0x8, "Aux I/O",
142                         {0x30,0xb4,0xb5,0xb6,0xb7,0xc0,0xc1,0xc2,0xc3,0xc4,
143                          0xf1,0xf2,0xf3,0xf4,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,
144                          EOT},
145                         {0x00,NANA,NANA,NANA,NANA,0x06,0x03,NANA,NANA,NANA,
146                          0x00,0x00,0x00,MISC,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD,
147                          EOT}},
148                 {EOT}}},
149         {0x42, "FDC37B80x/FDC37M707", {
150                 {EOT}}},
151         {0x09, "FDC37N958FR", { /* Found in e.g. Dell Latitude CPi A366XT. */
152                 {NOLDN, NULL,
153                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
154                          0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
155                         {0x03,NANA,0x44,0x00,0x00,0x00,0x04,MISC,MISC,0x00,
156                          NANA,NANA,NANA,NANA,NANA,EOT}},
157                 {0x0, "Floppy",
158                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
159                          EOT},
160                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
161                          EOT}},
162                 {0x3, "Parallel port",
163                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
164                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
165                 {0x4, "COM1",
166                         {0x30,0x60,0x61,0x70,0xf0,EOT},
167                         {0x00,0x00,0x00,0x00,0x00,EOT}},
168                 {0x5, "COM2",
169                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
170                          EOT},
171                         {NANA,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
172                          EOT}},
173                 {0x6, "Real-time clock (RTC)",
174                         {0x30,0x62,0x63,0x70,0xf0,EOT},
175                         {0x00,0x00,0x70,0x00,0x00,EOT}},
176                 {0x7, "Keyboard",
177                         {0x30,0x70,0x72,0xf0,EOT},
178                         {0x00,0x00,0x00,0x00,EOT}},
179                 {0x8, "Aux I/O",
180                         {0x30,0xb0,0xb1,0xb2,0xb3,0xb8,0xc0,0xc1,0xc2,0xc3,
181                          0xc4,0xc5,0xc6,0xc8,0xca,0xcb,0xcc,0xd0,0xd1,0xd2,
182                          0xd3,0xd4,0xd5,0xd6,0xd7,0xe0,0xe1,0xe2,0xe3,0xe4,
183                          0xe5,0xe6,0xe7,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf6,
184                          0xf9,0xfa,EOT},
185                         {0x00,NANA,NANA,NANA,NANA,NANA,NANA,0x01,NANA,NANA,
186                          NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
187                          NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
188                          NANA,NANA,NANA,NANA,NANA,0x00,0x00,0x00,0x00,NANA,
189                          NANA,NANA,EOT}},
190                 {0xa, "ACPI",
191                         {0x30,0x60,0x61,0x70,0xf0,EOT},
192                         {0x00,0x00,0x00,NANA,NANA,EOT}},
193                 {EOT}}},
194         {0x43, "FDC37B77x", {
195                 {EOT}}},
196         {0x44, "FDC37B78x", {
197                 {NOLDN, NULL,
198                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
199                          0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
200                         {0x03,NANA,0x44,0x00,0x00,0x00,0x04,MISC,MISC,0x00,
201                          NANA,NANA,NANA,NANA,NANA,EOT}},
202                 {0x0, "Floppy",
203                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
204                          EOT},
205                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
206                          EOT}},
207                 {0x3, "Parallel port",
208                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
209                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
210                 {0x4, "COM1",
211                         {0x30,0x60,0x61,0x70,0xf0,EOT},
212                         {0x00,0x00,0x00,0x00,0x00,EOT}},
213                 {0x5, "COM2",
214                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
215                          EOT},
216                         {NANA,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
217                          EOT}},
218                 {0x6, "Real-time clock (RTC)",
219                         {0x30,0x62,0x63,0x70,0xf0,EOT},
220                         {0x00,0x00,0x70,0x00,0x00,EOT}},
221                 {0x7, "Keyboard",
222                         {0x30,0x70,0x72,0xf0,EOT},
223                         {0x00,0x00,0x00,0x00,EOT}},
224                 {0x8, "Aux I/O",
225                         {0x30,0xb0,0xb1,0xb2,0xb3,0xb8,0xc0,0xc1,0xc2,0xc3,
226                          0xc4,0xc5,0xc6,0xc8,0xca,0xcb,0xcc,0xd0,0xd1,0xd2,
227                          0xd3,0xd4,0xd5,0xd6,0xd7,0xe0,0xe1,0xe2,0xe3,0xe4,
228                          0xe5,0xe6,0xe7,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf6,
229                          0xf9,0xfa,EOT},
230                         {0x00,NANA,NANA,NANA,NANA,NANA,NANA,0x01,NANA,NANA,
231                          NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
232                          NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
233                          NANA,NANA,NANA,NANA,NANA,0x00,0x00,0x00,0x00,NANA,
234                          NANA,NANA,EOT}},
235                 {0xa, "ACPI",
236                         {0x30,0x60,0x61,0x70,0xf0,EOT},
237                         {0x00,0x00,0x00,NANA,NANA,EOT}},
238                 {EOT}}},
239         {0x47, "FDC37M60x", {   /* TODO: Not yet in sensors-detect */
240                 {EOT}}},
241         {0x4c, "FDC37B72x", {
242                 {NOLDN, NULL,
243                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
244                          0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
245                         {0x03,NANA,0x4c,0x00,0x00,0x00,0x04,MISC,MISC,0x00,
246                          NANA,NANA,NANA,NANA,NANA,EOT}},
247                 {0x0, "Floppy",
248                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
249                          EOT},
250                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
251                          EOT}},
252                 {0x3, "Parallel port",
253                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
254                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
255                 {0x4, "COM1",
256                         {0x30,0x60,0x61,0x70,0xf0,EOT},
257                         {0x00,0x00,0x00,0x00,0x00,EOT}},
258                 {0x5, "COM2",
259                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
260                         {NANA,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
261                 {0x7, "Keyboard",
262                         {0x30,0x70,0x72,0xf0,EOT},
263                         {0x00,0x00,0x00,0x00,EOT}},
264                 {0x8, "Aux I/O",
265                         {0x30,0xb0,0xb1,0xb2,0xb3,0xb8,0xc0,0xc1,0xc2,0xc3,
266                          0xc4,0xc5,0xc6,0xc8,0xca,0xcb,0xcc,0xd0,0xd1,0xd2,
267                          0xd3,0xd4,0xd5,0xd6,0xd7,0xe0,0xe1,0xe2,0xe3,0xe4,
268                          0xe5,0xe6,0xe7,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf6,
269                          0xf9,0xfa,EOT},
270                         {0x00,NANA,NANA,NANA,NANA,NANA,0x00,0x01,NANA,NANA,
271                          NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
272                          NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
273                          NANA,NANA,NANA,NANA,NANA,0x00,0x00,0x00,MISC,NANA,
274                          NANA,NANA,EOT}},
275                 {0xa, "ACPI",
276                         {0x30,0x60,0x61,0x70,0xf0,EOT},
277                         {0x00,0x00,0x00,NANA,NANA,EOT}},
278                 {EOT}}},
279         {0x4d, "FDC37M81x", {
280                 {NOLDN, NULL,
281                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,
282                          0x2c,0x2d,0x2e,0x2f,EOT},
283                         {0x03,0x00,0x4d,NANA,0x00,0x00,0x04,MISC,MISC,NANA,
284                          NANA,NANA,NANA,NANA,EOT}},
285                 {0x0, "Floppy",
286                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
287                          0xf5,EOT},
288                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
289                          0x00,EOT}},
290                 {0x3, "Parallel port",
291                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
292                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
293                 {0x4, "COM1",
294                         {0x30,0x60,0x61,0x70,0xf0,EOT},
295                         {0x00,0x00,0x00,0x00,0x00,EOT}},
296                 {0x5, "COM2",
297                         {0x30,0x60,0x61,0x62,0x63,0x70,0xf0,0xf1,0xf2,EOT},
298                         {0x00,0x00,0x00,RSVD,RSVD,0x00,0x00,0x02,0x03,EOT}},
299                 {0x7, "Keyboard",
300                         {0x30,0x70,0x72,0xf0,EOT},
301                         {0x00,0x00,0x00,0x00,EOT}},
302                 {0x8, "Aux I/O",
303                         /* Only 0xf6 existing (and reserved) or 0xf6..0xfb? */
304                         {0x30,0xb4,0xb5,0xb6,0xb7,0xc0,0xc1,0xc2,0xc3,0xc4,
305                          0xc5,0xc6,0xc7,0xc8,0xf1,0xf2,0xf3,0xf4,0xf6,0xf7,
306                          0xf8,0xf9,0xfa,0xfb,EOT},
307                         {0x00,NANA,NANA,NANA,NANA,0x02,0x01,NANA,NANA,NANA,
308                          NANA,NANA,NANA,NANA,0x00,0x00,0x00,0x00,RSVD,RSVD,
309                          RSVD,RSVD,RSVD,RSVD,EOT}},
310                 {EOT}}},
311         {0x51, "LPC47B27x", {
312                 {NOLDN, NULL,
313                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
314                          0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
315                         {RSVD,0x51,NANA,0x00,0x00,0x04,MISC,MISC,RSVD,
316                          NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
317                 {0x0, "Floppy",
318                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
319                          EOT},
320                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
321                          EOT}},
322                 {0x3, "Parallel port",
323                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
324                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
325                 {0x4, "COM1",
326                         {0x30,0x60,0x61,0x70,0xf0,EOT},
327                         {0x00,0x00,0x00,0x00,0x00,EOT}},
328                 {0x5, "COM2",
329                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
330                          EOT},
331                         {NANA,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
332                          EOT}},
333                 {0x7, "Keyboard",
334                         {0x30,0x70,0x72,0xf0,EOT},
335                         {0x00,0x00,0x00,0x00,EOT}},
336                 {0x9, "Game port",
337                         {0x30,0x60,0x61,EOT},
338                         {0x00,0x00,0x00,EOT}},
339                 {0xa, "Power-management events (PME)",
340                         {0x30,0x60,0x61,0xf0,0xf1,EOT},
341                         {0x00,0x00,0x00,NANA,NANA,EOT}},
342                 {0xb, "MIDI port (MPU-401)",
343                         {0x30,0x60,0x61,0x70,EOT},
344                         {0x00,0x03,0x30,0x05,EOT}},
345                 {EOT}}},
346         {0x52, "LPC47B37x", {
347                 {EOT}}},
348         {0x54, "LPC47U33x", {
349                 {EOT}}},
350         {0x56, "LPC47B34x", {
351                 {EOT}}},
352         {0x57, "LPC47S42x", {
353                 {EOT}}},
354         {0x59, "LPC47M10x/112/13x", {
355                 {NOLDN, NULL,
356                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
357                          0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
358                         {RSVD,0x00,0x59,NANA,0x00,0x00,0x44,MISC,MISC,RSVD,
359                          NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
360                 {0x0, "Floppy",
361                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
362                          0xf5,EOT},
363                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
364                          0x00,EOT}},
365                 {0x3, "Parallel port",
366                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
367                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
368                 {0x4, "COM1",
369                         {0x30,0x60,0x61,0x70,0xf0,EOT},
370                         {0x00,0x00,0x00,0x00,0x00,EOT}},
371                 {0x5, "COM2",
372                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,
373                          0xf2,EOT},
374                         {NANA,0x00,0x00,RSVD,RSVD,0x00,RSVD,0x00,0x02,
375                          0x03,EOT}},
376                 {0x7, "Keyboard",
377                         {0x30,0x70,0x72,0xf0,EOT},
378                         {0x00,0x00,0x00,0x00,EOT}},
379                 {0x9, "Game port",
380                         {0x30,0x60,0x61,EOT},
381                         {0x00,0x00,0x00,EOT}},
382                 {0xa, "Power Management Events (PME)",
383                         {0x30,0x60,0x61,0xf0,0xf1,EOT},
384                         {0x00,0x00,0x00,NANA,RSVD,EOT}},
385                 {0xb, "MPU-401",
386                         {0x30,0x60,0x61,0x70,EOT},
387                         {0x00,0x03,0x30,0x05,EOT}},
388                 {EOT}}},
389         {0x5d, "LPC47B357", {   /* From sensors-detect (no datasheet) */
390                 {EOT}}},
391         {0x5f, "LPC47M14x", {
392                 {EOT}}},
393         {0x60, "LPC47M15x/192/997", {
394                 {NOLDN, NULL,
395                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
396                          0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
397                         {RSVD,0x00,0x60,NANA,0x00,0x00,0x44,MISC,MISC,RSVD,
398                          NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
399                 {0x0, "Floppy",
400                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
401                          EOT},
402                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
403                          EOT}},
404                 {0x3, "Parallel port",
405                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
406                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
407                 {0x4, "COM1",
408                         {0x30,0x60,0x61,0x70,0xf0,EOT},
409                         {0x00,0x00,0x00,0x00,0x00,EOT}},
410                 {0x5, "COM2 / IR",
411                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
412                         {NANA,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
413                 {0x7, "Keyboard",
414                         {0x30,0x70,0x72,0xf0,EOT},
415                         {0x00,0x00,0x00,0x00,EOT}},
416                 {0x9, "Game port",
417                         {0x30,0x60,0x61,EOT},
418                         {0x00,0x00,0x00,EOT}},
419                 {0xa, "Power Management Events (PME)",
420                         {0x30,0x60,0x61,0xf0,EOT},
421                         {0x00,0x00,0x00,NANA,EOT}},
422                 {0xb, "MPU-401",
423                         {0x30,0x60,0x61,0x70,EOT},
424                         {0x00,0x03,0x30,0x05,EOT}},
425                 {EOT}}},
426         {0x62, "LPC47S45x", {
427                 {EOT}}},
428         {0x6b, "LPC47M292", {   /* From sensors-detect */
429                 {EOT}}},
430         {0x6e, "LPC47B387", {   /* TODO: Not yet in sensors-detect */
431                 /* Found in the HP Compaq Business Desktop d530 Series */
432                 /* http://article.gmane.org/gmane.linux.bios/27192 */
433                 /* We cannot find a public datasheet for this Super I/O. */
434                 {EOT}}},
435         {0x6f, "LPC47B397", {
436                 {EOT}}},
437         {0x74, "LPC47M182", {
438                 {EOT}}},
439         {0x76, "LPC47M584", {   /* From sensors-detect (no datasheet) */
440                 {EOT}}},
441         {0x77, "A8000", {       /* ASUS A8000, a rebranded DME1737(?) */
442                 {NOLDN, NULL,
443                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
444                          0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
445                         {RSVD,0x00,0x77,NANA,0x00,RSVD,0x44,MISC,MISC,RSVD,
446                          NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
447                 {0x0, "Floppy",
448                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
449                          0xf5,EOT},
450                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
451                          0x00,EOT}},
452                 {0x3, "Parallel port",
453                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
454                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
455                 {0x4, "COM1",
456                         {0x30,0x60,0x61,0x70,0xf0,EOT},
457                         {0x00,0x00,0x00,0x00,0x00,EOT}},
458                 {0x5, "COM2",
459                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
460                         {0x00,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
461                 {0x7, "Keyboard",
462                         {0x30,0x70,0x72,0xf0,EOT},
463                         {0x00,0x00,0x00,0x00,EOT}},
464                 {0xa, "Runtime registers",
465                         {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT},
466                         {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}},
467                 {EOT}}},
468         {0x78, "DME1737", {
469                 {NOLDN, NULL,
470                         {0x03,0x07,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
471                          0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
472                         {RSVD,0x00,0x77,NANA,0x00,RSVD,0x44,MISC,MISC,RSVD,
473                          NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
474                 {0x0, "Floppy",
475                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
476                          0xf5,EOT},
477                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
478                          0x00,EOT}},
479                 {0x3, "Parallel port",
480                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
481                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
482                 {0x4, "COM1",
483                         {0x30,0x60,0x61,0x70,0xf0,EOT},
484                         {0x00,0x00,0x00,0x00,0x00,EOT}},
485                 {0x5, "COM2",
486                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
487                         {0x00,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
488                 {0x7, "Keyboard",
489                         {0x30,0x70,0x72,0xf0,EOT},
490                         {0x00,0x00,0x00,0x00,EOT}},
491                 {0xa, "Runtime registers",
492                         {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT},
493                         {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}},
494                 {EOT}}},
495         {0x79, "SCH5504", {     /* From sensors-detect (no datasheet) */
496                 {EOT}}},
497 #if 0
498         {0x7a, "Unknown", {     /* Found in Toshiba Satellite A80-117. */
499                 {EOT}}},
500 #endif
501         {0x7c, "SCH3112", {
502                 {EOT}}},
503         {0x7d, "SCH3114", {
504                 {EOT}}},
505         {0x7f, "SCH3116", {
506                 {EOT}}},
507         {0x81, "SCH5307", {
508                 {EOT}}},
509         {0x85, "SCH5317", {     /* From sensors-detect */
510                 {EOT}}},
511         {0x89, "SCH5027", {     /* From sensors-detect (no public datasheet) */
512                 {EOT}}},
513         {0x90, "SCH4307", {     /* From sensors-detect */
514                 {EOT}}},
515
516         /* The following Super I/Os use the 0x0d/0x0e ID registers. */
517         {0x03, "FDC37C669", {
518                 /* Init: 0x55, 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
519                 /* Chiprev: 0x02. */
520                 /* FIXME: There's another 0x03 but found on port 0x20/0x21! */
521                 {EOT}}},
522         {0x04, "FDC37C669FR", { /* TODO: Not yet in sensors-detect. */
523                 /* Init: 0x55, 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
524                 {EOT}}},
525         {0x13, "LPC47N237", {
526                 /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */
527                 {EOT}}},
528         {0x28, "FDC37N769", {
529                 /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
530                 {NOLDN, NULL,
531                         {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
532                          0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,
533                          0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
534                          0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
535                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
536                         {0x28,0x9c,0x88,0x70,0x00,0x00,0xff,0x00,0x00,0x00,
537                          0x00,0x00,0x02,0x28,NANA,0x00,0x00,0x80,RSVD,RSVD,
538                          NANA,NANA,NANA,0x03,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD,
539                          0x80,0x00,0x3c,RSVD,RSVD,0x00,0x00,0x00,0x00,0x00,
540                          0x00,0x00,RSVD,0x00,0x00,0x03,0x00,0x00,EOT}},
541                 {EOT}}},
542         {0x29, "FDC37N3869/FDC37N869", {
543                 /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
544                 {EOT}}},
545         {0x5a, "LPC47N227", {
546                 /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */
547                 {NOLDN, NULL,
548                         {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
549                          0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,
550                          0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
551                          0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
552                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,
553                          0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,EOT},
554                         {0x28,0x9c,0x08,0x70,0x00,0x00,0xff,0x00,RSVD,0x00,
555                          0x00,0x00,0x02,0x5a,NANA,0x00,0x00,0x80,MISC,0x00,
556                          NANA,NANA,NANA,0x03,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD,
557                          RSVD,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
558                          0x00,0x80,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,
559                          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,EOT}},
560                 {EOT}}},
561         {0x65, "FDC37C665GT/IR", {
562                 /* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. */
563                 /* Chiprev: 0x02 = FDC37C665GT, 0x82 = FDC37C665IR */
564                 {EOT}}},
565         {0x66, "FDC37C666GT", {
566                 /* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. Chiprev: 0x02. */
567                 {EOT}}},
568         {EOT}
569 };
570
571 static void enter_conf_mode_smsc(uint16_t port)
572 {
573         /* Some of the SMSC Super I/Os have an 0x55,0x55 init, some only
574          * require one 0x55. We do 0x55,0x55 for all of them at the moment,
575          * in the assumption that the extra 0x55 won't hurt the other
576          * Super I/Os. This is verified to be true on (at least) the FDC37N769.
577          */
578         outb(0x55, port);
579         outb(0x55, port);
580 }
581
582 static void exit_conf_mode_smsc(uint16_t port)
583 {
584         outb(0xaa, port);
585 }
586
587 static void probe_idregs_smsc_helper(uint16_t port, uint8_t idreg,
588                                      uint8_t revreg)
589 {
590         uint8_t id, rev;
591         const char *info = (idreg == 0x20) ? "(idregs=0x20/0x21) "
592                                            : "(idregs=0x0d/0x0e) ";
593
594         probing_for("SMSC", info, port);
595
596         enter_conf_mode_smsc(port);
597
598         id = regval(port, idreg);
599         rev = regval(port, revreg);
600
601         if (superio_unknown(reg_table, id)) {
602                 if (verbose)
603                         printf(NOTFOUND "id=0x%02x, rev=0x%02x\n", id, rev);
604                 exit_conf_mode_smsc(port);
605                 return;
606         }
607
608         printf("Found %s %s (id=0x%02x, rev=0x%02x) at 0x%x\n",
609                (id == 0x77 ? "ASUS" : "SMSC"), get_superio_name(reg_table, id),
610                id, rev, port);
611         chip_found = 1;
612
613         dump_superio((id == 0x77 ? "ASUS" : "SMSC"), reg_table, port, id);
614
615         exit_conf_mode_smsc(port);
616 }
617
618 void probe_idregs_smsc(uint16_t port)
619 {
620         probe_idregs_smsc_helper(port, DEVICE_ID_REG, DEVICE_REV_REG);
621         probe_idregs_smsc_helper(port, DEVICE_ID_REG_OLD, DEVICE_REV_REG_OLD);
622 }
623
624 void print_smsc_chips(void)
625 {
626         print_vendor_chips("SMSC", reg_table);
627 }