Lines Matching full:queue
50 * zip_cmd_queue_consumed - Calculates the space consumed in the command queue.
53 * @queue: Queue number
55 * Return: Bytes consumed in the command queue buffer.
57 static inline u32 zip_cmd_queue_consumed(struct zip_device *zip_dev, int queue) in zip_cmd_queue_consumed() argument
59 return ((zip_dev->iq[queue].sw_head - zip_dev->iq[queue].sw_tail) * in zip_cmd_queue_consumed()
64 * zip_load_instr - Submits the instruction into the ZIP command queue
69 * This function copies the ZIP instruction to the command queue and rings the
71 * queue is maintained in a circular fashion. When there is space for exactly
72 * one instruction in the queue, next chunk pointer of the queue is made to
73 * point to the head of the queue, thus maintaining a circular queue.
75 * Return: Queue number to which the instruction was submitted
81 u32 queue = 0; in zip_load_instr() local
91 queue = 0; in zip_load_instr()
93 queue = 1; in zip_load_instr()
95 zip_dbg("CPU Core: %d Queue number:%d", raw_smp_processor_id(), queue); in zip_load_instr()
98 spin_lock(&zip_dev->iq[queue].lock); in zip_load_instr()
101 * Command Queue implementation in zip_load_instr()
109 zip_dbg("sw_head : %lx", zip_dev->iq[queue].sw_head); in zip_load_instr()
110 zip_dbg("sw_tail : %lx", zip_dev->iq[queue].sw_tail); in zip_load_instr()
112 consumed = zip_cmd_queue_consumed(zip_dev, queue); in zip_load_instr()
115 zip_dbg("Cmd queue space available for single command"); in zip_load_instr()
116 /* Space for one cmd, pust it and make it circular queue */ in zip_load_instr()
117 memcpy((u8 *)zip_dev->iq[queue].sw_head, (u8 *)instr, in zip_load_instr()
119 zip_dev->iq[queue].sw_head += 16; /* 16 64_bit words = 128B */ in zip_load_instr()
122 ncb_ptr = zip_dev->iq[queue].sw_head; in zip_load_instr()
125 ncb_ptr, zip_dev->iq[queue].sw_head - 16); in zip_load_instr()
127 /* Using Circular command queue */ in zip_load_instr()
128 zip_dev->iq[queue].sw_head = zip_dev->iq[queue].sw_tail; in zip_load_instr()
130 zip_dev->iq[queue].free_flag = 1; in zip_load_instr()
134 ncp.s.addr = __pa(zip_dev->iq[queue].sw_head); in zip_load_instr()
137 *ncb_ptr, __pa(zip_dev->iq[queue].sw_head)); in zip_load_instr()
139 zip_dev->iq[queue].pend_cnt++; in zip_load_instr()
143 /* Push this cmd to cmd queue buffer */ in zip_load_instr()
144 memcpy((u8 *)zip_dev->iq[queue].sw_head, (u8 *)instr, in zip_load_instr()
146 zip_dev->iq[queue].sw_head += 16; /* 16 64_bit words = 128B */ in zip_load_instr()
148 zip_dev->iq[queue].pend_cnt++; in zip_load_instr()
151 zip_dev->iq[queue].sw_head, zip_dev->iq[queue].sw_tail, in zip_load_instr()
152 zip_dev->iq[queue].hw_tail); in zip_load_instr()
155 zip_dev->iq[queue].pend_cnt); in zip_load_instr()
161 (zip_dev->reg_base + ZIP_QUEX_DOORBELL(queue))); in zip_load_instr()
164 spin_unlock(&zip_dev->iq[queue].lock); in zip_load_instr()
166 return queue; in zip_load_instr()
170 * zip_update_cmd_bufs - Updates the queue statistics after posting the
173 * @queue: Queue number
175 void zip_update_cmd_bufs(struct zip_device *zip_dev, u32 queue) in zip_update_cmd_bufs() argument
178 spin_lock(&zip_dev->iq[queue].lock); in zip_update_cmd_bufs()
181 if (zip_dev->iq[queue].free_flag == 1) { in zip_update_cmd_bufs()
184 zip_dev->iq[queue].free_flag = 0; in zip_update_cmd_bufs()
187 zip_dev->iq[queue].hw_tail = zip_dev->iq[queue].sw_head; in zip_update_cmd_bufs()
190 zip_dev->iq[queue].hw_tail += 16; /* 16 64_bit words = 128B */ in zip_update_cmd_bufs()
193 zip_dev->iq[queue].done_cnt++; in zip_update_cmd_bufs()
194 zip_dev->iq[queue].pend_cnt--; in zip_update_cmd_bufs()
197 zip_dev->iq[queue].sw_head, zip_dev->iq[queue].sw_tail, in zip_update_cmd_bufs()
198 zip_dev->iq[queue].hw_tail); in zip_update_cmd_bufs()
199 zip_dbg(" Got CC : pend_cnt : %d\n", zip_dev->iq[queue].pend_cnt); in zip_update_cmd_bufs()
201 spin_unlock(&zip_dev->iq[queue].lock); in zip_update_cmd_bufs()