2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2008 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 request_t *qla2x00_req_pkt(struct scsi_qla_host *, struct req_que *,
16 static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *);
19 * qla2x00_get_cmd_direction() - Determine control_flag data direction.
22 * Returns the proper CF_* direction based on CDB.
24 static inline uint16_t
25 qla2x00_get_cmd_direction(srb_t *sp)
31 /* Set transfer direction */
32 if (sp->cmd->sc_data_direction == DMA_TO_DEVICE) {
34 sp->fcport->vha->hw->qla_stats.output_bytes +=
35 scsi_bufflen(sp->cmd);
36 } else if (sp->cmd->sc_data_direction == DMA_FROM_DEVICE) {
38 sp->fcport->vha->hw->qla_stats.input_bytes +=
39 scsi_bufflen(sp->cmd);
45 * qla2x00_calc_iocbs_32() - Determine number of Command Type 2 and
46 * Continuation Type 0 IOCBs to allocate.
48 * @dsds: number of data segment decriptors needed
50 * Returns the number of IOCB entries needed to store @dsds.
53 qla2x00_calc_iocbs_32(uint16_t dsds)
59 iocbs += (dsds - 3) / 7;
67 * qla2x00_calc_iocbs_64() - Determine number of Command Type 3 and
68 * Continuation Type 1 IOCBs to allocate.
70 * @dsds: number of data segment decriptors needed
72 * Returns the number of IOCB entries needed to store @dsds.
75 qla2x00_calc_iocbs_64(uint16_t dsds)
81 iocbs += (dsds - 2) / 5;
89 * qla2x00_prep_cont_type0_iocb() - Initialize a Continuation Type 0 IOCB.
92 * Returns a pointer to the Continuation Type 0 IOCB packet.
94 static inline cont_entry_t *
95 qla2x00_prep_cont_type0_iocb(struct req_que *req, struct scsi_qla_host *vha)
97 cont_entry_t *cont_pkt;
98 /* Adjust ring index. */
100 if (req->ring_index == req->length) {
102 req->ring_ptr = req->ring;
107 cont_pkt = (cont_entry_t *)req->ring_ptr;
109 /* Load packet defaults. */
110 *((uint32_t *)(&cont_pkt->entry_type)) =
111 __constant_cpu_to_le32(CONTINUE_TYPE);
117 * qla2x00_prep_cont_type1_iocb() - Initialize a Continuation Type 1 IOCB.
120 * Returns a pointer to the continuation type 1 IOCB packet.
122 static inline cont_a64_entry_t *
123 qla2x00_prep_cont_type1_iocb(struct req_que *req, scsi_qla_host_t *vha)
125 cont_a64_entry_t *cont_pkt;
127 /* Adjust ring index. */
129 if (req->ring_index == req->length) {
131 req->ring_ptr = req->ring;
136 cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
138 /* Load packet defaults. */
139 *((uint32_t *)(&cont_pkt->entry_type)) =
140 __constant_cpu_to_le32(CONTINUE_A64_TYPE);
146 * qla2x00_build_scsi_iocbs_32() - Build IOCB command utilizing 32bit
147 * capable IOCB types.
149 * @sp: SRB command to process
150 * @cmd_pkt: Command type 2 IOCB
151 * @tot_dsds: Total number of segments to transfer
153 void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
158 scsi_qla_host_t *vha;
159 struct scsi_cmnd *cmd;
160 struct scatterlist *sg;
166 /* Update entry type to indicate Command Type 2 IOCB */
167 *((uint32_t *)(&cmd_pkt->entry_type)) =
168 __constant_cpu_to_le32(COMMAND_TYPE);
170 /* No data transfer */
171 if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
172 cmd_pkt->byte_count = __constant_cpu_to_le32(0);
179 cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp));
181 /* Three DSDs are available in the Command Type 2 IOCB */
183 cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
185 /* Load data segments */
186 scsi_for_each_sg(cmd, sg, tot_dsds, i) {
187 cont_entry_t *cont_pkt;
189 /* Allocate additional continuation packets? */
190 if (avail_dsds == 0) {
192 * Seven DSDs are available in the Continuation
195 cont_pkt = qla2x00_prep_cont_type0_iocb(req, vha);
196 cur_dsd = (uint32_t *)&cont_pkt->dseg_0_address;
200 *cur_dsd++ = cpu_to_le32(sg_dma_address(sg));
201 *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
207 * qla2x00_build_scsi_iocbs_64() - Build IOCB command utilizing 64bit
208 * capable IOCB types.
210 * @sp: SRB command to process
211 * @cmd_pkt: Command type 3 IOCB
212 * @tot_dsds: Total number of segments to transfer
214 void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
219 scsi_qla_host_t *vha;
220 struct scsi_cmnd *cmd;
221 struct scatterlist *sg;
227 /* Update entry type to indicate Command Type 3 IOCB */
228 *((uint32_t *)(&cmd_pkt->entry_type)) =
229 __constant_cpu_to_le32(COMMAND_A64_TYPE);
231 /* No data transfer */
232 if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
233 cmd_pkt->byte_count = __constant_cpu_to_le32(0);
240 cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp));
242 /* Two DSDs are available in the Command Type 3 IOCB */
244 cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
246 /* Load data segments */
247 scsi_for_each_sg(cmd, sg, tot_dsds, i) {
249 cont_a64_entry_t *cont_pkt;
251 /* Allocate additional continuation packets? */
252 if (avail_dsds == 0) {
254 * Five DSDs are available in the Continuation
257 cont_pkt = qla2x00_prep_cont_type1_iocb(req, vha);
258 cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
262 sle_dma = sg_dma_address(sg);
263 *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
264 *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
265 *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
271 * qla2x00_start_scsi() - Send a SCSI command to the ISP
272 * @sp: command to send to the ISP
274 * Returns non-zero if a failure occurred, else zero.
277 qla2x00_start_scsi(srb_t *sp)
281 scsi_qla_host_t *vha;
282 struct scsi_cmnd *cmd;
286 cmd_entry_t *cmd_pkt;
290 struct device_reg_2xxx __iomem *reg;
291 struct qla_hw_data *ha;
295 /* Setup device pointers. */
299 reg = &ha->iobase->isp;
301 req = ha->req_q_map[0];
302 rsp = ha->rsp_q_map[0];
303 /* So we know we haven't pci_map'ed anything yet */
306 /* Send marker if required */
307 if (vha->marker_needed != 0) {
308 if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL)
310 return (QLA_FUNCTION_FAILED);
311 vha->marker_needed = 0;
314 /* Acquire ring specific lock */
315 spin_lock_irqsave(&ha->hardware_lock, flags);
317 /* Check for room in outstanding command list. */
318 handle = req->current_outstanding_cmd;
319 for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
321 if (handle == MAX_OUTSTANDING_COMMANDS)
323 if (!req->outstanding_cmds[handle])
326 if (index == MAX_OUTSTANDING_COMMANDS)
329 /* Map the sg table so we have an accurate count of sg entries needed */
330 if (scsi_sg_count(cmd)) {
331 nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd),
332 scsi_sg_count(cmd), cmd->sc_data_direction);
340 /* Calculate the number of request entries needed. */
341 req_cnt = ha->isp_ops->calc_req_entries(tot_dsds);
342 if (req->cnt < (req_cnt + 2)) {
343 cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha, reg));
344 if (req->ring_index < cnt)
345 req->cnt = cnt - req->ring_index;
347 req->cnt = req->length -
348 (req->ring_index - cnt);
350 if (req->cnt < (req_cnt + 2))
353 /* Build command packet */
354 req->current_outstanding_cmd = handle;
355 req->outstanding_cmds[handle] = sp;
358 sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
361 cmd_pkt = (cmd_entry_t *)req->ring_ptr;
362 cmd_pkt->handle = handle;
363 /* Zero out remaining portion of packet. */
364 clr_ptr = (uint32_t *)cmd_pkt + 2;
365 memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
366 cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
368 /* Set target ID and LUN number*/
369 SET_TARGET_ID(ha, cmd_pkt->target, sp->fcport->loop_id);
370 cmd_pkt->lun = cpu_to_le16(sp->cmd->device->lun);
372 /* Update tagged queuing modifier */
373 cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
375 /* Load SCSI command packet. */
376 memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len);
377 cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
379 /* Build IOCB segments */
380 ha->isp_ops->build_iocbs(sp, cmd_pkt, tot_dsds);
382 /* Set total data segment count. */
383 cmd_pkt->entry_count = (uint8_t)req_cnt;
386 /* Adjust ring index. */
388 if (req->ring_index == req->length) {
390 req->ring_ptr = req->ring;
394 sp->flags |= SRB_DMA_VALID;
396 /* Set chip new ring index. */
397 WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), req->ring_index);
398 RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg)); /* PCI Posting. */
400 /* Manage unprocessed RIO/ZIO commands in response queue. */
401 if (vha->flags.process_response_queue &&
402 rsp->ring_ptr->signature != RESPONSE_PROCESSED)
403 qla2x00_process_response_queue(rsp);
405 spin_unlock_irqrestore(&ha->hardware_lock, flags);
406 return (QLA_SUCCESS);
412 spin_unlock_irqrestore(&ha->hardware_lock, flags);
414 return (QLA_FUNCTION_FAILED);
418 * qla2x00_marker() - Send a marker IOCB to the firmware.
422 * @type: marker modifier
424 * Can be called from both normal and interrupt context.
426 * Returns non-zero if a failure occurred, else zero.
429 __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
430 struct rsp_que *rsp, uint16_t loop_id,
431 uint16_t lun, uint8_t type)
434 struct mrk_entry_24xx *mrk24;
435 struct qla_hw_data *ha = vha->hw;
436 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
439 mrk = (mrk_entry_t *)qla2x00_req_pkt(vha, req, rsp);
441 DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n",
442 __func__, base_vha->host_no));
444 return (QLA_FUNCTION_FAILED);
447 mrk->entry_type = MARKER_TYPE;
448 mrk->modifier = type;
449 if (type != MK_SYNC_ALL) {
450 if (IS_FWI2_CAPABLE(ha)) {
451 mrk24 = (struct mrk_entry_24xx *) mrk;
452 mrk24->nport_handle = cpu_to_le16(loop_id);
453 mrk24->lun[1] = LSB(lun);
454 mrk24->lun[2] = MSB(lun);
455 host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun));
456 mrk24->vp_index = vha->vp_idx;
458 SET_TARGET_ID(ha, mrk->target, loop_id);
459 mrk->lun = cpu_to_le16(lun);
464 qla2x00_isp_cmd(vha, req);
466 return (QLA_SUCCESS);
470 qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
471 struct rsp_que *rsp, uint16_t loop_id, uint16_t lun,
475 unsigned long flags = 0;
477 spin_lock_irqsave(&vha->hw->hardware_lock, flags);
478 ret = __qla2x00_marker(vha, req, rsp, loop_id, lun, type);
479 spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
485 * qla2x00_req_pkt() - Retrieve a request packet from the request ring.
488 * Note: The caller must hold the hardware lock before calling this routine.
490 * Returns NULL if function failed, else, a pointer to the request packet.
493 qla2x00_req_pkt(struct scsi_qla_host *vha, struct req_que *req,
496 struct qla_hw_data *ha = vha->hw;
497 device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id);
498 request_t *pkt = NULL;
502 uint16_t req_cnt = 1;
504 /* Wait 1 second for slot. */
505 for (timer = HZ; timer; timer--) {
506 if ((req_cnt + 2) >= req->cnt) {
507 /* Calculate number of free request entries. */
510 RD_REG_DWORD(®->isp25mq.req_q_out);
512 if (IS_FWI2_CAPABLE(ha))
513 cnt = (uint16_t)RD_REG_DWORD(
514 ®->isp24.req_q_out);
516 cnt = qla2x00_debounce_register(
517 ISP_REQ_Q_OUT(ha, ®->isp));
519 if (req->ring_index < cnt)
520 req->cnt = cnt - req->ring_index;
522 req->cnt = req->length -
523 (req->ring_index - cnt);
525 /* If room for request in request ring. */
526 if ((req_cnt + 2) < req->cnt) {
530 /* Zero out packet. */
531 dword_ptr = (uint32_t *)pkt;
532 for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++)
535 /* Set system defined field. */
536 pkt->sys_define = (uint8_t)req->ring_index;
538 /* Set entry count. */
539 pkt->entry_count = 1;
544 /* Release ring specific lock */
545 spin_unlock_irq(&ha->hardware_lock);
547 udelay(2); /* 2 us */
549 /* Check for pending interrupts. */
550 /* During init we issue marker directly */
551 if (!vha->marker_needed && !vha->flags.init_done)
553 spin_lock_irq(&ha->hardware_lock);
556 DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
563 * qla2x00_isp_cmd() - Modify the request ring pointer.
566 * Note: The caller must hold the hardware lock before calling this routine.
569 qla2x00_isp_cmd(struct scsi_qla_host *vha, struct req_que *req)
571 struct qla_hw_data *ha = vha->hw;
572 device_reg_t __iomem *reg = ISP_QUE_REG(ha, req->id);
573 struct device_reg_2xxx __iomem *ioreg = &ha->iobase->isp;
575 DEBUG5(printk("%s(): IOCB data:\n", __func__));
576 DEBUG5(qla2x00_dump_buffer(
577 (uint8_t *)req->ring_ptr, REQUEST_ENTRY_SIZE));
579 /* Adjust ring index. */
581 if (req->ring_index == req->length) {
583 req->ring_ptr = req->ring;
587 /* Set chip new ring index. */
589 WRT_REG_DWORD(®->isp25mq.req_q_in, req->ring_index);
590 RD_REG_DWORD(&ioreg->hccr);
593 if (IS_FWI2_CAPABLE(ha)) {
594 WRT_REG_DWORD(®->isp24.req_q_in, req->ring_index);
595 RD_REG_DWORD_RELAXED(®->isp24.req_q_in);
597 WRT_REG_WORD(ISP_REQ_Q_IN(ha, ®->isp),
599 RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, ®->isp));
606 * qla24xx_calc_iocbs() - Determine number of Command Type 3 and
607 * Continuation Type 1 IOCBs to allocate.
609 * @dsds: number of data segment decriptors needed
611 * Returns the number of IOCB entries needed to store @dsds.
613 static inline uint16_t
614 qla24xx_calc_iocbs(uint16_t dsds)
620 iocbs += (dsds - 1) / 5;
628 * qla24xx_build_scsi_iocbs() - Build IOCB command utilizing Command Type 7
631 * @sp: SRB command to process
632 * @cmd_pkt: Command type 3 IOCB
633 * @tot_dsds: Total number of segments to transfer
636 qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
641 scsi_qla_host_t *vha;
642 struct scsi_cmnd *cmd;
643 struct scatterlist *sg;
649 /* Update entry type to indicate Command Type 3 IOCB */
650 *((uint32_t *)(&cmd_pkt->entry_type)) =
651 __constant_cpu_to_le32(COMMAND_TYPE_7);
653 /* No data transfer */
654 if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
655 cmd_pkt->byte_count = __constant_cpu_to_le32(0);
662 /* Set transfer direction */
663 if (cmd->sc_data_direction == DMA_TO_DEVICE) {
664 cmd_pkt->task_mgmt_flags =
665 __constant_cpu_to_le16(TMF_WRITE_DATA);
666 sp->fcport->vha->hw->qla_stats.output_bytes +=
667 scsi_bufflen(sp->cmd);
668 } else if (cmd->sc_data_direction == DMA_FROM_DEVICE) {
669 cmd_pkt->task_mgmt_flags =
670 __constant_cpu_to_le16(TMF_READ_DATA);
671 sp->fcport->vha->hw->qla_stats.input_bytes +=
672 scsi_bufflen(sp->cmd);
675 /* One DSD is available in the Command Type 3 IOCB */
677 cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
679 /* Load data segments */
681 scsi_for_each_sg(cmd, sg, tot_dsds, i) {
683 cont_a64_entry_t *cont_pkt;
685 /* Allocate additional continuation packets? */
686 if (avail_dsds == 0) {
688 * Five DSDs are available in the Continuation
691 cont_pkt = qla2x00_prep_cont_type1_iocb(req, vha);
692 cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
696 sle_dma = sg_dma_address(sg);
697 *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
698 *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
699 *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
706 * qla24xx_start_scsi() - Send a SCSI command to the ISP
707 * @sp: command to send to the ISP
709 * Returns non-zero if a failure occurred, else zero.
712 qla24xx_start_scsi(srb_t *sp)
719 struct cmd_type_7 *cmd_pkt;
723 struct req_que *req = NULL;
724 struct rsp_que *rsp = NULL;
725 struct scsi_cmnd *cmd = sp->cmd;
726 struct scsi_qla_host *vha = sp->vha;
727 struct qla_hw_data *ha = vha->hw;
730 /* Setup device pointers. */
732 que_id = vha->req_ques[0];
734 req = ha->req_q_map[que_id];
740 rsp = ha->rsp_q_map[que_id];
741 /* So we know we haven't pci_map'ed anything yet */
744 /* Send marker if required */
745 if (vha->marker_needed != 0) {
746 if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL)
748 return QLA_FUNCTION_FAILED;
749 vha->marker_needed = 0;
752 /* Acquire ring specific lock */
753 spin_lock_irqsave(&ha->hardware_lock, flags);
755 /* Check for room in outstanding command list. */
756 handle = req->current_outstanding_cmd;
757 for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
759 if (handle == MAX_OUTSTANDING_COMMANDS)
761 if (!req->outstanding_cmds[handle])
764 if (index == MAX_OUTSTANDING_COMMANDS)
767 /* Map the sg table so we have an accurate count of sg entries needed */
768 if (scsi_sg_count(cmd)) {
769 nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd),
770 scsi_sg_count(cmd), cmd->sc_data_direction);
778 req_cnt = qla24xx_calc_iocbs(tot_dsds);
779 if (req->cnt < (req_cnt + 2)) {
780 cnt = ha->isp_ops->rd_req_reg(ha, req->id);
782 if (req->ring_index < cnt)
783 req->cnt = cnt - req->ring_index;
785 req->cnt = req->length -
786 (req->ring_index - cnt);
788 if (req->cnt < (req_cnt + 2))
791 /* Build command packet. */
792 req->current_outstanding_cmd = handle;
793 req->outstanding_cmds[handle] = sp;
795 sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
798 cmd_pkt = (struct cmd_type_7 *)req->ring_ptr;
799 cmd_pkt->handle = handle;
801 /* Zero out remaining portion of packet. */
802 /* tagged queuing modifier -- default is TSK_SIMPLE (0). */
803 clr_ptr = (uint32_t *)cmd_pkt + 2;
804 memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
805 cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
807 /* Set NPORT-ID and LUN number*/
808 cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id);
809 cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa;
810 cmd_pkt->port_id[1] = sp->fcport->d_id.b.area;
811 cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
812 cmd_pkt->vp_index = sp->fcport->vp_idx;
814 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun);
815 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
817 /* Load SCSI command packet. */
818 memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
819 host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb));
821 cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
823 /* Build IOCB segments */
824 qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds);
826 /* Set total data segment count. */
827 cmd_pkt->entry_count = (uint8_t)req_cnt;
830 /* Adjust ring index. */
832 if (req->ring_index == req->length) {
834 req->ring_ptr = req->ring;
838 sp->flags |= SRB_DMA_VALID;
840 /* Set chip new ring index. */
841 ha->isp_ops->wrt_req_reg(ha, req->id, req->ring_index);
843 /* Manage unprocessed RIO/ZIO commands in response queue. */
844 if (vha->flags.process_response_queue &&
845 rsp->ring_ptr->signature != RESPONSE_PROCESSED)
846 qla24xx_process_response_queue(rsp);
848 spin_unlock_irqrestore(&ha->hardware_lock, flags);
855 spin_unlock_irqrestore(&ha->hardware_lock, flags);
857 return QLA_FUNCTION_FAILED;
861 qla24xx_rd_req_reg(struct qla_hw_data *ha, uint16_t id)
863 device_reg_t __iomem *reg = (void *) ha->iobase;
864 return RD_REG_DWORD_RELAXED(®->isp24.req_q_out);
868 qla25xx_rd_req_reg(struct qla_hw_data *ha, uint16_t id)
870 device_reg_t __iomem *reg = (void *) ha->mqiobase + QLA_QUE_PAGE * id;
871 return RD_REG_DWORD_RELAXED(®->isp25mq.req_q_out);
875 qla24xx_wrt_req_reg(struct qla_hw_data *ha, uint16_t id, uint16_t index)
877 device_reg_t __iomem *reg = (void *) ha->iobase;
878 WRT_REG_DWORD(®->isp24.req_q_in, index);
879 RD_REG_DWORD_RELAXED(®->isp24.req_q_in);
883 qla25xx_wrt_req_reg(struct qla_hw_data *ha, uint16_t id, uint16_t index)
885 device_reg_t __iomem *reg = (void *) ha->mqiobase + QLA_QUE_PAGE * id;
886 struct device_reg_2xxx __iomem *ioreg = &ha->iobase->isp;
887 WRT_REG_DWORD(®->isp25mq.req_q_in, index);
888 RD_REG_DWORD(&ioreg->hccr); /* PCI posting */