diff options
author | adam radford <aradford@gmail.com> | 2012-10-01 22:27:07 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-10-09 06:17:26 -0400 |
commit | f9eff81584ce8727ac6d4dc418f546337781943b (patch) | |
tree | ae7d51ae6f5970bd388908f88d9d5fac061b7bea | |
parent | 079eaddf2e5cd903565caf5118ff4907df8bad29 (diff) |
[SCSI] megaraid_sas: Load io_request DataLength in bytes
Load io_request->DataLength in bytes for newer firmware that supports high
availability.
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_fusion.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 0af045e795a7..31d397497c45 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c | |||
@@ -1184,8 +1184,6 @@ megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len, | |||
1184 | io_request->CDB.EEDP32.PrimaryReferenceTag = | 1184 | io_request->CDB.EEDP32.PrimaryReferenceTag = |
1185 | cpu_to_be32(ref_tag); | 1185 | cpu_to_be32(ref_tag); |
1186 | io_request->CDB.EEDP32.PrimaryApplicationTagMask = 0xffff; | 1186 | io_request->CDB.EEDP32.PrimaryApplicationTagMask = 0xffff; |
1187 | |||
1188 | io_request->DataLength = num_blocks * 512; | ||
1189 | io_request->IoFlags = 32; /* Specify 32-byte cdb */ | 1187 | io_request->IoFlags = 32; /* Specify 32-byte cdb */ |
1190 | 1188 | ||
1191 | /* Transfer length */ | 1189 | /* Transfer length */ |
@@ -1329,7 +1327,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1329 | struct megasas_cmd_fusion *cmd) | 1327 | struct megasas_cmd_fusion *cmd) |
1330 | { | 1328 | { |
1331 | u8 fp_possible; | 1329 | u8 fp_possible; |
1332 | u32 start_lba_lo, start_lba_hi, device_id; | 1330 | u32 start_lba_lo, start_lba_hi, device_id, datalength = 0; |
1333 | struct MPI2_RAID_SCSI_IO_REQUEST *io_request; | 1331 | struct MPI2_RAID_SCSI_IO_REQUEST *io_request; |
1334 | union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; | 1332 | union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; |
1335 | struct IO_REQUEST_INFO io_info; | 1333 | struct IO_REQUEST_INFO io_info; |
@@ -1355,7 +1353,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1355 | * 6-byte READ(0x08) or WRITE(0x0A) cdb | 1353 | * 6-byte READ(0x08) or WRITE(0x0A) cdb |
1356 | */ | 1354 | */ |
1357 | if (scp->cmd_len == 6) { | 1355 | if (scp->cmd_len == 6) { |
1358 | io_request->DataLength = (u32) scp->cmnd[4]; | 1356 | datalength = (u32) scp->cmnd[4]; |
1359 | start_lba_lo = ((u32) scp->cmnd[1] << 16) | | 1357 | start_lba_lo = ((u32) scp->cmnd[1] << 16) | |
1360 | ((u32) scp->cmnd[2] << 8) | (u32) scp->cmnd[3]; | 1358 | ((u32) scp->cmnd[2] << 8) | (u32) scp->cmnd[3]; |
1361 | 1359 | ||
@@ -1366,7 +1364,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1366 | * 10-byte READ(0x28) or WRITE(0x2A) cdb | 1364 | * 10-byte READ(0x28) or WRITE(0x2A) cdb |
1367 | */ | 1365 | */ |
1368 | else if (scp->cmd_len == 10) { | 1366 | else if (scp->cmd_len == 10) { |
1369 | io_request->DataLength = (u32) scp->cmnd[8] | | 1367 | datalength = (u32) scp->cmnd[8] | |
1370 | ((u32) scp->cmnd[7] << 8); | 1368 | ((u32) scp->cmnd[7] << 8); |
1371 | start_lba_lo = ((u32) scp->cmnd[2] << 24) | | 1369 | start_lba_lo = ((u32) scp->cmnd[2] << 24) | |
1372 | ((u32) scp->cmnd[3] << 16) | | 1370 | ((u32) scp->cmnd[3] << 16) | |
@@ -1377,7 +1375,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1377 | * 12-byte READ(0xA8) or WRITE(0xAA) cdb | 1375 | * 12-byte READ(0xA8) or WRITE(0xAA) cdb |
1378 | */ | 1376 | */ |
1379 | else if (scp->cmd_len == 12) { | 1377 | else if (scp->cmd_len == 12) { |
1380 | io_request->DataLength = ((u32) scp->cmnd[6] << 24) | | 1378 | datalength = ((u32) scp->cmnd[6] << 24) | |
1381 | ((u32) scp->cmnd[7] << 16) | | 1379 | ((u32) scp->cmnd[7] << 16) | |
1382 | ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9]; | 1380 | ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9]; |
1383 | start_lba_lo = ((u32) scp->cmnd[2] << 24) | | 1381 | start_lba_lo = ((u32) scp->cmnd[2] << 24) | |
@@ -1389,7 +1387,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1389 | * 16-byte READ(0x88) or WRITE(0x8A) cdb | 1387 | * 16-byte READ(0x88) or WRITE(0x8A) cdb |
1390 | */ | 1388 | */ |
1391 | else if (scp->cmd_len == 16) { | 1389 | else if (scp->cmd_len == 16) { |
1392 | io_request->DataLength = ((u32) scp->cmnd[10] << 24) | | 1390 | datalength = ((u32) scp->cmnd[10] << 24) | |
1393 | ((u32) scp->cmnd[11] << 16) | | 1391 | ((u32) scp->cmnd[11] << 16) | |
1394 | ((u32) scp->cmnd[12] << 8) | (u32) scp->cmnd[13]; | 1392 | ((u32) scp->cmnd[12] << 8) | (u32) scp->cmnd[13]; |
1395 | start_lba_lo = ((u32) scp->cmnd[6] << 24) | | 1393 | start_lba_lo = ((u32) scp->cmnd[6] << 24) | |
@@ -1403,8 +1401,9 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1403 | 1401 | ||
1404 | memset(&io_info, 0, sizeof(struct IO_REQUEST_INFO)); | 1402 | memset(&io_info, 0, sizeof(struct IO_REQUEST_INFO)); |
1405 | io_info.ldStartBlock = ((u64)start_lba_hi << 32) | start_lba_lo; | 1403 | io_info.ldStartBlock = ((u64)start_lba_hi << 32) | start_lba_lo; |
1406 | io_info.numBlocks = io_request->DataLength; | 1404 | io_info.numBlocks = datalength; |
1407 | io_info.ldTgtId = device_id; | 1405 | io_info.ldTgtId = device_id; |
1406 | io_request->DataLength = scsi_bufflen(scp); | ||
1408 | 1407 | ||
1409 | if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) | 1408 | if (scp->sc_data_direction == PCI_DMA_FROMDEVICE) |
1410 | io_info.isRead = 1; | 1409 | io_info.isRead = 1; |
@@ -1431,7 +1430,6 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, | |||
1431 | if (fp_possible) { | 1430 | if (fp_possible) { |
1432 | megasas_set_pd_lba(io_request, scp->cmd_len, &io_info, scp, | 1431 | megasas_set_pd_lba(io_request, scp->cmd_len, &io_info, scp, |
1433 | local_map_ptr, start_lba_lo); | 1432 | local_map_ptr, start_lba_lo); |
1434 | io_request->DataLength = scsi_bufflen(scp); | ||
1435 | io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST; | 1433 | io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST; |
1436 | cmd->request_desc->SCSIIO.RequestFlags = | 1434 | cmd->request_desc->SCSIIO.RequestFlags = |
1437 | (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY | 1435 | (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY |