summaryrefslogtreecommitdiffstats
path: root/plat/qti/msm8916/msm8916_bl31_setup.c
blob: c58802034bd049dd4feb5df34e225dd833851624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net>
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <assert.h>

#include <arch.h>
#include <common/debug.h>
#include <plat/common/platform.h>

#include "msm8916_config.h"
#include "msm8916_setup.h"

static struct {
	entry_point_info_t bl32;
	entry_point_info_t bl33;
} image_ep_info = {
	/* BL32 entry point */
	SET_STATIC_PARAM_HEAD(bl32, PARAM_EP, VERSION_1,
			      entry_point_info_t, SECURE),
	.bl32.pc = BL32_BASE,

	/* BL33 entry point */
	SET_STATIC_PARAM_HEAD(bl33, PARAM_EP, VERSION_1,
			      entry_point_info_t, NON_SECURE),
	.bl33.pc = PRELOADED_BL33_BASE,
	.bl33.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS),
};

void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
				u_register_t arg2, u_register_t arg3)
{
	msm8916_early_platform_setup();
	msm8916_configure_early();
}

void bl31_plat_arch_setup(void)
{
	msm8916_plat_arch_setup(BL31_BASE, BL31_END - BL31_BASE);
	enable_mmu_el3(0);
}

void bl31_platform_setup(void)
{
	INFO("BL31: Platform setup start\n");
	msm8916_platform_setup();
	msm8916_configure();
	INFO("BL31: Platform setup done\n");
}

entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
{
	switch (type) {
	case SECURE:
		return &image_ep_info.bl32;
	case NON_SECURE:
		return &image_ep_info.bl33;
	default:
		assert(sec_state_is_valid(type));
		return NULL;
	}
}