blob: 602776a4742e08b738838fe4ff0e162b1627a131 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsufb7f4452010-12-08 13:49:12 +09002/*
3 * (C) Copyright 2010
4 * Renesas Solutions Corp.
5 * Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Nobuhiro Iwamatsufb7f4452010-12-08 13:49:12 +09006 */
7
8/*
9 * Linux SuperH zImage loading and boot
10 */
11
12#include <common.h>
Simon Glass8f3f7612019-11-14 12:57:42 -070013#include <irq_func.h>
Nobuhiro Iwamatsufb7f4452010-12-08 13:49:12 +090014#include <asm/io.h>
15#include <asm/zimage.h>
16
17int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
18{
19 ulong (*zboot_entry)(int, char * const []) = NULL;
20 char *s0, *s1;
21 unsigned char *param = NULL;
22 char *cmdline;
23 char *bootargs;
24
25 disable_interrupts();
26
27 if (argc >= 3) {
28 /* argv[1] holds the address of the zImage */
29 s0 = argv[1];
30 /* argv[2] holds the address of zero page */
31 s1 = argv[2];
32 } else {
33 goto exit;
34 }
35
36 if (s0)
37 zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16);
38
39 /* empty_zero_page */
40 if (s1)
41 param = (unsigned char*)simple_strtoul(s1, NULL, 16);
42
43 /* Linux kernel command line */
44 cmdline = (char *)param + COMMAND_LINE;
Simon Glass64b723f2017-08-03 12:22:12 -060045 bootargs = env_get("bootargs");
Nobuhiro Iwamatsufb7f4452010-12-08 13:49:12 +090046
47 /* Clear zero page */
Wolfgang Denk6ae80832014-11-06 14:02:57 +010048 /* cppcheck-suppress nullPointer */
Nobuhiro Iwamatsufb7f4452010-12-08 13:49:12 +090049 memset(param, 0, 0x1000);
50
51 /* Set commandline */
52 strcpy(cmdline, bootargs);
53
54 /* Boot */
55 zboot_entry(0, NULL);
56
57exit:
58 return -1;
59}
60
61U_BOOT_CMD(
62 zimageboot, 3, 0, do_sh_zimageboot,
63 "Boot zImage for Renesas SH",
64 ""
65);