aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-sbp2.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-01-24 13:41:46 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-01-28 14:31:07 -0500
commita08e100aece16e33a45b82924ad85f4066c4ed1c (patch)
tree7d231251c6b8abdf14614098954f49c6cb5843f6 /drivers/firewire/fw-sbp2.c
parentc1fbdd78517a9323ea5f5767c8ceb10aabc40fc2 (diff)
firewire: sbp2: fix payload limit at S1600 and S3200
1394-2008 clause 16.3.4.1 (1394b-2002 clause 16.3.1.1) defines tighter limits than 1394-2008 clause 6.2.2.3 (1394a-2000 clause 6.2.2.3). Our previously too large limit doesn't matter though if the controller reports its max_receive correctly. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r--drivers/firewire/fw-sbp2.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index e88d5067448c..ac8038431585 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -168,6 +168,7 @@ struct sbp2_target {
168 int address_high; 168 int address_high;
169 unsigned int workarounds; 169 unsigned int workarounds;
170 unsigned int mgt_orb_timeout; 170 unsigned int mgt_orb_timeout;
171 unsigned int max_payload;
171 172
172 int dont_block; /* counter for each logical unit */ 173 int dont_block; /* counter for each logical unit */
173 int blocked; /* ditto */ 174 int blocked; /* ditto */
@@ -1156,6 +1157,15 @@ static int sbp2_probe(struct device *dev)
1156 1157
1157 sbp2_init_workarounds(tgt, model, firmware_revision); 1158 sbp2_init_workarounds(tgt, model, firmware_revision);
1158 1159
1160 /*
1161 * At S100 we can do 512 bytes per packet, at S200 1024 bytes,
1162 * and so on up to 4096 bytes. The SBP-2 max_payload field
1163 * specifies the max payload size as 2 ^ (max_payload + 2), so
1164 * if we set this to max_speed + 7, we get the right value.
1165 */
1166 tgt->max_payload = min(device->max_speed + 7, 10U);
1167 tgt->max_payload = min(tgt->max_payload, device->card->max_receive - 1);
1168
1159 /* Do the login in a workqueue so we can easily reschedule retries. */ 1169 /* Do the login in a workqueue so we can easily reschedule retries. */
1160 list_for_each_entry(lu, &tgt->lu_list, link) 1170 list_for_each_entry(lu, &tgt->lu_list, link)
1161 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); 1171 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
@@ -1434,7 +1444,6 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1434 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1444 struct sbp2_logical_unit *lu = cmd->device->hostdata;
1435 struct fw_device *device = fw_device(lu->tgt->unit->device.parent); 1445 struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
1436 struct sbp2_command_orb *orb; 1446 struct sbp2_command_orb *orb;
1437 unsigned int max_payload;
1438 int generation, retval = SCSI_MLQUEUE_HOST_BUSY; 1447 int generation, retval = SCSI_MLQUEUE_HOST_BUSY;
1439 1448
1440 /* 1449 /*
@@ -1462,17 +1471,9 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1462 orb->done = done; 1471 orb->done = done;
1463 orb->cmd = cmd; 1472 orb->cmd = cmd;
1464 1473
1465 orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL); 1474 orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL);
1466 /*
1467 * At speed 100 we can do 512 bytes per packet, at speed 200,
1468 * 1024 bytes per packet etc. The SBP-2 max_payload field
1469 * specifies the max payload size as 2 ^ (max_payload + 2), so
1470 * if we set this to max_speed + 7, we get the right value.
1471 */
1472 max_payload = min(device->max_speed + 7,
1473 device->card->max_receive - 1);
1474 orb->request.misc = cpu_to_be32( 1475 orb->request.misc = cpu_to_be32(
1475 COMMAND_ORB_MAX_PAYLOAD(max_payload) | 1476 COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) |
1476 COMMAND_ORB_SPEED(device->max_speed) | 1477 COMMAND_ORB_SPEED(device->max_speed) |
1477 COMMAND_ORB_NOTIFY); 1478 COMMAND_ORB_NOTIFY);
1478 1479