aboutsummaryrefslogtreecommitdiff
path: root/util/superiotool/nsc.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2007-10-04 15:23:38 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2007-10-04 15:23:38 +0000
commit8b8d03974e11edbdbbd61c6b22d8013dca87be71 (patch)
tree2c7e18481a98fffb59960609f9c74b50d5d273a4 /util/superiotool/nsc.c
parent573ff508ab3d61ede76cd3b68aaaf7f2bdcfa34a (diff)
* Convert the NSC code to the common code structure all other Super I/Os use.
* Improve the --verbose output a bit more. Print the "Probing..." text for all Super I/Os and if a Super I/O is not known, show the data we were able to read from the chip (what data this is is very vendor/chip specific). * Thus the common no_superio_found() is dropped, it's not useful. The "read from 0x20" part was wrong for all Super I/Os other than the NSC ones anyway. * Winbond: For the 'olddevid' only use bits 3..0, mask away the others. * SMSC: Print which ID registers we try to read (in --verbose mode). * Minor cosmetic fixes. * Rename PC8374 to PC8374L (as per datasheet). * Rename probe_idregs_simple() to probe_idregs_nsc(). * Rename dump_readable_ns8374() to dump_readable_pc8374l(). Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2821 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
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);
}