Antonio Nino Diaz | 5e7b017 | 2018-11-27 09:36:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef SPM_RES_DESC_H |
| 8 | #define SPM_RES_DESC_H |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | #include <sp_res_desc_def.h> |
| 12 | |
| 13 | /******************************************************************************* |
| 14 | * Attribute Section |
| 15 | ******************************************************************************/ |
| 16 | |
| 17 | struct sp_rd_sect_attribute { |
| 18 | /* |
| 19 | * Version of the resource description. |
| 20 | */ |
| 21 | uint16_t version; |
| 22 | |
| 23 | /* |
| 24 | * Type of the Secure Partition: |
| 25 | * - bit[0]: SP Type |
| 26 | * - b'0: UP SP |
| 27 | * - b'1: MP SP |
| 28 | * If UP SP: |
| 29 | * - bit[1]: Type of UP SP |
| 30 | * - b'0: Migratable UP SP |
| 31 | * - b'1: Pinned UP SP |
| 32 | */ |
| 33 | uint16_t sp_type; |
| 34 | |
| 35 | /* |
| 36 | * If this is a Pinned UP SP, PE on which the Pinned UP SP will run. |
| 37 | */ |
| 38 | uint32_t pe_mpidr; |
| 39 | |
| 40 | /* |
| 41 | * Run-Time Exception Level: |
| 42 | * - 0: SEL0 SP |
| 43 | * - 1: SEL1 SP |
| 44 | */ |
| 45 | uint8_t runtime_el; |
| 46 | |
| 47 | /* |
| 48 | * Type of Execution: |
| 49 | * - 0: Init-time only |
| 50 | * - 1: Run-time Execution |
| 51 | */ |
| 52 | uint8_t exec_type; |
| 53 | |
| 54 | /* |
| 55 | * Expected behavior upon failure: |
| 56 | * - 0: Restartable |
| 57 | * - 1: One-Shot |
| 58 | */ |
| 59 | uint8_t panic_policy; |
| 60 | |
| 61 | /* |
| 62 | * Translation Granule to use in the SP translation regime: |
| 63 | * - 0: 4KB |
| 64 | * - 1: 16KB |
| 65 | * - 2: 64KB |
| 66 | */ |
| 67 | uint8_t xlat_granule; |
| 68 | |
| 69 | /* |
| 70 | * Size of the SP binary in bytes. |
| 71 | */ |
| 72 | uint32_t binary_size; |
| 73 | |
| 74 | /* |
| 75 | * - If SP is NOT PIE: |
| 76 | * - VA Address where the SP expects to be loaded. |
| 77 | * - If SP is PIE: |
| 78 | * - Ignored. |
| 79 | */ |
| 80 | uint64_t load_address; |
| 81 | |
| 82 | /* |
| 83 | * Initial execution address. This is a VA as the SP sees it. |
| 84 | */ |
| 85 | uint64_t entrypoint; |
| 86 | }; |
| 87 | |
| 88 | /******************************************************************************* |
| 89 | * Memory Region Section |
| 90 | ******************************************************************************/ |
| 91 | |
| 92 | struct sp_rd_sect_mem_region { |
| 93 | /* |
| 94 | * Name of a Memory region, including null terminator. Reserved names: |
| 95 | * - "Client Shared Memory Region": |
| 96 | * Memory region where memory shared by clients shall be mapped. |
| 97 | * - "Queue Memory Region": |
| 98 | * Memory region shared with SPM for SP queue management. |
| 99 | */ |
| 100 | char name[RD_MEM_REGION_NAME_LEN]; |
| 101 | |
| 102 | /* |
| 103 | * Memory Attributes: |
| 104 | * - bits[3:0]: Type of memory |
| 105 | * - 0: Device |
| 106 | * - 1: Code |
| 107 | * - 2: Data |
| 108 | * - 3: BSS |
| 109 | * - 4: Read-only Data |
| 110 | * - 5: SPM-to-SP Shared Memory Region |
| 111 | * - 6: Client Shared Memory Region |
| 112 | * - 7: Miscellaneous |
| 113 | * - If memory is { SPM-to-SP shared Memory, Client Shared Memory, |
| 114 | * Miscellaneous } |
| 115 | * - bits[4]: Position Independent |
| 116 | * - b'0: Position Dependent |
| 117 | * - b'1: Position Independent |
| 118 | */ |
| 119 | uint32_t attr; |
| 120 | |
| 121 | /* |
| 122 | * Base address of the memory region. |
| 123 | */ |
| 124 | uint64_t base; |
| 125 | |
| 126 | /* |
| 127 | * Size of the memory region. |
| 128 | */ |
| 129 | uint64_t size; |
| 130 | |
| 131 | /* |
| 132 | * Pointer to next memory region (or NULL if this is the last one). |
| 133 | */ |
| 134 | struct sp_rd_sect_mem_region *next; |
| 135 | }; |
| 136 | |
| 137 | /******************************************************************************* |
| 138 | * Notification Section |
| 139 | ******************************************************************************/ |
| 140 | |
| 141 | struct sp_rd_sect_notification { |
| 142 | /* |
| 143 | * Notification attributes: |
| 144 | * - bit[31]: Notification Type |
| 145 | * - b'0: Platform Notification |
| 146 | * - b'1: Interrupt |
| 147 | * If Notification Type == Platform Notification |
| 148 | * - bits[15:0]: Implementation-defined Notification ID |
| 149 | * If Notification Type == Interrupt |
| 150 | * - bits[15:0]: IRQ number |
| 151 | * - bits[23:16]: Interrupt Priority |
| 152 | * - bit[24]: Trigger Type |
| 153 | * - b'0: Edge Triggered |
| 154 | * - b'1: Level Triggered |
| 155 | * - bit[25]: Trigger Level |
| 156 | * - b'0: Falling or Low |
| 157 | * - b'1: Rising or High |
| 158 | */ |
| 159 | uint32_t attr; |
| 160 | |
| 161 | /* |
| 162 | * Processing Element. |
| 163 | * If Notification Type == Interrupt && IRQ number is { SGI, LPI } |
| 164 | * - PE ID to which IRQ will be forwarded |
| 165 | */ |
| 166 | uint32_t pe; |
| 167 | |
| 168 | /* |
| 169 | * Pointer to next notification (or NULL if this is the last one). |
| 170 | */ |
| 171 | struct sp_rd_sect_notification *next; |
| 172 | }; |
| 173 | |
| 174 | /******************************************************************************* |
| 175 | * Service Description Section |
| 176 | ******************************************************************************/ |
| 177 | |
| 178 | struct sp_rd_sect_service { |
| 179 | /* |
| 180 | * Service identifier. |
| 181 | */ |
| 182 | uint32_t uuid[4]; |
| 183 | |
| 184 | /* |
| 185 | * Accessibility Options: |
| 186 | * - bit[0]: Accessibility by secure-world clients |
| 187 | * - b'0: Not Accessible |
| 188 | * - b'1: Accessible |
| 189 | * - bit[1]: Accessible by EL3 |
| 190 | * - b'0: Not Accessible |
| 191 | * - b'1: Accessible |
| 192 | * - bit[2]: Accessible by normal-world clients |
| 193 | * - b'0: Not Accessible |
| 194 | * - b'1: Accessible |
| 195 | */ |
| 196 | uint8_t accessibility; |
| 197 | |
| 198 | /* |
| 199 | * Request type supported: |
| 200 | * - bit[0]: Blocking request |
| 201 | * - b'0: Not Enable |
| 202 | * - b'1: Enable |
| 203 | * - bit[1]: Non-blocking request |
| 204 | * - b'0: Not Enable |
| 205 | * - b'1: Enable |
| 206 | */ |
| 207 | uint8_t request_type; |
| 208 | |
| 209 | /* |
| 210 | * Maximum number of client connections that the service can support. |
| 211 | */ |
| 212 | uint16_t connection_quota; |
| 213 | |
| 214 | /* |
| 215 | * If the service requires secure world memory to be shared with its |
| 216 | * clients: |
| 217 | * - Maximum amount of secure world memory in bytes to reserve from the |
| 218 | * secure world memory pool for the service. |
| 219 | */ |
| 220 | uint32_t secure_mem_size; |
| 221 | |
| 222 | /* |
| 223 | * Interrupt number used to notify the SP for the service. |
| 224 | * - Should also be enabled in the Notification Section. |
| 225 | */ |
| 226 | uint32_t interrupt_num; |
| 227 | |
| 228 | /* |
| 229 | * Pointer to next service (or NULL if this is the last one). |
| 230 | */ |
| 231 | struct sp_rd_sect_service *next; |
| 232 | }; |
| 233 | |
| 234 | /******************************************************************************* |
| 235 | * Complete resource description struct |
| 236 | ******************************************************************************/ |
| 237 | |
| 238 | struct sp_res_desc { |
| 239 | |
| 240 | /* Attribute Section */ |
| 241 | struct sp_rd_sect_attribute attribute; |
| 242 | |
| 243 | /* System Resource Section */ |
| 244 | struct sp_rd_sect_mem_region *mem_region; |
| 245 | |
| 246 | struct sp_rd_sect_notification *notification; |
| 247 | |
| 248 | /* Service Section */ |
| 249 | struct sp_rd_sect_service *service; |
| 250 | }; |
| 251 | |
| 252 | #endif /* SPM_RES_DESC_H */ |