]>
Commit | Line | Data |
---|---|---|
a46d821f WD |
1 | /* |
2 | * (C) Copyright 2002 | |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
4 | * | |
1a459660 | 5 | * SPDX-License-Identifier: GPL-2.0+ |
a46d821f WD |
6 | */ |
7 | ||
8 | /* | |
9 | * Diagnostics support | |
10 | */ | |
11 | #include <common.h> | |
12 | #include <command.h> | |
a46d821f WD |
13 | #include <post.h> |
14 | ||
54841ab5 | 15 | int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
a46d821f WD |
16 | { |
17 | unsigned int i; | |
18 | ||
19 | if (argc == 1 || strcmp (argv[1], "run") != 0) { | |
20 | /* List test info */ | |
21 | if (argc == 1) { | |
4b9206ed | 22 | puts ("Available hardware tests:\n"); |
a46d821f | 23 | post_info (NULL); |
4b9206ed | 24 | puts ("Use 'diag [<test1> [<test2> ...]]'" |
a46d821f | 25 | " to get more info.\n"); |
4b9206ed | 26 | puts ("Use 'diag run [<test1> [<test2> ...]]'" |
a46d821f WD |
27 | " to run tests.\n"); |
28 | } else { | |
29 | for (i = 1; i < argc; i++) { | |
30 | if (post_info (argv[i]) != 0) | |
31 | printf ("%s - no such test\n", argv[i]); | |
32 | } | |
33 | } | |
34 | } else { | |
35 | /* Run tests */ | |
36 | if (argc == 2) { | |
37 | post_run (NULL, POST_RAM | POST_MANUAL); | |
38 | } else { | |
39 | for (i = 2; i < argc; i++) { | |
40 | if (post_run (argv[i], POST_RAM | POST_MANUAL) != 0) | |
41 | printf ("%s - unable to execute the test\n", | |
42 | argv[i]); | |
43 | } | |
44 | } | |
45 | } | |
46 | ||
47 | return 0; | |
48 | } | |
8bde7f77 WD |
49 | /***************************************************/ |
50 | ||
0d498393 | 51 | U_BOOT_CMD( |
6d0f6bcf | 52 | diag, CONFIG_SYS_MAXARGS, 0, do_diag, |
2fb2604d | 53 | "perform board diagnostics", |
8bde7f77 WD |
54 | " - print list of available tests\n" |
55 | "diag [test1 [test2]]\n" | |
56 | " - print information about specified tests\n" | |
57 | "diag run - run all available tests\n" | |
58 | "diag run [test1 [test2]]\n" | |
a89c33db | 59 | " - run specified tests" |
8bde7f77 | 60 | ); |