X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fbus%2Fdpaa%2Fdpaa_bus.c;h=204a50b1eba34798a13b446afdb459dfb53e2d8f;hb=6ef75e405d5a88e8806b261c1a6c3f6b30385007;hp=20462065c4a5c96de39aee424c64dcfcab14a897;hpb=fe33fe37fd8b63e140e9ed91443dc44fa62472d4;p=dpdk.git diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 20462065c4..204a50b1eb 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -46,11 +47,11 @@ int dpaa_logtype_mempool; int dpaa_logtype_pmd; int dpaa_logtype_eventdev; -struct rte_dpaa_bus rte_dpaa_bus; +static struct rte_dpaa_bus rte_dpaa_bus; struct netcfg_info *dpaa_netcfg; /* define a variable to hold the portal_key, once created.*/ -pthread_key_t dpaa_portal_key; +static pthread_key_t dpaa_portal_key; unsigned int dpaa_svr_family; @@ -165,6 +166,8 @@ dpaa_create_device_list(void) goto cleanup; } + dev->device.bus = &rte_dpaa_bus.bus; + cfg = &dpaa_netcfg->port_cfg[i]; fman_intf = cfg->fman_if; @@ -539,6 +542,20 @@ rte_dpaa_bus_probe(void) unsigned int svr_ver; int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST; + /* If DPAA bus is not present nothing needs to be done */ + if (TAILQ_EMPTY(&rte_dpaa_bus.device_list)) + return 0; + + svr_file = fopen(DPAA_SOC_ID_FILE, "r"); + if (svr_file) { + if (fscanf(svr_file, "svr:%x", &svr_ver) > 0) + dpaa_svr_family = svr_ver & SVR_MASK; + fclose(svr_file); + } + + /* And initialize the PA->VA translation table */ + dpaax_iova_table_populate(); + /* For each registered driver, and device, call the driver->probe */ TAILQ_FOREACH(dev, &rte_dpaa_bus.device_list, next) { TAILQ_FOREACH(drv, &rte_dpaa_bus.driver_list, next) { @@ -546,6 +563,9 @@ rte_dpaa_bus_probe(void) if (ret) continue; + if (rte_dev_is_probed(&dev->device)) + continue; + if (!drv->probe || (dev->device.devargs && dev->device.devargs->policy == RTE_DEV_BLACKLISTED)) @@ -556,8 +576,12 @@ rte_dpaa_bus_probe(void) dev->device.devargs->policy == RTE_DEV_WHITELISTED)) { ret = drv->probe(drv, dev); - if (ret) + if (ret) { DPAA_BUS_ERR("Unable to probe.\n"); + } else { + dev->driver = drv; + dev->device.driver = &drv->driver; + } } break; } @@ -566,15 +590,7 @@ rte_dpaa_bus_probe(void) /* Register DPAA mempool ops only if any DPAA device has * been detected. */ - if (!TAILQ_EMPTY(&rte_dpaa_bus.device_list)) - rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME); - - svr_file = fopen(DPAA_SOC_ID_FILE, "r"); - if (svr_file) { - if (fscanf(svr_file, "svr:%x", &svr_ver) > 0) - dpaa_svr_family = svr_ver & SVR_MASK; - fclose(svr_file); - } + rte_mbuf_set_platform_mempool_ops(DPAA_MEMPOOL_OPS_NAME); return 0; } @@ -611,7 +627,7 @@ rte_dpaa_get_iommu_class(void) return RTE_IOVA_PA; } -struct rte_dpaa_bus rte_dpaa_bus = { +static struct rte_dpaa_bus rte_dpaa_bus = { .bus = { .scan = rte_dpaa_bus_scan, .probe = rte_dpaa_bus_probe, @@ -626,9 +642,7 @@ struct rte_dpaa_bus rte_dpaa_bus = { RTE_REGISTER_BUS(FSL_DPAA_BUS_NAME, rte_dpaa_bus.bus); -RTE_INIT(dpaa_init_log); -static void -dpaa_init_log(void) +RTE_INIT(dpaa_init_log) { dpaa_logtype_bus = rte_log_register("bus.dpaa"); if (dpaa_logtype_bus >= 0)