xref: /wlan-dirver/qca-wifi-host-cmn/target_if/init_deinit/inc/init_cmd_api.h (revision 3149adf58a329e17232a4c0e58d460d025edd55a)
1 /*
2  * Copyright (c) 2018 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 /**
20  * DOC: init_cmd_api.h
21  *
22  * Public APIs to prepare and send init command
23  */
24 
25 #ifndef _INIT_DEINIT_INIT_CMD_H_
26 #define _INIT_DEINIT_INIT_CMD_H_
27 
28 /* max size if 256k */
29 #define HOST_MEM_CHUNK_MAX_SIZE (256 * 1024)
30 #define HOST_MEM_CHUNK_MAX_SIZE_POWER2 (8 + 10)
31 #define TXBF_CV_POOL0 2
32 #define TXBF_CV_POOL1 3
33 #define TXBF_CV_POOL2 4
34 #define HOST_CONTIGUOUS_MEM_CHUNK_REQUIRED 0x8
35 
36 /**
37  * enum wlan_fw_mem_prio - defines FW Memory requirement type
38  * @FW_MEM_HIGH_PRIORITY:   Memory requires contiguous memory allocation
39  * @FW_MEM_LOW_PRIORITY:    Memory can be fragmented
40  * @FW_PRIORITY_MAX:        Invalid type
41  */
42 enum wlan_fw_mem_prio {
43 	FW_MEM_HIGH_PRIORITY = 0,
44 	FW_MEM_LOW_PRIORITY,
45 	FW_PRIORITY_MAX
46 };
47 
48 /**
49  * init_deinit_handle_host_mem_req() - handle host memory request
50  * @psoc: PSOC object
51  * @tgt_info: PSOC_INFO object
52  * @event: Event buffer from FW
53  *
54  * API to handle memory request from FW and allocate memory chunks
55  *
56  * Return: SUCCESS on successful memory allocation
57  *         On FAILURE (appropriate failure codes are returned)
58  */
59 QDF_STATUS init_deinit_handle_host_mem_req(
60 		 struct wlan_objmgr_psoc *psoc,
61 		 struct target_psoc_info *tgt_info, uint8_t *event);
62 
63 /**
64  * init_deinit_free_num_units() - Free allocated mem chunks
65  * @psoc: PSOC object
66  * @tgt_info: PSOC_INFO object
67  *
68  * API to free memory
69  *
70  * Return: SUCCESS on successful memory free
71  *         On FAILURE (appropriate failure codes are returned)
72  */
73 QDF_STATUS init_deinit_free_num_units(struct wlan_objmgr_psoc *psoc,
74 			struct target_psoc_info *tgt_hdl);
75 
76 /**
77  * init_deinit_derive_band_to_mac_param() - Derive band to mac param
78  * @psoc: PSOC object
79  * @tgt_info: PSOC_INFO object
80  * @band_to_mac: BAND_TO_MAC object
81  *
82  * API to derive band to mac param
83  *
84  * Return: void
85  */
86 void init_deinit_derive_band_to_mac_param(
87 		struct wlan_objmgr_psoc *psoc,
88 		struct target_psoc_info *tgt_info,
89 		struct wmi_host_pdev_band_to_mac *band_to_mac);
90 
91 /**
92  * init_deinit_prepare_send_init_cmd() - prepare send init cmd
93  * @psoc: PSOC object
94  * @tgt_info: PSOC_INFO object
95  *
96  * API to prepare send init command
97  *
98  * Return: void
99  */
100 void init_deinit_prepare_send_init_cmd(
101 		 struct wlan_objmgr_psoc *psoc,
102 		 struct target_psoc_info *tgt_info);
103 
104 #endif /* _INIT_DEINIT_INIT_CMD_H_*/
105