33 #include <linux/kernel.h>
58 char *alloc_name =
"cvmx_cmd_queues";
59 #if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
60 extern uint64_t octeon_reserve32_memory;
63 if (
likely(__cvmx_cmd_queue_state_ptr))
66 #if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
67 if (octeon_reserve32_memory)
68 __cvmx_cmd_queue_state_ptr =
70 octeon_reserve32_memory,
71 octeon_reserve32_memory +
73 20) - 1, 128, alloc_name);
76 __cvmx_cmd_queue_state_ptr =
80 if (__cvmx_cmd_queue_state_ptr)
81 memset(__cvmx_cmd_queue_state_ptr, 0,
82 sizeof(*__cvmx_cmd_queue_state_ptr));
87 __cvmx_cmd_queue_state_ptr =
91 (
"ERROR: cvmx_cmd_queue_initialize: Unable to get named block %s.\n",
112 int max_depth,
int fpa_pool,
120 qstate = __cvmx_cmd_queue_get_state(queue_id);
129 if ((max_depth < 0) || (max_depth > 1 << 20))
131 }
else if (max_depth != 0)
134 if ((fpa_pool < 0) || (fpa_pool > 7))
136 if ((pool_size < 128) || (pool_size > 65536))
141 if (max_depth != (
int)qstate->
max_depth) {
143 "Queue already initialized with different "
150 "Queue already initialized with different "
157 "Queue already initialized with different "
158 "FPA pool size (%u).\n",
171 "FPA is not enabled.\n");
174 buffer = cvmx_fpa_alloc(fpa_pool);
175 if (buffer ==
NULL) {
177 "Unable to allocate initial buffer.\n");
181 memset(qstate, 0,
sizeof(*qstate));
190 __cvmx_cmd_queue_state_ptr->
191 ticket[__cvmx_cmd_queue_get_index(queue_id)] = 0;
210 cvmx_dprintf(
"ERROR: cvmx_cmd_queue_shutdown: Unable to "
211 "get queue information.\n");
216 cvmx_dprintf(
"ERROR: cvmx_cmd_queue_shutdown: Queue still "
217 "has data in it.\n");
221 __cvmx_cmd_queue_lock(queue_id, qptr);
223 cvmx_fpa_free(cvmx_phys_to_ptr
228 __cvmx_cmd_queue_unlock(qptr);
244 if (__cvmx_cmd_queue_get_state(queue_id) ==
NULL)
264 return debug9.
cn38xx.doorbell;
268 return debug8.
cn58xx.doorbell;
281 return dmax_counts.
s.dbell;