Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138928
b: refs/heads/master
c: ac26c18
h: refs/heads/master
v: v3
  • Loading branch information
David Woodhouse authored and Joerg Roedel committed Mar 17, 2009
1 parent 74b850c commit 73fde8b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a31fba5d68cebf8f5fefd03e079dab94875e25f5
refs/heads/master: ac26c18bd35d982d1ba06020a992b1085fefc3e2
6 changes: 6 additions & 0 deletions trunk/include/linux/dma-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ extern void debug_dma_sync_sg_for_device(struct device *dev,
struct scatterlist *sg,
int nelems, int direction);

extern void debug_dma_dump_mappings(struct device *dev);

#else /* CONFIG_DMA_API_DEBUG */

static inline void dma_debug_init(u32 num_entries)
Expand Down Expand Up @@ -156,6 +158,10 @@ static inline void debug_dma_sync_sg_for_device(struct device *dev,
{
}

static inline void debug_dma_dump_mappings(struct device *dev)
{
}

#endif /* CONFIG_DMA_API_DEBUG */

#endif /* __DMA_DEBUG_H */
30 changes: 30 additions & 0 deletions trunk/lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,36 @@ static void hash_bucket_del(struct dma_debug_entry *entry)
list_del(&entry->list);
}

/*
* Dump mapping entries for debugging purposes
*/
void debug_dma_dump_mappings(struct device *dev)
{
int idx;

for (idx = 0; idx < HASH_SIZE; idx++) {
struct hash_bucket *bucket = &dma_entry_hash[idx];
struct dma_debug_entry *entry;
unsigned long flags;

spin_lock_irqsave(&bucket->lock, flags);

list_for_each_entry(entry, &bucket->list, list) {
if (!dev || dev == entry->dev) {
dev_info(entry->dev,
"%s idx %d P=%Lx D=%Lx L=%Lx %s\n",
type2name[entry->type], idx,
(unsigned long long)entry->paddr,
entry->dev_addr, entry->size,
dir2name[entry->direction]);
}
}

spin_unlock_irqrestore(&bucket->lock, flags);
}
}
EXPORT_SYMBOL(debug_dma_dump_mappings);

/*
* Wrapper function for adding an entry to the hash.
* This function takes care of locking itself.
Expand Down

0 comments on commit 73fde8b

Please sign in to comment.