2 * This file is part of the superiotool project.
4 * Copyright (C) 2006 Ronald Minnich <rminnich@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "superiotool.h"
23 /* Well, they really thought this through, eh? Family is 8 bits! */
24 static const char *familyid[] = {
25 [0xf1] = "PC8374 (Winbond/NatSemi)"
28 static void dump_readable_ns8374(uint16_t port)
33 printf("Enables: 21=%02x, 22=%02x, 23=%02x, 24=%02x, 26=%02x\n",
34 regval(port, 0x21), regval(port, 0x22), regval(port, 0x23),
35 regval(port, 0x24), regval(port, 0x26));
36 printf("SMBUS at %02x\n", regval(port, 0x2a));
38 /* Check COM1. This is all we care about at present. */
39 printf("COM 1 is globally %s\n",
40 regval(port, 0x26) & 8 ? "disabled" : "enabled");
43 regwrite(port, 0x07, 0x03);
44 printf("COM 1 is locally %s\n",
45 regval(port, 0x30) & 1 ? "enabled" : "disabled");
47 ("COM1 60=%02x, 61=%02x, 70=%02x, 71=%02x, 74=%02x, 75=%02x, f0=%02x\n",
48 regval(port, 0x60), regval(port, 0x61), regval(port, 0x70),
49 regval(port, 0x71), regval(port, 0x74), regval(port, 0x75),
53 regwrite(port, 0x07, 0x07);
54 printf("GPIO is %s\n", regval(port, 0x30) & 1 ? "enabled" : "disabled");
56 ("GPIO 60=%02x, 61=%02x, 70=%02x, 71=%02x, 74=%02x, 75=%02x, f0=%02x\n",
57 regval(port, 0x60), regval(port, 0x61), regval(port, 0x70),
58 regval(port, 0x71), regval(port, 0x74), regval(port, 0x75),
62 void probe_idregs_simple(uint16_t port)
67 if (inb(port) != 0x20) {
68 no_superio_found("NSC", "", port);
69 /* TODO: Exit config mode? */
74 printf("Super I/O found at 0x%02x: id = 0x%02x\n", port, id);
79 printf("%s\n", familyid[id]);
81 printf("<unknown>\n");
85 dump_readable_ns8374(port);
88 printf("No dump for 0x%02x\n", id);