feat(ffa-svc): add `ffa_func_name` and `ffa_error_name`
Adds helper functions for getting string representations of function
identifiers and error codes. This makes debug logs more readable than
printing the integer value.
Change-Id: I9e74c197686dc08e0c71886f641c60829587bad6
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index b3f7451..141f1fe 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -61,10 +61,12 @@
ffa_ret = ffa_msg_wait();
for (;;) {
- VERBOSE("Woke up with func id: %x\n", ffa_func_id(ffa_ret));
+ VERBOSE("Woke up with func id: %s\n",
+ ffa_func_name(ffa_func_id(ffa_ret)));
if (ffa_func_id(ffa_ret) == FFA_ERROR) {
- ERROR("Error: %x\n", ffa_error_code(ffa_ret));
+ ERROR("Error: %s\n",
+ ffa_error_name(ffa_error_code(ffa_ret)));
break;
}
@@ -72,8 +74,8 @@
ffa_func_id(ffa_ret) != FFA_MSG_SEND_DIRECT_REQ_SMC64 &&
ffa_func_id(ffa_ret) != FFA_INTERRUPT &&
ffa_func_id(ffa_ret) != FFA_RUN) {
- ERROR("%s(%u) unknown func id 0x%x\n",
- __func__, vm_id, ffa_func_id(ffa_ret));
+ ERROR("%s(%u) unknown func id %s\n", __func__, vm_id,
+ ffa_func_name(ffa_func_id(ffa_ret)));
break;
}
@@ -304,9 +306,8 @@
VERBOSE("Mapping RXTX Region\n");
CONFIGURE_AND_MAP_MAILBOX(mb, PAGE_SIZE, ret);
if (ffa_func_id(ret) != FFA_SUCCESS_SMC32) {
- ERROR(
- "Failed to map RXTX buffers. Error: %x\n",
- ffa_error_code(ret));
+ ERROR("Failed to map RXTX buffers. Error: %s\n",
+ ffa_error_name(ffa_error_code(ret)));
panic();
}
}