diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mr.c | 167 |
1 files changed, 87 insertions, 80 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c index a6df55838365..d7993797f46e 100644 --- a/drivers/scsi/qla2xxx/qla_mr.c +++ b/drivers/scsi/qla2xxx/qla_mr.c | |||
@@ -707,7 +707,7 @@ qlafx00_tmf_iocb_timeout(void *data) | |||
707 | srb_t *sp = (srb_t *)data; | 707 | srb_t *sp = (srb_t *)data; |
708 | struct srb_iocb *tmf = &sp->u.iocb_cmd; | 708 | struct srb_iocb *tmf = &sp->u.iocb_cmd; |
709 | 709 | ||
710 | tmf->u.tmf.comp_status = CS_TIMEOUT; | 710 | tmf->u.tmf.comp_status = cpu_to_le16((uint16_t)CS_TIMEOUT); |
711 | complete(&tmf->u.tmf.comp); | 711 | complete(&tmf->u.tmf.comp); |
712 | } | 712 | } |
713 | 713 | ||
@@ -1418,7 +1418,8 @@ qlafx00_init_response_q_entries(struct rsp_que *rsp) | |||
1418 | pkt = rsp->ring_ptr; | 1418 | pkt = rsp->ring_ptr; |
1419 | for (cnt = 0; cnt < rsp->length; cnt++) { | 1419 | for (cnt = 0; cnt < rsp->length; cnt++) { |
1420 | pkt->signature = RESPONSE_PROCESSED; | 1420 | pkt->signature = RESPONSE_PROCESSED; |
1421 | WRT_REG_DWORD(&pkt->signature, RESPONSE_PROCESSED); | 1421 | WRT_REG_DWORD((void __iomem *)&pkt->signature, |
1422 | RESPONSE_PROCESSED); | ||
1422 | pkt++; | 1423 | pkt++; |
1423 | } | 1424 | } |
1424 | } | 1425 | } |
@@ -1733,7 +1734,7 @@ qla2x00_fxdisc_sp_done(void *data, void *ptr, int res) | |||
1733 | } | 1734 | } |
1734 | 1735 | ||
1735 | int | 1736 | int |
1736 | qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t fx_type) | 1737 | qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) |
1737 | { | 1738 | { |
1738 | srb_t *sp; | 1739 | srb_t *sp; |
1739 | struct srb_iocb *fdisc; | 1740 | struct srb_iocb *fdisc; |
@@ -1759,13 +1760,13 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t fx_type) | |||
1759 | fdisc->u.fxiocb.flags = | 1760 | fdisc->u.fxiocb.flags = |
1760 | SRB_FXDISC_RESP_DMA_VALID | SRB_FXDISC_REQ_DWRD_VALID; | 1761 | SRB_FXDISC_RESP_DMA_VALID | SRB_FXDISC_REQ_DWRD_VALID; |
1761 | fdisc->u.fxiocb.rsp_len = QLAFX00_PORT_DATA_INFO; | 1762 | fdisc->u.fxiocb.rsp_len = QLAFX00_PORT_DATA_INFO; |
1762 | fdisc->u.fxiocb.req_data = fcport->port_id; | 1763 | fdisc->u.fxiocb.req_data = cpu_to_le32(fcport->port_id); |
1763 | break; | 1764 | break; |
1764 | case FXDISC_GET_TGT_NODE_INFO: | 1765 | case FXDISC_GET_TGT_NODE_INFO: |
1765 | fdisc->u.fxiocb.flags = | 1766 | fdisc->u.fxiocb.flags = |
1766 | SRB_FXDISC_RESP_DMA_VALID | SRB_FXDISC_REQ_DWRD_VALID; | 1767 | SRB_FXDISC_RESP_DMA_VALID | SRB_FXDISC_REQ_DWRD_VALID; |
1767 | fdisc->u.fxiocb.rsp_len = QLAFX00_TGT_NODE_INFO; | 1768 | fdisc->u.fxiocb.rsp_len = QLAFX00_TGT_NODE_INFO; |
1768 | fdisc->u.fxiocb.req_data = fcport->tgt_id; | 1769 | fdisc->u.fxiocb.req_data = cpu_to_le32(fcport->tgt_id); |
1769 | break; | 1770 | break; |
1770 | case FXDISC_GET_TGT_NODE_LIST: | 1771 | case FXDISC_GET_TGT_NODE_LIST: |
1771 | fdisc->u.fxiocb.flags = | 1772 | fdisc->u.fxiocb.flags = |
@@ -1851,7 +1852,7 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t fx_type) | |||
1851 | sp->name = "fxdisc"; | 1852 | sp->name = "fxdisc"; |
1852 | qla2x00_init_timer(sp, FXDISC_TIMEOUT); | 1853 | qla2x00_init_timer(sp, FXDISC_TIMEOUT); |
1853 | fdisc->timeout = qla2x00_fxdisc_iocb_timeout; | 1854 | fdisc->timeout = qla2x00_fxdisc_iocb_timeout; |
1854 | fdisc->u.fxiocb.req_func_type = fx_type; | 1855 | fdisc->u.fxiocb.req_func_type = cpu_to_le16(fx_type); |
1855 | sp->done = qla2x00_fxdisc_sp_done; | 1856 | sp->done = qla2x00_fxdisc_sp_done; |
1856 | 1857 | ||
1857 | rval = qla2x00_start_sp(sp); | 1858 | 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) | |||
1904 | (uint8_t *)pinfo, 16); | 1905 | (uint8_t *)pinfo, 16); |
1905 | memcpy(vha->hw->gid_list, pinfo, QLAFX00_TGT_NODE_LIST_SIZE); | 1906 | memcpy(vha->hw->gid_list, pinfo, QLAFX00_TGT_NODE_LIST_SIZE); |
1906 | } | 1907 | } |
1907 | rval = fdisc->u.fxiocb.result; | 1908 | rval = le32_to_cpu(fdisc->u.fxiocb.result); |
1908 | 1909 | ||
1909 | done_unmap_dma: | 1910 | done_unmap_dma: |
1910 | if (fdisc->u.fxiocb.rsp_addr) | 1911 | if (fdisc->u.fxiocb.rsp_addr) |
@@ -1927,7 +1928,7 @@ qlafx00_abort_iocb_timeout(void *data) | |||
1927 | srb_t *sp = (srb_t *)data; | 1928 | srb_t *sp = (srb_t *)data; |
1928 | struct srb_iocb *abt = &sp->u.iocb_cmd; | 1929 | struct srb_iocb *abt = &sp->u.iocb_cmd; |
1929 | 1930 | ||
1930 | abt->u.abt.comp_status = CS_TIMEOUT; | 1931 | abt->u.abt.comp_status = cpu_to_le16((uint16_t)CS_TIMEOUT); |
1931 | complete(&abt->u.abt.comp); | 1932 | complete(&abt->u.abt.comp); |
1932 | } | 1933 | } |
1933 | 1934 | ||
@@ -2169,14 +2170,14 @@ qlafx00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len, | |||
2169 | static void | 2170 | static void |
2170 | qlafx00_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | 2171 | qlafx00_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, |
2171 | struct tsk_mgmt_entry_fx00 *pkt, srb_t *sp, | 2172 | struct tsk_mgmt_entry_fx00 *pkt, srb_t *sp, |
2172 | uint16_t sstatus, uint16_t cpstatus) | 2173 | __le16 sstatus, __le16 cpstatus) |
2173 | { | 2174 | { |
2174 | struct srb_iocb *tmf; | 2175 | struct srb_iocb *tmf; |
2175 | 2176 | ||
2176 | tmf = &sp->u.iocb_cmd; | 2177 | tmf = &sp->u.iocb_cmd; |
2177 | if (cpstatus != CS_COMPLETE || | 2178 | if (cpstatus != cpu_to_le16((uint16_t)CS_COMPLETE) || |
2178 | (sstatus & SS_RESPONSE_INFO_LEN_VALID)) | 2179 | (sstatus & cpu_to_le16((uint16_t)SS_RESPONSE_INFO_LEN_VALID))) |
2179 | cpstatus = CS_INCOMPLETE; | 2180 | cpstatus = cpu_to_le16((uint16_t)CS_INCOMPLETE); |
2180 | tmf->u.tmf.comp_status = cpstatus; | 2181 | tmf->u.tmf.comp_status = cpstatus; |
2181 | sp->done(vha, sp, 0); | 2182 | sp->done(vha, sp, 0); |
2182 | } | 2183 | } |
@@ -2194,7 +2195,7 @@ qlafx00_abort_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
2194 | return; | 2195 | return; |
2195 | 2196 | ||
2196 | abt = &sp->u.iocb_cmd; | 2197 | abt = &sp->u.iocb_cmd; |
2197 | abt->u.abt.comp_status = le32_to_cpu(pkt->tgt_id_sts); | 2198 | abt->u.abt.comp_status = pkt->tgt_id_sts; |
2198 | sp->done(vha, sp, 0); | 2199 | sp->done(vha, sp, 0); |
2199 | } | 2200 | } |
2200 | 2201 | ||
@@ -2216,12 +2217,12 @@ qlafx00_ioctl_iosb_entry(scsi_qla_host_t *vha, struct req_que *req, | |||
2216 | 2217 | ||
2217 | if (sp->type == SRB_FXIOCB_DCMD) { | 2218 | if (sp->type == SRB_FXIOCB_DCMD) { |
2218 | iocb_job = &sp->u.iocb_cmd; | 2219 | iocb_job = &sp->u.iocb_cmd; |
2219 | iocb_job->u.fxiocb.seq_number = le32_to_cpu(pkt->seq_no); | 2220 | iocb_job->u.fxiocb.seq_number = pkt->seq_no; |
2220 | iocb_job->u.fxiocb.fw_flags = le32_to_cpu(pkt->fw_iotcl_flags); | 2221 | iocb_job->u.fxiocb.fw_flags = pkt->fw_iotcl_flags; |
2221 | iocb_job->u.fxiocb.result = le32_to_cpu(pkt->status); | 2222 | iocb_job->u.fxiocb.result = pkt->status; |
2222 | if (iocb_job->u.fxiocb.flags & SRB_FXDISC_RSP_DWRD_VALID) | 2223 | if (iocb_job->u.fxiocb.flags & SRB_FXDISC_RSP_DWRD_VALID) |
2223 | iocb_job->u.fxiocb.req_data = | 2224 | iocb_job->u.fxiocb.req_data = |
2224 | le32_to_cpu(pkt->dataword_r); | 2225 | pkt->dataword_r; |
2225 | } else { | 2226 | } else { |
2226 | bsg_job = sp->u.bsg_job; | 2227 | bsg_job = sp->u.bsg_job; |
2227 | 2228 | ||
@@ -2275,10 +2276,10 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
2275 | fc_port_t *fcport; | 2276 | fc_port_t *fcport; |
2276 | struct scsi_cmnd *cp; | 2277 | struct scsi_cmnd *cp; |
2277 | struct sts_entry_fx00 *sts; | 2278 | struct sts_entry_fx00 *sts; |
2278 | uint16_t comp_status; | 2279 | __le16 comp_status; |
2279 | uint16_t scsi_status; | 2280 | __le16 scsi_status; |
2280 | uint16_t ox_id; | 2281 | uint16_t ox_id; |
2281 | uint8_t lscsi_status; | 2282 | __le16 lscsi_status; |
2282 | int32_t resid; | 2283 | int32_t resid; |
2283 | uint32_t sense_len, par_sense_len, rsp_info_len, resid_len, | 2284 | uint32_t sense_len, par_sense_len, rsp_info_len, resid_len, |
2284 | fw_resid_len; | 2285 | fw_resid_len; |
@@ -2292,8 +2293,8 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
2292 | 2293 | ||
2293 | sts = (struct sts_entry_fx00 *) pkt; | 2294 | sts = (struct sts_entry_fx00 *) pkt; |
2294 | 2295 | ||
2295 | comp_status = le16_to_cpu(sts->comp_status); | 2296 | comp_status = sts->comp_status; |
2296 | scsi_status = le16_to_cpu(sts->scsi_status) & SS_MASK; | 2297 | scsi_status = sts->scsi_status & cpu_to_le16((uint16_t)SS_MASK); |
2297 | hindex = sts->handle; | 2298 | hindex = sts->handle; |
2298 | handle = LSW(hindex); | 2299 | handle = LSW(hindex); |
2299 | 2300 | ||
@@ -2339,38 +2340,40 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
2339 | return; | 2340 | return; |
2340 | } | 2341 | } |
2341 | 2342 | ||
2342 | lscsi_status = scsi_status & STATUS_MASK; | 2343 | lscsi_status = scsi_status & cpu_to_le16((uint16_t)STATUS_MASK); |
2343 | 2344 | ||
2344 | fcport = sp->fcport; | 2345 | fcport = sp->fcport; |
2345 | 2346 | ||
2346 | ox_id = 0; | 2347 | ox_id = 0; |
2347 | sense_len = par_sense_len = rsp_info_len = resid_len = | 2348 | sense_len = par_sense_len = rsp_info_len = resid_len = |
2348 | fw_resid_len = 0; | 2349 | fw_resid_len = 0; |
2349 | if (scsi_status & SS_SENSE_LEN_VALID) | 2350 | if (scsi_status & cpu_to_le16((uint16_t)SS_SENSE_LEN_VALID)) |
2350 | sense_len = le32_to_cpu(sts->sense_len); | 2351 | sense_len = sts->sense_len; |
2351 | if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) | 2352 | if (scsi_status & cpu_to_le16(((uint16_t)SS_RESIDUAL_UNDER |
2353 | | (uint16_t)SS_RESIDUAL_OVER))) | ||
2352 | resid_len = le32_to_cpu(sts->residual_len); | 2354 | resid_len = le32_to_cpu(sts->residual_len); |
2353 | if (comp_status == CS_DATA_UNDERRUN) | 2355 | if (comp_status == cpu_to_le16((uint16_t)CS_DATA_UNDERRUN)) |
2354 | fw_resid_len = le32_to_cpu(sts->residual_len); | 2356 | fw_resid_len = le32_to_cpu(sts->residual_len); |
2355 | rsp_info = sense_data = sts->data; | 2357 | rsp_info = sense_data = sts->data; |
2356 | par_sense_len = sizeof(sts->data); | 2358 | par_sense_len = sizeof(sts->data); |
2357 | 2359 | ||
2358 | /* Check for overrun. */ | 2360 | /* Check for overrun. */ |
2359 | if (comp_status == CS_COMPLETE && | 2361 | if (comp_status == CS_COMPLETE && |
2360 | scsi_status & SS_RESIDUAL_OVER) | 2362 | scsi_status & cpu_to_le16((uint16_t)SS_RESIDUAL_OVER)) |
2361 | comp_status = CS_DATA_OVERRUN; | 2363 | comp_status = cpu_to_le16((uint16_t)CS_DATA_OVERRUN); |
2362 | 2364 | ||
2363 | /* | 2365 | /* |
2364 | * Based on Host and scsi status generate status code for Linux | 2366 | * Based on Host and scsi status generate status code for Linux |
2365 | */ | 2367 | */ |
2366 | switch (comp_status) { | 2368 | switch (le16_to_cpu(comp_status)) { |
2367 | case CS_COMPLETE: | 2369 | case CS_COMPLETE: |
2368 | case CS_QUEUE_FULL: | 2370 | case CS_QUEUE_FULL: |
2369 | if (scsi_status == 0) { | 2371 | if (scsi_status == 0) { |
2370 | res = DID_OK << 16; | 2372 | res = DID_OK << 16; |
2371 | break; | 2373 | break; |
2372 | } | 2374 | } |
2373 | if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) { | 2375 | if (scsi_status & cpu_to_le16(((uint16_t)SS_RESIDUAL_UNDER |
2376 | | (uint16_t)SS_RESIDUAL_OVER))) { | ||
2374 | resid = resid_len; | 2377 | resid = resid_len; |
2375 | scsi_set_resid(cp, resid); | 2378 | scsi_set_resid(cp, resid); |
2376 | 2379 | ||
@@ -2386,19 +2389,20 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
2386 | break; | 2389 | break; |
2387 | } | 2390 | } |
2388 | } | 2391 | } |
2389 | res = DID_OK << 16 | lscsi_status; | 2392 | res = DID_OK << 16 | le16_to_cpu(lscsi_status); |
2390 | 2393 | ||
2391 | if (lscsi_status == SAM_STAT_TASK_SET_FULL) { | 2394 | if (lscsi_status == |
2395 | cpu_to_le16((uint16_t)SAM_STAT_TASK_SET_FULL)) { | ||
2392 | ql_dbg(ql_dbg_io, fcport->vha, 0x3051, | 2396 | ql_dbg(ql_dbg_io, fcport->vha, 0x3051, |
2393 | "QUEUE FULL detected.\n"); | 2397 | "QUEUE FULL detected.\n"); |
2394 | break; | 2398 | break; |
2395 | } | 2399 | } |
2396 | logit = 0; | 2400 | logit = 0; |
2397 | if (lscsi_status != SS_CHECK_CONDITION) | 2401 | if (lscsi_status != cpu_to_le16((uint16_t)SS_CHECK_CONDITION)) |
2398 | break; | 2402 | break; |
2399 | 2403 | ||
2400 | memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 2404 | memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
2401 | if (!(scsi_status & SS_SENSE_LEN_VALID)) | 2405 | if (!(scsi_status & cpu_to_le16((uint16_t)SS_SENSE_LEN_VALID))) |
2402 | break; | 2406 | break; |
2403 | 2407 | ||
2404 | qlafx00_handle_sense(sp, sense_data, par_sense_len, sense_len, | 2408 | 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) | |||
2412 | else | 2416 | else |
2413 | resid = resid_len; | 2417 | resid = resid_len; |
2414 | scsi_set_resid(cp, resid); | 2418 | scsi_set_resid(cp, resid); |
2415 | if (scsi_status & SS_RESIDUAL_UNDER) { | 2419 | if (scsi_status & cpu_to_le16((uint16_t)SS_RESIDUAL_UNDER)) { |
2416 | if ((IS_FWI2_CAPABLE(ha) || IS_QLAFX00(ha)) | 2420 | if ((IS_FWI2_CAPABLE(ha) || IS_QLAFX00(ha)) |
2417 | && fw_resid_len != resid_len) { | 2421 | && fw_resid_len != resid_len) { |
2418 | ql_dbg(ql_dbg_io, fcport->vha, 0x3052, | 2422 | 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) | |||
2420 | "(0x%x of 0x%x bytes).\n", | 2424 | "(0x%x of 0x%x bytes).\n", |
2421 | resid, scsi_bufflen(cp)); | 2425 | resid, scsi_bufflen(cp)); |
2422 | 2426 | ||
2423 | res = DID_ERROR << 16 | lscsi_status; | 2427 | res = DID_ERROR << 16 | |
2428 | le16_to_cpu(lscsi_status); | ||
2424 | goto check_scsi_status; | 2429 | goto check_scsi_status; |
2425 | } | 2430 | } |
2426 | 2431 | ||
@@ -2436,8 +2441,9 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
2436 | res = DID_ERROR << 16; | 2441 | res = DID_ERROR << 16; |
2437 | break; | 2442 | break; |
2438 | } | 2443 | } |
2439 | } else if (lscsi_status != SAM_STAT_TASK_SET_FULL && | 2444 | } else if (lscsi_status != |
2440 | lscsi_status != SAM_STAT_BUSY) { | 2445 | cpu_to_le16((uint16_t)SAM_STAT_TASK_SET_FULL) && |
2446 | lscsi_status != cpu_to_le16((uint16_t)SAM_STAT_BUSY)) { | ||
2441 | /* | 2447 | /* |
2442 | * scsi status of task set and busy are considered | 2448 | * scsi status of task set and busy are considered |
2443 | * to be task not completed. | 2449 | * to be task not completed. |
@@ -2448,7 +2454,7 @@ qlafx00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
2448 | "of 0x%x bytes).\n", resid, | 2454 | "of 0x%x bytes).\n", resid, |
2449 | scsi_bufflen(cp)); | 2455 | scsi_bufflen(cp)); |
2450 | 2456 | ||
2451 | res = DID_ERROR << 16 | lscsi_status; | 2457 | res = DID_ERROR << 16 | le16_to_cpu(lscsi_status); |
2452 | goto check_scsi_status; | 2458 | goto check_scsi_status; |
2453 | } else { | 2459 | } else { |
2454 | ql_dbg(ql_dbg_io, fcport->vha, 0x3055, | 2460 | 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) | |||
2456 | scsi_status, lscsi_status); | 2462 | scsi_status, lscsi_status); |
2457 | } | 2463 | } |
2458 | 2464 | ||
2459 | res = DID_OK << 16 | lscsi_status; | 2465 | res = DID_OK << 16 | le16_to_cpu(lscsi_status); |
2460 | logit = 0; | 2466 | logit = 0; |
2461 | 2467 | ||
2462 | check_scsi_status: | 2468 | check_scsi_status: |
@@ -2465,17 +2471,20 @@ check_scsi_status: | |||
2465 | * Status. | 2471 | * Status. |
2466 | */ | 2472 | */ |
2467 | if (lscsi_status != 0) { | 2473 | if (lscsi_status != 0) { |
2468 | if (lscsi_status == SAM_STAT_TASK_SET_FULL) { | 2474 | if (lscsi_status == |
2475 | cpu_to_le16((uint16_t)SAM_STAT_TASK_SET_FULL)) { | ||
2469 | ql_dbg(ql_dbg_io, fcport->vha, 0x3056, | 2476 | ql_dbg(ql_dbg_io, fcport->vha, 0x3056, |
2470 | "QUEUE FULL detected.\n"); | 2477 | "QUEUE FULL detected.\n"); |
2471 | logit = 1; | 2478 | logit = 1; |
2472 | break; | 2479 | break; |
2473 | } | 2480 | } |
2474 | if (lscsi_status != SS_CHECK_CONDITION) | 2481 | if (lscsi_status != |
2482 | cpu_to_le16((uint16_t)SS_CHECK_CONDITION)) | ||
2475 | break; | 2483 | break; |
2476 | 2484 | ||
2477 | memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 2485 | memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
2478 | if (!(scsi_status & SS_SENSE_LEN_VALID)) | 2486 | if (!(scsi_status & |
2487 | cpu_to_le16((uint16_t)SS_SENSE_LEN_VALID))) | ||
2479 | break; | 2488 | break; |
2480 | 2489 | ||
2481 | qlafx00_handle_sense(sp, sense_data, par_sense_len, | 2490 | qlafx00_handle_sense(sp, sense_data, par_sense_len, |
@@ -2629,7 +2638,7 @@ qlafx00_multistatus_entry(struct scsi_qla_host *vha, | |||
2629 | uint32_t handle, hindex, handle_count, i; | 2638 | uint32_t handle, hindex, handle_count, i; |
2630 | uint16_t que; | 2639 | uint16_t que; |
2631 | struct req_que *req; | 2640 | struct req_que *req; |
2632 | uint32_t *handle_ptr; | 2641 | __le32 *handle_ptr; |
2633 | 2642 | ||
2634 | stsmfx = (struct multi_sts_entry_fx00 *) pkt; | 2643 | stsmfx = (struct multi_sts_entry_fx00 *) pkt; |
2635 | 2644 | ||
@@ -2643,7 +2652,7 @@ qlafx00_multistatus_entry(struct scsi_qla_host *vha, | |||
2643 | return; | 2652 | return; |
2644 | } | 2653 | } |
2645 | 2654 | ||
2646 | handle_ptr = (uint32_t *) &stsmfx->handles[0]; | 2655 | handle_ptr = &stsmfx->handles[0]; |
2647 | 2656 | ||
2648 | for (i = 0; i < handle_count; i++) { | 2657 | for (i = 0; i < handle_count; i++) { |
2649 | hindex = le32_to_cpu(*handle_ptr); | 2658 | hindex = le32_to_cpu(*handle_ptr); |
@@ -2714,10 +2723,11 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha, | |||
2714 | if (!vha->flags.online) | 2723 | if (!vha->flags.online) |
2715 | return; | 2724 | return; |
2716 | 2725 | ||
2717 | while (RD_REG_DWORD(&(rsp->ring_ptr->signature)) != | 2726 | while (RD_REG_DWORD((void __iomem *)&(rsp->ring_ptr->signature)) != |
2718 | RESPONSE_PROCESSED) { | 2727 | RESPONSE_PROCESSED) { |
2719 | lptr = rsp->ring_ptr; | 2728 | lptr = rsp->ring_ptr; |
2720 | memcpy_fromio(rsp->rsp_pkt, lptr, sizeof(rsp->rsp_pkt)); | 2729 | memcpy_fromio(rsp->rsp_pkt, (void __iomem *)lptr, |
2730 | sizeof(rsp->rsp_pkt)); | ||
2721 | pkt = (struct sts_entry_fx00 *)rsp->rsp_pkt; | 2731 | pkt = (struct sts_entry_fx00 *)rsp->rsp_pkt; |
2722 | 2732 | ||
2723 | rsp->ring_index++; | 2733 | rsp->ring_index++; |
@@ -2768,7 +2778,8 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha, | |||
2768 | break; | 2778 | break; |
2769 | } | 2779 | } |
2770 | next_iter: | 2780 | next_iter: |
2771 | WRT_REG_DWORD(&lptr->signature, RESPONSE_PROCESSED); | 2781 | WRT_REG_DWORD((void __iomem *)&lptr->signature, |
2782 | RESPONSE_PROCESSED); | ||
2772 | wmb(); | 2783 | wmb(); |
2773 | } | 2784 | } |
2774 | 2785 | ||
@@ -2958,8 +2969,7 @@ qlafx00_prep_cont_type1_iocb(struct req_que *req, | |||
2958 | cont_pkt = (cont_a64_entry_t *)req->ring_ptr; | 2969 | cont_pkt = (cont_a64_entry_t *)req->ring_ptr; |
2959 | 2970 | ||
2960 | /* Load packet defaults. */ | 2971 | /* Load packet defaults. */ |
2961 | *((uint32_t *)(&lcont_pkt->entry_type)) = | 2972 | lcont_pkt->entry_type = CONTINUE_A64_TYPE_FX00; |
2962 | __constant_cpu_to_le32(CONTINUE_A64_TYPE_FX00); | ||
2963 | 2973 | ||
2964 | return cont_pkt; | 2974 | return cont_pkt; |
2965 | } | 2975 | } |
@@ -2969,7 +2979,7 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt, | |||
2969 | uint16_t tot_dsds, struct cmd_type_7_fx00 *lcmd_pkt) | 2979 | uint16_t tot_dsds, struct cmd_type_7_fx00 *lcmd_pkt) |
2970 | { | 2980 | { |
2971 | uint16_t avail_dsds; | 2981 | uint16_t avail_dsds; |
2972 | uint32_t *cur_dsd; | 2982 | __le32 *cur_dsd; |
2973 | scsi_qla_host_t *vha; | 2983 | scsi_qla_host_t *vha; |
2974 | struct scsi_cmnd *cmd; | 2984 | struct scsi_cmnd *cmd; |
2975 | struct scatterlist *sg; | 2985 | struct scatterlist *sg; |
@@ -2986,8 +2996,7 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt, | |||
2986 | cont_pkt = NULL; | 2996 | cont_pkt = NULL; |
2987 | 2997 | ||
2988 | /* Update entry type to indicate Command Type 3 IOCB */ | 2998 | /* Update entry type to indicate Command Type 3 IOCB */ |
2989 | *((uint32_t *)(&lcmd_pkt->entry_type)) = | 2999 | lcmd_pkt->entry_type = FX00_COMMAND_TYPE_7; |
2990 | __constant_cpu_to_le32(FX00_COMMAND_TYPE_7); | ||
2991 | 3000 | ||
2992 | /* No data transfer */ | 3001 | /* No data transfer */ |
2993 | if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) { | 3002 | 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, | |||
3006 | 3015 | ||
3007 | /* One DSD is available in the Command Type 3 IOCB */ | 3016 | /* One DSD is available in the Command Type 3 IOCB */ |
3008 | avail_dsds = 1; | 3017 | avail_dsds = 1; |
3009 | cur_dsd = (uint32_t *)&lcmd_pkt->dseg_0_address; | 3018 | cur_dsd = (__le32 *)&lcmd_pkt->dseg_0_address; |
3010 | 3019 | ||
3011 | /* Load data segments */ | 3020 | /* Load data segments */ |
3012 | scsi_for_each_sg(cmd, sg, tot_dsds, i) { | 3021 | 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, | |||
3021 | memset(&lcont_pkt, 0, REQUEST_ENTRY_SIZE); | 3030 | memset(&lcont_pkt, 0, REQUEST_ENTRY_SIZE); |
3022 | cont_pkt = | 3031 | cont_pkt = |
3023 | qlafx00_prep_cont_type1_iocb(req, &lcont_pkt); | 3032 | qlafx00_prep_cont_type1_iocb(req, &lcont_pkt); |
3024 | cur_dsd = (uint32_t *)lcont_pkt.dseg_0_address; | 3033 | cur_dsd = (__le32 *)lcont_pkt.dseg_0_address; |
3025 | avail_dsds = 5; | 3034 | avail_dsds = 5; |
3026 | cont = 1; | 3035 | cont = 1; |
3027 | } | 3036 | } |
@@ -3224,13 +3233,13 @@ qlafx00_tm_iocb(srb_t *sp, struct tsk_mgmt_entry_fx00 *ptm_iocb) | |||
3224 | tm_iocb.timeout = cpu_to_le16(qla2x00_get_async_timeout(vha) + 2); | 3233 | tm_iocb.timeout = cpu_to_le16(qla2x00_get_async_timeout(vha) + 2); |
3225 | tm_iocb.tgt_id = cpu_to_le16(sp->fcport->tgt_id); | 3234 | tm_iocb.tgt_id = cpu_to_le16(sp->fcport->tgt_id); |
3226 | tm_iocb.control_flags = cpu_to_le32(fxio->u.tmf.flags); | 3235 | tm_iocb.control_flags = cpu_to_le32(fxio->u.tmf.flags); |
3227 | if (tm_iocb.control_flags == TCF_LUN_RESET) { | 3236 | if (tm_iocb.control_flags == cpu_to_le32((uint32_t)TCF_LUN_RESET)) { |
3228 | int_to_scsilun(fxio->u.tmf.lun, &llun); | 3237 | int_to_scsilun(fxio->u.tmf.lun, &llun); |
3229 | host_to_adap((uint8_t *)&llun, (uint8_t *)&tm_iocb.lun, | 3238 | host_to_adap((uint8_t *)&llun, (uint8_t *)&tm_iocb.lun, |
3230 | sizeof(struct scsi_lun)); | 3239 | sizeof(struct scsi_lun)); |
3231 | } | 3240 | } |
3232 | 3241 | ||
3233 | memcpy((void __iomem *)ptm_iocb, &tm_iocb, | 3242 | memcpy((void *)ptm_iocb, &tm_iocb, |
3234 | sizeof(struct tsk_mgmt_entry_fx00)); | 3243 | sizeof(struct tsk_mgmt_entry_fx00)); |
3235 | wmb(); | 3244 | wmb(); |
3236 | } | 3245 | } |
@@ -3252,7 +3261,7 @@ qlafx00_abort_iocb(srb_t *sp, struct abort_iocb_entry_fx00 *pabt_iocb) | |||
3252 | abt_iocb.tgt_id_sts = cpu_to_le16(sp->fcport->tgt_id); | 3261 | abt_iocb.tgt_id_sts = cpu_to_le16(sp->fcport->tgt_id); |
3253 | abt_iocb.req_que_no = cpu_to_le16(req->id); | 3262 | abt_iocb.req_que_no = cpu_to_le16(req->id); |
3254 | 3263 | ||
3255 | memcpy((void __iomem *)pabt_iocb, &abt_iocb, | 3264 | memcpy((void *)pabt_iocb, &abt_iocb, |
3256 | sizeof(struct abort_iocb_entry_fx00)); | 3265 | sizeof(struct abort_iocb_entry_fx00)); |
3257 | wmb(); | 3266 | wmb(); |
3258 | } | 3267 | } |
@@ -3273,13 +3282,12 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) | |||
3273 | 3282 | ||
3274 | if (sp->type == SRB_FXIOCB_DCMD) { | 3283 | if (sp->type == SRB_FXIOCB_DCMD) { |
3275 | fx_iocb.func_num = | 3284 | fx_iocb.func_num = |
3276 | cpu_to_le16(sp->u.iocb_cmd.u.fxiocb.req_func_type); | 3285 | sp->u.iocb_cmd.u.fxiocb.req_func_type; |
3277 | fx_iocb.adapid = cpu_to_le32(fxio->u.fxiocb.adapter_id); | 3286 | fx_iocb.adapid = fxio->u.fxiocb.adapter_id; |
3278 | fx_iocb.adapid_hi = cpu_to_le32(fxio->u.fxiocb.adapter_id_hi); | 3287 | fx_iocb.adapid_hi = fxio->u.fxiocb.adapter_id_hi; |
3279 | fx_iocb.reserved_0 = cpu_to_le32(fxio->u.fxiocb.reserved_0); | 3288 | fx_iocb.reserved_0 = fxio->u.fxiocb.reserved_0; |
3280 | fx_iocb.reserved_1 = cpu_to_le32(fxio->u.fxiocb.reserved_1); | 3289 | fx_iocb.reserved_1 = fxio->u.fxiocb.reserved_1; |
3281 | fx_iocb.dataword_extra = | 3290 | fx_iocb.dataword_extra = fxio->u.fxiocb.req_data_extra; |
3282 | cpu_to_le32(fxio->u.fxiocb.req_data_extra); | ||
3283 | 3291 | ||
3284 | if (fxio->u.fxiocb.flags & SRB_FXDISC_REQ_DMA_VALID) { | 3292 | if (fxio->u.fxiocb.flags & SRB_FXDISC_REQ_DMA_VALID) { |
3285 | fx_iocb.req_dsdcnt = cpu_to_le16(1); | 3293 | fx_iocb.req_dsdcnt = cpu_to_le16(1); |
@@ -3306,8 +3314,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) | |||
3306 | } | 3314 | } |
3307 | 3315 | ||
3308 | if (fxio->u.fxiocb.flags & SRB_FXDISC_REQ_DWRD_VALID) { | 3316 | if (fxio->u.fxiocb.flags & SRB_FXDISC_REQ_DWRD_VALID) { |
3309 | fx_iocb.dataword = | 3317 | fx_iocb.dataword = fxio->u.fxiocb.req_data; |
3310 | cpu_to_le32(fxio->u.fxiocb.req_data); | ||
3311 | } | 3318 | } |
3312 | fx_iocb.flags = fxio->u.fxiocb.flags; | 3319 | fx_iocb.flags = fxio->u.fxiocb.flags; |
3313 | } else { | 3320 | } else { |
@@ -3323,21 +3330,21 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) | |||
3323 | fx_iocb.reserved_1 = piocb_rqst->reserved_1; | 3330 | fx_iocb.reserved_1 = piocb_rqst->reserved_1; |
3324 | fx_iocb.dataword_extra = piocb_rqst->dataword_extra; | 3331 | fx_iocb.dataword_extra = piocb_rqst->dataword_extra; |
3325 | fx_iocb.dataword = piocb_rqst->dataword; | 3332 | fx_iocb.dataword = piocb_rqst->dataword; |
3326 | fx_iocb.req_xfrcnt = cpu_to_le16(piocb_rqst->req_len); | 3333 | fx_iocb.req_xfrcnt = piocb_rqst->req_len; |
3327 | fx_iocb.rsp_xfrcnt = cpu_to_le16(piocb_rqst->rsp_len); | 3334 | fx_iocb.rsp_xfrcnt = piocb_rqst->rsp_len; |
3328 | 3335 | ||
3329 | if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) { | 3336 | if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) { |
3330 | int avail_dsds, tot_dsds; | 3337 | int avail_dsds, tot_dsds; |
3331 | cont_a64_entry_t lcont_pkt; | 3338 | cont_a64_entry_t lcont_pkt; |
3332 | cont_a64_entry_t *cont_pkt = NULL; | 3339 | cont_a64_entry_t *cont_pkt = NULL; |
3333 | uint32_t *cur_dsd; | 3340 | __le32 *cur_dsd; |
3334 | int index = 0, cont = 0; | 3341 | int index = 0, cont = 0; |
3335 | 3342 | ||
3336 | fx_iocb.req_dsdcnt = | 3343 | fx_iocb.req_dsdcnt = |
3337 | cpu_to_le16(bsg_job->request_payload.sg_cnt); | 3344 | cpu_to_le16(bsg_job->request_payload.sg_cnt); |
3338 | tot_dsds = | 3345 | tot_dsds = |
3339 | cpu_to_le32(bsg_job->request_payload.sg_cnt); | 3346 | bsg_job->request_payload.sg_cnt; |
3340 | cur_dsd = (uint32_t *)&fx_iocb.dseg_rq_address[0]; | 3347 | cur_dsd = (__le32 *)&fx_iocb.dseg_rq_address[0]; |
3341 | avail_dsds = 1; | 3348 | avail_dsds = 1; |
3342 | for_each_sg(bsg_job->request_payload.sg_list, sg, | 3349 | for_each_sg(bsg_job->request_payload.sg_list, sg, |
3343 | tot_dsds, index) { | 3350 | tot_dsds, index) { |
@@ -3355,7 +3362,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) | |||
3355 | qlafx00_prep_cont_type1_iocb( | 3362 | qlafx00_prep_cont_type1_iocb( |
3356 | sp->fcport->vha->req, | 3363 | sp->fcport->vha->req, |
3357 | &lcont_pkt); | 3364 | &lcont_pkt); |
3358 | cur_dsd = (uint32_t *) | 3365 | cur_dsd = (__le32 *) |
3359 | lcont_pkt.dseg_0_address; | 3366 | lcont_pkt.dseg_0_address; |
3360 | avail_dsds = 5; | 3367 | avail_dsds = 5; |
3361 | cont = 1; | 3368 | cont = 1; |
@@ -3393,13 +3400,13 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) | |||
3393 | int avail_dsds, tot_dsds; | 3400 | int avail_dsds, tot_dsds; |
3394 | cont_a64_entry_t lcont_pkt; | 3401 | cont_a64_entry_t lcont_pkt; |
3395 | cont_a64_entry_t *cont_pkt = NULL; | 3402 | cont_a64_entry_t *cont_pkt = NULL; |
3396 | uint32_t *cur_dsd; | 3403 | __le32 *cur_dsd; |
3397 | int index = 0, cont = 0; | 3404 | int index = 0, cont = 0; |
3398 | 3405 | ||
3399 | fx_iocb.rsp_dsdcnt = | 3406 | fx_iocb.rsp_dsdcnt = |
3400 | cpu_to_le16(bsg_job->reply_payload.sg_cnt); | 3407 | cpu_to_le16(bsg_job->reply_payload.sg_cnt); |
3401 | tot_dsds = cpu_to_le32(bsg_job->reply_payload.sg_cnt); | 3408 | tot_dsds = bsg_job->reply_payload.sg_cnt; |
3402 | cur_dsd = (uint32_t *)&fx_iocb.dseg_rsp_address[0]; | 3409 | cur_dsd = (__le32 *)&fx_iocb.dseg_rsp_address[0]; |
3403 | avail_dsds = 1; | 3410 | avail_dsds = 1; |
3404 | 3411 | ||
3405 | for_each_sg(bsg_job->reply_payload.sg_list, sg, | 3412 | 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) | |||
3418 | qlafx00_prep_cont_type1_iocb( | 3425 | qlafx00_prep_cont_type1_iocb( |
3419 | sp->fcport->vha->req, | 3426 | sp->fcport->vha->req, |
3420 | &lcont_pkt); | 3427 | &lcont_pkt); |
3421 | cur_dsd = (uint32_t *) | 3428 | cur_dsd = (__le32 *) |
3422 | lcont_pkt.dseg_0_address; | 3429 | lcont_pkt.dseg_0_address; |
3423 | avail_dsds = 5; | 3430 | avail_dsds = 5; |
3424 | cont = 1; | 3431 | cont = 1; |
@@ -3453,7 +3460,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) | |||
3453 | } | 3460 | } |
3454 | 3461 | ||
3455 | if (piocb_rqst->flags & SRB_FXDISC_REQ_DWRD_VALID) | 3462 | if (piocb_rqst->flags & SRB_FXDISC_REQ_DWRD_VALID) |
3456 | fx_iocb.dataword = cpu_to_le32(piocb_rqst->dataword); | 3463 | fx_iocb.dataword = piocb_rqst->dataword; |
3457 | fx_iocb.flags = piocb_rqst->flags; | 3464 | fx_iocb.flags = piocb_rqst->flags; |
3458 | fx_iocb.entry_count = entry_cnt; | 3465 | fx_iocb.entry_count = entry_cnt; |
3459 | } | 3466 | } |
@@ -3462,7 +3469,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) | |||
3462 | sp->fcport->vha, 0x3047, | 3469 | sp->fcport->vha, 0x3047, |
3463 | (uint8_t *)&fx_iocb, sizeof(struct fxdisc_entry_fx00)); | 3470 | (uint8_t *)&fx_iocb, sizeof(struct fxdisc_entry_fx00)); |
3464 | 3471 | ||
3465 | memcpy((void __iomem *)pfxiocb, &fx_iocb, | 3472 | memcpy((void *)pfxiocb, &fx_iocb, |
3466 | sizeof(struct fxdisc_entry_fx00)); | 3473 | sizeof(struct fxdisc_entry_fx00)); |
3467 | wmb(); | 3474 | wmb(); |
3468 | } | 3475 | } |