bus/fslmc: fix the failure loop condition
[dpdk.git] / drivers / bus / fslmc / portal / dpaa2_hw_dpio.c
index 62c03a2..4c4e918 100644 (file)
@@ -61,6 +61,7 @@
 #include <fslmc_vfio.h>
 #include "dpaa2_hw_pvt.h"
 #include "dpaa2_hw_dpio.h"
+#include <mc/fsl_dpmng.h>
 
 #define NUM_HOST_CPUS RTE_MAX_LCORE
 
@@ -150,8 +151,6 @@ configure_dpio_qbman_swp(struct dpaa2_dpio_dev *dpio_dev)
        }
 
        PMD_INIT_LOG(DEBUG, "Qbman Portal ID %d", attr.qbman_portal_id);
-       PMD_INIT_LOG(DEBUG, "Portal CE adr 0x%lX", attr.qbman_portal_ce_offset);
-       PMD_INIT_LOG(DEBUG, "Portal CI adr 0x%lX", attr.qbman_portal_ci_offset);
 
        /* Configure & setup SW portal */
        p_des.block = NULL;
@@ -169,8 +168,6 @@ configure_dpio_qbman_swp(struct dpaa2_dpio_dev *dpio_dev)
                return -1;
        }
 
-       PMD_INIT_LOG(DEBUG, "QBMan SW Portal 0x%p\n", dpio_dev->sw_portal);
-
        return 0;
 }
 
@@ -179,6 +176,22 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev)
 {
        int sdest;
        int cpu_id, ret;
+       static int first_time;
+
+       /* find the SoC type for the first time */
+       if (!first_time) {
+               struct mc_soc_version mc_plat_info = {0};
+
+               if (mc_get_soc_version(dpio_dev->dpio,
+                                      CMD_PRI_LOW, &mc_plat_info)) {
+                       PMD_INIT_LOG(ERR, "\tmc_get_soc_version failed\n");
+               } else if ((mc_plat_info.svr & 0xffff0000) == SVR_LS1080A) {
+                       dpaa2_core_cluster_base = 0x02;
+                       dpaa2_cluster_sz = 4;
+                       PMD_INIT_LOG(DEBUG, "\tLS108x (A53) Platform Detected");
+               }
+               first_time = 1;
+       }
 
        /* Set the Stashing Destination */
        cpu_id = rte_lcore_id();
@@ -191,8 +204,6 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev)
        }
        /* Set the STASH Destination depending on Current CPU ID.
         * Valid values of SDEST are 4,5,6,7. Where,
-        * CPU 0-1 will have SDEST 4
-        * CPU 2-3 will have SDEST 5.....and so on.
         */
 
        sdest = dpaa2_core_cluster_sdest(cpu_id);
@@ -344,7 +355,6 @@ dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
                return -1;
        }
 
-       PMD_DRV_LOG(INFO, "\t Aloocated DPIO [%p]", dpio_dev);
        dpio_dev->dpio = NULL;
        dpio_dev->hw_id = object_id;
        dpio_dev->vfio_fd = vdev->fd;
@@ -359,8 +369,6 @@ dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
                return -1;
        }
 
-       PMD_DRV_LOG(DEBUG, "\t  Region Offset = %llx", reg_info.offset);
-       PMD_DRV_LOG(DEBUG, "\t  Region Size = %llx", reg_info.size);
        dpio_dev->ce_size = reg_info.size;
        dpio_dev->qbman_portal_ce_paddr = (uint64_t)mmap(NULL, reg_info.size,
                                PROT_WRITE | PROT_READ, MAP_SHARED,
@@ -383,8 +391,6 @@ dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
                return -1;
        }
 
-       PMD_DRV_LOG(DEBUG, "\t  Region Offset = %llx", reg_info.offset);
-       PMD_DRV_LOG(DEBUG, "\t  Region Size = %llx", reg_info.size);
        dpio_dev->ci_size = reg_info.size;
        dpio_dev->qbman_portal_ci_paddr = (uint64_t)mmap(NULL, reg_info.size,
                                PROT_WRITE | PROT_READ, MAP_SHARED,
@@ -401,7 +407,7 @@ dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
        io_space_count++;
        dpio_dev->index = io_space_count;
        TAILQ_INSERT_TAIL(&dpio_dev_list, dpio_dev, next);
-       PMD_INIT_LOG(DEBUG, "DPAA2:Added [dpio-%d]", object_id);
+       PMD_INIT_LOG(DEBUG, "DPAA2: Added [dpio-%d]", object_id);
 
        return 0;
 }
@@ -431,8 +437,7 @@ dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage)
        }
        return 0;
 fail:
-       i -= 1;
-       while (i >= 0)
+       while (--i >= 0)
                rte_free(q_storage->dq_storage[i]);
 
        return -1;