aboutsummaryrefslogtreecommitdiff
path: root/cmd/sb.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-15 18:44:03 -0700
committerTom Rini <trini@konsulko.com>2018-11-26 08:25:36 -0500
commitd66ddafaf94386f8b92b190a09a0dc488a89149f (patch)
treeb2c321722f6ca0490cae1deed943d7b1448d83b7 /cmd/sb.c
parent6d07d63d2f07497ba9846a5bcd3e5b9c417db931 (diff)
downloadu-boot-d66ddafaf94386f8b92b190a09a0dc488a89149f.zip
u-boot-d66ddafaf94386f8b92b190a09a0dc488a89149f.tar.gz
u-boot-d66ddafaf94386f8b92b190a09a0dc488a89149f.tar.bz2
sandbox: Add a new 'sb' command
The old 'sb' command was deprecated in 2015 and replaced with 'host'. It is useful to be able to access some internal sandbox state, particularly for testing. Resurrect the old command and provide a way to print some basic state information (currently just the arguments to sandbox). Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/sb.c')
-rw-r--r--cmd/sb.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/cmd/sb.c b/cmd/sb.c
new file mode 100644
index 0000000..6ca3361
--- /dev/null
+++ b/cmd/sb.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018, Google Inc.
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <spl.h>
+#include <asm/state.h>
+
+static int do_sb_state(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ struct sandbox_state *state;
+
+ state = state_get_current();
+ state_show(state);
+
+ return 0;
+}
+
+static cmd_tbl_t cmd_sb_sub[] = {
+ U_BOOT_CMD_MKENT(state, 1, 0, do_sb_state, "", ""),
+};
+
+static int do_sb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ cmd_tbl_t *c;
+
+ /* Skip past 'sb' */
+ argc--;
+ argv++;
+
+ c = find_cmd_tbl(argv[0], cmd_sb_sub, ARRAY_SIZE(cmd_sb_sub));
+ if (c)
+ return c->cmd(cmdtp, flag, argc, argv);
+ else
+ return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(
+ sb, 8, 1, do_sb,
+ "Sandbox status commands",
+ "state - Show sandbox state"
+);