blob: 5701e03797c5b768f20d2b083a1eb6ad91113db4 [file] [log] [blame]
Simon Glass46508c92018-11-15 18:44:03 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018, Google Inc.
4 * Written by Simon Glass <sjg@chromium.org>
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <spl.h>
10#include <asm/state.h>
11
Simon Glasse14f1a22018-11-15 18:44:09 -070012static int do_sb_handoff(cmd_tbl_t *cmdtp, int flag, int argc,
13 char *const argv[])
14{
15#if CONFIG_IS_ENABLED(HANDOFF)
16 if (gd->spl_handoff)
17 printf("SPL handoff magic %lx\n", gd->spl_handoff->arch.magic);
18 else
19 printf("SPL handoff info not received\n");
20
21 return 0;
22#else
23 printf("Command not supported\n");
24
25 return CMD_RET_USAGE;
26#endif
27}
28
Simon Glass46508c92018-11-15 18:44:03 -070029static int do_sb_state(cmd_tbl_t *cmdtp, int flag, int argc,
30 char * const argv[])
31{
32 struct sandbox_state *state;
33
34 state = state_get_current();
35 state_show(state);
36
37 return 0;
38}
39
40static cmd_tbl_t cmd_sb_sub[] = {
Simon Glasse14f1a22018-11-15 18:44:09 -070041 U_BOOT_CMD_MKENT(handoff, 1, 0, do_sb_handoff, "", ""),
Simon Glass46508c92018-11-15 18:44:03 -070042 U_BOOT_CMD_MKENT(state, 1, 0, do_sb_state, "", ""),
43};
44
45static int do_sb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
46{
47 cmd_tbl_t *c;
48
49 /* Skip past 'sb' */
50 argc--;
51 argv++;
52
53 c = find_cmd_tbl(argv[0], cmd_sb_sub, ARRAY_SIZE(cmd_sb_sub));
54 if (c)
55 return c->cmd(cmdtp, flag, argc, argv);
56 else
57 return CMD_RET_USAGE;
58}
59
60U_BOOT_CMD(
61 sb, 8, 1, do_sb,
62 "Sandbox status commands",
Simon Glasse14f1a22018-11-15 18:44:09 -070063 "handoff - Show handoff data received from SPL\n"
64 "sb state - Show sandbox state"
Simon Glass46508c92018-11-15 18:44:03 -070065);