1 // SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
2 /* Copyright(c) 2015 - 2020 Intel Corporation */
3 #include <adf_accel_devices.h>
4 #include <adf_pf2vf_msg.h>
5 #include <adf_common_drv.h>
6 #include "adf_c3xxxvf_hw_data.h"
8 static struct adf_hw_device_class c3xxxiov_class = {
9 .name = ADF_C3XXXVF_DEVICE_NAME,
14 static u32 get_accel_mask(u32 fuse)
16 return ADF_C3XXXIOV_ACCELERATORS_MASK;
19 static u32 get_ae_mask(u32 fuse)
21 return ADF_C3XXXIOV_ACCELENGINES_MASK;
24 static u32 get_num_accels(struct adf_hw_device_data *self)
26 return ADF_C3XXXIOV_MAX_ACCELERATORS;
29 static u32 get_num_aes(struct adf_hw_device_data *self)
31 return ADF_C3XXXIOV_MAX_ACCELENGINES;
34 static u32 get_misc_bar_id(struct adf_hw_device_data *self)
36 return ADF_C3XXXIOV_PMISC_BAR;
39 static u32 get_etr_bar_id(struct adf_hw_device_data *self)
41 return ADF_C3XXXIOV_ETR_BAR;
44 static enum dev_sku_info get_sku(struct adf_hw_device_data *self)
49 static u32 get_pf2vf_offset(u32 i)
51 return ADF_C3XXXIOV_PF2VF_OFFSET;
54 static u32 get_vintmsk_offset(u32 i)
56 return ADF_C3XXXIOV_VINTMSK_OFFSET;
59 static int adf_vf_int_noop(struct adf_accel_dev *accel_dev)
64 static void adf_vf_void_noop(struct adf_accel_dev *accel_dev)
68 void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data)
70 hw_data->dev_class = &c3xxxiov_class;
71 hw_data->num_banks = ADF_C3XXXIOV_ETR_MAX_BANKS;
72 hw_data->num_accel = ADF_C3XXXIOV_MAX_ACCELERATORS;
73 hw_data->num_logical_accel = 1;
74 hw_data->num_engines = ADF_C3XXXIOV_MAX_ACCELENGINES;
75 hw_data->tx_rx_gap = ADF_C3XXXIOV_RX_RINGS_OFFSET;
76 hw_data->tx_rings_mask = ADF_C3XXXIOV_TX_RINGS_MASK;
77 hw_data->alloc_irq = adf_vf_isr_resource_alloc;
78 hw_data->free_irq = adf_vf_isr_resource_free;
79 hw_data->enable_error_correction = adf_vf_void_noop;
80 hw_data->init_admin_comms = adf_vf_int_noop;
81 hw_data->exit_admin_comms = adf_vf_void_noop;
82 hw_data->send_admin_init = adf_vf2pf_notify_init;
83 hw_data->init_arb = adf_vf_int_noop;
84 hw_data->exit_arb = adf_vf_void_noop;
85 hw_data->disable_iov = adf_vf2pf_notify_shutdown;
86 hw_data->get_accel_mask = get_accel_mask;
87 hw_data->get_ae_mask = get_ae_mask;
88 hw_data->get_num_accels = get_num_accels;
89 hw_data->get_num_aes = get_num_aes;
90 hw_data->get_etr_bar_id = get_etr_bar_id;
91 hw_data->get_misc_bar_id = get_misc_bar_id;
92 hw_data->get_pf2vf_offset = get_pf2vf_offset;
93 hw_data->get_vintmsk_offset = get_vintmsk_offset;
94 hw_data->get_sku = get_sku;
95 hw_data->enable_ints = adf_vf_void_noop;
96 hw_data->enable_vf2pf_comms = adf_enable_vf2pf_comms;
97 hw_data->min_iov_compat_ver = ADF_PFVF_COMPATIBILITY_VERSION;
98 hw_data->dev_class->instances++;
99 adf_devmgr_update_class_index(hw_data);
102 void adf_clean_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data)
104 hw_data->dev_class->instances--;
105 adf_devmgr_update_class_index(hw_data);