1 /******************************************************************************
2  *
3  * Name:	skgehw.h
4  * Project:	Gigabit Ethernet Adapters, Common Modules
5  * Purpose:	Defines and Macros for the Gigabit Ethernet Adapter Product Family
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_SKGEHW_H
24 #define __INC_SKGEHW_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif	/* __cplusplus */
29 
30 /* defines ********************************************************************/
31 
32 #define BIT_31		(1UL << 31)
33 #define BIT_30		(1L << 30)
34 #define BIT_29		(1L << 29)
35 #define BIT_28		(1L << 28)
36 #define BIT_27		(1L << 27)
37 #define BIT_26		(1L << 26)
38 #define BIT_25		(1L << 25)
39 #define BIT_24		(1L << 24)
40 #define BIT_23		(1L << 23)
41 #define BIT_22		(1L << 22)
42 #define BIT_21		(1L << 21)
43 #define BIT_20		(1L << 20)
44 #define BIT_19		(1L << 19)
45 #define BIT_18		(1L << 18)
46 #define BIT_17		(1L << 17)
47 #define BIT_16		(1L << 16)
48 #define BIT_15		(1L << 15)
49 #define BIT_14		(1L << 14)
50 #define BIT_13		(1L << 13)
51 #define BIT_12		(1L << 12)
52 #define BIT_11		(1L << 11)
53 #define BIT_10		(1L << 10)
54 #define BIT_9		(1L << 9)
55 #define BIT_8		(1L << 8)
56 #define BIT_7		(1L << 7)
57 #define BIT_6		(1L << 6)
58 #define BIT_5		(1L << 5)
59 #define BIT_4		(1L << 4)
60 #define BIT_3		(1L << 3)
61 #define BIT_2		(1L << 2)
62 #define BIT_1		(1L << 1)
63 #define BIT_0		1L
64 
65 #define BIT_15S		(1U << 15)
66 #define BIT_14S		(1 << 14)
67 #define BIT_13S		(1 << 13)
68 #define BIT_12S		(1 << 12)
69 #define BIT_11S		(1 << 11)
70 #define BIT_10S		(1 << 10)
71 #define BIT_9S		(1 << 9)
72 #define BIT_8S		(1 << 8)
73 #define BIT_7S 		(1 << 7)
74 #define BIT_6S		(1 << 6)
75 #define BIT_5S		(1 << 5)
76 #define BIT_4S		(1 << 4)
77 #define BIT_3S		(1 << 3)
78 #define BIT_2S		(1 << 2)
79 #define BIT_1S		(1 << 1)
80 #define BIT_0S		1
81 
82 #define SHIFT31(x)	((x) << 31)
83 #define SHIFT30(x)	((x) << 30)
84 #define SHIFT29(x)	((x) << 29)
85 #define SHIFT28(x)	((x) << 28)
86 #define SHIFT27(x)	((x) << 27)
87 #define SHIFT26(x)	((x) << 26)
88 #define SHIFT25(x)	((x) << 25)
89 #define SHIFT24(x)	((x) << 24)
90 #define SHIFT23(x)	((x) << 23)
91 #define SHIFT22(x)	((x) << 22)
92 #define SHIFT21(x)	((x) << 21)
93 #define SHIFT20(x)	((x) << 20)
94 #define SHIFT19(x)	((x) << 19)
95 #define SHIFT18(x)	((x) << 18)
96 #define SHIFT17(x)	((x) << 17)
97 #define SHIFT16(x)	((x) << 16)
98 #define SHIFT15(x)	((x) << 15)
99 #define SHIFT14(x)	((x) << 14)
100 #define SHIFT13(x)	((x) << 13)
101 #define SHIFT12(x)	((x) << 12)
102 #define SHIFT11(x)	((x) << 11)
103 #define SHIFT10(x)	((x) << 10)
104 #define SHIFT9(x)	((x) << 9)
105 #define SHIFT8(x)	((x) << 8)
106 #define SHIFT7(x)	((x) << 7)
107 #define SHIFT6(x)	((x) << 6)
108 #define SHIFT5(x)	((x) << 5)
109 #define SHIFT4(x)	((x) << 4)
110 #define SHIFT3(x)	((x) << 3)
111 #define SHIFT2(x)	((x) << 2)
112 #define SHIFT1(x)	((x) << 1)
113 #define SHIFT0(x)	((x) << 0)
114 
115 /*
116  * Configuration Space header
117  * Since this module is used for different OS', those may be
118  * duplicate on some of them (e.g. Linux). But to keep the
119  * common source, we have to live with this...
120  */
121 #define PCI_VENDOR_ID	0x00	/* 16 bit	Vendor ID */
122 #define PCI_DEVICE_ID	0x02	/* 16 bit	Device ID */
123 #define PCI_COMMAND		0x04	/* 16 bit	Command */
124 #define PCI_STATUS		0x06	/* 16 bit	Status */
125 #define PCI_REV_ID		0x08	/*  8 bit	Revision ID */
126 #define PCI_CLASS_CODE	0x09	/* 24 bit	Class Code */
127 #define PCI_CACHE_LSZ	0x0c	/*  8 bit	Cache Line Size */
128 #define PCI_LAT_TIM		0x0d	/*  8 bit	Latency Timer */
129 #define PCI_HEADER_T	0x0e	/*  8 bit	Header Type */
130 #define PCI_BIST		0x0f	/*  8 bit	Built-in selftest */
131 #define PCI_BASE_1ST	0x10	/* 32 bit	1st Base address */
132 #define PCI_BASE_2ND	0x14	/* 32 bit	2nd Base address */
133 	/* Byte 0x18..0x2b:	reserved */
134 #define PCI_SUB_VID		0x2c	/* 16 bit	Subsystem Vendor ID */
135 #define PCI_SUB_ID		0x2e	/* 16 bit	Subsystem ID */
136 #define PCI_BASE_ROM	0x30	/* 32 bit	Expansion ROM Base Address */
137 #define PCI_CAP_PTR		0x34	/*  8 bit 	Capabilities Ptr */
138 	/* Byte 0x35..0x3b:	reserved */
139 #define PCI_IRQ_LINE	0x3c	/*  8 bit	Interrupt Line */
140 #define PCI_IRQ_PIN		0x3d	/*  8 bit	Interrupt Pin */
141 #define PCI_MIN_GNT		0x3e	/*  8 bit	Min_Gnt */
142 #define PCI_MAX_LAT		0x3f	/*  8 bit	Max_Lat */
143 	/* Device Dependent Region */
144 #define PCI_OUR_REG_1	0x40	/* 32 bit 	Our Register 1 */
145 #define PCI_OUR_REG_2	0x44	/* 32 bit 	Our Register 2 */
146 	/* Power Management Region */
147 #define PCI_PM_CAP_ID	0x48	/*  8 bit 	Power Management Cap. ID */
148 #define PCI_PM_NITEM	0x49	/*  8 bit 	Next Item Ptr */
149 #define PCI_PM_CAP_REG	0x4a	/* 16 bit 	Power Management Capabilities */
150 #define PCI_PM_CTL_STS	0x4c	/* 16 bit 	Power Manag. Control/Status */
151 	/* Byte 0x4e:	reserved */
152 #define PCI_PM_DAT_REG	0x4f	/*  8 bit 	Power Manag. Data Register */
153 	/* VPD Region */
154 #define PCI_VPD_CAP_ID	0x50	/*  8 bit 	VPD Cap. ID */
155 #define PCI_VPD_NITEM	0x51	/*  8 bit 	Next Item Ptr */
156 #define PCI_VPD_ADR_REG	0x52	/* 16 bit 	VPD Address Register */
157 #define PCI_VPD_DAT_REG	0x54	/* 32 bit 	VPD Data Register */
158 	/* Byte 0x58..0x59:	reserved */
159 #define PCI_SER_LD_CTRL	0x5a	/* 16 bit 	SEEPROM Loader Ctrl (YUKON only) */
160 	/* Byte 0x5c..0xff:	reserved */
161 
162 /*
163  * I2C Address (PCI Config)
164  *
165  * Note: The temperature and voltage sensors are relocated on a different
166  *	 I2C bus.
167  */
168 #define I2C_ADDR_VPD	0xa0	/* I2C address for the VPD EEPROM */
169 
170 /*
171  * Define Bits and Values of the registers
172  */
173 /*	PCI_COMMAND	16 bit	Command */
174 								/* Bit 15..11:	reserved */
175 #define PCI_INT_DIS		BIT_10S		/* Interrupt INTx# disable (PCI 2.3) */
176 #define PCI_FBTEN		BIT_9S		/* Fast Back-To-Back enable */
177 #define PCI_SERREN		BIT_8S		/* SERR enable */
178 #define PCI_ADSTEP		BIT_7S		/* Address Stepping */
179 #define PCI_PERREN		BIT_6S		/* Parity Report Response enable */
180 #define PCI_VGA_SNOOP	BIT_5S		/* VGA palette snoop */
181 #define PCI_MWIEN		BIT_4S		/* Memory write an inv cycl ena */
182 #define PCI_SCYCEN		BIT_3S		/* Special Cycle enable */
183 #define PCI_BMEN		BIT_2S		/* Bus Master enable */
184 #define PCI_MEMEN		BIT_1S		/* Memory Space Access enable */
185 #define PCI_IOEN		BIT_0S		/* I/O Space Access enable */
186 
187 #define PCI_COMMAND_VAL	(PCI_FBTEN | PCI_SERREN | PCI_PERREN | PCI_MWIEN |\
188 						 PCI_BMEN | PCI_MEMEN | PCI_IOEN)
189 
190 /*	PCI_STATUS	16 bit	Status */
191 #define PCI_PERR		BIT_15S		/* Parity Error */
192 #define PCI_SERR		BIT_14S		/* Signaled SERR */
193 #define PCI_RMABORT		BIT_13S		/* Received Master Abort */
194 #define PCI_RTABORT		BIT_12S		/* Received Target Abort */
195 								/* Bit 11:	reserved */
196 #define PCI_DEVSEL		(3<<9)		/* Bit 10.. 9:	DEVSEL Timing */
197 #define PCI_DEV_FAST	(0<<9)		/*		fast */
198 #define PCI_DEV_MEDIUM	(1<<9)		/*		medium */
199 #define PCI_DEV_SLOW	(2<<9)		/*		slow */
200 #define PCI_DATAPERR	BIT_8S		/* DATA Parity error detected */
201 #define PCI_FB2BCAP		BIT_7S		/* Fast Back-to-Back Capability */
202 #define PCI_UDF			BIT_6S		/* User Defined Features */
203 #define PCI_66MHZCAP	BIT_5S		/* 66 MHz PCI bus clock capable */
204 #define PCI_NEWCAP		BIT_4S		/* New cap. list implemented */
205 #define PCI_INT_STAT	BIT_3S		/* Interrupt INTx# Status (PCI 2.3) */
206 								/* Bit  2.. 0:	reserved */
207 
208 #define PCI_ERRBITS	(PCI_PERR | PCI_SERR | PCI_RMABORT | PCI_RTABORT |\
209 			PCI_DATAPERR)
210 
211 /*	PCI_CLASS_CODE	24 bit	Class Code */
212 /*	Byte 2:		Base Class		(02) */
213 /*	Byte 1:		SubClass		(00) */
214 /*	Byte 0:		Programming Interface	(00) */
215 
216 /*	PCI_CACHE_LSZ	8 bit	Cache Line Size */
217 /*	Possible values: 0,2,4,8,16,32,64,128	*/
218 
219 /*	PCI_HEADER_T	8 bit	Header Type */
220 #define PCI_HD_MF_DEV	BIT_7S	/* 0= single, 1= multi-func dev */
221 #define PCI_HD_TYPE		0x7f	/* Bit 6..0:	Header Layout 0= normal */
222 
223 /*	PCI_BIST	8 bit	Built-in selftest */
224 /*	Built-in Self test not supported (optional) */
225 
226 /*	PCI_BASE_1ST	32 bit	1st Base address */
227 #define PCI_MEMSIZE		0x4000L		/* use 16 kB Memory Base */
228 #define PCI_MEMBASE_MSK 0xffffc000L	/* Bit 31..14:	Memory Base Address */
229 #define PCI_MEMSIZE_MSK 0x00003ff0L	/* Bit 13.. 4:	Memory Size Req. */
230 #define PCI_PREFEN		BIT_3		/* Prefetchable */
231 #define PCI_MEM_TYP		(3L<<2)		/* Bit	2.. 1:	Memory Type */
232 #define PCI_MEM32BIT	(0L<<1)		/* Base addr anywhere in 32 Bit range */
233 #define PCI_MEM1M		(1L<<1)		/* Base addr below 1 MegaByte */
234 #define PCI_MEM64BIT	(2L<<1)		/* Base addr anywhere in 64 Bit range */
235 #define PCI_MEMSPACE	BIT_0		/* Memory Space Indicator */
236 
237 /*	PCI_BASE_2ND	32 bit	2nd Base address */
238 #define PCI_IOBASE		0xffffff00L	/* Bit 31.. 8:	I/O Base address */
239 #define PCI_IOSIZE		0x000000fcL	/* Bit	7.. 2:	I/O Size Requirements */
240 									/* Bit	1:	reserved */
241 #define PCI_IOSPACE		BIT_0		/* I/O Space Indicator */
242 
243 /*	PCI_BASE_ROM	32 bit	Expansion ROM Base Address */
244 #define PCI_ROMBASE_MSK	0xfffe0000L	/* Bit 31..17:	ROM Base address */
245 #define PCI_ROMBASE_SIZ	(0x1cL<<14)	/* Bit 16..14:	Treat as Base or Size */
246 #define PCI_ROMSIZE		(0x38L<<11)	/* Bit 13..11:	ROM Size Requirements */
247 									/* Bit 10.. 1:	reserved */
248 #define PCI_ROMEN		BIT_0		/* Address Decode enable */
249 
250 /* Device Dependent Region */
251 /*	PCI_OUR_REG_1		32 bit	Our Register 1 */
252 									/* Bit 31..29:	reserved */
253 #define PCI_PHY_COMA	BIT_28		/* Set PHY to Coma Mode (YUKON only) */
254 #define PCI_TEST_CAL	BIT_27		/* Test PCI buffer calib. (YUKON only) */
255 #define PCI_EN_CAL		BIT_26		/* Enable PCI buffer calib. (YUKON only) */
256 #define PCI_VIO			BIT_25		/* PCI I/O Voltage, 0 = 3.3V, 1 = 5V */
257 #define PCI_DIS_BOOT	BIT_24		/* Disable BOOT via ROM */
258 #define PCI_EN_IO		BIT_23		/* Mapping to I/O space */
259 #define PCI_EN_FPROM	BIT_22		/* Enable FLASH mapping to memory */
260 									/*		1 = Map Flash to memory */
261 									/*		0 = Disable addr. dec */
262 #define PCI_PAGESIZE	(3L<<20)	/* Bit 21..20:	FLASH Page Size	*/
263 #define PCI_PAGE_16		(0L<<20)	/*		16 k pages	*/
264 #define PCI_PAGE_32K	(1L<<20)	/*		32 k pages	*/
265 #define PCI_PAGE_64K	(2L<<20)	/*		64 k pages	*/
266 #define PCI_PAGE_128K	(3L<<20)	/*		128 k pages	*/
267 									/* Bit 19:	reserved	*/
268 #define PCI_PAGEREG		(7L<<16)	/* Bit 18..16:	Page Register	*/
269 #define PCI_NOTAR		BIT_15		/* No turnaround cycle */
270 #define PCI_FORCE_BE	BIT_14		/* Assert all BEs on MR */
271 #define PCI_DIS_MRL		BIT_13		/* Disable Mem Read Line */
272 #define PCI_DIS_MRM		BIT_12		/* Disable Mem Read Multiple */
273 #define PCI_DIS_MWI		BIT_11		/* Disable Mem Write & Invalidate */
274 #define PCI_DISC_CLS	BIT_10		/* Disc: cacheLsz bound */
275 #define PCI_BURST_DIS	BIT_9		/* Burst Disable */
276 #define PCI_DIS_PCI_CLK	BIT_8		/* Disable PCI clock driving */
277 #define PCI_SKEW_DAS	(0xfL<<4)	/* Bit	7.. 4:	Skew Ctrl, DAS Ext */
278 #define PCI_SKEW_BASE	0xfL		/* Bit	3.. 0:	Skew Ctrl, Base	*/
279 
280 
281 /*	PCI_OUR_REG_2		32 bit	Our Register 2 */
282 #define PCI_VPD_WR_THR	(0xffL<<24)	/* Bit 31..24:	VPD Write Threshold */
283 #define PCI_DEV_SEL		(0x7fL<<17)	/* Bit 23..17:	EEPROM Device Select */
284 #define PCI_VPD_ROM_SZ	(7L<<14)	/* Bit 16..14:	VPD ROM Size	*/
285 									/* Bit 13..12:	reserved	*/
286 #define PCI_PATCH_DIR	(0xfL<<8)	/* Bit 11.. 8:	Ext Patches dir 3..0 */
287 #define PCI_PATCH_DIR_3	BIT_11
288 #define PCI_PATCH_DIR_2	BIT_10
289 #define PCI_PATCH_DIR_1	BIT_9
290 #define PCI_PATCH_DIR_0	BIT_8
291 #define PCI_EXT_PATCHS	(0xfL<<4)	/* Bit	7.. 4:	Extended Patches 3..0 */
292 #define PCI_EXT_PATCH_3	BIT_7
293 #define PCI_EXT_PATCH_2	BIT_6
294 #define PCI_EXT_PATCH_1	BIT_5
295 #define PCI_EXT_PATCH_0	BIT_4
296 #define PCI_EN_DUMMY_RD	BIT_3		/* Enable Dummy Read */
297 #define PCI_REV_DESC	BIT_2		/* Reverse Desc. Bytes */
298 									/* Bit	1:	reserved */
299 #define PCI_USEDATA64	BIT_0		/* Use 64Bit Data bus ext */
300 
301 
302 /* Power Management Region */
303 /*	PCI_PM_CAP_REG		16 bit	Power Management Capabilities */
304 #define PCI_PME_SUP_MSK	(0x1f<<11)	/* Bit 15..11:	PM Event Support Mask */
305 #define PCI_PME_D3C_SUP	BIT_15S		/* PME from D3cold Support (if Vaux) */
306 #define PCI_PME_D3H_SUP	BIT_14S		/* PME from D3hot Support */
307 #define PCI_PME_D2_SUP	BIT_13S		/* PME from D2 Support */
308 #define PCI_PME_D1_SUP	BIT_12S		/* PME from D1 Support */
309 #define PCI_PME_D0_SUP	BIT_11S		/* PME from D0 Support */
310 #define PCI_PM_D2_SUP	BIT_10S		/* D2 Support in 33 MHz mode */
311 #define PCI_PM_D1_SUP	BIT_9S		/* D1 Support */
312 									/* Bit	8.. 6:	reserved */
313 #define PCI_PM_DSI		BIT_5S		/* Device Specific Initialization */
314 #define PCI_PM_APS		BIT_4S		/* Auxialiary Power Source */
315 #define PCI_PME_CLOCK	BIT_3S		/* PM Event Clock */
316 #define PCI_PM_VER_MSK		7		/* Bit	2.. 0:	PM PCI Spec. version */
317 
318 /*	PCI_PM_CTL_STS		16 bit	Power Management Control/Status */
319 #define PCI_PME_STATUS	BIT_15S		/* PME Status (YUKON only) */
320 #define PCI_PM_DAT_SCL	(3<<13)		/* Bit 14..13:	Data Reg. scaling factor */
321 #define PCI_PM_DAT_SEL	(0xf<<9)	/* Bit 12.. 9:	PM data selector field */
322 #define PCI_PME_EN		BIT_8S		/* Enable PME# generation (YUKON only) */
323 									/* Bit	7.. 2:	reserved */
324 #define PCI_PM_STATE_MSK	3		/* Bit	1.. 0:	Power Management State */
325 
326 #define PCI_PM_STATE_D0		0		/* D0:	Operational (default) */
327 #define PCI_PM_STATE_D1		1		/* D1:	(YUKON only) */
328 #define PCI_PM_STATE_D2		2		/* D2:	(YUKON only) */
329 #define PCI_PM_STATE_D3 	3		/* D3:	HOT, Power Down and Reset */
330 
331 /* VPD Region */
332 /*	PCI_VPD_ADR_REG		16 bit	VPD Address Register */
333 #define PCI_VPD_FLAG	BIT_15S		/* starts VPD rd/wr cycle */
334 #define PCI_VPD_ADR_MSK	0x7fffL		/* Bit 14.. 0:	VPD address mask */
335 
336 /*	Control Register File (Address Map) */
337 
338 /*
339  *	Bank 0
340  */
341 #define B0_RAP			0x0000	/*  8 bit	Register Address Port */
342 	/* 0x0001 - 0x0003:	reserved */
343 #define B0_CTST			0x0004	/* 16 bit	Control/Status register */
344 #define B0_LED			0x0006	/*  8 Bit	LED register */
345 #define B0_POWER_CTRL	0x0007	/*  8 Bit	Power Control reg (YUKON only) */
346 #define B0_ISRC			0x0008	/* 32 bit	Interrupt Source Register */
347 #define B0_IMSK			0x000c	/* 32 bit	Interrupt Mask Register */
348 #define B0_HWE_ISRC		0x0010	/* 32 bit	HW Error Interrupt Src Reg */
349 #define B0_HWE_IMSK		0x0014	/* 32 bit	HW Error Interrupt Mask Reg */
350 #define B0_SP_ISRC		0x0018	/* 32 bit	Special Interrupt Source Reg */
351 	/* 0x001c:		reserved */
352 
353 /* B0 XMAC 1 registers (GENESIS only) */
354 #define B0_XM1_IMSK		0x0020	/* 16 bit r/w	XMAC 1 Interrupt Mask Register*/
355 	/* 0x0022 - 0x0027:	reserved */
356 #define B0_XM1_ISRC		0x0028	/* 16 bit ro	XMAC 1 Interrupt Status Reg */
357 	/* 0x002a - 0x002f:	reserved */
358 #define B0_XM1_PHY_ADDR 0x0030	/* 16 bit r/w	XMAC 1 PHY Address Register */
359 	/* 0x0032 - 0x0033:	reserved */
360 #define B0_XM1_PHY_DATA 0x0034	/* 16 bit r/w	XMAC 1 PHY Data Register */
361 	/* 0x0036 - 0x003f:	reserved */
362 
363 /* B0 XMAC 2 registers (GENESIS only) */
364 #define B0_XM2_IMSK		0x0040	/* 16 bit r/w	XMAC 2 Interrupt Mask Register*/
365 	/* 0x0042 - 0x0047:	reserved */
366 #define B0_XM2_ISRC		0x0048	/* 16 bit ro	XMAC 2 Interrupt Status Reg */
367 	/* 0x004a - 0x004f:	reserved */
368 #define B0_XM2_PHY_ADDR 0x0050	/* 16 bit r/w	XMAC 2 PHY Address Register */
369 	/* 0x0052 - 0x0053:	reserved */
370 #define B0_XM2_PHY_DATA 0x0054	/* 16 bit r/w	XMAC 2 PHY Data Register */
371 	/* 0x0056 - 0x005f:	reserved */
372 
373 /* BMU Control Status Registers */
374 #define B0_R1_CSR		0x0060	/* 32 bit	BMU Ctrl/Stat Rx Queue 1 */
375 #define B0_R2_CSR		0x0064	/* 32 bit	BMU Ctrl/Stat Rx Queue 2 */
376 #define B0_XS1_CSR		0x0068	/* 32 bit	BMU Ctrl/Stat Sync Tx Queue 1 */
377 #define B0_XA1_CSR		0x006c	/* 32 bit	BMU Ctrl/Stat Async Tx Queue 1*/
378 #define B0_XS2_CSR		0x0070	/* 32 bit	BMU Ctrl/Stat Sync Tx Queue 2 */
379 #define B0_XA2_CSR		0x0074	/* 32 bit	BMU Ctrl/Stat Async Tx Queue 2*/
380 	/* 0x0078 - 0x007f:	reserved */
381 
382 /*
383  *	Bank 1
384  *	- completely empty (this is the RAP Block window)
385  *	Note: if RAP = 1 this page is reserved
386  */
387 
388 /*
389  *	Bank 2
390  */
391 /* NA reg = 48 bit Network Address Register, 3x16 or 8x8 bit readable */
392 #define B2_MAC_1		0x0100	/* NA reg	 MAC Address 1 */
393 	/* 0x0106 - 0x0107:	reserved */
394 #define B2_MAC_2		0x0108	/* NA reg	 MAC Address 2 */
395 	/* 0x010e - 0x010f:	reserved */
396 #define B2_MAC_3		0x0110	/* NA reg	 MAC Address 3 */
397 	/* 0x0116 - 0x0117:	reserved */
398 #define B2_CONN_TYP		0x0118	/*  8 bit	Connector type */
399 #define B2_PMD_TYP		0x0119	/*  8 bit	PMD type */
400 #define B2_MAC_CFG		0x011a	/*  8 bit	MAC Configuration / Chip Revision */
401 #define B2_CHIP_ID		0x011b	/*  8 bit 	Chip Identification Number */
402 	/* Eprom registers are currently of no use */
403 #define B2_E_0			0x011c	/*  8 bit	EPROM Byte 0 (ext. SRAM size */
404 #define B2_E_1			0x011d	/*  8 bit	EPROM Byte 1 (PHY type) */
405 #define B2_E_2			0x011e	/*  8 bit	EPROM Byte 2 */
406 #define B2_E_3			0x011f	/*  8 bit	EPROM Byte 3 */
407 #define B2_FAR			0x0120	/* 32 bit	Flash-Prom Addr Reg/Cnt */
408 #define B2_FDP			0x0124	/*  8 bit	Flash-Prom Data Port */
409 	/* 0x0125 - 0x0127:	reserved */
410 #define B2_LD_CTRL		0x0128	/*  8 bit	EPROM loader control register */
411 #define B2_LD_TEST		0x0129	/*  8 bit	EPROM loader test register */
412 	/* 0x012a - 0x012f:	reserved */
413 #define B2_TI_INI		0x0130	/* 32 bit	Timer Init Value */
414 #define B2_TI_VAL		0x0134	/* 32 bit	Timer Value */
415 #define B2_TI_CTRL		0x0138	/*  8 bit	Timer Control */
416 #define B2_TI_TEST		0x0139	/*  8 Bit	Timer Test */
417 	/* 0x013a - 0x013f:	reserved */
418 #define B2_IRQM_INI		0x0140	/* 32 bit	IRQ Moderation Timer Init Reg.*/
419 #define B2_IRQM_VAL		0x0144	/* 32 bit	IRQ Moderation Timer Value */
420 #define B2_IRQM_CTRL	0x0148	/*  8 bit	IRQ Moderation Timer Control */
421 #define B2_IRQM_TEST	0x0149	/*  8 bit	IRQ Moderation Timer Test */
422 #define B2_IRQM_MSK 	0x014c	/* 32 bit	IRQ Moderation Mask */
423 #define B2_IRQM_HWE_MSK 0x0150	/* 32 bit	IRQ Moderation HW Error Mask */
424 	/* 0x0154 - 0x0157:	reserved */
425 #define B2_TST_CTRL1	0x0158	/*  8 bit	Test Control Register 1 */
426 #define B2_TST_CTRL2	0x0159	/*  8 bit	Test Control Register 2 */
427 	/* 0x015a - 0x015b:	reserved */
428 #define B2_GP_IO		0x015c	/* 32 bit	General Purpose I/O Register */
429 #define B2_I2C_CTRL		0x0160	/* 32 bit	I2C HW Control Register */
430 #define B2_I2C_DATA		0x0164	/* 32 bit	I2C HW Data Register */
431 #define B2_I2C_IRQ		0x0168	/* 32 bit	I2C HW IRQ Register */
432 #define B2_I2C_SW		0x016c	/* 32 bit	I2C SW Port Register */
433 
434 /* Blink Source Counter (GENESIS only) */
435 #define B2_BSC_INI		0x0170	/* 32 bit	Blink Source Counter Init Val */
436 #define B2_BSC_VAL		0x0174	/* 32 bit	Blink Source Counter Value */
437 #define B2_BSC_CTRL		0x0178	/*  8 bit	Blink Source Counter Control */
438 #define B2_BSC_STAT		0x0179	/*  8 bit	Blink Source Counter Status */
439 #define B2_BSC_TST		0x017a	/* 16 bit	Blink Source Counter Test Reg */
440 	/* 0x017c - 0x017f:	reserved */
441 
442 /*
443  *	Bank 3
444  */
445 /* RAM Random Registers */
446 #define B3_RAM_ADDR		0x0180	/* 32 bit	RAM Address, to read or write */
447 #define B3_RAM_DATA_LO	0x0184	/* 32 bit	RAM Data Word (low dWord) */
448 #define B3_RAM_DATA_HI	0x0188	/* 32 bit	RAM Data Word (high dWord) */
449 	/* 0x018c - 0x018f:	reserved */
450 
451 /* RAM Interface Registers */
452 /*
453  * The HW-Spec. calls this registers Timeout Value 0..11. But this names are
454  * not usable in SW. Please notice these are NOT real timeouts, these are
455  * the number of qWords transferred continuously.
456  */
457 #define B3_RI_WTO_R1	0x0190	/*  8 bit	WR Timeout Queue R1		(TO0) */
458 #define B3_RI_WTO_XA1	0x0191	/*  8 bit	WR Timeout Queue XA1	(TO1) */
459 #define B3_RI_WTO_XS1	0x0192	/*  8 bit	WR Timeout Queue XS1	(TO2) */
460 #define B3_RI_RTO_R1	0x0193	/*  8 bit	RD Timeout Queue R1		(TO3) */
461 #define B3_RI_RTO_XA1	0x0194	/*  8 bit	RD Timeout Queue XA1	(TO4) */
462 #define B3_RI_RTO_XS1	0x0195	/*  8 bit	RD Timeout Queue XS1	(TO5) */
463 #define B3_RI_WTO_R2	0x0196	/*  8 bit	WR Timeout Queue R2		(TO6) */
464 #define B3_RI_WTO_XA2	0x0197	/*  8 bit	WR Timeout Queue XA2	(TO7) */
465 #define B3_RI_WTO_XS2	0x0198	/*  8 bit	WR Timeout Queue XS2	(TO8) */
466 #define B3_RI_RTO_R2	0x0199	/*  8 bit	RD Timeout Queue R2		(TO9) */
467 #define B3_RI_RTO_XA2	0x019a	/*  8 bit	RD Timeout Queue XA2	(TO10)*/
468 #define B3_RI_RTO_XS2	0x019b	/*  8 bit	RD Timeout Queue XS2	(TO11)*/
469 #define B3_RI_TO_VAL	0x019c	/*  8 bit	Current Timeout Count Val */
470 	/* 0x019d - 0x019f:	reserved */
471 #define B3_RI_CTRL		0x01a0	/* 16 bit	RAM Interface Control Register */
472 #define B3_RI_TEST		0x01a2	/*  8 bit	RAM Interface Test Register */
473 	/* 0x01a3 - 0x01af:	reserved */
474 
475 /* MAC Arbiter Registers (GENESIS only) */
476 /* these are the no. of qWord transferred continuously and NOT real timeouts */
477 #define B3_MA_TOINI_RX1	0x01b0	/*  8 bit	Timeout Init Val Rx Path MAC 1 */
478 #define B3_MA_TOINI_RX2	0x01b1	/*  8 bit	Timeout Init Val Rx Path MAC 2 */
479 #define B3_MA_TOINI_TX1	0x01b2	/*  8 bit	Timeout Init Val Tx Path MAC 1 */
480 #define B3_MA_TOINI_TX2	0x01b3	/*  8 bit	Timeout Init Val Tx Path MAC 2 */
481 #define B3_MA_TOVAL_RX1	0x01b4	/*  8 bit	Timeout Value Rx Path MAC 1 */
482 #define B3_MA_TOVAL_RX2	0x01b5	/*  8 bit	Timeout Value Rx Path MAC 1 */
483 #define B3_MA_TOVAL_TX1	0x01b6	/*  8 bit	Timeout Value Tx Path MAC 2 */
484 #define B3_MA_TOVAL_TX2	0x01b7	/*  8 bit	Timeout Value Tx Path MAC 2 */
485 #define B3_MA_TO_CTRL	0x01b8	/* 16 bit	MAC Arbiter Timeout Ctrl Reg */
486 #define B3_MA_TO_TEST	0x01ba	/* 16 bit	MAC Arbiter Timeout Test Reg */
487 	/* 0x01bc - 0x01bf:	reserved */
488 #define B3_MA_RCINI_RX1	0x01c0	/*  8 bit	Recovery Init Val Rx Path MAC 1 */
489 #define B3_MA_RCINI_RX2	0x01c1	/*  8 bit	Recovery Init Val Rx Path MAC 2 */
490 #define B3_MA_RCINI_TX1	0x01c2	/*  8 bit	Recovery Init Val Tx Path MAC 1 */
491 #define B3_MA_RCINI_TX2	0x01c3	/*  8 bit	Recovery Init Val Tx Path MAC 2 */
492 #define B3_MA_RCVAL_RX1	0x01c4	/*  8 bit	Recovery Value Rx Path MAC 1 */
493 #define B3_MA_RCVAL_RX2	0x01c5	/*  8 bit	Recovery Value Rx Path MAC 1 */
494 #define B3_MA_RCVAL_TX1	0x01c6	/*  8 bit	Recovery Value Tx Path MAC 2 */
495 #define B3_MA_RCVAL_TX2	0x01c7	/*  8 bit	Recovery Value Tx Path MAC 2 */
496 #define B3_MA_RC_CTRL	0x01c8	/* 16 bit	MAC Arbiter Recovery Ctrl Reg */
497 #define B3_MA_RC_TEST	0x01ca	/* 16 bit	MAC Arbiter Recovery Test Reg */
498 	/* 0x01cc - 0x01cf:	reserved */
499 
500 /* Packet Arbiter Registers (GENESIS only) */
501 /* these are real timeouts */
502 #define B3_PA_TOINI_RX1	0x01d0	/* 16 bit	Timeout Init Val Rx Path MAC 1 */
503 	/* 0x01d2 - 0x01d3:	reserved */
504 #define B3_PA_TOINI_RX2	0x01d4	/* 16 bit	Timeout Init Val Rx Path MAC 2 */
505 	/* 0x01d6 - 0x01d7:	reserved */
506 #define B3_PA_TOINI_TX1	0x01d8	/* 16 bit	Timeout Init Val Tx Path MAC 1 */
507 	/* 0x01da - 0x01db:	reserved */
508 #define B3_PA_TOINI_TX2	0x01dc	/* 16 bit	Timeout Init Val Tx Path MAC 2 */
509 	/* 0x01de - 0x01df:	reserved */
510 #define B3_PA_TOVAL_RX1	0x01e0	/* 16 bit	Timeout Val Rx Path MAC 1 */
511 	/* 0x01e2 - 0x01e3:	reserved */
512 #define B3_PA_TOVAL_RX2	0x01e4	/* 16 bit	Timeout Val Rx Path MAC 2 */
513 	/* 0x01e6 - 0x01e7:	reserved */
514 #define B3_PA_TOVAL_TX1	0x01e8	/* 16 bit	Timeout Val Tx Path MAC 1 */
515 	/* 0x01ea - 0x01eb:	reserved */
516 #define B3_PA_TOVAL_TX2	0x01ec	/* 16 bit	Timeout Val Tx Path MAC 2 */
517 	/* 0x01ee - 0x01ef:	reserved */
518 #define B3_PA_CTRL	0x01f0	/* 16 bit	Packet Arbiter Ctrl Register */
519 #define B3_PA_TEST	0x01f2	/* 16 bit	Packet Arbiter Test Register */
520 	/* 0x01f4 - 0x01ff:	reserved */
521 
522 /*
523  *	Bank 4 - 5
524  */
525 /* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */
526 #define TXA_ITI_INI		0x0200	/* 32 bit	Tx Arb Interval Timer Init Val*/
527 #define TXA_ITI_VAL		0x0204	/* 32 bit	Tx Arb Interval Timer Value */
528 #define TXA_LIM_INI		0x0208	/* 32 bit	Tx Arb Limit Counter Init Val */
529 #define TXA_LIM_VAL		0x020c	/* 32 bit	Tx Arb Limit Counter Value */
530 #define TXA_CTRL		0x0210	/*  8 bit	Tx Arbiter Control Register */
531 #define TXA_TEST		0x0211	/*  8 bit	Tx Arbiter Test Register */
532 #define TXA_STAT		0x0212	/*  8 bit	Tx Arbiter Status Register */
533 	/* 0x0213 - 0x027f:	reserved */
534 	/* 0x0280 - 0x0292:	MAC 2 */
535 	/* 0x0213 - 0x027f:	reserved */
536 
537 /*
538  *	Bank 6
539  */
540 /* External registers (GENESIS only) */
541 #define B6_EXT_REG		0x0300
542 
543 /*
544  *	Bank 7
545  */
546 /* This is a copy of the Configuration register file (lower half) */
547 #define B7_CFG_SPC		0x0380
548 
549 /*
550  *	Bank 8 - 15
551  */
552 /* Receive and Transmit Queue Registers, use Q_ADDR() to access */
553 #define B8_Q_REGS		0x0400
554 
555 /* Queue Register Offsets, use Q_ADDR() to access */
556 #define Q_D		0x00	/* 8*32	bit	Current Descriptor */
557 #define Q_DA_L	0x20	/* 32 bit	Current Descriptor Address Low dWord */
558 #define Q_DA_H	0x24	/* 32 bit	Current Descriptor Address High dWord */
559 #define Q_AC_L	0x28	/* 32 bit	Current Address Counter Low dWord */
560 #define Q_AC_H	0x2c	/* 32 bit	Current Address Counter High dWord */
561 #define Q_BC	0x30	/* 32 bit	Current Byte Counter */
562 #define Q_CSR	0x34	/* 32 bit	BMU Control/Status Register */
563 #define Q_F		0x38	/* 32 bit	Flag Register */
564 #define Q_T1	0x3c	/* 32 bit	Test Register 1 */
565 #define Q_T1_TR	0x3c	/*  8 bit	Test Register 1 Transfer SM */
566 #define Q_T1_WR	0x3d	/*  8 bit	Test Register 1 Write Descriptor SM */
567 #define Q_T1_RD	0x3e	/*  8 bit	Test Register 1 Read Descriptor SM */
568 #define Q_T1_SV	0x3f	/*  8 bit	Test Register 1 Supervisor SM */
569 #define Q_T2	0x40	/* 32 bit	Test Register 2	*/
570 #define Q_T3	0x44	/* 32 bit	Test Register 3	*/
571 	/* 0x48 - 0x7f:	reserved */
572 
573 /*
574  *	Bank 16 - 23
575  */
576 /* RAM Buffer Registers */
577 #define B16_RAM_REGS	0x0800
578 
579 /* RAM Buffer Register Offsets, use RB_ADDR() to access */
580 #define RB_START		0x00	/* 32 bit	RAM Buffer Start Address */
581 #define RB_END			0x04	/* 32 bit	RAM Buffer End Address */
582 #define RB_WP			0x08	/* 32 bit	RAM Buffer Write Pointer */
583 #define RB_RP			0x0c	/* 32 bit	RAM Buffer Read Pointer */
584 #define RB_RX_UTPP		0x10	/* 32 bit	Rx Upper Threshold, Pause Pack */
585 #define RB_RX_LTPP		0x14	/* 32 bit	Rx Lower Threshold, Pause Pack */
586 #define RB_RX_UTHP		0x18	/* 32 bit	Rx Upper Threshold, High Prio */
587 #define RB_RX_LTHP		0x1c	/* 32 bit	Rx Lower Threshold, High Prio */
588 	/* 0x10 - 0x1f:	reserved at Tx RAM Buffer Registers */
589 #define RB_PC			0x20	/* 32 bit	RAM Buffer Packet Counter */
590 #define RB_LEV			0x24	/* 32 bit	RAM Buffer Level Register */
591 #define RB_CTRL			0x28	/*  8 bit	RAM Buffer Control Register */
592 #define RB_TST1			0x29	/*  8 bit	RAM Buffer Test Register 1 */
593 #define RB_TST2			0x2A	/*  8 bit	RAM Buffer Test Register 2 */
594 	/* 0x2c - 0x7f:	reserved */
595 
596 /*
597  *	Bank 24
598  */
599 /*
600  * Receive MAC FIFO, Receive LED, and Link_Sync regs (GENESIS only)
601  * use MR_ADDR() to access
602  */
603 #define RX_MFF_EA		0x0c00	/* 32 bit	Receive MAC FIFO End Address */
604 #define RX_MFF_WP		0x0c04	/* 32 bit 	Receive MAC FIFO Write Pointer */
605 	/* 0x0c08 - 0x0c0b:	reserved */
606 #define RX_MFF_RP		0x0c0c	/* 32 bit	Receive MAC FIFO Read Pointer */
607 #define RX_MFF_PC		0x0c10	/* 32 bit	Receive MAC FIFO Packet Cnt */
608 #define RX_MFF_LEV		0x0c14	/* 32 bit	Receive MAC FIFO Level */
609 #define RX_MFF_CTRL1	0x0c18	/* 16 bit	Receive MAC FIFO Control Reg 1*/
610 #define RX_MFF_STAT_TO	0x0c1a	/*  8 bit	Receive MAC Status Timeout */
611 #define RX_MFF_TIST_TO	0x0c1b	/*  8 bit	Receive MAC Time Stamp Timeout */
612 #define RX_MFF_CTRL2	0x0c1c	/*  8 bit	Receive MAC FIFO Control Reg 2*/
613 #define RX_MFF_TST1		0x0c1d	/*  8 bit	Receive MAC FIFO Test Reg 1 */
614 #define RX_MFF_TST2		0x0c1e	/*  8 bit	Receive MAC FIFO Test Reg 2 */
615 	/* 0x0c1f:	reserved */
616 #define RX_LED_INI		0x0c20	/* 32 bit	Receive LED Cnt Init Value */
617 #define RX_LED_VAL		0x0c24	/* 32 bit	Receive LED Cnt Current Value */
618 #define RX_LED_CTRL		0x0c28	/*  8 bit	Receive LED Cnt Control Reg */
619 #define RX_LED_TST		0x0c29	/*  8 bit	Receive LED Cnt Test Register */
620 	/* 0x0c2a - 0x0c2f:	reserved */
621 #define LNK_SYNC_INI	0x0c30	/* 32 bit	Link Sync Cnt Init Value */
622 #define LNK_SYNC_VAL	0x0c34	/* 32 bit	Link Sync Cnt Current Value */
623 #define LNK_SYNC_CTRL	0x0c38	/*  8 bit	Link Sync Cnt Control Register */
624 #define LNK_SYNC_TST	0x0c39	/*  8 bit	Link Sync Cnt Test Register */
625 	/* 0x0c3a - 0x0c3b:	reserved */
626 #define LNK_LED_REG		0x0c3c	/*  8 bit	Link LED Register */
627 	/* 0x0c3d - 0x0c3f:	reserved */
628 
629 /* Receive GMAC FIFO (YUKON only), use MR_ADDR() to access */
630 #define RX_GMF_EA		0x0c40	/* 32 bit	Rx GMAC FIFO End Address */
631 #define RX_GMF_AF_THR	0x0c44	/* 32 bit	Rx GMAC FIFO Almost Full Thresh. */
632 #define RX_GMF_CTRL_T	0x0c48	/* 32 bit	Rx GMAC FIFO Control/Test */
633 #define RX_GMF_FL_MSK	0x0c4c	/* 32 bit	Rx GMAC FIFO Flush Mask */
634 #define RX_GMF_FL_THR	0x0c50	/* 32 bit	Rx GMAC FIFO Flush Threshold */
635 	/* 0x0c54 - 0x0c5f:	reserved */
636 #define RX_GMF_WP		0x0c60	/* 32 bit 	Rx GMAC FIFO Write Pointer */
637 	/* 0x0c64 - 0x0c67:	reserved */
638 #define RX_GMF_WLEV		0x0c68	/* 32 bit 	Rx GMAC FIFO Write Level */
639 	/* 0x0c6c - 0x0c6f:	reserved */
640 #define RX_GMF_RP		0x0c70	/* 32 bit 	Rx GMAC FIFO Read Pointer */
641 	/* 0x0c74 - 0x0c77:	reserved */
642 #define RX_GMF_RLEV		0x0c78	/* 32 bit 	Rx GMAC FIFO Read Level */
643 	/* 0x0c7c - 0x0c7f:	reserved */
644 
645 /*
646  *	Bank 25
647  */
648 	/* 0x0c80 - 0x0cbf:	MAC 2 */
649 	/* 0x0cc0 - 0x0cff:	reserved */
650 
651 /*
652  *	Bank 26
653  */
654 /*
655  * Transmit MAC FIFO and Transmit LED Registers (GENESIS only),
656  * use MR_ADDR() to access
657  */
658 #define TX_MFF_EA		0x0d00	/* 32 bit	Transmit MAC FIFO End Address */
659 #define TX_MFF_WP		0x0d04	/* 32 bit 	Transmit MAC FIFO WR Pointer */
660 #define TX_MFF_WSP		0x0d08	/* 32 bit	Transmit MAC FIFO WR Shadow Ptr */
661 #define TX_MFF_RP		0x0d0c	/* 32 bit	Transmit MAC FIFO RD Pointer */
662 #define TX_MFF_PC		0x0d10	/* 32 bit	Transmit MAC FIFO Packet Cnt */
663 #define TX_MFF_LEV		0x0d14	/* 32 bit	Transmit MAC FIFO Level */
664 #define TX_MFF_CTRL1	0x0d18	/* 16 bit	Transmit MAC FIFO Ctrl Reg 1 */
665 #define TX_MFF_WAF		0x0d1a	/*  8 bit	Transmit MAC Wait after flush */
666 	/* 0x0c1b:	reserved */
667 #define TX_MFF_CTRL2	0x0d1c	/*  8 bit	Transmit MAC FIFO Ctrl Reg 2 */
668 #define TX_MFF_TST1		0x0d1d	/*  8 bit	Transmit MAC FIFO Test Reg 1 */
669 #define TX_MFF_TST2		0x0d1e	/*  8 bit	Transmit MAC FIFO Test Reg 2 */
670 	/* 0x0d1f:	reserved */
671 #define TX_LED_INI		0x0d20	/* 32 bit	Transmit LED Cnt Init Value */
672 #define TX_LED_VAL		0x0d24	/* 32 bit	Transmit LED Cnt Current Val */
673 #define TX_LED_CTRL		0x0d28	/*  8 bit	Transmit LED Cnt Control Reg */
674 #define TX_LED_TST		0x0d29	/*  8 bit	Transmit LED Cnt Test Reg */
675 	/* 0x0d2a - 0x0d3f:	reserved */
676 
677 /* Transmit GMAC FIFO (YUKON only), use MR_ADDR() to access */
678 #define TX_GMF_EA		0x0d40	/* 32 bit	Tx GMAC FIFO End Address */
679 #define TX_GMF_AE_THR	0x0d44	/* 32 bit	Tx GMAC FIFO Almost Empty Thresh.*/
680 #define TX_GMF_CTRL_T	0x0d48	/* 32 bit	Tx GMAC FIFO Control/Test */
681 	/* 0x0d4c - 0x0d5f:	reserved */
682 #define TX_GMF_WP		0x0d60	/* 32 bit 	Tx GMAC FIFO Write Pointer */
683 #define TX_GMF_WSP		0x0d64	/* 32 bit 	Tx GMAC FIFO Write Shadow Ptr. */
684 #define TX_GMF_WLEV		0x0d68	/* 32 bit 	Tx GMAC FIFO Write Level */
685 	/* 0x0d6c - 0x0d6f:	reserved */
686 #define TX_GMF_RP		0x0d70	/* 32 bit 	Tx GMAC FIFO Read Pointer */
687 #define TX_GMF_RSTP		0x0d74	/* 32 bit 	Tx GMAC FIFO Restart Pointer */
688 #define TX_GMF_RLEV		0x0d78	/* 32 bit 	Tx GMAC FIFO Read Level */
689 	/* 0x0d7c - 0x0d7f:	reserved */
690 
691 /*
692  *	Bank 27
693  */
694 	/* 0x0d80 - 0x0dbf:	MAC 2 */
695 	/* 0x0daa - 0x0dff:	reserved */
696 
697 /*
698  *	Bank 28
699  */
700 /* Descriptor Poll Timer Registers */
701 #define B28_DPT_INI		0x0e00	/* 24 bit	Descriptor Poll Timer Init Val */
702 #define B28_DPT_VAL		0x0e04	/* 24 bit	Descriptor Poll Timer Curr Val */
703 #define B28_DPT_CTRL	0x0e08	/*  8 bit	Descriptor Poll Timer Ctrl Reg */
704 	/* 0x0e09:	reserved */
705 #define B28_DPT_TST		0x0e0a	/*  8 bit	Descriptor Poll Timer Test Reg */
706 	/* 0x0e0b:	reserved */
707 
708 /* Time Stamp Timer Registers (YUKON only) */
709 	/* 0x0e10:	reserved */
710 #define GMAC_TI_ST_VAL	0x0e14	/* 32 bit	Time Stamp Timer Curr Val */
711 #define GMAC_TI_ST_CTRL	0x0e18	/*  8 bit	Time Stamp Timer Ctrl Reg */
712 	/* 0x0e19:	reserved */
713 #define GMAC_TI_ST_TST	0x0e1a	/*  8 bit	Time Stamp Timer Test Reg */
714 	/* 0x0e1b - 0x0e7f:	reserved */
715 
716 /*
717  *	Bank 29
718  */
719 	/* 0x0e80 - 0x0efc:	reserved */
720 
721 /*
722  *	Bank 30
723  */
724 /* GMAC and GPHY Control Registers (YUKON only) */
725 #define GMAC_CTRL		0x0f00	/* 32 bit	GMAC Control Reg */
726 #define GPHY_CTRL		0x0f04	/* 32 bit	GPHY Control Reg */
727 #define GMAC_IRQ_SRC	0x0f08	/*  8 bit	GMAC Interrupt Source Reg */
728 	/* 0x0f09 - 0x0f0b:	reserved */
729 #define GMAC_IRQ_MSK	0x0f0c	/*  8 bit	GMAC Interrupt Mask Reg */
730 	/* 0x0f0d - 0x0f0f:	reserved */
731 #define GMAC_LINK_CTRL	0x0f10	/* 16 bit	Link Control Reg */
732 	/* 0x0f14 - 0x0f1f:	reserved */
733 
734 /* Wake-up Frame Pattern Match Control Registers (YUKON only) */
735 
736 #define WOL_REG_OFFS	0x20	/* HW-Bug: Address is + 0x20 against spec. */
737 
738 #define WOL_CTRL_STAT	0x0f20	/* 16 bit	WOL Control/Status Reg */
739 #define WOL_MATCH_CTL	0x0f22	/*  8 bit	WOL Match Control Reg */
740 #define WOL_MATCH_RES	0x0f23	/*  8 bit	WOL Match Result Reg */
741 #define WOL_MAC_ADDR_LO	0x0f24	/* 32 bit	WOL MAC Address Low */
742 #define WOL_MAC_ADDR_HI	0x0f28	/* 16 bit	WOL MAC Address High */
743 #define WOL_PATT_RPTR	0x0f2c	/*  8 bit	WOL Pattern Read Ptr */
744 
745 /* use this macro to access above registers */
746 #define WOL_REG(Reg)	((Reg) + (pAC->GIni.GIWolOffs))
747 
748 
749 /* WOL Pattern Length Registers (YUKON only) */
750 
751 #define WOL_PATT_LEN_LO	0x0f30		/* 32 bit	WOL Pattern Length 3..0 */
752 #define WOL_PATT_LEN_HI	0x0f34		/* 24 bit	WOL Pattern Length 6..4 */
753 
754 /* WOL Pattern Counter Registers (YUKON only) */
755 
756 #define WOL_PATT_CNT_0	0x0f38		/* 32 bit	WOL Pattern Counter 3..0 */
757 #define WOL_PATT_CNT_4	0x0f3c		/* 24 bit	WOL Pattern Counter 6..4 */
758 	/* 0x0f40 - 0x0f7f:	reserved */
759 
760 /*
761  *	Bank 31
762  */
763 /* 0x0f80 - 0x0fff:	reserved */
764 
765 /*
766  *	Bank 32	- 33
767  */
768 #define WOL_PATT_RAM_1	0x1000	/*  WOL Pattern RAM Link 1 */
769 
770 /*
771  *	Bank 0x22 - 0x3f
772  */
773 /* 0x1100 - 0x1fff:	reserved */
774 
775 /*
776  *	Bank 0x40 - 0x4f
777  */
778 #define BASE_XMAC_1		0x2000	/* XMAC 1 registers */
779 
780 /*
781  *	Bank 0x50 - 0x5f
782  */
783 
784 #define BASE_GMAC_1		0x2800	/* GMAC 1 registers */
785 
786 /*
787  *	Bank 0x60 - 0x6f
788  */
789 #define BASE_XMAC_2		0x3000	/* XMAC 2 registers */
790 
791 /*
792  *	Bank 0x70 - 0x7f
793  */
794 #define BASE_GMAC_2		0x3800	/* GMAC 2 registers */
795 
796 /*
797  *	Control Register Bit Definitions:
798  */
799 /*	B0_RAP		8 bit	Register Address Port */
800 								/* Bit 7:	reserved */
801 #define RAP_RAP			0x3f	/* Bit 6..0:	0 = block 0,..,6f = block 6f */
802 
803 /*	B0_CTST			16 bit	Control/Status register */
804 								/* Bit 15..14:	reserved */
805 #define CS_CLK_RUN_HOT	BIT_13S		/* CLK_RUN hot m. (YUKON-Lite only) */
806 #define CS_CLK_RUN_RST	BIT_12S		/* CLK_RUN reset  (YUKON-Lite only) */
807 #define CS_CLK_RUN_ENA	BIT_11S		/* CLK_RUN enable (YUKON-Lite only) */
808 #define CS_VAUX_AVAIL	BIT_10S		/* VAUX available (YUKON only) */
809 #define CS_BUS_CLOCK	BIT_9S		/* Bus Clock 0/1 = 33/66 MHz */
810 #define CS_BUS_SLOT_SZ	BIT_8S		/* Slot Size 0/1 = 32/64 bit slot */
811 #define CS_ST_SW_IRQ	BIT_7S		/* Set IRQ SW Request */
812 #define CS_CL_SW_IRQ	BIT_6S		/* Clear IRQ SW Request */
813 #define CS_STOP_DONE	BIT_5S		/* Stop Master is finished */
814 #define CS_STOP_MAST	BIT_4S		/* Command Bit to stop the master */
815 #define CS_MRST_CLR		BIT_3S		/* Clear Master reset	*/
816 #define CS_MRST_SET		BIT_2S		/* Set Master reset	*/
817 #define CS_RST_CLR		BIT_1S		/* Clear Software reset	*/
818 #define CS_RST_SET		BIT_0S		/* Set   Software reset	*/
819 
820 /*	B0_LED			 8 Bit	LED register */
821 								/* Bit  7.. 2:	reserved */
822 #define LED_STAT_ON		BIT_1S		/* Status LED on	*/
823 #define LED_STAT_OFF	BIT_0S		/* Status LED off	*/
824 
825 /*	B0_POWER_CTRL	 8 Bit	Power Control reg (YUKON only) */
826 #define PC_VAUX_ENA		BIT_7		/* Switch VAUX Enable  */
827 #define PC_VAUX_DIS		BIT_6       /* Switch VAUX Disable */
828 #define PC_VCC_ENA		BIT_5       /* Switch VCC Enable  */
829 #define PC_VCC_DIS		BIT_4       /* Switch VCC Disable */
830 #define PC_VAUX_ON		BIT_3       /* Switch VAUX On  */
831 #define PC_VAUX_OFF		BIT_2       /* Switch VAUX Off */
832 #define PC_VCC_ON		BIT_1       /* Switch VCC On  */
833 #define PC_VCC_OFF		BIT_0       /* Switch VCC Off */
834 
835 /*	B0_ISRC			32 bit	Interrupt Source Register */
836 /*	B0_IMSK			32 bit	Interrupt Mask Register */
837 /*	B0_SP_ISRC		32 bit	Special Interrupt Source Reg */
838 /*	B2_IRQM_MSK 	32 bit	IRQ Moderation Mask */
839 #define IS_ALL_MSK		0xbfffffffUL	/* All Interrupt bits */
840 #define IS_HW_ERR		BIT_31		/* Interrupt HW Error */
841 								/* Bit 30:	reserved */
842 #define IS_PA_TO_RX1	BIT_29		/* Packet Arb Timeout Rx1 */
843 #define IS_PA_TO_RX2	BIT_28		/* Packet Arb Timeout Rx2 */
844 #define IS_PA_TO_TX1	BIT_27		/* Packet Arb Timeout Tx1 */
845 #define IS_PA_TO_TX2	BIT_26		/* Packet Arb Timeout Tx2 */
846 #define IS_I2C_READY	BIT_25		/* IRQ on end of I2C Tx */
847 #define IS_IRQ_SW		BIT_24		/* SW forced IRQ	*/
848 #define IS_EXT_REG		BIT_23		/* IRQ from LM80 or PHY (GENESIS only) */
849 									/* IRQ from PHY (YUKON only) */
850 #define IS_TIMINT		BIT_22		/* IRQ from Timer	*/
851 #define IS_MAC1			BIT_21		/* IRQ from MAC 1	*/
852 #define IS_LNK_SYNC_M1	BIT_20		/* Link Sync Cnt wrap MAC 1 */
853 #define IS_MAC2			BIT_19		/* IRQ from MAC 2	*/
854 #define IS_LNK_SYNC_M2	BIT_18		/* Link Sync Cnt wrap MAC 2 */
855 /* Receive Queue 1 */
856 #define IS_R1_B			BIT_17		/* Q_R1 End of Buffer */
857 #define IS_R1_F			BIT_16		/* Q_R1 End of Frame */
858 #define IS_R1_C			BIT_15		/* Q_R1 Encoding Error */
859 /* Receive Queue 2 */
860 #define IS_R2_B			BIT_14		/* Q_R2 End of Buffer */
861 #define IS_R2_F			BIT_13		/* Q_R2 End of Frame */
862 #define IS_R2_C			BIT_12		/* Q_R2 Encoding Error */
863 /* Synchronous Transmit Queue 1 */
864 #define IS_XS1_B		BIT_11		/* Q_XS1 End of Buffer */
865 #define IS_XS1_F		BIT_10		/* Q_XS1 End of Frame */
866 #define IS_XS1_C		BIT_9		/* Q_XS1 Encoding Error */
867 /* Asynchronous Transmit Queue 1 */
868 #define IS_XA1_B		BIT_8		/* Q_XA1 End of Buffer */
869 #define IS_XA1_F		BIT_7		/* Q_XA1 End of Frame */
870 #define IS_XA1_C		BIT_6		/* Q_XA1 Encoding Error */
871 /* Synchronous Transmit Queue 2 */
872 #define IS_XS2_B		BIT_5		/* Q_XS2 End of Buffer */
873 #define IS_XS2_F		BIT_4		/* Q_XS2 End of Frame */
874 #define IS_XS2_C		BIT_3		/* Q_XS2 Encoding Error */
875 /* Asynchronous Transmit Queue 2 */
876 #define IS_XA2_B		BIT_2		/* Q_XA2 End of Buffer */
877 #define IS_XA2_F		BIT_1		/* Q_XA2 End of Frame */
878 #define IS_XA2_C		BIT_0		/* Q_XA2 Encoding Error */
879 
880 
881 /*	B0_HWE_ISRC		32 bit	HW Error Interrupt Src Reg */
882 /*	B0_HWE_IMSK		32 bit	HW Error Interrupt Mask Reg */
883 /*	B2_IRQM_HWE_MSK	32 bit	IRQ Moderation HW Error Mask */
884 #define IS_ERR_MSK		0x00000fffL	/* 		All Error bits */
885 								/* Bit 31..14:	reserved */
886 #define IS_IRQ_TIST_OV	BIT_13	/* Time Stamp Timer Overflow (YUKON only) */
887 #define IS_IRQ_SENSOR	BIT_12	/* IRQ from Sensor (YUKON only) */
888 #define IS_IRQ_MST_ERR	BIT_11	/* IRQ master error detected */
889 #define IS_IRQ_STAT		BIT_10	/* IRQ status exception */
890 #define IS_NO_STAT_M1	BIT_9	/* No Rx Status from MAC 1 */
891 #define IS_NO_STAT_M2	BIT_8	/* No Rx Status from MAC 2 */
892 #define IS_NO_TIST_M1	BIT_7	/* No Time Stamp from MAC 1 */
893 #define IS_NO_TIST_M2	BIT_6	/* No Time Stamp from MAC 2 */
894 #define IS_RAM_RD_PAR	BIT_5	/* RAM Read  Parity Error */
895 #define IS_RAM_WR_PAR	BIT_4	/* RAM Write Parity Error */
896 #define IS_M1_PAR_ERR	BIT_3	/* MAC 1 Parity Error */
897 #define IS_M2_PAR_ERR	BIT_2	/* MAC 2 Parity Error */
898 #define IS_R1_PAR_ERR	BIT_1	/* Queue R1 Parity Error */
899 #define IS_R2_PAR_ERR	BIT_0	/* Queue R2 Parity Error */
900 
901 /*	B2_CONN_TYP		 8 bit	Connector type */
902 /*	B2_PMD_TYP		 8 bit	PMD type */
903 /*	Values of connector and PMD type comply to SysKonnect internal std */
904 
905 /*	B2_MAC_CFG		 8 bit	MAC Configuration / Chip Revision */
906 #define CFG_CHIP_R_MSK	(0xf<<4)	/* Bit 7.. 4: Chip Revision */
907 									/* Bit 3.. 2:	reserved */
908 #define CFG_DIS_M2_CLK	BIT_1S		/* Disable Clock for 2nd MAC */
909 #define CFG_SNG_MAC		BIT_0S		/* MAC Config: 0=2 MACs / 1=1 MAC*/
910 
911 /*	B2_CHIP_ID		 8 bit 	Chip Identification Number */
912 #define CHIP_ID_GENESIS		0x0a	/* Chip ID for GENESIS */
913 #define CHIP_ID_YUKON		0xb0	/* Chip ID for YUKON */
914 #define CHIP_ID_YUKON_LITE	0xb1	/* Chip ID for YUKON-Lite (Rev. A1-A3) */
915 #define CHIP_ID_YUKON_LP	0xb2	/* Chip ID for YUKON-LP */
916 
917 #define CHIP_REV_YU_LITE_A1	3		/* Chip Rev. for YUKON-Lite A1,A2 */
918 #define CHIP_REV_YU_LITE_A3	7		/* Chip Rev. for YUKON-Lite A3 */
919 
920 /*	B2_FAR			32 bit	Flash-Prom Addr Reg/Cnt */
921 #define FAR_ADDR		0x1ffffL	/* Bit 16.. 0:	FPROM Address mask */
922 
923 /*	B2_LD_CTRL		 8 bit	EPROM loader control register */
924 /*	Bits are currently reserved */
925 
926 /*	B2_LD_TEST		 8 bit	EPROM loader test register */
927 								/* Bit 7.. 4:	reserved */
928 #define LD_T_ON			BIT_3S	/* Loader Test mode on */
929 #define LD_T_OFF		BIT_2S	/* Loader Test mode off */
930 #define LD_T_STEP		BIT_1S	/* Decrement FPROM addr. Counter */
931 #define LD_START		BIT_0S	/* Start loading FPROM */
932 
933 /*
934  *	Timer Section
935  */
936 /*	B2_TI_CTRL		 8 bit	Timer control */
937 /*	B2_IRQM_CTRL	 8 bit	IRQ Moderation Timer Control */
938 								/* Bit 7.. 3:	reserved */
939 #define TIM_START		BIT_2S	/* Start Timer */
940 #define TIM_STOP		BIT_1S	/* Stop  Timer */
941 #define TIM_CLR_IRQ		BIT_0S	/* Clear Timer IRQ (!IRQM) */
942 
943 /*	B2_TI_TEST		 8 Bit	Timer Test */
944 /*	B2_IRQM_TEST	 8 bit	IRQ Moderation Timer Test */
945 /*	B28_DPT_TST		 8 bit	Descriptor Poll Timer Test Reg */
946 								/* Bit 7.. 3:	reserved */
947 #define TIM_T_ON		BIT_2S	/* Test mode on */
948 #define TIM_T_OFF		BIT_1S	/* Test mode off */
949 #define TIM_T_STEP		BIT_0S	/* Test step */
950 
951 /*	B28_DPT_INI	32 bit	Descriptor Poll Timer Init Val */
952 /*	B28_DPT_VAL	32 bit	Descriptor Poll Timer Curr Val */
953 								/* Bit 31..24:	reserved */
954 #define DPT_MSK		0x00ffffffL	/* Bit 23.. 0:	Desc Poll Timer Bits */
955 
956 /*	B28_DPT_CTRL	 8 bit	Descriptor Poll Timer Ctrl Reg */
957 								/* Bit  7.. 2:	reserved */
958 #define DPT_START		BIT_1S	/* Start Descriptor Poll Timer */
959 #define DPT_STOP		BIT_0S	/* Stop  Descriptor Poll Timer */
960 
961 /*	B2_E_3			 8 bit 	lower 4 bits used for HW self test result */
962 #define B2_E3_RES_MASK	0x0f
963 
964 /*	B2_TST_CTRL1	 8 bit	Test Control Register 1 */
965 #define TST_FRC_DPERR_MR	BIT_7S	/* force DATAPERR on MST RD */
966 #define TST_FRC_DPERR_MW	BIT_6S	/* force DATAPERR on MST WR */
967 #define TST_FRC_DPERR_TR	BIT_5S	/* force DATAPERR on TRG RD */
968 #define TST_FRC_DPERR_TW	BIT_4S	/* force DATAPERR on TRG WR */
969 #define TST_FRC_APERR_M		BIT_3S	/* force ADDRPERR on MST */
970 #define TST_FRC_APERR_T		BIT_2S	/* force ADDRPERR on TRG */
971 #define TST_CFG_WRITE_ON	BIT_1S	/* Enable  Config Reg WR */
972 #define TST_CFG_WRITE_OFF	BIT_0S	/* Disable Config Reg WR */
973 
974 /*	B2_TST_CTRL2	 8 bit	Test Control Register 2 */
975 									/* Bit 7.. 4:	reserved */
976 			/* force the following error on the next master read/write	*/
977 #define TST_FRC_DPERR_MR64	BIT_3S	/* DataPERR RD 64	*/
978 #define TST_FRC_DPERR_MW64	BIT_2S	/* DataPERR WR 64	*/
979 #define TST_FRC_APERR_1M64	BIT_1S	/* AddrPERR on 1. phase */
980 #define TST_FRC_APERR_2M64	BIT_0S	/* AddrPERR on 2. phase */
981 
982 /*	B2_GP_IO		32 bit	General Purpose I/O Register */
983 							/* Bit 31..26:	reserved */
984 #define GP_DIR_9	BIT_25	/* IO_9 direct, 0=In/1=Out */
985 #define GP_DIR_8	BIT_24	/* IO_8 direct, 0=In/1=Out */
986 #define GP_DIR_7	BIT_23	/* IO_7 direct, 0=In/1=Out */
987 #define GP_DIR_6	BIT_22	/* IO_6 direct, 0=In/1=Out */
988 #define GP_DIR_5	BIT_21	/* IO_5 direct, 0=In/1=Out */
989 #define GP_DIR_4	BIT_20	/* IO_4 direct, 0=In/1=Out */
990 #define GP_DIR_3	BIT_19	/* IO_3 direct, 0=In/1=Out */
991 #define GP_DIR_2	BIT_18	/* IO_2 direct, 0=In/1=Out */
992 #define GP_DIR_1	BIT_17	/* IO_1 direct, 0=In/1=Out */
993 #define GP_DIR_0	BIT_16	/* IO_0 direct, 0=In/1=Out */
994 						/* Bit 15..10:	reserved */
995 #define GP_IO_9		BIT_9	/* IO_9 pin */
996 #define GP_IO_8		BIT_8	/* IO_8 pin */
997 #define GP_IO_7		BIT_7	/* IO_7 pin */
998 #define GP_IO_6		BIT_6	/* IO_6 pin */
999 #define GP_IO_5		BIT_5	/* IO_5 pin */
1000 #define GP_IO_4		BIT_4	/* IO_4 pin */
1001 #define GP_IO_3		BIT_3	/* IO_3 pin */
1002 #define GP_IO_2		BIT_2	/* IO_2 pin */
1003 #define GP_IO_1		BIT_1	/* IO_1 pin */
1004 #define GP_IO_0		BIT_0	/* IO_0 pin */
1005 
1006 /*	B2_I2C_CTRL		32 bit	I2C HW Control Register */
1007 #define I2C_FLAG		BIT_31		/* Start read/write if WR */
1008 #define I2C_ADDR		(0x7fffL<<16)	/* Bit 30..16:	Addr to be RD/WR */
1009 #define I2C_DEV_SEL		(0x7fL<<9)		/* Bit 15.. 9:	I2C Device Select */
1010 								/* Bit	8.. 5:	reserved	*/
1011 #define I2C_BURST_LEN	BIT_4		/* Burst Len, 1/4 bytes */
1012 #define I2C_DEV_SIZE	(7<<1)		/* Bit	3.. 1:	I2C Device Size	*/
1013 #define I2C_025K_DEV	(0<<1)		/*		0: 256 Bytes or smal. */
1014 #define I2C_05K_DEV		(1<<1)		/* 		1: 512	Bytes	*/
1015 #define I2C_1K_DEV		(2<<1)		/*		2: 1024 Bytes	*/
1016 #define I2C_2K_DEV		(3<<1)		/*		3: 2048	Bytes	*/
1017 #define I2C_4K_DEV		(4<<1)		/*		4: 4096 Bytes	*/
1018 #define I2C_8K_DEV		(5<<1)		/*		5: 8192 Bytes	*/
1019 #define I2C_16K_DEV		(6<<1)		/*		6: 16384 Bytes	*/
1020 #define I2C_32K_DEV		(7<<1)		/*		7: 32768 Bytes	*/
1021 #define I2C_STOP		BIT_0		/* Interrupt I2C transfer */
1022 
1023 /*	B2_I2C_IRQ		32 bit	I2C HW IRQ Register */
1024 								/* Bit 31.. 1	reserved */
1025 #define I2C_CLR_IRQ		BIT_0	/* Clear I2C IRQ */
1026 
1027 /*	B2_I2C_SW		32 bit (8 bit access)	I2C HW SW Port Register */
1028 								/* Bit  7.. 3:	reserved */
1029 #define I2C_DATA_DIR	BIT_2S		/* direction of I2C_DATA */
1030 #define I2C_DATA		BIT_1S		/* I2C Data Port	*/
1031 #define I2C_CLK			BIT_0S		/* I2C Clock Port	*/
1032 
1033 /*
1034  * I2C Address
1035  */
1036 #define I2C_SENS_ADDR	LM80_ADDR	/* I2C Sensor Address, (Volt and Temp)*/
1037 
1038 
1039 /*	B2_BSC_CTRL		 8 bit	Blink Source Counter Control */
1040 							/* Bit  7.. 2:	reserved */
1041 #define BSC_START	BIT_1S		/* Start Blink Source Counter */
1042 #define BSC_STOP	BIT_0S		/* Stop  Blink Source Counter */
1043 
1044 /*	B2_BSC_STAT		 8 bit	Blink Source Counter Status */
1045 							/* Bit  7.. 1:	reserved */
1046 #define BSC_SRC		BIT_0S		/* Blink Source, 0=Off / 1=On */
1047 
1048 /*	B2_BSC_TST		16 bit	Blink Source Counter Test Reg */
1049 #define BSC_T_ON	BIT_2S		/* Test mode on */
1050 #define BSC_T_OFF	BIT_1S		/* Test mode off */
1051 #define BSC_T_STEP	BIT_0S		/* Test step */
1052 
1053 
1054 /*	B3_RAM_ADDR		32 bit	RAM Address, to read or write */
1055 					/* Bit 31..19:	reserved */
1056 #define RAM_ADR_RAN	0x0007ffffL	/* Bit 18.. 0:	RAM Address Range */
1057 
1058 /* RAM Interface Registers */
1059 /*	B3_RI_CTRL		16 bit	RAM Iface Control Register */
1060 								/* Bit 15..10:	reserved */
1061 #define RI_CLR_RD_PERR	BIT_9S	/* Clear IRQ RAM Read Parity Err */
1062 #define RI_CLR_WR_PERR	BIT_8S	/* Clear IRQ RAM Write Parity Err*/
1063 								/* Bit	7.. 2:	reserved */
1064 #define RI_RST_CLR		BIT_1S	/* Clear RAM Interface Reset */
1065 #define RI_RST_SET		BIT_0S	/* Set   RAM Interface Reset */
1066 
1067 /*	B3_RI_TEST		 8 bit	RAM Iface Test Register */
1068 								/* Bit 15.. 4:	reserved */
1069 #define RI_T_EV			BIT_3S	/* Timeout Event occured */
1070 #define RI_T_ON			BIT_2S	/* Timeout Timer Test On */
1071 #define RI_T_OFF		BIT_1S	/* Timeout Timer Test Off */
1072 #define RI_T_STEP		BIT_0S	/* Timeout Timer Step */
1073 
1074 /* MAC Arbiter Registers */
1075 /*	B3_MA_TO_CTRL	16 bit	MAC Arbiter Timeout Ctrl Reg */
1076 								/* Bit 15.. 4:	reserved */
1077 #define MA_FOE_ON		BIT_3S	/* XMAC Fast Output Enable ON */
1078 #define MA_FOE_OFF		BIT_2S	/* XMAC Fast Output Enable OFF */
1079 #define MA_RST_CLR		BIT_1S	/* Clear MAC Arbiter Reset */
1080 #define MA_RST_SET		BIT_0S	/* Set   MAC Arbiter Reset */
1081 
1082 /*	B3_MA_RC_CTRL	16 bit	MAC Arbiter Recovery Ctrl Reg */
1083 								/* Bit 15.. 8:	reserved */
1084 #define MA_ENA_REC_TX2	BIT_7S	/* Enable  Recovery Timer TX2 */
1085 #define MA_DIS_REC_TX2	BIT_6S	/* Disable Recovery Timer TX2 */
1086 #define MA_ENA_REC_TX1	BIT_5S	/* Enable  Recovery Timer TX1 */
1087 #define MA_DIS_REC_TX1	BIT_4S	/* Disable Recovery Timer TX1 */
1088 #define MA_ENA_REC_RX2	BIT_3S	/* Enable  Recovery Timer RX2 */
1089 #define MA_DIS_REC_RX2	BIT_2S	/* Disable Recovery Timer RX2 */
1090 #define MA_ENA_REC_RX1	BIT_1S	/* Enable  Recovery Timer RX1 */
1091 #define MA_DIS_REC_RX1	BIT_0S	/* Disable Recovery Timer RX1 */
1092 
1093 /* Packet Arbiter Registers */
1094 /*	B3_PA_CTRL		16 bit	Packet Arbiter Ctrl Register */
1095 								/* Bit 15..14:	reserved */
1096 #define PA_CLR_TO_TX2	BIT_13S	/* Clear IRQ Packet Timeout TX2 */
1097 #define PA_CLR_TO_TX1	BIT_12S	/* Clear IRQ Packet Timeout TX1 */
1098 #define PA_CLR_TO_RX2	BIT_11S	/* Clear IRQ Packet Timeout RX2 */
1099 #define PA_CLR_TO_RX1	BIT_10S	/* Clear IRQ Packet Timeout RX1 */
1100 #define PA_ENA_TO_TX2	BIT_9S	/* Enable  Timeout Timer TX2 */
1101 #define PA_DIS_TO_TX2	BIT_8S	/* Disable Timeout Timer TX2 */
1102 #define PA_ENA_TO_TX1	BIT_7S	/* Enable  Timeout Timer TX1 */
1103 #define PA_DIS_TO_TX1	BIT_6S	/* Disable Timeout Timer TX1 */
1104 #define PA_ENA_TO_RX2	BIT_5S	/* Enable  Timeout Timer RX2 */
1105 #define PA_DIS_TO_RX2	BIT_4S	/* Disable Timeout Timer RX2 */
1106 #define PA_ENA_TO_RX1	BIT_3S	/* Enable  Timeout Timer RX1 */
1107 #define PA_DIS_TO_RX1	BIT_2S	/* Disable Timeout Timer RX1 */
1108 #define PA_RST_CLR		BIT_1S	/* Clear MAC Arbiter Reset */
1109 #define PA_RST_SET		BIT_0S	/* Set   MAC Arbiter Reset */
1110 
1111 #define PA_ENA_TO_ALL	(PA_ENA_TO_RX1 | PA_ENA_TO_RX2 |\
1112 						PA_ENA_TO_TX1 | PA_ENA_TO_TX2)
1113 
1114 /* Rx/Tx Path related Arbiter Test Registers */
1115 /*	B3_MA_TO_TEST	16 bit	MAC Arbiter Timeout Test Reg */
1116 /*	B3_MA_RC_TEST	16 bit	MAC Arbiter Recovery Test Reg */
1117 /*	B3_PA_TEST		16 bit	Packet Arbiter Test Register */
1118 /*			Bit 15, 11, 7, and 3 are reserved in B3_PA_TEST */
1119 #define TX2_T_EV	BIT_15S		/* TX2 Timeout/Recv Event occured */
1120 #define TX2_T_ON	BIT_14S		/* TX2 Timeout/Recv Timer Test On */
1121 #define TX2_T_OFF	BIT_13S		/* TX2 Timeout/Recv Timer Tst Off */
1122 #define TX2_T_STEP	BIT_12S		/* TX2 Timeout/Recv Timer Step */
1123 #define TX1_T_EV	BIT_11S		/* TX1 Timeout/Recv Event occured */
1124 #define TX1_T_ON	BIT_10S		/* TX1 Timeout/Recv Timer Test On */
1125 #define TX1_T_OFF	BIT_9S		/* TX1 Timeout/Recv Timer Tst Off */
1126 #define TX1_T_STEP	BIT_8S		/* TX1 Timeout/Recv Timer Step */
1127 #define RX2_T_EV	BIT_7S		/* RX2 Timeout/Recv Event occured */
1128 #define RX2_T_ON	BIT_6S		/* RX2 Timeout/Recv Timer Test On */
1129 #define RX2_T_OFF	BIT_5S		/* RX2 Timeout/Recv Timer Tst Off */
1130 #define RX2_T_STEP	BIT_4S		/* RX2 Timeout/Recv Timer Step */
1131 #define RX1_T_EV	BIT_3S		/* RX1 Timeout/Recv Event occured */
1132 #define RX1_T_ON	BIT_2S		/* RX1 Timeout/Recv Timer Test On */
1133 #define RX1_T_OFF	BIT_1S		/* RX1 Timeout/Recv Timer Tst Off */
1134 #define RX1_T_STEP	BIT_0S		/* RX1 Timeout/Recv Timer Step */
1135 
1136 
1137 /* Transmit Arbiter Registers MAC 1 and 2, use MR_ADDR() to access */
1138 /*	TXA_ITI_INI		32 bit	Tx Arb Interval Timer Init Val */
1139 /*	TXA_ITI_VAL		32 bit	Tx Arb Interval Timer Value */
1140 /*	TXA_LIM_INI		32 bit	Tx Arb Limit Counter Init Val */
1141 /*	TXA_LIM_VAL		32 bit	Tx Arb Limit Counter Value */
1142 								/* Bit 31..24:	reserved */
1143 #define TXA_MAX_VAL	0x00ffffffUL/* Bit 23.. 0:	Max TXA Timer/Cnt Val */
1144 
1145 /*	TXA_CTRL		 8 bit	Tx Arbiter Control Register */
1146 #define TXA_ENA_FSYNC	BIT_7S	/* Enable  force of sync Tx queue */
1147 #define TXA_DIS_FSYNC	BIT_6S	/* Disable force of sync Tx queue */
1148 #define TXA_ENA_ALLOC	BIT_5S	/* Enable  alloc of free bandwidth */
1149 #define TXA_DIS_ALLOC	BIT_4S	/* Disable alloc of free bandwidth */
1150 #define TXA_START_RC	BIT_3S	/* Start sync Rate Control */
1151 #define TXA_STOP_RC		BIT_2S	/* Stop  sync Rate Control */
1152 #define TXA_ENA_ARB		BIT_1S	/* Enable  Tx Arbiter */
1153 #define TXA_DIS_ARB		BIT_0S	/* Disable Tx Arbiter */
1154 
1155 /*	TXA_TEST		 8 bit	Tx Arbiter Test Register */
1156 								/* Bit 7.. 6:	reserved */
1157 #define TXA_INT_T_ON	BIT_5S	/* Tx Arb Interval Timer Test On */
1158 #define TXA_INT_T_OFF	BIT_4S	/* Tx Arb Interval Timer Test Off */
1159 #define TXA_INT_T_STEP	BIT_3S	/* Tx Arb Interval Timer Step */
1160 #define TXA_LIM_T_ON	BIT_2S	/* Tx Arb Limit Timer Test On */
1161 #define TXA_LIM_T_OFF	BIT_1S	/* Tx Arb Limit Timer Test Off */
1162 #define TXA_LIM_T_STEP	BIT_0S	/* Tx Arb Limit Timer Step */
1163 
1164 /*	TXA_STAT		 8 bit	Tx Arbiter Status Register */
1165 								/* Bit 7.. 1:	reserved */
1166 #define TXA_PRIO_XS		BIT_0S	/* sync queue has prio to send */
1167 
1168 /*	Q_BC			32 bit	Current Byte Counter */
1169 								/* Bit 31..16:	reserved */
1170 #define BC_MAX			0xffff	/* Bit 15.. 0:	Byte counter */
1171 
1172 /* BMU Control Status Registers */
1173 /*	B0_R1_CSR		32 bit	BMU Ctrl/Stat Rx Queue 1 */
1174 /*	B0_R2_CSR		32 bit	BMU Ctrl/Stat Rx Queue 2 */
1175 /*	B0_XA1_CSR		32 bit	BMU Ctrl/Stat Sync Tx Queue 1 */
1176 /*	B0_XS1_CSR		32 bit	BMU Ctrl/Stat Async Tx Queue 1 */
1177 /*	B0_XA2_CSR		32 bit	BMU Ctrl/Stat Sync Tx Queue 2 */
1178 /*	B0_XS2_CSR		32 bit	BMU Ctrl/Stat Async Tx Queue 2 */
1179 /*	Q_CSR			32 bit	BMU Control/Status Register */
1180 								/* Bit 31..25:	reserved */
1181 #define CSR_SV_IDLE		BIT_24		/* BMU SM Idle */
1182 								/* Bit 23..22:	reserved */
1183 #define CSR_DESC_CLR	BIT_21		/* Clear Reset for Descr */
1184 #define CSR_DESC_SET	BIT_20		/* Set   Reset for Descr */
1185 #define CSR_FIFO_CLR	BIT_19		/* Clear Reset for FIFO */
1186 #define CSR_FIFO_SET	BIT_18		/* Set   Reset for FIFO */
1187 #define CSR_HPI_RUN		BIT_17		/* Release HPI SM */
1188 #define CSR_HPI_RST		BIT_16		/* Reset   HPI SM to Idle */
1189 #define CSR_SV_RUN		BIT_15		/* Release Supervisor SM */
1190 #define CSR_SV_RST		BIT_14		/* Reset   Supervisor SM */
1191 #define CSR_DREAD_RUN	BIT_13		/* Release Descr Read SM */
1192 #define CSR_DREAD_RST	BIT_12		/* Reset   Descr Read SM */
1193 #define CSR_DWRITE_RUN	BIT_11		/* Release Descr Write SM */
1194 #define CSR_DWRITE_RST	BIT_10		/* Reset   Descr Write SM */
1195 #define CSR_TRANS_RUN	BIT_9		/* Release Transfer SM */
1196 #define CSR_TRANS_RST	BIT_8		/* Reset   Transfer SM */
1197 #define CSR_ENA_POL		BIT_7		/* Enable  Descr Polling */
1198 #define CSR_DIS_POL		BIT_6		/* Disable Descr Polling */
1199 #define CSR_STOP		BIT_5		/* Stop  Rx/Tx Queue */
1200 #define CSR_START		BIT_4		/* Start Rx/Tx Queue */
1201 #define CSR_IRQ_CL_P	BIT_3		/* (Rx)	Clear Parity IRQ */
1202 #define CSR_IRQ_CL_B	BIT_2		/* Clear EOB IRQ */
1203 #define CSR_IRQ_CL_F	BIT_1		/* Clear EOF IRQ */
1204 #define CSR_IRQ_CL_C	BIT_0		/* Clear ERR IRQ */
1205 
1206 #define CSR_SET_RESET	(CSR_DESC_SET | CSR_FIFO_SET | CSR_HPI_RST |\
1207 						CSR_SV_RST | CSR_DREAD_RST | CSR_DWRITE_RST |\
1208 						CSR_TRANS_RST)
1209 #define CSR_CLR_RESET	(CSR_DESC_CLR | CSR_FIFO_CLR | CSR_HPI_RUN |\
1210 						CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\
1211 						CSR_TRANS_RUN)
1212 
1213 /*	Q_F				32 bit	Flag Register */
1214 									/* Bit 31..28:	reserved */
1215 #define F_ALM_FULL		BIT_27		/* Rx FIFO: almost full */
1216 #define F_EMPTY			BIT_27		/* Tx FIFO: empty flag */
1217 #define F_FIFO_EOF		BIT_26		/* Tag (EOF Flag) bit in FIFO */
1218 #define F_WM_REACHED	BIT_25		/* Watermark reached */
1219 									/* reserved */
1220 #define F_FIFO_LEVEL	(0x1fL<<16)	/* Bit 23..16:	# of Qwords in FIFO */
1221 									/* Bit 15..11: 	reserved */
1222 #define F_WATER_MARK	0x0007ffL	/* Bit 10.. 0:	Watermark */
1223 
1224 /*	Q_T1			32 bit	Test Register 1 */
1225 /*		Holds four State Machine control Bytes */
1226 #define SM_CTRL_SV_MSK	(0xffL<<24)	/* Bit 31..24:	Control Supervisor SM */
1227 #define SM_CTRL_RD_MSK	(0xffL<<16)	/* Bit 23..16:	Control Read Desc SM */
1228 #define SM_CTRL_WR_MSK	(0xffL<<8)	/* Bit 15.. 8:	Control Write Desc SM */
1229 #define SM_CTRL_TR_MSK	0xffL		/* Bit	7.. 0:	Control Transfer SM */
1230 
1231 /*	Q_T1_TR			 8 bit	Test Register 1 Transfer SM */
1232 /*	Q_T1_WR			 8 bit	Test Register 1 Write Descriptor SM */
1233 /*	Q_T1_RD			 8 bit	Test Register 1 Read Descriptor SM */
1234 /*	Q_T1_SV			 8 bit	Test Register 1 Supervisor SM */
1235 
1236 /* The control status byte of each machine looks like ... */
1237 #define SM_STATE		0xf0	/* Bit 7.. 4:	State which shall be loaded */
1238 #define SM_LOAD			BIT_3S	/* Load the SM with SM_STATE */
1239 #define SM_TEST_ON		BIT_2S	/* Switch on SM Test Mode */
1240 #define SM_TEST_OFF		BIT_1S	/* Go off the Test Mode */
1241 #define SM_STEP			BIT_0S	/* Step the State Machine */
1242 /* The encoding of the states is not supported by the Diagnostics Tool */
1243 
1244 /*	Q_T2			32 bit	Test Register 2	*/
1245 								/* Bit 31.. 8:	reserved */
1246 #define T2_AC_T_ON		BIT_7	/* Address Counter Test Mode on */
1247 #define T2_AC_T_OFF		BIT_6	/* Address Counter Test Mode off */
1248 #define T2_BC_T_ON		BIT_5	/* Byte Counter Test Mode on */
1249 #define T2_BC_T_OFF		BIT_4	/* Byte Counter Test Mode off */
1250 #define T2_STEP04		BIT_3	/* Inc AC/Dec BC by 4 */
1251 #define T2_STEP03		BIT_2	/* Inc AC/Dec BC by 3 */
1252 #define T2_STEP02		BIT_1	/* Inc AC/Dec BC by 2 */
1253 #define T2_STEP01		BIT_0	/* Inc AC/Dec BC by 1 */
1254 
1255 /*	Q_T3			32 bit	Test Register 3	*/
1256 								/* Bit 31.. 7:	reserved */
1257 #define T3_MUX_MSK		(7<<4)	/* Bit  6.. 4:	Mux Position */
1258 								/* Bit  3:	reserved */
1259 #define T3_VRAM_MSK		7		/* Bit  2.. 0:	Virtual RAM Buffer Address */
1260 
1261 /* RAM Buffer Register Offsets, use RB_ADDR(Queue, Offs) to access */
1262 /*	RB_START		32 bit	RAM Buffer Start Address */
1263 /*	RB_END			32 bit	RAM Buffer End Address */
1264 /*	RB_WP			32 bit	RAM Buffer Write Pointer */
1265 /*	RB_RP			32 bit	RAM Buffer Read Pointer */
1266 /*	RB_RX_UTPP		32 bit	Rx Upper Threshold, Pause Pack */
1267 /*	RB_RX_LTPP		32 bit	Rx Lower Threshold, Pause Pack */
1268 /*	RB_RX_UTHP		32 bit	Rx Upper Threshold, High Prio */
1269 /*	RB_RX_LTHP		32 bit	Rx Lower Threshold, High Prio */
1270 /*	RB_PC			32 bit	RAM Buffer Packet Counter */
1271 /*	RB_LEV			32 bit	RAM Buffer Level Register */
1272 				/* Bit 31..19:	reserved */
1273 #define RB_MSK	0x0007ffff	/* Bit 18.. 0:	RAM Buffer Pointer Bits */
1274 
1275 /*	RB_TST2			 8 bit	RAM Buffer Test Register 2 */
1276 								/* Bit 7.. 4:	reserved */
1277 #define RB_PC_DEC		BIT_3S	/* Packet Counter Decrem */
1278 #define RB_PC_T_ON		BIT_2S	/* Packet Counter Test On */
1279 #define RB_PC_T_OFF		BIT_1S	/* Packet Counter Tst Off */
1280 #define RB_PC_INC		BIT_0S	/* Packet Counter Increm */
1281 
1282 /*	RB_TST1			 8 bit	RAM Buffer Test Register 1 */
1283 							/* Bit 7:	reserved */
1284 #define RB_WP_T_ON		BIT_6S	/* Write Pointer Test On */
1285 #define RB_WP_T_OFF		BIT_5S	/* Write Pointer Test Off */
1286 #define RB_WP_INC		BIT_4S	/* Write Pointer Increm */
1287 								/* Bit 3:	reserved */
1288 #define RB_RP_T_ON		BIT_2S	/* Read Pointer Test On */
1289 #define RB_RP_T_OFF		BIT_1S	/* Read Pointer Test Off */
1290 #define RB_RP_DEC		BIT_0S	/* Read Pointer Decrement */
1291 
1292 /*	RB_CTRL			 8 bit	RAM Buffer Control Register */
1293 								/* Bit 7.. 6:	reserved */
1294 #define RB_ENA_STFWD	BIT_5S	/* Enable  Store & Forward */
1295 #define RB_DIS_STFWD	BIT_4S	/* Disable Store & Forward */
1296 #define RB_ENA_OP_MD	BIT_3S	/* Enable  Operation Mode */
1297 #define RB_DIS_OP_MD	BIT_2S	/* Disable Operation Mode */
1298 #define RB_RST_CLR		BIT_1S	/* Clear RAM Buf STM Reset */
1299 #define RB_RST_SET		BIT_0S	/* Set   RAM Buf STM Reset */
1300 
1301 
1302 /* Receive and Transmit MAC FIFO Registers (GENESIS only) */
1303 
1304 /*	RX_MFF_EA		32 bit	Receive MAC FIFO End Address */
1305 /*	RX_MFF_WP		32 bit 	Receive MAC FIFO Write Pointer */
1306 /*	RX_MFF_RP		32 bit	Receive MAC FIFO Read Pointer */
1307 /*	RX_MFF_PC		32 bit	Receive MAC FIFO Packet Counter */
1308 /*	RX_MFF_LEV		32 bit	Receive MAC FIFO Level */
1309 /*	TX_MFF_EA		32 bit	Transmit MAC FIFO End Address */
1310 /*	TX_MFF_WP		32 bit 	Transmit MAC FIFO Write Pointer */
1311 /*	TX_MFF_WSP		32 bit	Transmit MAC FIFO WR Shadow Pointer */
1312 /*	TX_MFF_RP		32 bit	Transmit MAC FIFO Read Pointer */
1313 /*	TX_MFF_PC		32 bit	Transmit MAC FIFO Packet Cnt */
1314 /*	TX_MFF_LEV		32 bit	Transmit MAC FIFO Level */
1315 								/* Bit 31.. 6:	reserved */
1316 #define MFF_MSK			0x007fL	/* Bit	5.. 0:	MAC FIFO Address/Ptr Bits */
1317 
1318 /*	RX_MFF_CTRL1	16 bit	Receive MAC FIFO Control Reg 1 */
1319 								/* Bit 15..14:	reserved */
1320 #define MFF_ENA_RDY_PAT	BIT_13S		/* Enable  Ready Patch */
1321 #define MFF_DIS_RDY_PAT	BIT_12S		/* Disable Ready Patch */
1322 #define MFF_ENA_TIM_PAT	BIT_11S		/* Enable  Timing Patch */
1323 #define MFF_DIS_TIM_PAT	BIT_10S		/* Disable Timing Patch */
1324 #define MFF_ENA_ALM_FUL	BIT_9S		/* Enable  AlmostFull Sign */
1325 #define MFF_DIS_ALM_FUL	BIT_8S		/* Disable AlmostFull Sign */
1326 #define MFF_ENA_PAUSE	BIT_7S		/* Enable  Pause Signaling */
1327 #define MFF_DIS_PAUSE	BIT_6S		/* Disable Pause Signaling */
1328 #define MFF_ENA_FLUSH	BIT_5S		/* Enable  Frame Flushing */
1329 #define MFF_DIS_FLUSH	BIT_4S		/* Disable Frame Flushing */
1330 #define MFF_ENA_TIST	BIT_3S		/* Enable  Time Stamp Gener */
1331 #define MFF_DIS_TIST	BIT_2S		/* Disable Time Stamp Gener */
1332 #define MFF_CLR_INTIST	BIT_1S		/* Clear IRQ No Time Stamp */
1333 #define MFF_CLR_INSTAT	BIT_0S		/* Clear IRQ No Status */
1334 
1335 #define MFF_RX_CTRL_DEF MFF_ENA_TIM_PAT
1336 
1337 /*	TX_MFF_CTRL1	16 bit	Transmit MAC FIFO Control Reg 1 */
1338 #define MFF_CLR_PERR	BIT_15S		/* Clear Parity Error IRQ */
1339 								/* Bit 14:	reserved */
1340 #define MFF_ENA_PKT_REC	BIT_13S		/* Enable  Packet Recovery */
1341 #define MFF_DIS_PKT_REC BIT_12S		/* Disable Packet Recovery */
1342 /*	MFF_ENA_TIM_PAT	 (see RX_MFF_CTRL1) Bit 11:	Enable  Timing Patch */
1343 /*	MFF_DIS_TIM_PAT	 (see RX_MFF_CTRL1) Bit 10:	Disable Timing Patch */
1344 /*	MFF_ENA_ALM_FUL	 (see RX_MFF_CTRL1) Bit	 9:	Enable  Almost Full Sign */
1345 /*	MFF_DIS_ALM_FUL	 (see RX_MFF_CTRL1) Bit	 8:	Disable Almost Full Sign */
1346 #define MFF_ENA_W4E		BIT_7S		/* Enable  Wait for Empty */
1347 #define MFF_DIS_W4E		BIT_6S		/* Disable Wait for Empty */
1348 /*	MFF_ENA_FLUSH	 (see RX_MFF_CTRL1) Bit	 5:	Enable  Frame Flushing */
1349 /*	MFF_DIS_FLUSH	 (see RX_MFF_CTRL1) Bit	 4:	Disable Frame Flushing */
1350 #define MFF_ENA_LOOPB	BIT_3S		/* Enable  Loopback */
1351 #define MFF_DIS_LOOPB	BIT_2S		/* Disable Loopback */
1352 #define MFF_CLR_MAC_RST	BIT_1S		/* Clear XMAC Reset */
1353 #define MFF_SET_MAC_RST	BIT_0S		/* Set   XMAC Reset */
1354 
1355 #define MFF_TX_CTRL_DEF	(MFF_ENA_PKT_REC | MFF_ENA_TIM_PAT | MFF_ENA_FLUSH)
1356 
1357 /*	RX_MFF_TST2	 	 8 bit	Receive MAC FIFO Test Register 2 */
1358 /*	TX_MFF_TST2	 	 8 bit	Transmit MAC FIFO Test Register 2 */
1359 								/* Bit 7:	reserved */
1360 #define MFF_WSP_T_ON	BIT_6S	/* Tx: Write Shadow Ptr TestOn */
1361 #define MFF_WSP_T_OFF	BIT_5S	/* Tx: Write Shadow Ptr TstOff */
1362 #define MFF_WSP_INC		BIT_4S	/* Tx: Write Shadow Ptr Increment */
1363 #define MFF_PC_DEC		BIT_3S	/* Packet Counter Decrement */
1364 #define MFF_PC_T_ON		BIT_2S	/* Packet Counter Test On */
1365 #define MFF_PC_T_OFF	BIT_1S	/* Packet Counter Test Off */
1366 #define MFF_PC_INC		BIT_0S	/* Packet Counter Increment */
1367 
1368 /*	RX_MFF_TST1	 	 8 bit	Receive MAC FIFO Test Register 1 */
1369 /*	TX_MFF_TST1	 	 8 bit	Transmit MAC FIFO Test Register 1 */
1370 					/* Bit 7:	reserved */
1371 #define MFF_WP_T_ON		BIT_6S	/* Write Pointer Test On */
1372 #define MFF_WP_T_OFF	BIT_5S	/* Write Pointer Test Off */
1373 #define MFF_WP_INC		BIT_4S	/* Write Pointer Increm */
1374 							/* Bit 3:	reserved */
1375 #define MFF_RP_T_ON		BIT_2S	/* Read Pointer Test On */
1376 #define MFF_RP_T_OFF	BIT_1S	/* Read Pointer Test Off */
1377 #define MFF_RP_DEC		BIT_0S	/* Read Pointer Decrement */
1378 
1379 /*	RX_MFF_CTRL2	 8 bit	Receive MAC FIFO Control Reg 2 */
1380 /*	TX_MFF_CTRL2	 8 bit	Transmit MAC FIFO Control Reg 2 */
1381 								/* Bit 7..4:	reserved */
1382 #define MFF_ENA_OP_MD	BIT_3S	/* Enable  Operation Mode */
1383 #define MFF_DIS_OP_MD	BIT_2S	/* Disable Operation Mode */
1384 #define MFF_RST_CLR		BIT_1S	/* Clear MAC FIFO Reset */
1385 #define MFF_RST_SET		BIT_0S	/* Set   MAC FIFO Reset */
1386 
1387 
1388 /*	Link LED Counter Registers (GENESIS only) */
1389 
1390 /*	RX_LED_CTRL		 8 bit	Receive LED Cnt Control Reg */
1391 /*	TX_LED_CTRL		 8 bit	Transmit LED Cnt Control Reg */
1392 /*	LNK_SYNC_CTRL	 8 bit	Link Sync Cnt Control Register */
1393 							/* Bit 7.. 3:	reserved */
1394 #define LED_START		BIT_2S	/* Start Timer */
1395 #define LED_STOP		BIT_1S	/* Stop Timer */
1396 #define LED_STATE		BIT_0S	/* Rx/Tx: LED State, 1=LED on */
1397 #define LED_CLR_IRQ		BIT_0S	/* Lnk: 	Clear Link IRQ */
1398 
1399 /*	RX_LED_TST		 8 bit	Receive LED Cnt Test Register */
1400 /*	TX_LED_TST		 8 bit	Transmit LED Cnt Test Register */
1401 /*	LNK_SYNC_TST	 8 bit	Link Sync Cnt Test Register */
1402 							/* Bit 7.. 3:	reserved */
1403 #define LED_T_ON		BIT_2S	/* LED Counter Test mode On */
1404 #define LED_T_OFF		BIT_1S	/* LED Counter Test mode Off */
1405 #define LED_T_STEP		BIT_0S	/* LED Counter Step */
1406 
1407 /*	LNK_LED_REG	 	 8 bit	Link LED Register */
1408 								/* Bit 7.. 6:	reserved */
1409 #define LED_BLK_ON		BIT_5S	/* Link LED Blinking On */
1410 #define LED_BLK_OFF		BIT_4S	/* Link LED Blinking Off */
1411 #define LED_SYNC_ON		BIT_3S	/* Use Sync Wire to switch LED */
1412 #define LED_SYNC_OFF	BIT_2S	/* Disable Sync Wire Input */
1413 #define LED_ON			BIT_1S	/* switch LED on */
1414 #define LED_OFF			BIT_0S	/* switch LED off */
1415 
1416 /*	Receive and Transmit GMAC FIFO Registers (YUKON only) */
1417 
1418 /*	RX_GMF_EA		32 bit	Rx GMAC FIFO End Address */
1419 /*	RX_GMF_AF_THR	32 bit	Rx GMAC FIFO Almost Full Thresh. */
1420 /*	RX_GMF_WP		32 bit 	Rx GMAC FIFO Write Pointer */
1421 /*	RX_GMF_WLEV		32 bit 	Rx GMAC FIFO Write Level */
1422 /*	RX_GMF_RP		32 bit 	Rx GMAC FIFO Read Pointer */
1423 /*	RX_GMF_RLEV		32 bit 	Rx GMAC FIFO Read Level */
1424 /*	TX_GMF_EA		32 bit	Tx GMAC FIFO End Address */
1425 /*	TX_GMF_AE_THR	32 bit	Tx GMAC FIFO Almost Empty Thresh.*/
1426 /*	TX_GMF_WP		32 bit 	Tx GMAC FIFO Write Pointer */
1427 /*	TX_GMF_WSP		32 bit 	Tx GMAC FIFO Write Shadow Ptr. */
1428 /*	TX_GMF_WLEV		32 bit 	Tx GMAC FIFO Write Level */
1429 /*	TX_GMF_RP		32 bit 	Tx GMAC FIFO Read Pointer */
1430 /*	TX_GMF_RSTP		32 bit 	Tx GMAC FIFO Restart Pointer */
1431 /*	TX_GMF_RLEV		32 bit 	Tx GMAC FIFO Read Level */
1432 
1433 /*	RX_GMF_CTRL_T	32 bit	Rx GMAC FIFO Control/Test */
1434 						/* Bits 31..15:	reserved */
1435 #define GMF_WP_TST_ON	BIT_14		/* Write Pointer Test On */
1436 #define GMF_WP_TST_OFF	BIT_13		/* Write Pointer Test Off */
1437 #define GMF_WP_STEP		BIT_12		/* Write Pointer Step/Increment */
1438 						/* Bit 11:	reserved */
1439 #define GMF_RP_TST_ON	BIT_10		/* Read Pointer Test On */
1440 #define GMF_RP_TST_OFF	BIT_9		/* Read Pointer Test Off */
1441 #define GMF_RP_STEP		BIT_8		/* Read Pointer Step/Increment */
1442 #define GMF_RX_F_FL_ON	BIT_7		/* Rx FIFO Flush Mode On */
1443 #define GMF_RX_F_FL_OFF	BIT_6		/* Rx FIFO Flush Mode Off */
1444 #define GMF_CLI_RX_FO	BIT_5		/* Clear IRQ Rx FIFO Overrun */
1445 #define GMF_CLI_RX_FC	BIT_4		/* Clear IRQ Rx Frame Complete */
1446 #define GMF_OPER_ON		BIT_3		/* Operational Mode On */
1447 #define GMF_OPER_OFF	BIT_2		/* Operational Mode Off */
1448 #define GMF_RST_CLR		BIT_1		/* Clear GMAC FIFO Reset */
1449 #define GMF_RST_SET		BIT_0		/* Set   GMAC FIFO Reset */
1450 
1451 /*	TX_GMF_CTRL_T	32 bit	Tx GMAC FIFO Control/Test */
1452 						/* Bits 31..19:	reserved */
1453 #define GMF_WSP_TST_ON	BIT_18		/* Write Shadow Pointer Test On */
1454 #define GMF_WSP_TST_OFF	BIT_17		/* Write Shadow Pointer Test Off */
1455 #define GMF_WSP_STEP	BIT_16		/* Write Shadow Pointer Step/Increment */
1456 						/* Bits 15..7: same as for RX_GMF_CTRL_T */
1457 #define GMF_CLI_TX_FU	BIT_6		/* Clear IRQ Tx FIFO Underrun */
1458 #define GMF_CLI_TX_FC	BIT_5		/* Clear IRQ Tx Frame Complete */
1459 #define GMF_CLI_TX_PE	BIT_4		/* Clear IRQ Tx Parity Error */
1460 						/* Bits 3..0: same as for RX_GMF_CTRL_T */
1461 
1462 #define GMF_RX_CTRL_DEF		(GMF_OPER_ON | GMF_RX_F_FL_ON)
1463 #define GMF_TX_CTRL_DEF		GMF_OPER_ON
1464 
1465 #define RX_GMF_FL_THR_DEF	0x0a	/* Rx GMAC FIFO Flush Threshold default */
1466 
1467 /*	GMAC_TI_ST_CTRL	 8 bit	Time Stamp Timer Ctrl Reg (YUKON only) */
1468 								/* Bit 7.. 3:	reserved */
1469 #define GMT_ST_START	BIT_2S		/* Start Time Stamp Timer */
1470 #define GMT_ST_STOP		BIT_1S		/* Stop  Time Stamp Timer */
1471 #define GMT_ST_CLR_IRQ	BIT_0S		/* Clear Time Stamp Timer IRQ */
1472 
1473 /*	GMAC_CTRL		32 bit	GMAC Control Reg (YUKON only) */
1474 						/* Bits 31.. 8:	reserved */
1475 #define GMC_H_BURST_ON	BIT_7		/* Half Duplex Burst Mode On */
1476 #define GMC_H_BURST_OFF	BIT_6		/* Half Duplex Burst Mode Off */
1477 #define GMC_F_LOOPB_ON	BIT_5		/* FIFO Loopback On */
1478 #define GMC_F_LOOPB_OFF	BIT_4		/* FIFO Loopback Off */
1479 #define GMC_PAUSE_ON	BIT_3		/* Pause On */
1480 #define GMC_PAUSE_OFF	BIT_2		/* Pause Off */
1481 #define GMC_RST_CLR		BIT_1		/* Clear GMAC Reset */
1482 #define GMC_RST_SET		BIT_0		/* Set   GMAC Reset */
1483 
1484 /*	GPHY_CTRL		32 bit	GPHY Control Reg (YUKON only) */
1485 						/* Bits 31..29:	reserved */
1486 #define GPC_SEL_BDT		BIT_28	/* Select Bi-Dir. Transfer for MDC/MDIO */
1487 #define GPC_INT_POL_HI	BIT_27	/* IRQ Polarity is Active HIGH */
1488 #define GPC_75_OHM		BIT_26	/* Use 75 Ohm Termination instead of 50 */
1489 #define GPC_DIS_FC		BIT_25	/* Disable Automatic Fiber/Copper Detection */
1490 #define GPC_DIS_SLEEP	BIT_24	/* Disable Energy Detect */
1491 #define GPC_HWCFG_M_3	BIT_23	/* HWCFG_MODE[3] */
1492 #define GPC_HWCFG_M_2	BIT_22	/* HWCFG_MODE[2] */
1493 #define GPC_HWCFG_M_1	BIT_21	/* HWCFG_MODE[1] */
1494 #define GPC_HWCFG_M_0	BIT_20	/* HWCFG_MODE[0] */
1495 #define GPC_ANEG_0		BIT_19	/* ANEG[0] */
1496 #define GPC_ENA_XC		BIT_18	/* Enable MDI crossover */
1497 #define GPC_DIS_125		BIT_17	/* Disable 125 MHz clock */
1498 #define GPC_ANEG_3		BIT_16	/* ANEG[3] */
1499 #define GPC_ANEG_2		BIT_15	/* ANEG[2] */
1500 #define GPC_ANEG_1		BIT_14	/* ANEG[1] */
1501 #define GPC_ENA_PAUSE	BIT_13	/* Enable Pause (SYM_OR_REM) */
1502 #define GPC_PHYADDR_4	BIT_12	/* Bit 4 of Phy Addr */
1503 #define GPC_PHYADDR_3	BIT_11	/* Bit 3 of Phy Addr */
1504 #define GPC_PHYADDR_2	BIT_10	/* Bit 2 of Phy Addr */
1505 #define GPC_PHYADDR_1	BIT_9	/* Bit 1 of Phy Addr */
1506 #define GPC_PHYADDR_0	BIT_8	/* Bit 0 of Phy Addr */
1507 						/* Bits  7..2:	reserved */
1508 #define GPC_RST_CLR		BIT_1	/* Clear GPHY Reset */
1509 #define GPC_RST_SET		BIT_0	/* Set   GPHY Reset */
1510 
1511 #define GPC_HWCFG_GMII_COP	(GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | \
1512 							 GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1513 
1514 #define GPC_HWCFG_GMII_FIB	(				 GPC_HWCFG_M_2 | \
1515 							 GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1516 
1517 #define GPC_ANEG_ADV_ALL_M	(GPC_ANEG_3 | GPC_ANEG_2 | \
1518 							 GPC_ANEG_1 | GPC_ANEG_0)
1519 
1520 /* forced speed and duplex mode (don't mix with other ANEG bits) */
1521 #define GPC_FRC10MBIT_HALF	0
1522 #define GPC_FRC10MBIT_FULL	GPC_ANEG_0
1523 #define GPC_FRC100MBIT_HALF	GPC_ANEG_1
1524 #define GPC_FRC100MBIT_FULL	(GPC_ANEG_0 | GPC_ANEG_1)
1525 
1526 /* auto-negotiation with limited advertised speeds */
1527 /* mix only with master/slave settings (for copper) */
1528 #define GPC_ADV_1000_HALF	GPC_ANEG_2
1529 #define GPC_ADV_1000_FULL	GPC_ANEG_3
1530 #define GPC_ADV_ALL			(GPC_ANEG_2 | GPC_ANEG_3)
1531 
1532 /* master/slave settings */
1533 /* only for copper with 1000 Mbps */
1534 #define GPC_FORCE_MASTER	0
1535 #define GPC_FORCE_SLAVE		GPC_ANEG_0
1536 #define GPC_PREF_MASTER		GPC_ANEG_1
1537 #define GPC_PREF_SLAVE		(GPC_ANEG_1 | GPC_ANEG_0)
1538 
1539 /*	GMAC_IRQ_SRC	 8 bit	GMAC Interrupt Source Reg (YUKON only) */
1540 /*	GMAC_IRQ_MSK	 8 bit	GMAC Interrupt Mask   Reg (YUKON only) */
1541 #define GM_IS_TX_CO_OV	BIT_5		/* Transmit Counter Overflow IRQ */
1542 #define GM_IS_RX_CO_OV	BIT_4		/* Receive Counter Overflow IRQ */
1543 #define GM_IS_TX_FF_UR	BIT_3		/* Transmit FIFO Underrun */
1544 #define GM_IS_TX_COMPL	BIT_2		/* Frame Transmission Complete */
1545 #define GM_IS_RX_FF_OR	BIT_1		/* Receive FIFO Overrun */
1546 #define GM_IS_RX_COMPL	BIT_0		/* Frame Reception Complete */
1547 
1548 #define GMAC_DEF_MSK	(GM_IS_TX_CO_OV | GM_IS_RX_CO_OV | \
1549 						GM_IS_TX_FF_UR)
1550 
1551 /*	GMAC_LINK_CTRL	16 bit	GMAC Link Control Reg (YUKON only) */
1552 						/* Bits 15.. 2:	reserved */
1553 #define GMLC_RST_CLR	BIT_1S		/* Clear GMAC Link Reset */
1554 #define GMLC_RST_SET	BIT_0S		/* Set   GMAC Link Reset */
1555 
1556 
1557 /*	WOL_CTRL_STAT	16 bit	WOL Control/Status Reg */
1558 #define WOL_CTL_LINK_CHG_OCC			BIT_15S
1559 #define WOL_CTL_MAGIC_PKT_OCC			BIT_14S
1560 #define WOL_CTL_PATTERN_OCC				BIT_13S
1561 
1562 #define WOL_CTL_CLEAR_RESULT			BIT_12S
1563 
1564 #define WOL_CTL_ENA_PME_ON_LINK_CHG		BIT_11S
1565 #define WOL_CTL_DIS_PME_ON_LINK_CHG		BIT_10S
1566 #define WOL_CTL_ENA_PME_ON_MAGIC_PKT	BIT_9S
1567 #define WOL_CTL_DIS_PME_ON_MAGIC_PKT	BIT_8S
1568 #define WOL_CTL_ENA_PME_ON_PATTERN		BIT_7S
1569 #define WOL_CTL_DIS_PME_ON_PATTERN		BIT_6S
1570 
1571 #define WOL_CTL_ENA_LINK_CHG_UNIT		BIT_5S
1572 #define WOL_CTL_DIS_LINK_CHG_UNIT		BIT_4S
1573 #define WOL_CTL_ENA_MAGIC_PKT_UNIT		BIT_3S
1574 #define WOL_CTL_DIS_MAGIC_PKT_UNIT		BIT_2S
1575 #define WOL_CTL_ENA_PATTERN_UNIT		BIT_1S
1576 #define WOL_CTL_DIS_PATTERN_UNIT		BIT_0S
1577 
1578 #define WOL_CTL_DEFAULT				\
1579 	(WOL_CTL_DIS_PME_ON_LINK_CHG |	\
1580 	WOL_CTL_DIS_PME_ON_PATTERN |	\
1581 	WOL_CTL_DIS_PME_ON_MAGIC_PKT |	\
1582 	WOL_CTL_DIS_LINK_CHG_UNIT |		\
1583 	WOL_CTL_DIS_PATTERN_UNIT |		\
1584 	WOL_CTL_DIS_MAGIC_PKT_UNIT)
1585 
1586 /*	WOL_MATCH_CTL	 8 bit	WOL Match Control Reg */
1587 #define WOL_CTL_PATT_ENA(x)				(BIT_0 << (x))
1588 
1589 #define SK_NUM_WOL_PATTERN		7
1590 #define SK_PATTERN_PER_WORD		4
1591 #define SK_BITMASK_PATTERN		7
1592 #define SK_POW_PATTERN_LENGTH	128
1593 
1594 #define WOL_LENGTH_MSK		0x7f
1595 #define WOL_LENGTH_SHIFT	8
1596 
1597 
1598 /* Receive and Transmit Descriptors ******************************************/
1599 
1600 /* Transmit Descriptor struct */
1601 typedef	struct s_HwTxd {
1602 	SK_U32 volatile	TxCtrl;	/* Transmit Buffer Control Field */
1603 	SK_U32	TxNext;			/* Physical Address Pointer to the next TxD */
1604 	SK_U32	TxAdrLo;		/* Physical Tx Buffer Address lower dword */
1605 	SK_U32	TxAdrHi;		/* Physical Tx Buffer Address upper dword */
1606 	SK_U32	TxStat;			/* Transmit Frame Status Word */
1607 #ifndef	SK_USE_REV_DESC
1608 	SK_U16	TxTcpOffs;		/* TCP Checksum Calculation Start Value */
1609 	SK_U16	TxRes1;			/* 16 bit reserved field */
1610 	SK_U16	TxTcpWp;		/* TCP Checksum Write Position */
1611 	SK_U16	TxTcpSp;		/* TCP Checksum Calculation Start Position */
1612 #else	/* SK_USE_REV_DESC */
1613 	SK_U16	TxRes1;			/* 16 bit reserved field */
1614 	SK_U16	TxTcpOffs;		/* TCP Checksum Calculation Start Value */
1615 	SK_U16	TxTcpSp;		/* TCP Checksum Calculation Start Position */
1616 	SK_U16	TxTcpWp;		/* TCP Checksum Write Position */
1617 #endif	/* SK_USE_REV_DESC */
1618 	SK_U32  TxRes2;			/* 32 bit reserved field */
1619 } SK_HWTXD;
1620 
1621 /* Receive Descriptor struct */
1622 typedef	struct s_HwRxd {
1623 	SK_U32 volatile RxCtrl;	/* Receive Buffer Control Field */
1624 	SK_U32	RxNext;			/* Physical Address Pointer to the next RxD */
1625 	SK_U32	RxAdrLo;		/* Physical Rx Buffer Address lower dword */
1626 	SK_U32	RxAdrHi;		/* Physical Rx Buffer Address upper dword */
1627 	SK_U32	RxStat;			/* Receive Frame Status Word */
1628 	SK_U32	RxTiSt;			/* Receive Time Stamp (from XMAC on GENESIS) */
1629 #ifndef	SK_USE_REV_DESC
1630 	SK_U16	RxTcpSum1;		/* TCP Checksum 1 */
1631 	SK_U16	RxTcpSum2;		/* TCP Checksum 2 */
1632 	SK_U16	RxTcpSp1;		/* TCP Checksum Calculation Start Position 1 */
1633 	SK_U16	RxTcpSp2;		/* TCP Checksum Calculation Start Position 2 */
1634 #else	/* SK_USE_REV_DESC */
1635 	SK_U16	RxTcpSum2;		/* TCP Checksum 2 */
1636 	SK_U16	RxTcpSum1;		/* TCP Checksum 1 */
1637 	SK_U16	RxTcpSp2;		/* TCP Checksum Calculation Start Position 2 */
1638 	SK_U16	RxTcpSp1;		/* TCP Checksum Calculation Start Position 1 */
1639 #endif	/* SK_USE_REV_DESC */
1640 } SK_HWRXD;
1641 
1642 /*
1643  * Drivers which use the reverse descriptor feature (PCI_OUR_REG_2)
1644  * should set the define SK_USE_REV_DESC.
1645  * Structures are 'normaly' not endianess dependent. But in
1646  * this case the SK_U16 fields are bound to bit positions inside the
1647  * descriptor. RxTcpSum1 e.g. must start at bit 0 within the 6.th DWord.
1648  * The bit positions inside a DWord are of course endianess dependent and
1649  * swaps if the DWord is swapped by the hardware.
1650  */
1651 
1652 
1653 /* Descriptor Bit Definition */
1654 /*	TxCtrl		Transmit Buffer Control Field */
1655 /*	RxCtrl		Receive  Buffer Control Field */
1656 #define BMU_OWN			BIT_31	/* OWN bit: 0=host/1=BMU */
1657 #define BMU_STF			BIT_30	/* Start of Frame */
1658 #define BMU_EOF			BIT_29	/* End of Frame */
1659 #define BMU_IRQ_EOB		BIT_28	/* Req "End of Buffer" IRQ */
1660 #define BMU_IRQ_EOF		BIT_27	/* Req "End of Frame" IRQ */
1661 /* TxCtrl specific bits */
1662 #define BMU_STFWD		BIT_26	/* (Tx)	Store & Forward Frame */
1663 #define BMU_NO_FCS		BIT_25	/* (Tx) Disable MAC FCS (CRC) generation */
1664 #define BMU_SW			BIT_24	/* (Tx)	1 bit res. for SW use */
1665 /* RxCtrl specific bits */
1666 #define BMU_DEV_0		BIT_26	/* (Rx)	Transfer data to Dev0 */
1667 #define BMU_STAT_VAL	BIT_25	/* (Rx)	Rx Status Valid */
1668 #define BMU_TIST_VAL	BIT_24	/* (Rx)	Rx TimeStamp Valid */
1669 								/* Bit 23..16:	BMU Check Opcodes */
1670 #define BMU_CHECK		(0x55L<<16)	/* Default BMU check */
1671 #define BMU_TCP_CHECK	(0x56L<<16)	/* Descr with TCP ext */
1672 #define BMU_UDP_CHECK	(0x57L<<16)	/* Descr with UDP ext (YUKON only) */
1673 #define BMU_BBC			0xffffL	/* Bit 15.. 0:	Buffer Byte Counter */
1674 
1675 /*	TxStat		Transmit Frame Status Word */
1676 /*	RxStat		Receive Frame Status Word */
1677 /*
1678  *Note: TxStat is reserved for ASIC loopback mode only
1679  *
1680  *	The Bits of the Status words are defined in xmac_ii.h
1681  *	(see XMR_FS bits)
1682  */
1683 
1684 /* macros ********************************************************************/
1685 
1686 /* Receive and Transmit Queues */
1687 #define Q_R1	0x0000		/* Receive Queue 1 */
1688 #define Q_R2	0x0080		/* Receive Queue 2 */
1689 #define Q_XS1	0x0200		/* Synchronous Transmit Queue 1 */
1690 #define Q_XA1	0x0280		/* Asynchronous Transmit Queue 1 */
1691 #define Q_XS2	0x0300		/* Synchronous Transmit Queue 2 */
1692 #define Q_XA2	0x0380		/* Asynchronous Transmit Queue 2 */
1693 
1694 /*
1695  *	Macro Q_ADDR()
1696  *
1697  *	Use this macro to access the Receive and Transmit Queue Registers.
1698  *
1699  * para:
1700  *	Queue	Queue to access.
1701  *				Values: Q_R1, Q_R2, Q_XS1, Q_XA1, Q_XS2, and Q_XA2
1702  *	Offs	Queue register offset.
1703  *				Values: Q_D, Q_DA_L ... Q_T2, Q_T3
1704  *
1705  * usage	SK_IN32(pAC, Q_ADDR(Q_R2, Q_BC), pVal)
1706  */
1707 #define Q_ADDR(Queue, Offs)	(B8_Q_REGS + (Queue) + (Offs))
1708 
1709 /*
1710  *	Macro RB_ADDR()
1711  *
1712  *	Use this macro to access the RAM Buffer Registers.
1713  *
1714  * para:
1715  *	Queue	Queue to access.
1716  *				Values: Q_R1, Q_R2, Q_XS1, Q_XA1, Q_XS2, and Q_XA2
1717  *	Offs	Queue register offset.
1718  *				Values: RB_START, RB_END ... RB_LEV, RB_CTRL
1719  *
1720  * usage	SK_IN32(pAC, RB_ADDR(Q_R2, RB_RP), pVal)
1721  */
1722 #define RB_ADDR(Queue, Offs)	(B16_RAM_REGS + (Queue) + (Offs))
1723 
1724 
1725 /* MAC Related Registers */
1726 #define MAC_1		0	/* belongs to the port near the slot */
1727 #define MAC_2		1	/* belongs to the port far away from the slot */
1728 
1729 /*
1730  *	Macro MR_ADDR()
1731  *
1732  *	Use this macro to access a MAC Related Registers inside the ASIC.
1733  *
1734  * para:
1735  *	Mac		MAC to access.
1736  *				Values: MAC_1, MAC_2
1737  *	Offs	MAC register offset.
1738  *				Values: RX_MFF_EA, RX_MFF_WP ... LNK_LED_REG,
1739  *						TX_MFF_EA, TX_MFF_WP ... TX_LED_TST
1740  *
1741  * usage	SK_IN32(pAC, MR_ADDR(MAC_1, TX_MFF_EA), pVal)
1742  */
1743 #define MR_ADDR(Mac, Offs)	(((Mac) << 7) + (Offs))
1744 
1745 #ifdef	SK_LITTLE_ENDIAN
1746 #define XM_WORD_LO	0
1747 #define XM_WORD_HI	1
1748 #else	/* !SK_LITTLE_ENDIAN */
1749 #define XM_WORD_LO	1
1750 #define XM_WORD_HI	0
1751 #endif	/* !SK_LITTLE_ENDIAN */
1752 
1753 
1754 /*
1755  * macros to access the XMAC (GENESIS only)
1756  *
1757  * XM_IN16(),		to read a 16 bit register (e.g. XM_MMU_CMD)
1758  * XM_OUT16(),		to write a 16 bit register (e.g. XM_MMU_CMD)
1759  * XM_IN32(),		to read a 32 bit register (e.g. XM_TX_EV_CNT)
1760  * XM_OUT32(),		to write a 32 bit register (e.g. XM_TX_EV_CNT)
1761  * XM_INADDR(),		to read a network address register (e.g. XM_SRC_CHK)
1762  * XM_OUTADDR(),	to write a network address register (e.g. XM_SRC_CHK)
1763  * XM_INHASH(),		to read the XM_HSM_CHK register
1764  * XM_OUTHASH()		to write the XM_HSM_CHK register
1765  *
1766  * para:
1767  *	Mac		XMAC to access		values: MAC_1 or MAC_2
1768  *	IoC		I/O context needed for SK I/O macros
1769  *	Reg		XMAC Register to read or write
1770  *	(p)Val	Value or pointer to the value which should be read or written
1771  *
1772  * usage:	XM_OUT16(IoC, MAC_1, XM_MMU_CMD, Value);
1773  */
1774 
1775 #define XMA(Mac, Reg)									\
1776 	((BASE_XMAC_1 + (Mac) * (BASE_XMAC_2 - BASE_XMAC_1)) | ((Reg) << 1))
1777 
1778 #define XM_IN16(IoC, Mac, Reg, pVal)					\
1779 	SK_IN16((IoC), XMA((Mac), (Reg)), (pVal))
1780 
1781 #define XM_OUT16(IoC, Mac, Reg, Val)					\
1782 	SK_OUT16((IoC), XMA((Mac), (Reg)), (Val))
1783 
1784 #define XM_IN32(IoC, Mac, Reg, pVal) {					\
1785 	SK_IN16((IoC), XMA((Mac), (Reg)),					\
1786 		(SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_LO]);		\
1787 	SK_IN16((IoC), XMA((Mac), (Reg+2)),					\
1788 		(SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_HI]);		\
1789 }
1790 
1791 #define XM_OUT32(IoC, Mac, Reg, Val) {										\
1792 	SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16)((Val) & 0xffffL));			\
1793 	SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16)(((Val) >> 16) & 0xffffL));\
1794 }
1795 
1796 /* Remember: we are always writing to / reading from LITTLE ENDIAN memory */
1797 
1798 #define XM_INADDR(IoC, Mac, Reg, pVal) {				\
1799 	SK_U16	Word;										\
1800 	SK_U8	*pByte;										\
1801 	pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0];				\
1802 	SK_IN16((IoC), XMA((Mac), (Reg)), &Word);			\
1803 	pByte[0] = (SK_U8)(Word  & 0x00ff);					\
1804 	pByte[1] = (SK_U8)((Word >> 8) & 0x00ff);			\
1805 	SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word);			\
1806 	pByte[2] = (SK_U8)(Word  & 0x00ff);					\
1807 	pByte[3] = (SK_U8)((Word >> 8) & 0x00ff);			\
1808 	SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word);			\
1809 	pByte[4] = (SK_U8)(Word  & 0x00ff);					\
1810 	pByte[5] = (SK_U8)((Word >> 8) & 0x00ff);			\
1811 }
1812 
1813 #define XM_OUTADDR(IoC, Mac, Reg, pVal) {				\
1814 	SK_U8	SK_FAR *pByte;								\
1815 	pByte = (SK_U8 SK_FAR *)&((SK_U8 SK_FAR *)(pVal))[0];	\
1816 	SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16)			\
1817 		(((SK_U16)(pByte[0]) & 0x00ff) |				\
1818 		(((SK_U16)(pByte[1]) << 8) & 0xff00)));			\
1819 	SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16)		\
1820 		(((SK_U16)(pByte[2]) & 0x00ff) |				\
1821 		(((SK_U16)(pByte[3]) << 8) & 0xff00)));			\
1822 	SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16)		\
1823 		(((SK_U16)(pByte[4]) & 0x00ff) |				\
1824 		(((SK_U16)(pByte[5]) << 8) & 0xff00)));			\
1825 }
1826 
1827 #define XM_INHASH(IoC, Mac, Reg, pVal) {				\
1828 	SK_U16	Word;										\
1829 	SK_U8	SK_FAR *pByte;								\
1830 	pByte = (SK_U8 SK_FAR *)&((SK_U8 SK_FAR *)(pVal))[0];	\
1831 	SK_IN16((IoC), XMA((Mac), (Reg)), &Word);			\
1832 	pByte[0] = (SK_U8)(Word  & 0x00ff);					\
1833 	pByte[1] = (SK_U8)((Word >> 8) & 0x00ff);			\
1834 	SK_IN16((IoC), XMA((Mac), (Reg+2)), &Word);			\
1835 	pByte[2] = (SK_U8)(Word  & 0x00ff);					\
1836 	pByte[3] = (SK_U8)((Word >> 8) & 0x00ff);			\
1837 	SK_IN16((IoC), XMA((Mac), (Reg+4)), &Word);			\
1838 	pByte[4] = (SK_U8)(Word  & 0x00ff);					\
1839 	pByte[5] = (SK_U8)((Word >> 8) & 0x00ff);			\
1840 	SK_IN16((IoC), XMA((Mac), (Reg+6)), &Word);			\
1841 	pByte[6] = (SK_U8)(Word  & 0x00ff);					\
1842 	pByte[7] = (SK_U8)((Word >> 8) & 0x00ff);			\
1843 }
1844 
1845 #define XM_OUTHASH(IoC, Mac, Reg, pVal) {				\
1846 	SK_U8	SK_FAR *pByte;								\
1847 	pByte = (SK_U8 SK_FAR *)&((SK_U8 SK_FAR *)(pVal))[0];	\
1848 	SK_OUT16((IoC), XMA((Mac), (Reg)), (SK_U16)			\
1849 		(((SK_U16)(pByte[0]) & 0x00ff)|					\
1850 		(((SK_U16)(pByte[1]) << 8) & 0xff00)));			\
1851 	SK_OUT16((IoC), XMA((Mac), (Reg+2)), (SK_U16)		\
1852 		(((SK_U16)(pByte[2]) & 0x00ff)|					\
1853 		(((SK_U16)(pByte[3]) << 8) & 0xff00)));			\
1854 	SK_OUT16((IoC), XMA((Mac), (Reg+4)), (SK_U16)		\
1855 		(((SK_U16)(pByte[4]) & 0x00ff)|					\
1856 		(((SK_U16)(pByte[5]) << 8) & 0xff00)));			\
1857 	SK_OUT16((IoC), XMA((Mac), (Reg+6)), (SK_U16)		\
1858 		(((SK_U16)(pByte[6]) & 0x00ff)|					\
1859 		(((SK_U16)(pByte[7]) << 8) & 0xff00)));			\
1860 }
1861 
1862 /*
1863  * macros to access the GMAC (YUKON only)
1864  *
1865  * GM_IN16(),		to read  a 16 bit register (e.g. GM_GP_STAT)
1866  * GM_OUT16(),		to write a 16 bit register (e.g. GM_GP_CTRL)
1867  * GM_IN32(),		to read  a 32 bit register (e.g. GM_)
1868  * GM_OUT32(),		to write a 32 bit register (e.g. GM_)
1869  * GM_INADDR(),		to read  a network address register (e.g. GM_SRC_ADDR_1L)
1870  * GM_OUTADDR(),	to write a network address register (e.g. GM_SRC_ADDR_2L)
1871  * GM_INHASH(),		to read  the GM_MC_ADDR_H1 register
1872  * GM_OUTHASH()		to write the GM_MC_ADDR_H1 register
1873  *
1874  * para:
1875  *	Mac		GMAC to access		values: MAC_1 or MAC_2
1876  *	IoC		I/O context needed for SK I/O macros
1877  *	Reg		GMAC Register to read or write
1878  *	(p)Val	Value or pointer to the value which should be read or written
1879  *
1880  * usage:	GM_OUT16(IoC, MAC_1, GM_GP_CTRL, Value);
1881  */
1882 
1883 #define GMA(Mac, Reg)									\
1884 	((BASE_GMAC_1 + (Mac) * (BASE_GMAC_2 - BASE_GMAC_1)) | (Reg))
1885 
1886 #define GM_IN16(IoC, Mac, Reg, pVal)					\
1887 	SK_IN16((IoC), GMA((Mac), (Reg)), (pVal))
1888 
1889 #define GM_OUT16(IoC, Mac, Reg, Val)					\
1890 	SK_OUT16((IoC), GMA((Mac), (Reg)), (Val))
1891 
1892 #define GM_IN32(IoC, Mac, Reg, pVal) {					\
1893 	SK_IN16((IoC), GMA((Mac), (Reg)),					\
1894 		(SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_LO]);		\
1895 	SK_IN16((IoC), GMA((Mac), (Reg+4)),					\
1896 		(SK_U16 SK_FAR*)&((SK_U16 SK_FAR*)(pVal))[XM_WORD_HI]);		\
1897 }
1898 
1899 #define GM_OUT32(IoC, Mac, Reg, Val) {										\
1900 	SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16)((Val) & 0xffffL));			\
1901 	SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16)(((Val) >> 16) & 0xffffL));\
1902 }
1903 
1904 #define GM_INADDR(IoC, Mac, Reg, pVal) {				\
1905 	SK_U16	Word;										\
1906 	SK_U8	*pByte;										\
1907 	pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0];				\
1908 	SK_IN16((IoC), GMA((Mac), (Reg)), &Word);			\
1909 	pByte[0] = (SK_U8)(Word  & 0x00ff);					\
1910 	pByte[1] = (SK_U8)((Word >> 8) & 0x00ff);			\
1911 	SK_IN16((IoC), GMA((Mac), (Reg+4)), &Word);			\
1912 	pByte[2] = (SK_U8)(Word  & 0x00ff);					\
1913 	pByte[3] = (SK_U8)((Word >> 8) & 0x00ff);			\
1914 	SK_IN16((IoC), GMA((Mac), (Reg+8)), &Word);			\
1915 	pByte[4] = (SK_U8)(Word  & 0x00ff);					\
1916 	pByte[5] = (SK_U8)((Word >> 8) & 0x00ff);			\
1917 }
1918 
1919 #define GM_OUTADDR(IoC, Mac, Reg, pVal) {				\
1920 	SK_U8	SK_FAR *pByte;								\
1921 	pByte = (SK_U8 SK_FAR *)&((SK_U8 SK_FAR *)(pVal))[0];	\
1922 	SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16)			\
1923 		(((SK_U16)(pByte[0]) & 0x00ff) |				\
1924 		(((SK_U16)(pByte[1]) << 8) & 0xff00)));			\
1925 	SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16)		\
1926 		(((SK_U16)(pByte[2]) & 0x00ff) |				\
1927 		(((SK_U16)(pByte[3]) << 8) & 0xff00)));			\
1928 	SK_OUT16((IoC), GMA((Mac), (Reg+8)), (SK_U16)		\
1929 		(((SK_U16)(pByte[4]) & 0x00ff) |				\
1930 		(((SK_U16)(pByte[5]) << 8) & 0xff00)));			\
1931 }
1932 
1933 #define GM_INHASH(IoC, Mac, Reg, pVal) {				\
1934 	SK_U16	Word;										\
1935 	SK_U8	*pByte;										\
1936 	pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0];				\
1937 	SK_IN16((IoC), GMA((Mac), (Reg)), &Word);			\
1938 	pByte[0] = (SK_U8)(Word  & 0x00ff);					\
1939 	pByte[1] = (SK_U8)((Word >> 8) & 0x00ff);			\
1940 	SK_IN16((IoC), GMA((Mac), (Reg+4)), &Word);			\
1941 	pByte[2] = (SK_U8)(Word  & 0x00ff);					\
1942 	pByte[3] = (SK_U8)((Word >> 8) & 0x00ff);			\
1943 	SK_IN16((IoC), GMA((Mac), (Reg+8)), &Word);			\
1944 	pByte[4] = (SK_U8)(Word  & 0x00ff);					\
1945 	pByte[5] = (SK_U8)((Word >> 8) & 0x00ff);			\
1946 	SK_IN16((IoC), GMA((Mac), (Reg+12)), &Word);		\
1947 	pByte[6] = (SK_U8)(Word  & 0x00ff);					\
1948 	pByte[7] = (SK_U8)((Word >> 8) & 0x00ff);			\
1949 }
1950 
1951 #define GM_OUTHASH(IoC, Mac, Reg, pVal) {				\
1952 	SK_U8	*pByte;										\
1953 	pByte = (SK_U8 *)&((SK_U8 *)(pVal))[0];				\
1954 	SK_OUT16((IoC), GMA((Mac), (Reg)), (SK_U16)			\
1955 		(((SK_U16)(pByte[0]) & 0x00ff)|					\
1956 		(((SK_U16)(pByte[1]) << 8) & 0xff00)));			\
1957 	SK_OUT16((IoC), GMA((Mac), (Reg+4)), (SK_U16)		\
1958 		(((SK_U16)(pByte[2]) & 0x00ff)|					\
1959 		(((SK_U16)(pByte[3]) << 8) & 0xff00)));			\
1960 	SK_OUT16((IoC), GMA((Mac), (Reg+8)), (SK_U16)		\
1961 		(((SK_U16)(pByte[4]) & 0x00ff)|					\
1962 		(((SK_U16)(pByte[5]) << 8) & 0xff00)));			\
1963 	SK_OUT16((IoC), GMA((Mac), (Reg+12)), (SK_U16)		\
1964 		(((SK_U16)(pByte[6]) & 0x00ff)|					\
1965 		(((SK_U16)(pByte[7]) << 8) & 0xff00)));			\
1966 }
1967 
1968 /*
1969  * Different MAC Types
1970  */
1971 #define SK_MAC_XMAC		0	/* Xaqti XMAC II */
1972 #define SK_MAC_GMAC		1	/* Marvell GMAC */
1973 
1974 /*
1975  * Different PHY Types
1976  */
1977 #define SK_PHY_XMAC			0	/* integrated in XMAC II */
1978 #define SK_PHY_BCOM			1	/* Broadcom BCM5400 */
1979 #define SK_PHY_LONE			2	/* Level One LXT1000 */
1980 #define SK_PHY_NAT			3	/* National DP83891 */
1981 #define SK_PHY_MARV_COPPER	4	/* Marvell 88E1011S */
1982 #define SK_PHY_MARV_FIBER	5	/* Marvell 88E1011S working on fiber */
1983 
1984 /*
1985  * PHY addresses (bits 12..8 of PHY address reg)
1986  */
1987 #define PHY_ADDR_XMAC	(0<<8)
1988 #define PHY_ADDR_BCOM	(1<<8)
1989 #define PHY_ADDR_LONE	(3<<8)
1990 #define PHY_ADDR_NAT	(0<<8)
1991 
1992 /* GPHY address (bits 15..11 of SMI control reg) */
1993 #define PHY_ADDR_MARV	0
1994 
1995 /*
1996  * macros to access the PHY
1997  *
1998  * PHY_READ()		read a 16 bit value from the PHY
1999  * PHY_WRITE()		write a 16 bit value to the PHY
2000  *
2001  * para:
2002  * 	IoC		I/O context needed for SK I/O macros
2003  * 	pPort	Pointer to port struct for PhyAddr
2004  * 	Mac		XMAC to access		values: MAC_1 or MAC_2
2005  * 	PhyReg	PHY Register to read or write
2006  * 	(p)Val	Value or pointer to the value which should be read or
2007  *			written.
2008  *
2009  * usage:	PHY_READ(IoC, pPort, MAC_1, PHY_CTRL, Value);
2010  * Warning: a PHY_READ on an uninitialized PHY (PHY still in reset) never
2011  *          comes back. This is checked in DEBUG mode.
2012  */
2013 #ifndef DEBUG
2014 #define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) {						\
2015 	SK_U16 Mmu;  														\
2016 																		\
2017 	XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr);	\
2018 	XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal));							\
2019 	if ((pPort)->PhyType != SK_PHY_XMAC) {								\
2020 		do {  															\
2021 			XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu);					\
2022 		} while ((Mmu & XM_MMU_PHY_RDY) == 0);							\
2023 		XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal));						\
2024 	}  																	\
2025 }
2026 #else
2027 #define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) {						\
2028 	SK_U16 Mmu;  														\
2029 	int __i = 0;														\
2030 																		\
2031 	XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr);	\
2032 	XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal));							\
2033 	if ((pPort)->PhyType != SK_PHY_XMAC) {								\
2034 		do {  															\
2035 			XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu);					\
2036 			__i++;														\
2037 			if (__i > 100000) {											\
2038 				SK_DBG_PRINTF("*****************************\n");		\
2039 				SK_DBG_PRINTF("PHY_READ on uninitialized PHY\n");		\
2040 				SK_DBG_PRINTF("*****************************\n");		\
2041 				break;													\
2042 			}															\
2043 		} while ((Mmu & XM_MMU_PHY_RDY) == 0);							\
2044 		XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal));						\
2045 	}  																	\
2046 }
2047 #endif /* DEBUG */
2048 
2049 #define PHY_WRITE(IoC, pPort, Mac, PhyReg, Val) {						\
2050 	SK_U16 Mmu;															\
2051 																		\
2052 	if ((pPort)->PhyType != SK_PHY_XMAC) {								\
2053 		do {  															\
2054 			XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu);					\
2055 		} while ((Mmu & XM_MMU_PHY_BUSY) != 0);							\
2056 	}  																	\
2057 	XM_OUT16((IoC), (Mac), XM_PHY_ADDR, (PhyReg) | (pPort)->PhyAddr);	\
2058 	XM_OUT16((IoC), (Mac), XM_PHY_DATA, (Val));							\
2059 	if ((pPort)->PhyType != SK_PHY_XMAC) {								\
2060 		do {  															\
2061 			XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu);					\
2062 		} while ((Mmu & XM_MMU_PHY_BUSY) != 0);							\
2063 	}  																	\
2064 }
2065 
2066 /*
2067  *	Macro PCI_C()
2068  *
2069  *	Use this macro to access PCI config register from the I/O space.
2070  *
2071  * para:
2072  *	Addr	PCI configuration register to access.
2073  *			Values:	PCI_VENDOR_ID ... PCI_VPD_ADR_REG,
2074  *
2075  * usage	SK_IN16(pAC, PCI_C(PCI_VENDOR_ID), pVal);
2076  */
2077 #define PCI_C(Addr)	(B7_CFG_SPC + (Addr))	/* PCI Config Space */
2078 
2079 /*
2080  *	Macro SK_HW_ADDR(Base, Addr)
2081  *
2082  *	Calculates the effective HW address
2083  *
2084  * para:
2085  *	Base	I/O or memory base address
2086  *	Addr	Address offset
2087  *
2088  * usage:	May be used in SK_INxx and SK_OUTxx macros
2089  *		#define SK_IN8(pAC, Addr, pVal) ...\
2090  *			*pVal = (SK_U8)inp(SK_HW_ADDR(pAC->Hw.Iop, Addr)))
2091  */
2092 #ifdef SK_MEM_MAPPED_IO
2093 #define SK_HW_ADDR(Base, Addr)	((Base) + (Addr))
2094 #else  /* SK_MEM_MAPPED_IO */
2095 #define SK_HW_ADDR(Base, Addr)	\
2096 			((Base) + (((Addr) & 0x7f) | (((Addr) >> 7 > 0) ? 0x80 : 0)))
2097 #endif /* SK_MEM_MAPPED_IO */
2098 
2099 #define SZ_LONG	(sizeof(SK_U32))
2100 
2101 /*
2102  *	Macro SK_HWAC_LINK_LED()
2103  *
2104  *	Use this macro to set the link LED mode.
2105  * para:
2106  *	pAC		Pointer to adapter context struct
2107  *	IoC		I/O context needed for SK I/O macros
2108  *  Port	Port number
2109  *	Mode	Mode to set for this LED
2110  */
2111 #define SK_HWAC_LINK_LED(pAC, IoC, Port, Mode) \
2112 	SK_OUT8(IoC, MR_ADDR(Port, LNK_LED_REG), Mode);
2113 
2114 
2115 /* typedefs *******************************************************************/
2116 
2117 
2118 /* function prototypes ********************************************************/
2119 
2120 #ifdef __cplusplus
2121 }
2122 #endif	/* __cplusplus */
2123 
2124 #endif	/* __INC_SKGEHW_H */
2125