Add dump support for SMSC LPC47N252.
[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                 {NOLDN, NULL,
113                         {0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,
114                          0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
115                         {0x0e,NANA,0x00,0x00,0x04,0x04,NANA,NANA,0x00,
116                          0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
117                 {0x0, "Floppy",
118                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf3,0xf4,
119                          0xf5,EOT},
120                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,RSVD,0x00,
121                          0x00,EOT}},
122                 {0x1, "Power management (PM1)",
123                         {0x30,0x60,0x61,EOT},
124                         {0x00,0x00,0x00,EOT}},
125                 {0x3, "Parallel port",
126                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
127                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
128                 {0x4, "COM1",
129                         {0x30,0x60,0x61,0x70,0xf0,EOT},
130                         {0x00,0x00,0x00,0x00,0x00,EOT}},
131                 {0x5, "COM2 / IRCC",
132                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,
133                          0xf2,0xf7,0xf8,EOT},
134                         {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,
135                          0x03,0x00,0x00,EOT}},
136                 {0x6, "Real-time clock (RTC)",
137                         {0x30,0x60,0x61,0x62,0x63,0x70,0xf0,0xf1,EOT},
138                         {0x00,0x00,0x70,0x00,0x74,0x00,0x00,NANA,EOT}},
139                 {0x7, "Keyboard",
140                         {0x30,0x60,0x61,0x70,0x72,0xf0,EOT},
141                         {0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
142                 {0x8, "Embedded controller (EC)",
143                         {0x30,0x60,0x61,EOT},
144                         {0x00,0x00,0x62,EOT}},
145                 {0x9, "Mailbox Interface",
146                         {0x30,0x60,0x61,EOT},
147                         {0x00,0x00,0x00,EOT}},
148                 {0xa, "LPC/8051 addressable GPIO (LGPIO)",
149                         {0x30,0x60,0x61,EOT},
150                         {0x00,0x00,0x00,EOT}},
151                 {EOT}}},
152         {0x14, "LPC47M172", {
153                 {EOT}}},
154         {0x30, "FDC37C93xAPM", {
155                 {EOT}}},
156         {0x40, "FDC37C67x", {   /* E.g. FDC37C672. Chiprev: 0x01 */
157                 {NOLDN, NULL,
158                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,0x2c,
159                          0x2d,0x2e,0x2f,EOT},
160                         {0x03,0x40,NANA,0x00,0x00,0x04,MISC,MISC,NANA,NANA,
161                          NANA,NANA,NANA,EOT}},
162                 {0x0, "Floppy",
163                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
164                          EOT},
165                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
166                          EOT}},
167                 {0x3, "Parallel port",
168                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
169                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
170                 {0x4, "COM1",
171                         {0x30,0x60,0x61,0x70,0xf0,EOT},
172                         {0x00,0x00,0x00,0x00,0x00,EOT}},
173                 {0x5, "COM2",
174                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
175                          EOT},
176                         {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
177                          EOT}},
178                 {0x7, "Keyboard",
179                         {0x30,0x70,0x72,0xf0,EOT},
180                         {0x00,0x00,0x00,0x00,EOT}},
181                 {0x8, "Aux I/O",
182                         {0x30,0xb4,0xb5,0xb6,0xb7,0xc0,0xc1,0xc2,0xc3,0xc4,
183                          0xf1,0xf2,0xf3,0xf4,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,
184                          EOT},
185                         {0x00,NANA,NANA,NANA,NANA,0x06,0x03,NANA,NANA,NANA,
186                          0x00,0x00,0x00,MISC,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD,
187                          EOT}},
188                 {EOT}}},
189         {0x42, "FDC37B80x/FDC37M707", {
190                 {EOT}}},
191         {0x09, "FDC37N958FR", { /* Found in e.g. Dell Latitude CPi A366XT. */
192                 {NOLDN, NULL,
193                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b,
194                          0x2c,0x2d,0x2e,0x2f,EOT},
195                         {0x03,0x44,0x00,0x00,0x00,0x04,MISC,MISC,0x00,NANA,
196                          NANA,NANA,NANA,NANA,EOT}},
197                 {0x0, "Floppy",
198                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
199                          EOT},
200                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
201                          EOT}},
202                 {0x3, "Parallel port",
203                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
204                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
205                 {0x4, "COM1",
206                         {0x30,0x60,0x61,0x70,0xf0,EOT},
207                         {0x00,0x00,0x00,0x00,0x00,EOT}},
208                 {0x5, "COM2",
209                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
210                          EOT},
211                         {NANA,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
212                          EOT}},
213                 {0x6, "Real-time clock (RTC)",
214                         {0x30,0x62,0x63,0x70,0xf0,EOT},
215                         {0x00,0x00,0x70,0x00,0x00,EOT}},
216                 {0x7, "Keyboard",
217                         {0x30,0x70,0x72,0xf0,EOT},
218                         {0x00,0x00,0x00,0x00,EOT}},
219                 {0x8, "Aux I/O",
220                         {0x30,0xb0,0xb1,0xb2,0xb3,0xb8,0xc0,0xc1,0xc2,0xc3,
221                          0xc4,0xc5,0xc6,0xc8,0xca,0xcb,0xcc,0xd0,0xd1,0xd2,
222                          0xd3,0xd4,0xd5,0xd6,0xd7,0xe0,0xe1,0xe2,0xe3,0xe4,
223                          0xe5,0xe6,0xe7,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf6,
224                          0xf9,0xfa,EOT},
225                         {0x00,NANA,NANA,NANA,NANA,NANA,NANA,0x01,NANA,NANA,
226                          NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
227                          NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
228                          NANA,NANA,NANA,NANA,NANA,0x00,0x00,0x00,0x00,NANA,
229                          NANA,NANA,EOT}},
230                 {0xa, "ACPI",
231                         {0x30,0x60,0x61,0x70,0xf0,EOT},
232                         {0x00,0x00,0x00,NANA,NANA,EOT}},
233                 {EOT}}},
234         {0x43, "FDC37B77x", {
235                 {EOT}}},
236         {0x44, "FDC37B78x", {
237                 {NOLDN, NULL,
238                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b,
239                          0x2c,0x2d,0x2e,0x2f,EOT},
240                         {0x03,0x44,0x00,0x00,0x00,0x04,MISC,MISC,0x00,NANA,
241                          NANA,NANA,NANA,NANA,EOT}},
242                 {0x0, "Floppy",
243                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
244                          EOT},
245                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
246                          EOT}},
247                 {0x3, "Parallel port",
248                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
249                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
250                 {0x4, "COM1",
251                         {0x30,0x60,0x61,0x70,0xf0,EOT},
252                         {0x00,0x00,0x00,0x00,0x00,EOT}},
253                 {0x5, "COM2",
254                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
255                          EOT},
256                         {NANA,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
257                          EOT}},
258                 {0x6, "Real-time clock (RTC)",
259                         {0x30,0x62,0x63,0x70,0xf0,EOT},
260                         {0x00,0x00,0x70,0x00,0x00,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,NANA,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,0x00,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         {0x47, "FDC37M60x", {   /* TODO: Not yet in sensors-detect */
280                 {EOT}}},
281         {0x4c, "FDC37B72x", {
282                 {NOLDN, NULL,
283                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2b,
284                          0x2c,0x2d,0x2e,0x2f,EOT},
285                         {0x03,0x4c,0x00,0x00,0x00,0x04,MISC,MISC,0x00,NANA,
286                          NANA,NANA,NANA,NANA,EOT}},
287                 {0x0, "Floppy",
288                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
289                          EOT},
290                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
291                          EOT}},
292                 {0x3, "Parallel port",
293                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
294                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
295                 {0x4, "COM1",
296                         {0x30,0x60,0x61,0x70,0xf0,EOT},
297                         {0x00,0x00,0x00,0x00,0x00,EOT}},
298                 {0x5, "COM2",
299                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
300                         {NANA,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
301                 {0x7, "Keyboard",
302                         {0x30,0x70,0x72,0xf0,EOT},
303                         {0x00,0x00,0x00,0x00,EOT}},
304                 {0x8, "Aux I/O",
305                         {0x30,0xb0,0xb1,0xb2,0xb3,0xb8,0xc0,0xc1,0xc2,0xc3,
306                          0xc4,0xc5,0xc6,0xc8,0xca,0xcb,0xcc,0xd0,0xd1,0xd2,
307                          0xd3,0xd4,0xd5,0xd6,0xd7,0xe0,0xe1,0xe2,0xe3,0xe4,
308                          0xe5,0xe6,0xe7,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf6,
309                          0xf9,0xfa,EOT},
310                         {0x00,NANA,NANA,NANA,NANA,NANA,0x00,0x01,NANA,NANA,
311                          NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
312                          NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,
313                          NANA,NANA,NANA,NANA,NANA,0x00,0x00,0x00,MISC,NANA,
314                          NANA,NANA,EOT}},
315                 {0xa, "ACPI",
316                         {0x30,0x60,0x61,0x70,0xf0,EOT},
317                         {0x00,0x00,0x00,NANA,NANA,EOT}},
318                 {EOT}}},
319         {0x4d, "FDC37M81x", {
320                 {NOLDN, NULL,
321                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2b,0x2c,
322                          0x2d,0x2e,0x2f,EOT},
323                         {0x03,0x4d,NANA,0x00,0x00,0x04,MISC,MISC,NANA,NANA,
324                          NANA,NANA,NANA,EOT}},
325                 {0x0, "Floppy",
326                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
327                          0xf5,EOT},
328                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
329                          0x00,EOT}},
330                 {0x3, "Parallel port",
331                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
332                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
333                 {0x4, "COM1",
334                         {0x30,0x60,0x61,0x70,0xf0,EOT},
335                         {0x00,0x00,0x00,0x00,0x00,EOT}},
336                 {0x5, "COM2",
337                         {0x30,0x60,0x61,0x62,0x63,0x70,0xf0,0xf1,0xf2,EOT},
338                         {0x00,0x00,0x00,RSVD,RSVD,0x00,0x00,0x02,0x03,EOT}},
339                 {0x7, "Keyboard",
340                         {0x30,0x70,0x72,0xf0,EOT},
341                         {0x00,0x00,0x00,0x00,EOT}},
342                 {0x8, "Aux I/O",
343                         /* Only 0xf6 existing (and reserved) or 0xf6..0xfb? */
344                         {0x30,0xb4,0xb5,0xb6,0xb7,0xc0,0xc1,0xc2,0xc3,0xc4,
345                          0xc5,0xc6,0xc7,0xc8,0xf1,0xf2,0xf3,0xf4,0xf6,0xf7,
346                          0xf8,0xf9,0xfa,0xfb,EOT},
347                         {0x00,NANA,NANA,NANA,NANA,0x02,0x01,NANA,NANA,NANA,
348                          NANA,NANA,NANA,NANA,0x00,0x00,0x00,0x00,RSVD,RSVD,
349                          RSVD,RSVD,RSVD,RSVD,EOT}},
350                 {EOT}}},
351         {0x51, "LPC47B27x", {
352                 {NOLDN, NULL,
353                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,
354                          0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
355                         {RSVD,0x51,NANA,0x00,0x00,0x04,MISC,MISC,RSVD,
356                          NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
357                 {0x0, "Floppy",
358                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
359                          EOT},
360                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
361                          EOT}},
362                 {0x3, "Parallel port",
363                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
364                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
365                 {0x4, "COM1",
366                         {0x30,0x60,0x61,0x70,0xf0,EOT},
367                         {0x00,0x00,0x00,0x00,0x00,EOT}},
368                 {0x5, "COM2",
369                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,0xf2,
370                          EOT},
371                         {NANA,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x02,0x03,
372                          EOT}},
373                 {0x7, "Keyboard",
374                         {0x30,0x70,0x72,0xf0,EOT},
375                         {0x00,0x00,0x00,0x00,EOT}},
376                 {0x9, "Game port",
377                         {0x30,0x60,0x61,EOT},
378                         {0x00,0x00,0x00,EOT}},
379                 {0xa, "Power-management events (PME)",
380                         {0x30,0x60,0x61,0xf0,0xf1,EOT},
381                         {0x00,0x00,0x00,NANA,NANA,EOT}},
382                 {0xb, "MIDI port (MPU-401)",
383                         {0x30,0x60,0x61,0x70,EOT},
384                         {0x00,0x03,0x30,0x05,EOT}},
385                 {EOT}}},
386         {0x52, "LPC47B37x", {
387                 {EOT}}},
388         {0x54, "LPC47U33x", {
389                 {NOLDN, NULL,
390                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x2a,0x2b,
391                          0x2c,0x2d,0x2e,0x2f,EOT},
392                         {RSVD,0x54,NANA,0x00,0x00,0x04,MISC,MISC,NANA,NANA,
393                          NANA,NANA,NANA,NANA,EOT}},
394                 {0x0, "Floppy",
395                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
396                          EOT},
397                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
398                          EOT}},
399                 {0x3, "Parallel port",
400                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
401                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
402                 {0x4, "COM1",
403                         {0x30,0x60,0x61,0x70,0xf0,EOT},
404                         {0x00,0x00,0x00,0x00,0x00,EOT}},
405                 {0x5, "MIDI port (MPU-401)",
406                         {0x30,0x60,0x61,0x70,EOT},
407                         {0x00,0x03,0x30,0x05,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, "Runtime registers",
415                         {0x30,0x60,0x61,0xf0,0xf1,EOT},
416                         {0x00,0x00,0x00,NANA,NANA,EOT}},
417                 {0xb, "SMBus",
418                         {0x30,0x60,0x61,0x70,EOT},
419                         {0x00,0x00,0x00,0x00,EOT}},
420                 {EOT}}},
421         {0x56, "LPC47B34x", {
422                 {EOT}}},
423         {0x57, "LPC47S42x", {
424                 {EOT}}},
425         {0x59, "LPC47M10x/112/13x", {
426                 {NOLDN, NULL,
427                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a,
428                          0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
429                         {RSVD,0x59,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,
433                          0xf5,EOT},
434                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
435                          0x00,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",
443                         {0x30,0x60,0x61,0x62,0x63,0x70,0x74,0xf0,0xf1,
444                          0xf2,EOT},
445                         {NANA,0x00,0x00,RSVD,RSVD,0x00,RSVD,0x00,0x02,
446                          0x03,EOT}},
447                 {0x7, "Keyboard",
448                         {0x30,0x70,0x72,0xf0,EOT},
449                         {0x00,0x00,0x00,0x00,EOT}},
450                 {0x9, "Game port",
451                         {0x30,0x60,0x61,EOT},
452                         {0x00,0x00,0x00,EOT}},
453                 {0xa, "Power management events (PME)",
454                         {0x30,0x60,0x61,0xf0,0xf1,EOT},
455                         {0x00,0x00,0x00,NANA,RSVD,EOT}},
456                 {0xb, "MPU-401",
457                         {0x30,0x60,0x61,0x70,EOT},
458                         {0x00,0x03,0x30,0x05,EOT}},
459                 {EOT}}},
460         {0x5d, "LPC47B357", {   /* From sensors-detect (no datasheet) */
461                 {EOT}}},
462         {0x5f, "LPC47M14x", {
463                 {EOT}}},
464         {0x60, "LPC47M15x/192/997", {
465                 {NOLDN, NULL,
466                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a,
467                          0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
468                         {RSVD,0x60,NANA,0x00,0x00,0x44,MISC,MISC,RSVD,NANA,
469                          NANA,NANA,NANA,NANA,NANA,EOT}},
470                 {0x0, "Floppy",
471                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,0xf5,
472                          EOT},
473                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,0x00,
474                          EOT}},
475                 {0x3, "Parallel port",
476                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
477                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
478                 {0x4, "COM1",
479                         {0x30,0x60,0x61,0x70,0xf0,EOT},
480                         {0x00,0x00,0x00,0x00,0x00,EOT}},
481                 {0x5, "COM2 / IR",
482                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
483                         {NANA,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
484                 {0x7, "Keyboard",
485                         {0x30,0x70,0x72,0xf0,EOT},
486                         {0x00,0x00,0x00,0x00,EOT}},
487                 {0x9, "Game port",
488                         {0x30,0x60,0x61,EOT},
489                         {0x00,0x00,0x00,EOT}},
490                 {0xa, "Power management events (PME)",
491                         {0x30,0x60,0x61,0xf0,EOT},
492                         {0x00,0x00,0x00,NANA,EOT}},
493                 {0xb, "MPU-401",
494                         {0x30,0x60,0x61,0x70,EOT},
495                         {0x00,0x03,0x30,0x05,EOT}},
496                 {EOT}}},
497         {0x62, "LPC47S45x", {
498                 {EOT}}},
499         {0x67, "EMC2700LPC", {  /* From sensors-detect */
500                 {EOT}}},
501         {0x6b, "LPC47M292", {   /* From sensors-detect */
502                 {EOT}}},
503         {0x6e, "LPC47B387", {   /* TODO: Not yet in sensors-detect */
504                 /* Found in the HP Compaq Business Desktop d530 Series */
505                 /* http://article.gmane.org/gmane.linux.bios/27192 */
506                 /* We cannot find a public datasheet for this Super I/O. */
507                 {EOT}}},
508         {0x6f, "LPC47B397", {
509                 {EOT}}},
510         {0x74, "LPC47M182", { /* Only for LD_NUM = 0 */
511                 {NOLDN, NULL,
512                         {0x02,0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,
513                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
514                         {0x00,RSVD,0x74,RSVD,0x00,RSVD,0x44,MISC,0x00,
515                          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
516                 {0x0, "Floppy",
517                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
518                          0xf8,EOT},
519                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
520                          0x24,EOT}},
521                 {0x1, "Parallel port",
522                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf8,EOT},
523                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,0x08,EOT}},
524                 {0x2, "COM2",
525                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
526                         {0x00,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
527                 {0x3, "COM1",
528                         {0x30,0x60,0x61,0x70,0xf0,EOT},
529                         {0x00,0x00,0x00,0x00,0x00,EOT}},
530                 {0x4, "Power control",
531                         {0x30,0x60,0x61,0x70,0xf0,0xf1,EOT},
532                         {0x00,0x00,0x00,0x00,NANA,0x00,EOT}},
533                 {0x5, "Mouse",
534                         {0x30,0x70,EOT},
535                         {0x00,0x00,EOT}},
536                 {0x6, "Keyboard",
537                         {0x30,0x70,0xf0,EOT},
538                         {0x00,0x00,0x00,EOT}},
539                 {0x7, "GPIO",
540                         {0x30,0x60,0x61,0x70,0x72,0xf0,EOT},
541                         {0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
542                 {0xa, "Runtime registers",
543                         {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT},
544                         {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}},
545                 {EOT}}},
546         {0x76, "LPC47M584", {   /* From sensors-detect (no datasheet) */
547                 {EOT}}},
548         {0x77, "A8000", {       /* ASUS A8000, a rebranded DME1737(?) */
549                 {NOLDN, NULL,
550                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a,
551                          0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
552                         {RSVD,0x77,NANA,0x00,RSVD,0x44,MISC,MISC,RSVD,NANA,
553                          NANA,NANA,NANA,NANA,NANA,EOT}},
554                 {0x0, "Floppy",
555                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
556                          0xf5,EOT},
557                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
558                          0x00,EOT}},
559                 {0x3, "Parallel port",
560                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
561                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
562                 {0x4, "COM1",
563                         {0x30,0x60,0x61,0x70,0xf0,EOT},
564                         {0x00,0x00,0x00,0x00,0x00,EOT}},
565                 {0x5, "COM2",
566                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
567                         {0x00,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
568                 {0x7, "Keyboard",
569                         {0x30,0x70,0x72,0xf0,EOT},
570                         {0x00,0x00,0x00,0x00,EOT}},
571                 {0xa, "Runtime registers",
572                         {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT},
573                         {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}},
574                 {EOT}}},
575         {0x78, "DME1737", {
576                 {NOLDN, NULL,
577                         {0x03,0x20,0x21,0x22,0x23,0x24,0x26,0x27,0x28,0x2a,
578                          0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
579                         {RSVD,0x77,NANA,0x00,RSVD,0x44,MISC,MISC,RSVD,NANA,
580                          NANA,NANA,NANA,NANA,NANA,EOT}},
581                 {0x0, "Floppy",
582                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,0xf2,0xf4,
583                          0xf5,EOT},
584                         {0x00,0x03,0xf0,0x06,0x02,0x0e,0x00,0xff,0x00,
585                          0x00,EOT}},
586                 {0x3, "Parallel port",
587                         {0x30,0x60,0x61,0x70,0x74,0xf0,0xf1,EOT},
588                         {0x00,0x00,0x00,0x00,0x04,0x3c,0x00,EOT}},
589                 {0x4, "COM1",
590                         {0x30,0x60,0x61,0x70,0xf0,EOT},
591                         {0x00,0x00,0x00,0x00,0x00,EOT}},
592                 {0x5, "COM2",
593                         {0x30,0x60,0x61,0x70,0xf0,0xf1,0xf2,EOT},
594                         {0x00,0x00,0x00,0x00,0x00,0x02,0x03,EOT}},
595                 {0x7, "Keyboard",
596                         {0x30,0x70,0x72,0xf0,EOT},
597                         {0x00,0x00,0x00,0x00,EOT}},
598                 {0xa, "Runtime registers",
599                         {0x30,0x60,0x61,0x62,0x63,0xf0,0xf1,0xf2,EOT},
600                         {0x00,0x00,0x00,0x00,0x00,NANA,RSVD,0x04,EOT}},
601                 {EOT}}},
602         {0x79, "SCH5504", {     /* From sensors-detect (no datasheet) */
603                 {EOT}}},
604         {0x7a, "LPC47N217", {   /* Found in Toshiba Satellite A80-117. */
605                 {EOT}}},
606         {0x7c, "SCH3112", {
607                 {EOT}}},
608         {0x7d, "SCH3114", {
609                 {EOT}}},
610         {0x7f, "SCH3116", {
611                 {EOT}}},
612         {0x81, "SCH5307", {
613                 {EOT}}},
614         {0x83, "SCH5514D", {    /* From sensors-detect */
615                 {EOT}}},
616         {0x85, "SCH5317", {     /* From sensors-detect */
617                 /* The SCH5317 can have either 0x85 or 0x8c as device ID. */
618                 {EOT}}},
619         {0x86, "SCH5127", {     /* From sensors-detect */
620                 {EOT}}},
621         {0x89, "SCH5027", {     /* From sensors-detect (no public datasheet) */
622                 {EOT}}},
623         {0x8c, "SCH5317", {     /* From sensors-detect */
624                 /* The SCH5317 can have either 0x85 or 0x8c as device ID. */
625                 {EOT}}},
626         {0x90, "SCH4307", {     /* From sensors-detect */
627                 {EOT}}},
628
629         /* The following Super I/Os use the 0x0d/0x0e ID registers. */
630         {0x03, "FDC37C669", {
631                 /* Init: 0x55, 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
632                 /* Chiprev: 0x02. */
633                 /* FIXME: There's another 0x03 but found on port 0x20/0x21! */
634                 {EOT}}},
635         {0x04, "FDC37C669FR", { /* TODO: Not yet in sensors-detect. */
636                 /* Init: 0x55, 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
637                 {EOT}}},
638         {0x13, "LPC47N237", {
639                 /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */
640                 {EOT}}},
641         {0x28, "FDC37N769", {
642                 /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
643                 {NOLDN, NULL,
644                         {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
645                          0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,
646                          0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
647                          0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
648                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
649                         {0x28,0x9c,0x88,0x70,0x00,0x00,0xff,0x00,0x00,0x00,
650                          0x00,0x00,0x02,0x28,NANA,0x00,0x00,0x80,RSVD,RSVD,
651                          NANA,NANA,NANA,0x03,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD,
652                          0x80,0x00,0x3c,RSVD,RSVD,0x00,0x00,0x00,0x00,0x00,
653                          0x00,0x00,RSVD,0x00,0x00,0x03,0x00,0x00,EOT}},
654                 {EOT}}},
655         {0x29, "FDC37N3869/FDC37N869", {
656                 /* Init: 0x55. Exit: 0xaa. Ports: 0x3f0/0x370. */
657                 {EOT}}},
658         {0x5a, "LPC47N227", {
659                 /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */
660                 {NOLDN, NULL,
661                         {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
662                          0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,
663                          0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
664                          0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
665                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,
666                          0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,EOT},
667                         {0x28,0x9c,0x08,0x70,0x00,0x00,0xff,0x00,RSVD,0x00,
668                          0x00,0x00,0x02,0x5a,NANA,0x00,0x00,0x80,MISC,0x00,
669                          NANA,NANA,NANA,0x03,RSVD,RSVD,RSVD,RSVD,RSVD,RSVD,
670                          RSVD,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
671                          0x00,0x80,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,
672                          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,EOT}},
673                 {EOT}}},
674         {0x5b, "SIO10N268", {
675                 /* Init: 0x55. Exit: 0xaa. Ports: 0x2e/0x4e. */
676                 {NOLDN, NULL,
677                         {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
678                          0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,
679                          0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,
680                          0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
681                          0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,
682                          0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,
683                          0x3c,0x3d,0x3e,0x3f,0x40,0x41,0x42,0x43,0x44,0x45,
684                          0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,
685                          0x50,0x51,0x52,0x53,0x54,EOT},
686                         {0x20,0x98,0x00,0x70,0x00,0x00,0xff,0x00,0x00,0x00,
687                          0x00,0x00,0x02,0x5b,NANA,0x00,0x00,0x00,MISC,0x00,
688                          NANA,NANA,NANA,0x03,0x00,NANA,NANA,0x00,0x00,0x00,
689                          NANA,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0xff,0x00,
690                          0x00,0x80,0x00,0x00,0x0f,0x03,0x00,0x00,0x00,NANA,
691                          NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,0x00,0x00,
692                          0x00,0x00,0x00,0x00,NANA,NANA,NANA,NANA,NANA,0x50,
693                          NANA,0x00,NANA,NANA,NANA,NANA,NANA,NANA,0x00,0x01,
694                          0x00,0x01,0x00,0x8c,MISC,EOT}},
695                 {EOT}}},
696         {0x65, "FDC37C665GT/IR", {
697                 /* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. */
698                 /* Chiprev: 0x02 = FDC37C665GT, 0x82 = FDC37C665IR */
699                 {EOT}}},
700         {0x66, "FDC37C666GT", {
701                 /* Init: 0x55, 0x55. Exit: 0xaa. Port: 0x3f0. Chiprev: 0x02. */
702                 {EOT}}},
703         {EOT}
704 };
705
706 static void enter_conf_mode_smsc(uint16_t port)
707 {
708         /* Some of the SMSC Super I/Os have an 0x55,0x55 init, some only
709          * require one 0x55. We do 0x55,0x55 for all of them at the moment,
710          * in the assumption that the extra 0x55 won't hurt the other
711          * Super I/Os. This is verified to be true on (at least) the FDC37N769.
712          */
713         OUTB(0x55, port);
714         OUTB(0x55, port);
715 }
716
717 static void exit_conf_mode_smsc(uint16_t port)
718 {
719         OUTB(0xaa, port);
720 }
721
722 static void probe_idregs_smsc_helper(uint16_t port, uint8_t idreg,
723                                      uint8_t revreg)
724 {
725         uint8_t id, rev;
726         uint16_t runtime_base;
727         const char *info = (idreg == 0x20) ? "(idregs=0x20/0x21) "
728                                            : "(idregs=0x0d/0x0e) ";
729
730         probing_for("SMSC", info, port);
731
732         enter_conf_mode_smsc(port);
733
734         id = regval(port, idreg);
735         rev = regval(port, revreg);
736
737         if (superio_unknown(reg_table, id)) {
738                 if (verbose)
739                         printf(NOTFOUND "id=0x%02x, rev=0x%02x\n", id, rev);
740                 exit_conf_mode_smsc(port);
741                 return;
742         }
743
744         printf("Found %s %s (id=0x%02x, rev=0x%02x) at 0x%x\n",
745                (id == 0x77 ? "ASUS" : "SMSC"), get_superio_name(reg_table, id),
746                id, rev, port);
747         chip_found = 1;
748
749         dump_superio((id == 0x77 ? "ASUS" : "SMSC"), reg_table, port, id,
750                      LDN_SEL);
751
752         if (extra_dump) {
753                 switch (id) {
754                 case 0x5a: /* LPC47N227 */
755                         runtime_base = regval(port, 0x30) << 4;
756                         if (runtime_base)
757                                 dump_io(runtime_base, 16);
758                         else
759                                 printf("Runtime Register Block not mapped on this Super I/O.\n");
760                         break;
761                 default:
762                         printf("No extra registers known for this chip.\n");
763                 }
764         }
765
766         exit_conf_mode_smsc(port);
767 }
768
769 void probe_idregs_smsc(uint16_t port)
770 {
771         probe_idregs_smsc_helper(port, DEVICE_ID_REG, DEVICE_REV_REG);
772         probe_idregs_smsc_helper(port, DEVICE_ID_REG_OLD, DEVICE_REV_REG_OLD);
773 }
774
775 void print_smsc_chips(void)
776 {
777         print_vendor_chips("SMSC", reg_table);
778         printf("SMSC LPC47N227 runtime register block\n\n");
779 }