blob: 42f471e82af1331a0659fdcac15404b03d883a4f [file] [log] [blame]
Furquan Shaikhae879bb2014-08-26 15:43:16 -07001/*
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 Shaikhae879bb2014-08-26 15:43:16 -070022#include <soc/addressmap.h>
Julius Werner96195ee2014-10-20 13:25:21 -070023#include <soc/mmu_operations.h>
Furquan Shaikhae879bb2014-08-26 15:43:16 -070024
25static 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
39void 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}