aboutsummaryrefslogtreecommitdiff
path: root/src/soc/nvidia/tegra210/mmu_operations.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2015-08-05 17:03:34 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-08-28 06:40:32 +0000
commit8b3851969d6546ae920f52eb681631cd9b9aff46 (patch)
tree939709df2ed73125fbce2528c4eafb51afb5a7af /src/soc/nvidia/tegra210/mmu_operations.c
parentf8142155f9938beda215a3e1991f8544b4b1d690 (diff)
t210: Move page tables to end of TZDRAM
BL31 makes an assumption that TZDRAM always starts at its base. This was not true in our case since coreboot page tables were located towards the start of TZDRAM. Instead move page tables to the end, thus satisfying the assumption that BL31 base is the base of TZDRAM as well. BUG=chrome-os-partner:42989 BRANCH=None TEST=Compiles successfully and boots to kernel prompt Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Original-Commit-Id: aabed336da6e9aea426650c5ca5977ccfc83a21b Original-Change-Id: Ic4d155525dbb4baab95c971f77848e47d5d54dba Original-Signed-off-by: Furquan Shaikh <furquan@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/291020 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org> Original-Trybot-Ready: Furquan Shaikh <furquan@chromium.org> Original-Tested-by: Furquan Shaikh <furquan@chromium.org> Original-(cherry picked from commit a57127f1655ef311b82c41ce33ffc71db5f9db35) Original-Reviewed-on: https://chromium-review.googlesource.com/290987 Change-Id: Ie7166fd0301b46eb32f44107f7f782c6d79a278c Reviewed-on: http://review.coreboot.org/11383 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/nvidia/tegra210/mmu_operations.c')
-rw-r--r--src/soc/nvidia/tegra210/mmu_operations.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/soc/nvidia/tegra210/mmu_operations.c b/src/soc/nvidia/tegra210/mmu_operations.c
index dd7437c3d7..5578933514 100644
--- a/src/soc/nvidia/tegra210/mmu_operations.c
+++ b/src/soc/nvidia/tegra210/mmu_operations.c
@@ -18,6 +18,7 @@
*/
#include <arch/mmu.h>
+#include <assert.h>
#include <memrange.h>
#include <soc/addressmap.h>
#include <soc/mmu_operations.h>
@@ -69,15 +70,43 @@ void tegra210_mmu_init(void)
{
uintptr_t tz_base_mib;
size_t tz_size_mib;
+ uintptr_t ttb_base_mib;
size_t ttb_size_mib;
struct memranges *map = &t210_mmap_ranges;
tegra210_memrange_init(map);
mainboard_add_memory_ranges(map);
- /* Place page tables at the base of the trust zone region. */
+ /*
+ * Place page tables at the end of the trust zone region.
+ * TZDRAM layout is as follows:
+ *
+ * +--------------------------+ <----+DRAM_END
+ * | |
+ * | |
+ * | |
+ * +--------------------------+ <----+0x100000000
+ * | |
+ * | coreboot page tables |
+ * +--------------------------+
+ * | |
+ * | BL32 |
+ * +--------------------------+
+ * | |
+ * | BL31 |
+ * +--------------------------+ <----+TZDRAM_BASE
+ * | |
+ * | |
+ * | |
+ * | |
+ * +--------------------------+ <----+DRAM_BASE
+ *
+ */
carveout_range(CARVEOUT_TZ, &tz_base_mib, &tz_size_mib);
- tz_base_mib *= MiB;
+
+ assert(tz_size_mib > CONFIG_TTB_SIZE_MB);
+ ttb_base_mib = (tz_base_mib + tz_size_mib - CONFIG_TTB_SIZE_MB) * MiB;
+
ttb_size_mib = CONFIG_TTB_SIZE_MB * MiB;
- mmu_init(map, (void *)tz_base_mib, ttb_size_mib);
+ mmu_init(map, (void *)ttb_base_mib, ttb_size_mib);
mmu_enable();
}