aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2007-10-18 06:07:15 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:32 -0400
commit952184304fbf030f0133d8b66a91b2847dce729e (patch)
tree07a6ca0121cfa94bda58c0f49ac509f4b62fcf64
parent7f2b291f56d08e001454d16d3c92e175434898b3 (diff)
I/OAT: Add completion callback for async_tx interface use
The async_tx interface includes a completion callback. This adds support for using that callback, including using interrupts on completion. [akpm@linux-foundation.org: various fixes] Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/dma/ioat_dma.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 15906027c8de..7e4a785c2dff 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -212,6 +212,18 @@ static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx)
212 } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan))); 212 } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan)));
213 213
214 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 214 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
215 if (new->async_tx.callback) {
216 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
217 if (first != new) {
218 /* move callback into to last desc */
219 new->async_tx.callback = first->async_tx.callback;
220 new->async_tx.callback_param
221 = first->async_tx.callback_param;
222 first->async_tx.callback = NULL;
223 first->async_tx.callback_param = NULL;
224 }
225 }
226
215 new->tx_cnt = desc_count; 227 new->tx_cnt = desc_count;
216 new->async_tx.ack = orig_ack; /* client is in control of this ack */ 228 new->async_tx.ack = orig_ack; /* client is in control of this ack */
217 229
@@ -517,6 +529,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
517 pci_unmap_addr(desc, src), 529 pci_unmap_addr(desc, src),
518 pci_unmap_len(desc, len), 530 pci_unmap_len(desc, len),
519 PCI_DMA_TODEVICE); 531 PCI_DMA_TODEVICE);
532 if (desc->async_tx.callback) {
533 desc->async_tx.callback(
534 desc->async_tx.callback_param);
535 desc->async_tx.callback = NULL;
536 }
520 } 537 }
521 538
522 if (desc->async_tx.phys != phys_complete) { 539 if (desc->async_tx.phys != phys_complete) {
@@ -638,6 +655,12 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
638 */ 655 */
639#define IOAT_TEST_SIZE 2000 656#define IOAT_TEST_SIZE 2000
640 657
658static void ioat_dma_test_callback(void *dma_async_param)
659{
660 printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n",
661 dma_async_param);
662}
663
641/** 664/**
642 * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works. 665 * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works.
643 * @device: device to be tested 666 * @device: device to be tested
@@ -692,6 +715,8 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
692 addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, 715 addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE,
693 DMA_FROM_DEVICE); 716 DMA_FROM_DEVICE);
694 ioat_set_dest(addr, tx, 0); 717 ioat_set_dest(addr, tx, 0);
718 tx->callback = ioat_dma_test_callback;
719 tx->callback_param = (void *)0x8086;
695 cookie = ioat_tx_submit(tx); 720 cookie = ioat_tx_submit(tx);
696 if (cookie < 0) { 721 if (cookie < 0) {
697 dev_err(&device->pdev->dev, 722 dev_err(&device->pdev->dev,