Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 1 | /* |
Roberto Vargas | 2ca18d9 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch_helpers.h> |
| 8 | #include <arm_def.h> |
| 9 | #include <bl_common.h> |
Soby Mathew | db14130 | 2018-03-06 15:22:55 +0000 | [diff] [blame] | 10 | #include <generic_delay_timer.h> |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 11 | #include <plat_arm.h> |
Isla Mitchell | d254879 | 2017-07-14 10:48:25 +0100 | [diff] [blame] | 12 | #include <platform_def.h> |
Roberto Vargas | 2ca18d9 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 13 | #include <platform.h> |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 14 | #include <string.h> |
| 15 | |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 16 | /* Weak definitions may be overridden in specific ARM standard platform */ |
| 17 | #pragma weak bl2u_platform_setup |
| 18 | #pragma weak bl2u_early_platform_setup |
| 19 | #pragma weak bl2u_plat_arch_setup |
| 20 | |
| 21 | /* |
| 22 | * Perform ARM standard platform setup for BL2U |
| 23 | */ |
| 24 | void arm_bl2u_platform_setup(void) |
| 25 | { |
| 26 | /* Initialize the secure environment */ |
| 27 | plat_arm_security_setup(); |
| 28 | } |
| 29 | |
| 30 | void bl2u_platform_setup(void) |
| 31 | { |
| 32 | arm_bl2u_platform_setup(); |
| 33 | } |
| 34 | |
| 35 | void arm_bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info) |
| 36 | { |
| 37 | /* Initialize the console to provide early debug support */ |
Antonio Nino Diaz | 23ede6a | 2018-06-19 09:29:36 +0100 | [diff] [blame] | 38 | arm_console_boot_init(); |
| 39 | |
Soby Mathew | db14130 | 2018-03-06 15:22:55 +0000 | [diff] [blame] | 40 | generic_delay_timer_init(); |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | /******************************************************************************* |
| 44 | * BL1 can pass platform dependent information to BL2U in x1. |
| 45 | * In case of ARM CSS platforms x1 contains SCP_BL2U image info. |
| 46 | * In case of ARM FVP platforms x1 is not used. |
| 47 | * In both cases, x0 contains the extents of the memory available to BL2U |
| 48 | ******************************************************************************/ |
| 49 | void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info) |
| 50 | { |
| 51 | arm_bl2u_early_platform_setup(mem_layout, plat_info); |
| 52 | } |
| 53 | |
| 54 | /******************************************************************************* |
| 55 | * Perform the very early platform specific architectural setup here. At the |
| 56 | * moment this is only initializes the mmu in a quick and dirty way. |
| 57 | * The memory that is used by BL2U is only mapped. |
| 58 | ******************************************************************************/ |
| 59 | void arm_bl2u_plat_arch_setup(void) |
| 60 | { |
Sandrine Bailleux | a0e505e | 2016-06-20 10:10:40 +0100 | [diff] [blame] | 61 | arm_setup_page_tables(BL2U_BASE, |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 62 | BL31_LIMIT, |
Sandrine Bailleux | ecdc4d3 | 2016-07-08 14:38:16 +0100 | [diff] [blame] | 63 | BL_CODE_BASE, |
Masahiro Yamada | 51bef61 | 2017-01-18 02:10:08 +0900 | [diff] [blame] | 64 | BL_CODE_END, |
Sandrine Bailleux | ecdc4d3 | 2016-07-08 14:38:16 +0100 | [diff] [blame] | 65 | BL_RO_DATA_BASE, |
Masahiro Yamada | 51bef61 | 2017-01-18 02:10:08 +0900 | [diff] [blame] | 66 | BL_RO_DATA_END |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 67 | #if USE_COHERENT_MEM |
| 68 | , |
Masahiro Yamada | 0fac5af | 2016-12-28 16:11:41 +0900 | [diff] [blame] | 69 | BL_COHERENT_RAM_BASE, |
| 70 | BL_COHERENT_RAM_END |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 71 | #endif |
| 72 | ); |
Yatharth Kochar | 18dfb30 | 2016-11-22 11:06:03 +0000 | [diff] [blame] | 73 | #ifdef AARCH32 |
| 74 | enable_mmu_secure(0); |
| 75 | #else |
Sandrine Bailleux | 4a1267a | 2016-05-18 16:11:47 +0100 | [diff] [blame] | 76 | enable_mmu_el1(0); |
Yatharth Kochar | 18dfb30 | 2016-11-22 11:06:03 +0000 | [diff] [blame] | 77 | #endif |
Yatharth Kochar | 3a11eda | 2015-10-14 15:28:11 +0100 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | void bl2u_plat_arch_setup(void) |
| 81 | { |
| 82 | arm_bl2u_plat_arch_setup(); |
| 83 | } |