blob: 5ebba86c65d93064ee3423504bea654c692c3f73 [file] [log] [blame]
Srujana Challa5e8ce832021-01-15 19:22:19 +05301/* SPDX-License-Identifier: GPL-2.0-only
2 * Copyright (C) 2020 Marvell.
3 */
4
5#ifndef __OTX2_CPTPF_H
6#define __OTX2_CPTPF_H
7
Srujana Challa83ffcf72021-01-15 19:22:20 +05308#include "otx2_cpt_common.h"
Srujana Challa43ac0b82021-01-15 19:22:22 +05309#include "otx2_cptpf_ucode.h"
Srujana Challa64506012021-01-15 19:22:23 +053010#include "otx2_cptlf.h"
Srujana Challa83ffcf72021-01-15 19:22:20 +053011
Srujana Challafe16ece2021-01-15 19:22:21 +053012struct otx2_cptpf_dev;
13struct otx2_cptvf_info {
14 struct otx2_cptpf_dev *cptpf; /* PF pointer this VF belongs to */
15 struct work_struct vfpf_mbox_work;
16 struct pci_dev *vf_dev;
17 int vf_id;
18 int intr_idx;
19};
20
21struct cptpf_flr_work {
22 struct work_struct work;
23 struct otx2_cptpf_dev *pf;
24};
25
Srujana Challa5e8ce832021-01-15 19:22:19 +053026struct otx2_cptpf_dev {
27 void __iomem *reg_base; /* CPT PF registers start address */
Srujana Challa83ffcf72021-01-15 19:22:20 +053028 void __iomem *afpf_mbox_base; /* PF-AF mbox start address */
Srujana Challafe16ece2021-01-15 19:22:21 +053029 void __iomem *vfpf_mbox_base; /* VF-PF mbox start address */
Srujana Challa5e8ce832021-01-15 19:22:19 +053030 struct pci_dev *pdev; /* PCI device handle */
Srujana Challafe16ece2021-01-15 19:22:21 +053031 struct otx2_cptvf_info vf[OTX2_CPT_MAX_VFS_NUM];
Srujana Challa43ac0b82021-01-15 19:22:22 +053032 struct otx2_cpt_eng_grps eng_grps;/* Engine groups information */
Srujana Challa64506012021-01-15 19:22:23 +053033 struct otx2_cptlfs_info lfs; /* CPT LFs attached to this PF */
Srujana Challa78506c22021-01-15 19:22:24 +053034 /* HW capabilities for each engine type */
35 union otx2_cpt_eng_caps eng_caps[OTX2_CPT_MAX_ENG_TYPES];
36 bool is_eng_caps_discovered;
Srujana Challa43ac0b82021-01-15 19:22:22 +053037
Srujana Challa83ffcf72021-01-15 19:22:20 +053038 /* AF <=> PF mbox */
39 struct otx2_mbox afpf_mbox;
40 struct work_struct afpf_mbox_work;
41 struct workqueue_struct *afpf_mbox_wq;
42
Srujana Challafe16ece2021-01-15 19:22:21 +053043 /* VF <=> PF mbox */
44 struct otx2_mbox vfpf_mbox;
45 struct workqueue_struct *vfpf_mbox_wq;
46
47 struct workqueue_struct *flr_wq;
48 struct cptpf_flr_work *flr_work;
49
Srujana Challa4cd8c312021-05-25 16:57:15 +053050 unsigned long cap_flag;
Srujana Challa83ffcf72021-01-15 19:22:20 +053051 u8 pf_id; /* RVU PF number */
Srujana Challafe16ece2021-01-15 19:22:21 +053052 u8 max_vfs; /* Maximum number of VFs supported by CPT */
53 u8 enabled_vfs; /* Number of enabled VFs */
Srujana Challa8ec80152021-01-15 19:22:26 +053054 u8 kvf_limits; /* Kernel crypto limits */
Srujana Challab2d17df2021-04-15 17:58:37 +053055 bool has_cpt1;
Srujana Challa5e8ce832021-01-15 19:22:19 +053056};
57
Srujana Challa83ffcf72021-01-15 19:22:20 +053058irqreturn_t otx2_cptpf_afpf_mbox_intr(int irq, void *arg);
59void otx2_cptpf_afpf_mbox_handler(struct work_struct *work);
Srujana Challafe16ece2021-01-15 19:22:21 +053060irqreturn_t otx2_cptpf_vfpf_mbox_intr(int irq, void *arg);
61void otx2_cptpf_vfpf_mbox_handler(struct work_struct *work);
Srujana Challa83ffcf72021-01-15 19:22:20 +053062
Srujana Challa5e8ce832021-01-15 19:22:19 +053063#endif /* __OTX2_CPTPF_H */