]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/staging/ccree/ssi_fips_local.h
Merge tag 'iio-for-4.13b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
[mirror_ubuntu-artful-kernel.git] / drivers / staging / ccree / ssi_fips_local.h
1 /*
2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
3 *
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.
7 *
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.
12 *
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/>.
15 */
16
17 #ifndef __SSI_FIPS_LOCAL_H__
18 #define __SSI_FIPS_LOCAL_H__
19
20
21 #ifdef CONFIG_CCX7REE_FIPS_SUPPORT
22
23 #include "ssi_fips.h"
24 struct ssi_drvdata;
25
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
33 }CCFipsSyncStatus_t;
34
35
36 #define CHECK_AND_RETURN_UPON_FIPS_ERROR() {\
37 if (ssi_fips_check_fips_error() != 0) {\
38 return -ENOEXEC;\
39 }\
40 }
41 #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR() {\
42 if (ssi_fips_check_fips_error() != 0) {\
43 return;\
44 }\
45 }
46 #define SSI_FIPS_INIT(p_drvData) (ssi_fips_init(p_drvData))
47 #define SSI_FIPS_FINI(p_drvData) (ssi_fips_fini(p_drvData))
48
49 #define FIPS_LOG(...) SSI_LOG(KERN_INFO, __VA_ARGS__)
50 #define FIPS_DBG(...) //SSI_LOG(KERN_INFO, __VA_ARGS__)
51
52 /* FIPS functions */
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);
58
59 #else /* CONFIG_CC7XXREE_FIPS_SUPPORT */
60
61 #define CHECK_AND_RETURN_UPON_FIPS_ERROR()
62 #define CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR()
63
64 static inline int ssi_fips_init(struct ssi_drvdata *p_drvdata)
65 {
66 return 0;
67 }
68
69 static inline void ssi_fips_fini(struct ssi_drvdata *drvdata) {}
70
71 void fips_handler(struct ssi_drvdata *drvdata);
72
73 #endif /* CONFIG_CC7XXREE_FIPS_SUPPORT */
74
75
76 #endif /*__SSI_FIPS_LOCAL_H__*/
77