blob: 3fea5f5b532108c124123ba32f996118991b5d51 [file] [log] [blame]
Nobuhiro Iwamatsu45ce6f92010-12-08 13:49:12 +09001/*
2 * (C) Copyright 2010
3 * Renesas Solutions Corp.
4 * Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu45ce6f92010-12-08 13:49:12 +09007 */
8
9/*
10 * Linux SuperH zImage loading and boot
11 */
12
13#include <common.h>
14#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;
45 bootargs = getenv("bootargs");
46
47 /* Clear zero page */
Wolfgang Denk00605172014-11-06 14:02:57 +010048 /* cppcheck-suppress nullPointer */
Nobuhiro Iwamatsu45ce6f92010-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);