X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=post%2Fpost.c;h=852d6a5dab51ca84623487658c7d0b36abcf13be;hb=c4f4c760c9bdbad6c4f286edfff79e34d96ec5f6;hp=b29eb87fc2113701ca8c92618b62bdf568ee8e24;hpb=35e3717772c8c3534c18d8aac69e4b822777c23b;p=oweals%2Fu-boot.git diff --git a/post/post.c b/post/post.c index b29eb87fc2..852d6a5dab 100644 --- a/post/post.c +++ b/post/post.c @@ -26,6 +26,10 @@ #include #include +#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO +#include +#endif + #ifdef CONFIG_LOGBUFFER #include #endif @@ -68,6 +72,23 @@ int post_init_f (void) */ int __post_hotkeys_pressed(void) { +#ifdef CONFIG_SYS_POST_HOTKEYS_GPIO + int ret; + unsigned gpio = CONFIG_SYS_POST_HOTKEYS_GPIO; + + ret = gpio_request(gpio, "hotkeys"); + if (ret) { + printf("POST: gpio hotkey request failed\n"); + return 0; + } + + gpio_direction_input(gpio); + ret = gpio_get_value(gpio); + gpio_free(gpio); + + return ret; +#endif + return 0; /* No hotkeys supported */ } int post_hotkeys_pressed(void) @@ -175,7 +196,7 @@ static void post_get_flags (int *test_flags) POST_CRITICAL }; char *var[] = { "post_poweron", "post_normal", "post_slowtest", "post_critical" }; - int varnum = sizeof (var) / sizeof (var[0]); + int varnum = ARRAY_SIZE(var); char list[128]; /* long enough for POST list */ char *name; char *s; @@ -187,7 +208,7 @@ static void post_get_flags (int *test_flags) } for (i = 0; i < varnum; i++) { - if (getenv_r (var[i], list, sizeof (list)) <= 0) + if (getenv_f(var[i], list, sizeof (list)) <= 0) continue; for (j = 0; j < post_list_size; j++) { @@ -231,6 +252,12 @@ static void post_get_flags (int *test_flags) } } +void __show_post_progress (unsigned int test_num, int before, int result) +{ +} +void show_post_progress (unsigned int, int, int) + __attribute__((weak, alias("__show_post_progress"))); + static int post_run_single (struct post_test *test, int test_flags, int flags, unsigned int i) { @@ -248,29 +275,36 @@ static int post_run_single (struct post_test *test, if (test_flags & POST_PREREL) post_log_mark_start ( test->testid ); else - post_log ("POST %s ", test->cmd); + post_log ("POST %s ", test->cmd); } + show_post_progress(i, POST_BEFORE, POST_FAILED); + if (test_flags & POST_PREREL) { - if ((*test->test) (flags) == 0) + if ((*test->test) (flags) == 0) { post_log_mark_succ ( test->testid ); + show_post_progress(i, POST_AFTER, POST_PASSED); + } else { + show_post_progress(i, POST_AFTER, POST_FAILED); if (test_flags & POST_CRITICAL) gd->flags |= GD_FLG_POSTFAIL; if (test_flags & POST_STOP) gd->flags |= GD_FLG_POSTSTOP; } } else { - if ((*test->test) (flags) != 0) { - post_log ("FAILED\n"); - show_boot_progress (-32); - if (test_flags & POST_CRITICAL) - gd->flags |= GD_FLG_POSTFAIL; - if (test_flags & POST_STOP) - gd->flags |= GD_FLG_POSTSTOP; - } - else - post_log ("PASSED\n"); + if ((*test->test)(flags) != 0) { + post_log("FAILED\n"); + show_boot_progress(-32); + show_post_progress(i, POST_AFTER, POST_FAILED); + if (test_flags & POST_CRITICAL) + gd->flags |= GD_FLG_POSTFAIL; + if (test_flags & POST_STOP) + gd->flags |= GD_FLG_POSTSTOP; + } else { + post_log("PASSED\n"); + show_post_progress(i, POST_AFTER, POST_PASSED); + } } if ((test_flags & POST_REBOOT) && !(flags & POST_MANUAL)) { @@ -409,7 +443,7 @@ int post_log (char *format, ...) return 0; } -#ifndef CONFIG_RELOC_FIXUP_WORKS +#ifdef CONFIG_NEEDS_MANUAL_RELOC void post_reloc (void) { unsigned int i;