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);
201 ns_dev *card = pci_get_drvdata(pcidev); in nicstar_remove_one() local
207 i = card->index; in nicstar_remove_one()
212 if (card->atmdev->phy && card->atmdev->phy->stop) in nicstar_remove_one()
213 card->atmdev->phy->stop(card->atmdev); in nicstar_remove_one()
216 writel(0x00000000, card->membase + CFG); in nicstar_remove_one()
219 atm_dev_deregister(card->atmdev); in nicstar_remove_one()
226 PRINTK("nicstar%d: freeing %d huge buffers.\n", i, card->hbpool.count); in nicstar_remove_one()
227 while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL) { in nicstar_remove_one()
234 card->iovpool.count); in nicstar_remove_one()
235 while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL) { in nicstar_remove_one()
240 while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL) in nicstar_remove_one()
242 while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL) in nicstar_remove_one()
244 free_scq(card, card->scq0, NULL); in nicstar_remove_one()
246 if (card->scd2vc[j] != NULL) in nicstar_remove_one()
247 free_scq(card, card->scd2vc[j]->scq, card->scd2vc[j]->tx_vcc); in nicstar_remove_one()
249 idr_destroy(&card->idr); in nicstar_remove_one()
250 dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT, in nicstar_remove_one()
251 card->rsq.org, card->rsq.dma); in nicstar_remove_one()
252 dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT, in nicstar_remove_one()
253 card->tsq.org, card->tsq.dma); in nicstar_remove_one()
254 free_irq(card->pcidev->irq, card); in nicstar_remove_one()
255 iounmap(card->membase); in nicstar_remove_one()
256 kfree(card); in nicstar_remove_one()
309 static u32 ns_read_sram(ns_dev * card, u32 sram_address) in ns_read_sram() argument
316 spin_lock_irqsave(&card->res_lock, flags); in ns_read_sram()
317 while (CMD_BUSY(card)) ; in ns_read_sram()
318 writel(sram_address, card->membase + CMD); in ns_read_sram()
319 while (CMD_BUSY(card)) ; in ns_read_sram()
320 data = readl(card->membase + DR0); in ns_read_sram()
321 spin_unlock_irqrestore(&card->res_lock, flags); in ns_read_sram()
325 static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value, in ns_write_sram() argument
333 spin_lock_irqsave(&card->res_lock, flags); in ns_write_sram()
334 while (CMD_BUSY(card)) ; in ns_write_sram()
336 writel(*(value++), card->membase + i); in ns_write_sram()
338 so card->membase + DR0 == card->membase */ in ns_write_sram()
342 writel(sram_address, card->membase + CMD); in ns_write_sram()
343 spin_unlock_irqrestore(&card->res_lock, flags); in ns_write_sram()
349 struct ns_dev *card = NULL; in ns_init_card() local
363 ns_init_card_error(card, error); in ns_init_card()
370 ns_init_card_error(card, error); in ns_init_card()
374 card = kmalloc(sizeof(*card), GFP_KERNEL); in ns_init_card()
375 if (!card) { in ns_init_card()
380 ns_init_card_error(card, error); in ns_init_card()
383 cards[i] = card; in ns_init_card()
384 spin_lock_init(&card->int_lock); in ns_init_card()
385 spin_lock_init(&card->res_lock); in ns_init_card()
387 pci_set_drvdata(pcidev, card); in ns_init_card()
389 card->index = i; in ns_init_card()
390 card->atmdev = NULL; in ns_init_card()
391 card->pcidev = pcidev; in ns_init_card()
393 card->membase = ioremap(membase, NS_IOREMAP_SIZE); in ns_init_card()
394 if (!card->membase) { in ns_init_card()
397 ns_init_card_error(card, error); in ns_init_card()
400 PRINTK("nicstar%d: membase at 0x%p.\n", i, card->membase); in ns_init_card()
407 ns_init_card_error(card, error); in ns_init_card()
424 ns_init_card_error(card, error); in ns_init_card()
431 data = readl(card->membase + STAT); in ns_init_card()
433 writel(NS_STAT_TMROF, card->membase + STAT); in ns_init_card()
436 writel(NS_CFG_SWRST, card->membase + CFG); in ns_init_card()
438 writel(0x00000000, card->membase + CFG); in ns_init_card()
441 writel(0x00000008, card->membase + GP); in ns_init_card()
443 writel(0x00000001, card->membase + GP); in ns_init_card()
445 while (CMD_BUSY(card)) ; in ns_init_card()
446 writel(NS_CMD_WRITE_UTILITY | 0x00000100, card->membase + CMD); /* Sync UTOPIA with SAR clock */ in ns_init_card()
450 while (CMD_BUSY(card)) ; in ns_init_card()
451 writel(NS_CMD_READ_UTILITY | 0x00000200, card->membase + CMD); in ns_init_card()
452 while (CMD_BUSY(card)) ; in ns_init_card()
453 data = readl(card->membase + DR0); in ns_init_card()
457 card->max_pcr = ATM_25_PCR; in ns_init_card()
458 while (CMD_BUSY(card)) ; in ns_init_card()
459 writel(0x00000008, card->membase + DR0); in ns_init_card()
460 writel(NS_CMD_WRITE_UTILITY | 0x00000200, card->membase + CMD); in ns_init_card()
462 writel(NS_STAT_SFBQF, card->membase + STAT); in ns_init_card()
464 while (CMD_BUSY(card)) ; in ns_init_card()
465 writel(0x00000022, card->membase + DR0); in ns_init_card()
466 writel(NS_CMD_WRITE_UTILITY | 0x00000202, card->membase + CMD); in ns_init_card()
472 card->max_pcr = ATM_OC3_PCR; in ns_init_card()
474 while (CMD_BUSY(card)) ; in ns_init_card()
475 writel(0x00000002, card->membase + DR0); in ns_init_card()
476 writel(NS_CMD_WRITE_UTILITY | 0x00000205, card->membase + CMD); in ns_init_card()
482 ns_init_card_error(card, error); in ns_init_card()
485 writel(0x00000000, card->membase + GP); in ns_init_card()
489 ns_write_sram(card, 0x1C003, &data, 1); in ns_init_card()
491 ns_write_sram(card, 0x14003, &data, 1); in ns_init_card()
492 if (ns_read_sram(card, 0x14003) == 0x89ABCDEF && in ns_init_card()
493 ns_read_sram(card, 0x1C003) == 0x76543210) in ns_init_card()
494 card->sram_size = 128; in ns_init_card()
496 card->sram_size = 32; in ns_init_card()
497 PRINTK("nicstar%d: %dK x 32bit SRAM size.\n", i, card->sram_size); in ns_init_card()
499 card->rct_size = NS_MAX_RCTSIZE; in ns_init_card()
502 if (card->sram_size == 128) in ns_init_card()
507 if (card->sram_size == 32) { in ns_init_card()
511 card->rct_size = 4096; in ns_init_card()
517 card->vpibits = NS_VPIBITS; in ns_init_card()
518 if (card->rct_size == 4096) in ns_init_card()
519 card->vcibits = 12 - NS_VPIBITS; in ns_init_card()
520 else /* card->rct_size == 16384 */ in ns_init_card()
521 card->vcibits = 14 - NS_VPIBITS; in ns_init_card()
525 nicstar_init_eprom(card->membase); in ns_init_card()
528 writel(0x00000000, card->membase + VPM); in ns_init_card()
530 card->intcnt = 0; in ns_init_card()
532 (pcidev->irq, &ns_irq_handler, IRQF_SHARED, "nicstar", card) != 0) { in ns_init_card()
535 ns_init_card_error(card, error); in ns_init_card()
540 card->tsq.org = dma_alloc_coherent(&card->pcidev->dev, in ns_init_card()
542 &card->tsq.dma, GFP_KERNEL); in ns_init_card()
543 if (card->tsq.org == NULL) { in ns_init_card()
546 ns_init_card_error(card, error); in ns_init_card()
549 card->tsq.base = PTR_ALIGN(card->tsq.org, NS_TSQ_ALIGNMENT); in ns_init_card()
550 card->tsq.next = card->tsq.base; in ns_init_card()
551 card->tsq.last = card->tsq.base + (NS_TSQ_NUM_ENTRIES - 1); in ns_init_card()
553 ns_tsi_init(card->tsq.base + j); in ns_init_card()
554 writel(0x00000000, card->membase + TSQH); in ns_init_card()
555 writel(ALIGN(card->tsq.dma, NS_TSQ_ALIGNMENT), card->membase + TSQB); in ns_init_card()
556 PRINTK("nicstar%d: TSQ base at 0x%p.\n", i, card->tsq.base); in ns_init_card()
559 card->rsq.org = dma_alloc_coherent(&card->pcidev->dev, in ns_init_card()
561 &card->rsq.dma, GFP_KERNEL); in ns_init_card()
562 if (card->rsq.org == NULL) { in ns_init_card()
565 ns_init_card_error(card, error); in ns_init_card()
568 card->rsq.base = PTR_ALIGN(card->rsq.org, NS_RSQ_ALIGNMENT); in ns_init_card()
569 card->rsq.next = card->rsq.base; in ns_init_card()
570 card->rsq.last = card->rsq.base + (NS_RSQ_NUM_ENTRIES - 1); in ns_init_card()
572 ns_rsqe_init(card->rsq.base + j); in ns_init_card()
573 writel(0x00000000, card->membase + RSQH); in ns_init_card()
574 writel(ALIGN(card->rsq.dma, NS_RSQ_ALIGNMENT), card->membase + RSQB); in ns_init_card()
575 PRINTK("nicstar%d: RSQ base at 0x%p.\n", i, card->rsq.base); in ns_init_card()
578 card->scq1 = NULL; in ns_init_card()
579 card->scq2 = NULL; in ns_init_card()
580 card->scq0 = get_scq(card, VBR_SCQSIZE, NS_VRSCD0); in ns_init_card()
581 if (card->scq0 == NULL) { in ns_init_card()
584 ns_init_card_error(card, error); in ns_init_card()
587 u32d[0] = scq_virt_to_bus(card->scq0, card->scq0->base); in ns_init_card()
591 ns_write_sram(card, NS_VRSCD0, u32d, 4); in ns_init_card()
592 ns_write_sram(card, NS_VRSCD1, u32d, 4); /* These last two won't be used */ in ns_init_card()
593 ns_write_sram(card, NS_VRSCD2, u32d, 4); /* but are initialized, just in case... */ in ns_init_card()
594 card->scq0->scd = NS_VRSCD0; in ns_init_card()
595 PRINTK("nicstar%d: VBR-SCQ0 base at 0x%p.\n", i, card->scq0->base); in ns_init_card()
598 card->tst_addr = NS_TST0; in ns_init_card()
599 card->tst_free_entries = NS_TST_NUM_ENTRIES; in ns_init_card()
602 ns_write_sram(card, NS_TST0 + j, &data, 1); in ns_init_card()
604 ns_write_sram(card, NS_TST0 + NS_TST_NUM_ENTRIES, &data, 1); in ns_init_card()
606 ns_write_sram(card, NS_TST1 + j, &data, 1); in ns_init_card()
608 ns_write_sram(card, NS_TST1 + NS_TST_NUM_ENTRIES, &data, 1); in ns_init_card()
610 card->tste2vc[j] = NULL; in ns_init_card()
611 writel(NS_TST0 << 2, card->membase + TSTB); in ns_init_card()
622 for (j = 0; j < card->rct_size; j++) in ns_init_card()
623 ns_write_sram(card, j * 4, u32d, 4); in ns_init_card()
625 memset(card->vcmap, 0, sizeof(card->vcmap)); in ns_init_card()
628 card->scd2vc[j] = NULL; in ns_init_card()
631 card->sbnr.min = MIN_SB; in ns_init_card()
632 card->sbnr.init = NUM_SB; in ns_init_card()
633 card->sbnr.max = MAX_SB; in ns_init_card()
634 card->lbnr.min = MIN_LB; in ns_init_card()
635 card->lbnr.init = NUM_LB; in ns_init_card()
636 card->lbnr.max = MAX_LB; in ns_init_card()
637 card->iovnr.min = MIN_IOVB; in ns_init_card()
638 card->iovnr.init = NUM_IOVB; in ns_init_card()
639 card->iovnr.max = MAX_IOVB; in ns_init_card()
640 card->hbnr.min = MIN_HB; in ns_init_card()
641 card->hbnr.init = NUM_HB; in ns_init_card()
642 card->hbnr.max = MAX_HB; in ns_init_card()
644 card->sm_handle = NULL; in ns_init_card()
645 card->sm_addr = 0x00000000; in ns_init_card()
646 card->lg_handle = NULL; in ns_init_card()
647 card->lg_addr = 0x00000000; in ns_init_card()
649 card->efbie = 1; /* To prevent push_rxbufs from enabling the interrupt */ in ns_init_card()
651 idr_init(&card->idr); in ns_init_card()
654 skb_queue_head_init(&card->hbpool.queue); in ns_init_card()
655 card->hbpool.count = 0; in ns_init_card()
664 ns_init_card_error(card, error); in ns_init_card()
668 skb_queue_tail(&card->hbpool.queue, hb); in ns_init_card()
669 card->hbpool.count++; in ns_init_card()
673 skb_queue_head_init(&card->lbpool.queue); in ns_init_card()
674 card->lbpool.count = 0; /* Not used */ in ns_init_card()
683 ns_init_card_error(card, error); in ns_init_card()
687 skb_queue_tail(&card->lbpool.queue, lb); in ns_init_card()
689 push_rxbufs(card, lb); in ns_init_card()
692 card->rcbuf = lb; in ns_init_card()
693 card->rawcell = (struct ns_rcqe *) lb->data; in ns_init_card()
694 card->rawch = NS_PRV_DMA(lb); in ns_init_card()
699 ns_stat_lfbqc_get(readl(card->membase + STAT))) < card->lbnr.min) { in ns_init_card()
704 ns_init_card_error(card, error); in ns_init_card()
709 skb_queue_head_init(&card->sbpool.queue); in ns_init_card()
710 card->sbpool.count = 0; /* Not used */ in ns_init_card()
719 ns_init_card_error(card, error); in ns_init_card()
723 skb_queue_tail(&card->sbpool.queue, sb); in ns_init_card()
725 push_rxbufs(card, sb); in ns_init_card()
729 ns_stat_sfbqc_get(readl(card->membase + STAT))) < card->sbnr.min) { in ns_init_card()
734 ns_init_card_error(card, error); in ns_init_card()
739 skb_queue_head_init(&card->iovpool.queue); in ns_init_card()
740 card->iovpool.count = 0; in ns_init_card()
749 ns_init_card_error(card, error); in ns_init_card()
753 skb_queue_tail(&card->iovpool.queue, iovb); in ns_init_card()
754 card->iovpool.count++; in ns_init_card()
758 if (card->rct_size == 4096) in ns_init_card()
760 else /* (card->rct_size == 16384) */ in ns_init_card()
763 card->efbie = 1; in ns_init_card()
766 card->atmdev = atm_dev_register("nicstar", &card->pcidev->dev, &atm_ops, in ns_init_card()
768 if (card->atmdev == NULL) { in ns_init_card()
771 ns_init_card_error(card, error); in ns_init_card()
775 if (mac[i] == NULL || !mac_pton(mac[i], card->atmdev->esi)) { in ns_init_card()
776 nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET, in ns_init_card()
777 card->atmdev->esi, 6); in ns_init_card()
778 if (ether_addr_equal(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00")) { in ns_init_card()
779 nicstar_read_eprom(card->membase, in ns_init_card()
781 card->atmdev->esi, 6); in ns_init_card()
785 printk("nicstar%d: MAC address %pM\n", i, card->atmdev->esi); in ns_init_card()
787 card->atmdev->dev_data = card; in ns_init_card()
788 card->atmdev->ci_range.vpi_bits = card->vpibits; in ns_init_card()
789 card->atmdev->ci_range.vci_bits = card->vcibits; in ns_init_card()
790 card->atmdev->link_rate = card->max_pcr; in ns_init_card()
791 card->atmdev->phy = NULL; in ns_init_card()
794 if (card->max_pcr == ATM_OC3_PCR) in ns_init_card()
795 suni_init(card->atmdev); in ns_init_card()
799 if (card->max_pcr == ATM_25_PCR) in ns_init_card()
800 idt77105_init(card->atmdev); in ns_init_card()
803 if (card->atmdev->phy && card->atmdev->phy->start) in ns_init_card()
804 card->atmdev->phy->start(card->atmdev); in ns_init_card()
808 NS_CFG_PHYIE, card->membase + CFG); in ns_init_card()
815 static void ns_init_card_error(ns_dev *card, int error) in ns_init_card_error() argument
818 writel(0x00000000, card->membase + CFG); in ns_init_card_error()
822 while ((iovb = skb_dequeue(&card->iovpool.queue)) != NULL) in ns_init_card_error()
827 while ((sb = skb_dequeue(&card->sbpool.queue)) != NULL) in ns_init_card_error()
829 free_scq(card, card->scq0, NULL); in ns_init_card_error()
833 while ((lb = skb_dequeue(&card->lbpool.queue)) != NULL) in ns_init_card_error()
838 while ((hb = skb_dequeue(&card->hbpool.queue)) != NULL) in ns_init_card_error()
842 dma_free_coherent(&card->pcidev->dev, NS_RSQSIZE + NS_RSQ_ALIGNMENT, in ns_init_card_error()
843 card->rsq.org, card->rsq.dma); in ns_init_card_error()
846 dma_free_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT, in ns_init_card_error()
847 card->tsq.org, card->tsq.dma); in ns_init_card_error()
850 free_irq(card->pcidev->irq, card); in ns_init_card_error()
853 iounmap(card->membase); in ns_init_card_error()
856 pci_disable_device(card->pcidev); in ns_init_card_error()
857 kfree(card); in ns_init_card_error()
861 static scq_info *get_scq(ns_dev *card, int size, u32 scd) in get_scq() argument
871 scq->org = dma_alloc_coherent(&card->pcidev->dev, in get_scq()
880 dma_free_coherent(&card->pcidev->dev, in get_scq()
900 static void free_scq(ns_dev *card, scq_info *scq, struct atm_vcc *vcc) in free_scq() argument
931 dma_free_coherent(&card->pcidev->dev, in free_scq()
940 static void push_rxbufs(ns_dev * card, struct sk_buff *skb) in push_rxbufs() argument
952 addr1 = dma_map_single(&card->pcidev->dev, in push_rxbufs()
962 card->index); in push_rxbufs()
965 stat = readl(card->membase + STAT); in push_rxbufs()
966 card->sbfqc = ns_stat_sfbqc_get(stat); in push_rxbufs()
967 card->lbfqc = ns_stat_lfbqc_get(stat); in push_rxbufs()
970 if (card->sm_addr) { in push_rxbufs()
971 addr2 = card->sm_addr; in push_rxbufs()
972 handle2 = card->sm_handle; in push_rxbufs()
973 card->sm_addr = 0x00000000; in push_rxbufs()
974 card->sm_handle = NULL; in push_rxbufs()
977 card->sm_addr = addr1; in push_rxbufs()
978 card->sm_handle = handle1; in push_rxbufs()
984 if (card->lg_addr) { in push_rxbufs()
985 addr2 = card->lg_addr; in push_rxbufs()
986 handle2 = card->lg_handle; in push_rxbufs()
987 card->lg_addr = 0x00000000; in push_rxbufs()
988 card->lg_handle = NULL; in push_rxbufs()
991 card->lg_addr = addr1; in push_rxbufs()
992 card->lg_handle = handle1; in push_rxbufs()
999 if (card->sbfqc >= card->sbnr.max) { in push_rxbufs()
1000 skb_unlink(handle1, &card->sbpool.queue); in push_rxbufs()
1002 skb_unlink(handle2, &card->sbpool.queue); in push_rxbufs()
1006 card->sbfqc += 2; in push_rxbufs()
1009 if (card->lbfqc >= card->lbnr.max) { in push_rxbufs()
1010 skb_unlink(handle1, &card->lbpool.queue); in push_rxbufs()
1012 skb_unlink(handle2, &card->lbpool.queue); in push_rxbufs()
1016 card->lbfqc += 2; in push_rxbufs()
1019 id1 = idr_alloc(&card->idr, handle1, 0, 0, GFP_ATOMIC); in push_rxbufs()
1023 id2 = idr_alloc(&card->idr, handle2, 0, 0, GFP_ATOMIC); in push_rxbufs()
1027 spin_lock_irqsave(&card->res_lock, flags); in push_rxbufs()
1028 while (CMD_BUSY(card)) ; in push_rxbufs()
1029 writel(addr2, card->membase + DR3); in push_rxbufs()
1030 writel(id2, card->membase + DR2); in push_rxbufs()
1031 writel(addr1, card->membase + DR1); in push_rxbufs()
1032 writel(id1, card->membase + DR0); in push_rxbufs()
1034 card->membase + CMD); in push_rxbufs()
1035 spin_unlock_irqrestore(&card->res_lock, flags); in push_rxbufs()
1038 card->index, in push_rxbufs()
1043 if (!card->efbie && card->sbfqc >= card->sbnr.min && in push_rxbufs()
1044 card->lbfqc >= card->lbnr.min) { in push_rxbufs()
1045 card->efbie = 1; in push_rxbufs()
1046 writel((readl(card->membase + CFG) | NS_CFG_EFBIE), in push_rxbufs()
1047 card->membase + CFG); in push_rxbufs()
1057 ns_dev *card; in ns_irq_handler() local
1061 card = (ns_dev *) dev_id; in ns_irq_handler()
1062 dev = card->atmdev; in ns_irq_handler()
1063 card->intcnt++; in ns_irq_handler()
1065 PRINTK("nicstar%d: NICStAR generated an interrupt\n", card->index); in ns_irq_handler()
1067 spin_lock_irqsave(&card->int_lock, flags); in ns_irq_handler()
1069 stat_r = readl(card->membase + STAT); in ns_irq_handler()
1073 TXPRINTK("nicstar%d: TSI interrupt\n", card->index); in ns_irq_handler()
1074 process_tsq(card); in ns_irq_handler()
1075 writel(NS_STAT_TSIF, card->membase + STAT); in ns_irq_handler()
1080 writel(NS_STAT_TXICP, card->membase + STAT); in ns_irq_handler()
1082 card->index); in ns_irq_handler()
1087 writel(NS_STAT_TSQF, card->membase + STAT); in ns_irq_handler()
1088 PRINTK("nicstar%d: TSQ full.\n", card->index); in ns_irq_handler()
1089 process_tsq(card); in ns_irq_handler()
1094 writel(NS_STAT_TMROF, card->membase + STAT); in ns_irq_handler()
1095 PRINTK("nicstar%d: Timer overflow.\n", card->index); in ns_irq_handler()
1100 writel(NS_STAT_PHYI, card->membase + STAT); in ns_irq_handler()
1101 PRINTK("nicstar%d: PHY interrupt.\n", card->index); in ns_irq_handler()
1109 writel(NS_STAT_SFBQF, card->membase + STAT); in ns_irq_handler()
1111 card->index); in ns_irq_handler()
1116 writel(NS_STAT_LFBQF, card->membase + STAT); in ns_irq_handler()
1118 card->index); in ns_irq_handler()
1123 writel(NS_STAT_RSQF, card->membase + STAT); in ns_irq_handler()
1124 printk("nicstar%d: RSQ full.\n", card->index); in ns_irq_handler()
1125 process_rsq(card); in ns_irq_handler()
1130 RXPRINTK("nicstar%d: End of CS-PDU received.\n", card->index); in ns_irq_handler()
1131 process_rsq(card); in ns_irq_handler()
1132 writel(NS_STAT_EOPDU, card->membase + STAT); in ns_irq_handler()
1137 writel(NS_STAT_RAWCF, card->membase + STAT); in ns_irq_handler()
1140 card->index); in ns_irq_handler()
1145 while (readl(card->membase + RAWCT) != card->rawch) { in ns_irq_handler()
1147 if (ns_rcqe_islast(card->rawcell)) { in ns_irq_handler()
1150 oldbuf = card->rcbuf; in ns_irq_handler()
1151 card->rcbuf = idr_find(&card->idr, in ns_irq_handler()
1152 ns_rcqe_nextbufhandle(card->rawcell)); in ns_irq_handler()
1153 card->rawch = NS_PRV_DMA(card->rcbuf); in ns_irq_handler()
1154 card->rawcell = (struct ns_rcqe *) in ns_irq_handler()
1155 card->rcbuf->data; in ns_irq_handler()
1156 recycle_rx_buf(card, oldbuf); in ns_irq_handler()
1158 card->rawch += NS_RCQE_SIZE; in ns_irq_handler()
1159 card->rawcell++; in ns_irq_handler()
1169 writel(NS_STAT_SFBQE, card->membase + STAT); in ns_irq_handler()
1171 card->index); in ns_irq_handler()
1172 for (i = 0; i < card->sbnr.min; i++) { in ns_irq_handler()
1175 writel(readl(card->membase + CFG) & in ns_irq_handler()
1176 ~NS_CFG_EFBIE, card->membase + CFG); in ns_irq_handler()
1177 card->efbie = 0; in ns_irq_handler()
1181 skb_queue_tail(&card->sbpool.queue, sb); in ns_irq_handler()
1183 push_rxbufs(card, sb); in ns_irq_handler()
1185 card->sbfqc = i; in ns_irq_handler()
1186 process_rsq(card); in ns_irq_handler()
1194 writel(NS_STAT_LFBQE, card->membase + STAT); in ns_irq_handler()
1196 card->index); in ns_irq_handler()
1197 for (i = 0; i < card->lbnr.min; i++) { in ns_irq_handler()
1200 writel(readl(card->membase + CFG) & in ns_irq_handler()
1201 ~NS_CFG_EFBIE, card->membase + CFG); in ns_irq_handler()
1202 card->efbie = 0; in ns_irq_handler()
1206 skb_queue_tail(&card->lbpool.queue, lb); in ns_irq_handler()
1208 push_rxbufs(card, lb); in ns_irq_handler()
1210 card->lbfqc = i; in ns_irq_handler()
1211 process_rsq(card); in ns_irq_handler()
1216 writel(NS_STAT_RSQAF, card->membase + STAT); in ns_irq_handler()
1217 RXPRINTK("nicstar%d: RSQ almost full.\n", card->index); in ns_irq_handler()
1218 process_rsq(card); in ns_irq_handler()
1221 spin_unlock_irqrestore(&card->int_lock, flags); in ns_irq_handler()
1222 PRINTK("nicstar%d: end of interrupt service\n", card->index); in ns_irq_handler()
1228 ns_dev *card; in ns_open() local
1243 card = (ns_dev *) vcc->dev->dev_data; in ns_open()
1244 PRINTK("nicstar%d: opening vpi.vci %d.%d \n", card->index, (int)vpi, in ns_open()
1247 PRINTK("nicstar%d: unsupported AAL.\n", card->index); in ns_open()
1251 vc = &(card->vcmap[vpi << card->vcibits | vci]); in ns_open()
1260 printk("nicstar%d: %s vci already in use.\n", card->index, in ns_open()
1280 card->index); in ns_open()
1290 card->index, vcc->qos.txtp.max_pcr); in ns_open()
1295 modl = tmpl % card->max_pcr; in ns_open()
1297 n = (int)(tmpl / card->max_pcr); in ns_open()
1303 (card->tst_free_entries - in ns_open()
1307 card->index); in ns_open()
1317 card->index); in ns_open()
1323 if (n > (card->tst_free_entries - NS_TST_RESERVED)) { in ns_open()
1326 card->index); in ns_open()
1331 card->tst_free_entries -= n; in ns_open()
1334 card->index, n); in ns_open()
1336 if (card->scd2vc[frscdi] == NULL) { in ns_open()
1337 card->scd2vc[frscdi] = vc; in ns_open()
1344 card->index); in ns_open()
1345 card->tst_free_entries += n; in ns_open()
1353 scq = get_scq(card, CBR_SCQSIZE, vc->cbr_scd); in ns_open()
1356 card->index); in ns_open()
1357 card->scd2vc[frscdi] = NULL; in ns_open()
1358 card->tst_free_entries += n; in ns_open()
1368 ns_write_sram(card, vc->cbr_scd, u32d, 4); in ns_open()
1370 fill_tst(card, n, vc); in ns_open()
1373 vc->scq = card->scq0; in ns_open()
1396 ns_write_sram(card, in ns_open()
1398 (vpi << card->vcibits | vci) * in ns_open()
1411 ns_dev *card; in ns_close() local
1416 card = vcc->dev->dev_data; in ns_close()
1417 PRINTK("nicstar%d: closing vpi.vci %d.%d \n", card->index, in ns_close()
1428 (vcc->vpi << card->vcibits | vcc->vci) * NS_RCT_ENTRY_SIZE; in ns_close()
1429 spin_lock_irqsave(&card->res_lock, flags); in ns_close()
1430 while (CMD_BUSY(card)) ; in ns_close()
1432 card->membase + CMD); in ns_close()
1433 spin_unlock_irqrestore(&card->res_lock, flags); in ns_close()
1440 stat = readl(card->membase + STAT); in ns_close()
1441 card->sbfqc = ns_stat_sfbqc_get(stat); in ns_close()
1442 card->lbfqc = ns_stat_lfbqc_get(stat); in ns_close()
1446 card->index); in ns_close()
1448 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in ns_close()
1451 spin_lock_irqsave(&card->int_lock, flags); in ns_close()
1452 recycle_iov_buf(card, iovb); in ns_close()
1453 spin_unlock_irqrestore(&card->int_lock, flags); in ns_close()
1502 ns_write_sram(card, scq->scd, &data, 1); in ns_close()
1511 if (card->tste2vc[i] == vc) { in ns_close()
1512 ns_write_sram(card, card->tst_addr + i, &data, in ns_close()
1514 card->tste2vc[i] = NULL; in ns_close()
1515 card->tst_free_entries++; in ns_close()
1519 card->scd2vc[(vc->cbr_scd - NS_FRSCD) / NS_FRSCD_SIZE] = NULL; in ns_close()
1520 free_scq(card, vc->scq, vcc); in ns_close()
1526 scq_info *scq = card->scq0; in ns_close()
1549 stat = readl(card->membase + STAT); in ns_close()
1550 cfg = readl(card->membase + CFG); in ns_close()
1554 card->tsq.base, card->tsq.next, in ns_close()
1555 card->tsq.last, readl(card->membase + TSQT)); in ns_close()
1558 card->rsq.base, card->rsq.next, in ns_close()
1559 card->rsq.last, readl(card->membase + RSQT)); in ns_close()
1561 card->efbie ? "enabled" : "disabled"); in ns_close()
1563 ns_stat_sfbqc_get(stat), card->sbpool.count, in ns_close()
1564 ns_stat_lfbqc_get(stat), card->lbpool.count); in ns_close()
1566 card->hbpool.count, card->iovpool.count); in ns_close()
1571 static void fill_tst(ns_dev * card, int n, vc_map * vc) in fill_tst() argument
1582 new_tst = card->tst_addr; in fill_tst()
1587 if (card->tste2vc[e] == NULL) in fill_tst()
1591 printk("nicstar%d: No free TST entries found. \n", card->index); in fill_tst()
1600 if (cl >= NS_TST_NUM_ENTRIES && card->tste2vc[e] == NULL) { in fill_tst()
1601 card->tste2vc[e] = vc; in fill_tst()
1602 ns_write_sram(card, new_tst + e, &data, 1); in fill_tst()
1616 ns_write_sram(card, new_tst + NS_TST_NUM_ENTRIES, &data, 1); in fill_tst()
1617 ns_write_sram(card, card->tst_addr + NS_TST_NUM_ENTRIES, &data, 1); in fill_tst()
1618 card->tst_addr = new_tst; in fill_tst()
1623 ns_dev *card; in _ns_send() local
1630 card = vcc->dev->dev_data; in _ns_send()
1631 TXPRINTK("nicstar%d: ns_send() called.\n", card->index); in _ns_send()
1634 card->index); in _ns_send()
1642 card->index); in _ns_send()
1650 card->index); in _ns_send()
1657 printk("nicstar%d: No scatter-gather yet.\n", card->index); in _ns_send()
1665 NS_PRV_DMA(skb) = dma_map_single(&card->pcidev->dev, skb->data, in _ns_send()
1702 scq = card->scq0; in _ns_send()
1705 if (push_scqe(card, vc, scq, &scqe, skb, may_sleep) != 0) { in _ns_send()
1707 dma_unmap_single(&card->pcidev->dev, NS_PRV_DMA(skb), skb->len, in _ns_send()
1727 static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd, in push_scqe() argument
1741 printk("nicstar%d: Error pushing TBD.\n", card->index); in push_scqe()
1754 card->index); in push_scqe()
1762 card->index, skb, index); in push_scqe()
1764 card->index, le32_to_cpu(tbd->word_1), le32_to_cpu(tbd->word_2), in push_scqe()
1786 ns_write_sram(card, scq->scd, &data, 1); in push_scqe()
1789 card->index); in push_scqe()
1818 card->index, le32_to_cpu(tsr.word_1), in push_scqe()
1829 card->index); in push_scqe()
1832 ns_write_sram(card, scq->scd, &data, 1); in push_scqe()
1839 static void process_tsq(ns_dev * card) in process_tsq() argument
1848 if (card->tsq.next == card->tsq.last) in process_tsq()
1849 one_ahead = card->tsq.base; in process_tsq()
1851 one_ahead = card->tsq.next + 1; in process_tsq()
1853 if (one_ahead == card->tsq.last) in process_tsq()
1854 two_ahead = card->tsq.base; in process_tsq()
1858 while (!ns_tsi_isempty(card->tsq.next) || !ns_tsi_isempty(one_ahead) || in process_tsq()
1865 while (ns_tsi_isempty(card->tsq.next)) { in process_tsq()
1866 if (card->tsq.next == card->tsq.last) in process_tsq()
1867 card->tsq.next = card->tsq.base; in process_tsq()
1869 card->tsq.next++; in process_tsq()
1872 if (!ns_tsi_tmrof(card->tsq.next)) { in process_tsq()
1873 scdi = ns_tsi_getscdindex(card->tsq.next); in process_tsq()
1875 scq = card->scq0; in process_tsq()
1877 if (card->scd2vc[scdi] == NULL) { in process_tsq()
1880 card->index); in process_tsq()
1881 ns_tsi_init(card->tsq.next); in process_tsq()
1884 scq = card->scd2vc[scdi]->scq; in process_tsq()
1886 drain_scq(card, scq, ns_tsi_getscqpos(card->tsq.next)); in process_tsq()
1891 ns_tsi_init(card->tsq.next); in process_tsq()
1892 previous = card->tsq.next; in process_tsq()
1893 if (card->tsq.next == card->tsq.last) in process_tsq()
1894 card->tsq.next = card->tsq.base; in process_tsq()
1896 card->tsq.next++; in process_tsq()
1898 if (card->tsq.next == card->tsq.last) in process_tsq()
1899 one_ahead = card->tsq.base; in process_tsq()
1901 one_ahead = card->tsq.next + 1; in process_tsq()
1903 if (one_ahead == card->tsq.last) in process_tsq()
1904 two_ahead = card->tsq.base; in process_tsq()
1910 writel(PTR_DIFF(previous, card->tsq.base), in process_tsq()
1911 card->membase + TSQH); in process_tsq()
1914 static void drain_scq(ns_dev * card, scq_info * scq, int pos) in drain_scq() argument
1922 card->index, scq, pos); in drain_scq()
1924 printk("nicstar%d: Bad index on drain_scq().\n", card->index); in drain_scq()
1935 card->index, skb, i); in drain_scq()
1937 dma_unmap_single(&card->pcidev->dev, in drain_scq()
1956 static void process_rsq(ns_dev * card) in process_rsq() argument
1960 if (!ns_rsqe_valid(card->rsq.next)) in process_rsq()
1963 dequeue_rx(card, card->rsq.next); in process_rsq()
1964 ns_rsqe_init(card->rsq.next); in process_rsq()
1965 previous = card->rsq.next; in process_rsq()
1966 if (card->rsq.next == card->rsq.last) in process_rsq()
1967 card->rsq.next = card->rsq.base; in process_rsq()
1969 card->rsq.next++; in process_rsq()
1970 } while (ns_rsqe_valid(card->rsq.next)); in process_rsq()
1971 writel(PTR_DIFF(previous, card->rsq.base), card->membase + RSQH); in process_rsq()
1974 static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe) in dequeue_rx() argument
1987 stat = readl(card->membase + STAT); in dequeue_rx()
1988 card->sbfqc = ns_stat_sfbqc_get(stat); in dequeue_rx()
1989 card->lbfqc = ns_stat_lfbqc_get(stat); in dequeue_rx()
1992 skb = idr_remove(&card->idr, id); in dequeue_rx()
1995 "nicstar%d: skb not found!\n", card->index); in dequeue_rx()
1998 dma_sync_single_for_cpu(&card->pcidev->dev, in dequeue_rx()
2003 dma_unmap_single(&card->pcidev->dev, in dequeue_rx()
2010 if (vpi >= 1UL << card->vpibits || vci >= 1UL << card->vcibits) { in dequeue_rx()
2012 card->index, vpi, vci); in dequeue_rx()
2013 recycle_rx_buf(card, skb); in dequeue_rx()
2017 vc = &(card->vcmap[vpi << card->vcibits | vci]); in dequeue_rx()
2020 card->index, vpi, vci); in dequeue_rx()
2021 recycle_rx_buf(card, skb); in dequeue_rx()
2038 card->index); in dequeue_rx()
2045 card->index); in dequeue_rx()
2065 recycle_rx_buf(card, skb); in dequeue_rx()
2072 iovb = skb_dequeue(&(card->iovpool.queue)); in dequeue_rx()
2077 card->index); in dequeue_rx()
2079 recycle_rx_buf(card, skb); in dequeue_rx()
2083 } else if (--card->iovpool.count < card->iovnr.min) { in dequeue_rx()
2088 skb_queue_tail(&card->iovpool.queue, new_iovb); in dequeue_rx()
2089 card->iovpool.count++; in dequeue_rx()
2101 printk("nicstar%d: received too big AAL5 SDU.\n", card->index); in dequeue_rx()
2103 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in dequeue_rx()
2120 card->index); in dequeue_rx()
2121 which_list(card, skb); in dequeue_rx()
2123 recycle_rx_buf(card, skb); in dequeue_rx()
2125 recycle_iov_buf(card, iovb); in dequeue_rx()
2133 card->index); in dequeue_rx()
2134 which_list(card, skb); in dequeue_rx()
2136 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in dequeue_rx()
2139 recycle_iov_buf(card, iovb); in dequeue_rx()
2153 printk("nicstar%d: AAL5 CRC error", card->index); in dequeue_rx()
2159 recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data, in dequeue_rx()
2162 recycle_iov_buf(card, iovb); in dequeue_rx()
2171 push_rxbufs(card, skb); in dequeue_rx()
2175 dequeue_sm_buf(card, skb); in dequeue_rx()
2189 push_rxbufs(card, sb); in dequeue_rx()
2193 dequeue_sm_buf(card, sb); in dequeue_rx()
2200 push_rxbufs(card, skb); in dequeue_rx()
2205 push_rxbufs(card, skb); in dequeue_rx()
2208 dequeue_lg_buf(card, skb); in dequeue_rx()
2219 push_rxbufs(card, sb); in dequeue_rx()
2229 hb = skb_dequeue(&(card->hbpool.queue)); in dequeue_rx()
2236 card->index); in dequeue_rx()
2238 recycle_iovec_rx_bufs(card, in dequeue_rx()
2243 recycle_iov_buf(card, iovb); in dequeue_rx()
2245 } else if (card->hbpool.count < card->hbnr.min) { in dequeue_rx()
2250 skb_queue_tail(&card->hbpool. in dequeue_rx()
2252 card->hbpool.count++; in dequeue_rx()
2256 } else if (--card->hbpool.count < card->hbnr.min) { in dequeue_rx()
2261 skb_queue_tail(&card->hbpool.queue, in dequeue_rx()
2263 card->hbpool.count++; in dequeue_rx()
2265 if (card->hbpool.count < card->hbnr.min) { in dequeue_rx()
2271 skb_queue_tail(&card->hbpool. in dequeue_rx()
2273 card->hbpool.count++; in dequeue_rx()
2281 recycle_iovec_rx_bufs(card, iov, in dequeue_rx()
2283 if (card->hbpool.count < card->hbnr.max) { in dequeue_rx()
2284 skb_queue_tail(&card->hbpool.queue, hb); in dequeue_rx()
2285 card->hbpool.count++; in dequeue_rx()
2298 push_rxbufs(card, sb); in dequeue_rx()
2311 push_rxbufs(card, lb); in dequeue_rx()
2317 card->index); in dequeue_rx()
2327 recycle_iov_buf(card, iovb); in dequeue_rx()
2332 static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb) in recycle_rx_buf() argument
2336 card->index); in recycle_rx_buf()
2339 push_rxbufs(card, skb); in recycle_rx_buf()
2342 static void recycle_iovec_rx_bufs(ns_dev * card, struct iovec *iov, int count) in recycle_iovec_rx_bufs() argument
2345 recycle_rx_buf(card, (struct sk_buff *)(iov++)->iov_base); in recycle_iovec_rx_bufs()
2348 static void recycle_iov_buf(ns_dev * card, struct sk_buff *iovb) in recycle_iov_buf() argument
2350 if (card->iovpool.count < card->iovnr.max) { in recycle_iov_buf()
2351 skb_queue_tail(&card->iovpool.queue, iovb); in recycle_iov_buf()
2352 card->iovpool.count++; in recycle_iov_buf()
2357 static void dequeue_sm_buf(ns_dev * card, struct sk_buff *sb) in dequeue_sm_buf() argument
2359 skb_unlink(sb, &card->sbpool.queue); in dequeue_sm_buf()
2360 if (card->sbfqc < card->sbnr.init) { in dequeue_sm_buf()
2364 skb_queue_tail(&card->sbpool.queue, new_sb); in dequeue_sm_buf()
2366 push_rxbufs(card, new_sb); in dequeue_sm_buf()
2369 if (card->sbfqc < card->sbnr.init) in dequeue_sm_buf()
2374 skb_queue_tail(&card->sbpool.queue, new_sb); in dequeue_sm_buf()
2376 push_rxbufs(card, new_sb); in dequeue_sm_buf()
2381 static void dequeue_lg_buf(ns_dev * card, struct sk_buff *lb) in dequeue_lg_buf() argument
2383 skb_unlink(lb, &card->lbpool.queue); in dequeue_lg_buf()
2384 if (card->lbfqc < card->lbnr.init) { in dequeue_lg_buf()
2388 skb_queue_tail(&card->lbpool.queue, new_lb); in dequeue_lg_buf()
2390 push_rxbufs(card, new_lb); in dequeue_lg_buf()
2393 if (card->lbfqc < card->lbnr.init) in dequeue_lg_buf()
2398 skb_queue_tail(&card->lbpool.queue, new_lb); in dequeue_lg_buf()
2400 push_rxbufs(card, new_lb); in dequeue_lg_buf()
2408 ns_dev *card; in ns_proc_read() local
2412 card = (ns_dev *) dev->dev_data; in ns_proc_read()
2413 stat = readl(card->membase + STAT); in ns_proc_read()
2418 ns_stat_sfbqc_get(stat), card->sbnr.min, in ns_proc_read()
2419 card->sbnr.init, card->sbnr.max); in ns_proc_read()
2422 ns_stat_lfbqc_get(stat), card->lbnr.min, in ns_proc_read()
2423 card->lbnr.init, card->lbnr.max); in ns_proc_read()
2426 card->hbpool.count, card->hbnr.min, in ns_proc_read()
2427 card->hbnr.init, card->hbnr.max); in ns_proc_read()
2430 card->iovpool.count, card->iovnr.min, in ns_proc_read()
2431 card->iovnr.init, card->iovnr.max); in ns_proc_read()
2435 sprintf(page, "Interrupt counter: %u \n", card->intcnt); in ns_proc_read()
2436 card->intcnt = 0; in ns_proc_read()
2443 if (card->max_pcr == ATM_25_PCR && !left--) { in ns_proc_read()
2448 while (CMD_BUSY(card)) ; in ns_proc_read()
2450 card->membase + CMD); in ns_proc_read()
2451 while (CMD_BUSY(card)) ; in ns_proc_read()
2452 phy_regs[i] = readl(card->membase + DR0) & 0x000000FF; in ns_proc_read()
2463 if (card->tste2vc[left + 1] == NULL) in ns_proc_read()
2467 card->tste2vc[left + 1]->tx_vcc->vpi, in ns_proc_read()
2468 card->tste2vc[left + 1]->tx_vcc->vci); in ns_proc_read()
2476 ns_dev *card; in ns_ioctl() local
2481 card = dev->dev_data; in ns_ioctl()
2490 ns_stat_sfbqc_get(readl(card->membase + STAT)); in ns_ioctl()
2491 pl.level.min = card->sbnr.min; in ns_ioctl()
2492 pl.level.init = card->sbnr.init; in ns_ioctl()
2493 pl.level.max = card->sbnr.max; in ns_ioctl()
2498 ns_stat_lfbqc_get(readl(card->membase + STAT)); in ns_ioctl()
2499 pl.level.min = card->lbnr.min; in ns_ioctl()
2500 pl.level.init = card->lbnr.init; in ns_ioctl()
2501 pl.level.max = card->lbnr.max; in ns_ioctl()
2505 pl.count = card->hbpool.count; in ns_ioctl()
2506 pl.level.min = card->hbnr.min; in ns_ioctl()
2507 pl.level.init = card->hbnr.init; in ns_ioctl()
2508 pl.level.max = card->hbnr.max; in ns_ioctl()
2512 pl.count = card->iovpool.count; in ns_ioctl()
2513 pl.level.min = card->iovnr.min; in ns_ioctl()
2514 pl.level.init = card->iovnr.init; in ns_ioctl()
2515 pl.level.max = card->iovnr.max; in ns_ioctl()
2541 card->sbnr.min = pl.level.min; in ns_ioctl()
2542 card->sbnr.init = pl.level.init; in ns_ioctl()
2543 card->sbnr.max = pl.level.max; in ns_ioctl()
2549 card->lbnr.min = pl.level.min; in ns_ioctl()
2550 card->lbnr.init = pl.level.init; in ns_ioctl()
2551 card->lbnr.max = pl.level.max; in ns_ioctl()
2557 card->hbnr.min = pl.level.min; in ns_ioctl()
2558 card->hbnr.init = pl.level.init; in ns_ioctl()
2559 card->hbnr.max = pl.level.max; in ns_ioctl()
2565 card->iovnr.min = pl.level.min; in ns_ioctl()
2566 card->iovnr.init = pl.level.init; in ns_ioctl()
2567 card->iovnr.max = pl.level.max; in ns_ioctl()
2582 while (card->sbfqc < card->sbnr.init) { in ns_ioctl()
2589 skb_queue_tail(&card->sbpool.queue, sb); in ns_ioctl()
2591 push_rxbufs(card, sb); in ns_ioctl()
2596 while (card->lbfqc < card->lbnr.init) { in ns_ioctl()
2603 skb_queue_tail(&card->lbpool.queue, lb); in ns_ioctl()
2605 push_rxbufs(card, lb); in ns_ioctl()
2610 while (card->hbpool.count > card->hbnr.init) { in ns_ioctl()
2613 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2614 hb = skb_dequeue(&card->hbpool.queue); in ns_ioctl()
2615 card->hbpool.count--; in ns_ioctl()
2616 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2620 card->index); in ns_ioctl()
2625 while (card->hbpool.count < card->hbnr.init) { in ns_ioctl()
2632 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2633 skb_queue_tail(&card->hbpool.queue, hb); in ns_ioctl()
2634 card->hbpool.count++; in ns_ioctl()
2635 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2640 while (card->iovpool.count > card->iovnr.init) { in ns_ioctl()
2643 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2644 iovb = skb_dequeue(&card->iovpool.queue); in ns_ioctl()
2645 card->iovpool.count--; in ns_ioctl()
2646 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2650 card->index); in ns_ioctl()
2655 while (card->iovpool.count < card->iovnr.init) { in ns_ioctl()
2662 spin_lock_irqsave(&card->int_lock, flags); in ns_ioctl()
2663 skb_queue_tail(&card->iovpool.queue, iovb); in ns_ioctl()
2664 card->iovpool.count++; in ns_ioctl()
2665 spin_unlock_irqrestore(&card->int_lock, flags); in ns_ioctl()
2679 printk("nicstar%d: %s == NULL \n", card->index, in ns_ioctl()
2687 static void which_list(ns_dev * card, struct sk_buff *skb) in which_list() argument
2696 ns_dev *card; in ns_poll() local
2702 card = cards[i]; in ns_poll()
2703 if (!spin_trylock_irqsave(&card->int_lock, flags)) { in ns_poll()
2709 stat_r = readl(card->membase + STAT); in ns_poll()
2715 process_tsq(card); in ns_poll()
2716 process_rsq(card); in ns_poll()
2718 writel(stat_w, card->membase + STAT); in ns_poll()
2719 spin_unlock_irqrestore(&card->int_lock, flags); in ns_poll()
2728 ns_dev *card; in ns_phy_put() local
2731 card = dev->dev_data; in ns_phy_put()
2732 spin_lock_irqsave(&card->res_lock, flags); in ns_phy_put()
2733 while (CMD_BUSY(card)) ; in ns_phy_put()
2734 writel((u32) value, card->membase + DR0); in ns_phy_put()
2736 card->membase + CMD); in ns_phy_put()
2737 spin_unlock_irqrestore(&card->res_lock, flags); in ns_phy_put()
2742 ns_dev *card; in ns_phy_get() local
2746 card = dev->dev_data; in ns_phy_get()
2747 spin_lock_irqsave(&card->res_lock, flags); in ns_phy_get()
2748 while (CMD_BUSY(card)) ; in ns_phy_get()
2750 card->membase + CMD); in ns_phy_get()
2751 while (CMD_BUSY(card)) ; in ns_phy_get()
2752 data = readl(card->membase + DR0) & 0x000000FF; in ns_phy_get()
2753 spin_unlock_irqrestore(&card->res_lock, flags); in ns_phy_get()