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/dp8390var.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: dp8390var.h,v 1.36 2021/08/09 20:49:10 andvar Exp $    */
    2 
    3 /*
    4  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
    5  * adapters.
    6  *
    7  * Copyright (c) 1994, 1995 Charles M. Hannum.  All rights reserved.
    8  *
    9  * Copyright (C) 1993, David Greenman.  This software may be used, modified,
   10  * copied, distributed, and sold, in both source and binary form provided that
   11  * the above copyright and these terms are retained.  Under no circumstances is
   12  * the author responsible for the proper functioning of this software, nor does
   13  * the author assume any responsibility for damages incurred with its use.
   14  */
   15 
   16 #include <sys/rndsource.h>
   17 
   18 /*
   19  * We include MII glue here -- some DP8390 compatible chips have
   20  * MII interfaces on them (scary, isn't it...).
   21  */
   22 #include <sys/callout.h>
   23 #include <dev/mii/miivar.h>
   24 
   25 #define INTERFACE_NAME_LEN      32
   26 
   27 /*
   28  * dp8390_softc: per line info and status
   29  */
   30 struct dp8390_softc {
   31         device_t        sc_dev;
   32         void    *sc_ih;
   33         int     sc_flags;               /* interface flags, from config */
   34 
   35         struct ethercom sc_ec;          /* ethernet common */
   36         struct mii_data sc_mii;         /* MII glue */
   37 #define sc_media sc_mii.mii_media       /* compatibility definition */
   38         callout_t       sc_tick_ch;     /* MII tick callout */
   39 
   40         bus_space_tag_t sc_regt;        /* NIC register space tag */
   41         bus_space_handle_t sc_regh;     /* NIC register space handle */
   42         bus_space_tag_t sc_buft;        /* Buffer space tag */
   43         bus_space_handle_t sc_bufh;     /* Buffer space handle */
   44 
   45         bus_size_t sc_reg_map[16];      /* register map (offsets) */
   46 
   47         int     is790;          /* NIC is a 790 */
   48 
   49         u_int8_t cr_proto;      /* values always set in CR */
   50         u_int8_t rcr_proto;     /* values always set in RCR */
   51         u_int8_t dcr_reg;       /* override DCR iff LS is set */
   52 
   53         int     mem_start;      /* offset of NIC memory */
   54         int     mem_end;        /* offset of NIC memory end */
   55         int     mem_size;       /* total shared memory size */
   56         int     mem_ring;       /* offset of start of RX ring-buffer */
   57 
   58         u_short txb_cnt;        /* Number of transmit buffers */
   59         u_short txb_inuse;      /* number of transmit buffers active */
   60 
   61         u_short txb_new;        /* pointer to where new buffer will be added */
   62         u_short txb_next_tx;    /* pointer to next buffer ready to xmit */
   63         u_short txb_len[8];     /* buffered xmit buffer lengths */
   64         u_short tx_page_start;  /* first page of TX buffer area */
   65         u_short rec_page_start; /* first page of RX ring-buffer */
   66         u_short rec_page_stop;  /* last page of RX ring-buffer */
   67         u_short next_packet;    /* pointer to next unread RX packet */
   68 
   69         u_int8_t sc_enaddr[ETHER_ADDR_LEN];     /* storage for MAC address */
   70 
   71         int     sc_enabled;     /* boolean; power enabled on interface */
   72 
   73         krndsource_t rnd_source; /* random source */
   74 
   75         int     (*test_mem)(struct dp8390_softc *);
   76         void    (*init_card)(struct dp8390_softc *);
   77         void    (*stop_card)(struct dp8390_softc *);
   78         void    (*read_hdr)(struct dp8390_softc *, int, struct dp8390_ring *);
   79         void    (*recv_int)(struct dp8390_softc *);
   80         int     (*ring_copy)(struct dp8390_softc *, int, void *, u_short);
   81         int     (*write_mbuf)(struct dp8390_softc *, struct mbuf *, int);
   82 
   83         int     (*sc_enable)(struct dp8390_softc *);
   84         void    (*sc_disable)(struct dp8390_softc *);
   85 
   86         void    (*sc_media_init)(struct dp8390_softc *);
   87         void    (*sc_media_fini)(struct dp8390_softc *);
   88 
   89         int     (*sc_mediachange)(struct dp8390_softc *);
   90         void    (*sc_mediastatus)(struct dp8390_softc *, struct ifmediareq *);
   91 };
   92 
   93 /*
   94  * Vendor types
   95  */
   96 #define DP8390_VENDOR_UNKNOWN   0xff    /* Unknown network card */
   97 #define DP8390_VENDOR_WD_SMC    0x00    /* Western Digital/SMC */
   98 #define DP8390_VENDOR_3COM      0x01    /* 3Com */
   99 #define DP8390_VENDOR_NOVELL    0x02    /* Novell */
  100 #define DP8390_VENDOR_APPLE     0x10    /* Apple Ethernet card */
  101 #define DP8390_VENDOR_INTERLAN  0x11    /* Interlan A310 card (GatorCard) */
  102 #define DP8390_VENDOR_DAYNA     0x12    /* DaynaPORT E/30s (and others?) */
  103 #define DP8390_VENDOR_ASANTE    0x13    /* Asante MacCon II/E */
  104 #define DP8390_VENDOR_FARALLON  0x14    /* Farallon EtherMac II-TP */
  105 #define DP8390_VENDOR_FOCUS     0x15    /* FOCUS Enhancements EtherLAN */
  106 #define DP8390_VENDOR_KINETICS  0x16    /* Kinetics EtherPort SE/30 */
  107 #define DP8390_VENDOR_CABLETRON 0x17    /* Cabletron Ethernet */
  108 
  109 /*
  110  * Compile-time config flags
  111  */
  112 /*
  113  * This sets the default for enabling/disabling the tranceiver.
  114  */
  115 #define DP8390_DISABLE_TRANCEIVER       0x0001
  116 
  117 /*
  118  * This forces the board to be used in 8/16-bit mode even if it autoconfigs
  119  * differently.
  120  */
  121 #define DP8390_FORCE_8BIT_MODE          0x0002
  122 #define DP8390_FORCE_16BIT_MODE         0x0004
  123 
  124 /*
  125  * This disables the use of multiple transmit buffers.
  126  */
  127 #define DP8390_NO_MULTI_BUFFERING       0x0008
  128 
  129 /*
  130  * This forces all operations with the NIC memory to use Programmed I/O (i.e.
  131  * not via shared memory).
  132  */
  133 #define DP8390_FORCE_PIO                0x0010
  134 
  135 /*
  136  * The chip is ASIX AX88190 and needs work around.
  137  */
  138 #define DP8390_DO_AX88190_WORKAROUND    0x0020
  139 
  140 #define DP8390_ATTACHED                 0x0040  /* attach has succeeded */
  141 
  142 /*
  143  * ASIX AX88796 doesn't have remote DMA conmplete bit in ISR, so don't
  144  * check ISR.RDC
  145  */
  146 #define DP8390_NO_REMOTE_DMA_COMPLETE   0x0080
  147 
  148 /*
  149  * NIC register access macros
  150  */
  151 #define NIC_GET(t, h, reg)      bus_space_read_1(t, h,                  \
  152                                     ((sc)->sc_reg_map[reg]))
  153 #define NIC_PUT(t, h, reg, val) bus_space_write_1(t, h,                 \
  154                                     ((sc)->sc_reg_map[reg]), (val))
  155 #define NIC_BARRIER(t, h)       bus_space_barrier(t, h, 0, 0x10,        \
  156                             BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE)
  157 
  158 int     dp8390_config(struct dp8390_softc *);
  159 int     dp8390_intr(void *);
  160 int     dp8390_ioctl(struct ifnet *, u_long, void *);
  161 void    dp8390_start(struct ifnet *);
  162 void    dp8390_watchdog(struct ifnet *);
  163 void    dp8390_reset(struct dp8390_softc *);
  164 void    dp8390_init(struct dp8390_softc *);
  165 void    dp8390_stop(struct dp8390_softc *);
  166 
  167 void    dp8390_rint(struct dp8390_softc *);
  168 
  169 void    dp8390_getmcaf(struct ethercom *, u_int8_t *);
  170 struct mbuf *dp8390_get(struct dp8390_softc *, int, u_short);
  171 void    dp8390_read(struct dp8390_softc *, int, u_short);
  172 
  173 int     dp8390_enable(struct dp8390_softc *);
  174 void    dp8390_disable(struct dp8390_softc *);
  175 
  176 int     dp8390_activate(device_t, enum devact);
  177 
  178 int     dp8390_detach(struct dp8390_softc *, int);
  179 
  180 int     dp8390_mediachange(struct ifnet *);
  181 void    dp8390_mediastatus(struct ifnet *, struct ifmediareq *);
  182 
  183 void    dp8390_media_init(struct dp8390_softc *);

Cache object: 2cd56d1f24056eca22c9147eede5f85c


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