xref: /wlan-dirver/qca-wifi-host-cmn/hal/wifi3.0/be/hal_be_api.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _HAL_BE_API_H_
20 #define _HAL_BE_API_H_
21 
22 #include "hal_hw_headers.h"
23 #include "hal_rx.h"
24 
25 struct hal_hw_cc_config {
26 	uint32_t lut_base_addr_31_0;
27 	uint32_t cc_global_en:1,
28 		 page_4k_align:1,
29 		 cookie_offset_msb:5,
30 		 cookie_page_msb:5,
31 		 lut_base_addr_39_32:8,
32 		 wbm2sw6_cc_en:1,
33 		 wbm2sw5_cc_en:1,
34 		 wbm2sw4_cc_en:1,
35 		 wbm2sw3_cc_en:1,
36 		 wbm2sw2_cc_en:1,
37 		 wbm2sw1_cc_en:1,
38 		 wbm2sw0_cc_en:1,
39 		 wbm2fw_cc_en:1,
40 		 error_path_cookie_conv_en:1,
41 		 release_path_cookie_conv_en:1,
42 		 reserved:2;
43 };
44 
45 #define HAL_RX_MSDU_EXT_DESC_INFO_GET(msdu_details_ptr) \
46 	((struct rx_msdu_ext_desc_info *) \
47 	_OFFSET_TO_BYTE_PTR(msdu_details_ptr, \
48 RX_MSDU_DETAILS_RX_MSDU_EXT_DESC_INFO_DETAILS_RESERVED_0A_OFFSET))
49 
50 /**
51  * hal_reo_setup_generic_be - Initialize HW REO block
52  *
53  * @hal_soc: Opaque HAL SOC handle
54  * @reo_params: parameters needed by HAL for REO config
55  */
56 void hal_reo_setup_generic_be(struct hal_soc *soc,
57 			      void *reoparams);
58 
59 /**
60  * hal_rx_msdu_ext_desc_info_get_ptr_be() - Get the msdu extension
61  *			descriptor pointer.
62  * @msdu_details_ptr: msdu details
63  *
64  * Return: msdu exntension descriptor pointer.
65  */
66 void *hal_rx_msdu_ext_desc_info_get_ptr_be(void *msdu_details_ptr);
67 
68 /**
69  * hal_set_link_desc_addr_be - Setup link descriptor in a buffer_addr_info
70  * HW structure
71  *
72  * @desc: Descriptor entry (from WBM_IDLE_LINK ring)
73  * @cookie: SW cookie for the buffer/descriptor
74  * @link_desc_paddr: Physical address of link descriptor entry
75  *
76  */
77 void hal_set_link_desc_addr_be(void *desc, uint32_t cookie,
78 			       qdf_dma_addr_t link_desc_paddr);
79 
80 /**
81  * hal_hw_txrx_default_ops_attach_be(): Add default ops for BE chips
82  * @ hal_soc_hdl: hal_soc handle
83  *
84  * Return: None
85  */
86 void hal_hw_txrx_default_ops_attach_be(struct hal_soc *soc);
87 
88 uint32_t hal_tx_comp_get_buffer_source_generic_be(void *hal_desc);
89 uint8_t hal_rx_ret_buf_manager_get_be(hal_ring_desc_t ring_desc);
90 void hal_rx_wbm_err_info_get_generic_be(void *wbm_desc, void *wbm_er_info1);
91 
92 /**
93  * hal_reo_qdesc_setup - Setup HW REO queue descriptor
94  *
95  * @hal_soc: Opaque HAL SOC handle
96  * @ba_window_size: BlockAck window size
97  * @start_seq: Starting sequence number
98  * @hw_qdesc_vaddr: Virtual address of REO queue descriptor memory
99  * @hw_qdesc_paddr: Physical address of REO queue descriptor memory
100  * @pn_type: PN type (one of the types defined in 'enum hal_pn_type')
101  *
102  */
103 void hal_reo_qdesc_setup_be(hal_soc_handle_t hal_soc_hdl,
104 			    int tid, uint32_t ba_window_size,
105 			    uint32_t start_seq, void *hw_qdesc_vaddr,
106 			    qdf_dma_addr_t hw_qdesc_paddr,
107 			    int pn_type);
108 
109 /**
110  * hal_cookie_conversion_reg_cfg_be() - set cookie conversion relevant register
111  *					for REO/WBM
112  * @soc: HAL soc handle
113  * @cc_cfg: structure pointer for HW cookie conversion configuration
114  *
115  * Return: None
116  */
117 void hal_cookie_conversion_reg_cfg_be(hal_soc_handle_t hal_soc_hdl,
118 				      struct hal_hw_cc_config *cc_cfg);
119 
120 #endif /* _HAL_BE_API_H_ */
121