blob: 1d81988f12afc652135f76025c22aaa78994f67a [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Max Shvetsov103e0562021-02-04 16:58:31 +00002 * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <assert.h>
Antonio Nino Diaz43ef3932018-07-03 14:39:47 +01008#include <errno.h>
J-Alves9f6f0142020-06-17 15:37:59 +01009#include <debug.h>
Max Shvetsov103e0562021-02-04 16:58:31 +000010
11#include <cactus_platform_def.h>
12#include <cactus_test_cmds.h>
J-Alves9f6f0142020-06-17 15:37:59 +010013#include <drivers/arm/pl011.h>
14#include <drivers/console.h>
J-Alves9f6f0142020-06-17 15:37:59 +010015#include <lib/aarch64/arch_helpers.h>
16#include <lib/xlat_tables/xlat_mmu_helpers.h>
17#include <lib/xlat_tables/xlat_tables_v2.h>
Max Shvetsov103e0562021-02-04 16:58:31 +000018#include <plat_arm.h>
19#include <plat/common/platform.h>
20#include <platform_def.h>
J-Alves5aecd982020-06-11 10:25:33 +010021#include <sp_helpers.h>
J-Alves9f6f0142020-06-17 15:37:59 +010022#include <std_svc.h>
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010023
Max Shvetsov103e0562021-02-04 16:58:31 +000024#include "cactus_def.h"
25#include "cactus_tests.h"
26#include "cactus.h"
J-Alves63cdaa72020-10-08 17:22:45 +010027
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020028/* Host machine information injected by the build system in the ELF file. */
29extern const char build_message[];
30extern const char version_string[];
31
J-Alvesd8edeed2020-11-18 10:48:12 +000032/* Memory section to be used for memory share operations */
33static __aligned(PAGE_SIZE) uint8_t share_page[PAGE_SIZE];
34
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010035/*
36 *
37 * Message loop function
38 * Notice we cannot use regular print functions because this serves to both
39 * "primary" and "secondary" VMs. Secondary VM cannot access UART directly
40 * but rather through Hafnium print hypercall.
41 *
42 */
J-Alves63cdaa72020-10-08 17:22:45 +010043static void __dead2 message_loop(ffa_vm_id_t vm_id, struct mailbox_buffers *mb)
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010044{
J-Alves7581c382020-05-07 18:34:20 +010045 smc_ret_values ffa_ret;
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010046 uint32_t sp_response;
J-Alves63cdaa72020-10-08 17:22:45 +010047 ffa_vm_id_t source;
J-Alvesda6ac322020-11-09 15:45:30 +000048 ffa_vm_id_t destination;
J-Alves1d203f12020-11-11 11:38:49 +000049 uint64_t cactus_cmd;
50
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010051 /*
J-Alves63cdaa72020-10-08 17:22:45 +010052 * This initial wait call is necessary to inform SPMD that
53 * SP initialization has completed. It blocks until receiving
54 * a direct message request.
55 */
56
J-Alves7581c382020-05-07 18:34:20 +010057 ffa_ret = ffa_msg_wait();
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010058
59 for (;;) {
J-Alves63cdaa72020-10-08 17:22:45 +010060 VERBOSE("Woke up with func id: %lx\n", ffa_ret.ret0);
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010061
J-Alvesda6ac322020-11-09 15:45:30 +000062 if (ffa_ret.ret0 == FFA_ERROR) {
63 ERROR("Error: %lx\n", ffa_ret.ret2);
64 break;
65 }
66
J-Alves63cdaa72020-10-08 17:22:45 +010067 if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_REQ_SMC32 &&
68 ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_REQ_SMC64) {
Olivier Deprez73d81cf2020-09-15 16:57:00 +020069 ERROR("%s(%u) unknown func id 0x%lx\n",
70 __func__, vm_id, ffa_ret.ret0);
71 break;
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010072 }
73
J-Alvesda6ac322020-11-09 15:45:30 +000074 destination = ffa_ret.ret1 & U(0xFFFF);
75
76 source = ffa_ret.ret1 >> 16;
77
78 if (destination != vm_id) {
Olivier Deprez73d81cf2020-09-15 16:57:00 +020079 ERROR("%s(%u) invalid vm id 0x%lx\n",
80 __func__, vm_id, ffa_ret.ret1);
81 break;
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010082 }
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010083
J-Alves63cdaa72020-10-08 17:22:45 +010084 PRINT_CMD(ffa_ret);
Olivier Deprezafcdb7c2019-11-29 14:21:48 +010085
J-Alves53392012020-11-18 14:51:57 +000086 cactus_cmd = cactus_get_cmd(ffa_ret);
J-Alves1d203f12020-11-11 11:38:49 +000087
88 switch (cactus_cmd) {
J-Alvesb9085f82020-12-07 10:57:28 +000089 case CACTUS_MEM_SEND_CMD:
J-Alves63cdaa72020-10-08 17:22:45 +010090 ffa_memory_management_test(
91 mb, vm_id, source,
J-Alves53392012020-11-18 14:51:57 +000092 cactus_req_mem_send_get_mem_func(
93 ffa_ret),
94 cactus_mem_send_get_handle(ffa_ret));
J-Alves63cdaa72020-10-08 17:22:45 +010095
96 /*
97 * If execution gets to this point means all operations
98 * with memory retrieval went well, as such replying
99 */
J-Alves53392012020-11-18 14:51:57 +0000100 ffa_ret = cactus_success_resp(vm_id, source);
J-Alves63cdaa72020-10-08 17:22:45 +0100101 break;
J-Alvesd8edeed2020-11-18 10:48:12 +0000102 case CACTUS_REQ_MEM_SEND_CMD:
103 {
104 uint32_t mem_func =
J-Alves53392012020-11-18 14:51:57 +0000105 cactus_req_mem_send_get_mem_func(ffa_ret);
J-Alvesd8edeed2020-11-18 10:48:12 +0000106 ffa_vm_id_t receiver =
J-Alves53392012020-11-18 14:51:57 +0000107 cactus_req_mem_send_get_receiver(ffa_ret);
J-Alvesd8edeed2020-11-18 10:48:12 +0000108 ffa_memory_handle_t handle;
J-Alvesda6ac322020-11-09 15:45:30 +0000109
J-Alvesd8edeed2020-11-18 10:48:12 +0000110 VERBOSE("%x requested to send memory to %x (func: %x)\n",
111 source, receiver, mem_func);
112
113 const struct ffa_memory_region_constituent
114 constituents[] = {
115 {(void *)share_page, 1, 0}
116 };
117
118 const uint32_t constituents_count = (
119 sizeof(constituents) /
120 sizeof(constituents[0])
121 );
122
123 handle = ffa_memory_init_and_send(
124 (struct ffa_memory_region *)mb->send, PAGE_SIZE,
125 vm_id, receiver, constituents,
126 constituents_count, mem_func);
127
128 /*
129 * If returned an invalid handle, we should break the
130 * test.
131 */
132 expect(handle != FFA_MEMORY_HANDLE_INVALID, true);
133
J-Alves53392012020-11-18 14:51:57 +0000134 ffa_ret = cactus_mem_send_cmd(vm_id, receiver, mem_func,
135 handle);
J-Alvesd8edeed2020-11-18 10:48:12 +0000136
137 if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_RESP_SMC32) {
138 ERROR("Failed to send message. error: %lx\n",
139 ffa_ret.ret2);
J-Alves53392012020-11-18 14:51:57 +0000140 ffa_ret = cactus_error_resp(vm_id, source);
J-Alvesd8edeed2020-11-18 10:48:12 +0000141 break;
142 }
143
144 /* If anything went bad on the receiver's end. */
J-Alves53392012020-11-18 14:51:57 +0000145 if (cactus_get_response(ffa_ret) == CACTUS_ERROR) {
J-Alvesd8edeed2020-11-18 10:48:12 +0000146 ERROR("Received error from receiver!\n");
J-Alves53392012020-11-18 14:51:57 +0000147 ffa_ret = cactus_error_resp(vm_id, source);
J-Alvesd8edeed2020-11-18 10:48:12 +0000148 break;
149 }
150
151 if (mem_func != FFA_MEM_DONATE_SMC32) {
152 /*
153 * Do a memory reclaim only if the mem_func
154 * regards to memory share or lend operations,
155 * as with a donate the owner is permanently
156 * given up access to the memory region.
157 */
158 if (ffa_mem_reclaim(handle, 0)
159 .ret0 == FFA_ERROR) {
160 ERROR("Failed to reclaim memory!\n");
J-Alves53392012020-11-18 14:51:57 +0000161 ffa_ret = cactus_error_resp(vm_id,
J-Alvesd8edeed2020-11-18 10:48:12 +0000162 source);
163 break;
164 }
165
166 /**
167 * Read Content that has been written to memory
168 * to validate access to memory segment has been
169 * reestablished, and receiver made use of
170 * memory region.
171 */
172 #if (LOG_LEVEL >= LOG_LEVEL_VERBOSE)
173 uint32_t *ptr =
174 (uint32_t *)constituents
175 ->address;
176 VERBOSE("Memory contents after receiver"
177 " SP's use:\n");
178 for (unsigned int i = 0U; i < 5U; i++)
179 VERBOSE(" %u: %x\n", i,
180 ptr[i]);
181 #endif
182 }
183
J-Alves53392012020-11-18 14:51:57 +0000184 ffa_ret = cactus_success_resp(vm_id, source);
185 break;
J-Alvesd8edeed2020-11-18 10:48:12 +0000186 }
J-Alvesda6ac322020-11-09 15:45:30 +0000187 case CACTUS_ECHO_CMD:
188 {
J-Alves53392012020-11-18 14:51:57 +0000189 uint64_t echo_val = cactus_echo_get_val(ffa_ret);
J-Alvesda6ac322020-11-09 15:45:30 +0000190
191 VERBOSE("Received echo at %x, value %llx.\n",
192 destination, echo_val);
J-Alves53392012020-11-18 14:51:57 +0000193 ffa_ret = cactus_response(vm_id, source, echo_val);
J-Alvesda6ac322020-11-09 15:45:30 +0000194 break;
195 }
196 case CACTUS_REQ_ECHO_CMD:
197 {
198 ffa_vm_id_t echo_dest =
J-Alves53392012020-11-18 14:51:57 +0000199 cactus_req_echo_get_echo_dest(ffa_ret);
200 uint64_t echo_val = cactus_echo_get_val(ffa_ret);
J-Alvesda6ac322020-11-09 15:45:30 +0000201 bool success = true;
202
203 VERBOSE("%x requested to send echo to %x, value %llx\n",
204 source, echo_dest, echo_val);
205
J-Alves53392012020-11-18 14:51:57 +0000206 ffa_ret = cactus_echo_send_cmd(vm_id, echo_dest,
J-Alvesda6ac322020-11-09 15:45:30 +0000207 echo_val);
208
209 if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_RESP_SMC32) {
210 ERROR("Failed to send message. error: %lx\n",
211 ffa_ret.ret2);
212 success = false;
213 }
214
J-Alves53392012020-11-18 14:51:57 +0000215 if (cactus_get_response(ffa_ret) != echo_val) {
J-Alvesda6ac322020-11-09 15:45:30 +0000216 ERROR("Echo Failed!\n");
217 success = false;
218 }
219
J-Alves53392012020-11-18 14:51:57 +0000220 ffa_ret = success ? cactus_success_resp(vm_id, source) :
221 cactus_error_resp(vm_id, source);
J-Alvesda6ac322020-11-09 15:45:30 +0000222 break;
223 }
J-Alves1d203f12020-11-11 11:38:49 +0000224 case CACTUS_DEADLOCK_CMD:
225 case CACTUS_REQ_DEADLOCK_CMD:
226 {
227 ffa_vm_id_t deadlock_dest =
J-Alves53392012020-11-18 14:51:57 +0000228 cactus_deadlock_get_next_dest(ffa_ret);
J-Alves1d203f12020-11-11 11:38:49 +0000229 ffa_vm_id_t deadlock_next_dest = source;
230
231 if (cactus_cmd == CACTUS_DEADLOCK_CMD) {
232 VERBOSE("%x is creating deadlock. next: %x\n",
233 source, deadlock_dest);
234 } else if (cactus_cmd == CACTUS_REQ_DEADLOCK_CMD) {
235 VERBOSE(
236 "%x requested deadlock with %x and %x\n",
237 source, deadlock_dest, deadlock_next_dest);
238
239 deadlock_next_dest =
J-Alves53392012020-11-18 14:51:57 +0000240 cactus_deadlock_get_next_dest2(ffa_ret);
J-Alves1d203f12020-11-11 11:38:49 +0000241 }
242
J-Alves53392012020-11-18 14:51:57 +0000243 ffa_ret = cactus_deadlock_send_cmd(vm_id, deadlock_dest,
J-Alves1d203f12020-11-11 11:38:49 +0000244 deadlock_next_dest);
245
246 /*
247 * Should be true for the last partition to attempt
248 * an FF-A direct message, to the first partition.
249 */
250 bool is_deadlock_detected =
251 (ffa_ret.ret0 == FFA_ERROR) &&
252 (ffa_ret.ret2 == FFA_ERROR_BUSY);
253
254 /*
255 * Should be true after the deadlock has been detected
256 * and after the first response has been sent down the
257 * request chain.
258 */
259 bool is_returning_from_deadlock =
260 (ffa_ret.ret0 == FFA_MSG_SEND_DIRECT_RESP_SMC32)
J-Alves53392012020-11-18 14:51:57 +0000261 &&
262 (cactus_get_response(ffa_ret) == CACTUS_SUCCESS);
J-Alves1d203f12020-11-11 11:38:49 +0000263
264 if (is_deadlock_detected) {
265 NOTICE("Attempting dealock but got error %lx\n",
266 ffa_ret.ret2);
267 }
268
269 if (is_deadlock_detected ||
270 is_returning_from_deadlock) {
271 /*
272 * This is not the partition, that would have
273 * created the deadlock. As such, reply back
274 * to the partitions.
275 */
J-Alves53392012020-11-18 14:51:57 +0000276 ffa_ret = cactus_success_resp(vm_id, source);
J-Alves1d203f12020-11-11 11:38:49 +0000277 break;
278 }
279
280 /* Shouldn't get to this point */
281 ERROR("Deadlock test went wrong!\n");
J-Alves53392012020-11-18 14:51:57 +0000282 ffa_ret = cactus_error_resp(vm_id, source);
J-Alves1d203f12020-11-11 11:38:49 +0000283 break;
284 }
J-Alves63cdaa72020-10-08 17:22:45 +0100285 default:
286 /*
287 * Currently direct message test is handled here.
288 * TODO: create a case within the switch case
289 * For the sake of testing, add the vm id to the
290 * received message.
291 */
J-Alves63cdaa72020-10-08 17:22:45 +0100292 sp_response = ffa_ret.ret3 | vm_id;
Olivier Deprezaed7f082020-11-04 15:11:59 +0100293 VERBOSE("Replying with direct message response: %x\n", sp_response);
J-Alves63cdaa72020-10-08 17:22:45 +0100294 ffa_ret = ffa_msg_send_direct_resp(vm_id,
295 HYP_ID,
296 sp_response);
297
298 break;
299 }
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100300 }
Olivier Deprez73d81cf2020-09-15 16:57:00 +0200301
302 panic();
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100303}
304
305static const mmap_region_t cactus_mmap[] __attribute__((used)) = {
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +0100306 /* PLAT_ARM_DEVICE0 area includes UART2 necessary to console */
307 MAP_REGION_FLAT(PLAT_ARM_DEVICE0_BASE, PLAT_ARM_DEVICE0_SIZE,
308 MT_DEVICE | MT_RW),
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100309 {0}
310};
311
Manish Pandey26c6f812020-04-30 11:43:00 +0100312static void cactus_print_memory_layout(unsigned int vm_id)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200313{
Olivier Deprezaed7f082020-11-04 15:11:59 +0100314 INFO("Secure Partition memory layout:\n");
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200315
Olivier Deprezaed7f082020-11-04 15:11:59 +0100316 INFO(" Text region : %p - %p\n",
Antonio Nino Diaz1486f3b2018-06-26 10:30:10 +0100317 (void *)CACTUS_TEXT_START, (void *)CACTUS_TEXT_END);
Manish Pandey26c6f812020-04-30 11:43:00 +0100318
Olivier Deprezaed7f082020-11-04 15:11:59 +0100319 INFO(" Read-only data region : %p - %p\n",
Antonio Nino Diaz1486f3b2018-06-26 10:30:10 +0100320 (void *)CACTUS_RODATA_START, (void *)CACTUS_RODATA_END);
Manish Pandey26c6f812020-04-30 11:43:00 +0100321
Olivier Deprezaed7f082020-11-04 15:11:59 +0100322 INFO(" Data region : %p - %p\n",
Antonio Nino Diaz1486f3b2018-06-26 10:30:10 +0100323 (void *)CACTUS_DATA_START, (void *)CACTUS_DATA_END);
Manish Pandey26c6f812020-04-30 11:43:00 +0100324
Olivier Deprezaed7f082020-11-04 15:11:59 +0100325 INFO(" BSS region : %p - %p\n",
Antonio Nino Diaz1486f3b2018-06-26 10:30:10 +0100326 (void *)CACTUS_BSS_START, (void *)CACTUS_BSS_END);
Manish Pandey26c6f812020-04-30 11:43:00 +0100327
Olivier Deprezaed7f082020-11-04 15:11:59 +0100328 INFO(" RX : %p - %p\n",
Max Shvetsovc32f4782020-06-23 09:41:15 +0100329 (void *)get_sp_rx_start(vm_id),
330 (void *)get_sp_rx_end(vm_id));
Manish Pandey26c6f812020-04-30 11:43:00 +0100331
Olivier Deprezaed7f082020-11-04 15:11:59 +0100332 INFO(" TX : %p - %p\n",
Max Shvetsovc32f4782020-06-23 09:41:15 +0100333 (void *)get_sp_tx_start(vm_id),
334 (void *)get_sp_tx_end(vm_id));
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200335}
336
Manish Pandey26c6f812020-04-30 11:43:00 +0100337static void cactus_plat_configure_mmu(unsigned int vm_id)
Antonio Nino Diaz43ef3932018-07-03 14:39:47 +0100338{
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100339 mmap_add_region(CACTUS_TEXT_START,
340 CACTUS_TEXT_START,
341 CACTUS_TEXT_END - CACTUS_TEXT_START,
342 MT_CODE);
343 mmap_add_region(CACTUS_RODATA_START,
344 CACTUS_RODATA_START,
345 CACTUS_RODATA_END - CACTUS_RODATA_START,
346 MT_RO_DATA);
347 mmap_add_region(CACTUS_DATA_START,
348 CACTUS_DATA_START,
349 CACTUS_DATA_END - CACTUS_DATA_START,
350 MT_RW_DATA);
351 mmap_add_region(CACTUS_BSS_START,
352 CACTUS_BSS_START,
353 CACTUS_BSS_END - CACTUS_BSS_START,
354 MT_RW_DATA);
Antonio Nino Diaz43ef3932018-07-03 14:39:47 +0100355
Max Shvetsovc32f4782020-06-23 09:41:15 +0100356 mmap_add_region(get_sp_rx_start(vm_id),
357 get_sp_rx_start(vm_id),
Manish Pandey26c6f812020-04-30 11:43:00 +0100358 (CACTUS_RX_TX_SIZE / 2),
359 MT_RO_DATA);
360
Max Shvetsovc32f4782020-06-23 09:41:15 +0100361 mmap_add_region(get_sp_tx_start(vm_id),
362 get_sp_tx_start(vm_id),
Manish Pandey26c6f812020-04-30 11:43:00 +0100363 (CACTUS_RX_TX_SIZE / 2),
364 MT_RW_DATA);
365
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100366 mmap_add(cactus_mmap);
367 init_xlat_tables();
Antonio Nino Diaz43ef3932018-07-03 14:39:47 +0100368}
369
Olivier Deprez458d5532020-06-09 17:56:20 +0200370int tftf_irq_handler_dispatcher(void)
371{
372 ERROR("%s\n", __func__);
373
374 return 0;
375}
376
Antonio Nino Diaz1486f3b2018-06-26 10:30:10 +0100377void __dead2 cactus_main(void)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200378{
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100379 assert(IS_IN_EL1() != 0);
380
Max Shvetsovc32f4782020-06-23 09:41:15 +0100381 struct mailbox_buffers mb;
J-Alvesda6ac322020-11-09 15:45:30 +0000382
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100383 /* Clear BSS */
384 memset((void *)CACTUS_BSS_START,
385 0, CACTUS_BSS_END - CACTUS_BSS_START);
386
J-Alves7581c382020-05-07 18:34:20 +0100387 /* Get current FFA id */
388 smc_ret_values ffa_id_ret = ffa_id_get();
389 if (ffa_id_ret.ret0 != FFA_SUCCESS_SMC32) {
390 ERROR("FFA_ID_GET failed.\n");
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100391 panic();
392 }
393
J-Alves7581c382020-05-07 18:34:20 +0100394 ffa_vm_id_t ffa_id = ffa_id_ret.ret2 & 0xffff;
Max Shvetsovc32f4782020-06-23 09:41:15 +0100395 mb.send = (void *) get_sp_tx_start(ffa_id);
396 mb.recv = (void *) get_sp_rx_start(ffa_id);
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100397
Manish Pandey26c6f812020-04-30 11:43:00 +0100398 /* Configure and enable Stage-1 MMU, enable D-Cache */
399 cactus_plat_configure_mmu(ffa_id);
400 enable_mmu_el1(0);
401
J-Alves7581c382020-05-07 18:34:20 +0100402 if (ffa_id == SPM_VM_ID_FIRST) {
Arunachalam Ganapathy51be1fe2020-09-22 13:25:21 +0100403 console_init(CACTUS_PL011_UART_BASE,
404 CACTUS_PL011_UART_CLK_IN_HZ,
405 PL011_BAUDRATE);
Manish Pandey29495372020-04-09 15:19:26 +0100406
407 set_putc_impl(PL011_AS_STDOUT);
408
409 NOTICE("Booting Primary Cactus Secure Partition\n%s\n%s\n",
410 build_message, version_string);
Manish Pandey29495372020-04-09 15:19:26 +0100411 } else {
J-Alves83ede9b2020-11-02 17:37:19 +0000412 smc_ret_values ret;
Manish Pandey29495372020-04-09 15:19:26 +0100413 set_putc_impl(HVC_CALL_AS_STDOUT);
414
Olivier Deprezaed7f082020-11-04 15:11:59 +0100415 NOTICE("Booting Secondary Cactus Secure Partition (ID: %x)\n%s\n%s\n",
Ruari Phippsbd0a7e42020-07-17 16:42:21 +0100416 ffa_id, build_message, version_string);
417
Olivier Deprez0be4abe2020-08-04 11:26:13 +0200418 if (ffa_id == (SPM_VM_ID_FIRST + 2)) {
Olivier Deprezaed7f082020-11-04 15:11:59 +0100419 VERBOSE("Mapping RXTX Region\n");
J-Alves83ede9b2020-11-02 17:37:19 +0000420 CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret);
Ruari Phippsbd0a7e42020-07-17 16:42:21 +0100421 if (ret.ret0 != FFA_SUCCESS_SMC32) {
J-Alves83ede9b2020-11-02 17:37:19 +0000422 ERROR(
423 "Failed to map RXTX buffers. Error: %lx\n",
424 ret.ret2);
Ruari Phippsbd0a7e42020-07-17 16:42:21 +0100425 panic();
426 }
Ruari Phippsbd0a7e42020-07-17 16:42:21 +0100427 }
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100428 }
Manish Pandey26c6f812020-04-30 11:43:00 +0100429
Olivier Deprezaed7f082020-11-04 15:11:59 +0100430 INFO("FF-A id: %x\n", ffa_id);
Manish Pandey26c6f812020-04-30 11:43:00 +0100431 cactus_print_memory_layout(ffa_id);
432
J-Alves9f6f0142020-06-17 15:37:59 +0100433 /* Invoking Tests */
Max Shvetsovc32f4782020-06-23 09:41:15 +0100434 ffa_tests(&mb);
J-Alves9f6f0142020-06-17 15:37:59 +0100435
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100436 /* End up to message loop */
J-Alves63cdaa72020-10-08 17:22:45 +0100437 message_loop(ffa_id, &mb);
Antonio Nino Diaz43ef3932018-07-03 14:39:47 +0100438
Olivier Deprezafcdb7c2019-11-29 14:21:48 +0100439 /* Not reached */
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +0200440}