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