]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/dev/vx/if_vxvar.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / dev / vx / if_vxvar.h
1 /*-
2  * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: 1. Redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer. 2. The name
8  * of the author may not be used to endorse or promote products derived from
9  * this software without specific prior written permission
10  *
11  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
12  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
14  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
16  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
17  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
18  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
19  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
20  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21  *
22  * $FreeBSD$
23  *
24  October 2, 1994
25
26  Modified by: Andres Vega Garcia
27
28  INRIA - Sophia Antipolis, France
29  e-mail: avega@sophia.inria.fr
30  finger: avega@pax.inria.fr
31
32  */
33
34 /*
35  * Ethernet software status per interface.
36  */
37 struct vx_softc {
38         struct ifnet *vx_ifp;
39         bus_space_tag_t vx_bst;
40         bus_space_handle_t vx_bsh;
41         void *vx_intrhand;
42         struct resource *vx_irq;
43         struct resource *vx_res;
44 #define MAX_MBS  8                      /* # of mbufs we keep around     */
45         struct mbuf *vx_mb[MAX_MBS];    /* spare mbuf storage.           */
46         int vx_next_mb;                 /* Which mbuf to use next.       */
47         int vx_last_mb;                 /* Last mbuf.                    */
48         char vx_connectors;             /* Connectors on this card.      */
49         char vx_connector;              /* Connector to use.             */
50         short vx_tx_start_thresh;       /* Current TX_start_thresh.      */
51         int vx_tx_succ_ok;              /* # packets sent in sequence    */
52                                         /* w/o underrun                  */
53         struct callout vx_callout;      /* Callout for timeouts          */
54         struct callout vx_watchdog;
55         struct mtx vx_mtx;
56         int vx_buffill_pending;
57         int vx_timer;
58 };
59
60 #define CSR_WRITE_4(sc, reg, val)       \
61         bus_space_write_4(sc->vx_bst, sc->vx_bsh, reg, val)
62 #define CSR_WRITE_2(sc, reg, val)       \
63         bus_space_write_2(sc->vx_bst, sc->vx_bsh, reg, val)
64 #define CSR_WRITE_1(sc, reg, val)       \
65         bus_space_write_1(sc->vx_bst, sc->vx_bsh, reg, val)
66
67 #define CSR_READ_4(sc, reg)             \
68         bus_space_read_4(sc->vx_bst, sc->vx_bsh, reg)
69 #define CSR_READ_2(sc, reg)             \
70         bus_space_read_2(sc->vx_bst, sc->vx_bsh, reg)
71 #define CSR_READ_1(sc, reg)             \
72         bus_space_read_1(sc->vx_bst, sc->vx_bsh, reg)
73
74 #define VX_LOCK(sc)             mtx_lock(&(sc)->vx_mtx)
75 #define VX_UNLOCK(sc)           mtx_unlock(&(sc)->vx_mtx)
76 #define VX_LOCK_ASSERT(sc)      mtx_assert(&(sc)->vx_mtx, MA_OWNED)
77
78 int     vx_attach(device_t);
79 void    vx_stop(struct vx_softc *);
80 void    vx_intr(void *);
81 int     vx_busy_eeprom(struct vx_softc *);