diff options
author | dfr <dfr@FreeBSD.org> | 2004-05-16 11:26:39 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2004-05-16 11:26:39 +0000 |
commit | fc45c8c81571191d5d104d0d66c159ec3b8cad83 (patch) | |
tree | 7dc186635db03d1b11575d021acad0bf50c331e7 /sys/dev | |
parent | 12533f5b59c4d1ef4592075b6a1a73ee690a5c99 (diff) | |
download | FreeBSD-src-fc45c8c81571191d5d104d0d66c159ec3b8cad83.zip FreeBSD-src-fc45c8c81571191d5d104d0d66c159ec3b8cad83.tar.gz |
Don't use the node id as an index into the topology map. This breaks
if a node on the bus has more than three ports (like my cheapo six
port hub).
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/firewire/firewire.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 29c65b5..a72e3843 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -1293,6 +1293,25 @@ fw_bus_probe(struct firewire_comm *fc) } /* + * Find the self_id packet for a node, ignoring sequels. + */ +static union fw_self_id * +fw_find_self_id(struct firewire_comm *fc, int node) +{ + uint32_t i; + union fw_self_id *s; + + for (i = 0; i < fc->topology_map->self_id_count; i++) { + s = &fc->topology_map->self_id[i]; + if (s->p0.sequel) + continue; + if (s->p0.phy_id == node) + return s; + } + return 0; +} + +/* * To collect device informations on the IEEE1394 bus. */ static void @@ -1315,7 +1334,7 @@ loop: /* check link */ /* XXX we need to check phy_id first */ - if (!fc->topology_map->self_id[fc->ongonode].p0.link_active) { + if (!fw_find_self_id(fc, fc->ongonode)->p0.link_active) { if (firewire_debug) printf("node%d: link down\n", fc->ongonode); fc->ongonode++; @@ -2185,7 +2204,7 @@ fw_bmr(struct firewire_comm *fc) u_int32_t quad; /* Check to see if the current root node is cycle master capable */ - self_id = &fc->topology_map->self_id[fc->max_node]; + self_id = fw_find_self_id(fc, fc->max_node); if (fc->max_node > 0) { /* XXX check cmc bit of businfo block rather than contender */ if (self_id->p0.link_active && self_id->p0.contender) |