Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 1 | /* |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 2 | * Copyright (c) 2021-2022, ARM Limited and Contributors. All rights reserved. |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | #ifndef ARM_PAS_DEF_H |
| 7 | #define ARM_PAS_DEF_H |
| 8 | |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 9 | #include <lib/gpt_rme/gpt_rme.h> |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 10 | #include <plat/arm/common/arm_def.h> |
| 11 | |
| 12 | /***************************************************************************** |
| 13 | * PAS regions used to initialize the Granule Protection Table (GPT) |
| 14 | ****************************************************************************/ |
| 15 | |
| 16 | /* |
| 17 | * The PA space is initially mapped in the GPT as follows: |
| 18 | * |
| 19 | * ============================================================================ |
| 20 | * Base Addr| Size |L? GPT|PAS |Content |Comment |
| 21 | * ============================================================================ |
| 22 | * 0GB | 1GB |L0 GPT|ANY |TBROM (EL3 code) |Fixed mapping |
| 23 | * | | | |TSRAM (EL3 data) | |
| 24 | * | | | |IO (incl.UARTs & GIC) | |
| 25 | * ---------------------------------------------------------------------------- |
| 26 | * 1GB | 1GB |L0 GPT|ANY |IO |Fixed mapping |
| 27 | * ---------------------------------------------------------------------------- |
| 28 | * 2GB | 1GB |L1 GPT|NS |DRAM (NS Kernel) |Use T.Descrip |
| 29 | * ---------------------------------------------------------------------------- |
| 30 | * 3GB |1GB-64MB |L1 GPT|NS |DRAM (NS Kernel) |Use T.Descrip |
| 31 | * ---------------------------------------------------------------------------- |
| 32 | * 4GB-64MB |64MB-32MB | | | | |
| 33 | * | -4MB |L1 GPT|SECURE|DRAM TZC |Use T.Descrip |
| 34 | * ---------------------------------------------------------------------------- |
| 35 | * 4GB-32MB | | | | | |
| 36 | * -3MB-1MB |32MB |L1 GPT|REALM |RMM |Use T.Descrip |
| 37 | * ---------------------------------------------------------------------------- |
| 38 | * 4GB-3MB | | | | | |
| 39 | * -1MB |3MB |L1 GPT|ROOT |EL3 DRAM data |Use T.Descrip |
| 40 | * ---------------------------------------------------------------------------- |
| 41 | * 4GB-1MB |1MB |L1 GPT|ROOT |DRAM (L1 GPTs, SCP TZC) |Fixed mapping |
| 42 | * ============================================================================ |
| 43 | * |
| 44 | * - 4KB of L0 GPT reside in TSRAM, on top of the CONFIG section. |
| 45 | * - ~1MB of L1 GPTs reside at the top of DRAM1 (TZC area). |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 46 | * - The first 1GB region has GPT_GPI_ANY and, therefore, is not protected by |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 47 | * the GPT. |
| 48 | * - The DRAM TZC area is split into three regions: the L1 GPT region and |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 49 | * 3MB of region below that are defined as GPT_GPI_ROOT, 32MB Realm region |
| 50 | * below that is defined as GPT_GPI_REALM and the rest of it is defined as |
| 51 | * GPT_GPI_SECURE. |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 52 | */ |
| 53 | |
| 54 | /* TODO: This might not be the best way to map the PAS */ |
| 55 | |
| 56 | /* Device memory 0 to 2GB */ |
| 57 | #define ARM_PAS_1_BASE (U(0)) |
| 58 | #define ARM_PAS_1_SIZE ((ULL(1)<<31)) /* 2GB */ |
| 59 | |
| 60 | /* NS memory 2GB to (end - 64MB) */ |
| 61 | #define ARM_PAS_2_BASE (ARM_PAS_1_BASE + ARM_PAS_1_SIZE) |
| 62 | #define ARM_PAS_2_SIZE (ARM_NS_DRAM1_SIZE) |
| 63 | |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 64 | /* Shared area between EL3 and RMM */ |
| 65 | #define ARM_PAS_SHARED_BASE (ARM_EL3_RMM_SHARED_BASE) |
| 66 | #define ARM_PAS_SHARED_SIZE (ARM_EL3_RMM_SHARED_SIZE) |
| 67 | |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 68 | /* Secure TZC region */ |
| 69 | #define ARM_PAS_3_BASE (ARM_AP_TZC_DRAM1_BASE) |
| 70 | #define ARM_PAS_3_SIZE (ARM_AP_TZC_DRAM1_SIZE) |
| 71 | |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 72 | #define ARM_PAS_GPI_ANY MAP_GPT_REGION(ARM_PAS_1_BASE, \ |
| 73 | ARM_PAS_1_SIZE, \ |
| 74 | GPT_GPI_ANY) |
| 75 | #define ARM_PAS_KERNEL GPT_MAP_REGION_GRANULE(ARM_PAS_2_BASE, \ |
| 76 | ARM_PAS_2_SIZE, \ |
| 77 | GPT_GPI_NS) |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 78 | |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 79 | #define ARM_PAS_SECURE GPT_MAP_REGION_GRANULE(ARM_PAS_3_BASE, \ |
| 80 | ARM_PAS_3_SIZE, \ |
| 81 | GPT_GPI_SECURE) |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 82 | |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 83 | /* |
| 84 | * REALM and Shared area share the same PAS, so consider them a single |
| 85 | * PAS region to configure in GPT. |
| 86 | */ |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 87 | #define ARM_PAS_REALM GPT_MAP_REGION_GRANULE(ARM_REALM_BASE, \ |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 88 | (ARM_PAS_SHARED_SIZE + \ |
| 89 | ARM_REALM_SIZE), \ |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 90 | GPT_GPI_REALM) |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 91 | |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 92 | #define ARM_PAS_EL3_DRAM GPT_MAP_REGION_GRANULE(ARM_EL3_TZC_DRAM1_BASE, \ |
| 93 | ARM_EL3_TZC_DRAM1_SIZE, \ |
| 94 | GPT_GPI_ROOT) |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 95 | |
johpow01 | 9d13402 | 2021-06-16 17:57:28 -0500 | [diff] [blame] | 96 | #define ARM_PAS_GPTS GPT_MAP_REGION_GRANULE(ARM_L1_GPT_ADDR_BASE, \ |
| 97 | ARM_L1_GPT_SIZE, \ |
| 98 | GPT_GPI_ROOT) |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 99 | |
Zelalem Aweke | 5085abd | 2021-07-13 17:19:54 -0500 | [diff] [blame] | 100 | /* GPT Configuration options */ |
Zelalem Aweke | 5085abd | 2021-07-13 17:19:54 -0500 | [diff] [blame] | 101 | #define PLATFORM_L0GPTSZ GPCCR_L0GPTSZ_30BITS |
| 102 | |
Zelalem Aweke | c43c563 | 2021-07-12 23:41:05 -0500 | [diff] [blame] | 103 | #endif /* ARM_PAS_DEF_H */ |