Re: raw_pci_read in quirk_intel_irqbalance

From: Matthew Wilcox
Date: Mon Feb 11 2008 - 00:04:53 EST


On Sun, Feb 10, 2008 at 04:02:04PM -0700, Matthew Wilcox wrote:
> The line in question reads:
>
> /* read xTPR register */
> raw_pci_read(0, 0, 0x40, 0x4c, 2, &word);
>
> That's domain 0, bus 0, device 8, function 0, address 0x4c, length 2.
>
> I've checked the public E7525 and E7520 MCH datasheets, and they don't
> document the xTPR registers; nor do any of the devices in the datasheet
> have registers documented at 0x4c.
>
> You can see from my lspci above that I don't _have_ a device 8 on bus 0.
> The aforementioned documentation says:
>
> "A disabled or non-existent device's configuration register space is
> hidden. A disabled or non-existent device will return all ones for reads
> and will drop writes just as if the cycle terminated with a Master Abort
> on PCI."

I'd like to thank Grant for pointing out to me that this is exactly what
the write immediately above this is doing -- enabling device 8 to
respond to config space cycles.

> Now, my E7525 isn't affected by this quirk as it has a revision greater
> than 0x9. So maybe it's expected that device 8 is hidden on my machine;
> that it's only present on revisions up to 0x9. But maybe device 8 is
> always hidden, and that's why the author used raw_pci_ops?
>
> We can still do better than this, though. We can do:
>
> - raw_pci_read(0, 0, 0x40, 0x4c, 2, &word);
> + pci_bus_read_config_word(dev->bus, PCI_DEVFN(8, 0), 0x4c, &word);
>
> Using PCI_DEVFN tells people you really did mean device 8, and it's not
> a braino for device 4 or 2 (how many bits for slot and function again?)

Here's the patch to implement the above two suggestions:

----