--- quirks.c-2.4.4 Mon Apr 30 01:50:36 2001 +++ quirks.c Mon Apr 30 03:54:08 2001 @@ -88,23 +88,44 @@ * VIA Apollo KT133 needs PCI latency patch * Made according to a windows driver based patch by George E. Breese * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm + * Also see http://home.tiscalinet.de/au-ja/review-kt133a-1-en.html for + * the info on which Mr Breese based his work. */ static void __init quirk_vialatency(struct pci_dev *dev) { u8 r70; - - printk(KERN_INFO "Applying VIA PCI latency patch.\n"); - /* - * In register 0x70, mask off bit 2 (PCI Master read caching) - * and 1 (Delay Transaction) + u8 rev; + struct pci_dev *vt82c686; + + + /* we want to look for a VT82C686 south bridge, and then apply the via latency + * patch if we find that it's a 686B (by revision) */ - pci_read_config_byte(dev, 0x70, &r70); - r70 &= 0xf9; - pci_write_config_byte(dev, 0x70, r70); - /* - * Turn off PCI Latency timeout (set to 0 clocks) - */ - pci_write_config_byte(dev, 0x75, 0x80); + vt82c686 = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL); + if (vt82c686) + { + pci_read_config_byte(vt82c686, PCI_CLASS_REVISION, &rev); + /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */ + if (rev >= 0x40 && rev <= 0x4f) + { + printk(KERN_INFO "Applying VIA PCI latency patch (found VT82C686B).\n"); + /* + * In register 0x70, mask off bit 2 (PCI Master read caching) + * and 1 (Delay Transaction) + */ + pci_read_config_byte(dev, 0x70, &r70); + r70 &= 0xf9; + pci_write_config_byte(dev, 0x70, r70); + /* + * Turn off PCI Latency timeout (set to 0 clocks) + */ + pci_write_config_byte(dev, 0x75, 0x80); + } + else + { + printk(KERN_INFO "Found VT82C686A, not applying VIA latency patch.\n"); + } + } /* if (vt82c686) ... */ } /*