2 * Copyright (c) 2002-2007 Neterion, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 logStats( void *hwStats, unsigned short device_id )
35 count = XGE_COUNT_STATS - ((device_id == DEVICE_ID_XFRAME_II) ? 0 : XGE_COUNT_EXTENDED_STATS);
36 fdAll = fopen( "stats.log", "w+" );
39 XGE_PRINT_HEADER_STATS(fdAll);
41 for( index = 0; index < count ; index++ )
43 switch( statsInfo[index].type )
47 statsInfo[index].value =
48 *( ( u16 * )( ( unsigned char * ) hwStats +
49 GET_OFFSET_STATS( index ) ) );
54 statsInfo[index].value =
55 *( ( u32 * )( ( unsigned char * ) hwStats +
56 GET_OFFSET_STATS( index ) ) );
61 statsInfo[index].value =
62 *( ( u64 * )( ( unsigned char * ) hwStats +
63 GET_OFFSET_STATS( index ) ) );
68 XGE_PRINT_STATS(fdAll,(const char *) statsInfo[index].name,
69 statsInfo[index].value);
71 XGE_PRINT_LINE(fdAll);
77 logPciConf( void * pciConf )
81 fdAll = fopen( "pciconf.log", "w+" );
84 XGE_PRINT_HEADER_PCICONF(fdAll);
86 for( index = 0; index < XGE_COUNT_PCICONF; index++ )
88 pciconfInfo[index].value =
89 *( ( u16 * )( ( unsigned char * )pciConf +
90 GET_OFFSET_PCICONF(index) ) );
91 XGE_PRINT_PCICONF(fdAll,(const char *) pciconfInfo[index].name,
92 GET_OFFSET_PCICONF(index), pciconfInfo[index].value);
95 XGE_PRINT_LINE(fdAll);
101 logDevConf( void * devConf )
105 fdAll = fopen( "devconf.log", "w+" );
108 XGE_PRINT_HEADER_DEVCONF(fdAll);
110 for( index = 0; index < XGE_COUNT_DEVCONF; index++ )
112 devconfInfo[index].value =
113 *( ( u32 * )( ( unsigned char * )devConf +
114 ( index * ( sizeof( int ) ) ) ) );
115 XGE_PRINT_DEVCONF(fdAll,(const char *) devconfInfo[index].name,
116 devconfInfo[index].value);
119 XGE_PRINT_LINE(fdAll);
125 logRegInfo( void * regBuffer )
129 fdAll = fopen( "reginfo.log", "w+" );
132 XGE_PRINT_HEADER_REGS(fdAll);
134 for( index = 0; index < XGE_COUNT_REGS; index++ )
136 regInfo[index].value =
137 *( ( u64 * )( ( unsigned char * )regBuffer +
138 regInfo[index].offset ) );
139 XGE_PRINT_REGS(fdAll,(const char *) regInfo[index].name,
140 regInfo[index].offset, regInfo[index].value);
143 XGE_PRINT_LINE(fdAll);
148 logReadReg(u64 offset,u64 temp)
152 fdAll = fopen( "readreg.log", "w+");
155 XGE_PRINT_READ_HEADER_REGS(fdAll);
157 regInfo[index].offset = offset ;
159 regInfo[index].value = temp ;
161 printf("0x%.8X\t0x%.16llX\n",regInfo[index].offset, regInfo[index].value);
163 XGE_PRINT_LINE(fdAll);
168 logIntrStats( void * intrStats )
172 fdAll = fopen( "intrstats.log", "w+" );
175 XGE_PRINT_HEADER_STATS(fdAll);
177 for( index = 0; index < XGE_COUNT_INTRSTAT; index++ )
179 intrInfo[index].value =
180 *( ( u32 * )( ( unsigned char * )intrStats +
181 ( index * ( sizeof( u32 ) ) ) ) );
182 XGE_PRINT_STATS(fdAll,(const char *) intrInfo[index].name,
183 intrInfo[index].value);
186 XGE_PRINT_LINE(fdAll);
192 logTcodeStats( void * tcodeStats )
196 fdAll = fopen( "tcodestats.log", "w+" );
199 XGE_PRINT_HEADER_STATS(fdAll);
201 for( index = 0; index < XGE_COUNT_TCODESTAT; index++ )
203 if(!(tcodeInfo[index].flag))
205 switch( tcodeInfo[index].type )
209 tcodeInfo[index].value =
210 *( ( u16 * )( ( unsigned char * )tcodeStats +
211 ( index * ( sizeof( u16 ) ) ) ) );
216 tcodeInfo[index].value =
217 *( ( u32 * )( ( unsigned char * )tcodeStats +
218 ( index * ( sizeof( u32 ) ) ) ) );
223 XGE_PRINT_STATS(fdAll,(const char *) tcodeInfo[index].name,
224 tcodeInfo[index].value);
228 XGE_PRINT_LINE(fdAll);
234 logDriverInfo( char *version )
236 fdAll = fopen( "driverinfo.log", "w+");
239 XGE_PRINT_LINE(fdAll);
240 printf("DRIVER VERSION : %s\n",version);
241 XGE_PRINT_LINE(fdAll);