if_xname support Part 2/2: Convert remaining netif devices and implement full
[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 /*      $DragonFly: src/sys/dev/netif/cm/Attic/smc90cx6var.h,v 1.4 2004/01/06 03:17:22 dillon Exp $ */
4
5 /*-
6  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
7  * All rights reserved.
8  *
9  * This code is derived from software contributed to The NetBSD Foundation
10  * by Ignatios Souvatzis.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. All advertising materials mentioning features or use of this software
21  *    must display the following acknowledgement:
22  *        This product includes software developed by the NetBSD
23  *        Foundation, Inc. and its contributors.
24  * 4. Neither the name of The NetBSD Foundation nor the names of its
25  *    contributors may be used to endorse or promote products derived
26  *    from this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  */
40
41 /*
42  * BAH (SMC 8bit ARCnet chipset) k/dpi
43  *
44  * The SMC 8bit ARCnet chip family uses a register and a memory window, which
45  * we get passed via bus_space_tags and bus_space_handles.
46  *
47  * As the reset functionality differs between the Amiga boards (using the
48  * 90c26 chip) and middle-aged ISA boards (using the 90c56 chip), we have
49  * a sc_reset callback function in the softc, which does a stop function
50  * (reset and leave dead) or a reset function depending on wether the 2nd
51  * parameter is 0 or 1.
52  */
53
54 #ifndef _SMC90CX6VAR_H_
55 #define _SMC90CX6VAR_H_
56
57 #include <sys/callout.h>
58
59 struct cm_softc {
60         struct  arccom  sc_arccom;      /* Common arcnet structures */
61
62         int     port_rid;               /* resource id for port range */
63         struct resource *port_res;      /* resource for port range */
64         int     port_used;              /* ports used */
65
66         int     mem_rid;                /* resource id for memory range */
67         struct resource *mem_res;       /* resource for memory range */
68         int     mem_used;               /* memory used */
69
70         int     irq_rid;                /* resource id for irq */
71         struct resource *irq_res;       /* resource for irq */
72         void *  irq_handle;             /* handle for irq handler */
73
74         void    *sc_rxcookie;           /* softcallback cookies */
75         void    *sc_txcookie;
76         struct callout sc_recon_ch;
77         u_long  sc_recontime;           /* seconds only, I'm lazy */
78         u_long  sc_reconcount;          /* for the above */
79         u_long  sc_reconcount_excessive; /* for the above */
80 #define ARC_EXCESSIVE_RECONS 20
81 #define ARC_EXCESSIVE_RECONS_REWARN 400
82         u_char  sc_intmask;
83         u_char  sc_rx_act;              /* 2..3 */
84         u_char  sc_tx_act;              /* 0..1 */
85         u_char  sc_rx_fillcount;
86         u_char  sc_tx_fillcount;
87         u_char  sc_broadcast[2];        /* is it a broadcast packet? */
88         u_char  sc_retransmits[2];      /* unused at the moment */
89 };
90
91 int     cm_attach (device_t);
92 void    cmintr (void *);
93
94 int     cm_probe (device_t dev);
95 void    cm_stop (struct cm_softc *sc);
96
97 int     cm_alloc_port (device_t dev, int rid, int size);
98 int     cm_alloc_memory (device_t dev, int rid, int size);
99 int     cm_alloc_irq (device_t dev, int rid);
100 void    cm_release_resources (device_t dev);
101
102 extern  devclass_t cm_devclass;
103
104 #endif