diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-i386/msi.h | 20 | ||||
-rw-r--r-- | include/asm-ia64/machvec.h | 21 | ||||
-rw-r--r-- | include/asm-ia64/machvec_sn2.h | 9 | ||||
-rw-r--r-- | include/asm-ia64/msi.h | 29 | ||||
-rw-r--r-- | include/asm-x86_64/msi.h | 21 | ||||
-rw-r--r-- | include/linux/msi.h | 49 | ||||
-rw-r--r-- | include/linux/pci.h | 67 |
7 files changed, 70 insertions, 146 deletions
diff --git a/include/asm-i386/msi.h b/include/asm-i386/msi.h deleted file mode 100644 index 7368a89a0f42..000000000000 --- a/include/asm-i386/msi.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003-2004 Intel | ||
3 | * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) | ||
4 | */ | ||
5 | |||
6 | #ifndef ASM_MSI_H | ||
7 | #define ASM_MSI_H | ||
8 | |||
9 | #include <asm/desc.h> | ||
10 | #include <mach_apic.h> | ||
11 | |||
12 | extern struct msi_ops arch_msi_ops; | ||
13 | |||
14 | static inline int msi_arch_init(void) | ||
15 | { | ||
16 | msi_register(&arch_msi_ops); | ||
17 | return 0; | ||
18 | } | ||
19 | |||
20 | #endif /* ASM_MSI_H */ | ||
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h index 15b545a897a4..90cba967df35 100644 --- a/include/asm-ia64/machvec.h +++ b/include/asm-ia64/machvec.h | |||
@@ -20,6 +20,7 @@ struct page; | |||
20 | struct mm_struct; | 20 | struct mm_struct; |
21 | struct pci_bus; | 21 | struct pci_bus; |
22 | struct task_struct; | 22 | struct task_struct; |
23 | struct pci_dev; | ||
23 | 24 | ||
24 | typedef void ia64_mv_setup_t (char **); | 25 | typedef void ia64_mv_setup_t (char **); |
25 | typedef void ia64_mv_cpu_init_t (void); | 26 | typedef void ia64_mv_cpu_init_t (void); |
@@ -75,7 +76,9 @@ typedef unsigned char ia64_mv_readb_relaxed_t (const volatile void __iomem *); | |||
75 | typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *); | 76 | typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *); |
76 | typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *); | 77 | typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *); |
77 | typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *); | 78 | typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *); |
78 | typedef int ia64_mv_msi_init_t (void); | 79 | |
80 | typedef int ia64_mv_setup_msi_irq_t (unsigned int irq, struct pci_dev *pdev); | ||
81 | typedef void ia64_mv_teardown_msi_irq_t (unsigned int irq); | ||
79 | 82 | ||
80 | static inline void | 83 | static inline void |
81 | machvec_noop (void) | 84 | machvec_noop (void) |
@@ -154,7 +157,8 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *); | |||
154 | # define platform_readl_relaxed ia64_mv.readl_relaxed | 157 | # define platform_readl_relaxed ia64_mv.readl_relaxed |
155 | # define platform_readq_relaxed ia64_mv.readq_relaxed | 158 | # define platform_readq_relaxed ia64_mv.readq_relaxed |
156 | # define platform_migrate ia64_mv.migrate | 159 | # define platform_migrate ia64_mv.migrate |
157 | # define platform_msi_init ia64_mv.msi_init | 160 | # define platform_setup_msi_irq ia64_mv.setup_msi_irq |
161 | # define platform_teardown_msi_irq ia64_mv.teardown_msi_irq | ||
158 | # endif | 162 | # endif |
159 | 163 | ||
160 | /* __attribute__((__aligned__(16))) is required to make size of the | 164 | /* __attribute__((__aligned__(16))) is required to make size of the |
@@ -204,7 +208,8 @@ struct ia64_machine_vector { | |||
204 | ia64_mv_readl_relaxed_t *readl_relaxed; | 208 | ia64_mv_readl_relaxed_t *readl_relaxed; |
205 | ia64_mv_readq_relaxed_t *readq_relaxed; | 209 | ia64_mv_readq_relaxed_t *readq_relaxed; |
206 | ia64_mv_migrate_t *migrate; | 210 | ia64_mv_migrate_t *migrate; |
207 | ia64_mv_msi_init_t *msi_init; | 211 | ia64_mv_setup_msi_irq_t *setup_msi_irq; |
212 | ia64_mv_teardown_msi_irq_t *teardown_msi_irq; | ||
208 | } __attribute__((__aligned__(16))); /* align attrib? see above comment */ | 213 | } __attribute__((__aligned__(16))); /* align attrib? see above comment */ |
209 | 214 | ||
210 | #define MACHVEC_INIT(name) \ | 215 | #define MACHVEC_INIT(name) \ |
@@ -250,7 +255,8 @@ struct ia64_machine_vector { | |||
250 | platform_readl_relaxed, \ | 255 | platform_readl_relaxed, \ |
251 | platform_readq_relaxed, \ | 256 | platform_readq_relaxed, \ |
252 | platform_migrate, \ | 257 | platform_migrate, \ |
253 | platform_msi_init, \ | 258 | platform_setup_msi_irq, \ |
259 | platform_teardown_msi_irq, \ | ||
254 | } | 260 | } |
255 | 261 | ||
256 | extern struct ia64_machine_vector ia64_mv; | 262 | extern struct ia64_machine_vector ia64_mv; |
@@ -404,8 +410,11 @@ extern int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size | |||
404 | #ifndef platform_migrate | 410 | #ifndef platform_migrate |
405 | # define platform_migrate machvec_noop_task | 411 | # define platform_migrate machvec_noop_task |
406 | #endif | 412 | #endif |
407 | #ifndef platform_msi_init | 413 | #ifndef platform_setup_msi_irq |
408 | # define platform_msi_init ((ia64_mv_msi_init_t*)NULL) | 414 | # define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL) |
415 | #endif | ||
416 | #ifndef platform_teardown_msi_irq | ||
417 | # define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL) | ||
409 | #endif | 418 | #endif |
410 | 419 | ||
411 | #endif /* _ASM_IA64_MACHVEC_H */ | 420 | #endif /* _ASM_IA64_MACHVEC_H */ |
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h index cf724dc79d8c..c54b165b1c17 100644 --- a/include/asm-ia64/machvec_sn2.h +++ b/include/asm-ia64/machvec_sn2.h | |||
@@ -67,7 +67,8 @@ extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device; | |||
67 | extern ia64_mv_dma_mapping_error sn_dma_mapping_error; | 67 | extern ia64_mv_dma_mapping_error sn_dma_mapping_error; |
68 | extern ia64_mv_dma_supported sn_dma_supported; | 68 | extern ia64_mv_dma_supported sn_dma_supported; |
69 | extern ia64_mv_migrate_t sn_migrate; | 69 | extern ia64_mv_migrate_t sn_migrate; |
70 | extern ia64_mv_msi_init_t sn_msi_init; | 70 | extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq; |
71 | extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq; | ||
71 | 72 | ||
72 | 73 | ||
73 | /* | 74 | /* |
@@ -120,9 +121,11 @@ extern ia64_mv_msi_init_t sn_msi_init; | |||
120 | #define platform_dma_supported sn_dma_supported | 121 | #define platform_dma_supported sn_dma_supported |
121 | #define platform_migrate sn_migrate | 122 | #define platform_migrate sn_migrate |
122 | #ifdef CONFIG_PCI_MSI | 123 | #ifdef CONFIG_PCI_MSI |
123 | #define platform_msi_init sn_msi_init | 124 | #define platform_setup_msi_irq sn_setup_msi_irq |
125 | #define platform_teardown_msi_irq sn_teardown_msi_irq | ||
124 | #else | 126 | #else |
125 | #define platform_msi_init ((ia64_mv_msi_init_t*)NULL) | 127 | #define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL) |
128 | #define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL) | ||
126 | #endif | 129 | #endif |
127 | 130 | ||
128 | #include <asm/sn/io.h> | 131 | #include <asm/sn/io.h> |
diff --git a/include/asm-ia64/msi.h b/include/asm-ia64/msi.h deleted file mode 100644 index bb92b0dbde2f..000000000000 --- a/include/asm-ia64/msi.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003-2004 Intel | ||
3 | * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) | ||
4 | */ | ||
5 | |||
6 | #ifndef ASM_MSI_H | ||
7 | #define ASM_MSI_H | ||
8 | |||
9 | #define NR_VECTORS NR_IRQS | ||
10 | #define FIRST_DEVICE_VECTOR IA64_FIRST_DEVICE_VECTOR | ||
11 | #define LAST_DEVICE_VECTOR IA64_LAST_DEVICE_VECTOR | ||
12 | static inline void set_intr_gate (int nr, void *func) {} | ||
13 | #define IO_APIC_VECTOR(irq) (irq) | ||
14 | #define ack_APIC_irq ia64_eoi | ||
15 | #define MSI_TARGET_CPU_SHIFT 4 | ||
16 | |||
17 | extern struct msi_ops msi_apic_ops; | ||
18 | |||
19 | static inline int msi_arch_init(void) | ||
20 | { | ||
21 | if (platform_msi_init) | ||
22 | return platform_msi_init(); | ||
23 | |||
24 | /* default ops for most ia64 platforms */ | ||
25 | msi_register(&msi_apic_ops); | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | #endif /* ASM_MSI_H */ | ||
diff --git a/include/asm-x86_64/msi.h b/include/asm-x86_64/msi.h deleted file mode 100644 index 1876fda52ae3..000000000000 --- a/include/asm-x86_64/msi.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003-2004 Intel | ||
3 | * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) | ||
4 | */ | ||
5 | |||
6 | #ifndef ASM_MSI_H | ||
7 | #define ASM_MSI_H | ||
8 | |||
9 | #include <asm/desc.h> | ||
10 | #include <asm/mach_apic.h> | ||
11 | #include <asm/smp.h> | ||
12 | |||
13 | extern struct msi_ops arch_msi_ops; | ||
14 | |||
15 | static inline int msi_arch_init(void) | ||
16 | { | ||
17 | msi_register(&arch_msi_ops); | ||
18 | return 0; | ||
19 | } | ||
20 | |||
21 | #endif /* ASM_MSI_H */ | ||
diff --git a/include/linux/msi.h b/include/linux/msi.h new file mode 100644 index 000000000000..c7ef94343673 --- /dev/null +++ b/include/linux/msi.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef LINUX_MSI_H | ||
2 | #define LINUX_MSI_H | ||
3 | |||
4 | struct msi_msg { | ||
5 | u32 address_lo; /* low 32 bits of msi message address */ | ||
6 | u32 address_hi; /* high 32 bits of msi message address */ | ||
7 | u32 data; /* 16 bits of msi message data */ | ||
8 | }; | ||
9 | |||
10 | /* Heper functions */ | ||
11 | extern void mask_msi_irq(unsigned int irq); | ||
12 | extern void unmask_msi_irq(unsigned int irq); | ||
13 | extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); | ||
14 | |||
15 | extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); | ||
16 | |||
17 | struct msi_desc { | ||
18 | struct { | ||
19 | __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ | ||
20 | __u8 maskbit : 1; /* mask-pending bit supported ? */ | ||
21 | __u8 unused : 1; | ||
22 | __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ | ||
23 | __u8 pos; /* Location of the msi capability */ | ||
24 | __u16 entry_nr; /* specific enabled entry */ | ||
25 | unsigned default_irq; /* default pre-assigned irq */ | ||
26 | }msi_attrib; | ||
27 | |||
28 | struct { | ||
29 | __u16 head; | ||
30 | __u16 tail; | ||
31 | }link; | ||
32 | |||
33 | void __iomem *mask_base; | ||
34 | struct pci_dev *dev; | ||
35 | |||
36 | #ifdef CONFIG_PM | ||
37 | /* PM save area for MSIX address/data */ | ||
38 | struct msi_msg msg_save; | ||
39 | #endif | ||
40 | }; | ||
41 | |||
42 | /* | ||
43 | * The arch hook for setup up msi irqs | ||
44 | */ | ||
45 | int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev); | ||
46 | void arch_teardown_msi_irq(unsigned int irq); | ||
47 | |||
48 | |||
49 | #endif /* LINUX_MSI_H */ | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 9b34bc8f34e4..0da5a4a8940f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -595,11 +595,6 @@ struct msix_entry { | |||
595 | u16 entry; /* driver uses to specify entry, OS writes */ | 595 | u16 entry; /* driver uses to specify entry, OS writes */ |
596 | }; | 596 | }; |
597 | 597 | ||
598 | struct msi_msg { | ||
599 | u32 address_lo; /* low 32 bits of msi message address */ | ||
600 | u32 address_hi; /* high 32 bits of msi message address */ | ||
601 | u32 data; /* 16 bits of msi message data */ | ||
602 | }; | ||
603 | 598 | ||
604 | #ifndef CONFIG_PCI_MSI | 599 | #ifndef CONFIG_PCI_MSI |
605 | static inline void pci_scan_msi_device(struct pci_dev *dev) {} | 600 | static inline void pci_scan_msi_device(struct pci_dev *dev) {} |
@@ -617,68 +612,6 @@ extern int pci_enable_msix(struct pci_dev* dev, | |||
617 | struct msix_entry *entries, int nvec); | 612 | struct msix_entry *entries, int nvec); |
618 | extern void pci_disable_msix(struct pci_dev *dev); | 613 | extern void pci_disable_msix(struct pci_dev *dev); |
619 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); | 614 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); |
620 | |||
621 | /* | ||
622 | * MSI operation vector. Used by the msi core code (drivers/pci/msi.c) | ||
623 | * to abstract platform-specific tasks relating to MSI address generation | ||
624 | * and resource management. | ||
625 | */ | ||
626 | struct msi_ops { | ||
627 | int needs_64bit_address; | ||
628 | /** | ||
629 | * setup - generate an MSI bus address and data for a given vector | ||
630 | * @pdev: PCI device context (in) | ||
631 | * @irq: irq allocated by the msi core (in) | ||
632 | * @msg: PCI bus address and data for msi message (out) | ||
633 | * | ||
634 | * Description: The setup op is used to generate a PCI bus addres and | ||
635 | * data which the msi core will program into the card MSI capability | ||
636 | * registers. The setup routine is responsible for picking an initial | ||
637 | * cpu to target the MSI at. The setup routine is responsible for | ||
638 | * examining pdev to determine the MSI capabilities of the card and | ||
639 | * generating a suitable address/data. The setup routine is | ||
640 | * responsible for allocating and tracking any system resources it | ||
641 | * needs to route the MSI to the cpu it picks, and for associating | ||
642 | * those resources with the passed in vector. | ||
643 | * | ||
644 | * Returns 0 if the MSI address/data was successfully setup. | ||
645 | **/ | ||
646 | |||
647 | int (*setup) (struct pci_dev *pdev, unsigned int irq, | ||
648 | struct msi_msg *msg); | ||
649 | |||
650 | /** | ||
651 | * teardown - release resources allocated by setup | ||
652 | * @vector: vector context for resources (in) | ||
653 | * | ||
654 | * Description: The teardown op is used to release any resources | ||
655 | * that were allocated in the setup routine associated with the passed | ||
656 | * in vector. | ||
657 | **/ | ||
658 | |||
659 | void (*teardown) (unsigned int irq); | ||
660 | |||
661 | /** | ||
662 | * target - retarget an MSI at a different cpu | ||
663 | * @vector: vector context for resources (in) | ||
664 | * @cpu: new cpu to direct vector at (in) | ||
665 | * @addr_hi: new value of PCI bus upper 32 bits (in/out) | ||
666 | * @addr_lo: new value of PCI bus lower 32 bits (in/out) | ||
667 | * | ||
668 | * Description: The target op is used to redirect an MSI vector | ||
669 | * at a different cpu. addr_hi/addr_lo coming in are the existing | ||
670 | * values that the MSI core has programmed into the card. The | ||
671 | * target code is responsible for freeing any resources (if any) | ||
672 | * associated with the old address, and generating a new PCI bus | ||
673 | * addr_hi/addr_lo that will redirect the vector at the indicated cpu. | ||
674 | **/ | ||
675 | |||
676 | void (*target) (unsigned int irq, cpumask_t cpumask, | ||
677 | struct msi_msg *msg); | ||
678 | }; | ||
679 | |||
680 | extern int msi_register(struct msi_ops *ops); | ||
681 | |||
682 | #endif | 615 | #endif |
683 | 616 | ||
684 | #ifdef CONFIG_HT_IRQ | 617 | #ifdef CONFIG_HT_IRQ |