From: Jan Viktorin <vikto...@rehivetech.com>

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 cf6fb8e..86e3cfd 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -171,11 +171,13 @@ DPDK_16.11 {
        rte_eal_dev_attach;
        rte_eal_dev_detach;
        rte_eal_map_resource;
+       rte_eal_soc_dump;
        rte_eal_soc_register;
        rte_eal_soc_unregister;
        rte_eal_unmap_resource;
        rte_eal_vdrv_register;
        rte_eal_vdrv_unregister;
+       soc_device_list;
        soc_driver_list;

 } 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 23b06a9..347e611 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 ab6b985..0155025 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -175,11 +175,13 @@ DPDK_16.11 {
        rte_eal_dev_attach;
        rte_eal_dev_detach;
        rte_eal_map_resource;
+       rte_eal_soc_dump;
        rte_eal_soc_register;
        rte_eal_soc_unregister;
        rte_eal_unmap_resource;
        rte_eal_vdrv_register;
        rte_eal_vdrv_unregister;
+       soc_device_list;
        soc_driver_list;

 } DPDK_16.07;
-- 
2.7.4

Reply via email to