1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef _QDF_SSR_DRIVER_DUMP_H_
18 #define _QDF_SSR_DRIVER_DUMP_H_
19 
20 #include <qdf_types.h>
21 
22 #ifdef WLAN_FEATURE_SSR_DRIVER_DUMP
23 #include "i_qdf_ssr_driver_dump.h"
24 
25 typedef __qdf_ssr_driver_dump_entry qdf_ssr_driver_dump_entry;
26 
27 /**
28  * qdf_ssr_driver_dump_init() - Initialize the dump collection API.
29  *
30  * Return:
31  *	QDF_STATUS_SUCCESS - Initialization was successful
32  *	else		   - Error initializing mutex
33  */
34 QDF_STATUS qdf_ssr_driver_dump_init(void);
35 
36 /*
37  * qdf_ssr_driver_dump_deinit() - Deinitialize the dump collection API.
38  *
39  * Return:
40  *	QDF_STATUS_SUCCESS - Deinitialization was successful
41  *	else		   - Error destroying mutex
42  */
43 QDF_STATUS qdf_ssr_driver_dump_deinit(void);
44 
45 /*
46  * qdf_ssr_driver_dump_register_region() - Add a region to the entry list
47  * @region_name: name of region to be registered
48  * @region_buffer: pointer to region
49  * @region_size: size of region in bytes
50  *
51  * Return:
52  *	QDF_STATUS_SUCCESS - Region registration successful
53  *	QDF_STATUS_E_NULL_VALUE - Null pointers provided.
54  *	QDF_STATUS_E_RESOURCES - Error acquiring/releasing mutex
55  *	QDF_STATUS_E_INVAL - Duplicate region registration
56  *	QDF_STATUS_E_NOMEM - Not enough space for another region
57  */
58 QDF_STATUS
59 qdf_ssr_driver_dump_register_region(char *region_name, void *region_buffer,
60 				    size_t region_size);
61 
62 /*
63  * qdf_ssr_driver_dump_unregister_region() - Add a client to the entry list
64  * @region_name: name of region to be unregistered
65  *
66  * Return:
67  *	QDF_STATUS_SUCCESS - Region unregistration successful
68  *	QDF_STATUS_E_NULL_VALUE - Null pointer provided.
69  *	QDF_STATUS_E_RESOURCES - Error acquiring/releasing mutex
70  *	QDF_STATUS_E_INVAL - Region not found
71  */
72 QDF_STATUS qdf_ssr_driver_dump_unregister_region(char *region_name);
73 
74 /*
75  * qdf_ssr_driver_dump_retrieve_regions() - Retrieve list of clients
76  * @input_array: pointer to an array of cnss_ssr_driver_dump_entry, which
77  *		 will be filled with registered clients by this function.
78  * @num_entries_retrieved: pointer to a variable which will be filled with
79  *			   number of regions added.
80  *
81  * Return:
82  *	QDF_STATUS_SUCCESS - Region retrieval successful
83  *	QDF_STATUS_E_NULL_VALUE - Null pointers provided
84  *	QDF_STATUS_E_INVAL - Error retrieving regions
85  *	QDF_STATUS_E_RESOURCES - Error acquiring/releasing mutex
86  */
87 QDF_STATUS
88 qdf_ssr_driver_dump_retrieve_regions(qdf_ssr_driver_dump_entry *input_array,
89 				     size_t *num_entries_retrieved);
90 #else
91 
92 static inline QDF_STATUS
qdf_ssr_driver_dump_init(void)93 qdf_ssr_driver_dump_init(void)
94 {
95 	return QDF_STATUS_SUCCESS;
96 }
97 
98 static inline QDF_STATUS
qdf_ssr_driver_dump_deinit(void)99 qdf_ssr_driver_dump_deinit(void)
100 {
101 	return QDF_STATUS_SUCCESS;
102 }
103 
104 static inline QDF_STATUS
qdf_ssr_driver_dump_register_region(char * region_name,void * region_buffer,size_t region_size)105 qdf_ssr_driver_dump_register_region(char *region_name, void *region_buffer,
106 				    size_t region_size)
107 {
108 	return QDF_STATUS_SUCCESS;
109 }
110 
111 static inline QDF_STATUS
qdf_ssr_driver_dump_unregister_region(char * region_name)112 qdf_ssr_driver_dump_unregister_region(char *region_name)
113 {
114 	return QDF_STATUS_SUCCESS;
115 }
116 
117 #endif /* #ifdef WLAN_FEATURE_SSR_DRIVER_DUMP */
118 #endif
119