Sebastian Herbszt
2008-Aug-15 21:24 UTC
[syslinux] [PATCH] pci: fix pci_scan() - do not increment pci_device pointer
Commit a56f1a4e63e9fc38294a2b96d1672d3fa532a7a8 (pci: store device address) broke pci_scan(). It increments pci_device which then points to the wrong slot: struct pci_device *pci_device &pci_device_list->pci_device[pci_device_list->count]; ... pci_device->addr = a; ... pci_device++; ... pci_bus_list->pci_bus[bus]. pci_device[pci_bus_list->pci_bus[bus].pci_device_count] = pci_device; Partial revert of a56f1a4e63e9fc38294a2b96d1672d3fa532a7a8 does fix this. - Sebastian --- syslinux-3.71-12-ga19312b/com32/lib/pci/scan.c.orig 2008-08-15 22:13:57.000000000 +0200 +++ syslinux-3.71-12-ga19312b/com32/lib/pci/scan.c 2008-08-15 22:39:07.000000000 +0200 @@ -363,9 +363,6 @@ for (dev = 0; dev < MAX_PCI_DEVICES ; dev++) { maxfunc = 1; /* Assume a single-function device */ for (func = 0; func < maxfunc; func++) { - struct pci_device *pci_device - &pci_device_list->pci_device[pci_device_list->count]; - a = pci_mkaddr(bus, dev, func, 0); did = pci_readl(a); @@ -381,7 +378,9 @@ rid = pci_readb(a + 0x08); sid = pci_readl(a + 0x2c); - + struct pci_device *pci_device + &pci_device_list-> + pci_device[pci_device_list->count]; pci_device->addr = a; pci_device->product = did >> 16; pci_device->sub_product = sid >> 16; @@ -389,8 +388,6 @@ pci_device->sub_vendor = (sid << 16) >> 16; pci_device->revision = rid; pci_device_list->count++; - pci_device++; - dprintf ("Scanning: BUS %02x DID %08x (%04x:%04x) SID %08x RID %02x\n", bus, did, did >> 16, (did << 16) >> 16,