| .. | .. |
|---|
| 6 | 6 | * Copyright (C) 2017 Christoph Hellwig. |
|---|
| 7 | 7 | */ |
|---|
| 8 | 8 | |
|---|
| 9 | | -#include <linux/acpi.h> |
|---|
| 10 | 9 | #include <linux/device.h> |
|---|
| 11 | 10 | #include <linux/kernel.h> |
|---|
| 12 | 11 | #include <linux/export.h> |
|---|
| 13 | 12 | #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 | | - * pci_lost_interrupt - reports a lost PCI interrupt |
|---|
| 28 | | - * @pdev: device whose interrupt is lost |
|---|
| 29 | | - * |
|---|
| 30 | | - * The primary function of this routine is to report a lost interrupt |
|---|
| 31 | | - * in a standard way which users can recognise (instead of blaming the |
|---|
| 32 | | - * driver). |
|---|
| 33 | | - * |
|---|
| 34 | | - * Returns: |
|---|
| 35 | | - * a suggestion for fixing it (although the driver is not required to |
|---|
| 36 | | - * act on this). |
|---|
| 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 | | - /* currently no way to fix acpi on the fly */ |
|---|
| 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 | 13 | |
|---|
| 64 | 14 | /** |
|---|
| 65 | 15 | * pci_request_irq - allocate an interrupt line for a PCI device |
|---|