blob: a28a844ae0e3b01da2fb3e818bdc480378ef7cdc [file] [log] [blame]
Simon Glassd3049312012-12-26 09:53:36 +00001/*
2 * Copyright (c) 2012, Google Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17 * MA 02111-1307 USA
18 */
19
20#include <common.h>
21#include <fs.h>
22
23static int do_sandbox_load(cmd_tbl_t *cmdtp, int flag, int argc,
24 char * const argv[])
25{
26 return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
27}
28
29static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int argc,
30 char * const argv[])
31{
32 return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
33}
34
Simon Glass7eb2c8d2013-04-20 08:42:51 +000035static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc,
36 char * const argv[])
37{
38 return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
39}
40
Simon Glassd3049312012-12-26 09:53:36 +000041static cmd_tbl_t cmd_sandbox_sub[] = {
Simon Glass7eb2c8d2013-04-20 08:42:51 +000042 U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
Simon Glassd3049312012-12-26 09:53:36 +000043 U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
Simon Glass7eb2c8d2013-04-20 08:42:51 +000044 U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
Simon Glassd3049312012-12-26 09:53:36 +000045};
46
47static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
48 char * const argv[])
49{
50 cmd_tbl_t *c;
51
52 /* Skip past 'sandbox' */
53 argc--;
54 argv++;
55
56 c = find_cmd_tbl(argv[0], cmd_sandbox_sub,
57 ARRAY_SIZE(cmd_sandbox_sub));
58
59 if (c)
60 return c->cmd(cmdtp, flag, argc, argv);
61 else
62 return CMD_RET_USAGE;
63}
64
65U_BOOT_CMD(
Simon Glass7eb2c8d2013-04-20 08:42:51 +000066 sb, 8, 1, do_sandbox,
Simon Glassd3049312012-12-26 09:53:36 +000067 "Miscellaneous sandbox commands",
Simon Glass7eb2c8d2013-04-20 08:42:51 +000068 "load host <dev> <addr> <filename> [<bytes> <offset>] - "
69 "load a file from host\n"
70 "sb ls host <filename> - list files on host\n"
71 "sb save host <dev> <filename> <addr> <bytes> [<offset>] - "
72 "save a file to host\n"
Simon Glassd3049312012-12-26 09:53:36 +000073);