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 enum adf_cfg_val_type { 23 ADF_DEC, 24 ADF_HEX, 25 ADF_STR 26 }; 27 28 enum adf_device_type { 29 DEV_UNKNOWN = 0, 30 DEV_DH895XCC, 31 DEV_DH895XCCVF, 32 DEV_C62X, 33 DEV_C62XVF, 34 DEV_C3XXX, 35 DEV_C3XXXVF 36 }; 37 38 struct adf_dev_status_info { 39 enum adf_device_type type; 40 __u32 accel_id; 41 __u32 instance_id; 42 __u8 num_ae; 43 __u8 num_accel; 44 __u8 num_logical_accel; 45 __u8 banks_per_accel; 46 __u8 state; 47 __u8 bus; 48 __u8 dev; 49 __u8 fun; 50 char name[MAX_DEVICE_NAME_SIZE]; 51 }; 52 53 #define ADF_CTL_IOC_MAGIC 'a' 54 #define IOCTL_CONFIG_SYS_RESOURCE_PARAMETERS _IOW(ADF_CTL_IOC_MAGIC, 0, \ 55 struct adf_user_cfg_ctl_data) 56 #define IOCTL_STOP_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 1, \ 57 struct adf_user_cfg_ctl_data) 58 #define IOCTL_START_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 2, \ 59 struct adf_user_cfg_ctl_data) 60 #define IOCTL_STATUS_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 3, __u32) 61 #define IOCTL_GET_NUM_DEVICES _IOW(ADF_CTL_IOC_MAGIC, 4, __s32) 62 #endif 63