ia64/linux-2.6.18-xen.hg

diff drivers/net/amd8111e.h @ 0:831230e53067

Import 2.6.18 from kernel.org tarball.
author Ian Campbell <ian.campbell@xensource.com>
date Wed Apr 11 14:15:44 2007 +0100 (2007-04-11)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/drivers/net/amd8111e.h	Wed Apr 11 14:15:44 2007 +0100
     1.3 @@ -0,0 +1,823 @@
     1.4 +/*
     1.5 + * Advanced  Micro Devices Inc. AMD8111E Linux Network Driver 
     1.6 + * Copyright (C) 2003 Advanced Micro Devices 
     1.7 + *
     1.8 + * This program is free software; you can redistribute it and/or modify
     1.9 + * it under the terms of the GNU General Public License as published by
    1.10 + * the Free Software Foundation; either version 2 of the License, or
    1.11 + * (at your option) any later version.
    1.12 + *
    1.13 + * This program is distributed in the hope that it will be useful,
    1.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 + * GNU General Public License for more details.
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License
    1.19 + * along with this program; if not, write to the Free Software
    1.20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 
    1.21 + * USA
    1.22 +
    1.23 +Module Name:
    1.24 +
    1.25 +    amd8111e.h
    1.26 +
    1.27 +Abstract:
    1.28 +	
    1.29 + 	 AMD8111 based 10/100 Ethernet Controller driver definitions. 
    1.30 +
    1.31 +Environment:
    1.32 +    
    1.33 +	Kernel Mode
    1.34 +
    1.35 +Revision History:
    1.36 + 	3.0.0
    1.37 +	   Initial Revision.
    1.38 +	3.0.1
    1.39 +*/
    1.40 +
    1.41 +#ifndef _AMD811E_H
    1.42 +#define _AMD811E_H
    1.43 +
    1.44 +/* Command style register access
    1.45 +
    1.46 +Registers CMD0, CMD2, CMD3,CMD7 and INTEN0 uses a write access technique called command style access. It allows the write to selected bits of this register without altering the bits that are not selected. Command style registers are divided into 4 bytes that can be written independently. Higher order bit of each byte is the  value bit that specifies the value that will be written into the selected bits of register. 
    1.47 +
    1.48 +eg., if the value 10011010b is written into the least significant byte of a command style register, bits 1,3 and 4 of the register will be set to 1, and the other bits will not be altered. If the value 00011010b is written into the same byte, bits 1,3 and 4 will be cleared to 0 and the other bits will not be altered.
    1.49 +
    1.50 +*/
    1.51 +
    1.52 +/*  Offset for Memory Mapped Registers. */
    1.53 +/* 32 bit registers */
    1.54 +
    1.55 +#define  ASF_STAT		0x00	/* ASF status register */
    1.56 +#define CHIPID			0x04	/* Chip ID regsiter */
    1.57 +#define	MIB_DATA		0x10	/* MIB data register */
    1.58 +#define MIB_ADDR		0x14	/* MIB address register */
    1.59 +#define STAT0			0x30	/* Status0 register */
    1.60 +#define INT0			0x38	/* Interrupt0 register */
    1.61 +#define INTEN0			0x40	/* Interrupt0  enable register*/
    1.62 +#define CMD0			0x48	/* Command0 register */
    1.63 +#define CMD2			0x50	/* Command2 register */
    1.64 +#define CMD3			0x54	/* Command3 resiter */
    1.65 +#define CMD7			0x64	/* Command7 register */
    1.66 +
    1.67 +#define CTRL1 			0x6C	/* Control1 register */
    1.68 +#define CTRL2 			0x70	/* Control2 register */
    1.69 +
    1.70 +#define XMT_RING_LIMIT		0x7C	/* Transmit ring limit register */
    1.71 +
    1.72 +#define AUTOPOLL0		0x88	/* Auto-poll0 register */
    1.73 +#define AUTOPOLL1		0x8A	/* Auto-poll1 register */
    1.74 +#define AUTOPOLL2		0x8C	/* Auto-poll2 register */
    1.75 +#define AUTOPOLL3		0x8E	/* Auto-poll3 register */
    1.76 +#define AUTOPOLL4		0x90	/* Auto-poll4 register */
    1.77 +#define	AUTOPOLL5		0x92	/* Auto-poll5 register */
    1.78 +
    1.79 +#define AP_VALUE		0x98	/* Auto-poll value register */
    1.80 +#define DLY_INT_A		0xA8	/* Group A delayed interrupt register */
    1.81 +#define DLY_INT_B		0xAC	/* Group B delayed interrupt register */
    1.82 +
    1.83 +#define FLOW_CONTROL		0xC8	/* Flow control register */
    1.84 +#define PHY_ACCESS		0xD0	/* PHY access register */
    1.85 +
    1.86 +#define STVAL			0xD8	/* Software timer value register */
    1.87 +
    1.88 +#define XMT_RING_BASE_ADDR0	0x100	/* Transmit ring0 base addr register */
    1.89 +#define XMT_RING_BASE_ADDR1	0x108	/* Transmit ring1 base addr register */
    1.90 +#define XMT_RING_BASE_ADDR2	0x110	/* Transmit ring2 base addr register */
    1.91 +#define XMT_RING_BASE_ADDR3	0x118	/* Transmit ring2 base addr register */
    1.92 +
    1.93 +#define RCV_RING_BASE_ADDR0	0x120	/* Transmit ring0 base addr register */
    1.94 +
    1.95 +#define PMAT0			0x190	/* OnNow pattern register0 */
    1.96 +#define PMAT1			0x194	/* OnNow pattern register1 */
    1.97 +
    1.98 +/* 16bit registers */
    1.99 +
   1.100 +#define XMT_RING_LEN0		0x140	/* Transmit Ring0 length register */
   1.101 +#define XMT_RING_LEN1		0x144	/* Transmit Ring1 length register */
   1.102 +#define XMT_RING_LEN2		0x148 	/* Transmit Ring2 length register */
   1.103 +#define XMT_RING_LEN3		0x14C	/* Transmit Ring3 length register */
   1.104 +
   1.105 +#define RCV_RING_LEN0		0x150	/* Receive Ring0 length register */
   1.106 +
   1.107 +#define SRAM_SIZE		0x178	/* SRAM size register */
   1.108 +#define SRAM_BOUNDARY		0x17A	/* SRAM boundary register */
   1.109 +
   1.110 +/* 48bit register */
   1.111 +
   1.112 +#define PADR			0x160	/* Physical address register */
   1.113 +
   1.114 +#define IFS1			0x18C	/* Inter-frame spacing Part1 register */
   1.115 +#define IFS			0x18D	/* Inter-frame spacing register */
   1.116 +#define IPG			0x18E	/* Inter-frame gap register */
   1.117 +/* 64bit register */
   1.118 +
   1.119 +#define LADRF			0x168	/* Logical address filter register */
   1.120 +
   1.121 +
   1.122 +/* Register Bit Definitions */
   1.123 +typedef enum {
   1.124 +
   1.125 +	ASF_INIT_DONE		= (1 << 1),
   1.126 +	ASF_INIT_PRESENT	= (1 << 0),
   1.127 +
   1.128 +}STAT_ASF_BITS; 
   1.129 +   
   1.130 +typedef enum {
   1.131 +
   1.132 +	MIB_CMD_ACTIVE		= (1 << 15 ),
   1.133 +	MIB_RD_CMD		= (1 << 13 ),
   1.134 +	MIB_CLEAR		= (1 << 12 ),
   1.135 +	MIB_ADDRESS		= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)|
   1.136 +					(1 << 4) | (1 << 5),
   1.137 +}MIB_ADDR_BITS;
   1.138 +
   1.139 +
   1.140 +typedef enum {
   1.141 +	
   1.142 +	PMAT_DET		= (1 << 12),
   1.143 +	MP_DET		        = (1 << 11),
   1.144 +	LC_DET			= (1 << 10),
   1.145 +	SPEED_MASK		= (1 << 9)|(1 << 8)|(1 << 7),
   1.146 +	FULL_DPLX		= (1 << 6),
   1.147 +	LINK_STATS		= (1 << 5),
   1.148 +	AUTONEG_COMPLETE	= (1 << 4),
   1.149 +	MIIPD			= (1 << 3),
   1.150 +	RX_SUSPENDED		= (1 << 2),
   1.151 +	TX_SUSPENDED		= (1 << 1),
   1.152 +	RUNNING			= (1 << 0),
   1.153 +
   1.154 +}STAT0_BITS;
   1.155 +
   1.156 +#define PHY_SPEED_10		0x2
   1.157 +#define PHY_SPEED_100		0x3
   1.158 +
   1.159 +/* INT0				0x38, 32bit register */
   1.160 +typedef enum {
   1.161 +
   1.162 +	INTR			= (1 << 31),
   1.163 +	PCSINT			= (1 << 28), 
   1.164 +	LCINT			= (1 << 27),
   1.165 +	APINT5			= (1 << 26),
   1.166 +	APINT4			= (1 << 25),
   1.167 +	APINT3			= (1 << 24),
   1.168 +	TINT_SUM		= (1 << 23),
   1.169 +	APINT2			= (1 << 22),
   1.170 +	APINT1			= (1 << 21),
   1.171 +	APINT0			= (1 << 20),
   1.172 +	MIIPDTINT		= (1 << 19),
   1.173 +	MCCINT			= (1 << 17),
   1.174 +	MREINT			= (1 << 16),
   1.175 +	RINT_SUM		= (1 << 15),
   1.176 +	SPNDINT			= (1 << 14),
   1.177 +	MPINT			= (1 << 13),
   1.178 +	SINT			= (1 << 12),
   1.179 +	TINT3			= (1 << 11),
   1.180 +	TINT2			= (1 << 10),
   1.181 +	TINT1			= (1 << 9),
   1.182 +	TINT0			= (1 << 8),
   1.183 +	UINT			= (1 << 7),
   1.184 +	STINT			= (1 << 4),
   1.185 +	RINT0			= (1 << 0),
   1.186 +
   1.187 +}INT0_BITS;
   1.188 +
   1.189 +typedef enum {
   1.190 +
   1.191 +	VAL3			= (1 << 31),   /* VAL bit for byte 3 */
   1.192 +	VAL2			= (1 << 23),   /* VAL bit for byte 2 */
   1.193 +	VAL1			= (1 << 15),   /* VAL bit for byte 1 */
   1.194 +	VAL0			= (1 << 7),    /* VAL bit for byte 0 */
   1.195 +
   1.196 +}VAL_BITS;
   1.197 +
   1.198 +typedef enum {
   1.199 +
   1.200 +	/* VAL3 */
   1.201 +	LCINTEN			= (1 << 27),
   1.202 +	APINT5EN		= (1 << 26),
   1.203 +	APINT4EN		= (1 << 25),
   1.204 +	APINT3EN		= (1 << 24),
   1.205 +	/* VAL2 */
   1.206 +	APINT2EN		= (1 << 22),
   1.207 +	APINT1EN		= (1 << 21),
   1.208 +	APINT0EN		= (1 << 20),
   1.209 +	MIIPDTINTEN		= (1 << 19),
   1.210 +	MCCIINTEN		= (1 << 18),
   1.211 +	MCCINTEN		= (1 << 17),
   1.212 +	MREINTEN		= (1 << 16),
   1.213 +	/* VAL1 */
   1.214 +	SPNDINTEN		= (1 << 14),
   1.215 +	MPINTEN			= (1 << 13),
   1.216 +	TINTEN3			= (1 << 11),
   1.217 +	SINTEN			= (1 << 12),
   1.218 +	TINTEN2			= (1 << 10),
   1.219 +	TINTEN1			= (1 << 9),
   1.220 +	TINTEN0			= (1 << 8),
   1.221 +	/* VAL0 */
   1.222 +	STINTEN			= (1 << 4),
   1.223 +	RINTEN0			= (1 << 0),
   1.224 +
   1.225 +	INTEN0_CLEAR 		= 0x1F7F7F1F, /* Command style register */
   1.226 +
   1.227 +}INTEN0_BITS;		
   1.228 +
   1.229 +typedef enum {
   1.230 +	/* VAL2 */
   1.231 +	RDMD0			= (1 << 16),
   1.232 +	/* VAL1 */
   1.233 +	TDMD3			= (1 << 11),
   1.234 +	TDMD2			= (1 << 10),
   1.235 +	TDMD1			= (1 << 9),
   1.236 +	TDMD0			= (1 << 8),
   1.237 +	/* VAL0 */
   1.238 +	UINTCMD			= (1 << 6),
   1.239 +	RX_FAST_SPND		= (1 << 5),
   1.240 +	TX_FAST_SPND		= (1 << 4),
   1.241 +	RX_SPND			= (1 << 3),
   1.242 +	TX_SPND			= (1 << 2),
   1.243 +	INTREN			= (1 << 1),
   1.244 +	RUN			= (1 << 0),
   1.245 +
   1.246 +	CMD0_CLEAR 		= 0x000F0F7F,   /* Command style register */	
   1.247 +
   1.248 +}CMD0_BITS;
   1.249 +
   1.250 +typedef enum {
   1.251 +
   1.252 +	/* VAL3 */
   1.253 +	CONDUIT_MODE		= (1 << 29),
   1.254 +	/* VAL2 */
   1.255 +	RPA			= (1 << 19),
   1.256 +	DRCVPA			= (1 << 18),
   1.257 +	DRCVBC			= (1 << 17),
   1.258 +	PROM			= (1 << 16),
   1.259 +	/* VAL1 */
   1.260 +	ASTRP_RCV		= (1 << 13),
   1.261 +	RCV_DROP0	  	= (1 << 12),
   1.262 +	EMBA			= (1 << 11),
   1.263 +	DXMT2PD			= (1 << 10),
   1.264 +	LTINTEN			= (1 << 9),
   1.265 +	DXMTFCS			= (1 << 8),
   1.266 +	/* VAL0 */
   1.267 +	APAD_XMT		= (1 << 6),
   1.268 +	DRTY			= (1 << 5),
   1.269 +	INLOOP			= (1 << 4),
   1.270 +	EXLOOP			= (1 << 3),
   1.271 +	REX_RTRY		= (1 << 2),
   1.272 +	REX_UFLO		= (1 << 1),
   1.273 +	REX_LCOL		= (1 << 0),
   1.274 +
   1.275 +	CMD2_CLEAR 		= 0x3F7F3F7F,   /* Command style register */
   1.276 +
   1.277 +}CMD2_BITS;
   1.278 +
   1.279 +typedef enum {
   1.280 +
   1.281 +	/* VAL3 */
   1.282 +	ASF_INIT_DONE_ALIAS	= (1 << 29),
   1.283 +	/* VAL2 */
   1.284 +	JUMBO			= (1 << 21),
   1.285 +	VSIZE			= (1 << 20),	
   1.286 +	VLONLY			= (1 << 19),
   1.287 +	VL_TAG_DEL		= (1 << 18),	
   1.288 +	/* VAL1 */
   1.289 +	EN_PMGR			= (1 << 14),			
   1.290 +	INTLEVEL		= (1 << 13),
   1.291 +	FORCE_FULL_DUPLEX	= (1 << 12),	
   1.292 +	FORCE_LINK_STATUS	= (1 << 11),	
   1.293 +	APEP			= (1 << 10),	
   1.294 +	MPPLBA			= (1 << 9),	
   1.295 +	/* VAL0 */
   1.296 +	RESET_PHY_PULSE		= (1 << 2),	
   1.297 +	RESET_PHY		= (1 << 1),	
   1.298 +	PHY_RST_POL		= (1 << 0),	
   1.299 +
   1.300 +}CMD3_BITS;
   1.301 +
   1.302 +
   1.303 +typedef enum {
   1.304 +
   1.305 +	/* VAL0 */
   1.306 +	PMAT_SAVE_MATCH		= (1 << 4),
   1.307 +	PMAT_MODE		= (1 << 3),
   1.308 +	MPEN_SW			= (1 << 1),
   1.309 +	LCMODE_SW		= (1 << 0),
   1.310 +
   1.311 +	CMD7_CLEAR  		= 0x0000001B	/* Command style register */
   1.312 +
   1.313 +}CMD7_BITS;
   1.314 +
   1.315 +
   1.316 +typedef enum {
   1.317 +
   1.318 +	RESET_PHY_WIDTH		= (0xF << 16) | (0xF<< 20), /* 0x00FF0000 */
   1.319 +	XMTSP_MASK		= (1 << 9) | (1 << 8),	/* 9:8 */
   1.320 +	XMTSP_128		= (1 << 9),	/* 9 */	
   1.321 +	XMTSP_64		= (1 << 8),
   1.322 +	CACHE_ALIGN		= (1 << 4),
   1.323 +	BURST_LIMIT_MASK	= (0xF << 0 ),
   1.324 +	CTRL1_DEFAULT		= 0x00010111,
   1.325 +
   1.326 +}CTRL1_BITS;
   1.327 +
   1.328 +typedef enum {
   1.329 +
   1.330 +	FMDC_MASK		= (1 << 9)|(1 << 8),	/* 9:8 */
   1.331 +	XPHYRST			= (1 << 7),
   1.332 +	XPHYANE			= (1 << 6),
   1.333 +	XPHYFD			= (1 << 5),
   1.334 +	XPHYSP			= (1 << 4) | (1 << 3),	/* 4:3 */
   1.335 +	APDW_MASK		= (1 <<	2) | (1 << 1) | (1 << 0), /* 2:0 */
   1.336 +
   1.337 +}CTRL2_BITS;
   1.338 +
   1.339 +/* XMT_RING_LIMIT		0x7C, 32bit register */
   1.340 +typedef enum {
   1.341 +
   1.342 +	XMT_RING2_LIMIT		= (0xFF << 16),	/* 23:16 */
   1.343 +	XMT_RING1_LIMIT		= (0xFF << 8),	/* 15:8 */
   1.344 +	XMT_RING0_LIMIT		= (0xFF << 0), 	/* 7:0 */
   1.345 +
   1.346 +}XMT_RING_LIMIT_BITS;
   1.347 +
   1.348 +typedef enum {
   1.349 +
   1.350 +	AP_REG0_EN		= (1 << 15),
   1.351 +	AP_REG0_ADDR_MASK	= (0xF << 8) |(1 << 12),/* 12:8 */
   1.352 +	AP_PHY0_ADDR_MASK	= (0xF << 0) |(1 << 4),/* 4:0 */
   1.353 +
   1.354 +}AUTOPOLL0_BITS;
   1.355 +
   1.356 +/* AUTOPOLL1			0x8A, 16bit register */
   1.357 +typedef enum {
   1.358 +
   1.359 +	AP_REG1_EN		= (1 << 15),
   1.360 +	AP_REG1_ADDR_MASK	= (0xF << 8) |(1 << 12),/* 12:8 */
   1.361 +	AP_PRE_SUP1		= (1 << 6),
   1.362 +	AP_PHY1_DFLT		= (1 << 5),
   1.363 +	AP_PHY1_ADDR_MASK	= (0xF << 0) |(1 << 4),/* 4:0 */
   1.364 +
   1.365 +}AUTOPOLL1_BITS;
   1.366 +
   1.367 +
   1.368 +typedef enum {
   1.369 +
   1.370 +	AP_REG2_EN		= (1 << 15),
   1.371 +	AP_REG2_ADDR_MASK	= (0xF << 8) |(1 << 12),/* 12:8 */
   1.372 +	AP_PRE_SUP2		= (1 << 6),
   1.373 +	AP_PHY2_DFLT		= (1 << 5),
   1.374 +	AP_PHY2_ADDR_MASK	= (0xF << 0) |(1 << 4),/* 4:0 */
   1.375 +
   1.376 +}AUTOPOLL2_BITS;
   1.377 +
   1.378 +typedef enum {
   1.379 +
   1.380 +	AP_REG3_EN		= (1 << 15),
   1.381 +	AP_REG3_ADDR_MASK	= (0xF << 8) |(1 << 12),/* 12:8 */
   1.382 +	AP_PRE_SUP3		= (1 << 6),
   1.383 +	AP_PHY3_DFLT		= (1 << 5),
   1.384 +	AP_PHY3_ADDR_MASK	= (0xF << 0) |(1 << 4),/* 4:0 */
   1.385 +
   1.386 +}AUTOPOLL3_BITS;
   1.387 +
   1.388 +
   1.389 +typedef enum {
   1.390 +
   1.391 +	AP_REG4_EN		= (1 << 15),
   1.392 +	AP_REG4_ADDR_MASK	= (0xF << 8) |(1 << 12),/* 12:8 */
   1.393 +	AP_PRE_SUP4		= (1 << 6),
   1.394 +	AP_PHY4_DFLT		= (1 << 5),
   1.395 +	AP_PHY4_ADDR_MASK	= (0xF << 0) |(1 << 4),/* 4:0 */
   1.396 +
   1.397 +}AUTOPOLL4_BITS;
   1.398 +
   1.399 +
   1.400 +typedef enum {
   1.401 +
   1.402 +	AP_REG5_EN		= (1 << 15),
   1.403 +	AP_REG5_ADDR_MASK	= (0xF << 8) |(1 << 12),/* 12:8 */
   1.404 +	AP_PRE_SUP5		= (1 << 6),
   1.405 +	AP_PHY5_DFLT		= (1 << 5),
   1.406 +	AP_PHY5_ADDR_MASK	= (0xF << 0) |(1 << 4),/* 4:0 */
   1.407 +
   1.408 +}AUTOPOLL5_BITS;
   1.409 +
   1.410 +
   1.411 +
   1.412 +
   1.413 +/* AP_VALUE 			0x98, 32bit ragister */
   1.414 +typedef enum {
   1.415 +
   1.416 +	AP_VAL_ACTIVE		= (1 << 31),
   1.417 +	AP_VAL_RD_CMD		= ( 1 << 29),
   1.418 +	AP_ADDR			= (1 << 18)|(1 << 17)|(1 << 16), /* 18:16 */
   1.419 +	AP_VAL			= (0xF << 0) | (0xF << 4) |( 0xF << 8) |
   1.420 +				  (0xF << 12),	/* 15:0 */
   1.421 +
   1.422 +}AP_VALUE_BITS;
   1.423 +
   1.424 +typedef enum {
   1.425 +
   1.426 +	DLY_INT_A_R3		= (1 << 31),
   1.427 +	DLY_INT_A_R2		= (1 << 30),
   1.428 +	DLY_INT_A_R1		= (1 << 29),
   1.429 +	DLY_INT_A_R0		= (1 << 28),
   1.430 +	DLY_INT_A_T3		= (1 << 27),
   1.431 +	DLY_INT_A_T2		= (1 << 26),
   1.432 +	DLY_INT_A_T1		= (1 << 25),
   1.433 +	DLY_INT_A_T0		= ( 1 << 24),
   1.434 +	EVENT_COUNT_A		= (0xF << 16) | (0x1 << 20),/* 20:16 */
   1.435 +	MAX_DELAY_TIME_A	= (0xF << 0) | (0xF << 4) | (1 << 8)|
   1.436 +				  (1 << 9) | (1 << 10),	/* 10:0 */
   1.437 +
   1.438 +}DLY_INT_A_BITS;
   1.439 +
   1.440 +typedef enum {
   1.441 +
   1.442 +	DLY_INT_B_R3		= (1 << 31),
   1.443 +	DLY_INT_B_R2		= (1 << 30),
   1.444 +	DLY_INT_B_R1		= (1 << 29),
   1.445 +	DLY_INT_B_R0		= (1 << 28),
   1.446 +	DLY_INT_B_T3		= (1 << 27),
   1.447 +	DLY_INT_B_T2		= (1 << 26),
   1.448 +	DLY_INT_B_T1		= (1 << 25),
   1.449 +	DLY_INT_B_T0		= ( 1 << 24),
   1.450 +	EVENT_COUNT_B		= (0xF << 16) | (0x1 << 20),/* 20:16 */
   1.451 +	MAX_DELAY_TIME_B	= (0xF << 0) | (0xF << 4) | (1 << 8)| 
   1.452 +				  (1 << 9) | (1 << 10),	/* 10:0 */
   1.453 +}DLY_INT_B_BITS;
   1.454 +
   1.455 +
   1.456 +/* FLOW_CONTROL 		0xC8, 32bit register */
   1.457 +typedef enum {
   1.458 +
   1.459 +	PAUSE_LEN_CHG		= (1 << 30),
   1.460 +	FTPE			= (1 << 22),
   1.461 +	FRPE			= (1 << 21),
   1.462 +	NAPA			= (1 << 20),
   1.463 +	NPA			= (1 << 19),
   1.464 +	FIXP			= ( 1 << 18),
   1.465 +	FCCMD			= ( 1 << 16),
   1.466 +	PAUSE_LEN		= (0xF << 0) | (0xF << 4) |( 0xF << 8) |	 				  (0xF << 12),	/* 15:0 */
   1.467 +
   1.468 +}FLOW_CONTROL_BITS;
   1.469 +
   1.470 +/* PHY_ ACCESS			0xD0, 32bit register */
   1.471 +typedef enum {
   1.472 +
   1.473 +	PHY_CMD_ACTIVE		= (1 << 31),
   1.474 +	PHY_WR_CMD		= (1 << 30),
   1.475 +	PHY_RD_CMD		= (1 << 29),
   1.476 +	PHY_RD_ERR		= (1 << 28),
   1.477 +	PHY_PRE_SUP		= (1 << 27),
   1.478 +	PHY_ADDR		= (1 << 21) | (1 << 22) | (1 << 23)|
   1.479 +				  	(1 << 24) |(1 << 25),/* 25:21 */
   1.480 +	PHY_REG_ADDR		= (1 << 16) | (1 << 17) | (1 << 18)|	 			  	   	  	(1 << 19) | (1 << 20),/* 20:16 */
   1.481 +	PHY_DATA		= (0xF << 0)|(0xF << 4) |(0xF << 8)|
   1.482 +					(0xF << 12),/* 15:0 */
   1.483 +
   1.484 +}PHY_ACCESS_BITS;
   1.485 +
   1.486 +
   1.487 +/* PMAT0			0x190,	 32bit register */
   1.488 +typedef enum {
   1.489 +	PMR_ACTIVE		= (1 << 31),
   1.490 +	PMR_WR_CMD		= (1 << 30),
   1.491 +	PMR_RD_CMD		= (1 << 29),
   1.492 +	PMR_BANK		= (1 <<28),
   1.493 +	PMR_ADDR		= (0xF << 16)|(1 << 20)|(1 << 21)|
   1.494 +				  	(1 << 22),/* 22:16 */
   1.495 +	PMR_B4			= (0xF << 0) | (0xF << 4),/* 15:0 */
   1.496 +}PMAT0_BITS;
   1.497 +
   1.498 +
   1.499 +/* PMAT1			0x194,	 32bit register */
   1.500 +typedef enum {
   1.501 +	PMR_B3			= (0xF << 24) | (0xF <<28),/* 31:24 */
   1.502 +	PMR_B2			= (0xF << 16) |(0xF << 20),/* 23:16 */
   1.503 +	PMR_B1			= (0xF << 8) | (0xF <<12), /* 15:8 */
   1.504 +	PMR_B0			= (0xF << 0)|(0xF << 4),/* 7:0 */
   1.505 +}PMAT1_BITS;
   1.506 +
   1.507 +/************************************************************************/
   1.508 +/*                                                                      */
   1.509 +/*                      MIB counter definitions                         */
   1.510 +/*                                                                      */
   1.511 +/************************************************************************/
   1.512 +
   1.513 +#define rcv_miss_pkts				0x00
   1.514 +#define rcv_octets				0x01
   1.515 +#define rcv_broadcast_pkts			0x02
   1.516 +#define rcv_multicast_pkts			0x03
   1.517 +#define rcv_undersize_pkts			0x04
   1.518 +#define rcv_oversize_pkts			0x05
   1.519 +#define rcv_fragments				0x06
   1.520 +#define rcv_jabbers				0x07
   1.521 +#define rcv_unicast_pkts			0x08
   1.522 +#define rcv_alignment_errors			0x09
   1.523 +#define rcv_fcs_errors				0x0A
   1.524 +#define rcv_good_octets				0x0B
   1.525 +#define rcv_mac_ctrl				0x0C
   1.526 +#define rcv_flow_ctrl				0x0D
   1.527 +#define rcv_pkts_64_octets			0x0E
   1.528 +#define rcv_pkts_65to127_octets			0x0F
   1.529 +#define rcv_pkts_128to255_octets		0x10
   1.530 +#define rcv_pkts_256to511_octets		0x11
   1.531 +#define rcv_pkts_512to1023_octets		0x12
   1.532 +#define rcv_pkts_1024to1518_octets		0x13
   1.533 +#define rcv_unsupported_opcode			0x14
   1.534 +#define rcv_symbol_errors			0x15
   1.535 +#define rcv_drop_pkts_ring1			0x16
   1.536 +#define rcv_drop_pkts_ring2			0x17
   1.537 +#define rcv_drop_pkts_ring3			0x18
   1.538 +#define rcv_drop_pkts_ring4			0x19
   1.539 +#define rcv_jumbo_pkts				0x1A
   1.540 +
   1.541 +#define xmt_underrun_pkts			0x20
   1.542 +#define xmt_octets				0x21
   1.543 +#define xmt_packets				0x22
   1.544 +#define xmt_broadcast_pkts			0x23
   1.545 +#define xmt_multicast_pkts			0x24
   1.546 +#define xmt_collisions				0x25
   1.547 +#define xmt_unicast_pkts			0x26
   1.548 +#define xmt_one_collision			0x27
   1.549 +#define xmt_multiple_collision			0x28
   1.550 +#define xmt_deferred_transmit			0x29
   1.551 +#define xmt_late_collision			0x2A
   1.552 +#define xmt_excessive_defer			0x2B
   1.553 +#define xmt_loss_carrier			0x2C
   1.554 +#define xmt_excessive_collision			0x2D
   1.555 +#define xmt_back_pressure			0x2E
   1.556 +#define xmt_flow_ctrl				0x2F
   1.557 +#define xmt_pkts_64_octets			0x30
   1.558 +#define xmt_pkts_65to127_octets			0x31
   1.559 +#define xmt_pkts_128to255_octets		0x32
   1.560 +#define xmt_pkts_256to511_octets		0x33
   1.561 +#define xmt_pkts_512to1023_octets		0x34
   1.562 +#define xmt_pkts_1024to1518_octet		0x35
   1.563 +#define xmt_oversize_pkts			0x36
   1.564 +#define xmt_jumbo_pkts				0x37
   1.565 +
   1.566 +
   1.567 +/* Driver definitions */
   1.568 +
   1.569 +#define	 PCI_VENDOR_ID_AMD		0x1022
   1.570 +#define  PCI_DEVICE_ID_AMD8111E_7462	0x7462
   1.571 +
   1.572 +#define MAX_UNITS			8 /* Maximum number of devices possible */
   1.573 +
   1.574 +#define NUM_TX_BUFFERS			32 /* Number of transmit buffers */
   1.575 +#define NUM_RX_BUFFERS			32 /* Number of receive buffers */	
   1.576 +
   1.577 +#define TX_BUFF_MOD_MASK         	31 /* (NUM_TX_BUFFERS -1) */
   1.578 +#define RX_BUFF_MOD_MASK         	31 /* (NUM_RX_BUFFERS -1) */
   1.579 +
   1.580 +#define NUM_TX_RING_DR			32  
   1.581 +#define NUM_RX_RING_DR			32 
   1.582 +
   1.583 +#define TX_RING_DR_MOD_MASK         	31 /* (NUM_TX_RING_DR -1) */
   1.584 +#define RX_RING_DR_MOD_MASK         	31 /* (NUM_RX_RING_DR -1) */
   1.585 +
   1.586 +#define MAX_FILTER_SIZE			64 /* Maximum multicast address */ 
   1.587 +#define AMD8111E_MIN_MTU	 	60 	
   1.588 +#define AMD8111E_MAX_MTU		9000			
   1.589 +
   1.590 +#define PKT_BUFF_SZ			1536
   1.591 +#define MIN_PKT_LEN			60
   1.592 +#define ETH_ADDR_LEN			6
   1.593 +
   1.594 +#define  AMD8111E_TX_TIMEOUT		(3 * HZ)/* 3 sec */
   1.595 +#define SOFT_TIMER_FREQ 		0xBEBC  /* 0.5 sec */
   1.596 +#define DELAY_TIMER_CONV		50    /* msec to 10 usec conversion.
   1.597 +						 Only 500 usec resolution */ 						 
   1.598 +#define OPTION_VLAN_ENABLE		0x0001
   1.599 +#define OPTION_JUMBO_ENABLE		0x0002
   1.600 +#define OPTION_MULTICAST_ENABLE		0x0004
   1.601 +#define OPTION_WOL_ENABLE		0x0008
   1.602 +#define OPTION_WAKE_MAGIC_ENABLE	0x0010
   1.603 +#define OPTION_WAKE_PHY_ENABLE		0x0020
   1.604 +#define OPTION_INTR_COAL_ENABLE		0x0040
   1.605 +#define OPTION_DYN_IPG_ENABLE	        0x0080
   1.606 +
   1.607 +#define PHY_REG_ADDR_MASK		0x1f
   1.608 +
   1.609 +/* ipg parameters */
   1.610 +#define DEFAULT_IPG			0x60
   1.611 +#define IFS1_DELTA			36
   1.612 +#define	IPG_CONVERGE_JIFFIES (HZ/2)
   1.613 +#define	IPG_STABLE_TIME	5
   1.614 +#define	MIN_IPG	96
   1.615 +#define	MAX_IPG	255
   1.616 +#define IPG_STEP	16
   1.617 +#define CSTATE  1 
   1.618 +#define SSTATE  2 
   1.619 +
   1.620 +/* Assume contoller gets data 10 times the maximum processing time */
   1.621 +#define  REPEAT_CNT			10; 
   1.622 +     
   1.623 +/* amd8111e decriptor flag definitions */
   1.624 +typedef enum {
   1.625 +
   1.626 +	OWN_BIT		=	(1 << 15),
   1.627 +	ADD_FCS_BIT	=	(1 << 13),
   1.628 +	LTINT_BIT	=	(1 << 12),
   1.629 +	STP_BIT		=	(1 << 9),
   1.630 +	ENP_BIT		=	(1 << 8),
   1.631 +	KILL_BIT	= 	(1 << 6),
   1.632 +	TCC_VLAN_INSERT	=	(1 << 1),
   1.633 +	TCC_VLAN_REPLACE =	(1 << 1) |( 1<< 0),
   1.634 +
   1.635 +}TX_FLAG_BITS;
   1.636 +
   1.637 +typedef enum {
   1.638 +	ERR_BIT 	=	(1 << 14),
   1.639 +	FRAM_BIT	=  	(1 << 13),
   1.640 +	OFLO_BIT	=       (1 << 12),
   1.641 +	CRC_BIT		=	(1 << 11),
   1.642 +	PAM_BIT		=	(1 << 6),
   1.643 +	LAFM_BIT	= 	(1 << 5),
   1.644 +	BAM_BIT		=	(1 << 4),
   1.645 +	TT_VLAN_TAGGED	= 	(1 << 3) |(1 << 2),/* 0x000 */
   1.646 +	TT_PRTY_TAGGED	=	(1 << 3),/* 0x0008 */
   1.647 +
   1.648 +}RX_FLAG_BITS;
   1.649 +
   1.650 +#define RESET_RX_FLAGS		0x0000
   1.651 +#define TT_MASK			0x000c
   1.652 +#define TCC_MASK		0x0003
   1.653 +
   1.654 +/* driver ioctl parameters */
   1.655 +#define AMD8111E_REG_DUMP_LEN	 13*sizeof(u32) 
   1.656 +
   1.657 +/* crc generator constants */
   1.658 +#define CRC32 0xedb88320
   1.659 +#define INITCRC 0xFFFFFFFF
   1.660 +
   1.661 +/* amd8111e desriptor format */
   1.662 +
   1.663 +struct amd8111e_tx_dr{
   1.664 +
   1.665 +	u16 buff_count; /* Size of the buffer pointed by this descriptor */
   1.666 +
   1.667 +	u16 tx_flags;
   1.668 +
   1.669 +	u16 tag_ctrl_info;
   1.670 +
   1.671 +	u16 tag_ctrl_cmd;
   1.672 +
   1.673 +	u32 buff_phy_addr;
   1.674 +
   1.675 +	u32 reserved;
   1.676 +}; 
   1.677 +
   1.678 +struct amd8111e_rx_dr{
   1.679 +	
   1.680 +	u32 reserved;
   1.681 +
   1.682 +	u16 msg_count; /* Received message len */
   1.683 +
   1.684 +	u16 tag_ctrl_info; 
   1.685 +
   1.686 +	u16 buff_count;  /* Len of the buffer pointed by descriptor. */
   1.687 +
   1.688 +	u16 rx_flags;
   1.689 +
   1.690 +	u32 buff_phy_addr;
   1.691 +
   1.692 +};
   1.693 +struct amd8111e_link_config{
   1.694 +
   1.695 +#define SPEED_INVALID		0xffff
   1.696 +#define DUPLEX_INVALID		0xff
   1.697 +#define AUTONEG_INVALID		0xff
   1.698 +	
   1.699 +	unsigned long			orig_phy_option;
   1.700 +	u16				speed;
   1.701 +	u8				duplex;
   1.702 +	u8				autoneg;
   1.703 +	u8				reserved;  /* 32bit alignment */
   1.704 +};
   1.705 +
   1.706 +enum coal_type{
   1.707 +
   1.708 +	NO_COALESCE,
   1.709 +	LOW_COALESCE,
   1.710 +	MEDIUM_COALESCE,
   1.711 +	HIGH_COALESCE,
   1.712 +
   1.713 +};
   1.714 +
   1.715 +enum coal_mode{ 
   1.716 +       	RX_INTR_COAL,
   1.717 +	TX_INTR_COAL,
   1.718 +	DISABLE_COAL,
   1.719 +	ENABLE_COAL,
   1.720 +
   1.721 +};
   1.722 +#define MAX_TIMEOUT	40
   1.723 +#define MAX_EVENT_COUNT 31
   1.724 +struct amd8111e_coalesce_conf{
   1.725 +
   1.726 +	unsigned int rx_timeout;
   1.727 +	unsigned int rx_event_count;
   1.728 +	unsigned long rx_packets;
   1.729 +	unsigned long rx_prev_packets;
   1.730 +	unsigned long rx_bytes;
   1.731 +	unsigned long rx_prev_bytes;
   1.732 +	unsigned int rx_coal_type;
   1.733 +	
   1.734 +	unsigned int tx_timeout;
   1.735 +	unsigned int tx_event_count;
   1.736 +	unsigned long tx_packets;
   1.737 +	unsigned long tx_prev_packets;
   1.738 +	unsigned long tx_bytes;
   1.739 +	unsigned long tx_prev_bytes;
   1.740 +	unsigned int tx_coal_type;
   1.741 +
   1.742 +};
   1.743 +struct ipg_info{
   1.744 +	
   1.745 +	unsigned int ipg_state;
   1.746 +	unsigned int ipg;
   1.747 +	unsigned int current_ipg;
   1.748 +	unsigned int col_cnt;
   1.749 +	unsigned int diff_col_cnt;
   1.750 +	unsigned int timer_tick;
   1.751 +	unsigned int prev_ipg;
   1.752 +	struct timer_list ipg_timer;
   1.753 +};
   1.754 +
   1.755 +struct amd8111e_priv{
   1.756 +	
   1.757 +	struct amd8111e_tx_dr*  tx_ring;
   1.758 +	struct amd8111e_rx_dr* rx_ring;
   1.759 +	dma_addr_t tx_ring_dma_addr;	/* tx descriptor ring base address */
   1.760 +	dma_addr_t rx_ring_dma_addr;	/* rx descriptor ring base address */
   1.761 +	const char *name;
   1.762 +	struct pci_dev *pci_dev;	/* Ptr to the associated pci_dev */
   1.763 +	struct net_device* amd8111e_net_dev; 	/* ptr to associated net_device */
   1.764 +	/* Transmit and recive skbs */
   1.765 +	struct sk_buff *tx_skbuff[NUM_TX_BUFFERS];
   1.766 +	struct sk_buff *rx_skbuff[NUM_RX_BUFFERS];
   1.767 +	/* Transmit and receive dma mapped addr */
   1.768 +	dma_addr_t tx_dma_addr[NUM_TX_BUFFERS];
   1.769 +	dma_addr_t rx_dma_addr[NUM_RX_BUFFERS];
   1.770 +	/* Reg memory mapped address */
   1.771 +	void __iomem *mmio;
   1.772 +	
   1.773 +	spinlock_t lock;	/* Guard lock */
   1.774 +	unsigned long rx_idx, tx_idx;	/* The next free ring entry */
   1.775 +	unsigned long tx_complete_idx;
   1.776 +	unsigned long tx_ring_complete_idx;
   1.777 +	unsigned long tx_ring_idx;
   1.778 +	unsigned int rx_buff_len;	/* Buffer length of rx buffers */
   1.779 +	int options;		/* Options enabled/disabled for the device */
   1.780 +
   1.781 +	unsigned long ext_phy_option;
   1.782 +	int ext_phy_addr;
   1.783 +	u32 ext_phy_id;
   1.784 +	
   1.785 +	struct amd8111e_link_config link_config;
   1.786 +	int pm_cap;
   1.787 +
   1.788 +	struct net_device *next;
   1.789 +	int mii;
   1.790 +	struct mii_if_info mii_if;
   1.791 +#if AMD8111E_VLAN_TAG_USED
   1.792 +	struct vlan_group		*vlgrp;
   1.793 +#endif	
   1.794 +	char opened;
   1.795 +	struct net_device_stats stats;
   1.796 +	unsigned int drv_rx_errors;
   1.797 +	struct dev_mc_list* mc_list;
   1.798 +	struct amd8111e_coalesce_conf coal_conf;
   1.799 +
   1.800 +	struct ipg_info  ipg_data;	
   1.801 +	
   1.802 +};
   1.803 +
   1.804 +/* kernel provided writeq does not write 64 bits into the amd8111e device register instead writes only higher 32bits data into lower 32bits of the register.
   1.805 +BUG? */
   1.806 +#define  amd8111e_writeq(_UlData,_memMap)   \
   1.807 +		writel(*(u32*)(&_UlData), _memMap);	\
   1.808 +		writel(*(u32*)((u8*)(&_UlData)+4), _memMap+4)	
   1.809 +
   1.810 +/* maps the external speed options to internal value */
   1.811 +typedef enum {
   1.812 +	SPEED_AUTONEG,
   1.813 +	SPEED10_HALF,
   1.814 +	SPEED10_FULL,
   1.815 +	SPEED100_HALF,
   1.816 +	SPEED100_FULL,
   1.817 +}EXT_PHY_OPTION;
   1.818 +
   1.819 +static int card_idx;
   1.820 +static int speed_duplex[MAX_UNITS] = { 0, };
   1.821 +static int coalesce[MAX_UNITS] = {1,1,1,1,1,1,1,1};
   1.822 +static int dynamic_ipg[MAX_UNITS] = {0,0,0,0,0,0,0,0};
   1.823 +static unsigned int chip_version;
   1.824 +
   1.825 +#endif /* _AMD8111E_H */
   1.826 +