2 * This file is part of the superiotool project.
4 * Copyright (C) 2006 Ronald Minnich <rminnich@gmail.com>
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
22 #include "superiotool.h"
24 #define CHIP_ID_REG 0x20 /* Super I/O ID (SID) / family */
25 #define CHIP_REV_REG 0x27 /* Super I/O revision ID (SRID) */
27 /* SID[7..0]: chip family. SRID[7..5]: chip ID, SRID[4..0]: chip rev. */
28 const static struct superio_registers reg_table[] = {
34 static void dump_readable_pc8374l(uint16_t port)
39 printf("Human-readable register dump:\n");
41 printf("Enables: 21=%02x, 22=%02x, 23=%02x, 24=%02x, 26=%02x\n",
42 regval(port, 0x21), regval(port, 0x22), regval(port, 0x23),
43 regval(port, 0x24), regval(port, 0x26));
44 printf("SMBUS at %02x\n", regval(port, 0x2a));
46 /* Check COM1. This is all we care about at present. */
47 printf("COM 1 is globally %s\n",
48 regval(port, 0x26) & 8 ? "disabled" : "enabled");
51 regwrite(port, 0x07, 0x03);
52 printf("COM 1 is locally %s\n",
53 regval(port, 0x30) & 1 ? "enabled" : "disabled");
55 ("COM1 60=%02x, 61=%02x, 70=%02x, 71=%02x, 74=%02x, 75=%02x, f0=%02x\n",
56 regval(port, 0x60), regval(port, 0x61), regval(port, 0x70),
57 regval(port, 0x71), regval(port, 0x74), regval(port, 0x75),
61 regwrite(port, 0x07, 0x07);
62 printf("GPIO is %s\n", regval(port, 0x30) & 1 ? "enabled" : "disabled");
64 ("GPIO 60=%02x, 61=%02x, 70=%02x, 71=%02x, 74=%02x, 75=%02x, f0=%02x\n",
65 regval(port, 0x60), regval(port, 0x61), regval(port, 0x70),
66 regval(port, 0x71), regval(port, 0x74), regval(port, 0x75),
70 void probe_idregs_nsc(uint16_t port)
74 probing_for("NSC", "", port);
76 outb(CHIP_ID_REG, port);
77 if (inb(port) != CHIP_ID_REG) {
79 printf(NOTFOUND "port=0x%02x, port+1=0x%02x\n",
80 inb(port), inb(port + 1));
85 outb(CHIP_REV_REG, port);
86 if (inb(port) != CHIP_REV_REG) {
87 printf("Warning: Can't get chip revision. Setting to 0xff.\n");
93 if (superio_unknown(reg_table, id)) {
95 printf(NOTFOUND "sid=0x%02x, srid=0x%02x\n", id, rev);
99 printf("Found NSC %s (sid=0x%02x, srid=0x%02x) at 0x%x\n",
100 get_superio_name(reg_table, id), id, rev, port);
102 dump_superio("NSC", reg_table, port, id);
104 dump_readable_pc8374l(port);