xref: /aosp_15_r20/external/coreboot/util/superiotool/nsc.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "superiotool.h"
4 
5 #define CHIP_ID_REG	0x20	/* Super I/O ID (SID) / family */
6 #define CHIP_REV_REG	0x27	/* Super I/O revision ID (SRID) */
7 
8 static const struct superio_registers reg_table[] = {
9 	{0xcf, "PC97307", {
10 		{NOLDN, NULL,
11 			{0x20,0x21,0x22,0x23,0x24,0x27,EOT},
12 			{0xcf,MISC,MISC,0x00,0x00,NANA,EOT}},
13 		{0x0, "Keyboard",
14 			{0x30,0x31,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
15 			 0xf0,EOT},
16 			{MISC,0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,
17 			 0x40,EOT}},
18 		{0x1, "Mouse",
19 			{0x30,0x70,0x71,0x74,0x75,EOT},
20 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
21 		{0x2, "Real-time clock (RTC), advanced power control (APC)",
22 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
23 			{MISC,0x00,0x00,0x70,0x08,0x00,0x04,0x04,EOT}},
24 		{0x3, "Floppy",
25 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
26 			 EOT},
27 			{MISC,0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x20,0x00,
28 			 EOT}},
29 		{0x4, "Parallel port",
30 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
31 			{0x00,0x00,0x02,0x78,0x07,0x00,0x04,0x04,0xf2,EOT}},
32 		{0x5, "COM2 / IR",
33 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
34 			{0x00,0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
35 		{0x6, "COM1",
36 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
37 			{0x00,0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
38 		{0x7, "GPIO",
39 			{0x30,0x31,0x60,0x61,0x74,0x75,EOT},
40 			{0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
41 		{0x8, "Power management",
42 			{0x30,0x31,0x60,0x61,0x74,0x75,EOT},
43 			{0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
44 		{EOT}}},
45 	{0xd0, "PC87317", {
46 		{NOLDN, NULL,
47 			{0x20,0x21,0x22,0x23,0x24,0x25,EOT},
48 			{0xd0,MISC,MISC,0x00,0x00,0x00,EOT}},
49 		{0x0, "Keyboard",
50 			{0x30,0x31,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
51 			 0xf0,EOT},
52 			{MISC,0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,
53 			 0x40,EOT}},
54 		{0x1, "Mouse",
55 			{0x30,0x70,0x71,0x74,0x75,EOT},
56 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
57 		{0x2, "Real-time clock (RTC), advanced power control (APC)",
58 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
59 			{MISC,0x00,0x00,0x70,0x08,0x00,0x04,0x04,EOT}},
60 		{0x3, "Floppy",
61 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
62 			 EOT},
63 			{MISC,0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x20,0x00,
64 			 EOT}},
65 		{0x4, "Parallel port",
66 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
67 			{0x00,0x00,0x02,0x78,0x07,0x00,0x04,0x04,0xf2,EOT}},
68 		{0x5, "COM2 / IR",
69 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
70 			{0x00,0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
71 		{0x6, "COM1",
72 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
73 			{0x00,0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
74 		{0x7, "GPIO",
75 			{0x30,0x31,0x60,0x61,0x74,0x75,EOT},
76 			{0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
77 		{0x8, "Power management",
78 			{0x30,0x31,0x60,0x61,0x74,0x75,EOT},
79 			{0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
80 		{EOT}}},
81 	{0xdf, "PC97317", {
82 		{NOLDN, NULL,
83 			{0x20,0x21,0x22,0x23,0x24,0x25,0x27,EOT},
84 			{0xdf,MISC,MISC,0x00,0x00,0x00,NANA,EOT}},
85 		{0x0, "Keyboard",
86 			{0x30,0x31,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
87 			 0xf0,EOT},
88 			{MISC,0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,
89 			 0x40,EOT}},
90 		{0x1, "Mouse",
91 			{0x30,0x70,0x71,0x74,0x75,EOT},
92 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
93 		{0x2, "Real-time clock (RTC), advanced power control (APC)",
94 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
95 			{MISC,0x00,0x00,0x70,0x08,0x00,0x04,0x04,EOT}},
96 		{0x3, "Floppy",
97 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
98 			 EOT},
99 			{MISC,0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x20,0x00,
100 			 EOT}},
101 		{0x4, "Parallel port",
102 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
103 			{0x00,0x00,0x02,0x78,0x07,0x00,0x04,0x04,0xf2,EOT}},
104 		{0x5, "COM2 / IR",
105 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
106 			{0x00,0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
107 		{0x6, "COM1",
108 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
109 			{0x00,0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
110 		{0x7, "GPIO",
111 			{0x30,0x31,0x60,0x61,0x74,0x75,EOT},
112 			{0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
113 		{0x8, "Power management",
114 			{0x30,0x31,0x60,0x61,0x74,0x75,EOT},
115 			{0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
116 		{EOT}}},
117 	{0xe0, "PC87309", {
118 		{NOLDN, NULL,
119 			{0x20,0x21,0x22,0x27,0x2e,EOT},
120 			{0xe0,MISC,0x00,NANA,RSVD,EOT}},
121 		{0x0, "Floppy",
122 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
123 			 EOT},
124 			{MISC,0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x20,0x00,
125 			 EOT}},
126 		{0x1, "Parallel port",
127 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
128 			{0x00,0x00,0x02,0x78,0x07,0x00,0x04,0x04,0xf2,EOT}},
129 		{0x2, "COM2 / IR",
130 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
131 			{0x00,0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
132 		{0x3, "COM1",
133 			{0x30,0x31,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
134 			{0x00,0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
135 		{0x4, "Power management",
136 			{0x30,0x31,0x60,0x61,0x74,0x75,EOT},
137 			{0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
138 		{0x5, "Mouse",
139 			{0x30,0x70,0x71,0x74,0x75,EOT},
140 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
141 		{0x6, "Keyboard",
142 			{0x30,0x31,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
143 			 0xf0,EOT},
144 			{0x01,0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,
145 			 0x40,EOT}},
146 		{EOT}}},
147 	{0xe1, "PC87360", {
148 		{NOLDN, NULL,
149 			{0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2a,
150 			 0x2b,0x2c,0x2d,0x2e,EOT},
151 			{0xe1,0x11,0x00,0x03,0x00,0x00,0x00,NANA,0x00,MISC,
152 			 0x00,0x00,0x00,RSVD,EOT}},
153 		{0x0, "Floppy",
154 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
155 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,EOT}},
156 		{0x1, "Parallel port",
157 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
158 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,EOT}},
159 		{0x2, "COM2",
160 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
161 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
162 		{0x3, "COM1",
163 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
164 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
165 		{0x4, "System wake-up control (SWC)",
166 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
167 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}},
168 		{0x5, "Mouse",
169 			{0x30,0x70,0x71,0x74,0x75,EOT},
170 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
171 		{0x6, "Keyboard",
172 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
173 			 EOT},
174 			{0x01,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
175 			 EOT}},
176 		{0x7, "GPIO",
177 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
178 			 EOT},
179 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x00,0x00,
180 			 EOT}},
181 		{0x8, "ACCESS.bus (ACB)",
182 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
183 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,EOT}},
184 		{0x9, "Fan speed control and monitor (FSCM)",
185 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
186 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,EOT}},
187 		{0xa, "Watchdog timer",
188 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
189 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x02,EOT}},
190 		{EOT}}},
191 	{0xe2, "PC87351", {
192 		{NOLDN, NULL,
193 			{0x20,0x21,0x22,0x23,0x24,0x27,0x2e,EOT},
194 			{0xe2,0x11,0xa1,0x00,MISC,NANA,RSVD,EOT}},
195 		{0x0, "Floppy",
196 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
197 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,EOT}},
198 		{0x1, "Parallel port",
199 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
200 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,EOT}},
201 		{0x2, "COM2",
202 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
203 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
204 		{0x3, "COM1",
205 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
206 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
207 		{0x4, "System wake-up control (SWC)",
208 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
209 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}},
210 		{0x5, "Mouse",
211 			{0x30,0x70,0x71,0x74,0x75,EOT},
212 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
213 		{0x6, "Keyboard",
214 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
215 			 0xf0,EOT},
216 			{0x01,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,
217 			 0x40,EOT}},
218 		{0x7, "GPIO",
219 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
220 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x00,EOT}},
221 		{0x8, "Fan speed control",
222 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
223 			{0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,EOT}},
224 		{EOT}}},
225 	{0xe4, "PC87364", {
226 		{NOLDN, NULL,
227 			{0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2a,
228 			 0x2b,0x2c,0x2d,0x2e,EOT},
229 			{0xe4,0x11,0x00,0x03,0x00,0x00,0x00,NANA,0x00,MISC,
230 			 0x00,0x00,NANA,RSVD,EOT}},
231 		{0x0, "Floppy",
232 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
233 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,EOT}},
234 		{0x1, "Parallel port",
235 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
236 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,EOT}},
237 		{0x2, "COM2",
238 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
239 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
240 		{0x3, "COM1",
241 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
242 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
243 		{0x4, "System wake-up control (SWC)",
244 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
245 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}},
246 		{0x5, "Mouse",
247 			{0x30,0x70,0x71,0x74,0x75,EOT},
248 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
249 		{0x6, "Keyboard",
250 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
251 			 EOT},
252 			{0x01,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
253 			 EOT}},
254 		{0x7, "GPIO",
255 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
256 			 EOT},
257 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x00,0x00,
258 			 EOT}},
259 		{0x8, "ACCESS.bus (ACB)",
260 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
261 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,EOT}},
262 		{0x9, "Fan speed control and monitor (FSCM)",
263 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
264 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x00,EOT}},
265 		{0xa, "Watchdog timer",
266 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
267 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x02,EOT}},
268 		{EOT}}},
269 	{0xe5, "PC87365", {	/* SRID[7..0] == chip revision */
270 		{EOT}}},
271 	{0xe8, "PC87363", {
272 		{EOT}}},
273 	{0xe9, "PC87366", {
274 		{NOLDN, NULL,
275 			{0x20,0x21,0x22,0x23,0x24,0x25,0x27,0x28,0x2a,0x2b,
276 			 0x2c,0x2d,0x2e,EOT},
277 			{0xe9,0x11,0x00,0x03,0x00,0x00,NANA,0x00,MISC,MISC,
278 			 0x00,MISC,RSVD,EOT}},
279 		{0x0, "Floppy",
280 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
281 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,EOT}},
282 		{0x1, "Parallel port",
283 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
284 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,EOT}},
285 		{0x2, "COM2",
286 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
287 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
288 		{0x3, "COM1",
289 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
290 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
291 		{0x4, "System wake-up control (SWC)",
292 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
293 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}},
294 		{0x5, "Mouse",
295 			{0x30,0x70,0x71,0x74,0x75,EOT},
296 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
297 		{0x6, "Keyboard",
298 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
299 			 EOT},
300 			{0x01,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
301 			 EOT}},
302 		{0x7, "GPIO",
303 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
304 			 EOT},
305 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x00,0x00,
306 			 EOT}},
307 		{0x8, "ACCESS.bus (ACB)",
308 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
309 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,EOT}},
310 		{0x9, "Fan speed control and monitor (FSCM)",
311 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
312 			 EOT},
313 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x00,0x00,
314 			 EOT}},
315 		{0xa, "Watchdog timer (WDT)",
316 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
317 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x02,EOT}},
318 		{0xb, "Game port",
319 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
320 			{0x00,0x02,0x00,0x00,0x03,0x04,0x04,0x00,EOT}},
321 		{0xc, "MIDI port",
322 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
323 			{0x00,0x03,0x30,0x00,0x03,0x04,0x04,0x00,EOT}},
324 		{0xd, "Voltage level monitor (VLM)",
325 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
326 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}},
327 		{0xe, "Temperature sensor (TMS)",
328 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
329 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}},
330 		{EOT}}},
331 	{0xf4, "PC87382", {
332 		{NOLDN, NULL,
333 			{0x20,0x21,0x22,0x26,0x27,0x29,EOT},
334 			{0xf4,0x11,0x63,0x00,0x00,0x00,EOT}},
335 		{0x02, "IR",
336 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
337 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
338 		{0x03, "COM1",
339 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
340 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
341 		{0x07, "GPIO",
342 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
343 			 0xf2,EOT},
344 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC,
345 			 0x01,EOT}},
346 		{0x19, "Docking LPC switch",
347 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,EOT},
348 			{0x00,0x00,0x00,0x00,0x00,0x04,0x04,EOT}},
349 		{EOT}}},
350 	/* SID[7..0]: family, SRID[7..5]: ID, SRID[4..0]: rev. */
351 	{0xea, "PC8739x", {
352 		{NOLDN, NULL,
353 			{0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
354 			 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
355 			{0xea,0x11,MISC,MISC,MISC,0x80,0x00,NANA,0x00,MISC,
356 			 0x37,RSVD,RSVD,RSVD,RSVD,RSVD,EOT}},
357 		{0x0, "Floppy",
358 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
359 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,EOT}},
360 		{0x1, "Parallel port",
361 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
362 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,EOT}},
363 		{0x2, "COM2 / FIR",
364 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
365 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
366 		{0x3, "COM1",
367 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
368 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
369 		{0x7, "GPIO",
370 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
371 			 EOT},
372 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,0x44,0x01,
373 			 EOT}},
374 		{0xa, "Watchdog timer (WDT)",
375 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
376 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x02,EOT}},
377 		{0xb, "Game port",
378 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
379 			{0x00,0x02,0x01,0x00,0x03,0x04,0x04,0x00,EOT}},
380 		{0xc, "MIDI port",
381 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
382 			{0x00,0x03,0x30,0x00,0x03,0x04,0x04,0x00,EOT}},
383 		{0xf, "X-Bus",
384 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
385 			 0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,EOT},
386 			{0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,0x00,0x00,
387 			 0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
388 		{EOT}}},
389 	{0xec, "PC87591x", {
390 		/* SRID[7..5]: 000=PC87591E, 001=PC87591S, 100=PC87591L */
391 		{EOT}}},
392 	{0xee, "PC8741x", {
393 		/* SRID[7..5] is marked as "not applicable for the PC8741x". */
394 		{NOLDN, NULL,
395 			{0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
396 			 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
397 			{0xee,0x11,0x20,MISC,MISC,MISC,0x00,NANA,0x00,MISC,
398 			 0x00,RSVD,RSVD,RSVD,RSVD,RSVD,EOT}},
399 		{0x0, "Floppy",
400 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
401 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,EOT}},
402 		{0x1, "Parallel port",
403 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
404 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,EOT}},
405 		{0x2, "COM2",
406 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
407 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
408 		{0x3, "COM1",
409 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
410 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
411 		{0x4, "System wake-up control (SWC)",
412 			{0x30,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x70,
413 			 0x71,0x74,0x75,EOT},
414 			{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
415 			 0x03,0x04,0x04,EOT}},
416 		{0x5, "Mouse",
417 			{0x30,0x70,0x71,0x74,0x75,EOT},
418 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
419 		{0x6, "Keyboard",
420 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
421 			 EOT},
422 			{0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
423 			 EOT}},
424 		{0x7, "GPIO",
425 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
426 			 0xf3,EOT},
427 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC,0x01,
428 			 0x00,EOT}},
429 		{0xf, "X-Bus",
430 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
431 			 0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,
432 			 EOT},
433 			{0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,0x00,0x00,
434 			 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
435 			 EOT}},
436 		{0x10, "Real-time clock (RTC)",
437 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
438 			 0xf1,0xf2,0xf3,EOT},
439 			{0x00,0x00,0x70,0x00,0x72,0x08,0x00,0x04,0x04,0x00,
440 			 0x00,0x00,0x00,EOT}},
441 		{EOT}}},
442 	{0xf0, "PC87372", {
443 		{EOT}}},
444 	{0x0f1, "PC8374L", {
445 		{NOLDN, NULL,
446 			{0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26,
447 			 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
448 			{0x00,0x00,0x00,0xf1,0x11,0x00,0x00,0x00,RSVD,0x00,
449 			 MISC,RSVD,0x01,0x2e,RSVD,RSVD,RSVD,RSVD,RSVD,EOT}},
450 		{0x0, "Floppy",
451 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf8,
452 			 EOT},
453 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,0x24,
454 			 EOT}},
455 		{0x1, "Parallel port",
456 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf8,EOT},
457 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,0x07,EOT}},
458 		{0x2, "COM2 / IR",
459 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
460 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
461 		{0x3, "COM1",
462 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
463 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
464 		{0x4, "System wake-up control (SWC)",
465 			{0x30,0x50,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
466 			 EOT},
467 			{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,
468 			 EOT}},
469 		{0x5, "Mouse",
470 			{0x30,0x70,0x71,0x74,0x75,EOT},
471 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
472 		{0x6, "Keyboard",
473 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
474 			 EOT},
475 			{0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
476 			 EOT}},
477 		{0x7, "GPIO",
478 			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
479 			 0xf2,0xf3,0xf8,EOT},
480 			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC,
481 			 0x00,MISC,0x01,EOT}},
482 		{0x8, "Health management",
483 			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
484 			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x05,EOT}},
485 		{EOT}}},
486 	{0x8f1, "WPCD376I", {
487 		/* This is basically a clone/revision of NSC PC8374L. */
488 		{NOLDN, NULL,
489 			{0x10,0x12,0x13,0x20,0x21,0x22,0x23,0x24,0x25,0x26,
490 			 0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,EOT},
491 			{0x00,0x00,0x00,0xf1,0x11,0x00,0x00,0x00,0x06,0x00,
492 			 MISC,RSVD,0x01,0x2e,RSVD,RSVD,RSVD,RSVD,RSVD,EOT}},
493 		{0x0, "Floppy",
494 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf8,
495 			 EOT},
496 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,0x24,
497 			 EOT}},
498 		{0x1, "Parallel port",
499 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf8,EOT},
500 			{0x00,0x02,0x78,0x07,0x02,0x04,0x04,0xf2,0x07,EOT}},
501 		{0x3, "COM1",
502 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
503 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
504 		{0x4, "System wake-up control (SWC)",
505 			{0x30,0x50,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
506 			 EOT},
507 			{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,
508 			 EOT}},
509 		{0x5, "Mouse",
510 			{0x30,0x70,0x71,0x74,0x75,EOT},
511 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
512 		{0x6, "Keyboard",
513 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
514 			 EOT},
515 			{0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
516 			 EOT}},
517 		{0x7, "GPIO",
518 			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
519 			 0xf2,0xf3,0xf8,EOT},
520 			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC,
521 			 0x00,MISC,0x01,EOT}},
522 		{0x15, "ECIR",
523 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,EOT},
524 			{0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,EOT}},
525 		{0x16, "COM3 / IR",
526 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
527 			{0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x02,EOT}},
528 		{EOT}}},
529 	{0xf2, "PC87427", {
530 		/* SRID[7..5] is marked as "not applicable for the PC87427". */
531 		{NOLDN, NULL,
532 			{0x10,0x12,0x13,0x1d,0x20,0x21,0x22,0x23,0x24,0x25,
533 			 0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
534 			 EOT},
535 			{0x00,0x00,0x00,0x00,0xf2,0x11,0xa0,MISC,MISC,MISC,
536 			 0x02,NANA,0x00,MISC,0x00,0x00,MISC,MISC,RSVD,RSVD,
537 			 EOT}},
538 		{0x0, "Floppy",
539 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,EOT},
540 			{0x00,0x03,0xf2,0x06,0x03,0x02,0x04,0x24,0x00,EOT}},
541 		{0x2, "COM2",
542 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
543 			{0x00,0x02,0xf8,0x03,0x03,0x04,0x04,0x02,EOT}},
544 		{0x3, "COM1",
545 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
546 			{0x00,0x03,0xf8,0x04,0x03,0x04,0x04,0x02,EOT}},
547 		{0x4, "System wake-up control (SWC)",
548 			{0x30,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x70,
549 			 0x71,0x74,0x75,EOT},
550 			{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
551 			 0x03,0x04,0x04,EOT}},
552 		{0x5, "Mouse",
553 			{0x30,0x70,0x71,0x74,0x75,EOT},
554 			{0x00,0x0c,0x02,0x04,0x04,EOT}},
555 		{0x6, "Keyboard",
556 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
557 			 EOT},
558 			{0x00,0x00,0x60,0x00,0x64,0x01,0x02,0x04,0x04,0x40,
559 			 EOT}},
560 		{0x7, "GPIO",
561 			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
562 			 0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,EOT},
563 			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,MISC,
564 			 0x01,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
565 		{0x9, "Fan Monitor and Control (FMC)",
566 			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,
567 			 EOT},
568 			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x19,0x06,
569 			 EOT}},
570 		{0xa, "Watchdog timer (WDT)",
571 			{0x30,0x50,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,EOT},
572 			{0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,0x00,EOT}},
573 		{0xf, "X-Bus",
574 			{0x30,0x60,0x61,0x70,0x71,0x74,0x75,0xf0,0xf1,0xf2,
575 			 0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,
576 			 0xfd,0xfe,0xff,EOT},
577 			{0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x00,0x00,0x00,
578 			 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
579 			 0x00,0x80,0x10,EOT}},
580 		{0x10, "Real-time clock (RTC)",
581 			{0x30,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,0xf0,
582 			 0xf1,0xf2,0xf3,0xf6,0xf7,EOT},
583 			{0x00,0x00,0x70,0x00,0x72,0x08,0x00,0x04,0x04,0x00,
584 			 0x00,0x00,0x00,MISC,0x00,EOT}},
585 		{0x14, "Health monitoring and control (HMC)",
586 			{0x30,0x50,0x60,0x61,0x62,0x63,0x70,0x71,0x74,0x75,
587 			 0xf0,EOT},
588 			{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x04,
589 			 0x05,EOT}},
590 		{EOT}}},
591 	{0xf3, "PC87373", {
592 		{EOT}}},
593 	{EOT}
594 };
595 
probe_idregs_nsc(uint16_t port)596 void probe_idregs_nsc(uint16_t port)
597 {
598 	uint8_t id, rev;
599 	uint16_t magic;
600 
601 	probing_for("NSC", "", port);
602 
603 	OUTB(CHIP_ID_REG, port);
604 	if (INB(port) != CHIP_ID_REG) {
605 		if (verbose)
606 			printf(NOTFOUND "port=0x%02x, port+1=0x%02x\n",
607 			       INB(port), INB(port + 1));
608 		return;
609 	}
610 	id = INB(port + 1);
611 
612 	OUTB(CHIP_REV_REG, port);
613 	if (INB(port) != CHIP_REV_REG) {
614 		printf("Warning: Can't get chip revision. Setting to 0xff.\n");
615 		rev = 0xff;
616 	} else {
617 		rev = INB(port + 1);
618 	}
619 
620 	/*
621 	 * NSC PC8374L has ID 0xf1, rev 0b000xxxxx according to datasheet.
622 	 * Winbond WPCD376I has ID 0xf1, rev 0b100xxxxx according to datasheet.
623 	 */
624 	if (id == 0xf1)
625 		magic = ((rev & 0xe0) << 4) | id;
626 	else
627 		magic = id;
628 
629 	if (superio_unknown(reg_table, magic)) {
630 		if (verbose)
631 			printf(NOTFOUND "sid=0x%02x, srid=0x%02x\n", id, rev);
632 		return;
633 	}
634 
635 	printf("Found %s %s (sid=0x%02x, srid=0x%02x) at 0x%x\n",
636 	       magic == 0x8f1 ? "Winbond" : "NSC",
637 	       get_superio_name(reg_table, magic), id, rev, port);
638 	chip_found = 1;
639 
640 	dump_superio(magic == 0x8f1 ? "Winbond" : "NSC",
641 		     reg_table, port, magic, LDN_SEL);
642 }
643 
print_nsc_chips(void)644 void print_nsc_chips(void)
645 {
646 	print_vendor_chips("NSC", reg_table);
647 }
648