Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 7 | #include <assert.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 9 | #include <platform_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | |
| 11 | #include <arch.h> |
| 12 | #include <arch_helpers.h> |
| 13 | #include <common/bl_common.h> |
| 14 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 15 | #include "qemu_private.h" |
| 16 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 17 | /* Data structure which holds the extents of the trusted SRAM for BL1*/ |
| 18 | static meminfo_t bl1_tzram_layout; |
| 19 | |
| 20 | |
| 21 | meminfo_t *bl1_plat_sec_mem_layout(void) |
| 22 | { |
| 23 | return &bl1_tzram_layout; |
| 24 | } |
| 25 | |
| 26 | /******************************************************************************* |
| 27 | * Perform any BL1 specific platform actions. |
| 28 | ******************************************************************************/ |
| 29 | void bl1_early_platform_setup(void) |
| 30 | { |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 31 | /* Initialize the console to provide early debug support */ |
Michalis Pappas | cca6cb7 | 2018-03-04 15:43:38 +0800 | [diff] [blame] | 32 | qemu_console_init(); |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 33 | |
| 34 | /* Allow BL1 to see the whole Trusted RAM */ |
| 35 | bl1_tzram_layout.total_base = BL_RAM_BASE; |
| 36 | bl1_tzram_layout.total_size = BL_RAM_SIZE; |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | /****************************************************************************** |
| 40 | * Perform the very early platform specific architecture setup. This only |
| 41 | * does basic initialization. Later architectural setup (bl1_arch_setup()) |
| 42 | * does not do anything platform specific. |
| 43 | *****************************************************************************/ |
Julius Werner | 8e0ef0f | 2019-07-09 14:02:43 -0700 | [diff] [blame] | 44 | #ifdef __aarch64__ |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 45 | #define QEMU_CONFIGURE_BL1_MMU(...) qemu_configure_mmu_el3(__VA_ARGS__) |
Julius Werner | 8e0ef0f | 2019-07-09 14:02:43 -0700 | [diff] [blame] | 46 | #else |
| 47 | #define QEMU_CONFIGURE_BL1_MMU(...) qemu_configure_mmu_svc_mon(__VA_ARGS__) |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 48 | #endif |
| 49 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 50 | void bl1_plat_arch_setup(void) |
| 51 | { |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 52 | QEMU_CONFIGURE_BL1_MMU(bl1_tzram_layout.total_base, |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 53 | bl1_tzram_layout.total_size, |
Michalis Pappas | ba86112 | 2018-02-28 14:36:03 +0800 | [diff] [blame] | 54 | BL_CODE_BASE, BL1_CODE_END, |
| 55 | BL1_RO_DATA_BASE, BL1_RO_DATA_END, |
Masahiro Yamada | 0fac5af | 2016-12-28 16:11:41 +0900 | [diff] [blame] | 56 | BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_END); |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | void bl1_platform_setup(void) |
| 60 | { |
| 61 | plat_qemu_io_setup(); |
| 62 | } |