This patch changes the --verbose output to make it a lot more useful and (hopefully) a bit better readable. Also fix up the NSC code to behave like the rest of superiotool.
Various other changes (see patch) which are sort of interleaved, it would be overkill (and not useful) to extract them into an extra patch, IMO. Tested on various computers (both building and runnning). Example output: $ ./superiotool -V superiotool r2815 Probing for ALi Super I/O at 0x3f0... Failed. Returned data: id=0xffff, rev=0xff Probing for ALi Super I/O at 0x370... Failed. Returned data: id=0xffff, rev=0xff Probing for NSC Super I/O at 0x2e... Failed. Returned data: port=0xff, port+1=0xff Probing for NSC Super I/O at 0x4e... Failed. Returned data: port=0xff, port+1=0xff Probing for Fintek Super I/O at 0x2e... Failed. Returned data: vid=0xffff, id=0xffff Probing for Fintek Super I/O at 0x4e... Failed. Returned data: vid=0xffff, id=0xffff Probing for ITE Super I/O (init=0x87,0x01,0x55,0x55/0xaa) at 0x2e... Failed. Returned data: id=0x0000, rev=0x0 Probing for ITE Super I/O (init=0x87,0x87) at 0x2e... Failed. Returned data: id=0x0000, rev=0x0 Probing for ITE Super I/O (init=0x87,0x01,0x55,0x55/0xaa) at 0x4e... Failed. Returned data: id=0xffff, rev=0xf Probing for ITE Super I/O (init=0x87,0x87) at 0x4e... Failed. Returned data: id=0xffff, rev=0xf Probing for SMSC Super I/O (idregs=0x20/0x21) at 0x2e... Failed. Returned data: id=0x00, rev=0x00 Probing for SMSC Super I/O (idregs=0x0d/0x0e) at 0x2e... Failed. Returned data: id=0x7a, rev=0x00 Probing for SMSC Super I/O (idregs=0x20/0x21) at 0x4e... Failed. Returned data: id=0xff, rev=0xff Probing for SMSC Super I/O (idregs=0x0d/0x0e) at 0x4e... Failed. Returned data: id=0xff, rev=0xff Probing for SMSC Super I/O (idregs=0x20/0x21) at 0x3f0... Failed. Returned data: id=0xff, rev=0xff Probing for SMSC Super I/O (idregs=0x0d/0x0e) at 0x3f0... Failed. Returned data: id=0xff, rev=0xff Probing for SMSC Super I/O (idregs=0x20/0x21) at 0x370... Failed. Returned data: id=0xff, rev=0xff Probing for SMSC Super I/O (idregs=0x0d/0x0e) at 0x370... Failed. Returned data: id=0xff, rev=0xff Probing for Winbond Super I/O (init=0x88) at 0x2e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x89) at 0x2e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x86,0x86) at 0x2e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x87,0x87) at 0x2e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x88) at 0x4e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x89) at 0x4e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x86,0x86) at 0x4e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x87,0x87) at 0x4e... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x88) at 0x3f0... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x89) at 0x3f0... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x86,0x86) at 0x3f0... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x87,0x87) at 0x3f0... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x88) at 0x370... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x89) at 0x370... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x86,0x86) at 0x370... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x87,0x87) at 0x370... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x88) at 0x250... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x89) at 0x250... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x86,0x86) at 0x250... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Probing for Winbond Super I/O (init=0x87,0x87) at 0x250... Failed. Returned data: id/oldid=0xff/0x0f, rev=0xff Uwe. -- http://www.hermann-uwe.de | http://www.holsham-traders.de http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
* 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 <[EMAIL PROTECTED]>
Index: fintek.c
===================================================================
--- fintek.c (Revision 2819)
+++ fintek.c (Arbeitskopie)
@@ -136,6 +136,8 @@
{
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 @@
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);
Index: winbond.c
===================================================================
--- winbond.c (Revision 2819)
+++ winbond.c (Arbeitskopie)
@@ -184,9 +184,11 @@
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 @@
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;
}
Index: ite.c
===================================================================
--- ite.c (Revision 2819)
+++ ite.c (Arbeitskopie)
@@ -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 @@
{
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);
Index: nsc.c
===================================================================
--- nsc.c (Revision 2819)
+++ nsc.c (Arbeitskopie)
@@ -2,6 +2,7 @@
* This file is part of the superiotool project.
*
* Copyright (C) 2006 Ronald Minnich <[EMAIL PROTECTED]>
+ * Copyright (C) 2007 Uwe Hermann <[EMAIL PROTECTED]>
*
* 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 @@
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)
+ 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 (superio_unknown(reg_table, id)) {
+ if (verbose)
+ printf(NOTFOUND "sid=0x%02x, srid=0x%02x\n", id, rev);
return;
+ }
- if (familyid[id])
- printf("%s\n", familyid[id]);
- else
- printf("<unknown>\n");
+ printf("Found NSC %s (sid=0x%02x, srid=0x%02x) at 0x%x\n",
+ get_superio_name(reg_table, id), id, rev, port);
- switch (id) {
- case 0xf1:
- dump_readable_ns8374(port);
- break;
- default:
- printf("No dump for 0x%02x\n", id);
- break;
- }
+ dump_superio("NSC", reg_table, port, id);
+ if (id == 0xf1)
+ dump_readable_pc8374l(port);
}
Index: superiotool.c
===================================================================
--- superiotool.c (Revision 2819)
+++ superiotool.c (Arbeitskopie)
@@ -155,18 +155,14 @@
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)
Index: smsc.c
===================================================================
--- smsc.c (Revision 2819)
+++ smsc.c (Arbeitskopie)
@@ -133,19 +133,24 @@
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);
id = regval(port, 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);
Index: ali.c
===================================================================
--- ali.c (Revision 2819)
+++ ali.c (Arbeitskopie)
@@ -72,6 +72,8 @@
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 @@
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;
}
Index: superiotool.h
===================================================================
--- superiotool.h (Revision 2819)
+++ superiotool.h (Arbeitskopie)
@@ -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 @@
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_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 @@
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}},
signature.asc
Description: Digital signature
-- linuxbios mailing list [email protected] http://www.linuxbios.org/mailman/listinfo/linuxbios
