Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file contains work-arounds for x86 and x86_64 platform bugs. |
| 3 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <linux/pci.h> |
| 5 | #include <linux/irq.h> |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 6 | #include <asm/pci-direct.h> |
| 7 | #include <asm/genapic.h> |
| 8 | #include <asm/cpu.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
| 10 | #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI) |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 11 | static void __devinit verify_quirk_intel_irqbalance(struct pci_dev *dev) |
| 12 | { |
| 13 | #ifdef CONFIG_X86_64 |
| 14 | if (genapic != &apic_flat) |
| 15 | panic("APIC mode must be flat on this system\n"); |
| 16 | #elif defined(CONFIG_X86_GENERICARCH) |
| 17 | if (genapic != &apic_default) |
| 18 | panic("APIC mode must be default(flat) on this system. Use apic=default\n"); |
| 19 | #endif |
| 20 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 22 | void __init quirk_intel_irqbalance(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | { |
| 24 | u8 config, rev; |
| 25 | u32 word; |
| 26 | |
| 27 | /* BIOS may enable hardware IRQ balancing for |
| 28 | * E7520/E7320/E7525(revision ID 0x9 and below) |
| 29 | * based platforms. |
| 30 | * Disable SW irqbalance/affinity on those platforms. |
| 31 | */ |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 32 | rev = read_pci_config_byte(0, 0, 0, PCI_CLASS_REVISION); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | if (rev > 0x9) |
| 34 | return; |
| 35 | |
| 36 | printk(KERN_INFO "Intel E7520/7320/7525 detected."); |
| 37 | |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 38 | /* enable access to config space */ |
| 39 | config = read_pci_config_byte(0, 0, 0, 0xf4); |
| 40 | write_pci_config_byte(0, 0, 0, 0xf4, config|0x2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
| 42 | /* read xTPR register */ |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 43 | word = read_pci_config_16(0, 0, 0x40, 0x4c); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
| 45 | if (!(word & (1 << 13))) { |
| 46 | printk(KERN_INFO "Disabling irq balancing and affinity\n"); |
| 47 | #ifdef CONFIG_IRQBALANCE |
| 48 | irqbalance_disable(""); |
| 49 | #endif |
| 50 | noirqdebug_setup(""); |
| 51 | #ifdef CONFIG_PROC_FS |
| 52 | no_irq_affinity = 1; |
| 53 | #endif |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 54 | #ifdef CONFIG_HOTPLUG_CPU |
| 55 | printk(KERN_INFO "Disabling cpu hotplug control\n"); |
| 56 | enable_cpu_hotplug = 0; |
| 57 | #endif |
| 58 | #ifdef CONFIG_X86_64 |
| 59 | /* force the genapic selection to flat mode so that |
| 60 | * interrupts can be redirected to more than one CPU. |
| 61 | */ |
| 62 | genapic_force = &apic_flat; |
| 63 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | } |
| 65 | |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 66 | /* put back the original value for config space */ |
Alan Cox | da9bb1d | 2006-01-18 17:44:13 -0800 | [diff] [blame] | 67 | if (!(config & 0x2)) |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 68 | write_pci_config_byte(0, 0, 0, 0xf4, config); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | } |
Siddha, Suresh B | b0d0a4b | 2006-12-07 02:14:10 +0100 | [diff] [blame^] | 70 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, verify_quirk_intel_irqbalance); |
| 71 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, verify_quirk_intel_irqbalance); |
| 72 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, verify_quirk_intel_irqbalance); |
| 73 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | #endif |