xref: /illumos-gate/usr/src/uts/common/io/xge/hal/xgehal/xgehal-mgmtaux.c (revision a07094369b21309434206d9b3601d162693466fc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  *  Copyright (c) 2002-2005 Neterion, Inc.
24  *  All right Reserved.
25  *
26  *  FileName :    xgehal-mgmtaux.c
27  *
28  *  Description:  Xframe-family management auxiliary API implementation
29  *
30  *  Created:      1 September 2004
31  */
32 
33 #include "xgehal-mgmt.h"
34 #include "xgehal-driver.h"
35 #include "xgehal-device.h"
36 
37 #ifdef XGE_OS_HAS_SNPRINTF
38 #define __hal_aux_snprintf(retbuf, bufsize, fmt, key, value, retsize) \
39     if (bufsize <= 0) return XGE_HAL_ERR_OUT_OF_SPACE; \
40     retsize = xge_os_snprintf(retbuf, bufsize, fmt, key, \
41 			XGE_HAL_AUX_SEPA, value); \
42     if (retsize < 0 || retsize >= bufsize) return XGE_HAL_ERR_OUT_OF_SPACE;
43 #else
44 #define __hal_aux_snprintf(retbuf, bufsize, fmt, key, value, retsize) \
45 	if (bufsize <= 0) return XGE_HAL_ERR_OUT_OF_SPACE; \
46         retsize = xge_os_sprintf(retbuf, fmt, key, XGE_HAL_AUX_SEPA, value); \
47 	xge_assert(retsize < bufsize); \
48 	if (retsize < 0 || retsize >= bufsize) \
49 		return XGE_HAL_ERR_OUT_OF_SPACE;
50 #endif
51 
52 #define __HAL_AUX_ENTRY_DECLARE(size, buf) \
53 	int entrysize = 0, leftsize = size; \
54 	char *ptr = buf;
55 
56 #define __HAL_AUX_ENTRY(key, value, fmt) \
57 	ptr += entrysize; leftsize -= entrysize; \
58 	__hal_aux_snprintf(ptr, leftsize, "%s%c"fmt"\n", key, value, entrysize)
59 
60 #define __HAL_AUX_ENTRY_END(bufsize, retsize) \
61 	leftsize -= entrysize; \
62 	*retsize = bufsize - leftsize;
63 
64 /**
65  * xge_hal_aux_bar0_read - Read and format Xframe BAR0 register.
66  * @devh: HAL device handle.
67  * @offset: Register offset in the BAR0 space.
68  * @bufsize: Buffer size.
69  * @retbuf: Buffer pointer.
70  * @retsize: Size of the result. Cannot be greater than @bufsize.
71  *
72  * Read Xframe register from BAR0 space. The result is formatted as an ascii string.
73  *
74  * Returns: XGE_HAL_OK - success.
75  * XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
76  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
77  * XGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
78  * valid.
79  * XGE_HAL_ERR_INVALID_BAR_ID - BAR id is not valid.
80  *
81  * See also: xge_hal_mgmt_reg_read().
82  */
83 xge_hal_status_e xge_hal_aux_bar0_read(xge_hal_device_h devh,
84 			unsigned int offset, int bufsize, char *retbuf,
85 			int *retsize)
86 {
87 	xge_hal_status_e status;
88 	u64 retval;
89 
90 	status = xge_hal_mgmt_reg_read(devh, 0, offset, &retval);
91 	if (status != XGE_HAL_OK) {
92 		return status;
93 	}
94 
95 	if (bufsize < XGE_OS_SPRINTF_STRLEN) {
96 		return XGE_HAL_ERR_OUT_OF_SPACE;
97 	}
98 
99 	*retsize = xge_os_sprintf(retbuf, "0x%04X%c0x%08X%08X\n", offset,
100 				XGE_HAL_AUX_SEPA, (u32)(retval>>32), (u32)retval);
101 
102 	return XGE_HAL_OK;
103 }
104 
105 /**
106  * xge_hal_aux_bar1_read - Read and format Xframe BAR1 register.
107  * @devh: HAL device handle.
108  * @offset: Register offset in the BAR1 space.
109  * @bufsize: Buffer size.
110  * @retbuf: Buffer pointer.
111  * @retsize: Size of the result. Cannot be greater than @bufsize.
112  *
113  * Read Xframe register from BAR1 space. The result is formatted as ascii string.
114  * Returns: XGE_HAL_OK - success.
115  * XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
116  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
117  * XGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
118  * valid.
119  * XGE_HAL_ERR_INVALID_BAR_ID - BAR id is not valid.
120  *
121  * See also: xge_hal_mgmt_reg_read().
122  */
123 xge_hal_status_e xge_hal_aux_bar1_read(xge_hal_device_h devh,
124 			unsigned int offset, int bufsize, char *retbuf,
125 			int *retsize)
126 {
127 	xge_hal_status_e status;
128 	u64 retval;
129 
130 	status = xge_hal_mgmt_reg_read(devh, 1, offset, &retval);
131 	if (status != XGE_HAL_OK) {
132 		return status;
133 	}
134 
135 	if (bufsize < XGE_OS_SPRINTF_STRLEN) {
136 		return XGE_HAL_ERR_OUT_OF_SPACE;
137 	}
138 
139         *retsize = xge_os_sprintf(retbuf, "0x%04X%c0x%08X%08X\n",
140         offset,
141 				XGE_HAL_AUX_SEPA, (u32)(retval>>32), (u32)retval);
142 
143 	return XGE_HAL_OK;
144 }
145 
146 /**
147  * xge_hal_aux_bar0_write - Write BAR0 register.
148  * @devh: HAL device handle.
149  * @offset: Register offset in the BAR0 space.
150  * @value: Regsister value (to write).
151  *
152  * Write BAR0 register.
153  *
154  * Returns: XGE_HAL_OK - success.
155  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
156  * XGE_HAL_ERR_INVALID_OFFSET - Register offset in the BAR space is not
157  * valid.
158  * XGE_HAL_ERR_INVALID_BAR_ID - BAR id is not valid.
159  *
160  * See also: xge_hal_mgmt_reg_write().
161  */
162 xge_hal_status_e xge_hal_aux_bar0_write(xge_hal_device_h devh,
163 			unsigned int offset, u64 value)
164 {
165 	xge_hal_status_e status;
166 
167 	status = xge_hal_mgmt_reg_write(devh, 0, offset, value);
168 	if (status != XGE_HAL_OK) {
169 		return status;
170 	}
171 
172 	return XGE_HAL_OK;
173 }
174 
175 /**
176  * xge_hal_aux_about_read - Retrieve and format about info.
177  * @devh: HAL device handle.
178  * @bufsize: Buffer size.
179  * @retbuf: Buffer pointer.
180  * @retsize: Size of the result. Cannot be greater than @bufsize.
181  *
182  * Retrieve about info (using xge_hal_mgmt_about()) and sprintf it
183  * into the provided @retbuf.
184  *
185  * Returns: XGE_HAL_OK - success.
186  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
187  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
188  * XGE_HAL_FAIL - Failed to retrieve the information.
189  *
190  * See also: xge_hal_mgmt_about(), xge_hal_aux_device_dump().
191  */
192 xge_hal_status_e xge_hal_aux_about_read(xge_hal_device_h devh, int bufsize,
193 			char *retbuf, int *retsize)
194 {
195 	xge_hal_status_e status;
196 	xge_hal_mgmt_about_info_t about_info;
197 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
198 
199 	status = xge_hal_mgmt_about(devh, &about_info,
200 				  sizeof(xge_hal_mgmt_about_info_t));
201 	if (status != XGE_HAL_OK) {
202 		return status;
203 	}
204 
205 	__HAL_AUX_ENTRY("vendor", about_info.vendor, "0x%x");
206 	__HAL_AUX_ENTRY("device", about_info.device, "0x%x");
207 	__HAL_AUX_ENTRY("subsys_vendor", about_info.subsys_vendor, "0x%x");
208 	__HAL_AUX_ENTRY("subsys_device", about_info.subsys_device, "0x%x");
209 	__HAL_AUX_ENTRY("board_rev", about_info.board_rev, "0x%x");
210 	__HAL_AUX_ENTRY("vendor_name", about_info.vendor_name, "%s");
211 	__HAL_AUX_ENTRY("chip_name", about_info.chip_name, "%s");
212 	__HAL_AUX_ENTRY("media", about_info.media, "%s");
213 	__HAL_AUX_ENTRY("hal_major", about_info.hal_major, "%s");
214 	__HAL_AUX_ENTRY("hal_minor", about_info.hal_minor, "%s");
215 	__HAL_AUX_ENTRY("hal_fix", about_info.hal_fix, "%s");
216 	__HAL_AUX_ENTRY("hal_build", about_info.hal_build, "%s");
217 	__HAL_AUX_ENTRY("ll_major", about_info.ll_major, "%s");
218 	__HAL_AUX_ENTRY("ll_minor", about_info.ll_minor, "%s");
219 	__HAL_AUX_ENTRY("ll_fix", about_info.ll_fix, "%s");
220 	__HAL_AUX_ENTRY("ll_build", about_info.ll_build, "%s");
221 
222 	__HAL_AUX_ENTRY_END(bufsize, retsize);
223 
224 	return XGE_HAL_OK;
225 }
226 
227 /**
228  * xge_hal_aux_stats_tmac_read - Read TMAC hardware statistics.
229  * @devh: HAL device handle.
230  * @bufsize: Buffer size.
231  * @retbuf: Buffer pointer.
232  * @retsize: Size of the result. Cannot be greater than @bufsize.
233  *
234  * Read TMAC hardware statistics. This is a subset of stats counters
235  * from xge_hal_stats_hw_info_t{}.
236  *
237  * Returns: XGE_HAL_OK - success.
238  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
239  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
240  *
241  * See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
242  * xge_hal_aux_stats_pci_read(),
243  * xge_hal_aux_device_dump().
244  */
245 xge_hal_status_e xge_hal_aux_stats_tmac_read(xge_hal_device_h devh, int	bufsize,
246 				char *retbuf, int *retsize)
247 {
248 	xge_hal_status_e status;
249 	xge_hal_mgmt_hw_stats_t hw;
250 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
251 
252 	status = xge_hal_mgmt_hw_stats(devh, &hw,
253 				     sizeof(xge_hal_mgmt_hw_stats_t));
254 	if (status != XGE_HAL_OK) {
255 		return status;
256 	}
257 
258 	__HAL_AUX_ENTRY("tmac_data_octets", hw.tmac_data_octets, "%u");
259 	__HAL_AUX_ENTRY("tmac_frms", hw.tmac_frms, "%u");
260 	__HAL_AUX_ENTRY("tmac_drop_frms", (unsigned long long)
261 			hw.tmac_drop_frms, "%llu");
262 	__HAL_AUX_ENTRY("tmac_bcst_frms", hw.tmac_bcst_frms, "%u");
263 	__HAL_AUX_ENTRY("tmac_mcst_frms", hw.tmac_mcst_frms, "%u");
264 	__HAL_AUX_ENTRY("tmac_pause_ctrl_frms", (unsigned long long)
265 			hw.tmac_pause_ctrl_frms, "%llu");
266 	__HAL_AUX_ENTRY("tmac_ucst_frms", hw.tmac_ucst_frms, "%u");
267 	__HAL_AUX_ENTRY("tmac_ttl_octets", hw.tmac_ttl_octets, "%u");
268 	__HAL_AUX_ENTRY("tmac_any_err_frms", hw.tmac_any_err_frms, "%u");
269 	__HAL_AUX_ENTRY("tmac_nucst_frms", hw.tmac_nucst_frms, "%u");
270 	__HAL_AUX_ENTRY("tmac_ttl_less_fb_octets", (unsigned long long)
271 			hw.tmac_ttl_less_fb_octets, "%llu");
272 	__HAL_AUX_ENTRY("tmac_vld_ip_octets", (unsigned long long)
273 			hw.tmac_vld_ip_octets, "%llu");
274 	__HAL_AUX_ENTRY("tmac_drop_ip", hw.tmac_drop_ip, "%u");
275 	__HAL_AUX_ENTRY("tmac_vld_ip", hw.tmac_vld_ip, "%u");
276 	__HAL_AUX_ENTRY("tmac_rst_tcp", hw.tmac_rst_tcp, "%u");
277 	__HAL_AUX_ENTRY("tmac_icmp", hw.tmac_icmp, "%u");
278 	__HAL_AUX_ENTRY("tmac_tcp", (unsigned long long)
279 			hw.tmac_tcp, "%llu");
280 	__HAL_AUX_ENTRY("reserved_0", hw.reserved_0, "%u");
281 	__HAL_AUX_ENTRY("tmac_udp", hw.tmac_udp, "%u");
282 
283 	__HAL_AUX_ENTRY_END(bufsize, retsize);
284 
285 	return XGE_HAL_OK;
286 }
287 
288 /**
289  * xge_hal_aux_stats_rmac_read - Read RMAC hardware statistics.
290  * @devh: HAL device handle.
291  * @bufsize: Buffer size.
292  * @retbuf: Buffer pointer.
293  * @retsize: Size of the result. Cannot be greater than @bufsize.
294  *
295  * Read RMAC hardware statistics. This is a subset of stats counters
296  * from xge_hal_stats_hw_info_t{}.
297  *
298  * Returns: XGE_HAL_OK - success.
299  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
300  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
301  *
302  * See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
303  * xge_hal_aux_stats_pci_read(), xge_hal_aux_stats_tmac_read(),
304  * xge_hal_aux_device_dump().
305  */
306 xge_hal_status_e xge_hal_aux_stats_rmac_read(xge_hal_device_h devh, int	bufsize,
307 				char *retbuf, int *retsize)
308 {
309 	xge_hal_status_e status;
310 	xge_hal_mgmt_hw_stats_t hw;
311 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
312 
313 	status = xge_hal_mgmt_hw_stats(devh, &hw,
314 				     sizeof(xge_hal_mgmt_hw_stats_t));
315 	if (status != XGE_HAL_OK) {
316 		return status;
317 	}
318 
319 	__HAL_AUX_ENTRY("rmac_data_octets", hw.rmac_data_octets, "%u");
320 	__HAL_AUX_ENTRY("rmac_vld_frms", hw.rmac_vld_frms, "%u");
321 	__HAL_AUX_ENTRY("rmac_fcs_err_frms", (unsigned long long)
322 			hw.rmac_fcs_err_frms, "%llu");
323 	__HAL_AUX_ENTRY("mac_drop_frms", (unsigned long long)
324 			hw.rmac_drop_frms, "%llu");
325 	__HAL_AUX_ENTRY("rmac_vld_bcst_frms", hw.rmac_vld_bcst_frms, "%u");
326 	__HAL_AUX_ENTRY("rmac_vld_mcst_frms", hw.rmac_vld_mcst_frms, "%u");
327 	__HAL_AUX_ENTRY("rmac_out_rng_len_err_frms",
328 			hw.rmac_out_rng_len_err_frms, "%u");
329 	__HAL_AUX_ENTRY("rmac_in_rng_len_err_frms",
330 			hw.rmac_in_rng_len_err_frms, "%u");
331 	__HAL_AUX_ENTRY("rmac_long_frms", (unsigned long long)
332 			hw.rmac_long_frms, "%llu");
333 	__HAL_AUX_ENTRY("rmac_pause_ctrl_frms", (unsigned long long)
334 			hw.rmac_pause_ctrl_frms, "%llu");
335 	__HAL_AUX_ENTRY("rmac_unsup_ctrl_frms", (unsigned long long)
336 			hw.rmac_unsup_ctrl_frms, "%llu");
337 	__HAL_AUX_ENTRY("rmac_accepted_ucst_frms",
338 			hw.rmac_accepted_ucst_frms, "%u");
339 	__HAL_AUX_ENTRY("rmac_ttl_octets", hw.rmac_ttl_octets, "%u");
340 	__HAL_AUX_ENTRY("rmac_discarded_frms", hw.rmac_discarded_frms, "%u");
341 	__HAL_AUX_ENTRY("rmac_accepted_nucst_frms",
342 			hw.rmac_accepted_nucst_frms, "%u");
343 	__HAL_AUX_ENTRY("reserved_1", hw.reserved_1, "%u");
344 	__HAL_AUX_ENTRY("rmac_drop_events", hw.rmac_drop_events, "%u");
345 	__HAL_AUX_ENTRY("rmac_ttl_less_fb_octets", (unsigned long long)
346 			hw.rmac_ttl_less_fb_octets, "%llu");
347 	__HAL_AUX_ENTRY("rmac_ttl_frms", (unsigned long long)
348 			hw.rmac_ttl_frms, "%llu");
349 	__HAL_AUX_ENTRY("reserved_2", (unsigned long long)
350 			hw.reserved_2, "%llu");
351 	__HAL_AUX_ENTRY("rmac_usized_frms", hw.rmac_usized_frms, "%u");
352 	__HAL_AUX_ENTRY("reserved_3", hw.reserved_3, "%u");
353 	__HAL_AUX_ENTRY("rmac_frag_frms", hw.rmac_frag_frms, "%u");
354 	__HAL_AUX_ENTRY("rmac_osized_frms", hw.rmac_osized_frms, "%u");
355 	__HAL_AUX_ENTRY("reserved_4", hw.reserved_4, "%u");
356 	__HAL_AUX_ENTRY("rmac_jabber_frms", hw.rmac_jabber_frms, "%u");
357 	__HAL_AUX_ENTRY("rmac_ttl_64_frms", (unsigned long long)
358 			hw.rmac_ttl_64_frms, "%llu");
359 	__HAL_AUX_ENTRY("rmac_ttl_65_127_frms", (unsigned long long)
360 			hw.rmac_ttl_65_127_frms, "%llu");
361 	__HAL_AUX_ENTRY("reserved_5", (unsigned long long)
362 			hw.reserved_5, "%llu");
363 	__HAL_AUX_ENTRY("rmac_ttl_128_255_frms", (unsigned long long)
364 			hw.rmac_ttl_128_255_frms, "%llu");
365 	__HAL_AUX_ENTRY("rmac_ttl_256_511_frms", (unsigned long long)
366 			hw.rmac_ttl_256_511_frms, "%llu");
367 	__HAL_AUX_ENTRY("reserved_6", (unsigned long long)
368 			hw.reserved_6, "%llu");
369 	__HAL_AUX_ENTRY("rmac_ttl_512_1023_frms", (unsigned long long)
370 			hw.rmac_ttl_512_1023_frms, "%llu");
371 	__HAL_AUX_ENTRY("rmac_ttl_1024_1518_frms", (unsigned long long)
372 			hw.rmac_ttl_1024_1518_frms, "%llu");
373 	__HAL_AUX_ENTRY("rmac_ip", hw.rmac_ip, "%u");
374 	__HAL_AUX_ENTRY("reserved_7", hw.reserved_7, "%u");
375 	__HAL_AUX_ENTRY("rmac_ip_octets", (unsigned long long)
376 			hw.rmac_ip_octets, "%llu");
377 	__HAL_AUX_ENTRY("rmac_drop_ip", hw.rmac_drop_ip, "%u");
378 	__HAL_AUX_ENTRY("rmac_hdr_err_ip", hw.rmac_hdr_err_ip, "%u");
379 	__HAL_AUX_ENTRY("reserved_8", hw.reserved_8, "%u");
380 	__HAL_AUX_ENTRY("rmac_icmp", hw.rmac_icmp, "%u");
381 	__HAL_AUX_ENTRY("rmac_tcp", (unsigned long long)
382 			hw.rmac_tcp, "%llu");
383 	__HAL_AUX_ENTRY("rmac_err_drp_udp", hw.rmac_err_drp_udp, "%u");
384 	__HAL_AUX_ENTRY("rmac_udp", hw.rmac_udp, "%u");
385 	__HAL_AUX_ENTRY("rmac_xgmii_err_sym", (unsigned long long)
386 			hw.rmac_xgmii_err_sym, "%llu");
387 	__HAL_AUX_ENTRY("rmac_frms_q0", (unsigned long long)
388 			hw.rmac_frms_q0, "%llu");
389 	__HAL_AUX_ENTRY("rmac_frms_q1", (unsigned long long)
390 			hw.rmac_frms_q1, "%llu");
391 	__HAL_AUX_ENTRY("rmac_frms_q2", (unsigned long long)
392 			hw.rmac_frms_q2, "%llu");
393 	__HAL_AUX_ENTRY("rmac_frms_q3", (unsigned long long)
394 			hw.rmac_frms_q3, "%llu");
395 	__HAL_AUX_ENTRY("rmac_frms_q4", (unsigned long long)
396 			hw.rmac_frms_q4, "%llu");
397 	__HAL_AUX_ENTRY("rmac_frms_q5", (unsigned long long)
398 			hw.rmac_frms_q5, "%llu");
399 	__HAL_AUX_ENTRY("rmac_frms_q6", (unsigned long long)
400 			hw.rmac_frms_q6, "%llu");
401 	__HAL_AUX_ENTRY("rmac_frms_q7", (unsigned long long)
402 			hw.rmac_frms_q7, "%llu");
403 	__HAL_AUX_ENTRY("rmac_full_q3", hw.rmac_full_q3, "%d");
404 	__HAL_AUX_ENTRY("rmac_full_q2", hw.rmac_full_q2, "%d");
405 	__HAL_AUX_ENTRY("rmac_full_q1", hw.rmac_full_q1, "%d");
406 	__HAL_AUX_ENTRY("rmac_full_q0", hw.rmac_full_q0, "%d");
407 	__HAL_AUX_ENTRY("rmac_full_q7", hw.rmac_full_q7, "%d");
408 	__HAL_AUX_ENTRY("rmac_full_q6", hw.rmac_full_q6, "%d");
409 	__HAL_AUX_ENTRY("rmac_full_q5", hw.rmac_full_q5, "%d");
410 	__HAL_AUX_ENTRY("rmac_full_q4", hw.rmac_full_q4, "%d");
411 	__HAL_AUX_ENTRY("reserved_9", hw.reserved_9, "%u");
412 	__HAL_AUX_ENTRY("rmac_pause_cnt", hw.rmac_pause_cnt, "%u");
413 	__HAL_AUX_ENTRY("rmac_xgmii_data_err_cnt", (unsigned long long)
414 			hw.rmac_xgmii_data_err_cnt, "%llu");
415 	__HAL_AUX_ENTRY("rmac_xgmii_ctrl_err_cnt", (unsigned long long)
416 			hw.rmac_xgmii_ctrl_err_cnt, "%llu");
417 	__HAL_AUX_ENTRY("rmac_err_tcp", hw.rmac_err_tcp, "%u");
418 	__HAL_AUX_ENTRY("rmac_accepted_ip", hw.rmac_accepted_ip, "%u");
419 
420 	__HAL_AUX_ENTRY_END(bufsize, retsize);
421 
422 	return XGE_HAL_OK;
423 }
424 
425 /**
426  * xge_hal_aux_stats_herc_enchanced - Get Hercules hardware statistics.
427  * @devh: HAL device handle.
428  * @bufsize: Buffer size.
429  * @retbuf: Buffer pointer.
430  * @retsize: Size of the result. Cannot be greater than @bufsize.
431  *
432  * Read Hercules device hardware statistics.
433  *
434  * Returns: XGE_HAL_OK - success.
435  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
436  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
437  *
438  * See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
439  * xge_hal_aux_stats_tmac_read(), xge_hal_aux_stats_rmac_read(),
440  * xge_hal_aux_device_dump().
441 */
442 xge_hal_status_e xge_hal_aux_stats_herc_enchanced(xge_hal_device_h devh,
443 				  int bufsize, char *retbuf, int *retsize)
444 {
445 	xge_hal_status_e status;
446 	xge_hal_mgmt_hw_stats_t hw;
447 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
448 
449 	status = xge_hal_mgmt_hw_stats(devh, &hw,
450 				     sizeof(xge_hal_mgmt_hw_stats_t));
451 	if (status != XGE_HAL_OK) {
452 		return status;
453 	}
454 	__HAL_AUX_ENTRY("tmac_frms_oflow", hw.tmac_frms_oflow, "%u");
455 	__HAL_AUX_ENTRY("tmac_data_octets_oflow", hw.tmac_data_octets_oflow,
456 			"%u");
457 	__HAL_AUX_ENTRY("tmac_mcst_frms_oflow", hw.tmac_mcst_frms_oflow, "%u");
458 	__HAL_AUX_ENTRY("tmac_bcst_frms_oflow", hw.tmac_bcst_frms_oflow, "%u");
459 	__HAL_AUX_ENTRY("tmac_ttl_octets_oflow", hw.tmac_ttl_octets_oflow,
460 			"%u");
461 	__HAL_AUX_ENTRY("tmac_ucst_frms_oflow", hw.tmac_ucst_frms_oflow, "%u");
462 	__HAL_AUX_ENTRY("tmac_nucst_frms_oflow", hw.tmac_nucst_frms_oflow,
463 			"%u");
464 	__HAL_AUX_ENTRY("tmac_any_err_frms_oflow", hw.tmac_any_err_frms_oflow,
465 			"%u");
466 	__HAL_AUX_ENTRY("tmac_vlan_frms", (unsigned long long)hw.tmac_vlan_frms,
467 			"%llu");
468 	__HAL_AUX_ENTRY("tmac_vld_ip_oflow", hw.tmac_vld_ip_oflow, "%u");
469 	__HAL_AUX_ENTRY("tmac_drop_ip_oflow", hw.tmac_drop_ip_oflow, "%u");
470 	__HAL_AUX_ENTRY("tmac_icmp_oflow", hw.tmac_icmp_oflow, "%u");
471 	__HAL_AUX_ENTRY("tmac_rst_tcp_oflow", hw.tmac_rst_tcp_oflow, "%u");
472 	__HAL_AUX_ENTRY("tmac_udp_oflow", hw.tmac_udp_oflow, "%u");
473 	__HAL_AUX_ENTRY("tpa_unknown_protocol", hw.tpa_unknown_protocol, "%u");
474 	__HAL_AUX_ENTRY("tpa_parse_failure", hw.tpa_parse_failure, "%u");
475 	__HAL_AUX_ENTRY("rmac_vld_frms_oflow", hw.rmac_vld_frms_oflow, "%u");
476 	__HAL_AUX_ENTRY("rmac_data_octets_oflow", hw.rmac_data_octets_oflow,
477 			"%u");
478 	__HAL_AUX_ENTRY("rmac_vld_mcst_frms_oflow", hw.rmac_vld_mcst_frms_oflow,
479 			"%u");
480 	__HAL_AUX_ENTRY("rmac_vld_bcst_frms_oflow", hw.rmac_vld_bcst_frms_oflow,
481 			"%u");
482 	__HAL_AUX_ENTRY("rmac_ttl_octets_oflow", hw.rmac_ttl_octets_oflow,
483 			"%u");
484 	__HAL_AUX_ENTRY("rmac_accepted_ucst_frms_oflow",
485 			hw.rmac_accepted_ucst_frms_oflow, "%u");
486 	__HAL_AUX_ENTRY("rmac_accepted_nucst_frms_oflow",
487 			hw.rmac_accepted_nucst_frms_oflow, "%u");
488 	__HAL_AUX_ENTRY("rmac_discarded_frms_oflow",
489 			hw.rmac_discarded_frms_oflow, "%u");
490 	__HAL_AUX_ENTRY("rmac_drop_events_oflow", hw.rmac_drop_events_oflow,
491 			"%u");
492 	__HAL_AUX_ENTRY("rmac_usized_frms_oflow", hw.rmac_usized_frms_oflow,
493 			"%u");
494 	__HAL_AUX_ENTRY("rmac_osized_frms_oflow", hw.rmac_osized_frms_oflow,
495 			"%u");
496 	__HAL_AUX_ENTRY("rmac_frag_frms_oflow", hw.rmac_frag_frms_oflow, "%u");
497 	__HAL_AUX_ENTRY("rmac_jabber_frms_oflow", hw.rmac_jabber_frms_oflow,
498 			"%u");
499 	__HAL_AUX_ENTRY("rmac_ip_oflow", hw.rmac_ip_oflow, "%u");
500 	__HAL_AUX_ENTRY("rmac_drop_ip_oflow", hw.rmac_drop_ip_oflow, "%u");
501 	__HAL_AUX_ENTRY("rmac_icmp_oflow", hw.rmac_icmp_oflow, "%u");
502 	__HAL_AUX_ENTRY("rmac_udp_oflow", hw.rmac_udp_oflow, "%u");
503 	__HAL_AUX_ENTRY("rmac_err_drp_udp_oflow", hw.rmac_err_drp_udp_oflow,
504 			"%u");
505 	__HAL_AUX_ENTRY("rmac_pause_cnt_oflow", hw.rmac_pause_cnt_oflow, "%u");
506 	__HAL_AUX_ENTRY("rmac_ttl_1519_4095_frms",
507 			(unsigned long long)hw.rmac_ttl_1519_4095_frms, "%llu");
508 	__HAL_AUX_ENTRY("rmac_ttl_4096_8191_frms",
509 			(unsigned long long)hw.rmac_ttl_4096_8191_frms, "%llu");
510 	__HAL_AUX_ENTRY("rmac_ttl_8192_max_frms",
511 			(unsigned long long)hw.rmac_ttl_8192_max_frms, "%llu");
512 	__HAL_AUX_ENTRY("rmac_ttl_gt_max_frms",
513 			(unsigned long long)hw.rmac_ttl_gt_max_frms, "%llu");
514 	__HAL_AUX_ENTRY("rmac_osized_alt_frms",
515 			(unsigned long long)hw.rmac_osized_alt_frms, "%llu");
516 	__HAL_AUX_ENTRY("rmac_jabber_alt_frms",
517 			(unsigned long long)hw.rmac_jabber_alt_frms, "%llu");
518 	__HAL_AUX_ENTRY("rmac_gt_max_alt_frms",
519 			(unsigned long long)hw.rmac_gt_max_alt_frms, "%llu");
520 	__HAL_AUX_ENTRY("rmac_vlan_frms",
521 			(unsigned long long)hw.rmac_vlan_frms, "%llu");
522 	__HAL_AUX_ENTRY("rmac_fcs_discard", hw.rmac_fcs_discard, "%u");
523 	__HAL_AUX_ENTRY("rmac_len_discard", hw.rmac_len_discard, "%u");
524 	__HAL_AUX_ENTRY("rmac_da_discard", hw.rmac_da_discard, "%u");
525 	__HAL_AUX_ENTRY("rmac_pf_discard", hw.rmac_pf_discard, "%u");
526 	__HAL_AUX_ENTRY("rmac_rts_discard", hw.rmac_rts_discard, "%u");
527 	__HAL_AUX_ENTRY("rmac_red_discard", hw.rmac_red_discard, "%u");
528 	__HAL_AUX_ENTRY("rmac_ingm_full_discard", hw.rmac_ingm_full_discard,
529 			"%u");
530 	__HAL_AUX_ENTRY("rmac_accepted_ip_oflow", hw.rmac_accepted_ip_oflow,
531 			"%u");
532 	__HAL_AUX_ENTRY("link_fault_cnt", hw.link_fault_cnt, "%u");
533 
534 	__HAL_AUX_ENTRY_END(bufsize, retsize);
535 
536 	return XGE_HAL_OK;
537 }
538 
539 /**
540  * xge_hal_aux_stats_rmac_read - Read PCI hardware statistics.
541  * @devh: HAL device handle.
542  * @bufsize: Buffer size.
543  * @retbuf: Buffer pointer.
544  * @retsize: Size of the result. Cannot be greater than @bufsize.
545  *
546  * Read PCI statistics counters, including number of PCI read and
547  * write transactions, PCI retries, discards, etc.
548  * This is a subset of stats counters from xge_hal_stats_hw_info_t{}.
549  *
550  * Returns: XGE_HAL_OK - success.
551  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
552  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
553  *
554  * See also: xge_hal_mgmt_hw_stats{}, xge_hal_stats_hw_info_t{},
555  * xge_hal_aux_stats_tmac_read(), xge_hal_aux_stats_rmac_read(),
556  * xge_hal_aux_device_dump().
557  */
558 xge_hal_status_e xge_hal_aux_stats_pci_read(xge_hal_device_h devh, int bufsize,
559 				char *retbuf, int *retsize)
560 {
561 	xge_hal_status_e status;
562 	xge_hal_mgmt_hw_stats_t hw;
563 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
564 
565 	status = xge_hal_mgmt_hw_stats(devh, &hw,
566 				     sizeof(xge_hal_mgmt_hw_stats_t));
567 	if (status != XGE_HAL_OK) {
568 		return status;
569 	}
570 
571 	__HAL_AUX_ENTRY("new_rd_req_cnt", hw.new_rd_req_cnt, "%u");
572 	__HAL_AUX_ENTRY("rd_req_cnt", hw.rd_req_cnt, "%u");
573 	__HAL_AUX_ENTRY("rd_rtry_cnt", hw.rd_rtry_cnt, "%u");
574 	__HAL_AUX_ENTRY("new_rd_req_rtry_cnt", hw.new_rd_req_rtry_cnt, "%u");
575 	__HAL_AUX_ENTRY("wr_req_cnt", hw.wr_req_cnt, "%u");
576 	__HAL_AUX_ENTRY("wr_rtry_rd_ack_cnt", hw.wr_rtry_rd_ack_cnt, "%u");
577 	__HAL_AUX_ENTRY("new_wr_req_rtry_cnt", hw.new_wr_req_rtry_cnt, "%u");
578 	__HAL_AUX_ENTRY("new_wr_req_cnt", hw.new_wr_req_cnt, "%u");
579 	__HAL_AUX_ENTRY("wr_disc_cnt", hw.wr_disc_cnt, "%u");
580 	__HAL_AUX_ENTRY("wr_rtry_cnt", hw.wr_rtry_cnt, "%u");
581 	__HAL_AUX_ENTRY("txp_wr_cnt", hw.txp_wr_cnt, "%u");
582 	__HAL_AUX_ENTRY("rd_rtry_wr_ack_cnt", hw.rd_rtry_wr_ack_cnt, "%u");
583 	__HAL_AUX_ENTRY("txd_wr_cnt", hw.txd_wr_cnt, "%u");
584 	__HAL_AUX_ENTRY("txd_rd_cnt", hw.txd_rd_cnt, "%u");
585 	__HAL_AUX_ENTRY("rxd_wr_cnt", hw.rxd_wr_cnt, "%u");
586 	__HAL_AUX_ENTRY("rxd_rd_cnt", hw.rxd_rd_cnt, "%u");
587 	__HAL_AUX_ENTRY("rxf_wr_cnt", hw.rxf_wr_cnt, "%u");
588 	__HAL_AUX_ENTRY("txf_rd_cnt", hw.txf_rd_cnt, "%u");
589 
590 	__HAL_AUX_ENTRY_END(bufsize, retsize);
591 
592 	return XGE_HAL_OK;
593 }
594 
595 /**
596  * xge_hal_aux_stats_hal_read - Read HAL (layer) statistics.
597  * @devh: HAL device handle.
598  * @bufsize: Buffer size.
599  * @retbuf: Buffer pointer.
600  * @retsize: Size of the result. Cannot be greater than @bufsize.
601  *
602  * Read HAL statistics.
603  *
604  * Returns: XGE_HAL_OK - success.
605  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
606  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
607  * XGE_HAL_INF_STATS_IS_NOT_READY - Statistics information is not
608  * currently available.
609  *
610  * See also: xge_hal_aux_device_dump().
611  */
612 xge_hal_status_e xge_hal_aux_stats_hal_read(xge_hal_device_h devh,
613 			int bufsize, char *retbuf, int *retsize)
614 {
615 	xge_list_t *item;
616 	xge_hal_channel_t *channel;
617 	xge_hal_device_t *hldev = (xge_hal_device_t*)devh;
618 	xge_hal_status_e status;
619 	xge_hal_mgmt_device_stats_t devstat;
620 	xge_hal_mgmt_channel_stats_t chstat;
621 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
622 
623 	status = xge_hal_mgmt_device_stats(hldev, &devstat,
624 				     sizeof(xge_hal_mgmt_device_stats_t));
625 	if (status != XGE_HAL_OK) {
626 		return status;
627 	}
628 
629 	__HAL_AUX_ENTRY("rx_traffic_intr_cnt", devstat.rx_traffic_intr_cnt, "%u");
630 	__HAL_AUX_ENTRY("tx_traffic_intr_cnt", devstat.tx_traffic_intr_cnt, "%u");
631 	__HAL_AUX_ENTRY("not_traffic_intr_cnt",
632 			devstat.not_traffic_intr_cnt, "%u");
633 	__HAL_AUX_ENTRY("traffic_intr_cnt", devstat.traffic_intr_cnt, "%u");
634 	__HAL_AUX_ENTRY("total_intr_cnt", devstat.total_intr_cnt, "%u");
635 	__HAL_AUX_ENTRY("soft_reset_cnt", devstat.soft_reset_cnt, "%u");
636 	__HAL_AUX_ENTRY("rxufca_lo_adjust_cnt",
637 			devstat.rxufca_lo_adjust_cnt, "%u");
638 	__HAL_AUX_ENTRY("rxufca_hi_adjust_cnt",
639 			devstat.rxufca_hi_adjust_cnt, "%u");
640 #if defined(XGE_HAL_CONFIG_LRO)
641 	__HAL_AUX_ENTRY("tot_frms_lroised",
642 			devstat.tot_frms_lroised, "%u");
643 	__HAL_AUX_ENTRY("tot_lro_sessions",
644 			devstat.tot_lro_sessions, "%u");
645 #endif
646 
647 	/* for each opened rx channel */
648 	xge_list_for_each(item, &hldev->ring_channels) {
649 		char key[XGE_OS_SPRINTF_STRLEN];
650 		channel = xge_container_of(item, xge_hal_channel_t, item);
651 
652 		status = xge_hal_mgmt_channel_stats(channel, &chstat,
653 				     sizeof(xge_hal_mgmt_channel_stats_t));
654 		if (status != XGE_HAL_OK) {
655 			return status;
656 		}
657 
658 		(void) xge_os_sprintf(key, "ring%d_", channel->post_qid);
659 
660 		xge_os_strcpy(key+6, "full_cnt");
661 		__HAL_AUX_ENTRY(key, chstat.out_of_dtrs_cnt, "%u");
662 		xge_os_strcpy(key+6, "reserve_free_swaps_cnt");
663 		__HAL_AUX_ENTRY(key, chstat.reserve_free_swaps_cnt, "%u");
664 		xge_os_strcpy(key+6, "avg_compl_per_intr_cnt");
665 		__HAL_AUX_ENTRY(key, chstat.avg_compl_per_intr_cnt, "%u");
666 		xge_os_strcpy(key+6, "total_compl_cnt");
667 		__HAL_AUX_ENTRY(key, chstat.total_compl_cnt, "%u");
668 		xge_os_strcpy(key+6, "bump_cnt");
669 		__HAL_AUX_ENTRY(key, chstat.ring_bump_cnt, "%u");
670 	}
671 
672 	/* for each opened tx channel */
673 	xge_list_for_each(item, &hldev->fifo_channels) {
674 		char key[XGE_OS_SPRINTF_STRLEN];
675 		channel = xge_container_of(item, xge_hal_channel_t, item);
676 
677 		status = xge_hal_mgmt_channel_stats(channel, &chstat,
678 				     sizeof(xge_hal_mgmt_channel_stats_t));
679 		if (status != XGE_HAL_OK) {
680 			return status;
681 		}
682 
683 		(void) xge_os_sprintf(key, "fifo%d_", channel->post_qid);
684 
685 		xge_os_strcpy(key+6, "full_cnt");
686 		__HAL_AUX_ENTRY(key, chstat.out_of_dtrs_cnt, "%u");
687 		xge_os_strcpy(key+6, "reserve_free_swaps_cnt");
688 		__HAL_AUX_ENTRY(key, chstat.reserve_free_swaps_cnt, "%u");
689 		xge_os_strcpy(key+6, "avg_compl_per_intr_cnt");
690 		__HAL_AUX_ENTRY(key, chstat.avg_compl_per_intr_cnt, "%u");
691 		xge_os_strcpy(key+6, "total_compl_cnt");
692 		__HAL_AUX_ENTRY(key, chstat.total_compl_cnt, "%u");
693 		xge_os_strcpy(key+6, "total_posts");
694 		__HAL_AUX_ENTRY(key, chstat.total_posts, "%u");
695 		xge_os_strcpy(key+6, "total_posts_many");
696 		__HAL_AUX_ENTRY(key, chstat.total_posts_many, "%u");
697 		xge_os_strcpy(key+6, "total_buffers");
698 		__HAL_AUX_ENTRY(key, chstat.total_buffers, "%u");
699 		xge_os_strcpy(key+6, "avg_buffers_per_post");
700 		__HAL_AUX_ENTRY(key, chstat.avg_buffers_per_post, "%u");
701 		xge_os_strcpy(key+6, "avg_buffer_size");
702 		__HAL_AUX_ENTRY(key, chstat.avg_buffer_size, "%u");
703 		xge_os_strcpy(key+6, "avg_post_size");
704 		__HAL_AUX_ENTRY(key, chstat.avg_post_size, "%u");
705 		xge_os_strcpy(key+6, "total_posts_dtrs_many");
706 		__HAL_AUX_ENTRY(key, chstat.total_posts_dtrs_many, "%u");
707 		xge_os_strcpy(key+6, "total_posts_frags_many");
708 		__HAL_AUX_ENTRY(key, chstat.total_posts_frags_many, "%u");
709 		xge_os_strcpy(key+6, "total_posts_dang_dtrs");
710 		__HAL_AUX_ENTRY(key, chstat.total_posts_dang_dtrs, "%u");
711 		xge_os_strcpy(key+6, "total_posts_dang_frags");
712 		__HAL_AUX_ENTRY(key, chstat.total_posts_dang_frags, "%u");
713 	}
714 
715 	__HAL_AUX_ENTRY_END(bufsize, retsize);
716 
717 	return XGE_HAL_OK;
718 }
719 
720 
721 
722 /**
723  * xge_hal_aux_stats_sw_dev_read - Read software device statistics.
724  * @devh: HAL device handle.
725  * @bufsize: Buffer size.
726  * @retbuf: Buffer pointer.
727  * @retsize: Size of the result. Cannot be greater than @bufsize.
728  *
729  * Read software-maintained device statistics.
730  *
731  * Returns: XGE_HAL_OK - success.
732  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
733  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
734  * XGE_HAL_INF_STATS_IS_NOT_READY - Statistics information is not
735  * currently available.
736  *
737  * See also: xge_hal_aux_device_dump().
738  */
739 xge_hal_status_e xge_hal_aux_stats_sw_dev_read(xge_hal_device_h devh,
740 				int bufsize, char *retbuf, int *retsize)
741 {
742 	xge_hal_device_t *hldev = (xge_hal_device_t*)devh;
743 	xge_hal_status_e status;
744 	xge_hal_mgmt_sw_stats_t sw_dev_err_stats;
745 	int t_code;
746 	char buf[XGE_OS_SPRINTF_STRLEN];
747 
748 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
749 
750 	status = xge_hal_mgmt_sw_stats(hldev, &sw_dev_err_stats,
751 				     sizeof(xge_hal_mgmt_sw_stats_t));
752 	if (status != XGE_HAL_OK) {
753 		return status;
754 	}
755 
756 	__HAL_AUX_ENTRY("sm_err_cnt",sw_dev_err_stats.sm_err_cnt, "%u");
757 	__HAL_AUX_ENTRY("single_ecc_err_cnt",sw_dev_err_stats.single_ecc_err_cnt, "%u");
758 	__HAL_AUX_ENTRY("double_ecc_err_cnt",sw_dev_err_stats.double_ecc_err_cnt, "%u");
759 	__HAL_AUX_ENTRY("ecc_err_cnt", sw_dev_err_stats.ecc_err_cnt, "%u");
760 	__HAL_AUX_ENTRY("parity_err_cnt",sw_dev_err_stats.parity_err_cnt, "%u");
761 	__HAL_AUX_ENTRY("serr_cnt",sw_dev_err_stats.serr_cnt, "%u");
762 
763 	for (t_code = 1; t_code < 16; t_code++) {
764 	        int t_code_cnt = sw_dev_err_stats.rxd_t_code_err_cnt[t_code];
765 	        if (t_code_cnt)  {
766 			(void) xge_os_sprintf(buf, "rxd_t_code_%d", t_code);
767 			__HAL_AUX_ENTRY(buf, t_code_cnt, "%u");
768 	        }
769 	        t_code_cnt = sw_dev_err_stats.txd_t_code_err_cnt[t_code];
770 		if (t_code_cnt)	{
771 			(void) xge_os_sprintf(buf, "txd_t_code_%d", t_code);
772 			__HAL_AUX_ENTRY(buf, t_code_cnt, "%u");
773 		}
774 	}
775 
776 	__HAL_AUX_ENTRY_END(bufsize, retsize);
777 
778 	return XGE_HAL_OK;
779 }
780 
781 /**
782  * xge_hal_aux_pci_config_read - Retrieve and format PCI Configuration
783  * info.
784  * @devh: HAL device handle.
785  * @bufsize: Buffer size.
786  * @retbuf: Buffer pointer.
787  * @retsize: Size of the result. Cannot be greater than @bufsize.
788  *
789  * Retrieve about info (using xge_hal_mgmt_pci_config()) and sprintf it
790  * into the provided @retbuf.
791  *
792  * Returns: XGE_HAL_OK - success.
793  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
794  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
795  *
796  * See also: xge_hal_mgmt_pci_config(), xge_hal_aux_device_dump().
797  */
798 xge_hal_status_e xge_hal_aux_pci_config_read(xge_hal_device_h devh, int	bufsize,
799 				char *retbuf, int *retsize)
800 {
801 	xge_hal_status_e status;
802 	xge_hal_mgmt_pci_config_t pci_config;
803 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
804 
805 	status = xge_hal_mgmt_pci_config(devh, &pci_config,
806 				  sizeof(xge_hal_mgmt_pci_config_t));
807 	if (status != XGE_HAL_OK) {
808 		return status;
809 	}
810 
811 	__HAL_AUX_ENTRY("vendor_id", pci_config.vendor_id, "0x%04X");
812 	__HAL_AUX_ENTRY("device_id", pci_config.device_id, "0x%04X");
813 	__HAL_AUX_ENTRY("command", pci_config.command, "0x%04X");
814 	__HAL_AUX_ENTRY("status", pci_config.status, "0x%04X");
815 	__HAL_AUX_ENTRY("revision", pci_config.revision, "0x%02X");
816 	__HAL_AUX_ENTRY("pciClass1", pci_config.pciClass[0], "0x%02X");
817 	__HAL_AUX_ENTRY("pciClass2", pci_config.pciClass[1], "0x%02X");
818 	__HAL_AUX_ENTRY("pciClass3", pci_config.pciClass[2], "0x%02X");
819 	__HAL_AUX_ENTRY("cache_line_size",
820 			pci_config.cache_line_size, "0x%02X");
821 	__HAL_AUX_ENTRY("latency_timer", pci_config.latency_timer, "0x%02X");
822 	__HAL_AUX_ENTRY("header_type", pci_config.header_type, "0x%02X");
823 	__HAL_AUX_ENTRY("bist", pci_config.bist, "0x%02X");
824 	__HAL_AUX_ENTRY("base_addr0_lo", pci_config.base_addr0_lo, "0x%08X");
825 	__HAL_AUX_ENTRY("base_addr0_hi", pci_config.base_addr0_hi, "0x%08X");
826 	__HAL_AUX_ENTRY("base_addr1_lo", pci_config.base_addr1_lo, "0x%08X");
827 	__HAL_AUX_ENTRY("base_addr1_hi", pci_config.base_addr1_hi, "0x%08X");
828 	__HAL_AUX_ENTRY("not_Implemented1",
829 			pci_config.not_Implemented1, "0x%08X");
830 	__HAL_AUX_ENTRY("not_Implemented2", pci_config.not_Implemented2,
831 			"0x%08X");
832 	__HAL_AUX_ENTRY("cardbus_cis_pointer", pci_config.cardbus_cis_pointer,
833 			"0x%08X");
834 	__HAL_AUX_ENTRY("subsystem_vendor_id", pci_config.subsystem_vendor_id,
835 			"0x%04X");
836 	__HAL_AUX_ENTRY("subsystem_id", pci_config.subsystem_id, "0x%04X");
837 	__HAL_AUX_ENTRY("rom_base", pci_config.rom_base, "0x%08X");
838 	__HAL_AUX_ENTRY("capabilities_pointer",
839 			pci_config.capabilities_pointer, "0x%02X");
840 	__HAL_AUX_ENTRY("interrupt_line", pci_config.interrupt_line, "0x%02X");
841 	__HAL_AUX_ENTRY("interrupt_pin", pci_config.interrupt_pin, "0x%02X");
842 	__HAL_AUX_ENTRY("min_grant", pci_config.min_grant, "0x%02X");
843 	__HAL_AUX_ENTRY("max_latency", pci_config.max_latency, "0x%02X");
844 	__HAL_AUX_ENTRY("msi_cap_id", pci_config.msi_cap_id, "0x%02X");
845 	__HAL_AUX_ENTRY("msi_next_ptr", pci_config.msi_next_ptr, "0x%02X");
846 	__HAL_AUX_ENTRY("msi_control", pci_config.msi_control, "0x%04X");
847 	__HAL_AUX_ENTRY("msi_lower_address", pci_config.msi_lower_address,
848 			"0x%08X");
849 	__HAL_AUX_ENTRY("msi_higher_address", pci_config.msi_higher_address,
850 			"0x%08X");
851 	__HAL_AUX_ENTRY("msi_data", pci_config.msi_data, "0x%04X");
852 	__HAL_AUX_ENTRY("msi_unused", pci_config.msi_unused, "0x%04X");
853 	__HAL_AUX_ENTRY("vpd_cap_id", pci_config.vpd_cap_id, "0x%02X");
854 	__HAL_AUX_ENTRY("vpd_next_cap", pci_config.vpd_next_cap, "0x%02X");
855 	__HAL_AUX_ENTRY("vpd_addr", pci_config.vpd_addr, "0x%04X");
856 	__HAL_AUX_ENTRY("vpd_data", pci_config.vpd_data, "0x%08X");
857 	__HAL_AUX_ENTRY("pcix_cap", pci_config.pcix_cap, "0x%02X");
858 	__HAL_AUX_ENTRY("pcix_next_cap", pci_config.pcix_next_cap, "0x%02X");
859 	__HAL_AUX_ENTRY("pcix_command", pci_config.pcix_command, "0x%04X");
860 	__HAL_AUX_ENTRY("pcix_status", pci_config.pcix_status, "0x%08X");
861 
862 	if (xge_hal_device_check_id(devh) == XGE_HAL_CARD_HERC) {
863 		char key[XGE_OS_SPRINTF_STRLEN];
864 		int i;
865 
866 		for (i = 0;
867 		     i < (XGE_HAL_PCI_XFRAME_CONFIG_SPACE_SIZE - 0x68)/4;
868 		     i++) {
869 			(void) xge_os_sprintf(key, "%03x:", 4*i + 0x68);
870 			__HAL_AUX_ENTRY(key, *((int *)pci_config.rsvd_b1 + i),
871 					"0x%08X");
872 		}
873 	}
874 
875 	__HAL_AUX_ENTRY_END(bufsize, retsize);
876 
877 	return XGE_HAL_OK;
878 }
879 
880 
881 /**
882  * xge_hal_aux_channel_read - Read channels information.
883  * @devh: HAL device handle.
884  * @bufsize: Buffer size.
885  * @retbuf: Buffer pointer.
886  * @retsize: Size of the result. Cannot be greater than @bufsize.
887  *
888  * Read HAL statistics.
889  *
890  * Returns: XGE_HAL_OK - success.
891  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
892  * XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
893  * See also: xge_hal_aux_device_dump().
894  */
895 xge_hal_status_e xge_hal_aux_channel_read(xge_hal_device_h devh,
896 				int bufsize, char *retbuf, int *retsize)
897 {
898 	xge_list_t *item;
899 	xge_hal_channel_t *channel;
900 	xge_hal_device_t *hldev = (xge_hal_device_t*)devh;
901 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
902 
903 	if (hldev->magic != XGE_HAL_MAGIC) {
904                 return XGE_HAL_ERR_INVALID_DEVICE;
905         }
906 
907 	/* for each opened rx channel */
908 	xge_list_for_each(item, &hldev->ring_channels) {
909 		char key[XGE_OS_SPRINTF_STRLEN];
910 		channel = xge_container_of(item, xge_hal_channel_t, item);
911 
912 		if (channel->is_open != 1)
913 			continue;
914 
915 		(void) xge_os_sprintf(key, "ring%d_", channel->post_qid);
916 		xge_os_strcpy(key+6, "type");
917 		__HAL_AUX_ENTRY(key, channel->type, "%u");
918 		xge_os_strcpy(key+6, "length");
919 		__HAL_AUX_ENTRY(key, channel->length, "%u");
920 		xge_os_strcpy(key+6, "is open");
921 		__HAL_AUX_ENTRY(key, channel->is_open, "%u");
922 		xge_os_strcpy(key+6, "reserve initial");
923 		__HAL_AUX_ENTRY(key, channel->reserve_initial, "%u");
924 		xge_os_strcpy(key+6, "reserve max");
925 		__HAL_AUX_ENTRY(key, channel->reserve_max, "%u");
926 		xge_os_strcpy(key+6, "reserve length");
927 		__HAL_AUX_ENTRY(key, channel->reserve_length, "%u");
928 		xge_os_strcpy(key+6, "reserve top");
929 		__HAL_AUX_ENTRY(key, channel->reserve_top, "%u");
930 		xge_os_strcpy(key+6, "reserve threshold");
931 		__HAL_AUX_ENTRY(key, channel->reserve_threshold, "%u");
932 		xge_os_strcpy(key+6, "free length");
933 		__HAL_AUX_ENTRY(key, channel->free_length, "%u");
934 		xge_os_strcpy(key+6, "post index");
935 		__HAL_AUX_ENTRY(key, channel->post_index, "%u");
936 		xge_os_strcpy(key+6, "compl index");
937 		__HAL_AUX_ENTRY(key, channel->compl_index, "%u");
938 		xge_os_strcpy(key+6, "per dtr space");
939 		__HAL_AUX_ENTRY(key, channel->per_dtr_space, "%u");
940 	}
941 
942 	/* for each opened tx channel */
943 	xge_list_for_each(item, &hldev->fifo_channels) {
944 		char key[XGE_OS_SPRINTF_STRLEN];
945 		channel = xge_container_of(item, xge_hal_channel_t, item);
946 
947 		if (channel->is_open != 1)
948 			continue;
949 
950 		(void) xge_os_sprintf(key, "fifo%d_", channel->post_qid);
951 		xge_os_strcpy(key+6, "type");
952 		__HAL_AUX_ENTRY(key, channel->type, "%u");
953 		xge_os_strcpy(key+6, "length");
954 		__HAL_AUX_ENTRY(key, channel->length, "%u");
955 		xge_os_strcpy(key+6, "is open");
956 		__HAL_AUX_ENTRY(key, channel->is_open, "%u");
957 		xge_os_strcpy(key+6, "reserve initial");
958 		__HAL_AUX_ENTRY(key, channel->reserve_initial, "%u");
959 		xge_os_strcpy(key+6, "reserve max");
960 		__HAL_AUX_ENTRY(key, channel->reserve_max, "%u");
961 		xge_os_strcpy(key+6, "reserve length");
962 		__HAL_AUX_ENTRY(key, channel->reserve_length, "%u");
963 		xge_os_strcpy(key+6, "reserve top");
964 		__HAL_AUX_ENTRY(key, channel->reserve_top, "%u");
965 		xge_os_strcpy(key+6, "reserve threshold");
966 		__HAL_AUX_ENTRY(key, channel->reserve_threshold, "%u");
967 		xge_os_strcpy(key+6, "free length");
968 		__HAL_AUX_ENTRY(key, channel->free_length, "%u");
969 		xge_os_strcpy(key+6, "post index");
970 		__HAL_AUX_ENTRY(key, channel->post_index, "%u");
971 		xge_os_strcpy(key+6, "compl index");
972 		__HAL_AUX_ENTRY(key, channel->compl_index, "%u");
973 		xge_os_strcpy(key+6, "per dtr space");
974 		__HAL_AUX_ENTRY(key, channel->per_dtr_space, "%u");
975 	}
976 
977 	__HAL_AUX_ENTRY_END(bufsize, retsize);
978 
979 	return XGE_HAL_OK;
980 }
981 
982 /**
983  * xge_hal_aux_device_dump - Dump driver "about" info and device state.
984  * @devh: HAL device handle.
985  *
986  * Dump driver & device "about" info and device state,
987  * including all BAR0 registers, hardware and software statistics, PCI
988  * configuration space.
989  * See also: xge_hal_aux_about_read(), xge_hal_mgmt_reg_read(),
990  * xge_hal_aux_pci_config_read(), xge_hal_aux_stats_sw_dev_read(),
991  * xge_hal_aux_stats_tmac_read(), xge_hal_aux_stats_rmac_read(),
992  * xge_hal_aux_channel_read(), xge_hal_aux_stats_hal_read().
993  * Returns:
994  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
995  * XGE_HAL_ERR_OUT_OF_SPACE - Buffer size is very small.
996  */
997 xge_hal_status_e
998 xge_hal_aux_device_dump(xge_hal_device_h devh)
999 {
1000 	xge_hal_device_t *hldev = (xge_hal_device_t*)devh;
1001 	xge_hal_status_e status;
1002 	int retsize;
1003 	int offset;
1004 	u64 retval;
1005 
1006 	xge_assert(hldev->dump_buf != NULL);
1007 
1008 	xge_os_println("********* xge DEVICE DUMP BEGIN **********");
1009 
1010 	status = xge_hal_aux_about_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1011 	                                hldev->dump_buf,
1012 	                                &retsize);
1013 	if (status != XGE_HAL_OK) {
1014 		goto error;
1015 	}
1016 	xge_os_println(hldev->dump_buf);
1017 
1018 
1019 	for (offset = 0; offset < 1574; offset++) {
1020 
1021 		status = xge_hal_mgmt_reg_read(hldev, 0, offset*8, &retval);
1022 		if (status != XGE_HAL_OK) {
1023 			goto error;
1024 		}
1025 
1026 		if (!retval) continue;
1027 
1028 		xge_os_printf("0x%04x 0x%08x%08x", offset*8,
1029 					(u32)(retval>>32), (u32)retval);
1030 	}
1031 	xge_os_println("\n");
1032 
1033 	status = xge_hal_aux_pci_config_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1034 	                                     hldev->dump_buf,
1035 	                                     &retsize);
1036 	if (status != XGE_HAL_OK) {
1037 		goto error;
1038 	}
1039 	xge_os_println(hldev->dump_buf);
1040 
1041 	status = xge_hal_aux_stats_tmac_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1042 	                                     hldev->dump_buf,
1043 	                                     &retsize);
1044 	if (status != XGE_HAL_OK) {
1045 		goto error;
1046 	}
1047 	xge_os_println(hldev->dump_buf);
1048 
1049 	status = xge_hal_aux_stats_rmac_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1050 	                                     hldev->dump_buf,
1051 	                                     &retsize);
1052 	if (status != XGE_HAL_OK) {
1053 		goto error;
1054 	}
1055 	xge_os_println(hldev->dump_buf);
1056 
1057 	status = xge_hal_aux_stats_pci_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1058 	                                    hldev->dump_buf,
1059 	                                    &retsize);
1060 	if (status != XGE_HAL_OK) {
1061 		goto error;
1062 	}
1063 	xge_os_println(hldev->dump_buf);
1064 
1065 	if (xge_hal_device_check_id(hldev) == XGE_HAL_CARD_HERC) {
1066 		status = xge_hal_aux_stats_herc_enchanced(hldev,
1067 			     XGE_HAL_DUMP_BUF_SIZE, hldev->dump_buf, &retsize);
1068 		if (status != XGE_HAL_OK) {
1069 			goto error;
1070 		}
1071 		xge_os_println(hldev->dump_buf);
1072 	}
1073 
1074 	status = xge_hal_aux_stats_sw_dev_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1075 					     hldev->dump_buf, &retsize);
1076 	if (status != XGE_HAL_OK) {
1077 		goto error;
1078 	}
1079 	xge_os_println(hldev->dump_buf);
1080 
1081 	status = xge_hal_aux_channel_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1082 	                                  hldev->dump_buf,
1083 	                                  &retsize);
1084 	if (status != XGE_HAL_OK) {
1085 		goto error;
1086 	}
1087 	xge_os_println(hldev->dump_buf);
1088 
1089 	status = xge_hal_aux_stats_hal_read(hldev, XGE_HAL_DUMP_BUF_SIZE,
1090 	                                    hldev->dump_buf,
1091 	                                    &retsize);
1092 	if (status != XGE_HAL_OK) {
1093 		goto error;
1094 	}
1095 	xge_os_println(hldev->dump_buf);
1096 
1097 	xge_os_println("********* XFRAME DEVICE DUMP END **********");
1098 
1099 error:
1100 	return status;
1101 }
1102 
1103 
1104 /**
1105  * xge_hal_aux_driver_config_read - Read Driver configuration.
1106  * @bufsize: Buffer size.
1107  * @retbuf: Buffer pointer.
1108  * @retsize: Size of the result. Cannot be greater than @bufsize.
1109  *
1110  * Read driver configuration,
1111  *
1112  * Returns: XGE_HAL_OK - success.
1113  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
1114  *
1115  * See also: xge_hal_aux_device_config_read().
1116  */
1117 xge_hal_status_e
1118 xge_hal_aux_driver_config_read(int bufsize, char *retbuf, int *retsize)
1119 {
1120 	xge_hal_status_e status;
1121 	xge_hal_driver_config_t  drv_config;
1122 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
1123 
1124 	status = xge_hal_mgmt_driver_config(&drv_config,
1125 					  sizeof(xge_hal_driver_config_t));
1126 	if (status != XGE_HAL_OK) {
1127 		return status;
1128 	}
1129 
1130 	__HAL_AUX_ENTRY("queue size initial",
1131 			drv_config.queue_size_initial, "%u");
1132 	__HAL_AUX_ENTRY("queue size max", drv_config.queue_size_max, "%u");
1133 	__HAL_AUX_ENTRY_END(bufsize, retsize);
1134 
1135 	return XGE_HAL_OK;
1136 }
1137 
1138 
1139 /**
1140  * xge_hal_aux_device_config_read - Read device configuration.
1141  * @devh: HAL device handle.
1142  * @bufsize: Buffer size.
1143  * @retbuf: Buffer pointer.
1144  * @retsize: Size of the result. Cannot be greater than @bufsize.
1145  *
1146  * Read device configuration,
1147  *
1148  * Returns: XGE_HAL_OK - success.
1149  * XGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
1150  * XGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
1151  *
1152  * See also: xge_hal_aux_driver_config_read().
1153  */
1154 xge_hal_status_e xge_hal_aux_device_config_read(xge_hal_device_h devh,
1155 				int bufsize, char *retbuf, int *retsize)
1156 {
1157 	int i;
1158 	xge_hal_status_e status;
1159 	xge_hal_device_config_t  dev_config;
1160 	char key[XGE_OS_SPRINTF_STRLEN];
1161 	__HAL_AUX_ENTRY_DECLARE(bufsize, retbuf);
1162 
1163 	status = xge_hal_mgmt_device_config(devh, &dev_config,
1164 					  sizeof(xge_hal_device_config_t));
1165 	if (status != XGE_HAL_OK) {
1166 		return status;
1167 	}
1168 
1169 	__HAL_AUX_ENTRY("mtu", dev_config.mtu, "%u");
1170 	__HAL_AUX_ENTRY("isr polling count", dev_config.isr_polling_cnt, "%u");
1171 	__HAL_AUX_ENTRY("latency timer", dev_config.latency_timer, "%u");
1172 	__HAL_AUX_ENTRY("max split transactions",
1173 			dev_config.max_splits_trans, "%u");
1174 	__HAL_AUX_ENTRY("mmrb count", dev_config.mmrb_count, "%d");
1175 	__HAL_AUX_ENTRY("shared splits", dev_config.shared_splits, "%u");
1176 	__HAL_AUX_ENTRY("statistics refresh time(in sec)",
1177 			dev_config.stats_refresh_time_sec, "%u");
1178 	__HAL_AUX_ENTRY("pci freq(in mherz)", dev_config.pci_freq_mherz, "%u");
1179 	__HAL_AUX_ENTRY("intr mode", dev_config.intr_mode, "%u");
1180 	__HAL_AUX_ENTRY("sched timer(in us)", dev_config.sched_timer_us, "%u");
1181 	__HAL_AUX_ENTRY("sched timer one shot(flag)",
1182 			dev_config.sched_timer_one_shot,  "%u");
1183 	__HAL_AUX_ENTRY("ring memblock size",
1184 			dev_config.ring.memblock_size,  "%u");
1185 
1186 	for(i = 0; i < XGE_HAL_MAX_RING_NUM;  i++)
1187 	{
1188 		xge_hal_ring_queue_t *ring = &dev_config.ring.queue[i];
1189 		xge_hal_rti_config_t *rti =  &ring->rti;
1190 
1191 		if (!ring->configured)
1192 			continue;
1193 
1194 		(void) xge_os_sprintf(key, "ring%d_", i);
1195 		xge_os_strcpy(key+6, "inital rxd blocks");
1196 		__HAL_AUX_ENTRY(key, ring->initial, "%u");
1197 		xge_os_strcpy(key+6, "max rxd blocks");
1198 		__HAL_AUX_ENTRY(key, ring->max, "%u");
1199 		xge_os_strcpy(key+6, "buffer mode");
1200 		__HAL_AUX_ENTRY(key, ring->buffer_mode, "%u");
1201 		xge_os_strcpy(key+6, "dram size(in mb)");
1202 		__HAL_AUX_ENTRY(key, ring->dram_size_mb, "%u");
1203 		xge_os_strcpy(key+6, "backoff interval(in us)");
1204 		__HAL_AUX_ENTRY(key, ring->backoff_interval_us, "%u");
1205 		xge_os_strcpy(key+6, "max frame len");
1206 		__HAL_AUX_ENTRY(key, ring->max_frm_len, "%d");
1207 		xge_os_strcpy(key+6, "priority");
1208 		__HAL_AUX_ENTRY(key, ring->priority,  "%u");
1209 		xge_os_strcpy(key+6, "rth en");
1210 		__HAL_AUX_ENTRY(key, ring->rth_en,  "%u");
1211 		xge_os_strcpy(key+6, "no snoop bits");
1212 		__HAL_AUX_ENTRY(key, ring->no_snoop_bits,  "%u");
1213 		xge_os_strcpy(key+6, "urange_a");
1214 		__HAL_AUX_ENTRY(key, rti->urange_a,  "%u");
1215 		xge_os_strcpy(key+6, "ufc_a");
1216 		__HAL_AUX_ENTRY(key, rti->ufc_a,  "%u");
1217 		xge_os_strcpy(key+6, "urange_b");
1218 		__HAL_AUX_ENTRY(key, rti->urange_b,  "%u");
1219 		xge_os_strcpy(key+6, "ufc_b");
1220 		__HAL_AUX_ENTRY(key, rti->ufc_b,  "%u");
1221 		xge_os_strcpy(key+6, "urange_c");
1222 		__HAL_AUX_ENTRY(key, rti->urange_c,  "%u");
1223 		xge_os_strcpy(key+6, "ufc_c");
1224 		__HAL_AUX_ENTRY(key, rti->ufc_c,  "%u");
1225 		xge_os_strcpy(key+6, "ufc_d");
1226 		__HAL_AUX_ENTRY(key, rti->ufc_d,  "%u");
1227 		xge_os_strcpy(key+6, "timer val(in us)");
1228 		__HAL_AUX_ENTRY(key, rti->timer_val_us,  "%u");
1229 	}
1230 
1231 	{
1232 		xge_hal_mac_config_t *mac= &dev_config.mac;
1233 
1234 		__HAL_AUX_ENTRY("tmac util period",
1235 				mac->tmac_util_period, "%u");
1236 		__HAL_AUX_ENTRY("rmac util period",
1237 				mac->rmac_util_period, "%u");
1238 		__HAL_AUX_ENTRY("rmac bcast enable(flag)",
1239 				mac->rmac_bcast_en, "%u");
1240 		__HAL_AUX_ENTRY("rmac pause generator enable(flag)",
1241 				mac->rmac_pause_gen_en, "%d");
1242 		__HAL_AUX_ENTRY("rmac pause receive enable(flag)",
1243 				mac->rmac_pause_rcv_en, "%d");
1244 		__HAL_AUX_ENTRY("rmac pause time",
1245 				mac->rmac_pause_time, "%u");
1246 		__HAL_AUX_ENTRY("mc pause threshold qoq3",
1247 				mac->mc_pause_threshold_q0q3, "%u");
1248 		__HAL_AUX_ENTRY("mc pause threshold q4q7",
1249 				mac->mc_pause_threshold_q4q7, "%u");
1250 	}
1251 
1252 	{
1253 		xge_hal_tti_config_t *tti = &dev_config.tti;
1254 		__HAL_AUX_ENTRY("tti enabled", tti->enabled, "%u");
1255 		__HAL_AUX_ENTRY("tti urange_a", tti->urange_a, "%u");
1256 		__HAL_AUX_ENTRY("tti ufc_a", tti->ufc_a, "%u");
1257 		__HAL_AUX_ENTRY("tti urange_b", tti->urange_b, "%u");
1258 		__HAL_AUX_ENTRY("tti ufc_b", tti->ufc_b, "%u");
1259 		__HAL_AUX_ENTRY("tti urange_c", tti->urange_c, "%u");
1260 		__HAL_AUX_ENTRY("tti ufc_c", tti->ufc_c, "%u");
1261 		__HAL_AUX_ENTRY("tti urange_d", tti->urange_d, "%u");
1262 		__HAL_AUX_ENTRY("tti ufc_d", tti->ufc_d, "%u");
1263 		__HAL_AUX_ENTRY("tti timer val(in us)",
1264 				tti->timer_val_us, "%u");
1265 		__HAL_AUX_ENTRY("tti timer ci en(flag)",
1266 				tti->timer_ci_en, "%u");
1267 	}
1268 
1269 
1270 	__HAL_AUX_ENTRY("fifo max frags", dev_config.fifo.max_frags, "%u");
1271 	__HAL_AUX_ENTRY("fifo reserve threshold",
1272 			dev_config.fifo.reserve_threshold, "%u");
1273 	__HAL_AUX_ENTRY("fifo memblock size",
1274 			dev_config.fifo.memblock_size, "%u");
1275 #ifdef XGE_HAL_ALIGN_XMIT
1276 	__HAL_AUX_ENTRY("fifo alignment size",
1277 			dev_config.fifo.alignment_size, "%u");
1278 #endif
1279 
1280 	for(i = 0; i < XGE_HAL_MAX_FIFO_NUM;  i++)
1281 	{
1282 		xge_hal_fifo_queue_t *fifo = &dev_config.fifo.queue[i];
1283 
1284 		if (!fifo->configured)
1285 			continue;
1286 
1287 		(void) xge_os_sprintf(key, "fifo%d_", i);
1288 		xge_os_strcpy(key+6, "initial len");
1289 		__HAL_AUX_ENTRY(key, fifo->initial, "%u");
1290 		xge_os_strcpy(key+6, "max len");
1291 		__HAL_AUX_ENTRY(key, fifo->max, "%u");
1292 		xge_os_strcpy(key+6, "intr mode");
1293 		__HAL_AUX_ENTRY(key, fifo->intr, "%u");
1294 		xge_os_strcpy(key+6, "no snoop bits");
1295 		__HAL_AUX_ENTRY(key, fifo->no_snoop_bits, "%u");
1296 	}
1297 	__HAL_AUX_ENTRY("dump on serr(flag)", dev_config.dump_on_serr, "%u");
1298 	__HAL_AUX_ENTRY("dump on ecc err(flag)",
1299 			dev_config.dump_on_eccerr, "%u");
1300 	__HAL_AUX_ENTRY("dump on parity err(flag)",
1301 			dev_config.dump_on_parityerr, "%u");
1302 	__HAL_AUX_ENTRY("rth en(flag)", dev_config.rth_en, "%u");
1303 	__HAL_AUX_ENTRY("rth bucket size", dev_config.rth_bucket_size, "%u");
1304 
1305 	__HAL_AUX_ENTRY_END(bufsize, retsize);
1306 
1307 	return XGE_HAL_OK;
1308 }
1309 
1310