summaryrefslogtreecommitdiff
path: root/ta/logger_ta.c
diff options
context:
space:
mode:
Diffstat (limited to 'ta/logger_ta.c')
-rw-r--r--ta/logger_ta.c64
1 files changed, 20 insertions, 44 deletions
diff --git a/ta/logger_ta.c b/ta/logger_ta.c
index 6913f96..6c869ab 100644
--- a/ta/logger_ta.c
+++ b/ta/logger_ta.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Linaro Limited
+ * Copyright (c) 2018, Linaro Limited
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,8 +65,6 @@ TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
TEE_PARAM_TYPE_NONE,
TEE_PARAM_TYPE_NONE);
- DMSG("has been called");
-
if (param_types != exp_param_types)
return TEE_ERROR_BAD_PARAMETERS;
@@ -74,13 +72,6 @@ TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
(void)&params;
(void)&sess_ctx;
- /*
- * The DMSG() macro is non-standard, TEE Internal API doesn't
- * specify any means to logging from a TA.
- */
- IMSG("Entry log World!\n");
-
- /* If return value != TEE_SUCCESS the session will not be created. */
return TEE_SUCCESS;
}
@@ -91,48 +82,26 @@ TEE_Result TA_OpenSessionEntryPoint(uint32_t param_types,
void TA_CloseSessionEntryPoint(void __maybe_unused *sess_ctx)
{
(void)&sess_ctx; /* Unused parameter */
- IMSG("Goodbye!\n");
-}
-
-static TEE_Result inc_value(uint32_t param_types,
- TEE_Param params[4])
-{
- uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INOUT,
- TEE_PARAM_TYPE_NONE,
- TEE_PARAM_TYPE_NONE,
- TEE_PARAM_TYPE_NONE);
-
- DMSG("has been called");
-
- if (param_types != exp_param_types)
- return TEE_ERROR_BAD_PARAMETERS;
-
- IMSG("Got value: %u from NW", params[0].value.a);
- params[0].value.a++;
- IMSG("Increase value to: %u", params[0].value.a);
-
- return TEE_SUCCESS;
}
static TEE_Result dec_value(uint32_t param_types,
- TEE_Param params[4])
+ TEE_Param params[4])
{
- uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INOUT,
- TEE_PARAM_TYPE_NONE,
- TEE_PARAM_TYPE_NONE,
- TEE_PARAM_TYPE_NONE);
+ uint32_t exp_param_types = TEE_PARAM_TYPES(TEE_PARAM_TYPE_MEMREF_INOUT,
+ TEE_PARAM_TYPE_NONE,
+ TEE_PARAM_TYPE_NONE,
+ TEE_PARAM_TYPE_NONE);
+ char *iv;
- DMSG("has been called");
+ if (param_types != exp_param_types)
+ return TEE_ERROR_BAD_PARAMETERS;
- if (param_types != exp_param_types)
- return TEE_ERROR_BAD_PARAMETERS;
-
- IMSG("Got value: %u from NW", params[0].value.a);
- params[0].value.a--;
- IMSG("Decrease value to: %u", params[0].value.a);
+ iv = params[0].memref.buffer;
+ IMSG("Got value: %s from NW", iv);
- return TEE_SUCCESS;
+ return TEE_SUCCESS;
}
+
/*
* Called when a TA is invoked. sess_ctx hold that value that was
* assigned by TA_OpenSessionEntryPoint(). The rest of the paramters
@@ -144,5 +113,12 @@ TEE_Result TA_InvokeCommandEntryPoint(void __maybe_unused *sess_ctx,
{
(void)&sess_ctx; /* Unused parameter */
+ switch (cmd_id) {
+ case TA_LOGGER_WRITE:
+ return dec_value(param_types, params);
+ default:
+ return TEE_ERROR_BAD_PARAMETERS;
+ }
+
return TEE_ERROR_BAD_PARAMETERS;
}