+ return ret;
+}
+
+static int
+rte_fslmc_parse(const char *name, void *addr)
+{
+ uint16_t dev_id;
+ char *t_ptr;
+ const char *sep;
+ uint8_t sep_exists = 0;
+ int ret = -1;
+
+ DPAA2_BUS_DEBUG("Parsing dev=(%s)", name);
+
+ /* There are multiple ways this can be called, with bus:dev, name=dev
+ * or just dev. In all cases, the 'addr' is actually a string.
+ */
+ sep = strchr(name, ':');
+ if (!sep) {
+ /* check for '=' */
+ sep = strchr(name, '=');
+ if (!sep)
+ sep_exists = 0;
+ else
+ sep_exists = 1;
+ } else
+ sep_exists = 1;
+
+ /* Check if starting part if either of 'fslmc:' or 'name=', separator
+ * exists.
+ */
+ if (sep_exists) {
+ /* If either of "fslmc" or "name" are starting part */
+ if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
+ strlen(RTE_STR(FSLMC_BUS_NAME))) ||
+ (!strncmp(name, "name", strlen("name")))) {
+ goto jump_out;
+ } else {
+ DPAA2_BUS_DEBUG("Invalid device for matching (%s).",
+ name);
+ ret = -EINVAL;
+ goto err_out;
+ }
+ } else
+ sep = name;
+
+jump_out:
+ /* Validate device name */
+ if (strncmp("dpni", sep, 4) &&
+ strncmp("dpseci", sep, 6) &&
+ strncmp("dpcon", sep, 5) &&
+ strncmp("dpbp", sep, 4) &&
+ strncmp("dpio", sep, 4) &&
+ strncmp("dpci", sep, 4) &&
+ strncmp("dpmcp", sep, 5) &&
+ strncmp("dpdmai", sep, 6) &&
+ strncmp("dpdmux", sep, 6)) {
+ DPAA2_BUS_DEBUG("Unknown or unsupported device (%s)", sep);
+ ret = -EINVAL;
+ goto err_out;
+ }
+
+ t_ptr = strchr(sep, '.');
+ if (!t_ptr || sscanf(t_ptr + 1, "%hu", &dev_id) != 1) {
+ DPAA2_BUS_ERR("Missing device id in device name (%s)", sep);
+ ret = -EINVAL;
+ goto err_out;
+ }
+
+ if (addr)
+ strcpy(addr, sep);
+
+ ret = 0;
+err_out:
+ return ret;