]>
Commit | Line | Data |
---|---|---|
d66ddafa SG |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright 2018, Google Inc. | |
4 | * Written by Simon Glass <[email protected]> | |
5 | */ | |
6 | ||
7 | #include <common.h> | |
09140113 | 8 | #include <command.h> |
d66ddafa SG |
9 | #include <dm.h> |
10 | #include <spl.h> | |
11 | #include <asm/state.h> | |
12 | ||
09140113 | 13 | static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc, |
b0edea3c SG |
14 | char *const argv[]) |
15 | { | |
16 | #if CONFIG_IS_ENABLED(HANDOFF) | |
17 | if (gd->spl_handoff) | |
18 | printf("SPL handoff magic %lx\n", gd->spl_handoff->arch.magic); | |
19 | else | |
20 | printf("SPL handoff info not received\n"); | |
21 | ||
22 | return 0; | |
23 | #else | |
24 | printf("Command not supported\n"); | |
25 | ||
26 | return CMD_RET_USAGE; | |
27 | #endif | |
28 | } | |
29 | ||
09140113 SG |
30 | static int do_sb_state(struct cmd_tbl *cmdtp, int flag, int argc, |
31 | char *const argv[]) | |
d66ddafa SG |
32 | { |
33 | struct sandbox_state *state; | |
34 | ||
35 | state = state_get_current(); | |
36 | state_show(state); | |
37 | ||
38 | return 0; | |
39 | } | |
40 | ||
09140113 | 41 | static struct cmd_tbl cmd_sb_sub[] = { |
b0edea3c | 42 | U_BOOT_CMD_MKENT(handoff, 1, 0, do_sb_handoff, "", ""), |
d66ddafa SG |
43 | U_BOOT_CMD_MKENT(state, 1, 0, do_sb_state, "", ""), |
44 | }; | |
45 | ||
09140113 | 46 | static int do_sb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
d66ddafa | 47 | { |
09140113 | 48 | struct cmd_tbl *c; |
d66ddafa SG |
49 | |
50 | /* Skip past 'sb' */ | |
51 | argc--; | |
52 | argv++; | |
53 | ||
54 | c = find_cmd_tbl(argv[0], cmd_sb_sub, ARRAY_SIZE(cmd_sb_sub)); | |
55 | if (c) | |
56 | return c->cmd(cmdtp, flag, argc, argv); | |
57 | else | |
58 | return CMD_RET_USAGE; | |
59 | } | |
60 | ||
61 | U_BOOT_CMD( | |
62 | sb, 8, 1, do_sb, | |
63 | "Sandbox status commands", | |
b0edea3c SG |
64 | "handoff - Show handoff data received from SPL\n" |
65 | "sb state - Show sandbox state" | |
d66ddafa | 66 | ); |