aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/sbp2.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index c50aae948f0b..251656ec7d92 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -1649,6 +1649,8 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1649 } 1649 }
1650} 1650}
1651 1651
1652#define SBP2_PAYLOAD_TO_BYTES(p) (1 << ((p) + 2))
1653
1652/* 1654/*
1653 * This function is called in order to determine the max speed and packet 1655 * This function is called in order to determine the max speed and packet
1654 * size we can use in our ORBs. Note, that we (the driver and host) only 1656 * size we can use in our ORBs. Note, that we (the driver and host) only
@@ -1661,6 +1663,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1661static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id) 1663static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
1662{ 1664{
1663 struct sbp2scsi_host_info *hi = scsi_id->hi; 1665 struct sbp2scsi_host_info *hi = scsi_id->hi;
1666 u8 payload;
1664 1667
1665 SBP2_DEBUG_ENTER(); 1668 SBP2_DEBUG_ENTER();
1666 1669
@@ -1676,15 +1679,22 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
1676 1679
1677 /* Payload size is the lesser of what our speed supports and what 1680 /* Payload size is the lesser of what our speed supports and what
1678 * our host supports. */ 1681 * our host supports. */
1679 scsi_id->max_payload_size = 1682 payload = min(sbp2_speedto_max_payload[scsi_id->speed_code],
1680 min(sbp2_speedto_max_payload[scsi_id->speed_code], 1683 (u8) (hi->host->csr.max_rec - 1));
1681 (u8) (hi->host->csr.max_rec - 1)); 1684
1685 /* If physical DMA is off, work around limitation in ohci1394:
1686 * packet size must not exceed PAGE_SIZE */
1687 if (scsi_id->ne->host->low_addr_space < (1ULL << 32))
1688 while (SBP2_PAYLOAD_TO_BYTES(payload) + 24 > PAGE_SIZE &&
1689 payload)
1690 payload--;
1682 1691
1683 HPSB_DEBUG("Node " NODE_BUS_FMT ": Max speed [%s] - Max payload [%u]", 1692 HPSB_DEBUG("Node " NODE_BUS_FMT ": Max speed [%s] - Max payload [%u]",
1684 NODE_BUS_ARGS(hi->host, scsi_id->ne->nodeid), 1693 NODE_BUS_ARGS(hi->host, scsi_id->ne->nodeid),
1685 hpsb_speedto_str[scsi_id->speed_code], 1694 hpsb_speedto_str[scsi_id->speed_code],
1686 1 << ((u32) scsi_id->max_payload_size + 2)); 1695 SBP2_PAYLOAD_TO_BYTES(payload));
1687 1696
1697 scsi_id->max_payload_size = payload;
1688 return 0; 1698 return 0;
1689} 1699}
1690 1700