Simon Glass | d66ddaf | 2018-11-15 18:44:03 -0700 | [diff] [blame^] | 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_state(cmd_tbl_t *cmdtp, int flag, int argc, |
| 13 | char * const argv[]) |
| 14 | { |
| 15 | struct sandbox_state *state; |
| 16 | |
| 17 | state = state_get_current(); |
| 18 | state_show(state); |
| 19 | |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | static cmd_tbl_t cmd_sb_sub[] = { |
| 24 | U_BOOT_CMD_MKENT(state, 1, 0, do_sb_state, "", ""), |
| 25 | }; |
| 26 | |
| 27 | static int do_sb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 28 | { |
| 29 | cmd_tbl_t *c; |
| 30 | |
| 31 | /* Skip past 'sb' */ |
| 32 | argc--; |
| 33 | argv++; |
| 34 | |
| 35 | c = find_cmd_tbl(argv[0], cmd_sb_sub, ARRAY_SIZE(cmd_sb_sub)); |
| 36 | if (c) |
| 37 | return c->cmd(cmdtp, flag, argc, argv); |
| 38 | else |
| 39 | return CMD_RET_USAGE; |
| 40 | } |
| 41 | |
| 42 | U_BOOT_CMD( |
| 43 | sb, 8, 1, do_sb, |
| 44 | "Sandbox status commands", |
| 45 | "state - Show sandbox state" |
| 46 | ); |