xref: /dpdk/drivers/common/cnxk/roc_sso_priv.h (revision 62afdd8d493d8f563c053a4afccb3c5acd1acf54)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 
5 #ifndef _ROC_SSO_PRIV_H_
6 #define _ROC_SSO_PRIV_H_
7 
8 struct sso_rsrc {
9 	uint16_t rsrc_id;
10 	uint64_t base;
11 };
12 
13 struct sso {
14 	struct plt_pci_device *pci_dev;
15 	struct dev dev;
16 	/* EVA memory area */
17 	uintptr_t agg_mem[MAX_RVU_BLKLF_CNT];
18 	uint32_t agg_used[MAX_RVU_BLKLF_CNT];
19 	uint32_t agg_cnt[MAX_RVU_BLKLF_CNT];
20 	/* Interrupt handler args. */
21 	struct sso_rsrc hws_rsrc[MAX_RVU_BLKLF_CNT];
22 	struct sso_rsrc hwgrp_rsrc[MAX_RVU_BLKLF_CNT];
23 	/* MSIX offsets */
24 	uint16_t hws_msix_offset[MAX_RVU_BLKLF_CNT];
25 	uint16_t hwgrp_msix_offset[MAX_RVU_BLKLF_CNT];
26 	/* SSO link mapping. */
27 	struct plt_bitmap **link_map;
28 	void *link_map_mem;
29 } __plt_cache_aligned;
30 
31 enum sso_err_status {
32 	SSO_ERR_PARAM = -4096,
33 	SSO_ERR_DEVICE_NOT_BOUNDED = -4097,
34 };
35 
36 enum sso_lf_type {
37 	SSO_LF_TYPE_HWS,
38 	SSO_LF_TYPE_HWGRP,
39 };
40 
41 static inline struct sso *
42 roc_sso_to_sso_priv(struct roc_sso *roc_sso)
43 {
44 	return (struct sso *)&roc_sso->reserved[0];
45 }
46 
47 /* SSO LF ops */
48 int sso_lf_alloc(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf,
49 		 void **rsp);
50 int sso_lf_free(struct dev *dev, enum sso_lf_type lf_type, uint16_t nb_lf);
51 void sso_hws_link_modify(uint8_t hws, uintptr_t base, struct plt_bitmap *bmp, uint16_t hwgrp[],
52 			 uint16_t n, uint8_t set, uint16_t enable);
53 int sso_hwgrp_alloc_xaq(struct dev *dev, uint32_t npa_aura_id, uint16_t hwgrps);
54 int sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps);
55 int sso_hwgrp_init_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,
56 			    uint32_t nb_xae, uint32_t xae_waes,
57 			    uint32_t xaq_buf_size, uint16_t nb_hwgrp);
58 int sso_hwgrp_free_xaq_aura(struct dev *dev, struct roc_sso_xaq_data *xaq,
59 			    uint16_t nb_hwgrp);
60 
61 /* SSO IRQ */
62 int sso_register_irqs_priv(struct roc_sso *roc_sso,
63 			   struct plt_intr_handle *handle, uint16_t nb_hws,
64 			   uint16_t nb_hwgrp);
65 void sso_unregister_irqs_priv(struct roc_sso *roc_sso,
66 			      struct plt_intr_handle *handle, uint16_t nb_hws,
67 			      uint16_t nb_hwgrp);
68 
69 #endif /* _ROC_SSO_PRIV_H_ */
70