aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-01-09 08:14:49 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-03-05 14:35:18 -0500
commitf62bc980e6fd26434012c0d5676ecb17179d9ee4 (patch)
tree515d946a1739eb9a6bbcce215d8be62ae5695b09 /lib/dma-debug.c
parent2d62ece14fe04168a7d16688ddd2d17ac472268c (diff)
dma-debug: add checking for map/unmap_page/single
Impact: add debug callbacks for dma_{un}map_[page|single] Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index d0cb47a4211e..a2ed2b769685 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -566,3 +566,56 @@ out:
566 566
567} 567}
568 568
569void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
570 size_t size, int direction, dma_addr_t dma_addr,
571 bool map_single)
572{
573 struct dma_debug_entry *entry;
574
575 if (unlikely(global_disable))
576 return;
577
578 if (unlikely(dma_mapping_error(dev, dma_addr)))
579 return;
580
581 entry = dma_entry_alloc();
582 if (!entry)
583 return;
584
585 entry->dev = dev;
586 entry->type = dma_debug_page;
587 entry->paddr = page_to_phys(page) + offset;
588 entry->dev_addr = dma_addr;
589 entry->size = size;
590 entry->direction = direction;
591
592 if (map_single) {
593 entry->type = dma_debug_single;
594 check_for_stack(dev, page_address(page) + offset);
595 }
596
597 add_dma_entry(entry);
598}
599EXPORT_SYMBOL(debug_dma_map_page);
600
601void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
602 size_t size, int direction, bool map_single)
603{
604 struct dma_debug_entry ref = {
605 .type = dma_debug_page,
606 .dev = dev,
607 .dev_addr = addr,
608 .size = size,
609 .direction = direction,
610 };
611
612 if (unlikely(global_disable))
613 return;
614
615 if (map_single)
616 ref.type = dma_debug_single;
617
618 check_unmap(&ref);
619}
620EXPORT_SYMBOL(debug_dma_unmap_page);
621