Bryce, Here is how I fixed it. Please search for "~cpw" to find my comments (three of them). I stumbled across the bug with a chipset whose PCI bridge is a multifunction device.
Best regards, Chih-Pin Wu ************************************************************* Extracted from common_bridge.c, libpciaccess 0.12.0 int pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus, int *secondary_bus, int *subordinate_bus) { struct pci_device_private * priv = (struct pci_device_private *) dev; /* If the device isn't a bridge, return an error. */ if (((dev->device_class >> 16) & 0x0ff) != 0x06) { return ENODEV; } //~cpw Removed the following three statements // priv->bridge.pci is invalid since it is initialized to null; // As a result, the function always returns ENODEV. // // if (!priv->bridge.pci) { // return ENODEV; // } switch ((dev->device_class >> 8) & 0x0ff) { case 0x00: /* What to do for host bridges? I'm pretty sure this isn't right. */ *primary_bus = dev->bus; *secondary_bus = -1; *subordinate_bus = -1; break; case 0x01: case 0x02: case 0x03: *primary_bus = dev->bus; *secondary_bus = -1; *subordinate_bus = -1; break; case 0x04: if (priv->bridge.pci == NULL) read_bridge_info(priv); //~cpw Mask bit7 of header type since it is a multi-function device // indicator; Bridge itself could be a multi-function device and // the comparison should be against 0x01 and 0x81 // if (priv->header_type == 0x01) { if ((priv->header_type & 0x7f) == 0x01) { *primary_bus = priv->bridge.pci->primary_bus; *secondary_bus = priv->bridge.pci->secondary_bus; *subordinate_bus = priv->bridge.pci->subordinate_bus; } else { *primary_bus = dev->bus; *secondary_bus = -1; *subordinate_bus = -1; } break; case 0x07: if (priv->bridge.pcmcia == NULL) read_bridge_info(priv); //~cpw Mask bit7 of header type since it is a multi-function device // indicator; Bridge itself could be a multi-function device and // the comparison should be against 0x02 and 0x82 // if (priv->header_type == 0x02) { if ((priv->header_type & 0x7f) == 0x02) { *primary_bus = priv->bridge.pcmcia->primary_bus; *secondary_bus = priv->bridge.pcmcia->card_bus; *subordinate_bus = priv->bridge.pcmcia->subordinate_bus; } else { *primary_bus = dev->bus; *secondary_bus = -1; *subordinate_bus = -1; } break; } return 0; } -----Original Message----- From: boun...@canonical.com [mailto:boun...@canonical.com] On Behalf Of Bryce Harrington Sent: Friday, November 26, 2010 4:52 PM To: Chihpin Wu Subject: [Bug 681207] Re: PCI device header type doesn't include bit7 Hi chihpinwu, thanks for reporting this issue. I don't think there's been a lot of testing with multi-function cards so this may have gone untested. I'm a bit uncertain how this should be fixed - would you be willing to suggest a patch? ** Changed in: libpciaccess (Ubuntu) Status: New => Triaged ** Changed in: libpciaccess (Ubuntu) Importance: Undecided => Medium ** Changed in: libpciaccess (Ubuntu) Assignee: (unassigned) => Bryce Harrington (bryce) -- PCI device header type doesn't include bit7 https://bugs.launchpad.net/bugs/681207 You received this bug notification because you are a direct subscriber of the bug. Status in "libpciaccess" package in Ubuntu: Triaged Bug description: Within the function pci_device_get_bridge_buses() in file common_bridge.c, "priiv->header_type" is used to detect the bridge type without bit 7 (indicating multi-function or not) stripped. As a result the detection would always fail for multi-function card. I see this error in both versions 0.10.6 and 0.12.0. Beside this problem, version 0.12.0 has a pointer check "priv->bridge.pci" upon fuction entrance and just return "ENODEV" if it is null. The problem is that the pointer never got initialized in the first place and will always be null. This checking should be removed. To unsubscribe from this bug, go to: https://bugs.launchpad.net/ubuntu/+source/libpciaccess/+bug/681207/+subs cribe -- PCI device header type doesn't include bit7 https://bugs.launchpad.net/bugs/681207 You received this bug notification because you are a member of Ubuntu-X, which is subscribed to libpciaccess in ubuntu. _______________________________________________ Mailing list: https://launchpad.net/~ubuntu-x-swat Post to : ubuntu-x-swat@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-x-swat More help : https://help.launchpad.net/ListHelp