blob: 9245052492e2debf1c0f94debeb8851d653d3a3c [file] [log] [blame]
Simon Glass46508c92018-11-15 18:44:03 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018, Google Inc.
4 * Written by Simon Glass <sjg@chromium.org>
5 */
6
Simon Glassed38aef2020-05-10 11:40:03 -06007#include <command.h>
Simon Glass46508c92018-11-15 18:44:03 -07008#include <dm.h>
9#include <spl.h>
Simon Glass9a27d9d2024-10-28 13:47:57 +010010#include <asm/cpu.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060011#include <asm/global_data.h>
Simon Glass46508c92018-11-15 18:44:03 -070012#include <asm/state.h>
13
Simon Glassed38aef2020-05-10 11:40:03 -060014static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc,
Simon Glasse14f1a22018-11-15 18:44:09 -070015 char *const argv[])
16{
17#if CONFIG_IS_ENABLED(HANDOFF)
Simon Glassb711ef72024-08-21 10:19:13 -060018 struct spl_handoff *handoff = handoff_get();
19
20 if (handoff)
21 printf("SPL handoff magic %lx\n", handoff->arch.magic);
Simon Glasse14f1a22018-11-15 18:44:09 -070022 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 Glass9a27d9d2024-10-28 13:47:57 +010033static 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 Glassed38aef2020-05-10 11:40:03 -060041static int do_sb_state(struct cmd_tbl *cmdtp, int flag, int argc,
42 char *const argv[])
Simon Glass46508c92018-11-15 18:44:03 -070043{
44 struct sandbox_state *state;
45
46 state = state_get_current();
47 state_show(state);
48
49 return 0;
50}
51
Simon Glass354a6e82024-10-28 13:47:55 +010052U_BOOT_LONGHELP(sb,
Simon Glasse14f1a22018-11-15 18:44:09 -070053 "handoff - Show handoff data received from SPL\n"
Simon Glass9a27d9d2024-10-28 13:47:57 +010054 "sb map - Show mapped memory\n"
Simon Glass354a6e82024-10-28 13:47:55 +010055 "sb state - Show sandbox state");
56
57U_BOOT_CMD_WITH_SUBCMDS(sb, "Sandbox status commands", sb_help_text,
58 U_BOOT_SUBCMD_MKENT(handoff, 1, 1, do_sb_handoff),
Simon Glass9a27d9d2024-10-28 13:47:57 +010059 U_BOOT_SUBCMD_MKENT(map, 1, 1, do_sb_map),
Simon Glass354a6e82024-10-28 13:47:55 +010060 U_BOOT_SUBCMD_MKENT(state, 1, 1, do_sb_state));