提交 61c7f775 编写于 作者: S Stefan Richter 提交者: Jody McIntyre

ieee1394: write broadcast_channel only to select nodes (fixes device recognition)

Some old 1394-1995 SBP-2 bridges would hang if they received a broadcast write
request to BROADCAST_CHANNEL before the config ROM was read.  Affected devices
include Datafab MD2-FW2 2.5" HDD and SmartDisk VST FWCDRW-V8 portable CD writer.
The write request is now directed to specific nodes instead of being broadcast
to all nodes at once, and it is only performed if a previous read request at
this register succeeded.

Fixes an old interoperability problem which was perceived as a 2.6.14-specific
regression: http://marc.theaimsgroup.com/?t=113190586800003Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: NJody McIntyre <scjody@modernduck.com>
上级 c4fc108a
...@@ -1346,6 +1346,33 @@ static void nodemgr_update_pdrv(struct node_entry *ne) ...@@ -1346,6 +1346,33 @@ static void nodemgr_update_pdrv(struct node_entry *ne)
} }
/* Write the BROADCAST_CHANNEL as per IEEE1394a 8.3.2.3.11 and 8.4.2.3. This
* seems like an optional service but in the end it is practically mandatory
* as a consequence of these clauses.
*
* Note that we cannot do a broadcast write to all nodes at once because some
* pre-1394a devices would hang. */
static void nodemgr_irm_write_bc(struct node_entry *ne, int generation)
{
const u64 bc_addr = (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL);
quadlet_t bc_remote, bc_local;
int ret;
if (!ne->host->is_irm || ne->generation != generation ||
ne->nodeid == ne->host->node_id)
return;
bc_local = cpu_to_be32(ne->host->csr.broadcast_channel);
/* Check if the register is implemented and 1394a compliant. */
ret = hpsb_read(ne->host, ne->nodeid, generation, bc_addr, &bc_remote,
sizeof(bc_remote));
if (!ret && bc_remote & cpu_to_be32(0x80000000) &&
bc_remote != bc_local)
hpsb_node_write(ne, bc_addr, &bc_local, sizeof(bc_local));
}
static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation) static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation)
{ {
struct device *dev; struct device *dev;
...@@ -1357,6 +1384,8 @@ static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int ge ...@@ -1357,6 +1384,8 @@ static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int ge
if (!dev) if (!dev)
return; return;
nodemgr_irm_write_bc(ne, generation);
/* If "needs_probe", then this is either a new or changed node we /* If "needs_probe", then this is either a new or changed node we
* rescan totally. If the generation matches for an existing node * rescan totally. If the generation matches for an existing node
* (one that existed prior to the bus reset) we send update calls * (one that existed prior to the bus reset) we send update calls
...@@ -1429,9 +1458,7 @@ static int nodemgr_send_resume_packet(struct hpsb_host *host) ...@@ -1429,9 +1458,7 @@ static int nodemgr_send_resume_packet(struct hpsb_host *host)
return ret; return ret;
} }
/* Because we are a 1394a-2000 compliant IRM, we need to inform all the other /* Perform a few high-level IRM responsibilities. */
* nodes of the broadcast channel. (Really we're only setting the validity
* bit). Other IRM responsibilities go in here as well. */
static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
{ {
quadlet_t bc; quadlet_t bc;
...@@ -1440,13 +1467,8 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) ...@@ -1440,13 +1467,8 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
if (!host->is_irm || host->irm_id == (nodeid_t)-1) if (!host->is_irm || host->irm_id == (nodeid_t)-1)
return 1; return 1;
host->csr.broadcast_channel |= 0x40000000; /* set validity bit */ /* We are a 1394a-2000 compliant IRM. Set the validity bit. */
host->csr.broadcast_channel |= 0x40000000;
bc = cpu_to_be32(host->csr.broadcast_channel);
hpsb_write(host, LOCAL_BUS | ALL_NODES, get_hpsb_generation(host),
(CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL),
&bc, sizeof(quadlet_t));
/* If there is no bus manager then we should set the root node's /* If there is no bus manager then we should set the root node's
* force_root bit to promote bus stability per the 1394 * force_root bit to promote bus stability per the 1394
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册