lkml.org 
[lkml]   [2005]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: pci_enable_msi() for everyone?
From
Date

> 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;
> }

That would assume the architecture/slot/hw_setup always support MSI.
What if you put an SMI capable card in a machine that doesn't do MSI ?

> If you use the above function, then you can tell the difference and
> register different irq handlers if you wish.

No you can't because you lack the result code from pci_enable_msi()
which can fail (because it's veto'd by the arch for example)

> The main point being is that the pci_enable_msi() function would not
> have to be explicitly called by your driver, it would have already been
> taken care of earlier by the PCI core. That's what I want to do and am
> wondering if there would be any bad side affects to it.

Disagreed.

Ben

-
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/

\
 
 \ /
  Last update: 2005-06-06 00:05    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site