aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-10-04 05:16:34 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:27 -0400
commit38bc0361303535c86f6b67b151a541728d7bdae6 (patch)
tree6a3939b1f7aea3b00fc4ecd72646fd8442c95766 /include/linux/pci.h
parent0366f8f7137deb072991e4c50769c6da31f8940c (diff)
[PATCH] genirq: msi: refactor the msi_ops
The current msi_ops are short sighted in a number of ways, this patch attempts to fix the glaring deficiences. - Report in msi_ops if a 64bit address is needed in the msi message, so we can fail 32bit only msi structures. - Send and receive a full struct msi_msg in both setup and target. This is a little cleaner and allows for architectures that need to modify the data to retarget the msi interrupt to a different cpu. - In target pass in the full cpu mask instead of just the first cpu in case we can make use of the full cpu mask. - Operate in terms of irqs and not vectors, currently there is still a 1-1 relationship but on architectures other than ia64 I expect this will change. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Rajesh Shah <rajesh.shah@intel.com> Cc: Andi Kleen <ak@muc.de> Cc: "Protasevich, Natalie" <Natalie.Protasevich@UNISYS.com> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b9bb6c46e056..2aabe90f1cd2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -617,6 +617,68 @@ extern int pci_enable_msix(struct pci_dev* dev,
617 struct msix_entry *entries, int nvec); 617 struct msix_entry *entries, int nvec);
618extern void pci_disable_msix(struct pci_dev *dev); 618extern void pci_disable_msix(struct pci_dev *dev);
619extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 619extern 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 */
626struct 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
680extern int msi_register(struct msi_ops *ops);
681
620#endif 682#endif
621 683
622extern void pci_block_user_cfg_access(struct pci_dev *dev); 684extern void pci_block_user_cfg_access(struct pci_dev *dev);