diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_iocb.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_iocb.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index c517a1478e44..c71863ff5489 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -179,7 +179,6 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
179 | cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; | 179 | cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; |
180 | 180 | ||
181 | /* Load data segments */ | 181 | /* Load data segments */ |
182 | |||
183 | scsi_for_each_sg(cmd, sg, tot_dsds, i) { | 182 | scsi_for_each_sg(cmd, sg, tot_dsds, i) { |
184 | cont_entry_t *cont_pkt; | 183 | cont_entry_t *cont_pkt; |
185 | 184 | ||
@@ -316,9 +315,14 @@ qla2x00_start_scsi(srb_t *sp) | |||
316 | goto queuing_error; | 315 | goto queuing_error; |
317 | 316 | ||
318 | /* Map the sg table so we have an accurate count of sg entries needed */ | 317 | /* Map the sg table so we have an accurate count of sg entries needed */ |
319 | nseg = scsi_dma_map(cmd); | 318 | if (scsi_sg_count(cmd)) { |
320 | if (nseg < 0) | 319 | nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd), |
321 | goto queuing_error; | 320 | scsi_sg_count(cmd), cmd->sc_data_direction); |
321 | if (unlikely(!nseg)) | ||
322 | goto queuing_error; | ||
323 | } else | ||
324 | nseg = 0; | ||
325 | |||
322 | tot_dsds = nseg; | 326 | tot_dsds = nseg; |
323 | 327 | ||
324 | /* Calculate the number of request entries needed. */ | 328 | /* Calculate the number of request entries needed. */ |
@@ -414,9 +418,10 @@ __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, | |||
414 | { | 418 | { |
415 | mrk_entry_t *mrk; | 419 | mrk_entry_t *mrk; |
416 | struct mrk_entry_24xx *mrk24; | 420 | struct mrk_entry_24xx *mrk24; |
421 | scsi_qla_host_t *pha = to_qla_parent(ha); | ||
417 | 422 | ||
418 | mrk24 = NULL; | 423 | mrk24 = NULL; |
419 | mrk = (mrk_entry_t *)qla2x00_req_pkt(ha); | 424 | mrk = (mrk_entry_t *)qla2x00_req_pkt(pha); |
420 | if (mrk == NULL) { | 425 | if (mrk == NULL) { |
421 | DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n", | 426 | DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n", |
422 | __func__, ha->host_no)); | 427 | __func__, ha->host_no)); |
@@ -433,6 +438,7 @@ __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, | |||
433 | mrk24->lun[1] = LSB(lun); | 438 | mrk24->lun[1] = LSB(lun); |
434 | mrk24->lun[2] = MSB(lun); | 439 | mrk24->lun[2] = MSB(lun); |
435 | host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun)); | 440 | host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun)); |
441 | mrk24->vp_index = ha->vp_idx; | ||
436 | } else { | 442 | } else { |
437 | SET_TARGET_ID(ha, mrk->target, loop_id); | 443 | SET_TARGET_ID(ha, mrk->target, loop_id); |
438 | mrk->lun = cpu_to_le16(lun); | 444 | mrk->lun = cpu_to_le16(lun); |
@@ -440,7 +446,7 @@ __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, | |||
440 | } | 446 | } |
441 | wmb(); | 447 | wmb(); |
442 | 448 | ||
443 | qla2x00_isp_cmd(ha); | 449 | qla2x00_isp_cmd(pha); |
444 | 450 | ||
445 | return (QLA_SUCCESS); | 451 | return (QLA_SUCCESS); |
446 | } | 452 | } |
@@ -712,9 +718,14 @@ qla24xx_start_scsi(srb_t *sp) | |||
712 | goto queuing_error; | 718 | goto queuing_error; |
713 | 719 | ||
714 | /* Map the sg table so we have an accurate count of sg entries needed */ | 720 | /* Map the sg table so we have an accurate count of sg entries needed */ |
715 | nseg = scsi_dma_map(cmd); | 721 | if (scsi_sg_count(cmd)) { |
716 | if (nseg < 0) | 722 | nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd), |
723 | scsi_sg_count(cmd), cmd->sc_data_direction); | ||
724 | if (unlikely(!nseg)) | ||
717 | goto queuing_error; | 725 | goto queuing_error; |
726 | } else | ||
727 | nseg = 0; | ||
728 | |||
718 | tot_dsds = nseg; | 729 | tot_dsds = nseg; |
719 | 730 | ||
720 | req_cnt = qla24xx_calc_iocbs(tot_dsds); | 731 | req_cnt = qla24xx_calc_iocbs(tot_dsds); |
@@ -750,6 +761,7 @@ qla24xx_start_scsi(srb_t *sp) | |||
750 | cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa; | 761 | cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa; |
751 | cmd_pkt->port_id[1] = sp->fcport->d_id.b.area; | 762 | cmd_pkt->port_id[1] = sp->fcport->d_id.b.area; |
752 | cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain; | 763 | cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain; |
764 | cmd_pkt->vp_index = sp->fcport->vp_idx; | ||
753 | 765 | ||
754 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); | 766 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); |
755 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); | 767 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); |