Furquan Shaikh | ae879bb | 2014-08-26 15:43:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2014 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include <arch/secmon.h> |
| 21 | #include <console/console.h> |
Furquan Shaikh | ae879bb | 2014-08-26 15:43:16 -0700 | [diff] [blame] | 22 | #include <soc/addressmap.h> |
Julius Werner | 96195ee | 2014-10-20 13:25:21 -0700 | [diff] [blame^] | 23 | #include <soc/mmu_operations.h> |
Furquan Shaikh | ae879bb | 2014-08-26 15:43:16 -0700 | [diff] [blame] | 24 | |
| 25 | static void soc_get_secure_mem(uint64_t *base, size_t *size) |
| 26 | { |
| 27 | uintptr_t tz_base_mib; |
| 28 | size_t tz_size_mib; |
| 29 | |
| 30 | carveout_range(CARVEOUT_TZ, &tz_base_mib, &tz_size_mib); |
| 31 | |
| 32 | tz_base_mib *= MiB; |
| 33 | tz_size_mib *= MiB; |
| 34 | |
| 35 | *base = tz_base_mib; |
| 36 | *size = tz_size_mib; |
| 37 | } |
| 38 | |
| 39 | void soc_get_secmon_base_size(uint64_t *base, size_t *size) |
| 40 | { |
| 41 | uintptr_t tz_base; |
| 42 | size_t ttb_size, tz_size; |
| 43 | |
| 44 | soc_get_secure_mem(&tz_base, &tz_size); |
| 45 | |
| 46 | ttb_size = TTB_SIZE * MiB; |
| 47 | |
| 48 | *base = tz_base + ttb_size; |
| 49 | *size = tz_size - ttb_size; |
| 50 | } |