1 /******************************************************************************
2  *
3  * Name:	skgeinit.h
4  * Project:	Gigabit Ethernet Adapters, Common Modules
5  * Purpose:	Structures and prototypes for the GE Init Module
6  *
7  ******************************************************************************/
8 
9 /******************************************************************************
10  *
11  *	(C)Copyright 1998-2002 SysKonnect.
12  *	(C)Copyright 2002-2003 Marvell.
13  *
14  *	This program is free software; you can redistribute it and/or modify
15  *	it under the terms of the GNU General Public License as published by
16  *	the Free Software Foundation; either version 2 of the License, or
17  *	(at your option) any later version.
18  *
19  *	The information in this file is provided "AS IS" without warranty.
20  *
21  ******************************************************************************/
22 
23 #ifndef __INC_SKGEINIT_H_
24 #define __INC_SKGEINIT_H_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif	/* __cplusplus */
29 
30 /* defines ********************************************************************/
31 
32 #define SK_TEST_VAL		0x11335577UL
33 
34 /* modifying Link LED behaviour (used with SkGeLinkLED()) */
35 #define SK_LNK_OFF		LED_OFF
36 #define SK_LNK_ON		(LED_ON | LED_BLK_OFF | LED_SYNC_OFF)
37 #define SK_LNK_BLINK	(LED_ON | LED_BLK_ON  | LED_SYNC_ON)
38 #define SK_LNK_PERM		(LED_ON | LED_BLK_OFF | LED_SYNC_ON)
39 #define SK_LNK_TST		(LED_ON | LED_BLK_ON  | LED_SYNC_OFF)
40 
41 /* parameter 'Mode' when calling SK_HWAC_LINK_LED() */
42 #define SK_LED_OFF		LED_OFF
43 #define SK_LED_ACTIVE	(LED_ON | LED_BLK_OFF | LED_SYNC_OFF)
44 #define SK_LED_STANDBY	(LED_ON | LED_BLK_ON  | LED_SYNC_OFF)
45 
46 /* addressing LED Registers in SkGeXmitLED() */
47 #define XMIT_LED_INI	0
48 #define XMIT_LED_CNT	(RX_LED_VAL - RX_LED_INI)
49 #define XMIT_LED_CTRL	(RX_LED_CTRL- RX_LED_INI)
50 #define XMIT_LED_TST	(RX_LED_TST - RX_LED_INI)
51 
52 /* parameter 'Mode' when calling SkGeXmitLED() */
53 #define SK_LED_DIS	0
54 #define SK_LED_ENA	1
55 #define SK_LED_TST	2
56 
57 /* Counter and Timer constants, for a host clock of 62.5 MHz */
58 #define SK_XMIT_DUR		0x002faf08UL	/*  50 ms */
59 #define SK_BLK_DUR		0x01dcd650UL	/* 500 ms */
60 
61 #define SK_DPOLL_DEF	0x00ee6b28UL	/* 250 ms at 62.5 MHz */
62 
63 #define SK_DPOLL_MAX	0x00ffffffUL	/* 268 ms at 62.5 MHz */
64 										/* 215 ms at 78.12 MHz */
65 
66 #define SK_FACT_62		100			/* is given in percent */
67 #define SK_FACT_53		 85         /* on GENESIS:	53.12 MHz */
68 #define SK_FACT_78		125			/* on YUKON:	78.12 MHz */
69 
70 /* Timeout values */
71 #define SK_MAC_TO_53	72			/* MAC arbiter timeout */
72 #define SK_PKT_TO_53	0x2000		/* Packet arbiter timeout */
73 #define SK_PKT_TO_MAX	0xffff		/* Maximum value */
74 #define SK_RI_TO_53		36			/* RAM interface timeout */
75 
76 #define SK_PHY_ACC_TO	600000		/* PHY access timeout */
77 
78 /* RAM Buffer High Pause Threshold values */
79 #define SK_RB_ULPP		( 8 * 1024)	/* Upper Level in kB/8 */
80 #define SK_RB_LLPP_S	(10 * 1024)	/* Lower Level for small Queues */
81 #define SK_RB_LLPP_B	(16 * 1024)	/* Lower Level for big Queues */
82 
83 #ifndef SK_BMU_RX_WM
84 #define SK_BMU_RX_WM	0x600		/* BMU Rx Watermark */
85 #endif
86 #ifndef SK_BMU_TX_WM
87 #define SK_BMU_TX_WM	0x600		/* BMU Tx Watermark */
88 #endif
89 
90 /* XMAC II Rx High Watermark */
91 #define SK_XM_RX_HI_WM	0x05aa		/* 1450 */
92 
93 /* XMAC II Tx Threshold */
94 #define SK_XM_THR_REDL	0x01fb		/* .. for redundant link usage */
95 #define SK_XM_THR_SL	0x01fb		/* .. for single link adapters */
96 #define SK_XM_THR_MULL	0x01fb		/* .. for multiple link usage */
97 #define SK_XM_THR_JUMBO	0x03fc		/* .. for jumbo frame usage */
98 
99 /* values for GIPortUsage */
100 #define SK_RED_LINK		1		/* redundant link usage */
101 #define SK_MUL_LINK		2		/* multiple link usage */
102 #define SK_JUMBO_LINK	3		/* driver uses jumbo frames */
103 
104 /* Minimum RAM Buffer Rx Queue Size */
105 #define SK_MIN_RXQ_SIZE	16		/* 16 kB */
106 
107 /* Minimum RAM Buffer Tx Queue Size */
108 #define SK_MIN_TXQ_SIZE	16		/* 16 kB */
109 
110 /* Queue Size units */
111 #define QZ_UNITS		0x7
112 #define QZ_STEP			8
113 
114 /* Percentage of queue size from whole memory */
115 /* 80 % for receive */
116 #define RAM_QUOTA_RX	80L
117 /* 0% for sync transfer */
118 #define	RAM_QUOTA_SYNC	0L
119 /* the rest (20%) is taken for async transfer */
120 
121 /* Get the rounded queue size in Bytes in 8k steps */
122 #define ROUND_QUEUE_SIZE(SizeInBytes)					\
123 	((((unsigned long) (SizeInBytes) + (QZ_STEP*1024L)-1) / 1024) &	\
124 	~(QZ_STEP-1))
125 
126 /* Get the rounded queue size in KBytes in 8k steps */
127 #define ROUND_QUEUE_SIZE_KB(Kilobytes) \
128 	ROUND_QUEUE_SIZE((Kilobytes) * 1024L)
129 
130 /* Types of RAM Buffer Queues */
131 #define SK_RX_SRAM_Q	1	/* small receive queue */
132 #define SK_RX_BRAM_Q	2	/* big receive queue */
133 #define SK_TX_RAM_Q		3	/* small or big transmit queue */
134 
135 /* parameter 'Dir' when calling SkGeStopPort() */
136 #define SK_STOP_TX	1	/* Stops the transmit path, resets the XMAC */
137 #define SK_STOP_RX	2	/* Stops the receive path */
138 #define SK_STOP_ALL	3	/* Stops Rx and Tx path, resets the XMAC */
139 
140 /* parameter 'RstMode' when calling SkGeStopPort() */
141 #define SK_SOFT_RST	1	/* perform a software reset */
142 #define SK_HARD_RST	2	/* perform a hardware reset */
143 
144 /* Init Levels */
145 #define SK_INIT_DATA	0	/* Init level 0: init data structures */
146 #define SK_INIT_IO		1	/* Init level 1: init with IOs */
147 #define SK_INIT_RUN		2	/* Init level 2: init for run time */
148 
149 /* Link Mode Parameter */
150 #define SK_LMODE_HALF		1	/* Half Duplex Mode */
151 #define SK_LMODE_FULL		2	/* Full Duplex Mode */
152 #define SK_LMODE_AUTOHALF	3	/* AutoHalf Duplex Mode */
153 #define SK_LMODE_AUTOFULL	4	/* AutoFull Duplex Mode */
154 #define SK_LMODE_AUTOBOTH	5	/* AutoBoth Duplex Mode */
155 #define SK_LMODE_AUTOSENSE	6	/* configured mode auto sensing */
156 #define SK_LMODE_INDETERMINATED	7	/* indeterminated */
157 
158 /* Auto-negotiation timeout in 100ms granularity */
159 #define SK_AND_MAX_TO		6	/* Wait 600 msec before link comes up */
160 
161 /* Auto-negotiation error codes */
162 #define SK_AND_OK			0	/* no error */
163 #define SK_AND_OTHER		1	/* other error than below */
164 #define SK_AND_DUP_CAP		2	/* Duplex capabilities error */
165 
166 
167 /* Link Speed Capabilities */
168 #define SK_LSPEED_CAP_AUTO			(1<<0)	/* Automatic resolution */
169 #define SK_LSPEED_CAP_10MBPS		(1<<1)	/* 10 Mbps */
170 #define SK_LSPEED_CAP_100MBPS		(1<<2)	/* 100 Mbps */
171 #define SK_LSPEED_CAP_1000MBPS		(1<<3)	/* 1000 Mbps */
172 #define SK_LSPEED_CAP_INDETERMINATED (1<<4) /* indeterminated */
173 
174 /* Link Speed Parameter */
175 #define SK_LSPEED_AUTO				1	/* Automatic resolution */
176 #define SK_LSPEED_10MBPS			2	/* 10 Mbps */
177 #define SK_LSPEED_100MBPS			3	/* 100 Mbps */
178 #define SK_LSPEED_1000MBPS			4	/* 1000 Mbps */
179 #define SK_LSPEED_INDETERMINATED	5	/* indeterminated */
180 
181 /* Link Speed Current State */
182 #define SK_LSPEED_STAT_UNKNOWN		1
183 #define SK_LSPEED_STAT_10MBPS		2
184 #define SK_LSPEED_STAT_100MBPS 		3
185 #define SK_LSPEED_STAT_1000MBPS		4
186 #define SK_LSPEED_STAT_INDETERMINATED 5
187 
188 
189 /* Link Capability Parameter */
190 #define SK_LMODE_CAP_HALF		(1<<0)	/* Half Duplex Mode */
191 #define SK_LMODE_CAP_FULL		(1<<1)	/* Full Duplex Mode */
192 #define SK_LMODE_CAP_AUTOHALF	(1<<2)	/* AutoHalf Duplex Mode */
193 #define SK_LMODE_CAP_AUTOFULL	(1<<3)	/* AutoFull Duplex Mode */
194 #define SK_LMODE_CAP_INDETERMINATED (1<<4) /* indeterminated */
195 
196 /* Link Mode Current State */
197 #define SK_LMODE_STAT_UNKNOWN	1	/* Unknown Duplex Mode */
198 #define SK_LMODE_STAT_HALF		2	/* Half Duplex Mode */
199 #define SK_LMODE_STAT_FULL		3	/* Full Duplex Mode */
200 #define SK_LMODE_STAT_AUTOHALF	4	/* Half Duplex Mode obtained by Auto-Neg */
201 #define SK_LMODE_STAT_AUTOFULL	5	/* Full Duplex Mode obtained by Auto-Neg */
202 #define SK_LMODE_STAT_INDETERMINATED 6	/* indeterminated */
203 
204 /* Flow Control Mode Parameter (and capabilities) */
205 #define SK_FLOW_MODE_NONE		1	/* No Flow-Control */
206 #define SK_FLOW_MODE_LOC_SEND	2	/* Local station sends PAUSE */
207 #define SK_FLOW_MODE_SYMMETRIC	3	/* Both stations may send PAUSE */
208 #define SK_FLOW_MODE_SYM_OR_REM	4	/* Both stations may send PAUSE or
209 					 * just the remote station may send PAUSE
210 					 */
211 #define SK_FLOW_MODE_INDETERMINATED 5	/* indeterminated */
212 
213 /* Flow Control Status Parameter */
214 #define SK_FLOW_STAT_NONE		1	/* No Flow Control */
215 #define SK_FLOW_STAT_REM_SEND	2	/* Remote Station sends PAUSE */
216 #define SK_FLOW_STAT_LOC_SEND	3	/* Local station sends PAUSE */
217 #define SK_FLOW_STAT_SYMMETRIC	4	/* Both station may send PAUSE */
218 #define SK_FLOW_STAT_INDETERMINATED 5	/* indeterminated */
219 
220 /* Master/Slave Mode Capabilities */
221 #define SK_MS_CAP_AUTO		(1<<0)	/* Automatic resolution */
222 #define SK_MS_CAP_MASTER	(1<<1)	/* This station is master */
223 #define SK_MS_CAP_SLAVE		(1<<2)	/* This station is slave */
224 #define SK_MS_CAP_INDETERMINATED (1<<3)	/* indeterminated */
225 
226 /* Set Master/Slave Mode Parameter (and capabilities) */
227 #define SK_MS_MODE_AUTO		1	/* Automatic resolution */
228 #define SK_MS_MODE_MASTER	2	/* This station is master */
229 #define SK_MS_MODE_SLAVE	3	/* This station is slave */
230 #define SK_MS_MODE_INDETERMINATED 4	/* indeterminated */
231 
232 /* Master/Slave Status Parameter */
233 #define SK_MS_STAT_UNSET	1	/* The M/S status is not set */
234 #define SK_MS_STAT_MASTER	2	/* This station is master */
235 #define SK_MS_STAT_SLAVE	3	/* This station is slave */
236 #define SK_MS_STAT_FAULT	4	/* M/S resolution failed */
237 #define SK_MS_STAT_INDETERMINATED 5	/* indeterminated */
238 
239 /* parameter 'Mode' when calling SkXmSetRxCmd() */
240 #define SK_STRIP_FCS_ON		(1<<0)	/* Enable  FCS stripping of Rx frames */
241 #define SK_STRIP_FCS_OFF	(1<<1)	/* Disable FCS stripping of Rx frames */
242 #define SK_STRIP_PAD_ON		(1<<2)	/* Enable  pad byte stripping of Rx fr */
243 #define SK_STRIP_PAD_OFF	(1<<3)	/* Disable pad byte stripping of Rx fr */
244 #define SK_LENERR_OK_ON		(1<<4)	/* Don't chk fr for in range len error */
245 #define SK_LENERR_OK_OFF	(1<<5)	/* Check frames for in range len error */
246 #define SK_BIG_PK_OK_ON		(1<<6)	/* Don't set Rx Error bit for big frames */
247 #define SK_BIG_PK_OK_OFF	(1<<7)	/* Set Rx Error bit for big frames */
248 #define SK_SELF_RX_ON		(1<<8)	/* Enable  Rx of own packets */
249 #define SK_SELF_RX_OFF		(1<<9)	/* Disable Rx of own packets */
250 
251 /* parameter 'Para' when calling SkMacSetRxTxEn() */
252 #define SK_MAC_LOOPB_ON		(1<<0)	/* Enable  MAC Loopback Mode */
253 #define SK_MAC_LOOPB_OFF	(1<<1)	/* Disable MAC Loopback Mode */
254 #define SK_PHY_LOOPB_ON		(1<<2)	/* Enable  PHY Loopback Mode */
255 #define SK_PHY_LOOPB_OFF	(1<<3)	/* Disable PHY Loopback Mode */
256 #define SK_PHY_FULLD_ON		(1<<4)	/* Enable  GMII Full Duplex */
257 #define SK_PHY_FULLD_OFF	(1<<5)	/* Disable GMII Full Duplex */
258 
259 /* States of PState */
260 #define SK_PRT_RESET	0	/* the port is reset */
261 #define SK_PRT_STOP		1	/* the port is stopped (similar to SW reset) */
262 #define SK_PRT_INIT		2	/* the port is initialized */
263 #define SK_PRT_RUN		3	/* the port has an active link */
264 
265 /* PHY power down modes */
266 #define PHY_PM_OPERATIONAL_MODE		0	/* PHY operational mode */
267 #define PHY_PM_DEEP_SLEEP			1	/* coma mode --> minimal power */
268 #define PHY_PM_IEEE_POWER_DOWN		2	/* IEEE 22.2.4.1.5 compl. power down */
269 #define PHY_PM_ENERGY_DETECT		3	/* energy detect */
270 #define PHY_PM_ENERGY_DETECT_PLUS	4	/* energy detect plus */
271 
272 /* Default receive frame limit for Workaround of XMAC Errata */
273 #define SK_DEF_RX_WA_LIM	SK_CONSTU64(100)
274 
275 /* values for GILedBlinkCtrl (LED Blink Control) */
276 #define SK_ACT_LED_BLINK	(1<<0)	/* Active LED blinking */
277 #define SK_DUP_LED_NORMAL	(1<<1)	/* Duplex LED normal */
278 #define SK_LED_LINK100_ON	(1<<2)	/* Link 100M LED on */
279 
280 /* Link Partner Status */
281 #define SK_LIPA_UNKNOWN	0	/* Link partner is in unknown state */
282 #define SK_LIPA_MANUAL	1	/* Link partner is in detected manual state */
283 #define SK_LIPA_AUTO	2	/* Link partner is in auto-negotiation state */
284 
285 /* Maximum Restarts before restart is ignored (3Com WA) */
286 #define SK_MAX_LRESTART	3	/* Max. 3 times the link is restarted */
287 
288 /* Max. Auto-neg. timeouts before link detection in sense mode is reset */
289 #define SK_MAX_ANEG_TO	10	/* Max. 10 times the sense mode is reset */
290 
291 /* structures *****************************************************************/
292 
293 /*
294  * MAC specific functions
295  */
296 typedef struct s_GeMacFunc {
297 	int  (*pFnMacUpdateStats)(SK_AC *pAC, SK_IOC IoC, unsigned int Port);
298 	int  (*pFnMacStatistic)(SK_AC *pAC, SK_IOC IoC, unsigned int Port,
299 							SK_U16 StatAddr, SK_U32 SK_FAR *pVal);
300 	int  (*pFnMacResetCounter)(SK_AC *pAC, SK_IOC IoC, unsigned int Port);
301 	int  (*pFnMacOverflow)(SK_AC *pAC, SK_IOC IoC, unsigned int Port,
302 						   SK_U16 IStatus, SK_U64 SK_FAR *pVal);
303 } SK_GEMACFUNC;
304 
305 /*
306  * Port Structure
307  */
308 typedef	struct s_GePort {
309 #ifndef SK_DIAG
310 	SK_TIMER	PWaTimer;	/* Workaround Timer */
311 	SK_TIMER	HalfDupChkTimer;
312 #endif /* SK_DIAG */
313 	SK_U32	PPrevShorts;	/* Previous Short Counter checking */
314 	SK_U32	PPrevFcs;		/* Previous FCS Error Counter checking */
315 	SK_U64	PPrevRx;		/* Previous RxOk Counter checking */
316 	SK_U64	PRxLim;			/* Previous RxOk Counter checking */
317 	SK_U64	LastOctets;		/* For half duplex hang check */
318 	int		PLinkResCt;		/* Link Restart Counter */
319 	int		PAutoNegTimeOut;/* Auto-negotiation timeout current value */
320 	int		PAutoNegTOCt;	/* Auto-negotiation Timeout Counter */
321 	int		PRxQSize;		/* Port Rx Queue Size in kB */
322 	int		PXSQSize;		/* Port Synchronous  Transmit Queue Size in kB */
323 	int		PXAQSize;		/* Port Asynchronous Transmit Queue Size in kB */
324 	SK_U32	PRxQRamStart;	/* Receive Queue RAM Buffer Start Address */
325 	SK_U32	PRxQRamEnd;		/* Receive Queue RAM Buffer End Address */
326 	SK_U32	PXsQRamStart;	/* Sync Tx Queue RAM Buffer Start Address */
327 	SK_U32	PXsQRamEnd;		/* Sync Tx Queue RAM Buffer End Address */
328 	SK_U32	PXaQRamStart;	/* Async Tx Queue RAM Buffer Start Address */
329 	SK_U32	PXaQRamEnd;		/* Async Tx Queue RAM Buffer End Address */
330 	SK_U32	PRxOverCnt;		/* Receive Overflow Counter */
331 	int		PRxQOff;		/* Rx Queue Address Offset */
332 	int		PXsQOff;		/* Synchronous Tx Queue Address Offset */
333 	int		PXaQOff;		/* Asynchronous Tx Queue Address Offset */
334 	int		PhyType;		/* PHY used on this port */
335 	int		PState;			/* Port status (reset, stop, init, run) */
336 	SK_U16	PhyId1;			/* PHY Id1 on this port */
337 	SK_U16	PhyAddr;		/* MDIO/MDC PHY address */
338 	SK_U16	PIsave;			/* Saved Interrupt status word */
339 	SK_U16	PSsave;			/* Saved PHY status word */
340 	SK_U16	PGmANegAdv;		/* Saved GPhy AutoNegAdvertisment register */
341 	SK_BOOL	PHWLinkUp;		/* The hardware Link is up (wiring) */
342 	SK_BOOL	PLinkBroken;	/* Is Link broken ? */
343 	SK_BOOL	PCheckPar;		/* Do we check for parity errors ? */
344 	SK_BOOL	HalfDupTimerActive;
345 	SK_U8	PLinkCap;		/* Link Capabilities */
346 	SK_U8	PLinkModeConf;	/* Link Mode configured */
347 	SK_U8	PLinkMode;		/* Link Mode currently used */
348 	SK_U8	PLinkModeStatus;/* Link Mode Status */
349 	SK_U8	PLinkSpeedCap;	/* Link Speed Capabilities(10/100/1000 Mbps) */
350 	SK_U8	PLinkSpeed;		/* configured Link Speed (10/100/1000 Mbps) */
351 	SK_U8	PLinkSpeedUsed;	/* current Link Speed (10/100/1000 Mbps) */
352 	SK_U8	PFlowCtrlCap;	/* Flow Control Capabilities */
353 	SK_U8	PFlowCtrlMode;	/* Flow Control Mode */
354 	SK_U8	PFlowCtrlStatus;/* Flow Control Status */
355 	SK_U8	PMSCap;			/* Master/Slave Capabilities */
356 	SK_U8	PMSMode;		/* Master/Slave Mode */
357 	SK_U8	PMSStatus;		/* Master/Slave Status */
358 	SK_BOOL	PAutoNegFail;	/* Auto-negotiation fail flag */
359 	SK_U8	PLipaAutoNeg;	/* Auto-negotiation possible with Link Partner */
360 	SK_U8	PCableLen;		/* Cable Length */
361 	SK_U8	PMdiPairLen[4];	/* MDI[0..3] Pair Length */
362 	SK_U8	PMdiPairSts[4];	/* MDI[0..3] Pair Diagnostic Status */
363 	SK_U8	PPhyPowerState;	/* PHY current power state */
364 	int		PMacColThres;	/* MAC Collision Threshold */
365 	int		PMacJamLen;		/* MAC Jam length */
366 	int		PMacJamIpgVal;	/* MAC Jam IPG */
367 	int		PMacJamIpgData;	/* MAC IPG Jam to Data */
368 	int		PMacIpgData;	/* MAC Data IPG */
369 	SK_BOOL PMacLimit4;		/* reset collision counter and backoff algorithm */
370 } SK_GEPORT;
371 
372 /*
373  * Gigabit Ethernet Initialization Struct
374  * (has to be included in the adapter context)
375  */
376 typedef	struct s_GeInit {
377 	int			GIChipId;		/* Chip Identification Number */
378 	int			GIChipRev;		/* Chip Revision Number */
379 	SK_U8		GIPciHwRev;		/* PCI HW Revision Number */
380 	SK_BOOL		GIGenesis;		/* Genesis adapter ? */
381 	SK_BOOL		GIYukon;		/* YUKON-A1/Bx chip */
382 	SK_BOOL		GIYukonLite;	/* YUKON-Lite chip */
383 	SK_BOOL		GICopperType;	/* Copper Type adapter ? */
384 	SK_BOOL		GIPciSlot64;	/* 64-bit PCI Slot */
385 	SK_BOOL		GIPciClock66;	/* 66 MHz PCI Clock */
386 	SK_BOOL		GIVauxAvail;	/* VAUX available (YUKON) */
387 	SK_BOOL		GIYukon32Bit;	/* 32-Bit YUKON adapter */
388 	SK_U16		GILedBlinkCtrl;	/* LED Blink Control */
389 	int			GIMacsFound;	/* Number of MACs found on this adapter */
390 	int			GIMacType;		/* MAC Type used on this adapter */
391 	int			GIHstClkFact;	/* Host Clock Factor (62.5 / HstClk * 100) */
392 	int			GIPortUsage;	/* Driver Port Usage */
393 	int			GILevel;		/* Initialization Level completed */
394 	int			GIRamSize;		/* The RAM size of the adapter in kB */
395 	int			GIWolOffs;		/* WOL Register Offset (HW-Bug in Rev. A) */
396 	SK_U32		GIRamOffs;		/* RAM Address Offset for addr calculation */
397 	SK_U32		GIPollTimerVal;	/* Descr. Poll Timer Init Val (HstClk ticks) */
398 	SK_U32		GIValIrqMask;	/* Value for Interrupt Mask */
399 	SK_U32		GITimeStampCnt;	/* Time Stamp High Counter (YUKON only) */
400 	SK_GEPORT	GP[SK_MAX_MACS];/* Port Dependent Information */
401 	SK_GEMACFUNC GIFunc;		/* MAC depedent functions */
402 } SK_GEINIT;
403 
404 /*
405  * Error numbers and messages for skxmac2.c and skgeinit.c
406  */
407 #define SKERR_HWI_E001		(SK_ERRBASE_HWINIT)
408 #define SKERR_HWI_E001MSG	"SkXmClrExactAddr() has got illegal parameters"
409 #define SKERR_HWI_E002		(SKERR_HWI_E001+1)
410 #define SKERR_HWI_E002MSG	"SkGeInit(): Level 1 call missing"
411 #define SKERR_HWI_E003		(SKERR_HWI_E002+1)
412 #define SKERR_HWI_E003MSG	"SkGeInit() called with illegal init Level"
413 #define SKERR_HWI_E004		(SKERR_HWI_E003+1)
414 #define SKERR_HWI_E004MSG	"SkGeInitPort(): Queue Size illegal configured"
415 #define SKERR_HWI_E005		(SKERR_HWI_E004+1)
416 #define SKERR_HWI_E005MSG	"SkGeInitPort(): cannot init running ports"
417 #define SKERR_HWI_E006		(SKERR_HWI_E005+1)
418 #define SKERR_HWI_E006MSG	"SkGeMacInit(): PState does not match HW state"
419 #define SKERR_HWI_E007		(SKERR_HWI_E006+1)
420 #define SKERR_HWI_E007MSG	"SkXmInitDupMd() called with invalid Dup Mode"
421 #define SKERR_HWI_E008		(SKERR_HWI_E007+1)
422 #define SKERR_HWI_E008MSG	"SkXmSetRxCmd() called with invalid Mode"
423 #define SKERR_HWI_E009		(SKERR_HWI_E008+1)
424 #define SKERR_HWI_E009MSG	"SkGeCfgSync() called although PXSQSize zero"
425 #define SKERR_HWI_E010		(SKERR_HWI_E009+1)
426 #define SKERR_HWI_E010MSG	"SkGeCfgSync() called with invalid parameters"
427 #define SKERR_HWI_E011		(SKERR_HWI_E010+1)
428 #define SKERR_HWI_E011MSG	"SkGeInitPort(): Receive Queue Size too small"
429 #define SKERR_HWI_E012		(SKERR_HWI_E011+1)
430 #define SKERR_HWI_E012MSG	"SkGeInitPort(): invalid Queue Size specified"
431 #define SKERR_HWI_E013		(SKERR_HWI_E012+1)
432 #define SKERR_HWI_E013MSG	"SkGeInitPort(): cfg changed for running queue"
433 #define SKERR_HWI_E014		(SKERR_HWI_E013+1)
434 #define SKERR_HWI_E014MSG	"SkGeInitPort(): unknown GIPortUsage specified"
435 #define SKERR_HWI_E015		(SKERR_HWI_E014+1)
436 #define SKERR_HWI_E015MSG	"Illegal Link mode parameter"
437 #define SKERR_HWI_E016		(SKERR_HWI_E015+1)
438 #define SKERR_HWI_E016MSG	"Illegal Flow control mode parameter"
439 #define SKERR_HWI_E017		(SKERR_HWI_E016+1)
440 #define SKERR_HWI_E017MSG	"Illegal value specified for GIPollTimerVal"
441 #define SKERR_HWI_E018		(SKERR_HWI_E017+1)
442 #define SKERR_HWI_E018MSG	"FATAL: SkGeStopPort() does not terminate (Tx)"
443 #define SKERR_HWI_E019		(SKERR_HWI_E018+1)
444 #define SKERR_HWI_E019MSG	"Illegal Speed parameter"
445 #define SKERR_HWI_E020		(SKERR_HWI_E019+1)
446 #define SKERR_HWI_E020MSG	"Illegal Master/Slave parameter"
447 #define SKERR_HWI_E021		(SKERR_HWI_E020+1)
448 #define	SKERR_HWI_E021MSG	"MacUpdateStats(): cannot update statistic counter"
449 #define	SKERR_HWI_E022		(SKERR_HWI_E021+1)
450 #define	SKERR_HWI_E022MSG	"MacStatistic(): illegal statistic base address"
451 #define SKERR_HWI_E023		(SKERR_HWI_E022+1)
452 #define SKERR_HWI_E023MSG	"SkGeInitPort(): Transmit Queue Size too small"
453 #define SKERR_HWI_E024		(SKERR_HWI_E023+1)
454 #define SKERR_HWI_E024MSG	"FATAL: SkGeStopPort() does not terminate (Rx)"
455 #define SKERR_HWI_E025		(SKERR_HWI_E024+1)
456 #define SKERR_HWI_E025MSG	""
457 
458 /* function prototypes ********************************************************/
459 
460 #ifndef	SK_KR_PROTO
461 
462 /*
463  * public functions in skgeinit.c
464  */
465 extern void	SkGePollRxD(
466 	SK_AC	*pAC,
467 	SK_IOC	IoC,
468 	int		Port,
469 	SK_BOOL	PollRxD);
470 
471 extern void	SkGePollTxD(
472 	SK_AC	*pAC,
473 	SK_IOC	IoC,
474 	int		Port,
475 	SK_BOOL PollTxD);
476 
477 extern void	SkGeYellowLED(
478 	SK_AC	*pAC,
479 	SK_IOC	IoC,
480 	int		State);
481 
482 extern int	SkGeCfgSync(
483 	SK_AC	*pAC,
484 	SK_IOC	IoC,
485 	int		Port,
486 	SK_U32	IntTime,
487 	SK_U32	LimCount,
488 	int		SyncMode);
489 
490 extern void	SkGeLoadLnkSyncCnt(
491 	SK_AC	*pAC,
492 	SK_IOC	IoC,
493 	int		Port,
494 	SK_U32	CntVal);
495 
496 extern void	SkGeStopPort(
497 	SK_AC	*pAC,
498 	SK_IOC	IoC,
499 	int		Port,
500 	int		Dir,
501 	int		RstMode);
502 
503 extern int	SkGeInit(
504 	SK_AC	*pAC,
505 	SK_IOC	IoC,
506 	int		Level);
507 
508 extern void	SkGeDeInit(
509 	SK_AC	*pAC,
510 	SK_IOC	IoC);
511 
512 extern int	SkGeInitPort(
513 	SK_AC	*pAC,
514 	SK_IOC	IoC,
515 	int		Port);
516 
517 extern void	SkGeXmitLED(
518 	SK_AC	*pAC,
519 	SK_IOC	IoC,
520 	int		Led,
521 	int		Mode);
522 
523 extern void	SkGeInitRamIface(
524 	SK_AC	*pAC,
525 	SK_IOC	IoC);
526 
527 extern int	SkGeInitAssignRamToQueues(
528 	SK_AC	*pAC,
529 	int		ActivePort,
530 	SK_BOOL	DualNet);
531 
532 /*
533  * public functions in skxmac2.c
534  */
535 extern void SkMacRxTxDisable(
536 	SK_AC	*pAC,
537 	SK_IOC	IoC,
538 	int		Port);
539 
540 extern void	SkMacSoftRst(
541 	SK_AC	*pAC,
542 	SK_IOC	IoC,
543 	int		Port);
544 
545 extern void	SkMacHardRst(
546 	SK_AC	*pAC,
547 	SK_IOC	IoC,
548 	int		Port);
549 
550 extern void	SkMacClearRst(
551 	SK_AC	*pAC,
552 	SK_IOC	IoC,
553 	int		Port);
554 
555 extern void	SkXmInitMac(
556 	SK_AC	*pAC,
557 	SK_IOC	IoC,
558 	int		Port);
559 
560 extern void	SkGmInitMac(
561 	SK_AC	*pAC,
562 	SK_IOC	IoC,
563 	int		Port);
564 
565 extern void SkMacInitPhy(
566 	SK_AC	*pAC,
567 	SK_IOC	IoC,
568 	int		Port,
569 	SK_BOOL	DoLoop);
570 
571 extern void SkMacIrqDisable(
572 	SK_AC	*pAC,
573 	SK_IOC	IoC,
574 	int		Port);
575 
576 extern void	SkMacFlushTxFifo(
577 	SK_AC	*pAC,
578 	SK_IOC	IoC,
579 	int		Port);
580 
581 extern void	SkMacFlushRxFifo(
582 	SK_AC	*pAC,
583 	SK_IOC	IoC,
584 	int		Port);
585 
586 extern void	SkMacIrq(
587 	SK_AC	*pAC,
588 	SK_IOC	IoC,
589 	int		Port);
590 
591 extern int	SkMacAutoNegDone(
592 	SK_AC	*pAC,
593 	SK_IOC	IoC,
594 	int		Port);
595 
596 extern void	SkMacAutoNegLipaPhy(
597 	SK_AC	*pAC,
598 	SK_IOC	IoC,
599 	int		Port,
600 	SK_U16	IStatus);
601 
602 extern void  SkMacSetRxTxEn(
603 	SK_AC	*pAC,
604 	SK_IOC	IoC,
605 	int		Port,
606 	int		Para);
607 
608 extern int  SkMacRxTxEnable(
609 	SK_AC	*pAC,
610 	SK_IOC	IoC,
611 	int		Port);
612 
613 extern void	SkMacPromiscMode(
614 	SK_AC	*pAC,
615 	SK_IOC	IoC,
616 	int		Port,
617 	SK_BOOL	Enable);
618 
619 extern void	SkMacHashing(
620 	SK_AC	*pAC,
621 	SK_IOC	IoC,
622 	int		Port,
623 	SK_BOOL	Enable);
624 
625 extern void	SkXmPhyRead(
626 	SK_AC	*pAC,
627 	SK_IOC	IoC,
628 	int		Port,
629 	int		Addr,
630 	SK_U16	SK_FAR *pVal);
631 
632 extern void	SkXmPhyWrite(
633 	SK_AC	*pAC,
634 	SK_IOC	IoC,
635 	int		Port,
636 	int		Addr,
637 	SK_U16	Val);
638 
639 extern void	SkGmPhyRead(
640 	SK_AC	*pAC,
641 	SK_IOC	IoC,
642 	int		Port,
643 	int		Addr,
644 	SK_U16	SK_FAR *pVal);
645 
646 extern void	SkGmPhyWrite(
647 	SK_AC	*pAC,
648 	SK_IOC	IoC,
649 	int		Port,
650 	int		Addr,
651 	SK_U16	Val);
652 
653 extern void	SkXmClrExactAddr(
654 	SK_AC	*pAC,
655 	SK_IOC	IoC,
656 	int		Port,
657 	int		StartNum,
658 	int		StopNum);
659 
660 extern void	SkXmInitDupMd(
661 	SK_AC	*pAC,
662 	SK_IOC	IoC,
663 	int		Port);
664 
665 extern void	SkXmInitPauseMd(
666 	SK_AC	*pAC,
667 	SK_IOC	IoC,
668 	int		Port);
669 
670 extern void	SkXmAutoNegLipaXmac(
671 	SK_AC	*pAC,
672 	SK_IOC	IoC,
673 	int		Port,
674 	SK_U16	IStatus);
675 
676 extern int SkXmUpdateStats(
677 	SK_AC	*pAC,
678 	SK_IOC	IoC,
679 	unsigned int Port);
680 
681 extern int SkGmUpdateStats(
682 	SK_AC	*pAC,
683 	SK_IOC	IoC,
684 	unsigned int Port);
685 
686 extern int SkXmMacStatistic(
687 	SK_AC	*pAC,
688 	SK_IOC	IoC,
689 	unsigned int Port,
690 	SK_U16	StatAddr,
691 	SK_U32	SK_FAR *pVal);
692 
693 extern int SkGmMacStatistic(
694 	SK_AC	*pAC,
695 	SK_IOC	IoC,
696 	unsigned int Port,
697 	SK_U16	StatAddr,
698 	SK_U32	SK_FAR *pVal);
699 
700 extern int SkXmResetCounter(
701 	SK_AC	*pAC,
702 	SK_IOC	IoC,
703 	unsigned int Port);
704 
705 extern int SkGmResetCounter(
706 	SK_AC	*pAC,
707 	SK_IOC	IoC,
708 	unsigned int Port);
709 
710 extern int SkXmOverflowStatus(
711 	SK_AC	*pAC,
712 	SK_IOC	IoC,
713 	unsigned int Port,
714 	SK_U16  IStatus,
715 	SK_U64	SK_FAR *pStatus);
716 
717 extern int SkGmOverflowStatus(
718 	SK_AC	*pAC,
719 	SK_IOC	IoC,
720 	unsigned int Port,
721 	SK_U16	MacStatus,
722 	SK_U64	SK_FAR *pStatus);
723 
724 extern int SkGmCableDiagStatus(
725 	SK_AC	*pAC,
726 	SK_IOC	IoC,
727 	int		Port,
728 	SK_BOOL	StartTest);
729 
730 extern int SkGmEnterLowPowerMode(
731 	SK_AC	*pAC,
732 	SK_IOC	IoC,
733 	int		Port,
734 	SK_U8	Mode);
735 
736 extern int SkGmLeaveLowPowerMode(
737 	SK_AC	*pAC,
738 	SK_IOC	IoC,
739 	int		Port);
740 
741 #ifdef SK_DIAG
742 extern void	SkGePhyRead(
743 	SK_AC	*pAC,
744 	SK_IOC	IoC,
745 	int		Port,
746 	int		Addr,
747 	SK_U16	*pVal);
748 
749 extern void	SkGePhyWrite(
750 	SK_AC	*pAC,
751 	SK_IOC	IoC,
752 	int		Port,
753 	int		Addr,
754 	SK_U16	Val);
755 
756 extern void	SkMacSetRxCmd(
757 	SK_AC	*pAC,
758 	SK_IOC	IoC,
759 	int		Port,
760 	int		Mode);
761 extern void	SkMacCrcGener(
762 	SK_AC	*pAC,
763 	SK_IOC	IoC,
764 	int		Port,
765 	SK_BOOL	Enable);
766 extern void	SkMacTimeStamp(
767 	SK_AC	*pAC,
768 	SK_IOC	IoC,
769 	int		Port,
770 	SK_BOOL	Enable);
771 extern void	SkXmSendCont(
772 	SK_AC	*pAC,
773 	SK_IOC	IoC,
774 	int		Port,
775 	SK_BOOL	Enable);
776 #endif /* SK_DIAG */
777 
778 #else	/* SK_KR_PROTO */
779 
780 /*
781  * public functions in skgeinit.c
782  */
783 extern void	SkGePollRxD();
784 extern void	SkGePollTxD();
785 extern void	SkGeYellowLED();
786 extern int	SkGeCfgSync();
787 extern void	SkGeLoadLnkSyncCnt();
788 extern void	SkGeStopPort();
789 extern int	SkGeInit();
790 extern void	SkGeDeInit();
791 extern int	SkGeInitPort();
792 extern void	SkGeXmitLED();
793 extern void	SkGeInitRamIface();
794 extern int	SkGeInitAssignRamToQueues();
795 
796 /*
797  * public functions in skxmac2.c
798  */
799 extern void SkMacRxTxDisable();
800 extern void	SkMacSoftRst();
801 extern void	SkMacHardRst();
802 extern void	SkMacClearRst();
803 extern void SkMacInitPhy();
804 extern int  SkMacRxTxEnable();
805 extern void SkMacPromiscMode();
806 extern void SkMacHashing();
807 extern void SkMacIrqDisable();
808 extern void	SkMacFlushTxFifo();
809 extern void	SkMacFlushRxFifo();
810 extern void	SkMacIrq();
811 extern int	SkMacAutoNegDone();
812 extern void	SkMacAutoNegLipaPhy();
813 extern void SkMacSetRxTxEn();
814 extern void	SkXmInitMac();
815 extern void	SkXmPhyRead();
816 extern void	SkXmPhyWrite();
817 extern void	SkGmInitMac();
818 extern void	SkGmPhyRead();
819 extern void	SkGmPhyWrite();
820 extern void	SkXmClrExactAddr();
821 extern void	SkXmInitDupMd();
822 extern void	SkXmInitPauseMd();
823 extern void	SkXmAutoNegLipaXmac();
824 extern int	SkXmUpdateStats();
825 extern int	SkGmUpdateStats();
826 extern int	SkXmMacStatistic();
827 extern int	SkGmMacStatistic();
828 extern int	SkXmResetCounter();
829 extern int	SkGmResetCounter();
830 extern int	SkXmOverflowStatus();
831 extern int	SkGmOverflowStatus();
832 extern int	SkGmCableDiagStatus();
833 extern int	SkGmEnterLowPowerMode();
834 extern int	SkGmLeaveLowPowerMode();
835 
836 #ifdef SK_DIAG
837 extern void	SkGePhyRead();
838 extern void	SkGePhyWrite();
839 extern void	SkMacSetRxCmd();
840 extern void	SkMacCrcGener();
841 extern void	SkMacTimeStamp();
842 extern void	SkXmSendCont();
843 #endif /* SK_DIAG */
844 
845 #endif	/* SK_KR_PROTO */
846 
847 #ifdef __cplusplus
848 }
849 #endif	/* __cplusplus */
850 
851 #endif	/* __INC_SKGEINIT_H_ */
852