Lines Matching refs:seq

198 	struct asd_seq_data *seq = &asd_ha->seq;  in asd_init_scbs()  local
202 asd_ha->seq.tc_index_bitmap_bits = asd_ha->hw_prof.max_scbs; in asd_init_scbs()
203 asd_ha->seq.tc_index_array = kcalloc(asd_ha->seq.tc_index_bitmap_bits, in asd_init_scbs()
206 if (!asd_ha->seq.tc_index_array) in asd_init_scbs()
209 bitmap_bytes = (asd_ha->seq.tc_index_bitmap_bits+7)/8; in asd_init_scbs()
211 asd_ha->seq.tc_index_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL); in asd_init_scbs()
212 if (!asd_ha->seq.tc_index_bitmap) { in asd_init_scbs()
213 kfree(asd_ha->seq.tc_index_array); in asd_init_scbs()
214 asd_ha->seq.tc_index_array = NULL; in asd_init_scbs()
218 spin_lock_init(&seq->tc_index_lock); in asd_init_scbs()
220 seq->next_scb.size = sizeof(struct scb); in asd_init_scbs()
221 seq->next_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool, GFP_KERNEL, in asd_init_scbs()
222 &seq->next_scb.dma_handle); in asd_init_scbs()
223 if (!seq->next_scb.vaddr) { in asd_init_scbs()
224 kfree(asd_ha->seq.tc_index_bitmap); in asd_init_scbs()
225 kfree(asd_ha->seq.tc_index_array); in asd_init_scbs()
226 asd_ha->seq.tc_index_bitmap = NULL; in asd_init_scbs()
227 asd_ha->seq.tc_index_array = NULL; in asd_init_scbs()
231 seq->pending = 0; in asd_init_scbs()
232 spin_lock_init(&seq->pend_q_lock); in asd_init_scbs()
233 INIT_LIST_HEAD(&seq->pend_q); in asd_init_scbs()
253 asd_ha->seq.actual_dl in asd_init_dl()
257 if (!asd_ha->seq.actual_dl) in asd_init_dl()
259 asd_ha->seq.dl = asd_ha->seq.actual_dl->vaddr; in asd_init_dl()
260 asd_ha->seq.dl_toggle = ASD_DEF_DL_TOGGLE; in asd_init_dl()
261 asd_ha->seq.dl_next = 0; in asd_init_dl()
262 tasklet_init(&asd_ha->seq.dl_tasklet, asd_dl_tasklet_handler, in asd_init_dl()
272 struct asd_seq_data *seq = &asd_ha->seq; in asd_alloc_edbs() local
275 seq->edb_arr = kmalloc_array(seq->num_edbs, sizeof(*seq->edb_arr), in asd_alloc_edbs()
277 if (!seq->edb_arr) in asd_alloc_edbs()
280 for (i = 0; i < seq->num_edbs; i++) { in asd_alloc_edbs()
281 seq->edb_arr[i] = asd_alloc_coherent(asd_ha, ASD_EDB_SIZE, in asd_alloc_edbs()
283 if (!seq->edb_arr[i]) in asd_alloc_edbs()
285 memset(seq->edb_arr[i]->vaddr, 0, ASD_EDB_SIZE); in asd_alloc_edbs()
288 ASD_DPRINTK("num_edbs:%d\n", seq->num_edbs); in asd_alloc_edbs()
294 asd_free_coherent(asd_ha, seq->edb_arr[i]); in asd_alloc_edbs()
295 kfree(seq->edb_arr); in asd_alloc_edbs()
296 seq->edb_arr = NULL; in asd_alloc_edbs()
304 struct asd_seq_data *seq = &asd_ha->seq; in asd_alloc_escbs() local
308 seq->escb_arr = kmalloc_array(seq->num_escbs, sizeof(*seq->escb_arr), in asd_alloc_escbs()
310 if (!seq->escb_arr) in asd_alloc_escbs()
313 escbs = seq->num_escbs; in asd_alloc_escbs()
319 seq->num_escbs -= escbs; /* subtract what was not allocated */ in asd_alloc_escbs()
320 ASD_DPRINTK("num_escbs:%d\n", seq->num_escbs); in asd_alloc_escbs()
322 for (i = 0; i < seq->num_escbs; i++, escb = list_entry(escb->list.next, in asd_alloc_escbs()
325 seq->escb_arr[i] = escb; in asd_alloc_escbs()
331 kfree(seq->escb_arr); in asd_alloc_escbs()
332 seq->escb_arr = NULL; in asd_alloc_escbs()
339 struct asd_seq_data *seq = &asd_ha->seq; in asd_assign_edbs2escbs() local
342 for (i = 0; i < seq->num_escbs; i++) { in asd_assign_edbs2escbs()
343 struct asd_ascb *ascb = seq->escb_arr[i]; in asd_assign_edbs2escbs()
352 struct asd_dma_tok *edb = seq->edb_arr[z++]; in asd_assign_edbs2escbs()
370 struct asd_seq_data *seq = &asd_ha->seq; in asd_init_escbs() local
376 seq->num_escbs = (edbs+ASD_EDBS_PER_SCB-1)/ASD_EDBS_PER_SCB; in asd_init_escbs()
377 seq->num_edbs = seq->num_escbs * ASD_EDBS_PER_SCB; in asd_init_escbs()
397 seq->pending = seq->num_escbs; in asd_init_escbs()
398 seq->can_queue = 1 + (asd_ha->hw_prof.max_scbs - seq->pending)/2; in asd_init_escbs()
715 struct asd_seq_data *seq = &asd_ha->seq; in asd_dl_tasklet_handler() local
719 struct done_list_struct *dl = &seq->dl[seq->dl_next]; in asd_dl_tasklet_handler()
722 if ((dl->toggle & DL_TOGGLE_MASK) != seq->dl_toggle) in asd_dl_tasklet_handler()
726 spin_lock_irqsave(&seq->tc_index_lock, flags); in asd_dl_tasklet_handler()
727 ascb = asd_tc_index_find(seq, (int)le16_to_cpu(dl->index)); in asd_dl_tasklet_handler()
728 spin_unlock_irqrestore(&seq->tc_index_lock, flags); in asd_dl_tasklet_handler()
737 spin_lock_irqsave(&seq->pend_q_lock, flags); in asd_dl_tasklet_handler()
739 seq->pending--; in asd_dl_tasklet_handler()
740 spin_unlock_irqrestore(&seq->pend_q_lock, flags); in asd_dl_tasklet_handler()
745 seq->dl_next = (seq->dl_next + 1) & (ASD_DL_SIZE-1); in asd_dl_tasklet_handler()
746 if (!seq->dl_next) in asd_dl_tasklet_handler()
747 seq->dl_toggle ^= DL_TOGGLE_MASK; in asd_dl_tasklet_handler()
759 tasklet_schedule(&asd_ha->seq.dl_tasklet); in asd_process_donelist_isr()
1032 struct asd_seq_data *seq = &asd_ha->seq; in asd_ascb_alloc() local
1049 spin_lock_irqsave(&seq->tc_index_lock, flags); in asd_ascb_alloc()
1050 ascb->tc_index = asd_tc_index_get(seq, ascb); in asd_ascb_alloc()
1051 spin_unlock_irqrestore(&seq->tc_index_lock, flags); in asd_ascb_alloc()
1130 struct asd_seq_data *seq = &asd_ha->seq; in asd_swap_head_scb() local
1136 memcpy(seq->next_scb.vaddr, ascb->scb, sizeof(*ascb->scb)); in asd_swap_head_scb()
1137 ascb->dma_scb = seq->next_scb; in asd_swap_head_scb()
1139 seq->next_scb = t; in asd_swap_head_scb()
1141 cpu_to_le64(((u64)seq->next_scb.dma_handle)); in asd_swap_head_scb()
1191 spin_lock_irqsave(&asd_ha->seq.pend_q_lock, flags); in asd_post_ascb_list()
1192 can_queue = asd_ha->hw_prof.max_scbs - asd_ha->seq.pending; in asd_post_ascb_list()
1194 asd_ha->seq.pending += num; in asd_post_ascb_list()
1199 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); in asd_post_ascb_list()
1210 asd_ha->seq.scbpro += num; in asd_post_ascb_list()
1211 list_splice_init(&list, asd_ha->seq.pend_q.prev); in asd_post_ascb_list()
1212 asd_write_reg_dword(asd_ha, SCBPRO, (u32)asd_ha->seq.scbpro); in asd_post_ascb_list()
1213 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); in asd_post_ascb_list()
1241 spin_lock_irqsave(&asd_ha->seq.pend_q_lock, flags); in asd_post_escb_list()
1243 asd_ha->seq.scbpro += num; in asd_post_escb_list()
1244 asd_write_reg_dword(asd_ha, SCBPRO, (u32)asd_ha->seq.scbpro); in asd_post_escb_list()
1245 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); in asd_post_escb_list()