Simon Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012, Google Inc. |
| 3 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <fs.h> |
| 9 | |
| 10 | static int do_sandbox_load(cmd_tbl_t *cmdtp, int flag, int argc, |
| 11 | char * const argv[]) |
| 12 | { |
Tom Rini | 9ade485 | 2013-10-10 10:46:22 -0400 | [diff] [blame] | 13 | return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX); |
Simon Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | static 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 Glass | 7eb2c8d | 2013-04-20 08:42:51 +0000 | [diff] [blame] | 22 | static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc, |
| 23 | char * const argv[]) |
| 24 | { |
Tom Rini | 9ade485 | 2013-10-10 10:46:22 -0400 | [diff] [blame] | 25 | return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX); |
Simon Glass | 7eb2c8d | 2013-04-20 08:42:51 +0000 | [diff] [blame] | 26 | } |
| 27 | |
Simon Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 28 | static cmd_tbl_t cmd_sandbox_sub[] = { |
Simon Glass | 7eb2c8d | 2013-04-20 08:42:51 +0000 | [diff] [blame] | 29 | U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""), |
Simon Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 30 | U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""), |
Simon Glass | 7eb2c8d | 2013-04-20 08:42:51 +0000 | [diff] [blame] | 31 | U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""), |
Simon Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | static 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 | |
| 52 | U_BOOT_CMD( |
Simon Glass | 7eb2c8d | 2013-04-20 08:42:51 +0000 | [diff] [blame] | 53 | sb, 8, 1, do_sandbox, |
Simon Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 54 | "Miscellaneous sandbox commands", |
Simon Glass | 7eb2c8d | 2013-04-20 08:42:51 +0000 | [diff] [blame] | 55 | "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 Glass | d304931 | 2012-12-26 09:53:36 +0000 | [diff] [blame] | 60 | ); |