2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2005 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
9 #include <linux/blkdev.h>
10 #include <linux/delay.h>
12 #include <scsi/scsi_tcq.h>
14 static inline uint16_t qla2x00_get_cmd_direction(struct scsi_cmnd
*cmd
);
15 static inline cont_entry_t
*qla2x00_prep_cont_type0_iocb(scsi_qla_host_t
*);
16 static inline cont_a64_entry_t
*qla2x00_prep_cont_type1_iocb(scsi_qla_host_t
*);
17 static request_t
*qla2x00_req_pkt(scsi_qla_host_t
*ha
);
18 static void qla2x00_isp_cmd(scsi_qla_host_t
*ha
);
21 * qla2x00_get_cmd_direction() - Determine control_flag data direction.
24 * Returns the proper CF_* direction based on CDB.
26 static inline uint16_t
27 qla2x00_get_cmd_direction(struct scsi_cmnd
*cmd
)
33 /* Set transfer direction */
34 if (cmd
->sc_data_direction
== DMA_TO_DEVICE
)
36 else if (cmd
->sc_data_direction
== DMA_FROM_DEVICE
)
42 * qla2x00_calc_iocbs_32() - Determine number of Command Type 2 and
43 * Continuation Type 0 IOCBs to allocate.
45 * @dsds: number of data segment decriptors needed
47 * Returns the number of IOCB entries needed to store @dsds.
50 qla2x00_calc_iocbs_32(uint16_t dsds
)
56 iocbs
+= (dsds
- 3) / 7;
64 * qla2x00_calc_iocbs_64() - Determine number of Command Type 3 and
65 * Continuation Type 1 IOCBs to allocate.
67 * @dsds: number of data segment decriptors needed
69 * Returns the number of IOCB entries needed to store @dsds.
72 qla2x00_calc_iocbs_64(uint16_t dsds
)
78 iocbs
+= (dsds
- 2) / 5;
86 * qla2x00_prep_cont_type0_iocb() - Initialize a Continuation Type 0 IOCB.
89 * Returns a pointer to the Continuation Type 0 IOCB packet.
91 static inline cont_entry_t
*
92 qla2x00_prep_cont_type0_iocb(scsi_qla_host_t
*ha
)
94 cont_entry_t
*cont_pkt
;
96 /* Adjust ring index. */
98 if (ha
->req_ring_index
== ha
->request_q_length
) {
99 ha
->req_ring_index
= 0;
100 ha
->request_ring_ptr
= ha
->request_ring
;
102 ha
->request_ring_ptr
++;
105 cont_pkt
= (cont_entry_t
*)ha
->request_ring_ptr
;
107 /* Load packet defaults. */
108 *((uint32_t *)(&cont_pkt
->entry_type
)) =
109 __constant_cpu_to_le32(CONTINUE_TYPE
);
115 * qla2x00_prep_cont_type1_iocb() - Initialize a Continuation Type 1 IOCB.
118 * Returns a pointer to the continuation type 1 IOCB packet.
120 static inline cont_a64_entry_t
*
121 qla2x00_prep_cont_type1_iocb(scsi_qla_host_t
*ha
)
123 cont_a64_entry_t
*cont_pkt
;
125 /* Adjust ring index. */
126 ha
->req_ring_index
++;
127 if (ha
->req_ring_index
== ha
->request_q_length
) {
128 ha
->req_ring_index
= 0;
129 ha
->request_ring_ptr
= ha
->request_ring
;
131 ha
->request_ring_ptr
++;
134 cont_pkt
= (cont_a64_entry_t
*)ha
->request_ring_ptr
;
136 /* Load packet defaults. */
137 *((uint32_t *)(&cont_pkt
->entry_type
)) =
138 __constant_cpu_to_le32(CONTINUE_A64_TYPE
);
144 * qla2x00_build_scsi_iocbs_32() - Build IOCB command utilizing 32bit
145 * capable IOCB types.
147 * @sp: SRB command to process
148 * @cmd_pkt: Command type 2 IOCB
149 * @tot_dsds: Total number of segments to transfer
151 void qla2x00_build_scsi_iocbs_32(srb_t
*sp
, cmd_entry_t
*cmd_pkt
,
157 struct scsi_cmnd
*cmd
;
158 struct scatterlist
*sg
;
163 /* Update entry type to indicate Command Type 2 IOCB */
164 *((uint32_t *)(&cmd_pkt
->entry_type
)) =
165 __constant_cpu_to_le32(COMMAND_TYPE
);
167 /* No data transfer */
168 if (!scsi_bufflen(cmd
) || cmd
->sc_data_direction
== DMA_NONE
) {
169 cmd_pkt
->byte_count
= __constant_cpu_to_le32(0);
175 cmd_pkt
->control_flags
|= cpu_to_le16(qla2x00_get_cmd_direction(cmd
));
177 /* Three DSDs are available in the Command Type 2 IOCB */
179 cur_dsd
= (uint32_t *)&cmd_pkt
->dseg_0_address
;
181 /* Load data segments */
183 scsi_for_each_sg(cmd
, sg
, tot_dsds
, i
) {
184 cont_entry_t
*cont_pkt
;
186 /* Allocate additional continuation packets? */
187 if (avail_dsds
== 0) {
189 * Seven DSDs are available in the Continuation
192 cont_pkt
= qla2x00_prep_cont_type0_iocb(ha
);
193 cur_dsd
= (uint32_t *)&cont_pkt
->dseg_0_address
;
197 *cur_dsd
++ = cpu_to_le32(sg_dma_address(sg
));
198 *cur_dsd
++ = cpu_to_le32(sg_dma_len(sg
));
204 * qla2x00_build_scsi_iocbs_64() - Build IOCB command utilizing 64bit
205 * capable IOCB types.
207 * @sp: SRB command to process
208 * @cmd_pkt: Command type 3 IOCB
209 * @tot_dsds: Total number of segments to transfer
211 void qla2x00_build_scsi_iocbs_64(srb_t
*sp
, cmd_entry_t
*cmd_pkt
,
217 struct scsi_cmnd
*cmd
;
218 struct scatterlist
*sg
;
223 /* Update entry type to indicate Command Type 3 IOCB */
224 *((uint32_t *)(&cmd_pkt
->entry_type
)) =
225 __constant_cpu_to_le32(COMMAND_A64_TYPE
);
227 /* No data transfer */
228 if (!scsi_bufflen(cmd
) || cmd
->sc_data_direction
== DMA_NONE
) {
229 cmd_pkt
->byte_count
= __constant_cpu_to_le32(0);
235 cmd_pkt
->control_flags
|= cpu_to_le16(qla2x00_get_cmd_direction(cmd
));
237 /* Two DSDs are available in the Command Type 3 IOCB */
239 cur_dsd
= (uint32_t *)&cmd_pkt
->dseg_0_address
;
241 /* Load data segments */
242 scsi_for_each_sg(cmd
, sg
, tot_dsds
, i
) {
244 cont_a64_entry_t
*cont_pkt
;
246 /* Allocate additional continuation packets? */
247 if (avail_dsds
== 0) {
249 * Five DSDs are available in the Continuation
252 cont_pkt
= qla2x00_prep_cont_type1_iocb(ha
);
253 cur_dsd
= (uint32_t *)cont_pkt
->dseg_0_address
;
257 sle_dma
= sg_dma_address(sg
);
258 *cur_dsd
++ = cpu_to_le32(LSD(sle_dma
));
259 *cur_dsd
++ = cpu_to_le32(MSD(sle_dma
));
260 *cur_dsd
++ = cpu_to_le32(sg_dma_len(sg
));
266 * qla2x00_start_scsi() - Send a SCSI command to the ISP
267 * @sp: command to send to the ISP
269 * Returns non-zero if a failure occured, else zero.
272 qla2x00_start_scsi(srb_t
*sp
)
277 struct scsi_cmnd
*cmd
;
281 cmd_entry_t
*cmd_pkt
;
285 struct device_reg_2xxx __iomem
*reg
;
287 /* Setup device pointers. */
290 reg
= &ha
->iobase
->isp
;
292 /* So we know we haven't pci_map'ed anything yet */
295 /* Send marker if required */
296 if (ha
->marker_needed
!= 0) {
297 if (qla2x00_marker(ha
, 0, 0, MK_SYNC_ALL
) != QLA_SUCCESS
) {
298 return (QLA_FUNCTION_FAILED
);
300 ha
->marker_needed
= 0;
303 /* Acquire ring specific lock */
304 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
306 /* Check for room in outstanding command list. */
307 handle
= ha
->current_outstanding_cmd
;
308 for (index
= 1; index
< MAX_OUTSTANDING_COMMANDS
; index
++) {
310 if (handle
== MAX_OUTSTANDING_COMMANDS
)
312 if (ha
->outstanding_cmds
[handle
] == 0)
315 if (index
== MAX_OUTSTANDING_COMMANDS
)
318 /* Map the sg table so we have an accurate count of sg entries needed */
319 nseg
= scsi_dma_map(cmd
);
324 /* Calculate the number of request entries needed. */
325 req_cnt
= ha
->isp_ops
.calc_req_entries(tot_dsds
);
326 if (ha
->req_q_cnt
< (req_cnt
+ 2)) {
327 cnt
= RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha
, reg
));
328 if (ha
->req_ring_index
< cnt
)
329 ha
->req_q_cnt
= cnt
- ha
->req_ring_index
;
331 ha
->req_q_cnt
= ha
->request_q_length
-
332 (ha
->req_ring_index
- cnt
);
334 if (ha
->req_q_cnt
< (req_cnt
+ 2))
337 /* Build command packet */
338 ha
->current_outstanding_cmd
= handle
;
339 ha
->outstanding_cmds
[handle
] = sp
;
341 sp
->cmd
->host_scribble
= (unsigned char *)(unsigned long)handle
;
342 ha
->req_q_cnt
-= req_cnt
;
344 cmd_pkt
= (cmd_entry_t
*)ha
->request_ring_ptr
;
345 cmd_pkt
->handle
= handle
;
346 /* Zero out remaining portion of packet. */
347 clr_ptr
= (uint32_t *)cmd_pkt
+ 2;
348 memset(clr_ptr
, 0, REQUEST_ENTRY_SIZE
- 8);
349 cmd_pkt
->dseg_count
= cpu_to_le16(tot_dsds
);
351 /* Set target ID and LUN number*/
352 SET_TARGET_ID(ha
, cmd_pkt
->target
, sp
->fcport
->loop_id
);
353 cmd_pkt
->lun
= cpu_to_le16(sp
->cmd
->device
->lun
);
355 /* Update tagged queuing modifier */
356 cmd_pkt
->control_flags
= __constant_cpu_to_le16(CF_SIMPLE_TAG
);
358 /* Load SCSI command packet. */
359 memcpy(cmd_pkt
->scsi_cdb
, cmd
->cmnd
, cmd
->cmd_len
);
360 cmd_pkt
->byte_count
= cpu_to_le32((uint32_t)scsi_bufflen(cmd
));
362 /* Build IOCB segments */
363 ha
->isp_ops
.build_iocbs(sp
, cmd_pkt
, tot_dsds
);
365 /* Set total data segment count. */
366 cmd_pkt
->entry_count
= (uint8_t)req_cnt
;
369 /* Adjust ring index. */
370 ha
->req_ring_index
++;
371 if (ha
->req_ring_index
== ha
->request_q_length
) {
372 ha
->req_ring_index
= 0;
373 ha
->request_ring_ptr
= ha
->request_ring
;
375 ha
->request_ring_ptr
++;
377 sp
->flags
|= SRB_DMA_VALID
;
379 /* Set chip new ring index. */
380 WRT_REG_WORD(ISP_REQ_Q_IN(ha
, reg
), ha
->req_ring_index
);
381 RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha
, reg
)); /* PCI Posting. */
383 /* Manage unprocessed RIO/ZIO commands in response queue. */
384 if (ha
->flags
.process_response_queue
&&
385 ha
->response_ring_ptr
->signature
!= RESPONSE_PROCESSED
)
386 qla2x00_process_response_queue(ha
);
388 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
389 return (QLA_SUCCESS
);
395 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
397 return (QLA_FUNCTION_FAILED
);
401 * qla2x00_marker() - Send a marker IOCB to the firmware.
405 * @type: marker modifier
407 * Can be called from both normal and interrupt context.
409 * Returns non-zero if a failure occured, else zero.
412 __qla2x00_marker(scsi_qla_host_t
*ha
, uint16_t loop_id
, uint16_t lun
,
416 struct mrk_entry_24xx
*mrk24
;
419 mrk
= (mrk_entry_t
*)qla2x00_req_pkt(ha
);
421 DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n",
422 __func__
, ha
->host_no
));
424 return (QLA_FUNCTION_FAILED
);
427 mrk
->entry_type
= MARKER_TYPE
;
428 mrk
->modifier
= type
;
429 if (type
!= MK_SYNC_ALL
) {
430 if (IS_QLA24XX(ha
) || IS_QLA54XX(ha
)) {
431 mrk24
= (struct mrk_entry_24xx
*) mrk
;
432 mrk24
->nport_handle
= cpu_to_le16(loop_id
);
433 mrk24
->lun
[1] = LSB(lun
);
434 mrk24
->lun
[2] = MSB(lun
);
435 host_to_fcp_swap(mrk24
->lun
, sizeof(mrk24
->lun
));
437 SET_TARGET_ID(ha
, mrk
->target
, loop_id
);
438 mrk
->lun
= cpu_to_le16(lun
);
445 return (QLA_SUCCESS
);
449 qla2x00_marker(scsi_qla_host_t
*ha
, uint16_t loop_id
, uint16_t lun
,
453 unsigned long flags
= 0;
455 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
456 ret
= __qla2x00_marker(ha
, loop_id
, lun
, type
);
457 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
463 * qla2x00_req_pkt() - Retrieve a request packet from the request ring.
466 * Note: The caller must hold the hardware lock before calling this routine.
468 * Returns NULL if function failed, else, a pointer to the request packet.
471 qla2x00_req_pkt(scsi_qla_host_t
*ha
)
473 device_reg_t __iomem
*reg
= ha
->iobase
;
474 request_t
*pkt
= NULL
;
478 uint16_t req_cnt
= 1;
480 /* Wait 1 second for slot. */
481 for (timer
= HZ
; timer
; timer
--) {
482 if ((req_cnt
+ 2) >= ha
->req_q_cnt
) {
483 /* Calculate number of free request entries. */
484 if (IS_QLA24XX(ha
) || IS_QLA54XX(ha
))
485 cnt
= (uint16_t)RD_REG_DWORD(
486 ®
->isp24
.req_q_out
);
488 cnt
= qla2x00_debounce_register(
489 ISP_REQ_Q_OUT(ha
, ®
->isp
));
490 if (ha
->req_ring_index
< cnt
)
491 ha
->req_q_cnt
= cnt
- ha
->req_ring_index
;
493 ha
->req_q_cnt
= ha
->request_q_length
-
494 (ha
->req_ring_index
- cnt
);
496 /* If room for request in request ring. */
497 if ((req_cnt
+ 2) < ha
->req_q_cnt
) {
499 pkt
= ha
->request_ring_ptr
;
501 /* Zero out packet. */
502 dword_ptr
= (uint32_t *)pkt
;
503 for (cnt
= 0; cnt
< REQUEST_ENTRY_SIZE
/ 4; cnt
++)
506 /* Set system defined field. */
507 pkt
->sys_define
= (uint8_t)ha
->req_ring_index
;
509 /* Set entry count. */
510 pkt
->entry_count
= 1;
515 /* Release ring specific lock */
516 spin_unlock(&ha
->hardware_lock
);
518 udelay(2); /* 2 us */
520 /* Check for pending interrupts. */
521 /* During init we issue marker directly */
522 if (!ha
->marker_needed
)
525 spin_lock_irq(&ha
->hardware_lock
);
528 DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__
));
535 * qla2x00_isp_cmd() - Modify the request ring pointer.
538 * Note: The caller must hold the hardware lock before calling this routine.
541 qla2x00_isp_cmd(scsi_qla_host_t
*ha
)
543 device_reg_t __iomem
*reg
= ha
->iobase
;
545 DEBUG5(printk("%s(): IOCB data:\n", __func__
));
546 DEBUG5(qla2x00_dump_buffer(
547 (uint8_t *)ha
->request_ring_ptr
, REQUEST_ENTRY_SIZE
));
549 /* Adjust ring index. */
550 ha
->req_ring_index
++;
551 if (ha
->req_ring_index
== ha
->request_q_length
) {
552 ha
->req_ring_index
= 0;
553 ha
->request_ring_ptr
= ha
->request_ring
;
555 ha
->request_ring_ptr
++;
557 /* Set chip new ring index. */
558 if (IS_QLA24XX(ha
) || IS_QLA54XX(ha
)) {
559 WRT_REG_DWORD(®
->isp24
.req_q_in
, ha
->req_ring_index
);
560 RD_REG_DWORD_RELAXED(®
->isp24
.req_q_in
);
562 WRT_REG_WORD(ISP_REQ_Q_IN(ha
, ®
->isp
), ha
->req_ring_index
);
563 RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha
, ®
->isp
));
569 * qla24xx_calc_iocbs() - Determine number of Command Type 3 and
570 * Continuation Type 1 IOCBs to allocate.
572 * @dsds: number of data segment decriptors needed
574 * Returns the number of IOCB entries needed to store @dsds.
576 static inline uint16_t
577 qla24xx_calc_iocbs(uint16_t dsds
)
583 iocbs
+= (dsds
- 1) / 5;
591 * qla24xx_build_scsi_iocbs() - Build IOCB command utilizing Command Type 7
594 * @sp: SRB command to process
595 * @cmd_pkt: Command type 3 IOCB
596 * @tot_dsds: Total number of segments to transfer
599 qla24xx_build_scsi_iocbs(srb_t
*sp
, struct cmd_type_7
*cmd_pkt
,
605 struct scsi_cmnd
*cmd
;
606 struct scatterlist
*sg
;
611 /* Update entry type to indicate Command Type 3 IOCB */
612 *((uint32_t *)(&cmd_pkt
->entry_type
)) =
613 __constant_cpu_to_le32(COMMAND_TYPE_7
);
615 /* No data transfer */
616 if (!scsi_bufflen(cmd
) || cmd
->sc_data_direction
== DMA_NONE
) {
617 cmd_pkt
->byte_count
= __constant_cpu_to_le32(0);
623 /* Set transfer direction */
624 if (cmd
->sc_data_direction
== DMA_TO_DEVICE
)
625 cmd_pkt
->task_mgmt_flags
=
626 __constant_cpu_to_le16(TMF_WRITE_DATA
);
627 else if (cmd
->sc_data_direction
== DMA_FROM_DEVICE
)
628 cmd_pkt
->task_mgmt_flags
=
629 __constant_cpu_to_le16(TMF_READ_DATA
);
631 /* One DSD is available in the Command Type 3 IOCB */
633 cur_dsd
= (uint32_t *)&cmd_pkt
->dseg_0_address
;
635 /* Load data segments */
637 scsi_for_each_sg(cmd
, sg
, tot_dsds
, i
) {
639 cont_a64_entry_t
*cont_pkt
;
641 /* Allocate additional continuation packets? */
642 if (avail_dsds
== 0) {
644 * Five DSDs are available in the Continuation
647 cont_pkt
= qla2x00_prep_cont_type1_iocb(ha
);
648 cur_dsd
= (uint32_t *)cont_pkt
->dseg_0_address
;
652 sle_dma
= sg_dma_address(sg
);
653 *cur_dsd
++ = cpu_to_le32(LSD(sle_dma
));
654 *cur_dsd
++ = cpu_to_le32(MSD(sle_dma
));
655 *cur_dsd
++ = cpu_to_le32(sg_dma_len(sg
));
662 * qla24xx_start_scsi() - Send a SCSI command to the ISP
663 * @sp: command to send to the ISP
665 * Returns non-zero if a failure occured, else zero.
668 qla24xx_start_scsi(srb_t
*sp
)
673 struct scsi_cmnd
*cmd
;
677 struct cmd_type_7
*cmd_pkt
;
681 struct device_reg_24xx __iomem
*reg
;
683 /* Setup device pointers. */
686 reg
= &ha
->iobase
->isp24
;
688 /* So we know we haven't pci_map'ed anything yet */
691 /* Send marker if required */
692 if (ha
->marker_needed
!= 0) {
693 if (qla2x00_marker(ha
, 0, 0, MK_SYNC_ALL
) != QLA_SUCCESS
) {
694 return QLA_FUNCTION_FAILED
;
696 ha
->marker_needed
= 0;
699 /* Acquire ring specific lock */
700 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
702 /* Check for room in outstanding command list. */
703 handle
= ha
->current_outstanding_cmd
;
704 for (index
= 1; index
< MAX_OUTSTANDING_COMMANDS
; index
++) {
706 if (handle
== MAX_OUTSTANDING_COMMANDS
)
708 if (ha
->outstanding_cmds
[handle
] == 0)
711 if (index
== MAX_OUTSTANDING_COMMANDS
)
714 /* Map the sg table so we have an accurate count of sg entries needed */
715 nseg
= scsi_dma_map(cmd
);
720 req_cnt
= qla24xx_calc_iocbs(tot_dsds
);
721 if (ha
->req_q_cnt
< (req_cnt
+ 2)) {
722 cnt
= (uint16_t)RD_REG_DWORD_RELAXED(®
->req_q_out
);
723 if (ha
->req_ring_index
< cnt
)
724 ha
->req_q_cnt
= cnt
- ha
->req_ring_index
;
726 ha
->req_q_cnt
= ha
->request_q_length
-
727 (ha
->req_ring_index
- cnt
);
729 if (ha
->req_q_cnt
< (req_cnt
+ 2))
732 /* Build command packet. */
733 ha
->current_outstanding_cmd
= handle
;
734 ha
->outstanding_cmds
[handle
] = sp
;
736 sp
->cmd
->host_scribble
= (unsigned char *)(unsigned long)handle
;
737 ha
->req_q_cnt
-= req_cnt
;
739 cmd_pkt
= (struct cmd_type_7
*)ha
->request_ring_ptr
;
740 cmd_pkt
->handle
= handle
;
742 /* Zero out remaining portion of packet. */
743 /* tagged queuing modifier -- default is TSK_SIMPLE (0). */
744 clr_ptr
= (uint32_t *)cmd_pkt
+ 2;
745 memset(clr_ptr
, 0, REQUEST_ENTRY_SIZE
- 8);
746 cmd_pkt
->dseg_count
= cpu_to_le16(tot_dsds
);
748 /* Set NPORT-ID and LUN number*/
749 cmd_pkt
->nport_handle
= cpu_to_le16(sp
->fcport
->loop_id
);
750 cmd_pkt
->port_id
[0] = sp
->fcport
->d_id
.b
.al_pa
;
751 cmd_pkt
->port_id
[1] = sp
->fcport
->d_id
.b
.area
;
752 cmd_pkt
->port_id
[2] = sp
->fcport
->d_id
.b
.domain
;
754 int_to_scsilun(sp
->cmd
->device
->lun
, &cmd_pkt
->lun
);
755 host_to_fcp_swap((uint8_t *)&cmd_pkt
->lun
, sizeof(cmd_pkt
->lun
));
757 /* Load SCSI command packet. */
758 memcpy(cmd_pkt
->fcp_cdb
, cmd
->cmnd
, cmd
->cmd_len
);
759 host_to_fcp_swap(cmd_pkt
->fcp_cdb
, sizeof(cmd_pkt
->fcp_cdb
));
761 cmd_pkt
->byte_count
= cpu_to_le32((uint32_t)scsi_bufflen(cmd
));
763 /* Build IOCB segments */
764 qla24xx_build_scsi_iocbs(sp
, cmd_pkt
, tot_dsds
);
766 /* Set total data segment count. */
767 cmd_pkt
->entry_count
= (uint8_t)req_cnt
;
770 /* Adjust ring index. */
771 ha
->req_ring_index
++;
772 if (ha
->req_ring_index
== ha
->request_q_length
) {
773 ha
->req_ring_index
= 0;
774 ha
->request_ring_ptr
= ha
->request_ring
;
776 ha
->request_ring_ptr
++;
778 sp
->flags
|= SRB_DMA_VALID
;
780 /* Set chip new ring index. */
781 WRT_REG_DWORD(®
->req_q_in
, ha
->req_ring_index
);
782 RD_REG_DWORD_RELAXED(®
->req_q_in
); /* PCI Posting. */
784 /* Manage unprocessed RIO/ZIO commands in response queue. */
785 if (ha
->flags
.process_response_queue
&&
786 ha
->response_ring_ptr
->signature
!= RESPONSE_PROCESSED
)
787 qla24xx_process_response_queue(ha
);
789 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
796 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
798 return QLA_FUNCTION_FAILED
;
This page took 0.05878 seconds and 5 git commands to generate.