diff options
Diffstat (limited to 'drivers/scsi/stex.c')
-rw-r--r-- | drivers/scsi/stex.c | 90 |
1 files changed, 54 insertions, 36 deletions
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 69be1324b114..9ac83abc4028 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -32,11 +32,12 @@ | |||
32 | #include <scsi/scsi_cmnd.h> | 32 | #include <scsi/scsi_cmnd.h> |
33 | #include <scsi/scsi_host.h> | 33 | #include <scsi/scsi_host.h> |
34 | #include <scsi/scsi_tcq.h> | 34 | #include <scsi/scsi_tcq.h> |
35 | #include <scsi/scsi_dbg.h> | ||
35 | 36 | ||
36 | #define DRV_NAME "stex" | 37 | #define DRV_NAME "stex" |
37 | #define ST_DRIVER_VERSION "3.1.0.1" | 38 | #define ST_DRIVER_VERSION "3.6.0000.1" |
38 | #define ST_VER_MAJOR 3 | 39 | #define ST_VER_MAJOR 3 |
39 | #define ST_VER_MINOR 1 | 40 | #define ST_VER_MINOR 6 |
40 | #define ST_OEM 0 | 41 | #define ST_OEM 0 |
41 | #define ST_BUILD_VER 1 | 42 | #define ST_BUILD_VER 1 |
42 | 43 | ||
@@ -113,10 +114,6 @@ enum { | |||
113 | SG_CF_64B = 0x40, /* 64 bit item */ | 114 | SG_CF_64B = 0x40, /* 64 bit item */ |
114 | SG_CF_HOST = 0x20, /* sg in host memory */ | 115 | SG_CF_HOST = 0x20, /* sg in host memory */ |
115 | 116 | ||
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, | 117 | st_shasta = 0, |
121 | st_vsc = 1, | 118 | st_vsc = 1, |
122 | st_vsc1 = 2, | 119 | st_vsc1 = 2, |
@@ -586,7 +583,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
586 | u16 tag; | 583 | u16 tag; |
587 | host = cmd->device->host; | 584 | host = cmd->device->host; |
588 | id = cmd->device->id; | 585 | id = cmd->device->id; |
589 | lun = cmd->device->channel; /* firmware lun issue work around */ | 586 | lun = cmd->device->lun; |
590 | hba = (struct st_hba *) &host->hostdata[0]; | 587 | hba = (struct st_hba *) &host->hostdata[0]; |
591 | 588 | ||
592 | switch (cmd->cmnd[0]) { | 589 | switch (cmd->cmnd[0]) { |
@@ -605,8 +602,26 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
605 | stex_invalid_field(cmd, done); | 602 | stex_invalid_field(cmd, done); |
606 | return 0; | 603 | return 0; |
607 | } | 604 | } |
605 | case REPORT_LUNS: | ||
606 | /* | ||
607 | * The shasta firmware does not report actual luns in the | ||
608 | * target, so fail the command to force sequential lun scan. | ||
609 | * Also, the console device does not support this command. | ||
610 | */ | ||
611 | if (hba->cardtype == st_shasta || id == host->max_id - 1) { | ||
612 | stex_invalid_field(cmd, done); | ||
613 | return 0; | ||
614 | } | ||
615 | break; | ||
616 | case TEST_UNIT_READY: | ||
617 | if (id == host->max_id - 1) { | ||
618 | cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; | ||
619 | done(cmd); | ||
620 | return 0; | ||
621 | } | ||
622 | break; | ||
608 | case INQUIRY: | 623 | case INQUIRY: |
609 | if (id != ST_MAX_ARRAY_SUPPORTED) | 624 | if (id != host->max_id - 1) |
610 | break; | 625 | break; |
611 | if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { | 626 | if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { |
612 | stex_direct_copy(cmd, console_inq_page, | 627 | stex_direct_copy(cmd, console_inq_page, |
@@ -624,7 +639,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
624 | ver.oem = ST_OEM; | 639 | ver.oem = ST_OEM; |
625 | ver.build = ST_BUILD_VER; | 640 | ver.build = ST_BUILD_VER; |
626 | ver.signature[0] = PASSTHRU_SIGNATURE; | 641 | ver.signature[0] = PASSTHRU_SIGNATURE; |
627 | ver.console_id = ST_MAX_ARRAY_SUPPORTED; | 642 | ver.console_id = host->max_id - 1; |
628 | ver.host_no = hba->host->host_no; | 643 | ver.host_no = hba->host->host_no; |
629 | cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? | 644 | cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? |
630 | DID_OK << 16 | COMMAND_COMPLETE << 8 : | 645 | DID_OK << 16 | COMMAND_COMPLETE << 8 : |
@@ -645,13 +660,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
645 | 660 | ||
646 | req = stex_alloc_req(hba); | 661 | req = stex_alloc_req(hba); |
647 | 662 | ||
648 | if (hba->cardtype == st_yosemite) { | 663 | req->lun = lun; |
649 | req->lun = lun * (ST_MAX_TARGET_NUM - 1) + id; | 664 | req->target = id; |
650 | req->target = 0; | ||
651 | } else { | ||
652 | req->lun = lun; | ||
653 | req->target = id; | ||
654 | } | ||
655 | 665 | ||
656 | /* cdb */ | 666 | /* cdb */ |
657 | memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); | 667 | memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); |
@@ -767,18 +777,6 @@ static void stex_ys_commands(struct st_hba *hba, | |||
767 | ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; | 777 | ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; |
768 | else | 778 | else |
769 | ccb->srb_status = SRB_STATUS_SUCCESS; | 779 | 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 | } | 780 | } |
783 | } | 781 | } |
784 | 782 | ||
@@ -995,6 +993,11 @@ static int stex_abort(struct scsi_cmnd *cmd) | |||
995 | u32 data; | 993 | u32 data; |
996 | int result = SUCCESS; | 994 | int result = SUCCESS; |
997 | unsigned long flags; | 995 | unsigned long flags; |
996 | |||
997 | printk(KERN_INFO DRV_NAME | ||
998 | "(%s): aborting command\n", pci_name(hba->pdev)); | ||
999 | scsi_print_command(cmd); | ||
1000 | |||
998 | base = hba->mmio_base; | 1001 | base = hba->mmio_base; |
999 | spin_lock_irqsave(host->host_lock, flags); | 1002 | spin_lock_irqsave(host->host_lock, flags); |
1000 | if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) | 1003 | if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) |
@@ -1051,7 +1054,12 @@ static void stex_hard_reset(struct st_hba *hba) | |||
1051 | pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); | 1054 | pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); |
1052 | pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; | 1055 | pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; |
1053 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); | 1056 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); |
1054 | msleep(1); | 1057 | |
1058 | /* | ||
1059 | * 1 ms may be enough for 8-port controllers. But 16-port controllers | ||
1060 | * require more time to finish bus reset. Use 100 ms here for safety | ||
1061 | */ | ||
1062 | msleep(100); | ||
1055 | pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; | 1063 | pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; |
1056 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); | 1064 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); |
1057 | 1065 | ||
@@ -1075,6 +1083,10 @@ static int stex_reset(struct scsi_cmnd *cmd) | |||
1075 | unsigned long before; | 1083 | unsigned long before; |
1076 | hba = (struct st_hba *) &cmd->device->host->hostdata[0]; | 1084 | hba = (struct st_hba *) &cmd->device->host->hostdata[0]; |
1077 | 1085 | ||
1086 | printk(KERN_INFO DRV_NAME | ||
1087 | "(%s): resetting host\n", pci_name(hba->pdev)); | ||
1088 | scsi_print_command(cmd); | ||
1089 | |||
1078 | hba->mu_status = MU_STATE_RESETTING; | 1090 | hba->mu_status = MU_STATE_RESETTING; |
1079 | 1091 | ||
1080 | if (hba->cardtype == st_shasta) | 1092 | if (hba->cardtype == st_shasta) |
@@ -1194,7 +1206,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1194 | goto out_scsi_host_put; | 1206 | goto out_scsi_host_put; |
1195 | } | 1207 | } |
1196 | 1208 | ||
1197 | hba->mmio_base = ioremap(pci_resource_start(pdev, 0), | 1209 | hba->mmio_base = ioremap_nocache(pci_resource_start(pdev, 0), |
1198 | pci_resource_len(pdev, 0)); | 1210 | pci_resource_len(pdev, 0)); |
1199 | if ( !hba->mmio_base) { | 1211 | if ( !hba->mmio_base) { |
1200 | printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", | 1212 | printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", |
@@ -1229,12 +1241,18 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1229 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; | 1241 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; |
1230 | hba->mu_status = MU_STATE_STARTING; | 1242 | hba->mu_status = MU_STATE_STARTING; |
1231 | 1243 | ||
1232 | /* firmware uses id/lun pair for a logical drive, but lun would be | 1244 | if (hba->cardtype == st_shasta) { |
1233 | always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use | 1245 | host->max_lun = 8; |
1234 | channel to map lun here */ | 1246 | host->max_id = 16 + 1; |
1235 | host->max_channel = ST_MAX_LUN_PER_TARGET - 1; | 1247 | } else if (hba->cardtype == st_yosemite) { |
1236 | host->max_id = ST_MAX_TARGET_NUM; | 1248 | host->max_lun = 128; |
1237 | host->max_lun = 1; | 1249 | host->max_id = 1 + 1; |
1250 | } else { | ||
1251 | /* st_vsc and st_vsc1 */ | ||
1252 | host->max_lun = 1; | ||
1253 | host->max_id = 128 + 1; | ||
1254 | } | ||
1255 | host->max_channel = 0; | ||
1238 | host->unique_id = host->host_no; | 1256 | host->unique_id = host->host_no; |
1239 | host->max_cmd_len = STEX_CDB_LENGTH; | 1257 | host->max_cmd_len = STEX_CDB_LENGTH; |
1240 | 1258 | ||