Srujana Challa | 5e8ce83 | 2021-01-15 19:22:19 +0530 | [diff] [blame] | 1 | /* 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 Challa | 83ffcf7 | 2021-01-15 19:22:20 +0530 | [diff] [blame] | 8 | #include "otx2_cpt_common.h" |
Srujana Challa | 43ac0b8 | 2021-01-15 19:22:22 +0530 | [diff] [blame] | 9 | #include "otx2_cptpf_ucode.h" |
Srujana Challa | 6450601 | 2021-01-15 19:22:23 +0530 | [diff] [blame] | 10 | #include "otx2_cptlf.h" |
Srujana Challa | 83ffcf7 | 2021-01-15 19:22:20 +0530 | [diff] [blame] | 11 | |
Srujana Challa | fe16ece | 2021-01-15 19:22:21 +0530 | [diff] [blame] | 12 | struct otx2_cptpf_dev; |
| 13 | struct 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 | |
| 21 | struct cptpf_flr_work { |
| 22 | struct work_struct work; |
| 23 | struct otx2_cptpf_dev *pf; |
| 24 | }; |
| 25 | |
Srujana Challa | 5e8ce83 | 2021-01-15 19:22:19 +0530 | [diff] [blame] | 26 | struct otx2_cptpf_dev { |
| 27 | void __iomem *reg_base; /* CPT PF registers start address */ |
Srujana Challa | 83ffcf7 | 2021-01-15 19:22:20 +0530 | [diff] [blame] | 28 | void __iomem *afpf_mbox_base; /* PF-AF mbox start address */ |
Srujana Challa | fe16ece | 2021-01-15 19:22:21 +0530 | [diff] [blame] | 29 | void __iomem *vfpf_mbox_base; /* VF-PF mbox start address */ |
Srujana Challa | 5e8ce83 | 2021-01-15 19:22:19 +0530 | [diff] [blame] | 30 | struct pci_dev *pdev; /* PCI device handle */ |
Srujana Challa | fe16ece | 2021-01-15 19:22:21 +0530 | [diff] [blame] | 31 | struct otx2_cptvf_info vf[OTX2_CPT_MAX_VFS_NUM]; |
Srujana Challa | 43ac0b8 | 2021-01-15 19:22:22 +0530 | [diff] [blame] | 32 | struct otx2_cpt_eng_grps eng_grps;/* Engine groups information */ |
Srujana Challa | 6450601 | 2021-01-15 19:22:23 +0530 | [diff] [blame] | 33 | struct otx2_cptlfs_info lfs; /* CPT LFs attached to this PF */ |
Srujana Challa | 78506c2 | 2021-01-15 19:22:24 +0530 | [diff] [blame] | 34 | /* 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 Challa | 43ac0b8 | 2021-01-15 19:22:22 +0530 | [diff] [blame] | 37 | |
Srujana Challa | 83ffcf7 | 2021-01-15 19:22:20 +0530 | [diff] [blame] | 38 | /* 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 Challa | fe16ece | 2021-01-15 19:22:21 +0530 | [diff] [blame] | 43 | /* 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 Challa | 4cd8c31 | 2021-05-25 16:57:15 +0530 | [diff] [blame] | 50 | unsigned long cap_flag; |
Srujana Challa | 83ffcf7 | 2021-01-15 19:22:20 +0530 | [diff] [blame] | 51 | u8 pf_id; /* RVU PF number */ |
Srujana Challa | fe16ece | 2021-01-15 19:22:21 +0530 | [diff] [blame] | 52 | u8 max_vfs; /* Maximum number of VFs supported by CPT */ |
| 53 | u8 enabled_vfs; /* Number of enabled VFs */ |
Srujana Challa | 8ec8015 | 2021-01-15 19:22:26 +0530 | [diff] [blame] | 54 | u8 kvf_limits; /* Kernel crypto limits */ |
Srujana Challa | b2d17df | 2021-04-15 17:58:37 +0530 | [diff] [blame] | 55 | bool has_cpt1; |
Srujana Challa | 5e8ce83 | 2021-01-15 19:22:19 +0530 | [diff] [blame] | 56 | }; |
| 57 | |
Srujana Challa | 83ffcf7 | 2021-01-15 19:22:20 +0530 | [diff] [blame] | 58 | irqreturn_t otx2_cptpf_afpf_mbox_intr(int irq, void *arg); |
| 59 | void otx2_cptpf_afpf_mbox_handler(struct work_struct *work); |
Srujana Challa | fe16ece | 2021-01-15 19:22:21 +0530 | [diff] [blame] | 60 | irqreturn_t otx2_cptpf_vfpf_mbox_intr(int irq, void *arg); |
| 61 | void otx2_cptpf_vfpf_mbox_handler(struct work_struct *work); |
Srujana Challa | 83ffcf7 | 2021-01-15 19:22:20 +0530 | [diff] [blame] | 62 | |
Srujana Challa | 5e8ce83 | 2021-01-15 19:22:19 +0530 | [diff] [blame] | 63 | #endif /* __OTX2_CPTPF_H */ |