[PATCH] sk98 vendor driver update
[linux-2.6/history.git] / drivers / net / sk98lin / h / skgepnm2.h
blobc00558c78421248468ba2db4acd87d989ef0cbbd
1 /*****************************************************************************
3 * Name: skgepnm2.h
4 * Project: GEnesis, PCI Gigabit Ethernet Adapter
5 * Version: $Revision: 1.36 $
6 * Date: $Date: 2003/05/23 12:45:13 $
7 * Purpose: Defines for Private Network Management Interface
9 ****************************************************************************/
11 /******************************************************************************
13 * (C)Copyright 1998-2002 SysKonnect GmbH.
14 * (C)Copyright 2002-2003 Marvell.
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * The information in this file is provided "AS IS" without warranty.
23 ******************************************************************************/
25 /*****************************************************************************
27 * History:
29 * $Log: skgepnm2.h,v $
30 * Revision 1.36 2003/05/23 12:45:13 tschilli
31 * #ifndef SK_PNMI_HUNDREDS_SEC added to SK_PNMI_HUNDREDS_SEC definition
32 * to allow own time macro defines.
34 * Revision 1.35 2003/03/27 11:27:48 tschilli
35 * Copyright messages changed.
37 * Revision 1.34 2002/12/16 09:05:18 tschilli
38 * Code for VCT handling added.
40 * Revision 1.33 2002/09/10 09:00:03 rwahl
41 * Adapted boolean definitions according sktypes.
43 * Revision 1.32 2002/08/09 09:47:01 rwahl
44 * Added write-only flag to oid access defines.
45 * Editorial changes.
47 * Revision 1.31 2002/07/17 19:23:18 rwahl
48 * - Replaced MAC counter definitions by enumeration.
49 * - Added definition SK_PNMI_MAC_TYPES.
50 * - Added chipset defnition for Yukon.
52 * Revision 1.30 2001/02/06 10:03:41 mkunz
53 * - Pnmi V4 dual net support added. Interface functions and macros extended
54 * - Vpd bug fixed
55 * - OID_SKGE_MTU added
57 * Revision 1.29 2001/01/22 13:41:37 rassmann
58 * Supporting two nets on dual-port adapters.
60 * Revision 1.28 2000/08/03 15:12:48 rwahl
61 * - Additional comment for MAC statistic data structure.
63 * Revision 1.27 2000/08/01 16:10:18 rwahl
64 * - Added mac statistic data structure for StatRxLongFrame counter.
66 * Revision 1.26 2000/03/31 13:51:34 rwahl
67 * Added SK_UPTR cast to offset calculation for PNMI struct fields;
68 * missing cast caused compiler warnings by Win64 compiler.
70 * Revision 1.25 1999/11/22 13:57:41 cgoos
71 * Changed license header to GPL.
72 * Allowing overwrite for SK_PNMI_STORE/_READ defines.
74 * Revision 1.24 1999/04/13 15:11:11 mhaveman
75 * Changed copyright.
77 * Revision 1.23 1999/01/28 15:07:12 mhaveman
78 * Changed default threshold for port switches per hour from 10
79 * to 240 which means 4 switches per minute. This fits better
80 * the granularity of 32 for the port switch estimate
81 * counter.
83 * Revision 1.22 1999/01/05 12:52:30 mhaveman
84 * Removed macro SK_PNMI_MICRO_SEC.
86 * Revision 1.21 1999/01/05 12:50:34 mhaveman
87 * Enlarged macro definition SK_PNMI_HUNDREDS_SEC() so that no 64-bit
88 * arithmetic is necessary if SK_TICKS_PER_SEC is 100.
90 * Revision 1.20 1998/12/09 14:02:53 mhaveman
91 * Defined macro SK_PNMI_DEF_RLMT_CHG_THRES for default port switch
92 * threshold.
94 * Revision 1.19 1998/12/03 11:28:41 mhaveman
95 * Removed SK_PNMI_CHECKPTR macro.
97 * Revision 1.18 1998/12/03 11:21:00 mhaveman
98 * -Added pointer check macro SK_PNMI_CHECKPTR
99 * -Added macros SK_PNMI_VPD_ARR_SIZE and SK_PNMI_VPD_STR_SIZE for
100 * VPD key evaluation.
102 * Revision 1.17 1998/11/20 13:20:33 mhaveman
103 * Fixed bug in SK_PNMI_SET_STAT macro. ErrorStatus was not correctly set.
105 * Revision 1.16 1998/11/20 08:08:49 mhaveman
106 * Macro SK_PNMI_CHECKFLAGS has got a if clause.
108 * Revision 1.15 1998/11/03 13:53:40 mhaveman
109 * Fixed alignment problem in macor SK_PNMI_SET_STAT macro.
111 * Revision 1.14 1998/10/30 15:50:13 mhaveman
112 * Added macro SK_PNMI_MICRO_SEC()
114 * Revision 1.13 1998/10/30 12:32:20 mhaveman
115 * Added forgotten cast in SK_PNMI_READ_U32 macro.
117 * Revision 1.12 1998/10/29 15:40:26 mhaveman
118 * -Changed SK_PNMI_TRAP_SENSOR_LEN because SensorDescr has now
119 * variable string length.
120 * -Defined SK_PNMI_CHECKFLAGS macro
122 * Revision 1.11 1998/10/29 08:53:34 mhaveman
123 * Removed SK_PNMI_RLM_XXX table indexed because these counters need
124 * not been saved over XMAC resets.
126 * Revision 1.10 1998/10/28 08:48:20 mhaveman
127 * -Added macros for storage according to alignment
128 * -Changed type of Instance to SK_U32 because of VPD
129 * -Removed trap structures. Not needed because of alignment problem
130 * -Changed type of Action form SK_U8 to int
132 * Revision 1.9 1998/10/21 13:34:45 mhaveman
133 * Shit, mismatched calculation of SK_PNMI_HUNDREDS_SEC. Corrected.
135 * Revision 1.8 1998/10/21 13:24:58 mhaveman
136 * Changed calculation of hundreds of seconds.
138 * Revision 1.7 1998/10/20 07:31:41 mhaveman
139 * Made type changes to unsigned int where possible.
141 * Revision 1.6 1998/09/04 17:04:05 mhaveman
142 * Added Sync counters to offset storage to provided settled values on
143 * port switch.
145 * Revision 1.5 1998/09/04 12:45:35 mhaveman
146 * Removed dummies for SK_DRIVER_ macros. They should be added by driver
147 * writer in skdrv2nd.h.
149 * Revision 1.4 1998/09/04 11:59:50 mhaveman
150 * Everything compiles now. Driver Macros for counting still missing.
152 * Revision 1.3 1998/08/24 12:01:35 mhaveman
153 * Intermediate state.
155 * Revision 1.2 1998/08/17 07:51:40 mhaveman
156 * Intermediate state.
158 * Revision 1.1 1998/08/11 09:08:40 mhaveman
159 * Intermediate state.
161 ****************************************************************************/
163 #ifndef _SKGEPNM2_H_
164 #define _SKGEPNM2_H_
167 * General definitions
169 #define SK_PNMI_CHIPSET_XMAC 1 /* XMAC11800FP */
170 #define SK_PNMI_CHIPSET_YUKON 2 /* YUKON */
172 #define SK_PNMI_BUS_PCI 1 /* PCI bus*/
175 * Actions
177 #define SK_PNMI_ACT_IDLE 1
178 #define SK_PNMI_ACT_RESET 2
179 #define SK_PNMI_ACT_SELFTEST 3
180 #define SK_PNMI_ACT_RESETCNT 4
183 * VPD releated defines
186 #define SK_PNMI_VPD_RW 1
187 #define SK_PNMI_VPD_RO 2
189 #define SK_PNMI_VPD_OK 0
190 #define SK_PNMI_VPD_NOTFOUND 1
191 #define SK_PNMI_VPD_CUT 2
192 #define SK_PNMI_VPD_TIMEOUT 3
193 #define SK_PNMI_VPD_FULL 4
194 #define SK_PNMI_VPD_NOWRITE 5
195 #define SK_PNMI_VPD_FATAL 6
197 #define SK_PNMI_VPD_IGNORE 0
198 #define SK_PNMI_VPD_CREATE 1
199 #define SK_PNMI_VPD_DELETE 2
203 * RLMT related defines
205 #define SK_PNMI_DEF_RLMT_CHG_THRES 240 /* 4 changes per minute */
209 * VCT internal status values
211 #define SK_PNMI_VCT_PENDING 32
212 #define SK_PNMI_VCT_TEST_DONE 64
213 #define SK_PNMI_VCT_LINK 128
216 * Internal table definitions
218 #define SK_PNMI_GET 0
219 #define SK_PNMI_PRESET 1
220 #define SK_PNMI_SET 2
222 #define SK_PNMI_RO 0
223 #define SK_PNMI_RW 1
224 #define SK_PNMI_WO 2
226 typedef struct s_OidTabEntry {
227 SK_U32 Id;
228 SK_U32 InstanceNo;
229 unsigned int StructSize;
230 unsigned int Offset;
231 int Access;
232 int (* Func)(SK_AC *pAc, SK_IOC pIo, int action,
233 SK_U32 Id, char* pBuf, unsigned int* pLen,
234 SK_U32 Instance, unsigned int TableIndex,
235 SK_U32 NetNumber);
236 SK_U16 Param;
237 } SK_PNMI_TAB_ENTRY;
241 * Trap lengths
243 #define SK_PNMI_TRAP_SIMPLE_LEN 17
244 #define SK_PNMI_TRAP_SENSOR_LEN_BASE 46
245 #define SK_PNMI_TRAP_RLMT_CHANGE_LEN 23
246 #define SK_PNMI_TRAP_RLMT_PORT_LEN 23
249 * Number of MAC types supported
251 #define SK_PNMI_MAC_TYPES (SK_MAC_GMAC + 1)
254 * MAC statistic data list (overall set for MAC types used)
256 enum SK_MACSTATS {
257 SK_PNMI_HTX = 0,
258 SK_PNMI_HTX_OCTET,
259 SK_PNMI_HTX_OCTETHIGH = SK_PNMI_HTX_OCTET,
260 SK_PNMI_HTX_OCTETLOW,
261 SK_PNMI_HTX_BROADCAST,
262 SK_PNMI_HTX_MULTICAST,
263 SK_PNMI_HTX_UNICAST,
264 SK_PNMI_HTX_BURST,
265 SK_PNMI_HTX_PMACC,
266 SK_PNMI_HTX_MACC,
267 SK_PNMI_HTX_COL,
268 SK_PNMI_HTX_SINGLE_COL,
269 SK_PNMI_HTX_MULTI_COL,
270 SK_PNMI_HTX_EXCESS_COL,
271 SK_PNMI_HTX_LATE_COL,
272 SK_PNMI_HTX_DEFFERAL,
273 SK_PNMI_HTX_EXCESS_DEF,
274 SK_PNMI_HTX_UNDERRUN,
275 SK_PNMI_HTX_CARRIER,
276 SK_PNMI_HTX_UTILUNDER,
277 SK_PNMI_HTX_UTILOVER,
278 SK_PNMI_HTX_64,
279 SK_PNMI_HTX_127,
280 SK_PNMI_HTX_255,
281 SK_PNMI_HTX_511,
282 SK_PNMI_HTX_1023,
283 SK_PNMI_HTX_MAX,
284 SK_PNMI_HTX_LONGFRAMES,
285 SK_PNMI_HTX_SYNC,
286 SK_PNMI_HTX_SYNC_OCTET,
287 SK_PNMI_HTX_RESERVED,
289 SK_PNMI_HRX,
290 SK_PNMI_HRX_OCTET,
291 SK_PNMI_HRX_OCTETHIGH = SK_PNMI_HRX_OCTET,
292 SK_PNMI_HRX_OCTETLOW,
293 SK_PNMI_HRX_BADOCTET,
294 SK_PNMI_HRX_BADOCTETHIGH = SK_PNMI_HRX_BADOCTET,
295 SK_PNMI_HRX_BADOCTETLOW,
296 SK_PNMI_HRX_BROADCAST,
297 SK_PNMI_HRX_MULTICAST,
298 SK_PNMI_HRX_UNICAST,
299 SK_PNMI_HRX_PMACC,
300 SK_PNMI_HRX_MACC,
301 SK_PNMI_HRX_PMACC_ERR,
302 SK_PNMI_HRX_MACC_UNKWN,
303 SK_PNMI_HRX_BURST,
304 SK_PNMI_HRX_MISSED,
305 SK_PNMI_HRX_FRAMING,
306 SK_PNMI_HRX_UNDERSIZE,
307 SK_PNMI_HRX_OVERFLOW,
308 SK_PNMI_HRX_JABBER,
309 SK_PNMI_HRX_CARRIER,
310 SK_PNMI_HRX_IRLENGTH,
311 SK_PNMI_HRX_SYMBOL,
312 SK_PNMI_HRX_SHORTS,
313 SK_PNMI_HRX_RUNT,
314 SK_PNMI_HRX_TOO_LONG,
315 SK_PNMI_HRX_FCS,
316 SK_PNMI_HRX_CEXT,
317 SK_PNMI_HRX_UTILUNDER,
318 SK_PNMI_HRX_UTILOVER,
319 SK_PNMI_HRX_64,
320 SK_PNMI_HRX_127,
321 SK_PNMI_HRX_255,
322 SK_PNMI_HRX_511,
323 SK_PNMI_HRX_1023,
324 SK_PNMI_HRX_MAX,
325 SK_PNMI_HRX_LONGFRAMES,
327 SK_PNMI_HRX_RESERVED,
329 SK_PNMI_MAX_IDX /* NOTE: Ensure SK_PNMI_CNT_NO is set to this value */
333 * MAC specific data
335 typedef struct s_PnmiStatAddr {
336 SK_U16 Reg; /* MAC register containing the value */
337 SK_BOOL GetOffset; /* TRUE: Offset managed by PNMI (call GetStatVal())*/
338 } SK_PNMI_STATADDR;
342 * SK_PNMI_STRUCT_DATA copy offset evaluation macros
344 #define SK_PNMI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e))
345 #define SK_PNMI_MAI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e))
346 #define SK_PNMI_VPD_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_VPD *)0)->e))
347 #define SK_PNMI_SEN_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_SENSOR *)0)->e))
348 #define SK_PNMI_CHK_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CHECKSUM *)0)->e))
349 #define SK_PNMI_STA_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STAT *)0)->e))
350 #define SK_PNMI_CNF_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CONF *)0)->e))
351 #define SK_PNMI_RLM_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT *)0)->e))
352 #define SK_PNMI_MON_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT_MONITOR *)0)->e))
353 #define SK_PNMI_TRP_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_TRAP *)0)->e))
355 #define SK_PNMI_SET_STAT(b,s,o) {SK_U32 Val32; char *pVal; \
356 Val32 = (s); \
357 pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \
358 &(((SK_PNMI_STRUCT_DATA *)0)-> \
359 ReturnStatus.ErrorStatus)); \
360 SK_PNMI_STORE_U32(pVal, Val32); \
361 Val32 = (o); \
362 pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \
363 &(((SK_PNMI_STRUCT_DATA *)0)-> \
364 ReturnStatus.ErrorOffset)); \
365 SK_PNMI_STORE_U32(pVal, Val32);}
368 * Time macros
370 #ifndef SK_PNMI_HUNDREDS_SEC
371 #if SK_TICKS_PER_SEC == 100
372 #define SK_PNMI_HUNDREDS_SEC(t) (t)
373 #else
374 #define SK_PNMI_HUNDREDS_SEC(t) (((t) * 100) / (SK_TICKS_PER_SEC))
375 #endif /* !SK_TICKS_PER_SEC */
376 #endif /* !SK_PNMI_HUNDREDS_SEC */
379 * Macros to work around alignment problems
381 #ifndef SK_PNMI_STORE_U16
382 #define SK_PNMI_STORE_U16(p,v) {*(char *)(p) = *((char *)&(v)); \
383 *((char *)(p) + 1) = \
384 *(((char *)&(v)) + 1);}
385 #endif
387 #ifndef SK_PNMI_STORE_U32
388 #define SK_PNMI_STORE_U32(p,v) {*(char *)(p) = *((char *)&(v)); \
389 *((char *)(p) + 1) = \
390 *(((char *)&(v)) + 1); \
391 *((char *)(p) + 2) = \
392 *(((char *)&(v)) + 2); \
393 *((char *)(p) + 3) = \
394 *(((char *)&(v)) + 3);}
395 #endif
397 #ifndef SK_PNMI_STORE_U64
398 #define SK_PNMI_STORE_U64(p,v) {*(char *)(p) = *((char *)&(v)); \
399 *((char *)(p) + 1) = \
400 *(((char *)&(v)) + 1); \
401 *((char *)(p) + 2) = \
402 *(((char *)&(v)) + 2); \
403 *((char *)(p) + 3) = \
404 *(((char *)&(v)) + 3); \
405 *((char *)(p) + 4) = \
406 *(((char *)&(v)) + 4); \
407 *((char *)(p) + 5) = \
408 *(((char *)&(v)) + 5); \
409 *((char *)(p) + 6) = \
410 *(((char *)&(v)) + 6); \
411 *((char *)(p) + 7) = \
412 *(((char *)&(v)) + 7);}
413 #endif
415 #ifndef SK_PNMI_READ_U16
416 #define SK_PNMI_READ_U16(p,v) {*((char *)&(v)) = *(char *)(p); \
417 *(((char *)&(v)) + 1) = \
418 *((char *)(p) + 1);}
419 #endif
421 #ifndef SK_PNMI_READ_U32
422 #define SK_PNMI_READ_U32(p,v) {*((char *)&(v)) = *(char *)(p); \
423 *(((char *)&(v)) + 1) = \
424 *((char *)(p) + 1); \
425 *(((char *)&(v)) + 2) = \
426 *((char *)(p) + 2); \
427 *(((char *)&(v)) + 3) = \
428 *((char *)(p) + 3);}
429 #endif
431 #ifndef SK_PNMI_READ_U64
432 #define SK_PNMI_READ_U64(p,v) {*((char *)&(v)) = *(char *)(p); \
433 *(((char *)&(v)) + 1) = \
434 *((char *)(p) + 1); \
435 *(((char *)&(v)) + 2) = \
436 *((char *)(p) + 2); \
437 *(((char *)&(v)) + 3) = \
438 *((char *)(p) + 3); \
439 *(((char *)&(v)) + 4) = \
440 *((char *)(p) + 4); \
441 *(((char *)&(v)) + 5) = \
442 *((char *)(p) + 5); \
443 *(((char *)&(v)) + 6) = \
444 *((char *)(p) + 6); \
445 *(((char *)&(v)) + 7) = \
446 *((char *)(p) + 7);}
447 #endif
450 * Macros for Debug
452 #ifdef DEBUG
454 #define SK_PNMI_CHECKFLAGS(vSt) {if (pAC->Pnmi.MacUpdatedFlag > 0 || \
455 pAC->Pnmi.RlmtUpdatedFlag > 0 || \
456 pAC->Pnmi.SirqUpdatedFlag > 0) { \
457 SK_DBG_MSG(pAC, \
458 SK_DBGMOD_PNMI, \
459 SK_DBGCAT_CTRL, \
460 ("PNMI: ERR: %s MacUFlag=%d, RlmtUFlag=%d, SirqUFlag=%d\n", \
461 vSt, \
462 pAC->Pnmi.MacUpdatedFlag, \
463 pAC->Pnmi.RlmtUpdatedFlag, \
464 pAC->Pnmi.SirqUpdatedFlag))}}
466 #else /* !DEBUG */
468 #define SK_PNMI_CHECKFLAGS(vSt) /* Nothing */
470 #endif /* !DEBUG */
472 #endif /* _SKGEPNM2_H_ */