2 * Copyright (c) 2014 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
11 static void do_print_stats(void)
13 ulong start, size, offset, count;
15 printf("iotrace is %sabled\n", iotrace_get_enabled() ? "en" : "dis");
16 iotrace_get_buffer(&start, &size, &offset, &count);
17 printf("Start: %08lx\n", start);
18 printf("Size: %08lx\n", size);
19 printf("Offset: %08lx\n", offset);
20 printf("Output: %08lx\n", start + offset);
21 printf("Count: %08lx\n", count);
22 printf("CRC32: %08lx\n", (ulong)iotrace_get_checksum());
25 static int do_set_buffer(int argc, char * const argv[])
27 ulong addr = 0, size = 0;
30 addr = simple_strtoul(*argv++, NULL, 16);
31 size = simple_strtoul(*argv++, NULL, 16);
32 } else if (argc != 0) {
36 iotrace_set_buffer(addr, size);
41 int do_iotrace(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
43 const char *cmd = argc < 2 ? NULL : argv[1];
46 return cmd_usage(cmdtp);
49 return do_set_buffer(argc - 2, argv + 2);
51 iotrace_set_enabled(0);
54 iotrace_set_enabled(1);
67 iotrace, 4, 1, do_iotrace,
68 "iotrace utility commands",
69 "stats - display iotrace stats\n"
70 "iotrace buffer <address> <size> - set iotrace buffer\n"
71 "iotrace pause - pause tracing\n"
72 "iotrace resume - resume tracing"