diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-09-09 10:56:36 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:48:03 -0400 |
commit | f05ec594fed6890d38bb8767676f626a4035ba55 (patch) | |
tree | 7eeccddae09d90a8d783ef233037f8f1d334a735 | |
parent | b2a7a4ba0497f73295e3f4d20a8cedb1e3d2b1a7 (diff) |
[SCSI] advansys: Support 16-byte commands properly
The SCSI midlayer won't send commands greater than ->max_cmd_len.
So the checks on length in asc_build_req and adv_build_req are obsolete
and can be deleted, but also we have to set the max_cmd_len in
advansys_board_found(). Also move the length definitions together, and
write a helpful comment.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/advansys.c | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index d7bc0cf72134..ef4f6790a251 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -210,10 +210,16 @@ typedef unsigned char uchar; | |||
210 | #define ASC_SCSI_WIDTH_BIT_SET 0xFF | 210 | #define ASC_SCSI_WIDTH_BIT_SET 0xFF |
211 | #define ASC_MAX_SENSE_LEN 32 | 211 | #define ASC_MAX_SENSE_LEN 32 |
212 | #define ASC_MIN_SENSE_LEN 14 | 212 | #define ASC_MIN_SENSE_LEN 14 |
213 | #define ASC_MAX_CDB_LEN 12 | ||
214 | #define ASC_SCSI_RESET_HOLD_TIME_US 60 | 213 | #define ASC_SCSI_RESET_HOLD_TIME_US 60 |
215 | 214 | ||
216 | /* | 215 | /* |
216 | * Narrow boards only support 12-byte commands, while wide boards | ||
217 | * extend to 16-byte commands. | ||
218 | */ | ||
219 | #define ASC_MAX_CDB_LEN 12 | ||
220 | #define ADV_MAX_CDB_LEN 16 | ||
221 | |||
222 | /* | ||
217 | * Inquiry SPC-2 SPI Byte 1 EVPD (Enable Vital Product Data) | 223 | * Inquiry SPC-2 SPI Byte 1 EVPD (Enable Vital Product Data) |
218 | * and CmdDt (Command Support Data) field bit definitions. | 224 | * and CmdDt (Command Support Data) field bit definitions. |
219 | */ | 225 | */ |
@@ -1190,12 +1196,6 @@ static const char *advansys_info(struct Scsi_Host *shost); | |||
1190 | #define ADV_CARRIER_COUNT (ASC_DEF_MAX_HOST_QNG + 15) | 1196 | #define ADV_CARRIER_COUNT (ASC_DEF_MAX_HOST_QNG + 15) |
1191 | 1197 | ||
1192 | /* | 1198 | /* |
1193 | * For wide boards a CDB length maximum of 16 bytes | ||
1194 | * is supported. | ||
1195 | */ | ||
1196 | #define ADV_MAX_CDB_LEN 16 | ||
1197 | |||
1198 | /* | ||
1199 | * Define total number of simultaneous maximum element scatter-gather | 1199 | * Define total number of simultaneous maximum element scatter-gather |
1200 | * request blocks per wide adapter. ASC_DEF_MAX_HOST_QNG (253) is the | 1200 | * request blocks per wide adapter. ASC_DEF_MAX_HOST_QNG (253) is the |
1201 | * maximum number of outstanding commands per wide host adapter. Each | 1201 | * maximum number of outstanding commands per wide host adapter. Each |
@@ -3856,17 +3856,7 @@ static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp) | |||
3856 | 3856 | ||
3857 | /* | 3857 | /* |
3858 | * Build the ASC_SCSI_Q request. | 3858 | * Build the ASC_SCSI_Q request. |
3859 | * | ||
3860 | * For narrow boards a CDB length maximum of 12 bytes | ||
3861 | * is supported. | ||
3862 | */ | 3859 | */ |
3863 | if (scp->cmd_len > ASC_MAX_CDB_LEN) { | ||
3864 | ASC_PRINT3("asc_build_req: board %d: cmd_len %d > " | ||
3865 | "ASC_MAX_CDB_LEN %d\n", boardp->id, scp->cmd_len, | ||
3866 | ASC_MAX_CDB_LEN); | ||
3867 | scp->result = HOST_BYTE(DID_ERROR); | ||
3868 | return ASC_ERROR; | ||
3869 | } | ||
3870 | asc_scsi_q.cdbptr = &scp->cmnd[0]; | 3860 | asc_scsi_q.cdbptr = &scp->cmnd[0]; |
3871 | asc_scsi_q.q2.cdb_len = scp->cmd_len; | 3861 | asc_scsi_q.q2.cdb_len = scp->cmd_len; |
3872 | asc_scsi_q.q1.target_id = ASC_TID_TO_TARGET_ID(scp->device->id); | 3862 | asc_scsi_q.q1.target_id = ASC_TID_TO_TARGET_ID(scp->device->id); |
@@ -4029,18 +4019,7 @@ adv_build_req(asc_board_t *boardp, struct scsi_cmnd *scp, | |||
4029 | * Build the ADV_SCSI_REQ_Q request. | 4019 | * Build the ADV_SCSI_REQ_Q request. |
4030 | */ | 4020 | */ |
4031 | 4021 | ||
4032 | /* | 4022 | /* Set CDB length and copy it to the request structure. */ |
4033 | * Set CDB length and copy it to the request structure. | ||
4034 | * For wide boards a CDB length maximum of 16 bytes | ||
4035 | * is supported. | ||
4036 | */ | ||
4037 | if (scp->cmd_len > ADV_MAX_CDB_LEN) { | ||
4038 | ASC_PRINT3 | ||
4039 | ("adv_build_req: board %d: cmd_len %d > ADV_MAX_CDB_LEN %d\n", | ||
4040 | boardp->id, scp->cmd_len, ADV_MAX_CDB_LEN); | ||
4041 | scp->result = HOST_BYTE(DID_ERROR); | ||
4042 | return ASC_ERROR; | ||
4043 | } | ||
4044 | scsiqp->cdb_len = scp->cmd_len; | 4023 | scsiqp->cdb_len = scp->cmd_len; |
4045 | /* Copy first 12 CDB bytes to cdb[]. */ | 4024 | /* Copy first 12 CDB bytes to cdb[]. */ |
4046 | for (i = 0; i < scp->cmd_len && i < 12; i++) { | 4025 | for (i = 0; i < scp->cmd_len && i < 12; i++) { |
@@ -14834,6 +14813,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type) | |||
14834 | if (ASC_NARROW_BOARD(boardp)) { | 14813 | if (ASC_NARROW_BOARD(boardp)) { |
14835 | shost->max_id = ASC_MAX_TID + 1; | 14814 | shost->max_id = ASC_MAX_TID + 1; |
14836 | shost->max_lun = ASC_MAX_LUN + 1; | 14815 | shost->max_lun = ASC_MAX_LUN + 1; |
14816 | shost->max_cmd_len = ASC_MAX_CDB_LEN; | ||
14837 | 14817 | ||
14838 | shost->io_port = asc_dvc_varp->iop_base; | 14818 | shost->io_port = asc_dvc_varp->iop_base; |
14839 | boardp->asc_n_io_port = ASC_IOADR_GAP; | 14819 | boardp->asc_n_io_port = ASC_IOADR_GAP; |
@@ -14844,6 +14824,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type) | |||
14844 | } else { | 14824 | } else { |
14845 | shost->max_id = ADV_MAX_TID + 1; | 14825 | shost->max_id = ADV_MAX_TID + 1; |
14846 | shost->max_lun = ADV_MAX_LUN + 1; | 14826 | shost->max_lun = ADV_MAX_LUN + 1; |
14827 | shost->max_cmd_len = ADV_MAX_CDB_LEN; | ||
14847 | 14828 | ||
14848 | /* | 14829 | /* |
14849 | * Save the I/O Port address and length even though | 14830 | * Save the I/O Port address and length even though |