diff options
Diffstat (limited to 'include/linux/mmiotrace.h')
-rw-r--r-- | include/linux/mmiotrace.h | 85 |
1 files changed, 25 insertions, 60 deletions
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index 579b3b06c90e..c88a9c197d22 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h | |||
@@ -54,73 +54,38 @@ static inline void mmiotrace_iounmap(volatile void __iomem *addr) | |||
54 | } | 54 | } |
55 | #endif /* CONFIG_MMIOTRACE_HOOKS */ | 55 | #endif /* CONFIG_MMIOTRACE_HOOKS */ |
56 | 56 | ||
57 | /* in kernel/trace/trace_mmiotrace.c */ | 57 | enum mm_io_opcode { |
58 | extern int __init init_mmiotrace(void); | 58 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ |
59 | extern void enable_mmiotrace(void); | 59 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ |
60 | extern void disable_mmiotrace(void); | 60 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ |
61 | extern void mmio_trace_record(u32 type, unsigned long addr, unsigned long arg); | 61 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ |
62 | |||
63 | #endif /* __KERNEL__ */ | ||
64 | |||
65 | |||
66 | /* | ||
67 | * If you change anything here, you must bump MMIO_VERSION. | ||
68 | * This is the relay data format for user space. | ||
69 | */ | ||
70 | #define MMIO_VERSION 0x04 | ||
71 | |||
72 | /* mm_io_header.type */ | ||
73 | #define MMIO_OPCODE_MASK 0xff | ||
74 | #define MMIO_OPCODE_SHIFT 0 | ||
75 | #define MMIO_WIDTH_MASK 0xff00 | ||
76 | #define MMIO_WIDTH_SHIFT 8 | ||
77 | #define MMIO_MAGIC (0x6f000000 | (MMIO_VERSION<<16)) | ||
78 | #define MMIO_MAGIC_MASK 0xffff0000 | ||
79 | |||
80 | enum mm_io_opcode { /* payload type: */ | ||
81 | MMIO_READ = 0x1, /* struct mm_io_rw */ | ||
82 | MMIO_WRITE = 0x2, /* struct mm_io_rw */ | ||
83 | MMIO_PROBE = 0x3, /* struct mm_io_map */ | ||
84 | MMIO_UNPROBE = 0x4, /* struct mm_io_map */ | ||
85 | MMIO_MARKER = 0x5, /* raw char data */ | 62 | MMIO_MARKER = 0x5, /* raw char data */ |
86 | MMIO_UNKNOWN_OP = 0x6, /* struct mm_io_rw */ | 63 | MMIO_UNKNOWN_OP = 0x6, /* struct mmiotrace_rw */ |
87 | }; | 64 | }; |
88 | 65 | ||
89 | struct mm_io_header { | 66 | struct mmiotrace_rw { |
90 | __u32 type; /* see MMIO_* macros above */ | 67 | unsigned long phys; /* PCI address of register */ |
91 | __u32 sec; /* timestamp */ | 68 | unsigned long value; |
92 | __u32 nsec; | 69 | unsigned long pc; /* optional program counter */ |
93 | __u32 pid; /* PID of the process, or 0 for kernel core */ | 70 | int map_id; |
94 | __u16 data_len; /* length of the following payload */ | 71 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ |
72 | unsigned char width; /* size of register access in bytes */ | ||
95 | }; | 73 | }; |
96 | 74 | ||
97 | struct mm_io_rw { | 75 | struct mmiotrace_map { |
98 | __u64 address; /* virtual address of register */ | 76 | unsigned long phys; /* base address in PCI space */ |
99 | __u64 value; | 77 | unsigned long virt; /* base virtual address */ |
100 | __u64 pc; /* optional program counter */ | 78 | unsigned long len; /* mapping size */ |
79 | int map_id; | ||
80 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ | ||
101 | }; | 81 | }; |
102 | 82 | ||
103 | struct mm_io_map { | 83 | /* in kernel/trace/trace_mmiotrace.c */ |
104 | __u64 phys; /* base address in PCI space */ | 84 | extern void enable_mmiotrace(void); |
105 | __u64 addr; /* base virtual address */ | 85 | extern void disable_mmiotrace(void); |
106 | __u64 len; /* mapping size */ | 86 | extern void mmio_trace_rw(struct mmiotrace_rw *rw); |
107 | __u64 pc; /* optional program counter */ | 87 | extern void mmio_trace_mapping(struct mmiotrace_map *map); |
108 | }; | ||
109 | |||
110 | |||
111 | /* | ||
112 | * These structures are used to allow a single relay_write() | ||
113 | * call to write a full packet. | ||
114 | */ | ||
115 | |||
116 | struct mm_io_header_rw { | ||
117 | struct mm_io_header header; | ||
118 | struct mm_io_rw rw; | ||
119 | } __attribute__((packed)); | ||
120 | 88 | ||
121 | struct mm_io_header_map { | 89 | #endif /* __KERNEL__ */ |
122 | struct mm_io_header header; | ||
123 | struct mm_io_map map; | ||
124 | } __attribute__((packed)); | ||
125 | 90 | ||
126 | #endif /* MMIOTRACE_H */ | 91 | #endif /* MMIOTRACE_H */ |