blob: 4bf6e087d1111871b0be1e8336b8801d71f9f612 [file] [log] [blame]
developer8670d252021-03-19 22:13:11 +08001/*
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. */
12const 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),
developer8670d252021-03-19 22:13:11 +080016 MAP_REGION_FLAT(MTK_DEV_RNG2_BASE, MTK_DEV_RNG2_SIZE,
17 MT_DEVICE | MT_RW | MT_SECURE),
Rex-BC Chenb48c6c42021-04-12 11:10:31 +080018 MAP_REGION_FLAT(DP_SEC_BASE, DP_SEC_SIZE,
19 MT_DEVICE | MT_RW | MT_SECURE),
20 MAP_REGION_FLAT(eDP_SEC_BASE, eDP_SEC_SIZE,
21 MT_DEVICE | MT_RW | MT_SECURE),
developer8670d252021-03-19 22:13:11 +080022 { 0 }
23};
24
25/*******************************************************************************
26 * Macro generating the code for the function setting up the pagetables as per
27 * the platform memory map & initialize the mmu, for the given exception level
28 ******************************************************************************/
29void plat_configure_mmu_el3(uintptr_t total_base,
30 uintptr_t total_size,
31 uintptr_t ro_start,
32 uintptr_t ro_limit)
33{
34 mmap_add_region(total_base, total_base, total_size,
35 MT_RW_DATA | MT_SECURE);
36 mmap_add_region(ro_start, ro_start, ro_limit - ro_start,
37 MT_CODE | MT_SECURE);
38 mmap_add(plat_mmap);
39 init_xlat_tables();
40 enable_mmu_el3(0);
41}
42
43unsigned int plat_get_syscnt_freq2(void)
44{
45 return SYS_COUNTER_FREQ_IN_TICKS;
46}