- List SMSC LPC47N227 runtime register block as supported.
[coreboot.git] / util / superiotool / winbond.c
index 4e2794470b04aabbec44ac1c336c1a82e78f6dc3..d5d9275247b8603f50984bc2ca4cbb36227e7983 100644 (file)
@@ -468,25 +468,74 @@ 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);
+       OUTB(0x88, port);
 }
 
 static void enter_conf_mode_winbond_89(uint16_t port)
 {
-       outb(0x89, port);
+       OUTB(0x89, port);
 }
 
 static void enter_conf_mode_winbond_86(uint16_t port)
 {
-       outb(0x86, port);
-       outb(0x86, port);
+       OUTB(0x86, port);
+       OUTB(0x86, 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);
 }