1 /* $NetBSD: smc90cx6var.h,v 1.5 2000/03/23 07:01:32 thorpej Exp $ */
5 * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Ignatios Souvatzis.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
41 * BAH (SMC 8bit ARCnet chipset) k/dpi
43 * The SMC 8bit ARCnet chip family uses a register and a memory window, which
44 * we get passed via bus_space_tags and bus_space_handles.
46 * As the reset functionality differs between the Amiga boards (using the
47 * 90c26 chip) and middle-aged ISA boards (using the 90c56 chip), we have
48 * a sc_reset callback function in the softc, which does a stop function
49 * (reset and leave dead) or a reset function depending on wether the 2nd
50 * parameter is 0 or 1.
53 #ifndef _SMC90CX6VAR_H_
54 #define _SMC90CX6VAR_H_
56 #include <sys/callout.h>
59 struct ifnet *sc_ifp; /* Common arcnet structures */
60 struct mtx sc_mtx; /* sc mutex */
62 int port_rid; /* resource id for port range */
63 struct resource *port_res; /* resource for port range */
65 int mem_rid; /* resource id for memory range */
66 struct resource *mem_res; /* resource for memory range */
68 int irq_rid; /* resource id for irq */
69 struct resource *irq_res; /* resource for irq */
70 void * irq_handle; /* handle for irq handler */
72 void *sc_rxcookie; /* softcallback cookies */
74 struct callout sc_recon_ch;
75 u_long sc_recontime; /* seconds only, I'm lazy */
76 u_long sc_reconcount; /* for the above */
77 u_long sc_reconcount_excessive; /* for the above */
78 #define ARC_EXCESSIVE_RECONS 20
79 #define ARC_EXCESSIVE_RECONS_REWARN 400
81 u_char sc_rx_act; /* 2..3 */
82 u_char sc_tx_act; /* 0..1 */
83 u_char sc_rx_fillcount;
84 u_char sc_tx_fillcount;
85 u_char sc_broadcast[2]; /* is it a broadcast packet? */
86 u_char sc_retransmits[2]; /* unused at the moment */
89 int cm_attach(device_t dev);
91 void cm_stop_locked(struct cm_softc *sc);
92 void cm_release_resources(device_t dev);
94 extern devclass_t cm_devclass;
96 #define CM_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
97 #define CM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
100 #define GETREG(off) \
101 bus_space_read_1(rman_get_bustag((sc)->port_res), \
102 rman_get_bushandle((sc)->port_res), \
104 #define PUTREG(off, value) \
105 bus_space_write_1(rman_get_bustag((sc)->port_res), \
106 rman_get_bushandle((sc)->port_res), \
108 #define GETMEM(off) \
109 bus_space_read_1(rman_get_bustag((sc)->mem_res), \
110 rman_get_bushandle((sc)->mem_res), \
112 #define PUTMEM(off, value) \
113 bus_space_write_1(rman_get_bustag((sc)->mem_res), \
114 rman_get_bushandle((sc)->mem_res), \