diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2010-03-26 19:50:49 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-03-26 19:50:49 -0400 |
commit | 0793448187643b50af89d36b08470baf45a3cab4 (patch) | |
tree | b3313ff58d47e26a8cf707d196177effa1aadfbe /drivers/dma/ioat | |
parent | c3635c78e500a52c9fcd55de381a72928d9e054d (diff) |
DMAENGINE: generic channel status v2
Convert the device_is_tx_complete() operation on the
DMA engine to a generic device_tx_status()operation which
can return three states, DMA_TX_RUNNING, DMA_TX_COMPLETE,
DMA_TX_PAUSED.
[dan.j.williams@intel.com: update for timberdale]
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Li Yang <leoli@freescale.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Magnus Damm <damm@opensource.se>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Joe Perches <joe@perches.com>
Cc: Roland Dreier <rdreier@cisco.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/ioat')
-rw-r--r-- | drivers/dma/ioat/dma.c | 12 | ||||
-rw-r--r-- | drivers/dma/ioat/dma.h | 22 | ||||
-rw-r--r-- | drivers/dma/ioat/dma_v2.c | 2 | ||||
-rw-r--r-- | drivers/dma/ioat/dma_v3.c | 20 |
4 files changed, 28 insertions, 28 deletions
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 0099340b9616..59cebbfc89ec 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -726,18 +726,18 @@ static void ioat1_timer_event(unsigned long data) | |||
726 | } | 726 | } |
727 | 727 | ||
728 | enum dma_status | 728 | enum dma_status |
729 | ioat_is_dma_complete(struct dma_chan *c, dma_cookie_t cookie, | 729 | ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, |
730 | dma_cookie_t *done, dma_cookie_t *used) | 730 | struct dma_tx_state *txstate) |
731 | { | 731 | { |
732 | struct ioat_chan_common *chan = to_chan_common(c); | 732 | struct ioat_chan_common *chan = to_chan_common(c); |
733 | struct ioatdma_device *device = chan->device; | 733 | struct ioatdma_device *device = chan->device; |
734 | 734 | ||
735 | if (ioat_is_complete(c, cookie, done, used) == DMA_SUCCESS) | 735 | if (ioat_tx_status(c, cookie, txstate) == DMA_SUCCESS) |
736 | return DMA_SUCCESS; | 736 | return DMA_SUCCESS; |
737 | 737 | ||
738 | device->cleanup_fn((unsigned long) c); | 738 | device->cleanup_fn((unsigned long) c); |
739 | 739 | ||
740 | return ioat_is_complete(c, cookie, done, used); | 740 | return ioat_tx_status(c, cookie, txstate); |
741 | } | 741 | } |
742 | 742 | ||
743 | static void ioat1_dma_start_null_desc(struct ioat_dma_chan *ioat) | 743 | static void ioat1_dma_start_null_desc(struct ioat_dma_chan *ioat) |
@@ -857,7 +857,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device) | |||
857 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); | 857 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); |
858 | 858 | ||
859 | if (tmo == 0 || | 859 | if (tmo == 0 || |
860 | dma->device_is_tx_complete(dma_chan, cookie, NULL, NULL) | 860 | dma->device_tx_status(dma_chan, cookie, NULL) |
861 | != DMA_SUCCESS) { | 861 | != DMA_SUCCESS) { |
862 | dev_err(dev, "Self-test copy timed out, disabling\n"); | 862 | dev_err(dev, "Self-test copy timed out, disabling\n"); |
863 | err = -ENODEV; | 863 | err = -ENODEV; |
@@ -1198,7 +1198,7 @@ int __devinit ioat1_dma_probe(struct ioatdma_device *device, int dca) | |||
1198 | dma->device_issue_pending = ioat1_dma_memcpy_issue_pending; | 1198 | dma->device_issue_pending = ioat1_dma_memcpy_issue_pending; |
1199 | dma->device_alloc_chan_resources = ioat1_dma_alloc_chan_resources; | 1199 | dma->device_alloc_chan_resources = ioat1_dma_alloc_chan_resources; |
1200 | dma->device_free_chan_resources = ioat1_dma_free_chan_resources; | 1200 | dma->device_free_chan_resources = ioat1_dma_free_chan_resources; |
1201 | dma->device_is_tx_complete = ioat_is_dma_complete; | 1201 | dma->device_tx_status = ioat_dma_tx_status; |
1202 | 1202 | ||
1203 | err = ioat_probe(device); | 1203 | err = ioat_probe(device); |
1204 | if (err) | 1204 | if (err) |
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index 86b97ac8774e..23399672239e 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -142,15 +142,14 @@ static inline struct ioat_dma_chan *to_ioat_chan(struct dma_chan *c) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * ioat_is_complete - poll the status of an ioat transaction | 145 | * ioat_tx_status - poll the status of an ioat transaction |
146 | * @c: channel handle | 146 | * @c: channel handle |
147 | * @cookie: transaction identifier | 147 | * @cookie: transaction identifier |
148 | * @done: if set, updated with last completed transaction | 148 | * @txstate: if set, updated with the transaction state |
149 | * @used: if set, updated with last used transaction | ||
150 | */ | 149 | */ |
151 | static inline enum dma_status | 150 | static inline enum dma_status |
152 | ioat_is_complete(struct dma_chan *c, dma_cookie_t cookie, | 151 | ioat_tx_status(struct dma_chan *c, dma_cookie_t cookie, |
153 | dma_cookie_t *done, dma_cookie_t *used) | 152 | struct dma_tx_state *txstate) |
154 | { | 153 | { |
155 | struct ioat_chan_common *chan = to_chan_common(c); | 154 | struct ioat_chan_common *chan = to_chan_common(c); |
156 | dma_cookie_t last_used; | 155 | dma_cookie_t last_used; |
@@ -159,10 +158,11 @@ ioat_is_complete(struct dma_chan *c, dma_cookie_t cookie, | |||
159 | last_used = c->cookie; | 158 | last_used = c->cookie; |
160 | last_complete = chan->completed_cookie; | 159 | last_complete = chan->completed_cookie; |
161 | 160 | ||
162 | if (done) | 161 | if (txstate) { |
163 | *done = last_complete; | 162 | txstate->last = last_complete; |
164 | if (used) | 163 | txstate->used = last_used; |
165 | *used = last_used; | 164 | txstate->residue = 0; |
165 | } | ||
166 | 166 | ||
167 | return dma_async_is_complete(cookie, last_complete, last_used); | 167 | return dma_async_is_complete(cookie, last_complete, last_used); |
168 | } | 168 | } |
@@ -338,8 +338,8 @@ struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, | |||
338 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan); | 338 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan); |
339 | void ioat_init_channel(struct ioatdma_device *device, | 339 | void ioat_init_channel(struct ioatdma_device *device, |
340 | struct ioat_chan_common *chan, int idx); | 340 | struct ioat_chan_common *chan, int idx); |
341 | enum dma_status ioat_is_dma_complete(struct dma_chan *c, dma_cookie_t cookie, | 341 | enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, |
342 | dma_cookie_t *done, dma_cookie_t *used); | 342 | struct dma_tx_state *txstate); |
343 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | 343 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, |
344 | size_t len, struct ioat_dma_descriptor *hw); | 344 | size_t len, struct ioat_dma_descriptor *hw); |
345 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | 345 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 1ed5d66d7dca..f540e0be7f31 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -854,7 +854,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca) | |||
854 | dma->device_issue_pending = ioat2_issue_pending; | 854 | dma->device_issue_pending = ioat2_issue_pending; |
855 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; | 855 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; |
856 | dma->device_free_chan_resources = ioat2_free_chan_resources; | 856 | dma->device_free_chan_resources = ioat2_free_chan_resources; |
857 | dma->device_is_tx_complete = ioat_is_dma_complete; | 857 | dma->device_tx_status = ioat_tx_status; |
858 | 858 | ||
859 | err = ioat_probe(device); | 859 | err = ioat_probe(device); |
860 | if (err) | 860 | if (err) |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 26febc56dab1..d1adbf35268c 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -438,17 +438,17 @@ static void ioat3_timer_event(unsigned long data) | |||
438 | } | 438 | } |
439 | 439 | ||
440 | static enum dma_status | 440 | static enum dma_status |
441 | ioat3_is_complete(struct dma_chan *c, dma_cookie_t cookie, | 441 | ioat3_tx_status(struct dma_chan *c, dma_cookie_t cookie, |
442 | dma_cookie_t *done, dma_cookie_t *used) | 442 | struct dma_tx_state *txstate) |
443 | { | 443 | { |
444 | struct ioat2_dma_chan *ioat = to_ioat2_chan(c); | 444 | struct ioat2_dma_chan *ioat = to_ioat2_chan(c); |
445 | 445 | ||
446 | if (ioat_is_complete(c, cookie, done, used) == DMA_SUCCESS) | 446 | if (ioat_tx_status(c, cookie, txstate) == DMA_SUCCESS) |
447 | return DMA_SUCCESS; | 447 | return DMA_SUCCESS; |
448 | 448 | ||
449 | ioat3_cleanup_poll(ioat); | 449 | ioat3_cleanup_poll(ioat); |
450 | 450 | ||
451 | return ioat_is_complete(c, cookie, done, used); | 451 | return ioat_tx_status(c, cookie, txstate); |
452 | } | 452 | } |
453 | 453 | ||
454 | static struct dma_async_tx_descriptor * | 454 | static struct dma_async_tx_descriptor * |
@@ -976,7 +976,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device) | |||
976 | 976 | ||
977 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); | 977 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); |
978 | 978 | ||
979 | if (dma->device_is_tx_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { | 979 | if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_SUCCESS) { |
980 | dev_err(dev, "Self-test xor timed out\n"); | 980 | dev_err(dev, "Self-test xor timed out\n"); |
981 | err = -ENODEV; | 981 | err = -ENODEV; |
982 | goto free_resources; | 982 | goto free_resources; |
@@ -1030,7 +1030,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device) | |||
1030 | 1030 | ||
1031 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); | 1031 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); |
1032 | 1032 | ||
1033 | if (dma->device_is_tx_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { | 1033 | if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_SUCCESS) { |
1034 | dev_err(dev, "Self-test validate timed out\n"); | 1034 | dev_err(dev, "Self-test validate timed out\n"); |
1035 | err = -ENODEV; | 1035 | err = -ENODEV; |
1036 | goto free_resources; | 1036 | goto free_resources; |
@@ -1071,7 +1071,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device) | |||
1071 | 1071 | ||
1072 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); | 1072 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); |
1073 | 1073 | ||
1074 | if (dma->device_is_tx_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { | 1074 | if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_SUCCESS) { |
1075 | dev_err(dev, "Self-test memset timed out\n"); | 1075 | dev_err(dev, "Self-test memset timed out\n"); |
1076 | err = -ENODEV; | 1076 | err = -ENODEV; |
1077 | goto free_resources; | 1077 | goto free_resources; |
@@ -1114,7 +1114,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device) | |||
1114 | 1114 | ||
1115 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); | 1115 | tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); |
1116 | 1116 | ||
1117 | if (dma->device_is_tx_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { | 1117 | if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_SUCCESS) { |
1118 | dev_err(dev, "Self-test 2nd validate timed out\n"); | 1118 | dev_err(dev, "Self-test 2nd validate timed out\n"); |
1119 | err = -ENODEV; | 1119 | err = -ENODEV; |
1120 | goto free_resources; | 1120 | goto free_resources; |
@@ -1258,11 +1258,11 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1258 | 1258 | ||
1259 | 1259 | ||
1260 | if (is_raid_device) { | 1260 | if (is_raid_device) { |
1261 | dma->device_is_tx_complete = ioat3_is_complete; | 1261 | dma->device_tx_status = ioat3_tx_status; |
1262 | device->cleanup_fn = ioat3_cleanup_event; | 1262 | device->cleanup_fn = ioat3_cleanup_event; |
1263 | device->timer_fn = ioat3_timer_event; | 1263 | device->timer_fn = ioat3_timer_event; |
1264 | } else { | 1264 | } else { |
1265 | dma->device_is_tx_complete = ioat_is_dma_complete; | 1265 | dma->device_tx_status = ioat_dma_tx_status; |
1266 | device->cleanup_fn = ioat2_cleanup_event; | 1266 | device->cleanup_fn = ioat2_cleanup_event; |
1267 | device->timer_fn = ioat2_timer_event; | 1267 | device->timer_fn = ioat2_timer_event; |
1268 | } | 1268 | } |