Re: pci_enable_msi() for everyone?

From: Dave Jones
Date: Sat Jun 04 2005 - 02:25:31 EST


On Sat, Jun 04, 2005 at 12:18:03AM -0700, Greg KH wrote:
> On Sat, Jun 04, 2005 at 01:05:37AM -0600, Grant Grundler wrote:
> > On Fri, Jun 03, 2005 at 11:48:21PM -0700, Greg KH wrote:
> > > > One complication is some drivers will want to register a different
> > > > IRQ handler depending on if MSI is enabled or not.
> > >
> > > That's fine, they can always check the device capabilities and do that.
> >
> > Can you be more specific?
> > Maybe a short chunk of psuedo code?
>
> Hm, here's a possible function to do it (typed into my email client, not
> compiled, no warranties, etc...):
>
> /* returns 1 if device is in MSI mode, 0 otherwise */
> int pci_in_msi_mode(struct pci_dev *dev)
> {
> int pos;
> u16 control;
>
> pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
> if (!pos)
> return 0;
> pci_read_config_word(dev, msi_control_reg(pos), &control);
> if (control & PCI_MSI_FLAGS_ENABLE);
> return 1;
> return 0;
> }

What if MSI support has been disabled in the bridge due to some quirk
(like the recent AMD 8111 quirk) ? Maybe the above function
should check pci_msi_enable as well ?

Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/