Register a logtype for this bus driver and stop logging as EAL.

Signed-off-by: David Marchand <david.march...@redhat.com>
---
 drivers/bus/pci/bsd/pci.c            |  44 +++----
 drivers/bus/pci/linux/pci.c          |  52 ++++----
 drivers/bus/pci/linux/pci_uio.c      |  75 +++++-------
 drivers/bus/pci/linux/pci_vfio.c     | 173 +++++++++++----------------
 drivers/bus/pci/pci_common.c         |  85 ++++++-------
 drivers/bus/pci/pci_common_uio.c     |  15 +--
 drivers/bus/pci/pci_params.c         |   9 +-
 drivers/bus/pci/private.h            |   6 +
 drivers/bus/pci/windows/pci.c        |  13 +-
 drivers/bus/pci/windows/pci_netuio.c |   7 +-
 10 files changed, 202 insertions(+), 277 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 27f12590d4..2f88252418 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -60,8 +60,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
                ret = pci_uio_map_resource(dev);
                break;
        default:
-               RTE_LOG(DEBUG, EAL,
-                       "  Not managed by a supported kernel driver, 
skipped\n");
+               PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, 
skipped");
                ret = 1;
                break;
        }
@@ -80,8 +79,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
                pci_uio_unmap_resource(dev);
                break;
        default:
-               RTE_LOG(DEBUG, EAL,
-                       "  Not managed by a supported kernel driver, 
skipped\n");
+               PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, 
skipped");
                break;
        }
 }
@@ -112,20 +110,19 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
                        dev->addr.bus, dev->addr.devid, dev->addr.function);
 
        if (access(devname, O_RDWR) < 0) {
-               RTE_LOG(WARNING, EAL, "  "PCI_PRI_FMT" not managed by UIO 
driver, "
-                               "skipping\n", loc->domain, loc->bus, 
loc->devid, loc->function);
+               PCI_LOG(WARNING, "  "PCI_PRI_FMT" not managed by UIO driver, 
skipping",
+                       loc->domain, loc->bus, loc->devid, loc->function);
                return 1;
        }
 
        /* save fd if in primary process */
        if (rte_intr_fd_set(dev->intr_handle, open(devname, O_RDWR))) {
-               RTE_LOG(WARNING, EAL, "Failed to save fd");
+               PCI_LOG(WARNING, "Failed to save fd");
                goto error;
        }
 
        if (rte_intr_fd_get(dev->intr_handle) < 0) {
-               RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-                       devname, strerror(errno));
+               PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
                goto error;
        }
 
@@ -135,8 +132,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
        /* allocate the mapping details for secondary processes*/
        *uio_res = rte_zmalloc("UIO_RES", sizeof(**uio_res), 0);
        if (*uio_res == NULL) {
-               RTE_LOG(ERR, EAL,
-                       "%s(): cannot store uio mmap details\n", __func__);
+               PCI_LOG(ERR, "%s(): cannot store uio mmap details", __func__);
                goto error;
        }
 
@@ -168,8 +164,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, 
int res_idx,
        /* allocate memory to keep path */
        maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
        if (maps[map_idx].path == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-                               strerror(errno));
+               PCI_LOG(ERR, "Cannot allocate memory for path: %s", 
strerror(errno));
                return -1;
        }
 
@@ -178,8 +173,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, 
int res_idx,
         */
        fd = open(devname, O_RDWR);
        if (fd < 0) {
-               RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-                               devname, strerror(errno));
+               PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
                goto error;
        }
 
@@ -215,7 +209,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 
        pdev = malloc(sizeof(*pdev));
        if (pdev == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci 
device\n");
+               PCI_LOG(ERR, "Cannot allocate memory for internal pci device");
                return -1;
        }
 
@@ -345,15 +339,15 @@ rte_pci_scan(void)
 
        fd = open("/dev/pci", O_RDONLY);
        if (fd < 0) {
-               RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+               PCI_LOG(ERR, "%s(): error opening /dev/pci", __func__);
                goto error;
        }
 
        do {
                unsigned i;
                if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
-                       RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: 
%s\n",
-                                       __func__, strerror(errno));
+                       PCI_LOG(ERR, "%s(): error with ioctl on /dev/pci: %s",
+                               __func__, strerror(errno));
                        goto error;
                }
 
@@ -375,7 +369,7 @@ rte_pci_scan(void)
 
        close(fd);
 
-       RTE_LOG(DEBUG, EAL, "PCI scan found %u devices\n", dev_count);
+       PCI_LOG(DEBUG, "PCI scan found %u devices", dev_count);
        return 0;
 
 error:
@@ -395,7 +389,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv 
__rte_unused,
                     const struct rte_pci_device *pdev)
 {
        if (pdev->kdrv != RTE_PCI_KDRV_NIC_UIO)
-               RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to 
IOVA as 'PA'\n");
+               PCI_LOG(DEBUG, "Unsupported kernel driver? Defaulting to IOVA 
as 'PA'");
 
        return RTE_IOVA_PA;
 }
@@ -420,7 +414,7 @@ int rte_pci_read_config(const struct rte_pci_device *dev,
 
        fd = open("/dev/pci", O_RDWR);
        if (fd < 0) {
-               RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+               PCI_LOG(ERR, "%s(): error opening /dev/pci", __func__);
                goto error;
        }
 
@@ -465,7 +459,7 @@ int rte_pci_write_config(const struct rte_pci_device *dev,
        };
 
        if (len == 3 || len > sizeof(pi.pi_data)) {
-               RTE_LOG(ERR, EAL, "%s(): invalid pci read length\n", __func__);
+               PCI_LOG(ERR, "%s(): invalid pci read length", __func__);
                goto error;
        }
 
@@ -473,7 +467,7 @@ int rte_pci_write_config(const struct rte_pci_device *dev,
 
        fd = open("/dev/pci", O_RDWR);
        if (fd < 0) {
-               RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__);
+               PCI_LOG(ERR, "%s(): error opening /dev/pci", __func__);
                goto error;
        }
 
@@ -521,7 +515,7 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 #if defined(RTE_ARCH_X86)
        case RTE_PCI_KDRV_NIC_UIO:
                if (rte_eal_iopl_init() != 0) {
-                       RTE_LOG(ERR, EAL, "%s(): insufficient ioport 
permissions for PCI device %s\n",
+                       PCI_LOG(ERR, "%s(): insufficient ioport permissions for 
PCI device %s",
                                __func__, dev->name);
                        return -1;
                }
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 3d237398d9..9056035b33 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -75,8 +75,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
                }
                break;
        default:
-               RTE_LOG(DEBUG, EAL,
-                       "  Not managed by a supported kernel driver, 
skipped\n");
+               PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, 
skipped");
                ret = 1;
                break;
        }
@@ -102,8 +101,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
                pci_uio_unmap_resource(dev);
                break;
        default:
-               RTE_LOG(DEBUG, EAL,
-                       "  Not managed by a supported kernel driver, 
skipped\n");
+               PCI_LOG(DEBUG, "  Not managed by a supported kernel driver, 
skipped");
                break;
        }
 }
@@ -147,8 +145,7 @@ pci_parse_one_sysfs_resource(char *line, size_t len, 
uint64_t *phys_addr,
        } res_info;
 
        if (rte_strsplit(line, len, res_info.ptrs, 3, ' ') != 3) {
-               RTE_LOG(ERR, EAL,
-                       "%s(): bad resource format\n", __func__);
+               PCI_LOG(ERR, "%s(): bad resource format", __func__);
                return -1;
        }
        errno = 0;
@@ -156,8 +153,7 @@ pci_parse_one_sysfs_resource(char *line, size_t len, 
uint64_t *phys_addr,
        *end_addr = strtoull(res_info.end_addr, NULL, 16);
        *flags = strtoull(res_info.flags, NULL, 16);
        if (errno != 0) {
-               RTE_LOG(ERR, EAL,
-                       "%s(): bad resource format\n", __func__);
+               PCI_LOG(ERR, "%s(): bad resource format", __func__);
                return -1;
        }
 
@@ -175,15 +171,14 @@ pci_parse_sysfs_resource(const char *filename, struct 
rte_pci_device *dev)
 
        f = fopen(filename, "r");
        if (f == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot open sysfs resource\n");
+               PCI_LOG(ERR, "Cannot open sysfs resource");
                return -1;
        }
 
        for (i = 0; i<PCI_MAX_RESOURCE; i++) {
 
                if (fgets(buf, sizeof(buf), f) == NULL) {
-                       RTE_LOG(ERR, EAL,
-                               "%s(): cannot read resource\n", __func__);
+                       PCI_LOG(ERR, "%s(): cannot read resource", __func__);
                        goto error;
                }
                if (pci_parse_one_sysfs_resource(buf, sizeof(buf), &phys_addr,
@@ -218,7 +213,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr 
*addr)
 
        pdev = malloc(sizeof(*pdev));
        if (pdev == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci 
device\n");
+               PCI_LOG(ERR, "Cannot allocate memory for internal pci device");
                return -1;
        }
 
@@ -300,7 +295,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr 
*addr)
        /* parse resources */
        snprintf(filename, sizeof(filename), "%s/resource", dirname);
        if (pci_parse_sysfs_resource(filename, dev) < 0) {
-               RTE_LOG(ERR, EAL, "%s(): cannot parse resource\n", __func__);
+               PCI_LOG(ERR, "%s(): cannot parse resource", __func__);
                pci_free(pdev);
                return -1;
        }
@@ -309,7 +304,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr 
*addr)
        snprintf(filename, sizeof(filename), "%s/driver", dirname);
        ret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver));
        if (ret < 0) {
-               RTE_LOG(ERR, EAL, "Fail to get kernel driver\n");
+               PCI_LOG(ERR, "Fail to get kernel driver");
                pci_free(pdev);
                return -1;
        }
@@ -371,7 +366,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr 
*addr)
                                                 * So we just print out the
                                                 * error as an alarm.
                                                 */
-                                               RTE_LOG(ERR, EAL, "Unexpected 
device scan at %s!\n",
+                                               PCI_LOG(ERR, "Unexpected device 
scan at %s!",
                                                        filename);
                                        else if (dev2->device.devargs !=
                                                 dev->device.devargs) {
@@ -454,8 +449,7 @@ rte_pci_scan(void)
 
        dir = opendir(rte_pci_get_sysfs_path());
        if (dir == NULL) {
-               RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n",
-                       __func__, strerror(errno));
+               PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, 
strerror(errno));
                return -1;
        }
 
@@ -505,14 +499,14 @@ pci_device_iommu_support_va(const struct rte_pci_device 
*dev)
                if (errno == ENOENT)
                        return true;
 
-               RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
+               PCI_LOG(ERR, "%s(): can't open %s: %s",
                        __func__, filename, strerror(errno));
                return false;
        }
 
        /* We have an Intel IOMMU */
        if (fscanf(fp, "%" PRIx64, &vtd_cap_reg) != 1) {
-               RTE_LOG(ERR, EAL, "%s(): can't read %s\n", __func__, filename);
+               PCI_LOG(ERR, "%s(): can't read %s", __func__, filename);
                fclose(fp);
                return false;
        }
@@ -556,7 +550,7 @@ pci_device_iommu_support_va(__rte_unused const struct 
rte_pci_device *dev)
        bool ret = false;
 
        if (fp == NULL) {
-               RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
+               PCI_LOG(ERR, "%s(): can't open %s: %s",
                        __func__, filename, strerror(errno));
                return ret;
        }
@@ -565,15 +559,15 @@ pci_device_iommu_support_va(__rte_unused const struct 
rte_pci_device *dev)
        while (getline(&line, &len, fp) != -1) {
                if (strstr(line, "platform") != NULL) {
                        if (strstr(line, "PowerNV") != NULL) {
-                               RTE_LOG(DEBUG, EAL, "Running on a PowerNV 
platform\n");
+                               PCI_LOG(DEBUG, "Running on a PowerNV platform");
                                powernv = true;
                        } else if (strstr(line, "pSeries") != NULL) {
-                               RTE_LOG(DEBUG, EAL, "Running on a pSeries 
platform\n");
+                               PCI_LOG(DEBUG, "Running on a pSeries platform");
                                pseries = true;
                        }
                } else if (strstr(line, "model") != NULL) {
                        if (strstr(line, "qemu") != NULL) {
-                               RTE_LOG(DEBUG, EAL, "Found qemu emulation\n");
+                               PCI_LOG(DEBUG, "Found qemu emulation");
                                qemu = true;
                        }
                }
@@ -650,8 +644,7 @@ int rte_pci_read_config(const struct rte_pci_device *device,
        default:
                rte_pci_device_name(&device->addr, devname,
                                    RTE_DEV_NAME_MAX_LEN);
-               RTE_LOG(ERR, EAL,
-                       "Unknown driver type for %s\n", devname);
+               PCI_LOG(ERR, "Unknown driver type for %s", devname);
                return -1;
        }
 }
@@ -674,8 +667,7 @@ int rte_pci_write_config(const struct rte_pci_device 
*device,
        default:
                rte_pci_device_name(&device->addr, devname,
                                    RTE_DEV_NAME_MAX_LEN);
-               RTE_LOG(ERR, EAL,
-                       "Unknown driver type for %s\n", devname);
+               PCI_LOG(ERR, "Unknown driver type for %s", devname);
                return -1;
        }
 }
@@ -697,8 +689,7 @@ int rte_pci_mmio_read(const struct rte_pci_device *device, 
int bar,
        default:
                rte_pci_device_name(&device->addr, devname,
                                    RTE_DEV_NAME_MAX_LEN);
-               RTE_LOG(ERR, EAL,
-                       "Unknown driver type for %s\n", devname);
+               PCI_LOG(ERR, "Unknown driver type for %s", devname);
                return -1;
        }
 }
@@ -720,8 +711,7 @@ int rte_pci_mmio_write(const struct rte_pci_device *device, 
int bar,
        default:
                rte_pci_device_name(&device->addr, devname,
                                    RTE_DEV_NAME_MAX_LEN);
-               RTE_LOG(ERR, EAL,
-                       "Unknown driver type for %s\n", devname);
+               PCI_LOG(ERR, "Unknown driver type for %s", devname);
                return -1;
        }
 }
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 97d740dfe5..f7d990d33f 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -91,15 +91,13 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned 
uio_num)
 
        f = fopen(filename, "r");
        if (f == NULL) {
-               RTE_LOG(ERR, EAL, "%s(): cannot open sysfs to get 
major:minor\n",
-                       __func__);
+               PCI_LOG(ERR, "%s(): cannot open sysfs to get major:minor", 
__func__);
                return -1;
        }
 
        ret = fscanf(f, "%u:%u", &major, &minor);
        if (ret != 2) {
-               RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs to get 
major:minor\n",
-                       __func__);
+               PCI_LOG(ERR, "%s(): cannot parse sysfs to get major:minor", 
__func__);
                fclose(f);
                return -1;
        }
@@ -110,8 +108,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned 
uio_num)
        dev = makedev(major, minor);
        ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);
        if (ret != 0) {
-               RTE_LOG(ERR, EAL, "%s(): mknod() failed %s\n",
-                       __func__, strerror(errno));
+               PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, 
strerror(errno));
                return -1;
        }
 
@@ -150,7 +147,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
                dir = opendir(dirname);
 
                if (dir == NULL) {
-                       RTE_LOG(ERR, EAL, "Cannot opendir %s\n", dirname);
+                       PCI_LOG(ERR, "Cannot opendir %s", dirname);
                        return -1;
                }
        }
@@ -191,7 +188,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
        /* create uio device if we've been asked to */
        if (rte_eal_create_uio_dev() && create &&
                        pci_mknod_uio_dev(dstbuf, uio_num) < 0)
-               RTE_LOG(WARNING, EAL, "Cannot create /dev/uio%u\n", uio_num);
+               PCI_LOG(WARNING, "Cannot create /dev/uio%u", uio_num);
 
        return uio_num;
 }
@@ -231,8 +228,8 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
        /* find uio resource */
        uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 1);
        if (uio_num < 0) {
-               RTE_LOG(WARNING, EAL, "  "PCI_PRI_FMT" not managed by UIO 
driver, "
-                               "skipping\n", loc->domain, loc->bus, 
loc->devid, loc->function);
+               PCI_LOG(WARNING, "  "PCI_PRI_FMT" not managed by UIO driver, 
skipping",
+                       loc->domain, loc->bus, loc->devid, loc->function);
                return 1;
        }
        snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num);
@@ -240,8 +237,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
        /* save fd if in primary process */
        fd = open(devname, O_RDWR);
        if (fd < 0) {
-               RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-                       devname, strerror(errno));
+               PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
                goto error;
        }
 
@@ -253,8 +249,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
        uio_cfg_fd = open(cfgname, O_RDWR);
        if (uio_cfg_fd < 0) {
-               RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-                       cfgname, strerror(errno));
+               PCI_LOG(ERR, "Cannot open %s: %s", cfgname, strerror(errno));
                goto error;
        }
 
@@ -270,7 +265,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
                /* set bus master that is not done by uio_pci_generic */
                if (rte_pci_set_bus_master(dev, true)) {
-                       RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
+                       PCI_LOG(ERR, "Cannot set up bus mastering!");
                        goto error;
                }
        }
@@ -278,8 +273,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
        /* allocate the mapping details for secondary processes*/
        *uio_res = rte_zmalloc("UIO_RES", sizeof(**uio_res), 0);
        if (*uio_res == NULL) {
-               RTE_LOG(ERR, EAL,
-                       "%s(): cannot store uio mmap details\n", __func__);
+               PCI_LOG(ERR, "%s(): cannot store uio mmap details", __func__);
                goto error;
        }
 
@@ -313,8 +307,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, 
int res_idx,
        /* allocate memory to keep path */
        maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0);
        if (maps[map_idx].path == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-                               strerror(errno));
+               PCI_LOG(ERR, "Cannot allocate memory for path: %s", 
strerror(errno));
                return -1;
        }
 
@@ -331,8 +324,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, 
int res_idx,
 
                fd = open(devname, O_RDWR);
                if (fd < 0 && errno != ENOENT) {
-                       RTE_LOG(INFO, EAL, "%s cannot be mapped. "
-                               "Fall-back to non prefetchable mode.\n",
+                       PCI_LOG(INFO, "%s cannot be mapped. Fall-back to non 
prefetchable mode.",
                                devname);
                }
        }
@@ -347,8 +339,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, 
int res_idx,
                /* then try to map resource file */
                fd = open(devname, O_RDWR);
                if (fd < 0) {
-                       RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-                               devname, strerror(errno));
+                       PCI_LOG(ERR, "Cannot open %s: %s", devname, 
strerror(errno));
                        goto error;
                }
        }
@@ -403,14 +394,13 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
                dev->addr.devid, dev->addr.function);
        f = fopen(filename, "r");
        if (f == NULL) {
-               RTE_LOG(ERR, EAL, "%s(): Cannot open sysfs resource: %s\n",
-                       __func__, strerror(errno));
+               PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, 
strerror(errno));
                return -1;
        }
 
        for (i = 0; i < bar + 1; i++) {
                if (fgets(buf, sizeof(buf), f) == NULL) {
-                       RTE_LOG(ERR, EAL, "%s(): Cannot read sysfs resource\n", 
__func__);
+                       PCI_LOG(ERR, "%s(): Cannot read sysfs resource", 
__func__);
                        goto error;
                }
        }
@@ -420,23 +410,23 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 
        if (flags & IORESOURCE_IO) {
                if (rte_eal_iopl_init()) {
-                       RTE_LOG(ERR, EAL, "%s(): insufficient ioport 
permissions for PCI device %s\n",
+                       PCI_LOG(ERR, "%s(): insufficient ioport permissions for 
PCI device %s",
                                __func__, dev->name);
                        goto error;
                }
 
                base = (unsigned long)phys_addr;
                if (base > PIO_MAX) {
-                       RTE_LOG(ERR, EAL, "%s(): %08lx too large PIO 
resource\n", __func__, base);
+                       PCI_LOG(ERR, "%s(): %08lx too large PIO resource", 
__func__, base);
                        goto error;
                }
 
-               RTE_LOG(DEBUG, EAL, "%s(): PIO BAR %08lx detected\n", __func__, 
base);
+               PCI_LOG(DEBUG, "%s(): PIO BAR %08lx detected", __func__, base);
        } else if (flags & IORESOURCE_MEM) {
                base = (unsigned long)dev->mem_resource[bar].addr;
-               RTE_LOG(DEBUG, EAL, "%s(): MMIO BAR %08lx detected\n", 
__func__, base);
+               PCI_LOG(DEBUG, "%s(): MMIO BAR %08lx detected", __func__, base);
        } else {
-               RTE_LOG(ERR, EAL, "%s(): unknown BAR type\n", __func__);
+               PCI_LOG(ERR, "%s(): unknown BAR type", __func__);
                goto error;
        }
 
@@ -445,16 +435,14 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
                                        RTE_INTR_HANDLE_UNKNOWN) {
                int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
                if (uio_num < 0) {
-                       RTE_LOG(ERR, EAL, "cannot open %s: %s\n",
-                               dirname, strerror(errno));
+                       PCI_LOG(ERR, "cannot open %s: %s", dirname, 
strerror(errno));
                        goto error;
                }
 
                snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num);
                fd = open(filename, O_RDWR);
                if (fd < 0) {
-                       RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-                               filename, strerror(errno));
+                       PCI_LOG(ERR, "Cannot open %s: %s", filename, 
strerror(errno));
                        goto error;
                }
                if (rte_intr_fd_set(dev->intr_handle, fd))
@@ -464,7 +452,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
                        goto error;
        }
 
-       RTE_LOG(DEBUG, EAL, "PCI Port IO found start=0x%lx\n", base);
+       PCI_LOG(DEBUG, "PCI Port IO found start=0x%lx", base);
 
        p->base = base;
        p->len = 0;
@@ -493,13 +481,12 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
                dev->addr.devid, dev->addr.function);
        f = fopen(filename, "r");
        if (f == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot open sysfs resource: %s\n",
-                       strerror(errno));
+               PCI_LOG(ERR, "Cannot open sysfs resource: %s", strerror(errno));
                return -1;
        }
        for (i = 0; i < bar + 1; i++) {
                if (fgets(buf, sizeof(buf), f) == NULL) {
-                       RTE_LOG(ERR, EAL, "Cannot read sysfs resource\n");
+                       PCI_LOG(ERR, "Cannot read sysfs resource");
                        goto error;
                }
        }
@@ -507,7 +494,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
                        &end_addr, &flags) < 0)
                goto error;
        if ((flags & IORESOURCE_IO) == 0) {
-               RTE_LOG(ERR, EAL, "BAR %d is not an IO resource\n", bar);
+               PCI_LOG(ERR, "BAR %d is not an IO resource", bar);
                goto error;
        }
        snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT "/resource%d",
@@ -517,23 +504,21 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
        /* mmap the pci resource */
        fd = open(filename, O_RDWR);
        if (fd < 0) {
-               RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", filename,
-                       strerror(errno));
+               PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno));
                goto error;
        }
        addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE,
                MAP_SHARED, fd, 0);
        close(fd);
        if (addr == MAP_FAILED) {
-               RTE_LOG(ERR, EAL, "Cannot mmap IO port resource: %s\n",
-                       strerror(errno));
+               PCI_LOG(ERR, "Cannot mmap IO port resource: %s", 
strerror(errno));
                goto error;
        }
 
        /* strangely, the base address is mmap addr + phys_addr */
        p->base = (uintptr_t)addr + phys_addr;
        p->len = end_addr + 1;
-       RTE_LOG(DEBUG, EAL, "PCI Port IO found start=0x%"PRIx64"\n", p->base);
+       PCI_LOG(DEBUG, "PCI Port IO found start=0x%"PRIx64, p->base);
        fclose(f);
 
        return 0;
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 05b03a9667..adc34a5c51 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -121,15 +121,13 @@ pci_vfio_get_msix_bar(const struct rte_pci_device *dev,
 
                if (rte_pci_read_config(dev, &reg, sizeof(reg), cap_offset +
                                RTE_PCI_MSIX_TABLE) < 0) {
-                       RTE_LOG(ERR, EAL,
-                               "Cannot read MSIX table from PCI config 
space!\n");
+                       PCI_LOG(ERR, "Cannot read MSIX table from PCI config 
space!");
                        return -1;
                }
 
                if (rte_pci_read_config(dev, &flags, sizeof(flags), cap_offset +
                                RTE_PCI_MSIX_FLAGS) < 0) {
-                       RTE_LOG(ERR, EAL,
-                               "Cannot read MSIX flags from PCI config 
space!\n");
+                       PCI_LOG(ERR, "Cannot read MSIX flags from PCI config 
space!");
                        return -1;
                }
 
@@ -151,14 +149,14 @@ pci_vfio_enable_bus_memory(struct rte_pci_device *dev, 
int dev_fd)
 
        if (pci_vfio_get_region(dev, VFIO_PCI_CONFIG_REGION_INDEX,
                &size, &offset) != 0) {
-               RTE_LOG(ERR, EAL, "Cannot get offset of CONFIG region.\n");
+               PCI_LOG(ERR, "Cannot get offset of CONFIG region.");
                return -1;
        }
 
        ret = pread(dev_fd, &cmd, sizeof(cmd), offset + RTE_PCI_COMMAND);
 
        if (ret != sizeof(cmd)) {
-               RTE_LOG(ERR, EAL, "Cannot read command from PCI config 
space!\n");
+               PCI_LOG(ERR, "Cannot read command from PCI config space!");
                return -1;
        }
 
@@ -169,7 +167,7 @@ pci_vfio_enable_bus_memory(struct rte_pci_device *dev, int 
dev_fd)
        ret = pwrite(dev_fd, &cmd, sizeof(cmd), offset + RTE_PCI_COMMAND);
 
        if (ret != sizeof(cmd)) {
-               RTE_LOG(ERR, EAL, "Cannot write command to PCI config 
space!\n");
+               PCI_LOG(ERR, "Cannot write command to PCI config space!");
                return -1;
        }
 
@@ -206,7 +204,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int 
vfio_dev_fd)
        case RTE_INTR_MODE_NONE:
                break;
        default:
-               RTE_LOG(ERR, EAL, "Unknown default interrupt type!\n");
+               PCI_LOG(ERR, "Unknown default interrupt type!");
                return -1;
        }
 
@@ -224,8 +222,8 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int 
vfio_dev_fd)
 
                ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
                if (ret < 0) {
-                       RTE_LOG(ERR, EAL, "Cannot get VFIO IRQ info, error "
-                                       "%i (%s)\n", errno, strerror(errno));
+                       PCI_LOG(ERR, "Cannot get VFIO IRQ info, error %i (%s)",
+                               errno, strerror(errno));
                        return -1;
                }
 
@@ -233,8 +231,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int 
vfio_dev_fd)
                 * specified interrupt type, otherwise continue */
                if ((irq.flags & VFIO_IRQ_INFO_EVENTFD) == 0) {
                        if (intr_mode != RTE_INTR_MODE_NONE) {
-                               RTE_LOG(ERR, EAL,
-                                       "Interrupt vector does not support 
eventfd!\n");
+                               PCI_LOG(ERR, "Interrupt vector does not support 
eventfd!");
                                return -1;
                        } else
                                continue;
@@ -251,8 +248,8 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int 
vfio_dev_fd)
                /* set up an eventfd for interrupts */
                fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
                if (fd < 0) {
-                       RTE_LOG(ERR, EAL, "Cannot set up eventfd, error "
-                                       "%i (%s)\n", errno, strerror(errno));
+                       PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)",
+                               errno, strerror(errno));
                        return -1;
                }
 
@@ -276,7 +273,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int 
vfio_dev_fd)
                                                 RTE_INTR_HANDLE_VFIO_LEGACY);
                        break;
                default:
-                       RTE_LOG(ERR, EAL, "Unknown interrupt type!\n");
+                       PCI_LOG(ERR, "Unknown interrupt type!");
                        return -1;
                }
 
@@ -306,8 +303,7 @@ pci_vfio_req_handler(void *param)
        rte_spinlock_lock(&failure_handle_lock);
        bus = rte_bus_find_by_device(device);
        if (bus == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot find bus for device (%s)\n",
-                       device->name);
+               PCI_LOG(ERR, "Cannot find bus for device (%s)", device->name);
                goto handle_end;
        }
 
@@ -318,9 +314,7 @@ pci_vfio_req_handler(void *param)
         */
        ret = bus->hot_unplug_handler(device);
        if (ret)
-               RTE_LOG(ERR, EAL,
-                       "Can not handle hot-unplug for device (%s)\n",
-                       device->name);
+               PCI_LOG(ERR, "Can not handle hot-unplug for device (%s)", 
device->name);
 handle_end:
        rte_spinlock_unlock(&failure_handle_lock);
 }
@@ -335,7 +329,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int 
vfio_dev_fd)
        /* set up an eventfd for req notifier */
        fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
        if (fd < 0) {
-               RTE_LOG(ERR, EAL, "Cannot set up eventfd, error %i (%s)\n",
+               PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)",
                        errno, strerror(errno));
                return -1;
        }
@@ -353,19 +347,18 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int 
vfio_dev_fd)
                                         pci_vfio_req_handler,
                                         (void *)&dev->device);
        if (ret) {
-               RTE_LOG(ERR, EAL, "Fail to register req notifier handler.\n");
+               PCI_LOG(ERR, "Fail to register req notifier handler.");
                goto error;
        }
 
        ret = rte_intr_enable(dev->vfio_req_intr_handle);
        if (ret) {
-               RTE_LOG(ERR, EAL, "Fail to enable req notifier.\n");
+               PCI_LOG(ERR, "Fail to enable req notifier.");
                ret = rte_intr_callback_unregister(dev->vfio_req_intr_handle,
                                                 pci_vfio_req_handler,
                                                 (void *)&dev->device);
                if (ret < 0)
-                       RTE_LOG(ERR, EAL,
-                               "Fail to unregister req notifier handler.\n");
+                       PCI_LOG(ERR, "Fail to unregister req notifier 
handler.");
                goto error;
        }
 
@@ -388,7 +381,7 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
 
        ret = rte_intr_disable(dev->vfio_req_intr_handle);
        if (ret) {
-               RTE_LOG(ERR, EAL, "fail to disable req notifier.\n");
+               PCI_LOG(ERR, "fail to disable req notifier.");
                return -1;
        }
 
@@ -396,8 +389,7 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
                                           pci_vfio_req_handler,
                                           (void *)&dev->device);
        if (ret < 0) {
-               RTE_LOG(ERR, EAL,
-                        "fail to unregister req notifier handler.\n");
+               PCI_LOG(ERR, "fail to unregister req notifier handler.");
                return -1;
        }
 
@@ -421,14 +413,14 @@ pci_vfio_is_ioport_bar(const struct rte_pci_device *dev, 
int vfio_dev_fd,
 
        if (pci_vfio_get_region(dev, VFIO_PCI_CONFIG_REGION_INDEX,
                &size, &offset) != 0) {
-               RTE_LOG(ERR, EAL, "Cannot get offset of CONFIG region.\n");
+               PCI_LOG(ERR, "Cannot get offset of CONFIG region.");
                return -1;
        }
 
        ret = pread(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar),
                          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_LOG(ERR, "Cannot read command (%x) from config space!",
                        RTE_PCI_BASE_ADDRESS_0 + bar_index*4);
                return -1;
        }
@@ -440,17 +432,17 @@ static int
 pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 {
        if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) {
-               RTE_LOG(ERR, EAL, "Error setting up interrupts!\n");
+               PCI_LOG(ERR, "Error setting up interrupts!");
                return -1;
        }
 
        if (pci_vfio_enable_bus_memory(dev, vfio_dev_fd)) {
-               RTE_LOG(ERR, EAL, "Cannot enable bus memory!\n");
+               PCI_LOG(ERR, "Cannot enable bus memory!");
                return -1;
        }
 
        if (rte_pci_set_bus_master(dev, true)) {
-               RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n");
+               PCI_LOG(ERR, "Cannot set up bus mastering!");
                return -1;
        }
 
@@ -459,8 +451,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int 
vfio_dev_fd)
         * then it updates errno as EINVAL.
         */
        if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
-               RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
-                               errno, strerror(errno));
+               PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, 
strerror(errno));
                return -1;
        }
 
@@ -480,7 +471,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct 
mapped_pci_resource *vfio_res,
        struct pci_map *bar = &vfio_res->maps[bar_index];
 
        if (bar->size == 0) {
-               RTE_LOG(DEBUG, EAL, "Bar size is 0, skip BAR%d\n", bar_index);
+               PCI_LOG(DEBUG, "Bar size is 0, skip BAR%d", bar_index);
                return 0;
        }
 
@@ -503,7 +494,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct 
mapped_pci_resource *vfio_res,
 
                if (table_start == 0 && table_end >= bar->size) {
                        /* Cannot map this BAR */
-                       RTE_LOG(DEBUG, EAL, "Skipping BAR%d\n", bar_index);
+                       PCI_LOG(DEBUG, "Skipping BAR%d", bar_index);
                        bar->size = 0;
                        bar->addr = 0;
                        return 0;
@@ -523,10 +514,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct 
mapped_pci_resource *vfio_res,
                        memreg[1].size = bar->size - table_end;
                }
 
-               RTE_LOG(DEBUG, EAL,
-                       "Trying to map BAR%d that contains the MSI-X "
-                       "table. Trying offsets: "
-                       "0x%04" PRIx64 ":0x%04zx, 0x%04" PRIx64 ":0x%04zx\n",
+               PCI_LOG(DEBUG, "Trying to map BAR%d that contains the MSI-X 
table. "
+                       "Trying offsets: 0x%04" PRIx64 ":0x%04zx, 0x%04" PRIx64 
":0x%04zx",
                        bar_index,
                        memreg[0].offset, memreg[0].size,
                        memreg[1].offset, memreg[1].size);
@@ -576,14 +565,11 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct 
mapped_pci_resource *vfio_res,
                if (map_addr == NULL) {
                        munmap(bar_addr, bar->size);
                        bar_addr = MAP_FAILED;
-                       RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
-                                       bar_index);
+                       PCI_LOG(ERR, "Failed to map pci BAR%d", bar_index);
                        return -1;
                }
        } else {
-               RTE_LOG(ERR, EAL,
-                               "Failed to create inaccessible mapping for 
BAR%d\n",
-                               bar_index);
+               PCI_LOG(ERR, "Failed to create inaccessible mapping for BAR%d", 
bar_index);
                return -1;
        }
 
@@ -601,7 +587,7 @@ pci_vfio_sparse_mmap_bar(int vfio_dev_fd, struct 
mapped_pci_resource *vfio_res,
        uint32_t i;
 
        if (bar->size == 0) {
-               RTE_LOG(DEBUG, EAL, "Bar size is 0, skip BAR%d\n", bar_index);
+               PCI_LOG(DEBUG, "Bar size is 0, skip BAR%d", bar_index);
                return 0;
        }
 
@@ -619,15 +605,13 @@ pci_vfio_sparse_mmap_bar(int vfio_dev_fd, struct 
mapped_pci_resource *vfio_res,
                                        RTE_MAP_FORCE_ADDRESS);
                                if (map_addr == NULL) {
                                        munmap(bar_addr, bar->size);
-                                       RTE_LOG(ERR, EAL, "Failed to map pci 
BAR%d\n",
-                                               bar_index);
+                                       PCI_LOG(ERR, "Failed to map pci BAR%d", 
bar_index);
                                        goto err_map;
                                }
                        }
                }
        } else {
-               RTE_LOG(ERR, EAL, "Failed to create inaccessible mapping for 
BAR%d\n",
-                       bar_index);
+               PCI_LOG(ERR, "Failed to create inaccessible mapping for BAR%d", 
bar_index);
                goto err_map;
        }
 
@@ -653,8 +637,7 @@ pci_vfio_get_region_info(int vfio_dev_fd, struct 
vfio_region_info **info,
 
        ri = malloc(sizeof(*ri));
        if (ri == NULL) {
-               RTE_LOG(ERR, EAL,
-                       "Cannot allocate memory for VFIO region info\n");
+               PCI_LOG(ERR, "Cannot allocate memory for VFIO region info");
                return -1;
        }
 again:
@@ -676,8 +659,7 @@ pci_vfio_get_region_info(int vfio_dev_fd, struct 
vfio_region_info **info,
                if (tmp == NULL) {
                        /* realloc failed but the ri is still there */
                        free(ri);
-                       RTE_LOG(ERR, EAL,
-                               "Cannot reallocate memory for VFIO region 
info\n");
+                       PCI_LOG(ERR, "Cannot reallocate memory for VFIO region 
info");
                        return -1;
                }
                ri = tmp;
@@ -741,7 +723,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int 
vfio_dev_fd,
        for (i = 0; i < nb_maps; i++) {
                ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
                if (ret < 0) {
-                       RTE_LOG(DEBUG, EAL, "%s cannot get device region info 
error %i (%s)\n",
+                       PCI_LOG(DEBUG, "%s cannot get device region info error 
%i (%s)",
                                dev->name, errno, strerror(errno));
                        return -1;
                }
@@ -794,8 +776,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
        /* allocate vfio_res and get region info */
        vfio_res = rte_zmalloc("VFIO_RES", sizeof(*vfio_res), 0);
        if (vfio_res == NULL) {
-               RTE_LOG(ERR, EAL,
-                       "Cannot store VFIO mmap details\n");
+               PCI_LOG(ERR, "Cannot store VFIO mmap details");
                goto err_vfio_dev_fd;
        }
        memcpy(&vfio_res->pci_addr, &dev->addr, sizeof(vfio_res->pci_addr));
@@ -810,7 +791,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
        ret = pci_vfio_get_region_info(vfio_dev_fd, &reg,
                VFIO_PCI_CONFIG_REGION_INDEX);
        if (ret < 0) {
-               RTE_LOG(ERR, EAL, "%s cannot get device region info error %i 
(%s)\n",
+               PCI_LOG(ERR, "%s cannot get device region info error %i (%s)",
                        dev->name, errno, strerror(errno));
                goto err_vfio_res;
        }
@@ -824,8 +805,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
         */
        ret = pci_vfio_get_msix_bar(dev, &vfio_res->msix_table);
        if (ret < 0) {
-               RTE_LOG(ERR, EAL, "%s cannot get MSI-X BAR number!\n",
-                               pci_addr);
+               PCI_LOG(ERR, "%s cannot get MSI-X BAR number!", pci_addr);
                goto err_vfio_res;
        }
        /* if we found our MSI-X BAR region, check if we can mmap it */
@@ -833,11 +813,11 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
                int ret = pci_vfio_msix_is_mappable(vfio_dev_fd,
                                vfio_res->msix_table.bar_index);
                if (ret < 0) {
-                       RTE_LOG(ERR, EAL, "Couldn't check if MSI-X BAR is 
mappable\n");
+                       PCI_LOG(ERR, "Couldn't check if MSI-X BAR is mappable");
                        goto err_vfio_res;
                } else if (ret != 0) {
                        /* we can map it, so we don't care where it is */
-                       RTE_LOG(DEBUG, EAL, "VFIO reports MSI-X BAR as 
mappable\n");
+                       PCI_LOG(DEBUG, "VFIO reports MSI-X BAR as mappable");
                        vfio_res->msix_table.bar_index = -1;
                }
        }
@@ -849,9 +829,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 
                ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
                if (ret < 0) {
-                       RTE_LOG(ERR, EAL,
-                               "%s cannot get device region info error "
-                               "%i (%s)\n", pci_addr, errno, strerror(errno));
+                       PCI_LOG(ERR, "%s cannot get device region info error %i 
(%s)",
+                               pci_addr, errno, strerror(errno));
                        goto err_map;
                }
 
@@ -864,8 +843,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
                        free(reg);
                        goto err_map;
                } else if (ret) {
-                       RTE_LOG(INFO, EAL, "Ignore mapping IO port bar(%d)\n",
-                                       i);
+                       PCI_LOG(INFO, "Ignore mapping IO port bar(%d)", i);
                        free(reg);
                        continue;
                }
@@ -901,8 +879,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
                                maps[i].areas = rte_zmalloc(NULL,
                                        sizeof(*maps[i].areas) * 
maps[i].nr_areas, 0);
                                if (maps[i].areas == NULL) {
-                                       RTE_LOG(ERR, EAL,
-                                               "Cannot alloc memory for sparse 
map areas\n");
+                                       PCI_LOG(ERR, "Cannot alloc memory for 
sparse map areas");
                                        goto err_map;
                                }
                                memcpy(maps[i].areas, sparse->areas,
@@ -913,16 +890,16 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
                if (maps[i].nr_areas > 0) {
                        ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, 
i, 0);
                        if (ret < 0) {
-                               RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i 
failed: %s\n",
-                                               pci_addr, i, strerror(errno));
+                               PCI_LOG(ERR, "%s sparse mapping BAR%i failed: 
%s",
+                                       pci_addr, i, strerror(errno));
                                free(reg);
                                goto err_map;
                        }
                } else {
                        ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
                        if (ret < 0) {
-                               RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: 
%s\n",
-                                               pci_addr, i, strerror(errno));
+                               PCI_LOG(ERR, "%s mapping BAR%i failed: %s",
+                                       pci_addr, i, strerror(errno));
                                free(reg);
                                goto err_map;
                        }
@@ -934,13 +911,13 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
        }
 
        if (pci_rte_vfio_setup_device(dev, vfio_dev_fd) < 0) {
-               RTE_LOG(ERR, EAL, "%s setup device failed\n", pci_addr);
+               PCI_LOG(ERR, "%s setup device failed", pci_addr);
                goto err_map;
        }
 
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
        if (pci_vfio_enable_notifier(dev, vfio_dev_fd) != 0) {
-               RTE_LOG(ERR, EAL, "Error setting up notifier!\n");
+               PCI_LOG(ERR, "Error setting up notifier!");
                goto err_map;
        }
 
@@ -997,8 +974,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
        }
        /* if we haven't found our tailq entry, something's wrong */
        if (vfio_res == NULL) {
-               RTE_LOG(ERR, EAL, "%s cannot find TAILQ entry for PCI 
device!\n",
-                               pci_addr);
+               PCI_LOG(ERR, "%s cannot find TAILQ entry for PCI device!", 
pci_addr);
                return -1;
        }
 
@@ -1018,15 +994,15 @@ pci_vfio_map_resource_secondary(struct rte_pci_device 
*dev)
                if (maps[i].nr_areas > 0) {
                        ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, 
i, MAP_FIXED);
                        if (ret < 0) {
-                               RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i 
failed: %s\n",
-                                               pci_addr, i, strerror(errno));
+                               PCI_LOG(ERR, "%s sparse mapping BAR%i failed: 
%s",
+                                       pci_addr, i, strerror(errno));
                                goto err_vfio_dev_fd;
                        }
                } else {
                        ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 
MAP_FIXED);
                        if (ret < 0) {
-                               RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: 
%s\n",
-                                               pci_addr, i, strerror(errno));
+                               PCI_LOG(ERR, "%s mapping BAR%i failed: %s",
+                                       pci_addr, i, strerror(errno));
                                goto err_vfio_dev_fd;
                        }
                }
@@ -1085,8 +1061,7 @@ find_and_unmap_vfio_resource(struct mapped_pci_res_list 
*vfio_res_list,
        if (vfio_res == NULL)
                return vfio_res;
 
-       RTE_LOG(INFO, EAL, "Releasing PCI mapped resource for %s\n",
-               pci_addr);
+       PCI_LOG(INFO, "Releasing PCI mapped resource for %s", pci_addr);
 
        maps = vfio_res->maps;
        for (i = 0; i < vfio_res->nb_maps; i++) {
@@ -1096,7 +1071,7 @@ find_and_unmap_vfio_resource(struct mapped_pci_res_list 
*vfio_res_list,
                 * when mapping. Just using current maps array is enough
                 */
                if (maps[i].addr) {
-                       RTE_LOG(INFO, EAL, "Calling pci_unmap_resource for %s 
at %p\n",
+                       PCI_LOG(INFO, "Calling pci_unmap_resource for %s at %p",
                                pci_addr, maps[i].addr);
                        pci_unmap_resource(maps[i].addr, maps[i].size);
                }
@@ -1124,7 +1099,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device 
*dev)
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
        ret = pci_vfio_disable_notifier(dev);
        if (ret) {
-               RTE_LOG(ERR, EAL, "fail to disable req notifier.\n");
+               PCI_LOG(ERR, "fail to disable req notifier.");
                return -1;
        }
 
@@ -1133,8 +1108,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device 
*dev)
                return -1;
 
        if (close(rte_intr_fd_get(dev->intr_handle)) < 0) {
-               RTE_LOG(INFO, EAL, "Error when closing eventfd file descriptor 
for %s\n",
-                       pci_addr);
+               PCI_LOG(INFO, "Error when closing eventfd file descriptor for 
%s", pci_addr);
                return -1;
        }
 
@@ -1143,15 +1117,14 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device 
*dev)
                return -1;
 
        if (rte_pci_set_bus_master(dev, false)) {
-               RTE_LOG(ERR, EAL, "%s cannot unset bus mastering for PCI 
device!\n",
-                               pci_addr);
+               PCI_LOG(ERR, "%s cannot unset bus mastering for PCI device!", 
pci_addr);
                return -1;
        }
 
        ret = rte_vfio_release_device(rte_pci_get_sysfs_path(), pci_addr,
                                      vfio_dev_fd);
        if (ret < 0) {
-               RTE_LOG(ERR, EAL, "Cannot release VFIO device\n");
+               PCI_LOG(ERR, "Cannot release VFIO device");
                return ret;
        }
 
@@ -1161,8 +1134,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device 
*dev)
 
        /* if we haven't found our tailq entry, something's wrong */
        if (vfio_res == NULL) {
-               RTE_LOG(ERR, EAL, "%s cannot find TAILQ entry for PCI 
device!\n",
-                               pci_addr);
+               PCI_LOG(ERR, "%s cannot find TAILQ entry for PCI device!", 
pci_addr);
                return -1;
        }
 
@@ -1191,7 +1163,7 @@ pci_vfio_unmap_resource_secondary(struct rte_pci_device 
*dev)
        ret = rte_vfio_release_device(rte_pci_get_sysfs_path(), pci_addr,
                                      vfio_dev_fd);
        if (ret < 0) {
-               RTE_LOG(ERR, EAL, "Cannot release VFIO device\n");
+               PCI_LOG(ERR, "Cannot release VFIO device");
                return ret;
        }
 
@@ -1201,8 +1173,7 @@ pci_vfio_unmap_resource_secondary(struct rte_pci_device 
*dev)
 
        /* if we haven't found our tailq entry, something's wrong */
        if (vfio_res == NULL) {
-               RTE_LOG(ERR, EAL, "%s cannot find TAILQ entry for PCI 
device!\n",
-                               pci_addr);
+               PCI_LOG(ERR, "%s cannot find TAILQ entry for PCI device!", 
pci_addr);
                return -1;
        }
 
@@ -1226,7 +1197,7 @@ pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,
 
        if (bar < VFIO_PCI_BAR0_REGION_INDEX ||
            bar > VFIO_PCI_BAR5_REGION_INDEX) {
-               RTE_LOG(ERR, EAL, "invalid bar (%d)!\n", bar);
+               PCI_LOG(ERR, "invalid bar (%d)!", bar);
                return -1;
        }
 
@@ -1257,7 +1228,7 @@ pci_vfio_ioport_map(struct rte_pci_device *dev, int bar,
        }
 
        if (pci_vfio_get_region(dev, bar, &size, &offset) != 0) {
-               RTE_LOG(ERR, EAL, "Cannot get offset of region %d.\n", bar);
+               PCI_LOG(ERR, "Cannot get offset of region %d.", bar);
                return -1;
        }
 
@@ -1278,8 +1249,7 @@ pci_vfio_ioport_read(struct rte_pci_ioport *p,
 
        if (pread(vfio_dev_fd, data,
                    len, p->base + offset) <= 0)
-               RTE_LOG(ERR, EAL,
-                       "Can't read from PCI bar (%" PRIu64 ") : offset (%x)\n",
+               PCI_LOG(ERR, "Can't read from PCI bar (%" PRIu64 ") : offset 
(%x)",
                        VFIO_GET_REGION_IDX(p->base), (int)offset);
 }
 
@@ -1295,8 +1265,7 @@ pci_vfio_ioport_write(struct rte_pci_ioport *p,
 
        if (pwrite(vfio_dev_fd, data,
                     len, p->base + offset) <= 0)
-               RTE_LOG(ERR, EAL,
-                       "Can't write to PCI bar (%" PRIu64 ") : offset (%x)\n",
+               PCI_LOG(ERR, "Can't write to PCI bar (%" PRIu64 ") : offset 
(%x)",
                        VFIO_GET_REGION_IDX(p->base), (int)offset);
 }
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 889a48d2af..1173f0887c 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -141,13 +141,12 @@ pci_map_resource(void *requested_addr, int fd, off_t 
offset, size_t size,
                RTE_PROT_READ | RTE_PROT_WRITE,
                RTE_MAP_SHARED | additional_flags, fd, offset);
        if (mapaddr == NULL) {
-               RTE_LOG(ERR, EAL,
-                       "%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s 
(%p)\n",
+               PCI_LOG(ERR, "%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): 
%s (%p)",
                        __func__, fd, requested_addr, size,
                        (unsigned long long)offset,
                        rte_strerror(rte_errno), mapaddr);
        } else
-               RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
+               PCI_LOG(DEBUG, "  PCI memory mapped at %p", mapaddr);
 
        return mapaddr;
 }
@@ -161,12 +160,11 @@ pci_unmap_resource(void *requested_addr, size_t size)
 
        /* Unmap the PCI memory resource of device */
        if (rte_mem_unmap(requested_addr, size)) {
-               RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
+               PCI_LOG(ERR, "%s(): cannot mem unmap(%p, %#zx): %s",
                        __func__, requested_addr, size,
                        rte_strerror(rte_errno));
        } else
-               RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
-                               requested_addr);
+               PCI_LOG(DEBUG, "  PCI memory unmapped at %p", requested_addr);
 }
 /*
  * Match the PCI Driver and Device using the ID Table
@@ -226,28 +224,27 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                /* Match of device and driver failed */
                return 1;
 
-       RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
-                       loc->domain, loc->bus, loc->devid, loc->function,
-                       dev->device.numa_node);
+       PCI_LOG(DEBUG, "PCI device "PCI_PRI_FMT" on NUMA socket %i",
+               loc->domain, loc->bus, loc->devid, loc->function,
+               dev->device.numa_node);
 
        /* no initialization when marked as blocked, return without error */
        if (dev->device.devargs != NULL &&
                dev->device.devargs->policy == RTE_DEV_BLOCKED) {
-               RTE_LOG(INFO, EAL, "  Device is blocked, not initializing\n");
+               PCI_LOG(INFO, "  Device is blocked, not initializing");
                return 1;
        }
 
        if (dev->device.numa_node < 0 && rte_socket_count() > 1)
-               RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware\n", dev->name);
+               PCI_LOG(INFO, "Device %s is not NUMA-aware", dev->name);
 
        already_probed = rte_dev_is_probed(&dev->device);
        if (already_probed && !(dr->drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) {
-               RTE_LOG(DEBUG, EAL, "Device %s is already probed\n",
-                               dev->device.name);
+               PCI_LOG(DEBUG, "Device %s is already probed", dev->device.name);
                return -EEXIST;
        }
 
-       RTE_LOG(DEBUG, EAL, "  probe driver: %x:%x %s\n", dev->id.vendor_id,
+       PCI_LOG(DEBUG, "  probe driver: %x:%x %s", dev->id.vendor_id,
                dev->id.device_id, dr->driver.name);
 
        if (!already_probed) {
@@ -258,7 +255,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                iova_mode = rte_eal_iova_mode();
                if (dev_iova_mode != RTE_IOVA_DC &&
                    dev_iova_mode != iova_mode) {
-                       RTE_LOG(ERR, EAL, "  Expecting '%s' IOVA mode but 
current mode is '%s', not initializing\n",
+                       PCI_LOG(ERR, "  Expecting '%s' IOVA mode but current 
mode is '%s', not initializing",
                                dev_iova_mode == RTE_IOVA_PA ? "PA" : "VA",
                                iova_mode == RTE_IOVA_PA ? "PA" : "VA");
                        return -EINVAL;
@@ -268,8 +265,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                dev->intr_handle =
                        rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);
                if (dev->intr_handle == NULL) {
-                       RTE_LOG(ERR, EAL,
-                               "Failed to create interrupt instance for %s\n",
+                       PCI_LOG(ERR, "Failed to create interrupt instance for 
%s",
                                dev->device.name);
                        return -ENOMEM;
                }
@@ -279,8 +275,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                if (dev->vfio_req_intr_handle == NULL) {
                        rte_intr_instance_free(dev->intr_handle);
                        dev->intr_handle = NULL;
-                       RTE_LOG(ERR, EAL,
-                               "Failed to create vfio req interrupt instance 
for %s\n",
+                       PCI_LOG(ERR, "Failed to create vfio req interrupt 
instance for %s",
                                dev->device.name);
                        return -ENOMEM;
                }
@@ -304,10 +299,10 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                }
        }
 
-       RTE_LOG(INFO, EAL, "Probe PCI driver: %s (%x:%04x) device: 
"PCI_PRI_FMT" (socket %i)\n",
-                       dr->driver.name, dev->id.vendor_id, dev->id.device_id,
-                       loc->domain, loc->bus, loc->devid, loc->function,
-                       dev->device.numa_node);
+       PCI_LOG(INFO, "Probe PCI driver: %s (%x:%04x) device: "PCI_PRI_FMT" 
(socket %i)",
+               dr->driver.name, dev->id.vendor_id, dev->id.device_id,
+               loc->domain, loc->bus, loc->devid, loc->function,
+               dev->device.numa_node);
        /* call the driver probe() function */
        ret = dr->probe(dr, dev);
        if (already_probed)
@@ -349,12 +344,12 @@ rte_pci_detach_dev(struct rte_pci_device *dev)
        dr = dev->driver;
        loc = &dev->addr;
 
-       RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
-                       loc->domain, loc->bus, loc->devid,
-                       loc->function, dev->device.numa_node);
+       PCI_LOG(DEBUG, "PCI device "PCI_PRI_FMT" on NUMA socket %i",
+               loc->domain, loc->bus, loc->devid,
+               loc->function, dev->device.numa_node);
 
-       RTE_LOG(DEBUG, EAL, "  remove driver: %x:%x %s\n", dev->id.vendor_id,
-                       dev->id.device_id, dr->driver.name);
+       PCI_LOG(DEBUG, "  remove driver: %x:%x %s", dev->id.vendor_id,
+               dev->id.device_id, dr->driver.name);
 
        if (dr->remove) {
                ret = dr->remove(dev);
@@ -423,8 +418,7 @@ pci_probe(void)
                ret = pci_probe_all_drivers(dev);
                if (ret < 0) {
                        if (ret != -EEXIST) {
-                               RTE_LOG(ERR, EAL, "Requested device "
-                                       PCI_PRI_FMT " cannot be used\n",
+                               PCI_LOG(ERR, "Requested device " PCI_PRI_FMT " 
cannot be used",
                                        dev->addr.domain, dev->addr.bus,
                                        dev->addr.devid, dev->addr.function);
                                rte_errno = errno;
@@ -592,8 +586,8 @@ pci_find_device_by_addr(const void *failure_addr)
                        len = pdev->mem_resource[i].len;
                        end = start + len;
                        if (check_point >= start && check_point < end) {
-                               RTE_LOG(DEBUG, EAL, "Failure address %16.16"
-                                       PRIx64" belongs to device %s!\n",
+                               PCI_LOG(DEBUG, "Failure address %16.16"
+                                       PRIx64" belongs to device %s!",
                                        check_point, pdev->device.name);
                                return pdev;
                        }
@@ -632,8 +626,7 @@ pci_hot_unplug_handler(struct rte_device *dev)
                ret = pci_uio_remap_resource(pdev);
                break;
        default:
-               RTE_LOG(DEBUG, EAL,
-                       "Not managed by a supported kernel driver, skipped\n");
+               PCI_LOG(DEBUG, "Not managed by a supported kernel driver, 
skipped");
                ret = -1;
                break;
        }
@@ -655,8 +648,7 @@ pci_sigbus_handler(const void *failure_addr)
                /* The sigbus error is caused of hot-unplug. */
                ret = pci_hot_unplug_handler(&pdev->device);
                if (ret) {
-                       RTE_LOG(ERR, EAL,
-                               "Failed to handle hot-unplug for device %s",
+                       PCI_LOG(ERR, "Failed to handle hot-unplug for device 
%s",
                                pdev->name);
                        ret = -1;
                }
@@ -780,8 +772,7 @@ rte_pci_get_iommu_class(void)
                                continue;
 
                        dev_iova_mode = pci_device_iova_mode(drv, dev);
-                       RTE_LOG(DEBUG, EAL, "PCI driver %s for device "
-                               PCI_PRI_FMT " wants IOVA as '%s'\n",
+                       PCI_LOG(DEBUG, "PCI driver %s for device "PCI_PRI_FMT" 
wants IOVA as '%s'",
                                drv->driver.name,
                                dev->addr.domain, dev->addr.bus,
                                dev->addr.devid, dev->addr.function,
@@ -796,8 +787,8 @@ rte_pci_get_iommu_class(void)
        if (iommu_no_va == 1) {
                iova_mode = RTE_IOVA_PA;
                if (devices_want_va) {
-                       RTE_LOG(WARNING, EAL, "Some devices want 'VA' but IOMMU 
does not support 'VA'.\n");
-                       RTE_LOG(WARNING, EAL, "The devices that want 'VA' won't 
initialize.\n");
+                       PCI_LOG(WARNING, "Some devices want 'VA' but IOMMU does 
not support 'VA'.");
+                       PCI_LOG(WARNING, "The devices that want 'VA' won't 
initialize.");
                }
        } else if (devices_want_va && !devices_want_pa) {
                iova_mode = RTE_IOVA_VA;
@@ -806,8 +797,8 @@ rte_pci_get_iommu_class(void)
        } else {
                iova_mode = RTE_IOVA_DC;
                if (devices_want_va) {
-                       RTE_LOG(WARNING, EAL, "Some devices want 'VA' but 
forcing 'DC' because other devices want 'PA'.\n");
-                       RTE_LOG(WARNING, EAL, "Depending on the final decision 
by the EAL, not all devices may be able to initialize.\n");
+                       PCI_LOG(WARNING, "Some devices want 'VA' but forcing 
'DC' because other devices want 'PA'.");
+                       PCI_LOG(WARNING, "Depending on the final decision by 
the EAL, not all devices may be able to initialize.");
                }
        }
        return iova_mode;
@@ -878,7 +869,7 @@ rte_pci_find_ext_capability(const struct rte_pci_device 
*dev, uint32_t cap)
        ttl = (RTE_PCI_CFG_SPACE_EXP_SIZE - RTE_PCI_CFG_SPACE_SIZE) / 8;
 
        if (rte_pci_read_config(dev, &header, 4, offset) < 0) {
-               RTE_LOG(ERR, EAL, "error in reading extended capabilities\n");
+               PCI_LOG(ERR, "error in reading extended capabilities");
                return -1;
        }
 
@@ -899,8 +890,7 @@ rte_pci_find_ext_capability(const struct rte_pci_device 
*dev, uint32_t cap)
                        break;
 
                if (rte_pci_read_config(dev, &header, 4, offset) < 0) {
-                       RTE_LOG(ERR, EAL,
-                               "error in reading extended capabilities\n");
+                       PCI_LOG(ERR, "error in reading extended capabilities");
                        return -1;
                }
 
@@ -917,7 +907,7 @@ rte_pci_set_bus_master(const struct rte_pci_device *dev, 
bool enable)
 
        if (rte_pci_read_config(dev, &old_cmd, sizeof(old_cmd),
                                RTE_PCI_COMMAND) < 0) {
-               RTE_LOG(ERR, EAL, "error in reading PCI command register\n");
+               PCI_LOG(ERR, "error in reading PCI command register");
                return -1;
        }
 
@@ -931,7 +921,7 @@ rte_pci_set_bus_master(const struct rte_pci_device *dev, 
bool enable)
 
        if (rte_pci_write_config(dev, &cmd, sizeof(cmd),
                                 RTE_PCI_COMMAND) < 0) {
-               RTE_LOG(ERR, EAL, "error in writing PCI command register\n");
+               PCI_LOG(ERR, "error in writing PCI command register");
                return -1;
        }
 
@@ -969,3 +959,4 @@ struct rte_pci_bus rte_pci_bus = {
 };
 
 RTE_REGISTER_BUS(pci, rte_pci_bus.bus);
+RTE_LOG_REGISTER_DEFAULT(pci_bus_logtype, NOTICE);
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index 76c661f054..ff1b02b6bd 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -43,7 +43,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
                         */
                        fd = open(uio_res->maps[i].path, O_RDWR);
                        if (fd < 0) {
-                               RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
+                               PCI_LOG(ERR, "Cannot open %s: %s",
                                        uio_res->maps[i].path, strerror(errno));
                                return -1;
                        }
@@ -55,8 +55,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
                        /* fd is not needed in secondary process, close it */
                        close(fd);
                        if (mapaddr != uio_res->maps[i].addr) {
-                               RTE_LOG(ERR, EAL,
-                                       "Cannot mmap device resource file %s to 
address: %p\n",
+                               PCI_LOG(ERR, "Cannot mmap device resource file 
%s to address: %p",
                                        uio_res->maps[i].path,
                                        uio_res->maps[i].addr);
                                if (mapaddr != NULL) {
@@ -76,7 +75,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
                return 0;
        }
 
-       RTE_LOG(ERR, EAL, "Cannot find resource for device\n");
+       PCI_LOG(ERR, "Cannot find resource for device");
        return 1;
 }
 
@@ -171,14 +170,10 @@ pci_uio_remap_resource(struct rte_pci_device *dev)
                                PROT_READ | PROT_WRITE,
                                MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
                if (map_address == MAP_FAILED) {
-                       RTE_LOG(ERR, EAL,
-                               "Cannot remap resource for device %s\n",
-                               dev->name);
+                       PCI_LOG(ERR, "Cannot remap resource for device %s", 
dev->name);
                        return -1;
                }
-               RTE_LOG(INFO, EAL,
-                       "Successful remap resource for device %s\n",
-                       dev->name);
+               PCI_LOG(INFO, "Successful remap resource for device %s", 
dev->name);
        }
 
        return 0;
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index d24cc201b8..087ec38bb9 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -70,7 +70,7 @@ rte_pci_dev_iterate(const void *start,
        if (str != NULL) {
                kvargs = rte_kvargs_parse(str, pci_params_keys);
                if (kvargs == NULL) {
-                       RTE_LOG(ERR, EAL, "cannot parse argument list\n");
+                       PCI_LOG(ERR, "cannot parse argument list");
                        rte_errno = EINVAL;
                        return NULL;
                }
@@ -94,22 +94,21 @@ rte_pci_devargs_parse(struct rte_devargs *da)
 
        kvargs = rte_kvargs_parse(da->bus_str, NULL);
        if (kvargs == NULL) {
-               RTE_LOG(ERR, EAL, "cannot parse argument list: %s\n",
-                       da->bus_str);
+               PCI_LOG(ERR, "cannot parse argument list: %s", da->bus_str);
                ret = -ENODEV;
                goto out;
        }
 
        addr_str = rte_kvargs_get(kvargs, pci_params_keys[RTE_PCI_PARAM_ADDR]);
        if (addr_str == NULL) {
-               RTE_LOG(DEBUG, EAL, "No PCI address specified using '%s=<id>' 
in: %s\n",
+               PCI_LOG(DEBUG, "No PCI address specified using '%s=<id>' in: 
%s",
                        pci_params_keys[RTE_PCI_PARAM_ADDR], da->bus_str);
                goto out;
        }
 
        ret = rte_pci_addr_parse(addr_str, &addr);
        if (ret != 0) {
-               RTE_LOG(ERR, EAL, "PCI address invalid: %s\n", da->bus_str);
+               PCI_LOG(ERR, "PCI address invalid: %s", da->bus_str);
                ret = -EINVAL;
                goto out;
        }
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 8b0ce73533..38109844b9 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -10,9 +10,15 @@
 
 #include <bus_driver.h>
 #include <bus_pci_driver.h>
+#include <rte_log.h>
 #include <rte_os_shim.h>
 #include <rte_pci.h>
 
+extern int pci_bus_logtype;
+#define RTE_LOGTYPE_PCI_BUS pci_bus_logtype
+#define PCI_LOG(level, ...) \
+       RTE_LOG_LINE(level, PCI_BUS, "" __VA_ARGS__)
+
 #define RTE_MAX_PCI_REGIONS    9
 
 /*
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 45a12bcb52..36e6f89093 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -246,8 +246,7 @@ get_device_resource_info(HDEVINFO dev_info,
                /* get device info from NetUIO kernel driver */
                ret = get_netuio_device_info(dev_info, dev_info_data, dev);
                if (ret != 0) {
-                       RTE_LOG(DEBUG, EAL,
-                               "Could not retrieve device info for PCI device "
+                       PCI_LOG(DEBUG, "Could not retrieve device info for PCI 
device "
                                PCI_PRI_FMT,
                                dev->addr.domain, dev->addr.bus,
                                dev->addr.devid, dev->addr.function);
@@ -256,9 +255,7 @@ get_device_resource_info(HDEVINFO dev_info,
                break;
        default:
                /* kernel driver type is unsupported */
-               RTE_LOG(DEBUG, EAL,
-                       "Kernel driver type for PCI device " PCI_PRI_FMT ","
-                       " is unsupported",
+               PCI_LOG(DEBUG, "Kernel driver type for PCI device " PCI_PRI_FMT 
", is unsupported",
                        dev->addr.domain, dev->addr.bus,
                        dev->addr.devid, dev->addr.function);
                return -1;
@@ -397,7 +394,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA 
device_info_data)
 
        pdev = malloc(sizeof(*pdev));
        if (pdev == NULL) {
-               RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci 
device\n");
+               PCI_LOG(ERR, "Cannot allocate memory for internal pci device");
                goto end;
        }
 
@@ -470,7 +467,7 @@ rte_pci_scan(void)
                DIGCF_PRESENT | DIGCF_ALLCLASSES);
        if (dev_info == INVALID_HANDLE_VALUE) {
                RTE_LOG_WIN32_ERR("SetupDiGetClassDevs(pci_scan)");
-               RTE_LOG(ERR, EAL, "Unable to enumerate PCI devices.\n");
+               PCI_LOG(ERR, "Unable to enumerate PCI devices.");
                goto end;
        }
 
@@ -495,7 +492,7 @@ rte_pci_scan(void)
                device_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
        }
 
-       RTE_LOG(DEBUG, EAL, "PCI scan found %lu devices\n", found_device);
+       PCI_LOG(DEBUG, "PCI scan found %lu devices", found_device);
        ret = 0;
 end:
        if (dev_info != INVALID_HANDLE_VALUE)
diff --git a/drivers/bus/pci/windows/pci_netuio.c 
b/drivers/bus/pci/windows/pci_netuio.c
index 314bbcf547..346b2f4c0a 100644
--- a/drivers/bus/pci/windows/pci_netuio.c
+++ b/drivers/bus/pci/windows/pci_netuio.c
@@ -96,7 +96,7 @@ get_netuio_device_interface_detail(HDEVINFO di_set)
 
        dev_ifx_detail = malloc(required_size);
        if (!dev_ifx_detail) {
-               RTE_LOG(ERR, EAL, "Could not allocate memory for dev 
interface.\n");
+               PCI_LOG(ERR, "Could not allocate memory for dev interface.");
                goto end;
        }
        dev_ifx_detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
@@ -148,15 +148,14 @@ get_netuio_device_info(HDEVINFO dev_info, 
PSP_DEVINFO_DATA dev_info_data,
                NULL);
        if (netuio == INVALID_HANDLE_VALUE) {
                RTE_LOG_WIN32_ERR("CreateFile");
-               RTE_LOG(ERR, EAL, "Unable to open driver file \"%s\".\n",
-                       dev_ifx_detail->DevicePath);
+               PCI_LOG(ERR, "Unable to open driver file \"%s\".", 
dev_ifx_detail->DevicePath);
                goto end;
        }
 
        /* send ioctl to retrieve device information */
        if (send_ioctl(netuio, IOCTL_NETUIO_MAP_HW_INTO_USERSPACE, NULL, 0,
                &hw_info, sizeof(hw_info)) != ERROR_SUCCESS) {
-               RTE_LOG(ERR, EAL, "Unable to send ioctl to driver.\n");
+               PCI_LOG(ERR, "Unable to send ioctl to driver.");
                goto end;
        }
 
-- 
2.45.2

Reply via email to