PCI: Use pci_find_ht_capability() in drivers/pci/quirks.c

Use pci_find_ht_capability() in drivers/pci/quirks.c.

I'm pretty sure the logic is unchanged here, but someone please eye-ball it
for me. I've changed the message to be a little shorter, it's now:

PCI: Found (enabled|disabled) HT MSI mapping on xxxx:xx:xx.x

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Michael Ellerman 2006-11-22 18:26:21 +11:00 committed by Greg Kroah-Hartman
parent d010b51c7e
commit 7a380507c4

View File

@ -1644,19 +1644,23 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_
* return 1 if a HT MSI capability is found and enabled */ * return 1 if a HT MSI capability is found and enabled */
static int __devinit msi_ht_cap_enabled(struct pci_dev *dev) static int __devinit msi_ht_cap_enabled(struct pci_dev *dev)
{ {
u8 pos; int pos, ttl = 48;
int ttl;
for (pos = pci_find_capability(dev, PCI_CAP_ID_HT), ttl = 48; pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
pos && ttl; while (pos && ttl--) {
pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_HT), ttl--) { u8 flags;
u32 cap_hdr;
/* MSI mapping section according to Hypertransport spec */ if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
if (pci_read_config_dword(dev, pos, &cap_hdr) == 0 &flags) == 0)
&& (cap_hdr & 0xf8000000) == 0xa8000000 /* MSI mapping */) { {
printk(KERN_INFO "PCI: Found HT MSI mapping on %s with capability %s\n", printk(KERN_INFO "PCI: Found %s HT MSI Mapping on %s\n",
pci_name(dev), cap_hdr & 0x10000 ? "enabled" : "disabled"); flags & HT_MSI_FLAGS_ENABLE ?
return (cap_hdr & 0x10000) != 0; /* MSI mapping cap enabled */ "enabled" : "disabled", pci_name(dev));
return (flags & HT_MSI_FLAGS_ENABLE) != 0;
} }
pos = pci_find_next_ht_capability(dev, pos,
HT_CAPTYPE_MSI_MAPPING);
} }
return 0; return 0;
} }