From 4d1bbe99086472185a7d4df30ee3324989e17f85 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 31 Oct 2017 09:25:18 +0100 Subject: [PATCH] util/superiotool: distinguish between VT82C686 and VT1211 They both have a device id of 0x3c. The former is part of the PCI chip set accessible via port 0x3f0 while the latter is a standalone LPC chip accessible via 0x2e/0x4e depending on strapping. They're not register compatible: the VT82C686 only provides a FDC, LPT and part of UARTs. The VT82C686 documentation suggests it has revision 0x00 while the VT1211 datasheet indicates 0x01. Nevertheless, the VT1211 I happen to have hs a revision of 0x02. Thus the revision is probably not good enough to tell one from the another. Change-Id: Ic7529c84724c8d6b9eb75b863f1bceef5e4b52b5 Signed-off-by: Lubomir Rintel Reviewed-on: https://review.coreboot.org/22254 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/superiotool/via.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/util/superiotool/via.c b/util/superiotool/via.c index 4a97336614..3fa3635979 100644 --- a/util/superiotool/via.c +++ b/util/superiotool/via.c @@ -23,7 +23,9 @@ #define DEVICE_REV_VT1211_REG 0x21 static const struct superio_registers reg_table[] = { - {0x3c, "VT82C686A/VT82C686B/VT1211", { + {0x3c00, "VT82C686A/VT82C686B", { + {EOT}}}, + {0x3c01, "VT1211", { {EOT}}}, {EOT} }; @@ -75,41 +77,45 @@ static void exit_conf_mode_via_vt82c686(void) void probe_idregs_via(uint16_t port) { uint16_t id; + uint8_t devid; uint8_t rev; if (port == 0x3f0) { - probing_for("VIA", "(init=vt82c686)", port); + probing_for("VIA", "(init=vt82c686) ", port); if (enter_conf_mode_via_vt82c686()) return; - id = regval(port, DEVICE_ID_VT82C686_REG); + devid = regval(port, DEVICE_ID_VT82C686_REG); rev = regval(port, DEVICE_REV_VT82C686_REG); + id = devid << 8; if (superio_unknown(reg_table, id)) { if (verbose) - printf(NOTFOUND "id=0x%04x, rev=0x%02x\n", id, rev); + printf(NOTFOUND "id=0x%02x, rev=0x%02x\n", devid, rev); } else { - printf("Found VIA %s (id=0x%04x, rev=0x%02x) at 0x%x\n", - get_superio_name(reg_table, id), id, rev, port); + printf("Found VIA %s (id=0x%02x, rev=0x%02x) at 0x%x\n", + get_superio_name(reg_table, id), devid, rev, port); chip_found = 1; } exit_conf_mode_via_vt82c686(); if (chip_found) return; } else { - probing_for("VIA", "(init=0x87,0x87)", port); + probing_for("VIA", "(init=0x87,0x87) ", port); enter_conf_mode_winbond_fintek_ite_8787(port); - id = regval(port, DEVICE_ID_VT1211_REG); + devid = regval(port, DEVICE_ID_VT1211_REG); rev = regval(port, DEVICE_REV_VT1211_REG); + id = (devid << 8) | 1; if (superio_unknown(reg_table, id)) { if (verbose) - printf(NOTFOUND "id=0x%04x, rev=0x%02x\n", id, rev); + printf(NOTFOUND "id=0x%02x, rev=0x%02x\n", devid, rev); } else { - printf("Found VIA %s (id=0x%04x, rev=0x%02x) at 0x%x\n", - get_superio_name(reg_table, id), id, rev, port); + printf("Found VIA %s (id=0x%02x, rev=0x%02x) at 0x%x\n", + get_superio_name(reg_table, id), devid, rev, port); chip_found = 1; + dump_superio("VIA", reg_table, port, id, LDN_SEL); } }