aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-12-16 17:38:18 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-01-06 17:02:26 -0500
commit76ccc297018d25d55b789bbd508861ef1e2cdb0c (patch)
tree27789ff0ea4a77ce4972987a836156255808f703 /drivers/pci
parentfb7ebfe4108e2cdfa2bb88e57148087717463dfa (diff)
x86/PCI: Expand the x86_msi_ops to have a restore MSIs.
The MSI restore function will become a function pointer in an x86_msi_ops struct. It defaults to the implementation in the io_apic.c and msi.c. We piggyback on the indirection mechanism introduced by "x86: Introduce x86_msi_ops". Cc: x86@kernel.org Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: linux-pci@vger.kernel.org Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 82de95ec2ea0..a825d78fd0aa 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -86,6 +86,31 @@ void default_teardown_msi_irqs(struct pci_dev *dev)
86} 86}
87#endif 87#endif
88 88
89#ifndef arch_restore_msi_irqs
90# define arch_restore_msi_irqs default_restore_msi_irqs
91# define HAVE_DEFAULT_MSI_RESTORE_IRQS
92#endif
93
94#ifdef HAVE_DEFAULT_MSI_RESTORE_IRQS
95void default_restore_msi_irqs(struct pci_dev *dev, int irq)
96{
97 struct msi_desc *entry;
98
99 entry = NULL;
100 if (dev->msix_enabled) {
101 list_for_each_entry(entry, &dev->msi_list, list) {
102 if (irq == entry->irq)
103 break;
104 }
105 } else if (dev->msi_enabled) {
106 entry = irq_get_msi_desc(irq);
107 }
108
109 if (entry)
110 write_msi_msg(irq, &entry->msg);
111}
112#endif
113
89static void msi_set_enable(struct pci_dev *dev, int pos, int enable) 114static void msi_set_enable(struct pci_dev *dev, int pos, int enable)
90{ 115{
91 u16 control; 116 u16 control;
@@ -372,7 +397,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
372 397
373 pci_intx_for_msi(dev, 0); 398 pci_intx_for_msi(dev, 0);
374 msi_set_enable(dev, pos, 0); 399 msi_set_enable(dev, pos, 0);
375 write_msi_msg(dev->irq, &entry->msg); 400 arch_restore_msi_irqs(dev, dev->irq);
376 401
377 pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); 402 pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control);
378 msi_mask_irq(entry, msi_capable_mask(control), entry->masked); 403 msi_mask_irq(entry, msi_capable_mask(control), entry->masked);
@@ -400,7 +425,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
400 pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); 425 pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control);
401 426
402 list_for_each_entry(entry, &dev->msi_list, list) { 427 list_for_each_entry(entry, &dev->msi_list, list) {
403 write_msi_msg(entry->irq, &entry->msg); 428 arch_restore_msi_irqs(dev, entry->irq);
404 msix_mask_irq(entry, entry->masked); 429 msix_mask_irq(entry, entry->masked);
405 } 430 }
406 431