Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 1 | /* |
Stephan Gerhold | 0405839 | 2023-03-22 18:15:15 +0100 | [diff] [blame] | 2 | * Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net> |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
| 8 | |
| 9 | #include <arch.h> |
| 10 | #include <common/debug.h> |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 11 | #include <plat/common/platform.h> |
| 12 | |
Stephan Gerhold | 4bc53a1 | 2022-08-28 15:18:55 +0200 | [diff] [blame] | 13 | #include "msm8916_config.h" |
| 14 | #include "msm8916_setup.h" |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 15 | |
| 16 | static 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 Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 32 | void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, |
| 33 | u_register_t arg2, u_register_t arg3) |
| 34 | { |
Stephan Gerhold | 4bc53a1 | 2022-08-28 15:18:55 +0200 | [diff] [blame] | 35 | msm8916_early_platform_setup(); |
Stephan Gerhold | 1b78346 | 2022-09-16 20:42:49 +0200 | [diff] [blame] | 36 | msm8916_configure_early(); |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | void bl31_plat_arch_setup(void) |
| 40 | { |
Stephan Gerhold | 4bc53a1 | 2022-08-28 15:18:55 +0200 | [diff] [blame] | 41 | msm8916_plat_arch_setup(BL31_BASE, BL31_END - BL31_BASE); |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 42 | enable_mmu_el3(0); |
| 43 | } |
| 44 | |
| 45 | void bl31_platform_setup(void) |
| 46 | { |
Stephan Gerhold | 253fef0 | 2021-12-01 20:03:33 +0100 | [diff] [blame] | 47 | INFO("BL31: Platform setup start\n"); |
Stephan Gerhold | 4bc53a1 | 2022-08-28 15:18:55 +0200 | [diff] [blame] | 48 | msm8916_platform_setup(); |
| 49 | msm8916_configure(); |
Stephan Gerhold | 253fef0 | 2021-12-01 20:03:33 +0100 | [diff] [blame] | 50 | INFO("BL31: Platform setup done\n"); |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | entry_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 | } |