The base address flags are ignored when using sysfs method, while the proc and generic methods combined the flags into 'base_addr'. This inconsistency may fail some applications using libpci. Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx> --- lib/pci.h | 1 + lib/sysfs.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pci.h b/lib/pci.h index 452e1d8..b00a584 100644 --- a/lib/pci.h +++ b/lib/pci.h @@ -141,6 +141,7 @@ struct pci_dev { #define PCI_ADDR_IO_MASK (~(pciaddr_t) 0x3) #define PCI_ADDR_MEM_MASK (~(pciaddr_t) 0xf) +#define PCI_ADDR_FLAG_MASK 0xf u8 pci_read_byte(struct pci_dev *, int pos) PCI_ABI; /* Access to configuration space */ u16 pci_read_word(struct pci_dev *, int pos) PCI_ABI; diff --git a/lib/sysfs.c b/lib/sysfs.c index ca43562..3534048 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -107,23 +107,24 @@ sysfs_get_resources(struct pci_dev *d) a->error("Cannot open %s: %s", namebuf, strerror(errno)); for (i = 0; i < 7; i++) { - unsigned long long start, end, size; + unsigned long long start, end, size, flags; if (!fgets(buf, sizeof(buf), file)) break; - if (sscanf(buf, "%llx %llx", &start, &end) != 2) + if (sscanf(buf, "%llx %llx %llx", &start, &end, &flags) != 3) a->error("Syntax error in %s", namebuf); if (start) size = end - start + 1; else size = 0; + flags &= PCI_ADDR_FLAG_MASK; if (i < 6) { - d->base_addr[i] = start; + d->base_addr[i] = start | flags; d->size[i] = size; } else { - d->rom_base_addr = start; + d->rom_base_addr = start | flags; d->rom_size = size; } } -- 1.5.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html