Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / dev / netif / cm / smc90cx6var.h
1 /*      $NetBSD: smc90cx6var.h,v 1.5 2000/03/23 07:01:32 thorpej Exp $  */
2 /*      $FreeBSD: src/sys/dev/cm/smc90cx6var.h,v 1.1.2.1 2002/02/13 22:33:41 fjoe Exp $ */
3
4 /*-
5  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Ignatios Souvatzis.
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  * 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.
26  *
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.
38  */
39
40 /*
41  * BAH (SMC 8bit ARCnet chipset) k/dpi
42  *
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.
45  *
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.
51  */
52
53 #ifndef _SMC90CX6VAR_H_
54 #define _SMC90CX6VAR_H_
55
56 #include <sys/callout.h>
57
58 struct cm_softc {
59         struct  arccom  sc_arccom;      /* Common arcnet structures */
60
61         int     port_rid;               /* resource id for port range */
62         struct resource *port_res;      /* resource for port range */
63         int     port_used;              /* ports used */
64
65         int     mem_rid;                /* resource id for memory range */
66         struct resource *mem_res;       /* resource for memory range */
67         int     mem_used;               /* memory used */
68
69         int     irq_rid;                /* resource id for irq */
70         struct resource *irq_res;       /* resource for irq */
71         void *  irq_handle;             /* handle for irq handler */
72
73         void    *sc_rxcookie;           /* softcallback cookies */
74         void    *sc_txcookie;
75         struct callout sc_recon_ch;
76         u_long  sc_recontime;           /* seconds only, I'm lazy */
77         u_long  sc_reconcount;          /* for the above */
78         u_long  sc_reconcount_excessive; /* for the above */
79 #define ARC_EXCESSIVE_RECONS 20
80 #define ARC_EXCESSIVE_RECONS_REWARN 400
81         u_char  sc_intmask;
82         u_char  sc_rx_act;              /* 2..3 */
83         u_char  sc_tx_act;              /* 0..1 */
84         u_char  sc_rx_fillcount;
85         u_char  sc_tx_fillcount;
86         u_char  sc_broadcast[2];        /* is it a broadcast packet? */
87         u_char  sc_retransmits[2];      /* unused at the moment */
88 };
89
90 int     cm_attach __P((struct cm_softc *, int unit));
91 void    cmintr __P((void *));
92
93 int     cm_probe __P((device_t dev));
94 void    cm_stop __P((struct cm_softc *sc));
95
96 int     cm_alloc_port __P((device_t dev, int rid, int size));
97 int     cm_alloc_memory __P((device_t dev, int rid, int size));
98 int     cm_alloc_irq __P((device_t dev, int rid));
99 void    cm_release_resources __P((device_t dev));
100
101 extern  devclass_t cm_devclass;
102
103 #endif