Lines Matching refs:ha

15 qla4xxx_space_in_req_ring(struct scsi_qla_host *ha, uint16_t req_cnt)  in qla4xxx_space_in_req_ring()  argument
20 if ((req_cnt + 2) >= ha->req_q_count) { in qla4xxx_space_in_req_ring()
21 cnt = (uint16_t) ha->isp_ops->rd_shdw_req_q_out(ha); in qla4xxx_space_in_req_ring()
22 if (ha->request_in < cnt) in qla4xxx_space_in_req_ring()
23 ha->req_q_count = cnt - ha->request_in; in qla4xxx_space_in_req_ring()
25 ha->req_q_count = REQUEST_QUEUE_DEPTH - in qla4xxx_space_in_req_ring()
26 (ha->request_in - cnt); in qla4xxx_space_in_req_ring()
30 if ((req_cnt + 2) < ha->req_q_count) in qla4xxx_space_in_req_ring()
36 static void qla4xxx_advance_req_ring_ptr(struct scsi_qla_host *ha) in qla4xxx_advance_req_ring_ptr() argument
39 if (ha->request_in == (REQUEST_QUEUE_DEPTH - 1)) { in qla4xxx_advance_req_ring_ptr()
40 ha->request_in = 0; in qla4xxx_advance_req_ring_ptr()
41 ha->request_ptr = ha->request_ring; in qla4xxx_advance_req_ring_ptr()
43 ha->request_in++; in qla4xxx_advance_req_ring_ptr()
44 ha->request_ptr++; in qla4xxx_advance_req_ring_ptr()
58 static int qla4xxx_get_req_pkt(struct scsi_qla_host *ha, in qla4xxx_get_req_pkt() argument
63 if (qla4xxx_space_in_req_ring(ha, req_cnt)) { in qla4xxx_get_req_pkt()
64 *queue_entry = ha->request_ptr; in qla4xxx_get_req_pkt()
67 qla4xxx_advance_req_ring_ptr(ha); in qla4xxx_get_req_pkt()
68 ha->req_q_count -= req_cnt; in qla4xxx_get_req_pkt()
84 int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, in qla4xxx_send_marker_iocb() argument
92 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_send_marker_iocb()
95 if (qla4xxx_get_req_pkt(ha, (struct queue_entry **) &marker_entry) != in qla4xxx_send_marker_iocb()
110 ha->isp_ops->queue_iocb(ha); in qla4xxx_send_marker_iocb()
113 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_send_marker_iocb()
118 qla4xxx_alloc_cont_entry(struct scsi_qla_host *ha) in qla4xxx_alloc_cont_entry() argument
122 cont_entry = (struct continuation_t1_entry *)ha->request_ptr; in qla4xxx_alloc_cont_entry()
124 qla4xxx_advance_req_ring_ptr(ha); in qla4xxx_alloc_cont_entry()
129 cont_entry->hdr.systemDefined = (uint8_t) cpu_to_le16(ha->request_in); in qla4xxx_alloc_cont_entry()
151 struct scsi_qla_host *ha; in qla4xxx_build_scsi_iocbs() local
159 ha = srb->ha; in qla4xxx_build_scsi_iocbs()
177 cont_entry = qla4xxx_alloc_cont_entry(ha); in qla4xxx_build_scsi_iocbs()
194 void qla4_83xx_queue_iocb(struct scsi_qla_host *ha) in qla4_83xx_queue_iocb() argument
196 writel(ha->request_in, &ha->qla4_83xx_reg->req_q_in); in qla4_83xx_queue_iocb()
197 readl(&ha->qla4_83xx_reg->req_q_in); in qla4_83xx_queue_iocb()
200 void qla4_83xx_complete_iocb(struct scsi_qla_host *ha) in qla4_83xx_complete_iocb() argument
202 writel(ha->response_out, &ha->qla4_83xx_reg->rsp_q_out); in qla4_83xx_complete_iocb()
203 readl(&ha->qla4_83xx_reg->rsp_q_out); in qla4_83xx_complete_iocb()
213 void qla4_82xx_queue_iocb(struct scsi_qla_host *ha) in qla4_82xx_queue_iocb() argument
217 dbval = 0x14 | (ha->func_num << 5); in qla4_82xx_queue_iocb()
218 dbval = dbval | (0 << 8) | (ha->request_in << 16); in qla4_82xx_queue_iocb()
220 qla4_82xx_wr_32(ha, ha->nx_db_wr_ptr, ha->request_in); in qla4_82xx_queue_iocb()
231 void qla4_82xx_complete_iocb(struct scsi_qla_host *ha) in qla4_82xx_complete_iocb() argument
233 writel(ha->response_out, &ha->qla4_82xx_reg->rsp_q_out); in qla4_82xx_complete_iocb()
234 readl(&ha->qla4_82xx_reg->rsp_q_out); in qla4_82xx_complete_iocb()
244 void qla4xxx_queue_iocb(struct scsi_qla_host *ha) in qla4xxx_queue_iocb() argument
246 writel(ha->request_in, &ha->reg->req_q_in); in qla4xxx_queue_iocb()
247 readl(&ha->reg->req_q_in); in qla4xxx_queue_iocb()
258 void qla4xxx_complete_iocb(struct scsi_qla_host *ha) in qla4xxx_complete_iocb() argument
260 writel(ha->response_out, &ha->reg->rsp_q_out); in qla4xxx_complete_iocb()
261 readl(&ha->reg->rsp_q_out); in qla4xxx_complete_iocb()
272 int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb) in qla4xxx_send_command_to_isp() argument
289 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_send_command_to_isp()
299 if (!test_bit(AF_ONLINE, &ha->flags)) { in qla4xxx_send_command_to_isp()
302 ha->host_no, __func__)); in qla4xxx_send_command_to_isp()
313 if (!qla4xxx_space_in_req_ring(ha, req_cnt)) in qla4xxx_send_command_to_isp()
317 if ((ha->iocb_cnt + req_cnt) >= ha->iocb_hiwat) in qla4xxx_send_command_to_isp()
321 cmd_entry = (struct command_t3_entry *) ha->request_ptr; in qla4xxx_send_command_to_isp()
344 ha->bytes_xfered += scsi_bufflen(cmd); in qla4xxx_send_command_to_isp()
345 if (ha->bytes_xfered & ~0xFFFFF){ in qla4xxx_send_command_to_isp()
346 ha->total_mbytes_xferred += ha->bytes_xfered >> 20; in qla4xxx_send_command_to_isp()
347 ha->bytes_xfered &= 0xFFFFF; in qla4xxx_send_command_to_isp()
354 qla4xxx_advance_req_ring_ptr(ha); in qla4xxx_send_command_to_isp()
365 ha->iocb_cnt += req_cnt; in qla4xxx_send_command_to_isp()
367 ha->req_q_count -= req_cnt; in qla4xxx_send_command_to_isp()
369 ha->isp_ops->queue_iocb(ha); in qla4xxx_send_command_to_isp()
370 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_send_command_to_isp()
378 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_send_command_to_isp()
388 struct scsi_qla_host *ha = ddb_entry->ha; in qla4xxx_send_passthru0() local
394 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_send_passthru0()
397 if (!qla4xxx_space_in_req_ring(ha, task_data->iocb_req_cnt)) in qla4xxx_send_passthru0()
400 passthru_iocb = (struct passthru0 *) ha->request_ptr; in qla4xxx_send_passthru0()
436 qla4xxx_advance_req_ring_ptr(ha); in qla4xxx_send_passthru0()
440 ha->iocb_cnt += task_data->iocb_req_cnt; in qla4xxx_send_passthru0()
441 ha->req_q_count -= task_data->iocb_req_cnt; in qla4xxx_send_passthru0()
442 ha->isp_ops->queue_iocb(ha); in qla4xxx_send_passthru0()
446 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_send_passthru0()
450 static struct mrb *qla4xxx_get_new_mrb(struct scsi_qla_host *ha) in qla4xxx_get_new_mrb() argument
458 mrb->ha = ha; in qla4xxx_get_new_mrb()
462 static int qla4xxx_send_mbox_iocb(struct scsi_qla_host *ha, struct mrb *mrb, in qla4xxx_send_mbox_iocb() argument
471 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_send_mbox_iocb()
474 rval = qla4xxx_get_req_pkt(ha, (struct queue_entry **) &(mrb->mbox)); in qla4xxx_send_mbox_iocb()
478 index = ha->mrb_index; in qla4xxx_send_mbox_iocb()
484 if (ha->active_mrb_array[index] == NULL) { in qla4xxx_send_mbox_iocb()
485 ha->mrb_index = index; in qla4xxx_send_mbox_iocb()
491 ha->active_mrb_array[index] = mrb; in qla4xxx_send_mbox_iocb()
499 ha->iocb_cnt += mrb->iocb_cnt; in qla4xxx_send_mbox_iocb()
500 ha->isp_ops->queue_iocb(ha); in qla4xxx_send_mbox_iocb()
502 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_send_mbox_iocb()
506 int qla4xxx_ping_iocb(struct scsi_qla_host *ha, uint32_t options, in qla4xxx_ping_iocb() argument
515 mrb = qla4xxx_get_new_mrb(ha); in qla4xxx_ping_iocb()
517 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: fail to get new mrb\n", in qla4xxx_ping_iocb()
532 rval = qla4xxx_send_mbox_iocb(ha, mrb, in_mbox); in qla4xxx_ping_iocb()