Blame view

cmd/sb.c 1.29 KB
d66ddafaf   Simon Glass   sandbox: Add a ne...
1
2
3
4
5
6
7
8
9
10
  // SPDX-License-Identifier: GPL-2.0+
  /*
   * Copyright 2018, Google Inc.
   * Written by Simon Glass <sjg@chromium.org>
   */
  
  #include <common.h>
  #include <dm.h>
  #include <spl.h>
  #include <asm/state.h>
b0edea3c2   Simon Glass   spl: Add support ...
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  static int do_sb_handoff(cmd_tbl_t *cmdtp, int flag, int argc,
  			 char *const argv[])
  {
  #if CONFIG_IS_ENABLED(HANDOFF)
  	if (gd->spl_handoff)
  		printf("SPL handoff magic %lx
  ", gd->spl_handoff->arch.magic);
  	else
  		printf("SPL handoff info not received
  ");
  
  	return 0;
  #else
  	printf("Command not supported
  ");
  
  	return CMD_RET_USAGE;
  #endif
  }
d66ddafaf   Simon Glass   sandbox: Add a ne...
30
31
32
33
34
35
36
37
38
39
40
41
  static int do_sb_state(cmd_tbl_t *cmdtp, int flag, int argc,
  		       char * const argv[])
  {
  	struct sandbox_state *state;
  
  	state = state_get_current();
  	state_show(state);
  
  	return 0;
  }
  
  static cmd_tbl_t cmd_sb_sub[] = {
b0edea3c2   Simon Glass   spl: Add support ...
42
  	U_BOOT_CMD_MKENT(handoff, 1, 0, do_sb_handoff, "", ""),
d66ddafaf   Simon Glass   sandbox: Add a ne...
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  	U_BOOT_CMD_MKENT(state, 1, 0, do_sb_state, "", ""),
  };
  
  static int do_sb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  {
  	cmd_tbl_t *c;
  
  	/* Skip past 'sb' */
  	argc--;
  	argv++;
  
  	c = find_cmd_tbl(argv[0], cmd_sb_sub, ARRAY_SIZE(cmd_sb_sub));
  	if (c)
  		return c->cmd(cmdtp, flag, argc, argv);
  	else
  		return CMD_RET_USAGE;
  }
  
  U_BOOT_CMD(
  	sb,	8,	1,	do_sb,
  	"Sandbox status commands",
b0edea3c2   Simon Glass   spl: Add support ...
64
65
66
  	"handoff     - Show handoff data received from SPL
  "
  	"sb state       - Show sandbox state"
d66ddafaf   Simon Glass   sandbox: Add a ne...
67
  );