[04/18] bus/dpaa: update platform soc value register routines

Message ID 1513166759-13466-5-git-send-email-hemant.agrawal@nxp.com
State Superseded
Headers show
Series
  • DPAA PMD improvements
Related show

Commit Message

Hemant Agrawal Dec. 13, 2017, 12:05 p.m.
This patch update the logic and expose the soc value
register, so that it can be used by other modules as well.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 drivers/bus/dpaa/dpaa_bus.c               | 12 ++++++++++++
 drivers/bus/dpaa/rte_bus_dpaa_version.map |  8 ++++++++
 drivers/bus/dpaa/rte_dpaa_bus.h           | 11 +++++++++++
 drivers/net/dpaa/dpaa_ethdev.c            |  4 +++-
 drivers/net/dpaa/dpaa_ethdev.h            |  5 -----
 5 files changed, 34 insertions(+), 6 deletions(-)

-- 
2.7.4

Patch

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 1cc8c89..f1bc62a 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -77,6 +77,8 @@  struct netcfg_info *dpaa_netcfg;
 /* define a variable to hold the portal_key, once created.*/
 pthread_key_t dpaa_portal_key;
 
+unsigned int dpaa_svr_family;
+
 RTE_DEFINE_PER_LCORE(bool, _dpaa_io);
 
 static inline void
@@ -443,6 +445,8 @@  rte_dpaa_bus_probe(void)
 	int ret = -1;
 	struct rte_dpaa_device *dev;
 	struct rte_dpaa_driver *drv;
+	FILE *svr_file = NULL;
+	unsigned int svr_ver;
 
 	BUS_INIT_FUNC_TRACE();
 
@@ -462,6 +466,14 @@  rte_dpaa_bus_probe(void)
 			break;
 		}
 	}
+
+	svr_file = fopen(DPAA_SOC_ID_FILE, "r");
+	if (svr_file) {
+		if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
+			dpaa_svr_family = svr_ver & SVR_MASK;
+		fclose(svr_file);
+	}
+
 	return 0;
 }
 
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index fb9d532..eeeb458 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -64,3 +64,11 @@  DPDK_17.11 {
 
 	local: *;
 };
+
+DPDK_18.02 {
+	global:
+
+	dpaa_svr_family;
+
+	local: *;
+} DPDK_17.11;
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index eafc944..40caf72 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -46,6 +46,17 @@ 
 #define DEV_TO_DPAA_DEVICE(ptr)	\
 		container_of(ptr, struct rte_dpaa_device, device)
 
+/* DPAA SoC identifier; If this is not available, it can be concluded
+ * that board is non-DPAA. Single slot is currently supported.
+ */
+#define DPAA_SOC_ID_FILE	"/sys/devices/soc0/soc_id"
+
+#define SVR_LS1043A_FAMILY	0x87920000
+#define SVR_LS1046A_FAMILY	0x87070000
+#define SVR_MASK		0xffff0000
+
+extern unsigned int dpaa_svr_family;
+
 struct rte_dpaa_device;
 struct rte_dpaa_driver;
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 29678c5..4ad9afc 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -212,7 +212,9 @@  dpaa_fw_version_get(struct rte_eth_dev *dev __rte_unused,
 		DPAA_PMD_ERR("Unable to open SoC device");
 		return -ENOTSUP; /* Not supported on this infra */
 	}
-	if (fscanf(svr_file, "svr:%x", &svr_ver) <= 0)
+	if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
+		dpaa_svr_family = svr_ver & SVR_MASK;
+	else
 		DPAA_PMD_ERR("Unable to read SoC device");
 
 	fclose(svr_file);
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index ec5ae13..3f06d63 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -43,11 +43,6 @@ 
 #include <of.h>
 #include <netcfg.h>
 
-/* DPAA SoC identifier; If this is not available, it can be concluded
- * that board is non-DPAA. Single slot is currently supported.
- */
-#define DPAA_SOC_ID_FILE		"/sys/devices/soc0/soc_id"
-
 #define DPAA_MBUF_HW_ANNOTATION		64
 #define DPAA_FD_PTA_SIZE		64