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