Lines Matching defs:fc
197 struct firewire_comm *fc = device_private(parent);
204 fc->bdev = sc->dev = self;
205 sc->fc = fc;
208 fc->status = FWBUSNOTREADY;
210 if (fc->nisodma > FWMAXNDMA)
211 fc->nisodma = FWMAXNDMA;
213 fc->crom_src_buf = malloc(sizeof(struct crom_src_buf),
215 fc->topology_map =malloc(sizeof(struct fw_topology_map),
217 fc->speed_map = malloc(sizeof(struct fw_speed_map),
220 mutex_init(&fc->tlabel_lock, MUTEX_DEFAULT, IPL_VM);
221 mutex_init(&fc->fc_mtx, MUTEX_DEFAULT, IPL_VM);
222 mutex_init(&fc->wait_lock, MUTEX_DEFAULT, IPL_VM);
223 cv_init(&fc->fc_cv, "ieee1394");
225 callout_init(&fc->timeout_callout, CALLOUT_MPSAFE);
226 callout_setfunc(&fc->timeout_callout, firewire_watchdog, fc);
227 callout_init(&fc->bmr_callout, CALLOUT_MPSAFE);
228 callout_setfunc(&fc->bmr_callout, fw_try_bmr, fc);
229 callout_init(&fc->busprobe_callout, CALLOUT_MPSAFE);
230 callout_setfunc(&fc->busprobe_callout, (void *)fw_bus_probe, fc);
232 callout_schedule(&fc->timeout_callout, hz);
239 fc, &fc->probe_thread, "fw%dprobe", device_unit(fc->bdev))) {
247 faa.fc = fc;
256 fw_busreset(fc, FWBUSNOTREADY);
257 fc->ibr(fc);
269 struct firewire_comm *fc;
274 fc = sc->fc;
275 mutex_enter(&fc->wait_lock);
276 fc->status = FWBUSDETACH;
277 cv_signal(&fc->fc_cv);
278 while (fc->status != FWBUSDETACHOK) {
279 err = cv_timedwait_sig(&fc->fc_cv, &fc->wait_lock, hz * 60);
286 mutex_exit(&fc->wait_lock);
296 callout_stop(&fc->timeout_callout);
297 callout_stop(&fc->bmr_callout);
298 callout_stop(&fc->busprobe_callout);
301 for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL;
306 free(fc->topology_map, M_FW);
307 free(fc->speed_map, M_FW);
308 free(fc->crom_src_buf, M_FW);
310 cv_destroy(&fc->fc_cv);
311 mutex_destroy(&fc->wait_lock);
312 mutex_destroy(&fc->fc_mtx);
313 mutex_destroy(&fc->tlabel_lock);
329 firewire_resume(struct firewire_comm *fc)
332 fc->status = FWBUSNOTREADY;
341 fw_noderesolve_nodeid(struct firewire_comm *fc, int dst)
345 mutex_enter(&fc->fc_mtx);
346 STAILQ_FOREACH(fwdev, &fc->devices, link)
349 mutex_exit(&fc->fc_mtx);
358 fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 *eui)
362 mutex_enter(&fc->fc_mtx);
363 STAILQ_FOREACH(fwdev, &fc->devices, link)
366 mutex_exit(&fc->fc_mtx);
379 fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer)
390 aprint_error_dev(fc->bdev, "hand == NULL\n");
396 info = &fc->tcode[tcode];
398 aprint_error_dev(fc->bdev, "invalid tcode=%x\n", tcode);
403 if ((fc->status < FWBUSEXPLORE) &&
413 xferq = fc->atq;
415 xferq = fc->ats;
417 if (xfer->send.pay_len > MAXREC(fc->maxrec)) {
418 aprint_error_dev(fc->bdev, "send.pay_len > maxrec\n");
428 aprint_error_dev(fc->bdev,
435 aprint_error_dev(fc->bdev, "xferq->start == NULL\n");
439 aprint_error_dev(fc->bdev, "Discard a packet (queued=%d)\n",
446 if (fw_get_tlabel(fc, xfer) < 0)
450 xfer->fc = fc;
464 mutex_enter(&xfer->fc->wait_lock);
467 mutex_exit(&xfer->fc->wait_lock);
475 struct firewire_comm *fc = xfer->fc;
478 mutex_enter(&fc->wait_lock);
480 err = cv_wait_sig(&xfer->cv, &fc->wait_lock);
481 mutex_exit(&fc->wait_lock);
487 fw_drain_txq(struct firewire_comm *fc)
495 mutex_enter(&fc->atq->q_mtx);
496 fw_xferq_drain(fc->atq);
497 mutex_exit(&fc->atq->q_mtx);
498 mutex_enter(&fc->ats->q_mtx);
499 fw_xferq_drain(fc->ats);
500 mutex_exit(&fc->ats->q_mtx);
501 for (i = 0; i < fc->nisodma; i++)
502 fw_xferq_drain(fc->it[i]);
504 mutex_enter(&fc->tlabel_lock);
506 while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) {
510 STAILQ_REMOVE_HEAD(&fc->tlabels[i], tlabel);
513 mutex_exit(&fc->tlabel_lock);
523 fw_busreset(struct firewire_comm *fc, uint32_t new_status)
525 struct firewire_softc *sc = device_private(fc->bdev);
531 if (fc->status == FWBUSMGRELECT)
532 callout_stop(&fc->bmr_callout);
534 fc->status = new_status;
535 fw_reset_csr(fc);
537 if (fc->status == FWBUSNOTREADY)
538 fw_init_crom(fc);
540 fw_reset_crom(fc);
565 src = &fc->crom_src_buf->src;
567 if (memcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
570 memcpy((void *)fc->config_rom, newrom, CROMSIZE);
577 fw_init(struct firewire_comm *fc)
581 fc->arq->queued = 0;
582 fc->ars->queued = 0;
583 fc->atq->queued = 0;
584 fc->ats->queued = 0;
586 fc->arq->buf = NULL;
587 fc->ars->buf = NULL;
588 fc->atq->buf = NULL;
589 fc->ats->buf = NULL;
591 fc->arq->flag = 0;
592 fc->ars->flag = 0;
593 fc->atq->flag = 0;
594 fc->ats->flag = 0;
596 STAILQ_INIT(&fc->atq->q);
597 STAILQ_INIT(&fc->ats->q);
598 mutex_init(&fc->arq->q_mtx, MUTEX_DEFAULT, IPL_VM);
599 mutex_init(&fc->ars->q_mtx, MUTEX_DEFAULT, IPL_VM);
600 mutex_init(&fc->atq->q_mtx, MUTEX_DEFAULT, IPL_VM);
601 mutex_init(&fc->ats->q_mtx, MUTEX_DEFAULT, IPL_VM);
603 fc->arq->maxq = FWMAXQUEUE;
604 fc
605 fc->atq->maxq = FWMAXQUEUE;
606 fc->ats->maxq = FWMAXQUEUE;
608 CSRARC(fc, TOPO_MAP) = 0x3f1 << 16;
609 CSRARC(fc, TOPO_MAP + 4) = 1;
610 CSRARC(fc, SPED_MAP) = 0x3f1 << 16;
611 CSRARC(fc, SPED_MAP + 4) = 1;
613 STAILQ_INIT(&fc->devices);
616 STAILQ_INIT(&fc->binds);
618 STAILQ_INIT(&fc->tlabels[i]);
622 CSRARC(fc, oMPR) = 0x3fff0001; /* # output channel = 1 */
623 CSRARC(fc, oPCR) = 0x8000007a;
625 CSRARC(fc, i + oPCR) = 0x8000007a;
627 CSRARC(fc, iMPR) = 0x00ff0001; /* # input channel = 1 */
628 CSRARC(fc, iPCR) = 0x803f0000;
630 CSRARC(fc, i + iPCR) = 0x0;
633 fc->crom_src_buf = NULL;
641 fw_init_isodma(struct firewire_comm *fc)
645 for (i = 0; i < fc->nisodma; i++) {
646 fc->it[i]->queued = 0;
647 fc->ir[i]->queued = 0;
649 fc->it[i]->start = NULL;
650 fc->ir[i]->start = NULL;
652 fc->it[i]->buf = NULL;
653 fc->ir[i]->buf = NULL;
655 fc->it[i]->flag = FWXFERQ_STREAM;
656 fc->ir[i]->flag = FWXFERQ_STREAM;
658 STAILQ_INIT(&fc->it[i]->q);
659 STAILQ_INIT(&fc->ir[i]->q);
661 fc->ir[i]->maxq = FWMAXQUEUE;
662 fc->it[i]->maxq = FWMAXQUEUE;
664 cv_init(&fc->ir[i]->cv, "fw_read");
665 cv_init(&fc->it[i]->cv, "fw_write");
670 fw_destroy_isodma(struct firewire_comm *fc)
674 for (i = 0; i < fc->nisodma; i++) {
675 cv_destroy(&fc->ir[i]->cv);
676 cv_destroy(&fc->it[i]->cv);
681 fw_destroy(struct firewire_comm *fc)
683 mutex_destroy(&fc->arq->q_mtx);
684 mutex_destroy(&fc->ars->q_mtx);
685 mutex_destroy(&fc->atq->q_mtx);
686 mutex_destroy(&fc->ats->q_mtx);
696 fw_bindlookup(struct firewire_comm *fc, uint16_t dest_hi, uint32_t dest_lo)
702 mutex_enter(&fc->fc_mtx);
703 STAILQ_FOREACH(tfw, &fc->binds, fclist)
708 mutex_exit(&fc->fc_mtx);
716 fw_bindadd(struct firewire_comm *fc, struct fw_bind *fwb)
722 aprint_error_dev(fc->bdev, "invalid range\n");
726 mutex_enter(&fc->fc_mtx);
727 STAILQ_FOREACH(tfw, &fc->binds, fclist) {
733 STAILQ_INSERT_HEAD(&fc->binds, fwb, fclist);
735 STAILQ_INSERT_AFTER(&fc->binds, prev, fwb, fclist);
737 aprint_error_dev(fc->bdev, "bind failed\n");
740 mutex_exit(&fc->fc_mtx);
748 fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb)
755 mutex_enter(&fc->fc_mtx);
756 STAILQ_FOREACH(tfw, &fc->binds, fclist)
758 STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist);
759 mutex_exit(&fc->fc_mtx);
763 mutex_exit(&fc->fc_mtx);
764 aprint_error_dev(fc->bdev, "no such binding\n");
781 int rlen, int n, struct firewire_comm *fc, void *sc,
791 xfer->fc = fc;
866 aprint_error_dev(xfer->fc->bdev, "hand == NULL\n");
870 if (xfer->fc == NULL)
871 panic("fw_xfer_done: why xfer->fc is NULL?");
873 fw_tl_free(xfer->fc, xfer);
884 aprint_error_dev(xfer->fc->bdev, "fw_xfer_free FWXF_INQ\n");
892 if (xfer->fc != NULL) {
900 aprint_error_dev(xfer->fc->bdev,
957 fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
963 fc->sid_cnt = len / (sizeof(uint32_t) * 2);
964 fc->max_node = fc->nodeid & 0x3f;
965 CSRARC(fc, NODE_IDS) = ((uint32_t)fc->nodeid) << 16;
966 fc->status = FWBUSCYMELECT;
967 fc->topology_map->crc_len = 2;
968 fc->topology_map->generation++;
969 fc->topology_map->self_id_count = 0;
970 fc->topology_map->node_count = 0;
971 fc->speed_map->generation++;
972 fc->speed_map->crc_len = 1 + (64*64 + 3) / 4;
973 self_id = fc->topology_map->self_id;
974 for (i = 0; i < fc->sid_cnt; i++) {
976 aprint_error_dev(fc->bdev,
982 fc->topology_map->crc_len++;
984 fc->topology_map->node_count++;
989 if (fc->max_node < node)
990 fc->max_node = self_id->p0.phy_id;
992 fc->speed_map->speed[node][node] =
995 fc->speed_map->speed[j][node] =
996 fc->speed_map->speed[node][j] =
997 uimin(fc->speed_map->speed[j][j],
999 if ((fc->irm == -1 || self_id->p0.phy_id > fc->irm) &&
1001 fc->irm = self_id->p0.phy_id;
1013 fc->topology_map->self_id_count++;
1016 fc->topology_map->crc =
1017 fw_crc16((uint32_t *)&fc->topology_map->generation,
1018 fc->topology_map->crc_len * 4);
1019 fc->speed_map->crc = fw_crc16((uint32_t *)&fc->speed_map->generation,
1020 fc->speed_map->crc_len * 4);
1022 p = (uint32_t *)fc->topology_map;
1023 for (i = 0; i <= fc->topology_map->crc_len; i++)
1024 CSRARC(fc, TOPO_MAP + i * 4) = htonl(*p++);
1025 p = (uint32_t *)fc->speed_map;
1026 CSRARC(fc, SPED_MAP) = htonl(*p++);
1027 CSRARC(fc, SPED_MAP + 4) = htonl(*p++);
1029 memcpy(&CSRARC(fc, SPED_MAP + 8), p, (fc->speed_map->crc_len - 1) * 4);
1031 fc->max_hop = fc->max_node - i_branch;
1032 aprint_normal_dev(fc->bdev, "%d nodes, maxhop <= %d %s irm(%d)%s\n",
1033 fc->max_node + 1, fc->max_hop,
1034 (fc->irm == -1) ? "Not IRM capable" : "cable IRM",
1035 fc->irm,
1036 (fc->irm == fc->nodeid) ? " (me)" : "");
1038 if (try_bmr && (fc->irm != -1) && (CSRARC(fc, BUS_MGR_ID) == 0x3f)) {
1039 if (fc->irm == fc->nodeid) {
1040 fc->status = FWBUSMGRDONE;
1041 CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, fc->irm);
1042 fw_bmr(fc);
1044 fc->status = FWBUSMGRELECT;
1045 callout_schedule(&fc->bmr_callout, hz/8);
1048 fc->status = FWBUSMGRDONE;
1050 callout_schedule(&fc->busprobe_callout, hz/4);
1083 rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src,
1086 aprint_error_dev(rb->fc->bdev, "unknown response"
1095 rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src,
1124 aprint_error_dev(rb->fc->bdev,
1133 bind = fw_bindlookup(rb->fc, fp->mode.rreqq.dest_hi,
1137 aprint_error_dev(rb->fc->bdev, "Unknown service addr"
1143 if (rb->fc->status == FWBUSINIT) {
1144 aprint_error_dev(rb->fc->bdev,
1179 if (fw_asyreq(rb->fc, -1, rb->xfer)) {
1193 aprint_error_dev(rb->fc->bdev,
1205 aprint_error_dev(rb->fc->bdev, "unknown tcode %d\n", tcode);
1231 fw_open_isodma(struct firewire_comm *fc, int tx)
1238 xferqa = fc->it;
1240 xferqa = fc->ir;
1242 mutex_enter(&fc->fc_mtx);
1243 for (i = 0; i < fc->nisodma; i++) {
1250 if (i == fc->nisodma) {
1251 aprint_error_dev(fc->bdev, "no free dma channel (tx=%d)\n", tx);
1254 mutex_exit(&fc->fc_mtx);
1264 struct firewire_comm *fc = xfer->fc;
1276 xfer->q->start(fc);
1281 firewire_xfer_timeout(struct firewire_comm *fc)
1296 mutex_enter(&fc->tlabel_lock);
1298 while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) {
1305 aprint_error_dev(fc->bdev,
1310 STAILQ_REMOVE_HEAD(&fc->tlabels[i], tlabel);
1314 mutex_exit(&fc->tlabel_lock);
1315 fc->timeout(fc);
1325 struct firewire_comm *fc;
1328 fc = (struct firewire_comm *)arg;
1336 firewire_xfer_timeout(fc);
1340 callout_schedule(&fc->timeout_callout, hz / WATCHDOG_HZ);
1360 fw_reset_csr(struct firewire_comm *fc)
1364 CSRARC(fc, STATE_CLEAR) =
1366 CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR);
1367 CSRARC(fc, NODE_IDS) = 0x3f;
1369 CSRARC(fc, TOPO_MAP + 8) = 0;
1370 fc->irm = -1;
1372 fc->max_node = -1;
1375 CSRARC(fc, SPED_MAP + i * 4) = 0;
1376 CSRARC(fc, STATE_CLEAR) =
1378 CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR);
1379 CSRARC(fc, RESET_START) = 0;
1380 CSRARC(fc, SPLIT_TIMEOUT_HI) = 0;
1381 CSRARC(fc, SPLIT_TIMEOUT_LO) = 800 << 19;
1382 CSRARC(fc, CYCLE_TIME) = 0x0;
1383 CSRARC(fc, BUS_TIME) = 0x0;
1384 CSRARC(fc, BUS_MGR_ID) = 0x3f;
1385 CSRARC(fc, BANDWIDTH_AV) = 4915;
1386 CSRARC(fc, CHANNELS_AV_HI) = 0xffffffff;
1387 CSRARC(fc, CHANNELS_AV_LO) = 0xffffffff;
1388 CSRARC(fc, IP_CHANNELS) = (1U << 31);
1390 CSRARC(fc, CONF_ROM) = 0x04 << 24;
1391 CSRARC(fc, CONF_ROM + 4) = 0x31333934; /* means strings 1394 */
1392 CSRARC(fc, CONF_ROM + 8) =
1394 CSRARC(fc, CONF_ROM + 0xc) = 0;
1397 CSRARC(fc, oPCR) &= ~DV_BROADCAST_ON;
1398 CSRARC(fc, iPCR) &= ~DV_BROADCAST_ON;
1400 CSRARC(fc, STATE_CLEAR) &= ~(1 << 23 | 1 << 15 | 1 << 14);
1401 CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR);
1405 fw_init_crom(struct firewire_comm *fc)
1409 src = &fc->crom_src_buf->src;
1423 src->businfo.max_rec = fc->maxrec;
1426 src->businfo.link_spd = fc->speed;
1428 src->businfo.eui64.hi = fc->eui.hi;
1429 src->businfo.eui64.lo = fc->eui.lo;
1433 fc->crom_src = src;
1434 fc->crom_root = &fc->crom_src_buf->root;
1438 fw_reset_crom(struct firewire_comm *fc)
1444 buf = fc->crom_src_buf;
1445 src = fc->crom_src;
1446 root = fc->crom_root;
1479 fw_tl_free(struct firewire_comm *fc, struct fw_xfer *xfer)
1486 mutex_enter(&fc->tlabel_lock);
1488 STAILQ_FOREACH(txfer, &fc->tlabels[xfer->tl], tlabel)
1492 mutex_exit(&fc->tlabel_lock);
1493 aprint_error_dev(fc->bdev,
1503 STAILQ_REMOVE(&fc->tlabels[xfer->tl], xfer, fw_xfer, tlabel);
1504 mutex_exit(&fc->tlabel_lock);
1512 fw_tl2xfer(struct firewire_comm *fc, int node, int tlabel, int tcode)
1517 mutex_enter(&fc->tlabel_lock);
1518 STAILQ_FOREACH(xfer, &fc->tlabels[tlabel], tlabel)
1520 mutex_exit(&fc->tlabel_lock);
1524 if (xfer->fc->tcode[req].valid_res != tcode) {
1525 aprint_error_dev(fc->bdev,
1535 mutex_exit(&fc->tlabel_lock);
1545 fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count)
1550 fc->status = FWBUSPHYCONF;
1555 xfer->fc = fc;
1570 fw_asyreq(fc, -1, xfer);
1609 fw_bus_probe(struct firewire_comm *fc)
1613 mutex_enter(&fc->wait_lock);
1614 fc->status = FWBUSEXPLORE;
1619 mutex_enter(&fc->fc_mtx);
1620 STAILQ_FOREACH(fwdev, &fc->devices, link)
1631 mutex_exit(&fc->fc_mtx);
1633 cv_signal(&fc->fc_cv);
1634 mutex_exit(&fc->wait_lock);
1704 aprint_error_dev(fwdev->fc->bdev, "invalid offset %d\n",
1718 struct firewire_comm *fc;
1725 fc = dfwdev->fc;
1732 aprint_error_dev(fc->bdev,
1749 aprint_error_dev(fc->bdev, "node%d: error reading 0x04\n",
1756 aprint_error_dev(fc->bdev, "node%d: invalid bus name 0x%08x\n",
1771 mutex_enter(&fc->fc_mtx);
1772 STAILQ_FOREACH(fwdev, &fc->devices, link)
1775 mutex_exit(&fc->fc_mtx);
1779 fwdev->fc = fc;
1793 aprint_normal_dev(fc->bdev,
1795 fwdev->speed = fc->speed_map->speed[fc->nodeid][node];
1806 aprint_error_dev(fc->bdev, "fwdev->speed(%s)"
1815 * fc->devices TAILQ, then we will add it.
1818 mutex_enter(&fc->fc_mtx);
1819 STAILQ_FOREACH(tfwdev, &fc->devices, link) {
1827 STAILQ_INSERT_HEAD(&fc->devices, fwdev, link);
1829 STAILQ_INSERT_AFTER(&fc->devices, pfwdev, fwdev, link);
1830 mutex_exit(&fc->fc_mtx);
1832 aprint_normal_dev(fc->bdev, "New %s device ID:%08x%08x\n",
1866 fw_find_self_id(struct firewire_comm *fc, int node)
1871 for (i = 0; i < fc->topology_map->self_id_count; i++) {
1872 s = &fc->topology_map->self_id[i];
1882 fw_explore(struct firewire_comm *fc)
1893 dfwdev->fc = fc;
1898 for (node = 0; node <= fc->max_node; node++) {
1900 if (node == fc->nodeid) {
1902 printf("found myself node(%d) fc->nodeid(%d)"
1903 " fc->max_node(%d)\n",
1904 node, fc->nodeid, fc->max_node);
1907 printf("node(%d) fc->max_node(%d) found\n",
1908 node, fc->max_node);
1909 fwsid = fw_find_self_id(fc, node);
1936 struct firewire_comm *fc = (struct firewire_comm *)arg;
1946 * fw_attach_dev(fc);
1952 config_pending_decr(fc->bdev);
1954 mutex_enter(&fc->wait_lock);
1955 while (fc->status != FWBUSDETACH) {
1956 if (fc->status == FWBUSEXPLORE) {
1957 mutex_exit(&fc->wait_lock);
1958 fw_explore(fc);
1959 fc->status = FWBUSEXPDONE;
1962 fw_attach_dev(fc);
1963 mutex_enter(&fc->wait_lock);
1965 cv_wait_sig(&fc->fc_cv, &fc->wait_lock);
1967 fc->status = FWBUSDETACHOK;
1968 cv_signal(&fc->fc_cv);
1969 mutex_exit(&fc->wait_lock);
2019 fw_attach_dev(struct firewire_comm *fc)
2021 struct firewire_softc *sc = device_private(fc->bdev);
2029 fwa.fc = fc;
2031 mutex_enter(&fc->fc_mtx);
2032 for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL; fwdev = next) {
2034 mutex_exit(&fc->fc_mtx);
2057 mutex_enter(&fc->fc_mtx);
2066 mutex_exit(&fc->fc_mtx);
2086 mutex_enter(&fc->fc_mtx);
2088 mutex_exit(&fc->fc_mtx);
2096 for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL; fwdev = next) {
2120 STAILQ_REMOVE(&fc->devices, fwdev, fw_device, link);
2132 fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer)
2138 mutex_enter(&fc->tlabel_lock);
2139 new_tlabel = (fc->last_tlabel[dst] + 1) & 0x3f;
2140 STAILQ_FOREACH(txfer, &fc->tlabels[new_tlabel], tlabel)
2144 fc->last_tlabel[dst] = new_tlabel;
2145 STAILQ_INSERT_TAIL(&fc->tlabels[new_tlabel], xfer, tlabel);
2146 mutex_exit(&fc->tlabel_lock);
2154 mutex_exit(&fc->tlabel_lock);
2172 tinfo = &rb->fc->tcode[pkt->mode.hdr.tcode];
2200 aprint_error_dev(rb->fc->bdev,
2224 struct firewire_comm *fc;
2229 fc = xfer->fc;
2239 bmr = fc->nodeid;
2241 CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, bmr & 0x3f);
2243 fw_bmr(fc);
2247 aprint_error_dev(fc->bdev, "bus manager election failed\n");
2259 struct firewire_comm *fc = (struct firewire_comm *)arg;
2267 fc->status = FWBUSMGRELECT;
2277 fp->mode.lreq.dst = FWLOCALBUS | fc->irm;
2280 xfer->send.payload[1] = htonl(fc->nodeid);
2283 err = fw_asyreq(fc, -1, xfer);
2298 fw_bmr(struct firewire_comm *fc)
2306 self_id = fw_find_self_id(fc, fc->max_node);
2307 if (fc->max_node > 0) {
2310 cmstr = fc->max_node;
2312 aprint_normal_dev(fc->bdev,
2315 cmstr = fc->nodeid;
2321 aprint_normal_dev(fc->bdev, "bus manager %d%s\n",
2322 CSRARC(fc, BUS_MGR_ID),
2323 (CSRARC(fc, BUS_MGR_ID) != fc->nodeid) ? " (me)" : "");
2324 if (CSRARC(fc, BUS_MGR_ID) != fc->nodeid)
2329 if (fc->max_hop <= MAX_GAPHOP)
2330 fw_phy_config(fc, cmstr, gap_cnt[fc->max_hop]);
2332 if (cmstr == fc->nodeid || cmstr == -1)
2336 fwdev.fc = fc;