J-Alves | b4e89a2 | 2021-03-09 10:04:39 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2021, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include "cactus_message_loop.h" |
| 8 | #include "cactus_test_cmds.h" |
| 9 | #include "cactus_tests.h" |
| 10 | #include <debug.h> |
| 11 | #include <ffa_helpers.h> |
| 12 | |
| 13 | CACTUS_CMD_HANDLER(notifications_bind, CACTUS_NOTIFICATION_BIND_CMD) |
| 14 | { |
| 15 | ffa_id_t source = ffa_dir_msg_source(*args); |
| 16 | ffa_id_t vm_id = ffa_dir_msg_dest(*args); |
| 17 | ffa_id_t receiver = cactus_notification_get_receiver(*args); |
| 18 | ffa_id_t sender = cactus_notification_get_sender(*args); |
| 19 | ffa_notification_bitmap_t notifications = |
| 20 | cactus_notification_get_notifications(*args); |
| 21 | uint32_t flags = cactus_notification_get_flags(*args); |
| 22 | smc_ret_values ret; |
| 23 | |
| 24 | VERBOSE("Partition %x requested to bind notifications '%llx' to %x\n", |
| 25 | source, notifications, receiver); |
| 26 | |
| 27 | ret = ffa_notification_bind(sender, receiver, flags, notifications); |
| 28 | |
| 29 | if (is_ffa_call_error(ret)) { |
| 30 | return cactus_error_resp(vm_id, source, ffa_error_code(ret)); |
| 31 | } |
| 32 | |
| 33 | return cactus_response(vm_id, source, CACTUS_SUCCESS); |
| 34 | } |
| 35 | |
| 36 | CACTUS_CMD_HANDLER(notifications_unbind, CACTUS_NOTIFICATION_UNBIND_CMD) |
| 37 | { |
| 38 | ffa_id_t source = ffa_dir_msg_source(*args); |
| 39 | ffa_id_t vm_id = ffa_dir_msg_dest(*args); |
| 40 | ffa_id_t receiver = cactus_notification_get_receiver(*args); |
| 41 | ffa_id_t sender = cactus_notification_get_sender(*args); |
| 42 | ffa_notification_bitmap_t notifications = |
| 43 | cactus_notification_get_notifications(*args); |
| 44 | smc_ret_values ret; |
| 45 | |
| 46 | VERBOSE("Partition %x requested to unbind notifications '%llx' to %x\n", |
| 47 | source, notifications, receiver); |
| 48 | |
| 49 | ret = ffa_notification_unbind(sender, receiver, notifications); |
| 50 | |
| 51 | if (is_ffa_call_error(ret)) { |
| 52 | return cactus_error_resp(vm_id, source, ffa_error_code(ret)); |
| 53 | } |
| 54 | |
| 55 | return cactus_response(vm_id, source, CACTUS_SUCCESS); |
| 56 | } |