aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ioat_dma.c
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2007-10-18 06:07:13 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:32 -0400
commit5149fd010f404889b7d8f79159057791fbb817b1 (patch)
tree0ec09c009f35d59be64e3b952b6deba39b61f6e1 /drivers/dma/ioat_dma.c
parentdfe2299e7b35a0adfc87f04d3e725ccc508d7626 (diff)
I/OAT: clean up error handling and some print messages
Make better use of dev_err(), and catch an error where the transaction creation might fail. 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>
Diffstat (limited to 'drivers/dma/ioat_dma.c')
-rw-r--r--drivers/dma/ioat_dma.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 725f83f3eeb..c44f5517edb 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -267,7 +267,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
267 chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET); 267 chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
268 if (chanerr) { 268 if (chanerr) {
269 dev_err(&ioat_chan->device->pdev->dev, 269 dev_err(&ioat_chan->device->pdev->dev,
270 "ioatdma: CHANERR = %x, clearing\n", chanerr); 270 "CHANERR = %x, clearing\n", chanerr);
271 writel(chanerr, ioat_chan->reg_base + IOAT_CHANERR_OFFSET); 271 writel(chanerr, ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
272 } 272 }
273 273
@@ -276,7 +276,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
276 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); 276 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL);
277 if (!desc) { 277 if (!desc) {
278 dev_err(&ioat_chan->device->pdev->dev, 278 dev_err(&ioat_chan->device->pdev->dev,
279 "ioatdma: Only %d initial descriptors\n", i); 279 "Only %d initial descriptors\n", i);
280 break; 280 break;
281 } 281 }
282 list_add_tail(&desc->node, &tmp_list); 282 list_add_tail(&desc->node, &tmp_list);
@@ -342,7 +342,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
342 /* one is ok since we left it on there on purpose */ 342 /* one is ok since we left it on there on purpose */
343 if (in_use_descs > 1) 343 if (in_use_descs > 1)
344 dev_err(&ioat_chan->device->pdev->dev, 344 dev_err(&ioat_chan->device->pdev->dev,
345 "ioatdma: Freeing %d in use descriptors!\n", 345 "Freeing %d in use descriptors!\n",
346 in_use_descs - 1); 346 in_use_descs - 1);
347 347
348 ioat_chan->last_completion = ioat_chan->completion_addr = 0; 348 ioat_chan->last_completion = ioat_chan->completion_addr = 0;
@@ -482,7 +482,7 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
482 if ((ioat_chan->completion_virt->full & IOAT_CHANSTS_DMA_TRANSFER_STATUS) == 482 if ((ioat_chan->completion_virt->full & IOAT_CHANSTS_DMA_TRANSFER_STATUS) ==
483 IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED) { 483 IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED) {
484 dev_err(&ioat_chan->device->pdev->dev, 484 dev_err(&ioat_chan->device->pdev->dev,
485 "ioatdma: Channel halted, chanerr = %x\n", 485 "Channel halted, chanerr = %x\n",
486 readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET)); 486 readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET));
487 487
488 /* TODO do something to salvage the situation */ 488 /* TODO do something to salvage the situation */
@@ -643,7 +643,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
643 u8 *src; 643 u8 *src;
644 u8 *dest; 644 u8 *dest;
645 struct dma_chan *dma_chan; 645 struct dma_chan *dma_chan;
646 struct dma_async_tx_descriptor *tx; 646 struct dma_async_tx_descriptor *tx = NULL;
647 dma_addr_t addr; 647 dma_addr_t addr;
648 dma_cookie_t cookie; 648 dma_cookie_t cookie;
649 int err = 0; 649 int err = 0;
@@ -673,6 +673,13 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
673 } 673 }
674 674
675 tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0); 675 tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0);
676 if (!tx) {
677 dev_err(&device->pdev->dev,
678 "Self-test prep failed, disabling\n");
679 err = -ENODEV;
680 goto free_resources;
681 }
682
676 async_tx_ack(tx); 683 async_tx_ack(tx);
677 addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, 684 addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE,
678 DMA_TO_DEVICE); 685 DMA_TO_DEVICE);
@@ -686,13 +693,13 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
686 693
687 if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { 694 if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) {
688 dev_err(&device->pdev->dev, 695 dev_err(&device->pdev->dev,
689 "ioatdma: Self-test copy timed out, disabling\n"); 696 "Self-test copy timed out, disabling\n");
690 err = -ENODEV; 697 err = -ENODEV;
691 goto free_resources; 698 goto free_resources;
692 } 699 }
693 if (memcmp(src, dest, IOAT_TEST_SIZE)) { 700 if (memcmp(src, dest, IOAT_TEST_SIZE)) {
694 dev_err(&device->pdev->dev, 701 dev_err(&device->pdev->dev,
695 "ioatdma: Self-test copy failed compare, disabling\n"); 702 "Self-test copy failed compare, disabling\n");
696 err = -ENODEV; 703 err = -ENODEV;
697 goto free_resources; 704 goto free_resources;
698 } 705 }
@@ -730,6 +737,9 @@ static int ioat_dma_setup_interrupts(struct ioatdma_device *device)
730 goto msi; 737 goto msi;
731 if (!strcmp(ioat_interrupt_style, "intx")) 738 if (!strcmp(ioat_interrupt_style, "intx"))
732 goto intx; 739 goto intx;
740 dev_err(&device->pdev->dev, "invalid ioat_interrupt_style %s\n",
741 ioat_interrupt_style);
742 goto err_no_irq;
733 743
734msix: 744msix:
735 /* The number of MSI-X vectors should equal the number of channels */ 745 /* The number of MSI-X vectors should equal the number of channels */
@@ -906,9 +916,9 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev,
906 device->common.device_dependency_added = ioat_dma_dependency_added; 916 device->common.device_dependency_added = ioat_dma_dependency_added;
907 device->common.dev = &pdev->dev; 917 device->common.dev = &pdev->dev;
908 dev_err(&device->pdev->dev, 918 dev_err(&device->pdev->dev,
909 "ioatdma: Intel(R) I/OAT DMA Engine found," 919 "Intel(R) I/OAT DMA Engine found,"
910 " %d channels, device version 0x%02x\n", 920 " %d channels, device version 0x%02x, driver version %s\n",
911 device->common.chancnt, device->version); 921 device->common.chancnt, device->version, IOAT_DMA_VERSION);
912 922
913 err = ioat_dma_setup_interrupts(device); 923 err = ioat_dma_setup_interrupts(device);
914 if (err) 924 if (err)
@@ -932,7 +942,7 @@ err_dma_pool:
932 kfree(device); 942 kfree(device);
933err_kzalloc: 943err_kzalloc:
934 dev_err(&device->pdev->dev, 944 dev_err(&device->pdev->dev,
935 "ioatdma: Intel(R) I/OAT DMA Engine initialization failed\n"); 945 "Intel(R) I/OAT DMA Engine initialization failed\n");
936 return NULL; 946 return NULL;
937} 947}
938 948