aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/stex.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/stex.c')
-rw-r--r--drivers/scsi/stex.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 69be1324b114..96dcbac9545e 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -113,10 +113,6 @@ enum {
113 SG_CF_64B = 0x40, /* 64 bit item */ 113 SG_CF_64B = 0x40, /* 64 bit item */
114 SG_CF_HOST = 0x20, /* sg in host memory */ 114 SG_CF_HOST = 0x20, /* sg in host memory */
115 115
116 ST_MAX_ARRAY_SUPPORTED = 16,
117 ST_MAX_TARGET_NUM = (ST_MAX_ARRAY_SUPPORTED+1),
118 ST_MAX_LUN_PER_TARGET = 16,
119
120 st_shasta = 0, 116 st_shasta = 0,
121 st_vsc = 1, 117 st_vsc = 1,
122 st_vsc1 = 2, 118 st_vsc1 = 2,
@@ -586,7 +582,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
586 u16 tag; 582 u16 tag;
587 host = cmd->device->host; 583 host = cmd->device->host;
588 id = cmd->device->id; 584 id = cmd->device->id;
589 lun = cmd->device->channel; /* firmware lun issue work around */ 585 lun = cmd->device->lun;
590 hba = (struct st_hba *) &host->hostdata[0]; 586 hba = (struct st_hba *) &host->hostdata[0];
591 587
592 switch (cmd->cmnd[0]) { 588 switch (cmd->cmnd[0]) {
@@ -605,8 +601,19 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
605 stex_invalid_field(cmd, done); 601 stex_invalid_field(cmd, done);
606 return 0; 602 return 0;
607 } 603 }
604 case REPORT_LUNS:
605 /*
606 * The shasta firmware does not report actual luns in the
607 * target, so fail the command to force sequential lun scan.
608 * Also, the console device does not support this command.
609 */
610 if (hba->cardtype == st_shasta || id == host->max_id - 1) {
611 stex_invalid_field(cmd, done);
612 return 0;
613 }
614 break;
608 case INQUIRY: 615 case INQUIRY:
609 if (id != ST_MAX_ARRAY_SUPPORTED) 616 if (id != host->max_id - 1)
610 break; 617 break;
611 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { 618 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {
612 stex_direct_copy(cmd, console_inq_page, 619 stex_direct_copy(cmd, console_inq_page,
@@ -624,7 +631,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
624 ver.oem = ST_OEM; 631 ver.oem = ST_OEM;
625 ver.build = ST_BUILD_VER; 632 ver.build = ST_BUILD_VER;
626 ver.signature[0] = PASSTHRU_SIGNATURE; 633 ver.signature[0] = PASSTHRU_SIGNATURE;
627 ver.console_id = ST_MAX_ARRAY_SUPPORTED; 634 ver.console_id = host->max_id - 1;
628 ver.host_no = hba->host->host_no; 635 ver.host_no = hba->host->host_no;
629 cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? 636 cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ?
630 DID_OK << 16 | COMMAND_COMPLETE << 8 : 637 DID_OK << 16 | COMMAND_COMPLETE << 8 :
@@ -645,13 +652,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
645 652
646 req = stex_alloc_req(hba); 653 req = stex_alloc_req(hba);
647 654
648 if (hba->cardtype == st_yosemite) { 655 req->lun = lun;
649 req->lun = lun * (ST_MAX_TARGET_NUM - 1) + id; 656 req->target = id;
650 req->target = 0;
651 } else {
652 req->lun = lun;
653 req->target = id;
654 }
655 657
656 /* cdb */ 658 /* cdb */
657 memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); 659 memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH);
@@ -767,18 +769,6 @@ static void stex_ys_commands(struct st_hba *hba,
767 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; 769 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT;
768 else 770 else
769 ccb->srb_status = SRB_STATUS_SUCCESS; 771 ccb->srb_status = SRB_STATUS_SUCCESS;
770 } else if (ccb->cmd->cmnd[0] == REPORT_LUNS) {
771 u8 *report_lun_data = (u8 *)hba->copy_buffer;
772
773 count = STEX_EXTRA_SIZE;
774 stex_internal_copy(ccb->cmd, report_lun_data,
775 &count, ccb->sg_count, ST_FROM_CMD);
776 if (report_lun_data[2] || report_lun_data[3]) {
777 report_lun_data[2] = 0x00;
778 report_lun_data[3] = 0x08;
779 stex_internal_copy(ccb->cmd, report_lun_data,
780 &count, ccb->sg_count, ST_TO_CMD);
781 }
782 } 772 }
783} 773}
784 774
@@ -1229,12 +1219,18 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1229 hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; 1219 hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE;
1230 hba->mu_status = MU_STATE_STARTING; 1220 hba->mu_status = MU_STATE_STARTING;
1231 1221
1232 /* firmware uses id/lun pair for a logical drive, but lun would be 1222 if (hba->cardtype == st_shasta) {
1233 always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use 1223 host->max_lun = 8;
1234 channel to map lun here */ 1224 host->max_id = 16 + 1;
1235 host->max_channel = ST_MAX_LUN_PER_TARGET - 1; 1225 } else if (hba->cardtype == st_yosemite) {
1236 host->max_id = ST_MAX_TARGET_NUM; 1226 host->max_lun = 128;
1237 host->max_lun = 1; 1227 host->max_id = 1 + 1;
1228 } else {
1229 /* st_vsc and st_vsc1 */
1230 host->max_lun = 1;
1231 host->max_id = 128 + 1;
1232 }
1233 host->max_channel = 0;
1238 host->unique_id = host->host_no; 1234 host->unique_id = host->host_no;
1239 host->max_cmd_len = STEX_CDB_LENGTH; 1235 host->max_cmd_len = STEX_CDB_LENGTH;
1240 1236