~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mmiotrace.h

Version: ~ [ linux-5.12-rc1 ] ~ [ linux-5.11.2 ] ~ [ linux-5.10.19 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.101 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.177 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.222 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.258 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.258 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp