int gxio_mpipe_equeue_init(gxio_mpipe_equeue_t *equeue, gxio_mpipe_context_t *context, unsigned int ering, unsigned int channel, void *mem, unsigned int mem_size, unsigned int mem_flags) { /* The init call below will verify that "mem_size" is legal. */ unsigned int num_entries = mem_size / sizeof(gxio_mpipe_edesc_t); /* Offset used to read number of completed commands. */ MPIPE_EDMA_POST_REGION_ADDR_t offset; int i; unsigned int flags = 0; int result = gxio_mpipe_init_edma_ring(context, ering, channel, mem, mem_size, mem_flags); if (result < 0) return result; memset(equeue, 0, sizeof(*equeue)); offset.word = 0; offset.region = MPIPE_MMIO_ADDR__REGION_VAL_EDMA - MPIPE_MMIO_ADDR__REGION_VAL_IDMA; offset.ring = ering; if (mpipe_mode_flags & GXIO_MPIPE_RHWB) flags |= DMA_QUEUE_EQUEUE_RHWB; equeue->context = context; equeue->other_context = NULL; /* * If there is no other mPIPE instance, disable the Remote Buffer Return. */ if (equeue->other_context == NULL) flags &= ~DMA_QUEUE_EQUEUE_RHWB; __gxio_dma_queue_init(&equeue->dma_queue, context->mmio_fast_base + offset.word, num_entries, flags); equeue->edescs = mem; equeue->mask_num_entries = num_entries - 1; equeue->log2_num_entries = __builtin_ctz(num_entries); equeue->inst_map = (uint_reg_t) equeue->context->instance << EDESC_W1_INST_OFFSET; equeue->ering = ering; equeue->channel = channel; equeue->rhwb_complete_count = 0; for (i = 0; i < 8; i++) equeue->rhwb_complete_bin[i] = 0; return 0; }
int gxio_mpipe_equeue_init(gxio_mpipe_equeue_t *equeue, gxio_mpipe_context_t *context, unsigned int ering, unsigned int channel, void *mem, unsigned int mem_size, unsigned int mem_flags) { /* The init call below will verify that "mem_size" is legal. */ unsigned int num_entries = mem_size / sizeof(gxio_mpipe_edesc_t); /* Offset used to read number of completed commands. */ MPIPE_EDMA_POST_REGION_ADDR_t offset; int result = gxio_mpipe_init_edma_ring(context, ering, channel, mem, mem_size, mem_flags); if (result < 0) return result; memset(equeue, 0, sizeof(*equeue)); offset.word = 0; offset.region = MPIPE_MMIO_ADDR__REGION_VAL_EDMA - MPIPE_MMIO_ADDR__REGION_VAL_IDMA; offset.ring = ering; __gxio_dma_queue_init(&equeue->dma_queue, context->mmio_fast_base + offset.word, num_entries); equeue->edescs = mem; equeue->mask_num_entries = num_entries - 1; equeue->log2_num_entries = __builtin_ctz(num_entries); equeue->context = context; equeue->ering = ering; equeue->channel = channel; return 0; }