"Das U-Boot" Source Tree
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018, Google Inc.
4 * Written by Simon Glass <sjg@chromium.org>
5 */
6
7#include <command.h>
8#include <dm.h>
9#include <spl.h>
10#include <asm/cpu.h>
11#include <asm/global_data.h>
12#include <asm/state.h>
13
14static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc,
15 char *const argv[])
16{
17#if CONFIG_IS_ENABLED(HANDOFF)
18 if (gd->spl_handoff)
19 printf("SPL handoff magic %lx\n", gd->spl_handoff->arch.magic);
20 else
21 printf("SPL handoff info not received\n");
22
23 return 0;
24#else
25 printf("Command not supported\n");
26
27 return CMD_RET_USAGE;
28#endif
29}
30
31static int do_sb_map(struct cmd_tbl *cmdtp, int flag, int argc,
32 char *const argv[])
33{
34 sandbox_map_list();
35
36 return 0;
37}
38
39static int do_sb_state(struct cmd_tbl *cmdtp, int flag, int argc,
40 char *const argv[])
41{
42 struct sandbox_state *state;
43
44 state = state_get_current();
45 state_show(state);
46
47 return 0;
48}
49
50U_BOOT_LONGHELP(sb,
51 "handoff - Show handoff data received from SPL\n"
52 "sb map - Show mapped memory\n"
53 "sb state - Show sandbox state");
54
55U_BOOT_CMD_WITH_SUBCMDS(sb, "Sandbox status commands", sb_help_text,
56 U_BOOT_SUBCMD_MKENT(handoff, 1, 1, do_sb_handoff),
57 U_BOOT_SUBCMD_MKENT(map, 1, 1, do_sb_map),
58 U_BOOT_SUBCMD_MKENT(state, 1, 1, do_sb_state));