aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc64/kernel/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/pci.c')
-rw-r--r--arch/sparc64/kernel/pci.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index dfc41cd4bb5..6b740eb6fe7 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -13,6 +13,8 @@
#include <linux/capability.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
+#include <linux/msi.h>
+#include <linux/irq.h>
#include <linux/init.h>
#include <asm/uaccess.h>
@@ -646,4 +648,37 @@ int pci_domain_nr(struct pci_bus *pbus)
}
EXPORT_SYMBOL(pci_domain_nr);
+#ifdef CONFIG_PCI_MSI
+int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
+{
+ struct pcidev_cookie *pcp = pdev->sysdata;
+ struct pci_pbm_info *pbm = pcp->pbm;
+ struct pci_controller_info *p = pbm->parent;
+ int virt_irq, err;
+
+ if (!pbm->msi_num || !p->setup_msi_irq)
+ return -EINVAL;
+
+ err = p->setup_msi_irq(&virt_irq, pdev, desc);
+ if (err < 0)
+ return err;
+
+ return virt_irq;
+}
+
+void arch_teardown_msi_irq(unsigned int virt_irq)
+{
+ struct msi_desc *entry = get_irq_data(virt_irq);
+ struct pci_dev *pdev = entry->dev;
+ struct pcidev_cookie *pcp = pdev->sysdata;
+ struct pci_pbm_info *pbm = pcp->pbm;
+ struct pci_controller_info *p = pbm->parent;
+
+ if (!pbm->msi_num || !p->setup_msi_irq)
+ return;
+
+ return p->teardown_msi_irq(virt_irq, pdev);
+}
+#endif /* !(CONFIG_PCI_MSI) */
+
#endif /* !(CONFIG_PCI) */