diff options
author | adam radford <aradford@gmail.com> | 2011-05-11 21:34:40 -0400 |
---|---|---|
committer | James Bottomley <jbottomley@parallels.com> | 2011-05-24 12:35:46 -0400 |
commit | 495c5609700e21059fa0a4651b0f4f5847332319 (patch) | |
tree | a1cda862689a486b31a0701dd6508f0ed05ea977 /drivers/scsi | |
parent | 541f90b7c6dffe4cf4a3e8142ac8bd047da94733 (diff) |
[SCSI] megaraid_sas: Convert 6,10,12 byte CDB's for FastPath IO
The following patch for megaraid_sas converts 6,10,12 byte CDB's to 16
byte CDB for large LBA's for FastPath IO.
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_fusion.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index de43795ca90f..f13e7abd345a 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c | |||
@@ -1137,7 +1137,7 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, | |||
1137 | u64 start_blk = io_info->pdBlock; | 1137 | u64 start_blk = io_info->pdBlock; |
1138 | u8 *cdb = io_request->CDB.CDB32; | 1138 | u8 *cdb = io_request->CDB.CDB32; |
1139 | u32 num_blocks = io_info->numBlocks; | 1139 | u32 num_blocks = io_info->numBlocks; |
1140 | u8 opcode, flagvals, groupnum, control; | 1140 | u8 opcode = 0, flagvals = 0, groupnum = 0, control = 0; |
1141 | 1141 | ||
1142 | /* Check if T10 PI (DIF) is enabled for this LD */ | 1142 | /* Check if T10 PI (DIF) is enabled for this LD */ |
1143 | ld = MR_TargetIdToLdGet(io_info->ldTgtId, local_map_ptr); | 1143 | ld = MR_TargetIdToLdGet(io_info->ldTgtId, local_map_ptr); |
@@ -1219,7 +1219,46 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, | |||
1219 | cdb[8] = (u8)(num_blocks & 0xff); | 1219 | cdb[8] = (u8)(num_blocks & 0xff); |
1220 | cdb[7] = (u8)((num_blocks >> 8) & 0xff); | 1220 | cdb[7] = (u8)((num_blocks >> 8) & 0xff); |
1221 | 1221 | ||
1222 | io_request->IoFlags = 10; /* Specify 10-byte cdb */ | ||
1222 | cdb_len = 10; | 1223 | cdb_len = 10; |
1224 | } else if ((cdb_len < 16) && (start_blk > 0xffffffff)) { | ||
1225 | /* Convert to 16 byte CDB for large LBA's */ | ||
1226 | switch (cdb_len) { | ||
1227 | case 6: | ||
1228 | opcode = cdb[0] == READ_6 ? READ_16 : WRITE_16; | ||
1229 | control = cdb[5]; | ||
1230 | break; | ||
1231 | case 10: | ||
1232 | opcode = | ||
1233 | cdb[0] == READ_10 ? READ_16 : WRITE_16; | ||
1234 | flagvals = cdb[1]; | ||
1235 | groupnum = cdb[6]; | ||
1236 | control = cdb[9]; | ||
1237 | break; | ||
1238 | case 12: | ||
1239 | opcode = | ||
1240 | cdb[0] == READ_12 ? READ_16 : WRITE_16; | ||
1241 | flagvals = cdb[1]; | ||
1242 | groupnum = cdb[10]; | ||
1243 | control = cdb[11]; | ||
1244 | break; | ||
1245 | } | ||
1246 | |||
1247 | memset(cdb, 0, sizeof(io_request->CDB.CDB32)); | ||
1248 | |||
1249 | cdb[0] = opcode; | ||
1250 | cdb[1] = flagvals; | ||
1251 | cdb[14] = groupnum; | ||
1252 | cdb[15] = control; | ||
1253 | |||
1254 | /* Transfer length */ | ||
1255 | cdb[13] = (u8)(num_blocks & 0xff); | ||
1256 | cdb[12] = (u8)((num_blocks >> 8) & 0xff); | ||
1257 | cdb[11] = (u8)((num_blocks >> 16) & 0xff); | ||
1258 | cdb[10] = (u8)((num_blocks >> 24) & 0xff); | ||
1259 | |||
1260 | io_request->IoFlags = 16; /* Specify 16-byte cdb */ | ||
1261 | cdb_len = 16; | ||
1223 | } | 1262 | } |
1224 | 1263 | ||
1225 | /* Normal case, just load LBA here */ | 1264 | /* Normal case, just load LBA here */ |