Re: pci_enable_msi() for everyone?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux