Rex-BC Chen | 749b211 | 2021-09-28 11:24:09 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <lib/xlat_tables/xlat_tables_v2.h> |
| 8 | |
| 9 | #include <platform_def.h> |
| 10 | |
| 11 | /* Table of regions to map using the MMU. */ |
| 12 | const mmap_region_t plat_mmap[] = { |
| 13 | /* for TF text, RO, RW */ |
| 14 | MAP_REGION_FLAT(MTK_DEV_RNG0_BASE, MTK_DEV_RNG0_SIZE, |
| 15 | MT_DEVICE | MT_RW | MT_SECURE), |
Rex-BC Chen | 749b211 | 2021-09-28 11:24:09 +0800 | [diff] [blame] | 16 | MAP_REGION_FLAT(MTK_DEV_RNG2_BASE, MTK_DEV_RNG2_SIZE, |
| 17 | MT_DEVICE | MT_RW | MT_SECURE), |
jason-ch chen | fa82b9b | 2021-11-16 09:48:20 +0800 | [diff] [blame] | 18 | MAP_REGION_FLAT(MTK_MCDI_SRAM_BASE, MTK_MCDI_SRAM_MAP_SIZE, |
| 19 | MT_DEVICE | MT_RW | MT_SECURE), |
Rex-BC Chen | 749b211 | 2021-09-28 11:24:09 +0800 | [diff] [blame] | 20 | { 0 } |
| 21 | }; |
| 22 | |
| 23 | /******************************************************************************* |
| 24 | * Macro generating the code for the function setting up the pagetables as per |
| 25 | * the platform memory map & initialize the mmu, for the given exception level |
| 26 | ******************************************************************************/ |
| 27 | void plat_configure_mmu_el3(uintptr_t total_base, |
| 28 | uintptr_t total_size, |
| 29 | uintptr_t ro_start, |
| 30 | uintptr_t ro_limit) |
| 31 | { |
| 32 | mmap_add_region(total_base, total_base, total_size, |
| 33 | MT_RW_DATA | MT_SECURE); |
| 34 | mmap_add_region(ro_start, ro_start, ro_limit - ro_start, |
| 35 | MT_CODE | MT_SECURE); |
| 36 | mmap_add(plat_mmap); |
| 37 | init_xlat_tables(); |
| 38 | enable_mmu_el3(0); |
| 39 | } |
| 40 | |
| 41 | unsigned int plat_get_syscnt_freq2(void) |
| 42 | { |
| 43 | return SYS_COUNTER_FREQ_IN_TICKS; |
| 44 | } |