summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2007-09-20 23:37:56 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2007-09-20 23:37:56 +0000
commitb4db2209f9e01e1a013cc33356bceec57c3a3c80 (patch)
treeefd43f13e63088323dcbbffc9f431c692f3cd819 /util
parent0702469f163e69257a7cf079eb40ae99f53c815b (diff)
downloadcoreboot-b4db2209f9e01e1a013cc33356bceec57c3a3c80.tar.xz
Decouple the ITE code from fintek.c, it doesn't belong there.
Add common 'enter configuration mode' function for most Winbond/Fintek/ITE chips which use the 0x87 0x87 sequence for that reason. 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@2794 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util')
-rw-r--r--util/superiotool/fintek.c52
-rw-r--r--util/superiotool/ite.c13
-rw-r--r--util/superiotool/superiotool.c12
-rw-r--r--util/superiotool/superiotool.h2
-rw-r--r--util/superiotool/winbond.c17
5 files changed, 35 insertions, 61 deletions
diff --git a/util/superiotool/fintek.c b/util/superiotool/fintek.c
index e2f9c2772f..a95a38354f 100644
--- a/util/superiotool/fintek.c
+++ b/util/superiotool/fintek.c
@@ -102,68 +102,32 @@ void dump_fintek(uint16_t port, uint16_t did)
regval(port, 0xf6), regval(port, 0xf7), regval(port, 0xf8));
}
-static void enter_conf_mode_fintek(uint16_t port)
-{
- /* Enable configuration sequence (Fintek uses this for example)
- * Older ITE chips have the same enable sequence.
- */
- outb(0x87, port);
- outb(0x87, port);
-}
-
-static void exit_conf_mode_fintek(uint16_t port)
-{
- /* Exit MB PnP mode (for Fintek, doesn't hurt ITE). */
- outb(0xaa, port);
-}
-
void probe_idregs_fintek(uint16_t port)
{
- uint16_t vid, did, did_ite, success = 0;
+ uint16_t vid, did;
- enter_conf_mode_fintek(port);
+ enter_conf_mode_winbond_fintek_ite_8787(port);
did = regval(port, DEVICE_ID_BYTE1_REG);
did |= (regval(port, DEVICE_ID_BYTE2_REG) << 8);
- did_ite = ((did & 0xff) << 8) | ((did & 0xff00) >> 8);
vid = regval(port, VENDOR_ID_BYTE1_REG);
vid |= (regval(port, VENDOR_ID_BYTE2_REG) << 8);
- /* FIXME */
- if (vid != 0x3419 && did_ite != 0x8708 && did_ite != 0x8710) {
+ if (vid != 0x3419) {
no_superio_found(port);
- exit_conf_mode_fintek(port);
- return;
- }
-
- if (did_ite == 0x8708 || did_ite == 0x8701) {
- printf("Found ITE IT%04xF (id=0x%04x, rev=0x%01x) at port=0x%x\n", did_ite, did_ite, 0, port); /* FIXME */
- dump_ite(port, did_ite);
- regwrite(port, 0x02, 0x02); /* FIXME */
- return;
- }
-
- if (vid == 0xff || vid == 0xffff) {
- exit_conf_mode_fintek(port);
+ exit_conf_mode_winbond_fintek_ite_8787(port);
return;
}
printf("Found Fintek %s (vid=0x%04x, id=0x%04x) at port=0x%x\n",
get_superio_name(reg_table, did), vid, did, port);
- switch (vid) {
- case 0x3419:
- success = 1;
- dump_fintek(port, did);
- break;
- default:
- break;
- }
+ dump_superio("Fintek", reg_table, port, did);
- if (!success)
- printf("No dump for vid 0x%04x, did 0x%04x\n", vid, did);
+ /* TODO: Revive this as --dump-human-readable output. */
+ /* dump_fintek(port, did); */
- exit_conf_mode_fintek(port);
+ exit_conf_mode_winbond_fintek_ite_8787(port);
}
diff --git a/util/superiotool/ite.c b/util/superiotool/ite.c
index 610516a980..1a65e2cff2 100644
--- a/util/superiotool/ite.c
+++ b/util/superiotool/ite.c
@@ -226,12 +226,10 @@ static void exit_conf_mode_ite(uint16_t port)
regwrite(port, 0x02, 0x02);
}
-void probe_idregs_ite(uint16_t port)
+static void probe_idregs_ite_helper(uint16_t port)
{
uint16_t id, chipver;
- enter_conf_mode_ite(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 */
@@ -246,7 +244,16 @@ void probe_idregs_ite(uint16_t port)
get_superio_name(reg_table, id), id, chipver, port);
dump_superio("ITE", reg_table, port, id);
+}
+void probe_idregs_ite(uint16_t port)
+{
+ enter_conf_mode_ite(port);
+ probe_idregs_ite_helper(port);
exit_conf_mode_ite(port);
+
+ enter_conf_mode_winbond_fintek_ite_8787(port);
+ probe_idregs_ite_helper(port);
+ exit_conf_mode_winbond_fintek_ite_8787(port);
}
diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c
index 8aea0a02d9..0a253ad623 100644
--- a/util/superiotool/superiotool.c
+++ b/util/superiotool/superiotool.c
@@ -37,6 +37,18 @@ void regwrite(uint16_t port, uint8_t reg, uint8_t val)
outb(val, port + 1);
}
+void enter_conf_mode_winbond_fintek_ite_8787(uint16_t port)
+{
+ outb(0x87, port);
+ outb(0x87, port);
+}
+
+void exit_conf_mode_winbond_fintek_ite_8787(uint16_t port)
+{
+ outb(0xaa, port); /* Fintek, Winbond */
+ regwrite(port, 0x02, 0x02); /* ITE */
+}
+
int superio_unknown(const struct superio_registers reg_table[], uint16_t id)
{
return !strncmp(get_superio_name(reg_table, id), "<unknown>", 9);
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h
index b0d12cd0dd..9b82b4cf9d 100644
--- a/util/superiotool/superiotool.h
+++ b/util/superiotool/superiotool.h
@@ -70,6 +70,8 @@ struct superio_registers {
/* superiotool.c */
uint8_t regval(uint16_t port, uint8_t reg);
void regwrite(uint16_t port, uint8_t reg, uint8_t val);
+void enter_conf_mode_winbond_fintek_ite_8787(uint16_t port);
+void exit_conf_mode_winbond_fintek_ite_8787(uint16_t port);
int superio_unknown(const struct superio_registers reg_table[], uint16_t id);
const char *get_superio_name(const struct superio_registers reg_table[],
uint16_t id);
diff --git a/util/superiotool/winbond.c b/util/superiotool/winbond.c
index ca2d1db4bc..0e8f2b86f8 100644
--- a/util/superiotool/winbond.c
+++ b/util/superiotool/winbond.c
@@ -126,23 +126,12 @@ const static struct superio_registers reg_table[] = {
{EOT}
};
-static void enter_conf_mode_winbond(uint16_t port)
-{
- outb(0x87, port);
- outb(0x87, port);
-}
-
-static void exit_conf_mode_winbond(uint16_t port)
-{
- outb(0xaa, port);
-}
-
void probe_idregs_winbond(uint16_t port)
{
uint16_t id;
uint8_t devid, rev;
- enter_conf_mode_winbond(port);
+ enter_conf_mode_winbond_fintek_ite_8787(port);
devid = regval(port, DEVICE_ID_REG);
rev = regval(port, DEVICE_REV_REG);
@@ -152,7 +141,7 @@ void probe_idregs_winbond(uint16_t port)
if (superio_unknown(reg_table, id)) {
no_superio_found(port);
- exit_conf_mode_winbond(port);
+ exit_conf_mode_winbond_fintek_ite_8787(port);
return;
}
@@ -162,6 +151,6 @@ void probe_idregs_winbond(uint16_t port)
/* TODO: Special notes in dump output for the MISC entries. */
dump_superio("Winbond", reg_table, port, id);
- exit_conf_mode_winbond(port);
+ exit_conf_mode_winbond_fintek_ite_8787(port);
}