On 12/28/10 11:51 PM, David Hendricks wrote:
> On Tue, Dec 28, 2010 at 4:13 AM, Frantisek Rysanek
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Dear maintainers of the superiotool,
>
>     I have the following "feature request" (maybe not a bug report):
>     I have this idea that superiotool should be able to detect more than
>     one SuperIO chip in the system. Such detection of multiple chips may
>     work in some cases, but may fail in others.
>
>     The primary cause seems to be that
>      winbond.c :: probe_idregs_winbond()
>     and
>       ite.c :: probe_idregs_ite()
>     call
>       if (chip_found) return;   // this is a global variable!
>     after every "init sequence" tried.
>
>     Therefore, after the first chip detected (of any kind),
>     only the first init sequence is ever tried, in any subsequent calls
>     to the aforementioned probe_* functions.
>

That function is called with a port address. There can only be one chip
at one port address. So leaving the function after a chip has been found
at that address seems like the right thing to do. The bug is that
chip_found is a global variable and not a local variable.

Attached patch should fix the issue.



Stefan
Signed-off-by: Stefan Reinauer <[email protected]>

Index: util/superiotool/ite.c
===================================================================
--- util/superiotool/ite.c      (revision 6219)
+++ util/superiotool/ite.c      (working copy)
@@ -798,6 +798,8 @@
        regwrite(port, 0x02, 0x02);
 }
 
+static int chip_found_at_port = 0;
+
 static void probe_idregs_ite_helper(const char *init, uint16_t port)
 {
        uint16_t id, chipver, ecport;
@@ -817,6 +819,7 @@
        printf("Found ITE %s (id=0x%04x, rev=0x%01x) at 0x%x\n",
               get_superio_name(reg_table, id), id, chipver, port);
        chip_found = 1;
+       chip_found_at_port = 1;
 
        dump_superio("ITE", reg_table, port, id, LDN_SEL);
 
@@ -837,41 +840,43 @@
 
 void probe_idregs_ite(uint16_t port)
 {
+       chip_found_at_port = 0;
+
        if (port == 0x3f0 || port == 0x3bd || port == 0x370) {
                enter_conf_mode_ite_legacy(port, initkey_it8661f);
                probe_idregs_ite_helper("(init=legacy/it8661f) ", port);
                exit_conf_mode_ite(port);
-               if (chip_found) return;
+               if (chip_found_at_port) return;
 
                enter_conf_mode_ite_legacy(port, initkey_it8671f);
                probe_idregs_ite_helper("(init=legacy/it8671f) ", port);
                exit_conf_mode_ite(port);
-               if (chip_found) return;
+               if (chip_found_at_port) return;
        } else {
                enter_conf_mode_ite(port);
                probe_idregs_ite_helper("(init=standard) ", port);
                exit_conf_mode_ite(port);
-               if (chip_found) return;
+               if (chip_found_at_port) return;
 
                enter_conf_mode_ite_it8502e(port);
                probe_idregs_ite_helper("(init=it8502e) ", port);
                exit_conf_mode_ite(port);
-               if (chip_found) return;
+               if (chip_found_at_port) return;
 
                enter_conf_mode_ite_it8761e(port);
                probe_idregs_ite_helper("(init=it8761e) ", port);
                exit_conf_mode_ite(port);
-               if (chip_found) return;
+               if (chip_found_at_port) return;
 
                enter_conf_mode_ite_it8228e(port);
                probe_idregs_ite_helper("(init=it8228e) ", port);
                exit_conf_mode_ite(port);
-               if (chip_found) return;
+               if (chip_found_at_port) return;
 
                enter_conf_mode_winbond_fintek_ite_8787(port);
                probe_idregs_ite_helper("(init=0x87,0x87) ", port);
                exit_conf_mode_winbond_fintek_ite_8787(port);
-               if (chip_found) return;
+               if (chip_found_at_port) return;
        }
 }
 
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to