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