2 * This file is part of the LinuxBIOS project.
4 * Copyright (C) 2006 Ronald Minnich <rminnich@gmail.com>
5 * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
6 * Copyright (C) 2007 Carl-Daniel Hailfinger
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "superiotool.h"
25 unsigned char regval(unsigned short port, unsigned char reg)
31 void regwrite(unsigned short port, unsigned char reg, unsigned char val)
37 void dump_superio(const char *name, const struct superio_registers reg_table[],
38 unsigned short port, unsigned short id)
45 for (i = 0; /* Nothing */; i++) {
46 if (reg_table[i].superio_id == EOT)
49 if ((unsigned short)reg_table[i].superio_id != id)
52 printf("%s\n", reg_table[i].name);
55 if (reg_table[i].ldn[j].ldn == EOT)
58 if (reg_table[i].ldn[j].ldn != NOLDN) {
59 printf("Switching to LDN 0x%01x\n",
60 reg_table[i].ldn[j].ldn);
62 reg_table[i].ldn[j].ldn);
65 idx = reg_table[i].ldn[j].idx;
71 printf("%02x ", idx[k]);
78 printf("%02x ", regval(port, idx[k]));
82 idx = reg_table[i].ldn[j].def;
86 else if (idx[k] == NANA)
88 else if (idx[k] == RSVD)
91 printf("%02x ", idx[k]);
98 int main(int argc, char *argv[])
105 probe_idregs_simple(0x2e);
106 probe_idregs_simple(0x4e);
108 probe_idregs_fintek(0x2e);
109 probe_idregs_fintek(0x4e);
111 probe_idregs_ite(0x2e);
112 probe_idregs_ite(0x4e);
114 probe_idregs_smsc(0x3f0);
115 probe_idregs_smsc(0x370);