1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2014 Google, Inc
10 static void do_print_stats(void)
12 ulong start, size, offset, count;
14 printf("iotrace is %sabled\n", iotrace_get_enabled() ? "en" : "dis");
15 iotrace_get_buffer(&start, &size, &offset, &count);
16 printf("Start: %08lx\n", start);
17 printf("Size: %08lx\n", size);
18 printf("Offset: %08lx\n", offset);
19 printf("Output: %08lx\n", start + offset);
20 printf("Count: %08lx\n", count);
21 printf("CRC32: %08lx\n", (ulong)iotrace_get_checksum());
24 static int do_set_buffer(int argc, char * const argv[])
26 ulong addr = 0, size = 0;
29 addr = simple_strtoul(*argv++, NULL, 16);
30 size = simple_strtoul(*argv++, NULL, 16);
31 } else if (argc != 0) {
35 iotrace_set_buffer(addr, size);
40 int do_iotrace(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
42 const char *cmd = argc < 2 ? NULL : argv[1];
45 return cmd_usage(cmdtp);
48 return do_set_buffer(argc - 2, argv + 2);
50 iotrace_set_enabled(0);
53 iotrace_set_enabled(1);
66 iotrace, 4, 1, do_iotrace,
67 "iotrace utility commands",
68 "stats - display iotrace stats\n"
69 "iotrace buffer <address> <size> - set iotrace buffer\n"
70 "iotrace pause - pause tracing\n"
71 "iotrace resume - resume tracing"