1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
7 #include <rte_bus_pci.h>
9 #include "qat_common.h"
11 #include "adf_transport_access_macros.h"
15 #define QAT_DETACHED (0)
16 #define QAT_ATTACHED (1)
18 #define QAT_MAX_PCI_DEVICES 48
19 #define QAT_DEV_NAME_MAX_LEN 64
22 * This struct holds all the data about a QAT pci device
23 * including data about all services it supports.
29 struct qat_sym_dev_private;
30 struct qat_pci_device {
32 /* Data used by all services */
33 char name[QAT_DEV_NAME_MAX_LEN];
34 /**< Name of qat pci device */
36 /**< Device instance for this qat pci device */
37 struct rte_pci_device *pci_dev;
38 /**< PCI information. */
39 enum qat_device_gen qat_dev_gen;
40 /**< QAT device generation */
41 rte_spinlock_t arb_csr_lock;
42 /**< lock to protect accesses to the arbiter CSR */
45 /**< Flag indicating the device is attached */
47 struct qat_qp *qps_in_use[QAT_MAX_SERVICES][ADF_MAX_QPS_ON_ANY_SERVICE];
48 /**< links to qps set up for each service, index same as on API */
50 /* Data relating to symmetric crypto service */
51 struct qat_sym_dev_private *sym_dev;
52 /**< link back to cryptodev private data */
54 /* Data relating to compression service */
56 /* Data relating to asymmetric crypto service */
60 struct qat_gen_hw_data {
61 enum qat_device_gen dev_gen;
62 const struct qat_qp_hw_data (*qp_hw_data)[ADF_MAX_QPS_ON_ANY_SERVICE];
65 extern struct qat_gen_hw_data qat_gen_config[];
67 struct qat_pci_device *
68 qat_pci_device_allocate(struct rte_pci_device *pci_dev);
70 qat_pci_device_release(struct rte_pci_device *pci_dev);
71 struct qat_pci_device *
72 qat_get_qat_dev_from_pci_dev(struct rte_pci_device *pci_dev);
75 #endif /* _QAT_DEVICE_H_ */