aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot/common/cmd_diag.c
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2019-04-29 01:17:54 +0100
committerfishsoupisgood <github@madingley.org>2019-05-27 03:43:43 +0100
commit3f2546b2ef55b661fd8dd69682b38992225e86f6 (patch)
tree65ca85f13617aee1dce474596800950f266a456c /roms/u-boot/common/cmd_diag.c
downloadqemu-master.tar.gz
qemu-master.tar.bz2
qemu-master.zip
Initial import of qemu-2.4.1HEADmaster
Diffstat (limited to 'roms/u-boot/common/cmd_diag.c')
-rw-r--r--roms/u-boot/common/cmd_diag.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/roms/u-boot/common/cmd_diag.c b/roms/u-boot/common/cmd_diag.c
new file mode 100644
index 00000000..14ae04f2
--- /dev/null
+++ b/roms/u-boot/common/cmd_diag.c
@@ -0,0 +1,60 @@
+/*
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/*
+ * Diagnostics support
+ */
+#include <common.h>
+#include <command.h>
+#include <post.h>
+
+int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+{
+ unsigned int i;
+
+ if (argc == 1 || strcmp (argv[1], "run") != 0) {
+ /* List test info */
+ if (argc == 1) {
+ puts ("Available hardware tests:\n");
+ post_info (NULL);
+ puts ("Use 'diag [<test1> [<test2> ...]]'"
+ " to get more info.\n");
+ puts ("Use 'diag run [<test1> [<test2> ...]]'"
+ " to run tests.\n");
+ } else {
+ for (i = 1; i < argc; i++) {
+ if (post_info (argv[i]) != 0)
+ printf ("%s - no such test\n", 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\n",
+ argv[i]);
+ }
+ }
+ }
+
+ return 0;
+}
+/***************************************************/
+
+U_BOOT_CMD(
+ diag, CONFIG_SYS_MAXARGS, 0, do_diag,
+ "perform board diagnostics",
+ " - print list of available tests\n"
+ "diag [test1 [test2]]\n"
+ " - print information about specified tests\n"
+ "diag run - run all available tests\n"
+ "diag run [test1 [test2]]\n"
+ " - run specified tests"
+);