820 RBP_THRESH(CONFIG_RBPS_THRESH) |
821 RBP_QSIZE(CONFIG_RBPS_SIZE - 1) |
822 RBP_INT_ENB,
823 G0_RBPS_QI + (group * 32));
824
825
826 he_dev->rbpl_pool = pci_pool_create("rbpl", he_dev->pci_dev,
827 CONFIG_RBPL_BUFSIZE, 8, 0);
828 if (he_dev->rbpl_pool == NULL) {
829 hprintk("unable to create rbpl pool\n");
830 return -ENOMEM;
831 }
832
833 he_dev->rbpl_base = pci_alloc_consistent(he_dev->pci_dev,
834 CONFIG_RBPL_SIZE * sizeof(struct he_rbp), &he_dev->rbpl_phys);
835 if (he_dev->rbpl_base == NULL) {
836 hprintk("failed to alloc rbpl\n");
837 return -ENOMEM;
838 }
839 memset(he_dev->rbpl_base, 0, CONFIG_RBPL_SIZE * sizeof(struct he_rbp));
840 he_dev->rbpl_virt = kmalloc(CONFIG_RBPL_SIZE * sizeof(struct he_virt), GFP_KERNEL);
841
842 for (i = 0; i < CONFIG_RBPL_SIZE; ++i) {
843 dma_addr_t dma_handle;
844 void *cpuaddr;
845
846 cpuaddr = pci_pool_alloc(he_dev->rbpl_pool, GFP_KERNEL|GFP_DMA, &dma_handle);
847 if (cpuaddr == NULL)
848 return -ENOMEM;
849
850 he_dev->rbpl_virt[i].virt = cpuaddr;
851 he_dev->rbpl_base[i].status = RBP_LOANED | (i << RBP_INDEX_OFF);
852 he_dev->rbpl_base[i].phys = dma_handle;
853 }
854 he_dev->rbpl_tail = &he_dev->rbpl_base[CONFIG_RBPL_SIZE - 1];
855
856 he_writel(he_dev, he_dev->rbpl_phys, G0_RBPL_S + (group * 32));
857 he_writel(he_dev, RBPL_MASK(he_dev->rbpl_tail),
858 G0_RBPL_T + (group * 32));
859 he_writel(he_dev, CONFIG_RBPL_BUFSIZE/4,
860 G0_RBPL_BS + (group * 32));