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