From 7a51e50582b65bb6ac54e8923470807b5975c6e1 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Mon, 1 Dec 2008 14:18:57 +0000 Subject: The Winbond Super I/O chips have another indirection of registers. The hwmon has generic registers and banked registers, mostly temperature handling, and SMI/GPIO stuff. Not all LDNs are switched via register offset 0x07, make it a parameter. Add support for dumping the hardware monitor of Winbond W83627THF/THG parts with the -e option. Signed-off-by: Stefan Reinauer Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3784 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/superiotool/ali.c | 2 +- util/superiotool/fintek.c | 2 +- util/superiotool/ite.c | 8 ++--- util/superiotool/nsc.c | 2 +- util/superiotool/smsc.c | 3 +- util/superiotool/superiotool.c | 8 ++--- util/superiotool/superiotool.h | 8 +++-- util/superiotool/winbond.c | 74 ++++++++++++++++++++++++++++++++++++++++-- 8 files changed, 91 insertions(+), 16 deletions(-) diff --git a/util/superiotool/ali.c b/util/superiotool/ali.c index 0bc1e062e3..9111fa2281 100644 --- a/util/superiotool/ali.c +++ b/util/superiotool/ali.c @@ -95,7 +95,7 @@ void probe_idregs_ali(uint16_t port) get_superio_name(reg_table, id), id, rev, port); chip_found = 1; - dump_superio("ALi", reg_table, port, id); + dump_superio("ALi", reg_table, port, id, LDN_SEL); exit_conf_mode_ali(port); } diff --git a/util/superiotool/fintek.c b/util/superiotool/fintek.c index d4c9bb519f..701bd4c6f6 100644 --- a/util/superiotool/fintek.c +++ b/util/superiotool/fintek.c @@ -137,7 +137,7 @@ void probe_idregs_fintek(uint16_t port) get_superio_name(reg_table, did), vid, did, port); chip_found = 1; - dump_superio("Fintek", reg_table, port, did); + dump_superio("Fintek", reg_table, port, did, LDN_SEL); exit_conf_mode_winbond_fintek_ite_8787(port); } diff --git a/util/superiotool/ite.c b/util/superiotool/ite.c index 8ecefb5c7c..c78431881a 100644 --- a/util/superiotool/ite.c +++ b/util/superiotool/ite.c @@ -534,10 +534,10 @@ static void probe_idregs_ite_helper(const char *init, uint16_t port) get_superio_name(reg_table, id), id, chipver, port); chip_found = 1; - dump_superio("ITE", reg_table, port, id); + dump_superio("ITE", reg_table, port, id, LDN_SEL); if (extra_dump) { - regwrite(port, 0x07, 0x04); /* Select LDN 4 (EC). */ + regwrite(port, LDN_SEL, 0x04); /* Select LDN 4 (EC). */ /* Get EC base address (stored in LDN 4, index 0x60/0x61). */ ecport = regval(port, 0x60) << 8; @@ -547,7 +547,7 @@ static void probe_idregs_ite_helper(const char *init, uint16_t port) ecport += 5; printf("Environment controller (0x%04x)\n", ecport); - dump_superio("ITE-EC", ec_table, ecport, id); + dump_superio("ITE-EC", ec_table, ecport, id, LDN_SEL); } } @@ -583,5 +583,5 @@ void probe_idregs_ite(uint16_t port) void print_ite_chips(void) { print_vendor_chips("ITE", reg_table); - print_vendor_chips("ITE EC", ec_table); + print_vendor_chips("ITE-EC", ec_table); } diff --git a/util/superiotool/nsc.c b/util/superiotool/nsc.c index 3a3336a6b4..991bdc87c7 100644 --- a/util/superiotool/nsc.c +++ b/util/superiotool/nsc.c @@ -506,7 +506,7 @@ void probe_idregs_nsc(uint16_t port) get_superio_name(reg_table, id), id, rev, port); chip_found = 1; - dump_superio("NSC", reg_table, port, id); + dump_superio("NSC", reg_table, port, id, LDN_SEL); } void print_nsc_chips(void) diff --git a/util/superiotool/smsc.c b/util/superiotool/smsc.c index ae141ea815..bf23188168 100644 --- a/util/superiotool/smsc.c +++ b/util/superiotool/smsc.c @@ -643,7 +643,8 @@ static void probe_idregs_smsc_helper(uint16_t port, uint8_t idreg, id, rev, port); chip_found = 1; - dump_superio((id == 0x77 ? "ASUS" : "SMSC"), reg_table, port, id); + dump_superio((id == 0x77 ? "ASUS" : "SMSC"), reg_table, port, id, + LDN_SEL); exit_conf_mode_smsc(port); } diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c index 1bbe5feec7..9d3840f1f7 100644 --- a/util/superiotool/superiotool.c +++ b/util/superiotool/superiotool.c @@ -82,7 +82,7 @@ const char *get_superio_name(const struct superio_registers reg_table[], } static void dump_regs(const struct superio_registers reg_table[], - int i, int j, uint16_t port) + int i, int j, uint16_t port, uint8_t ldn_sel) { int k; const int16_t *idx; @@ -91,7 +91,7 @@ static void dump_regs(const struct superio_registers reg_table[], printf("LDN 0x%02x", reg_table[i].ldn[j].ldn); if (reg_table[i].ldn[j].name != NULL) printf(" (%s)", reg_table[i].ldn[j].name); - regwrite(port, 0x07, reg_table[i].ldn[j].ldn); + regwrite(port, ldn_sel, reg_table[i].ldn[j].ldn); } else { printf("Register dump:"); } @@ -131,7 +131,7 @@ static void dump_regs(const struct superio_registers reg_table[], void dump_superio(const char *vendor, const struct superio_registers reg_table[], - uint16_t port, uint16_t id) + uint16_t port, uint16_t id, uint8_t ldn_sel) { int i, j, no_dump_available = 1; @@ -149,7 +149,7 @@ void dump_superio(const char *vendor, if (reg_table[i].ldn[j].ldn == EOT) break; no_dump_available = 0; - dump_regs(reg_table, i, j, port); + dump_regs(reg_table, i, j, port, ldn_sel); } if (no_dump_available) diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h index 7e0ca0bd9b..e26f21c59c 100644 --- a/util/superiotool/superiotool.h +++ b/util/superiotool/superiotool.h @@ -73,10 +73,14 @@ and print its vendor, name, ID, revision, and config port.\n" #define MISC -5 /* Needs special comment in output */ #define MAXLDN 0x14 /* Biggest LDN */ #define LDNSIZE (MAXLDN + 3) /* Biggest LDN + 0 + NOLDN + EOT */ -#define MAXNUMIDX 170 /* Maximum number of indexes */ +#define MAXNUMIDX 170 /* Maximum number of indices */ #define IDXSIZE (MAXNUMIDX + 1) #define MAXNUMPORTS (6 + 1) /* Maximum number of Super I/O ports */ +/* Select registers for various components. */ +#define LDN_SEL 0x07 /* LDN select register */ +#define WINBOND_HWM_SEL 0x4e /* Hardware monitor bank select */ + /* Command line parameters. */ extern int dump, verbose, extra_dump; @@ -102,7 +106,7 @@ 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); void dump_superio(const char *name, const struct superio_registers reg_table[], - uint16_t port, uint16_t id); + uint16_t port, uint16_t id, uint8_t ldn_sel); void probing_for(const char *vendor, const char *info, uint16_t port); void print_vendor_chips(const char *vendor, const struct superio_registers reg_table[]); diff --git a/util/superiotool/winbond.c b/util/superiotool/winbond.c index 91f06063ec..d5d9275247 100644 --- a/util/superiotool/winbond.c +++ b/util/superiotool/winbond.c @@ -468,6 +468,55 @@ static const struct superio_registers reg_table[] = { {EOT} }; +static const struct superio_registers hwm_table[] = { + {0x828, "W83627THF/THG", { + {NOLDN, NULL, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, + 0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, + 0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d, + 0x1e,0x1f, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, + 0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34, + 0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e, + 0x3f, + 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,EOT}, + {RSVD,0xff,RSVD,0xff,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x3c,0x3c,0x0a,0x0a,RSVD,0xff,0x00,0x00, + 0x00,0x01,0x01,0x3c,0x43,RSVD,0xff,0xff,RSVD,RSVD, + NANA,NANA, + NANA,NANA,NANA,NANA,NANA,RSVD,RSVD,NANA,NANA,NANA, + NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA, + RSVD,RSVD,RSVD,RSVD,NANA,NANA,NANA,NANA,NANA,RSVD, + RSVD, + 0x03,0x00,0x00,0xfe,0xff,RSVD,RSVD,0x5f,NANA,0x03, + RSVD,0x44,0x18,0x15,0x80,0x5c,EOT}}, + {0x0, "Bank 0", + {0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5d,0x5e,0x5f,EOT}, + {NANA,NANA,NANA,NANA,NANA,NANA,0x00,0x80,0x90,0x70, + 0x00,RSVD,RSVD,EOT}}, + {0x1, "Bank 1", + {0x50,0x51,0x52,0x53,0x54,0x55,0x56,EOT}, + {NANA,NANA,0x00,0x4b,0x00,0x50,0x00,EOT}}, + {0x2, "Bank 2", + {0x50,0x51,0x52,0x53,0x54,0x55,0x56,EOT}, + {NANA,NANA,0x00,0x4b,0x00,0x50,0x00,EOT}}, + {0x4, "Bank 4", + {0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x59,0x5a, + 0x5b,EOT}, + {0x00,0xff,RSVD,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,EOT}}, + {0x5, "Bank 5", + {0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,EOT}, + {NANA,NANA,RSVD,RSVD,NANA,NANA,NANA,NANA,EOT}}, + {0x6, "Bank 6", + {0x50,EOT}, + {RSVD,EOT}}, + {EOT}}}, + {EOT} +}; + static void enter_conf_mode_winbond_88(uint16_t port) { OUTB(0x88, port); @@ -486,7 +535,7 @@ static void enter_conf_mode_winbond_86(uint16_t port) static void probe_idregs_winbond_helper(const char *init, uint16_t port) { - uint16_t id; + uint16_t id, hwmport; uint8_t devid, rev, olddevid; probing_for("Winbond", init, port); @@ -522,7 +571,27 @@ static void probe_idregs_winbond_helper(const char *init, uint16_t port) get_superio_name(reg_table, id), devid, rev, port); chip_found = 1; - dump_superio("Winbond", reg_table, port, id); + dump_superio("Winbond", reg_table, port, id, LDN_SEL); + + if (extra_dump) { + regwrite(port, LDN_SEL, 0x0b); /* Select LDN 0xb (HWM). */ + + if ((regval(port, 0x30) & (1 << 0)) != (1 << 0)) { + printf("Hardware Monitor disabled or does not exist.\n"); + return; + } + + /* Get HWM base address (stored in LDN 0xb, index 0x60/0x61). */ + hwmport = regval(port, 0x60) << 8; + hwmport |= regval(port, 0x61); + + /* HWM address register = HWM base address + 5. */ + hwmport += 5; + + printf("Hardware monitor (0x%04x)\n", hwmport); + dump_superio("Winbond-HWM", hwm_table, hwmport, id, + WINBOND_HWM_SEL); + } } void probe_idregs_winbond(uint16_t port) @@ -547,4 +616,5 @@ void probe_idregs_winbond(uint16_t port) void print_winbond_chips(void) { print_vendor_chips("Winbond", reg_table); + print_vendor_chips("Winbond-HWM", hwm_table); } -- cgit v1.2.3