2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2010-12-08 04:49:12 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2010
|
|
|
|
* Renesas Solutions Corp.
|
|
|
|
* Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Linux SuperH zImage loading and boot
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:03 +00:00
|
|
|
#include <command.h>
|
|
|
|
#include <env.h>
|
2019-11-14 19:57:42 +00:00
|
|
|
#include <irq_func.h>
|
2010-12-08 04:49:12 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/zimage.h>
|
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
int do_sh_zimageboot(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
|
|
char *const argv[])
|
2010-12-08 04:49:12 +00:00
|
|
|
{
|
|
|
|
ulong (*zboot_entry)(int, char * const []) = NULL;
|
|
|
|
char *s0, *s1;
|
|
|
|
unsigned char *param = NULL;
|
|
|
|
char *cmdline;
|
|
|
|
char *bootargs;
|
|
|
|
|
|
|
|
disable_interrupts();
|
|
|
|
|
|
|
|
if (argc >= 3) {
|
|
|
|
/* argv[1] holds the address of the zImage */
|
|
|
|
s0 = argv[1];
|
|
|
|
/* argv[2] holds the address of zero page */
|
|
|
|
s1 = argv[2];
|
|
|
|
} else {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s0)
|
|
|
|
zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16);
|
|
|
|
|
|
|
|
/* empty_zero_page */
|
|
|
|
if (s1)
|
|
|
|
param = (unsigned char*)simple_strtoul(s1, NULL, 16);
|
|
|
|
|
|
|
|
/* Linux kernel command line */
|
|
|
|
cmdline = (char *)param + COMMAND_LINE;
|
2017-08-03 18:22:12 +00:00
|
|
|
bootargs = env_get("bootargs");
|
2010-12-08 04:49:12 +00:00
|
|
|
|
|
|
|
/* Clear zero page */
|
2014-11-06 13:02:57 +00:00
|
|
|
/* cppcheck-suppress nullPointer */
|
2010-12-08 04:49:12 +00:00
|
|
|
memset(param, 0, 0x1000);
|
|
|
|
|
|
|
|
/* Set commandline */
|
|
|
|
strcpy(cmdline, bootargs);
|
|
|
|
|
|
|
|
/* Boot */
|
|
|
|
zboot_entry(0, NULL);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
U_BOOT_CMD(
|
|
|
|
zimageboot, 3, 0, do_sh_zimageboot,
|
|
|
|
"Boot zImage for Renesas SH",
|
|
|
|
""
|
|
|
|
);
|