blob: 9f6ab1789bb05fc81593c47211b16bc45be894e1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * This file contains work-arounds for x86 and x86_64 platform bugs.
3 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <linux/pci.h>
5#include <linux/irq.h>
6
7#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
8
Andrew Mortona86f34b2007-05-02 19:27:04 +02009static void __devinit quirk_intel_irqbalance(struct pci_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070010{
11 u8 config, rev;
12 u32 word;
13
14 /* BIOS may enable hardware IRQ balancing for
15 * E7520/E7320/E7525(revision ID 0x9 and below)
16 * based platforms.
17 * Disable SW irqbalance/affinity on those platforms.
18 */
Andrew Mortona86f34b2007-05-02 19:27:04 +020019 pci_read_config_byte(dev, PCI_CLASS_REVISION, &rev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 if (rev > 0x9)
21 return;
22
23 printk(KERN_INFO "Intel E7520/7320/7525 detected.");
24
Andrew Mortona86f34b2007-05-02 19:27:04 +020025 /* enable access to config space*/
26 pci_read_config_byte(dev, 0xf4, &config);
27 pci_write_config_byte(dev, 0xf4, config|0x2);
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
29 /* read xTPR register */
Andrew Mortona86f34b2007-05-02 19:27:04 +020030 raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32 if (!(word & (1 << 13))) {
33 printk(KERN_INFO "Disabling irq balancing and affinity\n");
34#ifdef CONFIG_IRQBALANCE
35 irqbalance_disable("");
36#endif
37 noirqdebug_setup("");
38#ifdef CONFIG_PROC_FS
39 no_irq_affinity = 1;
40#endif
41 }
42
Andrew Mortona86f34b2007-05-02 19:27:04 +020043 /* put back the original value for config space*/
Alan Coxda9bb1d2006-01-18 17:44:13 -080044 if (!(config & 0x2))
Andrew Mortona86f34b2007-05-02 19:27:04 +020045 pci_write_config_byte(dev, 0xf4, config);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046}
Andrew Mortona86f34b2007-05-02 19:27:04 +020047DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance);
48DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance);
49DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#endif