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

Cache object: 65160007eeb3fa55b71b4f3581b28cff


[ 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.