[RFC/PATCH 4/16] Abstract MSI suspend
Michael Ellerman
michael at ellerman.id.au
Thu Jan 25 19:34:09 EST 2007
Currently pci_disable_device() disables MSI on a device by twiddling
bits in config space via disable_msi_mode().
On some platforms that may not be appropriate, so abstract the MSI
suspend logic into pci_disable_device_msi().
Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---
drivers/pci/msi.c | 11 +++++++++++
drivers/pci/pci.c | 7 +------
drivers/pci/pci.h | 2 ++
3 files changed, 14 insertions(+), 6 deletions(-)
Index: msi/drivers/pci/msi.c
===================================================================
--- msi.orig/drivers/pci/msi.c
+++ msi/drivers/pci/msi.c
@@ -271,6 +271,17 @@ void disable_msi_mode(struct pci_dev *de
pci_intx(dev, 1); /* enable intx */
}
+void pci_disable_device_msi(struct pci_dev *dev)
+{
+ if (dev->msi_enabled)
+ disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI),
+ PCI_CAP_ID_MSI);
+
+ if (dev->msix_enabled)
+ disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI),
+ PCI_CAP_ID_MSIX);
+}
+
static int msi_lookup_irq(struct pci_dev *dev, int type)
{
int irq;
Index: msi/drivers/pci/pci.c
===================================================================
--- msi.orig/drivers/pci/pci.c
+++ msi/drivers/pci/pci.c
@@ -770,12 +770,7 @@ pci_disable_device(struct pci_dev *dev)
if (atomic_sub_return(1, &dev->enable_cnt) != 0)
return;
- if (dev->msi_enabled)
- disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI),
- PCI_CAP_ID_MSI);
- if (dev->msix_enabled)
- disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI),
- PCI_CAP_ID_MSIX);
+ pci_disable_device_msi(dev);
pci_read_config_word(dev, PCI_COMMAND, &pci_command);
if (pci_command & PCI_COMMAND_MASTER) {
Index: msi/drivers/pci/pci.h
===================================================================
--- msi.orig/drivers/pci/pci.h
+++ msi/drivers/pci/pci.h
@@ -47,9 +47,11 @@ extern unsigned int pci_pm_d3_delay;
#ifdef CONFIG_PCI_MSI
void disable_msi_mode(struct pci_dev *dev, int pos, int type);
+extern void pci_disable_device_msi(struct pci_dev *dev);
void pci_no_msi(void);
#else
static inline void disable_msi_mode(struct pci_dev *dev, int pos, int type) { }
+static inline void pci_disable_device_msi(struct pci_dev *dev) { }
static inline void pci_no_msi(void) { }
#endif
More information about the Linuxppc-dev
mailing list