blob: c58802034bd049dd4feb5df34e225dd833851624 [file] [log] [blame]
Stephan Gerhold14fdf072021-12-01 20:01:11 +01001/*
Stephan Gerhold04058392023-03-22 18:15:15 +01002 * Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net>
Stephan Gerhold14fdf072021-12-01 20:01:11 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <assert.h>
8
9#include <arch.h>
10#include <common/debug.h>
Stephan Gerhold14fdf072021-12-01 20:01:11 +010011#include <plat/common/platform.h>
12
Stephan Gerhold4bc53a12022-08-28 15:18:55 +020013#include "msm8916_config.h"
14#include "msm8916_setup.h"
Stephan Gerhold14fdf072021-12-01 20:01:11 +010015
16static struct {
17 entry_point_info_t bl32;
18 entry_point_info_t bl33;
19} image_ep_info = {
20 /* BL32 entry point */
21 SET_STATIC_PARAM_HEAD(bl32, PARAM_EP, VERSION_1,
22 entry_point_info_t, SECURE),
23 .bl32.pc = BL32_BASE,
24
25 /* BL33 entry point */
26 SET_STATIC_PARAM_HEAD(bl33, PARAM_EP, VERSION_1,
27 entry_point_info_t, NON_SECURE),
28 .bl33.pc = PRELOADED_BL33_BASE,
29 .bl33.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS),
30};
31
Stephan Gerhold14fdf072021-12-01 20:01:11 +010032void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
33 u_register_t arg2, u_register_t arg3)
34{
Stephan Gerhold4bc53a12022-08-28 15:18:55 +020035 msm8916_early_platform_setup();
Stephan Gerhold1b783462022-09-16 20:42:49 +020036 msm8916_configure_early();
Stephan Gerhold14fdf072021-12-01 20:01:11 +010037}
38
39void bl31_plat_arch_setup(void)
40{
Stephan Gerhold4bc53a12022-08-28 15:18:55 +020041 msm8916_plat_arch_setup(BL31_BASE, BL31_END - BL31_BASE);
Stephan Gerhold14fdf072021-12-01 20:01:11 +010042 enable_mmu_el3(0);
43}
44
45void bl31_platform_setup(void)
46{
Stephan Gerhold253fef02021-12-01 20:03:33 +010047 INFO("BL31: Platform setup start\n");
Stephan Gerhold4bc53a12022-08-28 15:18:55 +020048 msm8916_platform_setup();
49 msm8916_configure();
Stephan Gerhold253fef02021-12-01 20:03:33 +010050 INFO("BL31: Platform setup done\n");
Stephan Gerhold14fdf072021-12-01 20:01:11 +010051}
52
53entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
54{
55 switch (type) {
56 case SECURE:
57 return &image_ep_info.bl32;
58 case NON_SECURE:
59 return &image_ep_info.bl33;
60 default:
61 assert(sec_state_is_valid(type));
62 return NULL;
63 }
64}