| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - This file is provided under a dual BSD/GPLv2 license. When using or |
|---|
| 3 | | - redistributing this file, you may do so under either license. |
|---|
| 4 | | - |
|---|
| 5 | | - GPL LICENSE SUMMARY |
|---|
| 6 | | - Copyright(c) 2014 Intel Corporation. |
|---|
| 7 | | - This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - it under the terms of version 2 of the GNU General Public License as |
|---|
| 9 | | - published by the Free Software Foundation. |
|---|
| 10 | | - |
|---|
| 11 | | - This program is distributed in the hope that it will be useful, but |
|---|
| 12 | | - WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | | - General Public License for more details. |
|---|
| 15 | | - |
|---|
| 16 | | - Contact Information: |
|---|
| 17 | | - qat-linux@intel.com |
|---|
| 18 | | - |
|---|
| 19 | | - BSD LICENSE |
|---|
| 20 | | - Copyright(c) 2014 Intel Corporation. |
|---|
| 21 | | - Redistribution and use in source and binary forms, with or without |
|---|
| 22 | | - modification, are permitted provided that the following conditions |
|---|
| 23 | | - are met: |
|---|
| 24 | | - |
|---|
| 25 | | - * Redistributions of source code must retain the above copyright |
|---|
| 26 | | - notice, this list of conditions and the following disclaimer. |
|---|
| 27 | | - * Redistributions in binary form must reproduce the above copyright |
|---|
| 28 | | - notice, this list of conditions and the following disclaimer in |
|---|
| 29 | | - the documentation and/or other materials provided with the |
|---|
| 30 | | - distribution. |
|---|
| 31 | | - * Neither the name of Intel Corporation nor the names of its |
|---|
| 32 | | - contributors may be used to endorse or promote products derived |
|---|
| 33 | | - from this software without specific prior written permission. |
|---|
| 34 | | - |
|---|
| 35 | | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|---|
| 36 | | - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|---|
| 37 | | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|---|
| 38 | | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|---|
| 39 | | - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|---|
| 40 | | - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|---|
| 41 | | - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|---|
| 42 | | - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|---|
| 43 | | - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|---|
| 44 | | - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|---|
| 45 | | - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 46 | | -*/ |
|---|
| 1 | +/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */ |
|---|
| 2 | +/* Copyright(c) 2014 - 2020 Intel Corporation */ |
|---|
| 47 | 3 | #ifndef ADF_ACCEL_DEVICES_H_ |
|---|
| 48 | 4 | #define ADF_ACCEL_DEVICES_H_ |
|---|
| 49 | 5 | #include <linux/interrupt.h> |
|---|
| .. | .. |
|---|
| 59 | 15 | #define ADF_C62XVF_DEVICE_NAME "c6xxvf" |
|---|
| 60 | 16 | #define ADF_C3XXX_DEVICE_NAME "c3xxx" |
|---|
| 61 | 17 | #define ADF_C3XXXVF_DEVICE_NAME "c3xxxvf" |
|---|
| 62 | | -#define ADF_DH895XCC_PCI_DEVICE_ID 0x435 |
|---|
| 63 | | -#define ADF_DH895XCCIOV_PCI_DEVICE_ID 0x443 |
|---|
| 64 | | -#define ADF_C62X_PCI_DEVICE_ID 0x37c8 |
|---|
| 65 | | -#define ADF_C62XIOV_PCI_DEVICE_ID 0x37c9 |
|---|
| 66 | | -#define ADF_C3XXX_PCI_DEVICE_ID 0x19e2 |
|---|
| 67 | | -#define ADF_C3XXXIOV_PCI_DEVICE_ID 0x19e3 |
|---|
| 68 | 18 | #define ADF_ERRSOU3 (0x3A000 + 0x0C) |
|---|
| 69 | 19 | #define ADF_ERRSOU5 (0x3A000 + 0xD8) |
|---|
| 70 | 20 | #define ADF_DEVICE_FUSECTL_OFFSET 0x40 |
|---|
| .. | .. |
|---|
| 103 | 53 | struct pci_dev *pci_dev; |
|---|
| 104 | 54 | struct adf_accel_msix msix_entries; |
|---|
| 105 | 55 | struct adf_bar pci_bars[ADF_PCI_MAX_BARS]; |
|---|
| 106 | | - uint8_t revid; |
|---|
| 107 | | - uint8_t sku; |
|---|
| 56 | + u8 revid; |
|---|
| 57 | + u8 sku; |
|---|
| 108 | 58 | } __packed; |
|---|
| 109 | 59 | |
|---|
| 110 | 60 | enum dev_state { |
|---|
| .. | .. |
|---|
| 144 | 94 | struct adf_hw_device_class { |
|---|
| 145 | 95 | const char *name; |
|---|
| 146 | 96 | const enum adf_device_type type; |
|---|
| 147 | | - uint32_t instances; |
|---|
| 97 | + u32 instances; |
|---|
| 148 | 98 | } __packed; |
|---|
| 149 | 99 | |
|---|
| 150 | 100 | struct adf_cfg_device_data; |
|---|
| .. | .. |
|---|
| 154 | 104 | |
|---|
| 155 | 105 | struct adf_hw_device_data { |
|---|
| 156 | 106 | struct adf_hw_device_class *dev_class; |
|---|
| 157 | | - uint32_t (*get_accel_mask)(uint32_t fuse); |
|---|
| 158 | | - uint32_t (*get_ae_mask)(uint32_t fuse); |
|---|
| 159 | | - uint32_t (*get_sram_bar_id)(struct adf_hw_device_data *self); |
|---|
| 160 | | - uint32_t (*get_misc_bar_id)(struct adf_hw_device_data *self); |
|---|
| 161 | | - uint32_t (*get_etr_bar_id)(struct adf_hw_device_data *self); |
|---|
| 162 | | - uint32_t (*get_num_aes)(struct adf_hw_device_data *self); |
|---|
| 163 | | - uint32_t (*get_num_accels)(struct adf_hw_device_data *self); |
|---|
| 164 | | - uint32_t (*get_pf2vf_offset)(uint32_t i); |
|---|
| 165 | | - uint32_t (*get_vintmsk_offset)(uint32_t i); |
|---|
| 107 | + u32 (*get_accel_mask)(u32 fuse); |
|---|
| 108 | + u32 (*get_ae_mask)(u32 fuse); |
|---|
| 109 | + u32 (*get_sram_bar_id)(struct adf_hw_device_data *self); |
|---|
| 110 | + u32 (*get_misc_bar_id)(struct adf_hw_device_data *self); |
|---|
| 111 | + u32 (*get_etr_bar_id)(struct adf_hw_device_data *self); |
|---|
| 112 | + u32 (*get_num_aes)(struct adf_hw_device_data *self); |
|---|
| 113 | + u32 (*get_num_accels)(struct adf_hw_device_data *self); |
|---|
| 114 | + u32 (*get_pf2vf_offset)(u32 i); |
|---|
| 115 | + u32 (*get_vintmsk_offset)(u32 i); |
|---|
| 166 | 116 | enum dev_sku_info (*get_sku)(struct adf_hw_device_data *self); |
|---|
| 167 | 117 | int (*alloc_irq)(struct adf_accel_dev *accel_dev); |
|---|
| 168 | 118 | void (*free_irq)(struct adf_accel_dev *accel_dev); |
|---|
| .. | .. |
|---|
| 173 | 123 | int (*init_arb)(struct adf_accel_dev *accel_dev); |
|---|
| 174 | 124 | void (*exit_arb)(struct adf_accel_dev *accel_dev); |
|---|
| 175 | 125 | void (*get_arb_mapping)(struct adf_accel_dev *accel_dev, |
|---|
| 176 | | - const uint32_t **cfg); |
|---|
| 126 | + const u32 **cfg); |
|---|
| 177 | 127 | void (*disable_iov)(struct adf_accel_dev *accel_dev); |
|---|
| 178 | 128 | void (*enable_ints)(struct adf_accel_dev *accel_dev); |
|---|
| 179 | 129 | int (*enable_vf2pf_comms)(struct adf_accel_dev *accel_dev); |
|---|
| 180 | 130 | void (*reset_device)(struct adf_accel_dev *accel_dev); |
|---|
| 181 | 131 | const char *fw_name; |
|---|
| 182 | 132 | const char *fw_mmp_name; |
|---|
| 183 | | - uint32_t fuses; |
|---|
| 184 | | - uint32_t accel_capabilities_mask; |
|---|
| 185 | | - uint32_t instance_id; |
|---|
| 186 | | - uint16_t accel_mask; |
|---|
| 187 | | - uint16_t ae_mask; |
|---|
| 188 | | - uint16_t tx_rings_mask; |
|---|
| 189 | | - uint8_t tx_rx_gap; |
|---|
| 190 | | - uint8_t num_banks; |
|---|
| 191 | | - uint8_t num_accel; |
|---|
| 192 | | - uint8_t num_logical_accel; |
|---|
| 193 | | - uint8_t num_engines; |
|---|
| 194 | | - uint8_t min_iov_compat_ver; |
|---|
| 133 | + u32 fuses; |
|---|
| 134 | + u32 accel_capabilities_mask; |
|---|
| 135 | + u32 instance_id; |
|---|
| 136 | + u16 accel_mask; |
|---|
| 137 | + u16 ae_mask; |
|---|
| 138 | + u16 tx_rings_mask; |
|---|
| 139 | + u8 tx_rx_gap; |
|---|
| 140 | + u8 num_banks; |
|---|
| 141 | + u8 num_accel; |
|---|
| 142 | + u8 num_logical_accel; |
|---|
| 143 | + u8 num_engines; |
|---|
| 144 | + u8 min_iov_compat_ver; |
|---|
| 195 | 145 | } __packed; |
|---|
| 196 | 146 | |
|---|
| 197 | 147 | /* CSR write macro */ |
|---|
| .. | .. |
|---|
| 248 | 198 | struct tasklet_struct pf2vf_bh_tasklet; |
|---|
| 249 | 199 | struct mutex vf2pf_lock; /* protect CSR access */ |
|---|
| 250 | 200 | struct completion iov_msg_completion; |
|---|
| 251 | | - uint8_t compatible; |
|---|
| 252 | | - uint8_t pf_version; |
|---|
| 201 | + u8 compatible; |
|---|
| 202 | + u8 pf_version; |
|---|
| 253 | 203 | } vf; |
|---|
| 254 | 204 | }; |
|---|
| 255 | 205 | bool is_vf; |
|---|