Simon Glass | 46508c9 | 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 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 7 | #include <command.h> |
Simon Glass | 46508c9 | 2018-11-15 18:44:03 -0700 | [diff] [blame] | 8 | #include <dm.h> |
| 9 | #include <spl.h> |
Simon Glass | 9a27d9d | 2024-10-28 13:47:57 +0100 | [diff] [blame] | 10 | #include <asm/cpu.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 11 | #include <asm/global_data.h> |
Simon Glass | 46508c9 | 2018-11-15 18:44:03 -0700 | [diff] [blame] | 12 | #include <asm/state.h> |
| 13 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 14 | static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc, |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 15 | char *const argv[]) |
| 16 | { |
| 17 | #if CONFIG_IS_ENABLED(HANDOFF) |
Simon Glass | b711ef7 | 2024-08-21 10:19:13 -0600 | [diff] [blame] | 18 | struct spl_handoff *handoff = handoff_get(); |
| 19 | |
| 20 | if (handoff) |
| 21 | printf("SPL handoff magic %lx\n", handoff->arch.magic); |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 22 | else |
| 23 | printf("SPL handoff info not received\n"); |
| 24 | |
| 25 | return 0; |
| 26 | #else |
| 27 | printf("Command not supported\n"); |
| 28 | |
| 29 | return CMD_RET_USAGE; |
| 30 | #endif |
| 31 | } |
| 32 | |
Simon Glass | 9a27d9d | 2024-10-28 13:47:57 +0100 | [diff] [blame] | 33 | static int do_sb_map(struct cmd_tbl *cmdtp, int flag, int argc, |
| 34 | char *const argv[]) |
| 35 | { |
| 36 | sandbox_map_list(); |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 41 | static int do_sb_state(struct cmd_tbl *cmdtp, int flag, int argc, |
| 42 | char *const argv[]) |
Simon Glass | 46508c9 | 2018-11-15 18:44:03 -0700 | [diff] [blame] | 43 | { |
| 44 | struct sandbox_state *state; |
| 45 | |
| 46 | state = state_get_current(); |
| 47 | state_show(state); |
| 48 | |
| 49 | return 0; |
| 50 | } |
| 51 | |
Simon Glass | 354a6e8 | 2024-10-28 13:47:55 +0100 | [diff] [blame] | 52 | U_BOOT_LONGHELP(sb, |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 53 | "handoff - Show handoff data received from SPL\n" |
Simon Glass | 9a27d9d | 2024-10-28 13:47:57 +0100 | [diff] [blame] | 54 | "sb map - Show mapped memory\n" |
Simon Glass | 354a6e8 | 2024-10-28 13:47:55 +0100 | [diff] [blame] | 55 | "sb state - Show sandbox state"); |
| 56 | |
| 57 | U_BOOT_CMD_WITH_SUBCMDS(sb, "Sandbox status commands", sb_help_text, |
| 58 | U_BOOT_SUBCMD_MKENT(handoff, 1, 1, do_sb_handoff), |
Simon Glass | 9a27d9d | 2024-10-28 13:47:57 +0100 | [diff] [blame] | 59 | U_BOOT_SUBCMD_MKENT(map, 1, 1, do_sb_map), |
Simon Glass | 354a6e8 | 2024-10-28 13:47:55 +0100 | [diff] [blame] | 60 | U_BOOT_SUBCMD_MKENT(state, 1, 1, do_sb_state)); |