Home | History | Annotate | Line # | Download | only in ic
am7990var.h revision 1.13.4.1
      1  1.13.4.1   thorpej /*	$NetBSD: am7990var.h,v 1.13.4.1 1997/10/14 10:22:26 thorpej Exp $	*/
      2  1.13.4.1   thorpej 
      3  1.13.4.1   thorpej /*-
      4  1.13.4.1   thorpej  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  1.13.4.1   thorpej  * All rights reserved.
      6  1.13.4.1   thorpej  *
      7  1.13.4.1   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.13.4.1   thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  1.13.4.1   thorpej  * NASA Ames Research Center.
     10  1.13.4.1   thorpej  *
     11  1.13.4.1   thorpej  * Redistribution and use in source and binary forms, with or without
     12  1.13.4.1   thorpej  * modification, are permitted provided that the following conditions
     13  1.13.4.1   thorpej  * are met:
     14  1.13.4.1   thorpej  * 1. Redistributions of source code must retain the above copyright
     15  1.13.4.1   thorpej  *    notice, this list of conditions and the following disclaimer.
     16  1.13.4.1   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.13.4.1   thorpej  *    notice, this list of conditions and the following disclaimer in the
     18  1.13.4.1   thorpej  *    documentation and/or other materials provided with the distribution.
     19  1.13.4.1   thorpej  * 3. All advertising materials mentioning features or use of this software
     20  1.13.4.1   thorpej  *    must display the following acknowledgement:
     21  1.13.4.1   thorpej  *	This product includes software developed by the NetBSD
     22  1.13.4.1   thorpej  *	Foundation, Inc. and its contributors.
     23  1.13.4.1   thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.13.4.1   thorpej  *    contributors may be used to endorse or promote products derived
     25  1.13.4.1   thorpej  *    from this software without specific prior written permission.
     26  1.13.4.1   thorpej  *
     27  1.13.4.1   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.13.4.1   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.13.4.1   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.13.4.1   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.13.4.1   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.13.4.1   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.13.4.1   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.13.4.1   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.13.4.1   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.13.4.1   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.13.4.1   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     38  1.13.4.1   thorpej  */
     39       1.1       cgd 
     40       1.1       cgd /*
     41       1.1       cgd  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
     42       1.1       cgd  *
     43       1.1       cgd  * Redistribution and use in source and binary forms, with or without
     44       1.1       cgd  * modification, are permitted provided that the following conditions
     45       1.1       cgd  * are met:
     46       1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     47       1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     48       1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     49       1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     50       1.1       cgd  *    documentation and/or other materials provided with the distribution.
     51       1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     52       1.1       cgd  *    must display the following acknowledgement:
     53       1.1       cgd  *	This product includes software developed by Charles M. Hannum.
     54       1.1       cgd  * 4. The name of the author may not be used to endorse or promote products
     55       1.1       cgd  *    derived from this software without specific prior written permission.
     56       1.1       cgd  *
     57       1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     58       1.1       cgd  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     59       1.1       cgd  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     60       1.1       cgd  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     61       1.1       cgd  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     62       1.1       cgd  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     63       1.1       cgd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     64       1.1       cgd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     65       1.1       cgd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     66       1.1       cgd  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     67       1.1       cgd  */
     68       1.1       cgd 
     69  1.13.4.1   thorpej #include "rnd.h"
     70  1.13.4.1   thorpej 
     71       1.1       cgd #ifdef DDB
     72       1.1       cgd #define	integrate
     73       1.7   thorpej #define hide
     74       1.1       cgd #else
     75       1.6  christos #define	integrate	static __inline
     76       1.7   thorpej #define hide		static
     77       1.1       cgd #endif
     78       1.1       cgd 
     79  1.13.4.1   thorpej #if NRND > 0
     80  1.13.4.1   thorpej #include <sys/rnd.h>
     81  1.13.4.1   thorpej #endif
     82  1.13.4.1   thorpej 
     83       1.7   thorpej /*
     84       1.7   thorpej  * Ethernet software status per device.
     85       1.7   thorpej  *
     86       1.7   thorpej  * Each interface is referenced by a network interface structure,
     87      1.11        is  * ethercom.ec_if, which the routing code uses to locate the interface.
     88       1.7   thorpej  * This structure contains the output queue for the interface, its address, ...
     89       1.7   thorpej  *
     90       1.7   thorpej  * NOTE: this structure MUST be the first element in machine-dependent
     91       1.7   thorpej  * le_softc structures!  This is designed SPECIFICALLY to make it possible
     92       1.7   thorpej  * to simply cast a "void *" to "struct le_softc *" or to
     93       1.7   thorpej  * "struct am7990_softc *".  Among other things, this saves a lot of hair
     94       1.7   thorpej  * in the interrupt handlers.
     95       1.7   thorpej  */
     96       1.7   thorpej struct am7990_softc {
     97       1.7   thorpej 	struct	device sc_dev;		/* base device glue */
     98      1.11        is 	struct	ethercom sc_ethercom;	/* Ethernet common part */
     99      1.12   thorpej 	struct	ifmedia sc_media;	/* our supported media */
    100       1.7   thorpej 
    101       1.7   thorpej 	/*
    102       1.7   thorpej 	 * Memory functions:
    103       1.7   thorpej 	 *
    104       1.7   thorpej 	 *	copy to/from descriptor
    105       1.7   thorpej 	 *	copy to/from buffer
    106       1.7   thorpej 	 *	zero bytes in buffer
    107       1.7   thorpej 	 */
    108       1.7   thorpej 	void	(*sc_copytodesc)
    109       1.7   thorpej 		    __P((struct am7990_softc *, void *, int, int));
    110       1.7   thorpej 	void	(*sc_copyfromdesc)
    111       1.7   thorpej 		    __P((struct am7990_softc *, void *, int, int));
    112       1.7   thorpej 	void	(*sc_copytobuf)
    113       1.7   thorpej 		    __P((struct am7990_softc *, void *, int, int));
    114       1.7   thorpej 	void	(*sc_copyfrombuf)
    115       1.7   thorpej 		    __P((struct am7990_softc *, void *, int, int));
    116       1.7   thorpej 	void	(*sc_zerobuf)
    117       1.7   thorpej 		    __P((struct am7990_softc *, int, int));
    118       1.7   thorpej 
    119       1.7   thorpej 	/*
    120       1.7   thorpej 	 * Machine-dependent functions:
    121       1.7   thorpej 	 *
    122       1.7   thorpej 	 *	read/write CSR
    123      1.13     veego 	 *	hardware reset hook - may be NULL
    124       1.7   thorpej 	 *	hardware init hook - may be NULL
    125       1.8    abrown 	 *	no carrier hook - may be NULL
    126      1.12   thorpej 	 *	media change hook - may be NULL
    127       1.7   thorpej 	 */
    128       1.7   thorpej 	u_int16_t (*sc_rdcsr)
    129       1.7   thorpej 		    __P((struct am7990_softc *, u_int16_t));
    130       1.7   thorpej 	void	(*sc_wrcsr)
    131       1.7   thorpej 		    __P((struct am7990_softc *, u_int16_t, u_int16_t));
    132      1.13     veego 	void	(*sc_hwreset) __P((struct am7990_softc *));
    133       1.7   thorpej 	void	(*sc_hwinit) __P((struct am7990_softc *));
    134       1.8    abrown 	void	(*sc_nocarrier) __P((struct am7990_softc *));
    135      1.12   thorpej 	int	(*sc_mediachange) __P((struct am7990_softc *));
    136      1.12   thorpej 	void	(*sc_mediastatus) __P((struct am7990_softc *,
    137      1.12   thorpej 		    struct ifmediareq *));
    138      1.12   thorpej 
    139      1.12   thorpej 	/*
    140      1.12   thorpej 	 * Media-supported by this interface.  If this is NULL,
    141      1.12   thorpej 	 * the only supported media is assumed to be "manual".
    142      1.12   thorpej 	 */
    143      1.12   thorpej 	int	*sc_supmedia;
    144      1.12   thorpej 	int	sc_nsupmedia;
    145      1.12   thorpej 	int	sc_defaultmedia;
    146      1.13     veego 
    147      1.13     veego 	/* PCnet bit to use software selection of a port */
    148      1.13     veego 	int	sc_initmodemedia;
    149      1.12   thorpej 
    150      1.12   thorpej 	int	sc_havecarrier;	/* carrier status */
    151       1.7   thorpej 
    152       1.7   thorpej 	void	*sc_sh;		/* shutdownhook cookie */
    153       1.7   thorpej 
    154       1.7   thorpej 	u_int16_t sc_conf3;	/* CSR3 value */
    155      1.10       leo 	u_int16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
    156       1.7   thorpej 
    157       1.7   thorpej 	void	*sc_mem;	/* base address of RAM -- CPU's view */
    158       1.7   thorpej 	u_long	sc_addr;	/* base address of RAM -- LANCE's view */
    159       1.7   thorpej 
    160       1.7   thorpej 	u_long	sc_memsize;	/* size of RAM */
    161       1.7   thorpej 
    162       1.7   thorpej 	int	sc_nrbuf;	/* number of receive buffers */
    163       1.7   thorpej 	int	sc_ntbuf;	/* number of transmit buffers */
    164       1.7   thorpej 	int	sc_last_rd;
    165       1.7   thorpej 	int	sc_first_td, sc_last_td, sc_no_td;
    166       1.7   thorpej 
    167       1.7   thorpej 	int	sc_initaddr;
    168       1.7   thorpej 	int	sc_rmdaddr;
    169       1.7   thorpej 	int	sc_tmdaddr;
    170      1.10       leo 	int	*sc_rbufaddr;
    171      1.10       leo 	int	*sc_tbufaddr;
    172       1.7   thorpej 
    173       1.7   thorpej #ifdef LEDEBUG
    174       1.7   thorpej 	int	sc_debug;
    175       1.7   thorpej #endif
    176      1.11        is 	u_int8_t sc_enaddr[6];
    177      1.11        is 	u_int8_t sc_pad[2];
    178  1.13.4.1   thorpej #if NRND > 0
    179  1.13.4.1   thorpej 	rndsource_element_t	rnd_source;
    180  1.13.4.1   thorpej #endif
    181       1.7   thorpej };
    182       1.7   thorpej 
    183       1.7   thorpej /* Export this to machine-dependent drivers. */
    184       1.7   thorpej extern struct cfdriver le_cd;
    185       1.7   thorpej 
    186       1.7   thorpej void am7990_config __P((struct am7990_softc *));
    187       1.7   thorpej void am7990_init __P((struct am7990_softc *));
    188       1.7   thorpej int am7990_ioctl __P((struct ifnet *, u_long, caddr_t));
    189       1.7   thorpej void am7990_meminit __P((struct am7990_softc *));
    190       1.7   thorpej void am7990_reset __P((struct am7990_softc *));
    191      1.11        is void am7990_setladrf __P((struct ethercom *, u_int16_t *));
    192       1.7   thorpej void am7990_start __P((struct ifnet *));
    193       1.7   thorpej void am7990_stop __P((struct am7990_softc *));
    194       1.7   thorpej void am7990_watchdog __P((struct ifnet *));
    195       1.7   thorpej int am7990_intr __P((void *));
    196       1.1       cgd 
    197       1.2       cgd /*
    198       1.2       cgd  * The following functions are only useful on certain cpu/bus
    199       1.2       cgd  * combinations.  They should be written in assembly language for
    200       1.2       cgd  * maximum efficiency, but machine-independent versions are provided
    201       1.2       cgd  * for drivers that have not yet been optimized.
    202       1.2       cgd  */
    203       1.7   thorpej void am7990_copytobuf_contig __P((struct am7990_softc *, void *, int, int));
    204       1.7   thorpej void am7990_copyfrombuf_contig __P((struct am7990_softc *, void *, int, int));
    205       1.7   thorpej void am7990_zerobuf_contig __P((struct am7990_softc *, int, int));
    206       1.7   thorpej 
    207       1.7   thorpej #if 0	/* Example only - see am7990.c */
    208       1.7   thorpej void am7990_copytobuf_gap2 __P((struct am7990_softc *, void *, int, int));
    209       1.7   thorpej void am7990_copyfrombuf_gap2 __P((struct am7990_softc *, void *, int, int));
    210       1.7   thorpej void am7990_zerobuf_gap2 __P((struct am7990_softc *, int, int));
    211       1.7   thorpej 
    212       1.7   thorpej void am7990_copytobuf_gap16 __P((struct am7990_softc *, void *, int, int));
    213       1.7   thorpej void am7990_copyfrombuf_gap16 __P((struct am7990_softc *, void *, int, int));
    214       1.7   thorpej void am7990_zerobuf_gap16 __P((struct am7990_softc *, int, int));
    215       1.7   thorpej #endif /* Example only */
    216