1 /* $NetBSD: smc90cx6var.h,v 1.5 2000/03/23 07:01:32 thorpej Exp $ */
5 * SPDX-License-Identifier: BSD-2-Clause-NetBSD
7 * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
10 * This code is derived from software contributed to The NetBSD Foundation
11 * by Ignatios Souvatzis.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
36 * BAH (SMC 8bit ARCnet chipset) k/dpi
38 * The SMC 8bit ARCnet chip family uses a register and a memory window, which
39 * we get passed via bus_space_tags and bus_space_handles.
41 * As the reset functionality differs between the Amiga boards (using the
42 * 90c26 chip) and middle-aged ISA boards (using the 90c56 chip), we have
43 * a sc_reset callback function in the softc, which does a stop function
44 * (reset and leave dead) or a reset function depending on wether the 2nd
45 * parameter is 0 or 1.
48 #ifndef _SMC90CX6VAR_H_
49 #define _SMC90CX6VAR_H_
51 #include <sys/callout.h>
54 struct ifnet *sc_ifp; /* Common arcnet structures */
55 struct mtx sc_mtx; /* sc mutex */
57 int port_rid; /* resource id for port range */
58 struct resource *port_res; /* resource for port range */
60 int mem_rid; /* resource id for memory range */
61 struct resource *mem_res; /* resource for memory range */
63 int irq_rid; /* resource id for irq */
64 struct resource *irq_res; /* resource for irq */
65 void * irq_handle; /* handle for irq handler */
67 void *sc_rxcookie; /* softcallback cookies */
69 struct callout sc_recon_ch;
70 u_long sc_recontime; /* seconds only, I'm lazy */
71 u_long sc_reconcount; /* for the above */
72 u_long sc_reconcount_excessive; /* for the above */
73 #define ARC_EXCESSIVE_RECONS 20
74 #define ARC_EXCESSIVE_RECONS_REWARN 400
75 struct callout sc_watchdog_timer;
78 u_char sc_rx_act; /* 2..3 */
79 u_char sc_tx_act; /* 0..1 */
80 u_char sc_rx_fillcount;
81 u_char sc_tx_fillcount;
82 u_char sc_broadcast[2]; /* is it a broadcast packet? */
83 u_char sc_retransmits[2]; /* unused at the moment */
86 int cm_attach(device_t dev);
88 void cm_stop_locked(struct cm_softc *sc);
89 void cm_release_resources(device_t dev);
91 extern devclass_t cm_devclass;
93 #define CM_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
94 #define CM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
98 bus_space_read_1(rman_get_bustag((sc)->port_res), \
99 rman_get_bushandle((sc)->port_res), \
101 #define PUTREG(off, value) \
102 bus_space_write_1(rman_get_bustag((sc)->port_res), \
103 rman_get_bushandle((sc)->port_res), \
105 #define GETMEM(off) \
106 bus_space_read_1(rman_get_bustag((sc)->mem_res), \
107 rman_get_bushandle((sc)->mem_res), \
109 #define PUTMEM(off, value) \
110 bus_space_write_1(rman_get_bustag((sc)->mem_res), \
111 rman_get_bushandle((sc)->mem_res), \