Lines Matching refs:fc

105 fw_noderesolve_nodeid(struct firewire_comm *fc, int dst)
111 STAILQ_FOREACH(fwdev, &fc->devices, link)
123 fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 *eui)
129 FW_GLOCK(fc);
130 STAILQ_FOREACH(fwdev, &fc->devices, link)
133 FW_GUNLOCK(fc);
145 fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer)
162 info = &fc->tcode[tcode];
169 if ((fc->status < FWBUSEXPLORE) &&
179 xferq = fc->atq;
181 xferq = fc->ats;
183 if (xfer->send.pay_len > MAXREC(fc->maxrec)) {
204 device_printf(fc->bdev, "Discard a packet (queued=%d)\n",
211 if (fw_get_tlabel(fc, xfer) < 0)
216 xfer->fc = fc;
228 // struct mtx *lock = &xfer->fc->wait_lock;
229 mutex *lock = &xfer->fc->wait_lock;
243 // struct mtx *lock = &xfer->fc->wait_lock;
244 mutex *lock = &xfer->fc->wait_lock;
265 struct firewire_comm *fc = xfer->fc;
269 FW_GLOCK(fc);
275 FW_GUNLOCK(fc);
279 xfer->q->start(fc);
287 struct firewire_comm *fc = (struct firewire_comm *)arg;
305 mtx_lock(&fc->tlabel_lock);
307 while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) {
315 device_printf(fc->bdev,
320 STAILQ_REMOVE_HEAD(&fc->tlabels[i], tlabel);
324 mtx_unlock(&fc->tlabel_lock);
326 fc->timeout(fc);
336 struct firewire_comm *fc;
339 fc = (struct firewire_comm *)arg;
347 // taskqueue_enqueue(fc->taskqueue, &fc->task_timeout);
348 firewire_xfer_timeout(fc);
352 // callout_reset(&fc->timeout_callout, hz / WATCHDOG_HZ,
353 // (void *)firewire_watchdog, (void *)fc);
365 element = sc->fc->childList;
386 element = sc->fc->childList;
392 sc->fc->childList = info;
402 struct firewire_child_info *element = sc->fc->childList;
409 sc->fc->childList = NULL;//childList has only a node
429 firewire_attach(struct firewire_comm *fc, struct firewire_softc *sc)
431 sc->fc = fc;
432 fc->status = (uint)FWBUSNOTREADY;
435 if( fc->nisodma > FWMAXNDMA) fc->nisodma = FWMAXNDMA;
439 fc->crom_src_buf = (struct crom_src_buf *)malloc(
441 if (fc->crom_src_buf == NULL) {
442 device_printf(fc->dev, "%s: Malloc Failure crom src buff\n", __func__);
445 memset(fc->crom_src_buf, 0, sizeof(struct crom_src_buf));
446 fc->topology_map = (struct fw_topology_map *)malloc(
448 if (fc->topology_map == NULL) {
449 device_printf(fc->dev, "%s: Malloc Failure topology map\n", __func__);
450 free(fc->crom_src_buf);
453 memset(fc->topology_map, 0, sizeof(struct fw_topology_map));
454 fc->speed_map = (struct fw_speed_map *)malloc(
456 if (fc->speed_map == NULL) {
457 device_printf(fc->dev, "%s: Malloc Failure speed map\n", __func__);
458 free(fc->crom_src_buf);
459 free(fc->topology_map);
462 memset(fc->speed_map, 0, sizeof(struct fw_speed_map));
464 mtx_init(&fc->wait_lock, "fwwait", NULL, MTX_DEF);
465 mtx_init(&fc->tlabel_lock, "fwtlabel", NULL, MTX_DEF);
466 // CALLOUT_INIT(&fc->timeout_callout);
467 // CALLOUT_INIT(&fc->bmr_callout);
468 // CALLOUT_INIT(&fc->busprobe_callout);
469 // TASK_INIT(&fc->task_timeout, 0, firewire_xfer_timeout, (void *)fc);
471 // callout_reset(&sc->fc->timeout_callout, hz,
472 // (void *)firewire_watchdog, (void *)sc->fc);
473 fc->timeout_callout = create_timer(firewire_watchdog, fc,
477 // kproc_create(fw_bus_probe_thread, (void *)fc, &fc->probe_thread,
479 fc->probe_thread = spawn_kernel_thread(fw_bus_probe_thread,
480 "fw_probe", PROBE_THREAD_PRIORITY, fc);
481 if(fc->probe_thread < B_OK)
483 resume_thread(fc->probe_thread);
497 FW_GLOCK(fc);
498 fw_busreset(fc, (uint)FWBUSNOTREADY);
499 FW_GUNLOCK(fc);
500 fc->ibr(fc);
511 struct firewire_comm *fc;
516 fc = sc->fc;
517 mtx_lock(&fc->wait_lock);
518 fc->status = (uint)FWBUSDETACH;
519 // wakeup(fc);
520 release_sem(fc->Sem);
521 /* if (msleep(fc->probe_thread, &fc->wait_lock, PWAIT, "fwthr", hz * 60))
523 mtx_unlock(&fc->wait_lock);
526 if (fc->arq !=0 && fc->arq->maxq > 0)
527 fw_drain_txq(fc);
534 element = sc->fc->childList;
541 sc->fc->childList = NULL;
543 /* callout_stop(&fc->timeout_callout);
544 callout_stop(&fc->bmr_callout);
545 callout_stop(&fc->busprobe_callout);*/
546 delete_timer(fc->timeout_callout);
547 delete_timer(fc->bmr_callout);
548 delete_timer(fc->busprobe_callout);
552 for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL;
557 free(fc->topology_map);
558 free(fc->speed_map);
559 free(fc->crom_src_buf);
561 mtx_destroy(&fc->tlabel_lock);
562 mtx_destroy(&fc->wait_lock);
591 fw_drain_txq(struct firewire_comm *fc)
599 FW_GLOCK(fc);
600 fw_xferq_drain(fc->atq);
601 fw_xferq_drain(fc->ats);
602 for(i = 0; i < fc->nisodma; i++)
603 fw_xferq_drain(fc->it[i]);
604 FW_GUNLOCK(fc);
606 mtx_lock(&fc->tlabel_lock);
608 while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) {
612 STAILQ_REMOVE_HEAD(&fc->tlabels[i], tlabel);
615 mtx_unlock(&fc->tlabel_lock);
622 fw_reset_csr(struct firewire_comm *fc)
626 CSRARC(fc, STATE_CLEAR)
628 CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR);
629 CSRARC(fc, NODE_IDS) = 0x3f;
631 CSRARC(fc, TOPO_MAP + 8) = 0;
632 fc->irm = (uint)-1;
634 fc->max_node = (uint)-1;
637 CSRARC(fc, SPED_MAP + i * 4) = 0;
639 CSRARC(fc, STATE_CLEAR) = 1 << 23 | 0 << 17 | 1 << 16 | 1 << 15 | 1 << 14 ;
640 CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR);
641 CSRARC(fc, RESET_START) = 0;
642 CSRARC(fc, SPLIT_TIMEOUT_HI) = 0;
643 CSRARC(fc, SPLIT_TIMEOUT_LO) = 800 << 19;
644 CSRARC(fc, CYCLE_TIME) = 0x0;
645 CSRARC(fc, BUS_TIME) = 0x0;
646 CSRARC(fc, BUS_MGR_ID) = 0x3f;
647 CSRARC(fc, BANDWIDTH_AV) = 4915;
648 CSRARC(fc, CHANNELS_AV_HI) = 0xffffffff;
649 CSRARC(fc, CHANNELS_AV_LO) = 0xffffffff;
650 CSRARC(fc, IP_CHANNELS) = (1 << 31);
652 CSRARC(fc, CONF_ROM) = 0x04 << 24;
653 CSRARC(fc, CONF_ROM + 4) = 0x31333934; /* means strings 1394 */
654 CSRARC(fc, CONF_ROM + 8) = 1 << 31 | 1 << 30 | 1 << 29 |
656 CSRARC(fc, CONF_ROM + 0xc) = 0;
659 CSRARC(fc, oPCR) &= ~DV_BROADCAST_ON;
660 CSRARC(fc, iPCR) &= ~DV_BROADCAST_ON;
662 CSRARC(fc, STATE_CLEAR) &= ~(1 << 23 | 1 << 15 | 1 << 14 );
663 CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR);
667 fw_init_crom(struct firewire_comm *fc)
671 src = &fc->crom_src_buf->src;
685 src->businfo.max_rec = fc->maxrec;
689 src->businfo.link_spd = fc->speed;
691 src->businfo.eui64.hi = fc->eui.hi;
692 src->businfo.eui64.lo = fc->eui.lo;
696 fc->crom_src = src;
697 fc->crom_root = &fc->crom_src_buf->root;
701 fw_reset_crom(struct firewire_comm *fc)
707 buf = fc->crom_src_buf;
708 src = fc->crom_src;
709 root = fc->crom_root;
736 fw_busreset(struct firewire_comm *fc, uint32_t new_status)
743 struct firewire_child_info *element = fc->childList;
745 FW_GLOCK_ASSERT(fc);
746 if (fc->status == FWBUSMGRELECT)
747 // callout_stop(&fc->bmr_callout);
748 delete_timer(fc->bmr_callout);
749 fc->status = new_status;
750 fw_reset_csr(fc);
752 if ((int32)fc->status == FWBUSNOTREADY)
753 fw_init_crom(fc);
755 fw_reset_crom(fc);
758 /* if (device_get_children(fc->bdev, &devlistp, &devcnt) == 0) {
776 src = &fc->crom_src_buf->src;
794 src = &fc->crom_src_buf->src;
796 if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
799 bcopy(newrom, (void *)fc->config_rom, CROMSIZE);
805 void fw_init(struct firewire_comm *fc)
814 fc->arq->queued = 0;
815 fc->ars->queued = 0;
816 fc->atq->queued = 0;
817 fc->ats->queued = 0;
819 fc->arq->buf = NULL;
820 fc->ars->buf = NULL;
821 fc->atq->buf = NULL;
822 fc->ats->buf = NULL;
824 fc->arq->flag = 0;
825 fc->ars->flag = 0;
826 fc->atq->flag = 0;
827 fc->ats->flag = 0;
829 STAILQ_INIT(&fc->atq->q);
830 STAILQ_INIT(&fc->ats->q);
832 fc->Sem = create_sem(0, "fc Sem");
834 for( i = 0 ; i < fc->nisodma ; i ++ ){
835 fc->it[i]->queued = 0;
836 fc->ir[i]->queued = 0;
838 fc->it[i]->start = NULL;
839 fc->ir[i]->start = NULL;
841 fc->it[i]->buf = NULL;
842 fc->ir[i]->buf = NULL;
844 fc->it[i]->flag = FWXFERQ_STREAM;
845 fc->ir[i]->flag = FWXFERQ_STREAM;
847 STAILQ_INIT(&fc->it[i]->q);
848 STAILQ_INIT(&fc->ir[i]->q);
851 fc->it[i]->Sem = create_sem(0, tempname);
853 fc->ir[i]->Sem = create_sem(0, tempname);
856 fc->arq->maxq = FWMAXQUEUE;
857 fc->ars->maxq = FWMAXQUEUE;
858 fc->atq->maxq = FWMAXQUEUE;
859 fc->ats->maxq = FWMAXQUEUE;
861 for( i = 0 ; i < fc->nisodma ; i++){
862 fc->ir[i]->maxq = FWMAXQUEUE;
863 fc->it[i]->maxq = FWMAXQUEUE;
865 CSRARC(fc, TOPO_MAP) = 0x3f1 << 16;
866 CSRARC(fc, TOPO_MAP + 4) = 1;
867 CSRARC(fc, SPED_MAP) = 0x3f1 << 16;
868 CSRARC(fc, SPED_MAP + 4) = 1;
870 STAILQ_INIT(&fc->devices);
873 STAILQ_INIT(&fc->binds);
875 STAILQ_INIT(&fc->tlabels[i]);
880 CSRARC(fc, oMPR) = 0x3fff0001; /* # output channel = 1 */
881 CSRARC(fc, oPCR) = 0x8000007a;
883 CSRARC(fc, i + oPCR) = 0x8000007a;
886 CSRARC(fc, iMPR) = 0x00ff0001; /* # input channel = 1 */
887 CSRARC(fc, iPCR) = 0x803f0000;
889 CSRARC(fc, i + iPCR) = 0x0;
893 fc->crom_src_buf = NULL;
905 xfer->fc = fc;
912 fw_bindadd(fc, fwb);
923 fw_bindlookup(struct firewire_comm *fc, uint16_t dest_hi, uint32_t dest_lo)
929 FW_GLOCK(fc);
930 STAILQ_FOREACH(tfw, &fc->binds, fclist)
935 FW_GUNLOCK(fc);
943 fw_bindadd(struct firewire_comm *fc, struct fw_bind *fwb)
953 FW_GLOCK(fc);
954 STAILQ_FOREACH(tfw, &fc->binds, fclist) {
960 STAILQ_INSERT_HEAD(&fc->binds, fwb, fclist);
962 STAILQ_INSERT_AFTER(&fc->binds, prev, fwb, fclist);
967 FW_GUNLOCK(fc);
975 fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb)
984 FW_GLOCK(fc);
985 STAILQ_FOREACH(tfw, &fc->binds, fclist)
987 STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist);
992 FW_GUNLOCK(fc);
1004 FW_GUNLOCK(fc);
1012 struct firewire_comm *fc, void *sc, void (*hand)(struct fw_xfer *))
1021 xfer->fc = fc;
1060 fw_tl_free(struct firewire_comm *fc, struct fw_xfer *xfer)
1069 mtx_lock(&fc->tlabel_lock);
1071 STAILQ_FOREACH(txfer, &fc->tlabels[xfer->tl], tlabel)
1081 mtx_unlock(&fc->tlabel_lock);
1087 STAILQ_REMOVE(&fc->tlabels[xfer->tl], xfer, fw_xfer, tlabel);
1088 mtx_unlock(&fc->tlabel_lock);
1097 fw_tl2xfer(struct firewire_comm *fc, int node, int tlabel, int tcode)
1105 mtx_lock(&fc->tlabel_lock);
1106 STAILQ_FOREACH(xfer, &fc->tlabels[tlabel], tlabel)
1108 mtx_unlock(&fc->tlabel_lock);
1114 if (xfer->fc->tcode[req].valid_res != tcode) {
1125 mtx_unlock(&fc->tlabel_lock);
1215 if (xfer->fc == NULL)
1216 panic("fw_xfer_done: why xfer->fc is NULL?");
1218 fw_tl_free(xfer->fc, xfer);
1231 FW_GLOCK(xfer->fc);
1236 FW_GUNLOCK(xfer->fc);
1239 if (xfer->fc != NULL) {
1308 fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count)
1313 fc->status = FWBUSPHYCONF;
1318 xfer->fc = fc;
1332 device_printf(fc->bdev, "%s: root_node=%d gap_count=%d\n",
1334 fw_asyreq(fc, -1, xfer);
1373 void fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
1379 fc->sid_cnt = len /(sizeof(uint32_t) * 2);
1380 fc->max_node = fc->nodeid & 0x3f;
1381 CSRARC(fc, NODE_IDS) = ((uint32_t)fc->nodeid) << 16;
1382 fc->status = FWBUSCYMELECT;
1383 fc->topology_map->crc_len = 2;
1384 fc->topology_map->generation ++;
1385 fc->topology_map->self_id_count = 0;
1386 fc->topology_map->node_count = 0;
1387 fc->speed_map->generation ++;
1388 fc->speed_map->crc_len = 1 + (64*64 + 3) / 4;
1389 self_id = &fc->topology_map->self_id[0];
1390 for(i = 0; i < fc->sid_cnt; i ++){
1392 device_printf(fc->bdev, "%s:"
1398 (void)(fc->topology_map->crc_len++);
1400 (void)(fc->topology_map->node_count++);
1406 if(fc->max_node < node){
1407 fc->max_node = self_id->p0.phy_id;
1410 fc->speed_map->speed[node][node]
1413 fc->speed_map->speed[j][node]
1414 = fc->speed_map->speed[node][j]
1415 = min_c(fc->speed_map->speed[j][j],
1418 if ((fc->irm == (u_int)-1 || self_id->p0.phy_id > fc->irm) &&
1420 fc->irm = self_id->p0.phy_id;
1437 (void)(fc->topology_map->self_id_count++);
1440 fc->topology_map->crc = fw_crc16(
1441 (uint32_t *)&fc->topology_map->generation,
1442 fc->topology_map->crc_len * 4);
1443 fc->speed_map->crc = fw_crc16(
1444 (uint32_t *)&fc->speed_map->generation,
1445 fc->speed_map->crc_len * 4);
1447 p = (uint32_t *)fc->topology_map;
1448 for (i = 0; i <= fc->topology_map->crc_len; i++)
1449 CSRARC(fc, TOPO_MAP + i * 4) = htonl(*p++);
1450 p = (uint32_t *)fc->speed_map;
1451 CSRARC(fc, SPED_MAP) = htonl(*p++);
1452 CSRARC(fc, SPED_MAP + 4) = htonl(*p++);
1454 bcopy(p, &CSRARC(fc, SPED_MAP + 8), (fc->speed_map->crc_len - 1)*4);
1456 fc->max_hop = fc->max_node - i_branch;
1457 device_printf(fc->bdev, "%d nodes, maxhop <= %d %s irm(%d) %s\n",
1458 fc->max_node + 1, fc->max_hop,
1459 (fc->irm == (u_int)-1) ? "Not IRM capable" : "cable IRM",
1460 fc->irm,
1461 (fc->irm == fc->nodeid) ? " (me) " : "");
1463 if (try_bmr && (fc->irm != (u_int)-1) && (CSRARC(fc, BUS_MGR_ID) == 0x3f)) {
1464 if (fc->irm == fc->nodeid) {
1465 fc->status = FWBUSMGRDONE;
1466 CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, fc->irm);
1467 fw_bmr(fc);
1469 fc->status = FWBUSMGRELECT;
1470 // callout_reset(&fc->bmr_callout, hz/8,
1471 // (void *)fw_try_bmr, (void *)fc);
1472 fc->bmr_callout = create_timer(fw_try_bmr, fc,
1476 fc->status = FWBUSMGRDONE;
1478 // callout_reset(&fc->busprobe_callout, hz/4,
1479 // (void *)fw_bus_probe, (void *)fc);
1480 fc->busprobe_callout = create_timer(fw_bus_probe, fc,
1491 struct firewire_comm *fc = (struct firewire_comm *)arg;
1495 fc->status = FWBUSEXPLORE;
1499 device_printf(fc->bdev, "%s:"
1502 STAILQ_FOREACH(fwdev, &fc->devices, link)
1507 device_printf(fc->bdev, "%s:"
1512 device_printf(fc->bdev, "%s:"
1519 // wakeup((void *)fc);
1520 release_sem(fc->Sem);
1603 struct firewire_comm *fc;
1611 fc = dfwdev->fc;
1618 device_printf(fc->bdev, "%s: node%d: explore_read_quads failure\n",
1626 device_printf(fc->bdev, "%s:"
1636 device_printf(fc->bdev, "%s: node%d: error reading 0x04\n",
1643 device_printf(fc->bdev, "%s: node%d: invalid bus name 0x%08x\n",
1650 device_printf(fc->bdev, "%s: node(%d) BUS INFO BLOCK:\n"
1660 STAILQ_FOREACH(fwdev, &fc->devices, link)
1667 device_printf(fc->bdev, "%s: node%d: no memory\n",
1672 fwdev->fc = fc;
1687 device_printf(fc->bdev, "%s: "
1690 fwdev->speed = fc->speed_map->speed[fc->nodeid][node];
1701 device_printf(fc->bdev, "%s: fwdev->speed(%s)"
1712 STAILQ_FOREACH(tfwdev, &fc->devices, link) {
1720 STAILQ_INSERT_HEAD(&fc->devices, fwdev, link);
1722 STAILQ_INSERT_AFTER(&fc->devices, pfwdev, fwdev, link);
1724 device_printf(fc->bdev, "New %s device ID:%08x%08x\n",
1733 device_printf(fc->dev, "node%d: crom unchanged\n", node);
1748 device_printf(fc->dev, "%s:"
1762 fw_find_self_id(struct firewire_comm *fc, int node)
1767 for (i = 0; i < fc->topology_map->self_id_count; i++) {
1768 s = &fc->topology_map->self_id[i];
1778 fw_explore(struct firewire_comm *fc)
1787 dfwdev.fc = fc;
1792 for (node = 0; (uint)node <= fc->max_node; node ++) {
1794 if (node == fc->nodeid) {
1796 device_printf(fc->bdev, "%s:"
1797 " found myself node(%d) fc->nodeid(%d)"
1798 " fc->max_node(%d)\n",
1799 __func__, node, fc->nodeid, fc->max_node);
1803 device_printf(fc->bdev, "%s:"
1804 "node(%d) fc->max_node(%d) found\n",
1805 __func__, node, fc->max_node);
1808 fwsid = fw_find_self_id(fc, node);
1811 device_printf(fc->bdev, "%s: node%d: link down\n",
1827 device_printf(fc->bdev, "%s: node %d, err = %d\n",
1839 struct firewire_comm *fc;
1841 fc = (struct firewire_comm *)arg;
1842 mtx_lock(&fc->wait_lock);
1843 while (fc->status != (uint32_t)FWBUSDETACH) {
1844 if (fc->status == FWBUSEXPLORE) {
1845 mtx_unlock(&fc->wait_lock);
1846 fw_explore(fc);
1847 fc->status = FWBUSEXPDONE;
1850 fw_attach_dev(fc);
1851 mtx_lock(&fc->wait_lock);
1853 // msleep((void *)fc, &fc->wait_lock, PWAIT|PCATCH, "-", 0);
1854 mtx_unlock(&fc->wait_lock);
1855 acquire_sem(fc->Sem);
1856 mtx_lock(&fc->wait_lock);
1859 mtx_unlock(&fc->wait_lock);
1868 fw_attach_dev(struct firewire_comm *fc)
1875 struct firewire_child_info *element = fc->childList;
1877 for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL; fwdev = next) {
1884 device_printf(fc->bdev, "%s:"
1892 device_printf(fc->bdev, "%s:"
1895 STAILQ_REMOVE(&fc->devices, fwdev, fw_device,
1902 /* err = device_get_children(fc->bdev, &devlistp, &devcnt);
1930 fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer)
1938 mtx_lock(&fc->tlabel_lock);
1939 new_tlabel = (fc->last_tlabel[dst] + 1) & 0x3f;
1940 STAILQ_FOREACH(txfer, &fc->tlabels[new_tlabel], tlabel)
1944 fc->last_tlabel[dst] = new_tlabel;
1945 STAILQ_INSERT_TAIL(&fc->tlabels[new_tlabel], xfer, tlabel);
1946 mtx_unlock(&fc->tlabel_lock);
1954 mtx_unlock(&fc->tlabel_lock);
1973 tinfo = &rb->fc->tcode[pkt->mode.hdr.tcode];
2001 device_printf(rb->fc->bdev, "%s:"
2047 rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src,
2050 device_printf(rb->fc->bdev, "%s: "
2061 rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src,
2090 device_printf(rb->fc->bdev, "%s: "
2100 bind = fw_bindlookup(rb->fc, fp->mode.rreqq.dest_hi,
2103 device_printf(rb->fc->bdev, "%s: "
2113 if (rb->fc->status == FWBUSINIT) {
2114 device_printf(rb->fc->bdev, "%s: "
2151 if(fw_asyreq(rb->fc, -1, rb->xfer)){
2162 device_printf(rb->fc->bdev, "%s: "
2176 xferq = rb->fc->ir[sub];
2196 sc = device_get_softc(rb->fc->bdev);
2215 device_printf(rb->fc->bdev,"%s: unknown tcode %d\n",
2227 struct firewire_comm *fc;
2232 fc = xfer->fc;
2242 bmr = fc->nodeid;
2244 CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, bmr & 0x3f);
2246 fw_bmr(fc);
2250 device_printf(fc->bdev, "bus manager election failed\n");
2262 struct firewire_comm *fc = (struct firewire_comm *)arg;
2271 fc->status = FWBUSMGRELECT;
2281 fp->mode.lreq.dst = FWLOCALBUS | fc->irm;
2284 xfer->send.payload[1] = htonl(fc->nodeid);
2287 err = fw_asyreq(fc, -1, xfer);
2365 fw_asyreq(xfer->fc, -1, xfer);
2396 fw_bmr(struct firewire_comm *fc)
2404 self_id = fw_find_self_id(fc, fc->max_node);
2405 if (fc->max_node > 0) {
2408 cmstr = fc->max_node;
2410 device_printf(fc->bdev,
2413 cmstr = fc->nodeid;
2419 device_printf(fc->bdev, "bus manager %d %s\n",
2420 CSRARC(fc, BUS_MGR_ID),
2421 (CSRARC(fc, BUS_MGR_ID) != fc->nodeid) ? "(me)" : "");
2422 if(CSRARC(fc, BUS_MGR_ID) != fc->nodeid) {
2428 if(fc->max_hop <= MAX_GAPHOP )
2429 fw_phy_config(fc, cmstr, gap_cnt[fc->max_hop]);
2431 if (cmstr == fc->nodeid || cmstr == -1)
2435 fwdev.fc = fc;
2449 fw_open_isodma(struct firewire_comm *fc, int tx)
2456 xferqa = &fc->it[0];
2458 xferqa = &fc->ir[0];
2460 FW_GLOCK(fc);
2461 for (i = 0; i < fc->nisodma; i ++) {
2468 if (i == fc->nisodma) {
2472 FW_GUNLOCK(fc);