bus/fslmc: remove the export for QBMAN version
[dpdk.git] / drivers / bus / fslmc / qbman / qbman_portal.c
index be4e2e5..97df703 100644 (file)
@@ -44,6 +44,8 @@
 #define QBMAN_CINH_SWP_IER     0xe40
 #define QBMAN_CINH_SWP_ISDR    0xe80
 #define QBMAN_CINH_SWP_IIR     0xec0
+#define QBMAN_CINH_SWP_DQRR_ITR    0xa80
+#define QBMAN_CINH_SWP_ITPR    0xf40
 
 /* CENA register offsets */
 #define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((uint32_t)(n) << 6))
@@ -103,8 +105,6 @@ struct qb_attr_code code_sdqcr_dqsrc = QB_CODE(0, 0, 16);
 #define MAX_QBMAN_PORTALS  35
 static struct qbman_swp *portal_idx_map[MAX_QBMAN_PORTALS];
 
-uint32_t qman_version;
-
 /*********************************/
 /* Portal constructor/destructor */
 /*********************************/
@@ -218,6 +218,26 @@ void qbman_swp_interrupt_clear_status(struct qbman_swp *p, uint32_t mask)
        qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_ISR, mask);
 }
 
+uint32_t qbman_swp_dqrr_thrshld_read_status(struct qbman_swp *p)
+{
+       return qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_DQRR_ITR);
+}
+
+void qbman_swp_dqrr_thrshld_write(struct qbman_swp *p, uint32_t mask)
+{
+       qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_DQRR_ITR, mask);
+}
+
+uint32_t qbman_swp_intr_timeout_read_status(struct qbman_swp *p)
+{
+       return qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_ITPR);
+}
+
+void qbman_swp_intr_timeout_write(struct qbman_swp *p, uint32_t mask)
+{
+       qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_ITPR, mask);
+}
+
 uint32_t qbman_swp_interrupt_get_trigger(struct qbman_swp *p)
 {
        return qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_IER);
@@ -458,8 +478,8 @@ static int qbman_swp_enqueue_array_mode(struct qbman_swp *s,
                return -EBUSY;
        p = qbman_cena_write_start_wo_shadow(&s->sys,
                        QBMAN_CENA_SWP_EQCR(EQAR_IDX(eqar)));
-       word_copy(&p[1], &cl[1], 7);
-       word_copy(&p[8], fd, sizeof(*fd) >> 2);
+       memcpy(&p[1], &cl[1], 28);
+       memcpy(&p[8], fd, sizeof(*fd));
        /* Set the verb byte, have to substitute in the valid-bit */
        lwsync();
        p[0] = cl[0] | EQAR_VB(eqar);
@@ -490,8 +510,8 @@ static int qbman_swp_enqueue_ring_mode(struct qbman_swp *s,
 
        p = qbman_cena_write_start_wo_shadow(&s->sys,
                QBMAN_CENA_SWP_EQCR(s->eqcr.pi & 7));
-       word_copy(&p[1], &cl[1], 7);
-       word_copy(&p[8], fd, sizeof(*fd) >> 2);
+       memcpy(&p[1], &cl[1], 28);
+       memcpy(&p[8], fd, sizeof(*fd));
        lwsync();
        /* Set the verb byte, have to substitute in the valid-bit */
        p[0] = cl[0] | s->eqcr.pi_vb;
@@ -527,9 +547,7 @@ int qbman_swp_fill_ring(struct qbman_swp *s,
        }
        p = qbman_cena_write_start_wo_shadow(&s->sys,
                QBMAN_CENA_SWP_EQCR((s->eqcr.pi/* +burst_index */) & 7));
-       /* word_copy(&p[1], &cl[1], 7); */
        memcpy(&p[1], &cl[1], 7 * 4);
-       /* word_copy(&p[8], fd, sizeof(*fd) >> 2); */
        memcpy(&p[8], fd, sizeof(struct qbman_fd));
 
        /* lwsync(); */
@@ -574,6 +592,76 @@ int qbman_swp_enqueue(struct qbman_swp *s, const struct qbman_eq_desc *d,
                return qbman_swp_enqueue_ring_mode(s, d, fd);
 }
 
+int qbman_swp_enqueue_multiple_eqdesc(struct qbman_swp *s,
+                              const struct qbman_eq_desc *d,
+                              const struct qbman_fd *fd,
+                              int num_frames)
+{
+       uint32_t *p;
+       const uint32_t *cl = qb_cl(d);
+       uint32_t eqcr_ci, eqcr_pi;
+       uint8_t diff;
+       int i, num_enqueued = 0;
+       uint64_t addr_cena;
+
+       if (!s->eqcr.available) {
+               eqcr_ci = s->eqcr.ci;
+               s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+                               QBMAN_CENA_SWP_EQCR_CI) & 0xF;
+               diff = qm_cyc_diff(QBMAN_EQCR_SIZE,
+                                  eqcr_ci, s->eqcr.ci);
+               s->eqcr.available += diff;
+               if (!diff)
+                       return 0;
+       }
+
+       eqcr_pi = s->eqcr.pi;
+       num_enqueued = (s->eqcr.available < num_frames) ?
+                       s->eqcr.available : num_frames;
+       s->eqcr.available -= num_enqueued;
+       /* Fill in the EQCR ring */
+       for (i = 0; i < num_enqueued; i++) {
+               p = qbman_cena_write_start_wo_shadow(&s->sys,
+                                       QBMAN_CENA_SWP_EQCR(eqcr_pi & 7));
+               memcpy(&p[1], &cl[1], 28);
+               memcpy(&p[8], &fd[i], sizeof(*fd));
+               eqcr_pi++;
+               eqcr_pi &= 0xF;
+               /*Pointing to the next enqueue descriptor*/
+               cl += (sizeof(struct qbman_eq_desc) / sizeof(uint32_t));
+       }
+
+       lwsync();
+
+       /* Set the verb byte, have to substitute in the valid-bit */
+       eqcr_pi = s->eqcr.pi;
+       cl = qb_cl(d);
+       for (i = 0; i < num_enqueued; i++) {
+               p = qbman_cena_write_start_wo_shadow(&s->sys,
+                                       QBMAN_CENA_SWP_EQCR(eqcr_pi & 7));
+               p[0] = cl[0] | s->eqcr.pi_vb;
+               eqcr_pi++;
+               eqcr_pi &= 0xF;
+               if (!(eqcr_pi & 7))
+                       s->eqcr.pi_vb ^= QB_VALID_BIT;
+               /*Pointing to the next enqueue descriptor*/
+               cl += (sizeof(struct qbman_eq_desc) / sizeof(uint32_t));
+       }
+
+       /* Flush all the cacheline without load/store in between */
+       eqcr_pi = s->eqcr.pi;
+       addr_cena = (uint64_t)s->sys.addr_cena;
+       for (i = 0; i < num_enqueued; i++) {
+               dcbf((uint64_t *)(addr_cena +
+                               QBMAN_CENA_SWP_EQCR(eqcr_pi & 7)));
+               eqcr_pi++;
+               eqcr_pi &= 0xF;
+       }
+       s->eqcr.pi = eqcr_pi;
+
+       return num_enqueued;
+}
+
 /*************************/
 /* Static (push) dequeue */
 /*************************/
@@ -707,7 +795,7 @@ int qbman_swp_pull(struct qbman_swp *s, struct qbman_pull_desc *d)
         */
        qb_attr_code_encode(&code_pull_token, cl, s->desc.idx + 1);
        p = qbman_cena_write_start_wo_shadow(&s->sys, QBMAN_CENA_SWP_VDQCR);
-       word_copy(&p[1], &cl[1], 3);
+       memcpy(&p[1], &cl[1], 12);
        /* Set the verb byte, have to substitute in the valid-bit */
        lwsync();
        p[0] = cl[0] | s->vdq.valid_bit;
@@ -1393,7 +1481,7 @@ int qbman_swp_CDAN_set_context_enable(struct qbman_swp *s, uint16_t channelid,
                                  1, ctx);
 }
 
-uint8_t qbman_get_dqrr_idx(struct qbman_result *dqrr)
+uint8_t qbman_get_dqrr_idx(const struct qbman_result *dqrr)
 {
        return QBMAN_IDX_FROM_DQRR(dqrr);
 }
@@ -1489,8 +1577,3 @@ done:
 
        return sent;
 }
-
-int qbman_get_version(void)
-{
-       return qman_version;
-}