Lines Matching full:jr

11 #include "jr.h"
77 struct jobring *jr = &jr0[sec_idx]; in jr_initregs() local
78 phys_addr_t ip_base = virt_to_phys((void *)jr->input_ring); in jr_initregs()
79 phys_addr_t op_base = virt_to_phys((void *)jr->output_ring); in jr_initregs()
96 if (!jr->irq) in jr_initregs()
102 struct jobring *jr = &jr0[sec_idx]; in jr_init() local
104 memset(jr, 0, sizeof(struct jobring)); in jr_init()
106 jr->jq_id = DEFAULT_JR_ID; in jr_init()
107 jr->irq = DEFAULT_IRQ; in jr_init()
110 jr->liodn = DEFAULT_JR_LIODN; in jr_init()
112 jr->size = JR_SIZE; in jr_init()
113 jr->input_ring = (dma_addr_t *)memalign(ARCH_DMA_MINALIGN, in jr_init()
115 if (!jr->input_ring) in jr_init()
118 jr->op_size = roundup(JR_SIZE * sizeof(struct op_ring), in jr_init()
120 jr->output_ring = in jr_init()
121 (struct op_ring *)memalign(ARCH_DMA_MINALIGN, jr->op_size); in jr_init()
122 if (!jr->output_ring) in jr_init()
125 memset(jr->input_ring, 0, JR_SIZE * sizeof(dma_addr_t)); in jr_init()
126 memset(jr->output_ring, 0, jr->op_size); in jr_init()
137 struct jobring *jr = &jr0[sec_idx]; in jr_sw_cleanup() local
139 jr->head = 0; in jr_sw_cleanup()
140 jr->tail = 0; in jr_sw_cleanup()
141 jr->read_idx = 0; in jr_sw_cleanup()
142 jr->write_idx = 0; in jr_sw_cleanup()
143 memset(jr->info, 0, sizeof(jr->info)); in jr_sw_cleanup()
144 memset(jr->input_ring, 0, jr->size * sizeof(dma_addr_t)); in jr_sw_cleanup()
145 memset(jr->output_ring, 0, jr->size * sizeof(struct op_ring)); in jr_sw_cleanup()
185 struct jobring *jr = &jr0[sec_idx]; in jr_enqueue() local
186 int head = jr->head; in jr_enqueue()
206 jr->info[head].desc_phys_addr = desc_phys_addr; in jr_enqueue()
207 jr->info[head].callback = (void *)callback; in jr_enqueue()
208 jr->info[head].arg = arg; in jr_enqueue()
209 jr->info[head].op_done = 0; in jr_enqueue()
211 unsigned long start = (unsigned long)&jr->info[head] & in jr_enqueue()
213 unsigned long end = ALIGN((unsigned long)&jr->info[head] + in jr_enqueue()
223 addr_lo = (uint32_t *)(&jr->input_ring[head]); in jr_enqueue()
224 addr_hi = (uint32_t *)(&jr->input_ring[head]) + 1; in jr_enqueue()
226 addr_hi = (uint32_t *)(&jr->input_ring[head]); in jr_enqueue()
227 addr_lo = (uint32_t *)(&jr->input_ring[head]) + 1; in jr_enqueue()
235 sec_out32(&jr->input_ring[head], desc_phys_addr); in jr_enqueue()
238 start = (unsigned long)&jr->input_ring[head] & ~(ARCH_DMA_MINALIGN - 1); in jr_enqueue()
239 end = ALIGN((unsigned long)&jr->input_ring[head] + in jr_enqueue()
243 jr->head = (head + 1) & (jr->size - 1); in jr_enqueue()
246 start = (unsigned long)jr->output_ring & in jr_enqueue()
248 end = ALIGN((unsigned long)jr->output_ring + jr->op_size, in jr_enqueue()
260 struct jobring *jr = &jr0[sec_idx]; in jr_dequeue() local
261 int head = jr->head; in jr_dequeue()
262 int tail = jr->tail; in jr_dequeue()
272 while (sec_in32(&regs->orsf) && CIRC_CNT(jr->head, jr->tail, in jr_dequeue()
273 jr->size)) { in jr_dequeue()
284 addr_lo = (uint32_t *)(&jr->output_ring[jr->tail].desc); in jr_dequeue()
285 addr_hi = (uint32_t *)(&jr->output_ring[jr->tail].desc) + 1; in jr_dequeue()
287 addr_hi = (uint32_t *)(&jr->output_ring[jr->tail].desc); in jr_dequeue()
288 addr_lo = (uint32_t *)(&jr->output_ring[jr->tail].desc) + 1; in jr_dequeue()
296 addr = (uint32_t *)&jr->output_ring[jr->tail].desc; in jr_dequeue()
300 uint32_t status = sec_in32(&jr->output_ring[jr->tail].status); in jr_dequeue()
302 for (i = 0; CIRC_CNT(head, tail + i, jr->size) >= 1; i++) { in jr_dequeue()
303 idx = (tail + i) & (jr->size - 1); in jr_dequeue()
304 if (op_desc == jr->info[idx].desc_phys_addr) { in jr_dequeue()
314 jr->info[idx].op_done = 1; in jr_dequeue()
315 callback = (void *)jr->info[idx].callback; in jr_dequeue()
316 arg = jr->info[idx].arg; in jr_dequeue()
324 tail = (tail + 1) & (jr->size - 1); in jr_dequeue()
325 } while (jr->info[tail].op_done); in jr_dequeue()
327 jr->tail = tail; in jr_dequeue()
328 jr->read_idx = (jr->read_idx + 1) & (jr->size - 1); in jr_dequeue()
331 jr->info[idx].op_done = 0; in jr_dequeue()