4 #include <linux/types.h>
5 #include <linux/list.h>
10 typedef void (*kmmio_pre_handler_t
)(struct kmmio_probe
*,
11 struct pt_regs
*, unsigned long addr
);
12 typedef void (*kmmio_post_handler_t
)(struct kmmio_probe
*,
13 unsigned long condition
, struct pt_regs
*);
16 struct list_head list
; /* kmmio internal list */
17 unsigned long addr
; /* start location of the probe point */
18 unsigned long len
; /* length of the probe region */
19 kmmio_pre_handler_t pre_handler
; /* Called before addr is executed. */
20 kmmio_post_handler_t post_handler
; /* Called after addr is executed */
24 /* kmmio is active by some kmmio_probes? */
25 static inline int is_kmmio_active(void)
27 extern unsigned int kmmio_count
;
31 extern int register_kmmio_probe(struct kmmio_probe
*p
);
32 extern void unregister_kmmio_probe(struct kmmio_probe
*p
);
34 /* Called from page fault handler. */
35 extern int kmmio_handler(struct pt_regs
*regs
, unsigned long addr
);
37 #ifdef CONFIG_MMIOTRACE
38 /* Called from ioremap.c */
39 extern void mmiotrace_ioremap(resource_size_t offset
, unsigned long size
,
41 extern void mmiotrace_iounmap(volatile void __iomem
*addr
);
43 /* For anyone to insert markers. Remember trailing newline. */
44 extern int mmiotrace_printk(const char *fmt
, ...)
45 __attribute__ ((format (printf
, 1, 2)));
47 static inline void mmiotrace_ioremap(resource_size_t offset
,
48 unsigned long size
, void __iomem
*addr
)
52 static inline void mmiotrace_iounmap(volatile void __iomem
*addr
)
56 static inline int mmiotrace_printk(const char *fmt
, ...)
57 __attribute__ ((format (printf
, 1, 0)));
59 static inline int mmiotrace_printk(const char *fmt
, ...)
63 #endif /* CONFIG_MMIOTRACE */
66 MMIO_READ
= 0x1, /* struct mmiotrace_rw */
67 MMIO_WRITE
= 0x2, /* struct mmiotrace_rw */
68 MMIO_PROBE
= 0x3, /* struct mmiotrace_map */
69 MMIO_UNPROBE
= 0x4, /* struct mmiotrace_map */
70 MMIO_UNKNOWN_OP
= 0x5, /* struct mmiotrace_rw */
74 resource_size_t phys
; /* PCI address of register */
76 unsigned long pc
; /* optional program counter */
78 unsigned char opcode
; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */
79 unsigned char width
; /* size of register access in bytes */
82 struct mmiotrace_map
{
83 resource_size_t phys
; /* base address in PCI space */
84 unsigned long virt
; /* base virtual address */
85 unsigned long len
; /* mapping size */
87 unsigned char opcode
; /* MMIO_PROBE or MMIO_UNPROBE */
90 /* in kernel/trace/trace_mmiotrace.c */
91 extern void enable_mmiotrace(void);
92 extern void disable_mmiotrace(void);
93 extern void mmio_trace_rw(struct mmiotrace_rw
*rw
);
94 extern void mmio_trace_mapping(struct mmiotrace_map
*map
);
95 extern int mmio_trace_printk(const char *fmt
, va_list args
);
97 #endif /* MMIOTRACE_H */