summaryrefslogtreecommitdiff
path: root/util/superiotool/nsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/superiotool/nsc.c')
-rw-r--r--util/superiotool/nsc.c64
1 files changed, 39 insertions, 25 deletions
diff --git a/util/superiotool/nsc.c b/util/superiotool/nsc.c
index 0b58642a40..5bc9e9f463 100644
--- a/util/superiotool/nsc.c
+++ b/util/superiotool/nsc.c
@@ -2,6 +2,7 @@
* This file is part of the superiotool project.
*
* Copyright (C) 2006 Ronald Minnich <rminnich@gmail.com>
+ * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,16 +21,23 @@
#include "superiotool.h"
-/* Well, they really thought this through, eh? Family is 8 bits! */
-static const char *familyid[] = {
- [0xf1] = "PC8374 (Winbond/NatSemi)"
+#define CHIP_ID_REG 0x20 /* Super I/O ID (SID) / family */
+#define CHIP_REV_REG 0x27 /* Super I/O revision ID (SRID) */
+
+/* SID[7..0]: chip family. SRID[7..5]: chip ID, SRID[4..0]: chip rev. */
+const static struct superio_registers reg_table[] = {
+ {0xf1, "PC8374L", {
+ {EOT}}},
+ {EOT}
};
-static void dump_readable_ns8374(uint16_t port)
+static void dump_readable_pc8374l(uint16_t port)
{
if (!dump_readable)
return;
+ printf("Human-readable register dump:\n");
+
printf("Enables: 21=%02x, 22=%02x, 23=%02x, 24=%02x, 26=%02x\n",
regval(port, 0x21), regval(port, 0x22), regval(port, 0x23),
regval(port, 0x24), regval(port, 0x26));
@@ -59,34 +67,40 @@ static void dump_readable_ns8374(uint16_t port)
regval(port, 0xf0));
}
-void probe_idregs_simple(uint16_t port)
+void probe_idregs_nsc(uint16_t port)
{
- uint16_t id;
+ uint8_t id, rev;
- outb(0x20, port);
- if (inb(port) != 0x20) {
- no_superio_found("NSC", "", port);
- /* TODO: Exit config mode? */
+ probing_for("NSC", "", port);
+
+ outb(CHIP_ID_REG, port);
+ if (inb(port) != CHIP_ID_REG) {
+ if (verbose)
+ printf(NOTFOUND "port=0x%02x, port+1=0x%02x\n",
+ inb(port), inb(port + 1));
return;
}
id = inb(port + 1);
- printf("Super I/O found at 0x%02x: id = 0x%02x\n", port, id);
- if (id == 0xff)
- return;
+ outb(CHIP_REV_REG, port);
+ if (inb(port) != CHIP_REV_REG) {
+ printf("Warning: Can't get chip revision. Setting to 0xff.\n");
+ rev = 0xff;
+ } else {
+ rev = inb(port + 1);
+ }
- if (familyid[id])
- printf("%s\n", familyid[id]);
- else
- printf("<unknown>\n");
-
- switch (id) {
- case 0xf1:
- dump_readable_ns8374(port);
- break;
- default:
- printf("No dump for 0x%02x\n", id);
- break;
+ if (superio_unknown(reg_table, id)) {
+ if (verbose)
+ printf(NOTFOUND "sid=0x%02x, srid=0x%02x\n", id, rev);
+ return;
}
+
+ printf("Found NSC %s (sid=0x%02x, srid=0x%02x) at 0x%x\n",
+ get_superio_name(reg_table, id), id, rev, port);
+
+ dump_superio("NSC", reg_table, port, id);
+ if (id == 0xf1)
+ dump_readable_pc8374l(port);
}