The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/lancevar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: lancevar.h,v 1.12 2008/04/28 20:23:50 martin Exp $     */
    2 
    3 /*-
    4  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
    9  * Simulation Facility, NASA Ames Research Center.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   30  * POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 #include "rnd.h"
   34 
   35 #if NRND > 0
   36 #include <sys/rnd.h>
   37 #endif
   38 
   39 struct lance_softc {
   40         device_t sc_dev;                /* base device glue */
   41         struct  ethercom sc_ethercom;   /* Ethernet common part */
   42         struct  ifmedia sc_media;       /* our supported media */
   43 
   44         /*
   45          * Memory functions:
   46          *
   47          *      copy to/from descriptor
   48          *      copy to/from buffer
   49          *      zero bytes in buffer
   50          */
   51         void    (*sc_copytodesc)
   52                    (struct lance_softc *, void *, int, int);
   53         void    (*sc_copyfromdesc)
   54                    (struct lance_softc *, void *, int, int);
   55         void    (*sc_copytobuf)
   56                    (struct lance_softc *, void *, int, int);
   57         void    (*sc_copyfrombuf)
   58                    (struct lance_softc *, void *, int, int);
   59         void    (*sc_zerobuf)
   60                    (struct lance_softc *, int, int);
   61 
   62         /*
   63          * Machine-dependent functions:
   64          *
   65          *      read/write CSR
   66          *      hardware reset hook - may be NULL
   67          *      hardware init hook - may be NULL
   68          *      no carrier hook - may be NULL
   69          *      media change hook - may be NULL
   70          */
   71         uint16_t (*sc_rdcsr)
   72                    (struct lance_softc *, uint16_t);
   73         void    (*sc_wrcsr)
   74                    (struct lance_softc *, uint16_t, uint16_t);
   75         void    (*sc_hwreset)(struct lance_softc *);
   76         void    (*sc_hwinit)(struct lance_softc *);
   77         void    (*sc_nocarrier)(struct lance_softc *);
   78         int     (*sc_mediachange)(struct lance_softc *);
   79         void    (*sc_mediastatus)(struct lance_softc *, struct ifmediareq *);
   80 
   81         /*
   82          * Media-supported by this interface.  If this is NULL,
   83          * the only supported media is assumed to be "manual".
   84          */
   85         const int       *sc_supmedia;
   86         int     sc_nsupmedia;
   87         int     sc_defaultmedia;
   88 
   89         /* PCnet bit to use software selection of a port */
   90         int     sc_initmodemedia;
   91 
   92         int     sc_havecarrier; /* carrier status */
   93 
   94         void    *sc_sh;         /* shutdownhook cookie */
   95 
   96         uint16_t sc_conf3;      /* CSR3 value */
   97         uint16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
   98 
   99         void    *sc_mem;        /* base address of RAM -- CPU's view */
  100         u_long  sc_addr;        /* base address of RAM -- LANCE's view */
  101 
  102         u_long  sc_memsize;     /* size of RAM */
  103 
  104         int     sc_nrbuf;       /* number of receive buffers */
  105         int     sc_ntbuf;       /* number of transmit buffers */
  106         int     sc_last_rd;
  107         int     sc_first_td, sc_last_td, sc_no_td;
  108 
  109         int     sc_initaddr;
  110         int     sc_rmdaddr;
  111         int     sc_tmdaddr;
  112         int     *sc_rbufaddr;
  113         int     *sc_tbufaddr;
  114 
  115 #ifdef LEDEBUG
  116         int     sc_debug;
  117 #endif
  118         uint8_t sc_enaddr[ETHER_ADDR_LEN];
  119         uint8_t sc_pad[2];
  120 #if NRND > 0
  121         rndsource_element_t     rnd_source;
  122 #endif
  123 
  124         void (*sc_meminit)(struct lance_softc *);
  125         void (*sc_start)(struct ifnet *);
  126 };
  127 
  128 void lance_config(struct lance_softc *);
  129 void lance_reset(struct lance_softc *);
  130 int lance_init(struct ifnet *);
  131 int lance_put(struct lance_softc *, int, struct mbuf *);
  132 void lance_read(struct lance_softc *, int, int);
  133 void lance_setladrf(struct ethercom *, uint16_t *);
  134 
  135 /*
  136  * The following functions are only useful on certain CPU/bus
  137  * combinations.  They should be written in assembly language for
  138  * maximum efficiency, but machine-independent versions are provided
  139  * for drivers that have not yet been optimized.
  140  */
  141 void lance_copytobuf_contig(struct lance_softc *, void *, int, int);
  142 void lance_copyfrombuf_contig(struct lance_softc *, void *, int, int);
  143 void lance_zerobuf_contig(struct lance_softc *, int, int);
  144 
  145 #if 0   /* Example only - see lance.c */
  146 void lance_copytobuf_gap2(struct lance_softc *, void *, int, int);
  147 void lance_copyfrombuf_gap2(struct lance_softc *, void *, int, int);
  148 void lance_zerobuf_gap2(struct lance_softc *, int, int);
  149 
  150 void lance_copytobuf_gap16(struct lance_softc *, void *, int, int);
  151 void lance_copyfrombuf_gap16(struct lance_softc *, void *, int, int);
  152 void lance_zerobuf_gap16(struct lance_softc *, int, int);
  153 #endif /* Example only */

Cache object: 932b1bae8313f3cd761bff407696b430


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.