blob: 0faebc99398f490431215bbae7a29337cd285d88 [file] [log] [blame]
Masahiro Yamada574388c2016-09-03 11:37:40 +09001/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Masahiro Yamada574388c2016-09-03 11:37:40 +09007#include <platform_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008
9#include <common/debug.h>
10#include <lib/xlat_tables/xlat_tables_v2.h>
Masahiro Yamada574388c2016-09-03 11:37:40 +090011
Masahiro Yamadadb72b0c2018-02-02 15:55:13 +090012#define UNIPHIER_REG_REGION_BASE 0x50000000ULL
13#define UNIPHIER_REG_REGION_SIZE 0x20000000ULL
Masahiro Yamada574388c2016-09-03 11:37:40 +090014
15void uniphier_mmap_setup(uintptr_t total_base, size_t total_size,
16 const struct mmap_region *mmap)
17{
18 VERBOSE("Trusted RAM seen by this BL image: %p - %p\n",
19 (void *)total_base, (void *)(total_base + total_size));
20 mmap_add_region(total_base, total_base,
21 total_size,
22 MT_MEMORY | MT_RW | MT_SECURE);
23
24 /* remap the code section */
25 VERBOSE("Code region: %p - %p\n",
26 (void *)BL_CODE_BASE, (void *)BL_CODE_END);
27 mmap_add_region(BL_CODE_BASE, BL_CODE_BASE,
28 round_up(BL_CODE_END, PAGE_SIZE) - BL_CODE_BASE,
29 MT_CODE | MT_SECURE);
30
31 /* remap the coherent memory region */
32 VERBOSE("Coherent region: %p - %p\n",
33 (void *)BL_COHERENT_RAM_BASE, (void *)BL_COHERENT_RAM_END);
34 mmap_add_region(BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_BASE,
35 BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
36 MT_DEVICE | MT_RW | MT_SECURE);
37
Masahiro Yamada574388c2016-09-03 11:37:40 +090038 /* register region */
39 mmap_add_region(UNIPHIER_REG_REGION_BASE, UNIPHIER_REG_REGION_BASE,
40 UNIPHIER_REG_REGION_SIZE,
41 MT_DEVICE | MT_RW | MT_SECURE);
42
43 /* additional regions if needed */
44 if (mmap)
45 mmap_add(mmap);
46
47 init_xlat_tables();
48}