1  /*
2   * Copyright (c) 2018, 2020 The Linux Foundation. All rights reserved.
3   * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4   *
5   * Permission to use, copy, modify, and/or distribute this software for
6   * any purpose with or without fee is hereby granted, provided that the
7   * above copyright notice and this permission notice appear in all
8   * copies.
9   *
10   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11   * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12   * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13   * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14   * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15   * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17   * PERFORMANCE OF THIS SOFTWARE.
18   */
19  
20  /**
21   * DOC: init_cmd_api.h
22   *
23   * Public APIs to prepare and send init command
24   */
25  
26  #ifndef _INIT_DEINIT_INIT_CMD_H_
27  #define _INIT_DEINIT_INIT_CMD_H_
28  
29  /* max size if 256k */
30  #define HOST_MEM_CHUNK_MAX_SIZE (256 * 1024)
31  #define HOST_MEM_CHUNK_MAX_SIZE_POWER2 (8 + 10)
32  #define TXBF_CV_POOL0 2
33  #define TXBF_CV_POOL1 3
34  #define TXBF_CV_POOL2 4
35  #define CFR_CAPTURE_HOST_MEM_REQ_ID 9
36  #define HOST_CONTIGUOUS_MEM_CHUNK_REQUIRED 0x8
37  
38  /**
39   * init_deinit_handle_host_mem_req() - handle host memory request
40   * @psoc: PSOC object
41   * @tgt_info: PSOC_INFO object
42   * @event: Event buffer from FW
43   *
44   * API to handle memory request from FW and allocate memory chunks
45   *
46   * Return: SUCCESS on successful memory allocation
47   *         On FAILURE (appropriate failure codes are returned)
48   */
49  QDF_STATUS init_deinit_handle_host_mem_req(
50  		 struct wlan_objmgr_psoc *psoc,
51  		 struct target_psoc_info *tgt_info, uint8_t *event);
52  
53  /**
54   * init_deinit_free_num_units() - Free allocated mem chunks
55   * @psoc: PSOC object
56   * @tgt_hdl: PSOC_INFO object
57   *
58   * API to free memory
59   *
60   * Return: SUCCESS on successful memory free
61   *         On FAILURE (appropriate failure codes are returned)
62   */
63  QDF_STATUS init_deinit_free_num_units(struct wlan_objmgr_psoc *psoc,
64  			struct target_psoc_info *tgt_hdl);
65  
66  /**
67   * init_deinit_derive_band_to_mac_param() - Derive band to mac param
68   * @psoc: PSOC object
69   * @tgt_info: PSOC_INFO object
70   * @init_param: Pointer to init param
71   *
72   * API to derive band to mac param
73   *
74   * Return: void
75   */
76  void init_deinit_derive_band_to_mac_param(
77  		struct wlan_objmgr_psoc *psoc,
78  		struct target_psoc_info *tgt_info,
79  		struct wmi_init_cmd_param *init_param);
80  
81  /**
82   * init_deinit_prepare_send_init_cmd() - prepare send init cmd
83   * @psoc: PSOC object
84   * @tgt_info: PSOC_INFO object
85   *
86   * API to prepare send init command
87   *
88   * Return: void
89   */
90  void init_deinit_prepare_send_init_cmd(
91  		 struct wlan_objmgr_psoc *psoc,
92  		 struct target_psoc_info *tgt_info);
93  
94  #endif /* _INIT_DEINIT_INIT_CMD_H_*/
95