diff options
author | Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | 2009-08-28 13:54:41 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-08-28 13:54:41 -0400 |
commit | 14e0e6796a0d460ac6f7727616161dc317bbbf3a (patch) | |
tree | 06ff0894445ad8b08aa15e479742131396e1021b /arch/arm/plat-omap/iommu.c | |
parent | 613f77696e2c489e87def86a443fb4889acb95aa (diff) |
OMAP: iommu: add initial debugfs support
This enables to peek the following data.
$ /debug/iommu/isp# ls
mem nr_tlb_entries regs
mmap pagetable tlb
$ /debug/iommu/isp# head pagetable
L: da: pa:
-----------------------------------------
2: 00001000 8ae4a002
2: 00002000 8e7bb002
2: 00003000 8ae49002
2: 00004000 8ae65002
.....
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/iommu.c')
-rw-r--r-- | arch/arm/plat-omap/iommu.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index 4a0301399013..4b6012707307 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c | |||
@@ -351,16 +351,14 @@ EXPORT_SYMBOL_GPL(flush_iotlb_all); | |||
351 | 351 | ||
352 | #if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) | 352 | #if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) |
353 | 353 | ||
354 | ssize_t iommu_dump_ctx(struct iommu *obj, char *buf) | 354 | ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) |
355 | { | 355 | { |
356 | ssize_t bytes; | ||
357 | |||
358 | if (!obj || !buf) | 356 | if (!obj || !buf) |
359 | return -EINVAL; | 357 | return -EINVAL; |
360 | 358 | ||
361 | clk_enable(obj->clk); | 359 | clk_enable(obj->clk); |
362 | 360 | ||
363 | bytes = arch_iommu->dump_ctx(obj, buf); | 361 | bytes = arch_iommu->dump_ctx(obj, buf, bytes); |
364 | 362 | ||
365 | clk_disable(obj->clk); | 363 | clk_disable(obj->clk); |
366 | 364 | ||
@@ -368,7 +366,7 @@ ssize_t iommu_dump_ctx(struct iommu *obj, char *buf) | |||
368 | } | 366 | } |
369 | EXPORT_SYMBOL_GPL(iommu_dump_ctx); | 367 | EXPORT_SYMBOL_GPL(iommu_dump_ctx); |
370 | 368 | ||
371 | static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs) | 369 | static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num) |
372 | { | 370 | { |
373 | int i; | 371 | int i; |
374 | struct iotlb_lock saved, l; | 372 | struct iotlb_lock saved, l; |
@@ -379,7 +377,7 @@ static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs) | |||
379 | iotlb_lock_get(obj, &saved); | 377 | iotlb_lock_get(obj, &saved); |
380 | memcpy(&l, &saved, sizeof(saved)); | 378 | memcpy(&l, &saved, sizeof(saved)); |
381 | 379 | ||
382 | for (i = 0; i < obj->nr_tlb_entries; i++) { | 380 | for (i = 0; i < num; i++) { |
383 | struct cr_regs tmp; | 381 | struct cr_regs tmp; |
384 | 382 | ||
385 | iotlb_lock_get(obj, &l); | 383 | iotlb_lock_get(obj, &l); |
@@ -402,18 +400,21 @@ static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs) | |||
402 | * @obj: target iommu | 400 | * @obj: target iommu |
403 | * @buf: output buffer | 401 | * @buf: output buffer |
404 | **/ | 402 | **/ |
405 | size_t dump_tlb_entries(struct iommu *obj, char *buf) | 403 | size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t bytes) |
406 | { | 404 | { |
407 | int i, n; | 405 | int i, num; |
408 | struct cr_regs *cr; | 406 | struct cr_regs *cr; |
409 | char *p = buf; | 407 | char *p = buf; |
410 | 408 | ||
411 | cr = kcalloc(obj->nr_tlb_entries, sizeof(*cr), GFP_KERNEL); | 409 | num = bytes / sizeof(*cr); |
410 | num = min(obj->nr_tlb_entries, num); | ||
411 | |||
412 | cr = kcalloc(num, sizeof(*cr), GFP_KERNEL); | ||
412 | if (!cr) | 413 | if (!cr) |
413 | return 0; | 414 | return 0; |
414 | 415 | ||
415 | n = __dump_tlb_entries(obj, cr); | 416 | num = __dump_tlb_entries(obj, cr, num); |
416 | for (i = 0; i < n; i++) | 417 | for (i = 0; i < num; i++) |
417 | p += iotlb_dump_cr(obj, cr + i, p); | 418 | p += iotlb_dump_cr(obj, cr + i, p); |
418 | kfree(cr); | 419 | kfree(cr); |
419 | 420 | ||