Blame view
include/linux/mmiotrace.h
3 KB
b814d41f0
|
1 2 |
#ifndef _LINUX_MMIOTRACE_H #define _LINUX_MMIOTRACE_H |
8b7d89d02
|
3 |
|
970e6fa03
|
4 |
#include <linux/types.h> |
0fd0e3da4
|
5 6 7 8 9 10 11 12 13 14 15 |
#include <linux/list.h> struct kmmio_probe; struct pt_regs; typedef void (*kmmio_pre_handler_t)(struct kmmio_probe *, struct pt_regs *, unsigned long addr); typedef void (*kmmio_post_handler_t)(struct kmmio_probe *, unsigned long condition, struct pt_regs *); struct kmmio_probe { |
b814d41f0
|
16 17 18 19 20 21 22 23 24 25 26 |
/* kmmio internal list: */ struct list_head list; /* start location of the probe point: */ unsigned long addr; /* length of the probe region: */ unsigned long len; /* Called before addr is executed: */ kmmio_pre_handler_t pre_handler; /* Called after addr is executed: */ kmmio_post_handler_t post_handler; void *private; |
0fd0e3da4
|
27 |
}; |
b814d41f0
|
28 29 30 31 |
extern unsigned int kmmio_count; extern int register_kmmio_probe(struct kmmio_probe *p); extern void unregister_kmmio_probe(struct kmmio_probe *p); |
0f9a623dd
|
32 33 |
extern int kmmio_init(void); extern void kmmio_cleanup(void); |
b814d41f0
|
34 35 |
#ifdef CONFIG_MMIOTRACE |
0fd0e3da4
|
36 37 38 |
/* kmmio is active by some kmmio_probes? */ static inline int is_kmmio_active(void) { |
0fd0e3da4
|
39 40 |
return kmmio_count; } |
0fd0e3da4
|
41 42 |
/* Called from page fault handler. */ extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); |
9e57fb35d
|
43 |
/* Called from ioremap.c */ |
dee310d0a
|
44 45 |
extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, void __iomem *addr); |
d61fc4485
|
46 |
extern void mmiotrace_iounmap(volatile void __iomem *addr); |
9e57fb35d
|
47 48 |
/* For anyone to insert markers. Remember trailing newline. */ |
b9075fa96
|
49 |
extern __printf(1, 2) int mmiotrace_printk(const char *fmt, ...); |
b814d41f0
|
50 51 52 53 54 55 56 57 58 59 |
#else /* !CONFIG_MMIOTRACE: */ static inline int is_kmmio_active(void) { return 0; } static inline int kmmio_handler(struct pt_regs *regs, unsigned long addr) { return 0; } |
dee310d0a
|
60 61 |
static inline void mmiotrace_ioremap(resource_size_t offset, unsigned long size, void __iomem *addr) |
d61fc4485
|
62 63 |
{ } |
dee310d0a
|
64 |
|
d61fc4485
|
65 66 67 |
static inline void mmiotrace_iounmap(volatile void __iomem *addr) { } |
9e57fb35d
|
68 |
|
b9075fa96
|
69 |
static inline __printf(1, 2) int mmiotrace_printk(const char *fmt, ...) |
9e57fb35d
|
70 71 72 73 |
{ return 0; } #endif /* CONFIG_MMIOTRACE */ |
d61fc4485
|
74 |
|
bd8ac686c
|
75 |
enum mm_io_opcode { |
b814d41f0
|
76 77 78 79 80 |
MMIO_READ = 0x1, /* struct mmiotrace_rw */ MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ MMIO_PROBE = 0x3, /* struct mmiotrace_map */ MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ |
8b7d89d02
|
81 |
}; |
bd8ac686c
|
82 |
struct mmiotrace_rw { |
b814d41f0
|
83 84 85 86 87 88 |
resource_size_t phys; /* PCI address of register */ unsigned long value; unsigned long pc; /* optional program counter */ int map_id; unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ unsigned char width; /* size of register access in bytes */ |
8b7d89d02
|
89 |
}; |
bd8ac686c
|
90 |
struct mmiotrace_map { |
b814d41f0
|
91 92 93 94 95 |
resource_size_t phys; /* base address in PCI space */ unsigned long virt; /* base virtual address */ unsigned long len; /* mapping size */ int map_id; unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ |
8b7d89d02
|
96 |
}; |
bd8ac686c
|
97 98 99 100 101 |
/* in kernel/trace/trace_mmiotrace.c */ extern void enable_mmiotrace(void); extern void disable_mmiotrace(void); extern void mmio_trace_rw(struct mmiotrace_rw *rw); extern void mmio_trace_mapping(struct mmiotrace_map *map); |
9e57fb35d
|
102 |
extern int mmio_trace_printk(const char *fmt, va_list args); |
8b7d89d02
|
103 |
|
b814d41f0
|
104 |
#endif /* _LINUX_MMIOTRACE_H */ |