diff options
Diffstat (limited to 'drivers/dma/ioatdma.c')
-rw-r--r-- | drivers/dma/ioatdma.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c index 5fbe56b5cea0..41b18c5a3141 100644 --- a/drivers/dma/ioatdma.c +++ b/drivers/dma/ioatdma.c | |||
@@ -191,17 +191,12 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) | |||
191 | int i; | 191 | int i; |
192 | LIST_HEAD(tmp_list); | 192 | LIST_HEAD(tmp_list); |
193 | 193 | ||
194 | /* | 194 | /* have we already been set up? */ |
195 | * In-use bit automatically set by reading chanctrl | 195 | if (!list_empty(&ioat_chan->free_desc)) |
196 | * If 0, we got it, if 1, someone else did | 196 | return INITIAL_IOAT_DESC_COUNT; |
197 | */ | ||
198 | chanctrl = readw(ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET); | ||
199 | if (chanctrl & IOAT_CHANCTRL_CHANNEL_IN_USE) | ||
200 | return -EBUSY; | ||
201 | 197 | ||
202 | /* Setup register to interrupt and write completion status on error */ | 198 | /* Setup register to interrupt and write completion status on error */ |
203 | chanctrl = IOAT_CHANCTRL_CHANNEL_IN_USE | | 199 | chanctrl = IOAT_CHANCTRL_ERR_INT_EN | |
204 | IOAT_CHANCTRL_ERR_INT_EN | | ||
205 | IOAT_CHANCTRL_ANY_ERR_ABORT_EN | | 200 | IOAT_CHANCTRL_ANY_ERR_ABORT_EN | |
206 | IOAT_CHANCTRL_ERR_COMPLETION_EN; | 201 | IOAT_CHANCTRL_ERR_COMPLETION_EN; |
207 | writew(chanctrl, ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET); | 202 | writew(chanctrl, ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET); |
@@ -282,11 +277,6 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
282 | in_use_descs - 1); | 277 | in_use_descs - 1); |
283 | 278 | ||
284 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; | 279 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; |
285 | |||
286 | /* Tell hw the chan is free */ | ||
287 | chanctrl = readw(ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET); | ||
288 | chanctrl &= ~IOAT_CHANCTRL_CHANNEL_IN_USE; | ||
289 | writew(chanctrl, ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET); | ||
290 | } | 280 | } |
291 | 281 | ||
292 | static struct dma_async_tx_descriptor * | 282 | static struct dma_async_tx_descriptor * |
@@ -347,8 +337,7 @@ ioat_dma_prep_memcpy(struct dma_chan *chan, size_t len, int int_en) | |||
347 | new->async_tx.ack = 0; /* client is in control of this ack */ | 337 | new->async_tx.ack = 0; /* client is in control of this ack */ |
348 | new->async_tx.cookie = -EBUSY; | 338 | new->async_tx.cookie = -EBUSY; |
349 | 339 | ||
350 | pci_unmap_len_set(new, src_len, orig_len); | 340 | pci_unmap_len_set(new, len, orig_len); |
351 | pci_unmap_len_set(new, dst_len, orig_len); | ||
352 | spin_unlock_bh(&ioat_chan->desc_lock); | 341 | spin_unlock_bh(&ioat_chan->desc_lock); |
353 | 342 | ||
354 | return new ? &new->async_tx : NULL; | 343 | return new ? &new->async_tx : NULL; |
@@ -423,11 +412,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *chan) | |||
423 | */ | 412 | */ |
424 | pci_unmap_page(chan->device->pdev, | 413 | pci_unmap_page(chan->device->pdev, |
425 | pci_unmap_addr(desc, dst), | 414 | pci_unmap_addr(desc, dst), |
426 | pci_unmap_len(desc, dst_len), | 415 | pci_unmap_len(desc, len), |
427 | PCI_DMA_FROMDEVICE); | 416 | PCI_DMA_FROMDEVICE); |
428 | pci_unmap_page(chan->device->pdev, | 417 | pci_unmap_page(chan->device->pdev, |
429 | pci_unmap_addr(desc, src), | 418 | pci_unmap_addr(desc, src), |
430 | pci_unmap_len(desc, src_len), | 419 | pci_unmap_len(desc, len), |
431 | PCI_DMA_TODEVICE); | 420 | PCI_DMA_TODEVICE); |
432 | } | 421 | } |
433 | 422 | ||