uboot/cmd/boot.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * (C) Copyright 2000-2003
   4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   5 */
   6
   7/*
   8 * Misc boot support
   9 */
  10#include <common.h>
  11#include <command.h>
  12#include <net.h>
  13
  14#ifdef CONFIG_CMD_GO
  15
  16/* Allow ports to override the default behavior */
  17__attribute__((weak))
  18unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
  19                                 char *const argv[])
  20{
  21        return entry (argc, argv);
  22}
  23
  24static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
  25{
  26        ulong   addr, rc;
  27        int     rcode = 0;
  28
  29        if (argc < 2)
  30                return CMD_RET_USAGE;
  31
  32        addr = hextoul(argv[1], NULL);
  33
  34        printf ("## Starting application at 0x%08lX ...\n", addr);
  35
  36        /*
  37         * pass address parameter as argv[0] (aka command name),
  38         * and all remaining args
  39         */
  40        rc = do_go_exec ((void *)addr, argc - 1, argv + 1);
  41        if (rc != 0) rcode = 1;
  42
  43        printf ("## Application terminated, rc = 0x%lX\n", rc);
  44        return rcode;
  45}
  46
  47/* -------------------------------------------------------------------- */
  48
  49U_BOOT_CMD(
  50        go, CONFIG_SYS_MAXARGS, 1,      do_go,
  51        "start application at address 'addr'",
  52        "addr [arg ...]\n    - start application at address 'addr'\n"
  53        "      passing 'arg' as arguments"
  54);
  55
  56#endif
  57
  58U_BOOT_CMD(
  59        reset, 2, 0,    do_reset,
  60        "Perform RESET of the CPU",
  61        "- cold boot without level specifier\n"
  62        "reset -w - warm reset if implemented"
  63);
  64
  65#ifdef CONFIG_CMD_POWEROFF
  66U_BOOT_CMD(
  67        poweroff, 1, 0, do_poweroff,
  68        "Perform POWEROFF of the device",
  69        ""
  70);
  71#endif
  72