1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4  */
5 
6 #ifndef RSI_LOGGER_H
7 #define RSI_LOGGER_H
8 
9 #include <debug.h>
10 
11 /*
12  * RSI_LOG_LEVEL debug level is set to one of:
13  * LOG_LEVEL_NONE    = 0
14  * LOG_LEVEL_ERROR   = 10
15  * LOG_LEVEL_NOTICE  = 20
16  * LOG_LEVEL_WARNING = 30
17  * LOG_LEVEL_INFO    = 40
18  * LOG_LEVEL_VERBOSE = 50
19  */
20 #if (RSI_LOG_LEVEL >= LOG_LEVEL_ERROR) && (RSI_LOG_LEVEL <= LOG_LEVEL)
21 
22 void rsi_log_on_exit(unsigned int function_id, unsigned long args[5],
23 		     unsigned long res, bool exit_to_rec);
24 
25 /* Store SMC RSI parameters */
26 # define RSI_LOG_SET(x0, x1, x2, x3, x4)	\
27 	unsigned long rsi_log_args[5] = {x0, x1, x2, x3, x4}
28 
29 /*
30  * Macro prints RSI call function name, parameters
31  * and result when returning back to REC
32  */
33 # define RSI_LOG_EXIT(id, res, ret)	\
34 	rsi_log_on_exit(id, rsi_log_args, res, ret)
35 
36 #else
37 # define RSI_LOG_SET(x0, x1, x2, x3, x4)
38 # define RSI_LOG_EXIT(id, res, ret)
39 
40 #endif /* (>= LOG_LEVEL_ERROR) && (<= LOG_LEVEL) */
41 #endif /* RSI_LOGGER_H */
42