| // SPDX-License-Identifier: GPL-2.0+ |
| /* |
| * Copyright 2018, Google Inc. |
| * Written by Simon Glass <sjg@chromium.org> |
| */ |
| |
| #include <command.h> |
| #include <dm.h> |
| #include <spl.h> |
| #include <asm/cpu.h> |
| #include <asm/global_data.h> |
| #include <asm/state.h> |
| |
| static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc, |
| char *const argv[]) |
| { |
| #if CONFIG_IS_ENABLED(HANDOFF) |
| struct spl_handoff *handoff = handoff_get(); |
| |
| if (handoff) |
| printf("SPL handoff magic %lx\n", handoff->arch.magic); |
| else |
| printf("SPL handoff info not received\n"); |
| |
| return 0; |
| #else |
| printf("Command not supported\n"); |
| |
| return CMD_RET_USAGE; |
| #endif |
| } |
| |
| static int do_sb_map(struct cmd_tbl *cmdtp, int flag, int argc, |
| char *const argv[]) |
| { |
| sandbox_map_list(); |
| |
| return 0; |
| } |
| |
| static int do_sb_state(struct cmd_tbl *cmdtp, int flag, int argc, |
| char *const argv[]) |
| { |
| struct sandbox_state *state; |
| |
| state = state_get_current(); |
| state_show(state); |
| |
| return 0; |
| } |
| |
| U_BOOT_LONGHELP(sb, |
| "handoff - Show handoff data received from SPL\n" |
| "sb map - Show mapped memory\n" |
| "sb state - Show sandbox state"); |
| |
| U_BOOT_CMD_WITH_SUBCMDS(sb, "Sandbox status commands", sb_help_text, |
| U_BOOT_SUBCMD_MKENT(handoff, 1, 1, do_sb_handoff), |
| U_BOOT_SUBCMD_MKENT(map, 1, 1, do_sb_map), |
| U_BOOT_SUBCMD_MKENT(state, 1, 1, do_sb_state)); |