1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
4  */
5 
6 #ifndef LIBSP_INCLUDE_SP_API_DEFINES_H_
7 #define LIBSP_INCLUDE_SP_API_DEFINES_H_
8 
9 #include "ffa_api_defines.h"
10 
11 /**
12  * SP result values are integers where the zero value indicates success and
13  * negative values are error codes. The first part of the error code range is
14  * mapped directly to the FF-A error code range so the SP result type is able
15  * to propagate FF-A error codes. The second part of the range is for SP layer
16  * specific error codes. This ranges starts immediately after the value of the
17  * last (lowest value) FF-A error code.
18  */
19 
20 #define SP_RESULT_OFFSET	(FFA_ABORTED)
21 #define SP_RESULT_CREATE(x)	(SP_RESULT_OFFSET + (x))
22 
23 /** SP API call result codes */
24 #define SP_RESULT_OK			(0)
25 #define SP_RESULT_FFA(res)		(res)
26 #define SP_RESULT_INTERNAL_ERROR	SP_RESULT_CREATE(-1)
27 #define SP_RESULT_INVALID_PARAMETERS	SP_RESULT_CREATE(-2)
28 #define SP_RESULT_INVALID_STATE		SP_RESULT_CREATE(-3)
29 #define SP_RESULT_NOT_FOUND		SP_RESULT_CREATE(-4)
30 
31 #endif /* LIBSP_INCLUDE_SP_API_DEFINES_H_ */
32