2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 #ifndef __SSI_FIPS_LOCAL_H__
18 #define __SSI_FIPS_LOCAL_H__
21 #ifdef CONFIG_CCX7REE_FIPS_SUPPORT
26 // IG - how to make 1 file for TEE and REE
27 typedef enum CC_FipsSyncStatus {
28 CC_FIPS_SYNC_MODULE_OK = 0x0,
29 CC_FIPS_SYNC_MODULE_ERROR = 0x1,
30 CC_FIPS_SYNC_REE_STATUS = 0x4,
31 CC_FIPS_SYNC_TEE_STATUS = 0x8,
32 CC_FIPS_SYNC_STATUS_RESERVE32B = S32_MAX
36 #define CHECK_AND_RETURN_UPON_FIPS_ERROR() {\
37 if (ssi_fips_check_fips_error() != 0) {\
41 #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR() {\
42 if (ssi_fips_check_fips_error() != 0) {\
46 #define SSI_FIPS_INIT(p_drvData) (ssi_fips_init(p_drvData))
47 #define SSI_FIPS_FINI(p_drvData) (ssi_fips_fini(p_drvData))
49 #define FIPS_LOG(...) SSI_LOG(KERN_INFO, __VA_ARGS__)
50 #define FIPS_DBG(...) //SSI_LOG(KERN_INFO, __VA_ARGS__)
53 int ssi_fips_init(struct ssi_drvdata *p_drvdata);
54 void ssi_fips_fini(struct ssi_drvdata *drvdata);
55 int ssi_fips_check_fips_error(void);
56 int ssi_fips_set_error(struct ssi_drvdata *p_drvdata, ssi_fips_error_t err);
57 void fips_handler(struct ssi_drvdata *drvdata);
59 #else /* CONFIG_CC7XXREE_FIPS_SUPPORT */
61 #define CHECK_AND_RETURN_UPON_FIPS_ERROR()
62 #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR()
64 static inline int ssi_fips_init(struct ssi_drvdata *p_drvdata)
69 static inline void ssi_fips_fini(struct ssi_drvdata *drvdata) {}
71 void fips_handler(struct ssi_drvdata *drvdata);
73 #endif /* CONFIG_CC7XXREE_FIPS_SUPPORT */
76 #endif /*__SSI_FIPS_LOCAL_H__*/