[dpdk-dev] [PATCH v2 03/14] eal/soc: Implement SoC device list and dump

Shreyansh Jain shreyansh.jain at nxp.com
Wed Aug 31 13:00:24 CEST 2016


SoC devices would be linked in a separate list (from PCI). This is used for
probe function.
A helper for dumping the device list is added.

Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain at nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  2 ++
 lib/librte_eal/common/eal_common_soc.c          | 34 +++++++++++++++++++++++++
 lib/librte_eal/common/include/rte_soc.h         |  9 +++++++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  2 ++
 4 files changed, 47 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index cda8009..de38848 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -169,7 +169,9 @@ DPDK_16.11 {
 	rte_eal_dev_attach;
 	rte_eal_dev_detach;
 	soc_driver_list;
+	soc_device_list
 	rte_eal_soc_register;
 	rte_eal_soc_unregister;
+	rte_eal_soc_dump;
 
 } DPDK_16.07;
diff --git a/lib/librte_eal/common/eal_common_soc.c b/lib/librte_eal/common/eal_common_soc.c
index 56135ed..5dcddc5 100644
--- a/lib/librte_eal/common/eal_common_soc.c
+++ b/lib/librte_eal/common/eal_common_soc.c
@@ -31,6 +31,8 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <stddef.h>
+#include <stdio.h>
 #include <sys/queue.h>
 
 #include <rte_log.h>
@@ -40,6 +42,38 @@
 /* Global SoC driver list */
 struct soc_driver_list soc_driver_list =
 	TAILQ_HEAD_INITIALIZER(soc_driver_list);
+struct soc_device_list soc_device_list =
+	TAILQ_HEAD_INITIALIZER(soc_device_list);
+
+/* dump one device */
+static int
+soc_dump_one_device(FILE *f, struct rte_soc_device *dev)
+{
+	int i;
+
+	fprintf(f, "%s", dev->addr.name);
+	fprintf(f, " - fdt_path: %s\n",
+			dev->addr.fdt_path ? dev->addr.fdt_path : "(none)");
+
+	for (i = 0; dev->id && dev->id[i].compatible; ++i)
+		fprintf(f, "   %s\n", dev->id[i].compatible);
+
+	return 0;
+}
+
+/* dump devices on the bus to an output stream */
+void
+rte_eal_soc_dump(FILE *f)
+{
+	struct rte_soc_device *dev = NULL;
+
+	if (!f)
+		return;
+
+	TAILQ_FOREACH(dev, &soc_device_list, next) {
+		soc_dump_one_device(f, dev);
+	}
+}
 
 /* register a driver */
 void
diff --git a/lib/librte_eal/common/include/rte_soc.h b/lib/librte_eal/common/include/rte_soc.h
index 16c5a1b..c6f98eb 100644
--- a/lib/librte_eal/common/include/rte_soc.h
+++ b/lib/librte_eal/common/include/rte_soc.h
@@ -56,8 +56,12 @@ extern "C" {
 
 extern struct soc_driver_list soc_driver_list;
 /**< Global list of SoC Drivers */
+extern struct soc_device_list soc_device_list;
+/**< Global list of SoC Devices */
 
 TAILQ_HEAD(soc_driver_list, rte_soc_driver); /**< SoC drivers in D-linked Q. */
+TAILQ_HEAD(soc_device_list, rte_soc_device); /**< SoC devices in D-linked Q. */
+
 
 struct rte_soc_id {
 	const char *compatible; /**< OF compatible specification */
@@ -142,6 +146,11 @@ rte_eal_compare_soc_addr(const struct rte_soc_addr *a0,
 }
 
 /**
+ * Dump discovered SoC devices.
+ */
+void rte_eal_soc_dump(FILE *f);
+
+/**
  * Register a SoC driver.
  */
 void rte_eal_soc_register(struct rte_soc_driver *driver);
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 66c1258..b9d1932 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -175,7 +175,9 @@ DPDK_16.11 {
 	rte_eal_vdrv_register;
 	rte_eal_vdrv_unregister;
 	soc_driver_list;
+	soc_device_list;
 	rte_eal_soc_register;
 	rte_eal_soc_unregister;
+	rte_eal_soc_dump;
 
 } DPDK_16.07;
-- 
2.7.4



More information about the dev mailing list