quirks.c 2.1 KB

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