Define some PCI BAR constants and use them in existing drivers. Signed-off-by: David Marchand <david.march...@redhat.com> --- drivers/bus/pci/linux/pci_vfio.c | 7 +++---- lib/pci/rte_pci.h | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index f96b3ce7fb..c2e3d2f4b5 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -5,7 +5,6 @@ #include <unistd.h> #include <string.h> #include <fcntl.h> -#include <linux/pci_regs.h> #include <sys/eventfd.h> #include <sys/socket.h> #include <sys/ioctl.h> @@ -430,14 +429,14 @@ pci_vfio_is_ioport_bar(const struct rte_pci_device *dev, int vfio_dev_fd, } ret = pread64(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar), - offset + PCI_BASE_ADDRESS_0 + bar_index * 4); + offset + RTE_PCI_BASE_ADDRESS_0 + bar_index * 4); if (ret != sizeof(ioport_bar)) { RTE_LOG(ERR, EAL, "Cannot read command (%x) from config space!\n", - PCI_BASE_ADDRESS_0 + bar_index*4); + RTE_PCI_BASE_ADDRESS_0 + bar_index*4); return -1; } - return (ioport_bar & PCI_BASE_ADDRESS_SPACE_IO) != 0; + return (ioport_bar & RTE_PCI_BASE_ADDRESS_SPACE_IO) != 0; } static int diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index bf2b2639f4..429904cff9 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -43,6 +43,10 @@ extern "C" { #define RTE_PCI_STATUS 0x06 /* 16 bits */ #define RTE_PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ +/* Base addresses */ +#define RTE_PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ +#define RTE_PCI_BASE_ADDRESS_SPACE_IO 0x01 + /* Capability registers */ #define RTE_PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ #define RTE_PCI_CAP_ID_PM 0x01 /* Power Management */ -- 2.41.0