aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2006-03-31 21:07:45 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-04-13 11:13:31 -0400
commit4d7db04a7a69099accd84984a78c64d2178252f1 (patch)
tree4b447d05c77290bffe88339915da1186910234a3
parentd637c4543fdc86cbef5805c679d24bb665172a7d (diff)
[SCSI] add SCSI_UNKNOWN and LUN transfer limit restrictions
Original From: Ingo Flaschberger <if@xip.at> To support the RA4100 array from Compaq. This patch now correctly handles SCSI_UNKNOWN types with regard to BLIST_REPORTLUNS2 (allow it) and cdb[1] LUN inclusion (don't). It also allows a BLIST_MAX_512 flag to restrict the maximum transfer length to 512 blocks (apparently this is an RA4100 problem). Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/scsi.c3
-rw-r--r--drivers/scsi/scsi_devinfo.c4
-rw-r--r--drivers/scsi/scsi_scan.c19
-rw-r--r--include/scsi/scsi_devinfo.h1
4 files changed, 21 insertions, 6 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 32979fee6186..73994e2ac2cb 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -565,7 +565,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
565 /* 565 /*
566 * If SCSI-2 or lower, store the LUN value in cmnd. 566 * If SCSI-2 or lower, store the LUN value in cmnd.
567 */ 567 */
568 if (cmd->device->scsi_level <= SCSI_2) { 568 if (cmd->device->scsi_level <= SCSI_2 &&
569 cmd->device->scsi_level != SCSI_UNKNOWN) {
569 cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) | 570 cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
570 (cmd->device->lun << 5 & 0xe0); 571 (cmd->device->lun << 5 & 0xe0);
571 } 572 }
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 84c3937ae8fb..c750d3399a97 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -132,7 +132,9 @@ static struct {
132 {"CMD", "CRA-7280", NULL, BLIST_SPARSELUN}, /* CMD RAID Controller */ 132 {"CMD", "CRA-7280", NULL, BLIST_SPARSELUN}, /* CMD RAID Controller */
133 {"CNSI", "G7324", NULL, BLIST_SPARSELUN}, /* Chaparral G7324 RAID */ 133 {"CNSI", "G7324", NULL, BLIST_SPARSELUN}, /* Chaparral G7324 RAID */
134 {"CNSi", "G8324", NULL, BLIST_SPARSELUN}, /* Chaparral G8324 RAID */ 134 {"CNSi", "G8324", NULL, BLIST_SPARSELUN}, /* Chaparral G8324 RAID */
135 {"COMPAQ", "LOGICAL VOLUME", NULL, BLIST_FORCELUN}, 135 {"COMPAQ", "ARRAY CONTROLLER", NULL, BLIST_SPARSELUN | BLIST_LARGELUN |
136 BLIST_MAX_512 | BLIST_REPORTLUN2}, /* Compaq RA4x00 */
137 {"COMPAQ", "LOGICAL VOLUME", NULL, BLIST_FORCELUN | BLIST_MAX_512}, /* Compaq RA4x00 */
136 {"COMPAQ", "CR3500", NULL, BLIST_FORCELUN}, 138 {"COMPAQ", "CR3500", NULL, BLIST_FORCELUN},
137 {"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD}, 139 {"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
138 {"COMPAQ", "MSA1000 VOLUME", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD}, 140 {"COMPAQ", "MSA1000 VOLUME", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index f14945996ede..1a5474bd11a1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -673,6 +673,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
673 case TYPE_MEDIUM_CHANGER: 673 case TYPE_MEDIUM_CHANGER:
674 case TYPE_ENCLOSURE: 674 case TYPE_ENCLOSURE:
675 case TYPE_COMM: 675 case TYPE_COMM:
676 case TYPE_RAID:
676 case TYPE_RBC: 677 case TYPE_RBC:
677 sdev->writeable = 1; 678 sdev->writeable = 1;
678 break; 679 break;
@@ -738,6 +739,13 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
738 sdev->select_no_atn = 1; 739 sdev->select_no_atn = 1;
739 740
740 /* 741 /*
742 * Maximum 512 sector transfer length
743 * broken RA4x00 Compaq Disk Array
744 */
745 if (*bflags & BLIST_MAX_512)
746 blk_queue_max_sectors(sdev->request_queue, 512);
747
748 /*
741 * Some devices may not want to have a start command automatically 749 * Some devices may not want to have a start command automatically
742 * issued when a device is added. 750 * issued when a device is added.
743 */ 751 */
@@ -1123,10 +1131,13 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1123 * Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does 1131 * Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does
1124 * support more than 8 LUNs. 1132 * support more than 8 LUNs.
1125 */ 1133 */
1126 if ((bflags & BLIST_NOREPORTLUN) || 1134 if (bflags & BLIST_NOREPORTLUN)
1127 starget->scsi_level < SCSI_2 || 1135 return 1;
1128 (starget->scsi_level < SCSI_3 && 1136 if (starget->scsi_level < SCSI_2 &&
1129 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) ) 1137 starget->scsi_level != SCSI_UNKNOWN)
1138 return 1;
1139 if (starget->scsi_level < SCSI_3 &&
1140 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8))
1130 return 1; 1141 return 1;
1131 if (bflags & BLIST_NOLUN) 1142 if (bflags & BLIST_NOLUN)
1132 return 0; 1143 return 0;
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 174101b2069b..d31b16d25a09 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -28,4 +28,5 @@
28#define BLIST_NO_ULD_ATTACH 0x100000 /* device is actually for RAID config */ 28#define BLIST_NO_ULD_ATTACH 0x100000 /* device is actually for RAID config */
29#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */ 29#define BLIST_SELECT_NO_ATN 0x200000 /* select without ATN */
30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */ 30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */
31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */
31#endif 32#endif