2013-10-25 09:08:21 +01:00
|
|
|
/*
|
2018-02-12 12:36:17 +00:00
|
|
|
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
|
2013-10-25 09:08:21 +01:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2013-10-25 09:08:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <arch_helpers.h>
|
2015-05-19 11:54:12 +01:00
|
|
|
#include <auth_mod.h>
|
2015-10-10 19:06:53 +01:00
|
|
|
#include <bl1.h>
|
2018-02-12 12:36:17 +00:00
|
|
|
#include <bl2.h>
|
2013-10-25 09:08:21 +01:00
|
|
|
#include <bl_common.h>
|
2017-02-16 16:17:19 +00:00
|
|
|
#include <console.h>
|
2014-04-09 13:13:04 +01:00
|
|
|
#include <debug.h>
|
2014-04-09 13:14:54 +01:00
|
|
|
#include <platform.h>
|
2014-04-17 18:53:42 +01:00
|
|
|
#include "bl2_private.h"
|
2013-10-25 09:08:21 +01:00
|
|
|
|
2017-10-30 14:43:43 +00:00
|
|
|
#ifdef AARCH32
|
|
|
|
#define NEXT_IMAGE "BL32"
|
|
|
|
#else
|
|
|
|
#define NEXT_IMAGE "BL31"
|
|
|
|
#endif
|
2014-06-24 14:19:36 +01:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* The only thing to do in BL2 is to load further images and pass control to
|
2016-09-12 16:10:33 +01:00
|
|
|
* next BL. The memory occupied by BL2 will be reclaimed by BL3x stages. BL2
|
|
|
|
* runs entirely in S-EL1.
|
2014-06-24 14:19:36 +01:00
|
|
|
******************************************************************************/
|
|
|
|
void bl2_main(void)
|
|
|
|
{
|
2016-09-12 16:10:33 +01:00
|
|
|
entry_point_info_t *next_bl_ep_info;
|
2014-06-24 14:19:36 +01:00
|
|
|
|
2014-07-29 17:14:00 +01:00
|
|
|
NOTICE("BL2: %s\n", version_string);
|
|
|
|
NOTICE("BL2: %s\n", build_message);
|
|
|
|
|
2014-06-24 14:19:36 +01:00
|
|
|
/* Perform remaining generic architectural setup in S-EL1 */
|
|
|
|
bl2_arch_setup();
|
|
|
|
|
2015-01-28 16:46:57 +00:00
|
|
|
#if TRUSTED_BOARD_BOOT
|
|
|
|
/* Initialize authentication module */
|
2015-05-19 11:54:12 +01:00
|
|
|
auth_mod_init();
|
2015-01-28 16:46:57 +00:00
|
|
|
#endif /* TRUSTED_BOARD_BOOT */
|
|
|
|
|
2017-09-26 12:53:01 +01:00
|
|
|
/* initialize boot source */
|
|
|
|
bl2_plat_preload_setup();
|
|
|
|
|
2016-09-12 16:10:33 +01:00
|
|
|
/* Load the subsequent bootloader images. */
|
|
|
|
next_bl_ep_info = bl2_load_images();
|
2014-05-28 22:22:55 +01:00
|
|
|
|
2016-06-30 14:52:12 +01:00
|
|
|
#ifdef AARCH32
|
|
|
|
/*
|
|
|
|
* For AArch32 state BL1 and BL2 share the MMU setup.
|
|
|
|
* Given that BL2 does not map BL1 regions, MMU needs
|
|
|
|
* to be disabled in order to go back to BL1.
|
|
|
|
*/
|
|
|
|
disable_mmu_icache_secure();
|
|
|
|
#endif /* AARCH32 */
|
|
|
|
|
2017-10-30 14:43:43 +00:00
|
|
|
|
|
|
|
#if !BL2_AT_EL3
|
2017-02-16 16:17:19 +00:00
|
|
|
console_flush();
|
|
|
|
|
2013-10-25 09:08:21 +01:00
|
|
|
/*
|
2016-09-12 16:10:33 +01:00
|
|
|
* Run next BL image via an SMC to BL1. Information on how to pass
|
|
|
|
* control to the BL32 (if present) and BL33 software images will
|
|
|
|
* be passed to next BL image as an argument.
|
2013-10-25 09:08:21 +01:00
|
|
|
*/
|
2016-09-12 16:10:33 +01:00
|
|
|
smc(BL1_SMC_RUN_IMAGE, (unsigned long)next_bl_ep_info, 0, 0, 0, 0, 0, 0);
|
2017-10-30 14:43:43 +00:00
|
|
|
#else
|
|
|
|
NOTICE("BL2: Booting " NEXT_IMAGE "\n");
|
|
|
|
print_entry_point_info(next_bl_ep_info);
|
|
|
|
console_flush();
|
|
|
|
|
|
|
|
bl2_run_next_image(next_bl_ep_info);
|
|
|
|
#endif
|
2013-10-25 09:08:21 +01:00
|
|
|
}
|