Home | History | Annotate | Line # | Download | only in ic
elinkxlreg.h revision 1.1
      1 /*	$NetBSD: elinkxlreg.h,v 1.1 1998/11/04 00:29:29 fvdl Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Frank van der Linden.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *	This product includes software developed by the NetBSD
     21  *	Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * This file defines the registers specific to the EtherLink XL family
     41  * of NICs.
     42  */
     43 
     44 #define EEPROM_SOFTINFO3	0x15	/* Software info #3 */
     45 #define EEPROM_SUBVENDOR_ELXL	0x17	/* Subsys vendor id */
     46 #define EEPROM_SUBSYSID		0x18	/* Subsys id */
     47 #define EEPROM_MEDIA		0x19	/* Media options (90xB) */
     48 #define EEPROM_CHECKSUM_ELXL	0x20	/* EEPROM checksum */
     49 
     50 /*
     51  * Flat address space registers (outside the windows)
     52  */
     53 
     54 #define ELINK_TXPKTID		0x18	/* 90xB only */
     55 #define ELINK_TIMER		0x1a
     56 #define ELINK_TXSTATUS		0x1b
     57 #define ELINK_INTSTATUSAUTO	0x1e
     58 #define ELINK_DMACTRL		0x20
     59 #	define ELINK_DMAC_DNCMPLREQ	0x00000002
     60 #	define ELINK_DMAC_DNSTALLED	0x00000004
     61 #	define ELINK_DMAC_UPCOMPLETE	0x00000008
     62 #	define ELINK_DMAC_DNCOMPLETE	0x00000010
     63 #	define ELINK_DMAC_UPRXEAREN	0x00000020
     64 #	define ELINK_DMAC_ARNCNTDN	0x00000040
     65 #	define ELINK_DMAC_DNINPROG	0x00000080
     66 #	define ELINK_DMAC_CNTSPEED	0x00000100
     67 #	define ELINK_DMAC_CNTDNMODE	0x00000200
     68 #	define ELINK_DMAC_ALTSEQDIS	0x00010000
     69 #	define ELINK_DMAC_DEFEATMWI	0x00100000
     70 #	define ELINK_DMAC_DEFEATMRL	0x00200000
     71 #	define ELINK_DMAC_UPOVERDIS	0x00400000
     72 #	define ELINK_DMAC_TARGABORT	0x40000000
     73 #	define ELINK_DMAC_MSTRABORT	0x80000000
     74 #define ELINK_DNLISTPTR		0x24
     75 #define ELINK_DNBURSTTHRESH	0x2a	/* 90xB only */
     76 #define ELINK_DNPRIOTHRESH	0x2c	/* 90xB only */
     77 #define ELINK_DNPOLL		0x2d	/* 90xB only */
     78 #define ELINK_TXFREETHRESH	0x2f	/* 90x only */
     79 #define ELINK_UPPKTSTATUS	0x30
     80 #define ELINK_FREETIMER		0x34
     81 #define ELINK_COUNTDOWN		0x36
     82 #define ELINK_UPLISTPTR		0x38
     83 #define ELINK_UPPRIOTHRESH	0x3c	/* 90xB only */
     84 #define ELINK_UPPOLL		0x3d	/* 90xB only */
     85 #define ELINK_UPBURSTTHRESH	0x3e	/* 90xB only */
     86 #define ELINK_REALTIMECNT	0x40	/* 90xB only */
     87 #define ELINK_DNMAXBURST	0x78	/* 90xB only */
     88 #define ELINK_UPMAXBURST	0x7a	/* 90xB only */
     89 
     90 /*
     91  * This is reset options for the other cards, media options for
     92  * the 90xB NICs. Reset options are in a seperate register for
     93  * the 90xB.
     94  */
     95 #define ELINK_W3_MEDIA_OPTIONS	0x08
     96 #	define ELINK_MEDIACAP_100BASET4	0x0001
     97 #	define ELINK_MEDIACAP_100BASETX	0x0002
     98 #	define ELINK_MEDIACAP_100BASEFX	0x0004
     99 #	define ELINK_MEDIACAP_10BASET	0x0008
    100 #	define ELINK_MEDIACAP_10BASE2	0x0010
    101 #	define ELINK_MEDIACAP_10BASE5	0x0020
    102 #	define ELINK_MEDIACAP_MII	0x0040
    103 #	define ELINK_MEDIACAP_10BASEFL	0x0080
    104 
    105 /*
    106  * Window 4, offset 8 is defined for MII/PHY access for EtherLink XL
    107  * cards.
    108  */
    109 #define ELINK_W4_PHYSMGMT	0x08
    110 #	define ELINK_PHY_CLK	0x0001
    111 #	define ELINK_PHY_DATA	0x0002
    112 #	define ELINK_PHY_DIR	0x0004
    113 
    114 /*
    115  * Counter in window 4 for packets with a bad start-of-stream delimiter/
    116  */
    117 #define ELINK_W4_BADSSD		0x0c
    118 #define ELINK_W4_UBYTESOK	0x0c
    119 
    120 /*
    121  * Define for extra multicast hash filter bit implemented in the 90xB
    122  */
    123 #define FIL_MULTIHASH		0x10
    124 
    125 /*
    126  * Defines for the interrupt status register, only for the 90x[B]
    127  */
    128 #define S_HOST_ERROR		0x0002
    129 #define S_LINK_EVENT		0x0100
    130 #define S_DN_COMPLETE		0x0200
    131 #define S_UP_COMPLETE		0x0400
    132 
    133 #define S_MASK \
    134     (S_HOST_ERROR | S_TX_COMPLETE | S_UPD_STATS | S_DN_COMPLETE | S_UP_COMPLETE)
    135 
    136 
    137 /*
    138  * Window 7 registers. These are different for 90x and 90xB than
    139  * for the EtherLink III / Fast EtherLink cards.
    140  */
    141 
    142 #define ELINK_W7_VLANMASK	0x00	/* 90xB only */
    143 #define ELINK_W7_VLANTYPE	0x04	/* 90xB only */
    144 #define ELINK_W7_TIMER		0x0a	/* 90x only */
    145 #define ELINK_W7_TXSTATUS	0x0b	/* 90x only */
    146 #define ELINK_W7_POWEREVENT	0x0c	/* 90xB only */
    147 #define ELINK_W7_INTSTATUS	0x0e
    148 
    149 /*
    150  * Command definitions.
    151  */
    152 #define ELINK_UPSTALL		0x3000
    153 #define ELINK_UPUNSTALL		0x3001
    154 #define ELINK_DNSTALL		0x3002
    155 #define ELINK_DNUNSTALL		0x3003
    156 #define ELINK_TXRECLTHRESH	0xc000
    157 #define ELINK_TXSTARTTHRESH	0x9800
    158 #define ELINK_SETHASHFILBIT	0xcc00
    159 
    160 /*
    161  * The Internal Config register is different on 90xB cards. The
    162  * different masks / shifts are defined here.
    163  */
    164 
    165 /*
    166  * Lower 16 bits.
    167  */
    168 #define CONFIG_TXLARGE		(u_int16_t) 0x4000
    169 #define CONFIG_TXLARGE_SHIFT	14
    170 
    171 #define CONFIG_RXLARGE		(u_int16_t) 0x8000
    172 #define CONFIG_RXLARGE_SHIFT	15
    173 
    174 /*
    175  * Upper 16 bits.
    176  */
    177 #define CONFIG_XCVR_SEL		(u_int16_t) 0x00f0
    178 #define CONFIG_XCVR_SEL_SHIFT	4
    179 
    180 #define CONFIG_AUTOSEL		(u_int16_t) 0x0100
    181 #define CONFIG_AUTOSEL_SHIFT	8
    182 
    183 #define CONFIG_DISABLEROM	(u_int16_t) 0x0200
    184 #define CONFIG_DISABLEROM_SHIFT	9
    185 
    186 /*
    187  * ID of internal PHY.
    188  */
    189 
    190 #define ELINK_INTPHY_ID		24
    191 
    192 /*
    193  * Fragment header as laid out in memory for DMA access.
    194  */
    195 
    196 struct ex_fraghdr {
    197 	volatile u_int32_t fr_addr;	/* phys addr of frag */
    198 	volatile u_int32_t fr_len;	/* length of frag */
    199 };
    200 
    201 #define EX_FR_LENMASK	0x00001fff	/* mask for length in fr_len field */
    202 #define EX_FR_LAST	0x80000000	/* indicates last fragment */
    203 
    204 #define EX_NDPD		128
    205 #define EX_NUPD		64
    206 
    207 /*
    208  * Note: the number of receive fragments in an UPD is 1, since we're
    209  * receiving into one contiguous mbuf.
    210  */
    211 #define EX_NRFRAGS	1		/* # fragments in rcv pkt (< 64) */
    212 #define EX_NTFRAGS	32		/* # fragments in tx pkt (< 64) */
    213 
    214 /*
    215  * Type 0 Download Packet Descriptor (DPD).
    216  */
    217 struct ex_dpd {
    218 	volatile u_int32_t dpd_nextptr;		/* prt to next fragheader */
    219 	volatile u_int32_t dpd_fsh;		/* frame start header */
    220 	volatile struct ex_fraghdr dpd_frags[EX_NTFRAGS];
    221 };
    222 
    223 /*
    224  * Type 1 DPD, supported by 90xB.
    225  */
    226 struct ex_dpd1 {
    227 	volatile u_int32_t dpd_nextptr;
    228 	volatile u_int32_t dpd_schedtime;	/* time to download */
    229 	volatile u_int32_t dpd_fsh;
    230 	volatile struct ex_fraghdr dpd_frags[EX_NTFRAGS];
    231 };
    232 
    233 struct ex_upd {
    234 	volatile u_int32_t upd_nextptr;
    235 	volatile u_int32_t upd_pktstatus;
    236 	volatile struct ex_fraghdr upd_frags[EX_NRFRAGS];
    237 };
    238 
    239 /*
    240  * Higher level linked list of upload packet descriptors.
    241  */
    242 struct ex_rxdesc {
    243 	struct ex_rxdesc *rx_next;
    244 	struct mbuf *rx_mbhead;
    245 	bus_dmamap_t rx_dmamap;
    246 	struct ex_upd *rx_upd;
    247 };
    248 
    249 /*
    250  * .. and for download packet descriptors.
    251  */
    252 struct ex_txdesc {
    253 	struct ex_txdesc *tx_next;
    254 	struct mbuf *tx_mbhead;
    255 	bus_dmamap_t tx_dmamap;
    256 	struct ex_dpd *tx_dpd;
    257 };
    258 
    259 #define DPD_DMADDR(s,t) \
    260 	((s)->sc_dpddma + ((caddr_t)((t)->tx_dpd) - (caddr_t)((s)->sc_dpd)))
    261 
    262 /*
    263  * Frame Start Header bitfields.
    264  */
    265 
    266 #define EX_DPD_DNIND	0x80000000	/* intr on download done */
    267 #define EX_DPD_TXIND	0x00008000	/* intr on tx done */
    268 #define EX_DPD_NOCRC	0x00002000	/* no CRC append */
    269 
    270 /*
    271  * Lower 12 bits are the tx length for the 90x family. The 90xB
    272  * assumes that the tx length is the sum of all frame lengths,
    273  * and uses the bits as below. It also defines some more bits in
    274  * the upper part.
    275  */
    276 #define EX_DPD_EMPTY	0x20000000	/* no data in this DPD */
    277 #define EX_DPD_UPDEFEAT	0x10000000	/* don't round tx lengths up */
    278 #define EX_DPD_UDPCKSUM	0x08000000	/* do hardware UDP checksum */
    279 #define EX_DPD_TCPCKSUM	0x04000000	/* do hardware TCP checksum */
    280 #define EX_DPD_IPCKSUM	0x02000000	/* do hardware IP checksum */
    281 #define EX_DPD_DNCMPLT	0x01000000	/* packet has been downloaded */
    282 #define EX_DPD_IDMASK	0x000003fc	/* mask for packet id */
    283 #	define EX_DPD_IDSHIFT	2
    284 #define EX_DPD_RNDMASK	0x00000003	/* mask for rounding */
    285 					/* 0 -> dword, 2 -> word, 1,3 -> none */
    286 
    287 /*
    288  * Schedtime bitfields.
    289  */
    290 #define EX_SCHED_TIMEVALID	0x20000000	/* field contains value */
    291 #define EX_SCHED_LDCOUNT	0x10000000	/* load schedtime onto NIC */
    292 #define EX_SCHED_TIMEMASK	0x00ffffff
    293 
    294 /*
    295  * upd_pktstatus bitfields.
    296  */
    297 #define EX_UPD_PKTLENMASK	0x00001fff	/* 12:0 -> packet length */
    298 #define EX_UPD_ERROR		0x00004000	/* rcv error */
    299 #define EX_UPD_COMPLETE		0x00008000	/* rcv complete */
    300 #define EX_UPD_OVERRUN		0x00010000	/* rcv overrun */
    301 #define EX_UPD_RUNT		0x00020000	/* pkt < 60 bytes */
    302 #define EX_UPD_ALIGNERR		0x00040000	/* alignment error */
    303 #define EX_UPD_CRCERR		0x00080000	/* CRC error */
    304 #define EX_UPD_OVERSIZED	0x00100000	/* oversize frame */
    305 #define EX_UPD_DRIBBLEBITS	0x00800000	/* pkt had dribble bits */
    306 #define EX_UPD_OVERFLOW		0x01000000	/* insufficient space for pkt */
    307 #define EX_UPD_IPCKSUMERR	0x02000000	/* IP cksum error (90xB) */
    308 #define EX_UPD_TCPCKSUMERR	0x04000000	/* TCP cksum error (90xB) */
    309 #define EX_UPD_UDPCKSUMERR	0x08000000	/* UDP cksum error (90xB) */
    310 
    311 #define EX_UPD_ERR		0x001f4000	/* Errors we check for */
    312