diff options
author | Shannon Nelson <shannon.nelson@intel.com> | 2007-10-18 06:07:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:32 -0400 |
commit | 5149fd010f404889b7d8f79159057791fbb817b1 (patch) | |
tree | 0ec09c009f35d59be64e3b952b6deba39b61f6e1 /drivers | |
parent | dfe2299e7b35a0adfc87f04d3e725ccc508d7626 (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')
-rw-r--r-- | drivers/dma/ioat.c | 3 | ||||
-rw-r--r-- | drivers/dma/ioat_dca.c | 12 | ||||
-rw-r--r-- | drivers/dma/ioat_dma.c | 32 | ||||
-rw-r--r-- | drivers/dma/ioatdma.h | 2 |
4 files changed, 31 insertions, 18 deletions
diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c index a45872f32d50..f204c39fb412 100644 --- a/drivers/dma/ioat.c +++ b/drivers/dma/ioat.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "ioatdma_registers.h" | 34 | #include "ioatdma_registers.h" |
35 | #include "ioatdma_hw.h" | 35 | #include "ioatdma_hw.h" |
36 | 36 | ||
37 | MODULE_VERSION("1.24"); | 37 | MODULE_VERSION(IOAT_DMA_VERSION); |
38 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
39 | MODULE_AUTHOR("Intel Corporation"); | 39 | MODULE_AUTHOR("Intel Corporation"); |
40 | 40 | ||
@@ -85,6 +85,7 @@ static void ioat_shutdown_functionality(struct pci_dev *pdev) | |||
85 | { | 85 | { |
86 | struct ioat_device *device = pci_get_drvdata(pdev); | 86 | struct ioat_device *device = pci_get_drvdata(pdev); |
87 | 87 | ||
88 | dev_err(&pdev->dev, "Removing dma and dca services\n"); | ||
88 | if (device->dca) { | 89 | if (device->dca) { |
89 | unregister_dca_provider(device->dca); | 90 | unregister_dca_provider(device->dca); |
90 | free_dca_provider(device->dca); | 91 | free_dca_provider(device->dca); |
diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c index 2ae04c30edeb..ba985715b803 100644 --- a/drivers/dma/ioat_dca.c +++ b/drivers/dma/ioat_dca.c | |||
@@ -65,7 +65,7 @@ static inline u16 dcaid_from_pcidev(struct pci_dev *pci) | |||
65 | return (pci->bus->number << 8) | pci->devfn; | 65 | return (pci->bus->number << 8) | pci->devfn; |
66 | } | 66 | } |
67 | 67 | ||
68 | static int dca_enabled_in_bios(void) | 68 | static int dca_enabled_in_bios(struct pci_dev *pdev) |
69 | { | 69 | { |
70 | /* CPUID level 9 returns DCA configuration */ | 70 | /* CPUID level 9 returns DCA configuration */ |
71 | /* Bit 0 indicates DCA enabled by the BIOS */ | 71 | /* Bit 0 indicates DCA enabled by the BIOS */ |
@@ -75,17 +75,17 @@ static int dca_enabled_in_bios(void) | |||
75 | cpuid_level_9 = cpuid_eax(9); | 75 | cpuid_level_9 = cpuid_eax(9); |
76 | res = test_bit(0, &cpuid_level_9); | 76 | res = test_bit(0, &cpuid_level_9); |
77 | if (!res) | 77 | if (!res) |
78 | printk(KERN_ERR "ioat dma: DCA is disabled in BIOS\n"); | 78 | dev_err(&pdev->dev, "DCA is disabled in BIOS\n"); |
79 | 79 | ||
80 | return res; | 80 | return res; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int system_has_dca_enabled(void) | 83 | static int system_has_dca_enabled(struct pci_dev *pdev) |
84 | { | 84 | { |
85 | if (boot_cpu_has(X86_FEATURE_DCA)) | 85 | if (boot_cpu_has(X86_FEATURE_DCA)) |
86 | return dca_enabled_in_bios(); | 86 | return dca_enabled_in_bios(pdev); |
87 | 87 | ||
88 | printk(KERN_ERR "ioat dma: boot cpu doesn't have X86_FEATURE_DCA\n"); | 88 | dev_err(&pdev->dev, "boot cpu doesn't have X86_FEATURE_DCA\n"); |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
@@ -208,7 +208,7 @@ struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase) | |||
208 | int i; | 208 | int i; |
209 | int err; | 209 | int err; |
210 | 210 | ||
211 | if (!system_has_dca_enabled()) | 211 | if (!system_has_dca_enabled(pdev)) |
212 | return NULL; | 212 | return NULL; |
213 | 213 | ||
214 | /* I/OAT v1 systems must have a known tag_map to support DCA */ | 214 | /* I/OAT v1 systems must have a known tag_map to support DCA */ |
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 725f83f3eeb3..c44f5517edbd 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 | ||
734 | msix: | 744 | msix: |
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); |
933 | err_kzalloc: | 943 | err_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 | ||
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h index 2a319e124ece..d3643f264507 100644 --- a/drivers/dma/ioatdma.h +++ b/drivers/dma/ioatdma.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/cache.h> | 28 | #include <linux/cache.h> |
29 | #include <linux/pci_ids.h> | 29 | #include <linux/pci_ids.h> |
30 | 30 | ||
31 | #define IOAT_DMA_VERSION "1.26" | ||
32 | |||
31 | enum ioat_interrupt { | 33 | enum ioat_interrupt { |
32 | none = 0, | 34 | none = 0, |
33 | msix_multi_vector = 1, | 35 | msix_multi_vector = 1, |