2 * Copyright (c) 2012, Google Inc. All rights reserved.
4 * SPDX-License-Identifier: GPL-2.0+
9 static int do_bootstage_report(cmd_tbl_t *cmdtp, int flag, int argc,
17 static int get_base_size(int argc, char * const argv[], ulong *basep,
22 *basep = CONFIG_BOOTSTAGE_STASH_ADDR;
23 *sizep = CONFIG_BOOTSTAGE_STASH_SIZE;
26 *basep = simple_strtoul(argv[1], &endp, 16);
27 if (*argv[1] == 0 || *endp != 0)
31 *sizep = simple_strtoul(argv[2], &endp, 16);
32 if (*argv[2] == 0 || *endp != 0)
38 static int do_bootstage_stash(cmd_tbl_t *cmdtp, int flag, int argc,
44 if (get_base_size(argc, argv, &base, &size))
47 printf("No bootstage stash area defined\n");
51 if (0 == strcmp(argv[0], "stash"))
52 ret = bootstage_stash((void *)base, size);
54 ret = bootstage_unstash((void *)base, size);
61 static cmd_tbl_t cmd_bootstage_sub[] = {
62 U_BOOT_CMD_MKENT(report, 2, 1, do_bootstage_report, "", ""),
63 U_BOOT_CMD_MKENT(stash, 4, 0, do_bootstage_stash, "", ""),
64 U_BOOT_CMD_MKENT(unstash, 4, 0, do_bootstage_stash, "", ""),
68 * Process a bootstage sub-command
70 static int do_boostage(cmd_tbl_t *cmdtp, int flag, int argc,
75 /* Strip off leading 'bootstage' command argument */
79 c = find_cmd_tbl(argv[0], cmd_bootstage_sub,
80 ARRAY_SIZE(cmd_bootstage_sub));
83 return c->cmd(cmdtp, flag, argc, argv);
89 U_BOOT_CMD(bootstage, 4, 1, do_boostage,
91 " - check boot progress and timing\n"
92 "report - Print a report\n"
93 "stash [<start> [<size>]] - Stash data into memory\n"
94 "unstash [<start> [<size>]] - Unstash data from memory"