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 | |
| 7 | #include <arch.h> |
| 8 | #include <arch_helpers.h> |
| 9 | #include <assert.h> |
| 10 | #include <bl_common.h> |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 11 | #include <platform_def.h> |
| 12 | #include "qemu_private.h" |
| 13 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 14 | /* Data structure which holds the extents of the trusted SRAM for BL1*/ |
| 15 | static meminfo_t bl1_tzram_layout; |
| 16 | |
| 17 | |
| 18 | meminfo_t *bl1_plat_sec_mem_layout(void) |
| 19 | { |
| 20 | return &bl1_tzram_layout; |
| 21 | } |
| 22 | |
| 23 | /******************************************************************************* |
| 24 | * Perform any BL1 specific platform actions. |
| 25 | ******************************************************************************/ |
| 26 | void bl1_early_platform_setup(void) |
| 27 | { |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 28 | /* Initialize the console to provide early debug support */ |
Michalis Pappas | cca6cb7 | 2018-03-04 15:43:38 +0800 | [diff] [blame] | 29 | qemu_console_init(); |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 30 | |
| 31 | /* Allow BL1 to see the whole Trusted RAM */ |
| 32 | bl1_tzram_layout.total_base = BL_RAM_BASE; |
| 33 | bl1_tzram_layout.total_size = BL_RAM_SIZE; |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | /****************************************************************************** |
| 37 | * Perform the very early platform specific architecture setup. This only |
| 38 | * does basic initialization. Later architectural setup (bl1_arch_setup()) |
| 39 | * does not do anything platform specific. |
| 40 | *****************************************************************************/ |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 41 | #ifdef AARCH32 |
| 42 | #define QEMU_CONFIGURE_BL1_MMU(...) qemu_configure_mmu_secure(__VA_ARGS__) |
| 43 | #else |
| 44 | #define QEMU_CONFIGURE_BL1_MMU(...) qemu_configure_mmu_el3(__VA_ARGS__) |
| 45 | #endif |
| 46 | |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 47 | void bl1_plat_arch_setup(void) |
| 48 | { |
Etienne Carriere | 911de8c | 2018-02-02 13:23:22 +0100 | [diff] [blame] | 49 | QEMU_CONFIGURE_BL1_MMU(bl1_tzram_layout.total_base, |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 50 | bl1_tzram_layout.total_size, |
Michalis Pappas | ba86112 | 2018-02-28 14:36:03 +0800 | [diff] [blame] | 51 | BL_CODE_BASE, BL1_CODE_END, |
| 52 | BL1_RO_DATA_BASE, BL1_RO_DATA_END, |
Masahiro Yamada | 0fac5af | 2016-12-28 16:11:41 +0900 | [diff] [blame] | 53 | BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_END); |
Jens Wiklander | 52c798e | 2015-12-07 14:37:10 +0100 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | void bl1_platform_setup(void) |
| 57 | { |
| 58 | plat_qemu_io_setup(); |
| 59 | } |