blob: 449be7f89798178cdb09ca776d3b99464171b73c [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 Gerhold14fdf072021-12-01 20:01:11 +010036}
37
38void bl31_plat_arch_setup(void)
39{
Stephan Gerhold4bc53a12022-08-28 15:18:55 +020040 msm8916_plat_arch_setup(BL31_BASE, BL31_END - BL31_BASE);
Stephan Gerhold14fdf072021-12-01 20:01:11 +010041 enable_mmu_el3(0);
42}
43
44void bl31_platform_setup(void)
45{
Stephan Gerhold253fef02021-12-01 20:03:33 +010046 INFO("BL31: Platform setup start\n");
Stephan Gerhold4bc53a12022-08-28 15:18:55 +020047 msm8916_platform_setup();
48 msm8916_configure();
Stephan Gerhold253fef02021-12-01 20:03:33 +010049 INFO("BL31: Platform setup done\n");
Stephan Gerhold14fdf072021-12-01 20:01:11 +010050}
51
52entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
53{
54 switch (type) {
55 case SECURE:
56 return &image_ep_info.bl32;
57 case NON_SECURE:
58 return &image_ep_info.bl33;
59 default:
60 assert(sec_state_is_valid(type));
61 return NULL;
62 }
63}