configs: Migrate CONFIG_FMAN_ENET and some related options to Kconfig
[platform/kernel/u-boot.git] / cmd / sb.c
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 <common.h>
8 #include <dm.h>
9 #include <spl.h>
10 #include <asm/state.h>
11
12 static 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
29 static 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
40 static cmd_tbl_t cmd_sb_sub[] = {
41         U_BOOT_CMD_MKENT(handoff, 1, 0, do_sb_handoff, "", ""),
42         U_BOOT_CMD_MKENT(state, 1, 0, do_sb_state, "", ""),
43 };
44
45 static 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
60 U_BOOT_CMD(
61         sb,     8,      1,      do_sb,
62         "Sandbox status commands",
63         "handoff     - Show handoff data received from SPL\n"
64         "sb state       - Show sandbox state"
65 );