/* Helpers for initialising and "incrementing" a frame descriptor */ static void fd_init(struct qm_fd *__fd) { qm_fd_addr_set64(__fd, 0xabdeadbeefLLU); __fd->format = qm_fd_contig_big; __fd->length29 = 7; __fd->cmd = 0xfeedf00d; }
int caam_qi_enqueue(struct device *qidev, struct caam_drv_req *req) { struct qm_fd fd; dma_addr_t addr; int ret; int num_retries = 0; qm_fd_clear_fd(&fd); qm_fd_set_compound(&fd, qm_sg_entry_get_len(&req->fd_sgt[1])); addr = dma_map_single(qidev, req->fd_sgt, sizeof(req->fd_sgt), DMA_BIDIRECTIONAL); if (dma_mapping_error(qidev, addr)) { dev_err(qidev, "DMA mapping error for QI enqueue request\n"); return -EIO; } qm_fd_addr_set64(&fd, addr); do { ret = qman_enqueue(req->drv_ctx->req_fq, &fd); if (likely(!ret)) return 0; if (ret != -EBUSY) break; num_retries++; } while (num_retries < CAAM_QI_ENQUEUE_RETRIES); dev_err(qidev, "qman_enqueue failed: %d\n", ret); return ret; }
void pme_fd_cmd_fcw(struct qm_fd *fd, u8 flags, struct pme_flow *flow, struct pme_hw_residue *residue) { dma_addr_t f; struct pme_cmd_flow_write *fcw = (struct pme_cmd_flow_write *)&fd->cmd; BUG_ON(!flow); BUG_ON((unsigned long)flow & 31); fcw->cmd = pme_cmd_flow_write; fcw->flags = flags; if (flags & PME_CMD_FCW_RES) { if (residue) { dma_addr_t rptr = residue_map(residue); BUG_ON(!residue); BUG_ON((unsigned long)residue & 63); pme_flow_rptr_set64(flow, rptr); } else pme_flow_rptr_set64(flow, 0); } f = flow_map(flow); qm_fd_addr_set64(fd, f); fd->format = qm_fd_contig; fd->offset = 0; fd->length20 = sizeof(*flow); }
static void fd_inc(struct qm_fd *__fd) { u64 t = qm_fd_addr_get64(__fd); int z = t >> 40; t <<= 1; if (z) t |= 1; qm_fd_addr_set64(__fd, t); __fd->length29--; __fd->cmd++; }
void pme_fd_cmd_fcr(struct qm_fd *fd, struct pme_flow *flow) { dma_addr_t f; struct pme_cmd_flow_read *fcr = (struct pme_cmd_flow_read *)&fd->cmd; BUG_ON(!flow); BUG_ON((unsigned long)flow & 31); fcr->cmd = pme_cmd_flow_read; f = flow_map(flow); qm_fd_addr_set64(fd, f); fd->format = qm_fd_contig; fd->offset = 0; fd->length20 = sizeof(*flow); }
static void fd_inc(struct qm_fd *fd) { u64 t = qm_fd_addr_get64(fd); int z = t >> 40; unsigned int len, off; enum qm_fd_format fmt; t <<= 1; if (z) t |= 1; qm_fd_addr_set64(fd, t); fmt = qm_fd_get_format(fd); off = qm_fd_get_offset(fd); len = qm_fd_get_length(fd); len--; qm_fd_set_param(fd, fmt, off, len); fd->cmd = cpu_to_be32(be32_to_cpu(fd->cmd) + 1); }
/* Helpers for initialising and "incrementing" a frame descriptor */ static void fd_init(struct qm_fd *fd) { qm_fd_addr_set64(fd, 0xabdeadbeefLLU); qm_fd_set_contig_big(fd, 0x0000ffff); fd->cmd = cpu_to_be32(0xfeedf00d); }