| 941 | } |
| 942 | |
| 943 | static int |
| 944 | pmd_pfe_probe(struct rte_vdev_device *vdev) |
| 945 | { |
| 946 | const u32 *prop; |
| 947 | const struct device_node *np; |
| 948 | const char *name; |
| 949 | const uint32_t *addr; |
| 950 | uint64_t cbus_addr, ddr_size, cbus_size; |
| 951 | int rc = -1, fd = -1, gem_id; |
| 952 | unsigned int ii, interface_count = 0; |
| 953 | size_t size = 0; |
| 954 | struct pfe_vdev_init_params init_params = { |
| 955 | .gem_id = -1 |
| 956 | }; |
| 957 | |
| 958 | name = rte_vdev_device_name(vdev); |
| 959 | rc = pfe_parse_vdev_init_params(&init_params, vdev); |
| 960 | if (rc < 0) |
| 961 | return -EINVAL; |
| 962 | |
| 963 | PFE_PMD_LOG(INFO, "Initializing pmd_pfe for %s Given gem-id %d", |
| 964 | name, init_params.gem_id); |
| 965 | |
| 966 | if (g_pfe) { |
| 967 | if (g_pfe->nb_devs >= g_pfe->max_intf) { |
| 968 | PFE_PMD_ERR("PFE %d dev already created Max is %d", |
| 969 | g_pfe->nb_devs, g_pfe->max_intf); |
| 970 | return -EINVAL; |
| 971 | } |
| 972 | goto eth_init; |
| 973 | } |
| 974 | |
| 975 | g_pfe = rte_zmalloc(NULL, sizeof(*g_pfe), RTE_CACHE_LINE_SIZE); |
| 976 | if (g_pfe == NULL) |
| 977 | return -EINVAL; |
| 978 | |
| 979 | /* Load the device-tree driver */ |
| 980 | rc = of_init(); |
| 981 | if (rc) { |
| 982 | PFE_PMD_ERR("of_init failed with ret: %d", rc); |
| 983 | goto err; |
| 984 | } |
| 985 | |
| 986 | np = of_find_compatible_node(NULL, NULL, "fsl,pfe"); |
| 987 | if (!np) { |
| 988 | PFE_PMD_ERR("Invalid device node"); |
| 989 | rc = -EINVAL; |
| 990 | goto err; |
| 991 | } |
| 992 | |
| 993 | addr = of_get_address(np, 0, &cbus_size, NULL); |
| 994 | if (!addr) { |
| 995 | PFE_PMD_ERR("of_get_address cannot return qman address"); |
| 996 | goto err; |
| 997 | } |
| 998 | cbus_addr = of_translate_address(np, addr); |
| 999 | if (!cbus_addr) { |
| 1000 | PFE_PMD_ERR("of_translate_address failed"); |
nothing calls this directly
no test coverage detected