aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ioat/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/ioat/dma.c')
-rw-r--r--drivers/dma/ioat/dma.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index a4d6cb0c0343..31493d80e0e9 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -40,6 +40,8 @@
40#include "registers.h" 40#include "registers.h"
41#include "hw.h" 41#include "hw.h"
42 42
43#include "../dmaengine.h"
44
43int ioat_pending_level = 4; 45int ioat_pending_level = 4;
44module_param(ioat_pending_level, int, 0644); 46module_param(ioat_pending_level, int, 0644);
45MODULE_PARM_DESC(ioat_pending_level, 47MODULE_PARM_DESC(ioat_pending_level,
@@ -107,6 +109,7 @@ void ioat_init_channel(struct ioatdma_device *device, struct ioat_chan_common *c
107 chan->reg_base = device->reg_base + (0x80 * (idx + 1)); 109 chan->reg_base = device->reg_base + (0x80 * (idx + 1));
108 spin_lock_init(&chan->cleanup_lock); 110 spin_lock_init(&chan->cleanup_lock);
109 chan->common.device = dma; 111 chan->common.device = dma;
112 dma_cookie_init(&chan->common);
110 list_add_tail(&chan->common.device_node, &dma->channels); 113 list_add_tail(&chan->common.device_node, &dma->channels);
111 device->idx[idx] = chan; 114 device->idx[idx] = chan;
112 init_timer(&chan->timer); 115 init_timer(&chan->timer);
@@ -235,12 +238,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
235 238
236 spin_lock_bh(&ioat->desc_lock); 239 spin_lock_bh(&ioat->desc_lock);
237 /* cookie incr and addition to used_list must be atomic */ 240 /* cookie incr and addition to used_list must be atomic */
238 cookie = c->cookie; 241 cookie = dma_cookie_assign(tx);
239 cookie++;
240 if (cookie < 0)
241 cookie = 1;
242 c->cookie = cookie;
243 tx->cookie = cookie;
244 dev_dbg(to_dev(&ioat->base), "%s: cookie: %d\n", __func__, cookie); 242 dev_dbg(to_dev(&ioat->base), "%s: cookie: %d\n", __func__, cookie);
245 243
246 /* write address into NextDescriptor field of last desc in chain */ 244 /* write address into NextDescriptor field of last desc in chain */
@@ -603,8 +601,7 @@ static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete)
603 */ 601 */
604 dump_desc_dbg(ioat, desc); 602 dump_desc_dbg(ioat, desc);
605 if (tx->cookie) { 603 if (tx->cookie) {
606 chan->completed_cookie = tx->cookie; 604 dma_cookie_complete(tx);
607 tx->cookie = 0;
608 ioat_dma_unmap(chan, tx->flags, desc->len, desc->hw); 605 ioat_dma_unmap(chan, tx->flags, desc->len, desc->hw);
609 ioat->active -= desc->hw->tx_cnt; 606 ioat->active -= desc->hw->tx_cnt;
610 if (tx->callback) { 607 if (tx->callback) {
@@ -733,13 +730,15 @@ ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie,
733{ 730{
734 struct ioat_chan_common *chan = to_chan_common(c); 731 struct ioat_chan_common *chan = to_chan_common(c);
735 struct ioatdma_device *device = chan->device; 732 struct ioatdma_device *device = chan->device;
733 enum dma_status ret;
736 734
737 if (ioat_tx_status(c, cookie, txstate) == DMA_SUCCESS) 735 ret = dma_cookie_status(c, cookie, txstate);
738 return DMA_SUCCESS; 736 if (ret == DMA_SUCCESS)
737 return ret;
739 738
740 device->cleanup_fn((unsigned long) c); 739 device->cleanup_fn((unsigned long) c);
741 740
742 return ioat_tx_status(c, cookie, txstate); 741 return dma_cookie_status(c, cookie, txstate);
743} 742}
744 743
745static void ioat1_dma_start_null_desc(struct ioat_dma_chan *ioat) 744static void ioat1_dma_start_null_desc(struct ioat_dma_chan *ioat)