hmevar.h revision 1.22.2.1 1 /* $NetBSD: hmevar.h,v 1.22.2.1 2012/02/18 07:34:19 mrg Exp $ */
2
3 /*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Paul Kranenburg.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32
33 #include <sys/callout.h>
34 #include <sys/rnd.h>
35
36
37 struct hme_ring {
38 /* Ring Descriptors */
39 void * rb_membase; /* Packet buffer: CPU address */
40 bus_addr_t rb_dmabase; /* Packet buffer: DMA address */
41 void * rb_txd; /* Transmit descriptors */
42 bus_addr_t rb_txddma; /* DMA address of same */
43 void * rb_rxd; /* Receive descriptors */
44 bus_addr_t rb_rxddma; /* DMA address of same */
45 void * rb_txbuf; /* Transmit buffers */
46 void * rb_rxbuf; /* Receive buffers */
47 int rb_ntbuf; /* # of transmit buffers */
48 int rb_nrbuf; /* # of receive buffers */
49
50 /* Ring Descriptor state */
51 int rb_tdhead, rb_tdtail;
52 int rb_rdtail;
53 int rb_td_nbusy;
54 };
55
56 struct hme_softc {
57 device_t sc_dev; /* boilerplate device view */
58 struct ethercom sc_ethercom; /* Ethernet common part */
59 struct mii_data sc_mii; /* MII media control */
60 struct callout sc_tick_ch; /* tick callout */
61
62 /* The following bus handles are to be provided by the bus front-end */
63 bus_space_tag_t sc_bustag; /* bus tag */
64 bus_dma_tag_t sc_dmatag; /* bus dma tag */
65 bus_dmamap_t sc_dmamap; /* bus dma handle */
66 bus_space_handle_t sc_seb; /* HME Global registers */
67 bus_space_handle_t sc_erx; /* HME ERX registers */
68 bus_space_handle_t sc_etx; /* HME ETX registers */
69 bus_space_handle_t sc_mac; /* HME MAC registers */
70 bus_space_handle_t sc_mif; /* HME MIF registers */
71 int sc_burst; /* DVMA burst size in effect */
72 int sc_phys[2]; /* MII instance -> PHY map */
73
74 int sc_pci; /* XXXXX -- PCI buses are LE. */
75
76 /* Ring descriptor */
77 struct hme_ring sc_rb;
78 #if notused
79 void (*sc_copytobuf)(struct hme_softc *,
80 void *, void *, size_t);
81 void (*sc_copyfrombuf)(struct hme_softc *,
82 void *, void *, size_t);
83 #endif
84
85 int sc_debug;
86 int sc_ec_capenable;
87 short sc_if_flags;
88 uint8_t sc_enaddr[ETHER_ADDR_LEN]; /* MAC address */
89
90 /* Special hardware hooks */
91 void (*sc_hwreset)(struct hme_softc *);
92 void (*sc_hwinit)(struct hme_softc *);
93
94 krndsource_t rnd_source;
95 };
96
97
98 void hme_config(struct hme_softc *);
99 int hme_intr(void *);
100