From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <shreyansh.jain@nxp.com>
Received: from NAM03-CO1-obe.outbound.protection.outlook.com
 (mail-co1nam03on0050.outbound.protection.outlook.com [104.47.40.50])
 by dpdk.org (Postfix) with ESMTP id 7D7C9F612
 for <dev@dpdk.org>; Mon, 16 Jan 2017 16:35:35 +0100 (CET)
Received: from BLUPR0301CA0004.namprd03.prod.outlook.com (10.162.113.142) by
 MWHPR03MB2478.namprd03.prod.outlook.com (10.169.200.148) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
 15.1.845.12; Mon, 16 Jan 2017 15:35:34 +0000
Received: from BN1BFFO11FD046.protection.gbl (2a01:111:f400:7c10::1:160) by
 BLUPR0301CA0004.outlook.office365.com (2a01:111:e400:5259::14) with Microsoft
 SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12 via
 Frontend Transport; Mon, 16 Jan 2017 15:35:33 +0000
Authentication-Results: spf=fail (sender IP is 192.88.168.50)
 smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed)
 header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com;
 dkim=none (message not signed) header.d=none;
Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not
 designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; 
 client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net;
Received: from tx30smr01.am.freescale.net (192.88.168.50) by
 BN1BFFO11FD046.mail.protection.outlook.com (10.58.145.1) with Microsoft SMTP
 Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8
 via Frontend Transport; Mon, 16 Jan 2017 15:35:33 +0000
Received: from tophie.ap.freescale.net ([10.232.14.39])
 by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0GFZ4mn019448;
 Mon, 16 Jan 2017 08:35:31 -0700
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: <david.marchand@6wind.com>
CC: <dev@dpdk.org>, <thomas.monjalon@6wind.com>, Shreyansh Jain
 <shreyansh.jain@nxp.com>
Date: Mon, 16 Jan 2017 21:08:26 +0530
Message-ID: <1484581107-2025-8-git-send-email-shreyansh.jain@nxp.com>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1484581107-2025-1-git-send-email-shreyansh.jain@nxp.com>
References: <1484581107-2025-1-git-send-email-shreyansh.jain@nxp.com>
X-EOPAttributedMessage: 0
X-Matching-Connectors: 131290545335473552;
 (91ab9b29-cfa4-454e-5278-08d120cd25b8); ()
X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI;
 SFV:NSPM;
 SFS:(10009020)(6009001)(7916002)(336005)(39410400002)(39400400002)(39850400002)(39840400002)(39380400002)(39450400003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(81166006)(8936002)(8676002)(81156014)(86362001)(575784001)(50466002)(48376002)(33646002)(47776003)(2906002)(356003)(305945005)(50226002)(106466001)(2351001)(68736007)(105606002)(4326007)(5660300001)(626004)(189998001)(38730400001)(104016004)(85426001)(110136003)(92566002)(5003940100001)(54906002)(76176999)(6666003)(8656002)(77096006)(50986999)(2950100002)(36756003)(97736004)(27001)(6916009);
 DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2478; H:tx30smr01.am.freescale.net;
 FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; 
X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD046;
 1:ZksJaXeoYRj3x8xDrdAMTxwoh3cXMBfuqh1sAh8sP/fPBPf/bhct3hHiGn2bsrZyk2mglSdxd6AdlSJ+9MWS36+alG0JTxlhwozXA8cn1hLOVQUcDJW7pkf6S1GhDsbCwlM4JPVcDTfWTggzzULTnW8FqVoNAU2RFT43qoMsvt4LCwBOaKp7s4FVA6NVx9MURJ7cSOIZmCO/nHicm4eKhWkkw5v3hLTdsCmrrx15U06Hn0HrPm/TDR83nf1OyRvXtmSAy50dhkzyuPiqA7V+3FBnBkOvjQwcwRBpTbmciTuxTYiJpsDPu95KWJtzCaNZegWp9CeGZ/Uvv4KCfjALQXJHa0dYJ0sgeD50U12306PNfYyKwUkPXOC7cns9rYL1yWPjjfsebxqc2AeY2Ao2FF1vcLzxkR5HeQzYTXupTusGldmcTLElAtCqoybWHruyh0seLSOly5EN+HdoBZ/iAaktiBWES9vpii6FGcfghVmDK8E3a+sFXbPeu4gdwrxPiYH46olxt1paFv/aH/vx6xbBL2qi5yZD4VZNW1twMGZANg0LE+HbjHgDZkEhdvwLJQCNKeiNw488caH89rsaX9OneV5O4hOapPyZQU1eMA+plOidUWXIYo8HJcRPpPKb1J44nVSGhT4HBNYMUjDGpCp3G2bO2+7acWmo9BFPnLhVmvB5V6FafpuIQ1nRF1mHM1UBGaKb6F4B+cGpHZ3Vaw==
MIME-Version: 1.0
Content-Type: text/plain
X-MS-Office365-Filtering-Correlation-Id: 736f5f91-6d0e-4620-3437-08d43e254f8b
X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2478;
X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478;
 3:SySSOGavS+uugMZbi2g032ZNtj03bPPf3HV4pX9KpMXvKBQX3WFW46AxPGZqQQowNIDbhxxiEd/lxvsB6ZV0lGqaUI9S67Y9Vqq3lAse/n0XACf6nvUPcik4BHOxeK38L85dXPJrIaMVAe3S1vHhKGW2nZsRy7Cmo2ylgII7BlM5ySUyBJiXTEMHoTIUcD7VYLubi+FKn6csoH+y2nfZoKvuh9D6RdVucVy9X5l+n6VgEJKG7gUGTabRwMB2kfM6X5qQ4T3k6aHEucFA4YhhcbqlS9/kbALsMkUHXGkB2BPnbFF/Phk/mNF8PSWxu8L2RdKtZ6P4RCp1E8nWKl6benK2apw2VBq/eu2KxvsZS95zrBCdE8PKhryCR4nGYyXi;
 25:eeZ7oLHoeic+tbq81C9d2fWdqJOpq6cHvzcUvDqchUsNkkCNWBZwqOlavKG5lInCj/81ybpSkxUhv4Lz8dKDw2wtubZRSbMDnKq1Xt0RwEr2VPgwXNkqg6rIALyvczuhMJ/F+1sxCmi6eEL2n6mG8WuXI/hcWkK5IPdcCF1r08wSmOoR5NjMqiCM/tPNeOuGZgMUy+gYB8N0+Z9hMr6ddgGKFfNJoErjC4rFrLvEOuL1/Q88CmwcZmjGg+H0ad3Z9pstfZBX3dGExILpJG30gj+A0ZtclXWXQz2Kb8vHD/ZACD+XYux1PZkoSGwFXU5CixUPPgvbsi/XsE8NdsHSsKU1SDQFBD+op0exEhUqFTcaEqzlM2XQLcJSfAeOq2+L5z5s+jPOK7IAO3IDCsTeMNEOqoBIMX6g5N2wHyxQYX7JFylu5s9mW5B6zGM9L64l8BU2G6de8ote8gjjcVhipA==
X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478;
 31:Ky5wHpIMbZtVcH7srkclRDnVocWGGEDkr1LFXD8+kl731+4KbtoVO6cvLo6vdbHCP2kX4snFWwuZ6YT9L+qqfTuLa8HXNIGXVeh28B6dXi7IRrMqPk/TCilYqDjOON2qxKuF7h+Zwfqo//ld0knn7TYpP1RpKK9PnqrMzCWpr7jxL5sP8AhJtVBLi9rupt/3xWhw2XHYNtwvUq1A2LNUaHbrD3hm6/LWi4Hc+Sya/vGNhaeMBecgSJcXKH7xOBMa5DKWp/0qp3I0LS581IAe345ygIPn4F2bEFsXAfIxM3Y=
X-Microsoft-Antispam-PRVS: <MWHPR03MB247822474AA73F1EEB339069907D0@MWHPR03MB2478.namprd03.prod.outlook.com>
X-Exchange-Antispam-Report-Test: UriScan:(185117386973197);
X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0;
 RULEID:(6095060)(601004)(2401047)(13023025)(13015025)(13017025)(13018025)(13024025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123556025)(20161123563025)(20161123565025)(20161123559025);
 SRVR:MWHPR03MB2478; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2478; 
X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478;
 4:ucvAOV2abic9ex7HmopUbrm83uh2BN4pUnTgCJT5iwkl7YTcZDuz7foXKzXxfLzxqpnn8cd3N1ynVE2smUiicDOU/mx+XMaqowELjpd6FYM9BDDNLkPRk0fzDfn47I/nIsw5A64qCKJaRBSQECuXqyVSBFuxakhZYlggtIKsuQutnQvo9QHfpeIP0AhlyeuJo7xW2TnXNGdUwRuvGlKX0gzNXJdvD79OpbQQGiKHke/h2JVW3iTg+pa8GJhISRgL+o9ewl9XHNfKlq0Qfrke+P/n9qRZTJKvA515ren7kvW3oLR65boztoIUB+zsPv8m2ESC1PwSPT9tgpQyxfApPp+mNM8A6uOeVQO/eKhnq5tPmAowNyvm7dJn6TtASveJf+M0GKJwzBEhhMwVl7TNU0EJU528JMpg/QgcE4oXAmE5LhoqyoTHc6/iPSZ7+lyjEh2iF0qPG0BswNLIdrIsAapvCDPg37Y5ONVRyTl9Kh0I9llgRocLoAzkWzkcasIv8BwaN/zPcIzVKauxqeIeL71Hl1oGfZ5mQu77j4zhyR55qdlsUo6/U4Fhhi5wIR/v26qj4EnlVj/G5pRIBA8sGg+eV4vu+rGU2cuW+oGRxPbC/8+tUJFud8Sb0N/9Bu9El4Fda7ldbvHU85y/pIyt+c9rVcF4Co04/UFH0tLO/cq9UpeUNkE6aYdM0u4MsU0ZXsxK+oPRXZI4TjKISGmMJdzerUwMID6w+DzEE2bylSz2POCwrOezt6d0QdGEew1n
X-Forefront-PRVS: 01894AD3B8
X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2478;
 23:0CwEc1DsEZiju0DAttcDHD/TKiZExAvmYqlqKCDg5?=
 =?us-ascii?Q?YFRfHC0F1dCdQ4P2byte6uy3bylN5NdjKOkAAuylll1gEJ9RXP7c7fo8KtUP?=
 =?us-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v0LGfvl6Sc+zLRHAd0wO//1+zFfHy8At1hyEjmRbjjuY8hsi0GOFBOc2npG40XrOaoti6jCCJ+PMY8gR/OZbRBf506TD1BcJ4T48NyCsFg2L1P;
 24:y7PkY4pUvx6qIKjvPny/mR5D6KAdSLkn1kDI1lTlqPgX2i6UnnqmQ6hLG2/a0P2mQykIdDRbPU3i0E6EQIMprxmXxEZPYrzhqTpSvt6IpxE=
SpamDiagnosticOutput: 1:99
SpamDiagnosticMetadata: NSPM
X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478;
 7:V56ot1oifSzEYwCeJ77StOvPX4LfdSNGzjetKr4JVTHAMy2Os1ZdpNfxrqrn6LvixIdhkjQzvkgmLHfTZ7yBLby99K9aoIKQd8dLrs0746lu8zxRks0vhXfiyrsaM8oUGQsezRIL5UoloQCjg6K7XP41IuDpdyX3rmk/X6qxRKuVuCZ463cHnw0m0EtqsXyM20WJLXpfMbkjkfdjVsq1objAdh2b3lcHsiqnOpeEf7wGxK0i/BiiRGWZB3o7QnopQ+PKf21GWlV7SDuX1TqGIf/KrEMeGE6DeaqOdS6Nd/3Z4iIMpkgmliMpoW4S5APUNfPvcCJwjXyq5xhWzEe7m03+kx9vcPxsvNMlLkaU80x/wmu84xPjPc3lcWhB7LOjtHUg3rT++sr1mx/2RJcFHohQiHTydW0vZfGk363pKtAu93o7rF6pX04/MED+nSJIU1BnGlquFYFc+PnbiYytxg==
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2017 15:35:33.3133 (UTC)
X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50];
 Helo=[tx30smr01.am.freescale.net]
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2478
Subject: [dpdk-dev] [PATCH v6 7/8] eal: enable PCI bus
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Jan 2017 15:35:36 -0000

Remove EAL initiated direct PCI scan/probe and enable PCI Bus linkage.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 lib/librte_eal/bsdapp/eal/eal.c                 |  7 -----
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  2 --
 lib/librte_eal/common/eal_common_pci.c          | 36 ++++++++++++-----------
 lib/librte_eal/common/eal_private.h             | 10 -------
 lib/librte_eal/common/include/rte_pci.h         | 22 +++++---------
 lib/librte_eal/linuxapp/eal/eal.c               |  7 -----
 lib/librte_eal/linuxapp/eal/eal_pci.c           | 38 +++++++------------------
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  2 --
 8 files changed, 37 insertions(+), 87 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index a584447..a7f2671 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -562,9 +562,6 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_timer_init() < 0)
 		rte_panic("Cannot init HPET or TSC timers\n");
 
-	if (rte_eal_pci_init() < 0)
-		rte_panic("Cannot init PCI\n");
-
 	eal_check_mem_on_local_socket();
 
 	if (eal_plugins_init() < 0)
@@ -613,10 +610,6 @@ rte_eal_init(int argc, char **argv)
 	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
 	rte_eal_mp_wait_lcore();
 
-	/* Probe & Initialize PCI devices */
-	if (rte_eal_pci_probe())
-		rte_panic("Cannot probe PCI\n");
-
 	/* Probe all the buses and devices/drivers on them */
 	if (rte_bus_probe())
 		rte_panic("Cannot probe devices\n");
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index c43140c..f9ec086 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -6,8 +6,6 @@ DPDK_2.0 {
 	eal_parse_sysfs_value;
 	eal_timer_source;
 	lcore_config;
-	pci_device_list;
-	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
 	rte_calloc;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 35da451..1d283d2 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -83,11 +83,6 @@
 
 #include "eal_private.h"
 
-struct pci_driver_list pci_driver_list =
-	TAILQ_HEAD_INITIALIZER(pci_driver_list);
-struct pci_device_list pci_device_list =
-	TAILQ_HEAD_INITIALIZER(pci_device_list);
-
 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
 
 const char *pci_get_sysfs_path(void)
@@ -315,7 +310,7 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
 	if (dev->driver != NULL)
 		return 0;
 
-	TAILQ_FOREACH(dr, &pci_driver_list, next) {
+	FOREACH_DRIVER_ON_PCIBUS(dr) {
 		rc = rte_eal_pci_probe_one_driver(dr, dev);
 		if (rc < 0)
 			/* negative value is an error */
@@ -342,7 +337,7 @@ pci_detach_all_drivers(struct rte_pci_device *dev)
 	if (dev == NULL)
 		return -1;
 
-	TAILQ_FOREACH(dr, &pci_driver_list, next) {
+	FOREACH_DRIVER_ON_PCIBUS(dr) {
 		rc = rte_eal_pci_detach_dev(dr, dev);
 		if (rc < 0)
 			/* negative value is an error */
@@ -363,6 +358,7 @@ int
 rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
 {
 	struct rte_pci_device *dev = NULL;
+
 	int ret = 0;
 
 	if (addr == NULL)
@@ -374,7 +370,7 @@ rte_eal_pci_probe_one(const struct rte_pci_addr *addr)
 	if (pci_update_device(addr) < 0)
 		goto err_return;
 
-	TAILQ_FOREACH(dev, &pci_device_list, next) {
+	FOREACH_DEVICE_ON_PCIBUS(dev) {
 		if (rte_eal_compare_pci_addr(&dev->addr, addr))
 			continue;
 
@@ -404,7 +400,7 @@ rte_eal_pci_detach(const struct rte_pci_addr *addr)
 	if (addr == NULL)
 		return -1;
 
-	TAILQ_FOREACH(dev, &pci_device_list, next) {
+	FOREACH_DEVICE_ON_PCIBUS(dev) {
 		if (rte_eal_compare_pci_addr(&dev->addr, addr))
 			continue;
 
@@ -412,7 +408,7 @@ rte_eal_pci_detach(const struct rte_pci_addr *addr)
 		if (ret < 0)
 			goto err_return;
 
-		TAILQ_REMOVE(&pci_device_list, dev, next);
+		rte_eal_pci_remove_device(dev);
 		free(dev);
 		return 0;
 	}
@@ -441,7 +437,7 @@ rte_eal_pci_probe(void)
 	if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) == 0)
 		probe_all = 1;
 
-	TAILQ_FOREACH(dev, &pci_device_list, next) {
+	FOREACH_DEVICE_ON_PCIBUS(dev) {
 
 		/* set devargs in PCI structure */
 		devargs = pci_devargs_lookup(dev);
@@ -489,7 +485,7 @@ rte_eal_pci_dump(FILE *f)
 {
 	struct rte_pci_device *dev = NULL;
 
-	TAILQ_FOREACH(dev, &pci_device_list, next) {
+	FOREACH_DEVICE_ON_PCIBUS(dev) {
 		pci_dump_one_device(f, dev);
 	}
 }
@@ -498,16 +494,22 @@ rte_eal_pci_dump(FILE *f)
 void
 rte_eal_pci_register(struct rte_pci_driver *driver)
 {
-	TAILQ_INSERT_TAIL(&pci_driver_list, driver, next);
-	rte_eal_driver_register(&driver->driver);
+	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
+	/* Update Bus references */
+	driver->pci_bus = &rte_pci_bus;
 }
 
-/* unregister a driver */
+/* Unregister a driver */
 void
 rte_eal_pci_unregister(struct rte_pci_driver *driver)
 {
-	rte_eal_driver_unregister(&driver->driver);
-	TAILQ_REMOVE(&pci_driver_list, driver, next);
+	struct rte_pci_bus *pci_bus;
+
+	pci_bus = driver->pci_bus;
+
+	TAILQ_REMOVE(&pci_bus->driver_list, driver, next);
+	/* Update Bus references */
+	driver->pci_bus = NULL;
 }
 
 /* Add a PCI device to PCI Bus */
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 9e7d8f6..68386e8 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -108,16 +108,6 @@ int rte_eal_timer_init(void);
  */
 int rte_eal_log_init(const char *id, int facility);
 
-/**
- * Init the PCI infrastructure
- *
- * This function is private to EAL.
- *
- * @return
- *   0 on success, negative on error
- */
-int rte_eal_pci_init(void);
-
 struct rte_pci_driver;
 struct rte_pci_device;
 
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index a52b390..5f8d679 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -87,12 +87,6 @@ extern "C" {
 #include <rte_dev.h>
 #include <rte_bus.h>
 
-TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */
-TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */
-
-extern struct pci_driver_list pci_driver_list; /**< Global list of PCI drivers. */
-extern struct pci_device_list pci_device_list; /**< Global list of PCI devices. */
-
 /** Pathname of PCI devices directory. */
 const char *pci_get_sysfs_path(void);
 
@@ -124,6 +118,9 @@ TAILQ_HEAD(rte_pci_device_list, rte_pci_device);
 /** List of PCI drivers */
 TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 
+/* Extend PCI bus definition to users */
+extern struct rte_pci_bus rte_pci_bus;
+
 /* PCI Bus iterators */
 #define FOREACH_DEVICE_ON_PCIBUS(p)	\
 		TAILQ_FOREACH(p, &(rte_pci_bus.device_list), next)
@@ -208,8 +205,6 @@ struct rte_pci_device {
 	.subsystem_device_id = PCI_ANY_ID
 #endif
 
-struct rte_pci_driver;
-
 /**
  * Initialisation function for the driver called during PCI probing.
  */
@@ -416,17 +411,14 @@ rte_pci_match(struct rte_pci_driver *pci_drv,
 	      struct rte_pci_device *pci_dev);
 
 /**
- * Probe the PCI bus for registered drivers.
- *
- * Scan the content of the PCI bus, and call the probe() function for
- * all registered drivers that have a matching entry in its id_table
- * for discovered devices.
+ * Probe the PCI bus
  *
  * @return
  *   - 0 on success.
- *   - Negative on error.
+ *   - !0 on error.
  */
-int rte_eal_pci_probe(void);
+int
+rte_eal_pci_probe(void);
 
 /**
  * Map the PCI device resources in user space virtual memory address
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index f77ff5c..6bb7fc9 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -803,9 +803,6 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_log_init(logid, internal_config.syslog_facility) < 0)
 		rte_panic("Cannot init logs\n");
 
-	if (rte_eal_pci_init() < 0)
-		rte_panic("Cannot init PCI\n");
-
 #ifdef VFIO_PRESENT
 	if (rte_eal_vfio_setup() < 0)
 		rte_panic("Cannot init VFIO\n");
@@ -884,10 +881,6 @@ rte_eal_init(int argc, char **argv)
 	rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
 	rte_eal_mp_wait_lcore();
 
-	/* Probe & Initialize PCI devices */
-	if (rte_eal_pci_probe())
-		rte_panic("Cannot probe PCI\n");
-
 	/* Probe all the buses and devices/drivers on them */
 	if (rte_bus_probe())
 		rte_panic("Cannot probe devices\n");
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 300064d..50ad9f7 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -232,7 +232,8 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev)
 
 /* Scan one pci sysfs entry, and fill the devices list from it. */
 static int
-pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
+pci_scan_one(struct rte_pci_bus *pci_bus, const char *dirname,
+	     const struct rte_pci_addr *addr)
 {
 	char filename[PATH_MAX];
 	unsigned long tmp;
@@ -350,21 +351,19 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 		dev->kdrv = RTE_KDRV_NONE;
 
 	/* device is valid, add in list (sorted) */
-	if (TAILQ_EMPTY(&pci_device_list)) {
-		rte_eal_device_insert(&dev->device);
-		TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
+	if (TAILQ_EMPTY(&pci_bus->device_list)) {
+		rte_eal_pci_add_device(pci_bus, dev);
 	} else {
 		struct rte_pci_device *dev2;
 		int ret;
 
-		TAILQ_FOREACH(dev2, &pci_device_list, next) {
+		TAILQ_FOREACH(dev2, &pci_bus->device_list, next) {
 			ret = rte_eal_compare_pci_addr(&dev->addr, &dev2->addr);
 			if (ret > 0)
 				continue;
 
 			if (ret < 0) {
-				TAILQ_INSERT_BEFORE(dev2, dev, next);
-				rte_eal_device_insert(&dev->device);
+				rte_eal_pci_insert_device(dev2, dev);
 			} else { /* already registered */
 				dev2->kdrv = dev->kdrv;
 				dev2->max_vfs = dev->max_vfs;
@@ -374,8 +373,8 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 			}
 			return 0;
 		}
-		rte_eal_device_insert(&dev->device);
-		TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
+
+		rte_eal_pci_add_device(pci_bus, dev);
 	}
 
 	return 0;
@@ -390,7 +389,7 @@ pci_update_device(const struct rte_pci_addr *addr)
 		 pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
 		 addr->function);
 
-	return pci_scan_one(filename, addr);
+	return pci_scan_one(&rte_pci_bus, filename, addr);
 }
 
 /*
@@ -467,7 +466,8 @@ rte_eal_pci_scan(void)
 
 		snprintf(dirname, sizeof(dirname), "%s/%s",
 				pci_get_sysfs_path(), e->d_name);
-		if (pci_scan_one(dirname, &addr) < 0)
+
+		if (pci_scan_one(&rte_pci_bus, dirname, &addr) < 0)
 			goto error;
 	}
 	closedir(dir);
@@ -712,22 +712,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
 	return ret;
 }
 
-/* Init the PCI EAL subsystem */
-int
-rte_eal_pci_init(void)
-{
-	/* for debug purposes, PCI can be disabled */
-	if (internal_config.no_pci)
-		return 0;
-
-	if (rte_eal_pci_scan() < 0) {
-		RTE_LOG(ERR, EAL, "%s(): Cannot scan PCI bus\n", __func__);
-		return -1;
-	}
-
-	return 0;
-}
-
 struct rte_pci_bus rte_pci_bus = {
 	.bus = {
 		.scan = rte_eal_pci_scan,
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 6f047c5..f0e63c3 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -6,8 +6,6 @@ DPDK_2.0 {
 	eal_parse_sysfs_value;
 	eal_timer_source;
 	lcore_config;
-	pci_device_list;
-	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
 	rte_calloc;
-- 
2.7.4