xref: /linux/drivers/crypto/intel/qat/qat_common/adf_cfg_common.h (revision 460ea8980511c01c1551012b9a6ec6a06d02da59)
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */
2 /* Copyright(c) 2014 - 2020 Intel Corporation */
3 #ifndef ADF_CFG_COMMON_H_
4 #define ADF_CFG_COMMON_H_
5 
6 #include <linux/types.h>
7 #include <linux/ioctl.h>
8 
9 #define ADF_CFG_MAX_STR_LEN 64
10 #define ADF_CFG_MAX_KEY_LEN_IN_BYTES ADF_CFG_MAX_STR_LEN
11 #define ADF_CFG_MAX_VAL_LEN_IN_BYTES ADF_CFG_MAX_STR_LEN
12 #define ADF_CFG_MAX_SECTION_LEN_IN_BYTES ADF_CFG_MAX_STR_LEN
13 #define ADF_CFG_BASE_DEC 10
14 #define ADF_CFG_BASE_HEX 16
15 #define ADF_CFG_ALL_DEVICES 0xFE
16 #define ADF_CFG_NO_DEVICE 0xFF
17 #define ADF_CFG_AFFINITY_WHATEVER 0xFF
18 #define MAX_DEVICE_NAME_SIZE 32
19 #define ADF_MAX_DEVICES (32 * 32)
20 #define ADF_DEVS_ARRAY_SIZE BITS_TO_LONGS(ADF_MAX_DEVICES)
21 
22 #define ADF_CFG_SERV_RING_PAIR_0_SHIFT 0
23 #define ADF_CFG_SERV_RING_PAIR_1_SHIFT 3
24 #define ADF_CFG_SERV_RING_PAIR_2_SHIFT 6
25 #define ADF_CFG_SERV_RING_PAIR_3_SHIFT 9
26 enum adf_cfg_service_type {
27 	UNUSED = 0,
28 	CRYPTO,
29 	COMP,
30 	SYM,
31 	ASYM,
32 	USED
33 };
34 
35 enum adf_cfg_val_type {
36 	ADF_DEC,
37 	ADF_HEX,
38 	ADF_STR
39 };
40 
41 enum adf_device_type {
42 	DEV_UNKNOWN = 0,
43 	DEV_DH895XCC,
44 	DEV_DH895XCCVF,
45 	DEV_C62X,
46 	DEV_C62XVF,
47 	DEV_C3XXX,
48 	DEV_C3XXXVF,
49 	DEV_4XXX,
50 };
51 
52 struct adf_dev_status_info {
53 	enum adf_device_type type;
54 	__u32 accel_id;
55 	__u32 instance_id;
56 	__u8 num_ae;
57 	__u8 num_accel;
58 	__u8 num_logical_accel;
59 	__u8 banks_per_accel;
60 	__u8 state;
61 	__u8 bus;
62 	__u8 dev;
63 	__u8 fun;
64 	char name[MAX_DEVICE_NAME_SIZE];
65 };
66 
67 #define ADF_CTL_IOC_MAGIC 'a'
68 #define IOCTL_CONFIG_SYS_RESOURCE_PARAMETERS _IOW(ADF_CTL_IOC_MAGIC, 0, \
69 		struct adf_user_cfg_ctl_data)
70 #define IOCTL_STOP_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 1, \
71 		struct adf_user_cfg_ctl_data)
72 #define IOCTL_START_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 2, \
73 		struct adf_user_cfg_ctl_data)
74 #define IOCTL_STATUS_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 3, __u32)
75 #define IOCTL_GET_NUM_DEVICES _IOW(ADF_CTL_IOC_MAGIC, 4, __s32)
76 #endif
77