blob: 8d59364b63653aee6e84b9cb89d72df1fff2e130 [file] [log] [blame]
Simon Glassd3049312012-12-26 09:53:36 +00001/*
2 * Copyright (c) 2012, Google Inc.
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Simon Glassd3049312012-12-26 09:53:36 +00005 */
6
7#include <common.h>
8#include <fs.h>
9
10static int do_sandbox_load(cmd_tbl_t *cmdtp, int flag, int argc,
11 char * const argv[])
12{
Tom Rini9ade4852013-10-10 10:46:22 -040013 return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
Simon Glassd3049312012-12-26 09:53:36 +000014}
15
16static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int argc,
17 char * const argv[])
18{
19 return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
20}
21
Simon Glass7eb2c8d2013-04-20 08:42:51 +000022static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc,
23 char * const argv[])
24{
Tom Rini9ade4852013-10-10 10:46:22 -040025 return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
Simon Glass7eb2c8d2013-04-20 08:42:51 +000026}
27
Simon Glassd3049312012-12-26 09:53:36 +000028static cmd_tbl_t cmd_sandbox_sub[] = {
Simon Glass7eb2c8d2013-04-20 08:42:51 +000029 U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
Simon Glassd3049312012-12-26 09:53:36 +000030 U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
Simon Glass7eb2c8d2013-04-20 08:42:51 +000031 U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
Simon Glassd3049312012-12-26 09:53:36 +000032};
33
34static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
35 char * const argv[])
36{
37 cmd_tbl_t *c;
38
39 /* Skip past 'sandbox' */
40 argc--;
41 argv++;
42
43 c = find_cmd_tbl(argv[0], cmd_sandbox_sub,
44 ARRAY_SIZE(cmd_sandbox_sub));
45
46 if (c)
47 return c->cmd(cmdtp, flag, argc, argv);
48 else
49 return CMD_RET_USAGE;
50}
51
52U_BOOT_CMD(
Simon Glass7eb2c8d2013-04-20 08:42:51 +000053 sb, 8, 1, do_sandbox,
Simon Glassd3049312012-12-26 09:53:36 +000054 "Miscellaneous sandbox commands",
Simon Glass7eb2c8d2013-04-20 08:42:51 +000055 "load host <dev> <addr> <filename> [<bytes> <offset>] - "
56 "load a file from host\n"
57 "sb ls host <filename> - list files on host\n"
58 "sb save host <dev> <filename> <addr> <bytes> [<offset>] - "
59 "save a file to host\n"
Simon Glassd3049312012-12-26 09:53:36 +000060);