d->next = a->devices;
a->devices = d;
+ /*
+ * Applications compiled with older versions of libpci do not expect
+ * 32-bit domain numbers. To keep them working, we keep a 16-bit
+ * version of the domain number at the previous location in struct
+ * pci_dev. This will keep backward compatibility on systems which
+ * don't require large domain numbers.
+ */
+ if (d->domain > 0xffff)
+ d->domain_16 = 0xffff;
+ else
+ d->domain_16 = d->domain;
+
return 1;
}
struct pci_dev {
struct pci_dev *next; /* Next device in the chain */
- u16 domain_16; /* 16-bit PCI domain (host bridge) */
+ u16 domain_16; /* 16-bit version of the PCI domain for backward compatibility */
+ /* 0xffff if the real domain doesn't fit in 16 bits */
u8 bus, dev, func; /* Bus inside domain, device and function */
/* These fields are set by pci_fill_info() */
int numa_node; /* NUMA node */
pciaddr_t flags[6]; /* PCI_IORESOURCE_* flags for regions */
pciaddr_t rom_flags; /* PCI_IORESOURCE_* flags for expansion ROM */
- int domain; /* 32-bit PCI domain (host bridge) */
+ int domain; /* PCI domain (host bridge) */
/* Fields used internally: */
struct pci_access *access;
/* Ensure kernel provided domain that fits in a signed integer */
if (dom > 0x7fffffff)
- a->error("sysfs_scan: invalid domain:%x", dom);
+ a->error("sysfs_scan: Invalid domain %x", dom);
- /*
- * The domain value is truncated to 16 bits and stored in the pci_dev
- * structure's legacy 16-bit domain offset for compatibility with
- * applications compiled with libpci pre-32 bit domains. Such
- * applications may not work as expected if they are on a machine
- * utilizing PCI domain numbers requiring more than 16 bits.
- */
- d->domain_16 = dom;
d->domain = dom;
d->bus = bus;
d->dev = dev;