summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/superiotool/ali.c5
-rw-r--r--util/superiotool/fintek.c7
-rw-r--r--util/superiotool/ite.c8
-rw-r--r--util/superiotool/nsc.c64
-rw-r--r--util/superiotool/smsc.c9
-rw-r--r--util/superiotool/superiotool.c12
-rw-r--r--util/superiotool/superiotool.h8
-rw-r--r--util/superiotool/winbond.c8
8 files changed, 76 insertions, 45 deletions
diff --git a/util/superiotool/ali.c b/util/superiotool/ali.c
index 99dd00f694..e8bf36c577 100644
--- a/util/superiotool/ali.c
+++ b/util/superiotool/ali.c
@@ -72,6 +72,8 @@ void probe_idregs_ali(uint16_t port)
uint16_t id;
uint8_t rev;
+ probing_for("ALi", "", port);
+
enter_conf_mode_ali(port);
id = regval(port, DEVICE_ID_BYTE1_REG) << 8;
@@ -79,7 +81,8 @@ void probe_idregs_ali(uint16_t port)
rev = regval(port, DEVICE_REV_REG);
if (superio_unknown(reg_table, id)) {
- no_superio_found("ALi", "", port);
+ if (verbose)
+ printf(NOTFOUND "id=0x%04x, rev=0x%02x\n", id, rev);
exit_conf_mode_ali(port);
return;
}
diff --git a/util/superiotool/fintek.c b/util/superiotool/fintek.c
index 757d01c020..2fe8cb3747 100644
--- a/util/superiotool/fintek.c
+++ b/util/superiotool/fintek.c
@@ -136,6 +136,8 @@ void probe_idregs_fintek(uint16_t port)
{
uint16_t vid, did;
+ probing_for("Fintek", "", port);
+
enter_conf_mode_winbond_fintek_ite_8787(port);
did = regval(port, DEVICE_ID_BYTE1_REG);
@@ -145,12 +147,13 @@ void probe_idregs_fintek(uint16_t port)
vid |= (regval(port, VENDOR_ID_BYTE2_REG) << 8);
if (vid != FINTEK_VENDOR_ID || superio_unknown(reg_table, did)) {
- no_superio_found("Fintek", "", port);
+ if (verbose)
+ printf(NOTFOUND "vid=0x%04x, id=0x%04x\n", vid, did);
exit_conf_mode_winbond_fintek_ite_8787(port);
return;
}
- printf("Found Fintek %s (vid=0x%04x, id=0x%04x) at port=0x%x\n",
+ printf("Found Fintek %s (vid=0x%04x, id=0x%04x) at 0x%x\n",
get_superio_name(reg_table, did), vid, did, port);
dump_superio("Fintek", reg_table, port, did);
diff --git a/util/superiotool/ite.c b/util/superiotool/ite.c
index e44460c065..4d3537f7d1 100644
--- a/util/superiotool/ite.c
+++ b/util/superiotool/ite.c
@@ -23,6 +23,7 @@
#define CHIP_ID_BYTE1_REG 0x20
#define CHIP_ID_BYTE2_REG 0x21
+
#define CHIP_VERSION_REG 0x22
/* Note: IT8726F has ID 0x8726 (datasheet wrongly says 0x8716). */
@@ -265,17 +266,20 @@ static void probe_idregs_ite_helper(const char *init, uint16_t port)
{
uint16_t id, chipver;
+ probing_for("ITE", init, port);
+
id = regval(port, CHIP_ID_BYTE1_REG) << 8;
id |= regval(port, CHIP_ID_BYTE2_REG);
chipver = regval(port, CHIP_VERSION_REG) & 0x0f; /* Only bits 3..0 */
if (superio_unknown(reg_table, id)) {
- no_superio_found("ITE", init, port);
+ if (verbose)
+ printf(NOTFOUND "id=0x%04x, rev=0x%01x\n", id, chipver);
exit_conf_mode_ite(port);
return;
}
- printf("Found ITE %s (id=0x%04x, rev=0x%01x) at port=0x%x\n",
+ printf("Found ITE %s (id=0x%04x, rev=0x%01x) at 0x%x\n",
get_superio_name(reg_table, id), id, chipver, port);
dump_superio("ITE", reg_table, port, id);
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);
}
diff --git a/util/superiotool/smsc.c b/util/superiotool/smsc.c
index a6f2749710..6103d9f228 100644
--- a/util/superiotool/smsc.c
+++ b/util/superiotool/smsc.c
@@ -133,6 +133,10 @@ static void probe_idregs_smsc_helper(uint16_t port, uint8_t idreg,
uint8_t revreg)
{
uint8_t id, rev;
+ const char *info = (idreg == 0x20) ? "(idregs=0x20/0x21) "
+ : "(idregs=0x0d/0x0e) ";
+
+ probing_for("SMSC", info, port);
enter_conf_mode_smsc(port);
@@ -140,12 +144,13 @@ static void probe_idregs_smsc_helper(uint16_t port, uint8_t idreg,
rev = regval(port, revreg);
if (superio_unknown(reg_table, id)) {
- no_superio_found("SMSC", "", port);
+ if (verbose)
+ printf(NOTFOUND "id=0x%02x, rev=0x%02x\n", id, rev);
exit_conf_mode_smsc(port);
return;
}
- printf("Found %s %s (id=0x%02x, rev=0x%02x) at port=0x%x\n",
+ printf("Found %s %s (id=0x%02x, rev=0x%02x) at 0x%x\n",
(id == 0x77 ? "ASUS" : "SMSC"), get_superio_name(reg_table, id),
id, rev, port);
diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c
index d9d2bb8192..6771996091 100644
--- a/util/superiotool/superiotool.c
+++ b/util/superiotool/superiotool.c
@@ -155,18 +155,14 @@ void dump_superio_readable(uint16_t port)
printf("No human-readable dump available for this Super I/O\n");
}
-void no_superio_found(const char *vendor, const char *info, uint16_t port)
+void probing_for(const char *vendor, const char *info, uint16_t port)
{
if (!verbose)
return;
- if (inb(port) == 0xff)
- /* Yes, there's no space between '%s' and 'at'! */
- printf("Probing for %s Super I/O %sat 0x%x... failed\n",
- vendor, info, port);
- else
- printf("Probing 0x%x, failed (0x%02x), data returns 0x%02x\n",
- port, inb(port), inb(port + 1));
+ /* Yes, there's no space between '%s' and 'at'! */
+ printf("Probing for %s Super I/O %sat 0x%x...\n",
+ vendor, info, port);
}
static void print_version(void)
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h
index 9c9e55a238..a3dab52ccb 100644
--- a/util/superiotool/superiotool.h
+++ b/util/superiotool/superiotool.h
@@ -40,6 +40,8 @@
Per default (no options) superiotool will just probe for a Super I/O\n\
and print its vendor, name, ID, revision, and config port.\n"
+#define NOTFOUND " Failed. Returned data: "
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define EOT -1 /* End Of Table */
@@ -79,7 +81,7 @@ const char *get_superio_name(const struct superio_registers reg_table[],
void dump_superio(const char *name, const struct superio_registers reg_table[],
uint16_t port, uint16_t id);
void dump_superio_readable(uint16_t port);
-void no_superio_found(const char *vendor, const char *info, uint16_t port);
+void probing_for(const char *vendor, const char *info, uint16_t port);
/* ali.c */
void probe_idregs_ali(uint16_t port);
@@ -91,7 +93,7 @@ void probe_idregs_fintek(uint16_t port);
void probe_idregs_ite(uint16_t port);
/* nsc.c */
-void probe_idregs_simple(uint16_t port);
+void probe_idregs_nsc(uint16_t port);
/* smsc.c */
void probe_idregs_smsc(uint16_t port);
@@ -105,7 +107,7 @@ const static struct {
int ports[MAXNUMPORTS]; /* Signed, as we need EOT. */
} superio_ports_table[] = {
{probe_idregs_ali, {0x3f0, 0x370, EOT}},
- {probe_idregs_simple, {0x2e, 0x4e, EOT}},
+ {probe_idregs_nsc, {0x2e, 0x4e, EOT}},
{probe_idregs_fintek, {0x2e, 0x4e, EOT}},
{probe_idregs_ite, {0x2e, 0x4e, EOT}},
{probe_idregs_smsc, {0x2e, 0x4e, 0x3f0, 0x370, EOT}},
diff --git a/util/superiotool/winbond.c b/util/superiotool/winbond.c
index f45acb7873..23f9fdcf47 100644
--- a/util/superiotool/winbond.c
+++ b/util/superiotool/winbond.c
@@ -184,9 +184,11 @@ void probe_idregs_winbond_helper(const char *init, uint16_t port)
uint16_t id;
uint8_t devid, rev, olddevid;
+ probing_for("Winbond", init, port);
+
devid = regval(port, DEVICE_ID_REG);
rev = regval(port, DEVICE_REV_REG);
- olddevid = regval(port, DEVICE_ID_REG_OLD);
+ olddevid = regval(port, DEVICE_ID_REG_OLD) & 0x0f;
if (devid == 0x52)
id = devid; /* ID only */
@@ -199,7 +201,9 @@ void probe_idregs_winbond_helper(const char *init, uint16_t port)
id = olddevid & 0x0f; /* ID[3..0] */
if (superio_unknown(reg_table, id)) {
- no_superio_found("Winbond", init, port);
+ if (verbose)
+ printf(NOTFOUND "id/oldid=0x%02x/0x%02x, rev=0x%02x\n",
+ devid, olddevid, rev);
exit_conf_mode_winbond_fintek_ite_8787(port);
return;
}