aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/include/asm/pci.h5
-rw-r--r--arch/powerpc/include/asm/pci.h5
-rw-r--r--arch/s390/include/asm/pci.h4
-rw-r--r--arch/x86/include/asm/pci.h30
-rw-r--r--arch/x86/kernel/x86_init.c24
-rw-r--r--drivers/pci/msi.c48
-rw-r--r--include/linux/msi.h8
7 files changed, 55 insertions, 69 deletions
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index fa8e0aa250ca..f194c08bd057 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -136,11 +136,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
136 return channel ? 15 : 14; 136 return channel ? 15 : 14;
137} 137}
138 138
139#ifdef CONFIG_CPU_CAVIUM_OCTEON
140/* MSI arch hook for OCTEON */
141#define arch_setup_msi_irqs arch_setup_msi_irqs
142#endif
143
144extern char * (*pcibios_plat_setup)(char *str); 139extern char * (*pcibios_plat_setup)(char *str);
145 140
146#ifdef CONFIG_OF 141#ifdef CONFIG_OF
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 6653f2743c4e..95145a15c708 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -113,11 +113,6 @@ extern int pci_domain_nr(struct pci_bus *bus);
113/* Decide whether to display the domain number in /proc */ 113/* Decide whether to display the domain number in /proc */
114extern int pci_proc_domain(struct pci_bus *bus); 114extern int pci_proc_domain(struct pci_bus *bus);
115 115
116/* MSI arch hooks */
117#define arch_setup_msi_irqs arch_setup_msi_irqs
118#define arch_teardown_msi_irqs arch_teardown_msi_irqs
119#define arch_msi_check_device arch_msi_check_device
120
121struct vm_area_struct; 116struct vm_area_struct;
122/* Map a range of PCI memory or I/O space for a device into user space */ 117/* Map a range of PCI memory or I/O space for a device into user space */
123int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, 118int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 6e577ba0e5da..262b91bb8811 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -21,10 +21,6 @@ void pci_iounmap(struct pci_dev *, void __iomem *);
21int pci_domain_nr(struct pci_bus *); 21int pci_domain_nr(struct pci_bus *);
22int pci_proc_domain(struct pci_bus *); 22int pci_proc_domain(struct pci_bus *);
23 23
24/* MSI arch hooks */
25#define arch_setup_msi_irqs arch_setup_msi_irqs
26#define arch_teardown_msi_irqs arch_teardown_msi_irqs
27
28#define ZPCI_BUS_NR 0 /* default bus number */ 24#define ZPCI_BUS_NR 0 /* default bus number */
29#define ZPCI_DEVFN 0 /* default device number */ 25#define ZPCI_DEVFN 0 /* default device number */
30 26
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index d9e9e6c7ed32..7d7443283a9d 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -100,29 +100,6 @@ static inline void early_quirks(void) { }
100extern void pci_iommu_alloc(void); 100extern void pci_iommu_alloc(void);
101 101
102#ifdef CONFIG_PCI_MSI 102#ifdef CONFIG_PCI_MSI
103/* MSI arch specific hooks */
104static inline int x86_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
105{
106 return x86_msi.setup_msi_irqs(dev, nvec, type);
107}
108
109static inline void x86_teardown_msi_irqs(struct pci_dev *dev)
110{
111 x86_msi.teardown_msi_irqs(dev);
112}
113
114static inline void x86_teardown_msi_irq(unsigned int irq)
115{
116 x86_msi.teardown_msi_irq(irq);
117}
118static inline void x86_restore_msi_irqs(struct pci_dev *dev, int irq)
119{
120 x86_msi.restore_msi_irqs(dev, irq);
121}
122#define arch_setup_msi_irqs x86_setup_msi_irqs
123#define arch_teardown_msi_irqs x86_teardown_msi_irqs
124#define arch_teardown_msi_irq x86_teardown_msi_irq
125#define arch_restore_msi_irqs x86_restore_msi_irqs
126/* implemented in arch/x86/kernel/apic/io_apic. */ 103/* implemented in arch/x86/kernel/apic/io_apic. */
127struct msi_desc; 104struct msi_desc;
128int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 105int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
@@ -130,16 +107,9 @@ void native_teardown_msi_irq(unsigned int irq);
130void native_restore_msi_irqs(struct pci_dev *dev, int irq); 107void native_restore_msi_irqs(struct pci_dev *dev, int irq);
131int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, 108int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
132 unsigned int irq_base, unsigned int irq_offset); 109 unsigned int irq_base, unsigned int irq_offset);
133/* default to the implementation in drivers/lib/msi.c */
134#define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
135#define HAVE_DEFAULT_MSI_RESTORE_IRQS
136void default_teardown_msi_irqs(struct pci_dev *dev);
137void default_restore_msi_irqs(struct pci_dev *dev, int irq);
138#else 110#else
139#define native_setup_msi_irqs NULL 111#define native_setup_msi_irqs NULL
140#define native_teardown_msi_irq NULL 112#define native_teardown_msi_irq NULL
141#define default_teardown_msi_irqs NULL
142#define default_restore_msi_irqs NULL
143#endif 113#endif
144 114
145#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) 115#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 45a14dbbddaf..5587f991d111 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -107,6 +107,8 @@ struct x86_platform_ops x86_platform = {
107}; 107};
108 108
109EXPORT_SYMBOL_GPL(x86_platform); 109EXPORT_SYMBOL_GPL(x86_platform);
110
111#if defined(CONFIG_PCI_MSI)
110struct x86_msi_ops x86_msi = { 112struct x86_msi_ops x86_msi = {
111 .setup_msi_irqs = native_setup_msi_irqs, 113 .setup_msi_irqs = native_setup_msi_irqs,
112 .compose_msi_msg = native_compose_msi_msg, 114 .compose_msi_msg = native_compose_msi_msg,
@@ -116,6 +118,28 @@ struct x86_msi_ops x86_msi = {
116 .setup_hpet_msi = default_setup_hpet_msi, 118 .setup_hpet_msi = default_setup_hpet_msi,
117}; 119};
118 120
121/* MSI arch specific hooks */
122int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
123{
124 return x86_msi.setup_msi_irqs(dev, nvec, type);
125}
126
127void arch_teardown_msi_irqs(struct pci_dev *dev)
128{
129 x86_msi.teardown_msi_irqs(dev);
130}
131
132void arch_teardown_msi_irq(unsigned int irq)
133{
134 x86_msi.teardown_msi_irq(irq);
135}
136
137void arch_restore_msi_irqs(struct pci_dev *dev, int irq)
138{
139 x86_msi.restore_msi_irqs(dev, irq);
140}
141#endif
142
119struct x86_io_apic_ops x86_io_apic_ops = { 143struct x86_io_apic_ops x86_io_apic_ops = {
120 .init = native_io_apic_init_mappings, 144 .init = native_io_apic_init_mappings,
121 .read = native_io_apic_read, 145 .read = native_io_apic_read,
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index aca7578b05e5..823c3861c4d8 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -30,20 +30,21 @@ static int pci_msi_enable = 1;
30 30
31/* Arch hooks */ 31/* Arch hooks */
32 32
33#ifndef arch_msi_check_device 33int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
34int arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
35{ 34{
36 return 0; 35 return -EINVAL;
37} 36}
38#endif
39 37
40#ifndef arch_setup_msi_irqs 38void __weak arch_teardown_msi_irq(unsigned int irq)
41# define arch_setup_msi_irqs default_setup_msi_irqs 39{
42# define HAVE_DEFAULT_MSI_SETUP_IRQS 40}
43#endif
44 41
45#ifdef HAVE_DEFAULT_MSI_SETUP_IRQS 42int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
46int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 43{
44 return 0;
45}
46
47int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
47{ 48{
48 struct msi_desc *entry; 49 struct msi_desc *entry;
49 int ret; 50 int ret;
@@ -65,14 +66,11 @@ int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
65 66
66 return 0; 67 return 0;
67} 68}
68#endif
69
70#ifndef arch_teardown_msi_irqs
71# define arch_teardown_msi_irqs default_teardown_msi_irqs
72# define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
73#endif
74 69
75#ifdef HAVE_DEFAULT_MSI_TEARDOWN_IRQS 70/*
71 * We have a default implementation available as a separate non-weak
72 * function, as it is used by the Xen x86 PCI code
73 */
76void default_teardown_msi_irqs(struct pci_dev *dev) 74void default_teardown_msi_irqs(struct pci_dev *dev)
77{ 75{
78 struct msi_desc *entry; 76 struct msi_desc *entry;
@@ -89,14 +87,12 @@ void default_teardown_msi_irqs(struct pci_dev *dev)
89 arch_teardown_msi_irq(entry->irq + i); 87 arch_teardown_msi_irq(entry->irq + i);
90 } 88 }
91} 89}
92#endif
93 90
94#ifndef arch_restore_msi_irqs 91void __weak arch_teardown_msi_irqs(struct pci_dev *dev)
95# define arch_restore_msi_irqs default_restore_msi_irqs 92{
96# define HAVE_DEFAULT_MSI_RESTORE_IRQS 93 return default_teardown_msi_irqs(dev);
97#endif 94}
98 95
99#ifdef HAVE_DEFAULT_MSI_RESTORE_IRQS
100void default_restore_msi_irqs(struct pci_dev *dev, int irq) 96void default_restore_msi_irqs(struct pci_dev *dev, int irq)
101{ 97{
102 struct msi_desc *entry; 98 struct msi_desc *entry;
@@ -114,7 +110,11 @@ void default_restore_msi_irqs(struct pci_dev *dev, int irq)
114 if (entry) 110 if (entry)
115 write_msi_msg(irq, &entry->msg); 111 write_msi_msg(irq, &entry->msg);
116} 112}
117#endif 113
114void __weak arch_restore_msi_irqs(struct pci_dev *dev, int irq)
115{
116 return default_restore_msi_irqs(dev, irq);
117}
118 118
119static void msi_set_enable(struct pci_dev *dev, int enable) 119static void msi_set_enable(struct pci_dev *dev, int enable)
120{ 120{
diff --git a/include/linux/msi.h b/include/linux/msi.h
index ee66f3a12fb6..271dfd14a05f 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -51,12 +51,18 @@ struct msi_desc {
51}; 51};
52 52
53/* 53/*
54 * The arch hook for setup up msi irqs 54 * The arch hooks to setup up msi irqs. Those functions are
55 * implemented as weak symbols so that they /can/ be overriden by
56 * architecture specific code if needed.
55 */ 57 */
56int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 58int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
57void arch_teardown_msi_irq(unsigned int irq); 59void arch_teardown_msi_irq(unsigned int irq);
58int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 60int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
59void arch_teardown_msi_irqs(struct pci_dev *dev); 61void arch_teardown_msi_irqs(struct pci_dev *dev);
60int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); 62int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
63void arch_restore_msi_irqs(struct pci_dev *dev, int irq);
64
65void default_teardown_msi_irqs(struct pci_dev *dev);
66void default_restore_msi_irqs(struct pci_dev *dev, int irq);
61 67
62#endif /* LINUX_MSI_H */ 68#endif /* LINUX_MSI_H */