J-Alves | d1aae29 | 2020-10-08 17:16:58 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2020, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef CACTUS_TEST_CMDS |
| 8 | #define CACTUS_TEST_CMDS |
| 9 | |
| 10 | #include <debug.h> |
| 11 | #include <ffa_helpers.h> |
| 12 | |
| 13 | /** |
| 14 | * Success and error return to be sent over a msg response. |
| 15 | */ |
| 16 | #define CACTUS_SUCCESS 0 |
| 17 | #define CACTUS_ERROR -1 |
| 18 | |
| 19 | /** |
| 20 | * Get command from struct smc_ret_values. |
| 21 | */ |
| 22 | #define CACTUS_GET_CMD(smc_ret) smc_ret.ret3 |
| 23 | |
| 24 | /** |
| 25 | * Template for commands to be sent to CACTUS partitions over direct |
| 26 | * messages interfaces. |
| 27 | */ |
| 28 | #define CACTUS_SEND_CMD(source, dest, cmd, val0, val1, val2, val3) \ |
| 29 | ffa_msg_send_direct_req64_5args(source, dest, cmd, \ |
| 30 | val0, val1, val2, val3) |
| 31 | |
| 32 | #define PRINT_CMD(smc_ret) \ |
| 33 | VERBOSE("cmd %lx; args: %lx, %lx, %lx, %lx\n", \ |
| 34 | smc_ret.ret3, smc_ret.ret4, smc_ret.ret5, \ |
| 35 | smc_ret.ret6, smc_ret.ret7) |
| 36 | |
| 37 | /** |
| 38 | * Command to notify cactus of a memory management operation. The cmd value |
| 39 | * should be the memory management smc function id. |
| 40 | */ |
| 41 | #define CACTUS_MEM_SEND_CMD(source, dest, mem_func, handle) \ |
| 42 | CACTUS_SEND_CMD(source, dest, mem_func, handle, 0, 0, 0) |
| 43 | |
| 44 | #define CACTUS_MEM_SEND_GET_HANDLE(smc_ret) smc_ret.ret4 |
| 45 | |
| 46 | /** |
| 47 | * Template for responses to CACTUS commands. |
| 48 | */ |
| 49 | #define CACTUS_RESPONSE(source, dest, response) \ |
| 50 | ffa_msg_send_direct_resp(source, dest, response) |
| 51 | |
| 52 | #define CACTUS_SUCCESS_RESP(source, dest) \ |
| 53 | CACTUS_RESPONSE(source, dest, CACTUS_SUCCESS) |
| 54 | |
| 55 | #define CACTUS_ERROR_RESP(source, dest) \ |
| 56 | CACTUS_RESPONSE(source, dest, CACTUS_ERROR) |
| 57 | |
| 58 | #define CACTUS_GET_RESPONSE(smc_ret) smc_ret.ret3 |
| 59 | |
| 60 | #endif |