diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2007-09-19 01:55:35 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2007-09-19 01:55:35 +0000 |
commit | 3acf31e4eaa0f143cd8af10f5ce99523ddc53a03 (patch) | |
tree | 1698c59c50c3291bed158fb47b0ebbe729b0b7b8 /util/superiotool/smsc.c | |
parent | 3ef9b740dea1044713b667829cb9c4e2a48785b0 (diff) |
Further code simplifications and improvements.
Add command line option handling code. The following options
are defined at the moment:
-d|--dump Dump Super I/O registers.
-V|--verbose Verbose mode.
-v|--version Show the superiotool version.
-h|--help Show a short help text.
Per default (no options) we just probe for a Super I/O
and print its vendor, name, ID, version, and config port.
Example:
$ ./superiotool
Found SMSC FDC37N769 Super I/O (id=0x28, rev=0x01) at port=0x03f0
$ ./superiotool -d
Found SMSC FDC37N769 Super I/O (id=0x28, rev=0x01) at port=0x03f0
idx 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
val 20 90 80 f4 00 00 ff 00 00 00 40 00 0e 28 01 00 00 00 00 00 02 00 01 03 00 00 00 00 00 00 80 00 00 00 00 00 00 ba 00 00 03 00 00 23 03 03 00 00
def 28 9c 88 70 00 00 ff 00 00 00 00 00 02 28 NA 00 00 80 RR RR NA NA NA 03 RR RR RR RR RR RR 80 00 3c RR RR 00 00 00 00 00 00 00 RR 00 00 03 00 00
$ ./superiotool -s
./superiotool: invalid option -- s
$ ./superiotool -h
Usage: superiotool [-d] [-V] [-v] [-h]
$ ./superiotool -v
superiotool 0.1
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2788 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/superiotool/smsc.c')
-rw-r--r-- | util/superiotool/smsc.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/util/superiotool/smsc.c b/util/superiotool/smsc.c index e583471bac..acbb4773b0 100644 --- a/util/superiotool/smsc.c +++ b/util/superiotool/smsc.c @@ -40,29 +40,16 @@ const static struct superio_registers reg_table[] = { {EOT} }; -void enter_conf_mode_smsc(uint16_t port) +static void enter_conf_mode_smsc(uint16_t port) { outb(0x55, port); } -void exit_conf_mode_smsc(uint16_t port) +static void exit_conf_mode_smsc(uint16_t port) { outb(0xaa, port); } -/* Note: The actual SMSC ID is 16 bits, but we must pass 32 bits here. */ -void dump_smsc(uint16_t port, uint16_t id) -{ - switch (id) { - case 0x28: - dump_superio("SMSC", reg_table, port, id); - break; - default: - printf("Unknown SMSC chip, id=0x%02x\n", id); - break; - } -} - void probe_idregs_smsc(uint16_t port) { uint16_t id, rev; @@ -72,20 +59,18 @@ void probe_idregs_smsc(uint16_t port) /* Read device ID. */ id = regval(port, DEVICE_ID_REG); if (id != 0x28) { /* TODO: Support for other SMSC chips. */ - if (inb(port) != 0xff) - printf("No Super I/O chip found at 0x%04x\n", port); - else - printf("Probing 0x%04x, failed (0x%02x), data returns 0x%02x\n", port, inb(port), inb(port + 1)); + no_superio_found(port); return; } /* Read chip revision. */ rev = regval(port, DEVICE_REV_REG); - printf("Super I/O found at 0x%04x: id=0x%02x, rev=0x%02x\n", - port, id, rev); + printf("Found SMSC %s Super I/O (id=0x%02x, rev=0x%02x) at port=0x%04x\n", + get_superio_name(reg_table, id), id, rev, port); - dump_smsc(port, id ); + if (dump) + dump_superio("SMSC", reg_table, port, id); exit_conf_mode_smsc(port); } |