Per Åstrand | 79929ff | 2021-01-26 14:42:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| 7 | * not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
| 19 | #ifndef TRUSTZONE_H_ |
| 20 | #define TRUSTZONE_H_ |
| 21 | |
| 22 | /* For the I-/DTCM memory the S/NS gating is handled by the I-/DTGU block. |
| 23 | * The block defines a block size depending on the size of the memory. |
| 24 | * The slice between secure and nonsecure has to be on a block boundary |
| 25 | * to be able to map whole respective region to its security state. |
| 26 | * For MPS3 with SSE300 + U55 the block size is 0x2000. |
| 27 | */ |
| 28 | |
| 29 | #define TZ_S_ITCM_START 0x10000000 |
| 30 | #define TZ_S_ITCM_SIZE 0x0007c000 |
| 31 | #define TZ_S_BRAM_START 0x11000000 |
| 32 | #define TZ_S_BRAM_SIZE 0x001fc000 |
| 33 | #define TZ_S_DTCM_START 0x30000000 |
| 34 | #define TZ_S_DTCM_SIZE 0x00040000 |
| 35 | #define TZ_S_SRAM_START 0x31000000 |
| 36 | #define TZ_S_SRAM_SIZE 0x00100000 |
| 37 | #define TZ_S_STACK_HEAP 0x30040000 |
| 38 | |
| 39 | #define TZ_NSC_START 0x111fb000 |
| 40 | #define TZ_NSC_SIZE 0x00001000 |
| 41 | |
| 42 | #define TZ_NS_ITCM_START 0x0007c000 |
| 43 | #define TZ_NS_ITCM_SIZE 0x00004000 |
| 44 | #define TZ_NS_BRAM_START 0x011fc000 |
| 45 | #define TZ_NS_BRAM_SIZE 0x00004000 |
| 46 | #define TZ_NS_DTCM_START 0x20040000 |
| 47 | #define TZ_NS_DTCM_SIZE 0x00040000 |
| 48 | #define TZ_NS_SRAM_START 0x21100000 |
| 49 | #define TZ_NS_SRAM_SIZE 0x00100000 |
| 50 | #define TZ_NS_STACK_HEAP 0x20080000 |
| 51 | |
| 52 | /* Add separate definition for secure world to use for booting |
| 53 | * non secure world. |
| 54 | */ |
| 55 | #define TZ_NS_START_VECTOR TZ_NS_ITCM_START |
| 56 | |
| 57 | #ifdef TRUSTZONE_SECURE |
| 58 | #define ITCM_START TZ_S_ITCM_START |
| 59 | #define ITCM_SIZE TZ_S_ITCM_SIZE |
| 60 | #define BRAM_START TZ_S_BRAM_START |
| 61 | #define BRAM_SIZE TZ_S_BRAM_SIZE |
| 62 | #define DTCM_START TZ_S_DTCM_START |
| 63 | #define DTCM_SIZE TZ_S_DTCM_SIZE |
| 64 | #define SRAM_START TZ_S_SRAM_START |
| 65 | #define SRAM_SIZE TZ_S_SRAM_SIZE |
| 66 | #define STACK_HEAP TZ_S_STACK_HEAP |
| 67 | #else |
| 68 | #define ITCM_START TZ_NS_ITCM_START |
| 69 | #define ITCM_SIZE TZ_NS_ITCM_SIZE |
| 70 | #define BRAM_START TZ_NS_BRAM_START |
| 71 | #define BRAM_SIZE TZ_NS_BRAM_SIZE |
| 72 | #define DTCM_START TZ_NS_DTCM_START |
| 73 | #define DTCM_SIZE TZ_NS_DTCM_SIZE |
| 74 | #define SRAM_START TZ_NS_SRAM_START |
| 75 | #define SRAM_SIZE TZ_NS_SRAM_SIZE |
| 76 | #define STACK_HEAP TZ_NS_STACK_HEAP |
| 77 | #endif |
| 78 | |
| 79 | #define LR_START ITCM_START |
| 80 | #define LR_SIZE ITCM_SIZE |
| 81 | |
| 82 | #define ITCM_TOTAL_SIZE 0x00080000 |
| 83 | #define ITCM_ITGU 0xE001E500 |
| 84 | |
| 85 | #define DTCM_TOTAL_SIZE 0x00080000 |
| 86 | #define DTCM_DTGU 0xE001E600 |
| 87 | |
| 88 | #define BRAM_BASE_S 0x11000000 |
| 89 | #define BRAM_BASE_NS 0x01000000 |
| 90 | #define BRAM_TOTAL_SIZE 0x00200000 |
| 91 | #define BRAM_MPC 0x57000000 |
| 92 | |
Anton Moberg | 908a07c | 2021-04-08 09:50:57 +0200 | [diff] [blame^] | 93 | #define SRAM0_BASE_S 0x31000000 |
| 94 | #define SRAM0_BASE_NS 0x21000000 |
| 95 | #define SRAM0_SIZE 0x00200000 |
| 96 | #define SRAM0_MPC 0x50083000 |
Per Åstrand | 79929ff | 2021-01-26 14:42:43 +0100 | [diff] [blame] | 97 | |
Anton Moberg | 908a07c | 2021-04-08 09:50:57 +0200 | [diff] [blame^] | 98 | #define DDR0_BASE_S 0x70000000 |
| 99 | #define DDR0_BASE_NS 0x60000000 |
| 100 | #define DDR0_SIZE 0x02000000 |
Per Åstrand | 79929ff | 2021-01-26 14:42:43 +0100 | [diff] [blame] | 101 | |
| 102 | #ifdef TRUSTZONE_BUILD |
| 103 | #define DDR_START DDR0_BASE_S |
| 104 | #else |
| 105 | #define DDR_START DDR0_BASE_NS |
| 106 | #endif |
| 107 | /* Separate DDRs for secure and nonsecure */ |
Anton Moberg | 908a07c | 2021-04-08 09:50:57 +0200 | [diff] [blame^] | 108 | #define DDR_SIZE DDR0_SIZE |
Per Åstrand | 79929ff | 2021-01-26 14:42:43 +0100 | [diff] [blame] | 109 | |
| 110 | #if (S_TZ_ITCM_SIZE + TZ_NS_ITCM_SIZE) > ITCM_TOTAL_SIZE |
| 111 | #error Missconfigured ITCM memory |
| 112 | #endif |
| 113 | |
| 114 | #if (S_TZ_DTCM_SIZE + TZ_NS_DTCM_SIZE) > DTCM_TOTAL_SIZE |
| 115 | #error Missconfigured ITCM memory |
| 116 | #endif |
| 117 | |
| 118 | #endif // TRUSTZONE_H_ |