diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/msi.h | 49 | ||||
-rw-r--r-- | include/linux/pci.h | 67 |
2 files changed, 49 insertions, 67 deletions
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 |