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