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