]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/i4b/layer1/i4b_isic_isa.c
This commit was generated by cvs2svn to compensate for changes in r62475,
[FreeBSD/FreeBSD.git] / sys / i4b / layer1 / i4b_isic_isa.c
1 /*
2  * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  *
25  *---------------------------------------------------------------------------
26  *
27  *      i4b_isic_isa.c - ISA bus interface
28  *      ==================================
29  *
30  *      $Id: i4b_isic_isa.c,v 1.4 1999/12/13 21:25:26 hm Exp $ 
31  *
32  * $FreeBSD$
33  *
34  *      last edit-date: [Mon Dec 13 22:01:39 1999]
35  *
36  *---------------------------------------------------------------------------*/
37
38 #include "isic.h"
39 #include "opt_i4b.h"
40
41 #if NISIC > 0
42
43 #include <sys/param.h>
44 #include <sys/kernel.h>
45 #include <sys/systm.h>
46 #include <sys/mbuf.h>
47 #include <sys/socket.h>
48 #include <net/if.h>
49
50 #include <machine/clock.h>
51
52 #include <machine/i4b_debug.h>
53 #include <machine/i4b_ioctl.h>
54 #include <machine/i4b_trace.h>
55
56 #include <i4b/layer1/i4b_l1.h>
57 #include <i4b/layer1/i4b_ipac.h>
58 #include <i4b/layer1/i4b_isac.h>
59 #include <i4b/layer1/i4b_hscx.h>
60
61 #include <i4b/include/i4b_l1l2.h>
62 #include <i4b/include/i4b_mbuf.h>
63 #include <i4b/include/i4b_global.h>
64
65 #include <sys/resource.h>
66 #include <sys/bus.h>
67 #include <isa/isavar.h>
68
69 struct l1_softc l1_sc[ISIC_MAXUNIT];
70
71 static int isic_isa_probe(device_t dev);
72 static int isic_isa_attach(device_t dev);
73
74 static device_method_t isic_methods[] = {
75         DEVMETHOD(device_probe,         isic_isa_probe),
76         DEVMETHOD(device_attach,        isic_isa_attach),
77         { 0, 0 }
78 };
79
80 static driver_t isic_driver = {
81         "isic",
82         isic_methods,
83         0
84 };
85
86 static devclass_t isic_devclass;
87
88 DRIVER_MODULE(isic, isa, isic_driver, isic_devclass, 0, 0);
89
90 /*---------------------------------------------------------------------------*
91  *      probe for ISA non-PnP cards
92  *---------------------------------------------------------------------------*/
93 static int
94 isic_isa_probe(device_t dev)
95 {
96         int ret = ENXIO;
97
98         if(isa_get_vendorid(dev))       /* no PnP probes here */
99                 return ENXIO;
100
101         switch(device_get_flags(dev))
102         {
103 #ifdef TEL_S0_16
104                 case FLAG_TELES_S0_16:
105                         ret = isic_probe_s016(dev);
106                         break;
107 #endif
108
109 #ifdef TEL_S0_8
110                 case FLAG_TELES_S0_8:
111                         ret = isic_probe_s08(dev);
112                         break;
113 #endif
114
115 #ifdef ELSA_PCC16
116                 case FLAG_ELSA_PCC16:
117                         ret = isic_probe_Epcc16(dev);
118                         break;
119 #endif
120
121 #ifdef TEL_S0_16_3
122                 case FLAG_TELES_S0_163:
123                         ret = isic_probe_s0163(dev);            
124                         break;
125 #endif
126
127 #ifdef AVM_A1
128                 case FLAG_AVM_A1:
129                         ret = isic_probe_avma1(dev);
130                         break;
131 #endif
132
133 #ifdef USR_STI
134                 case FLAG_USR_ISDN_TA_INT:
135                         ret = isic_probe_usrtai(dev);           
136                         break;
137 #endif
138
139 #ifdef ITKIX1
140                 case FLAG_ITK_IX1:
141                         ret = isic_probe_itkix1(dev);
142                         break;
143 #endif
144
145                 default:
146                         printf("isic%d: probe, unknown flag: %d\n",
147                                 device_get_unit(dev), device_get_flags(dev));
148                         break;
149         }
150         return(ret);
151 }
152
153 /*---------------------------------------------------------------------------*
154  *      attach for ISA non-PnP cards
155  *---------------------------------------------------------------------------*/
156 static int
157 isic_isa_attach(device_t dev)
158 {
159         int ret = ENXIO;
160
161         struct l1_softc *sc = &l1_sc[device_get_unit(dev)];
162
163         sc->sc_unit = device_get_unit(dev);
164         
165         /* card dependent setup */
166
167         switch(sc->sc_flags)
168         {
169 #ifdef TEL_S0_16
170                 case FLAG_TELES_S0_16:
171                         ret = isic_attach_s016(dev);
172                         break;
173 #endif
174
175 #ifdef TEL_S0_8
176                 case FLAG_TELES_S0_8:
177                         ret = isic_attach_s08(dev);
178                         break;
179 #endif
180
181 #ifdef ELSA_PCC16
182                 case FLAG_ELSA_PCC16:
183                         ret = isic_attach_Epcc16(dev);
184                         break;
185 #endif
186
187 #ifdef TEL_S0_16_3
188                 case FLAG_TELES_S0_163:
189                         ret = isic_attach_s0163(dev);
190                         break;
191 #endif
192
193 #ifdef AVM_A1
194                 case FLAG_AVM_A1:
195                         ret = isic_attach_avma1(dev);
196                         break;
197 #endif
198
199 #ifdef USR_STI
200                 case FLAG_USR_ISDN_TA_INT:
201                         ret = isic_attach_usrtai(dev);          
202                         break;
203 #endif
204
205 #ifdef ITKIX1
206                 case FLAG_ITK_IX1:
207                         ret = isic_attach_itkix1(dev);
208                         break;
209 #endif
210
211                 default:
212                         printf("isic%d: attach, unknown flag: %d\n",
213                                 device_get_unit(dev), device_get_flags(dev));
214                         break;
215         }
216
217         if(ret)
218                 return(ret);
219                 
220         ret = isic_attach_common(dev);
221
222         return(ret);
223 }
224 #endif /* NISIC > 0 */