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"
14 #define QAT_DETACHED (0)
15 #define QAT_ATTACHED (1)
17 #define QAT_DEV_NAME_MAX_LEN 64
20 * This struct holds all the data about a QAT pci device
21 * including data about all services it supports.
27 struct qat_sym_dev_private;
28 struct qat_pci_device {
30 /* Data used by all services */
31 char name[QAT_DEV_NAME_MAX_LEN];
32 /**< Name of qat pci device */
34 /**< Device instance for this qat pci device */
35 struct rte_pci_device *pci_dev;
36 /**< PCI information. */
37 enum qat_device_gen qat_dev_gen;
38 /**< QAT device generation */
39 rte_spinlock_t arb_csr_lock;
40 /**< lock to protect accesses to the arbiter CSR */
43 /**< Flag indicating the device is attached */
45 struct qat_qp *qps_in_use[QAT_MAX_SERVICES][ADF_MAX_QPS_ON_ANY_SERVICE];
46 /**< links to qps set up for each service, index same as on API */
48 /* Data relating to symmetric crypto service */
49 struct qat_sym_dev_private *sym_dev;
50 /**< link back to cryptodev private data */
51 struct rte_device sym_rte_dev;
52 /**< This represents the crypto subset of this pci device.
53 * Register with this rather than with the one in
54 * pci_dev so that its driver can have a crypto-specific name
57 /* Data relating to compression service */
59 /* Data relating to asymmetric crypto service */
63 struct qat_gen_hw_data {
64 enum qat_device_gen dev_gen;
65 const struct qat_qp_hw_data (*qp_hw_data)[ADF_MAX_QPS_ON_ANY_SERVICE];
68 extern struct qat_gen_hw_data qat_gen_config[];
70 struct qat_pci_device *
71 qat_pci_device_allocate(struct rte_pci_device *pci_dev);
74 qat_pci_device_release(struct rte_pci_device *pci_dev);
76 struct qat_pci_device *
77 qat_get_qat_dev_from_pci_dev(struct rte_pci_device *pci_dev);
79 /* declaration needed for weak functions */
81 qat_sym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
84 qat_asym_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
87 qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
90 qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
93 qat_comp_dev_create(struct qat_pci_device *qat_pci_dev __rte_unused);
96 qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev __rte_unused);
98 #endif /* _QAT_DEVICE_H_ */