aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-01-09 08:38:50 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-03-05 14:35:19 -0500
commit6bfd4498764d6201399849d2e80fda95db7742c0 (patch)
tree71675d02878324a82036e75d3bd0e0457a33e12b /lib
parent972aa45ceaf65376f33aa75958fcaefc9e752fa4 (diff)
dma-debug: add checking for [alloc|free]_coherent
Impact: add debug callbacks for dma_[alloc|free]_coherent Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/dma-debug.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 26e40e93e0f2..44af837f68ef 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -692,3 +692,48 @@ void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
692} 692}
693EXPORT_SYMBOL(debug_dma_unmap_sg); 693EXPORT_SYMBOL(debug_dma_unmap_sg);
694 694
695void debug_dma_alloc_coherent(struct device *dev, size_t size,
696 dma_addr_t dma_addr, void *virt)
697{
698 struct dma_debug_entry *entry;
699
700 if (unlikely(global_disable))
701 return;
702
703 if (unlikely(virt == NULL))
704 return;
705
706 entry = dma_entry_alloc();
707 if (!entry)
708 return;
709
710 entry->type = dma_debug_coherent;
711 entry->dev = dev;
712 entry->paddr = virt_to_phys(virt);
713 entry->size = size;
714 entry->dev_addr = dma_addr;
715 entry->direction = DMA_BIDIRECTIONAL;
716
717 add_dma_entry(entry);
718}
719EXPORT_SYMBOL(debug_dma_alloc_coherent);
720
721void debug_dma_free_coherent(struct device *dev, size_t size,
722 void *virt, dma_addr_t addr)
723{
724 struct dma_debug_entry ref = {
725 .type = dma_debug_coherent,
726 .dev = dev,
727 .paddr = virt_to_phys(virt),
728 .dev_addr = addr,
729 .size = size,
730 .direction = DMA_BIDIRECTIONAL,
731 };
732
733 if (unlikely(global_disable))
734 return;
735
736 check_unmap(&ref);
737}
738EXPORT_SYMBOL(debug_dma_free_coherent);
739