/* $NetBSD: elinkxlreg.h,v 1.15 2008/04/28 20:23:49 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Frank van der Linden.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This file defines the registers specific to the EtherLink XL family
* of NICs.
*/
#define EEPROM_SOFTINFO3 0x15 /* Software info #3 */
#define EEPROM_SUBVENDOR_ELXL 0x17 /* Subsys vendor id */
#define EEPROM_SUBSYSID 0x18 /* Subsys id */
#define EEPROM_MEDIA 0x19 /* Media options (90xB) */
#define EEPROM_CHECKSUM_ELXL 0x20 /* EEPROM checksum */
#define READ_EEPROM8 0x0200 /* 8 bit EEPROM read command */
/*
* Flat address space registers (outside the windows)
*/
/*
* This is reset options for the other cards, media options for
* the 90xB NICs. Reset options are in a separate register for
* the 90xB.
*/
#define ELINK_W3_MEDIA_OPTIONS 0x08
# define ELINK_MEDIACAP_100BASET4 0x0001
# define ELINK_MEDIACAP_100BASETX 0x0002
# define ELINK_MEDIACAP_100BASEFX 0x0004
# define ELINK_MEDIACAP_10BASET 0x0008
# define ELINK_MEDIACAP_10BASE2 0x0010
# define ELINK_MEDIACAP_10BASE5 0x0020
# define ELINK_MEDIACAP_MII 0x0040
# define ELINK_MEDIACAP_10BASEFL 0x0080
/*
* Reset options for the 90xB
*/
#define ELINK_W2_RESET_OPTIONS 0x0c
# define ELINK_RESET_OPT_LEDPOLAR 0x0010
# define ELINK_RESET_OPT_PHYPOWER 0x4000
/*
* Window 4, offset 8 is defined for MII/PHY access for EtherLink XL
* cards.
*/
#define ELINK_W4_PHYSMGMT 0x08
# define ELINK_PHY_CLK 0x0001
# define ELINK_PHY_DATA 0x0002
# define ELINK_PHY_DIR 0x0004
/*
* Counter in window 4 for packets with a bad start-of-stream delimiter/
*/
#define ELINK_W4_BADSSD 0x0c
#define ELINK_W4_UBYTESOK 0x0d
/*
* Define for extra multicast hash filter bit implemented in the 90xB
*/
#define FIL_MULTIHASH 0x10
/*
* Defines for the interrupt status register, only for the 90x[B]
*/
#define HOST_ERROR 0x0002
#define LINK_EVENT 0x0100
#define DN_COMPLETE 0x0200
#define UP_COMPLETE 0x0400
#define EX_FR_LENMASK 0x00001fff /* mask for length in fr_len field */
#define EX_FR_LAST 0x80000000 /* indicates last fragment */
#define EX_NDPD 256
#define EX_NUPD 128
/*
* Note: the number of receive fragments in an UPD is 1, since we're
* receiving into one contiguous mbuf.
*/
#define EX_NRFRAGS 1 /* # fragments in rcv pkt (< 64) */
#define EX_NTFRAGS 32 /* # fragments in tx pkt (< 64) */
/*
* hardware ip4csum-tx on ex(4) sometimes seems to set wrong IP checksums
* if the TX IP packet length is 21 or 22 bytes which requires autopadding.
* To avoid this bug, we have to pad such very short packets manually.
*/
#define EX_IP4CSUMTX_MINLEN 22
#define EX_IP4CSUMTX_PADLEN (ETHER_HDR_LEN + EX_IP4CSUMTX_MINLEN)
#define EX_DPD_DNIND 0x80000000 /* intr on download done */
#define EX_DPD_TXIND 0x00008000 /* intr on tx done */
#define EX_DPD_NOCRC 0x00002000 /* no CRC append */
/*
* Lower 12 bits are the tx length for the 90x family. The 90xB
* assumes that the tx length is the sum of all frame lengths,
* and uses the bits as below. It also defines some more bits in
* the upper part.
*/
#define EX_DPD_EMPTY 0x20000000 /* no data in this DPD */
#define EX_DPD_UPDEFEAT 0x10000000 /* don't round tx lengths up */
#define EX_DPD_UDPCKSUM 0x08000000 /* do hardware UDP checksum */
#define EX_DPD_TCPCKSUM 0x04000000 /* do hardware TCP checksum */
#define EX_DPD_IPCKSUM 0x02000000 /* do hardware IP checksum */
#define EX_DPD_DNCMPLT 0x01000000 /* packet has been downloaded */
#define EX_DPD_IDMASK 0x000003fc /* mask for packet id */
# define EX_DPD_IDSHIFT 2
#define EX_DPD_RNDMASK 0x00000003 /* mask for rounding */
/* 0 -> dword, 2 -> word, 1,3 -> none */
/*
* Schedtime bitfields.
*/
#define EX_SCHED_TIMEVALID 0x20000000 /* field contains value */
#define EX_SCHED_LDCOUNT 0x10000000 /* load schedtime onto NIC */
#define EX_SCHED_TIMEMASK 0x00ffffff