Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <platform_def.h> |
| 8 | |
| 9 | #include <lib/xlat_tables/xlat_tables_v2.h> |
| 10 | |
Yann Gautier | a2e2a30 | 2019-02-14 11:13:39 +0100 | [diff] [blame] | 11 | #define MAP_SRAM MAP_REGION_FLAT(STM32MP_SYSRAM_BASE, \ |
| 12 | STM32MP_SYSRAM_SIZE, \ |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 13 | MT_MEMORY | \ |
| 14 | MT_RW | \ |
| 15 | MT_SECURE | \ |
| 16 | MT_EXECUTE_NEVER) |
| 17 | |
| 18 | #define MAP_DEVICE1 MAP_REGION_FLAT(STM32MP1_DEVICE1_BASE, \ |
| 19 | STM32MP1_DEVICE1_SIZE, \ |
| 20 | MT_DEVICE | \ |
| 21 | MT_RW | \ |
| 22 | MT_SECURE | \ |
| 23 | MT_EXECUTE_NEVER) |
| 24 | |
| 25 | #define MAP_DEVICE2 MAP_REGION_FLAT(STM32MP1_DEVICE2_BASE, \ |
| 26 | STM32MP1_DEVICE2_SIZE, \ |
| 27 | MT_DEVICE | \ |
| 28 | MT_RW | \ |
| 29 | MT_SECURE | \ |
| 30 | MT_EXECUTE_NEVER) |
| 31 | |
| 32 | #if defined(IMAGE_BL2) |
| 33 | static const mmap_region_t stm32mp1_mmap[] = { |
| 34 | MAP_SRAM, |
| 35 | MAP_DEVICE1, |
| 36 | MAP_DEVICE2, |
| 37 | {0} |
| 38 | }; |
| 39 | #endif |
| 40 | #if defined(IMAGE_BL32) |
| 41 | static const mmap_region_t stm32mp1_mmap[] = { |
| 42 | MAP_SRAM, |
| 43 | MAP_DEVICE1, |
| 44 | MAP_DEVICE2, |
| 45 | {0} |
| 46 | }; |
| 47 | #endif |
| 48 | |
| 49 | void configure_mmu(void) |
| 50 | { |
| 51 | mmap_add(stm32mp1_mmap); |
| 52 | init_xlat_tables(); |
| 53 | |
| 54 | enable_mmu_svc_mon(0); |
| 55 | } |