2 * Copyright (c) 2012, Google Inc. All rights reserved.
4 * SPDX-License-Identifier: GPL-2.0+
9 #ifndef CONFIG_BOOTSTAGE_STASH
10 #define CONFIG_BOOTSTAGE_STASH -1UL
11 #define CONFIG_BOOTSTAGE_STASH_SIZE -1
14 static int do_bootstage_report(cmd_tbl_t *cmdtp, int flag, int argc,
22 static int get_base_size(int argc, char * const argv[], ulong *basep,
27 *basep = CONFIG_BOOTSTAGE_STASH;
28 *sizep = CONFIG_BOOTSTAGE_STASH_SIZE;
31 *basep = simple_strtoul(argv[1], &endp, 16);
32 if (*argv[1] == 0 || *endp != 0)
36 *sizep = simple_strtoul(argv[2], &endp, 16);
37 if (*argv[2] == 0 || *endp != 0)
43 static int do_bootstage_stash(cmd_tbl_t *cmdtp, int flag, int argc,
49 if (get_base_size(argc, argv, &base, &size))
52 printf("No bootstage stash area defined\n");
56 if (0 == strcmp(argv[0], "stash"))
57 ret = bootstage_stash((void *)base, size);
59 ret = bootstage_unstash((void *)base, size);
66 static cmd_tbl_t cmd_bootstage_sub[] = {
67 U_BOOT_CMD_MKENT(report, 2, 1, do_bootstage_report, "", ""),
68 U_BOOT_CMD_MKENT(stash, 4, 0, do_bootstage_stash, "", ""),
69 U_BOOT_CMD_MKENT(unstash, 4, 0, do_bootstage_stash, "", ""),
73 * Process a bootstage sub-command
75 static int do_boostage(cmd_tbl_t *cmdtp, int flag, int argc,
80 /* Strip off leading 'bootstage' command argument */
84 c = find_cmd_tbl(argv[0], cmd_bootstage_sub,
85 ARRAY_SIZE(cmd_bootstage_sub));
88 return c->cmd(cmdtp, flag, argc, argv);
94 U_BOOT_CMD(bootstage, 4, 1, do_boostage,
96 " - check boot progress and timing\n"
97 "report - Print a report\n"
98 "stash [<start> [<size>]] - Stash data into memory\n"
99 "unstash [<start> [<size>]] - Unstash data from memory"