Thread: [Linux1394-cvslog] rev 608 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2002-10-13 22:07:50
|
Author: bencollins Date: 2002-10-13 18:07:44 -0400 (Sun, 13 Oct 2002) New Revision: 608 Modified: trunk/ohci1394.c trunk/ohci1394.h Log: Use a pci_pool (DMA consistent pool) for d->prg allocations. Modified: trunk/ohci1394.c ============================================================================== --- trunk/ohci1394.c (original) +++ trunk/ohci1394.c 2002-10-13 18:07:45.000000000 -0400 @@ -398,7 +398,7 @@ c = DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_BRANCH; if (generate_irq) c |= DMA_CTL_IRQ; - + d->prg_cpu[i]->control = cpu_to_le32(c | d->buf_size); /* End of descriptor list? */ @@ -1560,11 +1560,11 @@ if (d->prg_cpu) { for (i=0; i<d->num_desc; i++) if (d->prg_cpu[i] && d->prg_bus[i]) { - pci_free_consistent( - d->ohci->dev, sizeof(struct dma_cmd), - d->prg_cpu[i], d->prg_bus[i]); + pci_pool_free(d->prg_pool, d->prg_cpu[i], d->prg_bus[i]); OHCI_DMA_FREE("consistent dma_rcv prg[%d]", i); } + pci_pool_destroy(d->prg_pool); + OHCI_DMA_FREE("dma_rcv prg pool"); kfree(d->prg_cpu); kfree(d->prg_bus); } @@ -1624,6 +1624,10 @@ return -ENOMEM; } + d->prg_pool = pci_pool_create("ohci1394 rcv prg", ohci->dev, + sizeof(struct dma_cmd), 4, 0, SLAB_KERNEL); + OHCI_DMA_ALLOC("dma_rcv prg pool"); + for (i=0; i<d->num_desc; i++) { d->buf_cpu[i] = pci_alloc_consistent(ohci->dev, d->buf_size, @@ -1639,11 +1643,8 @@ return -ENOMEM; } - - d->prg_cpu[i] = pci_alloc_consistent(ohci->dev, - sizeof(struct dma_cmd), - d->prg_bus+i); - OHCI_DMA_ALLOC("consistent dma_rcv prg[%d]", i); + d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, SLAB_KERNEL, d->prg_bus+i); + OHCI_DMA_ALLOC("pool dma_rcv prg[%d]", i); if (d->prg_cpu[i] != NULL) { memset(d->prg_cpu[i], 0, sizeof(struct dma_cmd)); @@ -1692,11 +1693,11 @@ if (d->prg_cpu) { for (i=0; i<d->num_desc; i++) if (d->prg_cpu[i] && d->prg_bus[i]) { - pci_free_consistent( - d->ohci->dev, sizeof(struct at_dma_prg), - d->prg_cpu[i], d->prg_bus[i]); - OHCI_DMA_FREE("consistent dma_trm prg[%d]", i); + pci_pool_free(d->prg_pool, d->prg_cpu[i], d->prg_bus[i]); + OHCI_DMA_FREE("pool dma_trm prg[%d]", i); } + pci_pool_destroy(d->prg_pool); + OHCI_DMA_FREE("dma_trm prg pool"); kfree(d->prg_cpu); kfree(d->prg_bus); } @@ -1732,11 +1733,13 @@ memset(d->prg_cpu, 0, d->num_desc * sizeof(struct at_dma_prg*)); memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t)); + d->prg_pool = pci_pool_create("ohci1394 trm prg", ohci->dev, + sizeof(struct at_dma_prg), 4, 0, SLAB_KERNEL); + OHCI_DMA_ALLOC("dma_rcv prg pool"); + for (i = 0; i < d->num_desc; i++) { - d->prg_cpu[i] = pci_alloc_consistent(ohci->dev, - sizeof(struct at_dma_prg), - d->prg_bus+i); - OHCI_DMA_ALLOC("consistent dma_trm prg[%d]", i); + d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, SLAB_KERNEL, d->prg_bus+i); + OHCI_DMA_ALLOC("pool dma_trm prg[%d]", i); if (d->prg_cpu[i] != NULL) { memset(d->prg_cpu[i], 0, sizeof(struct at_dma_prg)); Modified: trunk/ohci1394.h ============================================================================== --- trunk/ohci1394.h (original) +++ trunk/ohci1394.h 2002-10-13 18:07:45.000000000 -0400 @@ -95,6 +95,7 @@ /* dma block descriptors */ struct dma_cmd **prg_cpu; dma_addr_t *prg_bus; + struct pci_pool *prg_pool; /* dma buffers */ quadlet_t **buf_cpu; @@ -120,6 +121,7 @@ /* dma block descriptors */ struct at_dma_prg **prg_cpu; dma_addr_t *prg_bus; + struct pci_pool *prg_pool; unsigned int prg_ind; unsigned int sent_ind; |