Home | History | Annotate | Line # | Download | only in ic
mb86960var.h revision 1.27.2.1
      1  1.27.2.1  jdolecek /*	$NetBSD: mb86960var.h,v 1.27.2.1 2002/10/10 18:39:07 jdolecek Exp $	*/
      2      1.19     perry 
      3       1.1   mycroft /*
      4       1.1   mycroft  * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
      5       1.1   mycroft  *
      6       1.1   mycroft  * This software may be used, modified, copied, distributed, and sold, in
      7       1.1   mycroft  * both source and binary form provided that the above copyright, these
      8       1.1   mycroft  * terms and the following disclaimer are retained.  The name of the author
      9       1.1   mycroft  * and/or the contributor may not be used to endorse or promote products
     10       1.1   mycroft  * derived from this software without specific prior written permission.
     11       1.1   mycroft  *
     12       1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND THE CONTRIBUTOR ``AS IS'' AND
     13       1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     14       1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     15       1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTOR BE LIABLE
     16       1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     17       1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     18       1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION.
     19       1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     20       1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     21       1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     22       1.1   mycroft  * SUCH DAMAGE.
     23       1.1   mycroft  */
     24       1.1   mycroft 
     25       1.1   mycroft /*
     26       1.1   mycroft  * Portions copyright (C) 1993, David Greenman.  This software may be used,
     27       1.1   mycroft  * modified, copied, distributed, and sold, in both source and binary form
     28       1.1   mycroft  * provided that the above copyright and these terms are retained.  Under no
     29       1.1   mycroft  * circumstances is the author responsible for the proper functioning of this
     30       1.1   mycroft  * software, nor does the author assume any responsibility for damages
     31       1.1   mycroft  * incurred with its use.
     32       1.1   mycroft  */
     33       1.1   mycroft 
     34       1.1   mycroft /*
     35       1.1   mycroft  * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
     36       1.1   mycroft  * Contributed by M.S. <seki (at) sysrap.cs.fujitsu.co.jp>
     37       1.1   mycroft  *
     38       1.1   mycroft  * This version is intended to be a generic template for various
     39       1.1   mycroft  * MB86960A/MB86965A based Ethernet cards.  It currently supports
     40       1.1   mycroft  * Fujitsu FMV-180 series (i.e., FMV-181 and FMV-182) and Allied-
     41       1.1   mycroft  * Telesis AT1700 series and RE2000 series.  There are some
     42       1.1   mycroft  * unnecessary hooks embedded, which are primarily intended to support
     43       1.1   mycroft  * other types of Ethernet cards, but the author is not sure whether
     44       1.1   mycroft  * they are useful.
     45       1.1   mycroft  */
     46       1.1   mycroft 
     47      1.18  explorer #include "rnd.h"
     48       1.1   mycroft 
     49      1.18  explorer #if NRND > 0
     50      1.18  explorer #include <sys/rnd.h>
     51      1.18  explorer #endif
     52       1.1   mycroft 
     53       1.1   mycroft /*
     54       1.1   mycroft  * Default settings for fe driver specific options.
     55       1.1   mycroft  * They can be set in config file by "options" statements.
     56       1.1   mycroft  */
     57       1.1   mycroft 
     58       1.1   mycroft /*
     59       1.1   mycroft  * Debug control.
     60       1.1   mycroft  * 0: No debug at all.  All debug specific codes are stripped off.
     61       1.1   mycroft  * 1: Silent.  No debug messages are logged except emergent ones.
     62       1.1   mycroft  * 2: Brief.  Lair events and/or important information are logged.
     63       1.1   mycroft  * 3: Detailed.  Logs all information which *may* be useful for debugging.
     64       1.1   mycroft  * 4: Trace.  All actions in the driver is logged.  Super verbose.
     65       1.1   mycroft  */
     66       1.1   mycroft #ifndef FE_DEBUG
     67       1.1   mycroft #define FE_DEBUG		1
     68       1.1   mycroft #endif
     69       1.1   mycroft 
     70       1.1   mycroft /*
     71       1.1   mycroft  * Delay padding of short transmission packets to minimum Ethernet size.
     72       1.1   mycroft  * This may or may not gain performance.  An EXPERIMENTAL option.
     73       1.1   mycroft  */
     74       1.1   mycroft #ifndef FE_DELAYED_PADDING
     75       1.1   mycroft #define FE_DELAYED_PADDING	0
     76       1.1   mycroft #endif
     77       1.1   mycroft 
     78       1.1   mycroft /*
     79       1.1   mycroft  * Transmit just one packet per a "send" command to 86960.
     80       1.1   mycroft  * This option is intended for performance test.  An EXPERIMENTAL option.
     81       1.1   mycroft  */
     82       1.1   mycroft #ifndef FE_SINGLE_TRANSMISSION
     83       1.1   mycroft #define FE_SINGLE_TRANSMISSION	0
     84       1.1   mycroft #endif
     85       1.1   mycroft 
     86       1.1   mycroft /*
     87       1.1   mycroft  * Device configuration flags.
     88       1.1   mycroft  */
     89       1.1   mycroft 
     90       1.1   mycroft /* DLCR6 settings. */
     91       1.1   mycroft #define FE_FLAGS_DLCR6_VALUE	0x007F
     92       1.1   mycroft 
     93       1.1   mycroft /* Force DLCR6 override. */
     94       1.1   mycroft #define FE_FLAGS_OVERRIDE_DLCR6	0x0080
     95       1.1   mycroft 
     96       1.1   mycroft /* A cludge for PCMCIA support. */
     97       1.1   mycroft #define FE_FLAGS_PCMCIA		0x8000
     98       1.1   mycroft 
     99       1.1   mycroft /*
    100       1.1   mycroft  * Supported hardware (Ethernet card) types
    101       1.1   mycroft  * This information is currently used only for debugging
    102       1.1   mycroft  */
    103       1.1   mycroft enum fe_type {
    104       1.1   mycroft 	/* For cards which are successfully probed but not identified. */
    105      1.21     enami 	FE_TYPE_UNKNOWN = 0,
    106       1.1   mycroft 
    107       1.1   mycroft 	/* Fujitsu FMV-180 series. */
    108       1.1   mycroft 	FE_TYPE_FMV181,
    109       1.1   mycroft 	FE_TYPE_FMV182,
    110       1.1   mycroft 
    111       1.1   mycroft 	/* Allied-Telesis AT1700 series and RE2000 series. */
    112       1.1   mycroft 	FE_TYPE_AT1700T,
    113       1.1   mycroft 	FE_TYPE_AT1700BT,
    114       1.1   mycroft 	FE_TYPE_AT1700FT,
    115       1.1   mycroft 	FE_TYPE_AT1700AT,
    116       1.1   mycroft 	FE_TYPE_RE2000,
    117       1.1   mycroft 
    118       1.1   mycroft 	/* PCMCIA by Fujitsu. */
    119       1.1   mycroft 	FE_TYPE_MBH10302,
    120      1.27     lukem 	FE_TYPE_MBH10304
    121       1.1   mycroft };
    122       1.1   mycroft 
    123      1.21     enami enum mb86960_type {
    124      1.21     enami 	MB86960_TYPE_86960,
    125      1.21     enami 	MB86960_TYPE_86965
    126      1.21     enami };
    127      1.21     enami 
    128       1.1   mycroft /*
    129       1.1   mycroft  * fe_softc: per line info and status
    130       1.1   mycroft  */
    131      1.21     enami struct mb86960_softc {
    132      1.21     enami 	struct device sc_dev;
    133      1.21     enami 	struct ethercom sc_ec;		/* ethernet common */
    134      1.21     enami 	struct ifmedia sc_media;	/* supported media information */
    135       1.1   mycroft 
    136      1.21     enami 	bus_space_tag_t sc_bst;		/* bus space */
    137      1.21     enami 	bus_space_handle_t sc_bsh;
    138       1.1   mycroft 
    139       1.1   mycroft 	/* Set by probe() and not modified in later phases. */
    140      1.21     enami 	enum	mb86960_type type;	/* controller type */
    141      1.21     enami 
    142      1.21     enami 	u_char	proto_dlcr4;		/* DLCR4 prototype. */
    143      1.21     enami 	u_char	proto_dlcr5;		/* DLCR5 prototype. */
    144      1.21     enami 	u_char	proto_dlcr6;		/* DLCR6 prototype. */
    145      1.21     enami 	u_char	proto_dlcr7;		/* DLCR7 prototype. */
    146      1.21     enami 	u_char	proto_bmpr13;		/* BMPR13 prototype. */
    147       1.1   mycroft 
    148       1.1   mycroft 	/* Vendor specific hooks. */
    149      1.21     enami 	void	(*init_card) __P((struct mb86960_softc *));
    150      1.21     enami 	void	(*stop_card) __P((struct mb86960_softc *));
    151       1.1   mycroft 
    152       1.1   mycroft 	/* Transmission buffer management. */
    153       1.1   mycroft 	u_short	txb_size;	/* total bytes in TX buffer */
    154       1.1   mycroft 	u_short	txb_free;	/* free bytes in TX buffer */
    155       1.1   mycroft 	u_char	txb_count;	/* number of packets in TX buffer */
    156       1.1   mycroft 	u_char	txb_sched;	/* number of scheduled packets */
    157       1.1   mycroft 	u_char	txb_padding;	/* number of delayed padding bytes */
    158       1.1   mycroft 
    159       1.1   mycroft 	/* Multicast address filter management. */
    160       1.1   mycroft 	u_char	filter_change;	/* MARs must be changed ASAP. */
    161       1.1   mycroft 	u_char	filter[FE_FILTER_LEN];	/* new filter value. */
    162      1.17        is 
    163      1.17        is 	u_int8_t sc_enaddr[ETHER_ADDR_LEN];
    164      1.18  explorer 
    165      1.18  explorer #if NRND > 0
    166      1.18  explorer 	rndsource_element_t rnd_source;
    167      1.18  explorer #endif
    168       1.1   mycroft 
    169      1.26     jhawk 	u_int32_t	sc_flags;	/* misc. flags */
    170      1.26     jhawk #define FE_FLAGS_ENABLED	0x0001	/* power enabled on interface */
    171      1.26     jhawk #define FE_FLAGS_ATTACHED	0x0002	/* attach has succeeded */
    172      1.21     enami 
    173      1.21     enami 	int	(*sc_enable) __P((struct mb86960_softc *));
    174      1.21     enami 	void	(*sc_disable) __P((struct mb86960_softc *));
    175       1.1   mycroft 
    176      1.21     enami 	int	(*sc_mediachange) __P((struct mb86960_softc *));
    177      1.21     enami 	void	(*sc_mediastatus) __P((struct mb86960_softc *,
    178      1.21     enami 		    struct ifmediareq *));
    179       1.1   mycroft };
    180       1.1   mycroft 
    181       1.1   mycroft /*
    182       1.1   mycroft  * Fe driver specific constants which relate to 86960/86965.
    183       1.1   mycroft  */
    184       1.1   mycroft 
    185       1.1   mycroft /* Interrupt masks. */
    186       1.1   mycroft #define FE_TMASK (FE_D2_COLL16 | FE_D2_TXDONE)
    187       1.1   mycroft #define FE_RMASK (FE_D3_OVRFLO | FE_D3_CRCERR | \
    188       1.1   mycroft 		  FE_D3_ALGERR | FE_D3_SRTPKT | FE_D3_PKTRDY)
    189       1.1   mycroft 
    190       1.1   mycroft /* Maximum number of iterrations for a receive interrupt. */
    191       1.1   mycroft #define FE_MAX_RECV_COUNT ((65536 - 2048 * 2) / 64)
    192       1.1   mycroft 	/* Maximum size of SRAM is 65536,
    193       1.1   mycroft 	 * minimum size of transmission buffer in fe is 2x2KB,
    194       1.1   mycroft 	 * and minimum amount of received packet including headers
    195       1.1   mycroft 	 * added by the chip is 64 bytes.
    196       1.1   mycroft 	 * Hence FE_MAX_RECV_COUNT is the upper limit for number
    197       1.1   mycroft 	 * of packets in the receive buffer. */
    198       1.1   mycroft 
    199      1.21     enami void	mb86960_attach	__P((struct mb86960_softc *, enum mb86960_type,
    200      1.21     enami 	    u_int8_t *));
    201      1.21     enami void	mb86960_config	__P((struct mb86960_softc *, int *, int, int));
    202      1.21     enami int	mb86960_intr	__P((void *));
    203      1.22   thorpej int	mb86960_enable	__P((struct mb86960_softc *));
    204      1.22   thorpej void	mb86960_disable	__P((struct mb86960_softc *));
    205      1.23   thorpej int	mb86960_activate __P((struct device *, enum devact));
    206      1.25     enami int	mb86960_detach	__P((struct mb86960_softc *));
    207