This source file includes following definitions.
- pci_note_irq_problem
- pci_request_irq
- pci_free_irq
1
2
3
4
5
6
7
8
9 #include <linux/acpi.h>
10 #include <linux/device.h>
11 #include <linux/kernel.h>
12 #include <linux/export.h>
13 #include <linux/pci.h>
14
15 static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason)
16 {
17 struct pci_dev *parent = to_pci_dev(pdev->dev.parent);
18
19 pci_err(pdev, "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n",
20 dev_name(&parent->dev), parent->vendor, parent->device);
21 pci_err(pdev, "%s\n", reason);
22 pci_err(pdev, "Please report to linux-kernel@vger.kernel.org\n");
23 WARN_ON(1);
24 }
25
26
27
28
29
30
31
32
33
34
35
36
37
38 enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)
39 {
40 if (pdev->msi_enabled || pdev->msix_enabled) {
41 enum pci_lost_interrupt_reason ret;
42
43 if (pdev->msix_enabled) {
44 pci_note_irq_problem(pdev, "MSIX routing failure");
45 ret = PCI_LOST_IRQ_DISABLE_MSIX;
46 } else {
47 pci_note_irq_problem(pdev, "MSI routing failure");
48 ret = PCI_LOST_IRQ_DISABLE_MSI;
49 }
50 return ret;
51 }
52 #ifdef CONFIG_ACPI
53 if (!(acpi_disabled || acpi_noirq)) {
54 pci_note_irq_problem(pdev, "Potential ACPI misrouting please reboot with acpi=noirq");
55
56 return PCI_LOST_IRQ_DISABLE_ACPI;
57 }
58 #endif
59 pci_note_irq_problem(pdev, "unknown cause (not MSI or ACPI)");
60 return PCI_LOST_IRQ_NO_INFORMATION;
61 }
62 EXPORT_SYMBOL(pci_lost_interrupt);
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 int pci_request_irq(struct pci_dev *dev, unsigned int nr, irq_handler_t handler,
84 irq_handler_t thread_fn, void *dev_id, const char *fmt, ...)
85 {
86 va_list ap;
87 int ret;
88 char *devname;
89 unsigned long irqflags = IRQF_SHARED;
90
91 if (!handler)
92 irqflags |= IRQF_ONESHOT;
93
94 va_start(ap, fmt);
95 devname = kvasprintf(GFP_KERNEL, fmt, ap);
96 va_end(ap);
97
98 ret = request_threaded_irq(pci_irq_vector(dev, nr), handler, thread_fn,
99 irqflags, devname, dev_id);
100 if (ret)
101 kfree(devname);
102 return ret;
103 }
104 EXPORT_SYMBOL(pci_request_irq);
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120 void pci_free_irq(struct pci_dev *dev, unsigned int nr, void *dev_id)
121 {
122 kfree(free_irq(pci_irq_vector(dev, nr), dev_id));
123 }
124 EXPORT_SYMBOL(pci_free_irq);