Blame view

cmd/diag.c 1.37 KB
a46d821fc   wdenk   Initial revision
1
2
3
4
  /*
   * (C) Copyright 2002
   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
5
   * SPDX-License-Identifier:	GPL-2.0+
a46d821fc   wdenk   Initial revision
6
7
8
9
10
11
12
   */
  
  /*
   * Diagnostics support
   */
  #include <common.h>
  #include <command.h>
a46d821fc   wdenk   Initial revision
13
  #include <post.h>
54841ab50   Wolfgang Denk   Make sure that ar...
14
  int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
a46d821fc   wdenk   Initial revision
15
16
17
18
19
20
  {
  	unsigned int i;
  
  	if (argc == 1 || strcmp (argv[1], "run") != 0) {
  		/* List test info */
  		if (argc == 1) {
4b9206ed5   wdenk   * Patches by Thom...
21
22
  			puts ("Available hardware tests:
  ");
a46d821fc   wdenk   Initial revision
23
  			post_info (NULL);
4b9206ed5   wdenk   * Patches by Thom...
24
  			puts ("Use 'diag [<test1> [<test2> ...]]'"
a46d821fc   wdenk   Initial revision
25
26
  					" to get more info.
  ");
4b9206ed5   wdenk   * Patches by Thom...
27
  			puts ("Use 'diag run [<test1> [<test2> ...]]'"
a46d821fc   wdenk   Initial revision
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  					" to run tests.
  ");
  		} else {
  			for (i = 1; i < argc; i++) {
  			    if (post_info (argv[i]) != 0)
  				printf ("%s - no such test
  ", argv[i]);
  			}
  		}
  	} else {
  		/* Run tests */
  		if (argc == 2) {
  			post_run (NULL, POST_RAM | POST_MANUAL);
  		} else {
  			for (i = 2; i < argc; i++) {
  			    if (post_run (argv[i], POST_RAM | POST_MANUAL) != 0)
  				printf ("%s - unable to execute the test
  ",
  					argv[i]);
  			}
  		}
  	}
  
  	return 0;
  }
8bde7f776   wdenk   * Code cleanup:
53
  /***************************************************/
0d4983930   wdenk   Patch by Kenneth ...
54
  U_BOOT_CMD(
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
55
  	diag,	CONFIG_SYS_MAXARGS,	0,	do_diag,
2fb2604d5   Peter Tyser   Command usage cle...
56
  	"perform board diagnostics",
8bde7f776   wdenk   * Code cleanup:
57
58
59
60
61
62
63
64
65
66
  	     "    - print list of available tests
  "
  	"diag [test1 [test2]]
  "
  	"         - print information about specified tests
  "
  	"diag run - run all available tests
  "
  	"diag run [test1 [test2]]
  "
a89c33db9   Wolfgang Denk   General help mess...
67
  	"         - run specified tests"
8bde7f776   wdenk   * Code cleanup:
68
  );