From: "Jun'ichi Nomura" This is a minimum set to fix compile warnings and errors. Maybe better fleshed up by msi developers if necessary. The patch also fixes other build error below on CONFIG_IA64_GENERIC. CC arch/ia64/sn/pci/msi.o /build/rc6/source/arch/ia64/sn/pci/msi.c: At top level: /build/rc6/source/arch/ia64/sn/pci/msi.c:192: error: variable `sn_msi_ops' has initializer but incomplete type /build/rc6/source/arch/ia64/sn/pci/msi.c:193: error: unknown field `setup' specified in initializer /build/rc6/source/arch/ia64/sn/pci/msi.c:193: warning: excess elements in struct initializer /build/rc6/source/arch/ia64/sn/pci/msi.c:193: warning: (near initialization for `sn_msi_ops') /build/rc6/source/arch/ia64/sn/pci/msi.c:194: error: unknown field `teardown' specified in initializer /build/rc6/source/arch/ia64/sn/pci/msi.c:194: warning: excess elements in struct initializer /build/rc6/source/arch/ia64/sn/pci/msi.c:194: warning: (near initialization for `sn_msi_ops') /build/rc6/source/arch/ia64/sn/pci/msi.c:196: error: unknown field `target' specified in initializer /build/rc6/source/arch/ia64/sn/pci/msi.c:196: warning: excess elements in struct initializer /build/rc6/source/arch/ia64/sn/pci/msi.c:196: warning: (near initialization for `sn_msi_ops') /build/rc6/source/arch/ia64/sn/pci/msi.c:192: error: storage size of `sn_msi_ops' isn't known Cc: Greg KH Signed-off-by: Andrew Morton --- arch/ia64/sn/pci/msi.c | 2 - drivers/pci/msi.h | 60 ------------------------------- drivers/pci/pci.h | 3 - include/asm-i386/msi.h | 2 - include/asm-ia64/msi.h | 2 - include/asm-x86_64/msi.h | 2 - include/linux/msi.h | 71 +++++++++++++++++++++++++++++++++++++ 7 files changed, 73 insertions(+), 69 deletions(-) diff -puN arch/ia64/sn/pci/msi.c~mm-drivers-pci-msi-explicit-declaration-of-msi_register arch/ia64/sn/pci/msi.c --- 25/arch/ia64/sn/pci/msi.c~mm-drivers-pci-msi-explicit-declaration-of-msi_register Wed Mar 15 14:54:56 2006 +++ 25-akpm/arch/ia64/sn/pci/msi.c Wed Mar 15 14:54:56 2006 @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff -puN drivers/pci/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register drivers/pci/msi.h --- 25/drivers/pci/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register Wed Mar 15 14:54:56 2006 +++ 25-akpm/drivers/pci/msi.h Wed Mar 15 14:54:56 2006 @@ -6,7 +6,7 @@ #ifndef MSI_H #define MSI_H -#include +#include /* * Assume the maximum number of hot plug slots supported by the system is about @@ -82,62 +82,4 @@ struct msi_desc { void __iomem *mask_base; struct pci_dev *dev; }; - -/* - * MSI operation vector. Used by the msi core code (drivers/pci/msi.c) - * to abstract platform-specific tasks relating to MSI address generation - * and resource management. - */ -struct msi_ops { - /** - * setup - generate an MSI bus address and data for a given vector - * @pdev: PCI device context (in) - * @vector: vector allocated by the msi core (in) - * @addr_hi: upper 32 bits of PCI bus MSI address (out) - * @addr_lo: lower 32 bits of PCI bus MSI address (out) - * @data: MSI data payload (out) - * - * Description: The setup op is used to generate a PCI bus addres and - * data which the msi core will program into the card MSI capability - * registers. The setup routine is responsible for picking an initial - * cpu to target the MSI at. The setup routine is responsible for - * examining pdev to determine the MSI capabilities of the card and - * generating a suitable address/data. The setup routine is - * responsible for allocating and tracking any system resources it - * needs to route the MSI to the cpu it picks, and for associating - * those resources with the passed in vector. - * - * Returns 0 if the MSI address/data was successfully setup. - */ - int (*setup) (struct pci_dev *pdev, unsigned int vector, - u32 *addr_hi, u32 *addr_lo, u32 *data); - - /** - * teardown - release resources allocated by setup - * @vector: vector context for resources (in) - * - * Description: The teardown op is used to release any resources - * that were allocated in the setup routine associated with the passed - * in vector. - */ - void (*teardown) (unsigned int vector); - - /** - * target - retarget an MSI at a different cpu - * @vector: vector context for resources (in) - * @cpu: new cpu to direct vector at (in) - * @addr_hi: new value of PCI bus upper 32 bits (in/out) - * @addr_lo: new value of PCI bus lower 32 bits (in/out) - * - * Description: The target op is used to redirect an MSI vector - * at a different cpu. addr_hi/addr_lo coming in are the existing - * values that the MSI core has programmed into the card. The - * target code is responsible for freeing any resources (if any) - * associated with the old address, and generating a new PCI bus - * addr_hi/addr_lo that will redirect the vector at the indicated cpu. - */ - void (*target) (unsigned int vector, unsigned int cpu, - u32 *addr_hi, u32 *addr_lo); -}; - #endif /* MSI_H */ diff -puN drivers/pci/pci.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register drivers/pci/pci.h --- 25/drivers/pci/pci.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register Wed Mar 15 14:54:56 2006 +++ 25-akpm/drivers/pci/pci.h Wed Mar 15 14:54:56 2006 @@ -48,14 +48,11 @@ extern int pci_msi_quirk; #define pci_msi_quirk 0 #endif -struct msi_ops; #ifdef CONFIG_PCI_MSI void disable_msi_mode(struct pci_dev *dev, int pos, int type); -int msi_register(struct msi_ops *ops); void pci_no_msi(void); #else static inline void disable_msi_mode(struct pci_dev *dev, int pos, int type) { } -static inline int msi_register(struct msi_ops *ops) { return 0; } static inline void pci_no_msi(void) { } #endif diff -puN include/asm-i386/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register include/asm-i386/msi.h --- 25/include/asm-i386/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register Wed Mar 15 14:54:56 2006 +++ 25-akpm/include/asm-i386/msi.h Wed Mar 15 14:54:56 2006 @@ -12,8 +12,6 @@ #define LAST_DEVICE_VECTOR 232 #define MSI_TARGET_CPU_SHIFT 12 -extern struct msi_ops msi_apic_ops; - static inline int msi_arch_init(void) { msi_register(&msi_apic_ops); diff -puN include/asm-ia64/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register include/asm-ia64/msi.h --- 25/include/asm-ia64/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register Wed Mar 15 14:54:56 2006 +++ 25-akpm/include/asm-ia64/msi.h Wed Mar 15 14:54:56 2006 @@ -14,8 +14,6 @@ static inline void set_intr_gate (int nr #define ack_APIC_irq ia64_eoi #define MSI_TARGET_CPU_SHIFT 4 -extern struct msi_ops msi_apic_ops; - /* default ia64 msi init routine */ static inline int ia64_msi_init(void) { diff -puN include/asm-x86_64/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register include/asm-x86_64/msi.h --- 25/include/asm-x86_64/msi.h~mm-drivers-pci-msi-explicit-declaration-of-msi_register Wed Mar 15 14:54:56 2006 +++ 25-akpm/include/asm-x86_64/msi.h Wed Mar 15 14:54:56 2006 @@ -13,8 +13,6 @@ #define LAST_DEVICE_VECTOR 232 #define MSI_TARGET_CPU_SHIFT 12 -extern struct msi_ops msi_apic_ops; - static inline int msi_arch_init(void) { msi_register(&msi_apic_ops); diff -puN /dev/null include/linux/msi.h --- /dev/null Thu Apr 11 07:25:15 2002 +++ 25-akpm/include/linux/msi.h Wed Mar 15 14:54:56 2006 @@ -0,0 +1,71 @@ +#ifndef __LINUX_MSI_H +#define __LINUX_MSI_H + +#include +#include + +#ifdef CONFIG_PCI_MSI +struct pci_dev; +/* + * MSI operation vector. Used by the msi core code (drivers/pci/msi.c) + * to abstract platform-specific tasks relating to MSI address generation + * and resource management. + */ +struct msi_ops { + /** + * setup - generate an MSI bus address and data for a given vector + * @pdev: PCI device context (in) + * @vector: vector allocated by the msi core (in) + * @addr_hi: upper 32 bits of PCI bus MSI address (out) + * @addr_lo: lower 32 bits of PCI bus MSI address (out) + * @data: MSI data payload (out) + * + * Description: The setup op is used to generate a PCI bus addres and + * data which the msi core will program into the card MSI capability + * registers. The setup routine is responsible for picking an initial + * cpu to target the MSI at. The setup routine is responsible for + * examining pdev to determine the MSI capabilities of the card and + * generating a suitable address/data. The setup routine is + * responsible for allocating and tracking any system resources it + * needs to route the MSI to the cpu it picks, and for associating + * those resources with the passed in vector. + * + * Returns 0 if the MSI address/data was successfully setup. + */ + int (*setup) (struct pci_dev *pdev, unsigned int vector, + u32 *addr_hi, u32 *addr_lo, u32 *data); + + /** + * teardown - release resources allocated by setup + * @vector: vector context for resources (in) + * + * Description: The teardown op is used to release any resources + * that were allocated in the setup routine associated with the passed + * in vector. + */ + void (*teardown) (unsigned int vector); + + /** + * target - retarget an MSI at a different cpu + * @vector: vector context for resources (in) + * @cpu: new cpu to direct vector at (in) + * @addr_hi: new value of PCI bus upper 32 bits (in/out) + * @addr_lo: new value of PCI bus lower 32 bits (in/out) + * + * Description: The target op is used to redirect an MSI vector + * at a different cpu. addr_hi/addr_lo coming in are the existing + * values that the MSI core has programmed into the card. The + * target code is responsible for freeing any resources (if any) + * associated with the old address, and generating a new PCI bus + * addr_hi/addr_lo that will redirect the vector at the indicated cpu. + */ + void (*target) (unsigned int vector, unsigned int cpu, + u32 *addr_hi, u32 *addr_lo); +}; + +extern struct msi_ops msi_apic_ops; +int msi_register(struct msi_ops *ops); +#endif + +#include +#endif /* __LINUX_MSI_H */ _