2 * This file is part of the LinuxBIOS project.
4 * Copyright (C) 2007 Carl-Daniel Hailfinger
5 * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
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.
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.
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
32 #define SUPERIOTOOL_VERSION "0.1"
34 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
36 #define EOT -1 /* End Of Table */
37 #define NOLDN -2 /* NO LDN needed */
38 #define NANA -3 /* Not Available */
39 #define RSVD -4 /* Reserved */
40 #define MISC -5 /* Needs special comment in output */
41 #define MAXNAMELEN 20 /* Maximum Name Length */
42 #define MAXLDN 0xa /* Biggest LDN */
43 #define LDNSIZE (MAXLDN + 3) /* Biggest LDN + 0 + NOLDN + EOT */
44 #define MAXNUMIDX 70 /* Maximum number of indexes */
45 #define IDXSIZE (MAXNUMIDX + 1)
46 #define MAXNUMPORTS (2 + 1) /* Maximum number of Super I/O ports */
48 /* Command line parameters. */
49 extern int dump, verbose;
51 struct superio_registers {
52 int32_t superio_id; /* Signed, as we need EOT. */
53 const char name[MAXNAMELEN];
62 uint8_t regval(uint16_t port, uint8_t reg);
63 void regwrite(uint16_t port, uint8_t reg, uint8_t val);
64 int superio_unknown(const struct superio_registers reg_table[], uint16_t id);
65 const char *get_superio_name(const struct superio_registers reg_table[],
67 void dump_superio(const char *name, const struct superio_registers reg_table[],
68 uint16_t port, uint16_t id);
69 void no_superio_found(uint16_t port);
72 void dump_fintek(uint16_t port, uint16_t did);
73 void probe_idregs_fintek(uint16_t port);
76 void dump_ite(uint16_t port, uint16_t id);
77 void probe_idregs_ite(uint16_t port);
80 void dump_ns8374(uint16_t port);
81 void probe_idregs_simple(uint16_t port);
84 void probe_idregs_smsc(uint16_t port);
87 void probe_idregs_winbond(uint16_t port);
89 /** Table of which config ports to probe on each Super I/O. */
91 void (*probe_idregs) (uint16_t port);
92 int ports[MAXNUMPORTS]; /* Signed, as we need EOT. */
93 } superio_ports_table[] = {
94 {probe_idregs_simple, {0x2e, 0x4e, EOT}},
95 {probe_idregs_fintek, {0x2e, 0x4e, EOT}},
96 {probe_idregs_ite, {0x2e, 0x4e, EOT}},
97 {probe_idregs_smsc, {0x3f0, 0x370, EOT}},
98 {probe_idregs_winbond, {0x2e, 0x4e, EOT}},