1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2012, Google Inc. All rights reserved.
10 static int do_bootstage_report(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
18 #if IS_ENABLED(CONFIG_BOOTSTAGE_STASH)
19 static int get_base_size(int argc
, char *const argv
[], ulong
*basep
,
24 *basep
= CONFIG_BOOTSTAGE_STASH_ADDR
;
25 *sizep
= CONFIG_BOOTSTAGE_STASH_SIZE
;
28 *basep
= hextoul(argv
[1], &endp
);
29 if (*argv
[1] == 0 || *endp
!= 0)
33 *sizep
= hextoul(argv
[2], &endp
);
34 if (*argv
[2] == 0 || *endp
!= 0)
40 static int do_bootstage_stash(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
46 if (get_base_size(argc
, argv
, &base
, &size
))
49 printf("No bootstage stash area defined\n");
53 if (0 == strcmp(argv
[0], "stash"))
54 ret
= bootstage_stash((void *)base
, size
);
56 ret
= bootstage_unstash((void *)base
, size
);
64 static struct cmd_tbl cmd_bootstage_sub
[] = {
65 U_BOOT_CMD_MKENT(report
, 2, 1, do_bootstage_report
, "", ""),
66 #if IS_ENABLED(CONFIG_BOOTSTAGE_STASH)
67 U_BOOT_CMD_MKENT(stash
, 4, 0, do_bootstage_stash
, "", ""),
68 U_BOOT_CMD_MKENT(unstash
, 4, 0, do_bootstage_stash
, "", ""),
73 * Process a bootstage sub-command
75 static int do_boostage(struct cmd_tbl
*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
);
93 U_BOOT_CMD(bootstage
, 4, 1, do_boostage
,
95 " - check boot progress and timing\n"
96 "report - Print a report\n"
97 #if IS_ENABLED(CONFIG_BOOTSTAGE_STASH)
98 "stash [<start> [<size>]] - Stash data into memory\n"
99 "unstash [<start> [<size>]] - Unstash data from memory\n"