Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch_helpers.h> |
| 8 | #include <assert.h> |
| 9 | #include <bl_common.h> |
| 10 | #include <debug.h> |
| 11 | #include <gicv2.h> |
| 12 | #include <mmio.h> |
| 13 | #include <platform_def.h> |
| 14 | #include <platform.h> |
| 15 | #include <stm32mp1_private.h> |
| 16 | #include <xlat_tables_v2.h> |
| 17 | |
| 18 | #define MAP_SRAM MAP_REGION_FLAT(STM32MP1_SRAM_BASE, \ |
| 19 | STM32MP1_SRAM_SIZE, \ |
| 20 | MT_MEMORY | \ |
| 21 | MT_RW | \ |
| 22 | MT_SECURE | \ |
| 23 | MT_EXECUTE_NEVER) |
| 24 | |
| 25 | #define MAP_DEVICE1 MAP_REGION_FLAT(STM32MP1_DEVICE1_BASE, \ |
| 26 | STM32MP1_DEVICE1_SIZE, \ |
| 27 | MT_DEVICE | \ |
| 28 | MT_RW | \ |
| 29 | MT_SECURE | \ |
| 30 | MT_EXECUTE_NEVER) |
| 31 | |
| 32 | #define MAP_DEVICE2 MAP_REGION_FLAT(STM32MP1_DEVICE2_BASE, \ |
| 33 | STM32MP1_DEVICE2_SIZE, \ |
| 34 | MT_DEVICE | \ |
| 35 | MT_RW | \ |
| 36 | MT_SECURE | \ |
| 37 | MT_EXECUTE_NEVER) |
| 38 | |
| 39 | static const mmap_region_t stm32mp1_mmap[] = { |
| 40 | MAP_SRAM, |
| 41 | MAP_DEVICE1, |
| 42 | MAP_DEVICE2, |
| 43 | {0} |
| 44 | }; |
| 45 | |
| 46 | void configure_mmu(void) |
| 47 | { |
| 48 | mmap_add(stm32mp1_mmap); |
| 49 | init_xlat_tables(); |
| 50 | |
| 51 | enable_mmu_secure(0); |
| 52 | } |
| 53 | |
| 54 | uintptr_t plat_get_ns_image_entrypoint(void) |
| 55 | { |
| 56 | return BL33_BASE; |
| 57 | } |
| 58 | |
| 59 | unsigned int plat_get_syscnt_freq2(void) |
| 60 | { |
| 61 | return read_cntfrq_el0(); |
| 62 | } |
| 63 | |
| 64 | /* Functions to save and get boot context address given by ROM code */ |
| 65 | static uintptr_t boot_ctx_address; |
| 66 | |
| 67 | void stm32mp1_save_boot_ctx_address(uintptr_t address) |
| 68 | { |
| 69 | boot_ctx_address = address; |
| 70 | } |
| 71 | |
| 72 | uintptr_t stm32mp1_get_boot_ctx_address(void) |
| 73 | { |
| 74 | return boot_ctx_address; |
| 75 | } |