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