Jorge Ramirez-Ortiz | a29d9a6 | 2017-06-28 10:11:31 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch_helpers.h> |
| 8 | #include <arm_gic.h> |
| 9 | #include <assert.h> |
| 10 | #include <bl_common.h> |
| 11 | #include <debug.h> |
| 12 | #include <delay_timer.h> |
| 13 | #include <errno.h> |
| 14 | #include <mmio.h> |
| 15 | #include <platform.h> |
| 16 | #include <xlat_tables.h> |
| 17 | #include "hi3798cv200.h" |
| 18 | #include "platform_def.h" |
| 19 | |
| 20 | #define MAP_DDR MAP_REGION_FLAT(DDR_BASE, \ |
| 21 | DDR_SIZE, \ |
| 22 | MT_MEMORY | MT_RW | MT_NS) |
| 23 | |
| 24 | #define MAP_DEVICE MAP_REGION_FLAT(DEVICE_BASE, \ |
| 25 | DEVICE_SIZE, \ |
| 26 | MT_DEVICE | MT_RW | MT_SECURE) |
| 27 | |
| 28 | static const mmap_region_t poplar_mmap[] = { |
| 29 | MAP_DDR, |
| 30 | MAP_DEVICE, |
| 31 | {0} |
| 32 | }; |
| 33 | |
| 34 | #define DEFINE_CONFIGURE_MMU_EL(_el) \ |
| 35 | void plat_configure_mmu_el##_el(unsigned long total_base, \ |
| 36 | unsigned long total_size, \ |
| 37 | unsigned long ro_start, \ |
| 38 | unsigned long ro_limit, \ |
| 39 | unsigned long coh_start, \ |
| 40 | unsigned long coh_limit) \ |
| 41 | { \ |
| 42 | mmap_add_region(total_base, total_base, \ |
| 43 | total_size, \ |
| 44 | MT_MEMORY | MT_RW | MT_SECURE); \ |
| 45 | mmap_add_region(ro_start, ro_start, \ |
| 46 | ro_limit - ro_start, \ |
| 47 | MT_MEMORY | MT_RO | MT_SECURE); \ |
| 48 | mmap_add_region(coh_start, coh_start, \ |
| 49 | coh_limit - coh_start, \ |
| 50 | MT_DEVICE | MT_RW | MT_SECURE); \ |
| 51 | mmap_add(poplar_mmap); \ |
| 52 | init_xlat_tables(); \ |
| 53 | \ |
| 54 | enable_mmu_el##_el(0); \ |
| 55 | } |
| 56 | |
| 57 | DEFINE_CONFIGURE_MMU_EL(3) |
| 58 | DEFINE_CONFIGURE_MMU_EL(1) |
| 59 | |
| 60 | unsigned int plat_get_syscnt_freq2(void) |
| 61 | { |
| 62 | return SYS_COUNTER_FREQ_IN_TICKS; |
| 63 | } |