Messages in this thread Patch in this message | | | Date | Fri, 24 Jan 2003 19:33:53 -0500 | From | "Wiedemeier, Jeff" <> | Subject | Re: [patch 2.5] tg3.c: pci_{save,restore}_extended_state |
| |
On Fri, Jan 24, 2003 at 02:32:52PM -0800, David S. Miller wrote: > From: Ivan Kokshaysky <ink@jurassic.park.msu.ru> > Date: Sat, 25 Jan 2003 01:41:02 +0300 > > I don't understand the issue, really. The config register says: > "MSIs are enabled". Which means: "My platform is *really* going to > use MSI". Why do you want to ignore that? > > I see, why not code up a generic pci_using_msi(pdev) that > does this? > > I suggested a per-arch version because I was not clear on how > this exactly worked.
You mean something like this? My reading of the PCI spec says that if the enable bit in Message Command (part of which is PCI_MSI_FLAGS as defined in pci.h) is that if the enable bit is set, MSIs are being used...
Then the tg3 code after the pci_restore_extended_state could be if (pci_using_msi(tp->pdev)) tw32(MSGINT_MODE, MSGINT_MODE_ENABLE);
/jeff ------ diff -Nuar linux-2.5.59/drivers/pci/pci.c pci_using_msi/drivers/pci/pci.c --- linux-2.5.59/drivers/pci/pci.c Thu Jan 16 21:21:48 2003 +++ pci_using_msi/drivers/pci/pci.c Fri Jan 24 19:00:53 2003 @@ -679,6 +679,26 @@ } } +/** + * pci_using_msi - is this pci device configured to use MSI? + * @dev: PCI device structure of device being queried + * + * Tells whether or not a pci device is configured to use Message Signalled + * Interrupts. Returns non-zero if configured for MSI, else 0. + */ +int +pci_using_msi(struct pci_dev *dev) +{ + int msi = pci_find_capability(dev, PCI_CAP_ID_MSI); + u8 flags; + + if (!msi) + return 0; + + pci_read_config_byte(dev, msi + PCI_MSI_FLAGS, &flags); + return (flags & PCI_MSI_FLAGS_ENABLE); +} + int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { @@ -749,6 +769,7 @@ EXPORT_SYMBOL(pci_set_master); EXPORT_SYMBOL(pci_set_mwi); EXPORT_SYMBOL(pci_clear_mwi); +EXPORT_SYMBOL(pci_using_msi); EXPORT_SYMBOL(pci_set_dma_mask); EXPORT_SYMBOL(pci_dac_set_dma_mask); EXPORT_SYMBOL(pci_assign_resource); diff -Nuar linux-2.5.59/include/linux/pci.h pci_using_msi/include/linux/pci.h --- linux-2.5.59/include/linux/pci.h Thu Jan 16 21:22:08 2003 +++ pci_using_msi/include/linux/pci.h Fri Jan 24 19:01:26 2003 @@ -622,6 +622,7 @@ #define HAVE_PCI_SET_MWI int pci_set_mwi(struct pci_dev *dev); void pci_clear_mwi(struct pci_dev *dev); +int pci_using_msi(struct pci_dev *dev); int pci_set_dma_mask(struct pci_dev *dev, u64 mask); int pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask); int pci_assign_resource(struct pci_dev *dev, int i); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |