• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_c62xvf_hw_data.h"
7 
8 static struct adf_hw_device_class c62xiov_class = {
9 	.name = ADF_C62XVF_DEVICE_NAME,
10 	.type = DEV_C62XVF,
11 	.instances = 0
12 };
13 
get_accel_mask(struct adf_hw_device_data * self)14 static u32 get_accel_mask(struct adf_hw_device_data *self)
15 {
16 	return ADF_C62XIOV_ACCELERATORS_MASK;
17 }
18 
get_ae_mask(struct adf_hw_device_data * self)19 static u32 get_ae_mask(struct adf_hw_device_data *self)
20 {
21 	return ADF_C62XIOV_ACCELENGINES_MASK;
22 }
23 
get_num_accels(struct adf_hw_device_data * self)24 static u32 get_num_accels(struct adf_hw_device_data *self)
25 {
26 	return ADF_C62XIOV_MAX_ACCELERATORS;
27 }
28 
get_num_aes(struct adf_hw_device_data * self)29 static u32 get_num_aes(struct adf_hw_device_data *self)
30 {
31 	return ADF_C62XIOV_MAX_ACCELENGINES;
32 }
33 
get_misc_bar_id(struct adf_hw_device_data * self)34 static u32 get_misc_bar_id(struct adf_hw_device_data *self)
35 {
36 	return ADF_C62XIOV_PMISC_BAR;
37 }
38 
get_etr_bar_id(struct adf_hw_device_data * self)39 static u32 get_etr_bar_id(struct adf_hw_device_data *self)
40 {
41 	return ADF_C62XIOV_ETR_BAR;
42 }
43 
get_sku(struct adf_hw_device_data * self)44 static enum dev_sku_info get_sku(struct adf_hw_device_data *self)
45 {
46 	return DEV_SKU_VF;
47 }
48 
get_pf2vf_offset(u32 i)49 static u32 get_pf2vf_offset(u32 i)
50 {
51 	return ADF_C62XIOV_PF2VF_OFFSET;
52 }
53 
get_vintmsk_offset(u32 i)54 static u32 get_vintmsk_offset(u32 i)
55 {
56 	return ADF_C62XIOV_VINTMSK_OFFSET;
57 }
58 
adf_vf_int_noop(struct adf_accel_dev * accel_dev)59 static int adf_vf_int_noop(struct adf_accel_dev *accel_dev)
60 {
61 	return 0;
62 }
63 
adf_vf_void_noop(struct adf_accel_dev * accel_dev)64 static void adf_vf_void_noop(struct adf_accel_dev *accel_dev)
65 {
66 }
67 
adf_init_hw_data_c62xiov(struct adf_hw_device_data * hw_data)68 void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data)
69 {
70 	hw_data->dev_class = &c62xiov_class;
71 	hw_data->num_banks = ADF_C62XIOV_ETR_MAX_BANKS;
72 	hw_data->num_accel = ADF_C62XIOV_MAX_ACCELERATORS;
73 	hw_data->num_logical_accel = 1;
74 	hw_data->num_engines = ADF_C62XIOV_MAX_ACCELENGINES;
75 	hw_data->tx_rx_gap = ADF_C62XIOV_RX_RINGS_OFFSET;
76 	hw_data->tx_rings_mask = ADF_C62XIOV_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);
100 }
101 
adf_clean_hw_data_c62xiov(struct adf_hw_device_data * hw_data)102 void adf_clean_hw_data_c62xiov(struct adf_hw_device_data *hw_data)
103 {
104 	hw_data->dev_class->instances--;
105 	adf_devmgr_update_class_index(hw_data);
106 }
107