elinkxlvar.h revision 1.1 1 1.1 fvdl /* $NetBSD: elinkxlvar.h,v 1.1 1998/11/04 00:29:29 fvdl Exp $ */
2 1.1 fvdl
3 1.1 fvdl /*-
4 1.1 fvdl * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.1 fvdl * All rights reserved.
6 1.1 fvdl *
7 1.1 fvdl * This code is derived from software contributed to The NetBSD Foundation
8 1.1 fvdl * by Frank van der Linden.
9 1.1 fvdl *
10 1.1 fvdl * Redistribution and use in source and binary forms, with or without
11 1.1 fvdl * modification, are permitted provided that the following conditions
12 1.1 fvdl * are met:
13 1.1 fvdl * 1. Redistributions of source code must retain the above copyright
14 1.1 fvdl * notice, this list of conditions and the following disclaimer.
15 1.1 fvdl * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 fvdl * notice, this list of conditions and the following disclaimer in the
17 1.1 fvdl * documentation and/or other materials provided with the distribution.
18 1.1 fvdl * 3. All advertising materials mentioning features or use of this software
19 1.1 fvdl * must display the following acknowledgement:
20 1.1 fvdl * This product includes software developed by the NetBSD
21 1.1 fvdl * Foundation, Inc. and its contributors.
22 1.1 fvdl * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 fvdl * contributors may be used to endorse or promote products derived
24 1.1 fvdl * from this software without specific prior written permission.
25 1.1 fvdl *
26 1.1 fvdl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 fvdl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 fvdl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 fvdl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 fvdl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 fvdl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 fvdl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 fvdl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 fvdl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 fvdl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 fvdl * POSSIBILITY OF SUCH DAMAGE.
37 1.1 fvdl */
38 1.1 fvdl
39 1.1 fvdl #include "rnd.h"
40 1.1 fvdl
41 1.1 fvdl #if NRND > 0
42 1.1 fvdl #include <sys/rnd.h>
43 1.1 fvdl #endif
44 1.1 fvdl
45 1.1 fvdl /*
46 1.1 fvdl * Ethernet software status per interface.
47 1.1 fvdl */
48 1.1 fvdl struct ex_softc {
49 1.1 fvdl struct device sc_dev;
50 1.1 fvdl void *sc_ih;
51 1.1 fvdl
52 1.1 fvdl struct ethercom sc_ethercom; /* Ethernet common part */
53 1.1 fvdl bus_space_tag_t sc_iot; /* bus cookie */
54 1.1 fvdl bus_space_handle_t sc_ioh; /* bus i/o handle */
55 1.1 fvdl bus_dma_tag_t sc_dmat; /* bus dma tag */
56 1.1 fvdl bus_dmamap_t sc_dpd_dmamap;
57 1.1 fvdl bus_dmamap_t sc_upd_dmamap;
58 1.1 fvdl #define sc_upddma sc_upd_dmamap->dm_segs[0].ds_addr
59 1.1 fvdl #define sc_dpddma sc_dpd_dmamap->dm_segs[0].ds_addr
60 1.1 fvdl struct ex_upd *sc_upd;
61 1.1 fvdl struct ex_dpd *sc_dpd;
62 1.1 fvdl bus_dmamap_t sc_tx_dmamaps[EX_NDPD]; /* DMA maps for DPDs */
63 1.1 fvdl bus_dmamap_t sc_rx_dmamaps[EX_NUPD]; /* DMA maps for UPDs */
64 1.1 fvdl struct ex_rxdesc sc_rxdescs[EX_NUPD];
65 1.1 fvdl struct ex_txdesc sc_txdescs[EX_NDPD];
66 1.1 fvdl
67 1.1 fvdl struct ex_rxdesc *rx_head;
68 1.1 fvdl struct ex_rxdesc *rx_tail;
69 1.1 fvdl
70 1.1 fvdl struct ex_txdesc *tx_head;
71 1.1 fvdl struct ex_txdesc *tx_tail;
72 1.1 fvdl struct ex_txdesc *tx_free;
73 1.1 fvdl struct ex_txdesc *tx_ftail;
74 1.1 fvdl
75 1.1 fvdl int tx_start_thresh; /* Current TX_start_thresh. */
76 1.1 fvdl int tx_succ_ok; /* # packets sent in sequence */
77 1.1 fvdl
78 1.1 fvdl u_int ex_connectors; /* Connectors on this card. */
79 1.1 fvdl mii_data_t ex_mii; /* mii bus data */
80 1.1 fvdl u_int ex_conf; /* config flags */
81 1.1 fvdl
82 1.1 fvdl #define EX_CONF_MII 0x0001 /* has MII bus */
83 1.1 fvdl #define EX_CONF_INTPHY 0x0002 /* has internal PHY */
84 1.1 fvdl #define EX_CONF_90XB 0x0004 /* is 90xB */
85 1.1 fvdl
86 1.1 fvdl
87 1.1 fvdl /*
88 1.1 fvdl * XXX code duplication from elink3var.h
89 1.1 fvdl */
90 1.1 fvdl u_int ex_flags; /* capabilities flag (from EEPROM) */
91 1.1 fvdl #define EX_FLAGS_PNP 0x0001
92 1.1 fvdl #define EX_FLAGS_FULLDUPLEX 0x0002
93 1.1 fvdl #define EX_FLAGS_LARGEPKT 0x0004 /* 4k packet support */
94 1.1 fvdl #define EX_FLAGS_SLAVEDMA 0x0008
95 1.1 fvdl #define EX_FLAGS_SECONDDMA 0x0010
96 1.1 fvdl #define EX_FLAGS_FULLDMA 0x0020
97 1.1 fvdl #define EX_FLAGS_FRAGMENTDMA 0x0040
98 1.1 fvdl #define EX_FLAGS_CRC_PASSTHRU 0x0080
99 1.1 fvdl #define EX_FLAGS_TXDONE 0x0100
100 1.1 fvdl #define EX_FLAGS_NO_TXLENGTH 0x0200
101 1.1 fvdl #define EX_FLAGS_RXREPEAT 0x0400
102 1.1 fvdl #define EX_FLAGS_SNOOPING 0x0800
103 1.1 fvdl #define EX_FLAGS_100MBIT 0x1000
104 1.1 fvdl #define EX_FLAGS_POWERMGMT 0x2000
105 1.1 fvdl
106 1.1 fvdl u_char ex_bustype; /* parent bus type (currently unused) */
107 1.1 fvdl
108 1.1 fvdl #define EX_BUS_PCI 0
109 1.1 fvdl
110 1.1 fvdl #if NRND > 0
111 1.1 fvdl rndsource_element_t rnd_source;
112 1.1 fvdl #endif
113 1.1 fvdl
114 1.1 fvdl /* power management hooks */
115 1.1 fvdl int (*enable) __P((struct ex_softc *));
116 1.1 fvdl void (*disable) __P((struct ex_softc *));
117 1.1 fvdl int enabled;
118 1.1 fvdl };
119 1.1 fvdl
120 1.1 fvdl #define ex_waitcmd(sc) \
121 1.1 fvdl while (bus_space_read_2((sc)->sc_iot, (sc)->sc_ioh, ELINK_STATUS) \
122 1.1 fvdl & S_COMMAND_IN_PROGRESS);
123 1.1 fvdl
124 1.1 fvdl u_int16_t exreadeeprom __P((bus_space_tag_t, bus_space_handle_t, int));
125 1.1 fvdl void ex_config __P((struct ex_softc *));
126 1.1 fvdl
127 1.1 fvdl int ex_intr __P((void *));
128 1.1 fvdl void ex_stop __P((struct ex_softc *));
129 1.1 fvdl void ex_watchdog __P((struct ifnet *));
130 1.1 fvdl int ex_ioctl __P((struct ifnet *ifp, u_long, caddr_t));
131