diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-10-06 16:12:28 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2010-10-18 10:49:34 -0400 |
commit | 294ee6f89cfd629e276f632a6003a0fad7785dce (patch) | |
tree | d72a0ebf5fe371f22a9e8b7b24880d4758255121 /arch/x86/include | |
parent | 1525bf0d8f059a38c6e79353583854e1981b2e67 (diff) |
x86: Introduce x86_msi_ops
Introduce an x86 specific indirect mechanism to setup MSIs.
The MSI setup functions become function pointers in an x86_msi_ops
struct, that defaults to the implementation in io_apic.c and msi.c.
[v2: Use HAVE_DEFAULT_* knobs]
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/pci.h | 33 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 9 |
2 files changed, 40 insertions, 2 deletions
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index d395540ff894..ca0437c714b2 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
8 | #include <asm/scatterlist.h> | 8 | #include <asm/scatterlist.h> |
9 | #include <asm/io.h> | 9 | #include <asm/io.h> |
10 | #include <asm/x86_init.h> | ||
10 | 11 | ||
11 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
12 | 13 | ||
@@ -94,8 +95,36 @@ static inline void early_quirks(void) { } | |||
94 | 95 | ||
95 | extern void pci_iommu_alloc(void); | 96 | extern void pci_iommu_alloc(void); |
96 | 97 | ||
97 | /* MSI arch hook */ | 98 | #ifdef CONFIG_PCI_MSI |
98 | #define arch_setup_msi_irqs arch_setup_msi_irqs | 99 | /* MSI arch specific hooks */ |
100 | static inline int x86_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
101 | { | ||
102 | return x86_msi.setup_msi_irqs(dev, nvec, type); | ||
103 | } | ||
104 | |||
105 | static inline void x86_teardown_msi_irqs(struct pci_dev *dev) | ||
106 | { | ||
107 | x86_msi.teardown_msi_irqs(dev); | ||
108 | } | ||
109 | |||
110 | static inline void x86_teardown_msi_irq(unsigned int irq) | ||
111 | { | ||
112 | x86_msi.teardown_msi_irq(irq); | ||
113 | } | ||
114 | #define arch_setup_msi_irqs x86_setup_msi_irqs | ||
115 | #define arch_teardown_msi_irqs x86_teardown_msi_irqs | ||
116 | #define arch_teardown_msi_irq x86_teardown_msi_irq | ||
117 | /* implemented in arch/x86/kernel/apic/io_apic. */ | ||
118 | int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); | ||
119 | void native_teardown_msi_irq(unsigned int irq); | ||
120 | /* default to the implementation in drivers/lib/msi.c */ | ||
121 | #define HAVE_DEFAULT_MSI_TEARDOWN_IRQS | ||
122 | void default_teardown_msi_irqs(struct pci_dev *dev); | ||
123 | #else | ||
124 | #define native_setup_msi_irqs NULL | ||
125 | #define native_teardown_msi_irq NULL | ||
126 | #define default_teardown_msi_irqs NULL | ||
127 | #endif | ||
99 | 128 | ||
100 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) | 129 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) |
101 | 130 | ||
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index baa579c8e038..64642ad019fb 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -154,9 +154,18 @@ struct x86_platform_ops { | |||
154 | int (*i8042_detect)(void); | 154 | int (*i8042_detect)(void); |
155 | }; | 155 | }; |
156 | 156 | ||
157 | struct pci_dev; | ||
158 | |||
159 | struct x86_msi_ops { | ||
160 | int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type); | ||
161 | void (*teardown_msi_irq)(unsigned int irq); | ||
162 | void (*teardown_msi_irqs)(struct pci_dev *dev); | ||
163 | }; | ||
164 | |||
157 | extern struct x86_init_ops x86_init; | 165 | extern struct x86_init_ops x86_init; |
158 | extern struct x86_cpuinit_ops x86_cpuinit; | 166 | extern struct x86_cpuinit_ops x86_cpuinit; |
159 | extern struct x86_platform_ops x86_platform; | 167 | extern struct x86_platform_ops x86_platform; |
168 | extern struct x86_msi_ops x86_msi; | ||
160 | 169 | ||
161 | extern void x86_init_noop(void); | 170 | extern void x86_init_noop(void); |
162 | extern void x86_init_uint_noop(unsigned int unused); | 171 | extern void x86_init_uint_noop(unsigned int unused); |