otx2_cptpf.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0-only
  2. * Copyright (C) 2020 Marvell.
  3. */
  4. #ifndef __OTX2_CPTPF_H
  5. #define __OTX2_CPTPF_H
  6. #include "otx2_cpt_common.h"
  7. #include "otx2_cptpf_ucode.h"
  8. #include "otx2_cptlf.h"
  9. struct otx2_cptpf_dev;
  10. struct otx2_cptvf_info {
  11. struct otx2_cptpf_dev *cptpf; /* PF pointer this VF belongs to */
  12. struct work_struct vfpf_mbox_work;
  13. struct pci_dev *vf_dev;
  14. int vf_id;
  15. int intr_idx;
  16. };
  17. struct cptpf_flr_work {
  18. struct work_struct work;
  19. struct otx2_cptpf_dev *pf;
  20. };
  21. struct otx2_cptpf_dev {
  22. void __iomem *reg_base; /* CPT PF registers start address */
  23. void __iomem *afpf_mbox_base; /* PF-AF mbox start address */
  24. void __iomem *vfpf_mbox_base; /* VF-PF mbox start address */
  25. struct pci_dev *pdev; /* PCI device handle */
  26. struct otx2_cptvf_info vf[OTX2_CPT_MAX_VFS_NUM];
  27. struct otx2_cpt_eng_grps eng_grps;/* Engine groups information */
  28. struct otx2_cptlfs_info lfs; /* CPT LFs attached to this PF */
  29. /* HW capabilities for each engine type */
  30. union otx2_cpt_eng_caps eng_caps[OTX2_CPT_MAX_ENG_TYPES];
  31. bool is_eng_caps_discovered;
  32. /* AF <=> PF mbox */
  33. struct otx2_mbox afpf_mbox;
  34. struct work_struct afpf_mbox_work;
  35. struct workqueue_struct *afpf_mbox_wq;
  36. /* VF <=> PF mbox */
  37. struct otx2_mbox vfpf_mbox;
  38. struct workqueue_struct *vfpf_mbox_wq;
  39. struct workqueue_struct *flr_wq;
  40. struct cptpf_flr_work *flr_work;
  41. struct mutex lock; /* serialize mailbox access */
  42. unsigned long cap_flag;
  43. u8 pf_id; /* RVU PF number */
  44. u8 max_vfs; /* Maximum number of VFs supported by CPT */
  45. u8 enabled_vfs; /* Number of enabled VFs */
  46. u8 kvf_limits; /* Kernel crypto limits */
  47. bool has_cpt1;
  48. /* Devlink */
  49. struct devlink *dl;
  50. };
  51. irqreturn_t otx2_cptpf_afpf_mbox_intr(int irq, void *arg);
  52. void otx2_cptpf_afpf_mbox_handler(struct work_struct *work);
  53. irqreturn_t otx2_cptpf_vfpf_mbox_intr(int irq, void *arg);
  54. void otx2_cptpf_vfpf_mbox_handler(struct work_struct *work);
  55. #endif /* __OTX2_CPTPF_H */