74 #ifndef __CVMX_CMD_QUEUE_H__
75 #define __CVMX_CMD_QUEUE_H__
77 #include <linux/prefetch.h>
85 #ifndef CVMX_CMD_QUEUE_ENABLE_MAX_DEPTH
86 #define CVMX_CMD_QUEUE_ENABLE_MAX_DEPTH 0
98 #define CVMX_CMD_QUEUE_PKO(queue) \
99 ((cvmx_cmd_queue_id_t)(CVMX_CMD_QUEUE_PKO_BASE + (0xffff&(queue))))
106 #define CVMX_CMD_QUEUE_DMA(queue) \
107 ((cvmx_cmd_queue_id_t)(CVMX_CMD_QUEUE_DMA_BASE + (0xffff&(queue))))
169 int max_depth,
int fpa_pool,
221 int unit = queue_id >> 16;
222 int q = (queue_id >> 4) & 0xf;
223 int core = queue_id & 0xf;
224 return unit * 256 + core * 16 +
q;
247 "ll %[my_ticket], %[ticket_ptr]\n"
251 "baddu %[ticket], %[my_ticket]\n"
252 "sc %[ticket], %[ticket_ptr]\n"
253 "beqz %[ticket], 1b\n"
256 "lbu %[ticket], %[now_serving]\n"
259 "beq %[ticket], %[my_ticket], 4f\n"
261 " subu %[ticket], %[my_ticket], %[ticket]\n"
263 "subu %[ticket], 1\n"
265 "cins %[ticket], %[ticket], 5, 7\n"
268 "bnez %[ticket], 3b\n"
269 " subu %[ticket], 1\n"
273 " lbu %[ticket], %[now_serving]\n"
276 [ticket_ptr]
"=m"(__cvmx_cmd_queue_state_ptr->
ticket[__cvmx_cmd_queue_get_index(queue_id)]),
278 [my_ticket]
"=r"(my_ticket)
305 return &__cvmx_cmd_queue_state_ptr->
306 state[__cvmx_cmd_queue_get_index(queue_id)];
334 __cvmx_cmd_queue_lock(queue_id, qptr);
345 __cvmx_cmd_queue_unlock(qptr);
354 if (
likely(qptr->
index + cmd_count < qptr->pool_size_m1)) {
357 base_ptr_div128 << 7);
359 qptr->
index += cmd_count;
373 __cvmx_cmd_queue_unlock(qptr);
378 base_ptr_div128 << 7);
389 *ptr = cvmx_ptr_to_phys(new_buffer);
396 qptr->
index = cmd_count;
404 __cvmx_cmd_queue_unlock(qptr);
432 __cvmx_cmd_queue_lock(queue_id, qptr);
443 __cvmx_cmd_queue_unlock(qptr);
455 base_ptr_div128 << 7);
476 __cvmx_cmd_queue_unlock(qptr);
482 base_ptr_div128 << 7);
487 *ptr = cvmx_ptr_to_phys(new_buffer);
497 new_buffer[0] = cmd2;
503 __cvmx_cmd_queue_unlock(qptr);
533 __cvmx_cmd_queue_lock(queue_id, qptr);
544 __cvmx_cmd_queue_unlock(qptr);
556 base_ptr_div128 << 7);
578 __cvmx_cmd_queue_unlock(qptr);
584 base_ptr_div128 << 7);
592 *ptr = cvmx_ptr_to_phys(new_buffer);
613 __cvmx_cmd_queue_unlock(qptr);