initial commit with v2.6.9
[linux-2.6.9-moxart.git] / drivers / scsi / qla2xxx / qla_iocb.c
blobebbae6059fbda432016ba585c470eb0422717834
1 /******************************************************************************
2 * QLOGIC LINUX SOFTWARE
4 * QLogic ISP2x00 device driver for Linux 2.6.x
5 * Copyright (C) 2003-2004 QLogic Corporation
6 * (www.qlogic.com)
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 ******************************************************************************/
20 #include "qla_def.h"
22 #include <linux/blkdev.h>
23 #include <linux/delay.h>
25 #include <scsi/scsi_tcq.h>
27 static inline uint16_t qla2x00_get_cmd_direction(struct scsi_cmnd *cmd);
28 static inline cont_entry_t *qla2x00_prep_cont_type0_iocb(scsi_qla_host_t *);
29 static inline cont_a64_entry_t *qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *);
31 /**
32 * qla2x00_get_cmd_direction() - Determine control_flag data direction.
33 * @cmd: SCSI command
35 * Returns the proper CF_* direction based on CDB.
37 static inline uint16_t
38 qla2x00_get_cmd_direction(struct scsi_cmnd *cmd)
40 uint16_t cflags;
42 cflags = 0;
44 /* Set transfer direction */
45 if (cmd->sc_data_direction == DMA_TO_DEVICE)
46 cflags = CF_WRITE;
47 else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
48 cflags = CF_READ;
49 return (cflags);
52 /**
53 * qla2x00_calc_iocbs_32() - Determine number of Command Type 2 and
54 * Continuation Type 0 IOCBs to allocate.
56 * @dsds: number of data segment decriptors needed
58 * Returns the number of IOCB entries needed to store @dsds.
60 uint16_t
61 qla2x00_calc_iocbs_32(uint16_t dsds)
63 uint16_t iocbs;
65 iocbs = 1;
66 if (dsds > 3) {
67 iocbs += (dsds - 3) / 7;
68 if ((dsds - 3) % 7)
69 iocbs++;
71 return (iocbs);
74 /**
75 * qla2x00_calc_iocbs_64() - Determine number of Command Type 3 and
76 * Continuation Type 1 IOCBs to allocate.
78 * @dsds: number of data segment decriptors needed
80 * Returns the number of IOCB entries needed to store @dsds.
82 uint16_t
83 qla2x00_calc_iocbs_64(uint16_t dsds)
85 uint16_t iocbs;
87 iocbs = 1;
88 if (dsds > 2) {
89 iocbs += (dsds - 2) / 5;
90 if ((dsds - 2) % 5)
91 iocbs++;
93 return (iocbs);
96 /**
97 * qla2x00_prep_cont_type0_iocb() - Initialize a Continuation Type 0 IOCB.
98 * @ha: HA context
100 * Returns a pointer to the Continuation Type 0 IOCB packet.
102 static inline cont_entry_t *
103 qla2x00_prep_cont_type0_iocb(scsi_qla_host_t *ha)
105 cont_entry_t *cont_pkt;
107 /* Adjust ring index. */
108 ha->req_ring_index++;
109 if (ha->req_ring_index == ha->request_q_length) {
110 ha->req_ring_index = 0;
111 ha->request_ring_ptr = ha->request_ring;
112 } else {
113 ha->request_ring_ptr++;
116 cont_pkt = (cont_entry_t *)ha->request_ring_ptr;
118 /* Load packet defaults. */
119 *((uint32_t *)(&cont_pkt->entry_type)) =
120 __constant_cpu_to_le32(CONTINUE_TYPE);
122 return (cont_pkt);
126 * qla2x00_prep_cont_type1_iocb() - Initialize a Continuation Type 1 IOCB.
127 * @ha: HA context
129 * Returns a pointer to the continuation type 1 IOCB packet.
131 static inline cont_a64_entry_t *
132 qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *ha)
134 cont_a64_entry_t *cont_pkt;
136 /* Adjust ring index. */
137 ha->req_ring_index++;
138 if (ha->req_ring_index == ha->request_q_length) {
139 ha->req_ring_index = 0;
140 ha->request_ring_ptr = ha->request_ring;
141 } else {
142 ha->request_ring_ptr++;
145 cont_pkt = (cont_a64_entry_t *)ha->request_ring_ptr;
147 /* Load packet defaults. */
148 *((uint32_t *)(&cont_pkt->entry_type)) =
149 __constant_cpu_to_le32(CONTINUE_A64_TYPE);
151 return (cont_pkt);
155 * qla2x00_build_scsi_iocbs_32() - Build IOCB command utilizing 32bit
156 * capable IOCB types.
158 * @sp: SRB command to process
159 * @cmd_pkt: Command type 2 IOCB
160 * @tot_dsds: Total number of segments to transfer
162 void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
163 uint16_t tot_dsds)
165 uint16_t avail_dsds;
166 uint32_t *cur_dsd;
167 scsi_qla_host_t *ha;
168 struct scsi_cmnd *cmd;
170 cmd = sp->cmd;
172 /* Update entry type to indicate Command Type 2 IOCB */
173 *((uint32_t *)(&cmd_pkt->entry_type)) =
174 __constant_cpu_to_le32(COMMAND_TYPE);
176 /* No data transfer */
177 if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) {
178 cmd_pkt->byte_count = __constant_cpu_to_le32(0);
179 return;
182 ha = sp->ha;
184 cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(cmd));
186 /* Three DSDs are available in the Command Type 2 IOCB */
187 avail_dsds = 3;
188 cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
190 /* Load data segments */
191 if (cmd->use_sg != 0) {
192 struct scatterlist *cur_seg;
193 struct scatterlist *end_seg;
195 cur_seg = (struct scatterlist *)cmd->request_buffer;
196 end_seg = cur_seg + tot_dsds;
197 while (cur_seg < end_seg) {
198 cont_entry_t *cont_pkt;
200 /* Allocate additional continuation packets? */
201 if (avail_dsds == 0) {
203 * Seven DSDs are available in the Continuation
204 * Type 0 IOCB.
206 cont_pkt = qla2x00_prep_cont_type0_iocb(ha);
207 cur_dsd = (uint32_t *)&cont_pkt->dseg_0_address;
208 avail_dsds = 7;
211 *cur_dsd++ = cpu_to_le32(sg_dma_address(cur_seg));
212 *cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
213 avail_dsds--;
215 cur_seg++;
217 } else {
218 dma_addr_t req_dma;
219 struct page *page;
220 unsigned long offset;
222 page = virt_to_page(cmd->request_buffer);
223 offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
224 req_dma = pci_map_page(ha->pdev, page, offset,
225 cmd->request_bufflen, cmd->sc_data_direction);
227 sp->dma_handle = req_dma;
229 *cur_dsd++ = cpu_to_le32(req_dma);
230 *cur_dsd++ = cpu_to_le32(cmd->request_bufflen);
235 * qla2x00_build_scsi_iocbs_64() - Build IOCB command utilizing 64bit
236 * capable IOCB types.
238 * @sp: SRB command to process
239 * @cmd_pkt: Command type 3 IOCB
240 * @tot_dsds: Total number of segments to transfer
242 void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
243 uint16_t tot_dsds)
245 uint16_t avail_dsds;
246 uint32_t *cur_dsd;
247 scsi_qla_host_t *ha;
248 struct scsi_cmnd *cmd;
250 cmd = sp->cmd;
252 /* Update entry type to indicate Command Type 3 IOCB */
253 *((uint32_t *)(&cmd_pkt->entry_type)) =
254 __constant_cpu_to_le32(COMMAND_A64_TYPE);
256 /* No data transfer */
257 if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) {
258 cmd_pkt->byte_count = __constant_cpu_to_le32(0);
259 return;
262 ha = sp->ha;
264 cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(cmd));
266 /* Two DSDs are available in the Command Type 3 IOCB */
267 avail_dsds = 2;
268 cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
270 /* Load data segments */
271 if (cmd->use_sg != 0) {
272 struct scatterlist *cur_seg;
273 struct scatterlist *end_seg;
275 cur_seg = (struct scatterlist *)cmd->request_buffer;
276 end_seg = cur_seg + tot_dsds;
277 while (cur_seg < end_seg) {
278 dma_addr_t sle_dma;
279 cont_a64_entry_t *cont_pkt;
281 /* Allocate additional continuation packets? */
282 if (avail_dsds == 0) {
284 * Five DSDs are available in the Continuation
285 * Type 1 IOCB.
287 cont_pkt = qla2x00_prep_cont_type1_iocb(ha);
288 cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
289 avail_dsds = 5;
292 sle_dma = sg_dma_address(cur_seg);
293 *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
294 *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
295 *cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
296 avail_dsds--;
298 cur_seg++;
300 } else {
301 dma_addr_t req_dma;
302 struct page *page;
303 unsigned long offset;
305 page = virt_to_page(cmd->request_buffer);
306 offset = ((unsigned long)cmd->request_buffer & ~PAGE_MASK);
307 req_dma = pci_map_page(ha->pdev, page, offset,
308 cmd->request_bufflen, cmd->sc_data_direction);
310 sp->dma_handle = req_dma;
312 *cur_dsd++ = cpu_to_le32(LSD(req_dma));
313 *cur_dsd++ = cpu_to_le32(MSD(req_dma));
314 *cur_dsd++ = cpu_to_le32(cmd->request_bufflen);
319 * qla2x00_start_scsi() - Send a SCSI command to the ISP
320 * @sp: command to send to the ISP
322 * Returns non-zero if a failure occured, else zero.
325 qla2x00_start_scsi(srb_t *sp)
327 int ret;
328 unsigned long flags;
329 scsi_qla_host_t *ha;
330 fc_lun_t *fclun;
331 struct scsi_cmnd *cmd;
332 uint32_t *clr_ptr;
333 uint32_t index;
334 uint32_t handle;
335 cmd_entry_t *cmd_pkt;
336 uint32_t timeout;
337 struct scatterlist *sg;
338 uint16_t cnt;
339 uint16_t req_cnt;
340 uint16_t tot_dsds;
341 device_reg_t *reg;
342 char tag[2];
344 /* Setup device pointers. */
345 ret = 0;
346 fclun = sp->lun_queue->fclun;
347 ha = fclun->fcport->ha;
348 cmd = sp->cmd;
349 reg = ha->iobase;
351 /* Send marker if required */
352 if (ha->marker_needed != 0) {
353 if (qla2x00_marker(ha, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) {
354 return (QLA_FUNCTION_FAILED);
356 ha->marker_needed = 0;
359 /* Acquire ring specific lock */
360 spin_lock_irqsave(&ha->hardware_lock, flags);
362 /* Check for room in outstanding command list. */
363 handle = ha->current_outstanding_cmd;
364 for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
365 handle++;
366 if (handle == MAX_OUTSTANDING_COMMANDS)
367 handle = 1;
368 if (ha->outstanding_cmds[handle] == 0)
369 break;
371 if (index == MAX_OUTSTANDING_COMMANDS)
372 goto queuing_error;
374 /* Calculate the number of request entries needed. */
375 req_cnt = (ha->calc_request_entries)(cmd->request->nr_hw_segments);
376 if (ha->req_q_cnt < (req_cnt + 2)) {
377 cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha, reg));
378 if (ha->req_ring_index < cnt)
379 ha->req_q_cnt = cnt - ha->req_ring_index;
380 else
381 ha->req_q_cnt = ha->request_q_length -
382 (ha->req_ring_index - cnt);
384 if (ha->req_q_cnt < (req_cnt + 2))
385 goto queuing_error;
387 /* Finally, we have enough space, now perform mappings. */
388 tot_dsds = 0;
389 if (cmd->use_sg) {
390 sg = (struct scatterlist *) cmd->request_buffer;
391 tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg,
392 cmd->sc_data_direction);
393 if (tot_dsds == 0)
394 goto queuing_error;
395 } else if (cmd->request_bufflen) {
396 tot_dsds++;
398 req_cnt = (ha->calc_request_entries)(tot_dsds);
400 /* Build command packet */
401 ha->current_outstanding_cmd = handle;
402 ha->outstanding_cmds[handle] = sp;
403 sp->ha = ha;
404 sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
405 ha->req_q_cnt -= req_cnt;
407 cmd_pkt = (cmd_entry_t *)ha->request_ring_ptr;
408 cmd_pkt->handle = handle;
409 /* Zero out remaining portion of packet. */
410 clr_ptr = (uint32_t *)cmd_pkt + 2;
411 memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
412 cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
414 /* Set target ID */
415 SET_TARGET_ID(ha, cmd_pkt->target, fclun->fcport->loop_id);
417 /* Set LUN number*/
418 cmd_pkt->lun = cpu_to_le16(fclun->lun);
420 /* Update tagged queuing modifier */
421 if (scsi_populate_tag_msg(cmd, tag)) {
422 switch (tag[0]) {
423 case MSG_SIMPLE_TAG:
424 cmd_pkt->control_flags =
425 __constant_cpu_to_le16(CF_SIMPLE_TAG);
426 break;
427 case MSG_HEAD_TAG:
428 cmd_pkt->control_flags =
429 __constant_cpu_to_le16(CF_HEAD_TAG);
430 break;
431 case MSG_ORDERED_TAG:
432 cmd_pkt->control_flags =
433 __constant_cpu_to_le16(CF_ORDERED_TAG);
434 break;
439 * Allocate at least 5 (+ QLA_CMD_TIMER_DELTA) seconds for RISC timeout.
441 timeout = (uint32_t)(cmd->timeout_per_command / HZ);
442 if (timeout > 65535)
443 cmd_pkt->timeout = __constant_cpu_to_le16(0);
444 else if (timeout > 25)
445 cmd_pkt->timeout = cpu_to_le16((uint16_t)timeout -
446 (5 + QLA_CMD_TIMER_DELTA));
447 else
448 cmd_pkt->timeout = cpu_to_le16((uint16_t)timeout);
450 /* Load SCSI command packet. */
451 memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len);
452 cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen);
454 /* Build IOCB segments */
455 (ha->build_scsi_iocbs)(sp, cmd_pkt, tot_dsds);
457 /* Set total data segment count. */
458 cmd_pkt->entry_count = (uint8_t)req_cnt;
459 wmb();
461 /* Adjust ring index. */
462 ha->req_ring_index++;
463 if (ha->req_ring_index == ha->request_q_length) {
464 ha->req_ring_index = 0;
465 ha->request_ring_ptr = ha->request_ring;
466 } else
467 ha->request_ring_ptr++;
469 ha->actthreads++;
470 ha->total_ios++;
471 sp->lun_queue->out_cnt++;
472 sp->flags |= SRB_DMA_VALID;
473 sp->state = SRB_ACTIVE_STATE;
474 sp->u_start = jiffies;
476 /* Set chip new ring index. */
477 WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
478 RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg)); /* PCI Posting. */
480 spin_unlock_irqrestore(&ha->hardware_lock, flags);
481 return (QLA_SUCCESS);
483 queuing_error:
484 spin_unlock_irqrestore(&ha->hardware_lock, flags);
486 return (QLA_FUNCTION_FAILED);
490 * qla2x00_marker() - Send a marker IOCB to the firmware.
491 * @ha: HA context
492 * @loop_id: loop ID
493 * @lun: LUN
494 * @type: marker modifier
496 * Can be called from both normal and interrupt context.
498 * Returns non-zero if a failure occured, else zero.
501 __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
502 uint8_t type)
504 mrk_entry_t *pkt;
506 pkt = (mrk_entry_t *)qla2x00_req_pkt(ha);
507 if (pkt == NULL) {
508 DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
510 return (QLA_FUNCTION_FAILED);
513 pkt->entry_type = MARKER_TYPE;
514 pkt->modifier = type;
516 if (type != MK_SYNC_ALL) {
517 pkt->lun = cpu_to_le16(lun);
518 SET_TARGET_ID(ha, pkt->target, loop_id);
520 wmb();
522 /* Issue command to ISP */
523 qla2x00_isp_cmd(ha);
525 return (QLA_SUCCESS);
528 int
529 qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
530 uint8_t type)
532 int ret;
533 unsigned long flags = 0;
535 spin_lock_irqsave(&ha->hardware_lock, flags);
536 ret = __qla2x00_marker(ha, loop_id, lun, type);
537 spin_unlock_irqrestore(&ha->hardware_lock, flags);
539 return (ret);
543 * qla2x00_req_pkt() - Retrieve a request packet from the request ring.
544 * @ha: HA context
546 * Note: The caller must hold the hardware lock before calling this routine.
548 * Returns NULL if function failed, else, a pointer to the request packet.
550 request_t *
551 qla2x00_req_pkt(scsi_qla_host_t *ha)
553 device_reg_t *reg = ha->iobase;
554 request_t *pkt = NULL;
555 uint16_t cnt;
556 uint32_t *dword_ptr;
557 uint32_t timer;
558 uint16_t req_cnt = 1;
560 /* Wait 1 second for slot. */
561 for (timer = HZ; timer; timer--) {
562 if ((req_cnt + 2) >= ha->req_q_cnt) {
563 /* Calculate number of free request entries. */
564 cnt = qla2x00_debounce_register(ISP_REQ_Q_OUT(ha, reg));
565 if (ha->req_ring_index < cnt)
566 ha->req_q_cnt = cnt - ha->req_ring_index;
567 else
568 ha->req_q_cnt = ha->request_q_length -
569 (ha->req_ring_index - cnt);
571 /* If room for request in request ring. */
572 if ((req_cnt + 2) < ha->req_q_cnt) {
573 ha->req_q_cnt--;
574 pkt = ha->request_ring_ptr;
576 /* Zero out packet. */
577 dword_ptr = (uint32_t *)pkt;
578 for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++)
579 *dword_ptr++ = 0;
581 /* Set system defined field. */
582 pkt->sys_define = (uint8_t)ha->req_ring_index;
584 /* Set entry count. */
585 pkt->entry_count = 1;
587 break;
590 /* Release ring specific lock */
591 spin_unlock(&ha->hardware_lock);
593 udelay(2); /* 2 us */
595 /* Check for pending interrupts. */
596 /* During init we issue marker directly */
597 if (!ha->marker_needed)
598 qla2x00_poll(ha);
600 spin_lock_irq(&ha->hardware_lock);
602 if (!pkt) {
603 DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
606 return (pkt);
610 * qla2x00_ms_req_pkt() - Retrieve a Management Server request packet from
611 * the request ring.
612 * @ha: HA context
613 * @sp: pointer to handle post function call
615 * Note: The caller must hold the hardware lock before calling this routine.
617 * Returns NULL if function failed, else, a pointer to the request packet.
619 request_t *
620 qla2x00_ms_req_pkt(scsi_qla_host_t *ha, srb_t *sp)
622 device_reg_t *reg = ha->iobase;
623 request_t *pkt = NULL;
624 uint16_t cnt, i, index;
625 uint32_t *dword_ptr;
626 uint32_t timer;
627 uint8_t found = 0;
628 uint16_t req_cnt = 1;
630 /* Wait 1 second for slot. */
631 for (timer = HZ; timer; timer--) {
632 if ((req_cnt + 2) >= ha->req_q_cnt) {
633 /* Calculate number of free request entries. */
634 cnt = qla2x00_debounce_register(ISP_REQ_Q_OUT(ha, reg));
635 if (ha->req_ring_index < cnt) {
636 ha->req_q_cnt = cnt - ha->req_ring_index;
637 } else {
638 ha->req_q_cnt = ha->request_q_length -
639 (ha->req_ring_index - cnt);
643 /* Check for room in outstanding command list. */
644 cnt = ha->current_outstanding_cmd;
645 for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
646 cnt++;
647 if (cnt == MAX_OUTSTANDING_COMMANDS)
648 cnt = 1;
650 if (ha->outstanding_cmds[cnt] == 0) {
651 found = 1;
652 ha->current_outstanding_cmd = cnt;
653 break;
657 /* If room for request in request ring. */
658 if (found && (req_cnt + 2) < ha->req_q_cnt) {
659 pkt = ha->request_ring_ptr;
661 /* Zero out packet. */
662 dword_ptr = (uint32_t *)pkt;
663 for (i = 0; i < REQUEST_ENTRY_SIZE / 4; i++ )
664 *dword_ptr++ = 0;
666 DEBUG5(printk("%s(): putting sp=%p in "
667 "outstanding_cmds[%x]\n",
668 __func__,
669 sp, cnt));
671 ha->outstanding_cmds[cnt] = sp;
673 /* save the handle */
674 sp->cmd->host_scribble = (unsigned char *) (u_long) cnt;
675 CMD_SP(sp->cmd) = (void *)sp;
677 ha->req_q_cnt--;
678 pkt->handle = (uint32_t)cnt;
680 /* Set system defined field. */
681 pkt->sys_define = (uint8_t)ha->req_ring_index;
682 pkt->entry_status = 0;
684 break;
687 /* Release ring specific lock */
688 spin_unlock(&ha->hardware_lock);
689 udelay(20);
691 /* Check for pending interrupts. */
692 qla2x00_poll(ha);
694 spin_lock_irq(&ha->hardware_lock);
696 if (!pkt) {
697 DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
700 return (pkt);
704 * qla2x00_isp_cmd() - Modify the request ring pointer.
705 * @ha: HA context
707 * Note: The caller must hold the hardware lock before calling this routine.
709 void
710 qla2x00_isp_cmd(scsi_qla_host_t *ha)
712 device_reg_t *reg = ha->iobase;
714 DEBUG5(printk("%s(): IOCB data:\n", __func__));
715 DEBUG5(qla2x00_dump_buffer(
716 (uint8_t *)ha->request_ring_ptr, REQUEST_ENTRY_SIZE));
718 /* Adjust ring index. */
719 ha->req_ring_index++;
720 if (ha->req_ring_index == ha->request_q_length) {
721 ha->req_ring_index = 0;
722 ha->request_ring_ptr = ha->request_ring;
723 } else
724 ha->request_ring_ptr++;
726 /* Set chip new ring index. */
727 WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
728 RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg)); /* PCI Posting. */