···4141 /* this nodes state */4242 unsigned in_bus_reset:1;4343 unsigned is_shutdown:1;4444+ unsigned resume_packet_sent:1;44454546 /* this nodes' duties on the bus */4647 unsigned is_root:1;
+57-10
drivers/ieee1394/nodemgr.c
···13491349}135013501351135113521352+/* Write the BROADCAST_CHANNEL as per IEEE1394a 8.3.2.3.11 and 8.4.2.3. This13531353+ * seems like an optional service but in the end it is practically mandatory13541354+ * as a consequence of these clauses.13551355+ *13561356+ * Note that we cannot do a broadcast write to all nodes at once because some13571357+ * pre-1394a devices would hang. */13581358+static void nodemgr_irm_write_bc(struct node_entry *ne, int generation)13591359+{13601360+ const u64 bc_addr = (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL);13611361+ quadlet_t bc_remote, bc_local;13621362+ int ret;13631363+13641364+ if (!ne->host->is_irm || ne->generation != generation ||13651365+ ne->nodeid == ne->host->node_id)13661366+ return;13671367+13681368+ bc_local = cpu_to_be32(ne->host->csr.broadcast_channel);13691369+13701370+ /* Check if the register is implemented and 1394a compliant. */13711371+ ret = hpsb_read(ne->host, ne->nodeid, generation, bc_addr, &bc_remote,13721372+ sizeof(bc_remote));13731373+ if (!ret && bc_remote & cpu_to_be32(0x80000000) &&13741374+ bc_remote != bc_local)13751375+ hpsb_node_write(ne, bc_addr, &bc_local, sizeof(bc_local));13761376+}13771377+13781378+13521379static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation)13531380{13541381 struct device *dev;···13861359 dev = get_device(&ne->device);13871360 if (!dev)13881361 return;13621362+13631363+ nodemgr_irm_write_bc(ne, generation);1389136413901365 /* If "needs_probe", then this is either a new or changed node we13911366 * rescan totally. If the generation matches for an existing node···14421413 return;14431414}1444141514451445-/* Because we are a 1394a-2000 compliant IRM, we need to inform all the other14461446- * nodes of the broadcast channel. (Really we're only setting the validity14471447- * bit). Other IRM responsibilities go in here as well. */14161416+static int nodemgr_send_resume_packet(struct hpsb_host *host)14171417+{14181418+ struct hpsb_packet *packet;14191419+ int ret = 1;14201420+14211421+ packet = hpsb_make_phypacket(host,14221422+ 0x003c0000 | NODEID_TO_NODE(host->node_id) << 24);14231423+ if (packet) {14241424+ packet->no_waiter = 1;14251425+ packet->generation = get_hpsb_generation(host);14261426+ ret = hpsb_send_packet(packet);14271427+ }14281428+ if (ret)14291429+ HPSB_WARN("fw-host%d: Failed to broadcast resume packet",14301430+ host->id);14311431+ return ret;14321432+}14331433+14341434+/* Perform a few high-level IRM responsibilities. */14481435static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)14491436{14501437 quadlet_t bc;···14691424 if (!host->is_irm || host->irm_id == (nodeid_t)-1)14701425 return 1;1471142614721472- host->csr.broadcast_channel |= 0x40000000; /* set validity bit */14731473-14741474- bc = cpu_to_be32(host->csr.broadcast_channel);14751475-14761476- hpsb_write(host, LOCAL_BUS | ALL_NODES, get_hpsb_generation(host),14771477- (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL),14781478- &bc, sizeof(quadlet_t));14271427+ /* We are a 1394a-2000 compliant IRM. Set the validity bit. */14281428+ host->csr.broadcast_channel |= 0x40000000;1479142914801430 /* If there is no bus manager then we should set the root node's14811431 * force_root bit to promote bus stability per the 1394···15021462 return 0;15031463 }15041464 }14651465+14661466+ /* Some devices suspend their ports while being connected to an inactive14671467+ * host adapter, i.e. if connected before the low-level driver is14681468+ * loaded. They become visible either when physically unplugged and14691469+ * replugged, or when receiving a resume packet. Send one once. */14701470+ if (!host->resume_packet_sent && !nodemgr_send_resume_packet(host))14711471+ host->resume_packet_sent = 1;1505147215061473 return 1;15071474}