2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2012-03-15 04:01:45 +00:00
|
|
|
/* Copyright (C) 2011
|
|
|
|
* Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
|
|
|
|
* - Added prep subcommand support
|
|
|
|
* - Reorganized source - modeled after powerpc version
|
|
|
|
*
|
2002-11-03 00:24:07 +00:00
|
|
|
* (C) Copyright 2002
|
|
|
|
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
|
|
|
* Marius Groeger <mgroeger@sysgo.de>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:00 +00:00
|
|
|
#include <bootstage.h>
|
2002-11-03 00:24:07 +00:00
|
|
|
#include <command.h>
|
2019-11-14 19:57:35 +00:00
|
|
|
#include <cpu_func.h>
|
2017-05-17 23:18:03 +00:00
|
|
|
#include <dm.h>
|
2020-05-10 17:40:05 +00:00
|
|
|
#include <log.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2017-03-20 11:51:50 +00:00
|
|
|
#include <dm/root.h>
|
2019-08-01 15:46:52 +00:00
|
|
|
#include <env.h>
|
2002-11-03 00:24:07 +00:00
|
|
|
#include <image.h>
|
2009-04-04 10:49:11 +00:00
|
|
|
#include <u-boot/zlib.h>
|
2002-11-03 00:24:07 +00:00
|
|
|
#include <asm/byteorder.h>
|
2018-03-04 16:20:11 +00:00
|
|
|
#include <linux/libfdt.h>
|
2015-03-22 22:08:59 +00:00
|
|
|
#include <mapmem.h>
|
2010-10-13 19:57:36 +00:00
|
|
|
#include <fdt_support.h>
|
2012-03-15 04:01:45 +00:00
|
|
|
#include <asm/bootm.h>
|
2014-07-12 13:24:03 +00:00
|
|
|
#include <asm/secure.h>
|
2012-10-19 02:00:04 +00:00
|
|
|
#include <linux/compiler.h>
|
2014-09-30 22:40:01 +00:00
|
|
|
#include <bootm.h>
|
|
|
|
#include <vxworks.h>
|
2020-05-10 17:39:56 +00:00
|
|
|
#include <asm/cache.h>
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2015-04-21 05:18:24 +00:00
|
|
|
#ifdef CONFIG_ARMV7_NONSEC
|
2013-09-19 16:06:43 +00:00
|
|
|
#include <asm/armv7.h>
|
|
|
|
#endif
|
2017-05-17 14:22:59 +00:00
|
|
|
#include <asm/setup.h>
|
2013-09-19 16:06:43 +00:00
|
|
|
|
2006-03-31 16:32:53 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2002-11-03 00:24:07 +00:00
|
|
|
static struct tag *params;
|
2010-10-13 19:57:36 +00:00
|
|
|
|
2016-11-17 00:02:57 +00:00
|
|
|
__weak void board_quiesce_devices(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-20 04:15:10 +00:00
|
|
|
/**
|
|
|
|
* announce_and_cleanup() - Print message and prepare for kernel boot
|
|
|
|
*
|
|
|
|
* @fake: non-zero to do everything except actually boot
|
|
|
|
*/
|
|
|
|
static void announce_and_cleanup(int fake)
|
2010-10-13 19:57:36 +00:00
|
|
|
{
|
2012-03-15 04:01:45 +00:00
|
|
|
bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
|
2012-09-28 08:56:37 +00:00
|
|
|
#ifdef CONFIG_BOOTSTAGE_FDT
|
2014-02-19 15:16:56 +00:00
|
|
|
bootstage_fdt_add_report();
|
2012-09-28 08:56:37 +00:00
|
|
|
#endif
|
2012-03-15 04:01:45 +00:00
|
|
|
#ifdef CONFIG_BOOTSTAGE_REPORT
|
|
|
|
bootstage_report();
|
|
|
|
#endif
|
2008-09-08 21:26:22 +00:00
|
|
|
|
2012-03-15 04:01:45 +00:00
|
|
|
#ifdef CONFIG_USB_DEVICE
|
|
|
|
udc_disconnect();
|
2010-10-13 19:57:36 +00:00
|
|
|
#endif
|
2016-11-17 00:02:57 +00:00
|
|
|
|
|
|
|
board_quiesce_devices();
|
|
|
|
|
2019-02-20 12:47:22 +00:00
|
|
|
printf("\nStarting kernel ...%s\n\n", fake ?
|
|
|
|
"(fake run for tracing)" : "");
|
2017-03-20 11:51:50 +00:00
|
|
|
/*
|
|
|
|
* Call remove function of all devices with a removal flag set.
|
|
|
|
* This may be useful for last-stage operations, like cancelling
|
|
|
|
* of DMA operation or releasing device internal buffers.
|
|
|
|
*/
|
2021-01-24 21:32:47 +00:00
|
|
|
dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL);
|
|
|
|
|
|
|
|
/* Remove all active vital devices next */
|
2017-03-20 11:51:50 +00:00
|
|
|
dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
|
|
|
|
|
2012-03-15 04:01:45 +00:00
|
|
|
cleanup_before_linux();
|
|
|
|
}
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2020-06-26 06:13:33 +00:00
|
|
|
static void setup_start_tag (struct bd_info *bd)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
2012-03-15 04:01:45 +00:00
|
|
|
params = (struct tag *)bd->bi_boot_params;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params->hdr.tag = ATAG_CORE;
|
|
|
|
params->hdr.size = tag_size (tag_core);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params->u.core.flags = 0;
|
|
|
|
params->u.core.pagesize = 0;
|
|
|
|
params->u.core.rootdev = 0;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params = tag_next (params);
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
2020-06-26 06:13:33 +00:00
|
|
|
static void setup_memory_tags(struct bd_info *bd)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
2003-12-06 23:55:10 +00:00
|
|
|
int i;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
|
|
|
|
params->hdr.tag = ATAG_MEM;
|
|
|
|
params->hdr.size = tag_size (tag_mem32);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params->u.mem.start = bd->bi_dram[i].start;
|
|
|
|
params->u.mem.size = bd->bi_dram[i].size;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params = tag_next (params);
|
|
|
|
}
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
2020-06-26 06:13:33 +00:00
|
|
|
static void setup_commandline_tag(struct bd_info *bd, char *commandline)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
2003-12-06 23:55:10 +00:00
|
|
|
char *p;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2004-03-23 21:43:07 +00:00
|
|
|
if (!commandline)
|
|
|
|
return;
|
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
/* eat leading white space */
|
|
|
|
for (p = commandline; *p == ' '; p++);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
/* skip non-existent command lines so the kernel will still
|
|
|
|
* use its default command line.
|
|
|
|
*/
|
|
|
|
if (*p == '\0')
|
|
|
|
return;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params->hdr.tag = ATAG_CMDLINE;
|
|
|
|
params->hdr.size =
|
|
|
|
(sizeof (struct tag_header) + strlen (p) + 1 + 4) >> 2;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
strcpy (params->u.cmdline.cmdline, p);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params = tag_next (params);
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
2020-06-26 06:13:33 +00:00
|
|
|
static void setup_initrd_tag(struct bd_info *bd, ulong initrd_start,
|
|
|
|
ulong initrd_end)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
2003-12-06 23:55:10 +00:00
|
|
|
/* an ATAG_INITRD node tells the kernel where the compressed
|
|
|
|
* ramdisk can be found. ATAG_RDIMG is a better name, actually.
|
|
|
|
*/
|
2004-04-18 22:26:17 +00:00
|
|
|
params->hdr.tag = ATAG_INITRD2;
|
2003-12-06 23:55:10 +00:00
|
|
|
params->hdr.size = tag_size (tag_initrd);
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params->u.initrd.start = initrd_start;
|
|
|
|
params->u.initrd.size = initrd_end - initrd_start;
|
2002-11-03 00:24:07 +00:00
|
|
|
|
2003-12-06 23:55:10 +00:00
|
|
|
params = tag_next (params);
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 08:06:02 +00:00
|
|
|
static void setup_serial_tag(struct tag **tmp)
|
2005-05-19 22:39:42 +00:00
|
|
|
{
|
|
|
|
struct tag *params = *tmp;
|
|
|
|
struct tag_serialnr serialnr;
|
|
|
|
|
|
|
|
get_board_serial(&serialnr);
|
|
|
|
params->hdr.tag = ATAG_SERIAL;
|
|
|
|
params->hdr.size = tag_size (tag_serialnr);
|
|
|
|
params->u.serialnr.low = serialnr.low;
|
|
|
|
params->u.serialnr.high= serialnr.high;
|
|
|
|
params = tag_next (params);
|
|
|
|
*tmp = params;
|
|
|
|
}
|
|
|
|
|
2013-05-08 08:06:02 +00:00
|
|
|
static void setup_revision_tag(struct tag **in_params)
|
2005-01-12 00:15:14 +00:00
|
|
|
{
|
|
|
|
u32 rev = 0;
|
|
|
|
|
|
|
|
rev = get_board_rev();
|
|
|
|
params->hdr.tag = ATAG_REVISION;
|
|
|
|
params->hdr.size = tag_size (tag_revision);
|
|
|
|
params->u.revision.rev = rev;
|
|
|
|
params = tag_next (params);
|
|
|
|
}
|
|
|
|
|
2020-06-26 06:13:33 +00:00
|
|
|
static void setup_end_tag(struct bd_info *bd)
|
2002-11-03 00:24:07 +00:00
|
|
|
{
|
2003-12-06 23:55:10 +00:00
|
|
|
params->hdr.tag = ATAG_NONE;
|
|
|
|
params->hdr.size = 0;
|
2002-11-03 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
2012-10-19 02:00:04 +00:00
|
|
|
__weak void setup_board_tags(struct tag **in_params) {}
|
|
|
|
|
2014-07-12 13:24:03 +00:00
|
|
|
#ifdef CONFIG_ARM64
|
2013-09-19 16:06:43 +00:00
|
|
|
static void do_nonsec_virt_switch(void)
|
|
|
|
{
|
2013-12-14 03:47:35 +00:00
|
|
|
smp_kick_all_cpus();
|
2015-01-06 21:18:42 +00:00
|
|
|
dcache_disable(); /* flush cache before swtiching to EL2 */
|
2013-09-19 16:06:43 +00:00
|
|
|
}
|
2014-07-12 13:24:03 +00:00
|
|
|
#endif
|
2013-09-19 16:06:43 +00:00
|
|
|
|
2022-09-07 02:26:50 +00:00
|
|
|
__weak void board_prep_linux(struct bootm_headers *images) { }
|
2019-10-07 08:22:15 +00:00
|
|
|
|
2012-03-15 04:01:45 +00:00
|
|
|
/* Subcommand: PREP */
|
2022-09-07 02:26:50 +00:00
|
|
|
static void boot_prep_linux(struct bootm_headers *images)
|
2012-03-15 04:01:45 +00:00
|
|
|
{
|
2017-08-03 18:22:12 +00:00
|
|
|
char *commandline = env_get("bootargs");
|
2012-03-15 04:01:45 +00:00
|
|
|
|
2022-07-07 08:45:37 +00:00
|
|
|
if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) {
|
2012-03-15 04:01:45 +00:00
|
|
|
debug("using: FDT\n");
|
2013-05-08 08:06:03 +00:00
|
|
|
if (image_setup_linux(images)) {
|
2021-02-17 11:55:54 +00:00
|
|
|
panic("FDT creation failed!");
|
2012-03-15 04:01:45 +00:00
|
|
|
}
|
2013-05-08 08:06:02 +00:00
|
|
|
} else if (BOOTM_ENABLE_TAGS) {
|
2012-03-15 04:01:45 +00:00
|
|
|
debug("using: ATAGS\n");
|
|
|
|
setup_start_tag(gd->bd);
|
2013-05-08 08:06:02 +00:00
|
|
|
if (BOOTM_ENABLE_SERIAL_TAG)
|
|
|
|
setup_serial_tag(¶ms);
|
|
|
|
if (BOOTM_ENABLE_CMDLINE_TAG)
|
|
|
|
setup_commandline_tag(gd->bd, commandline);
|
|
|
|
if (BOOTM_ENABLE_REVISION_TAG)
|
|
|
|
setup_revision_tag(¶ms);
|
|
|
|
if (BOOTM_ENABLE_MEMORY_TAGS)
|
|
|
|
setup_memory_tags(gd->bd);
|
|
|
|
if (BOOTM_ENABLE_INITRD_TAG) {
|
2016-01-14 02:19:36 +00:00
|
|
|
/*
|
|
|
|
* In boot_ramdisk_high(), it may relocate ramdisk to
|
|
|
|
* a specified location. And set images->initrd_start &
|
|
|
|
* images->initrd_end to relocated ramdisk's start/end
|
|
|
|
* addresses. So use them instead of images->rd_start &
|
|
|
|
* images->rd_end when possible.
|
|
|
|
*/
|
|
|
|
if (images->initrd_start && images->initrd_end) {
|
|
|
|
setup_initrd_tag(gd->bd, images->initrd_start,
|
|
|
|
images->initrd_end);
|
|
|
|
} else if (images->rd_start && images->rd_end) {
|
2013-05-08 08:06:02 +00:00
|
|
|
setup_initrd_tag(gd->bd, images->rd_start,
|
|
|
|
images->rd_end);
|
|
|
|
}
|
|
|
|
}
|
2012-10-19 02:00:04 +00:00
|
|
|
setup_board_tags(¶ms);
|
2012-03-15 04:01:45 +00:00
|
|
|
setup_end_tag(gd->bd);
|
2013-05-08 08:06:02 +00:00
|
|
|
} else {
|
2021-02-17 11:55:54 +00:00
|
|
|
panic("FDT and ATAGS support not compiled in\n");
|
2012-03-15 04:01:45 +00:00
|
|
|
}
|
2019-10-07 08:22:15 +00:00
|
|
|
|
|
|
|
board_prep_linux(images);
|
2012-03-15 04:01:45 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 12:37:32 +00:00
|
|
|
__weak bool armv7_boot_nonsec_default(void)
|
2014-11-14 08:34:31 +00:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_ARMV7_BOOT_SEC_DEFAULT
|
2016-06-23 12:37:32 +00:00
|
|
|
return false;
|
2014-11-14 08:34:31 +00:00
|
|
|
#else
|
2016-06-23 12:37:32 +00:00
|
|
|
return true;
|
2014-11-14 08:34:31 +00:00
|
|
|
#endif
|
2016-06-23 12:37:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARMV7_NONSEC
|
|
|
|
bool armv7_boot_nonsec(void)
|
|
|
|
{
|
2017-08-03 18:22:12 +00:00
|
|
|
char *s = env_get("bootm_boot_mode");
|
2016-06-23 12:37:32 +00:00
|
|
|
bool nonsec = armv7_boot_nonsec_default();
|
2014-11-14 08:34:31 +00:00
|
|
|
|
|
|
|
if (s && !strcmp(s, "sec"))
|
|
|
|
nonsec = false;
|
|
|
|
|
|
|
|
if (s && !strcmp(s, "nonsec"))
|
|
|
|
nonsec = true;
|
|
|
|
|
|
|
|
return nonsec;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-11-10 02:49:03 +00:00
|
|
|
#ifdef CONFIG_ARM64
|
2016-11-10 02:49:04 +00:00
|
|
|
__weak void update_os_arch_secondary_cores(uint8_t os_arch)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-09-03 14:40:28 +00:00
|
|
|
#ifdef CONFIG_ARMV8_SWITCH_TO_EL1
|
2016-11-10 02:49:03 +00:00
|
|
|
static void switch_to_el1(void)
|
|
|
|
{
|
|
|
|
if ((IH_ARCH_DEFAULT == IH_ARCH_ARM64) &&
|
|
|
|
(images.os.arch == IH_ARCH_ARM))
|
|
|
|
armv8_switch_to_el1(0, (u64)gd->bd->bi_arch_number,
|
2017-01-17 01:39:17 +00:00
|
|
|
(u64)images.ft_addr, 0,
|
2016-11-10 02:49:03 +00:00
|
|
|
(u64)images.ep,
|
|
|
|
ES_TO_AARCH32);
|
|
|
|
else
|
2017-01-17 01:39:17 +00:00
|
|
|
armv8_switch_to_el1((u64)images.ft_addr, 0, 0, 0,
|
2016-11-10 02:49:03 +00:00
|
|
|
images.ep,
|
|
|
|
ES_TO_AARCH64);
|
|
|
|
}
|
|
|
|
#endif
|
2021-09-03 14:40:28 +00:00
|
|
|
#endif
|
2016-11-10 02:49:03 +00:00
|
|
|
|
2012-03-15 04:01:45 +00:00
|
|
|
/* Subcommand: GO */
|
2022-09-07 02:26:50 +00:00
|
|
|
static void boot_jump_linux(struct bootm_headers *images, int flag)
|
2012-03-15 04:01:45 +00:00
|
|
|
{
|
2013-12-14 03:47:35 +00:00
|
|
|
#ifdef CONFIG_ARM64
|
2014-08-14 10:42:35 +00:00
|
|
|
void (*kernel_entry)(void *fdt_addr, void *res0, void *res1,
|
|
|
|
void *res2);
|
2013-12-14 03:47:35 +00:00
|
|
|
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
|
|
|
|
2014-08-14 10:42:35 +00:00
|
|
|
kernel_entry = (void (*)(void *fdt_addr, void *res0, void *res1,
|
|
|
|
void *res2))images->ep;
|
2013-12-14 03:47:35 +00:00
|
|
|
|
|
|
|
debug("## Transferring control to Linux (at address %lx)...\n",
|
|
|
|
(ulong) kernel_entry);
|
|
|
|
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
|
|
|
|
|
|
|
announce_and_cleanup(fake);
|
|
|
|
|
2014-07-12 13:23:58 +00:00
|
|
|
if (!fake) {
|
2016-12-08 03:58:25 +00:00
|
|
|
#ifdef CONFIG_ARMV8_PSCI
|
|
|
|
armv8_setup_psci();
|
|
|
|
#endif
|
2014-07-12 13:23:58 +00:00
|
|
|
do_nonsec_virt_switch();
|
2016-11-10 02:49:03 +00:00
|
|
|
|
2016-11-10 02:49:04 +00:00
|
|
|
update_os_arch_secondary_cores(images->os.arch);
|
|
|
|
|
2021-08-19 15:53:13 +00:00
|
|
|
#ifdef CONFIG_ARMV8_SWITCH_TO_EL1
|
2021-09-03 14:40:28 +00:00
|
|
|
armv8_switch_to_el2((u64)images->ft_addr, 0, 0, 0,
|
|
|
|
(u64)switch_to_el1, ES_TO_AARCH64);
|
|
|
|
#else
|
|
|
|
if ((IH_ARCH_DEFAULT == IH_ARCH_ARM64) &&
|
|
|
|
(images->os.arch == IH_ARCH_ARM))
|
|
|
|
armv8_switch_to_el2(0, (u64)gd->bd->bi_arch_number,
|
|
|
|
(u64)images->ft_addr, 0,
|
|
|
|
(u64)images->ep,
|
|
|
|
ES_TO_AARCH32);
|
|
|
|
else
|
2021-08-19 15:53:13 +00:00
|
|
|
armv8_switch_to_el2((u64)images->ft_addr, 0, 0, 0,
|
2021-09-03 14:40:28 +00:00
|
|
|
images->ep,
|
|
|
|
ES_TO_AARCH64);
|
|
|
|
#endif
|
2014-07-12 13:23:58 +00:00
|
|
|
}
|
2013-12-14 03:47:35 +00:00
|
|
|
#else
|
2012-03-15 04:01:45 +00:00
|
|
|
unsigned long machid = gd->bd->bi_arch_number;
|
|
|
|
char *s;
|
|
|
|
void (*kernel_entry)(int zero, int arch, uint params);
|
2012-04-19 11:34:00 +00:00
|
|
|
unsigned long r2;
|
2013-06-20 04:15:10 +00:00
|
|
|
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
2012-03-15 04:01:45 +00:00
|
|
|
|
|
|
|
kernel_entry = (void (*)(int, int, uint))images->ep;
|
2017-04-25 09:07:46 +00:00
|
|
|
#ifdef CONFIG_CPU_V7M
|
|
|
|
ulong addr = (ulong)kernel_entry | 1;
|
|
|
|
kernel_entry = (void *)addr;
|
|
|
|
#endif
|
2017-08-03 18:22:12 +00:00
|
|
|
s = env_get("machid");
|
2012-03-15 04:01:45 +00:00
|
|
|
if (s) {
|
2015-11-24 08:54:20 +00:00
|
|
|
if (strict_strtoul(s, 16, &machid) < 0) {
|
|
|
|
debug("strict_strtoul failed!\n");
|
|
|
|
return;
|
|
|
|
}
|
2012-03-15 04:01:45 +00:00
|
|
|
printf("Using machid 0x%lx from environment\n", machid);
|
|
|
|
}
|
|
|
|
|
|
|
|
debug("## Transferring control to Linux (at address %08lx)" \
|
|
|
|
"...\n", (ulong) kernel_entry);
|
|
|
|
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
2013-06-20 04:15:10 +00:00
|
|
|
announce_and_cleanup(fake);
|
2012-04-19 11:34:00 +00:00
|
|
|
|
2021-09-26 01:43:21 +00:00
|
|
|
if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len)
|
2012-04-19 11:34:00 +00:00
|
|
|
r2 = (unsigned long)images->ft_addr;
|
|
|
|
else
|
|
|
|
r2 = gd->bd->bi_boot_params;
|
|
|
|
|
2014-07-12 13:23:58 +00:00
|
|
|
if (!fake) {
|
2015-04-21 05:18:24 +00:00
|
|
|
#ifdef CONFIG_ARMV7_NONSEC
|
2014-12-21 09:45:11 +00:00
|
|
|
if (armv7_boot_nonsec()) {
|
2014-11-14 08:34:31 +00:00
|
|
|
armv7_init_nonsec();
|
|
|
|
secure_ram_addr(_do_nonsec_entry)(kernel_entry,
|
|
|
|
0, machid, r2);
|
|
|
|
} else
|
2014-07-12 13:24:03 +00:00
|
|
|
#endif
|
2014-11-14 08:34:31 +00:00
|
|
|
kernel_entry(0, machid, r2);
|
2014-07-12 13:23:58 +00:00
|
|
|
}
|
2013-12-14 03:47:35 +00:00
|
|
|
#endif
|
2012-03-15 04:01:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Main Entry point for arm bootm implementation
|
|
|
|
*
|
|
|
|
* Modeled after the powerpc implementation
|
|
|
|
* DIFFERENCE: Instead of calling prep and go at the end
|
|
|
|
* they are called if subcommand is equal 0.
|
|
|
|
*/
|
2020-05-10 17:40:03 +00:00
|
|
|
int do_bootm_linux(int flag, int argc, char *const argv[],
|
2022-09-07 02:26:50 +00:00
|
|
|
struct bootm_headers *images)
|
2012-03-15 04:01:45 +00:00
|
|
|
{
|
|
|
|
/* No need for those on ARM */
|
|
|
|
if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (flag & BOOTM_STATE_OS_PREP) {
|
|
|
|
boot_prep_linux(images);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-06-20 04:15:10 +00:00
|
|
|
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
|
|
|
boot_jump_linux(images, flag);
|
2012-03-15 04:01:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
boot_prep_linux(images);
|
2013-06-20 04:15:10 +00:00
|
|
|
boot_jump_linux(images, flag);
|
2012-03-15 04:01:45 +00:00
|
|
|
return 0;
|
2010-10-13 19:57:36 +00:00
|
|
|
}
|
2012-03-14 21:52:45 +00:00
|
|
|
|
common/cmd_bootm: extend do_bootm_vxworks to support the new VxWorks boot interface.
The next version VxWorks adopts device tree (for PowerPC and ARM) as its hardware
description mechanism. For PowerPC, the boot interface conforms to
the ePAPR standard, which is:
void (*kernel_entry)(ulong fdt_addr,
ulong r4 /* 0 */,
ulong r5 /* 0 */,
ulong r6 /* EPAPR_MAGIC */, ulong r7 /* IMA size */,
ulong r8 /* 0 */, ulong r9 /* 0 */)
For ARM, the boot interface is:
void (*kernel_entry)(void *fdt_addr)
Signed-off-by: Miao Yan <miao.yan@windriver.com>
[trini: Fix build error when !CONFIG_OF_FDT is set, typo on PowerPC,
missing extern ft_fixup_num_cores]
Signed-off-by: Tom Rini <trini@ti.com>
2013-11-28 09:51:38 +00:00
|
|
|
#if defined(CONFIG_BOOTM_VXWORKS)
|
2022-09-07 02:26:50 +00:00
|
|
|
void boot_prep_vxworks(struct bootm_headers *images)
|
common/cmd_bootm: extend do_bootm_vxworks to support the new VxWorks boot interface.
The next version VxWorks adopts device tree (for PowerPC and ARM) as its hardware
description mechanism. For PowerPC, the boot interface conforms to
the ePAPR standard, which is:
void (*kernel_entry)(ulong fdt_addr,
ulong r4 /* 0 */,
ulong r5 /* 0 */,
ulong r6 /* EPAPR_MAGIC */, ulong r7 /* IMA size */,
ulong r8 /* 0 */, ulong r9 /* 0 */)
For ARM, the boot interface is:
void (*kernel_entry)(void *fdt_addr)
Signed-off-by: Miao Yan <miao.yan@windriver.com>
[trini: Fix build error when !CONFIG_OF_FDT is set, typo on PowerPC,
missing extern ft_fixup_num_cores]
Signed-off-by: Tom Rini <trini@ti.com>
2013-11-28 09:51:38 +00:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_OF_LIBFDT)
|
|
|
|
int off;
|
|
|
|
|
|
|
|
if (images->ft_addr) {
|
|
|
|
off = fdt_path_offset(images->ft_addr, "/memory");
|
2018-05-04 08:49:11 +00:00
|
|
|
if (off > 0) {
|
2014-07-12 13:24:06 +00:00
|
|
|
if (arch_fixup_fdt(images->ft_addr))
|
common/cmd_bootm: extend do_bootm_vxworks to support the new VxWorks boot interface.
The next version VxWorks adopts device tree (for PowerPC and ARM) as its hardware
description mechanism. For PowerPC, the boot interface conforms to
the ePAPR standard, which is:
void (*kernel_entry)(ulong fdt_addr,
ulong r4 /* 0 */,
ulong r5 /* 0 */,
ulong r6 /* EPAPR_MAGIC */, ulong r7 /* IMA size */,
ulong r8 /* 0 */, ulong r9 /* 0 */)
For ARM, the boot interface is:
void (*kernel_entry)(void *fdt_addr)
Signed-off-by: Miao Yan <miao.yan@windriver.com>
[trini: Fix build error when !CONFIG_OF_FDT is set, typo on PowerPC,
missing extern ft_fixup_num_cores]
Signed-off-by: Tom Rini <trini@ti.com>
2013-11-28 09:51:38 +00:00
|
|
|
puts("## WARNING: fixup memory failed!\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
cleanup_before_linux();
|
|
|
|
}
|
2022-09-07 02:26:50 +00:00
|
|
|
|
|
|
|
void boot_jump_vxworks(struct bootm_headers *images)
|
common/cmd_bootm: extend do_bootm_vxworks to support the new VxWorks boot interface.
The next version VxWorks adopts device tree (for PowerPC and ARM) as its hardware
description mechanism. For PowerPC, the boot interface conforms to
the ePAPR standard, which is:
void (*kernel_entry)(ulong fdt_addr,
ulong r4 /* 0 */,
ulong r5 /* 0 */,
ulong r6 /* EPAPR_MAGIC */, ulong r7 /* IMA size */,
ulong r8 /* 0 */, ulong r9 /* 0 */)
For ARM, the boot interface is:
void (*kernel_entry)(void *fdt_addr)
Signed-off-by: Miao Yan <miao.yan@windriver.com>
[trini: Fix build error when !CONFIG_OF_FDT is set, typo on PowerPC,
missing extern ft_fixup_num_cores]
Signed-off-by: Tom Rini <trini@ti.com>
2013-11-28 09:51:38 +00:00
|
|
|
{
|
2018-04-10 09:36:36 +00:00
|
|
|
#if defined(CONFIG_ARM64) && defined(CONFIG_ARMV8_PSCI)
|
|
|
|
armv8_setup_psci();
|
|
|
|
smp_kick_all_cpus();
|
|
|
|
#endif
|
|
|
|
|
common/cmd_bootm: extend do_bootm_vxworks to support the new VxWorks boot interface.
The next version VxWorks adopts device tree (for PowerPC and ARM) as its hardware
description mechanism. For PowerPC, the boot interface conforms to
the ePAPR standard, which is:
void (*kernel_entry)(ulong fdt_addr,
ulong r4 /* 0 */,
ulong r5 /* 0 */,
ulong r6 /* EPAPR_MAGIC */, ulong r7 /* IMA size */,
ulong r8 /* 0 */, ulong r9 /* 0 */)
For ARM, the boot interface is:
void (*kernel_entry)(void *fdt_addr)
Signed-off-by: Miao Yan <miao.yan@windriver.com>
[trini: Fix build error when !CONFIG_OF_FDT is set, typo on PowerPC,
missing extern ft_fixup_num_cores]
Signed-off-by: Tom Rini <trini@ti.com>
2013-11-28 09:51:38 +00:00
|
|
|
/* ARM VxWorks requires device tree physical address to be passed */
|
|
|
|
((void (*)(void *))images->ep)(images->ft_addr);
|
|
|
|
}
|
|
|
|
#endif
|