gpoulios commented on code in PR #16309: URL: https://github.com/apache/nuttx/pull/16309#discussion_r2077933601
########## drivers/misc/optee.c: ########## @@ -55,21 +57,87 @@ /* Some GlobalPlatform error codes used in this driver */ #define TEE_SUCCESS 0x00000000 +#define TEE_ERROR_ACCESS_DENIED 0xFFFF0001 +#define TEE_ERROR_BAD_FORMAT 0xFFFF0005 #define TEE_ERROR_BAD_PARAMETERS 0xFFFF0006 #define TEE_ERROR_NOT_SUPPORTED 0xFFFF000A -#define TEE_ERROR_COMMUNICATION 0xFFFF000E #define TEE_ERROR_OUT_OF_MEMORY 0xFFFF000C #define TEE_ERROR_BUSY 0xFFFF000D +#define TEE_ERROR_COMMUNICATION 0xFFFF000E +#define TEE_ERROR_SECURITY 0xFFFF000F #define TEE_ERROR_SHORT_BUFFER 0xFFFF0010 +#define TEE_ERROR_TIMEOUT 0xFFFF3001 #define TEE_ORIGIN_COMMS 0x00000002 #define OPTEE_DEV_PATH "/dev/tee0" +/* According to optee_msg.h#OPTEE_MSG_ATTR_NONCONTIG */ + +#define OPTEE_PAGES_ARRAY_LEN \ + ((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(uint64_t)) - 1) + +/* Name: optee_msg_alloc + * + * Description: + * Allocate OP-TEE page-aligned memory for use as arguments to OP-TEE + * calls, large enough to fit `numparams` parameters. Initialize the + * buffer to 0, and set the `.num_params` field to the specified value. + * + * Use `optee_msg_free()` to free the memory returned. + * + * Parameters: + * priv - pointer to the driver's optee_priv_data struct + * numparams - the number of arguments to allocate shared memory for. + * Can be zero. + * + * Returned Values: + * On success, pointer to OP-TEE message arguments struct initialized + * to 0 except for `.num_params`, which is initialized to the specified + * number of parameters. + * On failure, NULL. + */ + +#define optee_msg_alloc(priv, numparams) \ + ({ \ Review Comment: That’s your code in list.h @xiaoxiang781216. Why is it allowed there but not here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org