Author: uwe Date: 2008-12-01 15:18:57 +0100 (Mon, 01 Dec 2008) New Revision: 3784
Modified: trunk/util/superiotool/ali.c trunk/util/superiotool/fintek.c trunk/util/superiotool/ite.c trunk/util/superiotool/nsc.c trunk/util/superiotool/smsc.c trunk/util/superiotool/superiotool.c trunk/util/superiotool/superiotool.h trunk/util/superiotool/winbond.c Log: 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 stepan@coresystems.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/util/superiotool/ali.c =================================================================== --- trunk/util/superiotool/ali.c 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/ali.c 2008-12-01 14:18:57 UTC (rev 3784) @@ -95,7 +95,7 @@ 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); }
Modified: trunk/util/superiotool/fintek.c =================================================================== --- trunk/util/superiotool/fintek.c 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/fintek.c 2008-12-01 14:18:57 UTC (rev 3784) @@ -137,7 +137,7 @@ 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); }
Modified: trunk/util/superiotool/ite.c =================================================================== --- trunk/util/superiotool/ite.c 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/ite.c 2008-12-01 14:18:57 UTC (rev 3784) @@ -534,10 +534,10 @@ 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 @@ 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 print_ite_chips(void) { print_vendor_chips("ITE", reg_table); - print_vendor_chips("ITE EC", ec_table); + print_vendor_chips("ITE-EC", ec_table); }
Modified: trunk/util/superiotool/nsc.c =================================================================== --- trunk/util/superiotool/nsc.c 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/nsc.c 2008-12-01 14:18:57 UTC (rev 3784) @@ -506,7 +506,7 @@ 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)
Modified: trunk/util/superiotool/smsc.c =================================================================== --- trunk/util/superiotool/smsc.c 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/smsc.c 2008-12-01 14:18:57 UTC (rev 3784) @@ -643,7 +643,8 @@ 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); }
Modified: trunk/util/superiotool/superiotool.c =================================================================== --- trunk/util/superiotool/superiotool.c 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/superiotool.c 2008-12-01 14:18:57 UTC (rev 3784) @@ -82,7 +82,7 @@ }
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 @@ 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 @@
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 @@ 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)
Modified: trunk/util/superiotool/superiotool.h =================================================================== --- trunk/util/superiotool/superiotool.h 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/superiotool.h 2008-12-01 14:18:57 UTC (rev 3784) @@ -73,10 +73,14 @@ #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 @@ 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[]);
Modified: trunk/util/superiotool/winbond.c =================================================================== --- trunk/util/superiotool/winbond.c 2008-11-30 14:52:46 UTC (rev 3783) +++ trunk/util/superiotool/winbond.c 2008-12-01 14:18:57 UTC (rev 3784) @@ -468,6 +468,55 @@ {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 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 @@ 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 print_winbond_chips(void) { print_vendor_chips("Winbond", reg_table); + print_vendor_chips("Winbond-HWM", hwm_table); }