summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2015-09-14 17:00:28 +0200
committerMartin Mares <mj@ucw.cz>2015-09-14 17:00:28 +0200
commit7ef7f3ec9830ebc3266da7d7bce1fe86ba04032a (patch)
tree3b14f533dbcfd44e48d1d7cd583ec1edf6851917
parent5bdd27f66a98943e9e88cd75c7b637f10b420484 (diff)
downloadpciutils-7ef7f3ec9830ebc3266da7d7bce1fe86ba04032a.tar.gz
NUMA node scanning is now done in an ABI-compatible way
The numa_node field was moved to the end of the public part of struct pci_dev. As usually, it has to be requested using the PCI_FILL_NUMA_NODE and pci_fill_info() is versioned.
-rw-r--r--lib/access.c16
-rw-r--r--lib/internal.h1
-rw-r--r--lib/libpci.ver5
-rw-r--r--lib/pci.h27
-rw-r--r--lib/sysfs.c2
-rw-r--r--lspci.c4
6 files changed, 33 insertions, 22 deletions
diff --git a/lib/access.c b/lib/access.c
index a547d2c..5994008 100644
--- a/lib/access.c
+++ b/lib/access.c
@@ -155,7 +155,7 @@ pci_write_block(struct pci_dev *d, int pos, byte *buf, int len)
}
int
-pci_fill_info_v33(struct pci_dev *d, int flags)
+pci_fill_info_v34(struct pci_dev *d, int flags)
{
if (flags & PCI_FILL_RESCAN)
{
@@ -169,15 +169,17 @@ pci_fill_info_v33(struct pci_dev *d, int flags)
}
/* In version 3.1, pci_fill_info got new flags => versioned alias */
-/* In versions 3.2 and 3.3, the same has happened */
-STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v33(d, flags));
-DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v33);
-DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v33);
-DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v33);
+/* In versions 3.2, 3.3 and 3.4, the same has happened */
+STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v34(d, flags));
+DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v34);
+DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v34);
+DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v34);
+DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v34);
SYMBOL_VERSION(pci_fill_info_v30, pci_fill_info@LIBPCI_3.0);
SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@LIBPCI_3.1);
SYMBOL_VERSION(pci_fill_info_v32, pci_fill_info@LIBPCI_3.2);
-SYMBOL_VERSION(pci_fill_info_v33, pci_fill_info@@LIBPCI_3.3);
+SYMBOL_VERSION(pci_fill_info_v33, pci_fill_info@LIBPCI_3.3);
+SYMBOL_VERSION(pci_fill_info_v34, pci_fill_info@@LIBPCI_3.4);
void
pci_setup_cache(struct pci_dev *d, byte *cache, int len)
diff --git a/lib/internal.h b/lib/internal.h
index a312385..7e101ab 100644
--- a/lib/internal.h
+++ b/lib/internal.h
@@ -69,6 +69,7 @@ int pci_fill_info_v30(struct pci_dev *, int flags) VERSIONED_ABI;
int pci_fill_info_v31(struct pci_dev *, int flags) VERSIONED_ABI;
int pci_fill_info_v32(struct pci_dev *, int flags) VERSIONED_ABI;
int pci_fill_info_v33(struct pci_dev *, int flags) VERSIONED_ABI;
+int pci_fill_info_v34(struct pci_dev *, int flags) VERSIONED_ABI;
/* params.c */
void pci_define_param(struct pci_access *acc, char *param, char *val, char *help);
diff --git a/lib/libpci.ver b/lib/libpci.ver
index 31f89fd..7ac8d34 100644
--- a/lib/libpci.ver
+++ b/lib/libpci.ver
@@ -61,3 +61,8 @@ LIBPCI_3.3 {
pci_filter_parse_id;
pci_filter_parse_slot;
};
+
+LIBPCI_3.4 {
+ global:
+ pci_fill_info;
+};
diff --git a/lib/pci.h b/lib/pci.h
index aafcfcb..39df8ea 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -127,7 +127,6 @@ struct pci_dev {
u16 vendor_id, device_id; /* Identity of the device */
u16 device_class; /* PCI device class */
int irq; /* IRQ number */
- int numa_node; /* NUMA node */
pciaddr_t base_addr[6]; /* Base addresses including flags in lower bits */
pciaddr_t size[6]; /* Region sizes */
pciaddr_t rom_base_addr; /* Expansion ROM base address */
@@ -136,6 +135,7 @@ struct pci_dev {
char *phy_slot; /* Physical slot */
char *module_alias; /* Linux kernel module alias */
char *label; /* Device name as exported by BIOS */
+ int numa_node; /* NUMA node */
/* Fields used internally: */
struct pci_access *access;
@@ -162,18 +162,19 @@ int pci_write_block(struct pci_dev *, int pos, u8 *buf, int len) PCI_ABI;
int pci_fill_info(struct pci_dev *, int flags) PCI_ABI; /* Fill in device information */
-#define PCI_FILL_IDENT 1
-#define PCI_FILL_IRQ 2
-#define PCI_FILL_BASES 4
-#define PCI_FILL_ROM_BASE 8
-#define PCI_FILL_SIZES 16
-#define PCI_FILL_CLASS 32
-#define PCI_FILL_CAPS 64
-#define PCI_FILL_EXT_CAPS 128
-#define PCI_FILL_PHYS_SLOT 256
-#define PCI_FILL_MODULE_ALIAS 512
-#define PCI_FILL_LABEL 1024
-#define PCI_FILL_RESCAN 0x10000
+#define PCI_FILL_IDENT 0x0001
+#define PCI_FILL_IRQ 0x0002
+#define PCI_FILL_BASES 0x0004
+#define PCI_FILL_ROM_BASE 0x0008
+#define PCI_FILL_SIZES 0x0010
+#define PCI_FILL_CLASS 0x0020
+#define PCI_FILL_CAPS 0x0040
+#define PCI_FILL_EXT_CAPS 0x0080
+#define PCI_FILL_PHYS_SLOT 0x0100
+#define PCI_FILL_MODULE_ALIAS 0x0200
+#define PCI_FILL_LABEL 0x0400
+#define PCI_FILL_NUMA_NODE 0x0800
+#define PCI_FILL_RESCAN 0x00010000
void pci_setup_cache(struct pci_dev *, u8 *cache, int len) PCI_ABI;
diff --git a/lib/sysfs.c b/lib/sysfs.c
index 800fb4e..9c005bb 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -200,7 +200,7 @@ static void sysfs_scan(struct pci_access *a)
d->vendor_id = sysfs_get_value(d, "vendor");
d->device_id = sysfs_get_value(d, "device");
d->device_class = sysfs_get_value(d, "class") >> 8;
- d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES;
+ d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_NUMA_NODE;
}
pci_link_dev(a, d);
}
diff --git a/lspci.c b/lspci.c
index 9ec6570..219e260 100644
--- a/lspci.c
+++ b/lspci.c
@@ -138,7 +138,9 @@ scan_device(struct pci_dev *p)
d->config_cached += 64;
}
pci_setup_cache(p, d->config, d->config_cached);
- pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_PHYS_SLOT | PCI_FILL_LABEL);
+ pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES |
+ PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_PHYS_SLOT | PCI_FILL_LABEL |
+ PCI_FILL_NUMA_NODE);
return d;
}