diff mbox series

[v3,01/14] common/dpaax: moving OF lib code from dpaa bus

Message ID 20191001110209.6047-2-g.singh@nxp.com
State Superseded
Headers show
Series [v3,01/14] common/dpaax: moving OF lib code from dpaa bus | expand

Commit Message

Gagandeep Singh Oct. 1, 2019, 11:01 a.m. UTC
From: Hemant Agrawal <hemant.agrawal@nxp.com>


This code is being shared by more than 1 type of driver.
Common is most appropriate place for it.

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

---
 drivers/bus/dpaa/Makefile                     |  2 +-
 drivers/bus/dpaa/base/fman/fman.c             |  2 +-
 drivers/bus/dpaa/base/fman/netcfg_layer.c     |  2 +-
 drivers/bus/dpaa/base/qbman/dpaa_sys.h        |  3 +-
 drivers/bus/dpaa/dpaa_bus.c                   |  2 +-
 drivers/bus/dpaa/include/compat.h             |  1 -
 drivers/bus/dpaa/include/fman.h               |  1 +
 drivers/bus/dpaa/include/fsl_usd.h            |  1 +
 drivers/bus/dpaa/meson.build                  |  1 -
 drivers/bus/dpaa/rte_dpaa_bus.h               |  2 +-
 drivers/bus/fslmc/Makefile                    |  1 +
 drivers/common/dpaax/Makefile                 | 10 +--
 .../dpaa/include => common/dpaax}/dpaa_list.h |  0
 .../base/fman/of.c => common/dpaax/dpaa_of.c} | 63 ++++++++++---------
 .../include/of.h => common/dpaax/dpaa_of.h}   | 27 ++++++--
 drivers/common/dpaax/dpaax_logs.h             | 10 +++
 drivers/common/dpaax/meson.build              |  5 +-
 .../common/dpaax/rte_common_dpaax_version.map | 18 ++++++
 drivers/crypto/caam_jr/Makefile               |  2 +
 drivers/crypto/caam_jr/caam_jr.c              |  2 +-
 drivers/crypto/dpaa2_sec/Makefile             |  2 +-
 drivers/crypto/dpaa_sec/Makefile              |  1 +
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  2 +-
 drivers/event/dpaa/Makefile                   |  1 +
 drivers/event/dpaa2/Makefile                  |  1 +
 drivers/mempool/dpaa/Makefile                 |  1 +
 drivers/mempool/dpaa2/Makefile                |  1 +
 drivers/net/dpaa/Makefile                     |  1 +
 drivers/net/dpaa/dpaa_ethdev.h                |  2 +-
 drivers/net/dpaa/dpaa_rxtx.c                  |  2 +-
 drivers/net/dpaa2/Makefile                    |  1 +
 drivers/raw/dpaa2_cmdif/Makefile              |  1 +
 drivers/raw/dpaa2_qdma/Makefile               |  1 +
 33 files changed, 118 insertions(+), 54 deletions(-)
 rename drivers/{bus/dpaa/include => common/dpaax}/dpaa_list.h (100%)
 rename drivers/{bus/dpaa/base/fman/of.c => common/dpaax/dpaa_of.c} (88%)
 rename drivers/{bus/dpaa/include/of.h => common/dpaax/dpaa_of.h} (86%)

-- 
2.17.1
diff mbox series

Patch

diff --git a/drivers/bus/dpaa/Makefile b/drivers/bus/dpaa/Makefile
index dfc2717a4..454ac12bf 100644
--- a/drivers/bus/dpaa/Makefile
+++ b/drivers/bus/dpaa/Makefile
@@ -17,6 +17,7 @@  CFLAGS += -Wno-cast-qual
 CFLAGS += -I$(RTE_BUS_DPAA)/
 CFLAGS += -I$(RTE_BUS_DPAA)/include
 CFLAGS += -I$(RTE_BUS_DPAA)/base/qbman
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
 
 # versioning export map
@@ -32,7 +33,6 @@  SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \
 	base/fman/fman.c \
 	base/fman/fman_hw.c \
-	base/fman/of.c \
 	base/fman/netcfg_layer.c \
 	base/qbman/process.c \
 	base/qbman/bman.c \
diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 8fa9b8cae..462efd2d4 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -11,7 +11,7 @@ 
 
 /* This header declares the driver interface we implement */
 #include <fman.h>
-#include <of.h>
+#include <dpaa_of.h>
 #include <rte_malloc.h>
 #include <rte_dpaa_logs.h>
 #include <rte_string_fns.h>
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index bf8c77265..6affd2e92 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -5,7 +5,7 @@ 
  *
  */
 #include <inttypes.h>
-#include <of.h>
+#include <dpaa_of.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <error.h>
diff --git a/drivers/bus/dpaa/base/qbman/dpaa_sys.h b/drivers/bus/dpaa/base/qbman/dpaa_sys.h
index 034991ba1..9377738df 100644
--- a/drivers/bus/dpaa/base/qbman/dpaa_sys.h
+++ b/drivers/bus/dpaa/base/qbman/dpaa_sys.h
@@ -8,7 +8,8 @@ 
 #ifndef __DPAA_SYS_H
 #define __DPAA_SYS_H
 
-#include <of.h>
+#include <compat.h>
+#include <dpaa_of.h>
 
 /* For 2-element tables related to cache-inhibited and cache-enabled mappings */
 #define DPAA_PORTAL_CE 0
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 07cc5c667..ec92cac79 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -32,6 +32,7 @@ 
 #include <rte_bus.h>
 #include <rte_mbuf_pool_ops.h>
 
+#include <dpaa_of.h>
 #include <rte_dpaa_bus.h>
 #include <rte_dpaa_logs.h>
 #include <dpaax_iova_table.h>
@@ -39,7 +40,6 @@ 
 #include <fsl_usd.h>
 #include <fsl_qman.h>
 #include <fsl_bman.h>
-#include <of.h>
 #include <netcfg.h>
 
 int dpaa_logtype_bus;
diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
index 277ce6369..fcc5b2e74 100644
--- a/drivers/bus/dpaa/include/compat.h
+++ b/drivers/bus/dpaa/include/compat.h
@@ -390,7 +390,6 @@  static inline unsigned long get_zeroed_page(gfp_t __foo __rte_unused)
 #define atomic_dec_return(v)    rte_atomic32_sub_return(v, 1)
 #define atomic_sub_and_test(i, v) (rte_atomic32_sub_return(v, i) == 0)
 
-#include <dpaa_list.h>
 #include <dpaa_bits.h>
 
 #endif /* __COMPAT_H */
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index d6eebc877..c02d32d22 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -15,6 +15,7 @@ 
 #include <rte_ether.h>
 
 #include <compat.h>
+#include <dpaa_list.h>
 
 #ifndef FMAN_DEVICE_PATH
 #define FMAN_DEVICE_PATH "/dev/mem"
diff --git a/drivers/bus/dpaa/include/fsl_usd.h b/drivers/bus/dpaa/include/fsl_usd.h
index ec1ab7cee..c18747256 100644
--- a/drivers/bus/dpaa/include/fsl_usd.h
+++ b/drivers/bus/dpaa/include/fsl_usd.h
@@ -9,6 +9,7 @@ 
 #define __FSL_USD_H
 
 #include <compat.h>
+#include <dpaa_list.h>
 #include <fsl_qman.h>
 
 #ifdef __cplusplus
diff --git a/drivers/bus/dpaa/meson.build b/drivers/bus/dpaa/meson.build
index 19daaa5b5..55338cfa7 100644
--- a/drivers/bus/dpaa/meson.build
+++ b/drivers/bus/dpaa/meson.build
@@ -12,7 +12,6 @@  deps += ['common_dpaax', 'eventdev']
 sources = files('base/fman/fman.c',
 		'base/fman/fman_hw.c',
 		'base/fman/netcfg_layer.c',
-		'base/fman/of.c',
 		'base/qbman/bman.c',
 		'base/qbman/bman_driver.c',
 		'base/qbman/dpaa_alloc.c',
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 554a56f2e..e3135ecaf 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -10,10 +10,10 @@ 
 #include <rte_mempool.h>
 #include <dpaax_iova_table.h>
 
+#include <dpaa_of.h>
 #include <fsl_usd.h>
 #include <fsl_qman.h>
 #include <fsl_bman.h>
-#include <of.h>
 #include <netcfg.h>
 
 #define DPAA_MEMPOOL_OPS_NAME	"dpaa"
diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
index 218d9bd28..16f0a2ca4 100644
--- a/drivers/bus/fslmc/Makefile
+++ b/drivers/bus/fslmc/Makefile
@@ -16,6 +16,7 @@  CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev
diff --git a/drivers/common/dpaax/Makefile b/drivers/common/dpaax/Makefile
index 94d2cf0ce..a0a1de028 100644
--- a/drivers/common/dpaax/Makefile
+++ b/drivers/common/dpaax/Makefile
@@ -12,6 +12,10 @@  LIB = librte_common_dpaax.a
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-pointer-arith
+CFLAGS += -Wno-cast-qual
+
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 
 # versioning export map
 EXPORT_MAP := rte_common_dpaax_version.map
@@ -22,10 +26,8 @@  LIBABIVER := 1
 #
 # all source are stored in SRCS-y
 #
-SRCS-y += dpaax_iova_table.c
+SRCS-y += dpaax_iova_table.c dpaa_of.c
 
 LDLIBS += -lrte_eal
 
-SYMLINK-y-include += dpaax_iova_table.h
-
-include $(RTE_SDK)/mk/rte.lib.mk
\ No newline at end of file
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/bus/dpaa/include/dpaa_list.h b/drivers/common/dpaax/dpaa_list.h
similarity index 100%
rename from drivers/bus/dpaa/include/dpaa_list.h
rename to drivers/common/dpaax/dpaa_list.h
diff --git a/drivers/bus/dpaa/base/fman/of.c b/drivers/common/dpaax/dpaa_of.c
similarity index 88%
rename from drivers/bus/dpaa/base/fman/of.c
rename to drivers/common/dpaax/dpaa_of.c
index 1e97be54e..bb2c8fc66 100644
--- a/drivers/bus/dpaa/base/fman/of.c
+++ b/drivers/common/dpaax/dpaa_of.c
@@ -5,9 +5,10 @@ 
  *
  */
 
-#include <of.h>
+#include <dpaa_of.h>
+#include <assert.h>
 #include <rte_string_fns.h>
-#include <rte_dpaa_logs.h>
+#include <dpaax_logs.h>
 
 static int alive;
 static struct dt_dir root_dir;
@@ -23,7 +24,7 @@  of_open_dir(const char *relative_path, struct dirent ***d)
 	snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path);
 	ret = scandir(full_path, d, 0, versionsort);
 	if (ret < 0)
-		DPAA_BUS_LOG(ERR, "Failed to open directory %s",
+		DPAAX_LOG(ERR, "Failed to open directory %s",
 			     full_path);
 	return ret;
 }
@@ -45,7 +46,7 @@  of_open_file(const char *relative_path)
 	snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path);
 	ret = open(full_path, O_RDONLY);
 	if (ret < 0)
-		DPAA_BUS_LOG(ERR, "Failed to open directory %s",
+		DPAAX_LOG(ERR, "Failed to open directory %s",
 			     full_path);
 	return ret;
 }
@@ -57,7 +58,7 @@  process_file(struct dirent *dent, struct dt_dir *parent)
 	struct dt_file *f = malloc(sizeof(*f));
 
 	if (!f) {
-		DPAA_BUS_LOG(DEBUG, "Unable to allocate memory for file node");
+		DPAAX_LOG(DEBUG, "Unable to allocate memory for file node");
 		return;
 	}
 	f->node.is_file = 1;
@@ -67,14 +68,14 @@  process_file(struct dirent *dent, struct dt_dir *parent)
 	f->parent = parent;
 	fd = of_open_file(f->node.node.full_name);
 	if (fd < 0) {
-		DPAA_BUS_LOG(DEBUG, "Unable to open file node");
+		DPAAX_LOG(DEBUG, "Unable to open file node");
 		free(f);
 		return;
 	}
 	f->len = read(fd, f->buf, OF_FILE_BUF_MAX);
 	close(fd);
 	if (f->len < 0) {
-		DPAA_BUS_LOG(DEBUG, "Unable to read file node");
+		DPAAX_LOG(DEBUG, "Unable to read file node");
 		free(f);
 		return;
 	}
@@ -130,7 +131,7 @@  iterate_dir(struct dirent **d, int num, struct dt_dir *dt)
 			list_add_tail(&subdir->node.list, &dt->subdirs);
 			break;
 		default:
-			DPAA_BUS_LOG(DEBUG, "Ignoring invalid dt entry %s/%s",
+			DPAAX_LOG(DEBUG, "Ignoring invalid dt entry %s/%s",
 				     dt->node.node.full_name, d[loop]->d_name);
 		}
 	}
@@ -170,37 +171,37 @@  linear_dir(struct dt_dir *d)
 	list_for_each_entry(f, &d->files, node.list) {
 		if (!strcmp(f->node.node.name, "compatible")) {
 			if (d->compatible)
-				DPAA_BUS_LOG(DEBUG, "Duplicate compatible in"
+				DPAAX_LOG(DEBUG, "Duplicate compatible in"
 					     " %s", d->node.node.full_name);
 			d->compatible = f;
 		} else if (!strcmp(f->node.node.name, "status")) {
 			if (d->status)
-				DPAA_BUS_LOG(DEBUG, "Duplicate status in %s",
+				DPAAX_LOG(DEBUG, "Duplicate status in %s",
 					     d->node.node.full_name);
 			d->status = f;
 		} else if (!strcmp(f->node.node.name, "linux,phandle")) {
 			if (d->lphandle)
-				DPAA_BUS_LOG(DEBUG, "Duplicate lphandle in %s",
+				DPAAX_LOG(DEBUG, "Duplicate lphandle in %s",
 					     d->node.node.full_name);
 			d->lphandle = f;
 		} else if (!strcmp(f->node.node.name, "phandle")) {
 			if (d->lphandle)
-				DPAA_BUS_LOG(DEBUG, "Duplicate lphandle in %s",
+				DPAAX_LOG(DEBUG, "Duplicate lphandle in %s",
 					     d->node.node.full_name);
 			d->lphandle = f;
 		} else if (!strcmp(f->node.node.name, "#address-cells")) {
 			if (d->a_cells)
-				DPAA_BUS_LOG(DEBUG, "Duplicate a_cells in %s",
+				DPAAX_LOG(DEBUG, "Duplicate a_cells in %s",
 					     d->node.node.full_name);
 			d->a_cells = f;
 		} else if (!strcmp(f->node.node.name, "#size-cells")) {
 			if (d->s_cells)
-				DPAA_BUS_LOG(DEBUG, "Duplicate s_cells in %s",
+				DPAAX_LOG(DEBUG, "Duplicate s_cells in %s",
 					     d->node.node.full_name);
 			d->s_cells = f;
 		} else if (!strcmp(f->node.node.name, "reg")) {
 			if (d->reg)
-				DPAA_BUS_LOG(DEBUG, "Duplicate reg in %s",
+				DPAAX_LOG(DEBUG, "Duplicate reg in %s",
 					     d->node.node.full_name);
 			d->reg = f;
 		}
@@ -220,7 +221,7 @@  of_init_path(const char *dt_path)
 	base_dir = dt_path;
 
 	/* This needs to be singleton initialization */
-	DPAA_BUS_HWWARN(alive, "Double-init of device-tree driver!");
+	DPAAX_HWWARN(alive, "Double-init of device-tree driver!");
 
 	/* Prepare root node (the remaining fields are set in process_dir()) */
 	root_dir.node.node.name[0] = '\0';
@@ -231,7 +232,7 @@  of_init_path(const char *dt_path)
 	/* Kick things off... */
 	ret = process_dir("", &root_dir);
 	if (ret) {
-		DPAA_BUS_LOG(ERR, "Unable to parse device tree");
+		DPAAX_LOG(ERR, "Unable to parse device tree");
 		return ret;
 	}
 
@@ -261,7 +262,7 @@  destroy_dir(struct dt_dir *d)
 void
 of_finish(void)
 {
-	DPAA_BUS_HWWARN(!alive, "Double-finish of device-tree driver!");
+	DPAAX_HWWARN(!alive, "Double-finish of device-tree driver!");
 
 	destroy_dir(&root_dir);
 	INIT_LIST_HEAD(&linear);
@@ -298,12 +299,12 @@  check_compatible(const struct dt_file *f, const char *compatible)
 
 const struct device_node *
 of_find_compatible_node(const struct device_node *from,
-			const char *type __always_unused,
+			const char *type __rte_unused,
 			const char *compatible)
 {
 	const struct dt_dir *d;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 
 	if (list_empty(&linear))
 		return NULL;
@@ -328,7 +329,7 @@  of_get_property(const struct device_node *from, const char *name,
 	const struct dt_dir *d;
 	const struct dt_file *f;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 
 	d = node2dir(from);
 	list_for_each_entry(f, &d->files, node.list)
@@ -345,7 +346,7 @@  of_device_is_available(const struct device_node *dev_node)
 {
 	const struct dt_dir *d;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 	d = node2dir(dev_node);
 	if (!d->status)
 		return true;
@@ -357,11 +358,11 @@  of_device_is_available(const struct device_node *dev_node)
 }
 
 const struct device_node *
-of_find_node_by_phandle(phandle ph)
+of_find_node_by_phandle(uint64_t ph)
 {
 	const struct dt_dir *d;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 	list_for_each_entry(d, &linear, linear)
 		if (d->lphandle && (d->lphandle->len == 4) &&
 		    !memcmp(d->lphandle->buf, &ph, 4))
@@ -374,7 +375,7 @@  of_get_parent(const struct device_node *dev_node)
 {
 	const struct dt_dir *d;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 
 	if (!dev_node)
 		return NULL;
@@ -390,14 +391,14 @@  of_get_next_child(const struct device_node *dev_node,
 {
 	const struct dt_dir *p, *c;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 
 	if (!dev_node)
 		return NULL;
 	p = node2dir(dev_node);
 	if (prev) {
 		c = node2dir(prev);
-		DPAA_BUS_HWWARN((c->parent != p), "Parent/child mismatch");
+		DPAAX_HWWARN((c->parent != p), "Parent/child mismatch");
 		if (c->parent != p)
 			return NULL;
 		if (c->node.list.next == &p->subdirs)
@@ -418,7 +419,7 @@  of_n_addr_cells(const struct device_node *dev_node)
 {
 	const struct dt_dir *d;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised");
 	if (!dev_node)
 		return OF_DEFAULT_NA;
 	d = node2dir(dev_node);
@@ -440,7 +441,7 @@  of_n_size_cells(const struct device_node *dev_node)
 {
 	const struct dt_dir *d;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 	if (!dev_node)
 		return OF_DEFAULT_NA;
 	d = node2dir(dev_node);
@@ -496,7 +497,7 @@  of_translate_address(const struct device_node *dev_node,
 	size_t rlen;
 	uint32_t na, pna;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 	assert(dev_node != NULL);
 
 	na = of_n_addr_cells(dev_node);
@@ -538,7 +539,7 @@  of_device_is_compatible(const struct device_node *dev_node,
 {
 	const struct dt_dir *d;
 
-	DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
+	DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
 	if (!dev_node)
 		d = &root_dir;
 	else
diff --git a/drivers/bus/dpaa/include/of.h b/drivers/common/dpaax/dpaa_of.h
similarity index 86%
rename from drivers/bus/dpaa/include/of.h
rename to drivers/common/dpaax/dpaa_of.h
index 7ea7608fc..e9761ce0e 100644
--- a/drivers/bus/dpaa/include/of.h
+++ b/drivers/common/dpaax/dpaa_of.h
@@ -8,7 +8,24 @@ 
 #ifndef __OF_H
 #define	__OF_H
 
-#include <compat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <glob.h>
+#include <errno.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <limits.h>
+#include <inttypes.h>
+#include <rte_common.h>
+#include <dpaa_list.h>
 
 #ifndef OF_INIT_DEFAULT_PATH
 #define OF_INIT_DEFAULT_PATH "/proc/device-tree"
@@ -89,7 +106,7 @@  struct dt_file {
 
 const struct device_node *of_find_compatible_node(
 					const struct device_node *from,
-					const char *type __always_unused,
+					const char *type __rte_unused,
 					const char *compatible)
 	__attribute__((nonnull(3)));
 
@@ -102,7 +119,7 @@  const void *of_get_property(const struct device_node *from, const char *name,
 			    size_t *lenp) __attribute__((nonnull(2)));
 bool of_device_is_available(const struct device_node *dev_node);
 
-const struct device_node *of_find_node_by_phandle(phandle ph);
+const struct device_node *of_find_node_by_phandle(uint64_t ph);
 
 const struct device_node *of_get_parent(const struct device_node *dev_node);
 
@@ -122,7 +139,7 @@  const uint32_t *of_get_address(const struct device_node *dev_node, size_t idx,
 			       uint64_t *size, uint32_t *flags);
 
 uint64_t of_translate_address(const struct device_node *dev_node,
-			      const u32 *addr) __attribute__((nonnull));
+			      const uint32_t *addr) __attribute__((nonnull));
 
 bool of_device_is_compatible(const struct device_node *dev_node,
 			     const char *compatible);
@@ -147,7 +164,7 @@  static inline int of_init(void)
 /* Read a numeric property according to its size and return it as a 64-bit
  * value.
  */
-static inline uint64_t of_read_number(const __be32 *cell, int size)
+static inline uint64_t of_read_number(const uint32_t *cell, int size)
 {
 	uint64_t r = 0;
 
diff --git a/drivers/common/dpaax/dpaax_logs.h b/drivers/common/dpaax/dpaax_logs.h
index bf1b27cc1..180476f67 100644
--- a/drivers/common/dpaax/dpaax_logs.h
+++ b/drivers/common/dpaax/dpaax_logs.h
@@ -9,6 +9,16 @@ 
 
 extern int dpaax_logger;
 
+#ifdef RTE_LIBRTE_DPAAX_DEBUG
+#define DPAAX_HWWARN(cond, fmt, args...) \
+	do {\
+		if (cond) \
+			DPAAX_LOG(DEBUG, "WARN: " fmt, ##args); \
+	} while (0)
+#else
+#define DPAAX_HWWARN(cond, fmt, args...) do { } while (0)
+#endif
+
 #define DPAAX_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, dpaax_logger, "dpaax: " fmt "\n", \
 		##args)
diff --git a/drivers/common/dpaax/meson.build b/drivers/common/dpaax/meson.build
index a315e7786..fb97be1c1 100644
--- a/drivers/common/dpaax/meson.build
+++ b/drivers/common/dpaax/meson.build
@@ -8,6 +8,9 @@  if not is_linux
 	reason = 'only supported on linux'
 endif
 
-sources = files('dpaax_iova_table.c')
+sources = files('dpaax_iova_table.c', 'dpaa_of.c')
 
 cflags += ['-D_GNU_SOURCE']
+if cc.has_argument('-Wno-cast-qual')
+        cflags += '-Wno-cast-qual'
+endif
diff --git a/drivers/common/dpaax/rte_common_dpaax_version.map b/drivers/common/dpaax/rte_common_dpaax_version.map
index 8131c9e30..a7699ae4d 100644
--- a/drivers/common/dpaax/rte_common_dpaax_version.map
+++ b/drivers/common/dpaax/rte_common_dpaax_version.map
@@ -9,3 +9,21 @@  DPDK_18.11 {
 
 	local: *;
 };
+
+DPDK_19.11 {
+	global:
+	of_device_is_available;
+	of_device_is_compatible;
+	of_find_compatible_node;
+	of_find_node_by_phandle;
+	of_get_address;
+	of_get_mac_address;
+	of_get_parent;
+	of_get_property;
+	of_init_path;
+	of_n_addr_cells;
+	of_translate_address;
+	of_get_next_child;
+
+	local: *;
+} DPDK_18.11;
diff --git a/drivers/crypto/caam_jr/Makefile b/drivers/crypto/caam_jr/Makefile
index cecfbbdc8..6eee8379f 100644
--- a/drivers/crypto/caam_jr/Makefile
+++ b/drivers/crypto/caam_jr/Makefile
@@ -17,6 +17,7 @@  CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/caam_jr
 #sharing the hw flib headers from dpaa2_sec pmd
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/
@@ -37,6 +38,7 @@  SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) += caam_jr_uio.c
 
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_common_dpaax
 LDLIBS += -lrte_bus_dpaa
 LDLIBS += -lrte_bus_vdev
 
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 77c030347..f24513b43 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -27,7 +27,7 @@ 
 /* RTA header files */
 #include <hw/desc/common.h>
 #include <hw/desc/algo.h>
-#include <of.h>
+#include <dpaa_of.h>
 
 #define CAAM_JR_DBG	0
 #define CRYPTODEV_NAME_CAAM_JR_PMD	crypto_caam_jr
diff --git a/drivers/crypto/dpaa2_sec/Makefile b/drivers/crypto/dpaa2_sec/Makefile
index 9c6657e52..039901bec 100644
--- a/drivers/crypto/dpaa2_sec/Makefile
+++ b/drivers/crypto/dpaa2_sec/Makefile
@@ -19,7 +19,7 @@  ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
 CFLAGS += -Wno-implicit-fallthrough
 endif
 endif
-
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/mc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/
diff --git a/drivers/crypto/dpaa_sec/Makefile b/drivers/crypto/dpaa_sec/Makefile
index 1d8b7bec1..8d1706597 100644
--- a/drivers/crypto/dpaa_sec/Makefile
+++ b/drivers/crypto/dpaa_sec/Makefile
@@ -16,6 +16,7 @@  CFLAGS += $(WERROR_FLAGS)
 
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa_sec/
 #sharing the hw flib headers from dpaa2_sec pmd
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 122c80a07..b0b6e57d4 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -27,7 +27,7 @@ 
 
 #include <fsl_usd.h>
 #include <fsl_qman.h>
-#include <of.h>
+#include <dpaa_of.h>
 
 /* RTA header files */
 #include <hw/desc/common.h>
diff --git a/drivers/event/dpaa/Makefile b/drivers/event/dpaa/Makefile
index cf9626495..a9f8648e7 100644
--- a/drivers/event/dpaa/Makefile
+++ b/drivers/event/dpaa/Makefile
@@ -19,6 +19,7 @@  CFLAGS += -I$(RTE_SDK_DPAA)/include
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include/
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
 
 EXPORT_MAP := rte_pmd_dpaa_event_version.map
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 470157f25..647a8372d 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -17,6 +17,7 @@  CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 LDLIBS += -lrte_eal -lrte_eventdev
 LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
 LDLIBS += -lrte_bus_vdev
diff --git a/drivers/mempool/dpaa/Makefile b/drivers/mempool/dpaa/Makefile
index ead5029fd..534e00733 100644
--- a/drivers/mempool/dpaa/Makefile
+++ b/drivers/mempool/dpaa/Makefile
@@ -12,6 +12,7 @@  CFLAGS := -I$(SRCDIR) $(CFLAGS)
 CFLAGS += -O3 $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include/
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa
 CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
 
diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile
index c1df78a80..bdb941025 100644
--- a/drivers/mempool/dpaa2/Makefile
+++ b/drivers/mempool/dpaa2/Makefile
@@ -12,6 +12,7 @@  LIB = librte_mempool_dpaa2.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
 
 # versioning export map
diff --git a/drivers/net/dpaa/Makefile b/drivers/net/dpaa/Makefile
index 4fb16bd9d..395e4d900 100644
--- a/drivers/net/dpaa/Makefile
+++ b/drivers/net/dpaa/Makefile
@@ -19,6 +19,7 @@  CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include/
 CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/base/qbman
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index f63a5f164..182becac1 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -15,7 +15,7 @@ 
 #include <fsl_usd.h>
 #include <fsl_qman.h>
 #include <fsl_bman.h>
-#include <of.h>
+#include <dpaa_of.h>
 #include <netcfg.h>
 
 #define MAX_DPAA_CORES			4
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 30b183607..9e735cc83 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -44,7 +44,7 @@ 
 #include <fsl_usd.h>
 #include <fsl_qman.h>
 #include <fsl_bman.h>
-#include <of.h>
+#include <dpaa_of.h>
 #include <netcfg.h>
 
 #define DPAA_MBUF_TO_CONTIG_FD(_mbuf, _fd, _bpid) \
diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index c7262ffd5..b8387706c 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -12,6 +12,7 @@  LIB = librte_pmd_dpaa2.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile
index 2b4150c2d..a7c980247 100644
--- a/drivers/raw/dpaa2_cmdif/Makefile
+++ b/drivers/raw/dpaa2_cmdif/Makefile
@@ -14,6 +14,7 @@  CFLAGS += $(WERROR_FLAGS)
 
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 
 LDLIBS += -lrte_bus_fslmc
 LDLIBS += -lrte_bus_vdev
diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index 0009fd4c6..057b2a81a 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -14,6 +14,7 @@  CFLAGS += $(WERROR_FLAGS)
 
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 
 LDLIBS += -lrte_bus_fslmc
 LDLIBS += -lrte_eal