1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2012, Google Inc. All rights reserved.
8 static int do_bootstage_report(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
16 static int get_base_size(int argc
, char * const argv
[], ulong
*basep
,
21 *basep
= CONFIG_BOOTSTAGE_STASH_ADDR
;
22 *sizep
= CONFIG_BOOTSTAGE_STASH_SIZE
;
25 *basep
= simple_strtoul(argv
[1], &endp
, 16);
26 if (*argv
[1] == 0 || *endp
!= 0)
30 *sizep
= simple_strtoul(argv
[2], &endp
, 16);
31 if (*argv
[2] == 0 || *endp
!= 0)
37 static int do_bootstage_stash(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
43 if (get_base_size(argc
, argv
, &base
, &size
))
46 printf("No bootstage stash area defined\n");
50 if (0 == strcmp(argv
[0], "stash"))
51 ret
= bootstage_stash((void *)base
, size
);
53 ret
= bootstage_unstash((void *)base
, size
);
60 static cmd_tbl_t cmd_bootstage_sub
[] = {
61 U_BOOT_CMD_MKENT(report
, 2, 1, do_bootstage_report
, "", ""),
62 U_BOOT_CMD_MKENT(stash
, 4, 0, do_bootstage_stash
, "", ""),
63 U_BOOT_CMD_MKENT(unstash
, 4, 0, do_bootstage_stash
, "", ""),
67 * Process a bootstage sub-command
69 static int do_boostage(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
74 /* Strip off leading 'bootstage' command argument */
78 c
= find_cmd_tbl(argv
[0], cmd_bootstage_sub
,
79 ARRAY_SIZE(cmd_bootstage_sub
));
82 return c
->cmd(cmdtp
, flag
, argc
, argv
);
88 U_BOOT_CMD(bootstage
, 4, 1, do_boostage
,
90 " - check boot progress and timing\n"
91 "report - Print a report\n"
92 "stash [<start> [<size>]] - Stash data into memory\n"
93 "unstash [<start> [<size>]] - Unstash data from memory"