• Home
  • Raw
  • Download

Lines Matching refs:bcs

223 static void __fcpci_write_ctrl(struct fritz_bcs *bcs, int which)  in __fcpci_write_ctrl()  argument
225 struct fritz_adapter *adapter = bcs->adapter; in __fcpci_write_ctrl()
226 int idx = bcs->channel ? AVM_IDX_HDLC_2 : AVM_IDX_HDLC_1; in __fcpci_write_ctrl()
229 'A' + bcs->channel, which, bcs->ctrl.ctrl); in __fcpci_write_ctrl()
232 outl(bcs->ctrl.ctrl, adapter->io + AVM_DATA + HDLC_CTRL); in __fcpci_write_ctrl()
235 static void fcpci_write_ctrl(struct fritz_bcs *bcs, int which) in fcpci_write_ctrl() argument
237 struct fritz_adapter *adapter = bcs->adapter; in fcpci_write_ctrl()
241 __fcpci_write_ctrl(bcs, which); in fcpci_write_ctrl()
313 static void fcpci2_write_ctrl(struct fritz_bcs *bcs, int which) in fcpci2_write_ctrl() argument
315 struct fritz_adapter *adapter = bcs->adapter; in fcpci2_write_ctrl()
316 int offset = bcs->channel ? AVM_HDLC_STATUS_2 : AVM_HDLC_STATUS_1; in fcpci2_write_ctrl()
319 'A' + bcs->channel, which, bcs->ctrl.ctrl); in fcpci2_write_ctrl()
321 outl(bcs->ctrl.ctrl, adapter->io + offset); in fcpci2_write_ctrl()
342 static void __fcpnp_write_ctrl(struct fritz_bcs *bcs, int which) in __fcpnp_write_ctrl() argument
344 struct fritz_adapter *adapter = bcs->adapter; in __fcpnp_write_ctrl()
345 unsigned char idx = bcs->channel ? AVM_IDX_HDLC_2 : AVM_IDX_HDLC_1; in __fcpnp_write_ctrl()
348 'A' + bcs->channel, which, bcs->ctrl.ctrl); in __fcpnp_write_ctrl()
352 outb(bcs->ctrl.sr.mode, in __fcpnp_write_ctrl()
355 outb(bcs->ctrl.sr.xml, in __fcpnp_write_ctrl()
358 outb(bcs->ctrl.sr.cmd, in __fcpnp_write_ctrl()
362 static void fcpnp_write_ctrl(struct fritz_bcs *bcs, int which) in fcpnp_write_ctrl() argument
364 struct fritz_adapter *adapter = bcs->adapter; in fcpnp_write_ctrl()
368 __fcpnp_write_ctrl(bcs, which); in fcpnp_write_ctrl()
374 static inline void B_L1L2(struct fritz_bcs *bcs, int pr, void *arg) in B_L1L2() argument
376 struct hisax_if *ifc = (struct hisax_if *) &bcs->b_if; in B_L1L2()
382 static void hdlc_fill_fifo(struct fritz_bcs *bcs) in hdlc_fill_fifo() argument
384 struct fritz_adapter *adapter = bcs->adapter; in hdlc_fill_fifo()
385 struct sk_buff *skb = bcs->tx_skb; in hdlc_fill_fifo()
394 bcs->ctrl.sr.cmd &= ~HDLC_CMD_XME; in hdlc_fill_fifo()
395 if (bcs->tx_skb->len > bcs->fifo_size) { in hdlc_fill_fifo()
396 count = bcs->fifo_size; in hdlc_fill_fifo()
398 count = bcs->tx_skb->len; in hdlc_fill_fifo()
399 if (bcs->mode != L1_MODE_TRANS) in hdlc_fill_fifo()
400 bcs->ctrl.sr.cmd |= HDLC_CMD_XME; in hdlc_fill_fifo()
402 DBG(0x40, "hdlc_fill_fifo %d/%d", count, bcs->tx_skb->len); in hdlc_fill_fifo()
403 p = bcs->tx_skb->data; in hdlc_fill_fifo()
404 skb_pull(bcs->tx_skb, count); in hdlc_fill_fifo()
405 bcs->tx_cnt += count; in hdlc_fill_fifo()
406 bcs->ctrl.sr.xml = ((count == bcs->fifo_size) ? 0 : count); in hdlc_fill_fifo()
412 __fcpci_write_ctrl(bcs, 3); in hdlc_fill_fifo()
418 fcpci2_write_ctrl(bcs, 3); in hdlc_fill_fifo()
420 (bcs->channel ? AVM_HDLC_FIFO_2 : AVM_HDLC_FIFO_1), in hdlc_fill_fifo()
426 __fcpnp_write_ctrl(bcs, 3); in hdlc_fill_fifo()
433 static inline void hdlc_empty_fifo(struct fritz_bcs *bcs, int count) in hdlc_empty_fifo() argument
435 struct fritz_adapter *adapter = bcs->adapter; in hdlc_empty_fifo()
437 unsigned char idx = bcs->channel ? AVM_IDX_HDLC_2 : AVM_IDX_HDLC_1; in hdlc_empty_fifo()
440 if (bcs->rcvidx + count > HSCX_BUFMAX) { in hdlc_empty_fifo()
444 p = bcs->rcvbuf + bcs->rcvidx; in hdlc_empty_fifo()
445 bcs->rcvidx += count; in hdlc_empty_fifo()
456 (bcs->channel ? AVM_HDLC_FIFO_2 : AVM_HDLC_FIFO_1), in hdlc_empty_fifo()
468 static inline void hdlc_rpr_irq(struct fritz_bcs *bcs, u32 stat) in hdlc_rpr_irq() argument
470 struct fritz_adapter *adapter = bcs->adapter; in hdlc_rpr_irq()
476 bcs->ctrl.sr.xml = 0; in hdlc_rpr_irq()
477 bcs->ctrl.sr.cmd |= HDLC_CMD_RRS; in hdlc_rpr_irq()
478 adapter->write_ctrl(bcs, 1); in hdlc_rpr_irq()
479 bcs->ctrl.sr.cmd &= ~HDLC_CMD_RRS; in hdlc_rpr_irq()
480 adapter->write_ctrl(bcs, 1); in hdlc_rpr_irq()
481 bcs->rcvidx = 0; in hdlc_rpr_irq()
487 len = bcs->fifo_size; in hdlc_rpr_irq()
489 hdlc_empty_fifo(bcs, len); in hdlc_rpr_irq()
491 if ((stat & HDLC_STAT_RME) || (bcs->mode == L1_MODE_TRANS)) { in hdlc_rpr_irq()
493 (bcs->mode == L1_MODE_TRANS)) { in hdlc_rpr_irq()
494 skb = dev_alloc_skb(bcs->rcvidx); in hdlc_rpr_irq()
498 skb_put_data(skb, bcs->rcvbuf, bcs->rcvidx); in hdlc_rpr_irq()
500 B_L1L2(bcs, PH_DATA | INDICATION, skb); in hdlc_rpr_irq()
502 bcs->rcvidx = 0; in hdlc_rpr_irq()
505 bcs->channel, stat); in hdlc_rpr_irq()
506 bcs->rcvidx = 0; in hdlc_rpr_irq()
511 static inline void hdlc_xdu_irq(struct fritz_bcs *bcs) in hdlc_xdu_irq() argument
513 struct fritz_adapter *adapter = bcs->adapter; in hdlc_xdu_irq()
519 bcs->ctrl.sr.xml = 0; in hdlc_xdu_irq()
520 bcs->ctrl.sr.cmd |= HDLC_CMD_XRS; in hdlc_xdu_irq()
521 adapter->write_ctrl(bcs, 1); in hdlc_xdu_irq()
522 bcs->ctrl.sr.cmd &= ~HDLC_CMD_XRS; in hdlc_xdu_irq()
524 if (!bcs->tx_skb) { in hdlc_xdu_irq()
526 adapter->write_ctrl(bcs, 1); in hdlc_xdu_irq()
530 if (bcs->mode == L1_MODE_HDLC) { in hdlc_xdu_irq()
531 skb_push(bcs->tx_skb, bcs->tx_cnt); in hdlc_xdu_irq()
532 bcs->tx_cnt = 0; in hdlc_xdu_irq()
536 static inline void hdlc_xpr_irq(struct fritz_bcs *bcs) in hdlc_xpr_irq() argument
540 skb = bcs->tx_skb; in hdlc_xpr_irq()
545 hdlc_fill_fifo(bcs); in hdlc_xpr_irq()
548 bcs->tx_cnt = 0; in hdlc_xpr_irq()
549 bcs->tx_skb = NULL; in hdlc_xpr_irq()
550 B_L1L2(bcs, PH_DATA | CONFIRM, (void *)(unsigned long)skb->truesize); in hdlc_xpr_irq()
554 static void hdlc_irq_one(struct fritz_bcs *bcs, u32 stat) in hdlc_irq_one() argument
556 DBG(0x10, "ch%d stat %#x", bcs->channel, stat); in hdlc_irq_one()
559 hdlc_rpr_irq(bcs, stat); in hdlc_irq_one()
563 hdlc_xdu_irq(bcs); in hdlc_irq_one()
564 hdlc_xpr_irq(bcs); in hdlc_irq_one()
569 hdlc_xpr_irq(bcs); in hdlc_irq_one()
582 hdlc_irq_one(&adapter->bcs[nr], stat); in hdlc_irq()
586 static void modehdlc(struct fritz_bcs *bcs, int mode) in modehdlc() argument
588 struct fritz_adapter *adapter = bcs->adapter; in modehdlc()
591 'A' + bcs->channel, bcs->mode, mode); in modehdlc()
593 if (bcs->mode == mode) in modehdlc()
596 bcs->fifo_size = 32; in modehdlc()
597 bcs->ctrl.ctrl = 0; in modehdlc()
598 bcs->ctrl.sr.cmd = HDLC_CMD_XRS | HDLC_CMD_RRS; in modehdlc()
601 bcs->ctrl.sr.mode = HDLC_MODE_TRANS; in modehdlc()
602 adapter->write_ctrl(bcs, 5); in modehdlc()
606 bcs->rcvidx = 0; in modehdlc()
607 bcs->tx_cnt = 0; in modehdlc()
608 bcs->tx_skb = NULL; in modehdlc()
610 bcs->ctrl.sr.mode = HDLC_MODE_TRANS; in modehdlc()
612 bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG; in modehdlc()
614 adapter->write_ctrl(bcs, 5); in modehdlc()
615 bcs->ctrl.sr.cmd = HDLC_CMD_XRS; in modehdlc()
616 adapter->write_ctrl(bcs, 1); in modehdlc()
617 bcs->ctrl.sr.cmd = 0; in modehdlc()
620 bcs->mode = mode; in modehdlc()
625 struct fritz_bcs *bcs = ifc->priv; in fritz_b_l2l1() local
633 BUG_ON(bcs->tx_skb); in fritz_b_l2l1()
634 bcs->tx_skb = skb; in fritz_b_l2l1()
636 hdlc_fill_fifo(bcs); in fritz_b_l2l1()
640 DBG(4, "B%d,PH_ACTIVATE_REQUEST %d", bcs->channel + 1, mode); in fritz_b_l2l1()
641 modehdlc(bcs, mode); in fritz_b_l2l1()
642 B_L1L2(bcs, PH_ACTIVATE | INDICATION, NULL); in fritz_b_l2l1()
645 DBG(4, "B%d,PH_DEACTIVATE_REQUEST", bcs->channel + 1); in fritz_b_l2l1()
646 modehdlc(bcs, L1_MODE_NULL); in fritz_b_l2l1()
647 B_L1L2(bcs, PH_DEACTIVATE | INDICATION, NULL); in fritz_b_l2l1()
814 adapter->bcs[0].mode = -1; in fcpcipnp_setup()
815 adapter->bcs[1].mode = -1; in fcpcipnp_setup()
816 modehdlc(&adapter->bcs[0], L1_MODE_NULL); in fcpcipnp_setup()
817 modehdlc(&adapter->bcs[1], L1_MODE_NULL); in fcpcipnp_setup()
853 adapter->bcs[i].adapter = adapter; in new_adapter()
854 adapter->bcs[i].channel = i; in new_adapter()
855 adapter->bcs[i].b_if.ifc.priv = &adapter->bcs[i]; in new_adapter()
856 adapter->bcs[i].b_if.ifc.l2l1 = fritz_b_l2l1; in new_adapter()
860 b_if[i] = &adapter->bcs[i].b_if; in new_adapter()