common/dpaax: move OF library from DPAA bus
authorHemant Agrawal <hemant.agrawal@nxp.com>
Thu, 10 Oct 2019 06:32:21 +0000 (12:02 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 23 Oct 2019 14:43:08 +0000 (16:43 +0200)
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>
41 files changed:
drivers/bus/dpaa/Makefile
drivers/bus/dpaa/base/fman/fman.c
drivers/bus/dpaa/base/fman/netcfg_layer.c
drivers/bus/dpaa/base/fman/of.c [deleted file]
drivers/bus/dpaa/base/qbman/dpaa_sys.h
drivers/bus/dpaa/base/qbman/qman.c
drivers/bus/dpaa/dpaa_bus.c
drivers/bus/dpaa/include/compat.h [deleted file]
drivers/bus/dpaa/include/dpaa_list.h [deleted file]
drivers/bus/dpaa/include/fman.h
drivers/bus/dpaa/include/fsl_usd.h
drivers/bus/dpaa/include/of.h [deleted file]
drivers/bus/dpaa/meson.build
drivers/bus/dpaa/rte_bus_dpaa_version.map
drivers/bus/dpaa/rte_dpaa_bus.h
drivers/bus/fslmc/Makefile
drivers/common/dpaax/Makefile
drivers/common/dpaax/compat.h [new file with mode: 0644]
drivers/common/dpaax/dpaa_list.h [new file with mode: 0644]
drivers/common/dpaax/dpaa_of.c [new file with mode: 0644]
drivers/common/dpaax/dpaa_of.h [new file with mode: 0644]
drivers/common/dpaax/dpaax_logs.h
drivers/common/dpaax/meson.build
drivers/common/dpaax/rte_common_dpaax_version.map
drivers/crypto/caam_jr/Makefile
drivers/crypto/caam_jr/caam_jr.c
drivers/crypto/caam_jr/meson.build
drivers/crypto/dpaa2_sec/Makefile
drivers/crypto/dpaa_sec/Makefile
drivers/crypto/dpaa_sec/dpaa_sec.c
drivers/crypto/dpaa_sec/meson.build
drivers/event/dpaa/Makefile
drivers/event/dpaa2/Makefile
drivers/mempool/dpaa/Makefile
drivers/mempool/dpaa2/Makefile
drivers/net/dpaa/Makefile
drivers/net/dpaa/dpaa_ethdev.h
drivers/net/dpaa/dpaa_rxtx.c
drivers/net/dpaa2/Makefile
drivers/raw/dpaa2_cmdif/Makefile
drivers/raw/dpaa2_qdma/Makefile

index dfc2717..454ac12 100644 (file)
@@ -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 \
index 8fa9b8c..462efd2 100644 (file)
@@ -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>
index bf8c772..6affd2e 100644 (file)
@@ -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/fman/of.c b/drivers/bus/dpaa/base/fman/of.c
deleted file mode 100644 (file)
index 1e97be5..0000000
+++ /dev/null
@@ -1,588 +0,0 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- *
- * Copyright 2010-2016 Freescale Semiconductor Inc.
- * Copyright 2017 NXP
- *
- */
-
-#include <of.h>
-#include <rte_string_fns.h>
-#include <rte_dpaa_logs.h>
-
-static int alive;
-static struct dt_dir root_dir;
-static const char *base_dir;
-static COMPAT_LIST_HEAD(linear);
-
-static int
-of_open_dir(const char *relative_path, struct dirent ***d)
-{
-       int ret;
-       char full_path[PATH_MAX];
-
-       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",
-                            full_path);
-       return ret;
-}
-
-static void
-of_close_dir(struct dirent **d, int num)
-{
-       while (num--)
-               free(d[num]);
-       free(d);
-}
-
-static int
-of_open_file(const char *relative_path)
-{
-       int ret;
-       char full_path[PATH_MAX];
-
-       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",
-                            full_path);
-       return ret;
-}
-
-static void
-process_file(struct dirent *dent, struct dt_dir *parent)
-{
-       int fd;
-       struct dt_file *f = malloc(sizeof(*f));
-
-       if (!f) {
-               DPAA_BUS_LOG(DEBUG, "Unable to allocate memory for file node");
-               return;
-       }
-       f->node.is_file = 1;
-       strlcpy(f->node.node.name, dent->d_name, NAME_MAX);
-       snprintf(f->node.node.full_name, PATH_MAX, "%s/%s",
-                parent->node.node.full_name, dent->d_name);
-       f->parent = parent;
-       fd = of_open_file(f->node.node.full_name);
-       if (fd < 0) {
-               DPAA_BUS_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");
-               free(f);
-               return;
-       }
-       list_add_tail(&f->node.list, &parent->files);
-}
-
-static const struct dt_dir *
-node2dir(const struct device_node *n)
-{
-       struct dt_node *dn = container_of((struct device_node *)n,
-                                         struct dt_node, node);
-       const struct dt_dir *d = container_of(dn, struct dt_dir, node);
-
-       assert(!dn->is_file);
-       return d;
-}
-
-/* process_dir() calls iterate_dir(), but the latter will also call the former
- * when recursing into sub-directories, so a predeclaration is needed.
- */
-static int process_dir(const char *relative_path, struct dt_dir *dt);
-
-static int
-iterate_dir(struct dirent **d, int num, struct dt_dir *dt)
-{
-       int loop;
-       /* Iterate the directory contents */
-       for (loop = 0; loop < num; loop++) {
-               struct dt_dir *subdir;
-               int ret;
-               /* Ignore dot files of all types (especially "..") */
-               if (d[loop]->d_name[0] == '.')
-                       continue;
-               switch (d[loop]->d_type) {
-               case DT_REG:
-                       process_file(d[loop], dt);
-                       break;
-               case DT_DIR:
-                       subdir = malloc(sizeof(*subdir));
-                       if (!subdir) {
-                               perror("malloc");
-                               return -ENOMEM;
-                       }
-                       strlcpy(subdir->node.node.name, d[loop]->d_name,
-                               NAME_MAX);
-                       snprintf(subdir->node.node.full_name, PATH_MAX,
-                                "%s/%s", dt->node.node.full_name,
-                                d[loop]->d_name);
-                       subdir->parent = dt;
-                       ret = process_dir(subdir->node.node.full_name, subdir);
-                       if (ret)
-                               return ret;
-                       list_add_tail(&subdir->node.list, &dt->subdirs);
-                       break;
-               default:
-                       DPAA_BUS_LOG(DEBUG, "Ignoring invalid dt entry %s/%s",
-                                    dt->node.node.full_name, d[loop]->d_name);
-               }
-       }
-       return 0;
-}
-
-static int
-process_dir(const char *relative_path, struct dt_dir *dt)
-{
-       struct dirent **d;
-       int ret, num;
-
-       dt->node.is_file = 0;
-       INIT_LIST_HEAD(&dt->subdirs);
-       INIT_LIST_HEAD(&dt->files);
-       ret = of_open_dir(relative_path, &d);
-       if (ret < 0)
-               return ret;
-       num = ret;
-       ret = iterate_dir(d, num, dt);
-       of_close_dir(d, num);
-       return (ret < 0) ? ret : 0;
-}
-
-static void
-linear_dir(struct dt_dir *d)
-{
-       struct dt_file *f;
-       struct dt_dir *dd;
-
-       d->compatible = NULL;
-       d->status = NULL;
-       d->lphandle = NULL;
-       d->a_cells = NULL;
-       d->s_cells = NULL;
-       d->reg = NULL;
-       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"
-                                            " %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",
-                                            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",
-                                            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",
-                                            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",
-                                            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",
-                                            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",
-                                            d->node.node.full_name);
-                       d->reg = f;
-               }
-       }
-
-       list_for_each_entry(dd, &d->subdirs, node.list) {
-               list_add_tail(&dd->linear, &linear);
-               linear_dir(dd);
-       }
-}
-
-int
-of_init_path(const char *dt_path)
-{
-       int ret;
-
-       base_dir = dt_path;
-
-       /* This needs to be singleton initialization */
-       DPAA_BUS_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';
-       root_dir.node.node.full_name[0] = '\0';
-       INIT_LIST_HEAD(&root_dir.node.list);
-       root_dir.parent = NULL;
-
-       /* Kick things off... */
-       ret = process_dir("", &root_dir);
-       if (ret) {
-               DPAA_BUS_LOG(ERR, "Unable to parse device tree");
-               return ret;
-       }
-
-       /* Now make a flat, linear list of directories */
-       linear_dir(&root_dir);
-       alive = 1;
-       return 0;
-}
-
-static void
-destroy_dir(struct dt_dir *d)
-{
-       struct dt_file *f, *tmpf;
-       struct dt_dir *dd, *tmpd;
-
-       list_for_each_entry_safe(f, tmpf, &d->files, node.list) {
-               list_del(&f->node.list);
-               free(f);
-       }
-       list_for_each_entry_safe(dd, tmpd, &d->subdirs, node.list) {
-               destroy_dir(dd);
-               list_del(&dd->node.list);
-               free(dd);
-       }
-}
-
-void
-of_finish(void)
-{
-       DPAA_BUS_HWWARN(!alive, "Double-finish of device-tree driver!");
-
-       destroy_dir(&root_dir);
-       INIT_LIST_HEAD(&linear);
-       alive = 0;
-}
-
-static const struct dt_dir *
-next_linear(const struct dt_dir *f)
-{
-       if (f->linear.next == &linear)
-               return NULL;
-       return list_entry(f->linear.next, struct dt_dir, linear);
-}
-
-static int
-check_compatible(const struct dt_file *f, const char *compatible)
-{
-       const char *c = (char *)f->buf;
-       unsigned int len, remains = f->len;
-
-       while (remains) {
-               len = strlen(c);
-               if (!strcmp(c, compatible))
-                       return 1;
-
-               if (remains < len + 1)
-                       break;
-
-               c += (len + 1);
-               remains -= (len + 1);
-       }
-       return 0;
-}
-
-const struct device_node *
-of_find_compatible_node(const struct device_node *from,
-                       const char *type __always_unused,
-                       const char *compatible)
-{
-       const struct dt_dir *d;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
-
-       if (list_empty(&linear))
-               return NULL;
-       if (!from)
-               d = list_entry(linear.next, struct dt_dir, linear);
-       else
-               d = node2dir(from);
-       for (d = next_linear(d); d && (!d->compatible ||
-                                      !check_compatible(d->compatible,
-                                      compatible));
-                       d = next_linear(d))
-               ;
-       if (d)
-               return &d->node.node;
-       return NULL;
-}
-
-const void *
-of_get_property(const struct device_node *from, const char *name,
-               size_t *lenp)
-{
-       const struct dt_dir *d;
-       const struct dt_file *f;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
-
-       d = node2dir(from);
-       list_for_each_entry(f, &d->files, node.list)
-               if (!strcmp(f->node.node.name, name)) {
-                       if (lenp)
-                               *lenp = f->len;
-                       return f->buf;
-               }
-       return NULL;
-}
-
-bool
-of_device_is_available(const struct device_node *dev_node)
-{
-       const struct dt_dir *d;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
-       d = node2dir(dev_node);
-       if (!d->status)
-               return true;
-       if (!strcmp((char *)d->status->buf, "okay"))
-               return true;
-       if (!strcmp((char *)d->status->buf, "ok"))
-               return true;
-       return false;
-}
-
-const struct device_node *
-of_find_node_by_phandle(phandle ph)
-{
-       const struct dt_dir *d;
-
-       DPAA_BUS_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))
-                       return &d->node.node;
-       return NULL;
-}
-
-const struct device_node *
-of_get_parent(const struct device_node *dev_node)
-{
-       const struct dt_dir *d;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
-
-       if (!dev_node)
-               return NULL;
-       d = node2dir(dev_node);
-       if (!d->parent)
-               return NULL;
-       return &d->parent->node.node;
-}
-
-const struct device_node *
-of_get_next_child(const struct device_node *dev_node,
-                 const struct device_node *prev)
-{
-       const struct dt_dir *p, *c;
-
-       DPAA_BUS_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");
-               if (c->parent != p)
-                       return NULL;
-               if (c->node.list.next == &p->subdirs)
-                       /* prev was the last child */
-                       return NULL;
-               c = list_entry(c->node.list.next, struct dt_dir, node.list);
-               return &c->node.node;
-       }
-       /* Return first child */
-       if (list_empty(&p->subdirs))
-               return NULL;
-       c = list_entry(p->subdirs.next, struct dt_dir, node.list);
-       return &c->node.node;
-}
-
-uint32_t
-of_n_addr_cells(const struct device_node *dev_node)
-{
-       const struct dt_dir *d;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised");
-       if (!dev_node)
-               return OF_DEFAULT_NA;
-       d = node2dir(dev_node);
-       while ((d = d->parent))
-               if (d->a_cells) {
-                       unsigned char *buf =
-                               (unsigned char *)&d->a_cells->buf[0];
-                       assert(d->a_cells->len == 4);
-                       return ((uint32_t)buf[0] << 24) |
-                               ((uint32_t)buf[1] << 16) |
-                               ((uint32_t)buf[2] << 8) |
-                               (uint32_t)buf[3];
-               }
-       return OF_DEFAULT_NA;
-}
-
-uint32_t
-of_n_size_cells(const struct device_node *dev_node)
-{
-       const struct dt_dir *d;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
-       if (!dev_node)
-               return OF_DEFAULT_NA;
-       d = node2dir(dev_node);
-       while ((d = d->parent))
-               if (d->s_cells) {
-                       unsigned char *buf =
-                               (unsigned char *)&d->s_cells->buf[0];
-                       assert(d->s_cells->len == 4);
-                       return ((uint32_t)buf[0] << 24) |
-                               ((uint32_t)buf[1] << 16) |
-                               ((uint32_t)buf[2] << 8) |
-                               (uint32_t)buf[3];
-               }
-       return OF_DEFAULT_NS;
-}
-
-const uint32_t *
-of_get_address(const struct device_node *dev_node, size_t idx,
-              uint64_t *size, uint32_t *flags __rte_unused)
-{
-       const struct dt_dir *d;
-       const unsigned char *buf;
-       uint32_t na = of_n_addr_cells(dev_node);
-       uint32_t ns = of_n_size_cells(dev_node);
-
-       if (!dev_node)
-               d = &root_dir;
-       else
-               d = node2dir(dev_node);
-       if (!d->reg)
-               return NULL;
-       assert(d->reg->len % ((na + ns) * 4) == 0);
-       assert(d->reg->len / ((na + ns) * 4) > (unsigned int) idx);
-       buf = (const unsigned char *)&d->reg->buf[0];
-       buf += (na + ns) * idx * 4;
-       if (size)
-               for (*size = 0; ns > 0; ns--, na++)
-                       *size = (*size << 32) +
-                               (((uint32_t)buf[4 * na] << 24) |
-                               ((uint32_t)buf[4 * na + 1] << 16) |
-                               ((uint32_t)buf[4 * na + 2] << 8) |
-                               (uint32_t)buf[4 * na + 3]);
-       return (const uint32_t *)buf;
-}
-
-uint64_t
-of_translate_address(const struct device_node *dev_node,
-                    const uint32_t *addr)
-{
-       uint64_t phys_addr, tmp_addr;
-       const struct device_node *parent;
-       const uint32_t *ranges;
-       size_t rlen;
-       uint32_t na, pna;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
-       assert(dev_node != NULL);
-
-       na = of_n_addr_cells(dev_node);
-       phys_addr = of_read_number(addr, na);
-
-       dev_node = of_get_parent(dev_node);
-       if (!dev_node)
-               return 0;
-       else if (node2dir(dev_node) == &root_dir)
-               return phys_addr;
-
-       do {
-               pna = of_n_addr_cells(dev_node);
-               parent = of_get_parent(dev_node);
-               if (!parent)
-                       return 0;
-
-               ranges = of_get_property(dev_node, "ranges", &rlen);
-               /* "ranges" property is missing. Translation breaks */
-               if (!ranges)
-                       return 0;
-               /* "ranges" property is empty. Do 1:1 translation */
-               else if (rlen == 0)
-                       continue;
-               else
-                       tmp_addr = of_read_number(ranges + na, pna);
-
-               na = pna;
-               dev_node = parent;
-               phys_addr += tmp_addr;
-       } while (node2dir(parent) != &root_dir);
-
-       return phys_addr;
-}
-
-bool
-of_device_is_compatible(const struct device_node *dev_node,
-                       const char *compatible)
-{
-       const struct dt_dir *d;
-
-       DPAA_BUS_HWWARN(!alive, "Device-tree driver not initialised!");
-       if (!dev_node)
-               d = &root_dir;
-       else
-               d = node2dir(dev_node);
-       if (d->compatible && check_compatible(d->compatible, compatible))
-               return true;
-       return false;
-}
-
-static const void *of_get_mac_addr(const struct device_node *np,
-               const char *name)
-{
-       return of_get_property(np, name, NULL);
-}
-
-/**
- * Search the device tree for the best MAC address to use.  'mac-address' is
- * checked first, because that is supposed to contain to "most recent" MAC
- * address. If that isn't set, then 'local-mac-address' is checked next,
- * because that is the default address.  If that isn't set, then the obsolete
- * 'address' is checked, just in case we're using an old device tree.
- *
- * Note that the 'address' property is supposed to contain a virtual address of
- * the register set, but some DTS files have redefined that property to be the
- * MAC address.
- *
- * All-zero MAC addresses are rejected, because those could be properties that
- * exist in the device tree, but were not set by U-Boot.  For example, the
- * DTS could define 'mac-address' and 'local-mac-address', with zero MAC
- * addresses.  Some older U-Boots only initialized 'local-mac-address'.  In
- * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
- * but is all zeros.
- */
-const void *of_get_mac_address(const struct device_node *np)
-{
-       const void *addr;
-
-       addr = of_get_mac_addr(np, "mac-address");
-       if (addr)
-               return addr;
-
-       addr = of_get_mac_addr(np, "local-mac-address");
-       if (addr)
-               return addr;
-
-       return of_get_mac_addr(np, "address");
-}
index 034991b..9377738 100644 (file)
@@ -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
index 770e43f..b53eb9e 100644 (file)
@@ -11,6 +11,8 @@
 #include <rte_eventdev.h>
 #include <rte_byteorder.h>
 
+#include <dpaa_bits.h>
+
 /* Compilation constants */
 #define DQRR_MAXFILL   15
 #define EQCR_ITHRESH   4       /* if EQCR congests, interrupt threshold */
index 1d8a294..d028ef3 100644 (file)
@@ -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
deleted file mode 100644 (file)
index 277ce63..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- *
- * Copyright 2011 Freescale Semiconductor, Inc.
- * All rights reserved.
- * Copyright 2019 NXP
- *
- */
-
-#ifndef __COMPAT_H
-#define __COMPAT_H
-
-#include <sched.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <stdint.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <pthread.h>
-#include <linux/types.h>
-#include <stdbool.h>
-#include <ctype.h>
-#include <malloc.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <limits.h>
-#include <assert.h>
-#include <dirent.h>
-#include <inttypes.h>
-#include <error.h>
-#include <rte_byteorder.h>
-#include <rte_atomic.h>
-#include <rte_spinlock.h>
-#include <rte_common.h>
-#include <rte_debug.h>
-#include <rte_cycles.h>
-#include <rte_malloc.h>
-
-/* The following definitions are primarily to allow the single-source driver
- * interfaces to be included by arbitrary program code. Ie. for interfaces that
- * are also available in kernel-space, these definitions provide compatibility
- * with certain attributes and types used in those interfaces.
- */
-
-/* Required compiler attributes */
-#ifndef __maybe_unused
-#define __maybe_unused __rte_unused
-#endif
-#ifndef __always_unused
-#define __always_unused        __rte_unused
-#endif
-#ifndef __packed
-#define __packed       __rte_packed
-#endif
-#ifndef noinline
-#define noinline       __attribute__((noinline))
-#endif
-#define L1_CACHE_BYTES 64
-#define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES)))
-#define __stringify_1(x) #x
-#define __stringify(x) __stringify_1(x)
-
-#ifdef ARRAY_SIZE
-#undef ARRAY_SIZE
-#endif
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-
-/* Debugging */
-#define prflush(fmt, args...) \
-       do { \
-               printf(fmt, ##args); \
-               fflush(stdout); \
-       } while (0)
-#ifndef pr_crit
-#define pr_crit(fmt, args...)   prflush("CRIT:" fmt, ##args)
-#endif
-#ifndef pr_err
-#define pr_err(fmt, args...)    prflush("ERR:" fmt, ##args)
-#endif
-#ifndef pr_warn
-#define pr_warn(fmt, args...)   prflush("WARN:" fmt, ##args)
-#endif
-#ifndef pr_info
-#define pr_info(fmt, args...)   prflush(fmt, ##args)
-#endif
-#ifndef pr_debug
-#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
-#define pr_debug(fmt, args...) printf(fmt, ##args)
-#else
-#define pr_debug(fmt, args...) {}
-#endif
-#endif
-
-#define DPAA_BUG_ON(x) RTE_ASSERT(x)
-
-/* Required types */
-typedef uint8_t                u8;
-typedef uint16_t       u16;
-typedef uint32_t       u32;
-typedef uint64_t       u64;
-typedef uint64_t       dma_addr_t;
-typedef cpu_set_t      cpumask_t;
-typedef uint32_t       phandle;
-typedef uint32_t       gfp_t;
-typedef uint32_t       irqreturn_t;
-
-#define ETHER_ADDR_LEN 6
-
-#define IRQ_HANDLED    0
-#define request_irq    qbman_request_irq
-#define free_irq       qbman_free_irq
-
-#define __iomem
-#define GFP_KERNEL     0
-#define __raw_readb(p) (*(const volatile unsigned char *)(p))
-#define __raw_readl(p) (*(const volatile unsigned int *)(p))
-#define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); }
-
-/* to be used as an upper-limit only */
-#define NR_CPUS                        64
-
-/* Waitqueue stuff */
-typedef struct { }             wait_queue_head_t;
-#define DECLARE_WAIT_QUEUE_HEAD(x) int dummy_##x __always_unused
-#define wake_up(x)             do { } while (0)
-
-/* I/O operations */
-static inline u32 in_be32(volatile void *__p)
-{
-       volatile u32 *p = __p;
-       return rte_be_to_cpu_32(*p);
-}
-
-static inline void out_be32(volatile void *__p, u32 val)
-{
-       volatile u32 *p = __p;
-       *p = rte_cpu_to_be_32(val);
-}
-
-#define hwsync() rte_rmb()
-#define lwsync() rte_wmb()
-
-#define dcbt_ro(p) __builtin_prefetch(p, 0)
-#define dcbt_rw(p) __builtin_prefetch(p, 1)
-
-#if defined(RTE_ARCH_ARM64)
-#define dcbz(p) { asm volatile("dc zva, %0" : : "r" (p) : "memory"); }
-#define dcbz_64(p) dcbz(p)
-#define dcbf(p) { asm volatile("dc cvac, %0" : : "r"(p) : "memory"); }
-#define dcbf_64(p) dcbf(p)
-#define dccivac(p) { asm volatile("dc civac, %0" : : "r"(p) : "memory"); }
-
-#define dcbit_ro(p) \
-       do { \
-               dccivac(p);                                             \
-               asm volatile("prfm pldl1keep, [%0, #64]" : : "r" (p));  \
-       } while (0)
-
-#elif defined(RTE_ARCH_ARM)
-#define dcbz(p) memset((p), 0, 32)
-#define dcbz_64(p) memset((p), 0, 64)
-#define dcbf(p)        RTE_SET_USED(p)
-#define dcbf_64(p) dcbf(p)
-#define dccivac(p)     RTE_SET_USED(p)
-#define dcbit_ro(p)    RTE_SET_USED(p)
-
-#else
-#define dcbz(p)        RTE_SET_USED(p)
-#define dcbz_64(p) dcbz(p)
-#define dcbf(p)        RTE_SET_USED(p)
-#define dcbf_64(p) dcbf(p)
-#define dccivac(p)     RTE_SET_USED(p)
-#define dcbit_ro(p)    RTE_SET_USED(p)
-#endif
-
-#define barrier() { asm volatile ("" : : : "memory"); }
-#define cpu_relax barrier
-
-#if defined(RTE_ARCH_ARM64)
-static inline uint64_t mfatb(void)
-{
-       uint64_t ret, ret_new, timeout = 200;
-
-       asm volatile ("mrs %0, cntvct_el0" : "=r" (ret));
-       asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new));
-       while (ret != ret_new && timeout--) {
-               ret = ret_new;
-               asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new));
-       }
-       DPAA_BUG_ON(!timeout && (ret != ret_new));
-       return ret * 64;
-}
-#else
-
-#define mfatb rte_rdtsc
-
-#endif
-
-/* Spin for a few cycles without bothering the bus */
-static inline void cpu_spin(int cycles)
-{
-       uint64_t now = mfatb();
-
-       while (mfatb() < (now + cycles))
-               ;
-}
-
-/* Qman/Bman API inlines and macros; */
-#ifdef lower_32_bits
-#undef lower_32_bits
-#endif
-#define lower_32_bits(x) ((u32)(x))
-
-#ifdef upper_32_bits
-#undef upper_32_bits
-#endif
-#define upper_32_bits(x) ((u32)(((x) >> 16) >> 16))
-
-/*
- * Swap bytes of a 48-bit value.
- */
-static inline uint64_t
-__bswap_48(uint64_t x)
-{
-       return  ((x & 0x0000000000ffULL) << 40) |
-               ((x & 0x00000000ff00ULL) << 24) |
-               ((x & 0x000000ff0000ULL) <<  8) |
-               ((x & 0x0000ff000000ULL) >>  8) |
-               ((x & 0x00ff00000000ULL) >> 24) |
-               ((x & 0xff0000000000ULL) >> 40);
-}
-
-/*
- * Swap bytes of a 40-bit value.
- */
-static inline uint64_t
-__bswap_40(uint64_t x)
-{
-       return  ((x & 0x00000000ffULL) << 32) |
-               ((x & 0x000000ff00ULL) << 16) |
-               ((x & 0x0000ff0000ULL)) |
-               ((x & 0x00ff000000ULL) >> 16) |
-               ((x & 0xff00000000ULL) >> 32);
-}
-
-/*
- * Swap bytes of a 24-bit value.
- */
-static inline uint32_t
-__bswap_24(uint32_t x)
-{
-       return  ((x & 0x0000ffULL) << 16) |
-               ((x & 0x00ff00ULL)) |
-               ((x & 0xff0000ULL) >> 16);
-}
-
-#define be64_to_cpu(x) rte_be_to_cpu_64(x)
-#define be32_to_cpu(x) rte_be_to_cpu_32(x)
-#define be16_to_cpu(x) rte_be_to_cpu_16(x)
-
-#define cpu_to_be64(x) rte_cpu_to_be_64(x)
-#if !defined(cpu_to_be32)
-#define cpu_to_be32(x) rte_cpu_to_be_32(x)
-#endif
-#define cpu_to_be16(x) rte_cpu_to_be_16(x)
-
-#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
-
-#define cpu_to_be48(x) __bswap_48(x)
-#define be48_to_cpu(x) __bswap_48(x)
-
-#define cpu_to_be40(x) __bswap_40(x)
-#define be40_to_cpu(x) __bswap_40(x)
-
-#define cpu_to_be24(x) __bswap_24(x)
-#define be24_to_cpu(x) __bswap_24(x)
-
-#else /* RTE_BIG_ENDIAN */
-
-#define cpu_to_be48(x) (x)
-#define be48_to_cpu(x) (x)
-
-#define cpu_to_be40(x) (x)
-#define be40_to_cpu(x) (x)
-
-#define cpu_to_be24(x) (x)
-#define be24_to_cpu(x) (x)
-
-#endif /* RTE_BIG_ENDIAN */
-
-/* When copying aligned words or shorts, try to avoid memcpy() */
-/* memcpy() stuff - when you know alignments in advance */
-#define CONFIG_TRY_BETTER_MEMCPY
-
-#ifdef CONFIG_TRY_BETTER_MEMCPY
-static inline void copy_words(void *dest, const void *src, size_t sz)
-{
-       u32 *__dest = dest;
-       const u32 *__src = src;
-       size_t __sz = sz >> 2;
-
-       DPAA_BUG_ON((unsigned long)dest & 0x3);
-       DPAA_BUG_ON((unsigned long)src & 0x3);
-       DPAA_BUG_ON(sz & 0x3);
-       while (__sz--)
-               *(__dest++) = *(__src++);
-}
-
-static inline void copy_shorts(void *dest, const void *src, size_t sz)
-{
-       u16 *__dest = dest;
-       const u16 *__src = src;
-       size_t __sz = sz >> 1;
-
-       DPAA_BUG_ON((unsigned long)dest & 0x1);
-       DPAA_BUG_ON((unsigned long)src & 0x1);
-       DPAA_BUG_ON(sz & 0x1);
-       while (__sz--)
-               *(__dest++) = *(__src++);
-}
-
-static inline void copy_bytes(void *dest, const void *src, size_t sz)
-{
-       u8 *__dest = dest;
-       const u8 *__src = src;
-
-       while (sz--)
-               *(__dest++) = *(__src++);
-}
-#else
-#define copy_words memcpy
-#define copy_shorts memcpy
-#define copy_bytes memcpy
-#endif
-
-/* Allocator stuff */
-#define kmalloc(sz, t) rte_malloc(NULL, sz, 0)
-#define vmalloc(sz)    rte_malloc(NULL, sz, 0)
-#define kfree(p)       { if (p) rte_free(p); }
-static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused)
-{
-       void *ptr = rte_malloc(NULL, sz, 0);
-
-       if (ptr)
-               memset(ptr, 0, sz);
-       return ptr;
-}
-
-static inline unsigned long get_zeroed_page(gfp_t __foo __rte_unused)
-{
-       void *p;
-
-       if (posix_memalign(&p, 4096, 4096))
-               return 0;
-       memset(p, 0, 4096);
-       return (unsigned long)p;
-}
-
-/* Spinlock stuff */
-#define spinlock_t             rte_spinlock_t
-#define __SPIN_LOCK_UNLOCKED(x)        RTE_SPINLOCK_INITIALIZER
-#define DEFINE_SPINLOCK(x)     spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
-#define spin_lock_init(x)      rte_spinlock_init(x)
-#define spin_lock_destroy(x)
-#define spin_lock(x)           rte_spinlock_lock(x)
-#define spin_unlock(x)         rte_spinlock_unlock(x)
-#define spin_lock_irq(x)       spin_lock(x)
-#define spin_unlock_irq(x)     spin_unlock(x)
-#define spin_lock_irqsave(x, f) spin_lock_irq(x)
-#define spin_unlock_irqrestore(x, f) spin_unlock_irq(x)
-
-#define atomic_t                rte_atomic32_t
-#define atomic_read(v)          rte_atomic32_read(v)
-#define atomic_set(v, i)        rte_atomic32_set(v, i)
-
-#define atomic_inc(v)           rte_atomic32_add(v, 1)
-#define atomic_dec(v)           rte_atomic32_sub(v, 1)
-
-#define atomic_inc_and_test(v)  rte_atomic32_inc_and_test(v)
-#define atomic_dec_and_test(v)  rte_atomic32_dec_and_test(v)
-
-#define atomic_inc_return(v)    rte_atomic32_add_return(v, 1)
-#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/dpaa_list.h b/drivers/bus/dpaa/include/dpaa_list.h
deleted file mode 100644 (file)
index e945759..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- *
- *   Copyright 2017 NXP
- *
- */
-
-#ifndef __DPAA_LIST_H
-#define __DPAA_LIST_H
-
-/****************/
-/* Linked-lists */
-/****************/
-
-struct list_head {
-       struct list_head *prev;
-       struct list_head *next;
-};
-
-#define COMPAT_LIST_HEAD(n) \
-struct list_head n = { \
-       .prev = &n, \
-       .next = &n \
-}
-
-#define INIT_LIST_HEAD(p) \
-do { \
-       struct list_head *__p298 = (p); \
-       __p298->next = __p298; \
-       __p298->prev = __p298->next; \
-} while (0)
-#define list_entry(node, type, member) \
-       (type *)((void *)node - offsetof(type, member))
-#define list_empty(p) \
-({ \
-       const struct list_head *__p298 = (p); \
-       ((__p298->next == __p298) && (__p298->prev == __p298)); \
-})
-#define list_add(p, l) \
-do { \
-       struct list_head *__p298 = (p); \
-       struct list_head *__l298 = (l); \
-       __p298->next = __l298->next; \
-       __p298->prev = __l298; \
-       __l298->next->prev = __p298; \
-       __l298->next = __p298; \
-} while (0)
-#define list_add_tail(p, l) \
-do { \
-       struct list_head *__p298 = (p); \
-       struct list_head *__l298 = (l); \
-       __p298->prev = __l298->prev; \
-       __p298->next = __l298; \
-       __l298->prev->next = __p298; \
-       __l298->prev = __p298; \
-} while (0)
-#define list_for_each(i, l)                            \
-       for (i = (l)->next; i != (l); i = i->next)
-#define list_for_each_safe(i, j, l)                    \
-       for (i = (l)->next, j = i->next; i != (l);      \
-            i = j, j = i->next)
-#define list_for_each_entry(i, l, name) \
-       for (i = list_entry((l)->next, typeof(*i), name); &i->name != (l); \
-               i = list_entry(i->name.next, typeof(*i), name))
-#define list_for_each_entry_safe(i, j, l, name) \
-       for (i = list_entry((l)->next, typeof(*i), name), \
-               j = list_entry(i->name.next, typeof(*j), name); \
-               &i->name != (l); \
-               i = j, j = list_entry(j->name.next, typeof(*j), name))
-#define list_del(i) \
-do { \
-       (i)->next->prev = (i)->prev; \
-       (i)->prev->next = (i)->next; \
-} while (0)
-
-#endif /* __DPAA_LIST_H */
index d6eebc8..c02d32d 100644 (file)
@@ -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"
index 3c26d6c..263d9bb 100644 (file)
@@ -10,6 +10,7 @@
 #define __FSL_USD_H
 
 #include <compat.h>
+#include <dpaa_list.h>
 #include <fsl_qman.h>
 
 #ifdef __cplusplus
diff --git a/drivers/bus/dpaa/include/of.h b/drivers/bus/dpaa/include/of.h
deleted file mode 100644 (file)
index 7ea7608..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
- *
- * Copyright 2010-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
- *
- */
-
-#ifndef __OF_H
-#define        __OF_H
-
-#include <compat.h>
-
-#ifndef OF_INIT_DEFAULT_PATH
-#define OF_INIT_DEFAULT_PATH "/proc/device-tree"
-#endif
-
-#define OF_DEFAULT_NA 1
-#define OF_DEFAULT_NS 1
-
-#define OF_FILE_BUF_MAX 256
-
-/**
- * Layout of Device Tree:
- * dt_dir
- *  |- dt_dir
- *  |   |- dt_dir
- *  |   |  |- dt_dir
- *  |   |  |  |- dt_file
- *  |   |  |  ``- dt_file
- *  |   |  ``- dt_file
- *  |   `-dt_file`
- *  ``- dt_file
- *
- *  +------------------+
- *  |dt_dir            |
- *  |+----------------+|
- *  ||dt_node         ||
- *  ||+--------------+||
- *  |||device_node   |||
- *  ||+--------------+||
- *  || list_dt_nodes  ||
- *  |+----------------+|
- *  | list of subdir   |
- *  | list of files    |
- *  +------------------+
- */
-
-/**
- * Device description on of a device node in device tree.
- */
-struct device_node {
-       char name[NAME_MAX];
-       char full_name[PATH_MAX];
-};
-
-/**
- * List of device nodes available in a device tree layout
- */
-struct dt_node {
-       struct device_node node; /**< Property of node */
-       int is_file; /**< FALSE==dir, TRUE==file */
-       struct list_head list; /**< Nodes within a parent subdir */
-};
-
-/**
- * Types we use to represent directories and files
- */
-struct dt_file;
-struct dt_dir {
-       struct dt_node node;
-       struct list_head subdirs;
-       struct list_head files;
-       struct list_head linear;
-       struct dt_dir *parent;
-       struct dt_file *compatible;
-       struct dt_file *status;
-       struct dt_file *lphandle;
-       struct dt_file *a_cells;
-       struct dt_file *s_cells;
-       struct dt_file *reg;
-};
-
-struct dt_file {
-       struct dt_node node;
-       struct dt_dir *parent;
-       ssize_t len;
-       uint64_t buf[OF_FILE_BUF_MAX >> 3];
-};
-
-const struct device_node *of_find_compatible_node(
-                                       const struct device_node *from,
-                                       const char *type __always_unused,
-                                       const char *compatible)
-       __attribute__((nonnull(3)));
-
-#define for_each_compatible_node(dev_node, type, compatible) \
-       for (dev_node = of_find_compatible_node(NULL, type, compatible); \
-               dev_node != NULL; \
-               dev_node = of_find_compatible_node(dev_node, type, compatible))
-
-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_get_parent(const struct device_node *dev_node);
-
-const struct device_node *of_get_next_child(const struct device_node *dev_node,
-                                           const struct device_node *prev);
-
-const void *of_get_mac_address(const struct device_node *np);
-
-#define for_each_child_node(parent, child) \
-       for (child = of_get_next_child(parent, NULL); child != NULL; \
-                       child = of_get_next_child(parent, child))
-
-uint32_t of_n_addr_cells(const struct device_node *dev_node);
-uint32_t of_n_size_cells(const struct device_node *dev_node);
-
-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));
-
-bool of_device_is_compatible(const struct device_node *dev_node,
-                            const char *compatible);
-
-/* of_init() must be called prior to initialisation or use of any driver
- * subsystem that is device-tree-dependent. Eg. Qman/Bman, config layers, etc.
- * The path should usually be "/proc/device-tree".
- */
-int of_init_path(const char *dt_path);
-
-/* of_finish() allows a controlled tear-down of the device-tree layer, eg. if a
- * full reload is desired without a process exit.
- */
-void of_finish(void);
-
-/* Use of this wrapper is recommended. */
-static inline int of_init(void)
-{
-       return of_init_path(OF_INIT_DEFAULT_PATH);
-}
-
-/* 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)
-{
-       uint64_t r = 0;
-
-       while (size--)
-               r = (r << 32) | be32toh(*(cell++));
-       return r;
-}
-
-#endif /*  __OF_H */
index c9c3b24..0e561c2 100644 (file)
@@ -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',
index a221522..97f4f62 100644 (file)
@@ -40,8 +40,6 @@ DPDK_17.11 {
        fman_ip_rev;
        netcfg_acquire;
        netcfg_release;
-       of_find_compatible_node;
-       of_get_property;
        qm_channel_caam;
        qman_create_fq;
        qman_dequeue;
@@ -97,7 +95,6 @@ DPDK_18.08 {
 
        fman_if_get_sg_enable;
        fman_if_set_sg;
-       of_get_mac_address;
 
 } DPDK_18.02;
 
index 9601aeb..c2b2375 100644 (file)
 #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"
index 218d9bd..16f0a2c 100644 (file)
@@ -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
index 94d2cf0..a0a1de0 100644 (file)
@@ -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/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
new file mode 100644 (file)
index 0000000..12c9d99
--- /dev/null
@@ -0,0 +1,393 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * All rights reserved.
+ * Copyright 2019 NXP
+ *
+ */
+
+#ifndef __COMPAT_H
+#define __COMPAT_H
+
+#include <sched.h>
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <stdint.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <pthread.h>
+#include <linux/types.h>
+#include <stdbool.h>
+#include <ctype.h>
+#include <malloc.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <limits.h>
+#include <assert.h>
+#include <dirent.h>
+#include <inttypes.h>
+#include <error.h>
+#include <rte_byteorder.h>
+#include <rte_atomic.h>
+#include <rte_spinlock.h>
+#include <rte_common.h>
+#include <rte_debug.h>
+#include <rte_cycles.h>
+#include <rte_malloc.h>
+
+/* The following definitions are primarily to allow the single-source driver
+ * interfaces to be included by arbitrary program code. Ie. for interfaces that
+ * are also available in kernel-space, these definitions provide compatibility
+ * with certain attributes and types used in those interfaces.
+ */
+
+/* Required compiler attributes */
+#ifndef __maybe_unused
+#define __maybe_unused __rte_unused
+#endif
+#ifndef __always_unused
+#define __always_unused        __rte_unused
+#endif
+#ifndef __packed
+#define __packed       __rte_packed
+#endif
+#ifndef noinline
+#define noinline       __attribute__((noinline))
+#endif
+#define L1_CACHE_BYTES 64
+#define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES)))
+#define __stringify_1(x) #x
+#define __stringify(x) __stringify_1(x)
+
+#ifdef ARRAY_SIZE
+#undef ARRAY_SIZE
+#endif
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+/* Debugging */
+#define prflush(fmt, args...) \
+       do { \
+               printf(fmt, ##args); \
+               fflush(stdout); \
+       } while (0)
+#ifndef pr_crit
+#define pr_crit(fmt, args...)   prflush("CRIT:" fmt, ##args)
+#endif
+#ifndef pr_err
+#define pr_err(fmt, args...)    prflush("ERR:" fmt, ##args)
+#endif
+#ifndef pr_warn
+#define pr_warn(fmt, args...)   prflush("WARN:" fmt, ##args)
+#endif
+#ifndef pr_info
+#define pr_info(fmt, args...)   prflush(fmt, ##args)
+#endif
+#ifndef pr_debug
+#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
+#define pr_debug(fmt, args...) printf(fmt, ##args)
+#else
+#define pr_debug(fmt, args...) {}
+#endif
+#endif
+
+#define DPAA_BUG_ON(x) RTE_ASSERT(x)
+
+/* Required types */
+typedef uint8_t                u8;
+typedef uint16_t       u16;
+typedef uint32_t       u32;
+typedef uint64_t       u64;
+typedef uint64_t       dma_addr_t;
+typedef cpu_set_t      cpumask_t;
+typedef uint32_t       phandle;
+typedef uint32_t       gfp_t;
+typedef uint32_t       irqreturn_t;
+
+#define ETHER_ADDR_LEN 6
+
+#define IRQ_HANDLED    0
+#define request_irq    qbman_request_irq
+#define free_irq       qbman_free_irq
+
+#define __iomem
+#define GFP_KERNEL     0
+#define __raw_readb(p) (*(const volatile unsigned char *)(p))
+#define __raw_readl(p) (*(const volatile unsigned int *)(p))
+#define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); }
+
+/* to be used as an upper-limit only */
+#define NR_CPUS                        64
+
+/* Waitqueue stuff */
+typedef struct { }             wait_queue_head_t;
+#define DECLARE_WAIT_QUEUE_HEAD(x) int dummy_##x __always_unused
+#define wake_up(x)             do { } while (0)
+
+/* I/O operations */
+static inline u32 in_be32(volatile void *__p)
+{
+       volatile u32 *p = __p;
+       return rte_be_to_cpu_32(*p);
+}
+
+static inline void out_be32(volatile void *__p, u32 val)
+{
+       volatile u32 *p = __p;
+       *p = rte_cpu_to_be_32(val);
+}
+
+#define hwsync() rte_rmb()
+#define lwsync() rte_wmb()
+
+#define dcbt_ro(p) __builtin_prefetch(p, 0)
+#define dcbt_rw(p) __builtin_prefetch(p, 1)
+
+#if defined(RTE_ARCH_ARM64)
+#define dcbz(p) { asm volatile("dc zva, %0" : : "r" (p) : "memory"); }
+#define dcbz_64(p) dcbz(p)
+#define dcbf(p) { asm volatile("dc cvac, %0" : : "r"(p) : "memory"); }
+#define dcbf_64(p) dcbf(p)
+#define dccivac(p) { asm volatile("dc civac, %0" : : "r"(p) : "memory"); }
+
+#define dcbit_ro(p) \
+       do { \
+               dccivac(p);                                             \
+               asm volatile("prfm pldl1keep, [%0, #64]" : : "r" (p));  \
+       } while (0)
+
+#elif defined(RTE_ARCH_ARM)
+#define dcbz(p) memset((p), 0, 32)
+#define dcbz_64(p) memset((p), 0, 64)
+#define dcbf(p)        RTE_SET_USED(p)
+#define dcbf_64(p) dcbf(p)
+#define dccivac(p)     RTE_SET_USED(p)
+#define dcbit_ro(p)    RTE_SET_USED(p)
+
+#else
+#define dcbz(p)        RTE_SET_USED(p)
+#define dcbz_64(p) dcbz(p)
+#define dcbf(p)        RTE_SET_USED(p)
+#define dcbf_64(p) dcbf(p)
+#define dccivac(p)     RTE_SET_USED(p)
+#define dcbit_ro(p)    RTE_SET_USED(p)
+#endif
+
+#define barrier() { asm volatile ("" : : : "memory"); }
+#define cpu_relax barrier
+
+#if defined(RTE_ARCH_ARM64)
+static inline uint64_t mfatb(void)
+{
+       uint64_t ret, ret_new, timeout = 200;
+
+       asm volatile ("mrs %0, cntvct_el0" : "=r" (ret));
+       asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new));
+       while (ret != ret_new && timeout--) {
+               ret = ret_new;
+               asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new));
+       }
+       DPAA_BUG_ON(!timeout && (ret != ret_new));
+       return ret * 64;
+}
+#else
+
+#define mfatb rte_rdtsc
+
+#endif
+
+/* Spin for a few cycles without bothering the bus */
+static inline void cpu_spin(int cycles)
+{
+       uint64_t now = mfatb();
+
+       while (mfatb() < (now + cycles))
+               ;
+}
+
+/* Qman/Bman API inlines and macros; */
+#ifdef lower_32_bits
+#undef lower_32_bits
+#endif
+#define lower_32_bits(x) ((u32)(x))
+
+#ifdef upper_32_bits
+#undef upper_32_bits
+#endif
+#define upper_32_bits(x) ((u32)(((x) >> 16) >> 16))
+
+/*
+ * Swap bytes of a 48-bit value.
+ */
+static inline uint64_t
+__bswap_48(uint64_t x)
+{
+       return  ((x & 0x0000000000ffULL) << 40) |
+               ((x & 0x00000000ff00ULL) << 24) |
+               ((x & 0x000000ff0000ULL) <<  8) |
+               ((x & 0x0000ff000000ULL) >>  8) |
+               ((x & 0x00ff00000000ULL) >> 24) |
+               ((x & 0xff0000000000ULL) >> 40);
+}
+
+/*
+ * Swap bytes of a 40-bit value.
+ */
+static inline uint64_t
+__bswap_40(uint64_t x)
+{
+       return  ((x & 0x00000000ffULL) << 32) |
+               ((x & 0x000000ff00ULL) << 16) |
+               ((x & 0x0000ff0000ULL)) |
+               ((x & 0x00ff000000ULL) >> 16) |
+               ((x & 0xff00000000ULL) >> 32);
+}
+
+/*
+ * Swap bytes of a 24-bit value.
+ */
+static inline uint32_t
+__bswap_24(uint32_t x)
+{
+       return  ((x & 0x0000ffULL) << 16) |
+               ((x & 0x00ff00ULL)) |
+               ((x & 0xff0000ULL) >> 16);
+}
+
+#define be64_to_cpu(x) rte_be_to_cpu_64(x)
+#define be32_to_cpu(x) rte_be_to_cpu_32(x)
+#define be16_to_cpu(x) rte_be_to_cpu_16(x)
+
+#define cpu_to_be64(x) rte_cpu_to_be_64(x)
+#if !defined(cpu_to_be32)
+#define cpu_to_be32(x) rte_cpu_to_be_32(x)
+#endif
+#define cpu_to_be16(x) rte_cpu_to_be_16(x)
+
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+
+#define cpu_to_be48(x) __bswap_48(x)
+#define be48_to_cpu(x) __bswap_48(x)
+
+#define cpu_to_be40(x) __bswap_40(x)
+#define be40_to_cpu(x) __bswap_40(x)
+
+#define cpu_to_be24(x) __bswap_24(x)
+#define be24_to_cpu(x) __bswap_24(x)
+
+#else /* RTE_BIG_ENDIAN */
+
+#define cpu_to_be48(x) (x)
+#define be48_to_cpu(x) (x)
+
+#define cpu_to_be40(x) (x)
+#define be40_to_cpu(x) (x)
+
+#define cpu_to_be24(x) (x)
+#define be24_to_cpu(x) (x)
+
+#endif /* RTE_BIG_ENDIAN */
+
+/* When copying aligned words or shorts, try to avoid memcpy() */
+/* memcpy() stuff - when you know alignments in advance */
+#define CONFIG_TRY_BETTER_MEMCPY
+
+#ifdef CONFIG_TRY_BETTER_MEMCPY
+static inline void copy_words(void *dest, const void *src, size_t sz)
+{
+       u32 *__dest = dest;
+       const u32 *__src = src;
+       size_t __sz = sz >> 2;
+
+       DPAA_BUG_ON((unsigned long)dest & 0x3);
+       DPAA_BUG_ON((unsigned long)src & 0x3);
+       DPAA_BUG_ON(sz & 0x3);
+       while (__sz--)
+               *(__dest++) = *(__src++);
+}
+
+static inline void copy_shorts(void *dest, const void *src, size_t sz)
+{
+       u16 *__dest = dest;
+       const u16 *__src = src;
+       size_t __sz = sz >> 1;
+
+       DPAA_BUG_ON((unsigned long)dest & 0x1);
+       DPAA_BUG_ON((unsigned long)src & 0x1);
+       DPAA_BUG_ON(sz & 0x1);
+       while (__sz--)
+               *(__dest++) = *(__src++);
+}
+
+static inline void copy_bytes(void *dest, const void *src, size_t sz)
+{
+       u8 *__dest = dest;
+       const u8 *__src = src;
+
+       while (sz--)
+               *(__dest++) = *(__src++);
+}
+#else
+#define copy_words memcpy
+#define copy_shorts memcpy
+#define copy_bytes memcpy
+#endif
+
+/* Allocator stuff */
+#define kmalloc(sz, t) rte_malloc(NULL, sz, 0)
+#define vmalloc(sz)    rte_malloc(NULL, sz, 0)
+#define kfree(p)       { if (p) rte_free(p); }
+static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused)
+{
+       void *ptr = rte_malloc(NULL, sz, 0);
+
+       if (ptr)
+               memset(ptr, 0, sz);
+       return ptr;
+}
+
+static inline unsigned long get_zeroed_page(gfp_t __foo __rte_unused)
+{
+       void *p;
+
+       if (posix_memalign(&p, 4096, 4096))
+               return 0;
+       memset(p, 0, 4096);
+       return (unsigned long)p;
+}
+
+/* Spinlock stuff */
+#define spinlock_t             rte_spinlock_t
+#define __SPIN_LOCK_UNLOCKED(x)        RTE_SPINLOCK_INITIALIZER
+#define DEFINE_SPINLOCK(x)     spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
+#define spin_lock_init(x)      rte_spinlock_init(x)
+#define spin_lock_destroy(x)
+#define spin_lock(x)           rte_spinlock_lock(x)
+#define spin_unlock(x)         rte_spinlock_unlock(x)
+#define spin_lock_irq(x)       spin_lock(x)
+#define spin_unlock_irq(x)     spin_unlock(x)
+#define spin_lock_irqsave(x, f) spin_lock_irq(x)
+#define spin_unlock_irqrestore(x, f) spin_unlock_irq(x)
+
+#define atomic_t                rte_atomic32_t
+#define atomic_read(v)          rte_atomic32_read(v)
+#define atomic_set(v, i)        rte_atomic32_set(v, i)
+
+#define atomic_inc(v)           rte_atomic32_add(v, 1)
+#define atomic_dec(v)           rte_atomic32_sub(v, 1)
+
+#define atomic_inc_and_test(v)  rte_atomic32_inc_and_test(v)
+#define atomic_dec_and_test(v)  rte_atomic32_dec_and_test(v)
+
+#define atomic_inc_return(v)    rte_atomic32_add_return(v, 1)
+#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)
+
+#endif /* __COMPAT_H */
diff --git a/drivers/common/dpaax/dpaa_list.h b/drivers/common/dpaax/dpaa_list.h
new file mode 100644 (file)
index 0000000..e945759
--- /dev/null
@@ -0,0 +1,75 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ *
+ *   Copyright 2017 NXP
+ *
+ */
+
+#ifndef __DPAA_LIST_H
+#define __DPAA_LIST_H
+
+/****************/
+/* Linked-lists */
+/****************/
+
+struct list_head {
+       struct list_head *prev;
+       struct list_head *next;
+};
+
+#define COMPAT_LIST_HEAD(n) \
+struct list_head n = { \
+       .prev = &n, \
+       .next = &n \
+}
+
+#define INIT_LIST_HEAD(p) \
+do { \
+       struct list_head *__p298 = (p); \
+       __p298->next = __p298; \
+       __p298->prev = __p298->next; \
+} while (0)
+#define list_entry(node, type, member) \
+       (type *)((void *)node - offsetof(type, member))
+#define list_empty(p) \
+({ \
+       const struct list_head *__p298 = (p); \
+       ((__p298->next == __p298) && (__p298->prev == __p298)); \
+})
+#define list_add(p, l) \
+do { \
+       struct list_head *__p298 = (p); \
+       struct list_head *__l298 = (l); \
+       __p298->next = __l298->next; \
+       __p298->prev = __l298; \
+       __l298->next->prev = __p298; \
+       __l298->next = __p298; \
+} while (0)
+#define list_add_tail(p, l) \
+do { \
+       struct list_head *__p298 = (p); \
+       struct list_head *__l298 = (l); \
+       __p298->prev = __l298->prev; \
+       __p298->next = __l298; \
+       __l298->prev->next = __p298; \
+       __l298->prev = __p298; \
+} while (0)
+#define list_for_each(i, l)                            \
+       for (i = (l)->next; i != (l); i = i->next)
+#define list_for_each_safe(i, j, l)                    \
+       for (i = (l)->next, j = i->next; i != (l);      \
+            i = j, j = i->next)
+#define list_for_each_entry(i, l, name) \
+       for (i = list_entry((l)->next, typeof(*i), name); &i->name != (l); \
+               i = list_entry(i->name.next, typeof(*i), name))
+#define list_for_each_entry_safe(i, j, l, name) \
+       for (i = list_entry((l)->next, typeof(*i), name), \
+               j = list_entry(i->name.next, typeof(*j), name); \
+               &i->name != (l); \
+               i = j, j = list_entry(j->name.next, typeof(*j), name))
+#define list_del(i) \
+do { \
+       (i)->next->prev = (i)->prev; \
+       (i)->prev->next = (i)->next; \
+} while (0)
+
+#endif /* __DPAA_LIST_H */
diff --git a/drivers/common/dpaax/dpaa_of.c b/drivers/common/dpaax/dpaa_of.c
new file mode 100644 (file)
index 0000000..bb2c8fc
--- /dev/null
@@ -0,0 +1,589 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2010-2016 Freescale Semiconductor Inc.
+ * Copyright 2017 NXP
+ *
+ */
+
+#include <dpaa_of.h>
+#include <assert.h>
+#include <rte_string_fns.h>
+#include <dpaax_logs.h>
+
+static int alive;
+static struct dt_dir root_dir;
+static const char *base_dir;
+static COMPAT_LIST_HEAD(linear);
+
+static int
+of_open_dir(const char *relative_path, struct dirent ***d)
+{
+       int ret;
+       char full_path[PATH_MAX];
+
+       snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path);
+       ret = scandir(full_path, d, 0, versionsort);
+       if (ret < 0)
+               DPAAX_LOG(ERR, "Failed to open directory %s",
+                            full_path);
+       return ret;
+}
+
+static void
+of_close_dir(struct dirent **d, int num)
+{
+       while (num--)
+               free(d[num]);
+       free(d);
+}
+
+static int
+of_open_file(const char *relative_path)
+{
+       int ret;
+       char full_path[PATH_MAX];
+
+       snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path);
+       ret = open(full_path, O_RDONLY);
+       if (ret < 0)
+               DPAAX_LOG(ERR, "Failed to open directory %s",
+                            full_path);
+       return ret;
+}
+
+static void
+process_file(struct dirent *dent, struct dt_dir *parent)
+{
+       int fd;
+       struct dt_file *f = malloc(sizeof(*f));
+
+       if (!f) {
+               DPAAX_LOG(DEBUG, "Unable to allocate memory for file node");
+               return;
+       }
+       f->node.is_file = 1;
+       strlcpy(f->node.node.name, dent->d_name, NAME_MAX);
+       snprintf(f->node.node.full_name, PATH_MAX, "%s/%s",
+                parent->node.node.full_name, dent->d_name);
+       f->parent = parent;
+       fd = of_open_file(f->node.node.full_name);
+       if (fd < 0) {
+               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) {
+               DPAAX_LOG(DEBUG, "Unable to read file node");
+               free(f);
+               return;
+       }
+       list_add_tail(&f->node.list, &parent->files);
+}
+
+static const struct dt_dir *
+node2dir(const struct device_node *n)
+{
+       struct dt_node *dn = container_of((struct device_node *)n,
+                                         struct dt_node, node);
+       const struct dt_dir *d = container_of(dn, struct dt_dir, node);
+
+       assert(!dn->is_file);
+       return d;
+}
+
+/* process_dir() calls iterate_dir(), but the latter will also call the former
+ * when recursing into sub-directories, so a predeclaration is needed.
+ */
+static int process_dir(const char *relative_path, struct dt_dir *dt);
+
+static int
+iterate_dir(struct dirent **d, int num, struct dt_dir *dt)
+{
+       int loop;
+       /* Iterate the directory contents */
+       for (loop = 0; loop < num; loop++) {
+               struct dt_dir *subdir;
+               int ret;
+               /* Ignore dot files of all types (especially "..") */
+               if (d[loop]->d_name[0] == '.')
+                       continue;
+               switch (d[loop]->d_type) {
+               case DT_REG:
+                       process_file(d[loop], dt);
+                       break;
+               case DT_DIR:
+                       subdir = malloc(sizeof(*subdir));
+                       if (!subdir) {
+                               perror("malloc");
+                               return -ENOMEM;
+                       }
+                       strlcpy(subdir->node.node.name, d[loop]->d_name,
+                               NAME_MAX);
+                       snprintf(subdir->node.node.full_name, PATH_MAX,
+                                "%s/%s", dt->node.node.full_name,
+                                d[loop]->d_name);
+                       subdir->parent = dt;
+                       ret = process_dir(subdir->node.node.full_name, subdir);
+                       if (ret)
+                               return ret;
+                       list_add_tail(&subdir->node.list, &dt->subdirs);
+                       break;
+               default:
+                       DPAAX_LOG(DEBUG, "Ignoring invalid dt entry %s/%s",
+                                    dt->node.node.full_name, d[loop]->d_name);
+               }
+       }
+       return 0;
+}
+
+static int
+process_dir(const char *relative_path, struct dt_dir *dt)
+{
+       struct dirent **d;
+       int ret, num;
+
+       dt->node.is_file = 0;
+       INIT_LIST_HEAD(&dt->subdirs);
+       INIT_LIST_HEAD(&dt->files);
+       ret = of_open_dir(relative_path, &d);
+       if (ret < 0)
+               return ret;
+       num = ret;
+       ret = iterate_dir(d, num, dt);
+       of_close_dir(d, num);
+       return (ret < 0) ? ret : 0;
+}
+
+static void
+linear_dir(struct dt_dir *d)
+{
+       struct dt_file *f;
+       struct dt_dir *dd;
+
+       d->compatible = NULL;
+       d->status = NULL;
+       d->lphandle = NULL;
+       d->a_cells = NULL;
+       d->s_cells = NULL;
+       d->reg = NULL;
+       list_for_each_entry(f, &d->files, node.list) {
+               if (!strcmp(f->node.node.name, "compatible")) {
+                       if (d->compatible)
+                               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)
+                               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)
+                               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)
+                               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)
+                               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)
+                               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)
+                               DPAAX_LOG(DEBUG, "Duplicate reg in %s",
+                                            d->node.node.full_name);
+                       d->reg = f;
+               }
+       }
+
+       list_for_each_entry(dd, &d->subdirs, node.list) {
+               list_add_tail(&dd->linear, &linear);
+               linear_dir(dd);
+       }
+}
+
+int
+of_init_path(const char *dt_path)
+{
+       int ret;
+
+       base_dir = dt_path;
+
+       /* This needs to be singleton initialization */
+       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';
+       root_dir.node.node.full_name[0] = '\0';
+       INIT_LIST_HEAD(&root_dir.node.list);
+       root_dir.parent = NULL;
+
+       /* Kick things off... */
+       ret = process_dir("", &root_dir);
+       if (ret) {
+               DPAAX_LOG(ERR, "Unable to parse device tree");
+               return ret;
+       }
+
+       /* Now make a flat, linear list of directories */
+       linear_dir(&root_dir);
+       alive = 1;
+       return 0;
+}
+
+static void
+destroy_dir(struct dt_dir *d)
+{
+       struct dt_file *f, *tmpf;
+       struct dt_dir *dd, *tmpd;
+
+       list_for_each_entry_safe(f, tmpf, &d->files, node.list) {
+               list_del(&f->node.list);
+               free(f);
+       }
+       list_for_each_entry_safe(dd, tmpd, &d->subdirs, node.list) {
+               destroy_dir(dd);
+               list_del(&dd->node.list);
+               free(dd);
+       }
+}
+
+void
+of_finish(void)
+{
+       DPAAX_HWWARN(!alive, "Double-finish of device-tree driver!");
+
+       destroy_dir(&root_dir);
+       INIT_LIST_HEAD(&linear);
+       alive = 0;
+}
+
+static const struct dt_dir *
+next_linear(const struct dt_dir *f)
+{
+       if (f->linear.next == &linear)
+               return NULL;
+       return list_entry(f->linear.next, struct dt_dir, linear);
+}
+
+static int
+check_compatible(const struct dt_file *f, const char *compatible)
+{
+       const char *c = (char *)f->buf;
+       unsigned int len, remains = f->len;
+
+       while (remains) {
+               len = strlen(c);
+               if (!strcmp(c, compatible))
+                       return 1;
+
+               if (remains < len + 1)
+                       break;
+
+               c += (len + 1);
+               remains -= (len + 1);
+       }
+       return 0;
+}
+
+const struct device_node *
+of_find_compatible_node(const struct device_node *from,
+                       const char *type __rte_unused,
+                       const char *compatible)
+{
+       const struct dt_dir *d;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+
+       if (list_empty(&linear))
+               return NULL;
+       if (!from)
+               d = list_entry(linear.next, struct dt_dir, linear);
+       else
+               d = node2dir(from);
+       for (d = next_linear(d); d && (!d->compatible ||
+                                      !check_compatible(d->compatible,
+                                      compatible));
+                       d = next_linear(d))
+               ;
+       if (d)
+               return &d->node.node;
+       return NULL;
+}
+
+const void *
+of_get_property(const struct device_node *from, const char *name,
+               size_t *lenp)
+{
+       const struct dt_dir *d;
+       const struct dt_file *f;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+
+       d = node2dir(from);
+       list_for_each_entry(f, &d->files, node.list)
+               if (!strcmp(f->node.node.name, name)) {
+                       if (lenp)
+                               *lenp = f->len;
+                       return f->buf;
+               }
+       return NULL;
+}
+
+bool
+of_device_is_available(const struct device_node *dev_node)
+{
+       const struct dt_dir *d;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+       d = node2dir(dev_node);
+       if (!d->status)
+               return true;
+       if (!strcmp((char *)d->status->buf, "okay"))
+               return true;
+       if (!strcmp((char *)d->status->buf, "ok"))
+               return true;
+       return false;
+}
+
+const struct device_node *
+of_find_node_by_phandle(uint64_t ph)
+{
+       const struct dt_dir *d;
+
+       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))
+                       return &d->node.node;
+       return NULL;
+}
+
+const struct device_node *
+of_get_parent(const struct device_node *dev_node)
+{
+       const struct dt_dir *d;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+
+       if (!dev_node)
+               return NULL;
+       d = node2dir(dev_node);
+       if (!d->parent)
+               return NULL;
+       return &d->parent->node.node;
+}
+
+const struct device_node *
+of_get_next_child(const struct device_node *dev_node,
+                 const struct device_node *prev)
+{
+       const struct dt_dir *p, *c;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+
+       if (!dev_node)
+               return NULL;
+       p = node2dir(dev_node);
+       if (prev) {
+               c = node2dir(prev);
+               DPAAX_HWWARN((c->parent != p), "Parent/child mismatch");
+               if (c->parent != p)
+                       return NULL;
+               if (c->node.list.next == &p->subdirs)
+                       /* prev was the last child */
+                       return NULL;
+               c = list_entry(c->node.list.next, struct dt_dir, node.list);
+               return &c->node.node;
+       }
+       /* Return first child */
+       if (list_empty(&p->subdirs))
+               return NULL;
+       c = list_entry(p->subdirs.next, struct dt_dir, node.list);
+       return &c->node.node;
+}
+
+uint32_t
+of_n_addr_cells(const struct device_node *dev_node)
+{
+       const struct dt_dir *d;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised");
+       if (!dev_node)
+               return OF_DEFAULT_NA;
+       d = node2dir(dev_node);
+       while ((d = d->parent))
+               if (d->a_cells) {
+                       unsigned char *buf =
+                               (unsigned char *)&d->a_cells->buf[0];
+                       assert(d->a_cells->len == 4);
+                       return ((uint32_t)buf[0] << 24) |
+                               ((uint32_t)buf[1] << 16) |
+                               ((uint32_t)buf[2] << 8) |
+                               (uint32_t)buf[3];
+               }
+       return OF_DEFAULT_NA;
+}
+
+uint32_t
+of_n_size_cells(const struct device_node *dev_node)
+{
+       const struct dt_dir *d;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+       if (!dev_node)
+               return OF_DEFAULT_NA;
+       d = node2dir(dev_node);
+       while ((d = d->parent))
+               if (d->s_cells) {
+                       unsigned char *buf =
+                               (unsigned char *)&d->s_cells->buf[0];
+                       assert(d->s_cells->len == 4);
+                       return ((uint32_t)buf[0] << 24) |
+                               ((uint32_t)buf[1] << 16) |
+                               ((uint32_t)buf[2] << 8) |
+                               (uint32_t)buf[3];
+               }
+       return OF_DEFAULT_NS;
+}
+
+const uint32_t *
+of_get_address(const struct device_node *dev_node, size_t idx,
+              uint64_t *size, uint32_t *flags __rte_unused)
+{
+       const struct dt_dir *d;
+       const unsigned char *buf;
+       uint32_t na = of_n_addr_cells(dev_node);
+       uint32_t ns = of_n_size_cells(dev_node);
+
+       if (!dev_node)
+               d = &root_dir;
+       else
+               d = node2dir(dev_node);
+       if (!d->reg)
+               return NULL;
+       assert(d->reg->len % ((na + ns) * 4) == 0);
+       assert(d->reg->len / ((na + ns) * 4) > (unsigned int) idx);
+       buf = (const unsigned char *)&d->reg->buf[0];
+       buf += (na + ns) * idx * 4;
+       if (size)
+               for (*size = 0; ns > 0; ns--, na++)
+                       *size = (*size << 32) +
+                               (((uint32_t)buf[4 * na] << 24) |
+                               ((uint32_t)buf[4 * na + 1] << 16) |
+                               ((uint32_t)buf[4 * na + 2] << 8) |
+                               (uint32_t)buf[4 * na + 3]);
+       return (const uint32_t *)buf;
+}
+
+uint64_t
+of_translate_address(const struct device_node *dev_node,
+                    const uint32_t *addr)
+{
+       uint64_t phys_addr, tmp_addr;
+       const struct device_node *parent;
+       const uint32_t *ranges;
+       size_t rlen;
+       uint32_t na, pna;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+       assert(dev_node != NULL);
+
+       na = of_n_addr_cells(dev_node);
+       phys_addr = of_read_number(addr, na);
+
+       dev_node = of_get_parent(dev_node);
+       if (!dev_node)
+               return 0;
+       else if (node2dir(dev_node) == &root_dir)
+               return phys_addr;
+
+       do {
+               pna = of_n_addr_cells(dev_node);
+               parent = of_get_parent(dev_node);
+               if (!parent)
+                       return 0;
+
+               ranges = of_get_property(dev_node, "ranges", &rlen);
+               /* "ranges" property is missing. Translation breaks */
+               if (!ranges)
+                       return 0;
+               /* "ranges" property is empty. Do 1:1 translation */
+               else if (rlen == 0)
+                       continue;
+               else
+                       tmp_addr = of_read_number(ranges + na, pna);
+
+               na = pna;
+               dev_node = parent;
+               phys_addr += tmp_addr;
+       } while (node2dir(parent) != &root_dir);
+
+       return phys_addr;
+}
+
+bool
+of_device_is_compatible(const struct device_node *dev_node,
+                       const char *compatible)
+{
+       const struct dt_dir *d;
+
+       DPAAX_HWWARN(!alive, "Device-tree driver not initialised!");
+       if (!dev_node)
+               d = &root_dir;
+       else
+               d = node2dir(dev_node);
+       if (d->compatible && check_compatible(d->compatible, compatible))
+               return true;
+       return false;
+}
+
+static const void *of_get_mac_addr(const struct device_node *np,
+               const char *name)
+{
+       return of_get_property(np, name, NULL);
+}
+
+/**
+ * Search the device tree for the best MAC address to use.  'mac-address' is
+ * checked first, because that is supposed to contain to "most recent" MAC
+ * address. If that isn't set, then 'local-mac-address' is checked next,
+ * because that is the default address.  If that isn't set, then the obsolete
+ * 'address' is checked, just in case we're using an old device tree.
+ *
+ * Note that the 'address' property is supposed to contain a virtual address of
+ * the register set, but some DTS files have redefined that property to be the
+ * MAC address.
+ *
+ * All-zero MAC addresses are rejected, because those could be properties that
+ * exist in the device tree, but were not set by U-Boot.  For example, the
+ * DTS could define 'mac-address' and 'local-mac-address', with zero MAC
+ * addresses.  Some older U-Boots only initialized 'local-mac-address'.  In
+ * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
+ * but is all zeros.
+ */
+const void *of_get_mac_address(const struct device_node *np)
+{
+       const void *addr;
+
+       addr = of_get_mac_addr(np, "mac-address");
+       if (addr)
+               return addr;
+
+       addr = of_get_mac_addr(np, "local-mac-address");
+       if (addr)
+               return addr;
+
+       return of_get_mac_addr(np, "address");
+}
diff --git a/drivers/common/dpaax/dpaa_of.h b/drivers/common/dpaax/dpaa_of.h
new file mode 100644 (file)
index 0000000..960b421
--- /dev/null
@@ -0,0 +1,174 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
+ *
+ * Copyright 2010-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ */
+
+#ifndef __OF_H
+#define        __OF_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 <limits.h>
+#include <rte_common.h>
+#include <dpaa_list.h>
+
+#ifndef OF_INIT_DEFAULT_PATH
+#define OF_INIT_DEFAULT_PATH "/proc/device-tree"
+#endif
+
+#define OF_DEFAULT_NA 1
+#define OF_DEFAULT_NS 1
+
+#define OF_FILE_BUF_MAX 256
+
+/**
+ * Layout of Device Tree:
+ * dt_dir
+ *  |- dt_dir
+ *  |   |- dt_dir
+ *  |   |  |- dt_dir
+ *  |   |  |  |- dt_file
+ *  |   |  |  ``- dt_file
+ *  |   |  ``- dt_file
+ *  |   `-dt_file`
+ *  ``- dt_file
+ *
+ *  +------------------+
+ *  |dt_dir            |
+ *  |+----------------+|
+ *  ||dt_node         ||
+ *  ||+--------------+||
+ *  |||device_node   |||
+ *  ||+--------------+||
+ *  || list_dt_nodes  ||
+ *  |+----------------+|
+ *  | list of subdir   |
+ *  | list of files    |
+ *  +------------------+
+ */
+
+/**
+ * Device description on of a device node in device tree.
+ */
+struct device_node {
+       char name[NAME_MAX];
+       char full_name[PATH_MAX];
+};
+
+/**
+ * List of device nodes available in a device tree layout
+ */
+struct dt_node {
+       struct device_node node; /**< Property of node */
+       int is_file; /**< FALSE==dir, TRUE==file */
+       struct list_head list; /**< Nodes within a parent subdir */
+};
+
+/**
+ * Types we use to represent directories and files
+ */
+struct dt_file;
+struct dt_dir {
+       struct dt_node node;
+       struct list_head subdirs;
+       struct list_head files;
+       struct list_head linear;
+       struct dt_dir *parent;
+       struct dt_file *compatible;
+       struct dt_file *status;
+       struct dt_file *lphandle;
+       struct dt_file *a_cells;
+       struct dt_file *s_cells;
+       struct dt_file *reg;
+};
+
+struct dt_file {
+       struct dt_node node;
+       struct dt_dir *parent;
+       ssize_t len;
+       uint64_t buf[OF_FILE_BUF_MAX >> 3];
+};
+
+const struct device_node *of_find_compatible_node(
+                                       const struct device_node *from,
+                                       const char *type __rte_unused,
+                                       const char *compatible)
+       __attribute__((nonnull(3)));
+
+#define for_each_compatible_node(dev_node, type, compatible) \
+       for (dev_node = of_find_compatible_node(NULL, type, compatible); \
+               dev_node != NULL; \
+               dev_node = of_find_compatible_node(dev_node, type, compatible))
+
+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(uint64_t ph);
+
+const struct device_node *of_get_parent(const struct device_node *dev_node);
+
+const struct device_node *of_get_next_child(const struct device_node *dev_node,
+                                           const struct device_node *prev);
+
+const void *of_get_mac_address(const struct device_node *np);
+
+#define for_each_child_node(parent, child) \
+       for (child = of_get_next_child(parent, NULL); child != NULL; \
+                       child = of_get_next_child(parent, child))
+
+uint32_t of_n_addr_cells(const struct device_node *dev_node);
+uint32_t of_n_size_cells(const struct device_node *dev_node);
+
+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 uint32_t *addr) __attribute__((nonnull));
+
+bool of_device_is_compatible(const struct device_node *dev_node,
+                            const char *compatible);
+
+/* of_init() must be called prior to initialisation or use of any driver
+ * subsystem that is device-tree-dependent. Eg. Qman/Bman, config layers, etc.
+ * The path should usually be "/proc/device-tree".
+ */
+int of_init_path(const char *dt_path);
+
+/* of_finish() allows a controlled tear-down of the device-tree layer, eg. if a
+ * full reload is desired without a process exit.
+ */
+void of_finish(void);
+
+/* Use of this wrapper is recommended. */
+static inline int of_init(void)
+{
+       return of_init_path(OF_INIT_DEFAULT_PATH);
+}
+
+/* Read a numeric property according to its size and return it as a 64-bit
+ * value.
+ */
+static inline uint64_t of_read_number(const uint32_t *cell, int size)
+{
+       uint64_t r = 0;
+
+       while (size--)
+               r = (r << 32) | be32toh(*(cell++));
+       return r;
+}
+
+#endif /*  __OF_H */
index bf1b27c..180476f 100644 (file)
@@ -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)
index a315e77..d41bb50 100644 (file)
@@ -8,6 +8,12 @@ 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
+if cc.has_argument('-Wno-pointer-arith')
+       cflags += '-Wno-pointer-arith'
+endif
index 8131c9e..a7699ae 100644 (file)
@@ -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;
index c232a20..fa35b79 100644 (file)
@@ -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/common/dpaax/caamflib/
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/caam_jr
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
index 2fe1818..d1da9a6 100644 (file)
@@ -27,9 +27,9 @@
 /* RTA header files */
 #include <desc/common.h>
 #include <desc/algo.h>
-#include <of.h>
+#include <dpaa_of.h>
 #ifdef RTE_LIBRTE_PMD_CAAM_JR_DEBUG
-#define CAAM_JR_DBG    1
+#define CAAM_JR_DBG    1
 #else
 #define CAAM_JR_DBG    0
 #endif
index 825fefd..50132ae 100644 (file)
@@ -15,4 +15,5 @@ sources = files('caam_jr_capabilities.c',
 allow_experimental_apis = true
 
 includes += include_directories('../../bus/dpaa/include/')
+includes += include_directories('../../common/dpaax/')
 includes += include_directories('../../common/dpaax/caamflib/')
index 1f28811..ba30a95 100644 (file)
@@ -20,6 +20,7 @@ CFLAGS += -Wno-implicit-fallthrough
 endif
 endif
 
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/mc
index abbcc86..9acccaa 100644 (file)
@@ -17,6 +17,7 @@ CFLAGS += $(WERROR_FLAGS)
 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/common/dpaax
 CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa_sec/
 CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax/caamflib/
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
index 632ce9f..6c18633 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <fsl_usd.h>
 #include <fsl_qman.h>
-#include <of.h>
+#include <dpaa_of.h>
 
 /* RTA header files */
 #include <desc/common.h>
index 8744a05..9f17d3a 100644 (file)
@@ -12,4 +12,5 @@ sources = files('dpaa_sec.c')
 allow_experimental_apis = true
 
 includes += include_directories('../../bus/dpaa/include')
+includes += include_directories('../../common/dpaax')
 includes += include_directories('../../common/dpaax/caamflib/')
index 1856fa4..befb21b 100644 (file)
@@ -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
 
 LDLIBS += -lrte_pmd_dpaa_sec
index c4019d6..a29284f 100644 (file)
@@ -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_common_dpaax
 LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
index ead5029..534e007 100644 (file)
@@ -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
 
index c1df78a..bdb9410 100644 (file)
@@ -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
index 4fb16bd..395e4d9 100644 (file)
@@ -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
 
index f63a5f1..182beca 100644 (file)
@@ -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
index 2de1a1a..bbe6150 100644 (file)
@@ -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) \
index 7924871..e5a2d3f 100644 (file)
@@ -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
index 2b4150c..a7c9802 100644 (file)
@@ -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
index 0009fd4..057b2a8 100644 (file)
@@ -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