summaryrefslogtreecommitdiff
path: root/util/superiotool/smsc.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2007-09-19 00:48:42 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2007-09-19 00:48:42 +0000
commit25a6c0f18ce8f2db4483fa8e65a5f5aa5042d958 (patch)
tree8ada258f72d569774a4acbe18fd55857e6c63002 /util/superiotool/smsc.c
parentc73ea4d4fc86a0e3a3c42bec45942e0354dae171 (diff)
downloadcoreboot-25a6c0f18ce8f2db4483fa8e65a5f5aa5042d958.tar.xz
Split out enter_conf_mode_*()/exit_conf_mode_() functions, we'll soon need
them. Reduce code duplication a bit by improved 'no dump available' handling. 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@2785 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/superiotool/smsc.c')
-rw-r--r--util/superiotool/smsc.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/util/superiotool/smsc.c b/util/superiotool/smsc.c
index 7636001bc1..e583471bac 100644
--- a/util/superiotool/smsc.c
+++ b/util/superiotool/smsc.c
@@ -40,6 +40,16 @@ const static struct superio_registers reg_table[] = {
{EOT}
};
+void enter_conf_mode_smsc(uint16_t port)
+{
+ outb(0x55, port);
+}
+
+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)
{
@@ -57,7 +67,7 @@ void probe_idregs_smsc(uint16_t port)
{
uint16_t id, rev;
- outb(0x55, port); /* Enter configuration mode. */
+ enter_conf_mode_smsc(port);
/* Read device ID. */
id = regval(port, DEVICE_ID_REG);
@@ -75,15 +85,8 @@ void probe_idregs_smsc(uint16_t port)
printf("Super I/O found at 0x%04x: id=0x%02x, rev=0x%02x\n",
port, id, rev);
- switch (id) {
- case 0x28:
- dump_smsc(port, id);
- break;
- default:
- printf("No dump for ID 0x%04x\n", id);
- break;
- }
+ dump_smsc(port, id );
- outb(0xaa, port); /* Exit configuration mode. */
+ exit_conf_mode_smsc(port);
}