See patch.

The Winbond SuperIO chips have another indirection of registers. The
hwmon has generic registers and banked registers, mostly temperature
handling, and SMI/GPIO stuff.

Regards,
Stefan

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [EMAIL PROTECTED]  • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866

* 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 -e

Signed-off-by: Stefan Reinauer <[EMAIL PROTECTED]>

Index: fintek.c
===================================================================
--- fintek.c    (revision 3779)
+++ fintek.c    (working copy)
@@ -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);
 }
Index: winbond.c
===================================================================
--- winbond.c   (revision 3779)
+++ winbond.c   (working copy)
@@ -468,6 +468,51 @@
        {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,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,0x5f,NANA,0x03,RSVD,0x44,
+                        0x18,0x15,0x80,0x5c,EOT}},
+               {0x0, "BANK 0",
+                       {0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,
+                        0x5d,EOT},
+                       {NANA,NANA,NANA,NANA,NANA,NANA,0x00,0x80,0x90,0x70,
+                        0x00,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,0x53,0x54,0x55,0x56,0x59,0x5a,0x5b,EOT},
+                       {0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,EOT}},
+               {0x5, "BANK 5",
+                       {0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,EOT},
+                       {NANA,NANA,NANA,NANA,NANA,NANA,NANA,NANA,EOT}},
+               {EOT}}},
+       {EOT}
+};
+
+
 static void enter_conf_mode_winbond_88(uint16_t port)
 {
        OUTB(0x88, port);
@@ -486,7 +531,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 +567,28 @@
                       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, 0x07, 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)
Index: ite.c
===================================================================
--- ite.c       (revision 3779)
+++ ite.c       (working copy)
@@ -534,7 +534,7 @@
               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). */
@@ -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);
        }
 }
 
Index: nsc.c
===================================================================
--- nsc.c       (revision 3779)
+++ nsc.c       (working copy)
@@ -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)
Index: superiotool.c
===================================================================
--- superiotool.c       (revision 3779)
+++ superiotool.c       (working copy)
@@ -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 bank_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, bank_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 bank_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, bank_sel);
                }
 
                if (no_dump_available)
Index: ali.c
===================================================================
--- ali.c       (revision 3779)
+++ ali.c       (working copy)
@@ -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);
 }
Index: smsc.c
===================================================================
--- smsc.c      (revision 3779)
+++ smsc.c      (working copy)
@@ -643,7 +643,7 @@
               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);
 }
Index: superiotool.h
===================================================================
--- superiotool.h       (revision 3779)
+++ superiotool.h       (working copy)
@@ -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 bank_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[]);
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to