]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/scsi/qla2xxx/qla_mr.c
Merge branch 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj...
[mirror_ubuntu-artful-kernel.git] / drivers / scsi / qla2xxx / qla_mr.c
index a6df55838365e2ebac0c15abe52cecb462518f48..d7993797f46e1339d4a36e05b88c6a49905c1d96 100644 (file)
@@ -707,7 +707,7 @@ qlafx00_tmf_iocb_timeout(void *data)
        srb_t *sp = (srb_t *)data;
        struct srb_iocb *tmf = &sp->u.iocb_cmd;
 
-       tmf->u.tmf.comp_status = CS_TIMEOUT;
+       tmf->u.tmf.comp_status = cpu_to_le16((uint16_t)CS_TIMEOUT);
        complete(&tmf->u.tmf.comp);
 }
 
@@ -1418,7 +1418,8 @@ qlafx00_init_response_q_entries(struct rsp_que *rsp)
        pkt = rsp->ring_ptr;
        for (cnt = 0; cnt < rsp->length; cnt++) {
                pkt->signature = RESPONSE_PROCESSED;
-               WRT_REG_DWORD(&pkt->signature, RESPONSE_PROCESSED);
+               WRT_REG_DWORD((void __iomem *)&pkt->signature,
+                   RESPONSE_PROCESSED);
                pkt++;
        }
 }
@@ -1733,7 +1734,7 @@ qla2x00_fxdisc_sp_done(void *data, void *ptr, int res)
 }
 
 int
-qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t fx_type)
+qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)
 {
        srb_t *sp;
        struct srb_iocb *fdisc;
@@ -1759,13 +1760,13 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t fx_type)
                fdisc->u.fxiocb.flags =
                    SRB_FXDISC_RESP_DMA_VALID | SRB_FXDISC_REQ_DWRD_VALID;
                fdisc->u.fxiocb.rsp_len = QLAFX00_PORT_DATA_INFO;
-               fdisc->u.fxiocb.req_data = fcport->port_id;
+               fdisc->u.fxiocb.req_data = cpu_to_le32(fcport->port_id);
                break;
        case FXDISC_GET_TGT_NODE_INFO:
                fdisc->u.fxiocb.flags =
                    SRB_FXDISC_RESP_DMA_VALID | SRB_FXDISC_REQ_DWRD_VALID;
                fdisc->u.fxiocb.rsp_len = QLAFX00_TGT_NODE_INFO;
-               fdisc->u.fxiocb.req_data = fcport->tgt_id;
+               fdisc->u.fxiocb.req_data = cpu_to_le32(fcport->tgt_id);
                break;
        case FXDISC_GET_TGT_NODE_LIST:
                fdisc->u.fxiocb.flags =
@@ -1851,7 +1852,7 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t fx_type)
        sp->name = "fxdisc";
        qla2x00_init_timer(sp, FXDISC_TIMEOUT);
        fdisc->timeout = qla2x00_fxdisc_iocb_timeout;
-       fdisc->u.fxiocb.req_func_type = fx_type;
+       fdisc->u.fxiocb.req_func_type = cpu_to_le16(fx_type);
        sp->done = qla2x00_fxdisc_sp_done;
 
        rval = qla2x00_start_sp(sp);
@@ -1904,7 +1905,7 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t fx_type)
                    (uint8_t *)pinfo, 16);
                memcpy(vha->hw->gid_list, pinfo, QLAFX00_TGT_NODE_LIST_SIZE);
        }
-       rval = fdisc->u.fxiocb.result;
+       rval = le32_to_cpu(fdisc->u.fxiocb.result);
 
 done_unmap_dma:
        if (fdisc->u.fxiocb.rsp_addr)
@@ -1927,7 +1928,7 @@ qlafx00_abort_iocb_timeout(void *data)
        srb_t *sp = (srb_t *)data;
        struct srb_iocb *abt = &sp->u.iocb_cmd;
 
-       abt->u.abt.comp_status = CS_TIMEOUT;
+       abt->u.abt.comp_status = cpu_to_le16((uint16_t)CS_TIMEOUT);
        complete(&abt->u.abt.comp);
 }
 
@@ -2169,14 +2170,14 @@ qlafx00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len,
 static void
 qlafx00_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
                      struct tsk_mgmt_entry_fx00 *pkt, srb_t *sp,
-                     uint16_t sstatus, uint16_t cpstatus)
+                     __le16 sstatus, __le16 cpstatus)
 {
        struct srb_iocb *tmf;
 
        tmf = &sp->u.iocb_cmd;
-       if (cpstatus != CS_COMPLETE ||
-           (sstatus & SS_RESPONSE_INFO_LEN_VALID))
-               cpstatus = CS_INCOMPLETE;
+       if (cpstatus != cpu_to_le16((uint16_t)CS_COMPLETE) ||
+           (sstatus & cpu_to_le16((uint16_t)SS_RESPONSE_INFO_LEN_VALID)))
+               cpstatus = cpu_to_le16((uint16_t)CS_INCOMPLETE);
        tmf->u.tmf.comp_status = cpstatus;
        sp->done(vha, sp, 0);
 }
@@ -2194,7 +2195,7 @@ qlafx00_abort_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
                return;
 
        abt = &sp->u.iocb_cmd;
-       abt->u.abt.comp_status = le32_to_cpu(pkt->tgt_id_sts);
+       abt->u.abt.comp_status = pkt->tgt_id_sts;
        sp->done(vha, sp, 0);
 }
 
@@ -2216,12 +2217,12 @@ qlafx00_ioctl_iosb_entry(scsi_qla_host_t *vha, struct req_que *req,
 
        if (sp->type == SRB_FXIOCB_DCMD) {
                iocb_job = &sp->u.iocb_cmd;
-               iocb_job->u.fxiocb.seq_number = le32_to_cpu(pkt->seq_no);
-               iocb_job->u.fxiocb.fw_flags = le32_to_cpu(pkt->fw_iotcl_flags);
-               iocb_job->u.fxiocb.result = le32_to_cpu(pkt->status);
+               iocb_job->u.fxiocb.seq_number = pkt->seq_no;
+               iocb_job->u.fxiocb.fw_flags = pkt->fw_iotcl_flags;
+               iocb_job->u.fxiocb.result = pkt->status;
                if (iocb_job->u.fxiocb.flags & SRB_FXDISC_RSP_DWRD_VALID)
                        iocb_job->u.fxiocb.req_data =
-                           le32_to_cpu(pkt->dataword_r);
+                           pkt->dataword_r;
        } else {
                bsg_job = sp->u.bsg_job;
 
@@ -2275,10 +2276,10 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
        fc_port_t       *fcport;
        struct scsi_cmnd *cp;
        struct sts_entry_fx00 *sts;
-       uint16_t        comp_status;
-       uint16_t        scsi_status;
+       __le16          comp_status;
+       __le16          scsi_status;
        uint16_t        ox_id;
-       uint8_t         lscsi_status;
+       __le16          lscsi_status;
        int32_t         resid;
        uint32_t        sense_len, par_sense_len, rsp_info_len, resid_len,
            fw_resid_len;
@@ -2292,8 +2293,8 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
 
        sts = (struct sts_entry_fx00 *) pkt;
 
-       comp_status = le16_to_cpu(sts->comp_status);
-       scsi_status = le16_to_cpu(sts->scsi_status) & SS_MASK;
+       comp_status = sts->comp_status;
+       scsi_status = sts->scsi_status & cpu_to_le16((uint16_t)SS_MASK);
        hindex = sts->handle;
        handle = LSW(hindex);
 
@@ -2339,38 +2340,40 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                return;
        }
 
-       lscsi_status = scsi_status & STATUS_MASK;
+       lscsi_status = scsi_status & cpu_to_le16((uint16_t)STATUS_MASK);
 
        fcport = sp->fcport;
 
        ox_id = 0;
        sense_len = par_sense_len = rsp_info_len = resid_len =
                fw_resid_len = 0;
-       if (scsi_status & SS_SENSE_LEN_VALID)
-               sense_len = le32_to_cpu(sts->sense_len);
-       if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER))
+       if (scsi_status & cpu_to_le16((uint16_t)SS_SENSE_LEN_VALID))
+               sense_len = sts->sense_len;
+       if (scsi_status & cpu_to_le16(((uint16_t)SS_RESIDUAL_UNDER
+           | (uint16_t)SS_RESIDUAL_OVER)))
                resid_len = le32_to_cpu(sts->residual_len);
-       if (comp_status == CS_DATA_UNDERRUN)
+       if (comp_status == cpu_to_le16((uint16_t)CS_DATA_UNDERRUN))
                fw_resid_len = le32_to_cpu(sts->residual_len);
        rsp_info = sense_data = sts->data;
        par_sense_len = sizeof(sts->data);
 
        /* Check for overrun. */
        if (comp_status == CS_COMPLETE &&
-           scsi_status & SS_RESIDUAL_OVER)
-               comp_status = CS_DATA_OVERRUN;
+           scsi_status & cpu_to_le16((uint16_t)SS_RESIDUAL_OVER))
+               comp_status = cpu_to_le16((uint16_t)CS_DATA_OVERRUN);
 
        /*
         * Based on Host and scsi status generate status code for Linux
         */
-       switch (comp_status) {
+       switch (le16_to_cpu(comp_status)) {
        case CS_COMPLETE:
        case CS_QUEUE_FULL:
                if (scsi_status == 0) {
                        res = DID_OK << 16;
                        break;
                }
-               if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) {
+               if (scsi_status & cpu_to_le16(((uint16_t)SS_RESIDUAL_UNDER
+                   | (uint16_t)SS_RESIDUAL_OVER))) {
                        resid = resid_len;
                        scsi_set_resid(cp, resid);
 
@@ -2386,19 +2389,20 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                                break;
                        }
                }
-               res = DID_OK << 16 | lscsi_status;
+               res = DID_OK << 16 | le16_to_cpu(lscsi_status);
 
-               if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
+               if (lscsi_status ==
+                   cpu_to_le16((uint16_t)SAM_STAT_TASK_SET_FULL)) {
                        ql_dbg(ql_dbg_io, fcport->vha, 0x3051,
                            "QUEUE FULL detected.\n");
                        break;
                }
                logit = 0;
-               if (lscsi_status != SS_CHECK_CONDITION)
+               if (lscsi_status != cpu_to_le16((uint16_t)SS_CHECK_CONDITION))
                        break;
 
                memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-               if (!(scsi_status & SS_SENSE_LEN_VALID))
+               if (!(scsi_status & cpu_to_le16((uint16_t)SS_SENSE_LEN_VALID)))
                        break;
 
                qlafx00_handle_sense(sp, sense_data, par_sense_len, sense_len,
@@ -2412,7 +2416,7 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                else
                        resid = resid_len;
                scsi_set_resid(cp, resid);
-               if (scsi_status & SS_RESIDUAL_UNDER) {
+               if (scsi_status & cpu_to_le16((uint16_t)SS_RESIDUAL_UNDER)) {
                        if ((IS_FWI2_CAPABLE(ha) || IS_QLAFX00(ha))
                            && fw_resid_len != resid_len) {
                                ql_dbg(ql_dbg_io, fcport->vha, 0x3052,
@@ -2420,7 +2424,8 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                                    "(0x%x of 0x%x bytes).\n",
                                    resid, scsi_bufflen(cp));
 
-                               res = DID_ERROR << 16 | lscsi_status;
+                               res = DID_ERROR << 16 |
+                                   le16_to_cpu(lscsi_status);
                                goto check_scsi_status;
                        }
 
@@ -2436,8 +2441,9 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                                res = DID_ERROR << 16;
                                break;
                        }
-               } else if (lscsi_status != SAM_STAT_TASK_SET_FULL &&
-                           lscsi_status != SAM_STAT_BUSY) {
+               } else if (lscsi_status !=
+                   cpu_to_le16((uint16_t)SAM_STAT_TASK_SET_FULL) &&
+                   lscsi_status != cpu_to_le16((uint16_t)SAM_STAT_BUSY)) {
                        /*
                         * scsi status of task set and busy are considered
                         * to be task not completed.
@@ -2448,7 +2454,7 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                            "of 0x%x bytes).\n", resid,
                            scsi_bufflen(cp));
 
-                       res = DID_ERROR << 16 | lscsi_status;
+                       res = DID_ERROR << 16 | le16_to_cpu(lscsi_status);
                        goto check_scsi_status;
                } else {
                        ql_dbg(ql_dbg_io, fcport->vha, 0x3055,
@@ -2456,7 +2462,7 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                            scsi_status, lscsi_status);
                }
 
-               res = DID_OK << 16 | lscsi_status;
+               res = DID_OK << 16 | le16_to_cpu(lscsi_status);
                logit = 0;
 
 check_scsi_status:
@@ -2465,17 +2471,20 @@ check_scsi_status:
                 * Status.
                 */
                if (lscsi_status != 0) {
-                       if (lscsi_status == SAM_STAT_TASK_SET_FULL) {
+                       if (lscsi_status ==
+                           cpu_to_le16((uint16_t)SAM_STAT_TASK_SET_FULL)) {
                                ql_dbg(ql_dbg_io, fcport->vha, 0x3056,
                                    "QUEUE FULL detected.\n");
                                logit = 1;
                                break;
                        }
-                       if (lscsi_status != SS_CHECK_CONDITION)
+                       if (lscsi_status !=
+                           cpu_to_le16((uint16_t)SS_CHECK_CONDITION))
                                break;
 
                        memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-                       if (!(scsi_status & SS_SENSE_LEN_VALID))
+                       if (!(scsi_status &
+                           cpu_to_le16((uint16_t)SS_SENSE_LEN_VALID)))
                                break;
 
                        qlafx00_handle_sense(sp, sense_data, par_sense_len,
@@ -2629,7 +2638,7 @@ qlafx00_multistatus_entry(struct scsi_qla_host *vha,
        uint32_t handle, hindex, handle_count, i;
        uint16_t que;
        struct req_que *req;
-       uint32_t *handle_ptr;
+       __le32 *handle_ptr;
 
        stsmfx = (struct multi_sts_entry_fx00 *) pkt;
 
@@ -2643,7 +2652,7 @@ qlafx00_multistatus_entry(struct scsi_qla_host *vha,
                return;
        }
 
-       handle_ptr = (uint32_t *) &stsmfx->handles[0];
+       handle_ptr =  &stsmfx->handles[0];
 
        for (i = 0; i < handle_count; i++) {
                hindex = le32_to_cpu(*handle_ptr);
@@ -2714,10 +2723,11 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha,
        if (!vha->flags.online)
                return;
 
-       while (RD_REG_DWORD(&(rsp->ring_ptr->signature)) !=
+       while (RD_REG_DWORD((void __iomem *)&(rsp->ring_ptr->signature)) !=
            RESPONSE_PROCESSED) {
                lptr = rsp->ring_ptr;
-               memcpy_fromio(rsp->rsp_pkt, lptr, sizeof(rsp->rsp_pkt));
+               memcpy_fromio(rsp->rsp_pkt, (void __iomem *)lptr,
+                   sizeof(rsp->rsp_pkt));
                pkt = (struct sts_entry_fx00 *)rsp->rsp_pkt;
 
                rsp->ring_index++;
@@ -2768,7 +2778,8 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha,
                        break;
                }
 next_iter:
-               WRT_REG_DWORD(&lptr->signature, RESPONSE_PROCESSED);
+               WRT_REG_DWORD((void __iomem *)&lptr->signature,
+                   RESPONSE_PROCESSED);
                wmb();
        }
 
@@ -2958,8 +2969,7 @@ qlafx00_prep_cont_type1_iocb(struct req_que *req,
        cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
 
        /* Load packet defaults. */
-       *((uint32_t *)(&lcont_pkt->entry_type)) =
-           __constant_cpu_to_le32(CONTINUE_A64_TYPE_FX00);
+       lcont_pkt->entry_type = CONTINUE_A64_TYPE_FX00;
 
        return cont_pkt;
 }
@@ -2969,7 +2979,7 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt,
                         uint16_t tot_dsds, struct cmd_type_7_fx00 *lcmd_pkt)
 {
        uint16_t        avail_dsds;
-       uint32_t        *cur_dsd;
+       __le32 *cur_dsd;
        scsi_qla_host_t *vha;
        struct scsi_cmnd *cmd;
        struct scatterlist *sg;
@@ -2986,8 +2996,7 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt,
        cont_pkt = NULL;
 
        /* Update entry type to indicate Command Type 3 IOCB */
-       *((uint32_t *)(&lcmd_pkt->entry_type)) =
-           __constant_cpu_to_le32(FX00_COMMAND_TYPE_7);
+       lcmd_pkt->entry_type = FX00_COMMAND_TYPE_7;
 
        /* No data transfer */
        if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
@@ -3006,7 +3015,7 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt,
 
        /* One DSD is available in the Command Type 3 IOCB */
        avail_dsds = 1;
-       cur_dsd = (uint32_t *)&lcmd_pkt->dseg_0_address;
+       cur_dsd = (__le32 *)&lcmd_pkt->dseg_0_address;
 
        /* Load data segments */
        scsi_for_each_sg(cmd, sg, tot_dsds, i) {
@@ -3021,7 +3030,7 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt,
                        memset(&lcont_pkt, 0, REQUEST_ENTRY_SIZE);
                        cont_pkt =
                            qlafx00_prep_cont_type1_iocb(req, &lcont_pkt);
-                       cur_dsd = (uint32_t *)lcont_pkt.dseg_0_address;
+                       cur_dsd = (__le32 *)lcont_pkt.dseg_0_address;
                        avail_dsds = 5;
                        cont = 1;
                }
@@ -3224,13 +3233,13 @@ qlafx00_tm_iocb(srb_t *sp, struct tsk_mgmt_entry_fx00 *ptm_iocb)
        tm_iocb.timeout = cpu_to_le16(qla2x00_get_async_timeout(vha) + 2);
        tm_iocb.tgt_id = cpu_to_le16(sp->fcport->tgt_id);
        tm_iocb.control_flags = cpu_to_le32(fxio->u.tmf.flags);
-       if (tm_iocb.control_flags == TCF_LUN_RESET) {
+       if (tm_iocb.control_flags == cpu_to_le32((uint32_t)TCF_LUN_RESET)) {
                int_to_scsilun(fxio->u.tmf.lun, &llun);
                host_to_adap((uint8_t *)&llun, (uint8_t *)&tm_iocb.lun,
                    sizeof(struct scsi_lun));
        }
 
-       memcpy((void __iomem *)ptm_iocb, &tm_iocb,
+       memcpy((void *)ptm_iocb, &tm_iocb,
            sizeof(struct tsk_mgmt_entry_fx00));
        wmb();
 }
@@ -3252,7 +3261,7 @@ qlafx00_abort_iocb(srb_t *sp, struct abort_iocb_entry_fx00 *pabt_iocb)
        abt_iocb.tgt_id_sts = cpu_to_le16(sp->fcport->tgt_id);
        abt_iocb.req_que_no = cpu_to_le16(req->id);
 
-       memcpy((void __iomem *)pabt_iocb, &abt_iocb,
+       memcpy((void *)pabt_iocb, &abt_iocb,
            sizeof(struct abort_iocb_entry_fx00));
        wmb();
 }
@@ -3273,13 +3282,12 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
 
        if (sp->type == SRB_FXIOCB_DCMD) {
                fx_iocb.func_num =
-                   cpu_to_le16(sp->u.iocb_cmd.u.fxiocb.req_func_type);
-               fx_iocb.adapid = cpu_to_le32(fxio->u.fxiocb.adapter_id);
-               fx_iocb.adapid_hi = cpu_to_le32(fxio->u.fxiocb.adapter_id_hi);
-               fx_iocb.reserved_0 = cpu_to_le32(fxio->u.fxiocb.reserved_0);
-               fx_iocb.reserved_1 = cpu_to_le32(fxio->u.fxiocb.reserved_1);
-               fx_iocb.dataword_extra =
-                   cpu_to_le32(fxio->u.fxiocb.req_data_extra);
+                   sp->u.iocb_cmd.u.fxiocb.req_func_type;
+               fx_iocb.adapid = fxio->u.fxiocb.adapter_id;
+               fx_iocb.adapid_hi = fxio->u.fxiocb.adapter_id_hi;
+               fx_iocb.reserved_0 = fxio->u.fxiocb.reserved_0;
+               fx_iocb.reserved_1 = fxio->u.fxiocb.reserved_1;
+               fx_iocb.dataword_extra = fxio->u.fxiocb.req_data_extra;
 
                if (fxio->u.fxiocb.flags & SRB_FXDISC_REQ_DMA_VALID) {
                        fx_iocb.req_dsdcnt = cpu_to_le16(1);
@@ -3306,8 +3314,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
                }
 
                if (fxio->u.fxiocb.flags & SRB_FXDISC_REQ_DWRD_VALID) {
-                       fx_iocb.dataword =
-                           cpu_to_le32(fxio->u.fxiocb.req_data);
+                       fx_iocb.dataword = fxio->u.fxiocb.req_data;
                }
                fx_iocb.flags = fxio->u.fxiocb.flags;
        } else {
@@ -3323,21 +3330,21 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
                fx_iocb.reserved_1 = piocb_rqst->reserved_1;
                fx_iocb.dataword_extra = piocb_rqst->dataword_extra;
                fx_iocb.dataword = piocb_rqst->dataword;
-               fx_iocb.req_xfrcnt = cpu_to_le16(piocb_rqst->req_len);
-               fx_iocb.rsp_xfrcnt = cpu_to_le16(piocb_rqst->rsp_len);
+               fx_iocb.req_xfrcnt = piocb_rqst->req_len;
+               fx_iocb.rsp_xfrcnt = piocb_rqst->rsp_len;
 
                if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) {
                        int avail_dsds, tot_dsds;
                        cont_a64_entry_t lcont_pkt;
                        cont_a64_entry_t *cont_pkt = NULL;
-                       uint32_t *cur_dsd;
+                       __le32 *cur_dsd;
                        int index = 0, cont = 0;
 
                        fx_iocb.req_dsdcnt =
                            cpu_to_le16(bsg_job->request_payload.sg_cnt);
                        tot_dsds =
-                           cpu_to_le32(bsg_job->request_payload.sg_cnt);
-                       cur_dsd = (uint32_t *)&fx_iocb.dseg_rq_address[0];
+                           bsg_job->request_payload.sg_cnt;
+                       cur_dsd = (__le32 *)&fx_iocb.dseg_rq_address[0];
                        avail_dsds = 1;
                        for_each_sg(bsg_job->request_payload.sg_list, sg,
                            tot_dsds, index) {
@@ -3355,7 +3362,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
                                            qlafx00_prep_cont_type1_iocb(
                                                sp->fcport->vha->req,
                                                &lcont_pkt);
-                                       cur_dsd = (uint32_t *)
+                                       cur_dsd = (__le32 *)
                                            lcont_pkt.dseg_0_address;
                                        avail_dsds = 5;
                                        cont = 1;
@@ -3393,13 +3400,13 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
                        int avail_dsds, tot_dsds;
                        cont_a64_entry_t lcont_pkt;
                        cont_a64_entry_t *cont_pkt = NULL;
-                       uint32_t *cur_dsd;
+                       __le32 *cur_dsd;
                        int index = 0, cont = 0;
 
                        fx_iocb.rsp_dsdcnt =
                           cpu_to_le16(bsg_job->reply_payload.sg_cnt);
-                       tot_dsds = cpu_to_le32(bsg_job->reply_payload.sg_cnt);
-                       cur_dsd = (uint32_t *)&fx_iocb.dseg_rsp_address[0];
+                       tot_dsds = bsg_job->reply_payload.sg_cnt;
+                       cur_dsd = (__le32 *)&fx_iocb.dseg_rsp_address[0];
                        avail_dsds = 1;
 
                        for_each_sg(bsg_job->reply_payload.sg_list, sg,
@@ -3418,7 +3425,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
                                            qlafx00_prep_cont_type1_iocb(
                                                sp->fcport->vha->req,
                                                &lcont_pkt);
-                                       cur_dsd = (uint32_t *)
+                                       cur_dsd = (__le32 *)
                                            lcont_pkt.dseg_0_address;
                                        avail_dsds = 5;
                                        cont = 1;
@@ -3453,7 +3460,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
                }
 
                if (piocb_rqst->flags & SRB_FXDISC_REQ_DWRD_VALID)
-                       fx_iocb.dataword = cpu_to_le32(piocb_rqst->dataword);
+                       fx_iocb.dataword = piocb_rqst->dataword;
                fx_iocb.flags = piocb_rqst->flags;
                fx_iocb.entry_count = entry_cnt;
        }
@@ -3462,7 +3469,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
            sp->fcport->vha, 0x3047,
            (uint8_t *)&fx_iocb, sizeof(struct fxdisc_entry_fx00));
 
-       memcpy((void __iomem *)pfxiocb, &fx_iocb,
+       memcpy((void *)pfxiocb, &fx_iocb,
            sizeof(struct fxdisc_entry_fx00));
        wmb();
 }