libpci < 2.2.4 can not store class info in struct pci_dev. Read class info manually and store it in a separate variable.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-libpci_old_workaround/board_enable.c =================================================================== --- flashrom-libpci_old_workaround/board_enable.c (Revision 997) +++ flashrom-libpci_old_workaround/board_enable.c (Arbeitskopie) @@ -789,9 +789,11 @@
/* First, look for a known LPC bridge */ for (dev = pacc->devices; dev; dev = dev->next) { - pci_fill_info(dev, PCI_FILL_CLASS); + uint16_t device_class; + /* libpci before version 2.2.4 does not store class info. */ + device_class = pci_read_word(dev, PCI_CLASS_DEVICE); if ((dev->vendor_id == 0x8086) && - (dev->device_class == 0x0601)) { /* ISA Bridge */ + (device_class == 0x0601)) { /* ISA Bridge */ /* Is this device in our list? */ for (i = 0; intel_ich_gpio_table[i].id; i++) if (dev->device_id == intel_ich_gpio_table[i].id)
On 5/14/10 4:00 AM, Carl-Daniel Hailfinger wrote:
libpci < 2.2.4 can not store class info in struct pci_dev. Read class info manually and store it in a separate variable.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Wouldn't it make more sense to ask people to update their libpci? pciutils 2.2.3 is more than 4 years old.
Stefan
2010/5/14 Stefan Reinauer stefan.reinauer@coresystems.de:
On 5/14/10 4:00 AM, Carl-Daniel Hailfinger wrote:
libpci < 2.2.4 can not store class info in struct pci_dev. Read class info manually and store it in a separate variable.
Wouldn't it make more sense to ask people to update their libpci? pciutils 2.2.3 is more than 4 years old.
It can be very hard - for example in so-called 'enterprise' distributions, which claims API/ABI compatibility as its key feature. Thus sometimes it takes a lot of time to convince maintainer(s) to update package even in case of a minor version upgrade (especially then no bugs were filed against old version of package).
On 14.05.2010 11:51, Peter Lemenkov wrote:
2010/5/14 Stefan Reinauer stefan.reinauer@coresystems.de:
On 5/14/10 4:00 AM, Carl-Daniel Hailfinger wrote:
libpci < 2.2.4 can not store class info in struct pci_dev. Read class info manually and store it in a separate variable.
Wouldn't it make more sense to ask people to update their libpci? pciutils 2.2.3 is more than 4 years old.
Two reasons for this change: - If we want to get flashrom working with libpayload, we'd better not rely on the more exotic features of libpci because every such feature has to be coded up and I don't think we want to link flashrom-as-payload against the whole libpci. - The enterprise distro problem mentioned below.
It can be very hard - for example in so-called 'enterprise' distributions, which claims API/ABI compatibility as its key feature. Thus sometimes it takes a lot of time to convince maintainer(s) to update package even in case of a minor version upgrade (especially then no bugs were filed against old version of package).
In this case, the patch was motivated by a user request about flashrom on Fedora Core 1 with Linux kernel 2.4. Now if this request had been about removal of C99 constructs, I'd have refused, but an one-liner like the one I sent is IMHO a small price to pay.
Regards, Carl-Daniel
On Fri, May 14, 2010 at 02:25:40PM +0200, Carl-Daniel Hailfinger wrote:
- If we want to get flashrom working with libpayload, we'd better not
rely on the more exotic features of libpci because every such feature has to be coded up and I don't think we want to link flashrom-as-payload against the whole libpci.
- The enterprise distro problem mentioned below.
Yeah, I agree. It doesn't make sense to support arbitrarily old versions, but this one still seems to be in use nowadays and the fix is pretty simple in this case, so why not...
Acked-by: Uwe Hermann uwe@hermann-uwe.de
Uwe.
On 20.05.2010 21:14, Uwe Hermann wrote:
On Fri, May 14, 2010 at 02:25:40PM +0200, Carl-Daniel Hailfinger wrote:
- If we want to get flashrom working with libpayload, we'd better not
rely on the more exotic features of libpci because every such feature has to be coded up and I don't think we want to link flashrom-as-payload against the whole libpci.
- The enterprise distro problem mentioned below.
Yeah, I agree. It doesn't make sense to support arbitrarily old versions, but this one still seems to be in use nowadays and the fix is pretty simple in this case, so why not...
Acked-by: Uwe Hermann uwe@hermann-uwe.de
Thanks, committed in r1004.
Regards, Carl-Daniel