18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2016 48c2ecf20Sopenharmony_ci * Author(s): Holger Dengler (hd@linux.vnet.ibm.com) 58c2ecf20Sopenharmony_ci * Harald Freudenberger <freude@de.ibm.com> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci#ifndef ZCRYPT_DEBUG_H 88c2ecf20Sopenharmony_ci#define ZCRYPT_DEBUG_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <asm/debug.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define DBF_ERR 3 /* error conditions */ 138c2ecf20Sopenharmony_ci#define DBF_WARN 4 /* warning conditions */ 148c2ecf20Sopenharmony_ci#define DBF_INFO 5 /* informational */ 158c2ecf20Sopenharmony_ci#define DBF_DEBUG 6 /* for debugging only */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define RC2ERR(rc) ((rc) ? DBF_ERR : DBF_INFO) 188c2ecf20Sopenharmony_ci#define RC2WARN(rc) ((rc) ? DBF_WARN : DBF_INFO) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define DBF_MAX_SPRINTF_ARGS 5 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define ZCRYPT_DBF(...) \ 238c2ecf20Sopenharmony_ci debug_sprintf_event(zcrypt_dbf_info, ##__VA_ARGS__) 248c2ecf20Sopenharmony_ci#define ZCRYPT_DBF_ERR(...) \ 258c2ecf20Sopenharmony_ci debug_sprintf_event(zcrypt_dbf_info, DBF_ERR, ##__VA_ARGS__) 268c2ecf20Sopenharmony_ci#define ZCRYPT_DBF_WARN(...) \ 278c2ecf20Sopenharmony_ci debug_sprintf_event(zcrypt_dbf_info, DBF_WARN, ##__VA_ARGS__) 288c2ecf20Sopenharmony_ci#define ZCRYPT_DBF_INFO(...) \ 298c2ecf20Sopenharmony_ci debug_sprintf_event(zcrypt_dbf_info, DBF_INFO, ##__VA_ARGS__) 308c2ecf20Sopenharmony_ci#define ZCRYPT_DBF_DBG(...) \ 318c2ecf20Sopenharmony_ci debug_sprintf_event(zcrypt_dbf_info, DBF_DEBUG, ##__VA_ARGS__) 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciextern debug_info_t *zcrypt_dbf_info; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciint zcrypt_debug_init(void); 368c2ecf20Sopenharmony_civoid zcrypt_debug_exit(void); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#endif /* ZCRYPT_DEBUG_H */ 39