Messages in this thread Patch in this message | | | Date | Fri, 7 Dec 2001 14:00:32 -0500 (EST) | From | "Calin A. Culianu" <> | Subject | [PATCH] Athlon bug stomper UPDATE (as per VIA's Windows patch) |
| |
This patch detects the 0305, 3099, 3102, and 3112 (KT133x, KT266x, VT8662, and KLE133) *only*. On these chipsets, it will patch register 55 in the Northbridge and turn off bits: 5, 6, AND 7. (It does this to register 95 on the KT266x Northbridge). This will supposedly switch off a Memory Write Queue timer, which can cause those infinite loop bugs and other assorted crashes. This patch works just like a similar patch that VIA recently released for Windows machines.
The difference between this patch and the original athlon bug stomper is that it is expanded to recognize more chipsets and also does a special case for the KT266x chipset.
The attached patch is similar to one already submitted to the mailing list, except I think it's a bit more elegant as it doesn't create a whole new function for stomping the kt266 register 95, but rather instead used the existing athlon bug stomper function in pci-pc.c and simply overloads its functionality. (More efficient in that it has fewer lines and less generated binary code).
I tested this patch on my KT266 motherboard and it seems to work correctly. Essentially no harm can be done by this patch, as most of the time those registers have those bits turned off anyway. Only some BIOS's set those bits incorrectly and thus can cause problems.
-Calin
This patch detects the 0305, 3099, 3102, and 3112 (KT133x, KT266x, VT8662, and KLE133) *only*. On these chipsets, it will patch register 55 in the Northbridge and turn off bits: 5, 6, AND 7. (It does this to register 95 on the KT266x Northbridge). This will supposedly switch off a Memory Write Queue timer, which can cause those infinite loop bugs and other assorted crashes.
Calin Culianu calin@rtlab.org diff -u -r vanilla/arch/i386/kernel/pci-pc.c patched/arch/i386/kernel/pci-pc.c --- vanilla/arch/i386/kernel/pci-pc.c Fri Nov 9 16:58:02 2001 +++ patched/arch/i386/kernel/pci-pc.c Thu Dec 6 19:03:03 2001 @@ -1114,17 +1114,26 @@ * But it does seem to fix some unspecified problem * with 'movntq' copies on Athlons. * - * VIA 8363 chipset: - * - bit 7 at offset 0x55: Debug (RW) + * VIA 8363,8622,8361 Northbridges: + * - bits 5, 6, 7 at offset 0x55 need to be turned off + * VIA 8367 (KT266x) Northbridges: + * - bits 5, 6, 7 at offset 0x95 need to be turned off */ static void __init pci_fixup_via_athlon_bug(struct pci_dev *d) { u8 v; - pci_read_config_byte(d, 0x55, &v); - if (v & 0x80) { + int where = 0x55; + + if (d->device == PCI_DEVICE_ID_VIA_8367_0) { + where = 0x95; /* the memory write queue timer register is + different for the kt266x's: 0x95 not 0x55 */ + } + + pci_read_config_byte(d, where, &v); + if (v & 0xe0) { printk("Trying to stomp on Athlon bug...\n"); - v &= 0x7f; /* clear bit 55.7 */ - pci_write_config_byte(d, 0x55, v); + v &= 0x1f; /* clear bits 5, 6, 7 */ + pci_write_config_byte(d, where, v); } } @@ -1138,6 +1147,9 @@ { PCI_FIXUP_HEADER, PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5598, pci_fixup_latency }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, pci_fixup_piix4_acpi }, { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_via_athlon_bug }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_athlon_bug }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_athlon_bug }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_athlon_bug }, { 0 } }; diff -u -r vanilla/include/linux/pci_ids.h patched/include/linux/pci_ids.h --- vanilla/include/linux/pci_ids.h Fri Nov 9 17:11:15 2001 +++ patched/include/linux/pci_ids.h Thu Dec 6 19:00:57 2001 @@ -912,7 +912,7 @@ #define PCI_DEVICE_ID_TTI_HPT366 0x0004 #define PCI_VENDOR_ID_VIA 0x1106 -#define PCI_DEVICE_ID_VIA_8363_0 0x0305 +#define PCI_DEVICE_ID_VIA_8363_0 0x0305 #define PCI_DEVICE_ID_VIA_8371_0 0x0391 #define PCI_DEVICE_ID_VIA_8501_0 0x0501 #define PCI_DEVICE_ID_VIA_82C505 0x0505 @@ -946,9 +946,11 @@ #define PCI_DEVICE_ID_VIA_8233_7 0x3065 #define PCI_DEVICE_ID_VIA_82C686_6 0x3068 #define PCI_DEVICE_ID_VIA_8233_0 0x3074 +#define PCI_DEVICE_ID_VIA_8622 0x3102 #define PCI_DEVICE_ID_VIA_8233C_0 0x3109 +#define PCI_DEVICE_ID_VIA_8361 0x3112 #define PCI_DEVICE_ID_VIA_8633_0 0x3091 -#define PCI_DEVICE_ID_VIA_8367_0 0x3099 +#define PCI_DEVICE_ID_VIA_8367_0 0x3099 #define PCI_DEVICE_ID_VIA_86C100A 0x6100 #define PCI_DEVICE_ID_VIA_8231 0x8231 #define PCI_DEVICE_ID_VIA_8231_4 0x8235
| |