Lines Matching +full:vci +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 A FORE Systems 200E-series driver for ATM on Linux.
4 Christophe Lizzi (lizzi@cnam.fr), October 1999-March 2003.
6 Based on the PCA-200E driver from Uwe Dannowski (Uwe.Dannowski@inf.tu-dresden.de).
8 This driver simultaneously supports PCA-200E and SBA-200E adapters
25 #include <linux/dma-mapping.h>
50 #if 0 /* enable the debugging code of the buffer supply queues */
54 #if 1 /* ensure correct handling of 52-byte AAL0 SDUs expected by atmdump-like apps */
77 ((((unsigned long)(addr) + (alignment - 1)) & ~(alignment - 1)) - (unsigned long)(addr))
101 MODULE_AUTHOR("Christophe Lizzi - credits to Uwe Dannowski and Heikki Vatiainen");
102 MODULE_DESCRIPTION("FORE Systems 200E-series ATM driver - version " FORE200E_VERSION);
103 MODULE_SUPPORTED_DEVICE("PCA-200E, SBA-200E");
132 return -EINVAL;
148 return -EINVAL; in fore200e_atm2fore_aal()
172 chunk->alloc_size = size + alignment; in fore200e_chunk_alloc()
173 chunk->direction = direction; in fore200e_chunk_alloc()
175 chunk->alloc_addr = kzalloc(chunk->alloc_size, GFP_KERNEL); in fore200e_chunk_alloc()
176 if (chunk->alloc_addr == NULL) in fore200e_chunk_alloc()
177 return -ENOMEM; in fore200e_chunk_alloc()
180 offset = FORE200E_ALIGN(chunk->alloc_addr, alignment); in fore200e_chunk_alloc()
182 chunk->align_addr = chunk->alloc_addr + offset; in fore200e_chunk_alloc()
184 chunk->dma_addr = dma_map_single(fore200e->dev, chunk->align_addr, in fore200e_chunk_alloc()
186 if (dma_mapping_error(fore200e->dev, chunk->dma_addr)) { in fore200e_chunk_alloc()
187 kfree(chunk->alloc_addr); in fore200e_chunk_alloc()
188 return -ENOMEM; in fore200e_chunk_alloc()
199 dma_unmap_single(fore200e->dev, chunk->dma_addr, chunk->dma_size, in fore200e_chunk_free()
200 chunk->direction); in fore200e_chunk_free()
201 kfree(chunk->alloc_addr); in fore200e_chunk_free()
213 /* returned chunks are page-aligned */ in fore200e_dma_chunk_alloc()
214 chunk->alloc_size = size * nbr; in fore200e_dma_chunk_alloc()
215 chunk->alloc_addr = dma_alloc_coherent(fore200e->dev, chunk->alloc_size, in fore200e_dma_chunk_alloc()
216 &chunk->dma_addr, GFP_KERNEL); in fore200e_dma_chunk_alloc()
217 if (!chunk->alloc_addr) in fore200e_dma_chunk_alloc()
218 return -ENOMEM; in fore200e_dma_chunk_alloc()
219 chunk->align_addr = chunk->alloc_addr; in fore200e_dma_chunk_alloc()
229 dma_free_coherent(fore200e->dev, chunk->alloc_size, chunk->alloc_addr, in fore200e_dma_chunk_free()
230 chunk->dma_addr); in fore200e_dma_chunk_free()
272 if ((ok = (fore200e->bus->read(addr) == val))) in fore200e_io_poll()
280 fore200e->bus->read(addr), val); in fore200e_io_poll()
297 if ((buffer = fore200e->host_bsq[ scheme ][ magn ].buffer) != NULL) { in fore200e_free_rx_buf()
303 if (data->alloc_addr != NULL) in fore200e_free_rx_buf()
320 struct chunk* status = &fore200e->host_bsq[ scheme ][ magn ].status; in fore200e_uninit_bs_queue()
321 struct chunk* rbd_block = &fore200e->host_bsq[ scheme ][ magn ].rbd_block; in fore200e_uninit_bs_queue()
323 if (status->alloc_addr) in fore200e_uninit_bs_queue()
326 if (rbd_block->alloc_addr) in fore200e_uninit_bs_queue()
338 fore200e->cp_monitor = fore200e->virt_base + FORE200E_CP_MONITOR_OFFSET; in fore200e_reset()
340 fore200e->bus->write(BSTAT_COLD_START, &fore200e->cp_monitor->bstat); in fore200e_reset()
342 fore200e->bus->reset(fore200e); in fore200e_reset()
345 ok = fore200e_io_poll(fore200e, &fore200e->cp_monitor->bstat, BSTAT_SELFTEST_OK, 1000); in fore200e_reset()
348 printk(FORE200E "device %s self-test failed\n", fore200e->name); in fore200e_reset()
349 return -ENODEV; in fore200e_reset()
352 printk(FORE200E "device %s self-test passed\n", fore200e->name); in fore200e_reset()
354 fore200e->state = FORE200E_STATE_RESET; in fore200e_reset()
365 fore200e->name, fore200e->phys_base, in fore200e_shutdown()
366 fore200e_irq_itoa(fore200e->irq)); in fore200e_shutdown()
368 if (fore200e->state > FORE200E_STATE_RESET) { in fore200e_shutdown()
374 switch(fore200e->state) { in fore200e_shutdown()
377 kfree(fore200e->stats); in fore200e_shutdown()
381 free_irq(fore200e->irq, fore200e->atm_dev); in fore200e_shutdown()
393 fore200e_dma_chunk_free(fore200e, &fore200e->host_rxq.status); in fore200e_shutdown()
394 fore200e_dma_chunk_free(fore200e, &fore200e->host_rxq.rpd); in fore200e_shutdown()
398 fore200e_dma_chunk_free(fore200e, &fore200e->host_txq.status); in fore200e_shutdown()
399 fore200e_dma_chunk_free(fore200e, &fore200e->host_txq.tpd); in fore200e_shutdown()
403 fore200e_dma_chunk_free(fore200e, &fore200e->host_cmdq.status); in fore200e_shutdown()
416 fore200e->bus->unmap(fore200e); in fore200e_shutdown()
424 atm_dev_deregister(fore200e->atm_dev); in fore200e_shutdown()
437 /* on big-endian hosts, the board is configured to convert in fore200e_pca_read()
445 /* on big-endian hosts, the board is configured to convert in fore200e_pca_write()
454 int irq_posted = readl(fore200e->regs.pca.psr); in fore200e_pca_irq_check()
457 if (irq_posted && (readl(fore200e->regs.pca.hcr) & PCA200E_HCR_OUTFULL)) { in fore200e_pca_irq_check()
458 DPRINTK(2,"FIFO OUT full, device %d\n", fore200e->atm_dev->number); in fore200e_pca_irq_check()
469 writel(PCA200E_HCR_CLRINTR, fore200e->regs.pca.hcr); in fore200e_pca_irq_ack()
476 writel(PCA200E_HCR_RESET, fore200e->regs.pca.hcr); in fore200e_pca_reset()
478 writel(0, fore200e->regs.pca.hcr); in fore200e_pca_reset()
484 DPRINTK(2, "device %s being mapped in memory\n", fore200e->name); in fore200e_pca_map()
486 fore200e->virt_base = ioremap(fore200e->phys_base, PCA200E_IOSPACE_LENGTH); in fore200e_pca_map()
488 if (fore200e->virt_base == NULL) { in fore200e_pca_map()
489 printk(FORE200E "can't map device %s\n", fore200e->name); in fore200e_pca_map()
490 return -EFAULT; in fore200e_pca_map()
493 DPRINTK(1, "device %s mapped to 0x%p\n", fore200e->name, fore200e->virt_base); in fore200e_pca_map()
496 fore200e->regs.pca.hcr = fore200e->virt_base + PCA200E_HCR_OFFSET; in fore200e_pca_map()
497 fore200e->regs.pca.imr = fore200e->virt_base + PCA200E_IMR_OFFSET; in fore200e_pca_map()
498 fore200e->regs.pca.psr = fore200e->virt_base + PCA200E_PSR_OFFSET; in fore200e_pca_map()
500 fore200e->state = FORE200E_STATE_MAP; in fore200e_pca_map()
508 DPRINTK(2, "device %s being unmapped from memory\n", fore200e->name); in fore200e_pca_unmap()
510 if (fore200e->virt_base != NULL) in fore200e_pca_unmap()
511 iounmap(fore200e->virt_base); in fore200e_pca_unmap()
517 struct pci_dev *pci_dev = to_pci_dev(fore200e->dev); in fore200e_pca_configure()
520 DPRINTK(2, "device %s being configured\n", fore200e->name); in fore200e_pca_configure()
522 if ((pci_dev->irq == 0) || (pci_dev->irq == 0xFF)) { in fore200e_pca_configure()
523 printk(FORE200E "incorrect IRQ setting - misconfigured PCI-PCI bridge?\n"); in fore200e_pca_configure()
524 return -EIO; in fore200e_pca_configure()
550 fore200e->state = FORE200E_STATE_CONFIGURE; in fore200e_pca_configure()
558 struct host_cmdq* cmdq = &fore200e->host_cmdq; in fore200e_pca_prom_read()
559 struct host_cmdq_entry* entry = &cmdq->host_entry[ cmdq->head ]; in fore200e_pca_prom_read()
564 FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); in fore200e_pca_prom_read()
569 prom_dma = dma_map_single(fore200e->dev, prom, sizeof(struct prom_data), in fore200e_pca_prom_read()
571 if (dma_mapping_error(fore200e->dev, prom_dma)) in fore200e_pca_prom_read()
572 return -ENOMEM; in fore200e_pca_prom_read()
574 fore200e->bus->write(prom_dma, &entry->cp_entry->cmd.prom_block.prom_haddr); in fore200e_pca_prom_read()
576 *entry->status = STATUS_PENDING; in fore200e_pca_prom_read()
578 fore200e->bus->write(*(u32*)&opcode, (u32 __iomem *)&entry->cp_entry->cmd.prom_block.opcode); in fore200e_pca_prom_read()
580 ok = fore200e_poll(fore200e, entry->status, STATUS_COMPLETE, 400); in fore200e_pca_prom_read()
582 *entry->status = STATUS_FREE; in fore200e_pca_prom_read()
584 dma_unmap_single(fore200e->dev, prom_dma, sizeof(struct prom_data), DMA_FROM_DEVICE); in fore200e_pca_prom_read()
587 printk(FORE200E "unable to get PROM data from device %s\n", fore200e->name); in fore200e_pca_prom_read()
588 return -EIO; in fore200e_pca_prom_read()
595 /* MAC address is stored as little-endian */ in fore200e_pca_prom_read()
596 swap_here(&prom->mac_addr[0]); in fore200e_pca_prom_read()
597 swap_here(&prom->mac_addr[4]); in fore200e_pca_prom_read()
607 struct pci_dev *pci_dev = to_pci_dev(fore200e->dev); in fore200e_pca_proc_read()
610 pci_dev->bus->number, PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)); in fore200e_pca_proc_read()
614 .model_name = "PCA-200E",
646 u32 hcr = fore200e->bus->read(fore200e->regs.sba.hcr) & SBA200E_HCR_STICKY; in fore200e_sba_irq_enable()
647 fore200e->bus->write(hcr | SBA200E_HCR_INTR_ENA, fore200e->regs.sba.hcr); in fore200e_sba_irq_enable()
652 return fore200e->bus->read(fore200e->regs.sba.hcr) & SBA200E_HCR_INTR_REQ; in fore200e_sba_irq_check()
657 u32 hcr = fore200e->bus->read(fore200e->regs.sba.hcr) & SBA200E_HCR_STICKY; in fore200e_sba_irq_ack()
658 fore200e->bus->write(hcr | SBA200E_HCR_INTR_CLR, fore200e->regs.sba.hcr); in fore200e_sba_irq_ack()
663 fore200e->bus->write(SBA200E_HCR_RESET, fore200e->regs.sba.hcr); in fore200e_sba_reset()
665 fore200e->bus->write(0, fore200e->regs.sba.hcr); in fore200e_sba_reset()
670 struct platform_device *op = to_platform_device(fore200e->dev); in fore200e_sba_map()
674 fore200e->regs.sba.hcr = of_ioremap(&op->resource[0], 0, SBA200E_HCR_LENGTH, "SBA HCR"); in fore200e_sba_map()
675 fore200e->regs.sba.bsr = of_ioremap(&op->resource[1], 0, SBA200E_BSR_LENGTH, "SBA BSR"); in fore200e_sba_map()
676 fore200e->regs.sba.isr = of_ioremap(&op->resource[2], 0, SBA200E_ISR_LENGTH, "SBA ISR"); in fore200e_sba_map()
677 fore200e->virt_base = of_ioremap(&op->resource[3], 0, SBA200E_RAM_LENGTH, "SBA RAM"); in fore200e_sba_map()
679 if (!fore200e->virt_base) { in fore200e_sba_map()
680 printk(FORE200E "unable to map RAM of device %s\n", fore200e->name); in fore200e_sba_map()
681 return -EFAULT; in fore200e_sba_map()
684 DPRINTK(1, "device %s mapped to 0x%p\n", fore200e->name, fore200e->virt_base); in fore200e_sba_map()
686 fore200e->bus->write(0x02, fore200e->regs.sba.isr); /* XXX hardwired interrupt level */ in fore200e_sba_map()
689 bursts = of_getintprop_default(op->dev.of_node->parent, "burst-sizes", 0x00); in fore200e_sba_map()
692 sbus_set_sbus64(&op->dev, bursts); in fore200e_sba_map()
694 fore200e->state = FORE200E_STATE_MAP; in fore200e_sba_map()
700 struct platform_device *op = to_platform_device(fore200e->dev); in fore200e_sba_unmap()
702 of_iounmap(&op->resource[0], fore200e->regs.sba.hcr, SBA200E_HCR_LENGTH); in fore200e_sba_unmap()
703 of_iounmap(&op->resource[1], fore200e->regs.sba.bsr, SBA200E_BSR_LENGTH); in fore200e_sba_unmap()
704 of_iounmap(&op->resource[2], fore200e->regs.sba.isr, SBA200E_ISR_LENGTH); in fore200e_sba_unmap()
705 of_iounmap(&op->resource[3], fore200e->virt_base, SBA200E_RAM_LENGTH); in fore200e_sba_unmap()
710 fore200e->state = FORE200E_STATE_CONFIGURE; in fore200e_sba_configure()
716 struct platform_device *op = to_platform_device(fore200e->dev); in fore200e_sba_prom_read()
720 prop = of_get_property(op->dev.of_node, "madaddrlo2", &len); in fore200e_sba_prom_read()
722 return -ENODEV; in fore200e_sba_prom_read()
723 memcpy(&prom->mac_addr[4], prop, 4); in fore200e_sba_prom_read()
725 prop = of_get_property(op->dev.of_node, "madaddrhi4", &len); in fore200e_sba_prom_read()
727 return -ENODEV; in fore200e_sba_prom_read()
728 memcpy(&prom->mac_addr[2], prop, 4); in fore200e_sba_prom_read()
730 prom->serial_number = of_getintprop_default(op->dev.of_node, in fore200e_sba_prom_read()
732 prom->hw_revision = of_getintprop_default(op->dev.of_node, in fore200e_sba_prom_read()
740 struct platform_device *op = to_platform_device(fore200e->dev); in fore200e_sba_proc_read()
743 regs = of_get_property(op->dev.of_node, "reg", NULL); in fore200e_sba_proc_read()
746 (regs ? regs->which_io : 0), op->dev.of_node); in fore200e_sba_proc_read()
750 .model_name = "SBA-200E",
772 struct host_txq* txq = &fore200e->host_txq; in fore200e_tx_irq()
777 if (fore200e->host_txq.txing == 0) in fore200e_tx_irq()
782 entry = &txq->host_entry[ txq->tail ]; in fore200e_tx_irq()
784 if ((*entry->status & STATUS_COMPLETE) == 0) { in fore200e_tx_irq()
789 entry, txq->tail, entry->vc_map, entry->skb); in fore200e_tx_irq()
792 kfree(entry->data); in fore200e_tx_irq()
795 dma_unmap_single(fore200e->dev, entry->tpd->tsd[ 0 ].buffer, entry->tpd->tsd[ 0 ].length, in fore200e_tx_irq()
798 vc_map = entry->vc_map; in fore200e_tx_irq()
801 if ((vc_map->vcc == NULL) || in fore200e_tx_irq()
802 (test_bit(ATM_VF_READY, &vc_map->vcc->flags) == 0)) { in fore200e_tx_irq()
805 fore200e->atm_dev->number); in fore200e_tx_irq()
807 dev_kfree_skb_any(entry->skb); in fore200e_tx_irq()
810 ASSERT(vc_map->vcc); in fore200e_tx_irq()
812 /* vcc closed then immediately re-opened? */ in fore200e_tx_irq()
813 if (vc_map->incarn != entry->incarn) { in fore200e_tx_irq()
816 if the same vcc is immediately re-opened, those pending PDUs must in fore200e_tx_irq()
818 to the prior incarnation of that vcc. otherwise, sk_atm(vcc)->sk_wmem_alloc in fore200e_tx_irq()
820 leading to a negative sk->sk_wmem_alloc count, ultimately freezing the vcc. in fore200e_tx_irq()
824 of the vcc, then this implies that the vcc has been closed then re-opened. in fore200e_tx_irq()
827 DPRINTK(1, "vcc closed-then-re-opened; dropping PDU sent on device %d\n", in fore200e_tx_irq()
828 fore200e->atm_dev->number); in fore200e_tx_irq()
830 dev_kfree_skb_any(entry->skb); in fore200e_tx_irq()
833 vcc = vc_map->vcc; in fore200e_tx_irq()
837 if (vcc->pop) { in fore200e_tx_irq()
838 vcc->pop(vcc, entry->skb); in fore200e_tx_irq()
841 dev_kfree_skb_any(entry->skb); in fore200e_tx_irq()
845 if (*entry->status & STATUS_ERROR) in fore200e_tx_irq()
846 atomic_inc(&vcc->stats->tx_err); in fore200e_tx_irq()
848 atomic_inc(&vcc->stats->tx); in fore200e_tx_irq()
852 *entry->status = STATUS_FREE; in fore200e_tx_irq()
854 fore200e->host_txq.txing--; in fore200e_tx_irq()
856 FORE200E_NEXT_ENTRY(txq->tail, QUEUE_SIZE_TX); in fore200e_tx_irq()
867 buffer = bsq->freebuf; in bsq_audit()
870 if (buffer->supplied) { in bsq_audit()
872 where, scheme, magn, buffer->index); in bsq_audit()
875 if (buffer->magn != magn) { in bsq_audit()
877 where, scheme, magn, buffer->index, buffer->magn); in bsq_audit()
880 if (buffer->scheme != scheme) { in bsq_audit()
882 where, scheme, magn, buffer->index, buffer->scheme); in bsq_audit()
885 if ((buffer->index < 0) || (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ])) { in bsq_audit()
887 where, scheme, magn, buffer->index); in bsq_audit()
891 buffer = buffer->next; in bsq_audit()
894 if (count != bsq->freebuf_count) { in bsq_audit()
896 where, scheme, magn, count, bsq->freebuf_count); in bsq_audit()
915 bsq = &fore200e->host_bsq[ scheme ][ magn ]; in fore200e_supply()
920 while (bsq->freebuf_count >= RBD_BLK_SIZE) { in fore200e_supply()
923 RBD_BLK_SIZE, scheme, magn, bsq->freebuf_count); in fore200e_supply()
925 entry = &bsq->host_entry[ bsq->head ]; in fore200e_supply()
930 buffer = bsq->freebuf; in fore200e_supply()
933 scheme, magn, bsq->freebuf_count); in fore200e_supply()
936 bsq->freebuf = buffer->next; in fore200e_supply()
939 if (buffer->supplied) in fore200e_supply()
941 scheme, magn, buffer->index); in fore200e_supply()
942 buffer->supplied = 1; in fore200e_supply()
944 entry->rbd_block->rbd[ i ].buffer_haddr = buffer->data.dma_addr; in fore200e_supply()
945 entry->rbd_block->rbd[ i ].handle = FORE200E_BUF2HDL(buffer); in fore200e_supply()
948 FORE200E_NEXT_ENTRY(bsq->head, QUEUE_SIZE_BS); in fore200e_supply()
951 bsq->freebuf_count -= RBD_BLK_SIZE; in fore200e_supply()
953 *entry->status = STATUS_PENDING; in fore200e_supply()
954 fore200e->bus->write(entry->rbd_block_dma, &entry->cp_entry->rbd_block_haddr); in fore200e_supply()
978 if ((vcc->qos.aal == ATM_AAL0) && (vcc->qos.rxtp.max_sdu == ATM_AAL0_SDU)) { in fore200e_push_rpd()
980 cell_header = (rpd->atm_header.gfc << ATM_HDR_GFC_SHIFT) | in fore200e_push_rpd()
981 (rpd->atm_header.vpi << ATM_HDR_VPI_SHIFT) | in fore200e_push_rpd()
982 (rpd->atm_header.vci << ATM_HDR_VCI_SHIFT) | in fore200e_push_rpd()
983 (rpd->atm_header.plt << ATM_HDR_PTI_SHIFT) | in fore200e_push_rpd()
984 rpd->atm_header.clp; in fore200e_push_rpd()
990 for (i = 0; i < rpd->nseg; i++) in fore200e_push_rpd()
991 pdu_len += rpd->rsd[ i ].length; in fore200e_push_rpd()
997 atomic_inc(&vcc->stats->rx_drop); in fore200e_push_rpd()
998 return -ENOMEM; in fore200e_push_rpd()
1010 for (i = 0; i < rpd->nseg; i++) { in fore200e_push_rpd()
1013 buffer = FORE200E_HDL2BUF(rpd->rsd[ i ].handle); in fore200e_push_rpd()
1016 dma_sync_single_for_cpu(fore200e->dev, buffer->data.dma_addr, in fore200e_push_rpd()
1017 rpd->rsd[i].length, DMA_FROM_DEVICE); in fore200e_push_rpd()
1019 skb_put_data(skb, buffer->data.align_addr, rpd->rsd[i].length); in fore200e_push_rpd()
1022 dma_sync_single_for_device(fore200e->dev, buffer->data.dma_addr, in fore200e_push_rpd()
1023 rpd->rsd[i].length, DMA_FROM_DEVICE); in fore200e_push_rpd()
1026 DPRINTK(3, "rx skb: len = %d, truesize = %d\n", skb->len, skb->truesize); in fore200e_push_rpd()
1028 if (pdu_len < fore200e_vcc->rx_min_pdu) in fore200e_push_rpd()
1029 fore200e_vcc->rx_min_pdu = pdu_len; in fore200e_push_rpd()
1030 if (pdu_len > fore200e_vcc->rx_max_pdu) in fore200e_push_rpd()
1031 fore200e_vcc->rx_max_pdu = pdu_len; in fore200e_push_rpd()
1032 fore200e_vcc->rx_pdu++; in fore200e_push_rpd()
1035 if (atm_charge(vcc, skb->truesize) == 0) { in fore200e_push_rpd()
1037 DPRINTK(2, "receive buffers saturated for %d.%d.%d - PDU dropped\n", in fore200e_push_rpd()
1038 vcc->itf, vcc->vpi, vcc->vci); in fore200e_push_rpd()
1042 atomic_inc(&vcc->stats->rx_drop); in fore200e_push_rpd()
1043 return -ENOMEM; in fore200e_push_rpd()
1046 vcc->push(vcc, skb); in fore200e_push_rpd()
1047 atomic_inc(&vcc->stats->rx); in fore200e_push_rpd()
1060 for (i = 0; i < rpd->nseg; i++) { in fore200e_collect_rpd()
1063 buffer = FORE200E_HDL2BUF(rpd->rsd[ i ].handle); in fore200e_collect_rpd()
1065 bsq = &fore200e->host_bsq[ buffer->scheme ][ buffer->magn ]; in fore200e_collect_rpd()
1068 bsq_audit(2, bsq, buffer->scheme, buffer->magn); in fore200e_collect_rpd()
1070 if (buffer->supplied == 0) in fore200e_collect_rpd()
1072 buffer->scheme, buffer->magn, buffer->index); in fore200e_collect_rpd()
1073 buffer->supplied = 0; in fore200e_collect_rpd()
1076 /* re-insert the buffer into the free buffer list */ in fore200e_collect_rpd()
1077 buffer->next = bsq->freebuf; in fore200e_collect_rpd()
1078 bsq->freebuf = buffer; in fore200e_collect_rpd()
1081 bsq->freebuf_count++; in fore200e_collect_rpd()
1089 struct host_rxq* rxq = &fore200e->host_rxq; in fore200e_rx_irq()
1096 entry = &rxq->host_entry[ rxq->head ]; in fore200e_rx_irq()
1099 if ((*entry->status & STATUS_COMPLETE) == 0) in fore200e_rx_irq()
1102 vc_map = FORE200E_VC_MAP(fore200e, entry->rpd->atm_header.vpi, entry->rpd->atm_header.vci); in fore200e_rx_irq()
1104 if ((vc_map->vcc == NULL) || in fore200e_rx_irq()
1105 (test_bit(ATM_VF_READY, &vc_map->vcc->flags) == 0)) { in fore200e_rx_irq()
1108 fore200e->atm_dev->number, in fore200e_rx_irq()
1109 entry->rpd->atm_header.vpi, entry->rpd->atm_header.vci); in fore200e_rx_irq()
1112 vcc = vc_map->vcc; in fore200e_rx_irq()
1115 if ((*entry->status & STATUS_ERROR) == 0) { in fore200e_rx_irq()
1117 fore200e_push_rpd(fore200e, vcc, entry->rpd); in fore200e_rx_irq()
1121 fore200e->atm_dev->number, in fore200e_rx_irq()
1122 entry->rpd->atm_header.vpi, entry->rpd->atm_header.vci); in fore200e_rx_irq()
1123 atomic_inc(&vcc->stats->rx_err); in fore200e_rx_irq()
1127 FORE200E_NEXT_ENTRY(rxq->head, QUEUE_SIZE_RX); in fore200e_rx_irq()
1129 fore200e_collect_rpd(fore200e, entry->rpd); in fore200e_rx_irq()
1132 fore200e->bus->write(entry->rpd_dma, &entry->cp_entry->rpd_haddr); in fore200e_rx_irq()
1133 *entry->status = STATUS_FREE; in fore200e_rx_irq()
1146 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_irq()
1148 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_irq()
1150 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_irq()
1152 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_irq()
1162 if (fore200e->bus->irq_check(fore200e) == 0) { in fore200e_interrupt()
1164 DPRINTK(3, "interrupt NOT triggered by device %d\n", fore200e->atm_dev->number); in fore200e_interrupt()
1167 DPRINTK(3, "interrupt triggered by device %d\n", fore200e->atm_dev->number); in fore200e_interrupt()
1170 tasklet_schedule(&fore200e->tx_tasklet); in fore200e_interrupt()
1171 tasklet_schedule(&fore200e->rx_tasklet); in fore200e_interrupt()
1176 fore200e->bus->irq_ack(fore200e); in fore200e_interrupt()
1188 DPRINTK(3, "tx tasklet scheduled for device %d\n", fore200e->atm_dev->number); in fore200e_tx_tasklet()
1190 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_tx_tasklet()
1192 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_tx_tasklet()
1202 DPRINTK(3, "rx tasklet scheduled for device %d\n", fore200e->atm_dev->number); in fore200e_rx_tasklet()
1204 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_rx_tasklet()
1206 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_rx_tasklet()
1215 int scheme = vcc->vci % 2 ? BUFFER_SCHEME_ONE : BUFFER_SCHEME_TWO; in fore200e_select_scheme()
1218 vcc->itf, vcc->vpi, vcc->vci, scheme); in fore200e_select_scheme()
1227 struct host_cmdq* cmdq = &fore200e->host_cmdq; in fore200e_activate_vcin()
1228 struct host_cmdq_entry* entry = &cmdq->host_entry[ cmdq->head ]; in fore200e_activate_vcin()
1233 enum fore200e_aal aal = fore200e_atm2fore_aal(vcc->qos.aal); in fore200e_activate_vcin()
1235 FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); in fore200e_activate_vcin()
1238 FORE200E_VCC(vcc)->scheme = fore200e_select_scheme(vcc); in fore200e_activate_vcin()
1242 activ_opcode.scheme = FORE200E_VCC(vcc)->scheme; in fore200e_activate_vcin()
1250 vpvc.vci = vcc->vci; in fore200e_activate_vcin()
1251 vpvc.vpi = vcc->vpi; in fore200e_activate_vcin()
1253 *entry->status = STATUS_PENDING; in fore200e_activate_vcin()
1261 fore200e->bus->write(mtu, &entry->cp_entry->cmd.activate_block.mtu); in fore200e_activate_vcin()
1262 …fore200e->bus->write(*(u32*)&vpvc, (u32 __iomem *)&entry->cp_entry->cmd.activate_block.vpv… in fore200e_activate_vcin()
1263 …fore200e->bus->write(*(u32*)&activ_opcode, (u32 __iomem *)&entry->cp_entry->cmd.activate_block.opc… in fore200e_activate_vcin()
1266 …fore200e->bus->write(*(u32*)&vpvc, (u32 __iomem *)&entry->cp_entry->cmd.deactivate_block.v… in fore200e_activate_vcin()
1267 …fore200e->bus->write(*(u32*)&deactiv_opcode, (u32 __iomem *)&entry->cp_entry->cmd.deactivate_block… in fore200e_activate_vcin()
1270 ok = fore200e_poll(fore200e, entry->status, STATUS_COMPLETE, 400); in fore200e_activate_vcin()
1272 *entry->status = STATUS_FREE; in fore200e_activate_vcin()
1276 activate ? "open" : "close", vcc->itf, vcc->vpi, vcc->vci); in fore200e_activate_vcin()
1277 return -EIO; in fore200e_activate_vcin()
1280 DPRINTK(1, "VC %d.%d.%d %sed\n", vcc->itf, vcc->vpi, vcc->vci, in fore200e_activate_vcin()
1292 if (qos->txtp.max_pcr < ATM_OC3_PCR) { in fore200e_rate_ctrl()
1295 rate->data_cells = qos->txtp.max_pcr * FORE200E_MAX_BACK2BACK_CELLS / ATM_OC3_PCR; in fore200e_rate_ctrl()
1296 rate->idle_cells = FORE200E_MAX_BACK2BACK_CELLS - rate->data_cells; in fore200e_rate_ctrl()
1300 rate->data_cells = rate->idle_cells = 0; in fore200e_rate_ctrl()
1308 struct fore200e* fore200e = FORE200E_DEV(vcc->dev); in fore200e_open()
1312 int vci = vcc->vci; in fore200e_open() local
1313 short vpi = vcc->vpi; in fore200e_open()
1316 ASSERT((vci >= 0) && (vci < 1<<FORE200E_VCI_BITS)); in fore200e_open()
1318 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_open()
1320 vc_map = FORE200E_VC_MAP(fore200e, vpi, vci); in fore200e_open()
1321 if (vc_map->vcc) { in fore200e_open()
1323 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_open()
1326 fore200e->atm_dev->number, vpi, vci); in fore200e_open()
1328 return -EINVAL; in fore200e_open()
1331 vc_map->vcc = vcc; in fore200e_open()
1333 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_open()
1337 vc_map->vcc = NULL; in fore200e_open()
1338 return -ENOMEM; in fore200e_open()
1341 DPRINTK(2, "opening %d.%d.%d:%d QoS = (tx: cl=%s, pcr=%d-%d, cdv=%d, max_sdu=%d; " in fore200e_open()
1342 "rx: cl=%s, pcr=%d-%d, cdv=%d, max_sdu=%d)\n", in fore200e_open()
1343 vcc->itf, vcc->vpi, vcc->vci, fore200e_atm2fore_aal(vcc->qos.aal), in fore200e_open()
1344 fore200e_traffic_class[ vcc->qos.txtp.traffic_class ], in fore200e_open()
1345 vcc->qos.txtp.min_pcr, vcc->qos.txtp.max_pcr, vcc->qos.txtp.max_cdv, vcc->qos.txtp.max_sdu, in fore200e_open()
1346 fore200e_traffic_class[ vcc->qos.rxtp.traffic_class ], in fore200e_open()
1347 vcc->qos.rxtp.min_pcr, vcc->qos.rxtp.max_pcr, vcc->qos.rxtp.max_cdv, vcc->qos.rxtp.max_sdu); in fore200e_open()
1349 /* pseudo-CBR bandwidth requested? */ in fore200e_open()
1350 if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) { in fore200e_open()
1352 mutex_lock(&fore200e->rate_mtx); in fore200e_open()
1353 if (fore200e->available_cell_rate < vcc->qos.txtp.max_pcr) { in fore200e_open()
1354 mutex_unlock(&fore200e->rate_mtx); in fore200e_open()
1357 vc_map->vcc = NULL; in fore200e_open()
1358 return -EAGAIN; in fore200e_open()
1362 fore200e->available_cell_rate -= vcc->qos.txtp.max_pcr; in fore200e_open()
1363 mutex_unlock(&fore200e->rate_mtx); in fore200e_open()
1366 vcc->itf = vcc->dev->number; in fore200e_open()
1368 set_bit(ATM_VF_PARTIAL,&vcc->flags); in fore200e_open()
1369 set_bit(ATM_VF_ADDR, &vcc->flags); in fore200e_open()
1371 vcc->dev_data = fore200e_vcc; in fore200e_open()
1373 if (fore200e_activate_vcin(fore200e, 1, vcc, vcc->qos.rxtp.max_sdu) < 0) { in fore200e_open()
1375 vc_map->vcc = NULL; in fore200e_open()
1377 clear_bit(ATM_VF_ADDR, &vcc->flags); in fore200e_open()
1378 clear_bit(ATM_VF_PARTIAL,&vcc->flags); in fore200e_open()
1380 vcc->dev_data = NULL; in fore200e_open()
1382 fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; in fore200e_open()
1385 return -EINVAL; in fore200e_open()
1389 if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) { in fore200e_open()
1391 fore200e_rate_ctrl(&vcc->qos, &fore200e_vcc->rate); in fore200e_open()
1392 set_bit(ATM_VF_HASQOS, &vcc->flags); in fore200e_open()
1395 vcc->itf, vcc->vpi, vcc->vci, fore200e_atm2fore_aal(vcc->qos.aal), in fore200e_open()
1396 vcc->qos.txtp.max_pcr, vcc->qos.rxtp.max_pcr, in fore200e_open()
1397 fore200e_vcc->rate.data_cells, fore200e_vcc->rate.idle_cells); in fore200e_open()
1400 fore200e_vcc->tx_min_pdu = fore200e_vcc->rx_min_pdu = MAX_PDU_SIZE + 1; in fore200e_open()
1401 fore200e_vcc->tx_max_pdu = fore200e_vcc->rx_max_pdu = 0; in fore200e_open()
1402 fore200e_vcc->tx_pdu = fore200e_vcc->rx_pdu = 0; in fore200e_open()
1405 vc_map->incarn = ++fore200e->incarn_count; in fore200e_open()
1408 set_bit(ATM_VF_READY, &vcc->flags); in fore200e_open()
1423 fore200e = FORE200E_DEV(vcc->dev); in fore200e_close()
1425 ASSERT((vcc->vpi >= 0) && (vcc->vpi < 1<<FORE200E_VPI_BITS)); in fore200e_close()
1426 ASSERT((vcc->vci >= 0) && (vcc->vci < 1<<FORE200E_VCI_BITS)); in fore200e_close()
1428 …DPRINTK(2, "closing %d.%d.%d:%d\n", vcc->itf, vcc->vpi, vcc->vci, fore200e_atm2fore_aal(vcc->qos.a… in fore200e_close()
1430 clear_bit(ATM_VF_READY, &vcc->flags); in fore200e_close()
1434 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_close()
1436 vc_map = FORE200E_VC_MAP(fore200e, vcc->vpi, vcc->vci); in fore200e_close()
1439 vc_map->vcc = NULL; in fore200e_close()
1441 vcc->itf = vcc->vci = vcc->vpi = 0; in fore200e_close()
1444 vcc->dev_data = NULL; in fore200e_close()
1446 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_close()
1449 if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) { in fore200e_close()
1451 mutex_lock(&fore200e->rate_mtx); in fore200e_close()
1452 fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; in fore200e_close()
1453 mutex_unlock(&fore200e->rate_mtx); in fore200e_close()
1455 clear_bit(ATM_VF_HASQOS, &vcc->flags); in fore200e_close()
1458 clear_bit(ATM_VF_ADDR, &vcc->flags); in fore200e_close()
1459 clear_bit(ATM_VF_PARTIAL,&vcc->flags); in fore200e_close()
1478 int tx_len = skb->len; in fore200e_send()
1486 return -EINVAL; in fore200e_send()
1488 fore200e = FORE200E_DEV(vcc->dev); in fore200e_send()
1492 return -EINVAL; in fore200e_send()
1494 txq = &fore200e->host_txq; in fore200e_send()
1496 return -EINVAL; in fore200e_send()
1498 if (!test_bit(ATM_VF_READY, &vcc->flags)) { in fore200e_send()
1499 DPRINTK(1, "VC %d.%d.%d not ready for tx\n", vcc->itf, vcc->vpi, vcc->vpi); in fore200e_send()
1501 return -EINVAL; in fore200e_send()
1505 if ((vcc->qos.aal == ATM_AAL0) && (vcc->qos.txtp.max_sdu == ATM_AAL0_SDU)) { in fore200e_send()
1506 cell_header = (u32*) skb->data; in fore200e_send()
1507 skb_data = skb->data + 4; /* skip 4-byte cell header */ in fore200e_send()
1508 skb_len = tx_len = skb->len - 4; in fore200e_send()
1510 DPRINTK(3, "user-supplied cell header = 0x%08x\n", *cell_header); in fore200e_send()
1515 skb_data = skb->data; in fore200e_send()
1516 skb_len = skb->len; in fore200e_send()
1521 DPRINTK(2, "misaligned tx PDU on device %s\n", fore200e->name); in fore200e_send()
1526 if ((vcc->qos.aal == ATM_AAL0) && (skb_len % ATM_CELL_PAYLOAD)) { in fore200e_send()
1529 DPRINTK(2, "incomplete tx AAL0 PDU on device %s\n", fore200e->name); in fore200e_send()
1537 if (vcc->pop) { in fore200e_send()
1538 vcc->pop(vcc, skb); in fore200e_send()
1543 return -ENOMEM; in fore200e_send()
1548 memset(data + skb_len, 0x00, tx_len - skb_len); in fore200e_send()
1554 vc_map = FORE200E_VC_MAP(fore200e, vcc->vpi, vcc->vci); in fore200e_send()
1555 ASSERT(vc_map->vcc == vcc); in fore200e_send()
1559 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_send()
1561 entry = &txq->host_entry[ txq->head ]; in fore200e_send()
1563 if ((*entry->status != STATUS_FREE) || (txq->txing >= QUEUE_SIZE_TX - 2)) { in fore200e_send()
1568 if (*entry->status != STATUS_FREE) { in fore200e_send()
1570 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_send()
1573 if (--retry > 0) { in fore200e_send()
1578 atomic_inc(&vcc->stats->tx_err); in fore200e_send()
1580 fore200e->tx_sat++; in fore200e_send()
1581 DPRINTK(2, "tx queue of device %s is saturated, PDU dropped - heartbeat is %08x\n", in fore200e_send()
1582 fore200e->name, fore200e->cp_queues->heartbeat); in fore200e_send()
1583 if (vcc->pop) { in fore200e_send()
1584 vcc->pop(vcc, skb); in fore200e_send()
1593 return -ENOBUFS; in fore200e_send()
1597 entry->incarn = vc_map->incarn; in fore200e_send()
1598 entry->vc_map = vc_map; in fore200e_send()
1599 entry->skb = skb; in fore200e_send()
1600 entry->data = tx_copy ? data : NULL; in fore200e_send()
1602 tpd = entry->tpd; in fore200e_send()
1603 tpd->tsd[ 0 ].buffer = dma_map_single(fore200e->dev, data, tx_len, in fore200e_send()
1605 if (dma_mapping_error(fore200e->dev, tpd->tsd[0].buffer)) { in fore200e_send()
1608 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_send()
1609 return -ENOMEM; in fore200e_send()
1611 tpd->tsd[ 0 ].length = tx_len; in fore200e_send()
1613 FORE200E_NEXT_ENTRY(txq->head, QUEUE_SIZE_TX); in fore200e_send()
1614 txq->txing++; in fore200e_send()
1621 vcc->itf, vcc->vpi, vcc->vci, fore200e_atm2fore_aal(vcc->qos.aal), in fore200e_send()
1622 tpd->tsd[0].length, skb_len); in fore200e_send()
1624 if (skb_len < fore200e_vcc->tx_min_pdu) in fore200e_send()
1625 fore200e_vcc->tx_min_pdu = skb_len; in fore200e_send()
1626 if (skb_len > fore200e_vcc->tx_max_pdu) in fore200e_send()
1627 fore200e_vcc->tx_max_pdu = skb_len; in fore200e_send()
1628 fore200e_vcc->tx_pdu++; in fore200e_send()
1631 tpd->rate.data_cells = fore200e_vcc->rate.data_cells; in fore200e_send()
1632 tpd->rate.idle_cells = fore200e_vcc->rate.idle_cells; in fore200e_send()
1635 tpd->atm_header.clp = (*cell_header & ATM_HDR_CLP); in fore200e_send()
1636 tpd->atm_header.plt = (*cell_header & ATM_HDR_PTI_MASK) >> ATM_HDR_PTI_SHIFT; in fore200e_send()
1637 tpd->atm_header.vci = (*cell_header & ATM_HDR_VCI_MASK) >> ATM_HDR_VCI_SHIFT; in fore200e_send()
1638 tpd->atm_header.vpi = (*cell_header & ATM_HDR_VPI_MASK) >> ATM_HDR_VPI_SHIFT; in fore200e_send()
1639 tpd->atm_header.gfc = (*cell_header & ATM_HDR_GFC_MASK) >> ATM_HDR_GFC_SHIFT; in fore200e_send()
1643 tpd->atm_header.clp = 0; in fore200e_send()
1644 tpd->atm_header.plt = 0; in fore200e_send()
1645 tpd->atm_header.vci = vcc->vci; in fore200e_send()
1646 tpd->atm_header.vpi = vcc->vpi; in fore200e_send()
1647 tpd->atm_header.gfc = 0; in fore200e_send()
1650 tpd->spec.length = tx_len; in fore200e_send()
1651 tpd->spec.nseg = 1; in fore200e_send()
1652 tpd->spec.aal = fore200e_atm2fore_aal(vcc->qos.aal); in fore200e_send()
1653 tpd->spec.intr = 1; in fore200e_send()
1657 …tpd_haddr.haddr = entry->tpd_dma >> TPD_HADDR_SHIFT; /* shift the address, as we are in a… in fore200e_send()
1659 *entry->status = STATUS_PENDING; in fore200e_send()
1660 fore200e->bus->write(*(u32*)&tpd_haddr, (u32 __iomem *)&entry->cp_entry->tpd_haddr); in fore200e_send()
1662 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_send()
1671 struct host_cmdq* cmdq = &fore200e->host_cmdq; in fore200e_getstats()
1672 struct host_cmdq_entry* entry = &cmdq->host_entry[ cmdq->head ]; in fore200e_getstats()
1677 if (fore200e->stats == NULL) { in fore200e_getstats()
1678 fore200e->stats = kzalloc(sizeof(struct stats), GFP_KERNEL); in fore200e_getstats()
1679 if (fore200e->stats == NULL) in fore200e_getstats()
1680 return -ENOMEM; in fore200e_getstats()
1683 stats_dma_addr = dma_map_single(fore200e->dev, fore200e->stats, in fore200e_getstats()
1685 if (dma_mapping_error(fore200e->dev, stats_dma_addr)) in fore200e_getstats()
1686 return -ENOMEM; in fore200e_getstats()
1688 FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); in fore200e_getstats()
1693 fore200e->bus->write(stats_dma_addr, &entry->cp_entry->cmd.stats_block.stats_haddr); in fore200e_getstats()
1695 *entry->status = STATUS_PENDING; in fore200e_getstats()
1697 fore200e->bus->write(*(u32*)&opcode, (u32 __iomem *)&entry->cp_entry->cmd.stats_block.opcode); in fore200e_getstats()
1699 ok = fore200e_poll(fore200e, entry->status, STATUS_COMPLETE, 400); in fore200e_getstats()
1701 *entry->status = STATUS_FREE; in fore200e_getstats()
1703 dma_unmap_single(fore200e->dev, stats_dma_addr, sizeof(struct stats), DMA_FROM_DEVICE); in fore200e_getstats()
1706 printk(FORE200E "unable to get statistics from device %s\n", fore200e->name); in fore200e_getstats()
1707 return -EIO; in fore200e_getstats()
1717 struct host_cmdq* cmdq = &fore200e->host_cmdq;
1718 struct host_cmdq_entry* entry = &cmdq->host_entry[ cmdq->head ];
1723 …oc3_regs_dma_addr = fore200e->bus->dma_map(fore200e, regs, sizeof(struct oc3_regs), DMA_FROM_DEVIC…
1725 FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD);
1732 fore200e->bus->write(oc3_regs_dma_addr, &entry->cp_entry->cmd.oc3_block.regs_haddr);
1734 *entry->status = STATUS_PENDING;
1736 fore200e->bus->write(*(u32*)&opcode, (u32*)&entry->cp_entry->cmd.oc3_block.opcode);
1738 ok = fore200e_poll(fore200e, entry->status, STATUS_COMPLETE, 400);
1740 *entry->status = STATUS_FREE;
1742 fore200e->bus->dma_unmap(fore200e, oc3_regs_dma_addr, sizeof(struct oc3_regs), DMA_FROM_DEVICE);
1745 printk(FORE200E "unable to get OC-3 regs of device %s\n", fore200e->name);
1746 return -EIO;
1757 struct host_cmdq* cmdq = &fore200e->host_cmdq; in fore200e_set_oc3()
1758 struct host_cmdq_entry* entry = &cmdq->host_entry[ cmdq->head ]; in fore200e_set_oc3()
1762 DPRINTK(2, "set OC-3 reg = 0x%02x, value = 0x%02x, mask = 0x%02x\n", reg, value, mask); in fore200e_set_oc3()
1764 FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); in fore200e_set_oc3()
1771 fore200e->bus->write(0, &entry->cp_entry->cmd.oc3_block.regs_haddr); in fore200e_set_oc3()
1773 *entry->status = STATUS_PENDING; in fore200e_set_oc3()
1775 fore200e->bus->write(*(u32*)&opcode, (u32 __iomem *)&entry->cp_entry->cmd.oc3_block.opcode); in fore200e_set_oc3()
1777 ok = fore200e_poll(fore200e, entry->status, STATUS_COMPLETE, 400); in fore200e_set_oc3()
1779 *entry->status = STATUS_FREE; in fore200e_set_oc3()
1782 printk(FORE200E "unable to set OC-3 reg 0x%02x of device %s\n", reg, fore200e->name); in fore200e_set_oc3()
1783 return -EIO; in fore200e_set_oc3()
1797 return -EPERM; in fore200e_setloop()
1815 return -EINVAL; in fore200e_setloop()
1820 fore200e->loop_mode = loop_mode; in fore200e_setloop()
1832 return -EIO; in fore200e_fetch_stats()
1834 tmp.section_bip = be32_to_cpu(fore200e->stats->oc3.section_bip8_errors); in fore200e_fetch_stats()
1835 tmp.line_bip = be32_to_cpu(fore200e->stats->oc3.line_bip24_errors); in fore200e_fetch_stats()
1836 tmp.path_bip = be32_to_cpu(fore200e->stats->oc3.path_bip8_errors); in fore200e_fetch_stats()
1837 tmp.line_febe = be32_to_cpu(fore200e->stats->oc3.line_febe_errors); in fore200e_fetch_stats()
1838 tmp.path_febe = be32_to_cpu(fore200e->stats->oc3.path_febe_errors); in fore200e_fetch_stats()
1839 tmp.corr_hcs = be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors); in fore200e_fetch_stats()
1840 tmp.uncorr_hcs = be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors); in fore200e_fetch_stats()
1841 tmp.tx_cells = be32_to_cpu(fore200e->stats->aal0.cells_transmitted) + in fore200e_fetch_stats()
1842 be32_to_cpu(fore200e->stats->aal34.cells_transmitted) + in fore200e_fetch_stats()
1843 be32_to_cpu(fore200e->stats->aal5.cells_transmitted); in fore200e_fetch_stats()
1844 tmp.rx_cells = be32_to_cpu(fore200e->stats->aal0.cells_received) + in fore200e_fetch_stats()
1845 be32_to_cpu(fore200e->stats->aal34.cells_received) + in fore200e_fetch_stats()
1846 be32_to_cpu(fore200e->stats->aal5.cells_received); in fore200e_fetch_stats()
1849 return copy_to_user(arg, &tmp, sizeof(struct sonet_stats)) ? -EFAULT : 0; in fore200e_fetch_stats()
1868 return put_user(0, (int __user *)arg) ? -EFAULT : 0; in fore200e_ioctl()
1874 return put_user(fore200e->loop_mode, (int __user *)arg) ? -EFAULT : 0; in fore200e_ioctl()
1877 return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int __user *)arg) ? -EFAULT : 0; in fore200e_ioctl()
1880 return -ENOSYS; /* not implemented */ in fore200e_ioctl()
1888 struct fore200e* fore200e = FORE200E_DEV(vcc->dev); in fore200e_change_qos()
1890 if (!test_bit(ATM_VF_READY, &vcc->flags)) { in fore200e_change_qos()
1891 DPRINTK(1, "VC %d.%d.%d not ready for QoS change\n", vcc->itf, vcc->vpi, vcc->vpi); in fore200e_change_qos()
1892 return -EINVAL; in fore200e_change_qos()
1896 "(tx: cl=%s, pcr=%d-%d, cdv=%d, max_sdu=%d; " in fore200e_change_qos()
1897 "rx: cl=%s, pcr=%d-%d, cdv=%d, max_sdu=%d), flags = 0x%x\n" in fore200e_change_qos()
1899 vcc->itf, vcc->vpi, vcc->vci, in fore200e_change_qos()
1900 fore200e_traffic_class[ qos->txtp.traffic_class ], in fore200e_change_qos()
1901 qos->txtp.min_pcr, qos->txtp.max_pcr, qos->txtp.max_cdv, qos->txtp.max_sdu, in fore200e_change_qos()
1902 fore200e_traffic_class[ qos->rxtp.traffic_class ], in fore200e_change_qos()
1903 qos->rxtp.min_pcr, qos->rxtp.max_pcr, qos->rxtp.max_cdv, qos->rxtp.max_sdu, in fore200e_change_qos()
1904 flags, fore200e->available_cell_rate); in fore200e_change_qos()
1906 if ((qos->txtp.traffic_class == ATM_CBR) && (qos->txtp.max_pcr > 0)) { in fore200e_change_qos()
1908 mutex_lock(&fore200e->rate_mtx); in fore200e_change_qos()
1909 if (fore200e->available_cell_rate + vcc->qos.txtp.max_pcr < qos->txtp.max_pcr) { in fore200e_change_qos()
1910 mutex_unlock(&fore200e->rate_mtx); in fore200e_change_qos()
1911 return -EAGAIN; in fore200e_change_qos()
1914 fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; in fore200e_change_qos()
1915 fore200e->available_cell_rate -= qos->txtp.max_pcr; in fore200e_change_qos()
1917 mutex_unlock(&fore200e->rate_mtx); in fore200e_change_qos()
1919 memcpy(&vcc->qos, qos, sizeof(struct atm_qos)); in fore200e_change_qos()
1922 fore200e_rate_ctrl(qos, &fore200e_vcc->rate); in fore200e_change_qos()
1924 set_bit(ATM_VF_HASQOS, &vcc->flags); in fore200e_change_qos()
1929 return -EINVAL; in fore200e_change_qos()
1935 …if (request_irq(fore200e->irq, fore200e_interrupt, IRQF_SHARED, fore200e->name, fore200e->atm_dev)… in fore200e_irq_request()
1938 fore200e_irq_itoa(fore200e->irq), fore200e->name); in fore200e_irq_request()
1939 return -EBUSY; in fore200e_irq_request()
1943 fore200e_irq_itoa(fore200e->irq), fore200e->name); in fore200e_irq_request()
1946 tasklet_init(&fore200e->tx_tasklet, fore200e_tx_tasklet, (unsigned long)fore200e); in fore200e_irq_request()
1947 tasklet_init(&fore200e->rx_tasklet, fore200e_rx_tasklet, (unsigned long)fore200e); in fore200e_irq_request()
1950 fore200e->state = FORE200E_STATE_IRQ; in fore200e_irq_request()
1961 return -ENOMEM; in fore200e_get_esi()
1963 ok = fore200e->bus->prom_read(fore200e, prom); in fore200e_get_esi()
1966 return -EBUSY; in fore200e_get_esi()
1970 fore200e->name, in fore200e_get_esi()
1971 (prom->hw_revision & 0xFF) + '@', /* probably meaningless with SBA boards */ in fore200e_get_esi()
1972 prom->serial_number & 0xFFFF, &prom->mac_addr[2]); in fore200e_get_esi()
1975 fore200e->esi[ i ] = fore200e->atm_dev->esi[ i ] = prom->mac_addr[ i + 2 ]; in fore200e_get_esi()
1994 bsq = &fore200e->host_bsq[ scheme ][ magn ]; in fore200e_alloc_rx_buf()
2002 buffer = bsq->buffer = kcalloc(nbr, sizeof(struct buffer), in fore200e_alloc_rx_buf()
2006 return -ENOMEM; in fore200e_alloc_rx_buf()
2008 bsq->freebuf = NULL; in fore200e_alloc_rx_buf()
2021 &buffer[ i ].data, size, fore200e->bus->buffer_alignment, in fore200e_alloc_rx_buf()
2025 fore200e_chunk_free(fore200e, &buffer[ --i ].data); in fore200e_alloc_rx_buf()
2028 return -ENOMEM; in fore200e_alloc_rx_buf()
2032 buffer[ i ].next = bsq->freebuf; in fore200e_alloc_rx_buf()
2033 bsq->freebuf = &buffer[ i ]; in fore200e_alloc_rx_buf()
2036 bsq->freebuf_count = nbr; in fore200e_alloc_rx_buf()
2044 fore200e->state = FORE200E_STATE_ALLOC_BUF; in fore200e_alloc_rx_buf()
2059 DPRINTK(2, "buffer supply queue %d / %d is being initialized\n", scheme, magn); in fore200e_init_bs_queue()
2061 bsq = &fore200e->host_bsq[ scheme ][ magn ]; in fore200e_init_bs_queue()
2065 &bsq->status, in fore200e_init_bs_queue()
2068 fore200e->bus->status_alignment) < 0) { in fore200e_init_bs_queue()
2069 return -ENOMEM; in fore200e_init_bs_queue()
2074 &bsq->rbd_block, in fore200e_init_bs_queue()
2077 fore200e->bus->descr_alignment) < 0) { in fore200e_init_bs_queue()
2079 fore200e_dma_chunk_free(fore200e, &bsq->status); in fore200e_init_bs_queue()
2080 return -ENOMEM; in fore200e_init_bs_queue()
2083 /* get the base address of the cp resident buffer supply queue entries */ in fore200e_init_bs_queue()
2084 cp_entry = fore200e->virt_base + in fore200e_init_bs_queue()
2085 fore200e->bus->read(&fore200e->cp_queues->cp_bsq[ scheme ][ magn ]); in fore200e_init_bs_queue()
2087 /* fill the host resident and cp resident buffer supply queue entries */ in fore200e_init_bs_queue()
2090 bsq->host_entry[ i ].status = in fore200e_init_bs_queue()
2091 FORE200E_INDEX(bsq->status.align_addr, enum status, i); in fore200e_init_bs_queue()
2092 bsq->host_entry[ i ].rbd_block = in fore200e_init_bs_queue()
2093 FORE200E_INDEX(bsq->rbd_block.align_addr, struct rbd_block, i); in fore200e_init_bs_queue()
2094 bsq->host_entry[ i ].rbd_block_dma = in fore200e_init_bs_queue()
2095 FORE200E_DMA_INDEX(bsq->rbd_block.dma_addr, struct rbd_block, i); in fore200e_init_bs_queue()
2096 bsq->host_entry[ i ].cp_entry = &cp_entry[ i ]; in fore200e_init_bs_queue()
2098 *bsq->host_entry[ i ].status = STATUS_FREE; in fore200e_init_bs_queue()
2100 fore200e->bus->write(FORE200E_DMA_INDEX(bsq->status.dma_addr, enum status, i), in fore200e_init_bs_queue()
2106 fore200e->state = FORE200E_STATE_INIT_BSQ; in fore200e_init_bs_queue()
2113 struct host_rxq* rxq = &fore200e->host_rxq; in fore200e_init_rx_queue()
2121 &rxq->status, in fore200e_init_rx_queue()
2124 fore200e->bus->status_alignment) < 0) { in fore200e_init_rx_queue()
2125 return -ENOMEM; in fore200e_init_rx_queue()
2130 &rxq->rpd, in fore200e_init_rx_queue()
2133 fore200e->bus->descr_alignment) < 0) { in fore200e_init_rx_queue()
2135 fore200e_dma_chunk_free(fore200e, &rxq->status); in fore200e_init_rx_queue()
2136 return -ENOMEM; in fore200e_init_rx_queue()
2140 cp_entry = fore200e->virt_base + fore200e->bus->read(&fore200e->cp_queues->cp_rxq); in fore200e_init_rx_queue()
2145 rxq->host_entry[ i ].status = in fore200e_init_rx_queue()
2146 FORE200E_INDEX(rxq->status.align_addr, enum status, i); in fore200e_init_rx_queue()
2147 rxq->host_entry[ i ].rpd = in fore200e_init_rx_queue()
2148 FORE200E_INDEX(rxq->rpd.align_addr, struct rpd, i); in fore200e_init_rx_queue()
2149 rxq->host_entry[ i ].rpd_dma = in fore200e_init_rx_queue()
2150 FORE200E_DMA_INDEX(rxq->rpd.dma_addr, struct rpd, i); in fore200e_init_rx_queue()
2151 rxq->host_entry[ i ].cp_entry = &cp_entry[ i ]; in fore200e_init_rx_queue()
2153 *rxq->host_entry[ i ].status = STATUS_FREE; in fore200e_init_rx_queue()
2155 fore200e->bus->write(FORE200E_DMA_INDEX(rxq->status.dma_addr, enum status, i), in fore200e_init_rx_queue()
2158 fore200e->bus->write(FORE200E_DMA_INDEX(rxq->rpd.dma_addr, struct rpd, i), in fore200e_init_rx_queue()
2163 rxq->head = 0; in fore200e_init_rx_queue()
2165 fore200e->state = FORE200E_STATE_INIT_RXQ; in fore200e_init_rx_queue()
2172 struct host_txq* txq = &fore200e->host_txq; in fore200e_init_tx_queue()
2180 &txq->status, in fore200e_init_tx_queue()
2183 fore200e->bus->status_alignment) < 0) { in fore200e_init_tx_queue()
2184 return -ENOMEM; in fore200e_init_tx_queue()
2189 &txq->tpd, in fore200e_init_tx_queue()
2192 fore200e->bus->descr_alignment) < 0) { in fore200e_init_tx_queue()
2194 fore200e_dma_chunk_free(fore200e, &txq->status); in fore200e_init_tx_queue()
2195 return -ENOMEM; in fore200e_init_tx_queue()
2199 cp_entry = fore200e->virt_base + fore200e->bus->read(&fore200e->cp_queues->cp_txq); in fore200e_init_tx_queue()
2204 txq->host_entry[ i ].status = in fore200e_init_tx_queue()
2205 FORE200E_INDEX(txq->status.align_addr, enum status, i); in fore200e_init_tx_queue()
2206 txq->host_entry[ i ].tpd = in fore200e_init_tx_queue()
2207 FORE200E_INDEX(txq->tpd.align_addr, struct tpd, i); in fore200e_init_tx_queue()
2208 txq->host_entry[ i ].tpd_dma = in fore200e_init_tx_queue()
2209 FORE200E_DMA_INDEX(txq->tpd.dma_addr, struct tpd, i); in fore200e_init_tx_queue()
2210 txq->host_entry[ i ].cp_entry = &cp_entry[ i ]; in fore200e_init_tx_queue()
2212 *txq->host_entry[ i ].status = STATUS_FREE; in fore200e_init_tx_queue()
2214 fore200e->bus->write(FORE200E_DMA_INDEX(txq->status.dma_addr, enum status, i), in fore200e_init_tx_queue()
2217 /* although there is a one-to-one mapping of tx queue entries and tpds, in fore200e_init_tx_queue()
2224 txq->head = 0; in fore200e_init_tx_queue()
2225 txq->tail = 0; in fore200e_init_tx_queue()
2227 fore200e->state = FORE200E_STATE_INIT_TXQ; in fore200e_init_tx_queue()
2234 struct host_cmdq* cmdq = &fore200e->host_cmdq; in fore200e_init_cmd_queue()
2242 &cmdq->status, in fore200e_init_cmd_queue()
2245 fore200e->bus->status_alignment) < 0) { in fore200e_init_cmd_queue()
2246 return -ENOMEM; in fore200e_init_cmd_queue()
2250 cp_entry = fore200e->virt_base + fore200e->bus->read(&fore200e->cp_queues->cp_cmdq); in fore200e_init_cmd_queue()
2255 cmdq->host_entry[ i ].status = in fore200e_init_cmd_queue()
2256 FORE200E_INDEX(cmdq->status.align_addr, enum status, i); in fore200e_init_cmd_queue()
2257 cmdq->host_entry[ i ].cp_entry = &cp_entry[ i ]; in fore200e_init_cmd_queue()
2259 *cmdq->host_entry[ i ].status = STATUS_FREE; in fore200e_init_cmd_queue()
2261 fore200e->bus->write(FORE200E_DMA_INDEX(cmdq->status.dma_addr, enum status, i), in fore200e_init_cmd_queue()
2266 cmdq->head = 0; in fore200e_init_cmd_queue()
2268 fore200e->state = FORE200E_STATE_INIT_CMDQ; in fore200e_init_cmd_queue()
2278 struct bs_spec __iomem * bs_spec = &fore200e->cp_queues->init.bs_spec[ scheme ][ magn ]; in fore200e_param_bs_queue()
2280 fore200e->bus->write(queue_length, &bs_spec->queue_length); in fore200e_param_bs_queue()
2281 fore200e->bus->write(fore200e_rx_buf_size[ scheme ][ magn ], &bs_spec->buffer_size); in fore200e_param_bs_queue()
2282 fore200e->bus->write(pool_size, &bs_spec->pool_size); in fore200e_param_bs_queue()
2283 fore200e->bus->write(supply_blksize, &bs_spec->supply_blksize); in fore200e_param_bs_queue()
2292 DPRINTK(2, "device %s being initialized\n", fore200e->name); in fore200e_initialize()
2294 mutex_init(&fore200e->rate_mtx); in fore200e_initialize()
2295 spin_lock_init(&fore200e->q_lock); in fore200e_initialize()
2297 cpq = fore200e->cp_queues = fore200e->virt_base + FORE200E_CP_QUEUES_OFFSET; in fore200e_initialize()
2300 fore200e->bus->write(1, &cpq->imask); in fore200e_initialize()
2302 if (fore200e->bus->irq_enable) in fore200e_initialize()
2303 fore200e->bus->irq_enable(fore200e); in fore200e_initialize()
2305 fore200e->bus->write(NBR_CONNECT, &cpq->init.num_connect); in fore200e_initialize()
2307 fore200e->bus->write(QUEUE_SIZE_CMD, &cpq->init.cmd_queue_len); in fore200e_initialize()
2308 fore200e->bus->write(QUEUE_SIZE_RX, &cpq->init.rx_queue_len); in fore200e_initialize()
2309 fore200e->bus->write(QUEUE_SIZE_TX, &cpq->init.tx_queue_len); in fore200e_initialize()
2311 fore200e->bus->write(RSD_EXTENSION, &cpq->init.rsd_extension); in fore200e_initialize()
2312 fore200e->bus->write(TSD_EXTENSION, &cpq->init.tsd_extension); in fore200e_initialize()
2322 fore200e->bus->write(STATUS_PENDING, &cpq->init.status); in fore200e_initialize()
2323 fore200e->bus->write(OPCODE_INITIALIZE, &cpq->init.opcode); in fore200e_initialize()
2325 ok = fore200e_io_poll(fore200e, &cpq->init.status, STATUS_COMPLETE, 3000); in fore200e_initialize()
2327 printk(FORE200E "device %s initialization failed\n", fore200e->name); in fore200e_initialize()
2328 return -ENODEV; in fore200e_initialize()
2331 printk(FORE200E "device %s initialized\n", fore200e->name); in fore200e_initialize()
2333 fore200e->state = FORE200E_STATE_INITIALIZE; in fore200e_initialize()
2340 struct cp_monitor __iomem * monitor = fore200e->cp_monitor; in fore200e_monitor_putc()
2345 fore200e->bus->write(((u32) c) | FORE200E_CP_MONITOR_UART_AVAIL, &monitor->soft_uart.send); in fore200e_monitor_putc()
2351 struct cp_monitor __iomem * monitor = fore200e->cp_monitor; in fore200e_monitor_getc()
2357 c = (int) fore200e->bus->read(&monitor->soft_uart.recv); in fore200e_monitor_getc()
2361 fore200e->bus->write(FORE200E_CP_MONITOR_UART_FREE, &monitor->soft_uart.recv); in fore200e_monitor_getc()
2369 return -1; in fore200e_monitor_getc()
2402 sprintf(buf, "%s%s", fore200e->bus->proc_name, FW_EXT); in fore200e_load_and_start_fw()
2403 if ((err = request_firmware(&firmware, buf, fore200e->dev)) < 0) { in fore200e_load_and_start_fw()
2404 printk(FORE200E "problem loading firmware image %s\n", fore200e->bus->model_name); in fore200e_load_and_start_fw()
2408 fw_data = (const __le32 *)firmware->data; in fore200e_load_and_start_fw()
2409 fw_size = firmware->size / sizeof(u32); in fore200e_load_and_start_fw()
2410 fw_header = (const struct fw_header *)firmware->data; in fore200e_load_and_start_fw()
2411 load_addr = fore200e->virt_base + le32_to_cpu(fw_header->load_offset); in fore200e_load_and_start_fw()
2414 fore200e->name, load_addr, fw_size); in fore200e_load_and_start_fw()
2416 if (le32_to_cpu(fw_header->magic) != FW_HEADER_MAGIC) { in fore200e_load_and_start_fw()
2417 printk(FORE200E "corrupted %s firmware image\n", fore200e->bus->model_name); in fore200e_load_and_start_fw()
2421 for (; fw_size--; fw_data++, load_addr++) in fore200e_load_and_start_fw()
2422 fore200e->bus->write(le32_to_cpu(*fw_data), load_addr); in fore200e_load_and_start_fw()
2424 DPRINTK(2, "device %s firmware being started\n", fore200e->name); in fore200e_load_and_start_fw()
2431 sprintf(buf, "\rgo %x\r", le32_to_cpu(fw_header->start_offset)); in fore200e_load_and_start_fw()
2434 if (fore200e_io_poll(fore200e, &fore200e->cp_monitor->bstat, BSTAT_CP_RUNNING, 1000) == 0) { in fore200e_load_and_start_fw()
2435 printk(FORE200E "device %s firmware didn't start\n", fore200e->name); in fore200e_load_and_start_fw()
2439 printk(FORE200E "device %s firmware started\n", fore200e->name); in fore200e_load_and_start_fw()
2441 fore200e->state = FORE200E_STATE_START_FW; in fore200e_load_and_start_fw()
2454 DPRINTK(2, "device %s being registered\n", fore200e->name); in fore200e_register()
2456 atm_dev = atm_dev_register(fore200e->bus->proc_name, parent, &fore200e_ops, in fore200e_register()
2457 -1, NULL); in fore200e_register()
2459 printk(FORE200E "unable to register device %s\n", fore200e->name); in fore200e_register()
2460 return -ENODEV; in fore200e_register()
2463 atm_dev->dev_data = fore200e; in fore200e_register()
2464 fore200e->atm_dev = atm_dev; in fore200e_register()
2466 atm_dev->ci_range.vpi_bits = FORE200E_VPI_BITS; in fore200e_register()
2467 atm_dev->ci_range.vci_bits = FORE200E_VCI_BITS; in fore200e_register()
2469 fore200e->available_cell_rate = ATM_OC3_PCR; in fore200e_register()
2471 fore200e->state = FORE200E_STATE_REGISTER; in fore200e_register()
2479 return -ENODEV; in fore200e_init()
2481 if (fore200e->bus->configure(fore200e) < 0) in fore200e_init()
2482 return -ENODEV; in fore200e_init()
2484 if (fore200e->bus->map(fore200e) < 0) in fore200e_init()
2485 return -ENODEV; in fore200e_init()
2488 return -ENODEV; in fore200e_init()
2491 return -ENODEV; in fore200e_init()
2494 return -ENODEV; in fore200e_init()
2497 return -ENOMEM; in fore200e_init()
2500 return -ENOMEM; in fore200e_init()
2503 return -ENOMEM; in fore200e_init()
2506 return -ENOMEM; in fore200e_init()
2509 return -ENOMEM; in fore200e_init()
2512 return -EIO; in fore200e_init()
2515 return -EBUSY; in fore200e_init()
2520 fore200e->state = FORE200E_STATE_COMPLETE; in fore200e_init()
2533 match = of_match_device(fore200e_sba_match, &op->dev); in fore200e_sba_probe()
2535 return -EINVAL; in fore200e_sba_probe()
2539 return -ENOMEM; in fore200e_sba_probe()
2541 fore200e->bus = &fore200e_sbus_ops; in fore200e_sba_probe()
2542 fore200e->dev = &op->dev; in fore200e_sba_probe()
2543 fore200e->irq = op->archdata.irqs[0]; in fore200e_sba_probe()
2544 fore200e->phys_base = op->resource[0].start; in fore200e_sba_probe()
2546 sprintf(fore200e->name, "SBA-200E-%d", index); in fore200e_sba_probe()
2548 err = fore200e_init(fore200e, &op->dev); in fore200e_sba_probe()
2556 dev_set_drvdata(&op->dev, fore200e); in fore200e_sba_probe()
2563 struct fore200e *fore200e = dev_get_drvdata(&op->dev); in fore200e_sba_remove()
2598 err = -EINVAL; in fore200e_pca_detect()
2602 if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32))) { in fore200e_pca_detect()
2603 err = -EINVAL; in fore200e_pca_detect()
2609 err = -ENOMEM; in fore200e_pca_detect()
2613 fore200e->bus = &fore200e_pci_ops; in fore200e_pca_detect()
2614 fore200e->dev = &pci_dev->dev; in fore200e_pca_detect()
2615 fore200e->irq = pci_dev->irq; in fore200e_pca_detect()
2616 fore200e->phys_base = pci_resource_start(pci_dev, 0); in fore200e_pca_detect()
2618 sprintf(fore200e->name, "PCA-200E-%d", index - 1); in fore200e_pca_detect()
2622 printk(FORE200E "device PCA-200E found at 0x%lx, IRQ %s\n", in fore200e_pca_detect()
2623 fore200e->phys_base, fore200e_irq_itoa(fore200e->irq)); in fore200e_pca_detect()
2625 sprintf(fore200e->name, "PCA-200E-%d", index); in fore200e_pca_detect()
2627 err = fore200e_init(fore200e, &pci_dev->dev); in fore200e_pca_detect()
2678 printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n"); in fore200e_module_init()
2717 if (!left--) { in fore200e_proc_read()
2720 return -EIO; in fore200e_proc_read()
2724 " internal name:\t\t%s\n", fore200e->name); in fore200e_proc_read()
2726 /* print bus-specific information */ in fore200e_proc_read()
2727 if (fore200e->bus->proc_read) in fore200e_proc_read()
2728 len += fore200e->bus->proc_read(fore200e, page + len); in fore200e_proc_read()
2736 fore200e_irq_itoa(fore200e->irq), in fore200e_proc_read()
2737 (void*)fore200e->phys_base, in fore200e_proc_read()
2738 fore200e->virt_base, in fore200e_proc_read()
2739 fore200e->esi, in fore200e_proc_read()
2740 fore200e->esi[4] * 256 + fore200e->esi[5]); in fore200e_proc_read()
2745 if (!left--) in fore200e_proc_read()
2751 fore200e->host_bsq[ BUFFER_SCHEME_ONE ][ BUFFER_MAGN_SMALL ].freebuf_count, in fore200e_proc_read()
2752 fore200e->host_bsq[ BUFFER_SCHEME_ONE ][ BUFFER_MAGN_LARGE ].freebuf_count, in fore200e_proc_read()
2753 fore200e->host_bsq[ BUFFER_SCHEME_TWO ][ BUFFER_MAGN_SMALL ].freebuf_count, in fore200e_proc_read()
2754 fore200e->host_bsq[ BUFFER_SCHEME_TWO ][ BUFFER_MAGN_LARGE ].freebuf_count); in fore200e_proc_read()
2756 if (!left--) { in fore200e_proc_read()
2757 u32 hb = fore200e->bus->read(&fore200e->cp_queues->heartbeat); in fore200e_proc_read()
2771 if (!left--) { in fore200e_proc_read()
2776 "single-mode optical fiber ST", in fore200e_proc_read()
2777 "single-mode optical fiber SC", in fore200e_proc_read()
2788 u32 fw_release = fore200e->bus->read(&fore200e->cp_queues->fw_release); in fore200e_proc_read()
2789 u32 mon960_release = fore200e->bus->read(&fore200e->cp_queues->mon960_release); in fore200e_proc_read()
2790 u32 oc3_revision = fore200e->bus->read(&fore200e->cp_queues->oc3_revision); in fore200e_proc_read()
2791 u32 media_index = FORE200E_MEDIA_INDEX(fore200e->bus->read(&fore200e->cp_queues->media_type)); in fore200e_proc_read()
2797 switch (fore200e->loop_mode) { in fore200e_proc_read()
2811 " OC-3 revision:\t\t0x%x\n" in fore200e_proc_read()
2812 " OC-3 mode:\t\t\t%s", in fore200e_proc_read()
2820 if (!left--) { in fore200e_proc_read()
2821 struct cp_monitor __iomem * cp_monitor = fore200e->cp_monitor; in fore200e_proc_read()
2828 fore200e->bus->read(&cp_monitor->mon_version), in fore200e_proc_read()
2829 fore200e->bus->read(&cp_monitor->bstat)); in fore200e_proc_read()
2832 if (!left--) in fore200e_proc_read()
2839 be32_to_cpu(fore200e->stats->phy.crc_header_errors), in fore200e_proc_read()
2840 be32_to_cpu(fore200e->stats->phy.framing_errors)); in fore200e_proc_read()
2842 if (!left--) in fore200e_proc_read()
2844 " OC-3:\n" in fore200e_proc_read()
2852 be32_to_cpu(fore200e->stats->oc3.section_bip8_errors), in fore200e_proc_read()
2853 be32_to_cpu(fore200e->stats->oc3.path_bip8_errors), in fore200e_proc_read()
2854 be32_to_cpu(fore200e->stats->oc3.line_bip24_errors), in fore200e_proc_read()
2855 be32_to_cpu(fore200e->stats->oc3.line_febe_errors), in fore200e_proc_read()
2856 be32_to_cpu(fore200e->stats->oc3.path_febe_errors), in fore200e_proc_read()
2857 be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors), in fore200e_proc_read()
2858 be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors)); in fore200e_proc_read()
2860 if (!left--) in fore200e_proc_read()
2867 " vci out of range:\t\t%10u\n" in fore200e_proc_read()
2868 " vci no conn:\t\t%10u\n", in fore200e_proc_read()
2869 be32_to_cpu(fore200e->stats->atm.cells_transmitted), in fore200e_proc_read()
2870 be32_to_cpu(fore200e->stats->atm.cells_received), in fore200e_proc_read()
2871 be32_to_cpu(fore200e->stats->atm.vpi_bad_range), in fore200e_proc_read()
2872 be32_to_cpu(fore200e->stats->atm.vpi_no_conn), in fore200e_proc_read()
2873 be32_to_cpu(fore200e->stats->atm.vci_bad_range), in fore200e_proc_read()
2874 be32_to_cpu(fore200e->stats->atm.vci_no_conn)); in fore200e_proc_read()
2876 if (!left--) in fore200e_proc_read()
2882 be32_to_cpu(fore200e->stats->aal0.cells_transmitted), in fore200e_proc_read()
2883 be32_to_cpu(fore200e->stats->aal0.cells_received), in fore200e_proc_read()
2884 be32_to_cpu(fore200e->stats->aal0.cells_dropped)); in fore200e_proc_read()
2886 if (!left--) in fore200e_proc_read()
2900 be32_to_cpu(fore200e->stats->aal34.cells_transmitted), in fore200e_proc_read()
2901 be32_to_cpu(fore200e->stats->aal34.cells_received), in fore200e_proc_read()
2902 be32_to_cpu(fore200e->stats->aal34.cells_dropped), in fore200e_proc_read()
2903 be32_to_cpu(fore200e->stats->aal34.cells_crc_errors), in fore200e_proc_read()
2904 be32_to_cpu(fore200e->stats->aal34.cells_protocol_errors), in fore200e_proc_read()
2905 be32_to_cpu(fore200e->stats->aal34.cspdus_transmitted), in fore200e_proc_read()
2906 be32_to_cpu(fore200e->stats->aal34.cspdus_received), in fore200e_proc_read()
2907 be32_to_cpu(fore200e->stats->aal34.cspdus_dropped), in fore200e_proc_read()
2908 be32_to_cpu(fore200e->stats->aal34.cspdus_protocol_errors)); in fore200e_proc_read()
2910 if (!left--) in fore200e_proc_read()
2924 be32_to_cpu(fore200e->stats->aal5.cells_transmitted), in fore200e_proc_read()
2925 be32_to_cpu(fore200e->stats->aal5.cells_received), in fore200e_proc_read()
2926 be32_to_cpu(fore200e->stats->aal5.cells_dropped), in fore200e_proc_read()
2927 be32_to_cpu(fore200e->stats->aal5.congestion_experienced), in fore200e_proc_read()
2928 be32_to_cpu(fore200e->stats->aal5.cspdus_transmitted), in fore200e_proc_read()
2929 be32_to_cpu(fore200e->stats->aal5.cspdus_received), in fore200e_proc_read()
2930 be32_to_cpu(fore200e->stats->aal5.cspdus_dropped), in fore200e_proc_read()
2931 be32_to_cpu(fore200e->stats->aal5.cspdus_crc_errors), in fore200e_proc_read()
2932 be32_to_cpu(fore200e->stats->aal5.cspdus_protocol_errors)); in fore200e_proc_read()
2934 if (!left--) in fore200e_proc_read()
2943 be32_to_cpu(fore200e->stats->aux.small_b1_failed), in fore200e_proc_read()
2944 be32_to_cpu(fore200e->stats->aux.large_b1_failed), in fore200e_proc_read()
2945 be32_to_cpu(fore200e->stats->aux.small_b2_failed), in fore200e_proc_read()
2946 be32_to_cpu(fore200e->stats->aux.large_b2_failed), in fore200e_proc_read()
2947 be32_to_cpu(fore200e->stats->aux.rpd_alloc_failed), in fore200e_proc_read()
2948 fore200e->tx_sat); in fore200e_proc_read()
2950 if (!left--) in fore200e_proc_read()
2953 fore200e->stats->aux.receive_carrier ? "ON" : "OFF!"); in fore200e_proc_read()
2955 if (!left--) { in fore200e_proc_read()
2957 " VCCs:\n address VPI VCI AAL " in fore200e_proc_read()
2963 vcc = fore200e->vc_map[i].vcc; in fore200e_proc_read()
2968 spin_lock_irqsave(&fore200e->q_lock, flags); in fore200e_proc_read()
2970 if (vcc && test_bit(ATM_VF_READY, &vcc->flags) && !left--) { in fore200e_proc_read()
2978 vcc->vpi, vcc->vci, fore200e_atm2fore_aal(vcc->qos.aal), in fore200e_proc_read()
2979 fore200e_vcc->tx_pdu, in fore200e_proc_read()
2980 fore200e_vcc->tx_min_pdu > 0xFFFF ? 0 : fore200e_vcc->tx_min_pdu, in fore200e_proc_read()
2981 fore200e_vcc->tx_max_pdu, in fore200e_proc_read()
2982 fore200e_vcc->rx_pdu, in fore200e_proc_read()
2983 fore200e_vcc->rx_min_pdu > 0xFFFF ? 0 : fore200e_vcc->rx_min_pdu, in fore200e_proc_read()
2984 fore200e_vcc->rx_max_pdu); in fore200e_proc_read()
2986 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_proc_read()
2990 spin_unlock_irqrestore(&fore200e->q_lock, flags); in fore200e_proc_read()