FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/hmevar.h
1 /* $OpenBSD: hmevar.h,v 1.17 2014/11/27 14:53:42 brad Exp $ */
2 /* $NetBSD: hmevar.h,v 1.6 2000/09/28 10:56:57 tsutsui Exp $ */
3
4 /*-
5 * Copyright (c) 1999 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Paul Kranenburg.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #include <sys/timeout.h>
34
35 #define HME_TX_RING_SIZE 64
36 #define HME_RX_RING_SIZE 64
37 #define HME_RX_RING_MAX 256
38 #define HME_TX_RING_MAX 256
39 #define HME_RX_PKTSIZE 1600
40 #define HME_TX_NSEGS 16
41
42 struct hme_sxd {
43 struct mbuf *sd_mbuf; /* descriptor mbuf */
44 bus_dmamap_t sd_map; /* descriptor dmamap */
45 };
46
47 struct hme_ring {
48 /* Ring Descriptors */
49 caddr_t rb_membase; /* Packet buffer: CPU address */
50 bus_addr_t rb_dmabase; /* Packet buffer: DMA address */
51 caddr_t rb_txd; /* Transmit descriptors */
52 bus_addr_t rb_txddma; /* DMA address of same */
53 caddr_t rb_rxd; /* Receive descriptors */
54 bus_addr_t rb_rxddma; /* DMA address of same */
55 };
56
57 struct hme_softc {
58 struct device sc_dev; /* boilerplate device view */
59 struct arpcom sc_arpcom; /* Ethernet common part */
60 struct mii_data sc_mii; /* MII media control */
61 #define sc_media sc_mii.mii_media/* shorthand */
62 struct timeout sc_tick_ch; /* tick callout */
63
64 /* The following bus handles are to be provided by the bus front-end */
65 bus_space_tag_t sc_bustag; /* bus tag */
66 bus_dma_tag_t sc_dmatag; /* bus dma tag */
67 bus_dmamap_t sc_dmamap; /* bus dma handle */
68 bus_space_handle_t sc_seb; /* HME Global registers */
69 bus_space_handle_t sc_erx; /* HME ERX registers */
70 bus_space_handle_t sc_etx; /* HME ETX registers */
71 bus_space_handle_t sc_mac; /* HME MAC registers */
72 bus_space_handle_t sc_mif; /* HME MIF registers */
73 int sc_burst; /* DVMA burst size in effect */
74 int sc_phys[2]; /* MII instance -> PHY map */
75
76 int sc_pci; /* XXXXX -- PCI buses are LE. */
77
78 /* Ring descriptor */
79 struct hme_ring sc_rb;
80
81 int sc_debug;
82
83 struct hme_sxd sc_txd[HME_TX_RING_MAX], sc_rxd[HME_RX_RING_MAX];
84 bus_dmamap_t sc_rxmap_spare;
85 int sc_tx_cnt, sc_tx_prod, sc_tx_cons;
86 struct if_rxring sc_rx_ring;
87 int sc_rx_prod, sc_rx_cons;
88 u_int32_t sc_tcvr;
89 };
90
91
92 void hme_config(struct hme_softc *);
93 void hme_unconfig(struct hme_softc *);
94 void hme_reset(struct hme_softc *);
95 int hme_intr(void *);
Cache object: 93e9f5e2bbd802555ae863712d07b35e
|