8 #include <linux/list.h>
13 typedef void (*kmmio_pre_handler_t
)(struct kmmio_probe
*,
14 struct pt_regs
*, unsigned long addr
);
15 typedef void (*kmmio_post_handler_t
)(struct kmmio_probe
*,
16 unsigned long condition
, struct pt_regs
*);
19 struct list_head list
; /* kmmio internal list */
20 unsigned long addr
; /* start location of the probe point */
21 unsigned long len
; /* length of the probe region */
22 kmmio_pre_handler_t pre_handler
; /* Called before addr is executed. */
23 kmmio_post_handler_t post_handler
; /* Called after addr is executed */
27 /* kmmio is active by some kmmio_probes? */
28 static inline int is_kmmio_active(void)
30 extern unsigned int kmmio_count
;
34 extern int register_kmmio_probe(struct kmmio_probe
*p
);
35 extern void unregister_kmmio_probe(struct kmmio_probe
*p
);
37 /* Called from page fault handler. */
38 extern int kmmio_handler(struct pt_regs
*regs
, unsigned long addr
);
40 /* Called from ioremap.c */
41 #ifdef CONFIG_MMIOTRACE
43 mmiotrace_ioremap(unsigned long offset
, unsigned long size
, void __iomem
*addr
);
44 extern void mmiotrace_iounmap(volatile void __iomem
*addr
);
47 mmiotrace_ioremap(unsigned long offset
, unsigned long size
, void __iomem
*addr
)
50 static inline void mmiotrace_iounmap(volatile void __iomem
*addr
)
53 #endif /* CONFIG_MMIOTRACE_HOOKS */
56 MMIO_READ
= 0x1, /* struct mmiotrace_rw */
57 MMIO_WRITE
= 0x2, /* struct mmiotrace_rw */
58 MMIO_PROBE
= 0x3, /* struct mmiotrace_map */
59 MMIO_UNPROBE
= 0x4, /* struct mmiotrace_map */
60 MMIO_MARKER
= 0x5, /* raw char data */
61 MMIO_UNKNOWN_OP
= 0x6, /* struct mmiotrace_rw */
65 unsigned long phys
; /* PCI address of register */
67 unsigned long pc
; /* optional program counter */
69 unsigned char opcode
; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */
70 unsigned char width
; /* size of register access in bytes */
73 struct mmiotrace_map
{
74 unsigned long phys
; /* base address in PCI space */
75 unsigned long virt
; /* base virtual address */
76 unsigned long len
; /* mapping size */
78 unsigned char opcode
; /* MMIO_PROBE or MMIO_UNPROBE */
81 /* in kernel/trace/trace_mmiotrace.c */
82 extern void enable_mmiotrace(void);
83 extern void disable_mmiotrace(void);
84 extern void mmio_trace_rw(struct mmiotrace_rw
*rw
);
85 extern void mmio_trace_mapping(struct mmiotrace_map
*map
);
87 #endif /* __KERNEL__ */
89 #endif /* MMIOTRACE_H */