Lines Matching full:card
26 * 1 - Per card interrupt spinlock (to protect structures and such)
28 * 3 - Per card resource spinlock (to access registers, etc.)
105 #define CMD_BUSY(card) (readl((card)->membase + STAT) & NS_STAT_CMDBZ) argument
120 static u32 ns_read_sram(ns_dev * card, u32 sram_address);
121 static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value,
124 static void ns_init_card_error(ns_dev * card, int error);
125 static scq_info *get_scq(ns_dev *card, int size, u32 scd);
126 static void free_scq(ns_dev *card, scq_info * scq, struct atm_vcc *vcc);
131 static void fill_tst(ns_dev * card, int n, vc_map * vc);
134 static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
136 static void process_tsq(ns_dev * card);
137 static void drain_scq(ns_dev * card, scq_info * scq, int pos);
138 static void process_rsq(ns_dev * card);
139 static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe);
140 static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb);
141 static void recycle_iovec_rx_bufs(ns_dev * card, struct iovec *iov, int count);
142 static void recycle_iov_buf(ns_dev * card, struct sk_buff *iovb);
143 static void dequeue_sm_buf(ns_dev * card, struct sk_buff *sb);
144 static void dequeue_lg_buf(ns_dev * card, struct sk_buff *lb);
148 static void which_list(ns_dev * card, struct sk_buff *skb);
202 ns_dev *card = pci_get_drvdata(pcidev); in nicstar_remove_one() local
208 i = card->index; in nicstar_remove_one()
213 if (card->atmdev->phy && card->atmdev->phy->stop) in nicstar_remove_one()
214 card->atmdev->phy->stop(card->atmdev); in nicstar_remove_one()
217 writel(0x00000000, card->membase + CFG); in nicstar_remove_one()
220 atm_dev_deregister(card->atmdev); in nicstar_remove_one()
227 PRINTK("nicstar%d: freeing %d huge buffers.\n", i, card->hbpool.count); in nicstar_remove_one()
228 while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL) { in nicstar_remove_one()
235 card->iovpool.count); in nicstar_remove_one()
236 while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL) { in nicstar_remove_one()
241 while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL) in nicstar_remove_one()
243 while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL) in nicstar_remove_one()
245 free_scq(card, card->scq0, NULL); in nicstar_remove_one()
247 if (card->scd2vc[j] != NULL) in nicstar_remove_one()
248 free_scq(card, card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc); in nicstar_remove_one()
250 idr_destroy(&card->idr); in nicstar_remove_one()
251 dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT, in nicstar_remove_one()
252 card->rsq.org, card->rsq.dma); in nicstar_remove_one()
253 dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT, in nicstar_remove_one()
254 card->tsq.org, card->tsq.dma); in nicstar_remove_one()
255 free_irq(card->pcidev->irq, card); in nicstar_remove_one()
256 iounmap(card->membase); in nicstar_remove_one()
257 kfree(card); in nicstar_remove_one()
310 static u32 ns_read_sram(ns_dev * card, u32 sram_address) in ns_read_sram() argument
317 spin_lock_irqsave(&card->res_lock, flags); in ns_read_sram()
318 while (CMD_BUSY(card)) ; in ns_read_sram()
319 writel(sram_address, card->membase + CMD); in ns_read_sram()
320 while (CMD_BUSY(card)) ; in ns_read_sram()
321 data = readl(card->membase + DR0); in ns_read_sram()
322 spin_unlock_irqrestore(&card->res_lock, flags); in ns_read_sram()
326 static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value, in ns_write_sram() argument
334 spin_lock_irqsave(&card->res_lock, flags); in ns_write_sram()
335 while (CMD_BUSY(card)) ; in ns_write_sram()
337 writel(*(value++), card->membase + i); in ns_write_sram()
339 so card->membase + DR0 == card->membase */ in ns_write_sram()
343 writel(sram_address, card->membase + CMD); in ns_write_sram()
344 spin_unlock_irqrestore(&card->res_lock, flags); in ns_write_sram()
350 struct ns_dev *card = NULL; in ns_init_card() local
364 ns_init_card_error(card, error); in ns_init_card()
371 ns_init_card_error(card, error); in ns_init_card()
375 card = kmalloc(sizeof(*card), GFP_KERNEL); in ns_init_card()
376 if (!card) { in ns_init_card()
381 ns_init_card_error(card, error); in ns_init_card()
384 cards[i] = card; in ns_init_card()
385 spin_lock_init(&card->int_lock); in ns_init_card()
386 spin_lock_init(&card->res_lock); in ns_init_card()
388 pci_set_drvdata(pcidev, card); in ns_init_card()
390 card->index = i; in ns_init_card()
391 card->atmdev = NULL; in ns_init_card()
392 card->pcidev = pcidev; in ns_init_card()
394 card->membase = ioremap(membase, NS_IOREMAP_SIZE); in ns_init_card()
395 if (!card->membase) { in ns_init_card()
398 ns_init_card_error(card, error); in ns_init_card()
401 PRINTK("nicstar%d: membase at 0x%p.\n", i, card->membase); in ns_init_card()
408 ns_init_card_error(card, error); in ns_init_card()
425 ns_init_card_error(card, error); in ns_init_card()
432 data = readl(card->membase + STAT); in ns_init_card()
434 writel(NS_STAT_TMROF, card->membase + STAT); in ns_init_card()
437 writel(NS_CFG_SWRST, card->membase + CFG); in ns_init_card()
439 writel(0x00000000, card->membase + CFG); in ns_init_card()
442 writel(0x00000008, card->membase + GP); in ns_init_card()
444 writel(0x00000001, card->membase + GP); in ns_init_card()
446 while (CMD_BUSY(card)) ; in ns_init_card()
447 writel(NS_CMD_WRITE_UTILITY | 0x00000100, card->membase + CMD); /* Sync UTOPIA with SAR clock */ in ns_init_card()
451 while (CMD_BUSY(card)) ; in ns_init_card()
452 writel(NS_CMD_READ_UTILITY | 0x00000200, card->membase + CMD); in ns_init_card()
453 while (CMD_BUSY(card)) ; in ns_init_card()
454 data = readl(card->membase + DR0); in ns_init_card()
458 card->max_pcr = ATM_25_PCR; in ns_init_card()
459 while (CMD_BUSY(card)) ; in ns_init_card()
460 writel(0x00000008, card->membase + DR0); in ns_init_card()
461 writel(NS_CMD_WRITE_UTILITY | 0x00000200, card->membase + CMD); in ns_init_card()
463 writel(NS_STAT_SFBQF, card->membase + STAT); in ns_init_card()
465 while (CMD_BUSY(card)) ; in ns_init_card()
466 writel(0x00000022, card->membase + DR0); in ns_init_card()
467 writel(NS_CMD_WRITE_UTILITY | 0x00000202, card->membase + CMD); in ns_init_card()
473 card->max_pcr = ATM_OC3_PCR; in ns_init_card()
475 while (CMD_BUSY(card)) ; in ns_init_card()
476 writel(0x00000002, card->membase + DR0); in ns_init_card()
477 writel(NS_CMD_WRITE_UTILITY | 0x00000205, card->membase + CMD); in ns_init_card()
483 ns_init_card_error(card, error); in ns_init_card()
486 writel(0x00000000, card->membase + GP); in ns_init_card()
490 ns_write_sram(card, 0x1C003, &data, 1); in ns_init_card()
492 ns_write_sram(card, 0x14003, &data, 1); in ns_init_card()
493 if (ns_read_sram(card, 0x14003) == 0x89ABCDEF && in ns_init_card()
494 ns_read_sram(card, 0x1C003) == 0x76543210) in ns_init_card()
495 card->sram_size = 128; in ns_init_card()
497 card->sram_size = 32; in ns_init_card()
498 PRINTK("nicstar%d: %dK x 32bit SRAM size.\n", i, card->sram_size); in ns_init_card()
500 card->rct_size = NS_MAX_RCTSIZE; in ns_init_card()
503 if (card->sram_size == 128) in ns_init_card()
508 if (card->sram_size == 32) { in ns_init_card()
512 card->rct_size = 4096; in ns_init_card()
518 card->vpibits = NS_VPIBITS; in ns_init_card()
519 if (card->rct_size == 4096) in ns_init_card()
520 card->vcibits = 12 - NS_VPIBITS; in ns_init_card()
521 else /* card->rct_size == 16384 */ in ns_init_card()
522 card->vcibits = 14 - NS_VPIBITS; in ns_init_card()
526 nicstar_init_eprom(card->membase); in ns_init_card()
529 writel(0x00000000, card->membase + VPM); in ns_init_card()
531 card->intcnt = 0; in ns_init_card()
533 (pcidev->irq, &ns_irq_handler, IRQF_SHARED, "nicstar", card) != 0) { in ns_init_card()
536 ns_init_card_error(card, error); in ns_init_card()
541 card->tsq.org = dma_alloc_coherent(&card->pcidev->dev, in ns_init_card()
543 &card->tsq.dma, GFP_KERNEL); in ns_init_card()
544 if (card->tsq.org == NULL) { in ns_init_card()
547 ns_init_card_error(card, error); in ns_init_card()
550 card->tsq.base = PTR_ALIGN(card->tsq.org, NS_TSQ_ALIGNMENT); in ns_init_card()
551 card->tsq.next = card->tsq.base; in ns_init_card()
552 card->tsq.last = card->tsq.base + (NS_TSQ_NUM_ENTRIES - 1); in ns_init_card()
554 ns_tsi_init(card->tsq.base + j); in ns_init_card()
555 writel(0x00000000, card->membase + TSQH); in ns_init_card()
556 writel(ALIGN(card->tsq.dma, NS_TSQ_ALIGNMENT), card->membase + TSQB); in ns_init_card()
557 PRINTK("nicstar%d: TSQ base at 0x%p.\n", i, card->tsq.base); in ns_init_card()
560 card->rsq.org = dma_alloc_coherent(&card->pcidev->dev, in ns_init_card()
562 &card->rsq.dma, GFP_KERNEL); in ns_init_card()
563 if (card->rsq.org == NULL) { in ns_init_card()
566 ns_init_card_error(card, error); in ns_init_card()
569 card->rsq.base = PTR_ALIGN(card->rsq.org, NS_RSQ_ALIGNMENT); in ns_init_card()
570 card->rsq.next = card->rsq.base; in ns_init_card()
571 card->rsq.last = card->rsq.base + (NS_RSQ_NUM_ENTRIES - 1); in ns_init_card()
573 ns_rsqe_init(card->rsq.base + j); in ns_init_card()
574 writel(0x00000000, card->membase + RSQH); in ns_init_card()
575 writel(ALIGN(card->rsq.dma, NS_RSQ_ALIGNMENT), card->membase + RSQB); in ns_init_card()
576 PRINTK("nicstar%d: RSQ base at 0x%p.\n", i, card->rsq.base); in ns_init_card()
579 card->scq1 = NULL; in ns_init_card()
580 card->scq2 = NULL; in ns_init_card()
581 card->scq0 = get_scq(card, VBR_SCQSIZE, NS_VRSCD0); in ns_init_card()
582 if (card->scq0 == NULL) { in ns_init_card()
585 ns_init_card_error(card, error); in ns_init_card()
588 u32d[0] = scq_virt_to_bus(card->scq0, card->scq0->base); in ns_init_card()
592 ns_write_sram(card, NS_VRSCD0, u32d, 4); in ns_init_card()
593 ns_write_sram(card, NS_VRSCD1, u32d, 4); /* These last two won't be used */ in ns_init_card()
594 ns_write_sram(card, NS_VRSCD2, u32d, 4); /* but are initialized, just in case... */ in ns_init_card()
595 card->scq0->scd = NS_VRSCD0; in ns_init_card()
596 PRINTK("nicstar%d: VBR-SCQ0 base at 0x%p.\n", i, card->scq0->base); in ns_init_card()
599 card->tst_addr = NS_TST0; in ns_init_card()
600 card->tst_free_entries = NS_TST_NUM_ENTRIES; in ns_init_card()
603 ns_write_sram(card, NS_TST0 + j, &data, 1); in ns_init_card()
605 ns_write_sram(card, NS_TST0 + NS_TST_NUM_ENTRIES, &data, 1); in ns_init_card()
607 ns_write_sram(card, NS_TST1 + j, &data, 1); in ns_init_card()
609 ns_write_sram(card, NS_TST1 + NS_TST_NUM_ENTRIES, &data, 1); in ns_init_card()
611 card->tste2vc[j] = NULL; in ns_init_card()
612 writel(NS_TST0 << 2, card->membase + TSTB); in ns_init_card()
623 for (j = 0; j < card->rct_size; j++) in ns_init_card()
624 ns_write_sram(card, j * 4, u32d, 4); in ns_init_card()
626 memset(card->vcmap, 0, sizeof(card->vcmap)); in ns_init_card()
629 card->scd2vc[j] = NULL; in ns_init_card()
632 card->sbnr.min = MIN_SB; in ns_init_card()
633 card->sbnr.init = NUM_SB; in ns_init_card()
634 card->sbnr.max = MAX_SB; in ns_init_card()
635 card->lbnr.min = MIN_LB; in ns_init_card()
636 card->lbnr.init = NUM_LB; in ns_init_card()
637 card->lbnr.max = MAX_LB; in ns_init_card()
638 card->iovnr.min = MIN_IOVB; in ns_init_card()
639 card->iovnr.init = NUM_IOVB; in ns_init_card()
640 card->iovnr.max = MAX_IOVB; in ns_init_card()
641 card->hbnr.min = MIN_HB; in ns_init_card()
642 card->hbnr.init = NUM_HB; in ns_init_card()
643 card->hbnr.max = MAX_HB; in ns_init_card()
645 card->sm_handle = NULL; in ns_init_card()
646 card->sm_addr = 0x00000000; in ns_init_card()
647 card->lg_handle = NULL; in ns_init_card()
648 card->lg_addr = 0x00000000; in ns_init_card()
650 card->efbie = 1; /* To prevent push_rxbufs from enabling the interrupt */ in ns_init_card()
652 idr_init(&card->idr); in ns_init_card()
655 skb_queue_head_init(&card->hbpool.queue); in ns_init_card()
656 card->hbpool.count = 0; in ns_init_card()
665 ns_init_card_error(card, error); in ns_init_card()
669 skb_queue_tail(&card->hbpool.queue, hb); in ns_init_card()
670 card->hbpool.count++; in ns_init_card()
674 skb_queue_head_init(&card->lbpool.queue); in ns_init_card()
675 card->lbpool.count = 0; /* Not used */ in ns_init_card()
684 ns_init_card_error(card, error); in ns_init_card()
688 skb_queue_tail(&card->lbpool.queue, lb); in ns_init_card()
690 push_rxbufs(card, lb); in ns_init_card()
693 card->rcbuf = lb; in ns_init_card()
694 card->rawcell = (struct ns_rcqe *) lb->data; in ns_init_card()
695 card->rawch = NS_PRV_DMA(lb); in ns_init_card()
700 ns_stat_lfbqc_get(readl(card->membase + STAT))) < card->lbnr.min) { in ns_init_card()
705 ns_init_card_error(card, error); in ns_init_card()
710 skb_queue_head_init(&card->sbpool.queue); in ns_init_card()
711 card->sbpool.count = 0; /* Not used */ in ns_init_card()
720 ns_init_card_error(card, error); in ns_init_card()
724 skb_queue_tail(&card->sbpool.queue, sb); in ns_init_card()
726 push_rxbufs(card, sb); in ns_init_card()
730 ns_stat_sfbqc_get(readl(card->membase + STAT))) < card->sbnr.min) { in ns_init_card()
735 ns_init_card_error(card, error); in ns_init_card()
740 skb_queue_head_init(&card->iovpool.queue); in ns_init_card()
741 card->iovpool.count = 0; in ns_init_card()
750 ns_init_card_error(card, error); in ns_init_card()
754 skb_queue_tail(&card->iovpool.queue, iovb); in ns_init_card()
755 card->iovpool.count++; in ns_init_card()
759 if (card->rct_size == 4096) in ns_init_card()
761 else /* (card->rct_size == 16384) */ in ns_init_card()
764 card->efbie = 1; in ns_init_card()
767 card->atmdev = atm_dev_register("nicstar", &card->pcidev->dev, &atm_ops, in ns_init_card()
769 if (card->atmdev == NULL) { in ns_init_card()
772 ns_init_card_error(card, error); in ns_init_card()
776 if (mac[i] == NULL || !mac_pton(mac[i], card->atmdev->esi)) { in ns_init_card()
777 nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET, in ns_init_card()
778 card->atmdev->esi, 6); in ns_init_card()
779 if (ether_addr_equal(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00")) { in ns_init_card()
780 nicstar_read_eprom(card->membase, in ns_init_card()
782 card->atmdev->esi, 6); in ns_init_card()
786 printk("nicstar%d: MAC address %pM\n", i, card->atmdev->esi); in ns_init_card()
788 card->atmdev->dev_data = card; in ns_init_card()
789 card->atmdev->ci_range.vpi_bits = card->vpibits; in ns_init_card()
790 card->atmdev->ci_range.vci_bits = card->vcibits; in ns_init_card()
791 card->atmdev->link_rate = card->max_pcr; in ns_init_card()
792 card->atmdev->phy = NULL; in ns_init_card()
795 if (card->max_pcr == ATM_OC3_PCR) in ns_init_card()
796 suni_init(card->atmdev); in ns_init_card()
800 if (card->max_pcr == ATM_25_PCR) in ns_init_card()
801 idt77105_init(card->atmdev); in ns_init_card()
804 if (card->atmdev->phy && card->atmdev->phy->start) in ns_init_card()
805 card->atmdev->phy->start(card->atmdev); in ns_init_card()
809 NS_CFG_PHYIE, card->membase + CFG); in ns_init_card()
816 static void ns_init_card_error(ns_dev *card, int error) in ns_init_card_error() argument
819 writel(0x00000000, card->membase + CFG); in ns_init_card_error()
823 while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL) in ns_init_card_error()
828 while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL) in ns_init_card_error()
830 free_scq(card, card->scq0, NULL); in ns_init_card_error()
834 while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL) in ns_init_card_error()
839 while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL) in ns_init_card_error()
843 dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT, in ns_init_card_error()
844 card->rsq.org, card->rsq.dma); in ns_init_card_error()
847 dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT, in ns_init_card_error()
848 card->tsq.org, card->tsq.dma); in ns_init_card_error()
851 free_irq(card->pcidev->irq, card); in ns_init_card_error()
854 iounmap(card->membase); in ns_init_card_error()
857 pci_disable_device(card->pcidev); in ns_init_card_error()
858 kfree(card); in ns_init_card_error()
862 static scq_info *get_scq(ns_dev *card, int size, u32 scd) in get_scq() argument
872 scq->org = dma_alloc_coherent(&card->pcidev->dev, in get_scq()
881 dma_free_coherent(&card->pcidev->dev, in get_scq()
901 static void free_scq(ns_dev *card, scq_info *scq, struct atm_vcc *vcc) in free_scq() argument
932 dma_free_coherent(&card->pcidev->dev, in free_scq()
941 static void push_rxbufs(ns_dev * card, struct sk_buff *skb) in push_rxbufs() argument
953 addr1 = dma_map_single(&card->pcidev->dev, in push_rxbufs()
963 card->index); in push_rxbufs()
966 stat = readl(card->membase + STAT); in push_rxbufs()
967 card->sbfqc = ns_stat_sfbqc_get(stat); in push_rxbufs()
968 card->lbfqc = ns_stat_lfbqc_get(stat); in push_rxbufs()
971 if (card->sm_addr) { in push_rxbufs()
972 addr2 = card->sm_addr; in push_rxbufs()
973 handle2 = card->sm_handle; in push_rxbufs()
974 card->sm_addr = 0x00000000; in push_rxbufs()
975 card->sm_handle = NULL; in push_rxbufs()
978 card->sm_addr = addr1; in push_rxbufs()
979 card->sm_handle = handle1; in push_rxbufs()
985 if (card->lg_addr) { in push_rxbufs()
986 addr2 = card->lg_addr; in push_rxbufs()
987 handle2 = card->lg_handle; in push_rxbufs()
988 card->lg_addr = 0x00000000; in push_rxbufs()
989 card->lg_handle = NULL; in push_rxbufs()
992 card->lg_addr = addr1; in push_rxbufs()
993 card->lg_handle = handle1; in push_rxbufs()
1000 if (card->sbfqc >= card->sbnr.max) { in push_rxbufs()
1001 skb_unlink(handle1, &card->sbpool.queue); in push_rxbufs()
1003 skb_unlink(handle2, &card->sbpool.queue); in push_rxbufs()
1007 card->sbfqc += 2; in push_rxbufs()
1010 if (card->lbfqc >= card->lbnr.max) { in push_rxbufs()
1011 skb_unlink(handle1, &card->lbpool.queue); in push_rxbufs()
1013 skb_unlink(handle2, &card->lbpool.queue); in push_rxbufs()
1017 card->lbfqc += 2; in push_rxbufs()
1020 id1 = idr_alloc(&card->idr, handle1, 0, 0, GFP_ATOMIC); in push_rxbufs()
1024 id2 = idr_alloc(&card->idr, handle2, 0, 0, GFP_ATOMIC); in push_rxbufs()
1028 spin_lock_irqsave(&card->res_lock, flags); in push_rxbufs()
1029 while (CMD_BUSY(card)) ; in push_rxbufs()
1030 writel(addr2, card->membase + DR3); in push_rxbufs()
1031 writel(id2, card->membase + DR2); in push_rxbufs()
1032 writel(addr1, card->membase + DR1); in push_rxbufs()
1033 writel(id1, card->membase + DR0); in push_rxbufs()
1035 card->membase + CMD); in push_rxbufs()
1036 spin_unlock_irqrestore(&card->res_lock, flags); in push_rxbufs()
1039 card->index, in push_rxbufs()
1044 if (!card->efbie && card->sbfqc >= card->sbnr.min && in push_rxbufs()
1045 card->lbfqc >= card->lbnr.min) { in push_rxbufs()
1046 card->efbie = 1; in push_rxbufs()
1047 writel((readl(card->membase + CFG) | NS_CFG_EFBIE), in push_rxbufs()
1048 card->membase + CFG); in push_rxbufs()
1058 ns_dev *card; in ns_irq_handler() local
1062 card = (ns_dev *) dev_id; in ns_irq_handler()
1063 dev = card->atmdev; in ns_irq_handler()
1064 card->intcnt++; in ns_irq_handler()
1066 PRINTK("nicstar%d: NICStAR generated an interrupt\n", card->index); in ns_irq_handler()
1068 spin_lock_irqsave(&card->int_lock, flags); in ns_irq_handler()
1070 stat_r = readl(card->membase + STAT); in ns_irq_handler()
1074 TXPRINTK("nicstar%d: TSI interrupt\n", card->index); in ns_irq_handler()
1075 process_tsq(card); in ns_irq_handler()
1076 writel(NS_STAT_TSIF, card->membase + STAT); in ns_irq_handler()
1081 writel(NS_STAT_TXICP, card->membase + STAT); in ns_irq_handler()
1083 card->index); in ns_irq_handler()
1088 writel(NS_STAT_TSQF, card->membase + STAT); in ns_irq_handler()
1089 PRINTK("nicstar%d: TSQ full.\n", card->index); in ns_irq_handler()
1090 process_tsq(card); in ns_irq_handler()
1095 writel(NS_STAT_TMROF, card->membase + STAT); in ns_irq_handler()
1096 PRINTK("nicstar%d: Timer overflow.\n", card->index); in ns_irq_handler()
1101 writel(NS_STAT_PHYI, card->membase + STAT); in ns_irq_handler()
1102 PRINTK("nicstar%d: PHY interrupt.\n", card->index); in ns_irq_handler()
1110 writel(NS_STAT_SFBQF, card->membase + STAT); in ns_irq_handler()
1112 card->index); in ns_irq_handler()
1117 writel(NS_STAT_LFBQF, card->membase + STAT); in ns_irq_handler()
1119 card->index); in ns_irq_handler()
1124 writel(NS_STAT_RSQF, card->membase + STAT); in ns_irq_handler()
1125 printk("nicstar%d: RSQ full.\n", card->index); in ns_irq_handler()
1126 process_rsq(card); in ns_irq_handler()
1131 RXPRINTK("nicstar%d: End of CS-PDU received.\n", card->index); in ns_irq_handler()
1132 process_rsq(card); in ns_irq_handler()
1133 writel(NS_STAT_EOPDU, card->membase + STAT); in ns_irq_handler()
1138 writel(NS_STAT_RAWCF, card->membase + STAT); in ns_irq_handler()
1141 card->index); in ns_irq_handler()
1146 while (readl(card->membase + RAWCT) != card->rawch) { in ns_irq_handler()
1148 if (ns_rcqe_islast(card->rawcell)) { in ns_irq_handler()
1151 oldbuf = card->rcbuf; in ns_irq_handler()
1152 card->rcbuf = idr_find(&card->idr, in ns_irq_handler()
1153 ns_rcqe_nextbufhandle(card->rawcell)); in ns_irq_handler()
1154 card->rawch = NS_PRV_DMA(card->rcbuf); in ns_irq_handler()
1155 card->rawcell = (struct ns_rcqe *) in ns_irq_handler()
1156 card->rcbuf->data; in ns_irq_handler()
1157 recycle_rx_buf(card, oldbuf); in ns_irq_handler()
1159 card->rawch += NS_RCQE_SIZE; in ns_irq_handler()
1160 card->rawcell++; in ns_irq_handler()
1170 writel(NS_STAT_SFBQE, card->membase + STAT); in ns_irq_handler()
1172 card->index); in ns_irq_handler()
1173 for (i = 0; i < card->sbnr.min; i++) { in ns_irq_handler()
1176 writel(readl(card->membase + CFG) & in ns_irq_handler()
1177 ~NS_CFG_EFBIE, card->membase + CFG); in ns_irq_handler()
1178 card->efbie = 0; in ns_irq_handler()
1182 skb_queue_tail(&card->sbpool.queue, sb); in ns_irq_handler()
1184 push_rxbufs(card, sb); in ns_irq_handler()
1186 card->sbfqc = i; in ns_irq_handler()
1187 process_rsq(card); in ns_irq_handler()
1195 writel(NS_STAT_LFBQE, card->membase + STAT); in ns_irq_handler()
1197 card->index); in ns_irq_handler()
1198 for (i = 0; i < card->lbnr.min; i++) { in ns_irq_handler()
1201 writel(readl(card->membase + CFG) & in ns_irq_handler()
1202 ~NS_CFG_EFBIE, card->membase + CFG); in ns_irq_handler()
1203 card->efbie = 0; in ns_irq_handler()
1207 skb_queue_tail(&card->lbpool.queue, lb); in ns_irq_handler()
1209 push_rxbufs(card, lb); in ns_irq_handler()
1211 card->lbfqc = i; in ns_irq_handler()
1212 process_rsq(card); in ns_irq_handler()
1217 writel(NS_STAT_RSQAF, card->membase + STAT); in ns_irq_handler()
1218 RXPRINTK("nicstar%d: RSQ almost full.\n", card->index); in ns_irq_handler()
1219 process_rsq(card); in ns_irq_handler()
1222 spin_unlock_irqrestore(&card->int_lock, flags); in ns_irq_handler()
1223 PRINTK("nicstar%d: end of interrupt service\n", card->index); in ns_irq_handler()
1229 ns_dev *card; in ns_open() local
1244 card = (ns_dev *) vcc->dev->dev_data; in ns_open()
1245 PRINTK("nicstar%d: opening vpi.vci %d.%d \n", card->index, (int)vpi, in ns_open()
1248 PRINTK("nicstar%d: unsupported AAL.\n", card->index); in ns_open()
1252 vc = &(card->vcmap[vpi << card->vcibits | vci]); in ns_open()
1261 printk("nicstar%d: %s vci already in use.\n", card->index, in ns_open()
1281 card->index); in ns_open()
1291 card->index, vcc->qos.txtp.max_pcr); in ns_open()
1296 modl = tmpl % card->max_pcr; in ns_open()
1298 n = (int)(tmpl / card->max_pcr); in ns_open()
1304 (card->tst_free_entries - in ns_open()
1308 card->index); in ns_open()
1318 card->index); in ns_open()
1324 if (n > (card->tst_free_entries - NS_TST_RESERVED)) { in ns_open()
1327 card->index); in ns_open()
1332 card->tst_free_entries -= n; in ns_open()
1335 card->index, n); in ns_open()
1337 if (card->scd2vc[frscdi] == NULL) { in ns_open()
1338 card->scd2vc[frscdi] = vc; in ns_open()
1345 card->index); in ns_open()
1346 card->tst_free_entries += n; in ns_open()
1354 scq = get_scq(card, CBR_SCQSIZE, vc->cbr_scd); in ns_open()
1357 card->index); in ns_open()
1358 card->scd2vc[frscdi] = NULL; in ns_open()
1359 card->tst_free_entries += n; in ns_open()
1369 ns_write_sram(card, vc->cbr_scd, u32d, 4); in ns_open()
1371 fill_tst(card, n, vc); in ns_open()
1374 vc->scq = card->scq0; in ns_open()
1397 ns_write_sram(card, in ns_open()
1399 (vpi << card->vcibits | vci) * in ns_open()
1412 ns_dev *card; in ns_close() local
1417 card = vcc->dev->dev_data; in ns_close()
1418 PRINTK("nicstar%d: closing vpi.vci %d.%d \n", card->index, in ns_close()
1429 (vcc->vpi << card->vcibits | vcc->vci) * NS_RCT_ENTRY_SIZE; in ns_close()
1430 spin_lock_irqsave(&card->res_lock, flags); in ns_close()
1431 while (CMD_BUSY(card)) ; in ns_close()
1433 card->membase + CMD); in ns_close()
1434 spin_unlock_irqrestore(&card->res_lock, flags); in ns_close()
1441 stat = readl(card->membase + STAT); in ns_close()
1442 card->sbfqc = ns_stat_sfbqc_get(stat); in ns_close()
1443 card->lbfqc = ns_stat_lfbqc_get(stat); in ns_close()
1447 card->index); in ns_close()
1449 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in ns_close()
1452 spin_lock_irqsave(&card->int_lock, flags); in ns_close()
1453 recycle_iov_buf(card, iovb); in ns_close()
1454 spin_unlock_irqrestore(&card->int_lock, flags); in ns_close()
1503 ns_write_sram(card, scq->scd, &data, 1); in ns_close()
1512 if (card->tste2vc[i] == vc) { in ns_close()
1513 ns_write_sram(card, card->tst_addr + i, &data, in ns_close()
1515 card->tste2vc[i] = NULL; in ns_close()
1516 card->tst_free_entries++; in ns_close()
1520 card->scd2vc[(vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE] = NULL; in ns_close()
1521 free_scq(card, vc->scq, vcc); in ns_close()
1527 scq_info *scq = card->scq0; in ns_close()
1550 stat = readl(card->membase + STAT); in ns_close()
1551 cfg = readl(card->membase + CFG); in ns_close()
1555 card->tsq.base, card->tsq.next, in ns_close()
1556 card->tsq.last, readl(card->membase + TSQT)); in ns_close()
1559 card->rsq.base, card->rsq.next, in ns_close()
1560 card->rsq.last, readl(card->membase + RSQT)); in ns_close()
1562 card->efbie ? "enabled" : "disabled"); in ns_close()
1564 ns_stat_sfbqc_get(stat), card->sbpool.count, in ns_close()
1565 ns_stat_lfbqc_get(stat), card->lbpool.count); in ns_close()
1567 card->hbpool.count, card->iovpool.count); in ns_close()
1572 static void fill_tst(ns_dev * card, int n, vc_map * vc) in fill_tst() argument
1583 new_tst = card->tst_addr; in fill_tst()
1588 if (card->tste2vc[e] == NULL) in fill_tst()
1592 printk("nicstar%d: No free TST entries found. \n", card->index); in fill_tst()
1601 if (cl >= NS_TST_NUM_ENTRIES && card->tste2vc[e] == NULL) { in fill_tst()
1602 card->tste2vc[e] = vc; in fill_tst()
1603 ns_write_sram(card, new_tst + e, &data, 1); in fill_tst()
1617 ns_write_sram(card, new_tst + NS_TST_NUM_ENTRIES, &data, 1); in fill_tst()
1618 ns_write_sram(card, card->tst_addr + NS_TST_NUM_ENTRIES, &data, 1); in fill_tst()
1619 card->tst_addr = new_tst; in fill_tst()
1624 ns_dev *card; in _ns_send() local
1631 card = vcc->dev->dev_data; in _ns_send()
1632 TXPRINTK("nicstar%d: ns_send() called.\n", card->index); in _ns_send()
1635 card->index); in _ns_send()
1643 card->index); in _ns_send()
1651 card->index); in _ns_send()
1658 printk("nicstar%d: No scatter-gather yet.\n", card->index); in _ns_send()
1666 NS_PRV_DMA(skb) = dma_map_single(&card->pcidev->dev, skb->data, in _ns_send()
1703 scq = card->scq0; in _ns_send()
1706 if (push_scqe(card, vc, scq, &scqe, skb, may_sleep) != 0) { in _ns_send()
1708 dma_unmap_single(&card->pcidev->dev, NS_PRV_DMA(skb), skb->len, in _ns_send()
1728 static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd, in push_scqe() argument
1742 printk("nicstar%d: Error pushing TBD.\n", card->index); in push_scqe()
1755 card->index); in push_scqe()
1763 card->index, skb, index); in push_scqe()
1765 card->index, le32_to_cpu(tbd->word_1), le32_to_cpu(tbd->word_2), in push_scqe()
1787 ns_write_sram(card, scq->scd, &data, 1); in push_scqe()
1790 card->index); in push_scqe()
1819 card->index, le32_to_cpu(tsr.word_1), in push_scqe()
1830 card->index); in push_scqe()
1833 ns_write_sram(card, scq->scd, &data, 1); in push_scqe()
1840 static void process_tsq(ns_dev * card) in process_tsq() argument
1849 if (card->tsq.next == card->tsq.last) in process_tsq()
1850 one_ahead = card->tsq.base; in process_tsq()
1852 one_ahead = card->tsq.next + 1; in process_tsq()
1854 if (one_ahead == card->tsq.last) in process_tsq()
1855 two_ahead = card->tsq.base; in process_tsq()
1859 while (!ns_tsi_isempty(card->tsq.next) || !ns_tsi_isempty(one_ahead) || in process_tsq()
1866 while (ns_tsi_isempty(card->tsq.next)) { in process_tsq()
1867 if (card->tsq.next == card->tsq.last) in process_tsq()
1868 card->tsq.next = card->tsq.base; in process_tsq()
1870 card->tsq.next++; in process_tsq()
1873 if (!ns_tsi_tmrof(card->tsq.next)) { in process_tsq()
1874 scdi = ns_tsi_getscdindex(card->tsq.next); in process_tsq()
1876 scq = card->scq0; in process_tsq()
1878 if (card->scd2vc[scdi] == NULL) { in process_tsq()
1881 card->index); in process_tsq()
1882 ns_tsi_init(card->tsq.next); in process_tsq()
1885 scq = card->scd2vc[scdi]->scq; in process_tsq()
1887 drain_scq(card, scq, ns_tsi_getscqpos(card->tsq.next)); in process_tsq()
1892 ns_tsi_init(card->tsq.next); in process_tsq()
1893 previous = card->tsq.next; in process_tsq()
1894 if (card->tsq.next == card->tsq.last) in process_tsq()
1895 card->tsq.next = card->tsq.base; in process_tsq()
1897 card->tsq.next++; in process_tsq()
1899 if (card->tsq.next == card->tsq.last) in process_tsq()
1900 one_ahead = card->tsq.base; in process_tsq()
1902 one_ahead = card->tsq.next + 1; in process_tsq()
1904 if (one_ahead == card->tsq.last) in process_tsq()
1905 two_ahead = card->tsq.base; in process_tsq()
1911 writel(PTR_DIFF(previous, card->tsq.base), in process_tsq()
1912 card->membase + TSQH); in process_tsq()
1915 static void drain_scq(ns_dev * card, scq_info * scq, int pos) in drain_scq() argument
1923 card->index, scq, pos); in drain_scq()
1925 printk("nicstar%d: Bad index on drain_scq().\n", card->index); in drain_scq()
1936 card->index, skb, i); in drain_scq()
1938 dma_unmap_single(&card->pcidev->dev, in drain_scq()
1957 static void process_rsq(ns_dev * card) in process_rsq() argument
1961 if (!ns_rsqe_valid(card->rsq.next)) in process_rsq()
1964 dequeue_rx(card, card->rsq.next); in process_rsq()
1965 ns_rsqe_init(card->rsq.next); in process_rsq()
1966 previous = card->rsq.next; in process_rsq()
1967 if (card->rsq.next == card->rsq.last) in process_rsq()
1968 card->rsq.next = card->rsq.base; in process_rsq()
1970 card->rsq.next++; in process_rsq()
1971 } while (ns_rsqe_valid(card->rsq.next)); in process_rsq()
1972 writel(PTR_DIFF(previous, card->rsq.base), card->membase + RSQH); in process_rsq()
1975 static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe) in dequeue_rx() argument
1988 stat = readl(card->membase + STAT); in dequeue_rx()
1989 card->sbfqc = ns_stat_sfbqc_get(stat); in dequeue_rx()
1990 card->lbfqc = ns_stat_lfbqc_get(stat); in dequeue_rx()
1993 skb = idr_remove(&card->idr, id); in dequeue_rx()
1996 "nicstar%d: skb not found!\n", card->index); in dequeue_rx()
1999 dma_sync_single_for_cpu(&card->pcidev->dev, in dequeue_rx()
2004 dma_unmap_single(&card->pcidev->dev, in dequeue_rx()
2011 if (vpi >= 1UL << card->vpibits || vci >= 1UL << card->vcibits) { in dequeue_rx()
2013 card->index, vpi, vci); in dequeue_rx()
2014 recycle_rx_buf(card, skb); in dequeue_rx()
2018 vc = &(card->vcmap[vpi << card->vcibits | vci]); in dequeue_rx()
2021 card->index, vpi, vci); in dequeue_rx()
2022 recycle_rx_buf(card, skb); in dequeue_rx()
2039 card->index); in dequeue_rx()
2046 card->index); in dequeue_rx()
2066 recycle_rx_buf(card, skb); in dequeue_rx()
2073 iovb = skb_dequeue(&(card->iovpool.queue)); in dequeue_rx()
2078 card->index); in dequeue_rx()
2080 recycle_rx_buf(card, skb); in dequeue_rx()
2084 } else if (--card->iovpool.count < card->iovnr.min) { in dequeue_rx()
2089 skb_queue_tail(&card->iovpool.queue, new_iovb); in dequeue_rx()
2090 card->iovpool.count++; in dequeue_rx()
2102 printk("nicstar%d: received too big AAL5 SDU.\n", card->index); in dequeue_rx()
2104 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in dequeue_rx()
2121 card->index); in dequeue_rx()
2122 which_list(card, skb); in dequeue_rx()
2124 recycle_rx_buf(card, skb); in dequeue_rx()
2126 recycle_iov_buf(card, iovb); in dequeue_rx()
2134 card->index); in dequeue_rx()
2135 which_list(card, skb); in dequeue_rx()
2137 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in dequeue_rx()
2140 recycle_iov_buf(card, iovb); in dequeue_rx()
2154 printk("nicstar%d: AAL5 CRC error", card->index); in dequeue_rx()
2160 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in dequeue_rx()
2163 recycle_iov_buf(card, iovb); in dequeue_rx()
2172 push_rxbufs(card, skb); in dequeue_rx()
2176 dequeue_sm_buf(card, skb); in dequeue_rx()
2190 push_rxbufs(card, sb); in dequeue_rx()
2194 dequeue_sm_buf(card, sb); in dequeue_rx()
2201 push_rxbufs(card, skb); in dequeue_rx()
2206 push_rxbufs(card, skb); in dequeue_rx()
2209 dequeue_lg_buf(card, skb); in dequeue_rx()
2220 push_rxbufs(card, sb); in dequeue_rx()
2230 hb = skb_dequeue(&(card->hbpool.queue)); in dequeue_rx()
2237 card->index); in dequeue_rx()
2239 recycle_iovec_rx_bufs(card, in dequeue_rx()
2244 recycle_iov_buf(card, iovb); in dequeue_rx()
2246 } else if (card->hbpool.count < card->hbnr.min) { in dequeue_rx()
2251 skb_queue_tail(&card->hbpool. in dequeue_rx()
2253 card->hbpool.count++; in dequeue_rx()
2257 } else if (--card->hbpool.count < card->hbnr.min) { in dequeue_rx()
2262 skb_queue_tail(&card->hbpool.queue, in dequeue_rx()
2264 card->hbpool.count++; in dequeue_rx()
2266 if (card->hbpool.count < card->hbnr.min) { in dequeue_rx()
2272 skb_queue_tail(&card->hbpool. in dequeue_rx()
2274 card->hbpool.count++; in dequeue_rx()
2282 recycle_iovec_rx_bufs(card, iov, in dequeue_rx()
2284 if (card->hbpool.count < card->hbnr.max) { in dequeue_rx()
2285 skb_queue_tail(&card->hbpool.queue, hb); in dequeue_rx()
2286 card->hbpool.count++; in dequeue_rx()
2299 push_rxbufs(card, sb); in dequeue_rx()
2312 push_rxbufs(card, lb); in dequeue_rx()
2318 card->index); in dequeue_rx()
2328 recycle_iov_buf(card, iovb); in dequeue_rx()
2333 static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb) in recycle_rx_buf() argument
2337 card->index); in recycle_rx_buf()
2340 push_rxbufs(card, skb); in recycle_rx_buf()
2343 static void recycle_iovec_rx_bufs(ns_dev * card, struct iovec *iov, int count) in recycle_iovec_rx_bufs() argument
2346 recycle_rx_buf(card, (struct sk_buff *)(iov++)->iov_base); in recycle_iovec_rx_bufs()
2349 static void recycle_iov_buf(ns_dev * card, struct sk_buff *iovb) in recycle_iov_buf() argument
2351 if (card->iovpool.count < card->iovnr.max) { in recycle_iov_buf()
2352 skb_queue_tail(&card->iovpool.queue, iovb); in recycle_iov_buf()
2353 card->iovpool.count++; in recycle_iov_buf()
2358 static void dequeue_sm_buf(ns_dev * card, struct sk_buff *sb) in dequeue_sm_buf() argument
2360 skb_unlink(sb, &card->sbpool.queue); in dequeue_sm_buf()
2361 if (card->sbfqc < card->sbnr.init) { in dequeue_sm_buf()
2365 skb_queue_tail(&card->sbpool.queue, new_sb); in dequeue_sm_buf()
2367 push_rxbufs(card, new_sb); in dequeue_sm_buf()
2370 if (card->sbfqc < card->sbnr.init) in dequeue_sm_buf()
2375 skb_queue_tail(&card->sbpool.queue, new_sb); in dequeue_sm_buf()
2377 push_rxbufs(card, new_sb); in dequeue_sm_buf()
2382 static void dequeue_lg_buf(ns_dev * card, struct sk_buff *lb) in dequeue_lg_buf() argument
2384 skb_unlink(lb, &card->lbpool.queue); in dequeue_lg_buf()
2385 if (card->lbfqc < card->lbnr.init) { in dequeue_lg_buf()
2389 skb_queue_tail(&card->lbpool.queue, new_lb); in dequeue_lg_buf()
2391 push_rxbufs(card, new_lb); in dequeue_lg_buf()
2394 if (card->lbfqc < card->lbnr.init) in dequeue_lg_buf()
2399 skb_queue_tail(&card->lbpool.queue, new_lb); in dequeue_lg_buf()
2401 push_rxbufs(card, new_lb); in dequeue_lg_buf()
2409 ns_dev *card; in ns_proc_read() local
2413 card = (ns_dev *) dev->dev_data; in ns_proc_read()
2414 stat = readl(card->membase + STAT); in ns_proc_read()
2419 ns_stat_sfbqc_get(stat), card->sbnr.min, in ns_proc_read()
2420 card->sbnr.init, card->sbnr.max); in ns_proc_read()
2423 ns_stat_lfbqc_get(stat), card->lbnr.min, in ns_proc_read()
2424 card->lbnr.init, card->lbnr.max); in ns_proc_read()
2427 card->hbpool.count, card->hbnr.min, in ns_proc_read()
2428 card->hbnr.init, card->hbnr.max); in ns_proc_read()
2431 card->iovpool.count, card->iovnr.min, in ns_proc_read()
2432 card->iovnr.init, card->iovnr.max); in ns_proc_read()
2436 sprintf(page, "Interrupt counter: %u \n", card->intcnt); in ns_proc_read()
2437 card->intcnt = 0; in ns_proc_read()
2444 if (card->max_pcr == ATM_25_PCR && !left--) { in ns_proc_read()
2449 while (CMD_BUSY(card)) ; in ns_proc_read()
2451 card->membase + CMD); in ns_proc_read()
2452 while (CMD_BUSY(card)) ; in ns_proc_read()
2453 phy_regs[i] = readl(card->membase + DR0) & 0x000000FF; in ns_proc_read()
2464 if (card->tste2vc[left + 1] == NULL) in ns_proc_read()
2468 card->tste2vc[left + 1]->tx_vcc->vpi, in ns_proc_read()
2469 card->tste2vc[left + 1]->tx_vcc->vci); in ns_proc_read()
2477 ns_dev *card; in ns_ioctl() local
2482 card = dev->dev_data; in ns_ioctl()
2491 ns_stat_sfbqc_get(readl(card->membase + STAT)); in ns_ioctl()
2492 pl.level.min = card->sbnr.min; in ns_ioctl()
2493 pl.level.init = card->sbnr.init; in ns_ioctl()
2494 pl.level.max = card->sbnr.max; in ns_ioctl()
2499 ns_stat_lfbqc_get(readl(card->membase + STAT)); in ns_ioctl()
2500 pl.level.min = card->lbnr.min; in ns_ioctl()
2501 pl.level.init = card->lbnr.init; in ns_ioctl()
2502 pl.level.max = card->lbnr.max; in ns_ioctl()
2506 pl.count = card->hbpool.count; in ns_ioctl()
2507 pl.level.min = card->hbnr.min; in ns_ioctl()
2508 pl.level.init = card->hbnr.init; in ns_ioctl()
2509 pl.level.max = card->hbnr.max; in ns_ioctl()
2513 pl.count = card->iovpool.count; in ns_ioctl()
2514 pl.level.min = card->iovnr.min; in ns_ioctl()
2515 pl.level.init = card->iovnr.init; in ns_ioctl()
2516 pl.level.max = card->iovnr.max; in ns_ioctl()
2542 card->sbnr.min = pl.level.min; in ns_ioctl()
2543 card->sbnr.init = pl.level.init; in ns_ioctl()
2544 card->sbnr.max = pl.level.max; in ns_ioctl()
2550 card->lbnr.min = pl.level.min; in ns_ioctl()
2551 card->lbnr.init = pl.level.init; in ns_ioctl()
2552 card->lbnr.max = pl.level.max; in ns_ioctl()
2558 card->hbnr.min = pl.level.min; in ns_ioctl()
2559 card->hbnr.init = pl.level.init; in ns_ioctl()
2560 card->hbnr.max = pl.level.max; in ns_ioctl()
2566 card->iovnr.min = pl.level.min; in ns_ioctl()
2567 card->iovnr.init = pl.level.init; in ns_ioctl()
2568 card->iovnr.max = pl.level.max; in ns_ioctl()
2583 while (card->sbfqc < card->sbnr.init) { in ns_ioctl()
2590 skb_queue_tail(&card->sbpool.queue, sb); in ns_ioctl()
2592 push_rxbufs(card, sb); in ns_ioctl()
2597 while (card->lbfqc < card->lbnr.init) { in ns_ioctl()
2604 skb_queue_tail(&card->lbpool.queue, lb); in ns_ioctl()
2606 push_rxbufs(card, lb); in ns_ioctl()
2611 while (card->hbpool.count > card->hbnr.init) { in ns_ioctl()
2614 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2615 hb = skb_dequeue(&card->hbpool.queue); in ns_ioctl()
2616 card->hbpool.count--; in ns_ioctl()
2617 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2621 card->index); in ns_ioctl()
2626 while (card->hbpool.count < card->hbnr.init) { in ns_ioctl()
2633 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2634 skb_queue_tail(&card->hbpool.queue, hb); in ns_ioctl()
2635 card->hbpool.count++; in ns_ioctl()
2636 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2641 while (card->iovpool.count > card->iovnr.init) { in ns_ioctl()
2644 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2645 iovb = skb_dequeue(&card->iovpool.queue); in ns_ioctl()
2646 card->iovpool.count--; in ns_ioctl()
2647 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2651 card->index); in ns_ioctl()
2656 while (card->iovpool.count < card->iovnr.init) { in ns_ioctl()
2663 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2664 skb_queue_tail(&card->iovpool.queue, iovb); in ns_ioctl()
2665 card->iovpool.count++; in ns_ioctl()
2666 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2680 printk("nicstar%d: %s == NULL \n", card->index, in ns_ioctl()
2688 static void which_list(ns_dev * card, struct sk_buff *skb) in which_list() argument
2697 ns_dev *card; in ns_poll() local
2703 card = cards[i]; in ns_poll()
2704 if (!spin_trylock_irqsave(&card->int_lock, flags)) { in ns_poll()
2710 stat_r = readl(card->membase + STAT); in ns_poll()
2716 process_tsq(card); in ns_poll()
2717 process_rsq(card); in ns_poll()
2719 writel(stat_w, card->membase + STAT); in ns_poll()
2720 spin_unlock_irqrestore(&card->int_lock, flags); in ns_poll()
2729 ns_dev *card; in ns_phy_put() local
2732 card = dev->dev_data; in ns_phy_put()
2733 spin_lock_irqsave(&card->res_lock, flags); in ns_phy_put()
2734 while (CMD_BUSY(card)) ; in ns_phy_put()
2735 writel((u32) value, card->membase + DR0); in ns_phy_put()
2737 card->membase + CMD); in ns_phy_put()
2738 spin_unlock_irqrestore(&card->res_lock, flags); in ns_phy_put()
2743 ns_dev *card; in ns_phy_get() local
2747 card = dev->dev_data; in ns_phy_get()
2748 spin_lock_irqsave(&card->res_lock, flags); in ns_phy_get()
2749 while (CMD_BUSY(card)) ; in ns_phy_get()
2751 card->membase + CMD); in ns_phy_get()
2752 while (CMD_BUSY(card)) ; in ns_phy_get()
2753 data = readl(card->membase + DR0) & 0x000000FF; in ns_phy_get()
2754 spin_unlock_irqrestore(&card->res_lock, flags); in ns_phy_get()