9 #include <linux/kernel.h>
11 #include <linux/pci.h>
12 #include <linux/slab.h>
13 #include <linux/time.h>
25 static bool overrun_detected;
26 static unsigned long prev_overruns;
31 overrun_detected =
false;
40 mmio_trace_array = tr;
53 mmio_trace_array =
NULL;
78 for (i = 0; i < 7; i++) {
81 (
unsigned long long)(start |
84 for (i = 0; i < 7; i++) {
88 (
unsigned long long)(end - start) + 1 : 0);
97 static void destroy_header_iter(
struct header_iter *hiter)
124 destroy_header_iter(hiter);
133 if (over > prev_overruns)
134 cnt += over - prev_overruns;
135 prev_overruns = over;
140 char __user *ubuf,
size_t cnt, loff_t *ppos)
147 n = count_overruns(iter);
151 if (!overrun_detected)
153 overrun_detected =
true;
160 mmio_print_pcidev(s, hiter->
dev);
164 destroy_header_iter(hiter);
176 struct trace_mmiotrace_rw *
field;
181 unsigned secs = (
unsigned long)t;
190 "R %d %u.%06lu %d 0x%llx 0x%lx 0x%lx %d\n",
192 (
unsigned long long)rw->
phys,
197 "W %d %u.%06lu %d 0x%llx 0x%lx 0x%lx %d\n",
199 (
unsigned long long)rw->
phys,
204 "UNKNOWN %u.%06lu %d 0x%llx %02lx,%02lx,"
206 secs, usec_rem, rw->
map_id,
207 (
unsigned long long)rw->
phys,
208 (rw->
value >> 16) & 0xff, (rw->
value >> 8) & 0xff,
209 (rw->
value >> 0) & 0xff, rw->
pc, 0);
223 struct trace_mmiotrace_map *
field;
228 unsigned secs = (
unsigned long)t;
237 "MAP %u.%06lu %d 0x%llx 0x%lx 0x%lx 0x%lx %d\n",
238 secs, usec_rem, m->
map_id,
244 "UNMAP %u.%06lu %d 0x%lx %d\n",
259 struct print_entry *print = (
struct print_entry *)entry;
260 const char *
msg = print->buf;
264 unsigned secs = (
unsigned long)t;
277 switch (iter->
ent->type) {
279 return mmio_print_rw(iter);
281 return mmio_print_map(iter);
283 return mmio_print_mark(iter);
292 .init = mmio_trace_init,
293 .reset = mmio_trace_reset,
294 .start = mmio_trace_start,
295 .pipe_open = mmio_pipe_open,
298 .print_line = mmio_print_line,
301 __init static int init_mmio_trace(
void)
314 struct trace_mmiotrace_rw *
entry;
318 sizeof(*entry), 0, pc);
326 if (!filter_check_discard(call, entry, buffer, event))
334 __trace_mmiotrace_rw(tr, data, rw);
337 static void __trace_mmiotrace_map(
struct trace_array *tr,
344 struct trace_mmiotrace_map *
entry;
348 sizeof(*entry), 0, pc);
356 if (!filter_check_discard(call, entry, buffer, event))
367 __trace_mmiotrace_map(tr, data, map);