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 | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | void bl31_plat_arch_setup(void) |
| 39 | { |
Stephan Gerhold | 4bc53a1 | 2022-08-28 15:18:55 +0200 | [diff] [blame] | 40 | msm8916_plat_arch_setup(BL31_BASE, BL31_END - BL31_BASE); |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 41 | enable_mmu_el3(0); |
| 42 | } |
| 43 | |
| 44 | void bl31_platform_setup(void) |
| 45 | { |
Stephan Gerhold | 253fef0 | 2021-12-01 20:03:33 +0100 | [diff] [blame] | 46 | INFO("BL31: Platform setup start\n"); |
Stephan Gerhold | 4bc53a1 | 2022-08-28 15:18:55 +0200 | [diff] [blame] | 47 | msm8916_platform_setup(); |
| 48 | msm8916_configure(); |
Stephan Gerhold | 253fef0 | 2021-12-01 20:03:33 +0100 | [diff] [blame] | 49 | INFO("BL31: Platform setup done\n"); |
Stephan Gerhold | 14fdf07 | 2021-12-01 20:01:11 +0100 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | entry_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 | } |