aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_iocb.c
diff options
context:
space:
mode:
authorVikas Chaudhary <vikas.chaudhary@qlogic.com>2010-07-28 06:23:44 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:04:23 -0400
commitf4f5df23bf72208d0c2f1d8be629839924c2f4c2 (patch)
tree88c41a002e0f9f4470543209047d1111a51a0d06 /drivers/scsi/qla4xxx/ql4_iocb.c
parentdbaf82ece08bf93ae5200f03efd87c4f1fc453f1 (diff)
[SCSI] qla4xxx: Added support for ISP82XX
Signed-off-by: Vikas Chaudhary <Vikas Chaudhary@qlogic.com> Signed-off-by: Karen Higgins <karen.higgins@qlogic.com> Signed-off-by: Ravi Anand <ravi.anand@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_iocb.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c73
1 files changed, 68 insertions, 5 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index e66f3f263f4..f89973deac5 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -108,8 +108,7 @@ int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
108 wmb(); 108 wmb();
109 109
110 /* Tell ISP it's got a new I/O request */ 110 /* Tell ISP it's got a new I/O request */
111 writel(ha->request_in, &ha->reg->req_q_in); 111 ha->isp_ops->queue_iocb(ha);
112 readl(&ha->reg->req_q_in);
113 112
114exit_send_marker: 113exit_send_marker:
115 spin_unlock_irqrestore(&ha->hardware_lock, flags); 114 spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -194,6 +193,72 @@ static void qla4xxx_build_scsi_iocbs(struct srb *srb,
194} 193}
195 194
196/** 195/**
196 * qla4_8xxx_queue_iocb - Tell ISP it's got new request(s)
197 * @ha: pointer to host adapter structure.
198 *
199 * This routine notifies the ISP that one or more new request
200 * queue entries have been placed on the request queue.
201 **/
202void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha)
203{
204 uint32_t dbval = 0;
205 unsigned long wtime;
206
207 dbval = 0x14 | (ha->func_num << 5);
208 dbval = dbval | (0 << 8) | (ha->request_in << 16);
209 writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr);
210 wmb();
211
212 wtime = jiffies + (2 * HZ);
213 while (readl((void __iomem *)ha->nx_db_rd_ptr) != dbval &&
214 !time_after_eq(jiffies, wtime)) {
215 writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr);
216 wmb();
217 }
218}
219
220/**
221 * qla4_8xxx_complete_iocb - Tell ISP we're done with response(s)
222 * @ha: pointer to host adapter structure.
223 *
224 * This routine notifies the ISP that one or more response/completion
225 * queue entries have been processed by the driver.
226 * This also clears the interrupt.
227 **/
228void qla4_8xxx_complete_iocb(struct scsi_qla_host *ha)
229{
230 writel(ha->response_out, &ha->qla4_8xxx_reg->rsp_q_out);
231 readl(&ha->qla4_8xxx_reg->rsp_q_out);
232}
233
234/**
235 * qla4xxx_queue_iocb - Tell ISP it's got new request(s)
236 * @ha: pointer to host adapter structure.
237 *
238 * This routine is notifies the ISP that one or more new request
239 * queue entries have been placed on the request queue.
240 **/
241void qla4xxx_queue_iocb(struct scsi_qla_host *ha)
242{
243 writel(ha->request_in, &ha->reg->req_q_in);
244 readl(&ha->reg->req_q_in);
245}
246
247/**
248 * qla4xxx_complete_iocb - Tell ISP we're done with response(s)
249 * @ha: pointer to host adapter structure.
250 *
251 * This routine is notifies the ISP that one or more response/completion
252 * queue entries have been processed by the driver.
253 * This also clears the interrupt.
254 **/
255void qla4xxx_complete_iocb(struct scsi_qla_host *ha)
256{
257 writel(ha->response_out, &ha->reg->rsp_q_out);
258 readl(&ha->reg->rsp_q_out);
259}
260
261/**
197 * qla4xxx_send_command_to_isp - issues command to HBA 262 * qla4xxx_send_command_to_isp - issues command to HBA
198 * @ha: pointer to host adapter structure. 263 * @ha: pointer to host adapter structure.
199 * @srb: pointer to SCSI Request Block to be sent to ISP 264 * @srb: pointer to SCSI Request Block to be sent to ISP
@@ -310,9 +375,7 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
310 srb->iocb_cnt = req_cnt; 375 srb->iocb_cnt = req_cnt;
311 ha->req_q_count -= req_cnt; 376 ha->req_q_count -= req_cnt;
312 377
313 /* Debug print statements */ 378 ha->isp_ops->queue_iocb(ha);
314 writel(ha->request_in, &ha->reg->req_q_in);
315 readl(&ha->reg->req_q_in);
316 spin_unlock_irqrestore(&ha->hardware_lock, flags); 379 spin_unlock_irqrestore(&ha->hardware_lock, flags);
317 380
318 return QLA_SUCCESS; 381 return QLA_SUCCESS;