1/*-
2 * Copyright(c) 2002-2011 Exar Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification are permitted provided the following conditions are met:
7 *
8 *    1. Redistributions of source code must retain the above copyright notice,
9 *       this list of conditions and the following disclaimer.
10 *
11 *    2. Redistributions in binary form must reproduce the above copyright
12 *       notice, this list of conditions and the following disclaimer in the
13 *       documentation and/or other materials provided with the distribution.
14 *
15 *    3. Neither the name of the Exar Corporation nor the names of its
16 *       contributors may be used to endorse or promote products derived from
17 *       this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31/*$FreeBSD: releng/11.0/sys/dev/vxge/include/vxgehal-mgmtaux.h 298955 2016-05-03 03:41:25Z pfg $*/
32
33#ifndef	VXGE_HAL_MGMTAUX_H
34#define	VXGE_HAL_MGMTAUX_H
35
36__EXTERN_BEGIN_DECLS
37
38/*
39 * vxge_hal_aux_about_read - Retrieve and format about info.
40 * @devh: HAL device handle.
41 * @bufsize: Buffer size.
42 * @retbuf: Buffer pointer.
43 * @retsize: Size of the result. Cannot be greater than @bufsize.
44 *
45 * Retrieve about info (using vxge_hal_mgmt_about()) and sprintf it
46 * into the provided @retbuf.
47 *
48 * Returns: VXGE_HAL_OK - success.
49 * VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
50 * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
51 * VXGE_HAL_FAIL - Failed to retrieve the information.
52 *
53 * See also: vxge_hal_mgmt_about(), vxge_hal_aux_device_dump().
54 */
55vxge_hal_status_e vxge_hal_aux_about_read(vxge_hal_device_h devh, int bufsize,
56    char *retbuf, int *retsize);
57
58/*
59 * vxge_hal_aux_driver_config_read - Read Driver configuration.
60 * @bufsize: Buffer size.
61 * @retbuf: Buffer pointer.
62 * @retsize: Size of the result. Cannot be greater than @bufsize.
63 *
64 * Read driver configuration,
65 *
66 * Returns: VXGE_HAL_OK - success.
67 * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
68 *
69 * See also: vxge_hal_aux_device_config_read().
70 */
71vxge_hal_status_e
72vxge_hal_aux_driver_config_read(int bufsize, char *retbuf, int *retsize);
73
74/*
75 * vxge_hal_aux_pci_config_read - Retrieve and format PCI Configuration
76 * info.
77 * @devh: HAL device handle.
78 * @bufsize: Buffer size.
79 * @retbuf: Buffer pointer.
80 * @retsize: Size of the result. Cannot be greater than @bufsize.
81 *
82 * Retrieve about info (using vxge_hal_mgmt_pci_config()) and sprintf it
83 * into the provided @retbuf.
84 *
85 * Returns: VXGE_HAL_OK - success.
86 * VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
87 * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
88 *
89 * See also: vxge_hal_mgmt_pci_config(), vxge_hal_aux_device_dump().
90 */
91vxge_hal_status_e
92vxge_hal_aux_pci_config_read(vxge_hal_device_h devh,
93    int bufsize,
94    char *retbuf,
95    int *retsize);
96
97/*
98 * vxge_hal_aux_device_config_read - Read device configuration.
99 * @devh: HAL device handle.
100 * @bufsize: Buffer size.
101 * @retbuf: Buffer pointer.
102 * @retsize: Size of the result. Cannot be greater than @bufsize.
103 *
104 * Read device configuration,
105 *
106 * Returns: VXGE_HAL_OK - success.
107 * VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
108 * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
109 *
110 * See also: vxge_hal_aux_driver_config_read().
111 */
112vxge_hal_status_e
113vxge_hal_aux_device_config_read(vxge_hal_device_h devh,
114    int bufsize, char *retbuf, int *retsize);
115
116/*
117 * vxge_hal_aux_bar0_read - Read and format X3100 BAR0 register.
118 * @devh: HAL device handle.
119 * @offset: Register offset in the BAR0 space.
120 * @bufsize: Buffer size.
121 * @retbuf: Buffer pointer.
122 * @retsize: Size of the result. Cannot be greater than @bufsize.
123 *
124 * Read X3100 register from BAR0 space. The result is formatted as an
125 * ascii string.
126 *
127 * Returns: VXGE_HAL_OK - success.
128 * VXGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
129 * VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
130 * VXGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
131 * valid.
132 *
133 * See also: vxge_hal_mgmt_reg_read().
134 */
135vxge_hal_status_e
136vxge_hal_aux_bar0_read(vxge_hal_device_h devh,
137    unsigned int offset, int bufsize, char *retbuf,
138    int *retsize);
139
140/*
141 * vxge_hal_aux_bar1_read - Read and format X3100 BAR1 register.
142 * @devh: HAL device handle.
143 * @offset: Register offset in the BAR1 space.
144 * @bufsize: Buffer size.
145 * @retbuf: Buffer pointer.
146 * @retsize: Size of the result. Cannot be greater than @bufsize.
147 *
148 * Read X3100 register from BAR1 space. The result is formatted as ascii string
149 * Returns: VXGE_HAL_OK - success.
150 * VXGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
151 * VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
152 * VXGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
153 * valid.
154 *
155 */
156vxge_hal_status_e
157vxge_hal_aux_bar1_read(vxge_hal_device_h devh,
158    unsigned int offset, int bufsize, char *retbuf,
159    int *retsize);
160
161/*
162 * vxge_hal_aux_bar0_write - Write BAR0 register.
163 * @devh: HAL device handle.
164 * @offset: Register offset in the BAR0 space.
165 * @value: Regsister value (to write).
166 *
167 * Write BAR0 register.
168 *
169 * Returns: VXGE_HAL_OK - success.
170 * VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
171 * VXGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
172 * valid.
173 *
174 * See also: vxge_hal_mgmt_reg_write().
175 */
176vxge_hal_status_e
177vxge_hal_aux_bar0_write(vxge_hal_device_h devh,
178    unsigned int offset, u64 value);
179
180/*
181 * vxge_hal_aux_stats_vpath_hw_read - Read vpath hardware statistics.
182 * @vpath_handle: HAL Vpath handle.
183 * @bufsize: Buffer size.
184 * @retbuf: Buffer pointer.
185 * @retsize: Size of the result. Cannot be greater than @bufsize.
186 *
187 * Read vpath hardware statistics. This is a subset of stats counters
188 * from vxge_hal_vpath_stats_hw_info_t {}.
189 *
190 */
191vxge_hal_status_e
192vxge_hal_aux_stats_vpath_hw_read(
193    vxge_hal_vpath_h vpath_handle,
194    int bufsize,
195    char *retbuf,
196    int *retsize);
197
198/*
199 * vxge_hal_aux_stats_device_hw_read - Read device hardware statistics.
200 * @devh: HAL device handle.
201 * @bufsize: Buffer size.
202 * @retbuf: Buffer pointer.
203 * @retsize: Size of the result. Cannot be greater than @bufsize.
204 *
205 * Read device hardware statistics. This is a subset of stats counters
206 * from vxge_hal_device_stats_hw_info_t {}.
207 *
208 */
209vxge_hal_status_e
210vxge_hal_aux_stats_device_hw_read(vxge_hal_device_h devh,
211    int bufsize, char *retbuf, int *retsize);
212
213/*
214 * vxge_hal_aux_stats_vpath_sw_fifo_read - Read vpath fifo software statistics.
215 * @vpath_handle: HAL Vpath handle.
216 * @bufsize: Buffer size.
217 * @retbuf: Buffer pointer.
218 * @retsize: Size of the result. Cannot be greater than @bufsize.
219 *
220 * Read vpath fifo software statistics. This is a subset of stats counters
221 * from vxge_hal_vpath_stats_sw_fifo_info_t {}.
222 *
223 */
224vxge_hal_status_e
225vxge_hal_aux_stats_vpath_sw_fifo_read(
226    vxge_hal_vpath_h vpath_handle,
227    int bufsize,
228    char *retbuf,
229    int *retsize);
230
231/*
232 * vxge_hal_aux_stats_vpath_sw_ring_read - Read vpath ring software statistics.
233 * @vpath_handle: HAL Vpath handle.
234 * @bufsize: Buffer size.
235 * @retbuf: Buffer pointer.
236 * @retsize: Size of the result. Cannot be greater than @bufsize.
237 *
238 * Read vpath ring software statistics. This is a subset of stats counters
239 * from vxge_hal_vpath_stats_sw_ring_info_t {}.
240 *
241 */
242vxge_hal_status_e
243vxge_hal_aux_stats_vpath_sw_ring_read(
244    vxge_hal_vpath_h vpath_handle,
245    int bufsize,
246    char *retbuf,
247    int *retsize);
248
249
250/*
251 * vxge_hal_aux_stats_vpath_sw_err_read - Read vpath err software statistics.
252 * @vpath_handle: HAL Vpath handle.
253 * @bufsize: Buffer size.
254 * @retbuf: Buffer pointer.
255 * @retsize: Size of the result. Cannot be greater than @bufsize.
256 *
257 * Read vpath err software statistics. This is a subset of stats counters
258 * from vxge_hal_vpath_stats_sw_err_info_t {}.
259 *
260 */
261vxge_hal_status_e
262vxge_hal_aux_stats_vpath_sw_err_read(
263    vxge_hal_vpath_h vpath_handle,
264    int bufsize,
265    char *retbuf,
266    int *retsize);
267
268/*
269 * vxge_hal_aux_stats_vpath_sw_read - Read vpath soft statistics.
270 * @vpath_handle: HAL Vpath handle.
271 * @bufsize: Buffer size.
272 * @retbuf: Buffer pointer.
273 * @retsize: Size of the result. Cannot be greater than @bufsize.
274 *
275 * Read device hardware statistics. This is a subset of stats counters
276 * from vxge_hal_vpath_stats_sw_info_t {}.
277 *
278 */
279vxge_hal_status_e
280vxge_hal_aux_stats_vpath_sw_read(
281    vxge_hal_vpath_h vpath_handle,
282    int bufsize,
283    char *retbuf,
284    int *retsize);
285
286/*
287 * vxge_hal_aux_stats_device_sw_read - Read device software statistics.
288 * @devh: HAL device handle.
289 * @bufsize: Buffer size.
290 * @retbuf: Buffer pointer.
291 * @retsize: Size of the result. Cannot be greater than @bufsize.
292 *
293 * Read device software statistics. This is a subset of stats counters
294 * from vxge_hal_device_stats_sw_info_t {}.
295 *
296 */
297vxge_hal_status_e
298vxge_hal_aux_stats_device_sw_read(vxge_hal_device_h devh,
299    int bufsize, char *retbuf, int *retsize);
300
301/*
302 * vxge_hal_aux_stats_device_sw_err_read - Read device software error statistics
303 * @devh: HAL device handle.
304 * @bufsize: Buffer size.
305 * @retbuf: Buffer pointer.
306 * @retsize: Size of the result. Cannot be greater than @bufsize.
307 *
308 * Read device software error statistics. This is a subset of stats counters
309 * from vxge_hal_device_stats_sw_info_t {}.
310 *
311 */
312vxge_hal_status_e
313vxge_hal_aux_stats_device_sw_err_read(vxge_hal_device_h devh,
314    int bufsize, char *retbuf, int *retsize);
315
316/*
317 * vxge_hal_aux_stats_device_read - Read device statistics.
318 * @devh: HAL device handle.
319 * @bufsize: Buffer size.
320 * @retbuf: Buffer pointer.
321 * @retsize: Size of the result. Cannot be greater than @bufsize.
322 *
323 * Read device statistics. This is a subset of stats counters
324 * from vxge_hal_device_stats_t {}.
325 *
326 */
327vxge_hal_status_e
328vxge_hal_aux_stats_device_read(vxge_hal_device_h devh,
329    int bufsize, char *retbuf, int *retsize);
330
331/*
332 * vxge_hal_aux_stats_xpak_read - Read device xpak statistics.
333 * @devh: HAL device handle.
334 * @bufsize: Buffer size.
335 * @retbuf: Buffer pointer.
336 * @retsize: Size of the result. Cannot be greater than @bufsize.
337 *
338 * Read device xpak statistics. This is valid for function 0 device only
339 *
340 */
341vxge_hal_status_e
342vxge_hal_aux_stats_xpak_read(vxge_hal_device_h devh,
343    int bufsize, char *retbuf, int *retsize);
344
345/*
346 * vxge_hal_aux_stats_mrpcim_read - Read device mrpcim statistics.
347 * @devh: HAL device handle.
348 * @bufsize: Buffer size.
349 * @retbuf: Buffer pointer.
350 * @retsize: Size of the result. Cannot be greater than @bufsize.
351 *
352 * Read mrpcim statistics. This is valid for function 0 device only
353 *
354 */
355vxge_hal_status_e
356vxge_hal_aux_stats_mrpcim_read(vxge_hal_device_h devh,
357    int bufsize, char *retbuf, int *retsize);
358
359/*
360 * vxge_hal_aux_vpath_ring_dump - Dump vpath ring.
361 * @vpath_handle: Vpath handle.
362 *
363 * Dump vpath ring.
364 */
365vxge_hal_status_e
366vxge_hal_aux_vpath_ring_dump(vxge_hal_vpath_h vpath_handle);
367
368/*
369 * vxge_hal_aux_vpath_fifo_dump - Dump vpath fifo.
370 * @vpath_handle: Vpath handle.
371 *
372 * Dump vpath fifo.
373 */
374vxge_hal_status_e
375vxge_hal_aux_vpath_fifo_dump(vxge_hal_vpath_h vpath_handle);
376
377/*
378 * vxge_hal_aux_device_dump - Dump driver "about" info and device state.
379 * @devh: HAL device handle.
380 *
381 * Dump driver & device "about" info and device state,
382 * including all BAR0 registers, hardware and software statistics, PCI
383 * configuration space.
384 */
385vxge_hal_status_e vxge_hal_aux_device_dump(vxge_hal_device_h devh);
386
387__EXTERN_END_DECLS
388
389#endif	/* VXGE_HAL_MGMTAUX_H */
390