drm/nouveau: fix i2ctable bounds checking
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / pci / irq.c
blobde01174aff067a2868817b5d64deea03cd040d55
1 /*
2 * PCI IRQ failure handing code
4 * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com>
5 */
7 #include <linux/acpi.h>
8 #include <linux/device.h>
9 #include <linux/kernel.h>
10 #include <linux/pci.h>
12 static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason)
14 struct pci_dev *parent = to_pci_dev(pdev->dev.parent);
16 dev_printk(KERN_ERR, &pdev->dev,
17 "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n",
18 dev_name(&parent->dev), parent->vendor, parent->device);
19 dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason);
20 dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n");
21 WARN_ON(1);
24 /**
25 * pci_lost_interrupt - reports a lost PCI interrupt
26 * @pdev: device whose interrupt is lost
28 * The primary function of this routine is to report a lost interrupt
29 * in a standard way which users can recognise (instead of blaming the
30 * driver).
32 * Returns:
33 * a suggestion for fixing it (although the driver is not required to
34 * act on this).
36 enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)
38 if (pdev->msi_enabled || pdev->msix_enabled) {
39 enum pci_lost_interrupt_reason ret;
41 if (pdev->msix_enabled) {
42 pci_note_irq_problem(pdev, "MSIX routing failure");
43 ret = PCI_LOST_IRQ_DISABLE_MSIX;
44 } else {
45 pci_note_irq_problem(pdev, "MSI routing failure");
46 ret = PCI_LOST_IRQ_DISABLE_MSI;
48 return ret;
50 #ifdef CONFIG_ACPI
51 if (!(acpi_disabled || acpi_noirq)) {
52 pci_note_irq_problem(pdev, "Potential ACPI misrouting please reboot with acpi=noirq");
53 /* currently no way to fix acpi on the fly */
54 return PCI_LOST_IRQ_DISABLE_ACPI;
56 #endif
57 pci_note_irq_problem(pdev, "unknown cause (not MSI or ACPI)");
58 return PCI_LOST_IRQ_NO_INFORMATION;
60 EXPORT_SYMBOL(pci_lost_interrupt);