diff options
-rw-r--r-- | arch/mips/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/s390/include/asm/pci.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/pci.h | 30 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 24 | ||||
-rw-r--r-- | drivers/pci/msi.c | 48 | ||||
-rw-r--r-- | include/linux/msi.h | 8 |
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 | |||
144 | extern char * (*pcibios_plat_setup)(char *str); | 139 | extern 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 */ |
114 | extern int pci_proc_domain(struct pci_bus *bus); | 114 | extern 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 | |||
121 | struct vm_area_struct; | 116 | struct 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 */ |
123 | int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, | 118 | int 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 *); | |||
21 | int pci_domain_nr(struct pci_bus *); | 21 | int pci_domain_nr(struct pci_bus *); |
22 | int pci_proc_domain(struct pci_bus *); | 22 | int 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) { } | |||
100 | extern void pci_iommu_alloc(void); | 100 | extern void pci_iommu_alloc(void); |
101 | 101 | ||
102 | #ifdef CONFIG_PCI_MSI | 102 | #ifdef CONFIG_PCI_MSI |
103 | /* MSI arch specific hooks */ | ||
104 | static 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 | |||
109 | static inline void x86_teardown_msi_irqs(struct pci_dev *dev) | ||
110 | { | ||
111 | x86_msi.teardown_msi_irqs(dev); | ||
112 | } | ||
113 | |||
114 | static inline void x86_teardown_msi_irq(unsigned int irq) | ||
115 | { | ||
116 | x86_msi.teardown_msi_irq(irq); | ||
117 | } | ||
118 | static 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. */ |
127 | struct msi_desc; | 104 | struct msi_desc; |
128 | int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); | 105 | int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); |
@@ -130,16 +107,9 @@ void native_teardown_msi_irq(unsigned int irq); | |||
130 | void native_restore_msi_irqs(struct pci_dev *dev, int irq); | 107 | void native_restore_msi_irqs(struct pci_dev *dev, int irq); |
131 | int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, | 108 | int 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 | ||
136 | void default_teardown_msi_irqs(struct pci_dev *dev); | ||
137 | void 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 | ||
109 | EXPORT_SYMBOL_GPL(x86_platform); | 109 | EXPORT_SYMBOL_GPL(x86_platform); |
110 | |||
111 | #if defined(CONFIG_PCI_MSI) | ||
110 | struct x86_msi_ops x86_msi = { | 112 | struct 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 */ | ||
122 | int 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 | |||
127 | void arch_teardown_msi_irqs(struct pci_dev *dev) | ||
128 | { | ||
129 | x86_msi.teardown_msi_irqs(dev); | ||
130 | } | ||
131 | |||
132 | void arch_teardown_msi_irq(unsigned int irq) | ||
133 | { | ||
134 | x86_msi.teardown_msi_irq(irq); | ||
135 | } | ||
136 | |||
137 | void arch_restore_msi_irqs(struct pci_dev *dev, int irq) | ||
138 | { | ||
139 | x86_msi.restore_msi_irqs(dev, irq); | ||
140 | } | ||
141 | #endif | ||
142 | |||
119 | struct x86_io_apic_ops x86_io_apic_ops = { | 143 | struct 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 | 33 | int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) |
34 | int 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 | 38 | void __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 | 42 | int __weak arch_msi_check_device(struct pci_dev *dev, int nvec, int type) |
46 | int default_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | 43 | { |
44 | return 0; | ||
45 | } | ||
46 | |||
47 | int __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 | */ | ||
76 | void default_teardown_msi_irqs(struct pci_dev *dev) | 74 | void 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 | 91 | void __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 | ||
100 | void default_restore_msi_irqs(struct pci_dev *dev, int irq) | 96 | void 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 | |
114 | void __weak arch_restore_msi_irqs(struct pci_dev *dev, int irq) | ||
115 | { | ||
116 | return default_restore_msi_irqs(dev, irq); | ||
117 | } | ||
118 | 118 | ||
119 | static void msi_set_enable(struct pci_dev *dev, int enable) | 119 | static 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 | */ |
56 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); | 58 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); |
57 | void arch_teardown_msi_irq(unsigned int irq); | 59 | void arch_teardown_msi_irq(unsigned int irq); |
58 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); | 60 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); |
59 | void arch_teardown_msi_irqs(struct pci_dev *dev); | 61 | void arch_teardown_msi_irqs(struct pci_dev *dev); |
60 | int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); | 62 | int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); |
63 | void arch_restore_msi_irqs(struct pci_dev *dev, int irq); | ||
64 | |||
65 | void default_teardown_msi_irqs(struct pci_dev *dev); | ||
66 | void default_restore_msi_irqs(struct pci_dev *dev, int irq); | ||
61 | 67 | ||
62 | #endif /* LINUX_MSI_H */ | 68 | #endif /* LINUX_MSI_H */ |