[updated to apply to latest svn]

All mentioned north bridges have been checked against data sheet. That's
all north bridges google found a datasheet for with "byte enable" included.

Second revision. Should now run multiple chipset enables if the first one
requests further enables to be run.

VIA byte-merging logic tested: works.
multiple chipset logic: completely untested


Signed-off-by: Michael Karcher <[email protected]>

Index: flashrom-via_no_byte_merge/chipset_enable.c
===================================================================
--- flashrom-via_no_byte_merge/chipset_enable.c (Revision 998)
+++ flashrom-via_no_byte_merge/chipset_enable.c (Arbeitskopie)
@@ -34,6 +34,8 @@
 #include <fcntl.h>
 #include "flash.h"
 
+#define NOT_DONE_YET 1
+
 extern int ichspi_lock;
 
 static int enable_flash_ali_m1533(struct pci_dev *dev, const char *name)
@@ -639,6 +641,32 @@
        return enable_flash_ich_dc_spi(dev, name, 10);
 }
 
+static void via_do_byte_merge(void * arg)
+{
+       struct pci_dev * dev = arg;
+       uint8_t val;
+
+       msg_pdbg("Re-enabling byte merging\n");
+       val = pci_read_byte(dev, 0x71);
+       val |= 0x40;
+       pci_write_byte(dev, 0x71, val);
+}
+
+static int via_no_byte_merge(struct pci_dev *dev, const char *name)
+{
+       uint8_t val;
+
+       val = pci_read_byte(dev, 0x71);
+       if (val & 0x40)
+       {
+               msg_pdbg("Disabling byte merging\n");
+               val &= ~0x40;
+               pci_write_byte(dev, 0x71, val);
+               register_shutdown(via_do_byte_merge, dev);
+       }
+       return NOT_DONE_YET;    /* need to find south bridge, too */
+}
+
 static int enable_flash_vt823x(struct pci_dev *dev, const char *name)
 {
        uint8_t val;
@@ -1405,6 +1433,14 @@
        {0x1039, 0x0746, NT, "SiS", "746",              enable_flash_sis540},
        {0x1039, 0x0748, NT, "SiS", "748",              enable_flash_sis540},
        {0x1039, 0x0755, NT, "SiS", "755",              enable_flash_sis540},
+       /* VIA northbridges */
+       {0x1106, 0x0585, NT, "VIA", "VT82C585VPX",      via_no_byte_merge},
+       {0x1106, 0x0595, NT, "VIA", "VT82C595",         via_no_byte_merge},
+       {0x1106, 0x0597, NT, "VIA", "VT82C597",         via_no_byte_merge},
+       {0x1106, 0x0691, NT, "VIA", "VT82C69x",         via_no_byte_merge}, /* 
691, 693a, 694t, 694x checked */
+       {0x1106, 0x0601, NT, "VIA", "VT8601/VT8601A",   via_no_byte_merge},
+       {0x1106, 0x8601, NT, "VIA", "VT8601T",          via_no_byte_merge},
+       /* VIA southbridges */
        {0x1106, 0x8324, OK, "VIA", "CX700",            enable_flash_vt823x},
        {0x1106, 0x8231, NT, "VIA", "VT8231",           enable_flash_vt823x},
        {0x1106, 0x3074, NT, "VIA", "VT8233",           enable_flash_vt823x},
@@ -1431,22 +1467,31 @@
        for (i = 0; chipset_enables[i].vendor_name != NULL; i++) {
                dev = pci_dev_find(chipset_enables[i].vendor_id,
                                   chipset_enables[i].device_id);
-               if (dev)
-                       break;
-       }
-
-       if (dev) {
+               if (!dev)
+                       continue;
+               if (ret != -2) {
+                       msg_pinfo("WARNING: unexpected second chipset match: "
+                              "\"%s %s\"\nignoring, please report lspci and "
+                              "board URL to [email protected]!\n",
+                                       chipset_enables[i].vendor_name,
+                                       chipset_enables[i].device_name);
+                       continue;
+               }
                msg_pinfo("Found chipset \"%s %s\", enabling flash write... ",
                       chipset_enables[i].vendor_name,
                       chipset_enables[i].device_name);
 
                ret = chipset_enables[i].doit(dev,
                                              chipset_enables[i].device_name);
-               if (ret)
+               if (ret == NOT_DONE_YET) {
+                       ret = -2;
+                       msg_pinfo("OK - searching further chips.\n");
+               } else if (ret < 0)
                        msg_pinfo("FAILED!\n");
-               else
+               else if(ret == 0)
                        msg_pinfo("OK.\n");
        }
+
        msg_pinfo("This chipset supports the following protocols: %s.\n",
               flashbuses_to_text(buses_supported));
 


-- 
http://www.hailfinger.org/


_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to