Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | e30ec7f | 2020-01-17 13:46:38 +0900 | [diff] [blame] | 2 | * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 7 | #include <platform_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | |
| 9 | #include <common/debug.h> |
| 10 | #include <lib/xlat_tables/xlat_tables_v2.h> |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 11 | |
Masahiro Yamada | db72b0c | 2018-02-02 15:55:13 +0900 | [diff] [blame] | 12 | #define UNIPHIER_REG_REGION_BASE 0x50000000ULL |
| 13 | #define UNIPHIER_REG_REGION_SIZE 0x20000000ULL |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 14 | |
Masahiro Yamada | e30ec7f | 2020-01-17 13:46:38 +0900 | [diff] [blame] | 15 | void uniphier_mmap_setup(void) |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 16 | { |
| 17 | VERBOSE("Trusted RAM seen by this BL image: %p - %p\n", |
Masahiro Yamada | e30ec7f | 2020-01-17 13:46:38 +0900 | [diff] [blame] | 18 | (void *)BL_CODE_BASE, (void *)BL_END); |
| 19 | mmap_add_region(BL_CODE_BASE, BL_CODE_BASE, |
| 20 | round_up(BL_END, PAGE_SIZE) - BL_CODE_BASE, |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 21 | MT_MEMORY | MT_RW | MT_SECURE); |
| 22 | |
| 23 | /* remap the code section */ |
| 24 | VERBOSE("Code region: %p - %p\n", |
| 25 | (void *)BL_CODE_BASE, (void *)BL_CODE_END); |
| 26 | mmap_add_region(BL_CODE_BASE, BL_CODE_BASE, |
| 27 | round_up(BL_CODE_END, PAGE_SIZE) - BL_CODE_BASE, |
| 28 | MT_CODE | MT_SECURE); |
| 29 | |
| 30 | /* remap the coherent memory region */ |
| 31 | VERBOSE("Coherent region: %p - %p\n", |
| 32 | (void *)BL_COHERENT_RAM_BASE, (void *)BL_COHERENT_RAM_END); |
| 33 | mmap_add_region(BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_BASE, |
| 34 | BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, |
| 35 | MT_DEVICE | MT_RW | MT_SECURE); |
| 36 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 37 | /* register region */ |
| 38 | mmap_add_region(UNIPHIER_REG_REGION_BASE, UNIPHIER_REG_REGION_BASE, |
| 39 | UNIPHIER_REG_REGION_SIZE, |
| 40 | MT_DEVICE | MT_RW | MT_SECURE); |
| 41 | |
Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 42 | init_xlat_tables(); |
| 43 | } |