xref: /linux/drivers/s390/crypto/zcrypt_debug.h (revision 151ebcf0797b1a3ba53c8843dc21748c80e098c7)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  Copyright IBM Corp. 2016
4  *  Author(s): Holger Dengler (hd@linux.vnet.ibm.com)
5  *	       Harald Freudenberger <freude@de.ibm.com>
6  */
7 #ifndef ZCRYPT_DEBUG_H
8 #define ZCRYPT_DEBUG_H
9 
10 #include <asm/debug.h>
11 
12 #define DBF_ERR		3	/* error conditions   */
13 #define DBF_WARN	4	/* warning conditions */
14 #define DBF_INFO	5	/* informational      */
15 #define DBF_DEBUG	6	/* for debugging only */
16 
17 #define RC2ERR(rc) ((rc) ? DBF_ERR : DBF_INFO)
18 #define RC2WARN(rc) ((rc) ? DBF_WARN : DBF_INFO)
19 
20 #define ZCRYPT_DBF_MAX_SPRINTF_ARGS 6
21 
22 #define ZCRYPT_DBF(...)					\
23 	debug_sprintf_event(zcrypt_dbf_info, ##__VA_ARGS__)
24 #define ZCRYPT_DBF_ERR(...)					\
25 	debug_sprintf_event(zcrypt_dbf_info, DBF_ERR, ##__VA_ARGS__)
26 #define ZCRYPT_DBF_WARN(...)					\
27 	debug_sprintf_event(zcrypt_dbf_info, DBF_WARN, ##__VA_ARGS__)
28 #define ZCRYPT_DBF_INFO(...)					\
29 	debug_sprintf_event(zcrypt_dbf_info, DBF_INFO, ##__VA_ARGS__)
30 
31 extern debug_info_t *zcrypt_dbf_info;
32 
33 int zcrypt_debug_init(void);
34 void zcrypt_debug_exit(void);
35 
36 #endif /* ZCRYPT_DEBUG_H */
37