1 /*
2  * Copyright (c) 2013-2019 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 /* BMI declarations and prototypes */
22 /* */
23 /* ================================================================= */
24 
25 #ifndef _BMI_H_
26 #define _BMI_H_
27 #include "bmi_msg.h"
28 #include "qdf_trace.h"
29 #include "ol_if_athvar.h"
30 #include "hif.h"
31 
32 struct ol_context;
33 
34 /**
35  * struct ol_config_info - Place Holder for offload configuration
36  * @enable_uart_print: UART Print
37  * @enable_self_recovery: Self Recovery
38  * @enable_fw_log:      To Enable FW LOG
39  * @enable_lpass_support: LPASS support
40  * @enable_ramdump_collection: Ramdump Collection
41  *
42  * Structure for holding ini parameters.
43  */
44 
45 struct ol_config_info {
46 	bool enable_uart_print;
47 	bool enable_self_recovery;
48 	uint8_t enable_fw_log;
49 	bool enable_lpass_support;
50 	bool enable_ramdump_collection;
51 };
52 
53 #ifdef WLAN_FEATURE_BMI
54 QDF_STATUS ol_cds_init(qdf_device_t qdf_dev, void *hif_ctx);
55 void ol_cds_free(void);
56 void ol_init_ini_config(struct ol_context *ol_ctx,
57 			struct ol_config_info *cfg);
58 /**
59  * ol_set_fw_crashed_cb() - set firmware crashed callback
60  * @ol_ctx: ol context
61  * @callback_fn: fw crashed callback function
62  *
63  * Return: None
64  */
65 void ol_set_fw_crashed_cb(struct ol_context *ol_ctx,
66 			  void (*callback_fn)(void));
67 void bmi_cleanup(struct ol_context *scn);
68 QDF_STATUS bmi_done(struct ol_context *ol_ctx);
69 void bmi_target_ready(struct hif_opaque_softc *scn, void *cfg_ctx);
70 QDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx);
71 
72 #else /* WLAN_FEATURE_BMI */
73 
74 static inline QDF_STATUS
ol_cds_init(qdf_device_t qdf_dev,void * hif_ctx)75 ol_cds_init(qdf_device_t qdf_dev, void *hif_ctx)
76 {
77 	return QDF_STATUS_SUCCESS;
78 }
79 
ol_cds_free(void)80 static inline void ol_cds_free(void)
81 {
82 }
83 
84 static inline void
ol_init_ini_config(struct ol_context * ol_ctx,struct ol_config_info * cfg)85 ol_init_ini_config(struct ol_context *ol_ctx, struct ol_config_info *cfg)
86 {
87 }
88 
89 static inline void
ol_set_fw_crashed_cb(struct ol_context * ol_ctx,void (* callback_fn)(void))90 ol_set_fw_crashed_cb(struct ol_context *ol_ctx, void (*callback_fn)(void))
91 {
92 }
93 
bmi_cleanup(struct ol_context * scn)94 static inline void bmi_cleanup(struct ol_context *scn)
95 {
96 }
97 
bmi_done(struct ol_context * ol_ctx)98 static inline QDF_STATUS bmi_done(struct ol_context *ol_ctx)
99 {
100 	return QDF_STATUS_SUCCESS;
101 }
102 
103 static inline void
bmi_target_ready(struct hif_opaque_softc * scn,void * cfg_ctx)104 bmi_target_ready(struct hif_opaque_softc *scn, void *cfg_ctx)
105 {
106 }
107 
108 static inline QDF_STATUS
bmi_download_firmware(struct ol_context * ol_ctx)109 bmi_download_firmware(struct ol_context *ol_ctx)
110 {
111 	return QDF_STATUS_SUCCESS;
112 }
113 #endif /* WLAN_FEATURE_BMI */
114 
115 #endif /* _BMI_H_ */
116