ixp4xx: add Mikael Petterssons patch works for 2.6.33 & 2.6.35
[openwrt.git] / target / linux / generic-2.4 / patches / 200-i4l.patch
1 --- a/Documentation/isdn/CREDITS
2 +++ b/Documentation/isdn/CREDITS
3 @@ -37,7 +37,7 @@ Michael Knigge (knick@cove.han.de)
4 Andreas Kool (akool@Kool.f.EUnet.de)
5 For contribution of the isdnlog/isdnrep-tool
6
7 -Pedro Roque Marques (pedro_m@yahoo.com)
8 +Pedro Roque Marques (roque@di.fc.ul.pt)
9 For lot of new ideas and the pcbit driver.
10
11 Eberhard Moenkeberg (emoenke@gwdg.de)
12 --- a/Documentation/isdn/HiSax.cert
13 +++ b/Documentation/isdn/HiSax.cert
14 @@ -68,6 +68,8 @@ drivers/isdn/hisax/cert.c
15 drivers/isdn/hisax/elsa.c
16 drivers/isdn/hisax/diva.c
17 drivers/isdn/hisax/hfc_pci.c
18 +drivers/isdn/hisax/hfc_usbr.c
19 +drivers/isdn/hisax/hfc_usb.c
20
21 Please send any changes, bugfixes and patches to me rather than implementing
22 them directly into the HiSax sources.
23 --- a/Documentation/isdn/INTERFACE
24 +++ b/Documentation/isdn/INTERFACE
25 @@ -1,4 +1,4 @@
26 -$Id: INTERFACE,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
27 +$Id: INTERFACE,v 1.17 2002/01/31 13:26:35 keil Exp $
28
29 Description of the Interface between Linklevel and Hardwarelevel
30 of isdn4linux:
31 @@ -399,7 +399,7 @@ Description of the Interface between Lin
32 protocol-Id is one of the constants ISDN_PROTO_L3...
33 parm.fax = Pointer to T30_s fax struct. (fax usage only)
34
35 - ISDN_CMD_GETL2: (currently unused)
36 + ISDN_CMD_GETL3: (currently unused)
37
38 With this command, the HL-driver is told to return the current
39 setting of the Layer-3-protocol.
40 @@ -781,3 +781,22 @@ Description of the Interface between Lin
41 arg = channel-number, locally to the driver. (starting with 0)
42 parm = unused.
43
44 + ISDN_STAT_ALERT:
45 +
46 + With this call, the HL-driver signals the receive of an ALERTING message to the LL.
47 +
48 + Parameter:
49 + driver = driver-Id
50 + command = ISDN_STAT_ALERT
51 + arg = channel-number, locally to the driver. (starting with 0)
52 +
53 + ISDN_STAT_PROCEED:
54 +
55 + With this call, the HL-driver signals the receive of an CALL PROCEEDING message
56 + to the LL.
57 +
58 + Parameter:
59 + driver = driver-Id
60 + command = ISDN_STAT_PROCEED
61 + arg = channel-number, locally to the driver. (starting with 0)
62 +
63 --- a/Documentation/isdn/INTERFACE.fax
64 +++ b/Documentation/isdn/INTERFACE.fax
65 @@ -1,4 +1,4 @@
66 -$Id: INTERFACE.fax,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
67 +$Id: INTERFACE.fax,v 1.2 2000/08/06 09:22:50 armin Exp $
68
69
70 Description of the fax-subinterface between linklevel and hardwarelevel of
71 --- a/Documentation/isdn/README
72 +++ b/Documentation/isdn/README
73 @@ -278,6 +278,12 @@ README for the ISDN-subsystem
74 1 = Add CPN to FCON message on
75 Bit 2: 0 = Add CDN to RING/FCON message off
76 1 = Add CDN to RING/FCON message on
77 + Bit 3: 0 = Do not signal RINGING
78 + 1 = Signal RINGING if ALERT was received
79 + Bit 4: 0 = Do not signal PROCEEDING
80 + 1 = Signal PROCEEDING if CALL PROCEEDING
81 + was received
82 +
83
84 Last but not least a (at the moment fairly primitive) device to request
85 the line-status (/dev/isdninfo) is made available.
86 --- a/Documentation/isdn/README.HiSax
87 +++ b/Documentation/isdn/README.HiSax
88 @@ -41,10 +41,9 @@ ELSA Quickstep 3000 (same settings as QS
89 ELSA Quickstep 3000PCI
90 ELSA PCMCIA
91 ITK ix1-micro Rev.2
92 -Eicon Diva 2.0 ISA and PCI (S0 and U interface, no PRO version)
93 -Eicon Diva 2.01 ISA and PCI
94 -Eicon Diva 2.02 PCI
95 -Eicon Diva Piccola
96 +Eicon.Diehl Diva 2.0 ISA and PCI (S0 and U interface, no PRO version)
97 +Eicon.Diehl Diva 2.01 ISA and PCI
98 +Eicon.Diehl Diva Piccola
99 ASUSCOM NETWORK INC. ISDNLink 128K PC adapter (order code I-IN100-ST-D)
100 Dynalink IS64PH (OEM version of ASUSCOM NETWORK INC. ISDNLink 128K adapter)
101 PCBIT-DP (OEM version of ASUSCOM NETWORK INC. ISDNLink)
102 @@ -53,7 +52,6 @@ Sedlbauer Speed Card (Speed Win, Teledat
103 Sedlbauer Speed Star/Speed Star2 (PCMCIA)
104 Sedlbauer ISDN-Controller PC/104
105 USR Sportster internal TA (compatible Stollmann tina-pp V3)
106 -USR internal TA PCI
107 ith Kommunikationstechnik GmbH MIC 16 ISA card
108 Traverse Technologie NETjet PCI S0 card and NETspider U card
109 Ovislink ISDN sc100-p card (NETjet driver)
110 @@ -68,14 +66,14 @@ Gazel ISDN cards
111 HFC-PCI based cards
112 Winbond W6692 based cards
113 HFC-S+, HFC-SP/PCMCIA cards
114 -formula-n enternow
115 -Gerdes Power ISDN
116 +HFC-USB ISDN TAs
117
118 Note: PCF, PCF-Pro: up to now, only the ISDN part is supported
119 PCC-8: not tested yet
120 Eicon.Diehl Diva U interface not tested
121
122 If you know other passive cards with the Siemens chipset, please let me know.
123 +To use the PNP cards you need the isapnptools.
124 You can combine any card, if there is no conflict between the resources
125 (io, mem, irq).
126
127 @@ -91,15 +89,8 @@ There is also some config needed before
128 modules. It is included in the normal "make [menu]config" target at the
129 kernel. Don't forget it, especially to select the right D-channel protocol.
130
131 -Please note: In older versions of the HiSax driver, all PnP cards
132 -needed to be configured with isapnp and worked only with the HiSax
133 -driver used as a module.
134 -
135 -In the current version, HiSax will automatically use the in-kernel
136 -ISAPnP support, provided you selected it during kernel configuration
137 -(CONFIG_ISAPNP), if you don't give the io=, irq= command line parameters.
138 -
139 -The affected card types are: 4,7,12,14,19,27-30
140 +Please note: All PnP cards need to be configured with isapnp and will work
141 +only with the HiSax driver used as a module.
142
143 a) when built as a module
144 -------------------------
145 @@ -200,8 +191,6 @@ Card types:
146 37 HFC 2BDS0 S+, SP irq,io
147 38 NETspider U PCI card none
148 39 HFC 2BDS0 SP/PCMCIA irq,io (set with cardmgr)
149 - 40 hotplug interface
150 - 41 Formula-n enter:now PCI none
151
152 At the moment IRQ sharing is only possible with PCI cards. Please make sure
153 that your IRQ is free and enabled for ISA use.
154 @@ -227,13 +216,6 @@ Examples for module loading
155 (IO 1 (BASE 0x0180))
156 modprobe hisax type=4 protocol=2 irq=10 io0=0x580 io1=0x180
157
158 - In the current version of HiSax, you can instead simply use
159 -
160 - modprobe hisax type=4 protocol=2
161 -
162 - if you configured your kernel for ISAPnP. Don't run isapnp in
163 - this case!
164 -
165 6. Teles 16.3, Euro ISDN, I/O base 280 hex, IRQ 12 and
166 Teles 16.0, 1TR6, IRQ 5, Memory d0000 hex
167 modprobe hisax type=3,1 protocol=2,1 io=0x280 mem=0,0xd0000
168 @@ -314,9 +296,7 @@ type
169 36 W6692 based PCI cards none
170 37 HFC 2BDS0 S+,SP/PCMCIA ONLY WORKS AS A MODULE !
171 38 NETspider U PCI card none
172 - 39 HFC 2BDS0 SP/PCMCIA ONLY WORKS AS A MODULE !
173 - 40 hotplug interface ONLY WORKS AS A MODULE !
174 - 41 Formula-n enter:now PCI none
175 +
176
177 Running the driver
178 ------------------
179 --- a/Documentation/isdn/README.act2000
180 +++ b/Documentation/isdn/README.act2000
181 @@ -1,4 +1,4 @@
182 -$Id: README.act2000,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
183 +$Id: README.act2000,v 1.3 2000/08/06 09:22:51 armin Exp $
184
185 This document describes the ACT2000 driver for the
186 IBM Active 2000 ISDN card.
187 --- a/Documentation/isdn/README.audio
188 +++ b/Documentation/isdn/README.audio
189 @@ -1,4 +1,4 @@
190 -$Id: README.audio,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
191 +$Id: README.audio,v 1.8 1999/07/11 17:17:29 armin Exp $
192
193 ISDN subsystem for Linux.
194 Description of audio mode.
195 --- a/Documentation/isdn/README.eicon
196 +++ b/Documentation/isdn/README.eicon
197 @@ -1,4 +1,4 @@
198 -$Id: README.eicon,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
199 +$Id: README.eicon,v 1.10 2000/08/13 12:19:15 armin Exp $
200
201 (c) 1999,2000 Armin Schindler (mac@melware.de)
202 (c) 1999,2000 Cytronics & Melware (info@melware.de)
203 --- a/Documentation/isdn/README.hysdn
204 +++ b/Documentation/isdn/README.hysdn
205 @@ -1,4 +1,4 @@
206 -$Id: README.hysdn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
207 +$Id: README.hysdn,v 1.3.6.1 2001/02/10 14:41:19 kai Exp $
208 The hysdn driver has been written by
209 by Werner Cornelius (werner@isdn4linux.de or werner@titro.de)
210 for Hypercope GmbH Aachen Germany. Hypercope agreed to publish this driver
211 --- a/Documentation/isdn/README.icn
212 +++ b/Documentation/isdn/README.icn
213 @@ -1,4 +1,4 @@
214 -$Id: README.icn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
215 +$Id: README.icn,v 1.7 2000/08/06 09:22:51 armin Exp $
216
217 You can get the ICN-ISDN-card from:
218
219 --- a/Documentation/isdn/README.pcbit
220 +++ b/Documentation/isdn/README.pcbit
221 @@ -37,4 +37,4 @@ mailing list (isdn4linux@listserv.isdn4l
222 regards,
223 Pedro.
224
225 -<pedro_m@yahoo.com>
226 +<roque@di.fc.ul.pt>
227 --- /dev/null
228 +++ b/Documentation/isdn/abcext_kernel.help
229 @@ -0,0 +1,166 @@
230 +
231 +ISDN-ABC-DW Extension
232 +CONFIG_ISDN_WITH_ABC
233 + These are many brand new Options and Features for the
234 + ISDN SUBSYSTEM. Including Logical Device bindings,
235 + Compression and other good stuff for Optimizing your
236 + ISDN System.
237 +
238 + To Use this Extensions you MUST HAVE THE NEWEST
239 + ISDN4K-UTILS. You must have Version 3.1-Beta6 or
240 + higher. Elsewhere you can not configure this Extensions.
241 +
242 + WARNING ! THIS STUF IS NOT PRODUCTION RELEASE THE
243 + FUNCTION ARE UNDER DEVELOPMENT. This ist BETA-CODE.
244 + You can use it at you Own Risk.
245 +
246 + For more Information on these Extensions take a look at
247 + "linux/Documentation/isdn/dw-abc-extension-howto.txt or
248 + Online at the Web "http://www.mediatronix.de/i4l/index.html"
249 +
250 + Please Report Bugs to "mario@mediatronix.de" or
251 + "delefw@isdn4linux.de"
252 +
253 +D-Channel-Callback with Channel in use check
254 +CONFIG_ISDN_WITH_ABC_CALLB
255 + When a Interface is declared as an Callback Interface,
256 + the Interface is checking that the other Side is not
257 + Calling on the same time before the Interface is Dialing.
258 +
259 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
260 + for more Information
261 +
262 + In most case answer with "Yes" when you have Callback devices,
263 + otherwise leave it "No"
264 +
265 +Outgoing-EAZ-Support
266 +CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
267 + Enables the Feature to Define an other EAZ or MSN for
268 + Outgoing calls on an Interface.
269 +
270 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
271 + for more Information
272 +
273 +Least Cost Router Support
274 +CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
275 + This is the final Kernel Code for configuring an Least
276 + Cost Router Softwarebased. The other Job is to do the
277 + action in ISDNLOG. You need the ISDNLOG to use this
278 + function. Currently the ISDNLOG have not the Support for
279 + this Option.
280 + So in most situations let the Option off.
281 +
282 +TCP keepalive detect and response
283 +CONFIG_ISDN_WITH_ABC_IPV4_TCP_KEEPALIVE
284 + This Option works only with the TCP/IP V4. It enables
285 + the Function that ISDN Devices are Answering TCP_KEEPALIVE Pakets
286 + localy. So that TCP KEEPALIVE Pakets not longer takes the Line
287 + open.
288 +
289 +Drop frames Sourceadresse is not Interfaceadress
290 +CONFIG_ISDN_WITH_ABC_IPV4_DYNADDR
291 + This Option works only with the TCP/IP V4. It will allow only
292 + the Transmitt of Pakets where the Sourceadresse is the Interface
293 + adress. It is usefull when you have Lines with Dynamic IP.
294 +
295 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
296 + for more Information
297 +
298 +Receive do not reset the Hanguptimer
299 +CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
300 + When you activate this option than the reiceive of pakets do
301 + not reset the Hanguptimer. It is very usefull because if the
302 + Paket vor your Network your Network generate an Response and
303 + the Transmit is reseting the HUPTIMER. But when the Paket is
304 + Rejected at your firewall your network generate no Response
305 + and no Sendtraffic is generated. So in this case there is no
306 + need to Reset the Huptimer because you have only received Data.
307 + With that option only Transmitted Data/Pakets will reset the
308 + HUPTIMER.
309 +
310 +Support of (device-channel) and Binding Groups
311 +CONFIG_ISDN_WITH_ABC_ICALL_BIND
312 + This Option enables the Feature to Bind logical ISDN Interfaces
313 + to an prefered ISDN Card or ISDN Card plus Channel. So you have
314 + the Chance to keep Channels exclusively for one (or more)
315 + Connection. Very usefull when you have more channels and Use
316 + Calling Line Identification, because you can organize that your
317 + call is going out over the Line with the right EAZ for the CLI.
318 +
319 +Skip channel if used external (Dial Only)
320 +CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
321 + When you have more than One ISDN Card in your System and you
322 + will Dialout with an Interface you can become the Situation
323 + that an External Device such a Telephone or Fax is Using the
324 + B-Channels. Normaly ISDN4Linux does not detect this Situation
325 + and dial everytime of the "External Busy" line out. With this
326 + Option Enabled the I4L will detect that he can not dialout on
327 + This Card and dial over the next Card out.
328 +
329 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
330 + for more Information
331 +
332 +Interface autodisable if Config error
333 +CONFIG_ISDN_WITH_ABC_CONN_ERROR
334 + This Option will detect an Device which generate Telephone
335 + Cost but does not Function correctly because there are
336 + Configerrors on one of the Site. In this Situation the
337 + Interface will be marked as Unsuably for some time to do
338 + not call every time this Site.
339 +
340 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
341 + for more Information
342 +
343 +UDP-Info-Support
344 +CONFIG_ISDN_WITH_ABC_UDP_CHECK
345 + This is the Mainoption to Enable or Disable the UDP
346 + Info Support. An Option to Controll ISDN-Interfaces
347 + Remotely. For this very Complex thing take a look at
348 +
349 + "linux/Documentation/isdn/dw-abc-extension-howto.txt"
350 + for more Information.
351 +
352 +UDP Hangup Support
353 +CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
354 +
355 + Sorry no more Information!
356 +
357 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
358 + for more Information
359 +
360 +UDP Dial Support
361 +CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
362 +
363 + Sorry no more Information!
364 +
365 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
366 + for more Information
367 +
368 +Limit on the line frames to two
369 +CONFIG_ISDN_WITH_ABC_FRAME_LIMIT
370 +
371 + This Option enables support for sending only 2 Pakets on
372 + the Fly to the ISDN Driver. It is very usefull when you
373 + will use the new RAW-IP Compression. Because of sending
374 + Only 2 Pakets on the Fly makes the risk of overflowing
375 + the ISDN Driver very smaller.
376 +
377 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
378 + for more Information
379 +
380 +Compression with RAWIP and X75I
381 +CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
382 +
383 + With this Option you have the ability to make Datacompression
384 + on RAW-IP Lines. It is function on HDLC and X75I Connection,
385 + but the Prefered L2-Protocol for Compression is X75I because
386 + the HDLC Protocol have no Errorcorrection.
387 +
388 + To Use this Option YOU MUST HAVE ENABLED THE OPTION:
389 + Support synchronous PPP
390 + and must load after loading the main isdndrivers the
391 + Modul "isdn_bsdcomp".
392 +
393 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
394 + for more Information
395 +
396 --- a/drivers/isdn/Config.in
397 +++ b/drivers/isdn/Config.in
398 @@ -4,11 +4,9 @@
399
400 # only included if CONFIG_ISDN != n
401
402 -define_bool CONFIG_ISDN_BOOL y
403 if [ "$CONFIG_INET" != "n" ]; then
404 bool ' Support synchronous PPP' CONFIG_ISDN_PPP
405 if [ "$CONFIG_ISDN_PPP" != "n" ]; then
406 - dep_bool ' PPP filtering for ISDN' CONFIG_IPPP_FILTER $CONFIG_FILTER
407 bool ' Use VJ-compression with synchronous PPP' CONFIG_ISDN_PPP_VJ
408 bool ' Support generic MP (RFC 1717)' CONFIG_ISDN_MPP
409 dep_tristate ' Support BSD compression' CONFIG_ISDN_PPP_BSDCOMP $CONFIG_ISDN
410 @@ -23,6 +21,30 @@ if [ "$CONFIG_X25" != "n" ]; then
411 fi
412
413 mainmenu_option next_comment
414 +comment 'ISDN abc-dw-extension'
415 +bool 'Enable isdn-abc-dw-extension' CONFIG_ISDN_WITH_ABC
416 +if [ "$CONFIG_ISDN_WITH_ABC" != "n" ]; then
417 + bool ' Use D-Channel-Callback with Channel in use check' CONFIG_ISDN_WITH_ABC_CALLB
418 + bool ' Enable Outgoing-EAZ-Support' CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
419 + bool ' Enable LCR-Support (need isdnlog)' CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
420 + bool ' RX dont reset hanguptimeout' CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
421 + if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
422 + bool ' Enable UDP-Info-Support' CONFIG_ISDN_WITH_ABC_UDP_CHECK
423 + if [ "$CONFIG_ISDN_WITH_ABC_UDP_CHECK" != "n" ]; then
424 + bool ' Enable Hangup-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
425 + bool ' Enable Dial-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
426 + fi
427 + fi
428 +
429 + bool ' Skip channel if used external (dial only)' CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
430 + bool ' Support interface-auto-disable if config-error' CONFIG_ISDN_WITH_ABC_CONN_ERROR
431 + if [ "$CONFIG_ISDN_PPP" != "n" ]; then
432 + bool ' Enable Compression with rawip and x75i' CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
433 + fi
434 +fi
435 +endmenu
436 +
437 +mainmenu_option next_comment
438 comment 'ISDN feature submodules'
439 dep_tristate 'isdnloop support' CONFIG_ISDN_DRV_LOOP $CONFIG_ISDN
440 dep_tristate 'Support isdn diversion services' CONFIG_ISDN_DIVERSION $CONFIG_ISDN
441 @@ -34,7 +56,6 @@ mainmenu_option next_comment
442 comment 'Passive ISDN cards'
443 dep_tristate 'HiSax SiemensChipSet driver support' CONFIG_ISDN_DRV_HISAX $CONFIG_ISDN
444 if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then
445 - define_bool CONFIG_ISDN_HISAX y
446 comment ' D-channel protocol features'
447 bool ' HiSax Support for EURO/DSS1' CONFIG_HISAX_EURO
448 if [ "$CONFIG_HISAX_EURO" != "n" ]; then
449 @@ -45,31 +66,28 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ];
450 fi
451 bool ' HiSax Support for german 1TR6' CONFIG_HISAX_1TR6
452 bool ' HiSax Support for US NI1' CONFIG_HISAX_NI1
453 - int ' Maximum number of cards supported by HiSax' CONFIG_HISAX_MAX_CARDS 8
454 comment ' HiSax supported cards'
455 - if [ "$CONFIG_ISA" != "n" ]; then
456 - bool ' Teles 16.0/8.0' CONFIG_HISAX_16_0
457 - bool ' Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3
458 - bool ' AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1
459 - bool ' ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2
460 - bool ' ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM
461 - bool ' TELEINT cards' CONFIG_HISAX_TELEINT
462 - bool ' HFC-S based cards' CONFIG_HISAX_HFCS
463 - bool ' USR Sportster internal TA' CONFIG_HISAX_SPORTSTER
464 - bool ' MIC card' CONFIG_HISAX_MIC
465 - bool ' Siemens I-Surf card' CONFIG_HISAX_ISURF
466 - bool ' HST Saphir card' CONFIG_HISAX_HSTSAPHIR
467 - fi
468 + bool ' Teles 16.0/8.0' CONFIG_HISAX_16_0
469 + bool ' Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3
470 bool ' Teles PCI' CONFIG_HISAX_TELESPCI
471 bool ' Teles S0Box' CONFIG_HISAX_S0BOX
472 + bool ' AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1
473 bool ' AVM PnP/PCI (Fritz!PnP/PCI)' CONFIG_HISAX_FRITZPCI
474 bool ' AVM A1 PCMCIA (Fritz)' CONFIG_HISAX_AVM_A1_PCMCIA
475 bool ' Elsa cards' CONFIG_HISAX_ELSA
476 + bool ' ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2
477 bool ' Eicon.Diehl Diva cards' CONFIG_HISAX_DIEHLDIVA
478 + bool ' ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM
479 + bool ' TELEINT cards' CONFIG_HISAX_TELEINT
480 + bool ' HFC-S based cards' CONFIG_HISAX_HFCS
481 bool ' Sedlbauer cards' CONFIG_HISAX_SEDLBAUER
482 + bool ' USR Sportster internal TA' CONFIG_HISAX_SPORTSTER
483 + bool ' MIC card' CONFIG_HISAX_MIC
484 bool ' NETjet card' CONFIG_HISAX_NETJET
485 bool ' NETspider U card' CONFIG_HISAX_NETJET_U
486 bool ' Niccy PnP/PCI card' CONFIG_HISAX_NICCY
487 + bool ' Siemens I-Surf card' CONFIG_HISAX_ISURF
488 + bool ' HST Saphir card' CONFIG_HISAX_HSTSAPHIR
489 bool ' Telekom A4T card' CONFIG_HISAX_BKM_A4T
490 bool ' Scitel Quadro card' CONFIG_HISAX_SCT_QUADRO
491 bool ' Gazel cards' CONFIG_HISAX_GAZEL
492 @@ -78,20 +96,27 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ];
493 bool ' HFC-S+, HFC-SP, HFC-PCMCIA cards' CONFIG_HISAX_HFC_SX
494 if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
495 # bool ' TESTEMULATOR (EXPERIMENTAL)' CONFIG_HISAX_TESTEMU
496 - bool ' Formula-n enter:now PCI card' CONFIG_HISAX_ENTERNOW_PCI
497 if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then
498 bool ' Am7930' CONFIG_HISAX_AMD7930
499 fi
500 fi
501 bool ' HiSax debugging' CONFIG_HISAX_DEBUG
502
503 - dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
504 - dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
505 - dep_tristate 'AVM A1 PCMCIA cards' CONFIG_HISAX_AVM_A1_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA $CONFIG_HISAX_AVM_A1_PCMCIA
506 - dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
507 - dep_tristate 'AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
508 - dep_tristate 'Auerswald devices ISDN support' CONFIG_USB_AUERISDN $CONFIG_ISDN_DRV_HISAX
509 + dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_PCMCIA
510 + dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_PCMCIA
511 + dep_tristate 'Colognechip HFC-USB support' CONFIG_HISAX_HFC_USB_CS $CONFIG_HISAX $CONFIG_USB
512 + dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_HISAX $CONFIG_USB $CONFIG_EXPERIMENTAL
513 + dep_tristate 'Fritz!PCIv2 support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_HISAX $CONFIG_EXPERIMENTAL
514
515 + if [ "$CONFIG_HISAX_SEDLBAUER_CS" != "n" ]; then
516 + define_bool CONFIG_HISAX_SEDLBAUER y
517 + fi
518 + if [ "$CONFIG_HISAX_ELSA_CS" != "n" ]; then
519 + define_bool CONFIG_HISAX_ELSA y
520 + fi
521 + if [ "$CONFIG_HISAX_HFC_USB_CS" != "n" ]; then
522 + define_bool CONFIG_HISAX_HFC_USB y
523 + fi
524 fi
525 endmenu
526
527 --- a/drivers/isdn/Makefile
528 +++ b/drivers/isdn/Makefile
529 @@ -2,7 +2,7 @@
530
531 # The target object and module list name.
532
533 -O_TARGET := vmlinux-obj.o
534 +O_TARGET := isdn.a
535
536 # Objects that export symbols.
537
538 @@ -32,9 +32,9 @@ obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_
539
540 # Object files in subdirectories
541
542 -mod-subdirs := avmb1 eicon hisax
543 +mod-subdirs := avmb1 eicon
544 subdir-$(CONFIG_ISDN_DIVERSION) += divert
545 -subdir-$(CONFIG_ISDN_HISAX) += hisax
546 +subdir-$(CONFIG_ISDN_DRV_HISAX) += hisax
547 subdir-$(CONFIG_ISDN_DRV_ICN) += icn
548 subdir-$(CONFIG_ISDN_DRV_PCBIT) += pcbit
549 subdir-$(CONFIG_ISDN_DRV_SC) += sc
550 --- a/drivers/isdn/act2000/act2000.h
551 +++ b/drivers/isdn/act2000/act2000.h
552 @@ -1,4 +1,4 @@
553 -/* $Id: act2000.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
554 +/* $Id$
555 *
556 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
557 *
558 @@ -178,19 +178,19 @@ typedef struct act2000_card {
559 char regname[35]; /* Name used for request_region */
560 } act2000_card;
561
562 -static inline void act2000_schedule_tx(act2000_card *card)
563 +extern __inline__ void act2000_schedule_tx(act2000_card *card)
564 {
565 queue_task(&card->snd_tq, &tq_immediate);
566 mark_bh(IMMEDIATE_BH);
567 }
568
569 -static inline void act2000_schedule_rx(act2000_card *card)
570 +extern __inline__ void act2000_schedule_rx(act2000_card *card)
571 {
572 queue_task(&card->rcv_tq, &tq_immediate);
573 mark_bh(IMMEDIATE_BH);
574 }
575
576 -static inline void act2000_schedule_poll(act2000_card *card)
577 +extern __inline__ void act2000_schedule_poll(act2000_card *card)
578 {
579 queue_task(&card->poll_tq, &tq_immediate);
580 mark_bh(IMMEDIATE_BH);
581 --- a/drivers/isdn/act2000/act2000_isa.c
582 +++ b/drivers/isdn/act2000/act2000_isa.c
583 @@ -1,4 +1,4 @@
584 -/* $Id: act2000_isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
585 +/* $Id$
586 *
587 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version).
588 *
589 @@ -178,8 +178,7 @@ act2000_isa_config_port(act2000_card * c
590 card->flags &= ~ACT2000_FLAGS_PVALID;
591 }
592 if (!check_region(portbase, ISA_REGION)) {
593 - if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL)
594 - return -EIO;
595 + request_region(portbase, ACT2000_PORTLEN, card->regname);
596 card->port = portbase;
597 card->flags |= ACT2000_FLAGS_PVALID;
598 return 0;
599 @@ -341,6 +340,9 @@ act2000_isa_send(act2000_card * card)
600 while (skb->len) {
601 if (act2000_isa_writeb(card, *(skb->data))) {
602 /* Fifo is full, but more data to send */
603 +#if 0
604 + printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l);
605 +#endif
606 test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock);
607 /* Schedule myself */
608 act2000_schedule_tx(card);
609 @@ -363,6 +365,9 @@ act2000_isa_send(act2000_card * card)
610 } else
611 dev_kfree_skb(skb);
612 card->sbuf = NULL;
613 +#if 0
614 + printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l);
615 +#endif
616 }
617 }
618
619 --- a/drivers/isdn/act2000/act2000_isa.h
620 +++ b/drivers/isdn/act2000/act2000_isa.h
621 @@ -1,4 +1,4 @@
622 -/* $Id: act2000_isa.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
623 +/* $Id$
624 *
625 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version).
626 *
627 --- a/drivers/isdn/act2000/capi.c
628 +++ b/drivers/isdn/act2000/capi.c
629 @@ -1,4 +1,4 @@
630 -/* $Id: capi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
631 +/* $Id$
632 *
633 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
634 * CAPI encoder/decoder
635 @@ -76,6 +76,10 @@ static actcapi_msgdsc valid_msg[] = {
636 {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"},
637 {{ 0x86, 0x03}, "DATA_B3_RESP"},
638 {{ 0xff, 0x03}, "MANUFACTURER_RESP"},
639 +#if 0
640 +/* CAPI 2.0 */
641 + {{ 0x05, 0x80}, "LISTEN_REQ (CAPI 2.0)"},
642 +#endif
643 #endif
644 {{ 0x00, 0x00}, NULL},
645 };
646 --- a/drivers/isdn/act2000/capi.h
647 +++ b/drivers/isdn/act2000/capi.h
648 @@ -1,4 +1,4 @@
649 -/* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
650 +/* $Id$
651 *
652 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
653 *
654 @@ -294,6 +294,19 @@ typedef struct actcapi_msg {
655 __u16 plci;
656 __u16 info;
657 } select_b3_protocol_conf;
658 +#if 0
659 + struct listen_req {
660 + __u32 controller;
661 + __u32 infomask;
662 + __u32 cipmask;
663 + __u32 cipmask2;
664 + __u16 dummy; /* 2 Length-bytes of 2 Structs MUST always be 0!!! */
665 + } listen_req;
666 + struct listen_conf {
667 + __u32 controller;
668 + __u16 info;
669 + } listen_conf;
670 +#else
671 struct listen_req {
672 __u8 controller;
673 __u32 infomask __attribute__ ((packed));
674 @@ -304,6 +317,7 @@ typedef struct actcapi_msg {
675 __u8 controller;
676 __u16 info __attribute__ ((packed));
677 } listen_conf;
678 +#endif
679 struct data_b3_req {
680 __u16 fakencci;
681 __u16 datalen;
682 @@ -330,7 +344,7 @@ typedef struct actcapi_msg {
683 } msg;
684 } actcapi_msg;
685
686 -static inline unsigned short
687 +extern __inline__ unsigned short
688 actcapi_nextsmsg(act2000_card *card)
689 {
690 unsigned long flags;
691 --- a/drivers/isdn/act2000/module.c
692 +++ b/drivers/isdn/act2000/module.c
693 @@ -1,4 +1,4 @@
694 -/* $Id: module.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
695 +/* $Id$
696 *
697 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
698 *
699 @@ -630,6 +630,10 @@ act2000_alloccard(int bus, int port, int
700 card->interface.features =
701 ISDN_FEATURE_L2_X75I |
702 ISDN_FEATURE_L2_HDLC |
703 +#if 0
704 +/* Not yet! New Firmware is on the way ... */
705 + ISDN_FEATURE_L2_TRANS |
706 +#endif
707 ISDN_FEATURE_L3_TRANS |
708 ISDN_FEATURE_P_UNKNOWN;
709 card->interface.hl_hdrlen = 20;
710 @@ -843,6 +847,39 @@ static void __exit act2000_exit(void)
711 }
712 printk(KERN_INFO "%s unloaded\n", DRIVERNAME);
713 }
714 +#if 0
715 +#ifndef MODULE
716 +void
717 +act2000_setup(char *str, int *ints)
718 +{
719 + int i, j, argc, port, irq, bus;
720 +
721 + argc = ints[0];
722 + i = 1;
723 + if (argc)
724 + while (argc) {
725 + port = irq = -1;
726 + bus = 0;
727 + if (argc) {
728 + bus = ints[i];
729 + i++;
730 + argc--;
731 + }
732 + if (argc) {
733 + port = ints[i];
734 + i++;
735 + argc--;
736 + }
737 + if (argc) {
738 + irq = ints[i];
739 + i++;
740 + argc--;
741 + }
742 + act2000_addcard(bus, port, irq, act_id);
743 + }
744 +}
745 +#endif
746 +#endif
747
748 module_init(act2000_init);
749 module_exit(act2000_exit);
750 --- a/drivers/isdn/avmb1/avm_cs.c
751 +++ b/drivers/isdn/avmb1/avm_cs.c
752 @@ -1,4 +1,4 @@
753 -/* $Id: avm_cs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
754 +/* $Id: avm_cs.c,v 1.6 2001/09/24 13:22:44 kai Exp $
755 *
756 * A PCMCIA client driver for AVM B1/M1/M2
757 *
758 --- a/drivers/isdn/avmb1/avmcard.h
759 +++ b/drivers/isdn/avmb1/avmcard.h
760 @@ -1,4 +1,4 @@
761 -/* $Id: avmcard.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
762 +/* $Id: avmcard.h,v 1.12 2001/09/24 13:22:44 kai Exp $
763 *
764 * Copyright 1999 by Carsten Paeth <calle@calle.de>
765 *
766 --- a/drivers/isdn/avmb1/b1.c
767 +++ b/drivers/isdn/avmb1/b1.c
768 @@ -1,4 +1,4 @@
769 -/* $Id: b1.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
770 +/* $Id: b1.c,v 1.26 2001/09/24 13:22:44 kai Exp $
771 *
772 * Common module for AVM B1 cards.
773 *
774 @@ -20,6 +20,7 @@
775 #include <linux/kernelcapi.h>
776 #include <asm/io.h>
777 #include <linux/init.h>
778 +#include <linux/isdn_compat.h>
779 #include <asm/uaccess.h>
780 #include <linux/netdevice.h>
781 #include "capilli.h"
782 @@ -27,7 +28,7 @@
783 #include "capicmd.h"
784 #include "capiutil.h"
785
786 -static char *revision = "$Revision: 1.1.4.1 $";
787 +static char *revision = "$Revision: 1.26 $";
788
789 /* ------------------------------------------------------------- */
790
791 --- a/drivers/isdn/avmb1/b1dma.c
792 +++ b/drivers/isdn/avmb1/b1dma.c
793 @@ -1,4 +1,4 @@
794 -/* $Id: b1dma.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
795 +/* $Id: b1dma.c,v 1.18 2001/09/24 13:22:44 kai Exp $
796 *
797 * Common module for AVM B1 cards that support dma with AMCC
798 *
799 @@ -21,6 +21,7 @@
800 #include <linux/kernelcapi.h>
801 #include <asm/io.h>
802 #include <linux/init.h>
803 +#include <linux/isdn_compat.h>
804 #include <asm/uaccess.h>
805 #include <linux/netdevice.h>
806 #include "capilli.h"
807 @@ -28,7 +29,11 @@
808 #include "capicmd.h"
809 #include "capiutil.h"
810
811 -static char *revision = "$Revision: 1.1.4.1 $";
812 +#if BITS_PER_LONG != 32
813 +#error FIXME: driver requires 32-bit platform
814 +#endif
815 +
816 +static char *revision = "$Revision: 1.18 $";
817
818 /* ------------------------------------------------------------- */
819
820 @@ -851,7 +856,7 @@ int b1dmactl_read_proc(char *page, char
821 __u8 flag;
822 int len = 0;
823 char *s;
824 - u_long txaddr, txlen, rxaddr, rxlen, csr;
825 + __u32 txaddr, txlen, rxaddr, rxlen, csr;
826
827 len += sprintf(page+len, "%-16s %s\n", "name", card->name);
828 len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port);
829 @@ -907,12 +912,12 @@ int b1dmactl_read_proc(char *page, char
830 save_flags(flags);
831 cli();
832
833 - txaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x2c));
834 - txaddr -= (u_long)card->dma->sendbuf;
835 + txaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x2c));
836 + txaddr -= (__u32)card->dma->sendbuf;
837 txlen = b1dmainmeml(card->mbase+0x30);
838
839 - rxaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x24));
840 - rxaddr -= (u_long)card->dma->recvbuf;
841 + rxaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x24));
842 + rxaddr -= (__u32)card->dma->recvbuf;
843 rxlen = b1dmainmeml(card->mbase+0x28);
844
845 csr = b1dmainmeml(card->mbase+AMCC_INTCSR);
846 --- a/drivers/isdn/avmb1/b1isa.c
847 +++ b/drivers/isdn/avmb1/b1isa.c
848 @@ -1,4 +1,4 @@
849 -/* $Id: b1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
850 +/* $Id: b1isa.c,v 1.14 2001/09/24 13:22:44 kai Exp $
851 *
852 * Module for AVM B1 ISA-card.
853 *
854 @@ -19,12 +19,13 @@
855 #include <linux/capi.h>
856 #include <linux/init.h>
857 #include <asm/io.h>
858 +#include <linux/isdn_compat.h>
859 #include "capicmd.h"
860 #include "capiutil.h"
861 #include "capilli.h"
862 #include "avmcard.h"
863
864 -static char *revision = "$Revision: 1.1.4.1 $";
865 +static char *revision = "$Revision: 1.14 $";
866
867 /* ------------------------------------------------------------- */
868
869 --- a/drivers/isdn/avmb1/b1pci.c
870 +++ b/drivers/isdn/avmb1/b1pci.c
871 @@ -1,4 +1,4 @@
872 -/* $Id: b1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
873 +/* $Id: b1pci.c,v 1.40 2001/09/24 13:22:44 kai Exp $
874 *
875 * Module for AVM B1 PCI-card.
876 *
877 @@ -21,21 +21,24 @@
878 #include <linux/capi.h>
879 #include <asm/io.h>
880 #include <linux/init.h>
881 +#include <linux/isdn_compat.h>
882 #include "capicmd.h"
883 #include "capiutil.h"
884 #include "capilli.h"
885 #include "avmcard.h"
886
887 -static char *revision = "$Revision: 1.1.4.1 $";
888 +static char *revision = "$Revision: 1.40 $";
889
890 /* ------------------------------------------------------------- */
891
892 +#ifndef COMPAT_HAS_2_2_PCI
893 static struct pci_device_id b1pci_pci_tbl[] __initdata = {
894 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_B1, PCI_ANY_ID, PCI_ANY_ID },
895 { } /* Terminating entry */
896 };
897
898 MODULE_DEVICE_TABLE(pci, b1pci_pci_tbl);
899 +#endif
900 MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 PCI card");
901 MODULE_AUTHOR("Carsten Paeth");
902 MODULE_LICENSE("GPL");
903 @@ -416,14 +419,14 @@ static int add_card(struct pci_dev *dev)
904 }
905 param.irq = dev->irq;
906
907 - if (pci_resource_start(dev, 2)) { /* B1 PCI V4 */
908 + if (pci_resource_start_io(dev, 2)) { /* B1 PCI V4 */
909 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
910 driver = &b1pciv4_driver;
911
912 pci_set_master(dev);
913 #endif
914 - param.membase = pci_resource_start(dev, 0);
915 - param.port = pci_resource_start(dev, 2);
916 + param.membase = pci_resource_start_mem(dev, 0);
917 + param.port = pci_resource_start_io(dev, 2);
918
919 printk(KERN_INFO
920 "%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n",
921 @@ -440,7 +443,7 @@ static int add_card(struct pci_dev *dev)
922 }
923 } else {
924 param.membase = 0;
925 - param.port = pci_resource_start(dev, 1);
926 + param.port = pci_resource_start_io(dev, 1);
927
928 printk(KERN_INFO
929 "%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n",
930 --- a/drivers/isdn/avmb1/b1pcmcia.c
931 +++ b/drivers/isdn/avmb1/b1pcmcia.c
932 @@ -1,4 +1,4 @@
933 -/* $Id: b1pcmcia.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
934 +/* $Id: b1pcmcia.c,v 1.17 2001/09/24 13:22:44 kai Exp $
935 *
936 * Module for AVM B1/M1/M2 PCMCIA-card.
937 *
938 @@ -25,7 +25,7 @@
939 #include "capilli.h"
940 #include "avmcard.h"
941
942 -static char *revision = "$Revision: 1.1.4.1 $";
943 +static char *revision = "$Revision: 1.17 $";
944
945 /* ------------------------------------------------------------- */
946
947 --- a/drivers/isdn/avmb1/c4.c
948 +++ b/drivers/isdn/avmb1/c4.c
949 @@ -1,4 +1,4 @@
950 -/* $Id: c4.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
951 +/* $Id: c4.c,v 1.38 2001/09/24 13:22:44 kai Exp $
952 *
953 * Module for AVM C4 & C2 card.
954 *
955 @@ -18,6 +18,7 @@
956 #include <linux/interrupt.h>
957 #include <linux/ioport.h>
958 #include <linux/pci.h>
959 +#include <linux/isdn_compat.h>
960 #include <linux/capi.h>
961 #include <linux/kernelcapi.h>
962 #include <linux/init.h>
963 @@ -30,7 +31,7 @@
964 #include "capilli.h"
965 #include "avmcard.h"
966
967 -static char *revision = "$Revision: 1.1.4.1 $";
968 +static char *revision = "$Revision: 1.38 $";
969
970 #undef CONFIG_C4_DEBUG
971 #undef CONFIG_C4_POLLDEBUG
972 @@ -39,6 +40,7 @@ static char *revision = "$Revision: 1.1.
973
974 static int suppress_pollack;
975
976 +#ifndef COMPAT_HAS_2_2_PCI
977 static struct pci_device_id c4_pci_tbl[] __initdata = {
978 { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C4 },
979 { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C2 },
980 @@ -46,6 +48,7 @@ static struct pci_device_id c4_pci_tbl[]
981 };
982
983 MODULE_DEVICE_TABLE(pci, c4_pci_tbl);
984 +#endif
985 MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards");
986 MODULE_AUTHOR("Carsten Paeth");
987 MODULE_LICENSE("GPL");
988 @@ -1332,9 +1335,9 @@ static int __init search_cards(struct ca
989 }
990 pci_set_master(dev);
991
992 - param.port = pci_resource_start(dev, 1);
993 + param.port = pci_resource_start_io(dev, 1);
994 param.irq = dev->irq;
995 - param.membase = pci_resource_start(dev, 0);
996 + param.membase = pci_resource_start_mem(dev, 0);
997
998 printk(KERN_INFO
999 "%s: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n",
1000 --- a/drivers/isdn/avmb1/capi.c
1001 +++ b/drivers/isdn/avmb1/capi.c
1002 @@ -1,4 +1,4 @@
1003 -/* $Id: capi.c,v 1.1.4.2 2001/12/09 18:45:13 kai Exp $
1004 +/* $Id: capi.c,v 1.59 2001/11/07 22:35:48 kai Exp $
1005 *
1006 * CAPI 2.0 Interface for Linux
1007 *
1008 @@ -23,6 +23,7 @@
1009 #include <linux/smp_lock.h>
1010 #include <linux/timer.h>
1011 #include <linux/wait.h>
1012 +#include <linux/isdn_compat.h>
1013 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1014 #include <linux/tty.h>
1015 #ifdef CONFIG_PPP
1016 @@ -30,6 +31,9 @@
1017 #include <linux/ppp_defs.h>
1018 #include <linux/if_ppp.h>
1019 #undef CAPI_PPP_ON_RAW_DEVICE
1020 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1021 +#include <linux/ppp_channel.h>
1022 +#endif /* CAPI_PPP_ON_RAW_DEVICE */
1023 #endif /* CONFIG_PPP */
1024 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1025 #include <linux/skbuff.h>
1026 @@ -38,14 +42,16 @@
1027 #include <linux/capi.h>
1028 #include <linux/kernelcapi.h>
1029 #include <linux/init.h>
1030 +#ifdef HAVE_DEVFS_FS
1031 #include <linux/devfs_fs_kernel.h>
1032 +#endif /* HAVE_DEVFS_FS */
1033 #include "capiutil.h"
1034 #include "capicmd.h"
1035 #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
1036 #include "capifs.h"
1037 #endif
1038
1039 -static char *revision = "$Revision: 1.1.4.2 $";
1040 +static char *revision = "$Revision: 1.59 $";
1041
1042 MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
1043 MODULE_AUTHOR("Carsten Paeth");
1044 @@ -87,10 +93,10 @@ struct capiminor {
1045 struct capincci *nccip;
1046 unsigned int minor;
1047
1048 - u16 applid;
1049 - u32 ncci;
1050 - u16 datahandle;
1051 - u16 msgid;
1052 + __u16 applid;
1053 + __u32 ncci;
1054 + __u16 datahandle;
1055 + __u16 msgid;
1056
1057 struct file *file;
1058 struct tty_struct *tty;
1059 @@ -112,16 +118,22 @@ struct capiminor {
1060 /* transmit path */
1061 struct datahandle_queue {
1062 struct datahandle_queue *next;
1063 - u16 datahandle;
1064 + __u16 datahandle;
1065 } *ackqueue;
1066 int nack;
1067
1068 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1069 + /* interface to generic ppp layer */
1070 + struct ppp_channel chan;
1071 + int chan_connected;
1072 + int chan_index;
1073 +#endif
1074 };
1075 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1076
1077 struct capincci {
1078 struct capincci *next;
1079 - u32 ncci;
1080 + __u32 ncci;
1081 struct capidev *cdev;
1082 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1083 struct capiminor *minorp;
1084 @@ -131,8 +143,8 @@ struct capincci {
1085 struct capidev {
1086 struct capidev *next;
1087 struct file *file;
1088 - u16 applid;
1089 - u16 errcode;
1090 + __u16 applid;
1091 + __u16 errcode;
1092 unsigned int minor;
1093 unsigned userflags;
1094
1095 @@ -156,22 +168,28 @@ static struct capidev *capidev_openlist
1096 static struct capiminor *minors = 0;
1097 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1098
1099 +#ifdef COMPAT_HAS_kmem_cache
1100 static kmem_cache_t *capidev_cachep = 0;
1101 static kmem_cache_t *capincci_cachep = 0;
1102 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1103 static kmem_cache_t *capiminor_cachep = 0;
1104 static kmem_cache_t *capidh_cachep = 0;
1105 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1106 +#endif
1107
1108 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1109 /* -------- datahandles --------------------------------------------- */
1110
1111 -static int capincci_add_ack(struct capiminor *mp, u16 datahandle)
1112 +int capincci_add_ack(struct capiminor *mp, __u16 datahandle)
1113 {
1114 struct datahandle_queue *n, **pp;
1115
1116 n = (struct datahandle_queue *)
1117 +#ifdef COMPAT_HAS_kmem_cache
1118 kmem_cache_alloc(capidh_cachep, GFP_ATOMIC);
1119 +#else
1120 + kmalloc(sizeof(struct datahandle_queue), GFP_ATOMIC);
1121 +#endif
1122 if (!n) {
1123 printk(KERN_ERR "capi: alloc datahandle failed\n");
1124 return -1;
1125 @@ -184,7 +202,7 @@ static int capincci_add_ack(struct capim
1126 return 0;
1127 }
1128
1129 -static int capiminor_del_ack(struct capiminor *mp, u16 datahandle)
1130 +int capiminor_del_ack(struct capiminor *mp, __u16 datahandle)
1131 {
1132 struct datahandle_queue **pp, *p;
1133
1134 @@ -192,7 +210,11 @@ static int capiminor_del_ack(struct capi
1135 if ((*pp)->datahandle == datahandle) {
1136 p = *pp;
1137 *pp = (*pp)->next;
1138 +#ifdef COMPAT_HAS_kmem_cache
1139 kmem_cache_free(capidh_cachep, p);
1140 +#else
1141 + kfree(p);
1142 +#endif
1143 mp->nack--;
1144 return 0;
1145 }
1146 @@ -200,7 +222,7 @@ static int capiminor_del_ack(struct capi
1147 return -1;
1148 }
1149
1150 -static void capiminor_del_all_ack(struct capiminor *mp)
1151 +void capiminor_del_all_ack(struct capiminor *mp)
1152 {
1153 struct datahandle_queue **pp, *p;
1154
1155 @@ -208,7 +230,11 @@ static void capiminor_del_all_ack(struct
1156 while (*pp) {
1157 p = *pp;
1158 *pp = (*pp)->next;
1159 +#ifdef COMPAT_HAS_kmem_cache
1160 kmem_cache_free(capidh_cachep, p);
1161 +#else
1162 + kfree(p);
1163 +#endif
1164 mp->nack--;
1165 }
1166 }
1167 @@ -216,13 +242,17 @@ static void capiminor_del_all_ack(struct
1168
1169 /* -------- struct capiminor ---------------------------------------- */
1170
1171 -static struct capiminor *capiminor_alloc(u16 applid, u32 ncci)
1172 +struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci)
1173 {
1174 struct capiminor *mp, **pp;
1175 unsigned int minor = 0;
1176
1177 MOD_INC_USE_COUNT;
1178 +#ifdef COMPAT_HAS_kmem_cache
1179 mp = (struct capiminor *)kmem_cache_alloc(capiminor_cachep, GFP_ATOMIC);
1180 +#else
1181 + mp = (struct capiminor *)kmalloc(sizeof(struct capiminor), GFP_ATOMIC);
1182 +#endif
1183 if (!mp) {
1184 MOD_DEC_USE_COUNT;
1185 printk(KERN_ERR "capi: can't alloc capiminor\n");
1186 @@ -257,7 +287,7 @@ static struct capiminor *capiminor_alloc
1187 return mp;
1188 }
1189
1190 -static void capiminor_free(struct capiminor *mp)
1191 +void capiminor_free(struct capiminor *mp)
1192 {
1193 struct capiminor **pp;
1194
1195 @@ -271,7 +301,11 @@ static void capiminor_free(struct capimi
1196 skb_queue_purge(&mp->inqueue);
1197 skb_queue_purge(&mp->outqueue);
1198 capiminor_del_all_ack(mp);
1199 +#ifdef COMPAT_HAS_kmem_cache
1200 kmem_cache_free(capiminor_cachep, mp);
1201 +#else
1202 + kfree(mp);
1203 +#endif
1204 MOD_DEC_USE_COUNT;
1205 #ifdef _DEBUG_REFCOUNT
1206 printk(KERN_DEBUG "capiminor_free %d\n", GET_USE_COUNT(THIS_MODULE));
1207 @@ -283,7 +317,7 @@ static void capiminor_free(struct capimi
1208 }
1209 }
1210
1211 -static struct capiminor *capiminor_find(unsigned int minor)
1212 +struct capiminor *capiminor_find(unsigned int minor)
1213 {
1214 struct capiminor *p;
1215 for (p = minors; p && p->minor != minor; p = p->next)
1216 @@ -294,7 +328,7 @@ static struct capiminor *capiminor_find(
1217
1218 /* -------- struct capincci ----------------------------------------- */
1219
1220 -static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
1221 +static struct capincci *capincci_alloc(struct capidev *cdev, __u32 ncci)
1222 {
1223 struct capincci *np, **pp;
1224 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1225 @@ -302,7 +336,11 @@ static struct capincci *capincci_alloc(s
1226 kdev_t kdev;
1227 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1228
1229 +#ifdef COMPAT_HAS_kmem_cache
1230 np = (struct capincci *)kmem_cache_alloc(capincci_cachep, GFP_ATOMIC);
1231 +#else
1232 + np = (struct capincci *)kmalloc(sizeof(struct capincci), GFP_ATOMIC);
1233 +#endif
1234 if (!np)
1235 return 0;
1236 memset(np, 0, sizeof(struct capincci));
1237 @@ -331,7 +369,7 @@ static struct capincci *capincci_alloc(s
1238 return np;
1239 }
1240
1241 -static void capincci_free(struct capidev *cdev, u32 ncci)
1242 +static void capincci_free(struct capidev *cdev, __u32 ncci)
1243 {
1244 struct capincci *np, **pp;
1245 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1246 @@ -367,7 +405,11 @@ static void capincci_free(struct capidev
1247 }
1248 }
1249 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1250 +#ifdef COMPAT_HAS_kmem_cache
1251 kmem_cache_free(capincci_cachep, np);
1252 +#else
1253 + kfree(np);
1254 +#endif
1255 if (*pp == 0) return;
1256 } else {
1257 pp = &(*pp)->next;
1258 @@ -375,7 +417,7 @@ static void capincci_free(struct capidev
1259 }
1260 }
1261
1262 -static struct capincci *capincci_find(struct capidev *cdev, u32 ncci)
1263 +struct capincci *capincci_find(struct capidev *cdev, __u32 ncci)
1264 {
1265 struct capincci *p;
1266
1267 @@ -393,7 +435,11 @@ static struct capidev *capidev_alloc(str
1268 struct capidev *cdev;
1269 struct capidev **pp;
1270
1271 +#ifdef COMPAT_HAS_kmem_cache
1272 cdev = (struct capidev *)kmem_cache_alloc(capidev_cachep, GFP_KERNEL);
1273 +#else
1274 + cdev = (struct capidev *)kmalloc(sizeof(struct capidev), GFP_KERNEL);
1275 +#endif
1276 if (!cdev)
1277 return 0;
1278 memset(cdev, 0, sizeof(struct capidev));
1279 @@ -423,10 +469,14 @@ static void capidev_free(struct capidev
1280 if (*pp)
1281 *pp = cdev->next;
1282
1283 +#ifdef COMPAT_HAS_kmem_cache
1284 kmem_cache_free(capidev_cachep, cdev);
1285 +#else
1286 + kfree(cdev);
1287 +#endif
1288 }
1289
1290 -static struct capidev *capidev_find(u16 applid)
1291 +static struct capidev *capidev_find(__u16 applid)
1292 {
1293 struct capidev *p;
1294 for (p=capidev_openlist; p; p = p->next) {
1295 @@ -439,13 +489,13 @@ static struct capidev *capidev_find(u16
1296 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1297 /* -------- handle data queue --------------------------------------- */
1298
1299 -static struct sk_buff *
1300 +struct sk_buff *
1301 gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
1302 {
1303 struct sk_buff *nskb;
1304 nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_ATOMIC);
1305 if (nskb) {
1306 - u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
1307 + __u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
1308 unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
1309 capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
1310 capimsg_setu16(s, 2, mp->applid);
1311 @@ -458,11 +508,11 @@ gen_data_b3_resp_for(struct capiminor *m
1312 return nskb;
1313 }
1314
1315 -static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
1316 +int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
1317 {
1318 struct sk_buff *nskb;
1319 unsigned int datalen;
1320 - u16 errcode, datahandle;
1321 + __u16 errcode, datahandle;
1322
1323 datalen = skb->len - CAPIMSG_LEN(skb->data);
1324 if (mp->tty) {
1325 @@ -504,6 +554,28 @@ static int handle_recv_skb(struct capimi
1326 kfree_skb(skb);
1327 return 0;
1328
1329 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1330 + } else if (mp->chan_connected) {
1331 + if ((nskb = gen_data_b3_resp_for(mp, skb)) == 0) {
1332 + printk(KERN_ERR "capi: gen_data_b3_resp failed\n");
1333 + return -1;
1334 + }
1335 + datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4);
1336 + errcode = (*capifuncs->capi_put_message)(mp->applid, nskb);
1337 + if (errcode != CAPI_NOERROR) {
1338 + printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
1339 + errcode);
1340 + kfree_skb(nskb);
1341 + return -1;
1342 + }
1343 + (void)skb_pull(skb, CAPIMSG_LEN(skb->data));
1344 +#ifdef _DEBUG_DATAFLOW
1345 + printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ppp\n",
1346 + datahandle, skb->len);
1347 +#endif
1348 + ppp_input(&mp->chan, skb);
1349 + return 0;
1350 +#endif
1351 } else if (mp->file) {
1352 if (skb_queue_len(&mp->recvqueue) > CAPINC_MAX_RECVQUEUE) {
1353 #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
1354 @@ -538,7 +610,7 @@ static int handle_recv_skb(struct capimi
1355 return -1;
1356 }
1357
1358 -static void handle_minor_recv(struct capiminor *mp)
1359 +void handle_minor_recv(struct capiminor *mp)
1360 {
1361 struct sk_buff *skb;
1362 while ((skb = skb_dequeue(&mp->inqueue)) != 0) {
1363 @@ -552,13 +624,13 @@ static void handle_minor_recv(struct cap
1364 }
1365 }
1366
1367 -static int handle_minor_send(struct capiminor *mp)
1368 +int handle_minor_send(struct capiminor *mp)
1369 {
1370 struct sk_buff *skb;
1371 - u16 len;
1372 + __u16 len;
1373 int count = 0;
1374 - u16 errcode;
1375 - u16 datahandle;
1376 + __u16 errcode;
1377 + __u16 datahandle;
1378
1379 if (mp->tty && mp->ttyoutstop) {
1380 #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
1381 @@ -569,7 +641,7 @@ static int handle_minor_send(struct capi
1382
1383 while ((skb = skb_dequeue(&mp->outqueue)) != 0) {
1384 datahandle = mp->datahandle;
1385 - len = (u16)skb->len;
1386 + len = (__u16)skb->len;
1387 skb_push(skb, CAPI_DATA_B3_REQ_LEN);
1388 memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
1389 capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
1390 @@ -578,7 +650,7 @@ static int handle_minor_send(struct capi
1391 capimsg_setu8 (skb->data, 5, CAPI_REQ);
1392 capimsg_setu16(skb->data, 6, mp->msgid++);
1393 capimsg_setu32(skb->data, 8, mp->ncci); /* NCCI */
1394 - capimsg_setu32(skb->data, 12, (u32) skb->data); /* Data32 */
1395 + capimsg_setu32(skb->data, 12, (__u32) skb->data); /* Data32 */
1396 capimsg_setu16(skb->data, 16, len); /* Data length */
1397 capimsg_setu16(skb->data, 18, datahandle);
1398 capimsg_setu16(skb->data, 20, 0); /* Flags */
1399 @@ -620,16 +692,16 @@ static int handle_minor_send(struct capi
1400 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1401 /* -------- function called by lower level -------------------------- */
1402
1403 -static void capi_signal(u16 applid, void *param)
1404 +static void capi_signal(__u16 applid, void *param)
1405 {
1406 struct capidev *cdev = (struct capidev *)param;
1407 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1408 struct capiminor *mp;
1409 - u16 datahandle;
1410 + __u16 datahandle;
1411 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1412 struct capincci *np;
1413 struct sk_buff *skb = 0;
1414 - u32 ncci;
1415 + __u32 ncci;
1416
1417 (void) (*capifuncs->capi_get_message) (applid, &skb);
1418 if (!skb) {
1419 @@ -683,6 +755,12 @@ static void capi_signal(u16 applid, void
1420 #endif
1421 kfree_skb(skb);
1422 (void)capiminor_del_ack(mp, datahandle);
1423 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1424 + if (mp->chan_connected) {
1425 + ppp_output_wakeup(&mp->chan);
1426 + return;
1427 + }
1428 +#endif
1429 if (mp->tty) {
1430 if (mp->tty->ldisc.write_wakeup)
1431 mp->tty->ldisc.write_wakeup(mp->tty);
1432 @@ -758,7 +836,7 @@ capi_write(struct file *file, const char
1433 struct capidev *cdev = (struct capidev *)file->private_data;
1434 struct sk_buff *skb;
1435 int retval;
1436 - u16 mlen;
1437 + __u16 mlen;
1438
1439 if (ppos != &file->f_pos)
1440 return -ESPIPE;
1441 @@ -998,7 +1076,7 @@ capi_ioctl(struct inode *inode, struct f
1442 sizeof(ncci));
1443 if (retval)
1444 return -EFAULT;
1445 - nccip = capincci_find(cdev, (u32) ncci);
1446 + nccip = capincci_find(cdev, (__u32) ncci);
1447 if (!nccip)
1448 return 0;
1449 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1450 @@ -1023,7 +1101,7 @@ capi_ioctl(struct inode *inode, struct f
1451 sizeof(ncci));
1452 if (retval)
1453 return -EFAULT;
1454 - nccip = capincci_find(cdev, (u32) ncci);
1455 + nccip = capincci_find(cdev, (__u32) ncci);
1456 if (!nccip || (mp = nccip->minorp) == 0)
1457 return -ESRCH;
1458 return mp->minor;
1459 @@ -1070,7 +1148,9 @@ capi_release(struct inode *inode, struct
1460
1461 static struct file_operations capi_fops =
1462 {
1463 +#ifdef COMPAT_HAS_FILEOP_OWNER
1464 owner: THIS_MODULE,
1465 +#endif
1466 llseek: no_llseek,
1467 read: capi_read,
1468 write: capi_write,
1469 @@ -1233,6 +1313,45 @@ capinc_raw_ioctl(struct inode *inode, st
1470 return -EINVAL;
1471
1472 switch (cmd) {
1473 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1474 + case PPPIOCATTACH:
1475 + {
1476 + int retval, val;
1477 + if (get_user(val, (int *) arg))
1478 + break;
1479 + if (mp->chan_connected)
1480 + return -EALREADY;
1481 + mp->chan.private = mp;
1482 +#if 1
1483 + return -EINVAL;
1484 +#else
1485 + mp->chan.ops = &ppp_ops;
1486 +#endif
1487 +
1488 + retval = ppp_register_channel(&mp->chan, val);
1489 + if (retval)
1490 + return retval;
1491 + mp->chan_connected = 1;
1492 + mp->chan_index = val;
1493 + }
1494 + return 0;
1495 + case PPPIOCDETACH:
1496 + {
1497 + if (!mp->chan_connected)
1498 + return -ENXIO;
1499 + ppp_unregister_channel(&mp->chan);
1500 + mp->chan_connected = 0;
1501 + }
1502 + return 0;
1503 + case PPPIOCGUNIT:
1504 + {
1505 + if (!mp->chan_connected)
1506 + return -ENXIO;
1507 + if (put_user(mp->chan_index, (int *) arg))
1508 + return -EFAULT;
1509 + }
1510 + return 0;
1511 +#endif
1512 }
1513 return -EINVAL;
1514 }
1515 @@ -1260,7 +1379,9 @@ capinc_raw_release(struct inode *inode,
1516
1517 static struct file_operations capinc_raw_fops =
1518 {
1519 +#ifdef COMPAT_HAS_FILEOP_OWNER
1520 owner: THIS_MODULE,
1521 +#endif
1522 llseek: no_llseek,
1523 read: capinc_raw_read,
1524 write: capinc_raw_write,
1525 @@ -1272,7 +1393,7 @@ static struct file_operations capinc_raw
1526
1527 /* -------- tty_operations for capincci ----------------------------- */
1528
1529 -static int capinc_tty_open(struct tty_struct * tty, struct file * file)
1530 +int capinc_tty_open(struct tty_struct * tty, struct file * file)
1531 {
1532 struct capiminor *mp;
1533
1534 @@ -1300,7 +1421,7 @@ static int capinc_tty_open(struct tty_st
1535 return 0;
1536 }
1537
1538 -static void capinc_tty_close(struct tty_struct * tty, struct file * file)
1539 +void capinc_tty_close(struct tty_struct * tty, struct file * file)
1540 {
1541 struct capiminor *mp;
1542
1543 @@ -1325,8 +1446,8 @@ static void capinc_tty_close(struct tty_
1544 #endif
1545 }
1546
1547 -static int capinc_tty_write(struct tty_struct * tty, int from_user,
1548 - const unsigned char *buf, int count)
1549 +int capinc_tty_write(struct tty_struct * tty, int from_user,
1550 + const unsigned char *buf, int count)
1551 {
1552 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1553 struct sk_buff *skb;
1554 @@ -1377,7 +1498,7 @@ static int capinc_tty_write(struct tty_s
1555 return count;
1556 }
1557
1558 -static void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1559 +void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1560 {
1561 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1562 struct sk_buff *skb;
1563 @@ -1414,7 +1535,7 @@ static void capinc_tty_put_char(struct t
1564 }
1565 }
1566
1567 -static void capinc_tty_flush_chars(struct tty_struct *tty)
1568 +void capinc_tty_flush_chars(struct tty_struct *tty)
1569 {
1570 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1571 struct sk_buff *skb;
1572 @@ -1440,7 +1561,7 @@ static void capinc_tty_flush_chars(struc
1573 (void)handle_minor_recv(mp);
1574 }
1575
1576 -static int capinc_tty_write_room(struct tty_struct *tty)
1577 +int capinc_tty_write_room(struct tty_struct *tty)
1578 {
1579 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1580 int room;
1581 @@ -1458,7 +1579,7 @@ static int capinc_tty_write_room(struct
1582 return room;
1583 }
1584
1585 -static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1586 +int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1587 {
1588 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1589 if (!mp || !mp->nccip) {
1590 @@ -1476,7 +1597,7 @@ static int capinc_tty_chars_in_buffer(st
1591 return mp->outbytes;
1592 }
1593
1594 -static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
1595 +int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
1596 unsigned int cmd, unsigned long arg)
1597 {
1598 int error = 0;
1599 @@ -1488,14 +1609,14 @@ static int capinc_tty_ioctl(struct tty_s
1600 return error;
1601 }
1602
1603 -static void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
1604 +void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
1605 {
1606 #ifdef _DEBUG_TTYFUNCS
1607 printk(KERN_DEBUG "capinc_tty_set_termios\n");
1608 #endif
1609 }
1610
1611 -static void capinc_tty_throttle(struct tty_struct * tty)
1612 +void capinc_tty_throttle(struct tty_struct * tty)
1613 {
1614 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1615 #ifdef _DEBUG_TTYFUNCS
1616 @@ -1505,7 +1626,7 @@ static void capinc_tty_throttle(struct t
1617 mp->ttyinstop = 1;
1618 }
1619
1620 -static void capinc_tty_unthrottle(struct tty_struct * tty)
1621 +void capinc_tty_unthrottle(struct tty_struct * tty)
1622 {
1623 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1624 #ifdef _DEBUG_TTYFUNCS
1625 @@ -1517,7 +1638,7 @@ static void capinc_tty_unthrottle(struct
1626 }
1627 }
1628
1629 -static void capinc_tty_stop(struct tty_struct *tty)
1630 +void capinc_tty_stop(struct tty_struct *tty)
1631 {
1632 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1633 #ifdef _DEBUG_TTYFUNCS
1634 @@ -1528,7 +1649,7 @@ static void capinc_tty_stop(struct tty_s
1635 }
1636 }
1637
1638 -static void capinc_tty_start(struct tty_struct *tty)
1639 +void capinc_tty_start(struct tty_struct *tty)
1640 {
1641 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1642 #ifdef _DEBUG_TTYFUNCS
1643 @@ -1540,43 +1661,49 @@ static void capinc_tty_start(struct tty_
1644 }
1645 }
1646
1647 -static void capinc_tty_hangup(struct tty_struct *tty)
1648 +void capinc_tty_hangup(struct tty_struct *tty)
1649 {
1650 #ifdef _DEBUG_TTYFUNCS
1651 printk(KERN_DEBUG "capinc_tty_hangup\n");
1652 #endif
1653 }
1654
1655 -static void capinc_tty_break_ctl(struct tty_struct *tty, int state)
1656 +void capinc_tty_break_ctl(struct tty_struct *tty, int state)
1657 {
1658 #ifdef _DEBUG_TTYFUNCS
1659 printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state);
1660 #endif
1661 }
1662
1663 -static void capinc_tty_flush_buffer(struct tty_struct *tty)
1664 +void capinc_tty_flush_buffer(struct tty_struct *tty)
1665 {
1666 #ifdef _DEBUG_TTYFUNCS
1667 printk(KERN_DEBUG "capinc_tty_flush_buffer\n");
1668 #endif
1669 }
1670
1671 -static void capinc_tty_set_ldisc(struct tty_struct *tty)
1672 +void capinc_tty_set_ldisc(struct tty_struct *tty)
1673 {
1674 #ifdef _DEBUG_TTYFUNCS
1675 printk(KERN_DEBUG "capinc_tty_set_ldisc\n");
1676 #endif
1677 }
1678
1679 -static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1680 +void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1681 {
1682 #ifdef _DEBUG_TTYFUNCS
1683 printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch);
1684 #endif
1685 }
1686
1687 -static int capinc_tty_read_proc(char *page, char **start, off_t off,
1688 - int count, int *eof, void *data)
1689 +int capinc_tty_read_proc(char *page, char **start, off_t off,
1690 + int count, int *eof, void *data)
1691 +{
1692 + return 0;
1693 +}
1694 +
1695 +int capinc_write_proc(struct file *file, const char *buffer,
1696 + unsigned long count, void *data)
1697 {
1698 return 0;
1699 }
1700 @@ -1588,7 +1715,7 @@ static struct tty_struct *capinc_tty_tab
1701 static struct termios *capinc_tty_termios[CAPINC_NR_PORTS];
1702 static struct termios *capinc_tty_termios_locked[CAPINC_NR_PORTS];
1703
1704 -static int capinc_tty_init(void)
1705 +int capinc_tty_init(void)
1706 {
1707 struct tty_driver *drv = &capinc_tty_driver;
1708
1709 @@ -1646,7 +1773,7 @@ static int capinc_tty_init(void)
1710 return 0;
1711 }
1712
1713 -static void capinc_tty_exit(void)
1714 +void capinc_tty_exit(void)
1715 {
1716 struct tty_driver *drv = &capinc_tty_driver;
1717 int retval;
1718 @@ -1771,8 +1898,9 @@ static void __exit proc_exit(void)
1719
1720 /* -------- init function and module interface ---------------------- */
1721
1722 +#ifdef COMPAT_HAS_kmem_cache
1723
1724 -static void alloc_exit(void)
1725 +static void __exit alloc_exit(void)
1726 {
1727 if (capidev_cachep) {
1728 (void)kmem_cache_destroy(capidev_cachep);
1729 @@ -1837,8 +1965,9 @@ static int __init alloc_init(void)
1730 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1731 return 0;
1732 }
1733 +#endif
1734
1735 -static void lower_callback(unsigned int cmd, u32 contr, void *data)
1736 +static void lower_callback(unsigned int cmd, __u32 contr, void *data)
1737 {
1738 struct capi_ncciinfo *np;
1739 struct capidev *cdev;
1740 @@ -1900,15 +2029,19 @@ static int __init capi_init(void)
1741 MOD_DEC_USE_COUNT;
1742 return -EIO;
1743 }
1744 +#ifdef HAVE_DEVFS_FS
1745 devfs_register_series (NULL, "capi/r%u", CAPINC_NR_PORTS,
1746 DEVFS_FL_DEFAULT,
1747 capi_rawmajor, 0,
1748 S_IFCHR | S_IRUSR | S_IWUSR,
1749 &capinc_raw_fops, NULL);
1750 +#endif
1751 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1752 +#ifdef HAVE_DEVFS_FS
1753 devfs_register (NULL, "isdn/capi20", DEVFS_FL_DEFAULT,
1754 capi_major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
1755 &capi_fops, NULL);
1756 +#endif
1757 printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major);
1758
1759 if ((capifuncs = attach_capi_interface(&cuser)) == 0) {
1760 @@ -1918,9 +2051,11 @@ static int __init capi_init(void)
1761 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1762 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1763 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1764 +#ifdef HAVE_DEVFS_FS
1765 devfs_unregister(devfs_find_handle(NULL, "capi20",
1766 capi_major, 0,
1767 DEVFS_SPECIAL_CHR, 0));
1768 +#endif
1769 return -EIO;
1770 }
1771
1772 @@ -1934,8 +2069,10 @@ static int __init capi_init(void)
1773 }
1774 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1775
1776 +#ifdef COMPAT_HAS_kmem_cache
1777 if (alloc_init() < 0) {
1778 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1779 +#ifdef HAVE_DEVFS_FS
1780 unsigned int j;
1781 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1782 for (j = 0; j < CAPINC_NR_PORTS; j++) {
1783 @@ -1943,16 +2080,20 @@ static int __init capi_init(void)
1784 sprintf(devname, "capi/r%u", j);
1785 devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0));
1786 }
1787 +#endif
1788 capinc_tty_exit();
1789 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1790 (void) detach_capi_interface(&cuser);
1791 devfs_unregister_chrdev(capi_major, "capi20");
1792 +#ifdef HAVE_DEVFS_FS
1793 devfs_unregister(devfs_find_handle(NULL, "capi20",
1794 capi_major, 0,
1795 DEVFS_SPECIAL_CHR, 0));
1796 +#endif
1797 MOD_DEC_USE_COUNT;
1798 return -ENOMEM;
1799 }
1800 +#endif /* COMPAT_HAS_kmem_cache */
1801
1802 (void)proc_init();
1803
1804 @@ -1975,23 +2116,31 @@ static int __init capi_init(void)
1805 static void __exit capi_exit(void)
1806 {
1807 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1808 +#ifdef HAVE_DEVFS_FS
1809 unsigned int j;
1810 #endif
1811 +#endif
1812 +#ifdef COMPAT_HAS_kmem_cache
1813 alloc_exit();
1814 +#endif
1815 (void)proc_exit();
1816
1817 devfs_unregister_chrdev(capi_major, "capi20");
1818 +#ifdef HAVE_DEVFS_FS
1819 devfs_unregister(devfs_find_handle(NULL, "isdn/capi20", capi_major, 0, DEVFS_SPECIAL_CHR, 0));
1820 +#endif
1821
1822 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1823 capinc_tty_exit();
1824 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1825 +#ifdef HAVE_DEVFS_FS
1826 for (j = 0; j < CAPINC_NR_PORTS; j++) {
1827 char devname[32];
1828 sprintf(devname, "capi/r%u", j);
1829 devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0));
1830 }
1831 #endif
1832 +#endif
1833 (void) detach_capi_interface(&cuser);
1834 printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev);
1835 }
1836 --- a/drivers/isdn/avmb1/capicmd.h
1837 +++ b/drivers/isdn/avmb1/capicmd.h
1838 @@ -1,4 +1,4 @@
1839 -/* $Id: capicmd.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1840 +/* $Id: capicmd.h,v 1.4 2001/09/24 13:22:44 kai Exp $
1841 *
1842 * CAPI 2.0 Interface for Linux
1843 *
1844 --- a/drivers/isdn/avmb1/capidev.h
1845 +++ b/drivers/isdn/avmb1/capidev.h
1846 @@ -1,4 +1,4 @@
1847 -/* $Id: capidev.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1848 +/* $Id: capidev.h,v 1.8 2001/09/24 13:22:44 kai Exp $
1849 *
1850 * CAPI 2.0 Interface for Linux
1851 *
1852 --- a/drivers/isdn/avmb1/capidrv.c
1853 +++ b/drivers/isdn/avmb1/capidrv.c
1854 @@ -1,4 +1,4 @@
1855 -/* $Id: capidrv.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1856 +/* $Id: capidrv.c,v 1.45 2001/09/24 13:22:44 kai Exp $
1857 *
1858 * ISDN4Linux Driver, using capi20 interface (kernelcapi)
1859 *
1860 @@ -35,7 +35,7 @@
1861 #include "capicmd.h"
1862 #include "capidrv.h"
1863
1864 -static char *revision = "$Revision: 1.1.4.1 $";
1865 +static char *revision = "$Revision: 1.45 $";
1866 static int debugmode = 0;
1867
1868 MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux");
1869 @@ -105,7 +105,6 @@ struct capidrv_contr {
1870 int oldstate;
1871 /* */
1872 __u16 datahandle;
1873 - spinlock_t lock;
1874 struct ncci_datahandle_queue {
1875 struct ncci_datahandle_queue *next;
1876 __u16 datahandle;
1877 @@ -423,7 +422,6 @@ static inline capidrv_ncci *new_ncci(cap
1878 nccip->plcip = plcip;
1879 nccip->chan = plcip->chan;
1880 nccip->datahandle = 0;
1881 - nccip->lock = SPIN_LOCK_UNLOCKED;
1882
1883 nccip->next = plcip->ncci_list;
1884 plcip->ncci_list = nccip;
1885 @@ -480,7 +478,6 @@ static int capidrv_add_ack(struct capidr
1886 __u16 datahandle, int len)
1887 {
1888 struct ncci_datahandle_queue *n, **pp;
1889 - unsigned long flags;
1890
1891 n = (struct ncci_datahandle_queue *)
1892 kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC);
1893 @@ -491,31 +488,25 @@ static int capidrv_add_ack(struct capidr
1894 n->next = 0;
1895 n->datahandle = datahandle;
1896 n->len = len;
1897 - spin_lock_irqsave(&nccip->lock, flags);
1898 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) ;
1899 *pp = n;
1900 - spin_unlock_irqrestore(&nccip->lock, flags);
1901 return 0;
1902 }
1903
1904 static int capidrv_del_ack(struct capidrv_ncci *nccip, __u16 datahandle)
1905 {
1906 struct ncci_datahandle_queue **pp, *p;
1907 - unsigned long flags;
1908 int len;
1909
1910 - spin_lock_irqsave(&nccip->lock, flags);
1911 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) {
1912 if ((*pp)->datahandle == datahandle) {
1913 p = *pp;
1914 len = p->len;
1915 *pp = (*pp)->next;
1916 - spin_unlock_irqrestore(&nccip->lock, flags);
1917 kfree(p);
1918 return len;
1919 }
1920 }
1921 - spin_unlock_irqrestore(&nccip->lock, flags);
1922 return -1;
1923 }
1924
1925 @@ -523,25 +514,13 @@ static int capidrv_del_ack(struct capidr
1926
1927 static void send_message(capidrv_contr * card, _cmsg * cmsg)
1928 {
1929 - struct sk_buff *skb;
1930 - size_t len;
1931 - u16 err;
1932 -
1933 + struct sk_buff *skb;
1934 + size_t len;
1935 capi_cmsg2message(cmsg, cmsg->buf);
1936 len = CAPIMSG_LEN(cmsg->buf);
1937 skb = alloc_skb(len, GFP_ATOMIC);
1938 - if(!skb) {
1939 - printk(KERN_ERR "no skb len(%d) memory\n", len);
1940 - return;
1941 - }
1942 memcpy(skb_put(skb, len), cmsg->buf, len);
1943 - err = (*capifuncs->capi_put_message) (global.appid, skb);
1944 - if (err) {
1945 - printk(KERN_WARNING "%s: capi_put_message error: %04x\n",
1946 - __FUNCTION__, err);
1947 - kfree_skb(skb);
1948 - return;
1949 - }
1950 + (*capifuncs->capi_put_message) (global.appid, skb);
1951 global.nsentctlpkt++;
1952 }
1953
1954 @@ -1932,8 +1911,10 @@ static int if_sendbuf(int id, int channe
1955 (void)capidrv_del_ack(nccip, datahandle);
1956 return 0;
1957 }
1958 +#if 1
1959 printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n",
1960 card->contrnr, skb_headroom(skb), msglen);
1961 +#endif
1962 memcpy(skb_push(nskb, msglen), sendcmsg.buf, msglen);
1963 errcode = (*capifuncs->capi_put_message) (global.appid, nskb);
1964 if (errcode == CAPI_NOERROR) {
1965 @@ -2035,6 +2016,52 @@ static void enable_dchannel_trace(capidr
1966 send_message(card, &cmdcmsg);
1967 }
1968
1969 +#if 0
1970 +static void disable_dchannel_trace(capidrv_contr *card)
1971 +{
1972 + __u8 manufacturer[CAPI_MANUFACTURER_LEN];
1973 + capi_version version;
1974 + __u16 contr = card->contrnr;
1975 + __u16 errcode;
1976 + __u16 avmversion[3];
1977 +
1978 + errcode = (*capifuncs->capi_get_manufacturer)(contr, manufacturer);
1979 + if (errcode != CAPI_NOERROR) {
1980 + printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n",
1981 + card->name, errcode);
1982 + return;
1983 + }
1984 + if (strstr(manufacturer, "AVM") == 0) {
1985 + printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n",
1986 + card->name, manufacturer);
1987 + return;
1988 + }
1989 + errcode = (*capifuncs->capi_get_version)(contr, &version);
1990 + if (errcode != CAPI_NOERROR) {
1991 + printk(KERN_ERR "%s: can't get version (0x%x)\n",
1992 + card->name, errcode);
1993 + return;
1994 + }
1995 + avmversion[0] = (version.majormanuversion >> 4) & 0x0f;
1996 + avmversion[1] = (version.majormanuversion << 4) & 0xf0;
1997 + avmversion[1] |= (version.minormanuversion >> 4) & 0x0f;
1998 + avmversion[2] |= version.minormanuversion & 0x0f;
1999 +
2000 + if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) {
2001 + printk(KERN_INFO "%s: D2 trace disabled\n", card->name);
2002 + } else {
2003 + printk(KERN_INFO "%s: D3 trace disabled\n", card->name);
2004 + }
2005 + capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid,
2006 + card->msgid++,
2007 + contr,
2008 + 0x214D5641, /* ManuID */
2009 + 0, /* Class */
2010 + 1, /* Function */
2011 + (_cstruct)"\004\000\000\000\000");
2012 + send_message(card, &cmdcmsg);
2013 +}
2014 +#endif
2015
2016 static void send_listen(capidrv_contr *card)
2017 {
2018 @@ -2200,10 +2227,10 @@ static int capidrv_delcontr(__u16 contr)
2019 free_ncci(card, card->bchans[card->nbchan-1].nccip);
2020 if (card->bchans[card->nbchan-1].plcip)
2021 free_plci(card, card->bchans[card->nbchan-1].plcip);
2022 + if (card->plci_list)
2023 + printk(KERN_ERR "capidrv: bug in free_plci()\n");
2024 card->nbchan--;
2025 }
2026 - if (card->plci_list)
2027 - printk(KERN_ERR "capidrv: bug in free_plci()\n");
2028 kfree(card->bchans);
2029 card->bchans = 0;
2030
2031 --- a/drivers/isdn/avmb1/capidrv.h
2032 +++ b/drivers/isdn/avmb1/capidrv.h
2033 @@ -1,4 +1,4 @@
2034 -/* $Id: capidrv.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2035 +/* $Id: capidrv.h,v 1.4 2001/09/24 13:22:44 kai Exp $
2036 *
2037 * ISDN4Linux Driver, using capi20 interface (kernelcapi)
2038 *
2039 --- a/drivers/isdn/avmb1/capifs.c
2040 +++ b/drivers/isdn/avmb1/capifs.c
2041 @@ -1,4 +1,4 @@
2042 -/* $Id: capifs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2043 +/* $Id: capifs.c,v 1.22 2001/09/24 13:22:44 kai Exp $
2044 *
2045 * Copyright 2000 by Carsten Paeth <calle@calle.de>
2046 *
2047 @@ -25,6 +25,7 @@
2048 #include <linux/major.h>
2049 #include <linux/slab.h>
2050 #include <linux/ctype.h>
2051 +#include <linux/isdn_compat.h>
2052 #include <asm/bitops.h>
2053 #include <asm/uaccess.h>
2054
2055 @@ -32,7 +33,7 @@ MODULE_DESCRIPTION("CAPI4Linux: /dev/cap
2056 MODULE_AUTHOR("Carsten Paeth");
2057 MODULE_LICENSE("GPL");
2058
2059 -static char *revision = "$Revision: 1.1.4.1 $";
2060 +static char *revision = "$Revision: 1.22 $";
2061
2062 struct capifs_ncci {
2063 struct inode *inode;
2064 @@ -69,14 +70,21 @@ static inline struct capifs_sb_info *SBI
2065 static int capifs_root_readdir(struct file *,void *,filldir_t);
2066 static struct dentry *capifs_root_lookup(struct inode *,struct dentry *);
2067 static int capifs_revalidate(struct dentry *, int);
2068 +#ifdef COMPAT_VFS_2_4
2069 static struct inode *capifs_new_inode(struct super_block *sb);
2070 +#endif
2071
2072 static struct file_operations capifs_root_operations = {
2073 +#ifdef COMPAT_VFS_2_4
2074 read: generic_read_dir,
2075 +#endif
2076 readdir: capifs_root_readdir,
2077 };
2078
2079 struct inode_operations capifs_root_inode_operations = {
2080 +#ifndef COMPAT_VFS_2_4
2081 + default_file_ops: &capifs_root_operations, /* file operations */
2082 +#endif
2083 lookup: capifs_root_lookup,
2084 };
2085
2086 @@ -101,12 +109,20 @@ static int capifs_root_readdir(struct fi
2087 switch(nr)
2088 {
2089 case 0:
2090 +#ifdef COMPAT_VFS_2_4
2091 if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
2092 +#else
2093 + if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0)
2094 +#endif
2095 return 0;
2096 filp->f_pos = ++nr;
2097 /* fall through */
2098 case 1:
2099 +#ifdef COMPAT_VFS_2_4
2100 if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
2101 +#else
2102 + if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0)
2103 +#endif
2104 return 0;
2105 filp->f_pos = ++nr;
2106 /* fall through */
2107 @@ -118,7 +134,11 @@ static int capifs_root_readdir(struct fi
2108 char *p = numbuf;
2109 if (np->type) *p++ = np->type;
2110 sprintf(p, "%u", np->num);
2111 +#ifdef COMPAT_VFS_2_4
2112 if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_UNKNOWN) < 0 )
2113 +#else
2114 + if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 )
2115 +#endif
2116 return 0;
2117 }
2118 filp->f_pos = ++nr;
2119 @@ -180,7 +200,7 @@ static struct dentry *capifs_root_lookup
2120
2121 dentry->d_inode = np->inode;
2122 if ( dentry->d_inode )
2123 - atomic_inc(&dentry->d_inode->i_count);
2124 + i_count_inc(dentry->d_inode->i_count);
2125
2126 d_add(dentry, dentry->d_inode);
2127
2128 @@ -199,9 +219,9 @@ static void capifs_put_super(struct supe
2129
2130 for ( i = 0 ; i < sbi->max_ncci ; i++ ) {
2131 if ( (inode = sbi->nccis[i].inode) ) {
2132 - if (atomic_read(&inode->i_count) != 1 )
2133 + if (i_count_read(inode->i_count) != 1 )
2134 printk("capifs_put_super: badness: entry %d count %d\n",
2135 - i, (unsigned)atomic_read(&inode->i_count));
2136 + i, (unsigned)i_count_read(inode->i_count));
2137 inode->i_nlink--;
2138 iput(inode);
2139 }
2140 @@ -213,11 +233,24 @@ static void capifs_put_super(struct supe
2141
2142 kfree(sbi->nccis);
2143 kfree(sbi);
2144 +#ifndef COMPAT_VFS_2_4
2145 + MOD_DEC_USE_COUNT;
2146 +#endif
2147 }
2148
2149 +#ifdef COMPAT_VFS_2_4
2150 static int capifs_statfs(struct super_block *sb, struct statfs *buf);
2151 +#else
2152 +static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz);
2153 +static void capifs_write_inode(struct inode *inode) { };
2154 +static void capifs_read_inode(struct inode *inode);
2155 +#endif
2156
2157 static struct super_operations capifs_sops = {
2158 +#ifndef COMPAT_VFS_2_4
2159 + read_inode: capifs_read_inode,
2160 + write_inode: capifs_write_inode,
2161 +#endif
2162 put_super: capifs_put_super,
2163 statfs: capifs_statfs,
2164 };
2165 @@ -288,6 +321,10 @@ struct super_block *capifs_read_super(st
2166 struct dentry * root;
2167 struct capifs_sb_info *sbi;
2168
2169 +#ifndef COMPAT_VFS_2_4
2170 + MOD_INC_USE_COUNT;
2171 + lock_super(s);
2172 +#endif
2173 /* Super block already completed? */
2174 if (s->s_root)
2175 goto out;
2176 @@ -322,6 +359,7 @@ struct super_block *capifs_read_super(st
2177 /*
2178 * Get the root inode and dentry, but defer checking for errors.
2179 */
2180 +#ifdef COMPAT_VFS_2_4
2181 root_inode = capifs_new_inode(s);
2182 if (root_inode) {
2183 root_inode->i_ino = 1;
2184 @@ -331,6 +369,10 @@ struct super_block *capifs_read_super(st
2185 root_inode->i_nlink = 2;
2186 }
2187 root = d_alloc_root(root_inode);
2188 +#else
2189 + root_inode = iget(s, 1); /* inode 1 == root directory */
2190 + root = d_alloc_root(root_inode, NULL);
2191 +#endif
2192
2193 /*
2194 * Check whether somebody else completed the super block.
2195 @@ -370,11 +412,34 @@ struct super_block *capifs_read_super(st
2196 mounts = s;
2197
2198 out: /* Success ... somebody else completed the super block for us. */
2199 +#ifndef COMPAT_VFS_2_4
2200 + unlock_super(s);
2201 +#endif
2202 return s;
2203 fail:
2204 +#ifndef COMPAT_VFS_2_4
2205 + unlock_super(s);
2206 + MOD_DEC_USE_COUNT;
2207 +#endif
2208 return NULL;
2209 }
2210
2211 +#ifndef COMPAT_VFS_2_4
2212 +static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
2213 +{
2214 + struct statfs tmp;
2215 +
2216 + tmp.f_type = CAPIFS_SUPER_MAGIC;
2217 + tmp.f_bsize = 1024;
2218 + tmp.f_blocks = 0;
2219 + tmp.f_bfree = 0;
2220 + tmp.f_bavail = 0;
2221 + tmp.f_files = 0;
2222 + tmp.f_ffree = 0;
2223 + tmp.f_namelen = NAME_MAX;
2224 + return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
2225 +}
2226 +#else
2227 static int capifs_statfs(struct super_block *sb, struct statfs *buf)
2228 {
2229 buf->f_type = CAPIFS_SUPER_MAGIC;
2230 @@ -387,7 +452,9 @@ static int capifs_statfs(struct super_bl
2231 buf->f_namelen = NAME_MAX;
2232 return 0;
2233 }
2234 +#endif
2235
2236 +#ifdef COMPAT_VFS_2_4
2237 static struct inode *capifs_new_inode(struct super_block *sb)
2238 {
2239 struct inode *inode = new_inode(sb);
2240 @@ -399,8 +466,51 @@ static struct inode *capifs_new_inode(st
2241 }
2242 return inode;
2243 }
2244 +#else
2245 +static void capifs_read_inode(struct inode *inode)
2246 +{
2247 + ino_t ino = inode->i_ino;
2248 + struct capifs_sb_info *sbi = SBI(inode->i_sb);
2249 +
2250 + inode->i_mode = 0;
2251 + inode->i_nlink = 0;
2252 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
2253 + inode->i_blocks = 0;
2254 + inode->i_blksize = 1024;
2255 + inode->i_uid = inode->i_gid = 0;
2256 +
2257 + if ( ino == 1 ) {
2258 + inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
2259 + inode->i_op = &capifs_root_inode_operations;
2260 + inode->i_nlink = 2;
2261 + return;
2262 + }
2263
2264 + ino -= 2;
2265 + if ( ino >= sbi->max_ncci )
2266 + return; /* Bogus */
2267 +
2268 +#ifdef COMPAT_VFS_2_4
2269 + init_special_inode(inode, S_IFCHR, 0);
2270 +#else
2271 + inode->i_mode = S_IFCHR;
2272 + inode->i_op = &chrdev_inode_operations;
2273 +#endif
2274 +
2275 + return;
2276 +}
2277 +#endif
2278 +
2279 +#ifndef COMPAT_VFS_2_4
2280 +static struct file_system_type capifs_fs_type = {
2281 + "capifs",
2282 + 0,
2283 + capifs_read_super,
2284 + NULL
2285 +};
2286 +#else
2287 static DECLARE_FSTYPE(capifs_fs_type, "capifs", capifs_read_super, 0);
2288 +#endif
2289
2290 void capifs_new_ncci(char type, unsigned int num, kdev_t device)
2291 {
2292 @@ -421,16 +531,26 @@ void capifs_new_ncci(char type, unsigned
2293 break;
2294 }
2295 }
2296 +#ifdef COMPAT_VFS_2_4
2297 if ( ino >= sbi->max_ncci )
2298 continue;
2299
2300 if ((np->inode = capifs_new_inode(sb)) != NULL) {
2301 +#else
2302 + if ((np->inode = iget(sb, ino+2)) != NULL) {
2303 +#endif
2304 struct inode *inode = np->inode;
2305 inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
2306 inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
2307 +#ifdef COMPAT_VFS_2_4
2308 inode->i_nlink = 1;
2309 inode->i_ino = ino + 2;
2310 init_special_inode(inode, sbi->mode|S_IFCHR, np->kdev);
2311 +#else
2312 + inode->i_mode = sbi->mode | S_IFCHR;
2313 + inode->i_rdev = np->kdev;
2314 + inode->i_nlink++;
2315 +#endif
2316 }
2317 }
2318 }
2319 --- a/drivers/isdn/avmb1/capifs.h
2320 +++ b/drivers/isdn/avmb1/capifs.h
2321 @@ -1,4 +1,4 @@
2322 -/* $Id: capifs.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2323 +/* $Id: capifs.h,v 1.4 2001/09/24 13:22:44 kai Exp $
2324 *
2325 * Copyright 2000 by Carsten Paeth <calle@calle.de>
2326 *
2327 --- a/drivers/isdn/avmb1/capilli.h
2328 +++ b/drivers/isdn/avmb1/capilli.h
2329 @@ -1,4 +1,4 @@
2330 -/* $Id: capilli.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2331 +/* $Id: capilli.h,v 1.5 2001/09/24 13:22:44 kai Exp $
2332 *
2333 * Kernel CAPI 2.0 Driver Interface for Linux
2334 *
2335 --- a/drivers/isdn/avmb1/capiutil.c
2336 +++ b/drivers/isdn/avmb1/capiutil.c
2337 @@ -1,4 +1,4 @@
2338 -/* $Id: capiutil.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2339 +/* $Id: capiutil.c,v 1.16 2001/09/24 13:22:44 kai Exp $
2340 *
2341 * CAPI 2.0 convert capi message to capi message struct
2342 *
2343 @@ -19,6 +19,7 @@
2344 #include <linux/init.h>
2345 #include <asm/segment.h>
2346 #include <linux/config.h>
2347 +#include <linux/isdn_compat.h>
2348 #include "capiutil.h"
2349
2350 MODULE_DESCRIPTION("CAPI4Linux: CAPI message conversion support");
2351 --- a/drivers/isdn/avmb1/capiutil.h
2352 +++ b/drivers/isdn/avmb1/capiutil.h
2353 @@ -1,4 +1,4 @@
2354 -/* $Id: capiutil.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2355 +/* $Id: capiutil.h,v 1.7 2001/09/24 13:22:44 kai Exp $
2356 *
2357 * CAPI 2.0 defines & types
2358 *
2359 --- a/drivers/isdn/avmb1/kcapi.c
2360 +++ b/drivers/isdn/avmb1/kcapi.c
2361 @@ -1,4 +1,4 @@
2362 -/* $Id: kcapi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2363 +/* $Id: kcapi.c,v 1.28 2001/09/24 13:22:44 kai Exp $
2364 *
2365 * Kernel CAPI 2.0 Module
2366 *
2367 @@ -21,6 +21,7 @@
2368 #include <linux/proc_fs.h>
2369 #include <linux/skbuff.h>
2370 #include <linux/tqueue.h>
2371 +#include <linux/isdn_compat.h>
2372 #include <linux/capi.h>
2373 #include <linux/kernelcapi.h>
2374 #include <linux/locks.h>
2375 @@ -33,7 +34,7 @@
2376 #include <linux/b1lli.h>
2377 #endif
2378
2379 -static char *revision = "$Revision: 1.1.4.1 $";
2380 +static char *revision = "$Revision: 1.28 $";
2381
2382 /* ------------------------------------------------------------- */
2383
2384 @@ -64,7 +65,6 @@ struct capi_ncci {
2385 __u32 ncci;
2386 __u32 winsize;
2387 int nmsg;
2388 - spinlock_t lock;
2389 struct msgidqueue *msgidqueue;
2390 struct msgidqueue *msgidlast;
2391 struct msgidqueue *msgidfree;
2392 @@ -104,14 +104,14 @@ static char capi_manufakturer[64] = "AVM
2393 #define APPL(a) (&applications[(a)-1])
2394 #define VALID_APPLID(a) ((a) && (a) <= CAPI_MAXAPPL && APPL(a)->applid == a)
2395 #define APPL_IS_FREE(a) (APPL(a)->applid == 0)
2396 -#define APPL_MARK_FREE(a) do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0)
2397 -#define APPL_MARK_USED(a) do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0)
2398 +#define APPL_MARK_FREE(a) do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0);
2399 +#define APPL_MARK_USED(a) do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0);
2400
2401 #define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f)
2402
2403 #define VALID_CARD(c) ((c) > 0 && (c) <= CAPI_MAXCONTR)
2404 #define CARD(c) (&cards[(c)-1])
2405 -#define CARDNR(cp) ((((cp)-cards)+1) & 0xff)
2406 +#define CARDNR(cp) (((cp)-cards)+1)
2407
2408 static struct capi_appl applications[CAPI_MAXAPPL];
2409 static struct capi_ctr cards[CAPI_MAXCONTR];
2410 @@ -535,9 +535,13 @@ static int notify_push(unsigned int cmd,
2411 * of devices. Devices can only removed in
2412 * user process, not in bh.
2413 */
2414 +#ifdef COMPAT_HAS_SCHEDULE_TASK
2415 MOD_INC_USE_COUNT;
2416 if (schedule_task(&tq_state_notify) == 0)
2417 MOD_DEC_USE_COUNT;
2418 +#else
2419 + queue_task(&tq_state_notify, &tq_scheduler);
2420 +#endif
2421 return 0;
2422 }
2423
2424 @@ -546,13 +550,7 @@ static int notify_push(unsigned int cmd,
2425 static void notify_up(__u32 contr)
2426 {
2427 struct capi_interface_user *p;
2428 - __u16 appl;
2429
2430 - for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
2431 - if (!VALID_APPLID(appl)) continue;
2432 - if (APPL(appl)->releasing) continue;
2433 - CARD(contr)->driver->register_appl(CARD(contr), appl, &APPL(appl)->rparam);
2434 - }
2435 printk(KERN_NOTICE "kcapi: notify up contr %d\n", contr);
2436 spin_lock(&capi_users_lock);
2437 for (p = capi_users; p; p = p->next) {
2438 @@ -639,7 +637,9 @@ static void notify_handler(void *dummy)
2439 kfree(np);
2440 MOD_DEC_USE_COUNT;
2441 }
2442 +#ifdef COMPAT_HAS_SCHEDULE_TASK
2443 MOD_DEC_USE_COUNT;
2444 +#endif
2445 }
2446
2447 /* -------- NCCI Handling ------------------------------------- */
2448 @@ -647,7 +647,6 @@ static void notify_handler(void *dummy)
2449 static inline void mq_init(struct capi_ncci * np)
2450 {
2451 int i;
2452 - np->lock = SPIN_LOCK_UNLOCKED;
2453 np->msgidqueue = 0;
2454 np->msgidlast = 0;
2455 np->nmsg = 0;
2456 @@ -662,11 +661,8 @@ static inline void mq_init(struct capi_n
2457 static inline int mq_enqueue(struct capi_ncci * np, __u16 msgid)
2458 {
2459 struct msgidqueue *mq;
2460 - spin_lock_bh(&np->lock);
2461 - if ((mq = np->msgidfree) == 0) {
2462 - spin_unlock_bh(&np->lock);
2463 + if ((mq = np->msgidfree) == 0)
2464 return 0;
2465 - }
2466 np->msgidfree = mq->next;
2467 mq->msgid = msgid;
2468 mq->next = 0;
2469 @@ -676,14 +672,12 @@ static inline int mq_enqueue(struct capi
2470 if (!np->msgidqueue)
2471 np->msgidqueue = mq;
2472 np->nmsg++;
2473 - spin_unlock_bh(&np->lock);
2474 return 1;
2475 }
2476
2477 static inline int mq_dequeue(struct capi_ncci * np, __u16 msgid)
2478 {
2479 struct msgidqueue **pp;
2480 - spin_lock_bh(&np->lock);
2481 for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
2482 if ((*pp)->msgid == msgid) {
2483 struct msgidqueue *mq = *pp;
2484 @@ -693,11 +687,9 @@ static inline int mq_dequeue(struct capi
2485 mq->next = np->msgidfree;
2486 np->msgidfree = mq;
2487 np->nmsg--;
2488 - spin_unlock_bh(&np->lock);
2489 return 1;
2490 }
2491 }
2492 - spin_unlock_bh(&np->lock);
2493 return 0;
2494 }
2495
2496 @@ -720,16 +712,12 @@ static void controllercb_appl_released(s
2497 nextpp = &(*pp)->next;
2498 }
2499 }
2500 - if (APPL(appl)->releasing) { /* only release if the application was marked for release */
2501 - printk(KERN_DEBUG "kcapi: appl %d releasing(%d)\n", appl, APPL(appl)->releasing);
2502 - APPL(appl)->releasing--;
2503 - if (APPL(appl)->releasing <= 0) {
2504 - APPL(appl)->signal = 0;
2505 - APPL_MARK_FREE(appl);
2506 - printk(KERN_INFO "kcapi: appl %d down\n", appl);
2507 - }
2508 - } else
2509 - printk(KERN_WARNING "kcapi: appl %d card%d released without request\n", appl, card->cnr);
2510 + APPL(appl)->releasing--;
2511 + if (APPL(appl)->releasing <= 0) {
2512 + APPL(appl)->signal = 0;
2513 + APPL_MARK_FREE(appl);
2514 + printk(KERN_INFO "kcapi: appl %d down\n", appl);
2515 + }
2516 }
2517 /*
2518 * ncci management
2519 @@ -882,7 +870,16 @@ error:
2520
2521 static void controllercb_ready(struct capi_ctr * card)
2522 {
2523 + __u16 appl;
2524 +
2525 card->cardstate = CARD_RUNNING;
2526 +
2527 + for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
2528 + if (!VALID_APPLID(appl)) continue;
2529 + if (APPL(appl)->releasing) continue;
2530 + card->driver->register_appl(card, appl, &APPL(appl)->rparam);
2531 + }
2532 +
2533 printk(KERN_NOTICE "kcapi: card %d \"%s\" ready.\n",
2534 CARDNR(card), card->name);
2535
2536 --- a/drivers/isdn/avmb1/t1isa.c
2537 +++ b/drivers/isdn/avmb1/t1isa.c
2538 @@ -1,4 +1,4 @@
2539 -/* $Id: t1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2540 +/* $Id: t1isa.c,v 1.22 2001/09/24 13:22:44 kai Exp $
2541 *
2542 * Module for AVM T1 HEMA-card.
2543 *
2544 @@ -19,13 +19,14 @@
2545 #include <linux/capi.h>
2546 #include <linux/kernelcapi.h>
2547 #include <linux/init.h>
2548 +#include <linux/isdn_compat.h>
2549 #include <asm/io.h>
2550 #include "capicmd.h"
2551 #include "capiutil.h"
2552 #include "capilli.h"
2553 #include "avmcard.h"
2554
2555 -static char *revision = "$Revision: 1.1.4.1 $";
2556 +static char *revision = "$Revision: 1.22 $";
2557
2558 /* ------------------------------------------------------------- */
2559
2560 --- a/drivers/isdn/avmb1/t1pci.c
2561 +++ b/drivers/isdn/avmb1/t1pci.c
2562 @@ -1,4 +1,4 @@
2563 -/* $Id: t1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2564 +/* $Id: t1pci.c,v 1.25 2001/09/24 13:22:44 kai Exp $
2565 *
2566 * Module for AVM T1 PCI-card.
2567 *
2568 @@ -18,6 +18,7 @@
2569 #include <linux/interrupt.h>
2570 #include <linux/ioport.h>
2571 #include <linux/pci.h>
2572 +#include <linux/isdn_compat.h>
2573 #include <linux/capi.h>
2574 #include <linux/init.h>
2575 #include <asm/io.h>
2576 @@ -26,19 +27,21 @@
2577 #include "capilli.h"
2578 #include "avmcard.h"
2579
2580 -static char *revision = "$Revision: 1.1.4.1 $";
2581 +static char *revision = "$Revision: 1.25 $";
2582
2583 #undef CONFIG_T1PCI_DEBUG
2584 #undef CONFIG_T1PCI_POLLDEBUG
2585
2586 /* ------------------------------------------------------------- */
2587
2588 +#ifndef COMPAT_HAS_2_2_PCI
2589 static struct pci_device_id t1pci_pci_tbl[] __initdata = {
2590 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_T1, PCI_ANY_ID, PCI_ANY_ID },
2591 { } /* Terminating entry */
2592 };
2593
2594 MODULE_DEVICE_TABLE(pci, t1pci_pci_tbl);
2595 +#endif
2596 MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 PCI card");
2597 MODULE_AUTHOR("Carsten Paeth");
2598 MODULE_LICENSE("GPL");
2599 @@ -264,9 +267,9 @@ static int __init t1pci_init(void)
2600 }
2601 pci_set_master(dev);
2602
2603 - param.port = pci_resource_start(dev, 1);
2604 + param.port = pci_resource_start_io(dev, 1);
2605 param.irq = dev->irq;
2606 - param.membase = pci_resource_start(dev, 0);
2607 + param.membase = pci_resource_start_mem(dev, 0);
2608
2609 printk(KERN_INFO
2610 "%s: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x\n",
2611 --- a/drivers/isdn/divert/divert_procfs.c
2612 +++ b/drivers/isdn/divert/divert_procfs.c
2613 @@ -1,4 +1,4 @@
2614 -/* $Id: divert_procfs.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2615 +/* $Id$
2616 *
2617 * Filesystem handling for the diversion supplementary services.
2618 *
2619 @@ -14,13 +14,16 @@
2620 #include <linux/module.h>
2621 #include <linux/version.h>
2622 #include <linux/poll.h>
2623 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2624 #include <linux/smp_lock.h>
2625 +#endif
2626 #ifdef CONFIG_PROC_FS
2627 #include <linux/proc_fs.h>
2628 #else
2629 #include <linux/fs.h>
2630 #endif
2631 #include <linux/isdnif.h>
2632 +#include <linux/isdn_compat.h>
2633 #include "isdn_divert.h"
2634
2635 /*********************************/
2636 @@ -80,7 +83,6 @@ static ssize_t
2637 isdn_divert_read(struct file *file, char *buf, size_t count, loff_t * off)
2638 {
2639 struct divert_info *inf;
2640 - loff_t pos = *off;
2641 int len;
2642
2643 if (!*((struct divert_info **) file->private_data)) {
2644 @@ -92,11 +94,11 @@ isdn_divert_read(struct file *file, char
2645 return (0);
2646
2647 inf->usage_cnt--; /* new usage count */
2648 - file->private_data = &inf->next; /* next structure */
2649 + (struct divert_info **) file->private_data = &inf->next; /* next structure */
2650 if ((len = strlen(inf->info_start)) <= count) {
2651 if (copy_to_user(buf, inf->info_start, len))
2652 return -EFAULT;
2653 - *off = pos + len;
2654 + file->f_pos += len;
2655 return (len);
2656 }
2657 return (0);
2658 @@ -136,17 +138,23 @@ isdn_divert_open(struct inode *ino, stru
2659 {
2660 unsigned long flags;
2661
2662 +#ifdef COMPAT_USE_MODCOUNT_LOCK
2663 + MOD_INC_USE_COUNT;
2664 +#else
2665 lock_kernel();
2666 +#endif
2667 save_flags(flags);
2668 cli();
2669 if_used++;
2670 if (divert_info_head)
2671 - filep->private_data = &(divert_info_tail->next);
2672 + (struct divert_info **) filep->private_data = &(divert_info_tail->next);
2673 else
2674 - filep->private_data = &divert_info_head;
2675 + (struct divert_info **) filep->private_data = &divert_info_head;
2676 restore_flags(flags);
2677 /* start_divert(); */
2678 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2679 unlock_kernel();
2680 +#endif
2681 return (0);
2682 } /* isdn_divert_open */
2683
2684 @@ -159,7 +167,9 @@ isdn_divert_close(struct inode *ino, str
2685 struct divert_info *inf;
2686 unsigned long flags;
2687
2688 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2689 lock_kernel();
2690 +#endif
2691 save_flags(flags);
2692 cli();
2693 if_used--;
2694 @@ -175,7 +185,11 @@ isdn_divert_close(struct inode *ino, str
2695 divert_info_head = divert_info_head->next;
2696 kfree(inf);
2697 }
2698 +#ifdef COMPAT_USE_MODCOUNT_LOCK
2699 + MOD_DEC_USE_COUNT;
2700 +#else
2701 unlock_kernel();
2702 +#endif
2703 return (0);
2704 } /* isdn_divert_close */
2705
2706 @@ -276,6 +290,9 @@ static struct file_operations isdn_fops
2707 open: isdn_divert_open,
2708 release: isdn_divert_close,
2709 };
2710 +#ifdef COMPAT_NO_SOFTNET
2711 +struct inode_operations divert_file_inode_operations;
2712 +#endif
2713
2714 /****************************/
2715 /* isdn subdir in /proc/net */
2716 @@ -302,8 +319,16 @@ divert_dev_init(void)
2717 remove_proc_entry("isdn", proc_net);
2718 return (-1);
2719 }
2720 +#ifdef COMPAT_NO_SOFTNET
2721 + memset(&divert_file_inode_operations, 0, sizeof(struct inode_operations));
2722 + divert_file_inode_operations.default_file_ops = &isdn_fops;
2723 + isdn_divert_entry->ops = &divert_file_inode_operations;
2724 +#else
2725 isdn_divert_entry->proc_fops = &isdn_fops;
2726 +#ifdef COMPAT_HAS_FILEOP_OWNER
2727 isdn_divert_entry->owner = THIS_MODULE;
2728 +#endif
2729 +#endif /* COMPAT_NO_SOFTNET */
2730 #endif /* CONFIG_PROC_FS */
2731
2732 return (0);
2733 --- a/drivers/isdn/divert/isdn_divert.c
2734 +++ b/drivers/isdn/divert/isdn_divert.c
2735 @@ -1,4 +1,4 @@
2736 -/* $Id: isdn_divert.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2737 +/* $Id$
2738 *
2739 * DSS1 main diversion supplementary handling for i4l.
2740 *
2741 @@ -84,6 +84,9 @@ static void deflect_timer_expire(ulong a
2742 restore_flags(flags);
2743 break;
2744
2745 + case NETWORK_DIAL:
2746 + divert_if.dial_net_name(cs->deflect_dest);
2747 +
2748 case DEFLECT_AUTODEL:
2749 default:
2750 save_flags(flags);
2751 @@ -452,6 +455,7 @@ int isdn_divert_icall(isdn_ctrl *ic)
2752 case DEFLECT_PROCEED:
2753 case DEFLECT_REPORT:
2754 case DEFLECT_REJECT:
2755 + case NETWORK_DIAL:
2756 if (dv->rule.action == DEFLECT_PROCEED)
2757 if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime)))
2758 return(0); /* no external deflection needed */
2759 @@ -495,6 +499,11 @@ int isdn_divert_icall(isdn_ctrl *ic)
2760 else
2761 { cs->deflect_dest[0] = '\0';
2762 retval = 4; /* only proceed */
2763 + if (cs->akt_state == NETWORK_DIAL) {
2764 + strcpy(cs->deflect_dest,dv->rule.to_nr);
2765 + cs->timer.expires = jiffies + 10;
2766 + retval = 0;
2767 + }
2768 }
2769 sprintf(cs->info,"%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n",
2770 cs->akt_state,
2771 @@ -739,6 +748,18 @@ int prot_stat_callback(isdn_ctrl *ic)
2772 }
2773
2774
2775 +#if 0
2776 + sprintf(st, "0x%lx 0x%lx",ic->arg, ic->parm.dss1_io.ll_id);
2777 + p = st + strlen(st);
2778 + p1 = ic->parm.dss1_io.data;
2779 + i = ic->parm.dss1_io.datalen;
2780 + while ((i > 0) && (p - st < 530))
2781 + { p += sprintf(p," %02x",(*p1++) & 0xFF);
2782 + i--;
2783 + }
2784 + sprintf(p, "\n");
2785 + put_info_buffer(st);
2786 +#endif
2787 break;
2788
2789 default:
2790 --- a/drivers/isdn/divert/isdn_divert.h
2791 +++ b/drivers/isdn/divert/isdn_divert.h
2792 @@ -1,4 +1,4 @@
2793 -/* $Id: isdn_divert.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2794 +/* $Id$
2795 *
2796 * Header for the diversion supplementary ioctl interface.
2797 *
2798 @@ -36,9 +36,10 @@
2799 #define DEFLECT_PROCEED 2 /* deflect when externally triggered */
2800 #define DEFLECT_ALERT 3 /* alert and deflect after delay */
2801 #define DEFLECT_REJECT 4 /* reject immediately */
2802 -#define DIVERT_ACTIVATE 5 /* diversion activate */
2803 -#define DIVERT_DEACTIVATE 6 /* diversion deactivate */
2804 -#define DIVERT_REPORT 7 /* interrogation result */
2805 +#define NETWORK_DIAL 5 /* dial a network interface */
2806 +#define DIVERT_ACTIVATE 16 /* diversion activate */
2807 +#define DIVERT_DEACTIVATE 17 /* diversion deactivate */
2808 +#define DIVERT_REPORT 18 /* interrogation result */
2809 #define DEFLECT_AUTODEL 255 /* only for internal use */
2810
2811 #define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */
2812 @@ -60,6 +61,7 @@ typedef struct
2813 2 = report call, send proceed, wait max waittime secs
2814 3 = report call, alert and deflect after waittime
2815 4 = report call, reject immediately
2816 + 5 = dial net interface specified in to_nr
2817 actions 1-2 only take place if interface is opened
2818 */
2819 u_char waittime; /* maximum wait time for proceeding */
2820 --- a/drivers/isdn/eicon/Divas_mod.c
2821 +++ b/drivers/isdn/eicon/Divas_mod.c
2822 @@ -20,6 +20,7 @@
2823 #include "adapter.h"
2824 #include "uxio.h"
2825
2826 +#include <linux/isdn_compat.h>
2827
2828 MODULE_DESCRIPTION("ISDN4Linux: Driver for Eicon Diva Server cards");
2829 MODULE_AUTHOR("Armin Schindler");
2830 --- a/drivers/isdn/eicon/common.c
2831 +++ b/drivers/isdn/eicon/common.c
2832 @@ -808,9 +808,7 @@ void DivasDoDpc(void *pData)
2833
2834 while(i--)
2835 {
2836 - if (card->state == DIA_RUNNING)
2837 - DivaDoCardDpc(card);
2838 - card++;
2839 + DivaDoCardDpc(card++);
2840 }
2841 }
2842
2843 --- a/drivers/isdn/eicon/eicon.h
2844 +++ b/drivers/isdn/eicon/eicon.h
2845 @@ -1,4 +1,4 @@
2846 -/* $Id: eicon.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2847 +/* $Id: eicon.h,v 1.26 2001/09/24 13:22:47 kai Exp $
2848 *
2849 * ISDN low-level module for Eicon active ISDN-Cards.
2850 *
2851 @@ -347,19 +347,19 @@ typedef struct eicon_card {
2852 extern char *eicon_ctype_name[];
2853
2854
2855 -static inline void eicon_schedule_tx(eicon_card *card)
2856 +extern __inline__ void eicon_schedule_tx(eicon_card *card)
2857 {
2858 queue_task(&card->snd_tq, &tq_immediate);
2859 mark_bh(IMMEDIATE_BH);
2860 }
2861
2862 -static inline void eicon_schedule_rx(eicon_card *card)
2863 +extern __inline__ void eicon_schedule_rx(eicon_card *card)
2864 {
2865 queue_task(&card->rcv_tq, &tq_immediate);
2866 mark_bh(IMMEDIATE_BH);
2867 }
2868
2869 -static inline void eicon_schedule_ack(eicon_card *card)
2870 +extern __inline__ void eicon_schedule_ack(eicon_card *card)
2871 {
2872 queue_task(&card->ack_tq, &tq_immediate);
2873 mark_bh(IMMEDIATE_BH);
2874 --- a/drivers/isdn/eicon/eicon_dsp.h
2875 +++ b/drivers/isdn/eicon/eicon_dsp.h
2876 @@ -1,4 +1,4 @@
2877 -/* $Id: eicon_dsp.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2878 +/* $Id: eicon_dsp.h,v 1.8 2001/09/24 13:22:47 kai Exp $
2879 *
2880 * ISDN lowlevel-module for Eicon active cards.
2881 * DSP definitions
2882 --- a/drivers/isdn/eicon/eicon_idi.c
2883 +++ b/drivers/isdn/eicon/eicon_idi.c
2884 @@ -1,4 +1,4 @@
2885 -/* $Id: eicon_idi.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2886 +/* $Id: eicon_idi.c,v 1.45 2001/11/07 22:35:48 kai Exp $
2887 *
2888 * ISDN lowlevel-module for Eicon active cards.
2889 * IDI interface
2890 @@ -25,7 +25,7 @@
2891
2892 #undef EICON_FULL_SERVICE_OKTETT
2893
2894 -char *eicon_idi_revision = "$Revision: 1.1.4.1 $";
2895 +char *eicon_idi_revision = "$Revision: 1.45 $";
2896
2897 eicon_manifbuf *manbuf;
2898
2899 @@ -1583,6 +1583,37 @@ idi_faxdata_rcv(eicon_card *ccard, eicon
2900 return;
2901 }
2902
2903 +#if 0
2904 + eicon_sff_dochead *doc = (eicon_sff_dochead *)skb->data;
2905 + eicon_sff_pagehead *page = (eicon_sff_pagehead *)skb->data + sizeof(eicon_sff_dochead);
2906 +
2907 + printk(KERN_DEBUG"SFF: doc %d / page %d (skb : %d)\n",
2908 + sizeof(eicon_sff_dochead),
2909 + sizeof(eicon_sff_pagehead), skb->len);
2910 +
2911 + if (skb->len >= sizeof(eicon_sff_dochead)) {
2912 + printk(KERN_DEBUG"SFF: id = 0x%x\n", doc->id);
2913 + printk(KERN_DEBUG"SFF: version = 0x%x\n", doc->version);
2914 + printk(KERN_DEBUG"SFF: reserved1 = 0x%x\n", doc->reserved1);
2915 + printk(KERN_DEBUG"SFF: userinfo = 0x%x\n", doc->userinfo);
2916 + printk(KERN_DEBUG"SFF: pagecount = 0x%x\n", doc->pagecount);
2917 + printk(KERN_DEBUG"SFF: off1pagehead = 0x%x\n", doc->off1pagehead);
2918 + printk(KERN_DEBUG"SFF: offnpagehead = 0x%x\n", doc->offnpagehead);
2919 + printk(KERN_DEBUG"SFF: offdocend = 0x%x\n", doc->offdocend);
2920 + }
2921 + if (skb->len >= (sizeof(eicon_sff_dochead) + sizeof(eicon_sff_pagehead))) {
2922 + printk(KERN_DEBUG"SFFp: id = 0x%x\n", page->pageheadid);
2923 + printk(KERN_DEBUG"SFFp: len = 0x%x\n", page->pageheadlen);
2924 + printk(KERN_DEBUG"SFFp: resvert = 0x%x\n", page->resvert);
2925 + printk(KERN_DEBUG"SFFp: reshoriz = 0x%x\n", page->reshoriz);
2926 + printk(KERN_DEBUG"SFFp: coding = 0x%x\n", page->coding);
2927 + printk(KERN_DEBUG"SFFp: reserved2 = 0x%x\n", page->reserved2);
2928 + printk(KERN_DEBUG"SFFp: linelength = 0x%x\n", page->linelength);
2929 + printk(KERN_DEBUG"SFFp: pagelength = 0x%x\n", page->pagelength);
2930 + printk(KERN_DEBUG"SFFp: offprevpage = 0x%x\n", page->offprevpage);
2931 + printk(KERN_DEBUG"SFFp: offnextpage = 0x%x\n", page->offnextpage);
2932 + }
2933 +#endif
2934
2935
2936 if (chan->fax->direction == ISDN_TTY_FAX_CONN_IN) {
2937 @@ -2054,8 +2085,7 @@ idi_faxdata_send(eicon_card *ccard, eico
2938 OutBuf.Len++;
2939 } else {
2940 *OutBuf.Next++ = 0;
2941 - *(__u16 *) OutBuf.Next = (__u16) LineBuf.Len;
2942 - OutBuf.Next += sizeof(__u16);
2943 + *((__u16 *) OutBuf.Next)++ = (__u16) LineBuf.Len;
2944 OutBuf.Len += 3;
2945 }
2946 memcpy(OutBuf.Next, LineBuf.Data, LineBuf.Len);
2947 @@ -2385,6 +2415,12 @@ idi_handle_ind(eicon_card *ccard, struct
2948 } else {
2949 if (chan->e.B2Id)
2950 idi_do_req(ccard, chan, REMOVE, 1);
2951 +#if 0
2952 + if (chan->e.D3Id) {
2953 + idi_do_req(ccard, chan, REMOVE, 0);
2954 + idi_do_req(ccard, chan, ASSIGN, 0);
2955 + }
2956 +#endif
2957 chan->statectrl &= ~WAITING_FOR_HANGUP;
2958 chan->statectrl &= ~IN_HOLD;
2959 if (chan->statectrl & HAVE_CONN_REQ) {
2960 --- a/drivers/isdn/eicon/eicon_idi.h
2961 +++ b/drivers/isdn/eicon/eicon_idi.h
2962 @@ -1,4 +1,4 @@
2963 -/* $Id: eicon_idi.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2964 +/* $Id: eicon_idi.h,v 1.12 2001/09/24 13:22:47 kai Exp $
2965 *
2966 * ISDN lowlevel-module for the Eicon active cards.
2967 * IDI-Interface
2968 --- a/drivers/isdn/eicon/eicon_io.c
2969 +++ b/drivers/isdn/eicon/eicon_io.c
2970 @@ -1,4 +1,4 @@
2971 -/* $Id: eicon_io.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2972 +/* $Id: eicon_io.c,v 1.15 2001/09/24 13:22:47 kai Exp $
2973 *
2974 * ISDN low-level module for Eicon active ISDN-Cards.
2975 * Code for communicating with hardware.
2976 --- a/drivers/isdn/eicon/eicon_isa.c
2977 +++ b/drivers/isdn/eicon/eicon_isa.c
2978 @@ -1,4 +1,4 @@
2979 -/* $Id: eicon_isa.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2980 +/* $Id: eicon_isa.c,v 1.18 2001/11/07 22:35:48 kai Exp $
2981 *
2982 * ISDN low-level module for Eicon active ISDN-Cards.
2983 * Hardware-specific code for old ISA cards.
2984 @@ -20,7 +20,7 @@
2985 #define release_shmem release_region
2986 #define request_shmem request_region
2987
2988 -char *eicon_isa_revision = "$Revision: 1.1.4.1 $";
2989 +char *eicon_isa_revision = "$Revision: 1.18 $";
2990
2991 #undef EICON_MCA_DEBUG
2992
2993 @@ -38,8 +38,12 @@ static int eicon_isa_valid_irq[] = {
2994 static void
2995 eicon_isa_release_shmem(eicon_isa_card *card) {
2996 if (card->mvalid) {
2997 +#ifdef COMPAT_HAS_ISA_IOREMAP
2998 iounmap(card->shmem);
2999 release_mem_region(card->physmem, card->ramsize);
3000 +#else
3001 + release_shmem((unsigned long)card->shmem, card->ramsize);
3002 +#endif
3003 }
3004 card->mvalid = 0;
3005 }
3006 @@ -94,12 +98,20 @@ eicon_isa_find_card(int Mem, int Irq, ch
3007 Mem, Id);
3008 return -1;
3009 }
3010 +#ifdef COMPAT_HAS_ISA_IOREMAP
3011 if (check_mem_region(Mem, RAMSIZE)) {
3012 +#else
3013 + if (check_shmem(Mem, RAMSIZE)) {
3014 +#endif
3015 printk(KERN_WARNING "eicon_isa_boot: memory at 0x%x already in use.\n", Mem);
3016 return -1;
3017 }
3018
3019 +#ifdef COMPAT_HAS_ISA_IOREMAP
3020 amem = (unsigned long) ioremap(Mem, RAMSIZE);
3021 +#else
3022 + amem = (unsigned long) Mem;
3023 +#endif
3024 writew(0x55aa, amem + 0x402);
3025 if (readw(amem + 0x402) != 0x55aa) primary = 0;
3026 writew(0, amem + 0x402);
3027 @@ -109,12 +121,16 @@ eicon_isa_find_card(int Mem, int Irq, ch
3028 if (primary) {
3029 printk(KERN_INFO "Eicon: assuming pri card at 0x%x\n", Mem);
3030 writeb(0, amem + 0x3ffe);
3031 +#ifdef COMPAT_HAS_ISA_IOREMAP
3032 iounmap((unsigned char *)amem);
3033 +#endif
3034 return EICON_CTYPE_ISAPRI;
3035 } else {
3036 printk(KERN_INFO "Eicon: assuming bri card at 0x%x\n", Mem);
3037 writeb(0, amem + 0x400);
3038 +#ifdef COMPAT_HAS_ISA_IOREMAP
3039 iounmap((unsigned char *)amem);
3040 +#endif
3041 return EICON_CTYPE_ISABRI;
3042 }
3043 return -1;
3044 @@ -151,6 +167,7 @@ eicon_isa_bootload(eicon_isa_card *card,
3045 else
3046 card->ramsize = RAMSIZE;
3047
3048 +#ifdef COMPAT_HAS_ISA_IOREMAP
3049 if (check_mem_region(card->physmem, card->ramsize)) {
3050 printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
3051 card->physmem);
3052 @@ -159,6 +176,16 @@ eicon_isa_bootload(eicon_isa_card *card,
3053 }
3054 request_mem_region(card->physmem, card->ramsize, "Eicon ISA ISDN");
3055 card->shmem = (eicon_isa_shmem *) ioremap(card->physmem, card->ramsize);
3056 +#else
3057 + /* Register shmem */
3058 + if (check_shmem((unsigned long)card->shmem, card->ramsize)) {
3059 + printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
3060 + (unsigned long)card->shmem);
3061 + kfree(code);
3062 + return -EBUSY;
3063 + }
3064 + request_shmem((unsigned long)card->shmem, card->ramsize, "Eicon ISA ISDN");
3065 +#endif
3066 #ifdef EICON_MCA_DEBUG
3067 printk(KERN_INFO "eicon_isa_boot: card->ramsize = %d.\n", card->ramsize);
3068 #endif
3069 --- a/drivers/isdn/eicon/eicon_isa.h
3070 +++ b/drivers/isdn/eicon/eicon_isa.h
3071 @@ -1,4 +1,4 @@
3072 -/* $Id: eicon_isa.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3073 +/* $Id: eicon_isa.h,v 1.11 2001/09/24 13:22:47 kai Exp $
3074 *
3075 * ISDN low-level module for Eicon active ISDN-Cards.
3076 *
3077 --- a/drivers/isdn/eicon/eicon_mod.c
3078 +++ b/drivers/isdn/eicon/eicon_mod.c
3079 @@ -1,4 +1,4 @@
3080 -/* $Id: eicon_mod.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3081 +/* $Id: eicon_mod.c,v 1.44 2001/11/20 09:48:25 armin Exp $
3082 *
3083 * ISDN lowlevel-module for Eicon active cards.
3084 *
3085 @@ -44,7 +44,7 @@
3086 static eicon_card *cards = (eicon_card *) NULL; /* glob. var , contains
3087 start of card-list */
3088
3089 -static char *eicon_revision = "$Revision: 1.1.4.1 $";
3090 +static char *eicon_revision = "$Revision: 1.44 $";
3091
3092 extern char *eicon_pci_revision;
3093 extern char *eicon_isa_revision;
3094 @@ -639,6 +639,18 @@ if_command(isdn_ctrl * c)
3095 static int
3096 if_writecmd(const u_char * buf, int len, int user, int id, int channel)
3097 {
3098 +#if 0
3099 + /* Not yet used */
3100 + eicon_card *card = eicon_findcard(id);
3101 +
3102 + if (card) {
3103 + if (!card->flags & EICON_FLAGS_RUNNING)
3104 + return (len);
3105 + return (len);
3106 + }
3107 + printk(KERN_ERR
3108 + "eicon: if_writecmd called with invalid driverId!\n");
3109 +#endif
3110 return (len);
3111 }
3112
3113 @@ -665,11 +677,8 @@ if_readstatus(u_char * buf, int len, int
3114 else
3115 cnt = skb->len;
3116
3117 - if (user) {
3118 - spin_unlock_irqrestore(&eicon_lock, flags);
3119 + if (user)
3120 copy_to_user(p, skb->data, cnt);
3121 - spin_lock_irqsave(&eicon_lock, flags);
3122 - }
3123 else
3124 memcpy(p, skb->data, cnt);
3125
3126 @@ -1459,6 +1468,7 @@ eicon_exit(void)
3127
3128 #ifndef MODULE
3129
3130 +#ifdef COMPAT_HAS_NEW_SETUP
3131 static int __init
3132 eicon_setup(char *line)
3133 {
3134 @@ -1467,6 +1477,12 @@ eicon_setup(char *line)
3135 char *str;
3136
3137 str = get_options(line, 4, ints);
3138 +#else
3139 +void
3140 +eicon_setup(char *str, int *ints)
3141 +{
3142 + int i, argc;
3143 +#endif
3144
3145 argc = ints[0];
3146 i = 1;
3147 @@ -1494,9 +1510,13 @@ eicon_setup(char *line)
3148 #else
3149 printk(KERN_INFO "Eicon ISDN active driver setup\n");
3150 #endif
3151 +#ifdef COMPAT_HAS_NEW_SETUP
3152 return(1);
3153 }
3154 __setup("eicon=", eicon_setup);
3155 +#else
3156 +}
3157 +#endif
3158
3159 #endif /* MODULE */
3160
3161 --- a/drivers/isdn/eicon/eicon_pci.c
3162 +++ b/drivers/isdn/eicon/eicon_pci.c
3163 @@ -1,4 +1,4 @@
3164 -/* $Id: eicon_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3165 +/* $Id: eicon_pci.c,v 1.18 2001/09/24 13:22:47 kai Exp $
3166 *
3167 * ISDN low-level module for Eicon active ISDN-Cards.
3168 * Hardware-specific code for PCI cards.
3169 @@ -24,7 +24,7 @@
3170 #include "adapter.h"
3171 #include "uxio.h"
3172
3173 -char *eicon_pci_revision = "$Revision: 1.1.4.1 $";
3174 +char *eicon_pci_revision = "$Revision: 1.18 $";
3175
3176 #if CONFIG_PCI /* intire stuff is only for PCI */
3177 #ifdef CONFIG_ISDN_DRV_EICON_PCI
3178 --- a/drivers/isdn/eicon/eicon_pci.h
3179 +++ b/drivers/isdn/eicon/eicon_pci.h
3180 @@ -1,4 +1,4 @@
3181 -/* $Id: eicon_pci.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3182 +/* $Id: eicon_pci.h,v 1.7 2001/09/24 13:22:47 kai Exp $
3183 *
3184 * ISDN low-level module for Eicon active ISDN-Cards (PCI part).
3185 *
3186 --- a/drivers/isdn/eicon/fourbri.c
3187 +++ b/drivers/isdn/eicon/fourbri.c
3188 @@ -337,8 +337,7 @@ static int diva_server_4bri_load(card_t
3189 static int diva_server_4bri_start(card_t *card, byte *channels)
3190 {
3191 byte *ctl;
3192 - byte *shared;
3193 - int i;
3194 + byte *shared, i;
3195 int adapter_num;
3196
3197 DPRINTF(("divas: start Diva Server 4BRI"));
3198 --- a/drivers/isdn/eicon/kprintf.c
3199 +++ b/drivers/isdn/eicon/kprintf.c
3200 @@ -18,6 +18,468 @@
3201 #include "divalog.h"
3202 #include "uxio.h"
3203
3204 +/*
3205 + * Implementation of printf and sprintf for kernel
3206 + */
3207 +
3208 +#define MAX_BUFF (80) /* limit size of temporary buffers */
3209 +
3210 +#define WRITE_CHAR(BUFFER, SIZE, C) \
3211 + if (--(SIZE) < 0) { (BUFFER)--; *(BUFFER) = '\0'; return; } *(BUFFER)++ = (C)
3212 +
3213 +
3214 +/*
3215 + * convert a number to decimal ASCII
3216 + */
3217 +
3218 +static
3219 +void do_decimal( char *temp,
3220 + int temp_len,
3221 + unsigned int value,
3222 + char *s)
3223 +
3224 +{
3225 + int i;
3226 +
3227 + temp[0] = '\0';
3228 +
3229 + for (i = 1; i < temp_len; i++)
3230 + {
3231 + temp[i] = (char) ((value % 10) + (int) '0');
3232 + value /= 10;
3233 + }
3234 +
3235 + for (i = (temp_len - 1); temp[i] == '0'; i--)
3236 + {
3237 + ;
3238 + }
3239 +
3240 + if (i == 0)
3241 + {
3242 + i++;
3243 + }
3244 +
3245 + while (i >= 0)
3246 + {
3247 + *s++ = temp[i--];
3248 + }
3249 +
3250 + return;
3251 +}
3252 +
3253 +/*
3254 + * convert a number to octal ASCII
3255 + */
3256 +
3257 +static
3258 +void do_octal( char *temp,
3259 + unsigned int value,
3260 + char *s)
3261 +
3262 +{
3263 + int i;
3264 +
3265 + temp[0] = '\0';
3266 +
3267 + for (i = 1; i <= 11; i++)
3268 + {
3269 + temp[i] = (char) ((value & 07) + (int) '0');
3270 + value >>= 3;
3271 + }
3272 + temp[11] &= '3';
3273 +
3274 + for (i = 11; temp[i] == '0'; i--)
3275 + {
3276 + ;
3277 + }
3278 +
3279 + if (i == 0)
3280 + {
3281 + i++;
3282 + }
3283 +
3284 + while (i >= 0)
3285 + {
3286 + *s++ = temp[i--];
3287 + }
3288 +
3289 + return;
3290 +}
3291 +
3292 +/*
3293 + * convert a number to hex ASCII
3294 + */
3295 +
3296 +static
3297 +void do_hex( char *temp,
3298 + unsigned int value,
3299 + char *s)
3300 +
3301 +{
3302 + int i;
3303 + static
3304 + char *dec_to_hex = "0123456789abcdef";
3305 +
3306 + temp[0] = '\0';
3307 +
3308 + for (i = 1; i <= 8; i++)
3309 + {
3310 + temp[i] = dec_to_hex[value & 0x0f];
3311 + value >>= 4;
3312 + }
3313 +
3314 + for (i = 8; temp[i] == '0'; i--)
3315 + {
3316 + ;
3317 + }
3318 +
3319 + if (i == 0)
3320 + {
3321 + i++;
3322 + }
3323 +
3324 + while (i >= 0)
3325 + {
3326 + *s++ = temp[i--];
3327 + }
3328 +
3329 + return;
3330 +}
3331 +
3332 +/*
3333 + * convert a buffer to ASCII HEX
3334 + */
3335 +
3336 +static
3337 +void do_buffer( char *buffer,
3338 + int length,
3339 + char *s)
3340 +
3341 +{
3342 + static
3343 + char hex_char [] = "0123456789abcdef";
3344 + char *b = buffer;
3345 + int hex_byte;
3346 + int nybble;
3347 +
3348 + length = (length >= ((MAX_BUFF / 3) + 1)) ? (MAX_BUFF / 3) : length;
3349 +
3350 + while (length)
3351 + {
3352 + hex_byte = (int) *b++;
3353 + nybble = (hex_byte >> 4) & 0xf;
3354 + *s++ = hex_char[nybble];
3355 + nybble = hex_byte & 0xf;
3356 + *s++ = hex_char[nybble];
3357 + *s++ = ' ';
3358 + length--;
3359 + }
3360 + *s = '\0';
3361 +
3362 + return;
3363 +}
3364 +
3365 +/*
3366 + * Body of sprintf function: behaves just like standard sprintf, except we
3367 + * have an extra argument (buffer size) which we use to ensure we don't
3368 + * overflow
3369 + */
3370 +
3371 +void Divas_vsprintf( char *buffer,
3372 + int size,
3373 + char *fmt,
3374 + va_list argptr)
3375 +
3376 +{
3377 + char c; /* single character buffer */
3378 + int i; /* handy scratch counter */
3379 + int f; /* format character (after %) */
3380 + char *str; /* pointer into string */
3381 + char temp[20]; /* temp buffer used in printing numbers */
3382 + char string[MAX_BUFF]; /* output from number conversion */
3383 + int length; /* length of string "str" */
3384 + char fill; /* fill character ' ' or '0' */
3385 + boolean_t leftjust; /* TRUE if left justified, else right justified */
3386 + int fmax, fmin; /* field specifiers % MIN . MAX s */
3387 + int leading; /* number of leading/trailing fill characters */
3388 + char sign; /* set to '-' for negative decimals */
3389 + int number; /* numeric argument */
3390 +
3391 + char *buff_ptr; /* pointer to user's buffer of hex data */
3392 + int buff_len; /* length of hex data */
3393 +
3394 + /* make sure we have somthing to write into */
3395 +
3396 + if ((!buffer) || (size <= 0))
3397 + {
3398 + return;
3399 + }
3400 +
3401 + while (TRUE)
3402 + {
3403 + /* echo characters until end or '%' encountered */
3404 +
3405 + while ((c = *fmt++) != '%')
3406 + {
3407 + if (!c)
3408 + {
3409 + *buffer = '\0';
3410 + return;
3411 + }
3412 + WRITE_CHAR(buffer, size, c);
3413 + }
3414 +
3415 + /* echo %% as % */
3416 +
3417 + if (*fmt == '%')
3418 + {
3419 + WRITE_CHAR(buffer, size, *fmt);
3420 + continue;
3421 + }
3422 +
3423 + /* %- turns on left-justify */
3424 +
3425 + if ((leftjust = (boolean_t) ((*fmt == '-') ? TRUE : FALSE)))
3426 + {
3427 + fmt++;
3428 + }
3429 +
3430 + /* %0 turns on zero filling */
3431 +
3432 + if (*fmt == '0')
3433 + {
3434 + fill = '0';
3435 + }
3436 + else
3437 + {
3438 + fill = ' ';
3439 + }
3440 +
3441 + /* minium field width specifier for %d, u, x, c, s */
3442 +
3443 + fmin = 0;
3444 +
3445 + if (*fmt == '*')
3446 + {
3447 + fmin = va_arg(argptr, int);
3448 + fmt++;
3449 + }
3450 + else
3451 + {
3452 + while ('0' <= *fmt && *fmt <= '9')
3453 + {
3454 + fmin = (fmin * 10) + (*fmt++ - '0');
3455 + }
3456 + }
3457 +
3458 + /* maximum string width specifier for %s */
3459 +
3460 + fmax = 0;
3461 +
3462 + if (*fmt == '.')
3463 + {
3464 + if (*(++fmt) == '*')
3465 + {
3466 + fmax = va_arg(argptr, int);
3467 + fmt++;
3468 + }
3469 + else
3470 + {
3471 + while ('0' <= *fmt && *fmt <= '9')
3472 + {
3473 + fmax = (fmax * 10) + (*fmt++ - '0');
3474 + }
3475 + }
3476 + }
3477 +
3478 + /* skip over 'l' option (ints are assumed same size as longs) */
3479 +
3480 + if (*fmt == 'l')
3481 + {
3482 + fmt++;
3483 + }
3484 +
3485 + /* get the format chacater */
3486 +
3487 + if (!(f = *fmt++))
3488 + {
3489 + WRITE_CHAR(buffer, size, '%');
3490 + *buffer = '\0';
3491 + return;
3492 + }
3493 +
3494 + sign = '\0'; /* sign == '-' for negative decimal */
3495 +
3496 + str = string;
3497 +
3498 + switch (f)
3499 + {
3500 + case 'c' :
3501 + string[0] = (char) va_arg(argptr, int);
3502 + string[1] = '\0';
3503 + fmax = 0;
3504 + fill = ' ';
3505 + break;
3506 +
3507 + case 's' :
3508 + str = va_arg(argptr, char *);
3509 + fill = ' ';
3510 + break;
3511 +
3512 + case 'D' :
3513 + case 'd' :
3514 + number = va_arg(argptr, int);
3515 + if (number < 0)
3516 + {
3517 + sign = '-';
3518 + number = -number;
3519 + }
3520 + do_decimal(temp, DIM(temp), (unsigned int) number, str);
3521 + fmax = 0;
3522 + break;
3523 +
3524 + case 'U' :
3525 + case 'u' :
3526 + number = va_arg(argptr, int);
3527 + do_decimal(temp, DIM(temp), (unsigned int) number, str);
3528 + fmax = 0;
3529 + break;
3530 +
3531 + case 'O' :
3532 + case 'o' :
3533 + number = va_arg(argptr, int);
3534 + do_octal(temp, (unsigned int) number, str);
3535 + fmax = 0;
3536 + break;
3537 +
3538 + case 'X' :
3539 + case 'x' :
3540 + number = va_arg(argptr, int);
3541 + do_hex(temp, (unsigned int) number, str);
3542 + fmax = 0;
3543 + break;
3544 +
3545 + case 'H' :
3546 + case 'h' :
3547 + buff_ptr = va_arg(argptr, char *);
3548 + buff_len = va_arg(argptr, int);
3549 + do_buffer(buff_ptr, buff_len, str);
3550 + fmax = 0;
3551 + break;
3552 +
3553 + default :
3554 + WRITE_CHAR(buffer, size, ((char) f));
3555 + break;
3556 + }
3557 +
3558 + /* get the length of the string */
3559 +
3560 + length = 0;
3561 + while (str[length])
3562 + {
3563 + length++;
3564 + }
3565 +
3566 + /* make sure we have fmax and fmin values that are O.K. */
3567 +
3568 + if (fmin > DIM(string) || fmin < 0)
3569 + {
3570 + fmin = 0;
3571 + }
3572 +
3573 + if (fmax > DIM(string) || fmax < 0)
3574 + {
3575 + fmax = 0;
3576 + }
3577 +
3578 + /* figure out how many leading characters thare are */
3579 +
3580 + leading = 0;
3581 +
3582 + if (fmax || fmin)
3583 + {
3584 + if (fmax)
3585 + {
3586 + if (length > fmax)
3587 + {
3588 + length = fmax;
3589 + }
3590 + }
3591 +
3592 + if (fmin)
3593 + {
3594 + leading = fmin - length;
3595 + }
3596 +
3597 + if (sign == '-')
3598 + {
3599 + leading--;
3600 + }
3601 + }
3602 +
3603 + /* output sign now, if fill is numeric */
3604 +
3605 + if (sign == '-' && fill == '0')
3606 + {
3607 + WRITE_CHAR(buffer, size, '-');
3608 + }
3609 +
3610 + /* if right justified, output fill characters */
3611 +
3612 + if (!leftjust)
3613 + {
3614 + for (i = 0; i < leading; i++)
3615 + {
3616 + WRITE_CHAR(buffer, size, fill);
3617 + }
3618 + }
3619 +
3620 + /* output sign now, if fill is spaces */
3621 +
3622 + if (sign == '-' && fill == ' ')
3623 + {
3624 + WRITE_CHAR(buffer, size, '-');
3625 + }
3626 +
3627 + /* now the actual value */
3628 +
3629 + for (i = 0; i < length; i++)
3630 + {
3631 + WRITE_CHAR(buffer, size, str[i]);
3632 + }
3633 +
3634 + /* if left justified, fill out with the fill character */
3635 +
3636 + if (leftjust)
3637 + {
3638 + for (i = 0; i < leading; i++)
3639 + {
3640 + WRITE_CHAR(buffer, size, fill);
3641 + }
3642 + }
3643 + }
3644 +}
3645 +
3646 +/*
3647 + * sprintf for kernel
3648 + *
3649 + * call our vsprintf assuming user has a big buffer....
3650 + */
3651 +
3652 +void DivasSprintf(char *buffer, char *fmt, ...)
3653 +
3654 +{
3655 + va_list argptr; /* pointer to additional args */
3656 +
3657 + va_start(argptr, fmt);
3658 +
3659 + Divas_vsprintf(buffer, 1024, fmt, argptr);
3660 +
3661 + va_end(argptr);
3662 +
3663 + return;
3664 +}
3665 +
3666 void DivasPrintf(char *fmt, ...)
3667
3668 {
3669 @@ -40,7 +502,7 @@ void DivasPrintf(char *fmt, ...)
3670
3671 /* call vsprintf to format the user's information */
3672
3673 - vsnprintf(log.buffer, DIM(log.buffer), fmt, argptr);
3674 + Divas_vsprintf(log.buffer, DIM(log.buffer), fmt, argptr);
3675
3676 va_end(argptr);
3677
3678 --- a/drivers/isdn/eicon/lincfg.c
3679 +++ b/drivers/isdn/eicon/lincfg.c
3680 @@ -26,6 +26,9 @@
3681 #include "uxio.h"
3682
3683 #include <linux/pci.h>
3684 +#ifndef COMPAT_HAS_2_2_PCI
3685 +#include <linux/pci_ids.h>
3686 +#endif
3687 #include <linux/kernel.h>
3688 #include <linux/ioport.h>
3689
3690 --- a/drivers/isdn/eicon/linchr.c
3691 +++ b/drivers/isdn/eicon/linchr.c
3692 @@ -154,17 +154,17 @@ ssize_t do_read(struct file *pFile, char
3693 klog_t *pHeadItem;
3694
3695 if (BufferSize < sizeof(klog_t))
3696 + {
3697 + printk(KERN_WARNING "Divas: Divalog buffer specifed a size that is too small (%d - %d required)\n",
3698 + BufferSize, sizeof(klog_t));
3699 return -EIO;
3700 + }
3701
3702 pHeadItem = (klog_t *) DivasLogFifoRead();
3703
3704 if (pHeadItem)
3705 {
3706 - if(copy_to_user(pClientLogBuffer, pHeadItem, sizeof(klog_t)))
3707 - {
3708 - kfree(pHeadItem);
3709 - return -EFAULT;
3710 - }
3711 + memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t));
3712 kfree(pHeadItem);
3713 return sizeof(klog_t);
3714 }
3715 --- a/drivers/isdn/eicon/linio.c
3716 +++ b/drivers/isdn/eicon/linio.c
3717 @@ -15,6 +15,7 @@
3718 #include <linux/slab.h>
3719 #include <linux/pci.h>
3720 #include <linux/delay.h>
3721 +#include <linux/isdn_compat.h>
3722 #undef N_DATA
3723
3724 #include "uxio.h"
3725 --- a/drivers/isdn/hisax/Makefile
3726 +++ b/drivers/isdn/hisax/Makefile
3727 @@ -4,20 +4,17 @@
3728
3729 O_TARGET := vmlinux-obj.o
3730
3731 -# Define maximum number of cards
3732 -
3733 -EXTRA_CFLAGS += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
3734 -
3735 # Objects that export symbols.
3736
3737 -export-objs := config.o hisax_isac.o isdnhdlc.o
3738 +export-objs := config.o fsm.o hisax_isac.o
3739
3740 # Multipart objects.
3741
3742 list-multi := hisax.o hisax_st5481.o
3743 hisax-objs := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \
3744 lmgr.o q931.o callc.o fsm.o cert.o
3745 -hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o
3746 +hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o \
3747 + st5481_hdlc.o
3748
3749 # Optional parts of multipart objects.
3750 hisax-objs-$(CONFIG_HISAX_EURO) += l3dss1.o
3751 @@ -33,7 +30,7 @@ hisax-objs-$(CONFIG_HISAX_AVM_A1_PCMCIA)
3752 hisax-objs-$(CONFIG_HISAX_FRITZPCI) += avm_pci.o isac.o arcofi.o
3753 hisax-objs-$(CONFIG_HISAX_ELSA) += elsa.o isac.o arcofi.o hscx.o
3754 hisax-objs-$(CONFIG_HISAX_IX1MICROR2) += ix1_micro.o isac.o arcofi.o hscx.o
3755 -hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o ipacx.o
3756 +hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o
3757 hisax-objs-$(CONFIG_HISAX_ASUSCOM) += asuscom.o isac.o arcofi.o hscx.o
3758 hisax-objs-$(CONFIG_HISAX_TELEINT) += teleint.o isac.o arcofi.o hfc_2bs0.o
3759 hisax-objs-$(CONFIG_HISAX_SEDLBAUER) += sedlbauer.o isac.o arcofi.o hscx.o isar.o
3760 @@ -44,6 +41,7 @@ hisax-objs-$(CONFIG_HISAX_NETJET_U) += n
3761 hisax-objs-$(CONFIG_HISAX_HFCS) += hfcscard.o hfc_2bds0.o
3762 hisax-objs-$(CONFIG_HISAX_HFC_PCI) += hfc_pci.o
3763 hisax-objs-$(CONFIG_HISAX_HFC_SX) += hfc_sx.o
3764 +hisax-objs-$(CONFIG_HISAX_HFC_USB) += hfc_usbr.o
3765 hisax-objs-$(CONFIG_HISAX_NICCY) += niccy.o isac.o arcofi.o hscx.o
3766 hisax-objs-$(CONFIG_HISAX_ISURF) += isurf.o isac.o arcofi.o isar.o
3767 hisax-objs-$(CONFIG_HISAX_HSTSAPHIR) += saphir.o isac.o arcofi.o hscx.o
3768 @@ -51,7 +49,6 @@ hisax-objs-$(CONFIG_HISAX_BKM_A4T) += bk
3769 hisax-objs-$(CONFIG_HISAX_SCT_QUADRO) += bkm_a8.o isac.o arcofi.o hscx.o
3770 hisax-objs-$(CONFIG_HISAX_GAZEL) += gazel.o isac.o arcofi.o hscx.o
3771 hisax-objs-$(CONFIG_HISAX_W6692) += w6692.o
3772 -hisax-objs-$(CONFIG_HISAX_ENTERNOW_PCI) += enternow_pci.o amd7930_fn.o
3773 #hisax-objs-$(CONFIG_HISAX_TESTEMU) += testemu.o
3774
3775 hisax-objs += $(sort $(hisax-objs-y))
3776 @@ -61,10 +58,9 @@ hisax-objs += $(sort $(hisax-objs-y))
3777 obj-$(CONFIG_ISDN_DRV_HISAX) += hisax.o
3778 obj-$(CONFIG_HISAX_SEDLBAUER_CS) += sedlbauer_cs.o
3779 obj-$(CONFIG_HISAX_ELSA_CS) += elsa_cs.o
3780 -obj-$(CONFIG_HISAX_AVM_A1_CS) += avma1_cs.o
3781 -obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o isdnhdlc.o
3782 -obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_isac.o hisax_fcpcipnp.o
3783 -obj-$(CONFIG_USB_AUERISDN) += isdnhdlc.o
3784 +obj-$(CONFIG_HISAX_HFC_USB_CS) += hfc_usb.o
3785 +obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o
3786 +obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_fcpcipnp.o hisax_isac.o
3787
3788 CERT := $(shell md5sum -c md5sums.asc >> /dev/null;echo $$?)
3789 CFLAGS_cert.o := -DCERTIFICATION=$(CERT)
3790 --- /dev/null
3791 +++ b/drivers/isdn/hisax/amd7930.c
3792 @@ -0,0 +1,755 @@
3793 +/* $Id: amd7930.c,v 1.8 2001/09/24 13:22:55 kai Exp $
3794 + *
3795 + * HiSax ISDN driver - chip specific routines for AMD 7930
3796 + *
3797 + * Author Brent Baccala
3798 + * Copyright by Brent Baccala <baccala@FreeSoft.org>
3799 + *
3800 + * This software may be used and distributed according to the terms
3801 + * of the GNU General Public License, incorporated herein by reference.
3802 + *
3803 + * - Existing ISDN HiSax driver provides all the smarts
3804 + * - it compiles, runs, talks to an isolated phone switch, connects
3805 + * to a Cisco, pings go through
3806 + * - AMD 7930 support only (no DBRI yet)
3807 + * - no US NI-1 support (may not work on US phone system - untested)
3808 + * - periodic packet loss, apparently due to lost interrupts
3809 + * - ISDN sometimes freezes, requiring reboot before it will work again
3810 + *
3811 + * The code is unreliable enough to be consider alpha
3812 + *
3813 + * This file is (c) under GNU General Public License
3814 + *
3815 + * Advanced Micro Devices' Am79C30A is an ISDN/audio chip used in the
3816 + * SparcStation 1+. The chip provides microphone and speaker interfaces
3817 + * which provide mono-channel audio at 8K samples per second via either
3818 + * 8-bit A-law or 8-bit mu-law encoding. Also, the chip features an
3819 + * ISDN BRI Line Interface Unit (LIU), I.430 S/T physical interface,
3820 + * which performs basic D channel LAPD processing and provides raw
3821 + * B channel data. The digital audio channel, the two ISDN B channels,
3822 + * and two 64 Kbps channels to the microprocessor are all interconnected
3823 + * via a multiplexer.
3824 + *
3825 + * This driver interfaces to the Linux HiSax ISDN driver, which performs
3826 + * all high-level Q.921 and Q.931 ISDN functions. The file is not
3827 + * itself a hardware driver; rather it uses functions exported by
3828 + * the AMD7930 driver in the sparcaudio subsystem (drivers/sbus/audio),
3829 + * allowing the chip to be simultaneously used for both audio and ISDN data.
3830 + * The hardware driver does _no_ buffering, but provides several callbacks
3831 + * which are called during interrupt service and should therefore run quickly.
3832 + *
3833 + * D channel transmission is performed by passing the hardware driver the
3834 + * address and size of an skb's data area, then waiting for a callback
3835 + * to signal successful transmission of the packet. A task is then
3836 + * queued to notify the HiSax driver that another packet may be transmitted.
3837 + *
3838 + * D channel reception is quite simple, mainly because of:
3839 + * 1) the slow speed of the D channel - 16 kbps, and
3840 + * 2) the presence of an 8- or 32-byte (depending on chip version) FIFO
3841 + * to buffer the D channel data on the chip
3842 + * Worst case scenario of back-to-back packets with the 8 byte buffer
3843 + * at 16 kbps yields an service time of 4 ms - long enough to preclude
3844 + * the need for fancy buffering. We queue a background task that copies
3845 + * data out of the receive buffer into an skb, and the hardware driver
3846 + * simply does nothing until we're done with the receive buffer and
3847 + * reset it for a new packet.
3848 + *
3849 + * B channel processing is more complex, because of:
3850 + * 1) the faster speed - 64 kbps,
3851 + * 2) the lack of any on-chip buffering (it interrupts for every byte), and
3852 + * 3) the lack of any chip support for HDLC encapsulation
3853 + *
3854 + * The HiSax driver can put each B channel into one of three modes -
3855 + * L1_MODE_NULL (channel disabled), L1_MODE_TRANS (transparent data relay),
3856 + * and L1_MODE_HDLC (HDLC encapsulation by low-level driver).
3857 + * L1_MODE_HDLC is the most common, used for almost all "pure" digital
3858 + * data sessions. L1_MODE_TRANS is used for ISDN audio.
3859 + *
3860 + * HDLC B channel transmission is performed via a large buffer into
3861 + * which the skb is copied while performing HDLC bit-stuffing. A CRC
3862 + * is computed and attached to the end of the buffer, which is then
3863 + * passed to the low-level routines for raw transmission. Once
3864 + * transmission is complete, the hardware driver is set to enter HDLC
3865 + * idle by successive transmission of mark (all 1) bytes, waiting for
3866 + * the ISDN driver to prepare another packet for transmission and
3867 + * deliver it.
3868 + *
3869 + * HDLC B channel reception is performed via an X-byte ring buffer
3870 + * divided into N sections of X/N bytes each. Defaults: X=256 bytes, N=4.
3871 + * As the hardware driver notifies us that each section is full, we
3872 + * hand it the next section and schedule a background task to peruse
3873 + * the received section, bit-by-bit, with an HDLC decoder. As
3874 + * packets are detected, they are copied into a large buffer while
3875 + * decoding HDLC bit-stuffing. The ending CRC is verified, and if
3876 + * it is correct, we alloc a new skb of the correct length (which we
3877 + * now know), copy the packet into it, and hand it to the upper layers.
3878 + * Optimization: for large packets, we hand the buffer (which also
3879 + * happens to be an skb) directly to the upper layer after an skb_trim,
3880 + * and alloc a new large buffer for future packets, thus avoiding a copy.
3881 + * Then we return to HDLC processing; state is saved between calls.
3882 + *
3883 + */
3884 +
3885 +#define __NO_VERSION__
3886 +#include "hisax.h"
3887 +#include "../../sbus/audio/amd7930.h"
3888 +#include "isac.h"
3889 +#include "isdnl1.h"
3890 +#include "rawhdlc.h"
3891 +#include <linux/interrupt.h>
3892 +
3893 +static const char *amd7930_revision = "$Revision: 1.8 $";
3894 +
3895 +#define RCV_BUFSIZE 1024 /* Size of raw receive buffer in bytes */
3896 +#define RCV_BUFBLKS 4 /* Number of blocks to divide buffer into
3897 + * (must divide RCV_BUFSIZE) */
3898 +
3899 +static void Bchan_fill_fifo(struct BCState *, struct sk_buff *);
3900 +
3901 +static void
3902 +Bchan_xmt_bh(struct BCState *bcs)
3903 +{
3904 + struct sk_buff *skb;
3905 +
3906 + if (bcs->hw.amd7930.tx_skb != NULL) {
3907 + dev_kfree_skb(bcs->hw.amd7930.tx_skb);
3908 + bcs->hw.amd7930.tx_skb = NULL;
3909 + }
3910 +
3911 + if ((skb = skb_dequeue(&bcs->squeue))) {
3912 + Bchan_fill_fifo(bcs, skb);
3913 + } else {
3914 + clear_bit(BC_FLG_BUSY, &bcs->Flag);
3915 + bcs->event |= 1 << B_XMTBUFREADY;
3916 + queue_task(&bcs->tqueue, &tq_immediate);
3917 + mark_bh(IMMEDIATE_BH);
3918 + }
3919 +}
3920 +
3921 +static void
3922 +Bchan_xmit_callback(struct BCState *bcs)
3923 +{
3924 + queue_task(&bcs->hw.amd7930.tq_xmt, &tq_immediate);
3925 + mark_bh(IMMEDIATE_BH);
3926 +}
3927 +
3928 +/* B channel transmission: two modes (three, if you count L1_MODE_NULL)
3929 + *
3930 + * L1_MODE_HDLC - We need to do HDLC encapsulation before transmiting
3931 + * the packet (i.e. make_raw_hdlc_data). Since this can be a
3932 + * time-consuming operation, our completion callback just schedules
3933 + * a bottom half to do encapsulation for the next packet. In between,
3934 + * the link will just idle
3935 + *
3936 + * L1_MODE_TRANS - Data goes through, well, transparent. No HDLC encap,
3937 + * and we can't just let the link idle, so the "bottom half" actually
3938 + * gets called during the top half (it's our callback routine in this case),
3939 + * but it's a lot faster now since we don't call make_raw_hdlc_data
3940 + */
3941 +
3942 +static void
3943 +Bchan_fill_fifo(struct BCState *bcs, struct sk_buff *skb)
3944 +{
3945 + struct IsdnCardState *cs = bcs->cs;
3946 + int len;
3947 +
3948 + if ((cs->debug & L1_DEB_HSCX) || (cs->debug & L1_DEB_HSCX_FIFO)) {
3949 + char tmp[1024];
3950 + char *t = tmp;
3951 +
3952 + t += sprintf(t, "amd7930_fill_fifo %c cnt %d",
3953 + bcs->channel ? 'B' : 'A', skb->len);
3954 + if (cs->debug & L1_DEB_HSCX_FIFO)
3955 + QuickHex(t, skb->data, skb->len);
3956 + debugl1(cs, tmp);
3957 + }
3958 +
3959 + if (bcs->mode == L1_MODE_HDLC) {
3960 + len = make_raw_hdlc_data(skb->data, skb->len,
3961 + bcs->hw.amd7930.tx_buff, RAW_BUFMAX);
3962 + if (len > 0)
3963 + amd7930_bxmit(0, bcs->channel,
3964 + bcs->hw.amd7930.tx_buff, len,
3965 + (void *) &Bchan_xmit_callback,
3966 + (void *) bcs);
3967 + dev_kfree_skb(skb);
3968 + } else if (bcs->mode == L1_MODE_TRANS) {
3969 + amd7930_bxmit(0, bcs->channel,
3970 + bcs->hw.amd7930.tx_buff, skb->len,
3971 + (void *) &Bchan_xmt_bh,
3972 + (void *) bcs);
3973 + bcs->hw.amd7930.tx_skb = skb;
3974 + } else {
3975 + dev_kfree_skb(skb);
3976 + }
3977 +}
3978 +
3979 +static void
3980 +Bchan_mode(struct BCState *bcs, int mode, int bc)
3981 +{
3982 + struct IsdnCardState *cs = bcs->cs;
3983 +
3984 + if (cs->debug & L1_DEB_HSCX) {
3985 + char tmp[40];
3986 + sprintf(tmp, "AMD 7930 mode %d bchan %d/%d",
3987 + mode, bc, bcs->channel);
3988 + debugl1(cs, tmp);
3989 + }
3990 + bcs->mode = mode;
3991 +}
3992 +
3993 +/* Bchan_l2l1 is the entry point for upper layer routines that want to
3994 + * transmit on the B channel. PH_DATA_REQ is a normal packet that
3995 + * we either start transmitting (if idle) or queue (if busy).
3996 + * PH_PULL_REQ can be called to request a callback message (PH_PULL_CNF)
3997 + * once the link is idle. After a "pull" callback, the upper layer
3998 + * routines can use PH_PULL_IND to send data.
3999 + */
4000 +
4001 +static void
4002 +Bchan_l2l1(struct PStack *st, int pr, void *arg)
4003 +{
4004 + struct sk_buff *skb = arg;
4005 +
4006 + switch (pr) {
4007 + case (PH_DATA_REQ):
4008 + if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4009 + skb_queue_tail(&st->l1.bcs->squeue, skb);
4010 + } else {
4011 + test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
4012 + Bchan_fill_fifo(st->l1.bcs, skb);
4013 + }
4014 + break;
4015 + case (PH_PULL_IND):
4016 + if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4017 + printk(KERN_WARNING "amd7930: this shouldn't happen\n");
4018 + break;
4019 + }
4020 + test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
4021 + Bchan_fill_fifo(st->l1.bcs, skb);
4022 + break;
4023 + case (PH_PULL_REQ):
4024 + if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4025 + clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4026 + st->l1.l1l2(st, PH_PULL_CNF, NULL);
4027 + } else
4028 + set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4029 + break;
4030 + }
4031 +}
4032 +
4033 +/* Receiver callback and bottom half - decodes HDLC at leisure (if
4034 + * L1_MODE_HDLC) and passes newly received skb on via bcs->rqueue. If
4035 + * a large packet is received, stick rv_skb (the buffer that the
4036 + * packet has been decoded into) on the receive queue and alloc a new
4037 + * (large) skb to act as buffer for future receives. If a small
4038 + * packet is received, leave rv_skb alone, alloc a new skb of the
4039 + * correct size, and copy the packet into it
4040 + */
4041 +
4042 +static void
4043 +Bchan_recv_callback(struct BCState *bcs)
4044 +{
4045 + struct amd7930_hw *hw = &bcs->hw.amd7930;
4046 +
4047 + hw->rv_buff_in += RCV_BUFSIZE/RCV_BUFBLKS;
4048 + hw->rv_buff_in %= RCV_BUFSIZE;
4049 +
4050 + if (hw->rv_buff_in != hw->rv_buff_out) {
4051 + amd7930_brecv(0, bcs->channel,
4052 + hw->rv_buff + hw->rv_buff_in,
4053 + RCV_BUFSIZE/RCV_BUFBLKS,
4054 + (void *) &Bchan_recv_callback, (void *) bcs);
4055 + }
4056 +
4057 + queue_task(&hw->tq_rcv, &tq_immediate);
4058 + mark_bh(IMMEDIATE_BH);
4059 +}
4060 +
4061 +static void
4062 +Bchan_rcv_bh(struct BCState *bcs)
4063 +{
4064 + struct IsdnCardState *cs = bcs->cs;
4065 + struct amd7930_hw *hw = &bcs->hw.amd7930;
4066 + struct sk_buff *skb;
4067 + int len;
4068 +
4069 + if (cs->debug & L1_DEB_HSCX) {
4070 + char tmp[1024];
4071 +
4072 + sprintf(tmp, "amd7930_Bchan_rcv (%d/%d)",
4073 + hw->rv_buff_in, hw->rv_buff_out);
4074 + debugl1(cs, tmp);
4075 + QuickHex(tmp, hw->rv_buff + hw->rv_buff_out,
4076 + RCV_BUFSIZE/RCV_BUFBLKS);
4077 + debugl1(cs, tmp);
4078 + }
4079 +
4080 + do {
4081 + if (bcs->mode == L1_MODE_HDLC) {
4082 + while ((len = read_raw_hdlc_data(hw->hdlc_state,
4083 + hw->rv_buff + hw->rv_buff_out, RCV_BUFSIZE/RCV_BUFBLKS,
4084 + hw->rv_skb->tail, HSCX_BUFMAX))) {
4085 + if (len > 0 && (cs->debug & L1_DEB_HSCX_FIFO)) {
4086 + char tmp[1024];
4087 + char *t = tmp;
4088 +
4089 + t += sprintf(t, "amd7930_Bchan_rcv %c cnt %d", bcs->channel ? 'B' : 'A', len);
4090 + QuickHex(t, hw->rv_skb->tail, len);
4091 + debugl1(cs, tmp);
4092 + }
4093 +
4094 + if (len > HSCX_BUFMAX/2) {
4095 + /* Large packet received */
4096 +
4097 + if (!(skb = dev_alloc_skb(HSCX_BUFMAX))) {
4098 + printk(KERN_WARNING "amd7930: receive out of memory");
4099 + } else {
4100 + skb_put(hw->rv_skb, len);
4101 + skb_queue_tail(&bcs->rqueue, hw->rv_skb);
4102 + hw->rv_skb = skb;
4103 + bcs->event |= 1 << B_RCVBUFREADY;
4104 + queue_task(&bcs->tqueue, &tq_immediate);
4105 + }
4106 + } else if (len > 0) {
4107 + /* Small packet received */
4108 +
4109 + if (!(skb = dev_alloc_skb(len))) {
4110 + printk(KERN_WARNING "amd7930: receive out of memory\n");
4111 + } else {
4112 + memcpy(skb_put(skb, len), hw->rv_skb->tail, len);
4113 + skb_queue_tail(&bcs->rqueue, skb);
4114 + bcs->event |= 1 << B_RCVBUFREADY;
4115 + queue_task(&bcs->tqueue, &tq_immediate);
4116 + mark_bh(IMMEDIATE_BH);
4117 + }
4118 + } else {
4119 + /* Reception Error */
4120 + /* printk("amd7930: B channel receive error\n"); */
4121 + }
4122 + }
4123 + } else if (bcs->mode == L1_MODE_TRANS) {
4124 + if (!(skb = dev_alloc_skb(RCV_BUFSIZE/RCV_BUFBLKS))) {
4125 + printk(KERN_WARNING "amd7930: receive out of memory\n");
4126 + } else {
4127 + memcpy(skb_put(skb, RCV_BUFSIZE/RCV_BUFBLKS),
4128 + hw->rv_buff + hw->rv_buff_out,
4129 + RCV_BUFSIZE/RCV_BUFBLKS);
4130 + skb_queue_tail(&bcs->rqueue, skb);
4131 + bcs->event |= 1 << B_RCVBUFREADY;
4132 + queue_task(&bcs->tqueue, &tq_immediate);
4133 + mark_bh(IMMEDIATE_BH);
4134 + }
4135 + }
4136 +
4137 + if (hw->rv_buff_in == hw->rv_buff_out) {
4138 + /* Buffer was filled up - need to restart receiver */
4139 + amd7930_brecv(0, bcs->channel,
4140 + hw->rv_buff + hw->rv_buff_in,
4141 + RCV_BUFSIZE/RCV_BUFBLKS,
4142 + (void *) &Bchan_recv_callback,
4143 + (void *) bcs);
4144 + }
4145 +
4146 + hw->rv_buff_out += RCV_BUFSIZE/RCV_BUFBLKS;
4147 + hw->rv_buff_out %= RCV_BUFSIZE;
4148 +
4149 + } while (hw->rv_buff_in != hw->rv_buff_out);
4150 +}
4151 +
4152 +static void
4153 +Bchan_close(struct BCState *bcs)
4154 +{
4155 + struct sk_buff *skb;
4156 +
4157 + Bchan_mode(bcs, 0, 0);
4158 + amd7930_bclose(0, bcs->channel);
4159 +
4160 + if (test_bit(BC_FLG_INIT, &bcs->Flag)) {
4161 + skb_queue_purge(&bcs->rqueue);
4162 + skb_queue_purge(&bcs->squeue);
4163 + }
4164 + test_and_clear_bit(BC_FLG_INIT, &bcs->Flag);
4165 +}
4166 +
4167 +static int
4168 +Bchan_open(struct BCState *bcs)
4169 +{
4170 + struct amd7930_hw *hw = &bcs->hw.amd7930;
4171 +
4172 + if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
4173 + skb_queue_head_init(&bcs->rqueue);
4174 + skb_queue_head_init(&bcs->squeue);
4175 + }
4176 + test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
4177 +
4178 + amd7930_bopen(0, bcs->channel, 0xff);
4179 + hw->rv_buff_in = 0;
4180 + hw->rv_buff_out = 0;
4181 + hw->tx_skb = NULL;
4182 + init_hdlc_state(hw->hdlc_state, 0);
4183 + amd7930_brecv(0, bcs->channel,
4184 + hw->rv_buff + hw->rv_buff_in, RCV_BUFSIZE/RCV_BUFBLKS,
4185 + (void *) &Bchan_recv_callback, (void *) bcs);
4186 +
4187 + bcs->event = 0;
4188 + bcs->tx_cnt = 0;
4189 + return (0);
4190 +}
4191 +
4192 +static void
4193 +Bchan_init(struct BCState *bcs)
4194 +{
4195 + if (!(bcs->hw.amd7930.tx_buff = kmalloc(RAW_BUFMAX, GFP_ATOMIC))) {
4196 + printk(KERN_WARNING
4197 + "HiSax: No memory for amd7930.tx_buff\n");
4198 + return;
4199 + }
4200 + if (!(bcs->hw.amd7930.rv_buff = kmalloc(RCV_BUFSIZE, GFP_ATOMIC))) {
4201 + printk(KERN_WARNING
4202 + "HiSax: No memory for amd7930.rv_buff\n");
4203 + return;
4204 + }
4205 + if (!(bcs->hw.amd7930.rv_skb = dev_alloc_skb(HSCX_BUFMAX))) {
4206 + printk(KERN_WARNING
4207 + "HiSax: No memory for amd7930.rv_skb\n");
4208 + return;
4209 + }
4210 + if (!(bcs->hw.amd7930.hdlc_state = kmalloc(sizeof(struct hdlc_state),
4211 + GFP_ATOMIC))) {
4212 + printk(KERN_WARNING
4213 + "HiSax: No memory for amd7930.hdlc_state\n");
4214 + return;
4215 + }
4216 +
4217 + bcs->hw.amd7930.tq_rcv.sync = 0;
4218 + bcs->hw.amd7930.tq_rcv.routine = (void (*)(void *)) &Bchan_rcv_bh;
4219 + bcs->hw.amd7930.tq_rcv.data = (void *) bcs;
4220 +
4221 + bcs->hw.amd7930.tq_xmt.sync = 0;
4222 + bcs->hw.amd7930.tq_xmt.routine = (void (*)(void *)) &Bchan_xmt_bh;
4223 + bcs->hw.amd7930.tq_xmt.data = (void *) bcs;
4224 +}
4225 +
4226 +static void
4227 +Bchan_manl1(struct PStack *st, int pr,
4228 + void *arg)
4229 +{
4230 + switch (pr) {
4231 + case (PH_ACTIVATE_REQ):
4232 + test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
4233 + Bchan_mode(st->l1.bcs, st->l1.mode, st->l1.bc);
4234 + st->l1.l1man(st, PH_ACTIVATE_CNF, NULL);
4235 + break;
4236 + case (PH_DEACTIVATE_REQ):
4237 + if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag))
4238 + Bchan_mode(st->l1.bcs, 0, 0);
4239 + test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
4240 + break;
4241 + }
4242 +}
4243 +
4244 +int
4245 +setstack_amd7930(struct PStack *st, struct BCState *bcs)
4246 +{
4247 + if (Bchan_open(bcs))
4248 + return (-1);
4249 + st->l1.bcs = bcs;
4250 + st->l2.l2l1 = Bchan_l2l1;
4251 + st->ma.manl1 = Bchan_manl1;
4252 + setstack_manager(st);
4253 + bcs->st = st;
4254 + return (0);
4255 +}
4256 +
4257 +
4258 +static void
4259 +amd7930_drecv_callback(void *arg, int error, unsigned int count)
4260 +{
4261 + struct IsdnCardState *cs = (struct IsdnCardState *) arg;
4262 + static struct tq_struct task;
4263 + struct sk_buff *skb;
4264 +
4265 + /* NOTE: This function is called directly from an interrupt handler */
4266 +
4267 + if (1) {
4268 + if (!(skb = alloc_skb(count, GFP_ATOMIC)))
4269 + printk(KERN_WARNING "HiSax: D receive out of memory\n");
4270 + else {
4271 + memcpy(skb_put(skb, count), cs->rcvbuf, count);
4272 + skb_queue_tail(&cs->rq, skb);
4273 + }
4274 +
4275 + task.routine = (void *) DChannel_proc_rcv;
4276 + task.data = (void *) cs;
4277 + queue_task(&task, &tq_immediate);
4278 + mark_bh(IMMEDIATE_BH);
4279 + }
4280 +
4281 + if (cs->debug & L1_DEB_ISAC_FIFO) {
4282 + char tmp[128];
4283 + char *t = tmp;
4284 +
4285 + t += sprintf(t, "amd7930 Drecv cnt %d", count);
4286 + if (error) t += sprintf(t, " ERR %x", error);
4287 + QuickHex(t, cs->rcvbuf, count);
4288 + debugl1(cs, tmp);
4289 + }
4290 +
4291 + amd7930_drecv(0, cs->rcvbuf, MAX_DFRAME_LEN,
4292 + &amd7930_drecv_callback, cs);
4293 +}
4294 +
4295 +static void
4296 +amd7930_dxmit_callback(void *arg, int error)
4297 +{
4298 + struct IsdnCardState *cs = (struct IsdnCardState *) arg;
4299 + static struct tq_struct task;
4300 +
4301 + /* NOTE: This function is called directly from an interrupt handler */
4302 +
4303 + /* may wish to do retransmission here, if error indicates collision */
4304 +
4305 + if (cs->debug & L1_DEB_ISAC_FIFO) {
4306 + char tmp[128];
4307 + char *t = tmp;
4308 +
4309 + t += sprintf(t, "amd7930 Dxmit cnt %d", cs->tx_skb->len);
4310 + if (error) t += sprintf(t, " ERR %x", error);
4311 + QuickHex(t, cs->tx_skb->data, cs->tx_skb->len);
4312 + debugl1(cs, tmp);
4313 + }
4314 +
4315 + cs->tx_skb = NULL;
4316 +
4317 + task.routine = (void *) DChannel_proc_xmt;
4318 + task.data = (void *) cs;
4319 + queue_task(&task, &tq_immediate);
4320 + mark_bh(IMMEDIATE_BH);
4321 +}
4322 +
4323 +static void
4324 +amd7930_Dchan_l2l1(struct PStack *st, int pr, void *arg)
4325 +{
4326 + struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware;
4327 + struct sk_buff *skb = arg;
4328 + char str[64];
4329 +
4330 + switch (pr) {
4331 + case (PH_DATA_REQ):
4332 + if (cs->tx_skb) {
4333 + skb_queue_tail(&cs->sq, skb);
4334 +#ifdef L2FRAME_DEBUG /* psa */
4335 + if (cs->debug & L1_DEB_LAPD)
4336 + Logl2Frame(cs, skb, "PH_DATA Queued", 0);
4337 +#endif
4338 + } else {
4339 + if ((cs->dlogflag) && (!(skb->data[2] & 1))) {
4340 + /* I-FRAME */
4341 + LogFrame(cs, skb->data, skb->len);
4342 + sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei);
4343 + dlogframe(cs, skb->data+4, skb->len-4,
4344 + str);
4345 + }
4346 + cs->tx_skb = skb;
4347 + cs->tx_cnt = 0;
4348 +#ifdef L2FRAME_DEBUG /* psa */
4349 + if (cs->debug & L1_DEB_LAPD)
4350 + Logl2Frame(cs, skb, "PH_DATA", 0);
4351 +#endif
4352 + amd7930_dxmit(0, skb->data, skb->len,
4353 + &amd7930_dxmit_callback, cs);
4354 + }
4355 + break;
4356 + case (PH_PULL_IND):
4357 + if (cs->tx_skb) {
4358 + if (cs->debug & L1_DEB_WARN)
4359 + debugl1(cs, " l2l1 tx_skb exist this shouldn't happen");
4360 + skb_queue_tail(&cs->sq, skb);
4361 + break;
4362 + }
4363 + if ((cs->dlogflag) && (!(skb->data[2] & 1))) { /* I-FRAME */
4364 + LogFrame(cs, skb->data, skb->len);
4365 + sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei);
4366 + dlogframe(cs, skb->data + 4, skb->len - 4,
4367 + str);
4368 + }
4369 + cs->tx_skb = skb;
4370 + cs->tx_cnt = 0;
4371 +#ifdef L2FRAME_DEBUG /* psa */
4372 + if (cs->debug & L1_DEB_LAPD)
4373 + Logl2Frame(cs, skb, "PH_DATA_PULLED", 0);
4374 +#endif
4375 + amd7930_dxmit(0, cs->tx_skb->data, cs->tx_skb->len,
4376 + &amd7930_dxmit_callback, cs);
4377 + break;
4378 + case (PH_PULL_REQ):
4379 +#ifdef L2FRAME_DEBUG /* psa */
4380 + if (cs->debug & L1_DEB_LAPD)
4381 + debugl1(cs, "-> PH_REQUEST_PULL");
4382 +#endif
4383 + if (!cs->tx_skb) {
4384 + test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4385 + st->l1.l1l2(st, PH_PULL_CNF, NULL);
4386 + } else
4387 + test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4388 + break;
4389 + }
4390 +}
4391 +
4392 +int
4393 +setDstack_amd7930(struct PStack *st, struct IsdnCardState *cs)
4394 +{
4395 + st->l2.l2l1 = amd7930_Dchan_l2l1;
4396 + if (! cs->rcvbuf) {
4397 + printk("setDstack_amd7930: No cs->rcvbuf!\n");
4398 + } else {
4399 + amd7930_drecv(0, cs->rcvbuf, MAX_DFRAME_LEN,
4400 + &amd7930_drecv_callback, cs);
4401 + }
4402 + return (0);
4403 +}
4404 +
4405 +static void
4406 +manl1_msg(struct IsdnCardState *cs, int msg, void *arg) {
4407 + struct PStack *st;
4408 +
4409 + st = cs->stlist;
4410 + while (st) {
4411 + st->ma.manl1(st, msg, arg);
4412 + st = st->next;
4413 + }
4414 +}
4415 +
4416 +static void
4417 +amd7930_new_ph(struct IsdnCardState *cs)
4418 +{
4419 + switch (amd7930_get_liu_state(0)) {
4420 + case 3:
4421 + manl1_msg(cs, PH_POWERUP_CNF, NULL);
4422 + break;
4423 +
4424 + case 7:
4425 + manl1_msg(cs, PH_I4_P8_IND, NULL);
4426 + break;
4427 +
4428 + case 8:
4429 + manl1_msg(cs, PH_RSYNC_IND, NULL);
4430 + break;
4431 + }
4432 +}
4433 +
4434 +/* amd7930 LIU state change callback */
4435 +
4436 +static void
4437 +amd7930_liu_callback(struct IsdnCardState *cs)
4438 +{
4439 + static struct tq_struct task;
4440 +
4441 + if (!cs)
4442 + return;
4443 +
4444 + if (cs->debug & L1_DEB_ISAC) {
4445 + char tmp[32];
4446 + sprintf(tmp, "amd7930_liu state %d", amd7930_get_liu_state(0));
4447 + debugl1(cs, tmp);
4448 + }
4449 +
4450 + task.sync = 0;
4451 + task.routine = (void *) &amd7930_new_ph;
4452 + task.data = (void *) cs;
4453 + queue_task(&task, &tq_immediate);
4454 + mark_bh(IMMEDIATE_BH);
4455 +}
4456 +
4457 +void
4458 +amd7930_l1cmd(struct IsdnCardState *cs, int msg, void *arg)
4459 +{
4460 + u_char val;
4461 + char tmp[32];
4462 +
4463 + if (cs->debug & L1_DEB_ISAC) {
4464 + char tmp[32];
4465 + sprintf(tmp, "amd7930_l1cmd msg %x", msg);
4466 + debugl1(cs, tmp);
4467 + }
4468 +
4469 + switch(msg) {
4470 + case PH_RESET_REQ:
4471 + if (amd7930_get_liu_state(0) <= 3)
4472 + amd7930_liu_activate(0,0);
4473 + else
4474 + amd7930_liu_deactivate(0);
4475 + break;
4476 + case PH_ENABLE_REQ:
4477 + break;
4478 + case PH_INFO3_REQ:
4479 + amd7930_liu_activate(0,0);
4480 + break;
4481 + case PH_TESTLOOP_REQ:
4482 + break;
4483 + default:
4484 + if (cs->debug & L1_DEB_WARN) {
4485 + sprintf(tmp, "amd7930_l1cmd unknown %4x", msg);
4486 + debugl1(cs, tmp);
4487 + }
4488 + break;
4489 + }
4490 +}
4491 +
4492 +static void init_amd7930(struct IsdnCardState *cs)
4493 +{
4494 + Bchan_init(&cs->bcs[0]);
4495 + Bchan_init(&cs->bcs[1]);
4496 + cs->bcs[0].BC_SetStack = setstack_amd7930;
4497 + cs->bcs[1].BC_SetStack = setstack_amd7930;
4498 + cs->bcs[0].BC_Close = Bchan_close;
4499 + cs->bcs[1].BC_Close = Bchan_close;
4500 + Bchan_mode(cs->bcs, 0, 0);
4501 + Bchan_mode(cs->bcs + 1, 0, 0);
4502 +}
4503 +
4504 +void
4505 +release_amd7930(struct IsdnCardState *cs)
4506 +{
4507 +}
4508 +
4509 +static int
4510 +amd7930_card_msg(struct IsdnCardState *cs, int mt, void *arg)
4511 +{
4512 + switch (mt) {
4513 + case CARD_RESET:
4514 + return(0);
4515 + case CARD_RELEASE:
4516 + release_amd7930(cs);
4517 + return(0);
4518 + case CARD_INIT:
4519 + cs->l1cmd = amd7930_l1cmd;
4520 + amd7930_liu_init(0, &amd7930_liu_callback, (void *)cs);
4521 + init_amd7930(cs);
4522 + return(0);
4523 + case CARD_TEST:
4524 + return(0);
4525 + }
4526 + return(0);
4527 +}
4528 +
4529 +int __init
4530 +setup_amd7930(struct IsdnCard *card)
4531 +{
4532 + struct IsdnCardState *cs = card->cs;
4533 + char tmp[64];
4534 +
4535 + strcpy(tmp, amd7930_revision);
4536 + printk(KERN_INFO "HiSax: AMD7930 driver Rev. %s\n", HiSax_getrev(tmp));
4537 + if (cs->typ != ISDN_CTYPE_AMD7930)
4538 + return (0);
4539 +
4540 + cs->irq = amd7930_get_irqnum(0);
4541 + if (cs->irq == 0)
4542 + return (0);
4543 +
4544 + cs->cardmsg = &amd7930_card_msg;
4545 +
4546 + return (1);
4547 +}
4548 --- a/drivers/isdn/hisax/arcofi.c
4549 +++ b/drivers/isdn/hisax/arcofi.c
4550 @@ -1,4 +1,4 @@
4551 -/* $Id: arcofi.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4552 +/* $Id: arcofi.c,v 1.14 2001/09/24 13:22:55 kai Exp $
4553 *
4554 * Ansteuerung ARCOFI 2165
4555 *
4556 --- a/drivers/isdn/hisax/arcofi.h
4557 +++ b/drivers/isdn/hisax/arcofi.h
4558 @@ -1,4 +1,4 @@
4559 -/* $Id: arcofi.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4560 +/* $Id$
4561 *
4562 * Ansteuerung ARCOFI 2165
4563 *
4564 --- a/drivers/isdn/hisax/asuscom.c
4565 +++ b/drivers/isdn/hisax/asuscom.c
4566 @@ -1,4 +1,4 @@
4567 -/* $Id: asuscom.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4568 +/* $Id: asuscom.c,v 1.14 2001/09/24 13:22:55 kai Exp $
4569 *
4570 * low level stuff for ASUSCOM NETWORK INC. ISDNLink cards
4571 *
4572 @@ -14,7 +14,6 @@
4573
4574 #define __NO_VERSION__
4575 #include <linux/init.h>
4576 -#include <linux/isapnp.h>
4577 #include "hisax.h"
4578 #include "isac.h"
4579 #include "ipac.h"
4580 @@ -23,7 +22,7 @@
4581
4582 extern const char *CardType[];
4583
4584 -const char *Asuscom_revision = "$Revision: 1.1.4.1 $";
4585 +const char *Asuscom_revision = "$Revision: 1.14 $";
4586
4587 #define byteout(addr,val) outb(val,addr)
4588 #define bytein(addr) inb(addr)
4589 @@ -310,27 +309,6 @@ Asus_card_msg(struct IsdnCardState *cs,
4590 return(0);
4591 }
4592
4593 -#ifdef __ISAPNP__
4594 -static struct isapnp_device_id asus_ids[] __initdata = {
4595 - { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688),
4596 - ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688),
4597 - (unsigned long) "Asus1688 PnP" },
4598 - { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1690),
4599 - ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1690),
4600 - (unsigned long) "Asus1690 PnP" },
4601 - { ISAPNP_VENDOR('S', 'I', 'E'), ISAPNP_FUNCTION(0x0020),
4602 - ISAPNP_VENDOR('S', 'I', 'E'), ISAPNP_FUNCTION(0x0020),
4603 - (unsigned long) "Isurf2 PnP" },
4604 - { ISAPNP_VENDOR('E', 'L', 'F'), ISAPNP_FUNCTION(0x0000),
4605 - ISAPNP_VENDOR('E', 'L', 'F'), ISAPNP_FUNCTION(0x0000),
4606 - (unsigned long) "Iscas TE320" },
4607 - { 0, }
4608 -};
4609 -
4610 -static struct isapnp_device_id *adev = &asus_ids[0];
4611 -static struct pci_bus *pnp_c __devinitdata = NULL;
4612 -#endif
4613 -
4614 int __init
4615 setup_asuscom(struct IsdnCard *card)
4616 {
4617 @@ -343,45 +321,7 @@ setup_asuscom(struct IsdnCard *card)
4618 printk(KERN_INFO "HiSax: Asuscom ISDNLink driver Rev. %s\n", HiSax_getrev(tmp));
4619 if (cs->typ != ISDN_CTYPE_ASUSCOM)
4620 return (0);
4621 -#ifdef __ISAPNP__
4622 - if (!card->para[1] && isapnp_present()) {
4623 - struct pci_bus *pb;
4624 - struct pci_dev *pd;
4625 -
4626 - while(adev->card_vendor) {
4627 - if ((pb = isapnp_find_card(adev->card_vendor,
4628 - adev->card_device, pnp_c))) {
4629 - pnp_c = pb;
4630 - pd = NULL;
4631 - if ((pd = isapnp_find_dev(pnp_c,
4632 - adev->vendor, adev->function, pd))) {
4633 - printk(KERN_INFO "HiSax: %s detected\n",
4634 - (char *)adev->driver_data);
4635 - pd->prepare(pd);
4636 - pd->deactivate(pd);
4637 - pd->activate(pd);
4638 - card->para[1] = pd->resource[0].start;
4639 - card->para[0] = pd->irq_resource[0].start;
4640 - if (!card->para[0] || !card->para[1]) {
4641 - printk(KERN_ERR "AsusPnP:some resources are missing %ld/%lx\n",
4642 - card->para[0], card->para[1]);
4643 - pd->deactivate(pd);
4644 - return(0);
4645 - }
4646 - break;
4647 - } else {
4648 - printk(KERN_ERR "AsusPnP: PnP error card found, no device\n");
4649 - }
4650 - }
4651 - adev++;
4652 - pnp_c=NULL;
4653 - }
4654 - if (!adev->card_vendor) {
4655 - printk(KERN_INFO "AsusPnP: no ISAPnP card found\n");
4656 - return(0);
4657 - }
4658 - }
4659 -#endif
4660 +
4661 bytecnt = 8;
4662 cs->hw.asus.cfg_reg = card->para[1];
4663 cs->irq = card->para[0];
4664 --- a/drivers/isdn/hisax/avm_a1.c
4665 +++ b/drivers/isdn/hisax/avm_a1.c
4666 @@ -1,4 +1,4 @@
4667 -/* $Id: avm_a1.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4668 +/* $Id: avm_a1.c,v 2.15 2001/09/24 13:22:55 kai Exp $
4669 *
4670 * low level stuff for AVM A1 (Fritz) isdn cards
4671 *
4672 @@ -18,7 +18,7 @@
4673 #include "isdnl1.h"
4674
4675 extern const char *CardType[];
4676 -static const char *avm_revision = "$Revision: 1.1.4.1 $";
4677 +static const char *avm_revision = "$Revision: 2.15 $";
4678
4679 #define AVM_A1_STAT_ISAC 0x01
4680 #define AVM_A1_STAT_HSCX 0x02
4681 --- a/drivers/isdn/hisax/avm_a1p.c
4682 +++ b/drivers/isdn/hisax/avm_a1p.c
4683 @@ -1,4 +1,4 @@
4684 -/* $Id: avm_a1p.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4685 +/* $Id: avm_a1p.c,v 2.9 2001/09/24 13:22:55 kai Exp $
4686 *
4687 * low level stuff for the following AVM cards:
4688 * A1 PCMCIA
4689 @@ -57,7 +57,7 @@
4690 #define byteout(addr,val) outb(val,addr)
4691 #define bytein(addr) inb(addr)
4692
4693 -static const char *avm_revision = "$Revision: 1.1.4.1 $";
4694 +static const char *avm_revision = "$Revision: 2.9 $";
4695
4696 static inline u_char
4697 ReadISAC(struct IsdnCardState *cs, u_char offset)
4698 --- a/drivers/isdn/hisax/avm_pci.c
4699 +++ b/drivers/isdn/hisax/avm_pci.c
4700 @@ -1,4 +1,4 @@
4701 -/* $Id: avm_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4702 +/* $Id: avm_pci.c,v 1.29 2001/09/24 13:22:55 kai Exp $
4703 *
4704 * low level stuff for AVM Fritz!PCI and ISA PnP isdn cards
4705 *
4706 @@ -19,11 +19,11 @@
4707 #include "isac.h"
4708 #include "isdnl1.h"
4709 #include <linux/pci.h>
4710 -#include <linux/isapnp.h>
4711 +#include <linux/isdn_compat.h>
4712 #include <linux/interrupt.h>
4713
4714 extern const char *CardType[];
4715 -static const char *avm_pci_rev = "$Revision: 1.1.4.1 $";
4716 +static const char *avm_pci_rev = "$Revision: 1.29 $";
4717
4718 #define AVM_FRITZ_PCI 1
4719 #define AVM_FRITZ_PNP 2
4720 @@ -291,8 +291,7 @@ hdlc_empty_fifo(struct BCState *bcs, int
4721 debugl1(cs, "hdlc_empty_fifo: incoming packet too large");
4722 return;
4723 }
4724 - p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx;
4725 - ptr = (u_int *)p;
4726 + ptr = (u_int *) p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx;
4727 bcs->hw.hdlc.rcvidx += count;
4728 if (cs->subtyp == AVM_FRITZ_PCI) {
4729 outl(idx, cs->hw.avm.cfg_reg + 4);
4730 @@ -353,8 +352,7 @@ hdlc_fill_fifo(struct BCState *bcs)
4731 }
4732 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
4733 debugl1(cs, "hdlc_fill_fifo %d/%ld", count, bcs->tx_skb->len);
4734 - p = bcs->tx_skb->data;
4735 - ptr = (u_int *)p;
4736 + ptr = (u_int *) p = bcs->tx_skb->data;
4737 skb_pull(bcs->tx_skb, count);
4738 bcs->tx_cnt -= count;
4739 bcs->hw.hdlc.count += count;
4740 @@ -766,10 +764,6 @@ AVM_card_msg(struct IsdnCardState *cs, i
4741 }
4742
4743 static struct pci_dev *dev_avm __initdata = NULL;
4744 -#ifdef __ISAPNP__
4745 -static struct pci_bus *bus_avm __initdata = NULL;
4746 -static struct pci_dev *pnp_avm __initdata = NULL;
4747 -#endif
4748
4749 int __init
4750 setup_avm_pcipnp(struct IsdnCard *card)
4751 @@ -783,47 +777,10 @@ setup_avm_pcipnp(struct IsdnCard *card)
4752 if (cs->typ != ISDN_CTYPE_FRITZPCI)
4753 return (0);
4754 if (card->para[1]) {
4755 - /* old manual method */
4756 cs->hw.avm.cfg_reg = card->para[1];
4757 cs->irq = card->para[0];
4758 cs->subtyp = AVM_FRITZ_PNP;
4759 } else {
4760 -#ifdef __ISAPNP__
4761 - if (isapnp_present()) {
4762 - struct pci_bus *ba;
4763 - if ((ba = isapnp_find_card(
4764 - ISAPNP_VENDOR('A', 'V', 'M'),
4765 - ISAPNP_FUNCTION(0x0900), bus_avm))) {
4766 - bus_avm = ba;
4767 - pnp_avm = NULL;
4768 - if ((pnp_avm = isapnp_find_dev(bus_avm,
4769 - ISAPNP_VENDOR('A', 'V', 'M'),
4770 - ISAPNP_FUNCTION(0x0900), pnp_avm))) {
4771 - pnp_avm->prepare(pnp_avm);
4772 - pnp_avm->deactivate(pnp_avm);
4773 - pnp_avm->activate(pnp_avm);
4774 - cs->hw.avm.cfg_reg =
4775 - pnp_avm->resource[0].start;
4776 - cs->irq =
4777 - pnp_avm->irq_resource[0].start;
4778 - if (!cs->irq) {
4779 - printk(KERN_ERR "FritzPnP:No IRQ\n");
4780 - pnp_avm->deactivate(pnp_avm);
4781 - return(0);
4782 - }
4783 - if (!cs->hw.avm.cfg_reg) {
4784 - printk(KERN_ERR "FritzPnP:No IO address\n");
4785 - pnp_avm->deactivate(pnp_avm);
4786 - return(0);
4787 - }
4788 - cs->subtyp = AVM_FRITZ_PNP;
4789 - goto ready;
4790 - }
4791 - }
4792 - } else {
4793 - printk(KERN_INFO "FritzPnP: no ISA PnP present\n");
4794 - }
4795 -#endif
4796 #if CONFIG_PCI
4797 if (!pci_present()) {
4798 printk(KERN_ERR "FritzPCI: no PCI bus present\n");
4799 @@ -838,7 +795,7 @@ setup_avm_pcipnp(struct IsdnCard *card)
4800 }
4801 if (pci_enable_device(dev_avm))
4802 return(0);
4803 - cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
4804 + cs->hw.avm.cfg_reg = pci_resource_start_io(dev_avm, 1);
4805 if (!cs->hw.avm.cfg_reg) {
4806 printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
4807 return(0);
4808 @@ -854,7 +811,6 @@ setup_avm_pcipnp(struct IsdnCard *card)
4809 return (0);
4810 #endif /* CONFIG_PCI */
4811 }
4812 -ready:
4813 cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10;
4814 if (check_region((cs->hw.avm.cfg_reg), 32)) {
4815 printk(KERN_WARNING
4816 --- a/drivers/isdn/hisax/bkm_a4t.c
4817 +++ b/drivers/isdn/hisax/bkm_a4t.c
4818 @@ -1,4 +1,4 @@
4819 -/* $Id: bkm_a4t.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4820 +/* $Id: bkm_a4t.c,v 1.22 2001/09/24 13:22:55 kai Exp $
4821 *
4822 * low level stuff for T-Berkom A4T
4823 *
4824 @@ -20,11 +20,12 @@
4825 #include "jade.h"
4826 #include "isdnl1.h"
4827 #include <linux/pci.h>
4828 +#include <linux/isdn_compat.h>
4829 #include "bkm_ax.h"
4830
4831 extern const char *CardType[];
4832
4833 -const char *bkm_a4t_revision = "$Revision: 1.1.4.1 $";
4834 +const char *bkm_a4t_revision = "$Revision: 1.22 $";
4835
4836
4837 static inline u_char
4838 @@ -293,13 +294,13 @@ setup_bkm_a4t(struct IsdnCard *card)
4839 u16 sub_sys;
4840 u16 sub_vendor;
4841
4842 - sub_vendor = dev_a4t->subsystem_vendor;
4843 - sub_sys = dev_a4t->subsystem_device;
4844 + pci_get_sub_vendor(dev_a4t,sub_vendor);
4845 + pci_get_sub_system(dev_a4t,sub_sys);
4846 if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
4847 if (pci_enable_device(dev_a4t))
4848 return(0);
4849 found = 1;
4850 - pci_memaddr = pci_resource_start(dev_a4t, 0);
4851 + pci_memaddr = pci_resource_start_mem(dev_a4t, 0);
4852 cs->irq = dev_a4t->irq;
4853 break;
4854 }
4855 --- a/drivers/isdn/hisax/bkm_a8.c
4856 +++ b/drivers/isdn/hisax/bkm_a8.c
4857 @@ -1,4 +1,4 @@
4858 -/* $Id: bkm_a8.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4859 +/* $Id: bkm_a8.c,v 1.22 2001/09/24 13:22:55 kai Exp $
4860 *
4861 * low level stuff for Scitel Quadro (4*S0, passive)
4862 *
4863 @@ -20,6 +20,7 @@
4864 #include "hscx.h"
4865 #include "isdnl1.h"
4866 #include <linux/pci.h>
4867 +#include <linux/isdn_compat.h>
4868 #include "bkm_ax.h"
4869
4870 #if CONFIG_PCI
4871 @@ -28,7 +29,7 @@
4872
4873 extern const char *CardType[];
4874
4875 -const char sct_quadro_revision[] = "$Revision: 1.1.4.1 $";
4876 +const char sct_quadro_revision[] = "$Revision: 1.22 $";
4877
4878 static const char *sct_quadro_subtypes[] =
4879 {
4880 @@ -329,13 +330,13 @@ setup_sct_quadro(struct IsdnCard *card)
4881 while ((dev_a8 = pci_find_device(PCI_VENDOR_ID_PLX,
4882 PCI_DEVICE_ID_PLX_9050, dev_a8))) {
4883
4884 - sub_vendor_id = dev_a8->subsystem_vendor;
4885 - sub_sys_id = dev_a8->subsystem_device;
4886 + pci_get_sub_vendor(dev_a8,sub_vendor_id);
4887 + pci_get_sub_system(dev_a8,sub_sys_id);
4888 if ((sub_sys_id == PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) &&
4889 (sub_vendor_id == PCI_VENDOR_ID_BERKOM)) {
4890 if (pci_enable_device(dev_a8))
4891 return(0);
4892 - pci_ioaddr1 = pci_resource_start(dev_a8, 1);
4893 + pci_ioaddr1 = pci_resource_start_io(dev_a8, 1);
4894 pci_irq = dev_a8->irq;
4895 pci_bus = dev_a8->bus->number;
4896 pci_device_fn = dev_a8->devfn;
4897 @@ -365,7 +366,7 @@ setup_sct_quadro(struct IsdnCard *card)
4898 pci_ioaddr1 &= PCI_BASE_ADDRESS_IO_MASK;
4899 pcibios_write_config_dword(pci_bus, pci_device_fn,
4900 PCI_BASE_ADDRESS_1, pci_ioaddr1);
4901 - dev_a8->resource[ 1].start = pci_ioaddr1;
4902 + get_pcibase(dev_a8, 1) = pci_ioaddr1;
4903 }
4904 #endif /* End HACK */
4905 }
4906 --- a/drivers/isdn/hisax/bkm_ax.h
4907 +++ b/drivers/isdn/hisax/bkm_ax.h
4908 @@ -1,4 +1,4 @@
4909 -/* $Id: bkm_ax.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4910 +/* $Id$
4911 *
4912 * low level decls for T-Berkom cards A4T and Scitel Quadro (4*S0, passive)
4913 *
4914 --- a/drivers/isdn/hisax/callc.c
4915 +++ b/drivers/isdn/hisax/callc.c
4916 @@ -1,4 +1,4 @@
4917 -/* $Id: callc.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4918 +/* $Id: callc.c,v 2.59 2002/02/09 21:19:11 keil Exp $
4919 *
4920 * Author Karsten Keil
4921 * Copyright by Karsten Keil <keil@isdn4linux.de>
4922 @@ -26,7 +26,7 @@
4923 #define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module))
4924 #endif /* MODULE */
4925
4926 -const char *lli_revision = "$Revision: 1.1.4.1 $";
4927 +const char *lli_revision = "$Revision: 2.59 $";
4928
4929 extern struct IsdnCard cards[];
4930 extern int nrcards;
4931 @@ -145,9 +145,11 @@ enum {
4932 EV_PROCEED, /* 20 */
4933 EV_ALERT, /* 21 */
4934 EV_REDIR, /* 22 */
4935 + EV_ALERTING, /* 23 */
4936 + EV_PROCEEDING, /* 24 */
4937 };
4938
4939 -#define EVENT_COUNT (EV_REDIR + 1)
4940 +#define EVENT_COUNT (EV_PROCEEDING + 1)
4941
4942 static char *strEvent[] =
4943 {
4944 @@ -174,6 +176,8 @@ static char *strEvent[] =
4945 "EV_PROCEED",
4946 "EV_ALERT",
4947 "EV_REDIR",
4948 + "EV_ALERTING",
4949 + "EV_PROCEEDING",
4950 };
4951
4952
4953 @@ -286,6 +290,22 @@ lli_prep_dialout(struct FsmInst *fi, int
4954 }
4955
4956 static void
4957 +lli_alerting(struct FsmInst *fi, int event, void *arg)
4958 +{
4959 + struct Channel *chanp = fi->userdata;
4960 +
4961 + HL_LL(chanp, ISDN_STAT_ALERT);
4962 +}
4963 +
4964 +static void
4965 +lli_proceeding(struct FsmInst *fi, int event, void *arg)
4966 +{
4967 + struct Channel *chanp = fi->userdata;
4968 +
4969 + HL_LL(chanp, ISDN_STAT_PROCEED);
4970 +}
4971 +
4972 +static void
4973 lli_resume(struct FsmInst *fi, int event, void *arg)
4974 {
4975 struct Channel *chanp = fi->userdata;
4976 @@ -784,6 +804,8 @@ static struct FsmNode fnlist[] __initdat
4977 {ST_OUT_DIAL, EV_DISCONNECT_IND, lli_release_req},
4978 {ST_OUT_DIAL, EV_RELEASE, lli_dhup_close},
4979 {ST_OUT_DIAL, EV_NOSETUP_RSP, lli_no_setup_rsp},
4980 + {ST_OUT_DIAL, EV_PROCEEDING, lli_proceeding},
4981 + {ST_OUT_DIAL, EV_ALERTING, lli_alerting},
4982 {ST_OUT_DIAL, EV_SETUP_ERR, lli_error},
4983 {ST_IN_WAIT_LL, EV_LEASED_REL, lli_failure_l},
4984 {ST_IN_WAIT_LL, EV_ACCEPTD, lli_setup_rsp},
4985 @@ -925,7 +947,7 @@ static void stat_redir_result(struct Isd
4986 ic.driver = cs->myid;
4987 ic.command = ISDN_STAT_REDIR;
4988 ic.arg = chan;
4989 - ic.parm.num[0] = result;
4990 + (ulong)(ic.parm.num[0]) = result;
4991 cs->iif.statcallb(&ic);
4992 } /* stat_redir_result */
4993
4994 @@ -997,8 +1019,13 @@ dchan_l3l4(struct PStack *st, int pr, vo
4995 FsmEvent(&chanp->fi, EV_RELEASE, NULL);
4996 break;
4997 case (CC_PROCEED_SEND | INDICATION):
4998 + break;
4999 case (CC_PROCEEDING | INDICATION):
5000 + FsmEvent(&chanp->fi, EV_PROCEEDING, NULL);
5001 + break;
5002 case (CC_ALERTING | INDICATION):
5003 + FsmEvent(&chanp->fi, EV_ALERTING, NULL);
5004 + break;
5005 case (CC_PROGRESS | INDICATION):
5006 case (CC_NOTIFY | INDICATION):
5007 break;
5008 --- a/drivers/isdn/hisax/cert.c
5009 +++ b/drivers/isdn/hisax/cert.c
5010 @@ -1,4 +1,4 @@
5011 -/* $Id: cert.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
5012 +/* $Id: cert.c,v 2.6 2001/09/24 13:22:56 kai Exp $
5013 *
5014 * Author Karsten Keil
5015 * Copyright by Karsten Keil <keil@isdn4linux.de>
5016 --- a/drivers/isdn/hisax/config.c
5017 +++ b/drivers/isdn/hisax/config.c
5018 @@ -1,4 +1,4 @@
5019 -/* $Id: config.c,v 1.1.4.5 2001/12/09 19:19:26 kai Exp $
5020 +/* $Id: config.c,v 2.84 2002/08/13 09:55:29 keil Exp $
5021 *
5022 * Author Karsten Keil
5023 * Copyright by Karsten Keil <keil@isdn4linux.de>
5024 @@ -24,6 +24,11 @@
5025 #include <linux/kernel_stat.h>
5026 #include <linux/tqueue.h>
5027 #include <linux/interrupt.h>
5028 +
5029 +#ifdef CONFIG_HISAX_HFC_USB
5030 +#include "hisax_loadable.h"
5031 +#endif
5032 +
5033 #define HISAX_STATUS_BUFSIZE 4096
5034 #define INCLUDE_INLINE_FUNCS
5035
5036 @@ -75,8 +80,7 @@
5037 * 37 HFC 2BDS0 S+/SP p0=irq p1=iobase
5038 * 38 Travers Technologies NETspider-U PCI card
5039 * 39 HFC 2BDS0-SP PCMCIA p0=irq p1=iobase
5040 - * 40 hotplug interface
5041 - * 41 Formula-n enter:now ISDN PCI a/b none
5042 + * 40 HFC-S USB none
5043 *
5044 * protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6 or ISDN_PTYPE_NI1
5045 *
5046 @@ -95,11 +99,17 @@ const char *CardType[] = {
5047 "Siemens I-Surf", "Acer P10", "HST Saphir", "Telekom A4T",
5048 "Scitel Quadro", "Gazel", "HFC 2BDS0 PCI", "Winbond 6692",
5049 "HFC 2BDS0 SX", "NETspider-U", "HFC-2BDS0-SP PCMCIA",
5050 - "Hotplug", "Formula-n enter:now PCI a/b",
5051 + "HFC-S USB",
5052 };
5053
5054 void HiSax_closecard(int cardnr);
5055
5056 +#ifdef CONFIG_HISAX_HFC_USB
5057 +#define DEFAULT_CARD ISDN_CTYPE_HFC_USB
5058 +#define DEFAULT_CFG {0,0,0,0}
5059 +EXPORT_SYMBOL(hisax_register_hfcusb);
5060 +#endif
5061 +
5062 #ifdef CONFIG_HISAX_ELSA
5063 #define DEFAULT_CARD ISDN_CTYPE_ELSA
5064 #define DEFAULT_CFG {0,0,0,0}
5065 @@ -339,19 +349,27 @@ EXPORT_SYMBOL(HiSax_closecard);
5066 NULL, \
5067 }
5068
5069 -struct IsdnCard cards[HISAX_MAX_CARDS] = {
5070 +#define EMPTY_CARD {0, DEFAULT_PROTO, {0, 0, 0, 0}, NULL}
5071 +
5072 +struct IsdnCard cards[] = {
5073 FIRST_CARD,
5074 + EMPTY_CARD,
5075 + EMPTY_CARD,
5076 + EMPTY_CARD,
5077 + EMPTY_CARD,
5078 + EMPTY_CARD,
5079 + EMPTY_CARD,
5080 + EMPTY_CARD,
5081 };
5082
5083 -#define HISAX_IDSIZE (HISAX_MAX_CARDS*8)
5084 -static char HiSaxID[HISAX_IDSIZE] __devinitdata = { 0, };
5085 +static char HiSaxID[64] __devinitdata = { 0, };
5086
5087 char *HiSax_id __devinitdata = HiSaxID;
5088 #ifdef MODULE
5089 /* Variables for insmod */
5090 -static int type[HISAX_MAX_CARDS] __devinitdata = { 0, };
5091 -static int protocol[HISAX_MAX_CARDS] __devinitdata = { 0, };
5092 -static int io[HISAX_MAX_CARDS] __devinitdata = { 0, };
5093 +static int type[8] __devinitdata = { 0, };
5094 +static int protocol[8] __devinitdata = { 0, };
5095 +static int io[8] __devinitdata = { 0, };
5096 #undef IO0_IO1
5097 #ifdef CONFIG_HISAX_16_3
5098 #define IO0_IO1
5099 @@ -361,27 +379,23 @@ static int io[HISAX_MAX_CARDS] __devinit
5100 #define IO0_IO1
5101 #endif
5102 #ifdef IO0_IO1
5103 -static int io0[HISAX_MAX_CARDS] __devinitdata = { 0, };
5104 -static int io1[HISAX_MAX_CARDS] __devinitdata = { 0, };
5105 +static int io0[8] __devinitdata = { 0, };
5106 +static int io1[8] __devinitdata = { 0, };
5107 #endif
5108 -static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, };
5109 -static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, };
5110 +static int irq[8] __devinitdata = { 0, };
5111 +static int mem[8] __devinitdata = { 0, };
5112 static char *id __devinitdata = HiSaxID;
5113
5114 -#define PARM_PARA "1-" __MODULE_STRING(HISAX_MAX_CARDS) "i"
5115 -
5116 -MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards");
5117 MODULE_AUTHOR("Karsten Keil");
5118 -MODULE_LICENSE("GPL");
5119 -MODULE_PARM(type, PARM_PARA);
5120 -MODULE_PARM(protocol, PARM_PARA);
5121 -MODULE_PARM(io, PARM_PARA);
5122 -MODULE_PARM(irq, PARM_PARA);
5123 -MODULE_PARM(mem, PARM_PARA);
5124 +MODULE_PARM(type, "1-8i");
5125 +MODULE_PARM(protocol, "1-8i");
5126 +MODULE_PARM(io, "1-8i");
5127 +MODULE_PARM(irq, "1-8i");
5128 +MODULE_PARM(mem, "1-8i");
5129 MODULE_PARM(id, "s");
5130 #ifdef IO0_IO1
5131 -MODULE_PARM(io0, PARM_PARA);
5132 -MODULE_PARM(io1, PARM_PARA);
5133 +MODULE_PARM(io0, "1-8i");
5134 +MODULE_PARM(io1, "1-8i");
5135 #endif
5136 #endif /* MODULE */
5137
5138 @@ -432,6 +446,7 @@ void __init HiSaxVersion(void)
5139 }
5140
5141 #ifndef MODULE
5142 +#ifdef COMPAT_HAS_NEW_SETUP
5143 #define MAX_ARG (HISAX_MAX_CARDS*5)
5144 static int __init HiSax_setup(char *line)
5145 {
5146 @@ -440,12 +455,16 @@ static int __init HiSax_setup(char *line
5147 char *str;
5148
5149 str = get_options(line, MAX_ARG, ints);
5150 +#else
5151 +void __init HiSax_setup(char *str, int *ints)
5152 +{
5153 + int i, j, argc;
5154 +#endif
5155 argc = ints[0];
5156 printk(KERN_DEBUG "HiSax_setup: argc(%d) str(%s)\n", argc, str);
5157 i = 0;
5158 j = 1;
5159 while (argc && (i < HISAX_MAX_CARDS)) {
5160 - cards[i].protocol = DEFAULT_PROTO;
5161 if (argc) {
5162 cards[i].typ = ints[j];
5163 j++;
5164 @@ -473,19 +492,21 @@ static int __init HiSax_setup(char *line
5165 }
5166 i++;
5167 }
5168 - if (str && *str) {
5169 - if (strlen(str) < HISAX_IDSIZE)
5170 - strcpy(HiSaxID, str);
5171 - else
5172 - printk(KERN_WARNING "HiSax: ID too long!");
5173 - } else
5174 + if (str && *str) {
5175 + strcpy(HiSaxID, str);
5176 + HiSax_id = HiSaxID;
5177 + } else {
5178 strcpy(HiSaxID, "HiSax");
5179 -
5180 - HiSax_id = HiSaxID;
5181 + HiSax_id = HiSaxID;
5182 + }
5183 +#ifdef COMPAT_HAS_NEW_SETUP
5184 return 1;
5185 }
5186
5187 __setup("hisax=", HiSax_setup);
5188 +#else
5189 +}
5190 +#endif /* COMPAT_HAS_NEW_SETUP */
5191 #endif /* MODULES */
5192
5193 #if CARD_TELES0
5194 @@ -560,6 +581,10 @@ extern int setup_hfcs(struct IsdnCard *c
5195 extern int setup_hfcpci(struct IsdnCard *card);
5196 #endif
5197
5198 +#if CONFIG_HISAX_HFC_USB
5199 +extern int setup_hfc_usb(struct IsdnCard *card);
5200 +#endif
5201 +
5202 #if CARD_HFC_SX
5203 extern int setup_hfcsx(struct IsdnCard *card);
5204 #endif
5205 @@ -604,10 +629,6 @@ extern int setup_w6692(struct IsdnCard *
5206 extern int setup_netjet_u(struct IsdnCard *card);
5207 #endif
5208
5209 -#if CARD_FN_ENTERNOW_PCI
5210 -extern int setup_enternow_pci(struct IsdnCard *card);
5211 -#endif
5212 -
5213 /*
5214 * Find card with given driverId
5215 */
5216 @@ -899,7 +920,8 @@ static int __devinit init_card(struct Is
5217 return 3;
5218 }
5219
5220 -static int __devinit checkcard(int cardnr, char *id, int *busy_flag)
5221 +static int __devinit checkcard(int cardnr, char *id, int *busy_flag,
5222 + void *load_drv)
5223 {
5224 long flags;
5225 int ret = 0;
5226 @@ -1093,6 +1115,12 @@ static int __devinit checkcard(int cardn
5227 ret = setup_hfcsx(card);
5228 break;
5229 #endif
5230 +#if CONFIG_HISAX_HFC_USB
5231 + case ISDN_CTYPE_HFC_USB:
5232 + cs->hw.hfcusb.drv = load_drv;
5233 + ret = setup_hfc_usb(card);
5234 + break;
5235 +#endif
5236 #if CARD_NICCY
5237 case ISDN_CTYPE_NICCY:
5238 ret = setup_niccy(card);
5239 @@ -1143,11 +1171,6 @@ static int __devinit checkcard(int cardn
5240 ret = setup_netjet_u(card);
5241 break;
5242 #endif
5243 -#if CARD_FN_ENTERNOW_PCI
5244 - case ISDN_CTYPE_ENTERNOW:
5245 - ret = setup_enternow_pci(card);
5246 - break;
5247 -#endif
5248 case ISDN_CTYPE_DYNAMIC:
5249 ret = 2;
5250 break;
5251 @@ -1186,6 +1209,9 @@ static int __devinit checkcard(int cardn
5252 case ISDN_CTYPE_DYNAMIC:
5253 ret = 0;
5254 break;
5255 + case ISDN_CTYPE_HFC_USB:
5256 + ret = cs->cardmsg(cs, CARD_INIT, NULL);
5257 + break;
5258 default:
5259 ret = init_card(cs);
5260 break;
5261 @@ -1257,16 +1283,13 @@ int __devinit HiSax_inithardware(int *bu
5262 else
5263 sprintf(ids, "%s%d", id, i);
5264 }
5265 - if (checkcard(i, ids, busy_flag)) {
5266 + if (checkcard(i, ids, busy_flag, NULL)) {
5267 foundcards++;
5268 i++;
5269 } else {
5270 - /* make sure we don't oops the module */
5271 - if (cards[i].typ > 0 && cards[i].typ <= ISDN_CTYPE_COUNT) {
5272 - printk(KERN_WARNING
5273 - "HiSax: Card %s not installed !\n",
5274 - CardType[cards[i].typ]);
5275 - }
5276 + printk(KERN_WARNING
5277 + "HiSax: Card %s not installed !\n",
5278 + CardType[cards[i].typ]);
5279 HiSax_shiftcards(i);
5280 nrcards--;
5281 }
5282 @@ -1342,6 +1365,49 @@ void HiSax_reportcard(int cardnr, int se
5283 #endif
5284 }
5285
5286 +#ifdef CONFIG_HISAX_HFC_USB
5287 +int
5288 +hisax_register_hfcusb(struct hisax_drvreg *l1drv)
5289 +{
5290 + int i;
5291 + char ids[30];
5292 +
5293 + if (l1drv->version != HISAX_LOAD_VERSION)
5294 + return 1;
5295 +
5296 + switch (l1drv->cmd) {
5297 + case HISAX_LOAD_CHKVER:
5298 + break; /* success */
5299 +
5300 + case HISAX_LOAD_REGISTER:
5301 + for (i = 0; i < HISAX_MAX_CARDS; i++) {
5302 + if (!cards[i].typ)
5303 + break;
5304 + }
5305 + if (i >= HISAX_MAX_CARDS)
5306 + return 1; /* no space */
5307 + cards[i].typ = ISDN_CTYPE_HFC_USB; /* setup type */
5308 + cards[i].protocol = DEFAULT_PROTO;
5309 + sprintf(ids, "%s%d", l1drv->drvname, i);
5310 + if (checkcard(i, ids, NULL, (void *) l1drv)) {
5311 + nrcards++;
5312 + return 0;
5313 + }
5314 + if (cards[i].cs)
5315 + kfree((void *) cards[i].cs);
5316 + cards[i].cs = NULL;
5317 + cards[i].typ = 0; /* no card present */
5318 + return 1;
5319 + break;
5320 +
5321 + default:
5322 + return 1; /* unknown command */
5323 + }
5324 +
5325 + return 0;
5326 +} /* hisax_register_hfcusb */
5327 +#endif
5328 +
5329 static int __init HiSax_init(void)
5330 {
5331 int i, retval;
5332 @@ -1408,8 +1474,6 @@ static int __init HiSax_init(void)
5333 if (protocol[i]) {
5334 cards[j].protocol = protocol[i];
5335 nzproto++;
5336 - } else {
5337 - cards[j].protocol = DEFAULT_PROTO;
5338 }
5339 switch (type[i]) {
5340 case ISDN_CTYPE_16_0:
5341 @@ -1487,22 +1551,15 @@ static int __init HiSax_init(void)
5342 } else {
5343 /* QUADRO is a 4 BRI card */
5344 cards[j++].para[0] = 1;
5345 - /* we need to check if further cards can be added */
5346 - if (j < HISAX_MAX_CARDS) {
5347 - cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5348 - cards[j].protocol = protocol[i];
5349 - cards[j++].para[0] = 2;
5350 - }
5351 - if (j < HISAX_MAX_CARDS) {
5352 - cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5353 - cards[j].protocol = protocol[i];
5354 - cards[j++].para[0] = 3;
5355 - }
5356 - if (j < HISAX_MAX_CARDS) {
5357 - cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5358 - cards[j].protocol = protocol[i];
5359 - cards[j].para[0] = 4;
5360 - }
5361 + cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5362 + cards[j].protocol = protocol[i];
5363 + cards[j++].para[0] = 2;
5364 + cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5365 + cards[j].protocol = protocol[i];
5366 + cards[j++].para[0] = 3;
5367 + cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5368 + cards[j].protocol = protocol[i];
5369 + cards[j].para[0] = 4;
5370 }
5371 break;
5372 }
5373 @@ -1526,10 +1583,15 @@ static int __init HiSax_init(void)
5374 nrcards, (nrcards > 1) ? "s" : "");
5375
5376 /* Install only, if at least one card found */
5377 - if (!HiSax_inithardware(NULL))
5378 - return -ENODEV;
5379 + if (!HiSax_inithardware(NULL)) {
5380 + retval = -EIO;
5381 + goto out_isdnl1;
5382 + }
5383 +
5384 return 0;
5385
5386 + out_isdnl1:
5387 + Isdnl1Free();
5388 out_tei:
5389 TeiFree();
5390 out_isdnl2:
5391 @@ -1576,8 +1638,6 @@ int elsa_init_pcmcia(void *pcm_iob, int
5392 cards[i].typ = type[i];
5393 if (protocol[i]) {
5394 cards[i].protocol = protocol[i];
5395 - } else {
5396 - cards[i].protocol = DEFAULT_PROTO;
5397 }
5398 }
5399 cards[0].para[0] = pcm_irq;
5400 @@ -1595,8 +1655,7 @@ int elsa_init_pcmcia(void *pcm_iob, int
5401 printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5402 nrcards, (nrcards > 1) ? "s" : "");
5403
5404 - if (!HiSax_inithardware(busy_flag))
5405 - return -ENODEV;
5406 + HiSax_inithardware(busy_flag);
5407 printk(KERN_NOTICE "HiSax: module installed\n");
5408 #endif
5409 return 0;
5410 @@ -1619,8 +1678,6 @@ int hfc_init_pcmcia(void *pcm_iob, int p
5411 cards[i].typ = type[i];
5412 if (protocol[i]) {
5413 cards[i].protocol = protocol[i];
5414 - } else {
5415 - cards[i].protocol = DEFAULT_PROTO;
5416 }
5417 }
5418 cards[0].para[0] = pcm_irq;
5419 @@ -1638,8 +1695,7 @@ int hfc_init_pcmcia(void *pcm_iob, int p
5420 printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5421 nrcards, (nrcards > 1) ? "s" : "");
5422
5423 - if (!HiSax_inithardware(busy_flag))
5424 - return -ENODEV;
5425 + HiSax_inithardware(busy_flag);
5426 printk(KERN_NOTICE "HiSax: module installed\n");
5427 #endif
5428 return 0;
5429 @@ -1662,8 +1718,6 @@ int sedl_init_pcmcia(void *pcm_iob, int
5430 cards[i].typ = type[i];
5431 if (protocol[i]) {
5432 cards[i].protocol = protocol[i];
5433 - } else {
5434 - cards[i].protocol = DEFAULT_PROTO;
5435 }
5436 }
5437 cards[0].para[0] = pcm_irq;
5438 @@ -1681,8 +1735,7 @@ int sedl_init_pcmcia(void *pcm_iob, int
5439 printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5440 nrcards, (nrcards > 1) ? "s" : "");
5441
5442 - if (!HiSax_inithardware(busy_flag))
5443 - return -ENODEV;
5444 + HiSax_inithardware(busy_flag);
5445 printk(KERN_NOTICE "HiSax: module installed\n");
5446 #endif
5447 return 0;
5448 @@ -1705,8 +1758,6 @@ int avm_a1_init_pcmcia(void *pcm_iob, in
5449 cards[i].typ = type[i];
5450 if (protocol[i]) {
5451 cards[i].protocol = protocol[i];
5452 - } else {
5453 - cards[i].protocol = DEFAULT_PROTO;
5454 }
5455 }
5456 cards[0].para[0] = pcm_irq;
5457 @@ -1724,8 +1775,7 @@ int avm_a1_init_pcmcia(void *pcm_iob, in
5458 printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5459 nrcards, (nrcards > 1) ? "s" : "");
5460
5461 - if (!HiSax_inithardware(busy_flag))
5462 - return -ENODEV;
5463 + HiSax_inithardware(busy_flag);
5464 printk(KERN_NOTICE "HiSax: module installed\n");
5465 #endif
5466 return 0;
5467 @@ -1743,7 +1793,7 @@ int __devinit hisax_init_pcmcia(void *pc
5468 sprintf(ids, "HiSax%d", nrcards);
5469 else
5470 sprintf(ids, "HiSax");
5471 - if (!checkcard(nrcards, ids, busy_flag)) {
5472 + if (!checkcard(nrcards, ids, busy_flag, NULL)) {
5473 return -1;
5474 }
5475 ret = nrcards;
5476 @@ -1785,7 +1835,7 @@ int hisax_register(struct hisax_d_if *hi
5477 cards[i].protocol = protocol;
5478 sprintf(id, "%s%d", name, i);
5479 nrcards++;
5480 - retval = checkcard(i, id, 0);
5481 + retval = checkcard(i, id, 0, NULL);
5482 if (retval == 0) { // yuck
5483 cards[i].typ = 0;
5484 nrcards--;
5485 @@ -2117,9 +2167,6 @@ static struct pci_device_id hisax_pci_tb
5486 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20, PCI_ANY_ID, PCI_ANY_ID},
5487 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20_U, PCI_ANY_ID, PCI_ANY_ID},
5488 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA201, PCI_ANY_ID, PCI_ANY_ID},
5489 -//#########################################################################################
5490 - {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA202, PCI_ANY_ID, PCI_ANY_ID},
5491 -//#########################################################################################
5492 #endif
5493 #ifdef CONFIG_HISAX_ELSA
5494 {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_MICROLINK, PCI_ANY_ID, PCI_ANY_ID},
5495 @@ -2178,11 +2225,3 @@ MODULE_DEVICE_TABLE(pci, hisax_pci_tbl);
5496
5497 module_init(HiSax_init);
5498 module_exit(HiSax_exit);
5499 -
5500 -EXPORT_SYMBOL(FsmNew);
5501 -EXPORT_SYMBOL(FsmFree);
5502 -EXPORT_SYMBOL(FsmEvent);
5503 -EXPORT_SYMBOL(FsmChangeState);
5504 -EXPORT_SYMBOL(FsmInitTimer);
5505 -EXPORT_SYMBOL(FsmDelTimer);
5506 -EXPORT_SYMBOL(FsmRestartTimer);
5507 --- a/drivers/isdn/hisax/diva.c
5508 +++ b/drivers/isdn/hisax/diva.c
5509 @@ -1,4 +1,4 @@
5510 -/* $Id: diva.c,v 1.1.4.2 2002/08/30 11:21:00 keil Exp $
5511 +/* $Id: diva.c,v 1.33 2001/09/24 13:22:56 kai Exp $
5512 *
5513 * low level stuff for Eicon.Diehl Diva Family ISDN cards
5514 *
5515 @@ -22,14 +22,13 @@
5516 #include "isac.h"
5517 #include "hscx.h"
5518 #include "ipac.h"
5519 -#include "ipacx.h"
5520 #include "isdnl1.h"
5521 #include <linux/pci.h>
5522 -#include <linux/isapnp.h>
5523 +#include <linux/isdn_compat.h>
5524
5525 extern const char *CardType[];
5526
5527 -const char *Diva_revision = "$Revision: 1.1.4.2 $";
5528 +const char *Diva_revision = "$Revision: 1.33 $";
5529
5530 #define byteout(addr,val) outb(val,addr)
5531 #define bytein(addr) inb(addr)
5532 @@ -51,7 +50,6 @@ const char *Diva_revision = "$Revision:
5533 #define DIVA_PCI 2
5534 #define DIVA_IPAC_ISA 3
5535 #define DIVA_IPAC_PCI 4
5536 -#define DIVA_IPACX_PCI 5
5537
5538 /* CTRL (Read) */
5539 #define DIVA_IRQ_STAT 0x01
5540 @@ -71,12 +69,10 @@ const char *Diva_revision = "$Revision:
5541 #define PITA_MISC_REG 0x1c
5542 #ifdef __BIG_ENDIAN
5543 #define PITA_PARA_SOFTRESET 0x00000001
5544 -#define PITA_SER_SOFTRESET 0x00000002
5545 #define PITA_PARA_MPX_MODE 0x00000004
5546 #define PITA_INT0_ENABLE 0x00000200
5547 #else
5548 #define PITA_PARA_SOFTRESET 0x01000000
5549 -#define PITA_SER_SOFTRESET 0x02000000
5550 #define PITA_PARA_MPX_MODE 0x04000000
5551 #define PITA_INT0_ENABLE 0x00020000
5552 #endif
5553 @@ -244,47 +240,6 @@ MemWriteHSCX(struct IsdnCardState *cs, i
5554 memwritereg(cs->hw.diva.cfg_reg, offset + (hscx ? 0x40 : 0), value);
5555 }
5556
5557 -/* IO-Functions for IPACX type cards */
5558 -static u_char
5559 -MemReadISAC_IPACX(struct IsdnCardState *cs, u_char offset)
5560 -{
5561 - return (memreadreg(cs->hw.diva.cfg_reg, offset));
5562 -}
5563 -
5564 -static void
5565 -MemWriteISAC_IPACX(struct IsdnCardState *cs, u_char offset, u_char value)
5566 -{
5567 - memwritereg(cs->hw.diva.cfg_reg, offset, value);
5568 -}
5569 -
5570 -static void
5571 -MemReadISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size)
5572 -{
5573 - while(size--)
5574 - *data++ = memreadreg(cs->hw.diva.cfg_reg, 0);
5575 -}
5576 -
5577 -static void
5578 -MemWriteISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size)
5579 -{
5580 - while(size--)
5581 - memwritereg(cs->hw.diva.cfg_reg, 0, *data++);
5582 -}
5583 -
5584 -static u_char
5585 -MemReadHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset)
5586 -{
5587 - return(memreadreg(cs->hw.diva.cfg_reg, offset +
5588 - (hscx ? IPACX_OFF_B2 : IPACX_OFF_B1)));
5589 -}
5590 -
5591 -static void
5592 -MemWriteHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value)
5593 -{
5594 - memwritereg(cs->hw.diva.cfg_reg, offset +
5595 - (hscx ? IPACX_OFF_B2 : IPACX_OFF_B1), value);
5596 -}
5597 -
5598 /*
5599 * fast interrupt HSCX stuff goes here
5600 */
5601 @@ -595,7 +550,7 @@ Memhscx_int_main(struct IsdnCardState *c
5602 u_char exval;
5603 struct BCState *bcs;
5604
5605 - if (val & 0x01) { // EXB
5606 + if (val & 0x01) {
5607 bcs = cs->bcs + 1;
5608 exval = MemReadHSCX(cs, 1, HSCX_EXIR);
5609 if (exval & 0x40) {
5610 @@ -622,7 +577,7 @@ Memhscx_int_main(struct IsdnCardState *c
5611 debugl1(cs, "HSCX B interrupt %x", val);
5612 Memhscx_interrupt(cs, val, 1);
5613 }
5614 - if (val & 0x02) { // EXA
5615 + if (val & 0x02) {
5616 bcs = cs->bcs;
5617 exval = MemReadHSCX(cs, 0, HSCX_EXIR);
5618 if (exval & 0x40) {
5619 @@ -644,7 +599,7 @@ Memhscx_int_main(struct IsdnCardState *c
5620 } else if (cs->debug & L1_DEB_HSCX)
5621 debugl1(cs, "HSCX A EXIR %x", exval);
5622 }
5623 - if (val & 0x04) { // ICA
5624 + if (val & 0x04) {
5625 exval = MemReadHSCX(cs, 0, HSCX_ISTA);
5626 if (cs->debug & L1_DEB_HSCX)
5627 debugl1(cs, "HSCX A interrupt %x", exval);
5628 @@ -705,31 +660,12 @@ Start_IPACPCI:
5629 memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xC0);
5630 }
5631
5632 -static void
5633 -diva_irq_ipacx_pci(int intno, void *dev_id, struct pt_regs *regs)
5634 -{
5635 - struct IsdnCardState *cs = dev_id;
5636 - u_char val;
5637 - u_char *cfg;
5638 -
5639 - if (!cs) {
5640 - printk(KERN_WARNING "Diva: Spurious interrupt!\n");
5641 - return;
5642 - }
5643 - cfg = (u_char *) cs->hw.diva.pci_cfg;
5644 - val = *cfg;
5645 - if (!(val &PITA_INT0_STATUS)) return; // other shared IRQ
5646 - interrupt_ipacx(cs); // handler for chip
5647 - *cfg = PITA_INT0_STATUS; // Reset PLX interrupt
5648 -}
5649 -
5650 void
5651 release_io_diva(struct IsdnCardState *cs)
5652 {
5653 int bytecnt;
5654
5655 - if ((cs->subtyp == DIVA_IPAC_PCI) ||
5656 - (cs->subtyp == DIVA_IPACX_PCI) ) {
5657 + if (cs->subtyp == DIVA_IPAC_PCI) {
5658 u_int *cfg = (unsigned int *)cs->hw.diva.pci_cfg;
5659
5660 *cfg = 0; /* disable INT0/1 */
5661 @@ -776,16 +712,6 @@ reset_diva(struct IsdnCardState *cs)
5662 set_current_state(TASK_UNINTERRUPTIBLE);
5663 schedule_timeout((10*HZ)/1000);
5664 memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xc0);
5665 - } else if (cs->subtyp == DIVA_IPACX_PCI) {
5666 - unsigned int *ireg = (unsigned int *)(cs->hw.diva.pci_cfg +
5667 - PITA_MISC_REG);
5668 - *ireg = PITA_PARA_SOFTRESET | PITA_PARA_MPX_MODE;
5669 - set_current_state(TASK_UNINTERRUPTIBLE);
5670 - schedule_timeout((10*HZ)/1000);
5671 - *ireg = PITA_PARA_MPX_MODE | PITA_SER_SOFTRESET;
5672 - set_current_state(TASK_UNINTERRUPTIBLE);
5673 - schedule_timeout((10*HZ)/1000);
5674 - MemWriteISAC_IPACX(cs, IPACX_MASK, 0xff); // Interrupts off
5675 } else { /* DIVA 2.0 */
5676 cs->hw.diva.ctrl_reg = 0; /* Reset On */
5677 byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
5678 @@ -814,9 +740,7 @@ diva_led_handler(struct IsdnCardState *c
5679 {
5680 int blink = 0;
5681
5682 - if ((cs->subtyp == DIVA_IPAC_ISA) ||
5683 - (cs->subtyp == DIVA_IPAC_PCI) ||
5684 - (cs->subtyp == DIVA_IPACX_PCI) )
5685 + if ((cs->subtyp == DIVA_IPAC_ISA) || (cs->subtyp == DIVA_IPAC_PCI))
5686 return;
5687 del_timer(&cs->hw.diva.tl);
5688 if (cs->hw.diva.status & DIVA_ASSIGN)
5689 @@ -859,12 +783,6 @@ Diva_card_msg(struct IsdnCardState *cs,
5690 release_io_diva(cs);
5691 return(0);
5692 case CARD_INIT:
5693 - if (cs->subtyp == DIVA_IPACX_PCI) {
5694 - ireg = (unsigned int *)cs->hw.diva.pci_cfg;
5695 - *ireg = PITA_INT0_ENABLE;
5696 - init_ipacx(cs, 3); // init chip and enable interrupts
5697 - return (0);
5698 - }
5699 if (cs->subtyp == DIVA_IPAC_PCI) {
5700 ireg = (unsigned int *)cs->hw.diva.pci_cfg;
5701 *ireg = PITA_INT0_ENABLE;
5702 @@ -901,9 +819,7 @@ Diva_card_msg(struct IsdnCardState *cs,
5703 }
5704 break;
5705 }
5706 - if ((cs->subtyp != DIVA_IPAC_ISA) &&
5707 - (cs->subtyp != DIVA_IPAC_PCI) &&
5708 - (cs->subtyp != DIVA_IPACX_PCI) )
5709 + if ((cs->subtyp != DIVA_IPAC_ISA) && (cs->subtyp != DIVA_IPAC_PCI))
5710 diva_led_handler(cs);
5711 return(0);
5712 }
5713 @@ -911,40 +827,11 @@ Diva_card_msg(struct IsdnCardState *cs,
5714 static struct pci_dev *dev_diva __initdata = NULL;
5715 static struct pci_dev *dev_diva_u __initdata = NULL;
5716 static struct pci_dev *dev_diva201 __initdata = NULL;
5717 -static struct pci_dev *dev_diva202 __initdata = NULL;
5718 -
5719 -#ifdef __ISAPNP__
5720 -static struct isapnp_device_id diva_ids[] __initdata = {
5721 - { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
5722 - ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
5723 - (unsigned long) "Diva picola" },
5724 - { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
5725 - ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x51),
5726 - (unsigned long) "Diva picola" },
5727 - { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
5728 - ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
5729 - (unsigned long) "Diva 2.0" },
5730 - { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
5731 - ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x71),
5732 - (unsigned long) "Diva 2.0" },
5733 - { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
5734 - ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
5735 - (unsigned long) "Diva 2.01" },
5736 - { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
5737 - ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0xA1),
5738 - (unsigned long) "Diva 2.01" },
5739 - { 0, }
5740 -};
5741 -
5742 -static struct isapnp_device_id *pdev = &diva_ids[0];
5743 -static struct pci_bus *pnp_c __devinitdata = NULL;
5744 -#endif
5745 -
5746
5747 int __init
5748 setup_diva(struct IsdnCard *card)
5749 {
5750 - int bytecnt = 8;
5751 + int bytecnt;
5752 u_char val;
5753 struct IsdnCardState *cs = card->cs;
5754 char tmp[64];
5755 @@ -977,75 +864,8 @@ setup_diva(struct IsdnCard *card)
5756 cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
5757 }
5758 cs->irq = card->para[0];
5759 + bytecnt = 8;
5760 } else {
5761 -#ifdef __ISAPNP__
5762 - if (isapnp_present()) {
5763 - struct pci_bus *pb;
5764 - struct pci_dev *pd;
5765 -
5766 - while(pdev->card_vendor) {
5767 - if ((pb = isapnp_find_card(pdev->card_vendor,
5768 - pdev->card_device, pnp_c))) {
5769 - pnp_c = pb;
5770 - pd = NULL;
5771 - if ((pd = isapnp_find_dev(pnp_c,
5772 - pdev->vendor, pdev->function, pd))) {
5773 - printk(KERN_INFO "HiSax: %s detected\n",
5774 - (char *)pdev->driver_data);
5775 - pd->prepare(pd);
5776 - pd->deactivate(pd);
5777 - pd->activate(pd);
5778 - card->para[1] =
5779 - pd->resource[0].start;
5780 - card->para[0] =
5781 - pd->irq_resource[0].start;
5782 - if (!card->para[0] || !card->para[1]) {
5783 - printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
5784 - card->para[0], card->para[1]);
5785 - pd->deactivate(pd);
5786 - return(0);
5787 - }
5788 - cs->hw.diva.cfg_reg = card->para[1];
5789 - cs->irq = card->para[0];
5790 - if (pdev->function == ISAPNP_FUNCTION(0xA1)) {
5791 - cs->subtyp = DIVA_IPAC_ISA;
5792 - cs->hw.diva.ctrl = 0;
5793 - cs->hw.diva.isac =
5794 - card->para[1] + DIVA_IPAC_DATA;
5795 - cs->hw.diva.hscx =
5796 - card->para[1] + DIVA_IPAC_DATA;
5797 - cs->hw.diva.isac_adr =
5798 - card->para[1] + DIVA_IPAC_ADR;
5799 - cs->hw.diva.hscx_adr =
5800 - card->para[1] + DIVA_IPAC_ADR;
5801 - test_and_set_bit(HW_IPAC, &cs->HW_Flags);
5802 - } else {
5803 - cs->subtyp = DIVA_ISA;
5804 - cs->hw.diva.ctrl =
5805 - card->para[1] + DIVA_ISA_CTRL;
5806 - cs->hw.diva.isac =
5807 - card->para[1] + DIVA_ISA_ISAC_DATA;
5808 - cs->hw.diva.hscx =
5809 - card->para[1] + DIVA_HSCX_DATA;
5810 - cs->hw.diva.isac_adr =
5811 - card->para[1] + DIVA_ISA_ISAC_ADR;
5812 - cs->hw.diva.hscx_adr =
5813 - card->para[1] + DIVA_HSCX_ADR;
5814 - }
5815 - goto ready;
5816 - } else {
5817 - printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
5818 - return(0);
5819 - }
5820 - }
5821 - pdev++;
5822 - pnp_c=NULL;
5823 - }
5824 - if (!pdev->card_vendor) {
5825 - printk(KERN_INFO "Diva PnP: no ISAPnP card found\n");
5826 - }
5827 - }
5828 -#endif
5829 #if CONFIG_PCI
5830 if (!pci_present()) {
5831 printk(KERN_ERR "Diva: no PCI bus present\n");
5832 @@ -1059,14 +879,14 @@ setup_diva(struct IsdnCard *card)
5833 return(0);
5834 cs->subtyp = DIVA_PCI;
5835 cs->irq = dev_diva->irq;
5836 - cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
5837 + cs->hw.diva.cfg_reg = pci_resource_start_io(dev_diva, 2);
5838 } else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON,
5839 PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) {
5840 if (pci_enable_device(dev_diva_u))
5841 return(0);
5842 cs->subtyp = DIVA_PCI;
5843 cs->irq = dev_diva_u->irq;
5844 - cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2);
5845 + cs->hw.diva.cfg_reg = pci_resource_start_io(dev_diva_u, 2);
5846 } else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON,
5847 PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) {
5848 if (pci_enable_device(dev_diva201))
5849 @@ -1074,19 +894,9 @@ setup_diva(struct IsdnCard *card)
5850 cs->subtyp = DIVA_IPAC_PCI;
5851 cs->irq = dev_diva201->irq;
5852 cs->hw.diva.pci_cfg =
5853 - (ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096);
5854 + (ulong) ioremap(pci_resource_start_mem(dev_diva201, 0), 4096);
5855 cs->hw.diva.cfg_reg =
5856 - (ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096);
5857 - } else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON,
5858 - PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) {
5859 - if (pci_enable_device(dev_diva202))
5860 - return(0);
5861 - cs->subtyp = DIVA_IPACX_PCI;
5862 - cs->irq = dev_diva202->irq;
5863 - cs->hw.diva.pci_cfg =
5864 - (ulong) ioremap(pci_resource_start(dev_diva202, 0), 4096);
5865 - cs->hw.diva.cfg_reg =
5866 - (ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096);
5867 + (ulong) ioremap(pci_resource_start_mem(dev_diva201, 1), 4096);
5868 } else {
5869 printk(KERN_WARNING "Diva: No PCI card found\n");
5870 return(0);
5871 @@ -1107,8 +917,7 @@ setup_diva(struct IsdnCard *card)
5872 printk(KERN_WARNING "Diva: unable to config DIVA PCI\n");
5873 return (0);
5874 #endif /* CONFIG_PCI */
5875 - if ((cs->subtyp == DIVA_IPAC_PCI) ||
5876 - (cs->subtyp == DIVA_IPACX_PCI) ) {
5877 + if (cs->subtyp == DIVA_IPAC_PCI) {
5878 cs->hw.diva.ctrl = 0;
5879 cs->hw.diva.isac = 0;
5880 cs->hw.diva.hscx = 0;
5881 @@ -1125,23 +934,18 @@ setup_diva(struct IsdnCard *card)
5882 bytecnt = 32;
5883 }
5884 }
5885 -ready:
5886 +
5887 printk(KERN_INFO
5888 "Diva: %s card configured at %#lx IRQ %d\n",
5889 (cs->subtyp == DIVA_PCI) ? "PCI" :
5890 (cs->subtyp == DIVA_ISA) ? "ISA" :
5891 - (cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" :
5892 - (cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
5893 + (cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" : "IPAC PCI",
5894 cs->hw.diva.cfg_reg, cs->irq);
5895 - if ((cs->subtyp == DIVA_IPAC_PCI) ||
5896 - (cs->subtyp == DIVA_IPACX_PCI) ||
5897 - (cs->subtyp == DIVA_PCI) )
5898 - printk(KERN_INFO "Diva: %s space at %#lx\n",
5899 - (cs->subtyp == DIVA_PCI) ? "PCI" :
5900 - (cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
5901 + if ((cs->subtyp == DIVA_IPAC_PCI) || (cs->subtyp == DIVA_PCI))
5902 + printk(KERN_INFO "Diva: %s PCI space at %#lx\n",
5903 + (cs->subtyp == DIVA_PCI) ? "PCI" : "IPAC PCI",
5904 cs->hw.diva.pci_cfg);
5905 - if ((cs->subtyp != DIVA_IPAC_PCI) &&
5906 - (cs->subtyp != DIVA_IPACX_PCI) ) {
5907 + if (cs->subtyp != DIVA_IPAC_PCI) {
5908 if (check_region(cs->hw.diva.cfg_reg, bytecnt)) {
5909 printk(KERN_WARNING
5910 "HiSax: %s config port %lx-%lx already in use\n",
5911 @@ -1177,17 +981,6 @@ ready:
5912 cs->irq_func = &diva_irq_ipac_pci;
5913 val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
5914 printk(KERN_INFO "Diva: IPAC version %x\n", val);
5915 - } else if (cs->subtyp == DIVA_IPACX_PCI) {
5916 - cs->readisac = &MemReadISAC_IPACX;
5917 - cs->writeisac = &MemWriteISAC_IPACX;
5918 - cs->readisacfifo = &MemReadISACfifo_IPACX;
5919 - cs->writeisacfifo = &MemWriteISACfifo_IPACX;
5920 - cs->BC_Read_Reg = &MemReadHSCX_IPACX;
5921 - cs->BC_Write_Reg = &MemWriteHSCX_IPACX;
5922 - cs->BC_Send_Data = 0; // function located in ipacx module
5923 - cs->irq_func = &diva_irq_ipacx_pci;
5924 - printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
5925 - MemReadISAC_IPACX(cs, IPACX_ID) &0x3F);
5926 } else { /* DIVA 2.0 */
5927 cs->hw.diva.tl.function = (void *) diva_led_handler;
5928 cs->hw.diva.tl.data = (long) cs;
5929 --- a/drivers/isdn/hisax/elsa.c
5930 +++ b/drivers/isdn/hisax/elsa.c
5931 @@ -1,4 +1,4 @@
5932 -/* $Id: elsa.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
5933 +/* $Id: elsa.c,v 2.32 2001/09/24 13:22:56 kai Exp $
5934 *
5935 * low level stuff for Elsa isdn cards
5936 *
5937 @@ -28,13 +28,13 @@
5938 #include "hscx.h"
5939 #include "isdnl1.h"
5940 #include <linux/pci.h>
5941 -#include <linux/isapnp.h>
5942 +#include <linux/isdn_compat.h>
5943 #include <linux/serial.h>
5944 #include <linux/serial_reg.h>
5945
5946 extern const char *CardType[];
5947
5948 -const char *Elsa_revision = "$Revision: 1.1.4.1 $";
5949 +const char *Elsa_revision = "$Revision: 2.32 $";
5950 const char *Elsa_Types[] =
5951 {"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
5952 "PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI",
5953 @@ -864,21 +864,6 @@ probe_elsa(struct IsdnCardState *cs)
5954 static struct pci_dev *dev_qs1000 __devinitdata = NULL;
5955 static struct pci_dev *dev_qs3000 __devinitdata = NULL;
5956
5957 -#ifdef __ISAPNP__
5958 -static struct isapnp_device_id elsa_ids[] __initdata = {
5959 - { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
5960 - ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
5961 - (unsigned long) "Elsa QS1000" },
5962 - { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
5963 - ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
5964 - (unsigned long) "Elsa QS3000" },
5965 - { 0, }
5966 -};
5967 -
5968 -static struct isapnp_device_id *pdev = &elsa_ids[0];
5969 -static struct pci_bus *pnp_c __devinitdata = NULL;
5970 -#endif
5971 -
5972 int __devinit
5973 setup_elsa(struct IsdnCard *card)
5974 {
5975 @@ -893,7 +878,6 @@ setup_elsa(struct IsdnCard *card)
5976 cs->hw.elsa.ctrl_reg = 0;
5977 cs->hw.elsa.status = 0;
5978 cs->hw.elsa.MFlag = 0;
5979 - cs->subtyp = 0;
5980 if (cs->typ == ISDN_CTYPE_ELSA) {
5981 cs->hw.elsa.base = card->para[0];
5982 printk(KERN_INFO "Elsa: Microlink IO probing\n");
5983 @@ -955,60 +939,9 @@ setup_elsa(struct IsdnCard *card)
5984 return (0);
5985 }
5986 } else if (cs->typ == ISDN_CTYPE_ELSA_PNP) {
5987 -#ifdef __ISAPNP__
5988 - if (!card->para[1] && isapnp_present()) {
5989 - struct pci_bus *pb;
5990 - struct pci_dev *pd;
5991 -
5992 - while(pdev->card_vendor) {
5993 - if ((pb = isapnp_find_card(pdev->card_vendor,
5994 - pdev->card_device, pnp_c))) {
5995 - pnp_c = pb;
5996 - pd = NULL;
5997 - if ((pd = isapnp_find_dev(pnp_c,
5998 - pdev->vendor, pdev->function, pd))) {
5999 - printk(KERN_INFO "HiSax: %s detected\n",
6000 - (char *)pdev->driver_data);
6001 - pd->prepare(pd);
6002 - pd->deactivate(pd);
6003 - pd->activate(pd);
6004 - card->para[1] =
6005 - pd->resource[0].start;
6006 - card->para[0] =
6007 - pd->irq_resource[0].start;
6008 - if (!card->para[0] || !card->para[1]) {
6009 - printk(KERN_ERR "Elsa PnP:some resources are missing %ld/%lx\n",
6010 - card->para[0], card->para[1]);
6011 - pd->deactivate(pd);
6012 - return(0);
6013 - }
6014 - if (pdev->function == ISAPNP_FUNCTION(0x133))
6015 - cs->subtyp = ELSA_QS1000;
6016 - else
6017 - cs->subtyp = ELSA_QS3000;
6018 - break;
6019 - } else {
6020 - printk(KERN_ERR "Elsa PnP: PnP error card found, no device\n");
6021 - return(0);
6022 - }
6023 - }
6024 - pdev++;
6025 - pnp_c=NULL;
6026 - }
6027 - if (!pdev->card_vendor) {
6028 - printk(KERN_INFO "Elsa PnP: no ISAPnP card found\n");
6029 - return(0);
6030 - }
6031 - }
6032 -#endif
6033 - if (card->para[1] && card->para[0]) {
6034 - cs->hw.elsa.base = card->para[1];
6035 - cs->irq = card->para[0];
6036 - if (!cs->subtyp)
6037 - cs->subtyp = ELSA_QS1000;
6038 - } else {
6039 - printk(KERN_ERR "Elsa PnP: no parameter\n");
6040 - }
6041 + cs->hw.elsa.base = card->para[1];
6042 + cs->irq = card->para[0];
6043 + cs->subtyp = ELSA_QS1000;
6044 cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG;
6045 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE;
6046 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC;
6047 @@ -1058,16 +991,16 @@ setup_elsa(struct IsdnCard *card)
6048 return(0);
6049 cs->subtyp = ELSA_QS1000PCI;
6050 cs->irq = dev_qs1000->irq;
6051 - cs->hw.elsa.cfg = pci_resource_start(dev_qs1000, 1);
6052 - cs->hw.elsa.base = pci_resource_start(dev_qs1000, 3);
6053 + cs->hw.elsa.cfg = pci_resource_start_io(dev_qs1000, 1);
6054 + cs->hw.elsa.base = pci_resource_start_io(dev_qs1000, 3);
6055 } else if ((dev_qs3000 = pci_find_device(PCI_VENDOR_ID_ELSA,
6056 PCI_DEVICE_ID_ELSA_QS3000, dev_qs3000))) {
6057 if (pci_enable_device(dev_qs3000))
6058 return(0);
6059 cs->subtyp = ELSA_QS3000PCI;
6060 cs->irq = dev_qs3000->irq;
6061 - cs->hw.elsa.cfg = pci_resource_start(dev_qs3000, 1);
6062 - cs->hw.elsa.base = pci_resource_start(dev_qs3000, 3);
6063 + cs->hw.elsa.cfg = pci_resource_start_io(dev_qs3000, 1);
6064 + cs->hw.elsa.base = pci_resource_start_io(dev_qs3000, 3);
6065 } else {
6066 printk(KERN_WARNING "Elsa: No PCI card found\n");
6067 return(0);
6068 @@ -1123,7 +1056,6 @@ setup_elsa(struct IsdnCard *card)
6069 break;
6070 case ELSA_PCFPRO:
6071 case ELSA_PCF:
6072 - case ELSA_QS3000:
6073 case ELSA_QS3000PCI:
6074 bytecnt = 16;
6075 break;
6076 --- a/drivers/isdn/hisax/elsa_cs.c
6077 +++ b/drivers/isdn/hisax/elsa_cs.c
6078 @@ -72,7 +72,7 @@ static int pc_debug = PCMCIA_DEBUG;
6079 MODULE_PARM(pc_debug, "i");
6080 #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
6081 static char *version =
6082 -"elsa_cs.c $Revision: 1.1.4.1 $ $Date: 2001/11/20 14:19:35 $ (K.Lichtenwalder)";
6083 +"elsa_cs.c $Revision: 1.2 $ $Date: 2001/09/24 13:22:56 $ (K.Lichtenwalder)";
6084 #else
6085 #define DEBUG(n, args...)
6086 #endif
6087 --- a/drivers/isdn/hisax/elsa_ser.c
6088 +++ b/drivers/isdn/hisax/elsa_ser.c
6089 @@ -1,4 +1,4 @@
6090 -/* $Id: elsa_ser.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6091 +/* $Id: elsa_ser.c,v 2.14 2001/09/24 13:22:56 kai Exp $
6092 *
6093 * stuff for the serial modem on ELSA cards
6094 *
6095 @@ -396,6 +396,74 @@ static inline void transmit_chars(struct
6096 }
6097 }
6098
6099 +#if 0
6100 +static inline void check_modem_status(struct IsdnCardState *cs)
6101 +{
6102 + int status;
6103 + struct async_struct *info = cs->hw.elsa.info;
6104 + struct async_icount *icount;
6105 +
6106 + status = serial_inp(info, UART_MSR);
6107 +
6108 + if (status & UART_MSR_ANY_DELTA) {
6109 + icount = &info->state->icount;
6110 + /* update input line counters */
6111 + if (status & UART_MSR_TERI)
6112 + icount->rng++;
6113 + if (status & UART_MSR_DDSR)
6114 + icount->dsr++;
6115 + if (status & UART_MSR_DDCD) {
6116 + icount->dcd++;
6117 + }
6118 + if (status & UART_MSR_DCTS)
6119 + icount->cts++;
6120 +// wake_up(&info->delta_msr_wait);
6121 + }
6122 +
6123 + if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
6124 +#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
6125 + printk("ttys%d CD now %s...", info->line,
6126 + (status & UART_MSR_DCD) ? "on" : "off");
6127 +#endif
6128 + if (status & UART_MSR_DCD)
6129 +// wake_up(&info->open_wait);
6130 +;
6131 + else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
6132 + (info->flags & ASYNC_CALLOUT_NOHUP))) {
6133 +#ifdef SERIAL_DEBUG_OPEN
6134 + printk("doing serial hangup...");
6135 +#endif
6136 + if (info->tty)
6137 + tty_hangup(info->tty);
6138 + }
6139 + }
6140 +#if 0
6141 + if (info->flags & ASYNC_CTS_FLOW) {
6142 + if (info->tty->hw_stopped) {
6143 + if (status & UART_MSR_CTS) {
6144 +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
6145 + printk("CTS tx start...");
6146 +#endif
6147 + info->tty->hw_stopped = 0;
6148 + info->IER |= UART_IER_THRI;
6149 + serial_outp(info, UART_IER, info->IER);
6150 +// rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
6151 + return;
6152 + }
6153 + } else {
6154 + if (!(status & UART_MSR_CTS)) {
6155 +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
6156 + printk("CTS tx stop...");
6157 +#endif
6158 + info->tty->hw_stopped = 1;
6159 + info->IER &= ~UART_IER_THRI;
6160 + serial_outp(info, UART_IER, info->IER);
6161 + }
6162 + }
6163 + }
6164 +#endif 0
6165 +}
6166 +#endif
6167
6168 static void rs_interrupt_elsa(int irq, struct IsdnCardState *cs)
6169 {
6170 --- a/drivers/isdn/hisax/fsm.c
6171 +++ b/drivers/isdn/hisax/fsm.c
6172 @@ -1,4 +1,4 @@
6173 -/* $Id: fsm.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6174 +/* $Id$
6175 *
6176 * Finite state machine
6177 *
6178 @@ -21,6 +21,14 @@
6179
6180 #define FSM_TIMER_DEBUG 0
6181
6182 +EXPORT_SYMBOL(FsmNew);
6183 +EXPORT_SYMBOL(FsmFree);
6184 +EXPORT_SYMBOL(FsmEvent);
6185 +EXPORT_SYMBOL(FsmChangeState);
6186 +EXPORT_SYMBOL(FsmInitTimer);
6187 +EXPORT_SYMBOL(FsmDelTimer);
6188 +EXPORT_SYMBOL(FsmRestartTimer);
6189 +
6190 int __init
6191 FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
6192 {
6193 --- a/drivers/isdn/hisax/fsm.h
6194 +++ b/drivers/isdn/hisax/fsm.h
6195 @@ -1,4 +1,4 @@
6196 -/* $Id: fsm.h,v 1.1.2.1 2001/11/20 14:19:35 kai Exp $
6197 +/* $Id$
6198 *
6199 * Finite state machine
6200 *
6201 --- a/drivers/isdn/hisax/gazel.c
6202 +++ b/drivers/isdn/hisax/gazel.c
6203 @@ -1,4 +1,4 @@
6204 -/* $Id: gazel.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6205 +/* $Id: gazel.c,v 2.19 2001/09/24 13:22:56 kai Exp $
6206 *
6207 * low level stuff for Gazel isdn cards
6208 *
6209 @@ -20,9 +20,10 @@
6210 #include "isdnl1.h"
6211 #include "ipac.h"
6212 #include <linux/pci.h>
6213 +#include <linux/isdn_compat.h>
6214
6215 extern const char *CardType[];
6216 -const char *gazel_revision = "$Revision: 1.1.4.1 $";
6217 +const char *gazel_revision = "$Revision: 2.19 $";
6218
6219 #define R647 1
6220 #define R685 2
6221 @@ -563,8 +564,8 @@ setup_gazelpci(struct IsdnCardState *cs)
6222 if (pci_enable_device(dev_tel))
6223 return 1;
6224 pci_irq = dev_tel->irq;
6225 - pci_ioaddr0 = pci_resource_start(dev_tel, 1);
6226 - pci_ioaddr1 = pci_resource_start(dev_tel, 2);
6227 + pci_ioaddr0 = pci_resource_start_io(dev_tel, 1);
6228 + pci_ioaddr1 = pci_resource_start_io(dev_tel, 2);
6229 found = 1;
6230 }
6231 if (found)
6232 --- a/drivers/isdn/hisax/hfc_2bds0.c
6233 +++ b/drivers/isdn/hisax/hfc_2bds0.c
6234 @@ -1,4 +1,4 @@
6235 -/* $Id: hfc_2bds0.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6236 +/* $Id: hfc_2bds0.c,v 1.18 2001/09/24 13:22:56 kai Exp $
6237 *
6238 * specific routines for CCD's HFC 2BDS0
6239 *
6240 @@ -616,6 +616,17 @@ hfcd_bh(struct IsdnCardState *cs)
6241 */
6242 if (!cs)
6243 return;
6244 +#if 0
6245 + if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) {
6246 + if (cs->debug)
6247 + debugl1(cs, "D-Channel Busy cleared");
6248 + stptr = cs->stlist;
6249 + while (stptr != NULL) {
6250 + stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL);
6251 + stptr = stptr->next;
6252 + }
6253 + }
6254 +#endif
6255 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
6256 switch (cs->dc.hfcd.ph_state) {
6257 case (0):
6258 @@ -1090,6 +1101,32 @@ HFCD_l1hw(struct PStack *st, int pr, voi
6259 cs->hw.hfcD.mst_m |= HFCD_MASTER;
6260 cs->writeisac(cs, HFCD_MST_MODE, cs->hw.hfcD.mst_m);
6261 break;
6262 +#if 0
6263 + case (HW_TESTLOOP | REQUEST):
6264 + u_char val = 0;
6265 + if (1 & (int) arg)
6266 + val |= 0x0c;
6267 + if (2 & (int) arg)
6268 + val |= 0x3;
6269 + if (test_bit(HW_IOM1, &cs->HW_Flags)) {
6270 + /* IOM 1 Mode */
6271 + if (!val) {
6272 + cs->writeisac(cs, ISAC_SPCR, 0xa);
6273 + cs->writeisac(cs, ISAC_ADF1, 0x2);
6274 + } else {
6275 + cs->writeisac(cs, ISAC_SPCR, val);
6276 + cs->writeisac(cs, ISAC_ADF1, 0xa);
6277 + }
6278 + } else {
6279 + /* IOM 2 Mode */
6280 + cs->writeisac(cs, ISAC_SPCR, val);
6281 + if (val)
6282 + cs->writeisac(cs, ISAC_ADF1, 0x8);
6283 + else
6284 + cs->writeisac(cs, ISAC_ADF1, 0x0);
6285 + }
6286 + break;
6287 +#endif
6288 default:
6289 if (cs->debug & L1_DEB_WARN)
6290 debugl1(cs, "hfcd_l1hw unknown pr %4x", pr);
6291 @@ -1106,6 +1143,20 @@ setstack_hfcd(struct PStack *st, struct
6292 static void
6293 hfc_dbusy_timer(struct IsdnCardState *cs)
6294 {
6295 +#if 0
6296 + struct PStack *stptr;
6297 + if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
6298 + if (cs->debug)
6299 + debugl1(cs, "D-Channel Busy");
6300 + test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags);
6301 + stptr = cs->stlist;
6302 +
6303 + while (stptr != NULL) {
6304 + stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL);
6305 + stptr = stptr->next;
6306 + }
6307 + }
6308 +#endif
6309 }
6310
6311 unsigned int __init
6312 --- a/drivers/isdn/hisax/hfc_2bds0.h
6313 +++ b/drivers/isdn/hisax/hfc_2bds0.h
6314 @@ -1,4 +1,4 @@
6315 -/* $Id: hfc_2bds0.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6316 +/* $Id: hfc_2bds0.h,v 1.6 2001/09/24 13:22:56 kai Exp $
6317 *
6318 * specific defines for CCD's HFC 2BDS0
6319 *
6320 --- a/drivers/isdn/hisax/hfc_2bs0.c
6321 +++ b/drivers/isdn/hisax/hfc_2bs0.c
6322 @@ -1,4 +1,4 @@
6323 -/* $Id: hfc_2bs0.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6324 +/* $Id: hfc_2bs0.c,v 1.20 2001/09/24 13:22:56 kai Exp $
6325 *
6326 * specific routines for CCD's HFC 2BS0
6327 *
6328 --- a/drivers/isdn/hisax/hfc_2bs0.h
6329 +++ b/drivers/isdn/hisax/hfc_2bs0.h
6330 @@ -1,4 +1,4 @@
6331 -/* $Id: hfc_2bs0.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6332 +/* $Id: hfc_2bs0.h,v 1.5 2001/09/24 13:22:56 kai Exp $
6333 *
6334 * specific defines for CCD's HFC 2BS0
6335 *
6336 --- a/drivers/isdn/hisax/hfc_pci.c
6337 +++ b/drivers/isdn/hisax/hfc_pci.c
6338 @@ -1,4 +1,4 @@
6339 -/* $Id: hfc_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6340 +/* $Id: hfc_pci.c,v 1.48 2001/09/24 13:22:56 kai Exp $
6341 *
6342 * low level driver for CCD´s hfc-pci based cards
6343 *
6344 @@ -22,11 +22,12 @@
6345 #include "hfc_pci.h"
6346 #include "isdnl1.h"
6347 #include <linux/pci.h>
6348 +#include <linux/isdn_compat.h>
6349 #include <linux/interrupt.h>
6350
6351 extern const char *CardType[];
6352
6353 -static const char *hfcpci_revision = "$Revision: 1.1.4.1 $";
6354 +static const char *hfcpci_revision = "$Revision: 1.48 $";
6355
6356 /* table entry in the PCI devices list */
6357 typedef struct {
6358 @@ -76,8 +77,6 @@ release_io_hfcpci(struct IsdnCardState *
6359 {
6360 unsigned long flags;
6361
6362 - printk(KERN_INFO "HiSax: release hfcpci at %p\n",
6363 - cs->hw.hfcpci.pci_io);
6364 save_flags(flags);
6365 cli();
6366 cs->hw.hfcpci.int_m2 = 0; /* interrupt output off ! */
6367 @@ -88,11 +87,13 @@ release_io_hfcpci(struct IsdnCardState *
6368 set_current_state(TASK_UNINTERRUPTIBLE);
6369 schedule_timeout((30 * HZ) / 1000); /* Timeout 30ms */
6370 Write_hfc(cs, HFCPCI_CIRM, 0); /* Reset Off */
6371 +#if CONFIG_PCI
6372 pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
6373 +#endif /* CONFIG_PCI */
6374 del_timer(&cs->hw.hfcpci.timer);
6375 kfree(cs->hw.hfcpci.share_start);
6376 cs->hw.hfcpci.share_start = NULL;
6377 - iounmap((void *)cs->hw.hfcpci.pci_io);
6378 + vfree(cs->hw.hfcpci.pci_io);
6379 }
6380
6381 /********************************************************************************/
6382 @@ -687,10 +688,6 @@ hfcpci_fill_fifo(struct BCState *bcs)
6383 debugl1(cs, "hfcpci_fill_fifo_trans %d frame length %d discarded",
6384 bcs->channel, bcs->tx_skb->len);
6385
6386 - if (bcs->st->lli.l1writewakeup &&
6387 - (PACKET_NOACK != bcs->tx_skb->pkt_type))
6388 - bcs->st->lli.l1writewakeup(bcs->st, bcs->tx_skb->len);
6389 -
6390 dev_kfree_skb_any(bcs->tx_skb);
6391 cli();
6392 bcs->tx_skb = skb_dequeue(&bcs->squeue); /* fetch next data */
6393 @@ -1146,6 +1143,20 @@ hfcpci_interrupt(int intno, void *dev_id
6394 static void
6395 hfcpci_dbusy_timer(struct IsdnCardState *cs)
6396 {
6397 +#if 0
6398 + struct PStack *stptr;
6399 + if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
6400 + if (cs->debug)
6401 + debugl1(cs, "D-Channel Busy");
6402 + test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags);
6403 + stptr = cs->stlist;
6404 +
6405 + while (stptr != NULL) {
6406 + stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL);
6407 + stptr = stptr->next;
6408 + }
6409 + }
6410 +#endif
6411 }
6412
6413 /*************************************/
6414 @@ -1550,6 +1561,17 @@ hfcpci_bh(struct IsdnCardState *cs)
6415 */
6416 if (!cs)
6417 return;
6418 +#if 0
6419 + if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) {
6420 + if (cs->debug)
6421 + debugl1(cs, "D-Channel Busy cleared");
6422 + stptr = cs->stlist;
6423 + while (stptr != NULL) {
6424 + stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL);
6425 + stptr = stptr->next;
6426 + }
6427 + }
6428 +#endif
6429 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
6430 if (!cs->hw.hfcpci.nt_mode)
6431 switch (cs->dc.hfcpci.ph_state) {
6432 @@ -1712,7 +1734,7 @@ setup_hfcpci(struct IsdnCard *card)
6433 if (pci_enable_device(tmp_hfcpci))
6434 continue;
6435 pci_set_master(tmp_hfcpci);
6436 - if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
6437 + if ((card->para[0]) && (card->para[0] != (get_pcibase(tmp_hfcpci, 0) & PCI_BASE_ADDRESS_IO_MASK)))
6438 continue;
6439 else
6440 break;
6441 @@ -1729,7 +1751,7 @@ setup_hfcpci(struct IsdnCard *card)
6442 printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n");
6443 return (0);
6444 }
6445 - cs->hw.hfcpci.pci_io = (char *) dev_hfcpci->resource[ 1].start;
6446 + cs->hw.hfcpci.pci_io = (char *) get_pcibase(dev_hfcpci, 1);
6447 printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
6448 } else {
6449 printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
6450 @@ -1746,7 +1768,7 @@ setup_hfcpci(struct IsdnCard *card)
6451 printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
6452 return 0;
6453 }
6454 - cs->hw.hfcpci.fifos = (void *)
6455 + (ulong) cs->hw.hfcpci.fifos =
6456 (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
6457 pcibios_write_config_dword(cs->hw.hfcpci.pci_bus,
6458 cs->hw.hfcpci.pci_device_fn, 0x80,
6459 --- a/drivers/isdn/hisax/hfc_pci.h
6460 +++ b/drivers/isdn/hisax/hfc_pci.h
6461 @@ -1,4 +1,4 @@
6462 -/* $Id: hfc_pci.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6463 +/* $Id: hfc_pci.h,v 1.10 2001/09/24 13:22:56 kai Exp $
6464 *
6465 * specific defines for CCD's HFC 2BDS0 PCI chips
6466 *
6467 --- a/drivers/isdn/hisax/hfc_sx.c
6468 +++ b/drivers/isdn/hisax/hfc_sx.c
6469 @@ -1,4 +1,4 @@
6470 -/* $Id: hfc_sx.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6471 +/* $Id: hfc_sx.c,v 1.12 2001/09/24 13:22:56 kai Exp $
6472 *
6473 * level driver for CCD´s hfc-s+/sp based cards
6474 *
6475 @@ -17,11 +17,10 @@
6476 #include "hfc_sx.h"
6477 #include "isdnl1.h"
6478 #include <linux/interrupt.h>
6479 -#include <linux/isapnp.h>
6480
6481 extern const char *CardType[];
6482
6483 -static const char *hfcsx_revision = "$Revision: 1.1.4.1 $";
6484 +static const char *hfcsx_revision = "$Revision: 1.12 $";
6485
6486 /***************************************/
6487 /* IRQ-table for CCDs demo board */
6488 @@ -940,6 +939,20 @@ hfcsx_interrupt(int intno, void *dev_id,
6489 static void
6490 hfcsx_dbusy_timer(struct IsdnCardState *cs)
6491 {
6492 +#if 0
6493 + struct PStack *stptr;
6494 + if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
6495 + if (cs->debug)
6496 + debugl1(cs, "D-Channel Busy");
6497 + test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags);
6498 + stptr = cs->stlist;
6499 +
6500 + while (stptr != NULL) {
6501 + stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL);
6502 + stptr = stptr->next;
6503 + }
6504 + }
6505 +#endif
6506 }
6507
6508 /*************************************/
6509 @@ -1333,6 +1346,17 @@ hfcsx_bh(struct IsdnCardState *cs)
6510 */
6511 if (!cs)
6512 return;
6513 +#if 0
6514 + if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) {
6515 + if (cs->debug)
6516 + debugl1(cs, "D-Channel Busy cleared");
6517 + stptr = cs->stlist;
6518 + while (stptr != NULL) {
6519 + stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL);
6520 + stptr = stptr->next;
6521 + }
6522 + }
6523 +#endif
6524 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
6525 if (!cs->hw.hfcsx.nt_mode)
6526 switch (cs->dc.hfcsx.ph_state) {
6527 @@ -1461,17 +1485,7 @@ hfcsx_card_msg(struct IsdnCardState *cs,
6528 return (0);
6529 }
6530
6531 -#ifdef __ISAPNP__
6532 -static struct isapnp_device_id hfc_ids[] __initdata = {
6533 - { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620),
6534 - ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620),
6535 - (unsigned long) "Teles 16.3c2" },
6536 - { 0, }
6537 -};
6538
6539 -static struct isapnp_device_id *hdev = &hfc_ids[0];
6540 -static struct pci_bus *pnp_c __devinitdata = NULL;
6541 -#endif
6542
6543 int __devinit
6544 setup_hfcsx(struct IsdnCard *card)
6545 @@ -1482,45 +1496,6 @@ setup_hfcsx(struct IsdnCard *card)
6546
6547 strcpy(tmp, hfcsx_revision);
6548 printk(KERN_INFO "HiSax: HFC-SX driver Rev. %s\n", HiSax_getrev(tmp));
6549 -#ifdef __ISAPNP__
6550 - if (!card->para[1] && isapnp_present()) {
6551 - struct pci_bus *pb;
6552 - struct pci_dev *pd;
6553 -
6554 - while(hdev->card_vendor) {
6555 - if ((pb = isapnp_find_card(hdev->card_vendor,
6556 - hdev->card_device, pnp_c))) {
6557 - pnp_c = pb;
6558 - pd = NULL;
6559 - if ((pd = isapnp_find_dev(pnp_c,
6560 - hdev->vendor, hdev->function, pd))) {
6561 - printk(KERN_INFO "HiSax: %s detected\n",
6562 - (char *)hdev->driver_data);
6563 - pd->prepare(pd);
6564 - pd->deactivate(pd);
6565 - pd->activate(pd);
6566 - card->para[1] = pd->resource[0].start;
6567 - card->para[0] = pd->irq_resource[0].start;
6568 - if (!card->para[0] || !card->para[1]) {
6569 - printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n",
6570 - card->para[0], card->para[1]);
6571 - pd->deactivate(pd);
6572 - return(0);
6573 - }
6574 - break;
6575 - } else {
6576 - printk(KERN_ERR "HFC PnP: PnP error card found, no device\n");
6577 - }
6578 - }
6579 - hdev++;
6580 - pnp_c=NULL;
6581 - }
6582 - if (!hdev->card_vendor) {
6583 - printk(KERN_INFO "HFC PnP: no ISAPnP card found\n");
6584 - return(0);
6585 - }
6586 - }
6587 -#endif
6588 cs->hw.hfcsx.base = card->para[1] & 0xfffe;
6589 cs->irq = card->para[0];
6590 cs->hw.hfcsx.int_s1 = 0;
6591 @@ -1603,3 +1578,7 @@ setup_hfcsx(struct IsdnCard *card)
6592 cs->auxcmd = &hfcsx_auxcmd;
6593 return (1);
6594 }
6595 +
6596 +
6597 +
6598 +
6599 --- a/drivers/isdn/hisax/hfc_sx.h
6600 +++ b/drivers/isdn/hisax/hfc_sx.h
6601 @@ -1,4 +1,4 @@
6602 -/* $Id: hfc_sx.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6603 +/* $Id$
6604 *
6605 * specific defines for CCD's HFC 2BDS0 S+,SP chips
6606 *
6607 --- /dev/null
6608 +++ b/drivers/isdn/hisax/hfc_usb.c
6609 @@ -0,0 +1,1189 @@
6610 +/* $Id: hfc_usb.c,v 2.3 2001/07/06 21:30:11 werner Exp $
6611 + *
6612 + *
6613 + *
6614 + * Author (C) 2001 Werner Cornelius (werner@isdn-development.de)
6615 + * modular driver for Colognechip HFC-USB chip
6616 + * as plugin for HiSax isdn driver
6617 + * type approval valid for HFC-S USB based TAs
6618 + *
6619 + * Copyright 2001 by Werner Cornelius (werner@isdn-development.de)
6620 + *
6621 + * This program is free software; you can redistribute it and/or modify
6622 + * it under the terms of the GNU General Public License as published by
6623 + * the Free Software Foundation; either version 2, or (at your option)
6624 + * any later version.
6625 + *
6626 + * This program is distributed in the hope that it will be useful,
6627 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6628 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6629 + * GNU General Public License for more details.
6630 + *
6631 + * You should have received a copy of the GNU General Public License
6632 + * along with this program; if not, write to the Free Software
6633 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6634 + *
6635 + */
6636 +
6637 +#include <linux/types.h>
6638 +#include <linux/stddef.h>
6639 +#include <linux/timer.h>
6640 +#include <linux/config.h>
6641 +#include <linux/isdn_compat.h>
6642 +#include <linux/init.h>
6643 +#include "hisax.h"
6644 +#include <linux/module.h>
6645 +#include <linux/kernel_stat.h>
6646 +#include <linux/tqueue.h>
6647 +#include <linux/usb.h>
6648 +#include <linux/kernel.h>
6649 +#include <linux/smp_lock.h>
6650 +#include <linux/sched.h>
6651 +#include "hisax_loadable.h"
6652 +
6653 +#define INCLUDE_INLINE_FUNCS
6654 +
6655 +/***********/
6656 +/* defines */
6657 +/***********/
6658 +#define HFC_CTRL_TIMEOUT 5 /* 5ms timeout writing/reading regs */
6659 +#define HFC_TIMER_T3 7000 /* timeout for l1 activation timer */
6660 +
6661 +#define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */
6662 +#define HFCUSB_L1_DRX 1 /* D-frame received */
6663 +#define HFCUSB_L1_ERX 2 /* E-frame received */
6664 +#define HFCUSB_L1_DTX 4 /* D-frames completed */
6665 +
6666 +#define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */
6667 +
6668 +#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
6669 +#define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
6670 +
6671 +#define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */
6672 +#define HFCUSB_CIRM 0x00 /* cirm register index */
6673 +#define HFCUSB_USB_SIZE 0x07 /* int length register */
6674 +#define HFCUSB_USB_SIZE_I 0x06 /* iso length register */
6675 +#define HFCUSB_F_CROSS 0x0b /* bit order register */
6676 +#define HFCUSB_CLKDEL 0x37 /* bit delay register */
6677 +#define HFCUSB_CON_HDLC 0xfa /* channel connect register */
6678 +#define HFCUSB_HDLC_PAR 0xfb
6679 +#define HFCUSB_SCTRL 0x31 /* S-bus control register (tx) */
6680 +#define HFCUSB_SCTRL_E 0x32 /* same for E and special funcs */
6681 +#define HFCUSB_SCTRL_R 0x33 /* S-bus control register (rx) */
6682 +#define HFCUSB_F_THRES 0x0c /* threshold register */
6683 +#define HFCUSB_FIFO 0x0f /* fifo select register */
6684 +#define HFCUSB_F_USAGE 0x1a /* fifo usage register */
6685 +#define HFCUSB_MST_MODE0 0x14
6686 +#define HFCUSB_MST_MODE1 0x15
6687 +#define HFCUSB_P_DATA 0x1f
6688 +#define HFCUSB_INC_RES_F 0x0e
6689 +#define HFCUSB_STATES 0x30
6690 +
6691 +#define HFCUSB_CHIPID 0x40 /* ID value of HFC-USB */
6692 +
6693 +/******************/
6694 +/* fifo registers */
6695 +/******************/
6696 +#define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */
6697 +#define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */
6698 +#define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */
6699 +#define HFCUSB_B2_TX 2
6700 +#define HFCUSB_B2_RX 3
6701 +#define HFCUSB_D_TX 4
6702 +#define HFCUSB_D_RX 5
6703 +#define HFCUSB_PCM_TX 6
6704 +#define HFCUSB_PCM_RX 7
6705 +
6706 +/************/
6707 +/* LED mask */
6708 +/************/
6709 +#define LED_DRIVER 0x1
6710 +#define LED_L1 0x2
6711 +#define LED_BCH 0x4
6712 +
6713 +/**********/
6714 +/* macros */
6715 +/**********/
6716 +#define Write_hfc(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),0,0,HFC_CTRL_TIMEOUT)
6717 +#define Read_hfc(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
6718 +
6719 +#ifdef COMPAT_HAS_USB_IDTAB
6720 +/****************************************/
6721 +/* data defining the devices to be used */
6722 +/****************************************/
6723 +static __devinitdata const struct usb_device_id hfc_usb_idtab[3] = {
6724 + {USB_DEVICE(0x959, 0x2bd0)}, /* Colognechip ROM */
6725 + {USB_DEVICE(0x7b0, 0x0006)}, /* USB TA 128 */
6726 + {} /* end with an all-zeroes entry */
6727 +};
6728 +#endif
6729 +
6730 +/*************************************************/
6731 +/* entry and size of output/input control buffer */
6732 +/*************************************************/
6733 +#define HFC_CTRL_BUFSIZE 32
6734 +typedef struct {
6735 + __u8 hfc_reg; /* register number */
6736 + __u8 reg_val; /* value to be written (or read) */
6737 +} ctrl_buft;
6738 +
6739 +/***************************************************************/
6740 +/* structure defining input+output fifos (interrupt/bulk mode) */
6741 +/***************************************************************/
6742 +struct hfcusb_data; /* forward definition */
6743 +typedef struct {
6744 + int fifonum; /* fifo index attached to this structure */
6745 + __u8 fifo_mask; /* mask for this fifo */
6746 + int active; /* fifo is currently active */
6747 + struct hfcusb_data *hfc; /* pointer to main structure */
6748 + int pipe; /* address of endpoint */
6749 + __u8 usb_maxlen; /* maximum length for usb transfer */
6750 + int max_size; /* maximum size of receive/send packet */
6751 + int transmode; /* transparent mode selected */
6752 + int framenum; /* number of frame when last tx completed */
6753 + int rx_offset; /* offset inside rx buffer */
6754 + int next_complete; /* complete marker */
6755 + __u8 *act_ptr; /* pointer to next data */
6756 + __u8 intervall; /* interrupt interval */
6757 + struct sk_buff *buff; /* actual used buffer */
6758 + urb_t urb; /* transfer structure for usb routines */
6759 + __u8 buffer[128]; /* buffer incoming/outgoing data */
6760 +} usb_fifo;
6761 +
6762 +/*********************************************/
6763 +/* structure holding all data for one device */
6764 +/*********************************************/
6765 +typedef struct hfcusb_data {
6766 + struct hisax_drvreg regd; /* register data and callbacks */
6767 + struct usb_device *dev; /* our device */
6768 + int if_used; /* used interface number */
6769 + int alt_used; /* used alternate config */
6770 + int ctrl_paksize; /* control pipe packet size */
6771 + int ctrl_in_pipe, ctrl_out_pipe; /* handles for control pipe */
6772 +
6773 + /* control pipe background handling */
6774 + ctrl_buft ctrl_buff[HFC_CTRL_BUFSIZE]; /* buffer holding queued data */
6775 + volatile int ctrl_in_idx, ctrl_out_idx, ctrl_cnt; /* input/output pointer + count */
6776 + urb_t ctrl_urb; /* transfer structure for control channel */
6777 + devrequest ctrl_write; /* buffer for control write request */
6778 + devrequest ctrl_read; /* same for read request */
6779 +
6780 + volatile __u8 dfifo_fill; /* value read from tx d-fifo */
6781 + volatile __u8 active_fifos; /* fifos currently active as bit mask */
6782 + volatile __u8 threshold_mask; /* threshold actually reported */
6783 + volatile __u8 service_request; /* fifo needs service from task */
6784 + volatile __u8 ctrl_fifo; /* last selected fifo */
6785 + volatile __u8 bch_enables; /* or mask for sctrl_r and sctrl register values */
6786 + volatile __u8 led_req; /* request status of adapters leds */
6787 + volatile __u8 led_act; /* active status of adapters leds */
6788 + usb_fifo fifos[HFCUSB_NUM_FIFOS]; /* structure holding all fifo data */
6789 +
6790 + /* layer 1 activation/deactivation handling */
6791 + volatile __u8 l1_state; /* actual l1 state */
6792 + volatile ulong l1_event; /* event mask */
6793 + struct tq_struct l1_tq; /* l1 bh structure */
6794 + struct timer_list t3_timer; /* timer for activation/deactivation */
6795 + struct timer_list t4_timer; /* timer for activation/deactivation */
6796 +} hfcusb_data;
6797 +
6798 +#if 0
6799 +static void
6800 +usb_dump_urb(purb_t purb)
6801 +{
6802 + printk("urb :%p\n", purb);
6803 + printk("next :%p\n", purb->next);
6804 + printk("dev :%p\n", purb->dev);
6805 + printk("pipe :%08X\n", purb->pipe);
6806 + printk("status :%d\n", purb->status);
6807 + printk("transfer_flags :%08X\n", purb->transfer_flags);
6808 + printk("transfer_buffer :%p\n", purb->transfer_buffer);
6809 + printk("transfer_buffer_length:%d\n",
6810 + purb->transfer_buffer_length);
6811 + printk("actual_length :%d\n", purb->actual_length);
6812 + printk("setup_packet :%p\n", purb->setup_packet);
6813 + printk("start_frame :%d\n", purb->start_frame);
6814 + printk("number_of_packets :%d\n", purb->number_of_packets);
6815 + printk("interval :%d\n", purb->interval);
6816 + printk("error_count :%d\n", purb->error_count);
6817 + printk("context :%p\n", purb->context);
6818 + printk("complete :%p\n", purb->complete);
6819 +}
6820 +#endif
6821 +
6822 +/*************************************************************************/
6823 +/* bottom half handler for L1 activation/deactiavtaion + D-chan + E-chan */
6824 +/*************************************************************************/
6825 +static void
6826 +usb_l1d_bh(hfcusb_data * hfc)
6827 +{
6828 +
6829 + while (hfc->l1_event) {
6830 + if (test_and_clear_bit
6831 + (HFCUSB_L1_STATECHANGE, &hfc->l1_event)) {
6832 + if (hfc->l1_state == 7)
6833 + hfc->led_req |= LED_L1;
6834 + else
6835 + hfc->led_req &= ~LED_L1;
6836 + if ((hfc->l1_state == 7) ||
6837 + (hfc->l1_state == 3))
6838 + hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6839 + (hfc->l1_state ==
6840 + 7) ? (PH_ACTIVATE |
6841 + INDICATION)
6842 + : (PH_DEACTIVATE | INDICATION),
6843 + NULL);
6844 + }
6845 + if (test_and_clear_bit(HFCUSB_L1_DRX, &hfc->l1_event)) {
6846 + hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6847 + PH_DATA | INDICATION,
6848 + (void *) 0);
6849 + }
6850 + if (test_and_clear_bit(HFCUSB_L1_ERX, &hfc->l1_event)) {
6851 + hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6852 + PH_DATA | INDICATION,
6853 + (void *) 1);
6854 + }
6855 + if (test_and_clear_bit(HFCUSB_L1_DTX, &hfc->l1_event)) {
6856 + hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6857 + PH_DATA | CONFIRM, NULL);
6858 + }
6859 + } /* while */
6860 +} /* usb_l1d_bh */
6861 +
6862 +/******************************************************/
6863 +/* start next background transfer for control channel */
6864 +/******************************************************/
6865 +static void
6866 +ctrl_start_transfer(hfcusb_data * hfc)
6867 +{
6868 +
6869 + if (hfc->ctrl_cnt) {
6870 + switch (hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg) {
6871 + case HFCUSB_F_USAGE:
6872 + hfc->ctrl_urb.pipe = hfc->ctrl_in_pipe;
6873 + hfc->ctrl_urb.setup_packet =
6874 + (u_char *) & hfc->ctrl_read;
6875 + hfc->ctrl_urb.transfer_buffer_length = 1;
6876 + hfc->ctrl_read.index =
6877 + hfc->ctrl_buff[hfc->ctrl_out_idx].
6878 + hfc_reg;
6879 + hfc->ctrl_urb.transfer_buffer =
6880 + (char *) &hfc->dfifo_fill;
6881 + break;
6882 +
6883 + default: /* write register */
6884 + hfc->ctrl_urb.pipe = hfc->ctrl_out_pipe;
6885 + hfc->ctrl_urb.setup_packet =
6886 + (u_char *) & hfc->ctrl_write;
6887 + hfc->ctrl_urb.transfer_buffer = NULL;
6888 + hfc->ctrl_urb.transfer_buffer_length = 0;
6889 + hfc->ctrl_write.index =
6890 + hfc->ctrl_buff[hfc->ctrl_out_idx].
6891 + hfc_reg;
6892 + hfc->ctrl_write.value =
6893 + hfc->ctrl_buff[hfc->ctrl_out_idx].
6894 + reg_val;
6895 + break;
6896 + }
6897 + usb_submit_urb(&hfc->ctrl_urb); /* start transfer */
6898 + }
6899 +} /* ctrl_start_transfer */
6900 +
6901 +/************************************/
6902 +/* queue a control transfer request */
6903 +/* return 0 on success. */
6904 +/************************************/
6905 +static int
6906 +queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val)
6907 +{
6908 + ctrl_buft *buf;
6909 +
6910 + if (hfc->ctrl_cnt >= HFC_CTRL_BUFSIZE)
6911 + return (1); /* no space left */
6912 + buf = hfc->ctrl_buff + hfc->ctrl_in_idx; /* pointer to new index */
6913 + buf->hfc_reg = reg;
6914 + buf->reg_val = val;
6915 + if (++hfc->ctrl_in_idx >= HFC_CTRL_BUFSIZE)
6916 + hfc->ctrl_in_idx = 0; /* pointer wrap */
6917 + if (++hfc->ctrl_cnt == 1)
6918 + ctrl_start_transfer(hfc);
6919 + return (0);
6920 +} /* queue_control_request */
6921 +
6922 +/**************************************/
6923 +/* called when timer t3 or t4 expires */
6924 +/**************************************/
6925 +static void
6926 +l1_timer_expire(hfcusb_data * hfc)
6927 +{
6928 + if (timer_pending(&hfc->t4_timer))
6929 + del_timer(&hfc->t4_timer);
6930 + queue_control_request(hfc, HFCUSB_STATES, 0x40);
6931 + test_and_set_bit(HFCUSB_L1_STATECHANGE,
6932 + &hfc->l1_event);
6933 + queue_task(&hfc->l1_tq, &tq_immediate);
6934 + mark_bh(IMMEDIATE_BH);
6935 +} /* l1_timer_expire */
6936 +
6937 +/**************************************************/
6938 +/* (re)fills a tx-fifo urb. Queuing is done later */
6939 +/**************************************************/
6940 +static void
6941 +fill_tx_urb(usb_fifo * fifo)
6942 +{
6943 + struct sk_buff *skb;
6944 + long flags;
6945 + int i, ii = 0;
6946 +
6947 + fifo->urb.dev = fifo->hfc->dev;
6948 + if ((fifo->buff)
6949 + && (fifo->urb.transfer_buffer_length < fifo->usb_maxlen)) {
6950 + switch (fifo->fifonum) {
6951 + case HFCUSB_B1_TX:
6952 + case HFCUSB_B2_TX:
6953 + skb = fifo->buff;
6954 + fifo->buff = NULL;
6955 + fifo->hfc->regd.bch_l1l2(fifo->hfc->regd.
6956 + arg_hisax,
6957 + (fifo->fifonum ==
6958 + HFCUSB_B1_TX) ? 0
6959 + : 1,
6960 + (PH_DATA |
6961 + CONFIRM),
6962 + (void *) skb);
6963 + fifo->hfc->service_request |=
6964 + fifo->fifo_mask;
6965 + return;
6966 + case HFCUSB_D_TX:
6967 + dev_kfree_skb_any(fifo->buff);
6968 + fifo->buff = NULL;
6969 + save_flags(flags);
6970 + cli();
6971 + fifo->hfc->dfifo_fill = 0xff; /* currently invalid data */
6972 + queue_control_request(fifo->hfc,
6973 + HFCUSB_FIFO,
6974 + HFCUSB_D_TX);
6975 + queue_control_request(fifo->hfc,
6976 + HFCUSB_F_USAGE, 0);
6977 + restore_flags(flags);
6978 + return;
6979 + default:
6980 + return; /* error, invalid fifo */
6981 + }
6982 + }
6983 +
6984 + /* check if new buffer needed */
6985 + if (!fifo->buff) {
6986 + switch (fifo->fifonum) {
6987 + case HFCUSB_B1_TX:
6988 + if (fifo->hfc->regd.bsk[0])
6989 + fifo->buff = *fifo->hfc->regd.bsk[0]; /* B1-channel tx buffer */
6990 + break;
6991 + case HFCUSB_B2_TX:
6992 + if (fifo->hfc->regd.bsk[1])
6993 + fifo->buff = *fifo->hfc->regd.bsk[1]; /* B2-channel tx buffer */
6994 + break;
6995 + case HFCUSB_D_TX:
6996 + if (fifo->hfc->regd.dsq)
6997 + fifo->buff = skb_dequeue(fifo->hfc->regd.dsq); /* D-channel tx queue */
6998 + break;
6999 + default:
7000 + return; /* error, invalid fifo */
7001 + }
7002 + if (!fifo->buff) {
7003 + fifo->active = 0; /* we are inactive now */
7004 + fifo->hfc->active_fifos &= ~fifo->fifo_mask;
7005 + if (fifo->fifonum == HFCUSB_D_TX) {
7006 + test_and_set_bit(HFCUSB_L1_DTX,
7007 + &fifo->hfc->l1_event);
7008 + queue_task(&fifo->hfc->l1_tq,
7009 + &tq_immediate);
7010 + mark_bh(IMMEDIATE_BH);
7011 + }
7012 + return;
7013 + }
7014 + fifo->act_ptr = fifo->buff->data; /* start of data */
7015 + fifo->active = 1;
7016 + ii = 1;
7017 + fifo->hfc->active_fifos |= fifo->fifo_mask;
7018 + fifo->hfc->service_request &= ~fifo->fifo_mask;
7019 + }
7020 + /* fillup the send buffer */
7021 + i = fifo->buff->len - (fifo->act_ptr - fifo->buff->data); /* remaining length */
7022 + fifo->buffer[0] = !fifo->transmode; /* not eof */
7023 + if (i > (fifo->usb_maxlen - ii)) {
7024 + i = fifo->usb_maxlen - ii;
7025 + }
7026 + if (i)
7027 + memcpy(fifo->buffer + ii, fifo->act_ptr, i);
7028 + fifo->urb.transfer_buffer_length = i + ii;
7029 + fifo->rx_offset = ii;
7030 +} /* fill_tx_urb */
7031 +
7032 +/************************************************/
7033 +/* transmit completion routine for all tx fifos */
7034 +/************************************************/
7035 +static void
7036 +tx_complete(purb_t urb)
7037 +{
7038 + usb_fifo *fifo = (usb_fifo *) urb->context; /* pointer to our fifo */
7039 +
7040 + fifo->hfc->service_request &= ~fifo->fifo_mask; /* no further handling */
7041 + fifo->framenum = usb_get_current_frame_number(fifo->hfc->dev);
7042 +
7043 + /* check for deactivation or error */
7044 + if ((!fifo->active) || (urb->status)) {
7045 + fifo->hfc->active_fifos &= ~fifo->fifo_mask; /* we are inactive */
7046 + fifo->active = 0;
7047 + if ((fifo->buff) && (fifo->fifonum == HFCUSB_D_TX)) {
7048 + dev_kfree_skb_any(fifo->buff);
7049 + }
7050 + fifo->buff = NULL;
7051 + return;
7052 + }
7053 + fifo->act_ptr += (urb->transfer_buffer_length - fifo->rx_offset); /* adjust pointer */
7054 + fill_tx_urb(fifo); /* refill the urb */
7055 + fifo->hfc->threshold_mask |= fifo->fifo_mask; /* assume threshold reached */
7056 + if (fifo->buff)
7057 + fifo->hfc->service_request |= fifo->fifo_mask; /* need to restart */
7058 +} /* tx_complete */
7059 +
7060 +/***********************************************/
7061 +/* receive completion routine for all rx fifos */
7062 +/***********************************************/
7063 +static void
7064 +rx_complete(purb_t urb)
7065 +{
7066 + usb_fifo *fifo = (usb_fifo *) urb->context; /* pointer to our fifo */
7067 + hfcusb_data *hfc = fifo->hfc;
7068 + usb_fifo *txfifo;
7069 + __u8 last_state;
7070 + int i, ii, currcnt, hdlci;
7071 + struct sk_buff *skb;
7072 +
7073 + urb->dev = hfc->dev; /* security init */
7074 + if ((!fifo->active) || (urb->status)) {
7075 + hfc->service_request &= ~fifo->fifo_mask; /* no further handling */
7076 + hfc->active_fifos &= ~fifo->fifo_mask; /* we are inactive */
7077 + fifo->urb.interval = 0; /* cancel automatic rescheduling */
7078 + if (fifo->buff) {
7079 + dev_kfree_skb_any(fifo->buff);
7080 + fifo->buff = NULL;
7081 + }
7082 + return;
7083 + }
7084 +
7085 + /* first check for any status changes */
7086 + if ((urb->actual_length < fifo->rx_offset)
7087 + || (urb->actual_length > fifo->usb_maxlen))
7088 + return; /* error condition */
7089 +
7090 + if (fifo->rx_offset) {
7091 + hfc->threshold_mask = fifo->buffer[1]; /* update threshold status */
7092 + fifo->next_complete = fifo->buffer[0] & 1;
7093 + if ((fifo->fifonum == HFCUSB_D_RX) &&
7094 + (hfc->led_req != hfc->led_act))
7095 + queue_control_request(hfc, HFCUSB_P_DATA, hfc->led_req);
7096 +
7097 + /* check if rescheduling needed */
7098 + if ((i =
7099 + hfc->service_request & hfc->active_fifos & ~hfc->
7100 + threshold_mask)) {
7101 + currcnt =
7102 + usb_get_current_frame_number(hfc->dev);
7103 + txfifo = hfc->fifos + HFCUSB_B1_TX;
7104 + ii = 3;
7105 + while (ii--) {
7106 + if ((i & txfifo->fifo_mask)
7107 + && (currcnt != txfifo->framenum)) {
7108 + hfc->service_request &=
7109 + ~txfifo->fifo_mask;
7110 + if (!txfifo->buff)
7111 + fill_tx_urb(txfifo);
7112 + if (txfifo->buff)
7113 + usb_submit_urb(&txfifo->
7114 + urb);
7115 + }
7116 + txfifo += 2;
7117 + }
7118 + }
7119 +
7120 + /* handle l1 events */
7121 + if ((fifo->buffer[0] >> 4) != hfc->l1_state) {
7122 + last_state = hfc->l1_state;
7123 + hfc->l1_state = fifo->buffer[0] >> 4; /* update status */
7124 + if (timer_pending(&hfc->t4_timer))
7125 + del_timer(&hfc->t4_timer);
7126 + if (((hfc->l1_state == 3) &&
7127 + ((last_state == 7) ||
7128 + (last_state == 8))) ||
7129 + ((timer_pending(&hfc->t3_timer) &&
7130 + (hfc->l1_state == 8)))) {
7131 + hfc->t4_timer.expires = jiffies + 2;
7132 + add_timer(&hfc->t4_timer);
7133 + } else {
7134 + if (timer_pending(&hfc->t3_timer)
7135 + && (hfc->l1_state == 7))
7136 + del_timer(&hfc->t3_timer); /* no longer needed */
7137 + test_and_set_bit(HFCUSB_L1_STATECHANGE,
7138 + &hfc->l1_event);
7139 + queue_task(&hfc->l1_tq, &tq_immediate);
7140 + mark_bh(IMMEDIATE_BH);
7141 + }
7142 + }
7143 + }
7144 +
7145 + /* check the length for data and move if present */
7146 + if (fifo->next_complete || (urb->actual_length > fifo->rx_offset)) {
7147 + i = fifo->buff->len + urb->actual_length - fifo->rx_offset; /* new total length */
7148 + hdlci = (fifo->transmode) ? 0 : 3;
7149 + if (i <= (fifo->max_size + hdlci)) {
7150 + memcpy(fifo->act_ptr,
7151 + fifo->buffer + fifo->rx_offset,
7152 + urb->actual_length - fifo->rx_offset);
7153 + fifo->act_ptr +=
7154 + (urb->actual_length - fifo->rx_offset);
7155 + fifo->buff->len +=
7156 + (urb->actual_length - fifo->rx_offset);
7157 + } else
7158 + fifo->buff->len = fifo->max_size + 4; /* mark frame as to long */
7159 + if (fifo->next_complete && (urb->actual_length < fifo->usb_maxlen)) {
7160 + /* the frame is complete */
7161 + fifo->next_complete = 0;
7162 + if (((!*(fifo->act_ptr - 1)) || fifo->transmode) &&
7163 + (fifo->buff->len >= (hdlci + 1))
7164 + && (fifo->buff->len <=
7165 + (fifo->max_size + hdlci)) &&
7166 + ((skb = dev_alloc_skb(fifo->max_size + hdlci)) != NULL)) {
7167 + fifo->buff->len -= hdlci; /* adjust size */
7168 + switch (fifo->fifonum) {
7169 + case HFCUSB_D_RX:
7170 + skb_queue_tail(hfc->regd.
7171 + drq,
7172 + fifo->buff);
7173 + test_and_set_bit
7174 + (HFCUSB_L1_DRX,
7175 + &hfc->l1_event);
7176 + queue_task(&hfc->l1_tq,
7177 + &tq_immediate);
7178 + mark_bh(IMMEDIATE_BH);
7179 + break;
7180 +
7181 + case HFCUSB_B1_RX:
7182 + if (hfc->regd.brq[0]) {
7183 + skb_queue_tail
7184 + (hfc->regd.
7185 + brq[0],
7186 + fifo->buff);
7187 + hfc->regd.
7188 + bch_l1l2(hfc->
7189 + regd.
7190 + arg_hisax,
7191 + 0,
7192 + PH_DATA
7193 + |
7194 + INDICATION,
7195 + (void *)
7196 + fifo->
7197 + buff);
7198 + } else
7199 + dev_kfree_skb_any
7200 + (fifo->buff);
7201 + break;
7202 +
7203 + case HFCUSB_B2_RX:
7204 + if (hfc->regd.brq[1]) {
7205 + skb_queue_tail
7206 + (hfc->regd.
7207 + brq[1],
7208 + fifo->buff);
7209 + hfc->regd.
7210 + bch_l1l2(hfc->
7211 + regd.
7212 + arg_hisax,
7213 + 1,
7214 + PH_DATA
7215 + |
7216 + INDICATION,
7217 + (void
7218 + *)
7219 + fifo->
7220 + buff);
7221 + } else
7222 + dev_kfree_skb_any
7223 + (fifo->buff);
7224 + break;
7225 +
7226 + case HFCUSB_PCM_RX:
7227 + skb_queue_tail(&hfc->regd.
7228 + erq,
7229 + fifo->buff);
7230 + test_and_set_bit
7231 + (HFCUSB_L1_ERX,
7232 + &hfc->l1_event);
7233 + queue_task(&hfc->l1_tq,
7234 + &tq_immediate);
7235 + mark_bh(IMMEDIATE_BH);
7236 + break;
7237 +
7238 + default:
7239 + dev_kfree_skb_any(fifo->
7240 + buff);
7241 + break;
7242 + }
7243 + fifo->buff = skb;
7244 + }
7245 + fifo->buff->len = 0; /* reset counter */
7246 + fifo->act_ptr = fifo->buff->data; /* and pointer */
7247 + }
7248 + }
7249 + fifo->rx_offset = (urb->actual_length < fifo->usb_maxlen) ? 2 : 0;
7250 +} /* rx_complete */
7251 +
7252 +/***************************************************/
7253 +/* start the interrupt transfer for the given fifo */
7254 +/***************************************************/
7255 +static void
7256 +start_rx_fifo(usb_fifo * fifo)
7257 +{
7258 + if (fifo->buff)
7259 + return; /* still active */
7260 + if (!
7261 + (fifo->buff =
7262 + dev_alloc_skb(fifo->max_size + (fifo->transmode ? 0 : 3))))
7263 + return;
7264 + fifo->act_ptr = fifo->buff->data;
7265 + FILL_INT_URB(&fifo->urb, fifo->hfc->dev, fifo->pipe, fifo->buffer,
7266 + fifo->usb_maxlen, rx_complete, fifo, fifo->intervall);
7267 + fifo->next_complete = 0;
7268 + fifo->rx_offset = 2;
7269 + fifo->active = 1; /* must be marked active */
7270 + fifo->hfc->active_fifos |= fifo->fifo_mask;
7271 + if (usb_submit_urb(&fifo->urb)) {
7272 + fifo->active = 0;
7273 + fifo->hfc->active_fifos &= ~fifo->fifo_mask;
7274 + dev_kfree_skb_any(fifo->buff);
7275 + fifo->buff = NULL;
7276 + }
7277 +} /* start_rx_fifo */
7278 +
7279 +/***************************************************************/
7280 +/* control completion routine handling background control cmds */
7281 +/***************************************************************/
7282 +static void
7283 +ctrl_complete(purb_t urb)
7284 +{
7285 + hfcusb_data *hfc = (hfcusb_data *) urb->context;
7286 +
7287 + urb->dev = hfc->dev;
7288 + if (hfc->ctrl_cnt) {
7289 + switch (hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg) {
7290 + case HFCUSB_FIFO:
7291 + hfc->ctrl_fifo =
7292 + hfc->ctrl_buff[hfc->ctrl_out_idx].
7293 + reg_val;
7294 + break;
7295 + case HFCUSB_F_USAGE:
7296 + if (!hfc->dfifo_fill) {
7297 + fill_tx_urb(hfc->fifos +
7298 + HFCUSB_D_TX);
7299 + if (hfc->fifos[HFCUSB_D_TX].buff)
7300 + usb_submit_urb(&hfc->
7301 + fifos
7302 + [HFCUSB_D_TX].
7303 + urb);
7304 + } else {
7305 + queue_control_request(hfc,
7306 + HFCUSB_FIFO,
7307 + HFCUSB_D_TX);
7308 + queue_control_request(hfc,
7309 + HFCUSB_F_USAGE,
7310 + 0);
7311 + }
7312 + break;
7313 + case HFCUSB_SCTRL_R:
7314 + switch (hfc->ctrl_fifo) {
7315 + case HFCUSB_B1_RX:
7316 + if (hfc->bch_enables & 1)
7317 + start_rx_fifo(hfc->
7318 + fifos
7319 + +
7320 + HFCUSB_B1_RX);
7321 + break;
7322 + case HFCUSB_B2_RX:
7323 + if (hfc->bch_enables & 2)
7324 + start_rx_fifo(hfc->
7325 + fifos
7326 + +
7327 + HFCUSB_B2_RX);
7328 + break;
7329 + }
7330 + if (hfc->bch_enables & 3)
7331 + hfc->led_req |= LED_BCH;
7332 + else
7333 + hfc->led_req &= ~LED_BCH;
7334 + break;
7335 + case HFCUSB_P_DATA:
7336 + hfc->led_act =
7337 + hfc->ctrl_buff[hfc->ctrl_out_idx].
7338 + reg_val;
7339 + break;
7340 + }
7341 + hfc->ctrl_cnt--; /* decrement actual count */
7342 + if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE)
7343 + hfc->ctrl_out_idx = 0; /* pointer wrap */
7344 + ctrl_start_transfer(hfc); /* start next transfer */
7345 + }
7346 +} /* ctrl_complete */
7347 +
7348 +/*****************************************/
7349 +/* Layer 1 + D channel access from HiSax */
7350 +/*****************************************/
7351 +static void
7352 +hfcusb_l1_access(void *drvarg, int pr, void *arg)
7353 +{
7354 + hfcusb_data *hfc = (hfcusb_data *) drvarg;
7355 +
7356 + switch (pr) {
7357 + case (PH_DATA | REQUEST):
7358 + case (PH_PULL | INDICATION):
7359 + skb_queue_tail(hfc->regd.dsq,
7360 + (struct sk_buff *) arg);
7361 + if (!hfc->fifos[HFCUSB_D_TX].active
7362 + && !hfc->dfifo_fill) {
7363 + fill_tx_urb(hfc->fifos + HFCUSB_D_TX);
7364 + hfc->active_fifos |=
7365 + hfc->fifos[HFCUSB_D_TX].fifo_mask;
7366 + usb_submit_urb(&hfc->fifos[HFCUSB_D_TX].
7367 + urb);
7368 + }
7369 + break;
7370 + case (PH_ACTIVATE | REQUEST):
7371 + switch (hfc->l1_state) {
7372 + case 6:
7373 + case 8:
7374 + hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
7375 + (PH_DEACTIVATE |
7376 + INDICATION), NULL);
7377 +
7378 + break;
7379 + case 7:
7380 + hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
7381 + (PH_ACTIVATE |
7382 + INDICATION), NULL);
7383 +
7384 + break;
7385 + default:
7386 + queue_control_request(hfc, HFCUSB_STATES, 0x60); /* start activation */
7387 + hfc->t3_timer.expires =
7388 + jiffies + (HFC_TIMER_T3 * HZ) / 1000;
7389 + if (!timer_pending(&hfc->t3_timer))
7390 + add_timer(&hfc->t3_timer);
7391 + break;
7392 + }
7393 + break;
7394 +
7395 + case (PH_DEACTIVATE | REQUEST):
7396 + queue_control_request(hfc, HFCUSB_STATES, 0x40); /* start deactivation */
7397 + break;
7398 + default:
7399 + printk(KERN_INFO "unknown hfcusb l1_access 0x%x\n",
7400 + pr);
7401 + break;
7402 + }
7403 +} /* hfcusb_l1_access */
7404 +
7405 +/*******************************/
7406 +/* B channel access from HiSax */
7407 +/*******************************/
7408 +static void
7409 +hfcusb_bch_access(void *drvarg, int chan, int pr, void *arg)
7410 +{
7411 + hfcusb_data *hfc = (hfcusb_data *) drvarg;
7412 + usb_fifo *fifo = hfc->fifos + (chan ? HFCUSB_B2_TX : HFCUSB_B1_TX);
7413 + long flags;
7414 +
7415 + switch (pr) {
7416 + case (PH_DATA | REQUEST):
7417 + case (PH_PULL | INDICATION):
7418 + save_flags(flags);
7419 + cli();
7420 + if (!fifo->active) {
7421 + fill_tx_urb(fifo);
7422 + hfc->active_fifos |= fifo->fifo_mask;
7423 + usb_submit_urb(&fifo->urb);
7424 + }
7425 + restore_flags(flags);
7426 + break;
7427 + case (PH_ACTIVATE | REQUEST):
7428 + if (!((int) arg)) {
7429 + hfc->bch_enables &= ~(1 << chan);
7430 + if (fifo->active) {
7431 + fifo->active = 0;
7432 + usb_unlink_urb(&fifo->urb);
7433 + }
7434 + save_flags(flags);
7435 + cli();
7436 + queue_control_request(hfc, HFCUSB_FIFO,
7437 + fifo->fifonum);
7438 + queue_control_request(hfc,
7439 + HFCUSB_INC_RES_F, 2);
7440 + queue_control_request(hfc, HFCUSB_CON_HDLC,
7441 + 9);
7442 + queue_control_request(hfc, HFCUSB_SCTRL,
7443 + 0x40 +
7444 + hfc->bch_enables);
7445 + queue_control_request(hfc, HFCUSB_SCTRL_R,
7446 + hfc->bch_enables);
7447 + restore_flags(flags);
7448 + fifo++;
7449 + if (fifo->active) {
7450 + fifo->active = 0;
7451 + usb_unlink_urb(&fifo->urb);
7452 + }
7453 + return; /* fifo deactivated */
7454 + }
7455 + fifo->transmode = ((int) arg == L1_MODE_TRANS);
7456 + fifo->max_size =
7457 + ((fifo->transmode) ? fifo->
7458 + usb_maxlen : MAX_BCH_SIZE);
7459 + (fifo + 1)->transmode = fifo->transmode;
7460 + (fifo + 1)->max_size = fifo->max_size;
7461 + hfc->bch_enables |= (1 << chan);
7462 + save_flags(flags);
7463 + cli();
7464 + queue_control_request(hfc, HFCUSB_FIFO,
7465 + fifo->fifonum);
7466 + queue_control_request(hfc, HFCUSB_CON_HDLC,
7467 + ((!fifo->
7468 + transmode) ? 9 : 11));
7469 + queue_control_request(hfc, HFCUSB_INC_RES_F, 2);
7470 + queue_control_request(hfc, HFCUSB_SCTRL,
7471 + 0x40 + hfc->bch_enables);
7472 + if ((int) arg == L1_MODE_HDLC)
7473 + queue_control_request(hfc, HFCUSB_CON_HDLC,
7474 + 8);
7475 + queue_control_request(hfc, HFCUSB_FIFO,
7476 + fifo->fifonum + 1);
7477 + queue_control_request(hfc, HFCUSB_CON_HDLC,
7478 + ((!fifo->
7479 + transmode) ? 8 : 10));
7480 + queue_control_request(hfc, HFCUSB_INC_RES_F, 2);
7481 + queue_control_request(hfc, HFCUSB_SCTRL_R,
7482 + hfc->bch_enables);
7483 + restore_flags(flags);
7484 +
7485 + break;
7486 +
7487 + default:
7488 + printk(KERN_INFO
7489 + "unknown hfcusb bch_access chan %d 0x%x\n",
7490 + chan, pr);
7491 + break;
7492 + }
7493 +} /* hfcusb_bch_access */
7494 +
7495 +/***************************************************************************/
7496 +/* usb_init is called once when a new matching device is detected to setup */
7497 +/* main parmeters. It registers the driver at the main hisax module. */
7498 +/* on success 0 is returned. */
7499 +/***************************************************************************/
7500 +static int
7501 +usb_init(hfcusb_data * hfc)
7502 +{
7503 + usb_fifo *fifo;
7504 + int i;
7505 + u_char b;
7506 +
7507 + /* check the chip id */
7508 + if ((Read_hfc(hfc, HFCUSB_CHIP_ID, &b) != 1) ||
7509 + (b != HFCUSB_CHIPID)) {
7510 + printk(KERN_INFO "HFC-USB: Invalid chip id 0x%02x\n", b);
7511 + return (1);
7512 + }
7513 +
7514 + /* first set the needed config, interface and alternate */
7515 + usb_set_configuration(hfc->dev, 1);
7516 + usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used);
7517 +
7518 + /* init the led state request */
7519 + hfc->led_req = LED_DRIVER;
7520 +
7521 + /* now we initialise the chip */
7522 + Write_hfc(hfc, HFCUSB_CIRM, 0x10); /* aux = output, reset off */
7523 + Write_hfc(hfc, HFCUSB_P_DATA, 0); /* leds = off */
7524 + Write_hfc(hfc, HFCUSB_USB_SIZE,
7525 + (hfc->fifos[HFCUSB_B1_TX].usb_maxlen >> 3) |
7526 + ((hfc->fifos[HFCUSB_B1_RX].usb_maxlen >> 3) << 4));
7527 +
7528 + /* enable PCM/GCI master mode */
7529 + Write_hfc(hfc, HFCUSB_MST_MODE1, 0); /* set default values */
7530 + Write_hfc(hfc, HFCUSB_MST_MODE0, 1); /* enable master mode */
7531 +
7532 + /* init the fifos */
7533 + Write_hfc(hfc, HFCUSB_F_THRES, (HFCUSB_TX_THRESHOLD >> 3) |
7534 + ((HFCUSB_RX_THRESHOLD >> 3) << 4));
7535 +
7536 + for (i = 0, fifo = hfc->fifos + i; i < HFCUSB_NUM_FIFOS;
7537 + i++, fifo++) {
7538 + Write_hfc(hfc, HFCUSB_FIFO, i); /* select the desired fifo */
7539 +
7540 + fifo->transmode = 0; /* hdlc mode selected */
7541 + fifo->buff = NULL; /* init buffer pointer */
7542 + fifo->max_size =
7543 + (i <= HFCUSB_B2_RX) ? MAX_BCH_SIZE : MAX_DFRAME_LEN;
7544 + Write_hfc(hfc, HFCUSB_HDLC_PAR, ((i <= HFCUSB_B2_RX) ? 0 : 2)); /* data length */
7545 + Write_hfc(hfc, HFCUSB_CON_HDLC, ((i & 1) ? 0x08 : 0x09)); /* rx hdlc, tx fill 1 */
7546 + Write_hfc(hfc, HFCUSB_INC_RES_F, 2); /* reset the fifo */
7547 + }
7548 +
7549 + Write_hfc(hfc, HFCUSB_CLKDEL, 0x0f); /* clock delay value */
7550 + Write_hfc(hfc, HFCUSB_STATES, 3 | 0x10); /* set deactivated mode */
7551 + Write_hfc(hfc, HFCUSB_STATES, 3); /* enable state machine */
7552 +
7553 + Write_hfc(hfc, HFCUSB_SCTRL_R, 0); /* disable both B receivers */
7554 + Write_hfc(hfc, HFCUSB_SCTRL, 0x40); /* disable B transmitters + cap mode */
7555 +
7556 + /* init the l1 timer */
7557 + init_timer(&hfc->t3_timer);
7558 + hfc->t3_timer.data = (long) hfc;
7559 + hfc->t3_timer.function = (void *) l1_timer_expire;
7560 + hfc->t4_timer.data = (long) hfc;
7561 + hfc->t4_timer.function = (void *) l1_timer_expire;
7562 + hfc->l1_tq.routine = (void *) (void *) usb_l1d_bh;
7563 + hfc->l1_tq.sync = 0;
7564 + hfc->l1_tq.data = hfc;
7565 +
7566 + /* init the background control machinery */
7567 + hfc->ctrl_read.requesttype = 0xc0;
7568 + hfc->ctrl_read.request = 1;
7569 + hfc->ctrl_read.length = 1;
7570 + hfc->ctrl_write.requesttype = 0x40;
7571 + hfc->ctrl_write.request = 0;
7572 + hfc->ctrl_write.length = 0;
7573 + FILL_CONTROL_URB(&hfc->ctrl_urb, hfc->dev, hfc->ctrl_out_pipe,
7574 + (u_char *) & hfc->ctrl_write, NULL, 0,
7575 + ctrl_complete, hfc);
7576 +
7577 + /* init the TX-urbs */
7578 + fifo = hfc->fifos + HFCUSB_D_TX;
7579 + FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe,
7580 + (u_char *) fifo->buffer, 0, tx_complete, fifo);
7581 + fifo = hfc->fifos + HFCUSB_B1_TX;
7582 + FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe,
7583 + (u_char *) fifo->buffer, 0, tx_complete, fifo);
7584 + fifo = hfc->fifos + HFCUSB_B2_TX;
7585 + FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe,
7586 + (u_char *) fifo->buffer, 0, tx_complete, fifo);
7587 +
7588 + /* init the E-buffer */
7589 + skb_queue_head_init(&hfc->regd.erq);
7590 +
7591 + /* now register ourself at hisax */
7592 + hfc->regd.version = HISAX_LOAD_VERSION; /* set our version */
7593 + hfc->regd.cmd = HISAX_LOAD_REGISTER; /* register command */
7594 + hfc->regd.argl1 = (void *) hfc; /* argument for our local routine */
7595 + hfc->regd.dch_l2l1 = hfcusb_l1_access;
7596 + hfc->regd.bch_l2l1 = hfcusb_bch_access;
7597 + hfc->regd.drvname = "hfc_usb";
7598 + if (hisax_register_hfcusb(&hfc->regd)) {
7599 + printk(KERN_INFO "HFC-USB failed to register at hisax\n");
7600 + Write_hfc(hfc, HFCUSB_CIRM, 0x08); /* aux = input, reset on */
7601 + return (1);
7602 + }
7603 +
7604 + /* startup the D- and E-channel fifos */
7605 + start_rx_fifo(hfc->fifos + HFCUSB_D_RX); /* D-fifo */
7606 + if (hfc->fifos[HFCUSB_PCM_RX].pipe)
7607 + start_rx_fifo(hfc->fifos + HFCUSB_PCM_RX); /* E-fifo */
7608 +
7609 + return (0);
7610 +} /* usb_init */
7611 +
7612 +/*************************************************/
7613 +/* function called to probe a new plugged device */
7614 +/*************************************************/
7615 +static void *
7616 +hfc_usb_probe(struct usb_device *dev, unsigned int interface
7617 +#ifdef COMPAT_HAS_USB_IDTAB
7618 + , const struct usb_device_id *id_table)
7619 +#else
7620 + )
7621 +#endif
7622 +{
7623 + hfcusb_data *context;
7624 + struct usb_interface *ifp = dev->actconfig->interface + interface;
7625 + struct usb_interface_descriptor *ifdp =
7626 + ifp->altsetting + ifp->act_altsetting;
7627 + struct usb_endpoint_descriptor *epd;
7628 + int i, idx, ep_msk;
7629 +
7630 +#ifdef COMPAT_HAS_USB_IDTAB
7631 + if (id_table && (dev->descriptor.idVendor == id_table->idVendor) &&
7632 + (dev->descriptor.idProduct == id_table->idProduct) &&
7633 +#else
7634 + if ((((dev->descriptor.idVendor == 0x959) &&
7635 + (dev->descriptor.idProduct == 0x2bd0)) ||
7636 + ((dev->descriptor.idVendor == 0x7b0) &&
7637 + (dev->descriptor.idProduct == 0x0006))) &&
7638 +#endif
7639 + (ifdp->bNumEndpoints >= 6) && (ifdp->bNumEndpoints <= 16)) {
7640 + if (!(context = kmalloc(sizeof(hfcusb_data), GFP_KERNEL))) {
7641 + return (NULL); /* got no mem */
7642 + };
7643 + memset(context, 0, sizeof(hfcusb_data)); /* clear the structure */
7644 + i = ifdp->bNumEndpoints; /* get number of endpoints */
7645 + ep_msk = 0; /* none found */
7646 + epd = ifdp->endpoint; /* first endpoint descriptor */
7647 + while (i-- && ((ep_msk & 0xcf) != 0xcf)) {
7648 +
7649 + idx = (((epd->bEndpointAddress & 0x7f) - 1) << 1); /* get endpoint base */
7650 + if (idx < 7) {
7651 + switch (epd->bmAttributes) {
7652 + case USB_ENDPOINT_XFER_INT:
7653 + if (!
7654 + (epd->
7655 + bEndpointAddress &
7656 + 0x80))
7657 + break; /* only interrupt in allowed */
7658 + idx++; /* input index is odd */
7659 + context->fifos[idx].pipe =
7660 + usb_rcvintpipe(dev,
7661 + epd->
7662 + bEndpointAddress);
7663 + break;
7664 +
7665 + case USB_ENDPOINT_XFER_BULK:
7666 + if (epd->
7667 + bEndpointAddress &
7668 + 0x80)
7669 + break; /* only bulk out allowed */
7670 + context->fifos[idx].pipe =
7671 + usb_sndbulkpipe(dev,
7672 + epd->
7673 + bEndpointAddress);
7674 + break;
7675 + default:
7676 + context->fifos[idx].pipe = 0; /* reset data */
7677 + } /* switch attribute */
7678 +
7679 + if (context->fifos[idx].pipe) {
7680 + context->fifos[idx].fifonum = idx;
7681 + context->fifos[idx].fifo_mask =
7682 + 1 << idx;
7683 + context->fifos[idx].hfc = context;
7684 + context->fifos[idx].usb_maxlen =
7685 + epd->wMaxPacketSize;
7686 + context->fifos[idx].intervall =
7687 + epd->bInterval;
7688 + ep_msk |= (1 << idx);
7689 + } else
7690 + ep_msk &= ~(1 << idx);
7691 + } /* idx < 7 */
7692 + epd++;
7693 + }
7694 +
7695 + if ((ep_msk & 0x3f) != 0x3f) {
7696 + kfree(context);
7697 + return (NULL);
7698 + }
7699 + MOD_INC_USE_COUNT; /* lock our module */
7700 + context->dev = dev; /* save device */
7701 + context->if_used = interface; /* save used interface */
7702 + context->alt_used = ifp->act_altsetting; /* and alternate config */
7703 + context->ctrl_paksize = dev->descriptor.bMaxPacketSize0; /* control size */
7704 +
7705 + /* create the control pipes needed for register access */
7706 + context->ctrl_in_pipe = usb_rcvctrlpipe(context->dev, 0);
7707 + context->ctrl_out_pipe = usb_sndctrlpipe(context->dev, 0);
7708 +
7709 + /* init the chip and register the driver */
7710 + if (usb_init(context)) {
7711 + kfree(context);
7712 + MOD_DEC_USE_COUNT;
7713 + return (NULL);
7714 + }
7715 +
7716 + printk(KERN_INFO
7717 + "HFC-USB: New device if=%d alt=%d registered\n",
7718 + context->if_used, context->alt_used);
7719 + return (context);
7720 + }
7721 +
7722 + return (NULL); /* no matching entry */
7723 +} /* hfc_usb_probe */
7724 +
7725 +/****************************************************/
7726 +/* function called when an active device is removed */
7727 +/****************************************************/
7728 +static void
7729 +hfc_usb_disconnect(struct usb_device *usbdev, void *drv_context)
7730 +{
7731 + hfcusb_data *context = drv_context;
7732 + int i;
7733 + struct sk_buff *skb;
7734 +
7735 + /* tell all fifos to terminate */
7736 + for (i = 0; i < HFCUSB_NUM_FIFOS; i++)
7737 + if (context->fifos[i].active) {
7738 + context->fifos[i].active = 0;
7739 + usb_unlink_urb(&context->fifos[i].urb);
7740 + }
7741 + while (context->active_fifos) {
7742 + set_current_state(TASK_INTERRUPTIBLE);
7743 + /* Timeout 10ms */
7744 + schedule_timeout((10 * HZ) / 1000);
7745 + }
7746 + if (timer_pending(&context->t3_timer))
7747 + del_timer(&context->t3_timer);
7748 + context->regd.release_driver(context->regd.arg_hisax);
7749 + while ((skb = skb_dequeue(&context->regd.erq)) != NULL)
7750 + dev_kfree_skb_any(skb);
7751 +
7752 + kfree(context); /* free our structure again */
7753 + MOD_DEC_USE_COUNT; /* and decrement the usage counter */
7754 +} /* hfc_usb_disconnect */
7755 +
7756 +/************************************/
7757 +/* our driver information structure */
7758 +/************************************/
7759 +static struct usb_driver hfc_drv = {
7760 + name:"hfc_usb",
7761 +#ifdef COMPAT_HAS_USB_IDTAB
7762 + id_table:hfc_usb_idtab,
7763 +#endif
7764 + probe:hfc_usb_probe,
7765 + disconnect:hfc_usb_disconnect,
7766 +};
7767 +
7768 +static void __exit
7769 +hfc_usb_exit(void)
7770 +{
7771 +
7772 + usb_deregister(&hfc_drv); /* release our driver */
7773 + printk(KERN_INFO "HFC-USB module removed\n");
7774 +}
7775 +
7776 +static int __init
7777 +hfc_usb_init(void)
7778 +{
7779 + struct hisax_drvreg drv;
7780 +
7781 + drv.version = HISAX_LOAD_VERSION; /* set our version */
7782 + drv.cmd = HISAX_LOAD_CHKVER; /* check command only */
7783 + if (hisax_register_hfcusb(&drv)) {
7784 + printk(KERN_INFO "HFC-USB <-> hisax version conflict\n");
7785 + return (-1); /* unable to register */
7786 + }
7787 + if (usb_register(&hfc_drv)) {
7788 + printk(KERN_INFO
7789 + "Unable to register HFC-USB module at usb stack\n");
7790 + return (-1); /* unable to register */
7791 + }
7792 +
7793 + printk(KERN_INFO "HFC-USB module loaded\n");
7794 + return (0);
7795 +}
7796 +
7797 +module_init(hfc_usb_init);
7798 +module_exit(hfc_usb_exit);
7799 --- /dev/null
7800 +++ b/drivers/isdn/hisax/hfc_usbr.c
7801 @@ -0,0 +1,471 @@
7802 +/* $Id: hfc_usbr.c,v 2.5 2001/07/06 21:30:11 werner Exp $
7803 +
7804 + * hfc_usb.c low level driver for CCD´s hfc-usb single chip controllers
7805 + * type approval valid for HFC-S USB based TAs
7806 + *
7807 + * Author Werner Cornelius (werner@isdn-development.de)
7808 + *
7809 + * Copyright 2001 by Werner Cornelius (werner@isdn4linux.de)
7810 + *
7811 + * This program is free software; you can redistribute it and/or modify
7812 + * it under the terms of the GNU General Public License as published by
7813 + * the Free Software Foundation; either version 2, or (at your option)
7814 + * any later version.
7815 + *
7816 + * This program is distributed in the hope that it will be useful,
7817 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7818 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7819 + * GNU General Public License for more details.
7820 + *
7821 + * You should have received a copy of the GNU General Public License
7822 + * along with this program; if not, write to the Free Software
7823 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7824 + *
7825 + */
7826 +
7827 +#define __NO_VERSION__
7828 +#include <linux/init.h>
7829 +#include "hisax.h"
7830 +#include "isdnl1.h"
7831 +#include "hisax_loadable.h"
7832 +
7833 +extern const char *CardType[];
7834 +
7835 +static const char *hfcusb_revision = "$Revision: 2.5 $";
7836 +
7837 +/*********************************/
7838 +/* schedule a new b_channel task */
7839 +/*********************************/
7840 +static void
7841 +hfcusb_sched_event(struct BCState *bcs, int event)
7842 +{
7843 + bcs->event |= 1 << event;
7844 + queue_task(&bcs->tqueue, &tq_immediate);
7845 + mark_bh(IMMEDIATE_BH);
7846 +}
7847 +
7848 +/************************************************/
7849 +/* select a b-channel entry matching and active */
7850 +/************************************************/
7851 +static
7852 +struct BCState *
7853 +Sel_BCS(struct IsdnCardState *cs, int channel)
7854 +{
7855 + if (cs->bcs[0].mode && (cs->bcs[0].channel == channel))
7856 + return (&cs->bcs[0]);
7857 + else if (cs->bcs[1].mode && (cs->bcs[1].channel == channel))
7858 + return (&cs->bcs[1]);
7859 + else
7860 + return (NULL);
7861 +}
7862 +
7863 +/**********************************************/
7864 +/* transfer function (D-channel from l2 to l1 */
7865 +/**********************************************/
7866 +static void
7867 +hfcusb_d_l2l1(struct PStack *st, int pr, void *arg)
7868 +{
7869 + struct IsdnCardState *cs = st->l1.hardware;
7870 + struct hisax_drvreg *drv = cs->hw.hfcusb.drv;
7871 +
7872 + if (drv) {
7873 + switch (pr) {
7874 + case (PH_DATA | REQUEST):
7875 + case (PH_PULL | INDICATION):
7876 + cs->hw.hfcusb.dch_tx_busy = 1;
7877 + break;
7878 + case (PH_PULL | REQUEST):
7879 + if (!cs->hw.hfcusb.dch_tx_busy) {
7880 + test_and_clear_bit(FLG_L1_PULL_REQ,
7881 + &st->l1.Flags);
7882 + st->l1.l1l2(st, PH_PULL | CONFIRM,
7883 + NULL);
7884 + } else
7885 + test_and_set_bit(FLG_L1_PULL_REQ,
7886 + &st->l1.Flags);
7887 + return;
7888 + }
7889 + drv->dch_l2l1(drv, pr, arg);
7890 + } else
7891 + debugl1(cs, "hfcusb l2l1 called without existing driver");
7892 +} /* hfcusb_d_l2l1 */
7893 +
7894 +/*****************************/
7895 +/* E-channel receive routine */
7896 +/*****************************/
7897 +static void
7898 +EChannel_proc_rcv(struct IsdnCardState *cs)
7899 +{
7900 + u_char *ptr;
7901 + struct sk_buff *skb;
7902 + struct hisax_drvreg *usbdrv =
7903 + (struct hisax_drvreg *) cs->hw.hfcusb.drv;
7904 +
7905 +
7906 + while ((skb = skb_dequeue(&usbdrv->erq)) != NULL) {
7907 + if (cs->debug & DEB_DLOG_HEX) {
7908 + ptr = cs->dlog;
7909 + if ((skb->len) < MAX_DLOG_SPACE / 3 - 10) {
7910 + *ptr++ = 'E';
7911 + *ptr++ = 'C';
7912 + *ptr++ = 'H';
7913 + *ptr++ = 'O';
7914 + *ptr++ = ':';
7915 + ptr += QuickHex(ptr, skb->data, skb->len);
7916 + ptr--;
7917 + *ptr++ = '\n';
7918 + *ptr = 0;
7919 + HiSax_putstatus(cs, NULL, cs->dlog);
7920 + } else
7921 + HiSax_putstatus(cs, "LogEcho: ",
7922 + "warning Frame too big (%d)",
7923 + skb->len);
7924 + }
7925 + dev_kfree_skb_any(skb);
7926 + }
7927 +}
7928 +
7929 +/******************************************/
7930 +/* transfer function called from L1 to L2 */
7931 +/******************************************/
7932 +static void
7933 +hfcusb_d_l1l2(void *cs1, int pr, void *arg)
7934 +{
7935 + struct IsdnCardState *cs = (struct IsdnCardState *) cs1;
7936 +
7937 + switch (pr) {
7938 + case (PH_DATA | INDICATION):
7939 + if (!((int) arg))
7940 + DChannel_proc_rcv(cs);
7941 + else
7942 + EChannel_proc_rcv(cs);
7943 + break;
7944 +
7945 + case (PH_DATA | CONFIRM):
7946 + cs->hw.hfcusb.dch_tx_busy = 0;
7947 + DChannel_proc_xmt(cs);
7948 + break;
7949 +
7950 + case (PH_ACTIVATE | INDICATION):
7951 + case (PH_ACTIVATE | CONFIRM):
7952 + cs->stlist->l1.l1l2(cs->stlist, pr, arg);
7953 + if (cs->debug & L1_DEB_ISAC)
7954 + debugl1(cs, "layer 1 activated");
7955 + break;
7956 +
7957 + case (PH_DEACTIVATE | INDICATION):
7958 + case (PH_DEACTIVATE | CONFIRM):
7959 + cs->stlist->l1.l1l2(cs->stlist, pr, arg);
7960 + if (cs->debug & L1_DEB_ISAC)
7961 + debugl1(cs, "layer 1 deactivated");
7962 + break;
7963 +
7964 + default:
7965 + debugl1(cs, "unknown l1 msg 0x%x ", pr);
7966 + }
7967 +} /* hfcusb_d_l1l2 */
7968 +
7969 +
7970 +/******************************************/
7971 +/* transfer function called from L1 to L2 */
7972 +/******************************************/
7973 +static void
7974 +hfcusb_b_l1l2(void *cs1, int chan, int pr, void *arg)
7975 +{
7976 + struct IsdnCardState *cs = (struct IsdnCardState *) cs1;
7977 + struct BCState *bcs = Sel_BCS(cs, chan);
7978 +
7979 + switch (pr) {
7980 + case (PH_DATA | INDICATION):
7981 + if (!bcs)
7982 + return;
7983 + hfcusb_sched_event(bcs, B_RCVBUFREADY);
7984 + break;
7985 +
7986 + case (PH_DATA | CONFIRM):
7987 + if (!bcs)
7988 + return;
7989 + bcs->tx_cnt -= bcs->tx_skb->len;
7990 + if (bcs->st->lli.l1writewakeup &&
7991 + (PACKET_NOACK != bcs->tx_skb->pkt_type))
7992 + bcs->st->lli.l1writewakeup(bcs->st,
7993 + bcs->tx_skb->
7994 + len);
7995 + dev_kfree_skb_any(bcs->tx_skb);
7996 + bcs->tx_skb = skb_dequeue(&bcs->squeue);
7997 + break;
7998 +
7999 + case (PH_ACTIVATE | INDICATION):
8000 + case (PH_ACTIVATE | CONFIRM):
8001 + cs->stlist->l1.l1l2(cs->stlist, pr, arg);
8002 + if (cs->debug & L1_DEB_ISAC)
8003 + debugl1(cs, "layer 1 activated");
8004 + break;
8005 +
8006 + case (PH_DEACTIVATE | INDICATION):
8007 + case (PH_DEACTIVATE | CONFIRM):
8008 + cs->stlist->l1.l1l2(cs->stlist, pr, arg);
8009 + if (cs->debug & L1_DEB_ISAC)
8010 + debugl1(cs, "layer 1 deactivated");
8011 + break;
8012 +
8013 + default:
8014 + debugl1(cs, "unknown l1 b msg 0x%x ", pr);
8015 + }
8016 +} /* hfcusb_b_l1l2 */
8017 +
8018 +
8019 +/***********************************************/
8020 +/* called during init setting l1 stack pointer */
8021 +/***********************************************/
8022 +void
8023 +setstack_hfcusb(struct PStack *st, struct IsdnCardState *cs)
8024 +{
8025 + st->l2.l2l1 = hfcusb_d_l2l1;
8026 +}
8027 +
8028 +/**************************************/
8029 +/* send B-channel data if not blocked */
8030 +/**************************************/
8031 +static void
8032 +hfcusb_send_data(struct BCState *bcs)
8033 +{
8034 + struct IsdnCardState *cs = bcs->cs;
8035 + struct hisax_drvreg *drv =
8036 + (struct hisax_drvreg *) cs->hw.hfcusb.drv;
8037 +
8038 + if (!drv)
8039 + return;
8040 + drv->bch_l2l1(drv->argl1, bcs->channel, PH_DATA | REQUEST,
8041 + bcs->tx_skb);
8042 +}
8043 +
8044 +/***************************************************************/
8045 +/* activate/deactivate hardware for selected channels and mode */
8046 +/***************************************************************/
8047 +void
8048 +mode_hfcusb(struct BCState *bcs, int mode, int bc)
8049 +{
8050 + struct IsdnCardState *cs = bcs->cs;
8051 + struct hisax_drvreg *drv = cs->hw.hfcusb.drv;
8052 +
8053 + if (!drv)
8054 + return;
8055 + if (cs->debug & L1_DEB_HSCX)
8056 + debugl1(cs, "HFCUSB bchannel mode %d bchan %d/%d",
8057 + mode, bc, bcs->channel);
8058 + bcs->mode = mode;
8059 + bcs->channel = bc;
8060 + if (mode) {
8061 + drv->bsk[bc] = &bcs->tx_skb;
8062 + drv->brq[bc] = &bcs->rqueue;
8063 + }
8064 + drv->bch_l2l1(drv->argl1, bc, PH_ACTIVATE | REQUEST,
8065 + (void *) mode);
8066 + if (!mode) {
8067 + drv->bsk[bc] = NULL;
8068 + drv->brq[bc] = NULL;
8069 + }
8070 +}
8071 +
8072 +/******************************/
8073 +/* Layer2 -> Layer 1 Transfer */
8074 +/******************************/
8075 +static void
8076 +hfcusb_b_l2l1(struct PStack *st, int pr, void *arg)
8077 +{
8078 + struct sk_buff *skb = arg;
8079 + struct hisax_drvreg *drv = st->l1.bcs->cs->hw.hfcusb.drv;
8080 + long flags;
8081 +
8082 + switch (pr) {
8083 + case (PH_DATA | REQUEST):
8084 + save_flags(flags);
8085 + cli();
8086 + if (st->l1.bcs->tx_skb) {
8087 + skb_queue_tail(&st->l1.bcs->squeue, skb);
8088 + restore_flags(flags);
8089 + } else {
8090 + st->l1.bcs->tx_skb = skb;
8091 + st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
8092 + restore_flags(flags);
8093 + }
8094 + break;
8095 + case (PH_PULL | INDICATION):
8096 + if (st->l1.bcs->tx_skb) {
8097 + printk(KERN_WARNING
8098 + "hfc_l2l1: this shouldn't happen\n");
8099 + break;
8100 + }
8101 + save_flags(flags);
8102 + cli();
8103 + st->l1.bcs->tx_skb = skb;
8104 + st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
8105 + restore_flags(flags);
8106 + break;
8107 + case (PH_PULL | REQUEST):
8108 + if (!st->l1.bcs->tx_skb) {
8109 + test_and_clear_bit(FLG_L1_PULL_REQ,
8110 + &st->l1.Flags);
8111 + st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
8112 + } else
8113 + test_and_set_bit(FLG_L1_PULL_REQ,
8114 + &st->l1.Flags);
8115 + break;
8116 + case (PH_ACTIVATE | REQUEST):
8117 + if (drv) {
8118 + test_and_set_bit(BC_FLG_ACTIV,
8119 + &st->l1.bcs->Flag);
8120 + mode_hfcusb(st->l1.bcs, st->l1.mode,
8121 + st->l1.bc);
8122 + l1_msg_b(st, pr, arg);
8123 + }
8124 + break;
8125 + case (PH_DEACTIVATE | REQUEST):
8126 + l1_msg_b(st, pr, arg);
8127 + break;
8128 + case (PH_DEACTIVATE | CONFIRM):
8129 + test_and_clear_bit(BC_FLG_ACTIV,
8130 + &st->l1.bcs->Flag);
8131 + test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
8132 + mode_hfcusb(st->l1.bcs, 0, st->l1.bc);
8133 + st->l1.l1l2(st, PH_DEACTIVATE | CONFIRM, NULL);
8134 + break;
8135 + }
8136 +}
8137 +
8138 +/******************************************/
8139 +/* deactivate B-channel access and queues */
8140 +/******************************************/
8141 +static void
8142 +close_hfcusb(struct BCState *bcs)
8143 +{
8144 + mode_hfcusb(bcs, 0, bcs->channel);
8145 + if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
8146 + skb_queue_purge(&bcs->rqueue);
8147 + skb_queue_purge(&bcs->squeue);
8148 + if (bcs->tx_skb) {
8149 + dev_kfree_skb_any(bcs->tx_skb);
8150 + bcs->tx_skb = NULL;
8151 + test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
8152 + }
8153 + }
8154 +}
8155 +
8156 +/*************************************/
8157 +/* init B-channel queues and control */
8158 +/*************************************/
8159 +static int
8160 +open_hfcusbstate(struct IsdnCardState *cs, struct BCState *bcs)
8161 +{
8162 + if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
8163 + skb_queue_head_init(&bcs->rqueue);
8164 + skb_queue_head_init(&bcs->squeue);
8165 + }
8166 + bcs->tx_skb = NULL;
8167 + test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
8168 + bcs->event = 0;
8169 + bcs->tx_cnt = 0;
8170 + return (0);
8171 +}
8172 +
8173 +/*********************************/
8174 +/* inits the stack for B-channel */
8175 +/*********************************/
8176 +static int
8177 +setstack_2b(struct PStack *st, struct BCState *bcs)
8178 +{
8179 + bcs->channel = st->l1.bc;
8180 + if (open_hfcusbstate(st->l1.hardware, bcs))
8181 + return (-1);
8182 + st->l1.bcs = bcs;
8183 + st->l2.l2l1 = hfcusb_b_l2l1;
8184 + setstack_manager(st);
8185 + bcs->st = st;
8186 + setstack_l1_B(st);
8187 + return (0);
8188 +}
8189 +
8190 +/********************************/
8191 +/* called for card init message */
8192 +/********************************/
8193 +void __devinit
8194 +inithfcusb(struct IsdnCardState *cs)
8195 +{
8196 + cs->setstack_d = setstack_hfcusb;
8197 + cs->BC_Send_Data = &hfcusb_send_data;
8198 + cs->bcs[0].BC_SetStack = setstack_2b;
8199 + cs->bcs[1].BC_SetStack = setstack_2b;
8200 + cs->bcs[0].BC_Close = close_hfcusb;
8201 + cs->bcs[1].BC_Close = close_hfcusb;
8202 + mode_hfcusb(cs->bcs, 0, 0);
8203 + mode_hfcusb(cs->bcs + 1, 0, 1);
8204 +}
8205 +
8206 +
8207 +
8208 +/*******************************************/
8209 +/* handle card messages from control layer */
8210 +/*******************************************/
8211 +static int
8212 +hfcusb_card_msg(struct IsdnCardState *cs, int mt, void *arg)
8213 +{
8214 + if (cs->debug & L1_DEB_ISAC)
8215 + debugl1(cs, "HFCUSB: card_msg %x", mt);
8216 + switch (mt) {
8217 + case CARD_INIT:
8218 + inithfcusb(cs);
8219 + return (0);
8220 + case CARD_RELEASE:
8221 + case CARD_RESET:
8222 + case CARD_TEST:
8223 + return (0);
8224 + }
8225 + return (0);
8226 +}
8227 +
8228 +
8229 +extern void
8230 + HiSax_closecard(int cardnr);
8231 +/*****************************/
8232 +/* release a driver instance */
8233 +/* called when hardware is */
8234 +/* no longer present. */
8235 +/*****************************/
8236 +static void
8237 +release_hfcdrv(void *arg)
8238 +{
8239 + struct IsdnCardState *cs = (struct IsdnCardState *) arg;
8240 +
8241 + cs->hw.hfcusb.drv = NULL; /* disable any further use of driver */
8242 + HiSax_closecard(cs->cardnr);
8243 +} /* release_hfcdrv */
8244 +
8245 +/*********************************************/
8246 +/* called once when a new device is detected */
8247 +/* initialises local data */
8248 +/*********************************************/
8249 +int
8250 +setup_hfc_usb(struct IsdnCard *card)
8251 +{
8252 + struct IsdnCardState *cs = card->cs;
8253 + char tmp[64];
8254 + struct hisax_drvreg *usbdrv =
8255 + (struct hisax_drvreg *) cs->hw.hfcusb.drv;
8256 +
8257 + if (!usbdrv)
8258 + return (0); /* no driver data present */
8259 +
8260 + strcpy(tmp, hfcusb_revision);
8261 + printk(KERN_INFO "HiSax: HFC-USB driver Rev. %s\n",
8262 + HiSax_getrev(tmp));
8263 +
8264 + usbdrv->release_driver = &release_hfcdrv; /* release routine */
8265 + usbdrv->arg_hisax = (void *) cs; /* parameter for calling */
8266 + usbdrv->dch_l1l2 = &hfcusb_d_l1l2; /* access from L1 to HiSax */
8267 + usbdrv->bch_l1l2 = &hfcusb_b_l1l2;
8268 + usbdrv->drq = &cs->rq;
8269 + usbdrv->dsq = &cs->sq;
8270 + cs->cardmsg = &hfcusb_card_msg;
8271 + return (1); /* success */
8272 +}
8273 --- a/drivers/isdn/hisax/hfcscard.c
8274 +++ b/drivers/isdn/hisax/hfcscard.c
8275 @@ -1,4 +1,4 @@
8276 -/* $Id: hfcscard.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
8277 +/* $Id: hfcscard.c,v 1.10 2001/09/24 13:22:56 kai Exp $
8278 *
8279 * low level stuff for hfcs based cards (Teles3c, ACER P10)
8280 *
8281 @@ -12,14 +12,13 @@
8282
8283 #define __NO_VERSION__
8284 #include <linux/init.h>
8285 -#include <linux/isapnp.h>
8286 #include "hisax.h"
8287 #include "hfc_2bds0.h"
8288 #include "isdnl1.h"
8289
8290 extern const char *CardType[];
8291
8292 -static const char *hfcs_revision = "$Revision: 1.1.4.1 $";
8293 +static const char *hfcs_revision = "$Revision: 1.10 $";
8294
8295 static void
8296 hfcs_interrupt(int intno, void *dev_id, struct pt_regs *regs)
8297 @@ -140,36 +139,6 @@ hfcs_card_msg(struct IsdnCardState *cs,
8298 return(0);
8299 }
8300
8301 -#ifdef __ISAPNP__
8302 -static struct isapnp_device_id hfc_ids[] __initdata = {
8303 - { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114),
8304 - ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114),
8305 - (unsigned long) "Acer P10" },
8306 - { ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0002),
8307 - ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0002),
8308 - (unsigned long) "Billion 2" },
8309 - { ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0001),
8310 - ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0001),
8311 - (unsigned long) "Billion 1" },
8312 - { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x7410),
8313 - ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x7410),
8314 - (unsigned long) "IStar PnP" },
8315 - { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2610),
8316 - ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2610),
8317 - (unsigned long) "Teles 16.3c" },
8318 - { ISAPNP_VENDOR('S', 'F', 'M'), ISAPNP_FUNCTION(0x0001),
8319 - ISAPNP_VENDOR('S', 'F', 'M'), ISAPNP_FUNCTION(0x0001),
8320 - (unsigned long) "Tornado Tipa C" },
8321 - { ISAPNP_VENDOR('K', 'Y', 'E'), ISAPNP_FUNCTION(0x0001),
8322 - ISAPNP_VENDOR('K', 'Y', 'E'), ISAPNP_FUNCTION(0x0001),
8323 - (unsigned long) "Genius Speed Surfer" },
8324 - { 0, }
8325 -};
8326 -
8327 -static struct isapnp_device_id *hdev = &hfc_ids[0];
8328 -static struct pci_bus *pnp_c __devinitdata = NULL;
8329 -#endif
8330 -
8331 int __init
8332 setup_hfcs(struct IsdnCard *card)
8333 {
8334 @@ -178,46 +147,6 @@ setup_hfcs(struct IsdnCard *card)
8335
8336 strcpy(tmp, hfcs_revision);
8337 printk(KERN_INFO "HiSax: HFC-S driver Rev. %s\n", HiSax_getrev(tmp));
8338 -
8339 -#ifdef __ISAPNP__
8340 - if (!card->para[1] && isapnp_present()) {
8341 - struct pci_bus *pb;
8342 - struct pci_dev *pd;
8343 -
8344 - while(hdev->card_vendor) {
8345 - if ((pb = isapnp_find_card(hdev->card_vendor,
8346 - hdev->card_device, pnp_c))) {
8347 - pnp_c = pb;
8348 - pd = NULL;
8349 - if ((pd = isapnp_find_dev(pnp_c,
8350 - hdev->vendor, hdev->function, pd))) {
8351 - printk(KERN_INFO "HiSax: %s detected\n",
8352 - (char *)hdev->driver_data);
8353 - pd->prepare(pd);
8354 - pd->deactivate(pd);
8355 - pd->activate(pd);
8356 - card->para[1] = pd->resource[0].start;
8357 - card->para[0] = pd->irq_resource[0].start;
8358 - if (!card->para[0] || !card->para[1]) {
8359 - printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n",
8360 - card->para[0], card->para[1]);
8361 - pd->deactivate(pd);
8362 - return(0);
8363 - }
8364 - break;
8365 - } else {
8366 - printk(KERN_ERR "HFC PnP: PnP error card found, no device\n");
8367 - }
8368 - }
8369 - hdev++;
8370 - pnp_c=NULL;
8371 - }
8372 - if (!hdev->card_vendor) {
8373 - printk(KERN_INFO "HFC PnP: no ISAPnP card found\n");
8374 - return(0);
8375 - }
8376 - }
8377 -#endif
8378 cs->hw.hfcD.addr = card->para[1] & 0xfffe;
8379 cs->irq = card->para[0];
8380 cs->hw.hfcD.cip = 0;
8381 --- a/drivers/isdn/hisax/hisax.h
8382 +++ b/drivers/isdn/hisax/hisax.h
8383 @@ -1,4 +1,4 @@
8384 -/* $Id: hisax.h,v 1.1.4.2 2001/12/09 19:15:28 kai Exp $
8385 +/* $Id: hisax.h,v 2.64 2001/09/24 13:22:56 kai Exp $
8386 *
8387 * Basic declarations, defines and prototypes
8388 *
8389 @@ -24,7 +24,9 @@
8390 #include <linux/isdnif.h>
8391 #include <linux/tty.h>
8392 #include <linux/serial_reg.h>
8393 +#ifndef COMPAT_NO_SOFTNET
8394 #include <linux/netdevice.h>
8395 +#endif
8396
8397 #define ERROR_STATISTIC
8398
8399 @@ -68,9 +70,6 @@
8400 #define DL_DATA 0x0220
8401 #define DL_FLUSH 0x0224
8402 #define DL_UNIT_DATA 0x0230
8403 -
8404 -#define MDL_BC_RELEASE 0x0278 // Formula-n enter:now
8405 -#define MDL_BC_ASSIGN 0x027C // Formula-n enter:now
8406 #define MDL_ASSIGN 0x0280
8407 #define MDL_REMOVE 0x0284
8408 #define MDL_ERROR 0x0288
8409 @@ -472,8 +471,6 @@ struct amd7930_hw {
8410 #define BC_FLG_FTI_RUN 13
8411 #define BC_FLG_LL_OK 14
8412 #define BC_FLG_LL_CONN 15
8413 -#define BC_FLG_FTI_FTS 16
8414 -#define BC_FLG_FRH_WAIT 17
8415
8416 #define L1_MODE_NULL 0
8417 #define L1_MODE_TRANS 1
8418 @@ -695,6 +692,13 @@ struct hfcPCI_hw {
8419 struct timer_list timer;
8420 };
8421
8422 +#ifdef CONFIG_HISAX_HFC_USB
8423 +struct hfcUSB_hw {
8424 + void *drv; /* pointer to driver structure */
8425 + int dch_tx_busy;
8426 +};
8427 +#endif
8428 +
8429 struct hfcSX_hw {
8430 unsigned long base;
8431 unsigned char cirm;
8432 @@ -838,17 +842,6 @@ struct w6692_chip {
8433 int ph_state;
8434 };
8435
8436 -struct amd7930_chip {
8437 - u_char lmr1;
8438 - u_char ph_state;
8439 - u_char old_state;
8440 - u_char flg_t3;
8441 - unsigned int tx_xmtlen;
8442 - struct timer_list timer3;
8443 - void (*ph_command) (struct IsdnCardState *, u_char, char *);
8444 - void (*setIrqMask) (struct IsdnCardState *, u_char);
8445 -};
8446 -
8447 struct icc_chip {
8448 int ph_state;
8449 u_char *mon_tx;
8450 @@ -902,6 +895,9 @@ struct IsdnCardState {
8451 struct njet_hw njet;
8452 struct hfcD_hw hfcD;
8453 struct hfcPCI_hw hfcpci;
8454 +#ifdef CONFIG_HISAX_HFC_USB
8455 + struct hfcUSB_hw hfcusb;
8456 +#endif
8457 struct hfcSX_hw hfcsx;
8458 struct ix1_hw niccy;
8459 struct isurf_hw isurf;
8460 @@ -945,7 +941,6 @@ struct IsdnCardState {
8461 struct hfcpci_chip hfcpci;
8462 struct hfcsx_chip hfcsx;
8463 struct w6692_chip w6692;
8464 - struct amd7930_chip amd7930;
8465 struct icc_chip icc;
8466 } dc;
8467 u_char *rcvbuf;
8468 @@ -967,6 +962,8 @@ struct IsdnCardState {
8469 #define MON0_TX 4
8470 #define MON1_TX 8
8471
8472 +#define HISAX_MAX_CARDS 8
8473 +
8474 #define ISDN_CTYPE_16_0 1
8475 #define ISDN_CTYPE_8_0 2
8476 #define ISDN_CTYPE_16_3 3
8477 @@ -1006,8 +1003,8 @@ struct IsdnCardState {
8478 #define ISDN_CTYPE_HFC_SX 37
8479 #define ISDN_CTYPE_NETJET_U 38
8480 #define ISDN_CTYPE_HFC_SP_PCMCIA 39
8481 -#define ISDN_CTYPE_DYNAMIC 40
8482 -#define ISDN_CTYPE_ENTERNOW 41
8483 +#define ISDN_CTYPE_HFC_USB 40
8484 +#define ISDN_CTYPE_DYNAMIC 41
8485 #define ISDN_CTYPE_COUNT 41
8486
8487
8488 @@ -1267,10 +1264,6 @@ struct IsdnCardState {
8489 #define CARD_NETJET_U 0
8490 #endif
8491
8492 -#ifdef CONFIG_HISAX_ENTERNOW_PCI
8493 -#define CARD_FN_ENTERNOW_PCI 1
8494 -#endif
8495 -
8496 #define TEI_PER_CARD 1
8497
8498 /* L1 Debug */
8499 --- a/drivers/isdn/hisax/hisax_debug.h
8500 +++ b/drivers/isdn/hisax/hisax_debug.h
8501 @@ -28,7 +28,7 @@
8502
8503 #define DBG(level, format, arg...) do { \
8504 if (level & __debug_variable) \
8505 -printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \
8506 +printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg); \
8507 } while (0)
8508
8509 #define DBG_PACKET(level,data,count) \
8510 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c
8511 +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
8512 @@ -20,22 +20,19 @@
8513 *
8514 * o POWER PC
8515 * o clean up debugging
8516 - * o tx_skb at PH_DEACTIVATE time
8517 */
8518
8519 #include <linux/version.h>
8520 #include <linux/module.h>
8521 #include <linux/init.h>
8522 #include <linux/pci.h>
8523 -#include <linux/isapnp.h>
8524 +#include "hisax_isapnp.h"
8525 #include <linux/kmod.h>
8526 #include <linux/slab.h>
8527 #include <linux/skbuff.h>
8528 #include <linux/netdevice.h>
8529 -
8530 -#include <asm/io.h>
8531 -
8532 #include "hisax_fcpcipnp.h"
8533 +#include "hisax_isac.h"
8534
8535 // debugging cruft
8536 #define __debug_variable debug
8537 @@ -46,10 +43,14 @@ static int debug = 0;
8538 MODULE_PARM(debug, "i");
8539 #endif
8540
8541 -MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
8542 +MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>");
8543 MODULE_DESCRIPTION("AVM Fritz!PCI/PnP ISDN driver");
8544
8545 -static struct pci_device_id fcpci_ids[] __devinitdata = {
8546 +#ifndef PCI_DEVICE_ID_AVM_A1_V2
8547 +#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00
8548 +#endif
8549 +
8550 +static struct pci_device_id fcpci_ids[] __initdata = {
8551 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1 , PCI_ANY_ID, PCI_ANY_ID,
8552 0, 0, (unsigned long) "Fritz!Card PCI" },
8553 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID,
8554 @@ -58,7 +59,7 @@ static struct pci_device_id fcpci_ids[]
8555 };
8556 MODULE_DEVICE_TABLE(pci, fcpci_ids);
8557
8558 -static struct isapnp_device_id fcpnp_ids[] __devinitdata = {
8559 +static struct isapnp_device_id fcpnp_ids[] __initdata = {
8560 { ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900),
8561 ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900),
8562 (unsigned long) "Fritz!Card PnP" },
8563 @@ -68,7 +69,8 @@ MODULE_DEVICE_TABLE(isapnp, fcpnp_ids);
8564
8565 static int protocol = 2; /* EURO-ISDN Default */
8566 MODULE_PARM(protocol, "i");
8567 -MODULE_LICENSE("GPL");
8568 +
8569 +static LIST_HEAD(adapter_list);
8570
8571 // ----------------------------------------------------------------------
8572
8573 @@ -147,7 +149,7 @@ static unsigned char fcpci_read_isac(str
8574 outb(idx, adapter->io + AVM_INDEX);
8575 val = inb(adapter->io + AVM_DATA + (offset & 0xf));
8576 spin_unlock_irqrestore(&adapter->hw_lock, flags);
8577 - DBG(0x1000, " port %#x, value %#x",
8578 + DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8579 offset, val);
8580 return val;
8581 }
8582 @@ -160,7 +162,7 @@ static void fcpci_write_isac(struct isac
8583 AVM_IDX_ISAC_REG_HIGH : AVM_IDX_ISAC_REG_LOW;
8584 unsigned long flags;
8585
8586 - DBG(0x1000, " port %#x, value %#x",
8587 + DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8588 offset, value);
8589 spin_lock_irqsave(&adapter->hw_lock, flags);
8590 outb(idx, adapter->io + AVM_INDEX);
8591 @@ -240,7 +242,7 @@ static unsigned char fcpci2_read_isac(st
8592 outl(offset, adapter->io + AVM_ISACSX_INDEX);
8593 val = inl(adapter->io + AVM_ISACSX_DATA);
8594 spin_unlock_irqrestore(&adapter->hw_lock, flags);
8595 - DBG(0x1000, " port %#x, value %#x",
8596 + DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8597 offset, val);
8598
8599 return val;
8600 @@ -252,7 +254,7 @@ static void fcpci2_write_isac(struct isa
8601 struct fritz_adapter *adapter = isac->priv;
8602 unsigned long flags;
8603
8604 - DBG(0x1000, " port %#x, value %#x",
8605 + DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8606 offset, value);
8607 spin_lock_irqsave(&adapter->hw_lock, flags);
8608 outl(offset, adapter->io + AVM_ISACSX_INDEX);
8609 @@ -375,6 +377,9 @@ static void hdlc_fill_fifo(struct fritz_
8610
8611 DBG(0x40, "hdlc_fill_fifo");
8612
8613 + if (!skb)
8614 + BUG();
8615 +
8616 if (skb->len == 0)
8617 BUG();
8618
8619 @@ -515,7 +520,6 @@ static inline void hdlc_xdu_irq(struct f
8620 }
8621 skb_push(bcs->tx_skb, bcs->tx_cnt);
8622 bcs->tx_cnt = 0;
8623 - hdlc_fill_fifo(bcs);
8624 }
8625
8626 static inline void hdlc_xpr_irq(struct fritz_bcs *bcs)
8627 @@ -536,7 +540,7 @@ static inline void hdlc_xpr_irq(struct f
8628 dev_kfree_skb_irq(skb);
8629 }
8630
8631 -static void hdlc_irq_one(struct fritz_bcs *bcs, u32 stat)
8632 +static void hdlc_irq(struct fritz_bcs *bcs, u32 stat)
8633 {
8634 DBG(0x10, "ch%d stat %#x", bcs->channel, stat);
8635 if (stat & HDLC_INT_RPR) {
8636 @@ -553,7 +557,7 @@ static void hdlc_irq_one(struct fritz_bc
8637 }
8638 }
8639
8640 -static inline void hdlc_irq(struct fritz_adapter *adapter)
8641 +static inline void hdlc_interrupt(struct fritz_adapter *adapter)
8642 {
8643 int nr;
8644 u32 stat;
8645 @@ -562,7 +566,7 @@ static inline void hdlc_irq(struct fritz
8646 stat = adapter->read_hdlc_status(adapter, nr);
8647 DBG(0x10, "HDLC %c stat %#x", 'A' + nr, stat);
8648 if (stat & HDLC_INT_MASK)
8649 - hdlc_irq_one(&adapter->bcs[nr], stat);
8650 + hdlc_irq(&adapter->bcs[nr], stat);
8651 }
8652 }
8653
8654 @@ -584,14 +588,14 @@ static void modehdlc(struct fritz_bcs *b
8655 adapter->write_ctrl(bcs, 5);
8656 break;
8657 case L1_MODE_TRANS:
8658 + bcs->ctrl.sr.mode = HDLC_MODE_TRANS;
8659 + adapter->write_ctrl(bcs, 5);
8660 + bcs->ctrl.sr.cmd = HDLC_CMD_XRS;
8661 + adapter->write_ctrl(bcs, 1);
8662 + bcs->ctrl.sr.cmd = 0;
8663 + break;
8664 case L1_MODE_HDLC:
8665 - bcs->rcvidx = 0;
8666 - bcs->tx_cnt = 0;
8667 - bcs->tx_skb = NULL;
8668 - if (mode == L1_MODE_TRANS)
8669 - bcs->ctrl.sr.mode = HDLC_MODE_TRANS;
8670 - else
8671 - bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG;
8672 + bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG;
8673 adapter->write_ctrl(bcs, 5);
8674 bcs->ctrl.sr.cmd = HDLC_CMD_XRS;
8675 adapter->write_ctrl(bcs, 1);
8676 @@ -645,10 +649,10 @@ static void fcpci2_irq(int intno, void *
8677 return;
8678 DBG(2, "STATUS0 %#x", val);
8679 if (val & AVM_STATUS0_IRQ_ISAC)
8680 - isacsx_irq(&adapter->isac);
8681 + isacsx_interrupt(&adapter->isac);
8682
8683 if (val & AVM_STATUS0_IRQ_HDLC)
8684 - hdlc_irq(adapter);
8685 + hdlc_interrupt(adapter);
8686 }
8687
8688 static void fcpci_irq(int intno, void *dev, struct pt_regs *regs)
8689 @@ -662,10 +666,10 @@ static void fcpci_irq(int intno, void *d
8690 return;
8691 DBG(2, "sval %#x", sval);
8692 if (!(sval & AVM_STATUS0_IRQ_ISAC))
8693 - isac_irq(&adapter->isac);
8694 + isac_interrupt(&adapter->isac);
8695
8696 if (!(sval & AVM_STATUS0_IRQ_HDLC))
8697 - hdlc_irq(adapter);
8698 + hdlc_interrupt(adapter);
8699 }
8700
8701 // ----------------------------------------------------------------------
8702 @@ -681,11 +685,6 @@ static inline void fcpci_init(struct fri
8703 {
8704 outb(AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER |
8705 AVM_STATUS0_ENA_IRQ, adapter->io + AVM_STATUS0);
8706 -
8707 - outb(AVM_STATUS1_ENA_IOM | adapter->irq,
8708 - adapter->io + AVM_STATUS1);
8709 - set_current_state(TASK_UNINTERRUPTIBLE);
8710 - schedule_timeout(50*HZ / 1000); /* Timeout 50ms */
8711 }
8712
8713 // ----------------------------------------------------------------------
8714 @@ -693,6 +692,7 @@ static inline void fcpci_init(struct fri
8715 static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter)
8716 {
8717 u32 val = 0;
8718 + struct pci_dev *pdev = adapter->pci_dev;
8719 int retval;
8720
8721 DBG(1,"");
8722 @@ -700,21 +700,21 @@ static int __devinit fcpcipnp_setup(stru
8723 isac_init(&adapter->isac); // FIXME is this okay now
8724
8725 retval = -EBUSY;
8726 - if (!request_region(adapter->io, 32, "fcpcipnp"))
8727 + if (!request_region(adapter->io, 32, "hisax_fcpcipnp"))
8728 goto err;
8729
8730 switch (adapter->type) {
8731 case AVM_FRITZ_PCIV2:
8732 - retval = request_irq(adapter->irq, fcpci2_irq, SA_SHIRQ,
8733 - "fcpcipnp", adapter);
8734 + retval = request_irq(pdev->irq, fcpci2_irq, SA_SHIRQ,
8735 + "hisax_fcpcipnp", adapter);
8736 break;
8737 case AVM_FRITZ_PCI:
8738 - retval = request_irq(adapter->irq, fcpci_irq, SA_SHIRQ,
8739 - "fcpcipnp", adapter);
8740 + retval = request_irq(pdev->irq, fcpci_irq, SA_SHIRQ,
8741 + "hisax_fcpcipnp", adapter);
8742 break;
8743 case AVM_FRITZ_PNP:
8744 - retval = request_irq(adapter->irq, fcpci_irq, 0,
8745 - "fcpcipnp", adapter);
8746 + retval = request_irq(pdev->irq, fcpci_irq, 0,
8747 + "hisax_fcpcipnp", adapter);
8748 break;
8749 }
8750 if (retval)
8751 @@ -808,11 +808,23 @@ static int __devinit fcpcipnp_setup(stru
8752
8753 static void __devexit fcpcipnp_release(struct fritz_adapter *adapter)
8754 {
8755 + struct pci_dev *pdev = adapter->pci_dev;
8756 +
8757 DBG(1,"");
8758
8759 outb(0, adapter->io + AVM_STATUS0);
8760 - free_irq(adapter->irq, adapter);
8761 + free_irq(pdev->irq, adapter);
8762 release_region(adapter->io, 32);
8763 +
8764 + switch (adapter->type) {
8765 + case AVM_FRITZ_PCI:
8766 + case AVM_FRITZ_PCIV2:
8767 + pci_disable_device(pdev);
8768 + break;
8769 + case AVM_FRITZ_PNP:
8770 + pdev->deactivate(pdev);
8771 + break;
8772 + }
8773 }
8774
8775 // ----------------------------------------------------------------------
8776 @@ -830,6 +842,8 @@ new_adapter(struct pci_dev *pdev)
8777
8778 memset(adapter, 0, sizeof(struct fritz_adapter));
8779
8780 + adapter->pci_dev = pdev;
8781 +
8782 SET_MODULE_OWNER(&adapter->isac.hisax_d_if);
8783 adapter->isac.hisax_d_if.ifc.priv = &adapter->isac;
8784 adapter->isac.hisax_d_if.ifc.l2l1 = isac_d_l2l1;
8785 @@ -840,6 +854,7 @@ new_adapter(struct pci_dev *pdev)
8786 adapter->bcs[i].b_if.ifc.priv = &adapter->bcs[i];
8787 adapter->bcs[i].b_if.ifc.l2l1 = fritz_b_l2l1;
8788 }
8789 + list_add(&adapter->list, &adapter_list);
8790
8791 pci_set_drvdata(pdev, adapter);
8792
8793 @@ -854,6 +869,7 @@ new_adapter(struct pci_dev *pdev)
8794 static void delete_adapter(struct fritz_adapter *adapter)
8795 {
8796 hisax_unregister(&adapter->isac.hisax_d_if);
8797 + list_del(&adapter->list);
8798 kfree(adapter);
8799 }
8800
8801 @@ -863,12 +879,15 @@ static int __devinit fcpci_probe(struct
8802 struct fritz_adapter *adapter;
8803 int retval;
8804
8805 + printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at %s\n",
8806 + (char *) ent->driver_data, pdev->slot_name);
8807 +
8808 retval = -ENOMEM;
8809 adapter = new_adapter(pdev);
8810 if (!adapter)
8811 goto err;
8812
8813 - if (pdev->device == PCI_DEVICE_ID_AVM_A1_V2)
8814 + if (pdev->device == 0x0e00)
8815 adapter->type = AVM_FRITZ_PCIV2;
8816 else
8817 adapter->type = AVM_FRITZ_PCI;
8818 @@ -876,12 +895,7 @@ static int __devinit fcpci_probe(struct
8819 retval = pci_enable_device(pdev);
8820 if (retval)
8821 goto err_free;
8822 -
8823 adapter->io = pci_resource_start(pdev, 1);
8824 - adapter->irq = pdev->irq;
8825 -
8826 - printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at %s\n",
8827 - (char *) ent->driver_data, pdev->slot_name);
8828
8829 retval = fcpcipnp_setup(adapter);
8830 if (retval)
8831 @@ -901,6 +915,9 @@ static int __devinit fcpnp_probe(struct
8832 struct fritz_adapter *adapter;
8833 int retval;
8834
8835 + printk(KERN_INFO "hisax_fcpcipnp: found adapter %s\n",
8836 + (char *) ent->driver_data);
8837 +
8838 retval = -ENOMEM;
8839 adapter = new_adapter(pdev);
8840 if (!adapter)
8841 @@ -912,11 +929,8 @@ static int __devinit fcpnp_probe(struct
8842 pdev->deactivate(pdev); // why?
8843 pdev->activate(pdev);
8844 adapter->io = pdev->resource[0].start;
8845 - adapter->irq = pdev->irq_resource[0].start;
8846 -
8847 - printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at IO %#x irq %d\n",
8848 - (char *) ent->driver_data, adapter->io, adapter->irq);
8849 -
8850 + pdev->irq = pdev->irq_resource[0].start;
8851 +
8852 retval = fcpcipnp_setup(adapter);
8853 if (retval)
8854 goto err_free;
8855 @@ -929,43 +943,35 @@ static int __devinit fcpnp_probe(struct
8856 return retval;
8857 }
8858
8859 -static void __devexit fcpci_remove(struct pci_dev *pdev)
8860 -{
8861 - struct fritz_adapter *adapter = pci_get_drvdata(pdev);
8862 -
8863 - fcpcipnp_release(adapter);
8864 - pci_disable_device(pdev);
8865 - delete_adapter(adapter);
8866 -}
8867 -
8868 -static void __devexit fcpnp_remove(struct pci_dev *pdev)
8869 +static void __devexit fcpcipnp_remove(struct pci_dev *pdev)
8870 {
8871 struct fritz_adapter *adapter = pci_get_drvdata(pdev);
8872
8873 fcpcipnp_release(adapter);
8874 - pdev->deactivate(pdev);
8875 delete_adapter(adapter);
8876 }
8877
8878 static struct pci_driver fcpci_driver = {
8879 - name: "fcpci",
8880 - probe: fcpci_probe,
8881 - remove: __devexit_p(fcpci_remove),
8882 + name: "fcpci",
8883 + probe: fcpci_probe,
8884 + remove: fcpcipnp_remove,
8885 id_table: fcpci_ids,
8886 };
8887
8888 static struct isapnp_driver fcpnp_driver = {
8889 - name: "fcpnp",
8890 - probe: fcpnp_probe,
8891 - remove: __devexit_p(fcpnp_remove),
8892 + name: "fcpnp",
8893 + probe: fcpnp_probe,
8894 + remove: fcpcipnp_remove,
8895 id_table: fcpnp_ids,
8896 };
8897
8898 -static int __init hisax_fcpcipnp_init(void)
8899 +static LIST_HEAD(isapnp_drivers);
8900 +
8901 +static int __init hisax_fcpci_init(void)
8902 {
8903 int retval, pci_nr_found;
8904
8905 - printk(KERN_INFO "hisax_fcpcipnp: Fritz!Card PCI/PCIv2/PnP ISDN driver v0.0.1\n");
8906 + printk(KERN_INFO "hisax_fcpcipnp: Fritz!PCI/PnP ISDN driver v0.0.1\n");
8907
8908 retval = pci_register_driver(&fcpci_driver);
8909 if (retval < 0)
8910 @@ -976,15 +982,14 @@ static int __init hisax_fcpcipnp_init(vo
8911 if (retval < 0)
8912 goto out_unregister_pci;
8913
8914 -#if !defined(CONFIG_HOTPLUG) || defined(MODULE)
8915 +#if !defined(CONFIG_HOTPLUG) && defined(MODULE)
8916 if (pci_nr_found + retval == 0) {
8917 retval = -ENODEV;
8918 goto out_unregister_isapnp;
8919 - }
8920 #endif
8921 return 0;
8922
8923 -#if !defined(CONFIG_HOTPLUG) || defined(MODULE)
8924 +#if !defined(CONFIG_HOTPLUG) && defined(MODULE)
8925 out_unregister_isapnp:
8926 isapnp_unregister_driver(&fcpnp_driver);
8927 #endif
8928 @@ -994,11 +999,15 @@ static int __init hisax_fcpcipnp_init(vo
8929 return retval;
8930 }
8931
8932 -static void __exit hisax_fcpcipnp_exit(void)
8933 +static void __exit hisax_fcpci_exit(void)
8934 {
8935 isapnp_unregister_driver(&fcpnp_driver);
8936 pci_unregister_driver(&fcpci_driver);
8937 }
8938
8939 -module_init(hisax_fcpcipnp_init);
8940 -module_exit(hisax_fcpcipnp_exit);
8941 +module_init(hisax_fcpci_init);
8942 +module_exit(hisax_fcpci_exit);
8943 +
8944 +#ifdef __ISAPNP__
8945 +#include "hisax_isapnp.c"
8946 +#endif
8947 --- a/drivers/isdn/hisax/hisax_fcpcipnp.h
8948 +++ b/drivers/isdn/hisax/hisax_fcpcipnp.h
8949 @@ -43,10 +43,12 @@ struct fritz_bcs {
8950 };
8951
8952 struct fritz_adapter {
8953 + struct list_head list;
8954 + struct pci_dev *pci_dev;
8955 +
8956 int type;
8957 spinlock_t hw_lock;
8958 unsigned int io;
8959 - unsigned int irq;
8960 struct isac isac;
8961
8962 struct fritz_bcs bcs[2];
8963 --- a/drivers/isdn/hisax/hisax_isac.c
8964 +++ b/drivers/isdn/hisax/hisax_isac.c
8965 @@ -34,7 +34,7 @@
8966 static int debug = 1;
8967 MODULE_PARM(debug, "i");
8968
8969 -static char *ISACVer[] = {
8970 +static char *ISACVer[] __devinitdata = {
8971 "2086/2186 V1.1",
8972 "2085 B1",
8973 "2085 B2",
8974 @@ -42,10 +42,6 @@ static char *ISACVer[] = {
8975 };
8976 #endif
8977
8978 -MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
8979 -MODULE_DESCRIPTION("ISAC/ISAC-SX driver");
8980 -MODULE_LICENSE("GPL");
8981 -
8982 #define DBG_WARN 0x0001
8983 #define DBG_IRQ 0x0002
8984 #define DBG_L1M 0x0004
8985 @@ -438,7 +434,7 @@ static void l1m_debug(struct FsmInst *fi
8986 va_end(args);
8987 }
8988
8989 -static void isac_version(struct isac *cs)
8990 +static void __devinit isac_version(struct isac *cs)
8991 {
8992 int val;
8993
8994 @@ -602,7 +598,7 @@ static inline void isac_exi_interrupt(st
8995 }
8996 }
8997
8998 -void isac_irq(struct isac *isac)
8999 +void isac_interrupt(struct isac *isac)
9000 {
9001 unsigned char val;
9002
9003 @@ -635,8 +631,6 @@ void isac_irq(struct isac *isac)
9004 if (val & ISAC_ISTA_SIN) {
9005 DBG(DBG_WARN, "SIN");
9006 }
9007 - isac->write_isac(isac, ISAC_MASK, 0xff);
9008 - isac->write_isac(isac, ISAC_MASK, 0x00);
9009 }
9010
9011 // ======================================================================
9012 @@ -742,7 +736,7 @@ static inline void isacsx_icd_interrupt(
9013 }
9014 }
9015
9016 -void isacsx_irq(struct isac *isac)
9017 +void isacsx_interrupt(struct isac *isac)
9018 {
9019 unsigned char val;
9020
9021 @@ -755,7 +749,7 @@ void isacsx_irq(struct isac *isac)
9022 isacsx_cic_interrupt(isac);
9023 }
9024
9025 -void isac_init(struct isac *isac)
9026 +void __devinit isac_init(struct isac *isac)
9027 {
9028 isac->tx_skb = NULL;
9029 isac->l1m.fsm = &l1fsm;
9030 @@ -770,7 +764,7 @@ void isac_init(struct isac *isac)
9031 FsmInitTimer(&isac->l1m, &isac->timer);
9032 }
9033
9034 -void isac_setup(struct isac *isac)
9035 +void __devinit isac_setup(struct isac *isac)
9036 {
9037 int val, eval;
9038
9039 @@ -781,7 +775,7 @@ void isac_setup(struct isac *isac)
9040
9041 isac->write_isac(isac, ISAC_MASK, 0xff);
9042 isac->mocr = 0xaa;
9043 - if (test_bit(ISAC_IOM1, &isac->flags)) {
9044 + if (test_bit(HW_IOM1, &isac->flags)) {
9045 /* IOM 1 Mode */
9046 isac->write_isac(isac, ISAC_ADF2, 0x0);
9047 isac->write_isac(isac, ISAC_SPCR, 0xa);
9048 @@ -817,7 +811,7 @@ void isac_setup(struct isac *isac)
9049 FsmEvent(&isac->l1m, (val >> 2) & 0xf, NULL);
9050
9051 isac->write_isac(isac, ISAC_MASK, 0x0);
9052 - // RESET Receiver and Transmitter
9053 + /* RESET Receiver and Transmitter */
9054 isac->write_isac(isac, ISAC_CMDR, ISAC_CMDR_XRES | ISAC_CMDR_RRES);
9055 }
9056
9057 @@ -888,10 +882,10 @@ EXPORT_SYMBOL(isac_init);
9058 EXPORT_SYMBOL(isac_d_l2l1);
9059
9060 EXPORT_SYMBOL(isacsx_setup);
9061 -EXPORT_SYMBOL(isacsx_irq);
9062 +EXPORT_SYMBOL(isacsx_interrupt);
9063
9064 EXPORT_SYMBOL(isac_setup);
9065 -EXPORT_SYMBOL(isac_irq);
9066 +EXPORT_SYMBOL(isac_interrupt);
9067
9068 module_init(hisax_isac_init);
9069 module_exit(hisax_isac_exit);
9070 --- a/drivers/isdn/hisax/hisax_isac.h
9071 +++ b/drivers/isdn/hisax/hisax_isac.h
9072 @@ -8,7 +8,7 @@
9073 #define TIMER3_VALUE 7000
9074 #define MAX_DFRAME_LEN_L1 300
9075
9076 -#define ISAC_IOM1 0
9077 +#define HW_IOM1 0
9078
9079 struct isac {
9080 void *priv;
9081 @@ -37,9 +37,9 @@ void isac_init(struct isac *isac);
9082 void isac_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg);
9083
9084 void isac_setup(struct isac *isac);
9085 -void isac_irq(struct isac *isac);
9086 +void isac_interrupt(struct isac *isac);
9087
9088 void isacsx_setup(struct isac *isac);
9089 -void isacsx_irq(struct isac *isac);
9090 +void isacsx_interrupt(struct isac *isac);
9091
9092 #endif
9093 --- /dev/null
9094 +++ b/drivers/isdn/hisax/hisax_isapnp.c
9095 @@ -0,0 +1,105 @@
9096 +// FIXME copied
9097 +static const struct isapnp_device_id *
9098 +isapnp_match_device(const struct isapnp_device_id *ids, struct pci_dev *dev)
9099 +{
9100 + DBG(1,"");
9101 +
9102 + while (ids->card_vendor || ids->card_device) {
9103 + if ((ids->card_vendor == ISAPNP_ANY_ID || ids->card_vendor == dev->bus->vendor) &&
9104 + (ids->card_device == ISAPNP_ANY_ID || ids->card_device == dev->bus->device) &&
9105 + (ids->vendor == ISAPNP_ANY_ID || ids->vendor == dev->vendor) &&
9106 + (ids->function == ISAPNP_ANY_ID || ids->function == dev->device))
9107 + return ids;
9108 + ids++;
9109 + }
9110 + return NULL;
9111 +}
9112 +
9113 +/**
9114 + * pci_dev_driver - get the pci_driver of a device
9115 + * @dev: the device to query
9116 + *
9117 + * Returns the appropriate pci_driver structure or %NULL if there is no
9118 + * registered driver for the device.
9119 + */
9120 +struct pci_driver *isapnp_dev_driver(const struct pci_dev *dev)
9121 +{
9122 + return dev->driver;
9123 +}
9124 +
9125 +static int isapnp_announce_device(struct isapnp_driver *drv, struct pci_dev *dev)
9126 +{
9127 + const struct isapnp_device_id *id;
9128 + int ret = 0;
9129 +
9130 + DBG(1,"");
9131 +
9132 + if (drv->id_table) {
9133 + id = isapnp_match_device(drv->id_table, dev);
9134 + if (!id) {
9135 + ret = 0;
9136 + goto out;
9137 + }
9138 + } else
9139 + id = NULL;
9140 +
9141 +// dev_probe_lock();
9142 + if (drv->probe(dev, id) >= 0) {
9143 + dev->driver = (struct pci_driver *) drv;
9144 + ret = 1;
9145 + }
9146 +// dev_probe_unlock();
9147 +out:
9148 + return ret;
9149 +}
9150 +
9151 +/**
9152 + * FIXME pci_register_driver - register a new pci driver
9153 + * @drv: the driver structure to register
9154 + *
9155 + * Adds the driver structure to the list of registered drivers
9156 + * Returns the number of pci devices which were claimed by the driver
9157 + * during registration. The driver remains registered even if the
9158 + * return value is zero.
9159 + */
9160 +int isapnp_register_driver(struct isapnp_driver *drv)
9161 +{
9162 + struct pci_dev *dev;
9163 + int count = 0;
9164 +
9165 + DBG(1,"");
9166 +
9167 + list_add_tail(&drv->node, &isapnp_drivers);
9168 + isapnp_for_each_dev(dev) {
9169 + if (!isapnp_dev_driver(dev))
9170 + count += isapnp_announce_device(drv, dev);
9171 + }
9172 + return count;
9173 +}
9174 +
9175 +/**
9176 + * pci_unregister_driver - unregister a pci driver
9177 + * @drv: the driver structure to unregister
9178 + *
9179 + * Deletes the driver structure from the list of registered PCI drivers,
9180 + * gives it a chance to clean up by calling its remove() function for
9181 + * each device it was responsible for, and marks those devices as
9182 + * driverless.
9183 + */
9184 +
9185 +void isapnp_unregister_driver(struct isapnp_driver *drv)
9186 +{
9187 + struct pci_dev *dev;
9188 +
9189 + DBG(1,"");
9190 +
9191 + list_del(&drv->node);
9192 + isapnp_for_each_dev(dev) {
9193 + if (dev->driver == (struct pci_driver *) drv) {
9194 + if (drv->remove)
9195 + drv->remove(dev);
9196 + dev->driver = NULL;
9197 + }
9198 + }
9199 +}
9200 +
9201 --- /dev/null
9202 +++ b/drivers/isdn/hisax/hisax_isapnp.h
9203 @@ -0,0 +1,33 @@
9204 +#ifndef __HISAX_ISAPNP_H__
9205 +#define __HISAX_ISAPNP_H__
9206 +
9207 +#include <linux/isapnp.h>
9208 +
9209 +#ifdef COMPAT_NEED_ISAPNP_DRIVER
9210 +struct isapnp_driver {
9211 + struct list_head node;
9212 + char *name;
9213 + const struct isapnp_device_id *id_table; /* NULL if wants all devices */
9214 + int (*probe) (struct pci_dev *dev, const struct isapnp_device_id *id); /* New device inserted */
9215 + void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
9216 +};
9217 +#endif
9218 +#ifdef __ISAPNP__
9219 +
9220 +int isapnp_register_driver(struct isapnp_driver *drv);
9221 +void isapnp_unregister_driver(struct isapnp_driver *drv);
9222 +
9223 +#else
9224 +
9225 +static inline int isapnp_register_driver(struct isapnp_driver *drv)
9226 +{
9227 + return 0;
9228 +}
9229 +
9230 +static inline void isapnp_unregister_driver(struct isapnp_driver *drv)
9231 +{
9232 +}
9233 +
9234 +#endif
9235 +
9236 +#endif
9237 --- /dev/null
9238 +++ b/drivers/isdn/hisax/hisax_loadable.h
9239 @@ -0,0 +1,74 @@
9240 +/* $Id: hisax_loadable.h,v 2.1 2001/06/08 22:19:16 werner Exp $
9241 + *
9242 + *
9243 + * Author (C) 2001 Werner Cornelius (werner@isdn-development.de)
9244 + * modular driver for Colognechip HFC-USB chip
9245 + * as plugin for HiSax isdn driver
9246 + *
9247 + * Copyright 2001 by Werner Cornelius (werner@isdn4linux.de)
9248 + *
9249 + * This program is free software; you can redistribute it and/or modify
9250 + * it under the terms of the GNU General Public License as published by
9251 + * the Free Software Foundation; either version 2, or (at your option)
9252 + * any later version.
9253 + *
9254 + * This program is distributed in the hope that it will be useful,
9255 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9256 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9257 + * GNU General Public License for more details.
9258 + *
9259 + * You should have received a copy of the GNU General Public License
9260 + * along with this program; if not, write to the Free Software
9261 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
9262 + *
9263 + */
9264 +
9265 +#include <linux/types.h>
9266 +#include <linux/skbuff.h>
9267 +
9268 +/***************************************/
9269 +/* additional defines for l1 constants */
9270 +/***************************************/
9271 +#define B1_DATA 0x1f0
9272 +#define B1_SETMODE 0x1f4
9273 +#define B2_DATA 0x1f8
9274 +#define B2_SETMODE 0x1fc
9275 +
9276 +
9277 +/********************************************************/
9278 +/* structure used for register and release of L1 driver */
9279 +/********************************************************/
9280 +struct hisax_drvreg {
9281 + int version; /* actual version for check */
9282 + int cmd; /* command code */
9283 +
9284 + /* function pointers set by hisax during register call */
9285 + void (*release_driver) (void *arg_hisax); /* set by hisax, release function for driver */
9286 + void (*dch_l1l2) (void *arg_hisax, int pr, void *arg); /* set by hisax, notify dch+l1 events */
9287 + void (*bch_l1l2) (void *arg_hisax, int chan, int pr, void *arg); /* set by hisax, notify bch events */
9288 + void *arg_hisax; /* argument when calling hisax main */
9289 + struct sk_buff_head *drq; /* pointer to D-receive queue */
9290 + struct sk_buff_head *dsq; /* pointer to D-send queue */
9291 + struct sk_buff_head erq; /* E-receive queue */
9292 + struct sk_buff_head *brq[2]; /* pointer to B-receive queues */
9293 + struct sk_buff **bsk[2]; /* pointer to B-transmit buffer */
9294 +
9295 + /* function pointers set by l1 driver before calling the register function */
9296 + void (*dch_l2l1) (void *argl1, int pr, void *arg); /* function dch+l1 from hisax -> l1 */
9297 + void (*bch_l2l1) (void *argl1, int chan, int pr, void *arg); /* function bch from hisax -> l1 */
9298 + void *argl1; /* pointer to l1 data structure when calling l1 */
9299 +
9300 + char *drvname; /* driver name for hisax usage */
9301 +};
9302 +
9303 +/**************************/
9304 +/* constants and commands */
9305 +/**************************/
9306 +#define HISAX_LOAD_VERSION 4 /* change when interface changes */
9307 +#define HISAX_LOAD_CHKVER 0 /* check version command (returns 0 on success) */
9308 +#define HISAX_LOAD_REGISTER 1 /* register the L1 driver and return 0 on success */
9309 +
9310 +/***************************************/
9311 +/* definition of the register function */
9312 +/***************************************/
9313 +extern int hisax_register_hfcusb(struct hisax_drvreg *l1drv);
9314 --- a/drivers/isdn/hisax/hscx.c
9315 +++ b/drivers/isdn/hisax/hscx.c
9316 @@ -1,4 +1,4 @@
9317 -/* $Id: hscx.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9318 +/* $Id: hscx.c,v 1.24 2001/09/24 13:22:56 kai Exp $
9319 *
9320 * HSCX specific routines
9321 *
9322 --- a/drivers/isdn/hisax/hscx.h
9323 +++ b/drivers/isdn/hisax/hscx.h
9324 @@ -1,4 +1,4 @@
9325 -/* $Id: hscx.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9326 +/* $Id: hscx.h,v 1.8 2001/09/24 13:22:56 kai Exp $
9327 *
9328 * HSCX specific defines
9329 *
9330 --- a/drivers/isdn/hisax/hscx_irq.c
9331 +++ b/drivers/isdn/hisax/hscx_irq.c
9332 @@ -1,4 +1,4 @@
9333 -/* $Id: hscx_irq.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9334 +/* $Id: hscx_irq.c,v 1.18 2001/09/24 13:22:56 kai Exp $
9335 *
9336 * low level b-channel stuff for Siemens HSCX
9337 *
9338 --- a/drivers/isdn/hisax/icc.c
9339 +++ b/drivers/isdn/hisax/icc.c
9340 @@ -1,4 +1,4 @@
9341 -/* $Id: icc.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9342 +/* $Id: icc.c,v 1.8 2001/09/24 13:22:56 kai Exp $
9343 *
9344 * ICC specific routines
9345 *
9346 --- a/drivers/isdn/hisax/icc.h
9347 +++ b/drivers/isdn/hisax/icc.h
9348 @@ -1,4 +1,4 @@
9349 -/* $Id: icc.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9350 +/* $Id: icc.h,v 1.4 2001/09/24 13:22:56 kai Exp $
9351 *
9352 * ICC specific routines
9353 *
9354 --- a/drivers/isdn/hisax/ipac.h
9355 +++ b/drivers/isdn/hisax/ipac.h
9356 @@ -1,4 +1,4 @@
9357 -/* $Id: ipac.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9358 +/* $Id: ipac.h,v 1.7 2001/09/24 13:22:56 kai Exp $
9359 *
9360 * IPAC specific defines
9361 *
9362 --- a/drivers/isdn/hisax/isac.c
9363 +++ b/drivers/isdn/hisax/isac.c
9364 @@ -1,4 +1,4 @@
9365 -/* $Id: isac.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9366 +/* $Id: isac.c,v 1.31 2001/09/24 13:22:56 kai Exp $
9367 *
9368 * ISAC specific routines
9369 *
9370 --- a/drivers/isdn/hisax/isac.h
9371 +++ b/drivers/isdn/hisax/isac.h
9372 @@ -1,4 +1,4 @@
9373 -/* $Id: isac.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9374 +/* $Id: isac.h,v 1.9 2001/09/24 13:22:56 kai Exp $
9375 *
9376 * ISAC specific defines
9377 *
9378 --- a/drivers/isdn/hisax/isar.c
9379 +++ b/drivers/isdn/hisax/isar.c
9380 @@ -1,4 +1,4 @@
9381 -/* $Id: isar.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9382 +/* $Id: isar.c,v 1.22 2001/09/23 12:00:05 keil Exp $
9383 *
9384 * isar.c ISAR (Siemens PSB 7110) specific routines
9385 *
9386 @@ -21,12 +21,10 @@
9387 #define DLE 0x10
9388 #define ETX 0x03
9389
9390 -#define FAXMODCNT 13
9391 -const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146};
9392 -static u_int modmask = 0x1fff;
9393 -static int frm_extra_delay = 2;
9394 -static int para_TOA = 6;
9395 -const u_char *FC1_CMD[] = {"FAE", "FTS", "FRS", "FTM", "FRM", "FTH", "FRH", "CTRL" };
9396 +
9397 +const u_char faxmodulation_s[] = "3,24,48,72,73,74,96,97,98,121,122,145,146";
9398 +const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146};
9399 +#define FAXMODCNT 13
9400
9401 void isar_setup(struct IsdnCardState *cs);
9402 static void isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para);
9403 @@ -127,7 +125,7 @@ get_irq_infos(struct IsdnCardState *cs,
9404 ireg->clsb = cs->BC_Read_Reg(cs, 1, ISAR_CTRL_L);
9405 #if DUMP_MBOXFRAME
9406 if (cs->debug & L1_DEB_HSCX)
9407 - debugl1(cs, "irq_stat(%02x,%02x,%d)", ireg->iis, ireg->cmsb,
9408 + debugl1(cs, "rcv_mbox(%02x,%02x,%d)", ireg->iis, ireg->cmsb,
9409 ireg->clsb);
9410 #endif
9411 }
9412 @@ -414,7 +412,6 @@ isar_load_firmware(struct IsdnCardState
9413 }
9414 cs->debug = debug;
9415 isar_setup(cs);
9416 -
9417 ret = 0;
9418 reterrflg:
9419 restore_flags(flags);
9420 @@ -428,21 +425,6 @@ reterror:
9421 return(ret);
9422 }
9423
9424 -static inline void
9425 -ll_deliver_faxstat(struct BCState *bcs, u_char status)
9426 -{
9427 - isdn_ctrl ic;
9428 - struct Channel *chanp = (struct Channel *) bcs->st->lli.userdata;
9429 -
9430 - if (bcs->cs->debug & L1_DEB_HSCX)
9431 - debugl1(bcs->cs, "HL->LL FAXIND %x", status);
9432 - ic.driver = bcs->cs->myid;
9433 - ic.command = ISDN_STAT_FAXIND;
9434 - ic.arg = chanp->chan;
9435 - ic.parm.aux.cmd = status;
9436 - bcs->cs->iif.statcallb(&ic);
9437 -}
9438 -
9439 extern void BChannel_bh(struct BCState *);
9440 #define B_LL_NOCARRIER 8
9441 #define B_LL_CONNECT 9
9442 @@ -599,6 +581,7 @@ isar_rcv_frame(struct IsdnCardState *cs,
9443 if (ireg->cmsb & SART_NMD) { /* ABORT */
9444 if (cs->debug & L1_DEB_WARN)
9445 debugl1(cs, "isar_rcv_frame: no more data");
9446 + cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9447 bcs->hw.isar.rcvidx = 0;
9448 send_DLE_ETX(bcs);
9449 sendmsg(cs, SET_DPS(bcs->hw.isar.dpath) |
9450 @@ -609,6 +592,7 @@ isar_rcv_frame(struct IsdnCardState *cs,
9451 }
9452 } else {
9453 printk(KERN_WARNING "HiSax: skb out of memory\n");
9454 + cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9455 }
9456 break;
9457 }
9458 @@ -633,9 +617,8 @@ isar_rcv_frame(struct IsdnCardState *cs,
9459 bcs->hw.isar.rcvidx = 0;
9460 cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9461 } else {
9462 - if (ireg->cmsb & HDLC_FSD) {
9463 + if (ireg->cmsb & HDLC_FSD)
9464 bcs->hw.isar.rcvidx = 0;
9465 - }
9466 ptr = bcs->hw.isar.rcvbuf + bcs->hw.isar.rcvidx;
9467 bcs->hw.isar.rcvidx += ireg->clsb;
9468 rcv_mbox(cs, ireg, ptr);
9469 @@ -646,8 +629,6 @@ isar_rcv_frame(struct IsdnCardState *cs,
9470 if (cs->debug & L1_DEB_WARN)
9471 debugl1(cs, "isar frame to short %d",
9472 bcs->hw.isar.rcvidx);
9473 - printk(KERN_WARNING "ISAR: frame to short %d\n",
9474 - bcs->hw.isar.rcvidx);
9475 } else if (!(skb = dev_alloc_skb(bcs->hw.isar.rcvidx))) {
9476 printk(KERN_WARNING "ISAR: receive out of memory\n");
9477 } else {
9478 @@ -658,7 +639,6 @@ isar_rcv_frame(struct IsdnCardState *cs,
9479 isar_sched_event(bcs, B_RCVBUFREADY);
9480 send_DLE_ETX(bcs);
9481 isar_sched_event(bcs, B_LL_OK);
9482 - test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9483 }
9484 bcs->hw.isar.rcvidx = 0;
9485 }
9486 @@ -666,14 +646,13 @@ isar_rcv_frame(struct IsdnCardState *cs,
9487 if (ireg->cmsb & SART_NMD) { /* ABORT */
9488 if (cs->debug & L1_DEB_WARN)
9489 debugl1(cs, "isar_rcv_frame: no more data");
9490 + cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9491 bcs->hw.isar.rcvidx = 0;
9492 + send_DLE_ETX(bcs);
9493 sendmsg(cs, SET_DPS(bcs->hw.isar.dpath) |
9494 ISAR_HIS_PUMPCTRL, PCTRL_CMD_ESC, 0, NULL);
9495 bcs->hw.isar.state = STFAX_ESCAPE;
9496 - if (test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag)) {
9497 - send_DLE_ETX(bcs);
9498 - isar_sched_event(bcs, B_LL_NOCARRIER);
9499 - }
9500 + isar_sched_event(bcs, B_LL_NOCARRIER);
9501 }
9502 break;
9503 default:
9504 @@ -977,6 +956,21 @@ isar_pump_statev_modem(struct BCState *b
9505 }
9506 }
9507
9508 +static inline void
9509 +ll_deliver_faxstat(struct BCState *bcs, u_char status)
9510 +{
9511 + isdn_ctrl ic;
9512 + struct Channel *chanp = (struct Channel *) bcs->st->lli.userdata;
9513 +
9514 + if (bcs->cs->debug & L1_DEB_HSCX)
9515 + debugl1(bcs->cs, "HL->LL FAXIND %x", status);
9516 + ic.driver = bcs->cs->myid;
9517 + ic.command = ISDN_STAT_FAXIND;
9518 + ic.arg = chanp->chan;
9519 + ic.parm.aux.cmd = status;
9520 + bcs->cs->iif.statcallb(&ic);
9521 +}
9522 +
9523 static void
9524 isar_pump_statev_fax(struct BCState *bcs, u_char devt) {
9525 struct IsdnCardState *cs = bcs->cs;
9526 @@ -1081,22 +1075,19 @@ isar_pump_statev_fax(struct BCState *bcs
9527 if (cs->debug & L1_DEB_HSCX)
9528 debugl1(cs, "pump stev RSP_DISC");
9529 if (bcs->hw.isar.state == STFAX_ESCAPE) {
9530 - p1 = 5;
9531 switch(bcs->hw.isar.newcmd) {
9532 case 0:
9533 bcs->hw.isar.state = STFAX_READY;
9534 break;
9535 - case PCTRL_CMD_FTM:
9536 - p1 = 2;
9537 case PCTRL_CMD_FTH:
9538 + case PCTRL_CMD_FTM:
9539 + p1 = 10;
9540 sendmsg(cs, dps | ISAR_HIS_PUMPCTRL,
9541 PCTRL_CMD_SILON, 1, &p1);
9542 bcs->hw.isar.state = STFAX_SILDET;
9543 break;
9544 - case PCTRL_CMD_FRM:
9545 - if (frm_extra_delay)
9546 - mdelay(frm_extra_delay);
9547 case PCTRL_CMD_FRH:
9548 + case PCTRL_CMD_FRM:
9549 p1 = bcs->hw.isar.mod = bcs->hw.isar.newmod;
9550 bcs->hw.isar.newmod = 0;
9551 bcs->hw.isar.cmd = bcs->hw.isar.newcmd;
9552 @@ -1215,9 +1206,6 @@ isar_int_main(struct IsdnCardState *cs)
9553 isar_pump_statev_modem(bcs, ireg->cmsb);
9554 } else if (bcs->mode == L1_MODE_FAX) {
9555 isar_pump_statev_fax(bcs, ireg->cmsb);
9556 - } else if (ireg->cmsb == PSEV_10MS_TIMER) {
9557 - if (cs->debug & L1_DEB_HSCX)
9558 - debugl1(cs, "pump stev TIMER");
9559 } else {
9560 if (cs->debug & L1_DEB_WARN)
9561 debugl1(cs, "isar IIS_PSTEV pmode %d stat %x",
9562 @@ -1278,9 +1266,6 @@ ftimer_handler(struct BCState *bcs) {
9563 if (test_and_clear_bit(BC_FLG_LL_CONN, &bcs->Flag)) {
9564 isar_sched_event(bcs, B_LL_CONNECT);
9565 }
9566 - if (test_and_clear_bit(BC_FLG_FTI_FTS, &bcs->Flag)) {
9567 - isar_sched_event(bcs, B_LL_OK);
9568 - }
9569 }
9570
9571 static void
9572 @@ -1303,7 +1288,7 @@ setup_pump(struct BCState *bcs) {
9573 } else {
9574 param[5] = PV32P6_ATN;
9575 }
9576 - param[0] = para_TOA; /* 6 db */
9577 + param[0] = 6; /* 6 db */
9578 param[1] = PV32P2_V23R | PV32P2_V22A | PV32P2_V22B |
9579 PV32P2_V22C | PV32P2_V21 | PV32P2_BEL;
9580 param[2] = PV32P3_AMOD | PV32P3_V32B | PV32P3_V23B;
9581 @@ -1319,7 +1304,7 @@ setup_pump(struct BCState *bcs) {
9582 } else {
9583 param[1] = PFAXP2_ATN;
9584 }
9585 - param[0] = para_TOA; /* 6 db */
9586 + param[0] = 6; /* 6 db */
9587 sendmsg(cs, dps | ISAR_HIS_PUMPCFG, ctrl, 2, param);
9588 bcs->hw.isar.state = STFAX_NULL;
9589 bcs->hw.isar.newcmd = 0;
9590 @@ -1348,6 +1333,7 @@ setup_sart(struct BCState *bcs) {
9591 "\0\0");
9592 break;
9593 case L1_MODE_HDLC:
9594 + case L1_MODE_FAX:
9595 param[0] = 0;
9596 sendmsg(cs, dps | ISAR_HIS_SARTCFG, SMODE_HDLC, 1,
9597 param);
9598 @@ -1359,9 +1345,6 @@ setup_sart(struct BCState *bcs) {
9599 sendmsg(cs, dps | ISAR_HIS_SARTCFG, ctrl, 2,
9600 param);
9601 break;
9602 - case L1_MODE_FAX:
9603 - /* SART must not configured with FAX */
9604 - break;
9605 }
9606 udelay(1000);
9607 sendmsg(cs, dps | ISAR_HIS_BSTREQ, 0, 0, NULL);
9608 @@ -1465,7 +1448,6 @@ isar_pump_cmd(struct BCState *bcs, u_cha
9609
9610 switch(cmd) {
9611 case ISDN_FAX_CLASS1_FTM:
9612 - test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9613 if (bcs->hw.isar.state == STFAX_READY) {
9614 p1 = para;
9615 ctrl = PCTRL_CMD_FTM;
9616 @@ -1489,7 +1471,6 @@ isar_pump_cmd(struct BCState *bcs, u_cha
9617 }
9618 break;
9619 case ISDN_FAX_CLASS1_FTH:
9620 - test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9621 if (bcs->hw.isar.state == STFAX_READY) {
9622 p1 = para;
9623 ctrl = PCTRL_CMD_FTH;
9624 @@ -1513,7 +1494,6 @@ isar_pump_cmd(struct BCState *bcs, u_cha
9625 }
9626 break;
9627 case ISDN_FAX_CLASS1_FRM:
9628 - test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9629 if (bcs->hw.isar.state == STFAX_READY) {
9630 p1 = para;
9631 ctrl = PCTRL_CMD_FRM;
9632 @@ -1537,7 +1517,6 @@ isar_pump_cmd(struct BCState *bcs, u_cha
9633 }
9634 break;
9635 case ISDN_FAX_CLASS1_FRH:
9636 - test_and_set_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9637 if (bcs->hw.isar.state == STFAX_READY) {
9638 p1 = para;
9639 ctrl = PCTRL_CMD_FRH;
9640 @@ -1560,11 +1539,6 @@ isar_pump_cmd(struct BCState *bcs, u_cha
9641 bcs->hw.isar.state = STFAX_ESCAPE;
9642 }
9643 break;
9644 - case ISDN_FAXPUMP_HALT:
9645 - bcs->hw.isar.state = STFAX_NULL;
9646 - nom = 0;
9647 - ctrl = PCTRL_CMD_HALT;
9648 - break;
9649 }
9650 if (ctrl)
9651 sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, ctrl, nom, &p1);
9652 @@ -1658,15 +1632,6 @@ isar_l2l1(struct PStack *st, int pr, voi
9653 l1_msg_b(st, pr, arg);
9654 break;
9655 case (PH_DEACTIVATE | CONFIRM):
9656 - switch(st->l1.mode) {
9657 - case L1_MODE_TRANS:
9658 - case L1_MODE_HDLC:
9659 - case L1_MODE_V32:
9660 - break;
9661 - case L1_MODE_FAX:
9662 - isar_pump_cmd(st->l1.bcs, ISDN_FAXPUMP_HALT, 0);
9663 - break;
9664 - }
9665 test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
9666 test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
9667 if (st->l1.bcs->cs->debug & L1_DEB_HSCX)
9668 @@ -1758,51 +1723,6 @@ isar_auxcmd(struct IsdnCardState *cs, is
9669 test_and_set_bit(BC_FLG_DLEETX,
9670 &bcs->Flag);
9671 break;
9672 - case ISDN_FAX_CLASS1_FTS:
9673 - if (ic->parm.aux.subcmd == AT_QUERY) {
9674 - ic->command = ISDN_STAT_FAXIND;
9675 - ic->parm.aux.cmd = ISDN_FAX_CLASS1_OK;
9676 - cs->iif.statcallb(ic);
9677 - return(0);
9678 - } else if (ic->parm.aux.subcmd == AT_EQ_QUERY) {
9679 - strcpy(ic->parm.aux.para, "0-255");
9680 - ic->command = ISDN_STAT_FAXIND;
9681 - ic->parm.aux.cmd = ISDN_FAX_CLASS1_QUERY;
9682 - cs->iif.statcallb(ic);
9683 - return(0);
9684 - } else if (ic->parm.aux.subcmd == AT_EQ_VALUE) {
9685 - if (cs->debug & L1_DEB_HSCX)
9686 - debugl1(cs, "isar_auxcmd %s=%d",
9687 - FC1_CMD[ic->parm.aux.cmd], ic->parm.aux.para[0]);
9688 - if (bcs->hw.isar.state == STFAX_READY) {
9689 - if (! ic->parm.aux.para[0]) {
9690 - ic->command = ISDN_STAT_FAXIND;
9691 - ic->parm.aux.cmd = ISDN_FAX_CLASS1_OK;
9692 - cs->iif.statcallb(ic);
9693 - return(0);
9694 - }
9695 - if (! test_and_set_bit(BC_FLG_FTI_RUN, &bcs->Flag)) {
9696 - /* n*10 ms */
9697 - bcs->hw.isar.ftimer.expires =
9698 - jiffies + ((ic->parm.aux.para[0] * 10 * HZ)/1000);
9699 - test_and_set_bit(BC_FLG_FTI_FTS, &bcs->Flag);
9700 - add_timer(&bcs->hw.isar.ftimer);
9701 - return(0);
9702 - } else {
9703 - if (cs->debug)
9704 - debugl1(cs, "isar FTS=%d and FTI busy",
9705 - ic->parm.aux.para[0]);
9706 - }
9707 - } else {
9708 - if (cs->debug)
9709 - debugl1(cs, "isar FTS=%d and isar.state not ready(%x)",
9710 - ic->parm.aux.para[0],bcs->hw.isar.state);
9711 - }
9712 - ic->command = ISDN_STAT_FAXIND;
9713 - ic->parm.aux.cmd = ISDN_FAX_CLASS1_ERROR;
9714 - cs->iif.statcallb(ic);
9715 - }
9716 - break;
9717 case ISDN_FAX_CLASS1_FRM:
9718 case ISDN_FAX_CLASS1_FRH:
9719 case ISDN_FAX_CLASS1_FTM:
9720 @@ -1815,24 +1735,16 @@ isar_auxcmd(struct IsdnCardState *cs, is
9721 cs->iif.statcallb(ic);
9722 return(0);
9723 } else if (ic->parm.aux.subcmd == AT_EQ_QUERY) {
9724 - char *p = ic->parm.aux.para;
9725 - for(i=0;i<FAXMODCNT;i++)
9726 - if ((1<<i) & modmask)
9727 - p += sprintf(p, "%d,", faxmodulation[i]);
9728 - p--;
9729 - *p=0;
9730 + strcpy(ic->parm.aux.para, faxmodulation_s);
9731 ic->command = ISDN_STAT_FAXIND;
9732 ic->parm.aux.cmd = ISDN_FAX_CLASS1_QUERY;
9733 cs->iif.statcallb(ic);
9734 return(0);
9735 } else if (ic->parm.aux.subcmd == AT_EQ_VALUE) {
9736 - if (cs->debug & L1_DEB_HSCX)
9737 - debugl1(cs, "isar_auxcmd %s=%d",
9738 - FC1_CMD[ic->parm.aux.cmd], ic->parm.aux.para[0]);
9739 for(i=0;i<FAXMODCNT;i++)
9740 if (faxmodulation[i]==ic->parm.aux.para[0])
9741 break;
9742 - if ((i < FAXMODCNT) && ((1<<i) & modmask) &&
9743 + if ((FAXMODCNT > i) &&
9744 test_bit(BC_FLG_INIT, &bcs->Flag)) {
9745 isar_pump_cmd(bcs,
9746 ic->parm.aux.cmd,
9747 @@ -1850,7 +1762,7 @@ isar_auxcmd(struct IsdnCardState *cs, is
9748 break;
9749 case (ISDN_CMD_IOCTL):
9750 switch (ic->arg) {
9751 - case 9: /* load firmware */
9752 + case (9): /* load firmware */
9753 features = ISDN_FEATURE_L2_MODEM |
9754 ISDN_FEATURE_L2_FAX |
9755 ISDN_FEATURE_L3_FCLASS1;
9756 @@ -1860,26 +1772,6 @@ isar_auxcmd(struct IsdnCardState *cs, is
9757 else
9758 ll_run(cs, features);
9759 break;
9760 - case 20:
9761 - features = *(unsigned int *) ic->parm.num;
9762 - printk(KERN_DEBUG "HiSax: max modulation old(%04x) new(%04x)\n",
9763 - modmask, features);
9764 - modmask = features;
9765 - break;
9766 - case 21:
9767 - features = *(unsigned int *) ic->parm.num;
9768 - printk(KERN_DEBUG "HiSax: FRM extra delay old(%d) new(%d) ms\n",
9769 - frm_extra_delay, features);
9770 - if (features >= 0)
9771 - frm_extra_delay = features;
9772 - break;
9773 - case 22:
9774 - features = *(unsigned int *) ic->parm.num;
9775 - printk(KERN_DEBUG "HiSax: TOA old(%d) new(%d) db\n",
9776 - para_TOA, features);
9777 - if (features >= 0 && features < 32)
9778 - para_TOA = features;
9779 - break;
9780 default:
9781 printk(KERN_DEBUG "HiSax: invalid ioctl %d\n",
9782 (int) ic->arg);
9783 --- a/drivers/isdn/hisax/isar.h
9784 +++ b/drivers/isdn/hisax/isar.h
9785 @@ -1,4 +1,4 @@
9786 -/* $Id: isar.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9787 +/* $Id: isar.h,v 1.11 2001/09/24 13:22:56 kai Exp $
9788 *
9789 * ISAR (Siemens PSB 7110) specific defines
9790 *
9791 @@ -28,8 +28,6 @@
9792 #define ISAR_HIS_FIRM 0x1e
9793 #define ISAR_HIS_STDSP 0x08
9794 #define ISAR_HIS_DIAG 0x05
9795 -#define ISAR_HIS_WAITSTATE 0x27
9796 -#define ISAR_HIS_TIMERIRQ 0x25
9797 #define ISAR_HIS_P0CFG 0x3c
9798 #define ISAR_HIS_P12CFG 0x24
9799 #define ISAR_HIS_SARTCFG 0x25
9800 @@ -45,10 +43,6 @@
9801 #define ISAR_HIS_DPS2 0x80
9802 #define SET_DPS(x) ((x<<6) & 0xc0)
9803
9804 -#define ISAR_CMD_TIMERIRQ_OFF 0x20
9805 -#define ISAR_CMD_TIMERIRQ_ON 0x21
9806 -
9807 -
9808 #define ISAR_IIS_MSCMSD 0x3f
9809 #define ISAR_IIS_VNR 0x15
9810 #define ISAR_IIS_DKEY 0x03
9811 @@ -213,8 +207,6 @@
9812 #define STFAX_ESCAPE 5
9813 #define STFAX_SILDET 6
9814
9815 -#define ISDN_FAXPUMP_HALT 100
9816 -
9817 extern int ISARVersion(struct IsdnCardState *cs, char *s);
9818 extern void isar_int_main(struct IsdnCardState *cs);
9819 extern void initisar(struct IsdnCardState *cs);
9820 --- a/drivers/isdn/hisax/isdnl1.c
9821 +++ b/drivers/isdn/hisax/isdnl1.c
9822 @@ -1,4 +1,4 @@
9823 -/* $Id: isdnl1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9824 +/* $Id: isdnl1.c,v 2.46 2001/09/24 13:22:56 kai Exp $
9825 *
9826 * common low level stuff for Siemens Chipsetbased isdn cards
9827 *
9828 @@ -18,7 +18,7 @@
9829 *
9830 */
9831
9832 -const char *l1_revision = "$Revision: 1.1.4.1 $";
9833 +const char *l1_revision = "$Revision: 2.46 $";
9834
9835 #define __NO_VERSION__
9836 #include <linux/init.h>
9837 --- a/drivers/isdn/hisax/isdnl1.h
9838 +++ b/drivers/isdn/hisax/isdnl1.h
9839 @@ -1,4 +1,4 @@
9840 -/* $Id: isdnl1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9841 +/* $Id: isdnl1.h,v 2.12 2001/09/24 13:22:56 kai Exp $
9842 *
9843 * Layer 1 defines
9844 *
9845 --- a/drivers/isdn/hisax/isdnl2.c
9846 +++ b/drivers/isdn/hisax/isdnl2.c
9847 @@ -1,4 +1,4 @@
9848 -/* $Id: isdnl2.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9849 +/* $Id: isdnl2.c,v 2.30 2001/09/24 13:22:56 kai Exp $
9850 *
9851 * Author Karsten Keil
9852 * based on the teles driver from Jan den Ouden
9853 @@ -20,7 +20,7 @@
9854 #include "hisax.h"
9855 #include "isdnl2.h"
9856
9857 -const char *l2_revision = "$Revision: 1.1.4.1 $";
9858 +const char *l2_revision = "$Revision: 2.30 $";
9859
9860 static void l2m_debug(struct FsmInst *fi, char *fmt, ...);
9861
9862 @@ -1418,8 +1418,8 @@ l2_st5_tei_remove(struct FsmInst *fi, in
9863 freewin(st);
9864 st->l2.tei = -1;
9865 stop_t200(st, 17);
9866 - st5_dl_release_l2l3(st);
9867 FsmChangeState(fi, ST_L2_1);
9868 + st5_dl_release_l2l3(st);
9869 }
9870
9871 static void
9872 --- a/drivers/isdn/hisax/isdnl2.h
9873 +++ b/drivers/isdn/hisax/isdnl2.h
9874 @@ -1,4 +1,4 @@
9875 -/* $Id: isdnl2.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9876 +/* $Id$
9877 *
9878 * Layer 2 defines
9879 *
9880 --- a/drivers/isdn/hisax/isdnl3.c
9881 +++ b/drivers/isdn/hisax/isdnl3.c
9882 @@ -1,4 +1,4 @@
9883 -/* $Id: isdnl3.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9884 +/* $Id: isdnl3.c,v 2.22 2001/09/24 13:22:56 kai Exp $
9885 *
9886 * Author Karsten Keil
9887 * based on the teles driver from Jan den Ouden
9888 @@ -21,7 +21,7 @@
9889 #include "isdnl3.h"
9890 #include <linux/config.h>
9891
9892 -const char *l3_revision = "$Revision: 1.1.4.1 $";
9893 +const char *l3_revision = "$Revision: 2.22 $";
9894
9895 static struct Fsm l3fsm;
9896
9897 --- a/drivers/isdn/hisax/isdnl3.h
9898 +++ b/drivers/isdn/hisax/isdnl3.h
9899 @@ -1,4 +1,4 @@
9900 -/* $Id: isdnl3.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9901 +/* $Id$
9902 *
9903 * This software may be used and distributed according to the terms
9904 * of the GNU General Public License, incorporated herein by reference.
9905 --- a/drivers/isdn/hisax/isurf.c
9906 +++ b/drivers/isdn/hisax/isurf.c
9907 @@ -1,4 +1,4 @@
9908 -/* $Id: isurf.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9909 +/* $Id: isurf.c,v 1.12 2001/09/24 13:22:56 kai Exp $
9910 *
9911 * low level stuff for Siemens I-Surf/I-Talk cards
9912 *
9913 @@ -16,11 +16,10 @@
9914 #include "isac.h"
9915 #include "isar.h"
9916 #include "isdnl1.h"
9917 -#include <linux/isapnp.h>
9918
9919 extern const char *CardType[];
9920
9921 -static const char *ISurf_revision = "$Revision: 1.1.4.1 $";
9922 +static const char *ISurf_revision = "$Revision: 1.12 $";
9923
9924 #define byteout(addr,val) outb(val,addr)
9925 #define bytein(addr) inb(addr)
9926 @@ -128,8 +127,10 @@ void
9927 release_io_isurf(struct IsdnCardState *cs)
9928 {
9929 release_region(cs->hw.isurf.reset, 1);
9930 +#ifdef COMPAT_HAS_ISA_IOREMAP
9931 iounmap((unsigned char *)cs->hw.isurf.isar);
9932 release_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE);
9933 +#endif
9934 }
9935
9936 static void
9937 @@ -194,10 +195,6 @@ isurf_auxcmd(struct IsdnCardState *cs, i
9938 return(isar_auxcmd(cs, ic));
9939 }
9940
9941 -#ifdef __ISAPNP__
9942 -static struct pci_bus *pnp_surf __devinitdata = NULL;
9943 -#endif
9944 -
9945 int __init
9946 setup_isurf(struct IsdnCard *card)
9947 {
9948 @@ -215,58 +212,9 @@ setup_isurf(struct IsdnCard *card)
9949 cs->hw.isurf.phymem = card->para[2];
9950 cs->irq = card->para[0];
9951 } else {
9952 -#ifdef __ISAPNP__
9953 - struct pci_bus *pb;
9954 - struct pci_dev *pd;
9955 -
9956 - if (isapnp_present()) {
9957 - cs->subtyp = 0;
9958 - if ((pb = isapnp_find_card(
9959 - ISAPNP_VENDOR('S', 'I', 'E'),
9960 - ISAPNP_FUNCTION(0x0010), pnp_surf))) {
9961 - pnp_surf = pb;
9962 - pd = NULL;
9963 - if (!(pd = isapnp_find_dev(pnp_surf,
9964 - ISAPNP_VENDOR('S', 'I', 'E'),
9965 - ISAPNP_FUNCTION(0x0010), pd))) {
9966 - printk(KERN_ERR "ISurfPnP: PnP error card found, no device\n");
9967 - return (0);
9968 - }
9969 - pd->prepare(pd);
9970 - pd->deactivate(pd);
9971 - pd->activate(pd);
9972 - /* The ISA-PnP logic apparently
9973 - * expects upper limit address to be
9974 - * set. Since the isa-pnp module
9975 - * doesn't do this, so we have to make
9976 - * up for it.
9977 - */
9978 - isapnp_cfg_begin(pd->bus->number, pd->devfn);
9979 - isapnp_write_word(ISAPNP_CFG_MEM+3,
9980 - pd->resource[8].end >> 8);
9981 - isapnp_cfg_end();
9982 - cs->hw.isurf.reset = pd->resource[0].start;
9983 - cs->hw.isurf.phymem = pd->resource[8].start;
9984 - cs->irq = pd->irq_resource[0].start;
9985 - if (!cs->irq || !cs->hw.isurf.reset || !cs->hw.isurf.phymem) {
9986 - printk(KERN_ERR "ISurfPnP:some resources are missing %d/%x/%lx\n",
9987 - cs->irq, cs->hw.isurf.reset, cs->hw.isurf.phymem);
9988 - pd->deactivate(pd);
9989 - return(0);
9990 - }
9991 - } else {
9992 - printk(KERN_INFO "ISurfPnP: no ISAPnP card found\n");
9993 - return(0);
9994 - }
9995 - } else {
9996 - printk(KERN_INFO "ISurfPnP: no ISAPnP bus found\n");
9997 - return(0);
9998 - }
9999 -#else
10000 printk(KERN_WARNING "HiSax: %s port/mem not set\n",
10001 CardType[card->typ]);
10002 return (0);
10003 -#endif
10004 }
10005 if (check_region(cs->hw.isurf.reset, 1)) {
10006 printk(KERN_WARNING
10007 @@ -277,6 +225,7 @@ setup_isurf(struct IsdnCard *card)
10008 } else {
10009 request_region(cs->hw.isurf.reset, 1, "isurf isdn");
10010 }
10011 +#ifdef COMPAT_HAS_ISA_IOREMAP
10012 if (check_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE)) {
10013 printk(KERN_WARNING
10014 "HiSax: %s memory region %lx-%lx already in use\n",
10015 @@ -292,6 +241,10 @@ setup_isurf(struct IsdnCard *card)
10016 cs->hw.isurf.isar =
10017 (unsigned long) ioremap(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE);
10018 cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET;
10019 +#else
10020 + cs->hw.isurf.isar = cs->hw.isurf.phymem + ISURF_ISAR_OFFSET;
10021 + cs->hw.isurf.isac = cs->hw.isurf.phymem + ISURF_ISAC_OFFSET;
10022 +#endif
10023 printk(KERN_INFO
10024 "ISurf: defined at 0x%x 0x%lx IRQ %d\n",
10025 cs->hw.isurf.reset,
10026 --- a/drivers/isdn/hisax/ix1_micro.c
10027 +++ b/drivers/isdn/hisax/ix1_micro.c
10028 @@ -1,4 +1,4 @@
10029 -/* $Id: ix1_micro.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10030 +/* $Id: ix1_micro.c,v 2.12 2001/09/24 13:22:56 kai Exp $
10031 *
10032 * low level stuff for ITK ix1-micro Rev.2 isdn cards
10033 * derived from the original file teles3.c from Karsten Keil
10034 @@ -19,14 +19,13 @@
10035
10036 #define __NO_VERSION__
10037 #include <linux/init.h>
10038 -#include <linux/isapnp.h>
10039 #include "hisax.h"
10040 #include "isac.h"
10041 #include "hscx.h"
10042 #include "isdnl1.h"
10043
10044 extern const char *CardType[];
10045 -const char *ix1_revision = "$Revision: 1.1.4.1 $";
10046 +const char *ix1_revision = "$Revision: 2.12 $";
10047
10048 #define byteout(addr,val) outb(val,addr)
10049 #define bytein(addr) inb(addr)
10050 @@ -219,21 +218,6 @@ ix1_card_msg(struct IsdnCardState *cs, i
10051 return(0);
10052 }
10053
10054 -#ifdef __ISAPNP__
10055 -static struct isapnp_device_id itk_ids[] __initdata = {
10056 - { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25),
10057 - ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25),
10058 - (unsigned long) "ITK micro 2" },
10059 - { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x29),
10060 - ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x29),
10061 - (unsigned long) "ITK micro 2." },
10062 - { 0, }
10063 -};
10064 -
10065 -static struct isapnp_device_id *idev = &itk_ids[0];
10066 -static struct pci_bus *pnp_c __devinitdata = NULL;
10067 -#endif
10068 -
10069
10070 int __init
10071 setup_ix1micro(struct IsdnCard *card)
10072 @@ -246,45 +230,6 @@ setup_ix1micro(struct IsdnCard *card)
10073 if (cs->typ != ISDN_CTYPE_IX1MICROR2)
10074 return (0);
10075
10076 -#ifdef __ISAPNP__
10077 - if (!card->para[1] && isapnp_present()) {
10078 - struct pci_bus *pb;
10079 - struct pci_dev *pd;
10080 -
10081 - while(idev->card_vendor) {
10082 - if ((pb = isapnp_find_card(idev->card_vendor,
10083 - idev->card_device, pnp_c))) {
10084 - pnp_c = pb;
10085 - pd = NULL;
10086 - if ((pd = isapnp_find_dev(pnp_c,
10087 - idev->vendor, idev->function, pd))) {
10088 - printk(KERN_INFO "HiSax: %s detected\n",
10089 - (char *)idev->driver_data);
10090 - pd->prepare(pd);
10091 - pd->deactivate(pd);
10092 - pd->activate(pd);
10093 - card->para[1] = pd->resource[0].start;
10094 - card->para[0] = pd->irq_resource[0].start;
10095 - if (!card->para[0] || !card->para[1]) {
10096 - printk(KERN_ERR "ITK PnP:some resources are missing %ld/%lx\n",
10097 - card->para[0], card->para[1]);
10098 - pd->deactivate(pd);
10099 - return(0);
10100 - }
10101 - break;
10102 - } else {
10103 - printk(KERN_ERR "ITK PnP: PnP error card found, no device\n");
10104 - }
10105 - }
10106 - idev++;
10107 - pnp_c=NULL;
10108 - }
10109 - if (!idev->card_vendor) {
10110 - printk(KERN_INFO "ITK PnP: no ISAPnP card found\n");
10111 - return(0);
10112 - }
10113 - }
10114 -#endif
10115 /* IO-Ports */
10116 cs->hw.ix1.isac_ale = card->para[1] + ISAC_COMMAND_OFFSET;
10117 cs->hw.ix1.hscx_ale = card->para[1] + HSCX_COMMAND_OFFSET;
10118 --- a/drivers/isdn/hisax/jade.c
10119 +++ b/drivers/isdn/hisax/jade.c
10120 @@ -1,4 +1,4 @@
10121 -/* $Id: jade.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10122 +/* $Id: jade.c,v 1.9 2001/09/24 13:22:56 kai Exp $
10123 *
10124 * JADE stuff (derived from original hscx.c)
10125 *
10126 --- a/drivers/isdn/hisax/jade.h
10127 +++ b/drivers/isdn/hisax/jade.h
10128 @@ -1,4 +1,4 @@
10129 -/* $Id: jade.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10130 +/* $Id: jade.h,v 1.5 2001/09/24 13:22:56 kai Exp $
10131 *
10132 * JADE specific defines
10133 *
10134 --- a/drivers/isdn/hisax/jade_irq.c
10135 +++ b/drivers/isdn/hisax/jade_irq.c
10136 @@ -1,4 +1,4 @@
10137 -/* $Id: jade_irq.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10138 +/* $Id: jade_irq.c,v 1.7 2001/09/24 13:22:56 kai Exp $
10139 *
10140 * Low level JADE IRQ stuff (derived from original hscx_irq.c)
10141 *
10142 --- a/drivers/isdn/hisax/l3_1tr6.c
10143 +++ b/drivers/isdn/hisax/l3_1tr6.c
10144 @@ -1,4 +1,4 @@
10145 -/* $Id: l3_1tr6.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10146 +/* $Id: l3_1tr6.c,v 2.15 2001/09/24 13:22:56 kai Exp $
10147 *
10148 * German 1TR6 D-channel protocol
10149 *
10150 @@ -20,7 +20,7 @@
10151 #include <linux/ctype.h>
10152
10153 extern char *HiSax_getrev(const char *revision);
10154 -const char *l3_1tr6_revision = "$Revision: 1.1.4.1 $";
10155 +const char *l3_1tr6_revision = "$Revision: 2.15 $";
10156
10157 #define MsgHead(ptr, cref, mty, dis) \
10158 *ptr++ = dis; \
10159 --- a/drivers/isdn/hisax/l3_1tr6.h
10160 +++ b/drivers/isdn/hisax/l3_1tr6.h
10161 @@ -1,4 +1,4 @@
10162 -/* $Id: l3_1tr6.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10163 +/* $Id$
10164 *
10165 * German 1TR6 D-channel protocol defines
10166 *
10167 --- a/drivers/isdn/hisax/l3dss1.c
10168 +++ b/drivers/isdn/hisax/l3dss1.c
10169 @@ -1,4 +1,4 @@
10170 -/* $Id: l3dss1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10171 +/* $Id: l3dss1.c,v 2.32 2001/09/24 13:22:56 kai Exp $
10172 *
10173 * EURO/DSS1 D-channel protocol
10174 *
10175 @@ -27,7 +27,7 @@
10176 #include <linux/config.h>
10177
10178 extern char *HiSax_getrev(const char *revision);
10179 -const char *dss1_revision = "$Revision: 1.1.4.1 $";
10180 +const char *dss1_revision = "$Revision: 2.32 $";
10181
10182 #define EXT_BEARER_CAPS 1
10183
10184 --- a/drivers/isdn/hisax/l3dss1.h
10185 +++ b/drivers/isdn/hisax/l3dss1.h
10186 @@ -1,4 +1,4 @@
10187 -/* $Id: l3dss1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10188 +/* $Id$
10189 *
10190 * DSS1 (Euro) D-channel protocol defines
10191 *
10192 --- a/drivers/isdn/hisax/l3ni1.c
10193 +++ b/drivers/isdn/hisax/l3ni1.c
10194 @@ -1,4 +1,4 @@
10195 -/* $Id: l3ni1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10196 +/* $Id: l3ni1.c,v 2.8 2001/09/24 13:22:56 kai Exp $
10197 *
10198 * NI1 D-channel protocol
10199 *
10200 @@ -25,7 +25,7 @@
10201 #include <linux/ctype.h>
10202
10203 extern char *HiSax_getrev(const char *revision);
10204 -const char *ni1_revision = "$Revision: 1.1.4.1 $";
10205 +const char *ni1_revision = "$Revision: 2.8 $";
10206
10207 #define EXT_BEARER_CAPS 1
10208
10209 --- a/drivers/isdn/hisax/l3ni1.h
10210 +++ b/drivers/isdn/hisax/l3ni1.h
10211 @@ -1,4 +1,4 @@
10212 -/* $Id: l3ni1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10213 +/* $Id$
10214 *
10215 * NI1 D-channel protocol
10216 *
10217 --- a/drivers/isdn/hisax/lmgr.c
10218 +++ b/drivers/isdn/hisax/lmgr.c
10219 @@ -1,4 +1,4 @@
10220 -/* $Id: lmgr.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10221 +/* $Id$
10222 *
10223 * Layermanagement module
10224 *
10225 --- a/drivers/isdn/hisax/md5sums.asc
10226 +++ b/drivers/isdn/hisax/md5sums.asc
10227 @@ -1,33 +1,22 @@
10228 ------BEGIN PGP SIGNED MESSAGE-----
10229 -Hash: SHA1
10230 -
10231 # This are valid md5sums for certificated HiSax driver.
10232 # The certification is valid only if the md5sums of all files match.
10233 # The certification is valid only for ELSA Microlink PCI,
10234 -# Eicon Technology Diva 2.01 PCI, Sedlbauer SpeedFax+,
10235 -# HFC-S PCI A based cards and HFC-S USB based ISDN
10236 -# terminal adapters in the moment.
10237 +# Eicon Technology Diva 2.01 PCI, Sedlbauer SpeedFax+,
10238 +# HFC-S PCI A based cards and HFC-S USB based isdn tas
10239 +# in the moment.
10240 # Read ../../../Documentation/isdn/HiSax.cert for more informations.
10241 #
10242 -cd4a9917e1147039d5dfc66440d42054 isac.c
10243 -211840e78b56c9d4753be9c85da21a50 isdnl1.c
10244 -5ce9b1fff42a02f9c2eb4fb81c701b1f isdnl2.c
10245 -6948de0c43513dd23c6706feb5fc2209 isdnl3.c
10246 -3730780b69368218d756024165efea79 tei.c
10247 -16e72710eb58da01415b877490f5d2ac callc.c
10248 -6abc55c77e0f3149ae9334f3257a1a1a cert.c
10249 -27bdb2800d4590e00da20eff241edc47 l3dss1.c
10250 -df8bb877b854c4302d396b554e4e84ef l3_1tr6.c
10251 -9d8b4bed15370063d1b16e47080f50e1 elsa.c
10252 -210f4a3f1eebca70229d786b15cf3e90 diva.c
10253 -4ddf21079dd77e892380f789bae250a7 sedlbauer.c
10254 -8200d818771e3cbdef2a3c3e818d25ac hfc_pci.c
10255 +6f9433a8b696076562562d090e3c420f isac.c
10256 +13c3eed869f5139f44c563e3a8fea1f5 isdnl1.c
10257 +addcff863b0ff1e366c0f2ae9fa6e81e isdnl2.c
10258 +7076deb94a363945c21ea27aca4a720a isdnl3.c
10259 +51c603829b6cc4f8421f744ad657ceff tei.c
10260 +669050ab5079f02887ed0239d86e5474 callc.c
10261 +ecacd146b8f8881ef9349935dab3df4a cert.c
10262 +fadeb3b85bb23bc1ac48470c0848d6fa l3dss1.c
10263 +cf7dec9fac6283716904d26b99188476 l3_1tr6.c
10264 +2f75c8765e1be13d114d5f4433cf364b elsa.c
10265 +b4cf8a4dceed9ea6dcba65a85b4eecc7 diva.c
10266 +dee3f8f40c6fe78a4b57729804b7e6cd sedlbauer.c
10267 +0d79fe6dfc5bfaa4826970c41a6d273d hfc_pci.c
10268 # end of md5sums
10269 ------BEGIN PGP SIGNATURE-----
10270 -Version: GnuPG v1.0.6 (GNU/Linux)
10271 -Comment: For info see http://www.gnupg.org
10272 -
10273 -iD8DBQE9rE91DiY0VZsg4ukRAkKfAJ4xWUfqjc0hW+V+JPue5yr7mrt+RwCdGdSf
10274 -GIKgAEdRLzERmpt/bCCwAbY=
10275 -=FaHw
10276 ------END PGP SIGNATURE-----
10277 --- a/drivers/isdn/hisax/mic.c
10278 +++ b/drivers/isdn/hisax/mic.c
10279 @@ -1,4 +1,4 @@
10280 -/* $Id: mic.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10281 +/* $Id: mic.c,v 1.12 2001/09/24 13:22:56 kai Exp $
10282 *
10283 * low level stuff for mic cards
10284 *
10285 @@ -19,7 +19,7 @@
10286
10287 extern const char *CardType[];
10288
10289 -const char *mic_revision = "$Revision: 1.1.4.1 $";
10290 +const char *mic_revision = "$Revision: 1.12 $";
10291
10292 #define byteout(addr,val) outb(val,addr)
10293 #define bytein(addr) inb(addr)
10294 --- a/drivers/isdn/hisax/netjet.c
10295 +++ b/drivers/isdn/hisax/netjet.c
10296 @@ -1,4 +1,4 @@
10297 -/* $Id: netjet.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10298 +/* $Id: netjet.c,v 1.29 2001/09/24 13:22:56 kai Exp $
10299 *
10300 * low level stuff for Traverse Technologie NETJet ISDN cards
10301 *
10302 @@ -8,9 +8,7 @@
10303 * This software may be used and distributed according to the terms
10304 * of the GNU General Public License, incorporated herein by reference.
10305 *
10306 - * Thanks to Traverse Technologies Australia for documents and information
10307 - *
10308 - * 16-Apr-2002 - led code added - Guy Ellis (guy@traverse.com.au)
10309 + * Thanks to Traverse Technologie Australia for documents and information
10310 *
10311 */
10312
10313 @@ -26,7 +24,7 @@
10314 #include <asm/io.h>
10315 #include "netjet.h"
10316
10317 -const char *NETjet_revision = "$Revision: 1.1.4.1 $";
10318 +const char *NETjet_revision = "$Revision: 1.29 $";
10319
10320 /* Interface functions */
10321
10322 @@ -135,7 +133,6 @@ void
10323 mode_tiger(struct BCState *bcs, int mode, int bc)
10324 {
10325 struct IsdnCardState *cs = bcs->cs;
10326 - u_char led;
10327
10328 if (cs->debug & L1_DEB_HSCX)
10329 debugl1(cs, "Tiger mode %d bchan %d/%d",
10330 @@ -157,15 +154,6 @@ mode_tiger(struct BCState *bcs, int mode
10331 cs->hw.njet.dmactrl);
10332 byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0);
10333 }
10334 - if (cs->typ == ISDN_CTYPE_NETJET_S)
10335 - {
10336 - // led off
10337 - led = bc & 0x01;
10338 - led = 0x01 << (6 + led); // convert to mask
10339 - led = ~led;
10340 - cs->hw.njet.auxd &= led;
10341 - byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
10342 - }
10343 break;
10344 case (L1_MODE_TRANS):
10345 break;
10346 @@ -191,14 +179,6 @@ mode_tiger(struct BCState *bcs, int mode
10347 bcs->hw.tiger.sendp = bcs->hw.tiger.send;
10348 bcs->hw.tiger.free = NETJET_DMA_TXSIZE;
10349 test_and_set_bit(BC_FLG_EMPTY, &bcs->Flag);
10350 - if (cs->typ == ISDN_CTYPE_NETJET_S)
10351 - {
10352 - // led on
10353 - led = bc & 0x01;
10354 - led = 0x01 << (6 + led); // convert to mask
10355 - cs->hw.njet.auxd |= led;
10356 - byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
10357 - }
10358 break;
10359 }
10360 if (cs->debug & L1_DEB_HSCX)
10361 @@ -874,13 +854,9 @@ tiger_l2l1(struct PStack *st, int pr, vo
10362 case (PH_ACTIVATE | REQUEST):
10363 test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
10364 mode_tiger(st->l1.bcs, st->l1.mode, st->l1.bc);
10365 - /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG */
10366 - st->l1.bcs->cs->cardmsg(st->l1.bcs->cs, MDL_BC_ASSIGN, (void *)(&st->l1.bc));
10367 l1_msg_b(st, pr, arg);
10368 break;
10369 case (PH_DEACTIVATE | REQUEST):
10370 - /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG */
10371 - st->l1.bcs->cs->cardmsg(st->l1.bcs->cs, MDL_BC_RELEASE, (void *)(&st->l1.bc));
10372 l1_msg_b(st, pr, arg);
10373 break;
10374 case (PH_DEACTIVATE | CONFIRM):
10375 --- a/drivers/isdn/hisax/netjet.h
10376 +++ b/drivers/isdn/hisax/netjet.h
10377 @@ -1,4 +1,4 @@
10378 -/* $Id: netjet.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10379 +/* $Id: netjet.h,v 2.8 2001/09/24 13:22:56 kai Exp $
10380 *
10381 * NETjet common header file
10382 *
10383 --- a/drivers/isdn/hisax/niccy.c
10384 +++ b/drivers/isdn/hisax/niccy.c
10385 @@ -1,4 +1,4 @@
10386 -/* $Id: niccy.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10387 +/* $Id: niccy.c,v 1.21 2001/10/20 22:05:00 kai Exp $
10388 *
10389 * low level stuff for Dr. Neuhaus NICCY PnP and NICCY PCI and
10390 * compatible (SAGEM cybermodem)
10391 @@ -22,10 +22,10 @@
10392 #include "hscx.h"
10393 #include "isdnl1.h"
10394 #include <linux/pci.h>
10395 -#include <linux/isapnp.h>
10396 +#include <linux/isdn_compat.h>
10397
10398 extern const char *CardType[];
10399 -const char *niccy_revision = "$Revision: 1.1.4.1 $";
10400 +const char *niccy_revision = "$Revision: 1.21 $";
10401
10402 #define byteout(addr,val) outb(val,addr)
10403 #define bytein(addr) inb(addr)
10404 @@ -239,9 +239,6 @@ niccy_card_msg(struct IsdnCardState *cs,
10405 }
10406
10407 static struct pci_dev *niccy_dev __initdata = NULL;
10408 -#ifdef __ISAPNP__
10409 -static struct pci_bus *pnp_c __devinitdata = NULL;
10410 -#endif
10411
10412 int __init
10413 setup_niccy(struct IsdnCard *card)
10414 @@ -253,39 +250,7 @@ setup_niccy(struct IsdnCard *card)
10415 printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
10416 if (cs->typ != ISDN_CTYPE_NICCY)
10417 return (0);
10418 -#ifdef __ISAPNP__
10419 - if (!card->para[1] && isapnp_present()) {
10420 - struct pci_bus *pb;
10421 - struct pci_dev *pd;
10422 -
10423 - if ((pb = isapnp_find_card(
10424 - ISAPNP_VENDOR('S', 'D', 'A'),
10425 - ISAPNP_FUNCTION(0x0150), pnp_c))) {
10426 - pnp_c = pb;
10427 - pd = NULL;
10428 - if (!(pd = isapnp_find_dev(pnp_c,
10429 - ISAPNP_VENDOR('S', 'D', 'A'),
10430 - ISAPNP_FUNCTION(0x0150), pd))) {
10431 - printk(KERN_ERR "NiccyPnP: PnP error card found, no device\n");
10432 - return (0);
10433 - }
10434 - pd->prepare(pd);
10435 - pd->deactivate(pd);
10436 - pd->activate(pd);
10437 - card->para[1] = pd->resource[0].start;
10438 - card->para[2] = pd->resource[1].start;
10439 - card->para[0] = pd->irq_resource[0].start;
10440 - if (!card->para[0] || !card->para[1] || !card->para[2]) {
10441 - printk(KERN_ERR "NiccyPnP:some resources are missing %ld/%lx/%lx\n",
10442 - card->para[0], card->para[1], card->para[2]);
10443 - pd->deactivate(pd);
10444 - return(0);
10445 - }
10446 - } else {
10447 - printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
10448 - }
10449 - }
10450 -#endif
10451 +
10452 if (card->para[1]) {
10453 cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
10454 cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
10455 @@ -331,12 +296,12 @@ setup_niccy(struct IsdnCard *card)
10456 return(0);
10457 }
10458 cs->irq = niccy_dev->irq;
10459 - cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
10460 + cs->hw.niccy.cfg_reg = pci_resource_start_io(niccy_dev, 0);
10461 if (!cs->hw.niccy.cfg_reg) {
10462 printk(KERN_WARNING "Niccy: No IO-Adr for PCI cfg found\n");
10463 return(0);
10464 }
10465 - pci_ioaddr = pci_resource_start(niccy_dev, 1);
10466 + pci_ioaddr = pci_resource_start_io(niccy_dev, 1);
10467 if (!pci_ioaddr) {
10468 printk(KERN_WARNING "Niccy: No IO-Adr for PCI card found\n");
10469 return(0);
10470 --- a/drivers/isdn/hisax/nj_s.c
10471 +++ b/drivers/isdn/hisax/nj_s.c
10472 @@ -1,4 +1,4 @@
10473 -/* $Id: nj_s.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10474 +/* $Id: nj_s.c,v 2.13 2001/09/24 13:22:56 kai Exp $
10475 *
10476 * This software may be used and distributed according to the terms
10477 * of the GNU General Public License, incorporated herein by reference.
10478 @@ -12,11 +12,12 @@
10479 #include "isac.h"
10480 #include "isdnl1.h"
10481 #include <linux/pci.h>
10482 +#include <linux/isdn_compat.h>
10483 #include <linux/interrupt.h>
10484 #include <linux/ppp_defs.h>
10485 #include "netjet.h"
10486
10487 -const char *NETjet_S_revision = "$Revision: 1.1.4.1 $";
10488 +const char *NETjet_S_revision = "$Revision: 2.13 $";
10489
10490 static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
10491 {
10492 @@ -130,7 +131,6 @@ NETjet_S_card_msg(struct IsdnCardState *
10493 release_io_netjet(cs);
10494 return(0);
10495 case CARD_INIT:
10496 - reset_netjet_s(cs);
10497 inittiger(cs);
10498 clear_pending_isac_ints(cs);
10499 initisac(cs);
10500 @@ -180,19 +180,11 @@ setup_netjet_s(struct IsdnCard *card)
10501 printk(KERN_WARNING "NETjet-S: No IRQ for PCI card found\n");
10502 return(0);
10503 }
10504 - cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
10505 + cs->hw.njet.base = pci_resource_start_io(dev_netjet, 0);
10506 if (!cs->hw.njet.base) {
10507 printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n");
10508 return(0);
10509 }
10510 - /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG www.formula-n.com */
10511 - if ((dev_netjet->subsystem_vendor == 0x55) &&
10512 - (dev_netjet->subsystem_device == 0x02)) {
10513 - printk(KERN_WARNING "Netjet: You tried to load this driver with an incompatible TigerJet-card\n");
10514 - printk(KERN_WARNING "Use type=41 for Formula-n enter:now ISDN PCI and compatible\n");
10515 - return(0);
10516 - }
10517 - /* end new code */
10518 } else {
10519 printk(KERN_WARNING "NETjet-S: No PCI card found\n");
10520 return(0);
10521 @@ -263,6 +255,7 @@ setup_netjet_s(struct IsdnCard *card)
10522 } else {
10523 request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn");
10524 }
10525 + reset_netjet_s(cs);
10526 cs->readisac = &NETjet_ReadIC;
10527 cs->writeisac = &NETjet_WriteIC;
10528 cs->readisacfifo = &NETjet_ReadICfifo;
10529 --- a/drivers/isdn/hisax/nj_u.c
10530 +++ b/drivers/isdn/hisax/nj_u.c
10531 @@ -1,4 +1,4 @@
10532 -/* $Id: nj_u.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10533 +/* $Id: nj_u.c,v 2.14 2001/09/24 13:22:56 kai Exp $
10534 *
10535 * This software may be used and distributed according to the terms
10536 * of the GNU General Public License, incorporated herein by reference.
10537 @@ -12,11 +12,12 @@
10538 #include "icc.h"
10539 #include "isdnl1.h"
10540 #include <linux/pci.h>
10541 +#include <linux/isdn_compat.h>
10542 #include <linux/interrupt.h>
10543 #include <linux/ppp_defs.h>
10544 #include "netjet.h"
10545
10546 -const char *NETjet_U_revision = "$Revision: 1.1.4.1 $";
10547 +const char *NETjet_U_revision = "$Revision: 2.14 $";
10548
10549 static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
10550 {
10551 @@ -181,7 +182,7 @@ setup_netjet_u(struct IsdnCard *card)
10552 printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n");
10553 return(0);
10554 }
10555 - cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
10556 + cs->hw.njet.base = pci_resource_start_io(dev_netjet, 0);
10557 if (!cs->hw.njet.base) {
10558 printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n");
10559 return(0);
10560 --- a/drivers/isdn/hisax/q931.c
10561 +++ b/drivers/isdn/hisax/q931.c
10562 @@ -1,4 +1,4 @@
10563 -/* $Id: q931.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10564 +/* $Id: q931.c,v 1.12 2001/09/24 13:22:56 kai Exp $
10565 *
10566 * code to decode ITU Q.931 call control messages
10567 *
10568 @@ -197,6 +197,31 @@ struct MessageType mt_n1[] =
10569
10570 #define MT_N1_LEN (sizeof(mt_n1) / sizeof(struct MessageType))
10571
10572 +#if 0
10573 +static struct MessageType fac_1tr6[] =
10574 +{
10575 + {FAC_Sperre, "Sperre"},
10576 + {FAC_Forward1, "Forward 1"},
10577 + {FAC_Forward2, "Forward 2"},
10578 + {FAC_Konferenz, "Konferenz"},
10579 + {FAC_GrabBchan, "Grab Bchannel"},
10580 + {FAC_Reactivate, "Reactivate"},
10581 + {FAC_Konferenz3, "Dreier Konferenz"},
10582 + {FAC_Dienstwechsel1, "Einseitiger Dienstwechsel"},
10583 + {FAC_Dienstwechsel2, "Zweiseitiger Dienstwechsel"},
10584 + {FAC_NummernIdent, "Rufnummer-Identifizierung"},
10585 + {FAC_GBG, "GBG"},
10586 + {FAC_DisplayUebergeben, "Display Uebergeben"},
10587 + {FAC_DisplayUmgeleitet, "Display Umgeleitet"},
10588 + {FAC_Unterdruecke, "Unterdruecke Rufnummer"},
10589 + {FAC_Deactivate, "Deactivate"},
10590 + {FAC_Activate, "Activate"},
10591 + {FAC_SPV, "SPV"},
10592 + {FAC_Rueckwechsel, "Rueckwechsel"},
10593 + {FAC_Umleitung, "Umleitung"}
10594 +};
10595 +#define FAC_1TR6_LEN (sizeof(fac_1tr6) / sizeof(struct MessageType))
10596 +#endif
10597
10598 static int
10599 prbits(char *dest, u_char b, int start, int len)
10600 --- /dev/null
10601 +++ b/drivers/isdn/hisax/rawhdlc.c
10602 @@ -0,0 +1,543 @@
10603 +/* $Id: rawhdlc.c,v 1.7 2001/09/24 13:22:57 kai Exp $
10604 + *
10605 + * support routines for cards that don't support HDLC
10606 + *
10607 + * Author Brent Baccala
10608 + * Copyright by Karsten Keil <keil@isdn4linux.de>
10609 + * by Brent Baccala <baccala@FreeSoft.org>
10610 + *
10611 + * This software may be used and distributed according to the terms
10612 + * of the GNU General Public License, incorporated herein by reference.
10613 + *
10614 + *
10615 + * Some passive ISDN cards, such as the Traverse NETJet and the AMD 7930,
10616 + * don't perform HDLC encapsulation over the B channel. Drivers for
10617 + * such cards use support routines in this file to perform B channel HDLC.
10618 + *
10619 + * Bit-synchronous HDLC encapsulation is a means of encapsulating packets
10620 + * over a continuously transmitting serial communications link.
10621 + * It looks like this:
10622 + *
10623 + * 11111111101111110...........0111111011111111111
10624 + * iiiiiiiiiffffffffdddddddddddffffffffiiiiiiiiiii
10625 + *
10626 + * i = idle f = flag d = data
10627 + *
10628 + * When idle, the channel sends a continuous string of ones (mark
10629 + * idle; illustrated), or a continuous string of flag characters (flag
10630 + * idle). The beginning of a data frame is marked by a flag character
10631 + * (01111110), then comes the actual data, followed by another flag
10632 + * character, after which another frame may be sent immediately (a
10633 + * single flag may serve as both the end of one frame and the start of
10634 + * the next), or the link may return to idle. Obviously, the flag
10635 + * character can not appear anywhere in the data (or a false
10636 + * end-of-frame would occur), so the transmitter performs
10637 + * "bit-stuffing" - inserting a zero bit after every five one bits,
10638 + * irregardless of the original bit after the five ones. Byte
10639 + * ordering is irrelevent at this point - the data is treated as a
10640 + * string of bits, not bytes. Since no more than 5 ones may now occur
10641 + * in a row, the flag sequence, with its 6 ones, is unique.
10642 + *
10643 + * Upon reception, a zero bit that occur after 5 one bits is simply
10644 + * discarded. A series of 6 one bits is end-of-frame, and a series of
10645 + * 7 one bits is an abort. Once bit-stuffing has been corrected for,
10646 + * an integer number of bytes should now be present. The last two
10647 + * of these bytes form the Frame Check Sequence, a CRC that is verified
10648 + * and then discarded. Note that bit-stuffing is performed on the FCS
10649 + * just as if it were regular data.
10650 + *
10651 + *
10652 + *
10653 + * int make_raw_hdlc_data(u_char *src, u_int slen,
10654 + * u_char *dst, u_int dsize)
10655 + *
10656 + * Used for transmission. Copies slen bytes from src to dst, performing
10657 + * HDLC encapsulation (flag bytes, bit-stuffing, CRC) in the process.
10658 + * dsize is size of destination buffer, and should be at least
10659 + * ((6*slen)/5)+5 bytes to ensure adequate space will be available.
10660 + * Function returns length (in bytes) of valid destination buffer, or
10661 + * 0 upon destination overflow.
10662 + *
10663 + * void init_hdlc_state(struct hdlc_state *stateptr, int mode)
10664 + *
10665 + * Initializes hdlc_state structure before first call to read_raw_hdlc_data
10666 + *
10667 + * mode = 0: Sane mode
10668 + * mode = 1/2:
10669 + * Insane mode; NETJet use a shared unsigned int memory block (
10670 + * with busmaster DMA), the bit pattern of every word is
10671 + * <8 B1> <8 B2> <8 Mon> <2 D> <4 C/I> <MX> <MR>
10672 + * according to Siemens IOM-2 interface, so we have to handle
10673 + * the src buffer as unsigned int and have to shift/mask the
10674 + * B-channel bytes.
10675 + * mode 1 -> B1 mode 2 -> B2 data is used
10676 + *
10677 + * int read_raw_hdlc_data(struct hdlc_state *saved_state,
10678 + * u_char *src, u_int slen,
10679 + * u_char *dst, u_int dsize)
10680 + *
10681 + * Used for reception. Scans source buffer bit-by-bit looking for
10682 + * valid HDLC frames, which are copied to destination buffer. HDLC
10683 + * state information is stored in a structure, which allows this
10684 + * function to process frames spread across several blocks of raw
10685 + * HDLC data. Part of the state information is bit offsets into
10686 + * the source and destination buffers.
10687 + *
10688 + * A return value >0 indicates the length of a valid frame, now
10689 + * stored in the destination buffer. In this case, the source
10690 + * buffer might not be completely processed, so this function should
10691 + * be called again with the same source buffer, possibly with a
10692 + * different destination buffer.
10693 + *
10694 + * A return value of zero indicates that the source buffer was
10695 + * completely processed without finding a valid end-of-packet;
10696 + * however, we might be in the middle of packet reception, so
10697 + * the function should be called again with the next block of
10698 + * raw HDLC data and the same destination buffer. It is NOT
10699 + * permitted to change the destination buffer in this case,
10700 + * since data may already have begun to be stored there.
10701 + *
10702 + * A return value of -1 indicates some kind of error - destination
10703 + * buffer overflow, CRC check failed, frame not a multiple of 8
10704 + * bits. Destination buffer probably contains invalid data, which
10705 + * should be discarded. Call function again with same source buffer
10706 + * and a new (or same) destination buffer.
10707 + *
10708 + * Suggested calling sequence:
10709 + *
10710 + * init_hdlc_state(...);
10711 + * for (EACH_RAW_DATA_BLOCK) {
10712 + * while (len = read_raw_hdlc_data(...)) {
10713 + * if (len == -1) DISCARD_FRAME;
10714 + * else PROCESS_FRAME;
10715 + * }
10716 + * }
10717 + *
10718 + *
10719 + * Test the code in this file as follows:
10720 + * gcc -DDEBUGME -o rawhdlctest rawhdlc.c
10721 + * ./rawhdlctest < rawdata
10722 + *
10723 + * The file "rawdata" can be easily generated from a HISAX B-channel
10724 + * hex dump (CF CF CF 02 ...) using the following perl script:
10725 + *
10726 + * while(<>) {
10727 + * @hexlist = split ' ';
10728 + * while ($hexstr = shift(@hexlist)) {
10729 + * printf "%c", hex($hexstr);
10730 + * }
10731 + * }
10732 + *
10733 + */
10734 +
10735 +#ifdef DEBUGME
10736 +#include <stdio.h>
10737 +#endif
10738 +
10739 +#include <linux/types.h>
10740 +#include <linux/ppp_defs.h>
10741 +#include "rawhdlc.h"
10742 +
10743 +/* There's actually an identical copy of this table in the PPP code
10744 + * (ppp_crc16_table), but I don't want this code dependent on PPP
10745 + */
10746 +
10747 +// static
10748 +__u16 fcstab[256] =
10749 +{
10750 + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
10751 + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
10752 + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
10753 + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
10754 + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
10755 + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
10756 + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
10757 + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
10758 + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
10759 + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
10760 + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
10761 + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
10762 + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
10763 + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
10764 + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
10765 + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
10766 + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
10767 + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
10768 + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
10769 + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
10770 + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
10771 + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
10772 + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
10773 + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
10774 + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
10775 + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
10776 + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
10777 + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
10778 + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
10779 + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
10780 + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
10781 + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
10782 +};
10783 +
10784 +#define HDLC_ZERO_SEARCH 0
10785 +#define HDLC_FLAG_SEARCH 1
10786 +#define HDLC_FLAG_FOUND 2
10787 +#define HDLC_FRAME_FOUND 3
10788 +#define HDLC_NULL 4
10789 +#define HDLC_PART 5
10790 +#define HDLC_FULL 6
10791 +
10792 +#define HDLC_FLAG_VALUE 0x7e
10793 +
10794 +
10795 +#define MAKE_RAW_BYTE for (j=0; j<8; j++) { \
10796 + bitcnt++;\
10797 + out_val >>= 1;\
10798 + if (val & 1) {\
10799 + s_one++;\
10800 + out_val |= 0x80;\
10801 + } else {\
10802 + s_one = 0;\
10803 + out_val &= 0x7f;\
10804 + }\
10805 + if (bitcnt==8) {\
10806 + if (d_cnt == dsize) return 0;\
10807 + dst[d_cnt++] = out_val;\
10808 + bitcnt = 0;\
10809 + }\
10810 + if (s_one == 5) {\
10811 + out_val >>= 1;\
10812 + out_val &= 0x7f;\
10813 + bitcnt++;\
10814 + s_one = 0;\
10815 + }\
10816 + if (bitcnt==8) {\
10817 + if (d_cnt == dsize) return 0;\
10818 + dst[d_cnt++] = out_val;\
10819 + bitcnt = 0;\
10820 + }\
10821 + val >>= 1;\
10822 + }
10823 +
10824 +/* Optimization suggestion: If needed, this function could be
10825 + * dramatically sped up using a state machine. Each state would
10826 + * correspond to having seen N one bits, and being offset M bits into
10827 + * the current output byte. N ranges from 0 to 4, M from 0 to 7, so
10828 + * we need 5*8 = 35 states. Each state would have a table with 256
10829 + * entries, one for each input character. Each entry would contain
10830 + * three output characters, an output state, an a byte increment
10831 + * that's either 1 or 2. All this could fit in four bytes; so we need
10832 + * 4 bytes * 256 characters = 1 KB for each state (35 KB total). Zero
10833 + * the output buffer before you start. For each character in your
10834 + * input, you look it up in the current state's table and get three
10835 + * bytes to be or'ed into the output at the current byte offset, and
10836 + * an byte increment to move your pointer forward. A simple Perl
10837 + * script could generate the tables. Given HDLC semantics, probably
10838 + * would be better to set output to all 1s, then use ands instead of ors.
10839 + * A smaller state machine could operate on nibbles instead of bytes.
10840 + * A state machine for 32-bit architectures could use word offsets
10841 + * instead of byte offsets, requiring 5*32 = 160 states; probably
10842 + * best to work on nibbles in such a case.
10843 + */
10844 +
10845 +
10846 +int make_raw_hdlc_data(u_char *src, u_int slen, u_char *dst, u_int dsize)
10847 +{
10848 + register u_int i,d_cnt=0;
10849 + register u_char j;
10850 + register u_char val;
10851 + register u_char s_one = 0;
10852 + register u_char out_val = 0;
10853 + register u_char bitcnt = 0;
10854 + u_int fcs;
10855 +
10856 +
10857 + dst[d_cnt++] = HDLC_FLAG_VALUE;
10858 + fcs = PPP_INITFCS;
10859 + for (i=0; i<slen; i++) {
10860 + val = src[i];
10861 + fcs = PPP_FCS (fcs, val);
10862 + MAKE_RAW_BYTE;
10863 + }
10864 + fcs ^= 0xffff;
10865 + val = fcs & 0xff;
10866 + MAKE_RAW_BYTE;
10867 + val = (fcs>>8) & 0xff;
10868 + MAKE_RAW_BYTE;
10869 + val = HDLC_FLAG_VALUE;
10870 + for (j=0; j<8; j++) {
10871 + bitcnt++;
10872 + out_val >>= 1;
10873 + if (val & 1)
10874 + out_val |= 0x80;
10875 + else
10876 + out_val &= 0x7f;
10877 + if (bitcnt==8) {
10878 + if (d_cnt == dsize) return 0;
10879 + dst[d_cnt++] = out_val;
10880 + bitcnt = 0;
10881 + }
10882 + val >>= 1;
10883 + }
10884 + if (bitcnt) {
10885 + while (8>bitcnt++) {
10886 + out_val >>= 1;
10887 + out_val |= 0x80;
10888 + }
10889 + if (d_cnt == dsize) return 0;
10890 + dst[d_cnt++] = out_val;
10891 + }
10892 +
10893 + return d_cnt;
10894 +}
10895 +
10896 +void init_hdlc_state(struct hdlc_state *stateptr, int mode)
10897 +{
10898 + stateptr->state = HDLC_ZERO_SEARCH;
10899 + stateptr->r_one = 0;
10900 + stateptr->r_val = 0;
10901 + stateptr->o_bitcnt = 0;
10902 + stateptr->i_bitcnt = 0;
10903 + stateptr->insane_mode = mode;
10904 +}
10905 +
10906 +/* Optimization suggestion: A similar state machine could surely
10907 + * be developed for this function as well.
10908 + */
10909 +
10910 +int read_raw_hdlc_data(struct hdlc_state *saved_state,
10911 + u_char *src, u_int slen, u_char *dst, u_int dsize)
10912 +{
10913 + int retval=0;
10914 + register u_char val;
10915 + register u_char state = saved_state->state;
10916 + register u_char r_one = saved_state->r_one;
10917 + register u_char r_val = saved_state->r_val;
10918 + register u_int o_bitcnt = saved_state->o_bitcnt;
10919 + register u_int i_bitcnt = saved_state->i_bitcnt;
10920 + register u_int fcs = saved_state->fcs;
10921 + register u_int *isrc = (u_int *) src;
10922 +
10923 + /* Use i_bitcnt (bit offset into source buffer) to reload "val"
10924 + * in case we're starting up again partway through a source buffer
10925 + */
10926 +
10927 + if ((i_bitcnt >> 3) < slen) {
10928 + if (saved_state->insane_mode==1) {
10929 + val = isrc[(i_bitcnt >> 3)] & 0xff;
10930 + } else if (saved_state->insane_mode==2) {
10931 + val = (isrc[i_bitcnt >> 3] >>8) & 0xff;
10932 + } else {
10933 + val = src[i_bitcnt >> 3];
10934 + }
10935 + val >>= i_bitcnt & 7;
10936 + }
10937 +
10938 + /* One bit per loop. Keep going until we've got something to
10939 + * report (retval != 0), or we exhaust the source buffer
10940 + */
10941 +
10942 + while ((retval == 0) && ((i_bitcnt >> 3) < slen)) {
10943 + if ((i_bitcnt & 7) == 0) {
10944 + if (saved_state->insane_mode==1) {
10945 + val = isrc[(i_bitcnt >> 3)] & 0xff;
10946 + } else if (saved_state->insane_mode==2) {
10947 + val = (isrc[i_bitcnt >> 3] >>8) & 0xff;
10948 + } else {
10949 + val = src[i_bitcnt >> 3];
10950 + }
10951 +#ifdef DEBUGME
10952 + printf("Input byte %d: 0x%2x\n", i_bitcnt>>3, val);
10953 +#endif
10954 + if (val == 0xff) {
10955 + state = HDLC_ZERO_SEARCH;
10956 + o_bitcnt = 0;
10957 + r_one = 0;
10958 + i_bitcnt += 8;
10959 + continue;
10960 + }
10961 + }
10962 +
10963 +#ifdef DEBUGME
10964 + /* printf("Data bit=%d (%d/%d)\n", val&1, i_bitcnt>>3, i_bitcnt&7);*/
10965 +#endif
10966 +
10967 + if (state == HDLC_ZERO_SEARCH) {
10968 + if (val & 1) {
10969 + r_one++;
10970 + } else {
10971 + r_one=0;
10972 + state= HDLC_FLAG_SEARCH;
10973 + }
10974 + } else if (state == HDLC_FLAG_SEARCH) {
10975 + if (val & 1) {
10976 + r_one++;
10977 + if (r_one>6) {
10978 + state=HDLC_ZERO_SEARCH;
10979 + }
10980 + } else {
10981 + if (r_one==6) {
10982 + o_bitcnt=0;
10983 + r_val=0;
10984 + state=HDLC_FLAG_FOUND;
10985 + }
10986 + r_one=0;
10987 + }
10988 + } else if (state == HDLC_FLAG_FOUND) {
10989 + if (val & 1) {
10990 + r_one++;
10991 + if (r_one>6) {
10992 + state=HDLC_ZERO_SEARCH;
10993 + } else {
10994 + r_val >>= 1;
10995 + r_val |= 0x80;
10996 + o_bitcnt++;
10997 + }
10998 + } else {
10999 + if (r_one==6) {
11000 + o_bitcnt=0;
11001 + r_val=0;
11002 + r_one=0;
11003 + i_bitcnt++;
11004 + val >>= 1;
11005 + continue;
11006 + } else if (r_one!=5) {
11007 + r_val >>= 1;
11008 + r_val &= 0x7f;
11009 + o_bitcnt++;
11010 + }
11011 + r_one=0;
11012 + }
11013 + if ((state != HDLC_ZERO_SEARCH) &&
11014 + !(o_bitcnt & 7)) {
11015 +#ifdef DEBUGME
11016 + printf("HDLC_FRAME_FOUND at i_bitcnt:%d\n",i_bitcnt);
11017 +#endif
11018 + state=HDLC_FRAME_FOUND;
11019 + fcs = PPP_INITFCS;
11020 + dst[0] = r_val;
11021 + fcs = PPP_FCS (fcs, r_val);
11022 + }
11023 + } else if (state == HDLC_FRAME_FOUND) {
11024 + if (val & 1) {
11025 + r_one++;
11026 + if (r_one>6) {
11027 + state=HDLC_ZERO_SEARCH;
11028 + o_bitcnt=0;
11029 + } else {
11030 + r_val >>= 1;
11031 + r_val |= 0x80;
11032 + o_bitcnt++;
11033 + }
11034 + } else {
11035 + if (r_one==6) {
11036 + r_val=0;
11037 + r_one=0;
11038 + o_bitcnt++;
11039 + if (o_bitcnt & 7) {
11040 + /* Alignment error */
11041 +#ifdef DEBUGME
11042 + printf("Alignment error\n");
11043 +#endif
11044 + state=HDLC_FLAG_SEARCH;
11045 + retval = -1;
11046 + } else if (fcs==PPP_GOODFCS) {
11047 + /* Valid frame */
11048 + state=HDLC_FLAG_FOUND;
11049 + retval = (o_bitcnt>>3)-3;
11050 + } else {
11051 + /* CRC error */
11052 +#ifdef DEBUGME
11053 + printf("CRC error; fcs was 0x%x, should have been 0x%x\n", fcs, PPP_GOODFCS);
11054 +#endif
11055 + state=HDLC_FLAG_FOUND;
11056 + retval = -1;
11057 + }
11058 + } else if (r_one==5) {
11059 + r_one=0;
11060 + i_bitcnt++;
11061 + val >>= 1;
11062 + continue;
11063 + } else {
11064 + r_val >>= 1;
11065 + r_val &= 0x7f;
11066 + o_bitcnt++;
11067 + }
11068 + r_one=0;
11069 + }
11070 + if ((state == HDLC_FRAME_FOUND) &&
11071 + !(o_bitcnt & 7)) {
11072 + if ((o_bitcnt>>3)>=dsize) {
11073 + /* Buffer overflow error */
11074 +#ifdef DEBUGME
11075 + printf("Buffer overflow error\n");
11076 +#endif
11077 + r_val=0;
11078 + state=HDLC_FLAG_SEARCH;
11079 + retval = -1;
11080 + } else {
11081 + dst[(o_bitcnt>>3)-1] = r_val;
11082 + fcs = PPP_FCS (fcs, r_val);
11083 +#ifdef DEBUGME
11084 + printf("Output byte %d: 0x%02x; FCS 0x%04x\n", (o_bitcnt>>3)-1, r_val, fcs);
11085 +#endif
11086 + }
11087 + }
11088 + }
11089 + i_bitcnt ++;
11090 + val >>= 1;
11091 + }
11092 +
11093 + /* We exhausted the source buffer before anything else happened
11094 + * (retval==0). Reset i_bitcnt in expectation of a new source
11095 + * buffer. Other, we either had an error or a valid frame, so
11096 + * reset o_bitcnt in expectation of a new destination buffer.
11097 + */
11098 +
11099 + if (retval == 0) {
11100 + i_bitcnt = 0;
11101 + } else {
11102 + o_bitcnt = 0;
11103 + }
11104 +
11105 + saved_state->state = state;
11106 + saved_state->r_one = r_one;
11107 + saved_state->r_val = r_val;
11108 + saved_state->fcs = fcs;
11109 + saved_state->o_bitcnt = o_bitcnt;
11110 + saved_state->i_bitcnt = i_bitcnt;
11111 +
11112 + return (retval);
11113 +}
11114 +
11115 +
11116 +
11117 +#ifdef DEBUGME
11118 +
11119 +char buffer[1024];
11120 +char obuffer[1024];
11121 +
11122 +main()
11123 +{
11124 + int buflen=0;
11125 + int len;
11126 + struct hdlc_state hdlc_state;
11127 +
11128 + while((buffer[buflen] = getc(stdin)) != EOF && buflen<1024) buflen++;
11129 +
11130 + printf("buflen = %d\n", buflen);
11131 +
11132 + init_hdlc_state(&hdlc_state, 0);
11133 +
11134 + while (len = read_raw_hdlc_data(&hdlc_state,buffer,buflen,obuffer,1024)) {
11135 + if (len == -1) printf("Error @ byte %d/bit %d\n",
11136 + hdlc_state.i_bitcnt>>3, hdlc_state.i_bitcnt & 7);
11137 + else {
11138 + printf("Frame received: len %d\n", len);
11139 + }
11140 + }
11141 +
11142 + printf("Done\n");
11143 +}
11144 +
11145 +#endif
11146 --- /dev/null
11147 +++ b/drivers/isdn/hisax/rawhdlc.h
11148 @@ -0,0 +1,28 @@
11149 +/* $Id: rawhdlc.h,v 1.5 2001/09/24 13:22:57 kai Exp $
11150 + *
11151 + * Author Brent Baccala
11152 + * Copyright by Brent Baccala <baccala@FreeSoft.org>
11153 + *
11154 + * This software may be used and distributed according to the terms
11155 + * of the GNU General Public License, incorporated herein by reference.
11156 + *
11157 + */
11158 +
11159 +#ifndef RAWHDLC_H
11160 +struct hdlc_state {
11161 + char insane_mode;
11162 + u_char state;
11163 + u_char r_one;
11164 + u_char r_val;
11165 + u_int o_bitcnt;
11166 + u_int i_bitcnt;
11167 + u_int fcs;
11168 +};
11169 +
11170 +
11171 +int make_raw_hdlc_data(u_char *src, u_int slen, u_char *dst, u_int dsize);
11172 +void init_hdlc_state(struct hdlc_state *stateptr, int mode);
11173 +int read_raw_hdlc_data(struct hdlc_state *saved_state,
11174 + u_char *src, u_int slen, u_char *dst, u_int dsize);
11175 +#define RAWHDLC_H
11176 +#endif
11177 --- a/drivers/isdn/hisax/s0box.c
11178 +++ b/drivers/isdn/hisax/s0box.c
11179 @@ -1,4 +1,4 @@
11180 -/* $Id: s0box.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11181 +/* $Id: s0box.c,v 2.6 2001/09/24 13:22:57 kai Exp $
11182 *
11183 * low level stuff for Creatix S0BOX
11184 *
11185 @@ -18,7 +18,7 @@
11186 #include "isdnl1.h"
11187
11188 extern const char *CardType[];
11189 -const char *s0box_revision = "$Revision: 1.1.4.1 $";
11190 +const char *s0box_revision = "$Revision: 2.6 $";
11191
11192 static inline void
11193 writereg(unsigned int padr, signed int addr, u_char off, u_char val) {
11194 --- a/drivers/isdn/hisax/saphir.c
11195 +++ b/drivers/isdn/hisax/saphir.c
11196 @@ -1,4 +1,4 @@
11197 -/* $Id: saphir.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11198 +/* $Id: saphir.c,v 1.10 2001/09/24 13:22:57 kai Exp $
11199 *
11200 * low level stuff for HST Saphir 1
11201 *
11202 @@ -20,7 +20,7 @@
11203 #include "isdnl1.h"
11204
11205 extern const char *CardType[];
11206 -static char *saphir_rev = "$Revision: 1.1.4.1 $";
11207 +static char *saphir_rev = "$Revision: 1.10 $";
11208
11209 #define byteout(addr,val) outb(val,addr)
11210 #define bytein(addr) inb(addr)
11211 --- a/drivers/isdn/hisax/sedlbauer.c
11212 +++ b/drivers/isdn/hisax/sedlbauer.c
11213 @@ -1,4 +1,4 @@
11214 -/* $Id: sedlbauer.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11215 +/* $Id: sedlbauer.c,v 1.34 2002/02/09 21:00:57 keil Exp $
11216 *
11217 * low level stuff for Sedlbauer cards
11218 * includes support for the Sedlbauer speed star (speed star II),
11219 @@ -48,18 +48,19 @@
11220 #include "isar.h"
11221 #include "isdnl1.h"
11222 #include <linux/pci.h>
11223 -#include <linux/isapnp.h>
11224 +#include <linux/isdn_compat.h>
11225
11226 extern const char *CardType[];
11227
11228 -const char *Sedlbauer_revision = "$Revision: 1.1.4.1 $";
11229 +const char *Sedlbauer_revision = "$Revision: 1.34 $";
11230
11231 const char *Sedlbauer_Types[] =
11232 {"None", "speed card/win", "speed star", "speed fax+",
11233 "speed win II / ISDN PC/104", "speed star II", "speed pci",
11234 - "speed fax+ pyramid", "speed fax+ pci"};
11235 + "speed fax+ pyramid", "speed fax+ pci", "HST Saphir III"};
11236
11237 #define PCI_SUBVENDOR_SPEEDFAX_PYRAMID 0x51
11238 +#define PCI_SUBVENDOR_HST_SAPHIR3 0x52
11239 #define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53
11240 #define PCI_SUBVENDOR_SPEEDFAX_PCI 0x54
11241 #define PCI_SUB_ID_SEDLBAUER 0x01
11242 @@ -72,6 +73,7 @@ const char *Sedlbauer_Types[] =
11243 #define SEDL_SPEED_PCI 6
11244 #define SEDL_SPEEDFAX_PYRAMID 7
11245 #define SEDL_SPEEDFAX_PCI 8
11246 +#define HST_SAPHIR3 9
11247
11248 #define SEDL_CHIP_TEST 0
11249 #define SEDL_CHIP_ISAC_HSCX 1
11250 @@ -531,21 +533,6 @@ Sedl_card_msg(struct IsdnCardState *cs,
11251
11252 static struct pci_dev *dev_sedl __devinitdata = NULL;
11253
11254 -#ifdef __ISAPNP__
11255 -static struct isapnp_device_id sedl_ids[] __initdata = {
11256 - { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
11257 - ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
11258 - (unsigned long) "Speed win" },
11259 - { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
11260 - ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
11261 - (unsigned long) "Speed Fax+" },
11262 - { 0, }
11263 -};
11264 -
11265 -static struct isapnp_device_id *pdev = &sedl_ids[0];
11266 -static struct pci_bus *pnp_c __devinitdata = NULL;
11267 -#endif
11268 -
11269 int __devinit
11270 setup_sedlbauer(struct IsdnCard *card)
11271 {
11272 @@ -581,57 +568,6 @@ setup_sedlbauer(struct IsdnCard *card)
11273 bytecnt = 16;
11274 }
11275 } else {
11276 -#ifdef __ISAPNP__
11277 - if (isapnp_present()) {
11278 - struct pci_bus *pb;
11279 - struct pci_dev *pd;
11280 -
11281 - while(pdev->card_vendor) {
11282 - if ((pb = isapnp_find_card(pdev->card_vendor,
11283 - pdev->card_device, pnp_c))) {
11284 - pnp_c = pb;
11285 - pd = NULL;
11286 - if ((pd = isapnp_find_dev(pnp_c,
11287 - pdev->vendor, pdev->function, pd))) {
11288 - printk(KERN_INFO "HiSax: %s detected\n",
11289 - (char *)pdev->driver_data);
11290 - pd->prepare(pd);
11291 - pd->deactivate(pd);
11292 - pd->activate(pd);
11293 - card->para[1] =
11294 - pd->resource[0].start;
11295 - card->para[0] =
11296 - pd->irq_resource[0].start;
11297 - if (!card->para[0] || !card->para[1]) {
11298 - printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n",
11299 - card->para[0], card->para[1]);
11300 - pd->deactivate(pd);
11301 - return(0);
11302 - }
11303 - cs->hw.sedl.cfg_reg = card->para[1];
11304 - cs->irq = card->para[0];
11305 - if (pdev->function == ISAPNP_FUNCTION(0x2)) {
11306 - cs->subtyp = SEDL_SPEED_FAX;
11307 - cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
11308 - bytecnt = 16;
11309 - } else {
11310 - cs->subtyp = SEDL_SPEED_CARD_WIN;
11311 - cs->hw.sedl.chip = SEDL_CHIP_TEST;
11312 - }
11313 - goto ready;
11314 - } else {
11315 - printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
11316 - return(0);
11317 - }
11318 - }
11319 - pdev++;
11320 - pnp_c=NULL;
11321 - }
11322 - if (!pdev->card_vendor) {
11323 - printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
11324 - }
11325 - }
11326 -#endif
11327 /* Probe for Sedlbauer speed pci */
11328 #if CONFIG_PCI
11329 if (!pci_present()) {
11330 @@ -647,15 +583,15 @@ setup_sedlbauer(struct IsdnCard *card)
11331 printk(KERN_WARNING "Sedlbauer: No IRQ for PCI card found\n");
11332 return(0);
11333 }
11334 - cs->hw.sedl.cfg_reg = pci_resource_start(dev_sedl, 0);
11335 + cs->hw.sedl.cfg_reg = pci_resource_start_io(dev_sedl, 0);
11336 } else {
11337 printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
11338 return(0);
11339 }
11340 cs->irq_flags |= SA_SHIRQ;
11341 cs->hw.sedl.bus = SEDL_BUS_PCI;
11342 - sub_vendor_id = dev_sedl->subsystem_vendor;
11343 - sub_id = dev_sedl->subsystem_device;
11344 + pci_get_sub_vendor(dev_sedl,sub_vendor_id);
11345 + pci_get_sub_system(dev_sedl,sub_id);
11346 printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n",
11347 sub_vendor_id, sub_id);
11348 printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n",
11349 @@ -670,6 +606,9 @@ setup_sedlbauer(struct IsdnCard *card)
11350 } else if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PCI) {
11351 cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
11352 cs->subtyp = SEDL_SPEEDFAX_PCI;
11353 + } else if (sub_vendor_id == PCI_SUBVENDOR_HST_SAPHIR3) {
11354 + cs->hw.sedl.chip = SEDL_CHIP_IPAC;
11355 + cs->subtyp = HST_SAPHIR3;
11356 } else if (sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER_PCI) {
11357 cs->hw.sedl.chip = SEDL_CHIP_IPAC;
11358 cs->subtyp = SEDL_SPEED_PCI;
11359 @@ -683,8 +622,8 @@ setup_sedlbauer(struct IsdnCard *card)
11360 cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF;
11361 byteout(cs->hw.sedl.cfg_reg, 0xff);
11362 byteout(cs->hw.sedl.cfg_reg, 0x00);
11363 - byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd);
11364 - byteout(cs->hw.sedl.cfg_reg+ 5, 0x02);
11365 + byteout(cs->hw.sedl.cfg_reg +2, 0xdd);
11366 + byteout(cs->hw.sedl.cfg_reg +5, 0x02);
11367 byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
11368 save_flags(flags);
11369 sti();
11370 @@ -697,7 +636,7 @@ setup_sedlbauer(struct IsdnCard *card)
11371 return (0);
11372 #endif /* CONFIG_PCI */
11373 }
11374 -ready:
11375 +
11376 /* In case of the sedlbauer pcmcia card, this region is in use,
11377 * reserved for us by the card manager. So we do not check it
11378 * here, it would fail.
11379 --- a/drivers/isdn/hisax/sportster.c
11380 +++ b/drivers/isdn/hisax/sportster.c
11381 @@ -1,4 +1,4 @@
11382 -/* $Id: sportster.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11383 +/* $Id: sportster.c,v 1.16 2001/09/24 13:22:57 kai Exp $
11384 *
11385 * low level stuff for USR Sportster internal TA
11386 *
11387 @@ -20,7 +20,7 @@
11388 #include "isdnl1.h"
11389
11390 extern const char *CardType[];
11391 -const char *sportster_revision = "$Revision: 1.1.4.1 $";
11392 +const char *sportster_revision = "$Revision: 1.16 $";
11393
11394 #define byteout(addr,val) outb(val,addr)
11395 #define bytein(addr) inb(addr)
11396 --- /dev/null
11397 +++ b/drivers/isdn/hisax/st5481-debug.h
11398 @@ -0,0 +1,103 @@
11399 +#define ST5481_DEBUG 0x0
11400 +
11401 +#if ST5481_DEBUG
11402 +
11403 +
11404 +/*
11405 + DEBUG flags. Set compile option ST5481_DEBUG with the following bits set to trace
11406 + the given subsections:
11407 +
11408 + 0x01: USB
11409 + 0x02: D
11410 + 0x04: B
11411 + 0x08: PH
11412 + 0x10: PACKET_DUMP D out
11413 + 0x20: ISO_DUMP D out
11414 + 0x40: PACKET_DUMP D in
11415 + 0x80: ISO_DUMP in
11416 + 0x100: PACKET_DUMP B out
11417 + 0x200: ISO_DUMP B out
11418 + 0x400: PACKET_DUMP B in
11419 +*/
11420 +
11421 +#define DBG(level, format, arg...) \
11422 +if (level & ST5481_DEBUG) \
11423 +printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg) \
11424 +
11425 +static inline void
11426 +dump_packet(const char *name,const u_char *data,int pkt_len)
11427 +{
11428 +#define DUMP_HDR_SIZE 200
11429 +#define DUMP_TLR_SIZE 8
11430 + if (pkt_len) {
11431 + int i,len1,len2;
11432 +
11433 + printk(KERN_DEBUG "%s: length=%d,data=",name,pkt_len);
11434 +
11435 + if (pkt_len > DUMP_HDR_SIZE+ DUMP_TLR_SIZE) {
11436 + len1 = DUMP_HDR_SIZE;
11437 + len2 = DUMP_TLR_SIZE;
11438 + } else {
11439 + len1 = pkt_len > DUMP_HDR_SIZE ? DUMP_HDR_SIZE : pkt_len;
11440 + len2 = 0;
11441 + }
11442 + for (i = 0; i < len1; ++i) {
11443 + printk ("%.2x", data[i]);
11444 + }
11445 + if (len2) {
11446 + printk ("..");
11447 + for (i = pkt_len-DUMP_TLR_SIZE; i < pkt_len; ++i) {
11448 + printk ("%.2x", data[i]);
11449 + }
11450 + }
11451 + printk ("\n");
11452 + }
11453 +#undef DUMP_HDR_SIZE
11454 +#undef DUMP_TLR_SIZE
11455 +}
11456 +
11457 +static inline void
11458 +dump_iso_packet(const char *name,urb_t *urb)
11459 +{
11460 + int i,j;
11461 + int len,ofs;
11462 + u_char *data;
11463 +
11464 + printk(KERN_DEBUG "%s: packets=%d,errors=%d\n",
11465 + name,urb->number_of_packets,urb->error_count);
11466 + for (i = 0; i < urb->number_of_packets; ++i) {
11467 + if (urb->pipe & USB_DIR_IN) {
11468 + len = urb->iso_frame_desc[i].actual_length;
11469 + } else {
11470 + len = urb->iso_frame_desc[i].length;
11471 + }
11472 + ofs = urb->iso_frame_desc[i].offset;
11473 + printk(KERN_DEBUG "len=%.2d,ofs=%.3d ",len,ofs);
11474 + if (len) {
11475 + data = urb->transfer_buffer+ofs;
11476 + for (j=0; j < len; j++) {
11477 + printk ("%.2x", data[j]);
11478 + }
11479 + }
11480 + printk("\n");
11481 + }
11482 +}
11483 +
11484 +#define DUMP_PACKET(level,data,count) \
11485 + if (level & ST5481_DEBUG) dump_packet(__FUNCTION__,data,count)
11486 +#define DUMP_SKB(level,skb) \
11487 + if ((level & ST5481_DEBUG) && skb) dump_packet(__FUNCTION__,skb->data,skb->len)
11488 +#define DUMP_ISO_PACKET(level,urb) \
11489 + if (level & ST5481_DEBUG) dump_iso_packet(__FUNCTION__,urb)
11490 +
11491 +#else
11492 +
11493 +#define DBG(level,format, arg...) do {} while (0)
11494 +#define DUMP_PACKET(level,data,count) do {} while (0)
11495 +#define DUMP_SKB(level,skb) do {} while (0)
11496 +#define DUMP_ISO_PACKET(level,urb) do {} while (0)
11497 +
11498 +#endif
11499 +
11500 +
11501 +
11502 --- a/drivers/isdn/hisax/st5481.h
11503 +++ b/drivers/isdn/hisax/st5481.h
11504 @@ -219,15 +219,15 @@ enum {
11505 #define L1_EVENT_COUNT (EV_TIMER3 + 1)
11506
11507 #define ERR(format, arg...) \
11508 -printk(KERN_ERR "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg)
11509 +printk(KERN_ERR __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg)
11510
11511 #define WARN(format, arg...) \
11512 -printk(KERN_WARNING "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg)
11513 +printk(KERN_WARNING __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg)
11514
11515 #define INFO(format, arg...) \
11516 -printk(KERN_INFO "%s:%s: " format "\n" , __FILE__, __FUNCTION__ , ## arg)
11517 +printk(KERN_INFO __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg)
11518
11519 -#include "isdnhdlc.h"
11520 +#include "st5481_hdlc.h"
11521 #include "fsm.h"
11522 #include "hisax_if.h"
11523 #include <linux/skbuff.h>
11524 @@ -236,7 +236,7 @@ printk(KERN_INFO "%s:%s: " format "\n" ,
11525 * FIFO handling
11526 */
11527
11528 -/* Generic FIFO structure */
11529 +/* Generic FIFO structure */
11530 struct fifo {
11531 u_char r,w,count,size;
11532 spinlock_t lock;
11533 @@ -270,7 +270,7 @@ static inline int fifo_add(struct fifo *
11534 index = -1;
11535 } else {
11536 // Return index where to get the next data to add to the FIFO
11537 - index = fifo->w++ & (fifo->size-1);
11538 + index = fifo->w++ & (fifo->size-1);
11539 fifo->count++;
11540 }
11541 spin_unlock_irqrestore(&fifo->lock, flags);
11542 @@ -289,13 +289,13 @@ static inline int fifo_remove(struct fif
11543 return -1;
11544 }
11545
11546 - spin_lock_irqsave(&fifo->lock, flags);
11547 + spin_lock_irqsave(&fifo->lock, flags);
11548 if (!fifo->count) {
11549 // FIFO empty
11550 index = -1;
11551 } else {
11552 // Return index where to get the next data from the FIFO
11553 - index = fifo->r++ & (fifo->size-1);
11554 + index = fifo->r++ & (fifo->size-1);
11555 fifo->count--;
11556 }
11557 spin_unlock_irqrestore(&fifo->lock, flags);
11558 @@ -309,7 +309,7 @@ static inline int fifo_remove(struct fif
11559 typedef void (*ctrl_complete_t)(void *);
11560
11561 typedef struct ctrl_msg {
11562 - struct usb_ctrlrequest dr;
11563 + devrequest dr;
11564 ctrl_complete_t complete;
11565 void *context;
11566 } ctrl_msg;
11567 @@ -336,7 +336,7 @@ struct st5481_intr {
11568 };
11569
11570 struct st5481_d_out {
11571 - struct isdnhdlc_vars hdlc_state;
11572 + struct hdlc_vars hdlc_state;
11573 struct urb *urb[2]; /* double buffering */
11574 unsigned long busy;
11575 struct sk_buff *tx_skb;
11576 @@ -344,7 +344,7 @@ struct st5481_d_out {
11577 };
11578
11579 struct st5481_b_out {
11580 - struct isdnhdlc_vars hdlc_state;
11581 + struct hdlc_vars hdlc_state;
11582 struct urb *urb[2]; /* double buffering */
11583 u_char flow_event;
11584 u_long busy;
11585 @@ -352,7 +352,7 @@ struct st5481_b_out {
11586 };
11587
11588 struct st5481_in {
11589 - struct isdnhdlc_vars hdlc_state;
11590 + struct hdlc_vars hdlc_state;
11591 struct urb *urb[2]; /* double buffering */
11592 int mode;
11593 int bufsize;
11594 @@ -478,7 +478,7 @@ extern int st5481_debug;
11595 if (level & __debug_variable) dump_iso_packet(__FUNCTION__,urb)
11596
11597 static void __attribute__((unused))
11598 -dump_iso_packet(const char *name,struct urb *urb)
11599 +dump_iso_packet(const char *name,urb_t *urb)
11600 {
11601 int i,j;
11602 int len,ofs;
11603 --- a/drivers/isdn/hisax/st5481_b.c
11604 +++ b/drivers/isdn/hisax/st5481_b.c
11605 @@ -67,28 +67,24 @@ static void usb_b_out(struct st5481_bcs
11606 bytes_sent = buf_size - len;
11607 if (skb->len < bytes_sent)
11608 bytes_sent = skb->len;
11609 - { /* swap tx bytes to get hearable audio data */
11610 - register unsigned char *src = skb->data;
11611 - register unsigned char *dest = urb->transfer_buffer+len;
11612 - register unsigned int count;
11613 - for (count = 0; count < bytes_sent; count++)
11614 - *dest++ = isdnhdlc_bit_rev_tab[*src++];
11615 - }
11616 +
11617 + memcpy(urb->transfer_buffer+len, skb->data, bytes_sent);
11618 +
11619 len += bytes_sent;
11620 } else {
11621 - len += isdnhdlc_encode(&b_out->hdlc_state,
11622 - skb->data, skb->len, &bytes_sent,
11623 - urb->transfer_buffer+len, buf_size-len);
11624 + len += hdlc_encode(&b_out->hdlc_state,
11625 + skb->data, skb->len, &bytes_sent,
11626 + urb->transfer_buffer+len, buf_size-len);
11627 }
11628
11629 skb_pull(skb, bytes_sent);
11630 -
11631 +
11632 if (!skb->len) {
11633 // Frame sent
11634 b_out->tx_skb = NULL;
11635 B_L1L2(bcs, PH_DATA | CONFIRM, (void *) skb->truesize);
11636 dev_kfree_skb_any(skb);
11637 -
11638 +
11639 /* if (!(bcs->tx_skb = skb_dequeue(&bcs->sq))) { */
11640 /* st5481B_sched_event(bcs, B_XMTBUFREADY); */
11641 /* } */
11642 @@ -99,9 +95,9 @@ static void usb_b_out(struct st5481_bcs
11643 len = buf_size;
11644 } else {
11645 // Send flags
11646 - len += isdnhdlc_encode(&b_out->hdlc_state,
11647 - NULL, 0, &bytes_sent,
11648 - urb->transfer_buffer+len, buf_size-len);
11649 + len += hdlc_encode(&b_out->hdlc_state,
11650 + NULL, 0, &bytes_sent,
11651 + urb->transfer_buffer+len, buf_size-len);
11652 }
11653 }
11654 }
11655 @@ -213,7 +209,7 @@ static void st5481B_mode(struct st5481_b
11656 if (bcs->mode != L1_MODE_NULL) {
11657 // Open the B channel
11658 if (bcs->mode != L1_MODE_TRANS) {
11659 - isdnhdlc_out_init(&b_out->hdlc_state, 0, bcs->mode == L1_MODE_HDLC_56K);
11660 + hdlc_out_init(&b_out->hdlc_state, 0, bcs->mode == L1_MODE_HDLC_56K);
11661 }
11662 st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2, NULL, NULL);
11663
11664 @@ -279,7 +275,7 @@ static int __devinit st5481_setup_b_out(
11665 usb_b_out_complete, bcs);
11666 }
11667
11668 -static void st5481_release_b_out(struct st5481_bcs *bcs)
11669 +static void __devexit st5481_release_b_out(struct st5481_bcs *bcs)
11670 {
11671 struct st5481_b_out *b_out = &bcs->b_out;
11672
11673 @@ -320,7 +316,7 @@ int __devinit st5481_setup_b(struct st54
11674 /*
11675 * Release buffers and URBs for the B channels
11676 */
11677 -void st5481_release_b(struct st5481_bcs *bcs)
11678 +void __devexit st5481_release_b(struct st5481_bcs *bcs)
11679 {
11680 DBG(4,"");
11681
11682 --- a/drivers/isdn/hisax/st5481_d.c
11683 +++ b/drivers/isdn/hisax/st5481_d.c
11684 @@ -162,8 +162,8 @@ static struct FsmNode L1FnList[] __initd
11685 {ST_L1_F8, EV_TIMER3, l1_timer3},
11686 {ST_L1_F8, EV_IND_DP, l1_go_f3},
11687 {ST_L1_F8, EV_IND_AP, l1_go_f6},
11688 - {ST_L1_F8, EV_IND_AI8, l1_go_f7},
11689 - {ST_L1_F8, EV_IND_AI10, l1_go_f7},
11690 + {ST_L1_F8, EV_IND_AI8, l1_go_f8},
11691 + {ST_L1_F8, EV_IND_AI10, l1_go_f8},
11692 {ST_L1_F8, EV_IND_RSY, l1_ignore},
11693 };
11694
11695 @@ -297,7 +297,7 @@ static void usb_d_out(struct st5481_adap
11696 unsigned int num_packets, packet_offset;
11697 int len, buf_size, bytes_sent;
11698 struct sk_buff *skb;
11699 - struct iso_packet_descriptor *desc;
11700 + iso_packet_descriptor_t *desc;
11701
11702 if (d_out->fsm.state != ST_DOUT_NORMAL)
11703 return;
11704 @@ -313,15 +313,15 @@ static void usb_d_out(struct st5481_adap
11705 buf_size = NUM_ISO_PACKETS_D * SIZE_ISO_PACKETS_D_OUT;
11706
11707 if (skb) {
11708 - len = isdnhdlc_encode(&d_out->hdlc_state,
11709 - skb->data, skb->len, &bytes_sent,
11710 - urb->transfer_buffer, buf_size);
11711 + len = hdlc_encode(&d_out->hdlc_state,
11712 + skb->data, skb->len, &bytes_sent,
11713 + urb->transfer_buffer, buf_size);
11714 skb_pull(skb,bytes_sent);
11715 } else {
11716 // Send flags or idle
11717 - len = isdnhdlc_encode(&d_out->hdlc_state,
11718 - NULL, 0, &bytes_sent,
11719 - urb->transfer_buffer, buf_size);
11720 + len = hdlc_encode(&d_out->hdlc_state,
11721 + NULL, 0, &bytes_sent,
11722 + urb->transfer_buffer, buf_size);
11723 }
11724
11725 if (len < buf_size) {
11726 @@ -413,7 +413,7 @@ static void dout_start_xmit(struct FsmIn
11727
11728 DBG(2,"len=%d",skb->len);
11729
11730 - isdnhdlc_out_init(&d_out->hdlc_state, 1, 0);
11731 + hdlc_out_init(&d_out->hdlc_state, 1, 0);
11732
11733 if (test_and_set_bit(buf_nr, &d_out->busy)) {
11734 WARN("ep %d urb %d busy %#lx", EP_D_OUT, buf_nr, d_out->busy);
11735 @@ -422,9 +422,9 @@ static void dout_start_xmit(struct FsmIn
11736 urb = d_out->urb[buf_nr];
11737
11738 DBG_SKB(0x10, skb);
11739 - len = isdnhdlc_encode(&d_out->hdlc_state,
11740 - skb->data, skb->len, &bytes_sent,
11741 - urb->transfer_buffer, 16);
11742 + len = hdlc_encode(&d_out->hdlc_state,
11743 + skb->data, skb->len, &bytes_sent,
11744 + urb->transfer_buffer, 16);
11745 skb_pull(skb, bytes_sent);
11746
11747 if(len < 16)
11748 @@ -673,7 +673,7 @@ static int __devinit st5481_setup_d_out(
11749 usb_d_out_complete, adapter);
11750 }
11751
11752 -static void st5481_release_d_out(struct st5481_adapter *adapter)
11753 +static void __devexit st5481_release_d_out(struct st5481_adapter *adapter)
11754 {
11755 struct st5481_d_out *d_out = &adapter->d_out;
11756
11757 @@ -723,7 +723,7 @@ int __devinit st5481_setup_d(struct st54
11758 return retval;
11759 }
11760
11761 -void st5481_release_d(struct st5481_adapter *adapter)
11762 +void __devexit st5481_release_d(struct st5481_adapter *adapter)
11763 {
11764 DBG(2,"");
11765
11766 --- a/drivers/isdn/hisax/st5481_init.c
11767 +++ b/drivers/isdn/hisax/st5481_init.c
11768 @@ -14,6 +14,7 @@
11769 * TODO:
11770 *
11771 * b layer1 delay?
11772 + * hdlc as module
11773 * hotplug / unregister issues
11774 * mod_inc/dec_use_count
11775 * unify parts of d/b channel usb handling
11776 @@ -177,7 +178,7 @@ MODULE_DEVICE_TABLE (usb, st5481_ids);
11777 static struct usb_driver st5481_usb_driver = {
11778 name: "st5481_usb",
11779 probe: probe_st5481,
11780 - disconnect: __devexit_p(disconnect_st5481),
11781 + disconnect: disconnect_st5481,
11782 id_table: st5481_ids,
11783 };
11784
11785 --- a/drivers/isdn/hisax/st5481_usb.c
11786 +++ b/drivers/isdn/hisax/st5481_usb.c
11787 @@ -41,9 +41,9 @@ static void usb_next_ctrl_msg(struct urb
11788 (unsigned char *)&ctrl->msg_fifo.data[r_index];
11789
11790 DBG(1,"request=0x%02x,value=0x%04x,index=%x",
11791 - ((struct ctrl_msg *)urb->setup_packet)->dr.bRequest,
11792 - ((struct ctrl_msg *)urb->setup_packet)->dr.wValue,
11793 - ((struct ctrl_msg *)urb->setup_packet)->dr.wIndex);
11794 + ((struct ctrl_msg *)urb->setup_packet)->dr.request,
11795 + ((struct ctrl_msg *)urb->setup_packet)->dr.value,
11796 + ((struct ctrl_msg *)urb->setup_packet)->dr.index);
11797
11798 // Prepare the URB
11799 urb->dev = adapter->usb_dev;
11800 @@ -69,11 +69,11 @@ void usb_ctrl_msg(struct st5481_adapter
11801 }
11802 ctrl_msg = &ctrl->msg_fifo.data[w_index];
11803
11804 - ctrl_msg->dr.bRequestType = requesttype;
11805 - ctrl_msg->dr.bRequest = request;
11806 - ctrl_msg->dr.wValue = cpu_to_le16p(&value);
11807 - ctrl_msg->dr.wIndex = cpu_to_le16p(&index);
11808 - ctrl_msg->dr.wLength = 0;
11809 + ctrl_msg->dr.requesttype = requesttype;
11810 + ctrl_msg->dr.request = request;
11811 + ctrl_msg->dr.value = cpu_to_le16p(&value);
11812 + ctrl_msg->dr.index = cpu_to_le16p(&index);
11813 + ctrl_msg->dr.length = 0;
11814 ctrl_msg->complete = complete;
11815 ctrl_msg->context = context;
11816
11817 @@ -140,17 +140,17 @@ static void usb_ctrl_complete(struct urb
11818
11819 ctrl_msg = (struct ctrl_msg *)urb->setup_packet;
11820
11821 - if (ctrl_msg->dr.bRequest == USB_REQ_CLEAR_FEATURE) {
11822 + if (ctrl_msg->dr.request == USB_REQ_CLEAR_FEATURE) {
11823 /* Special case handling for pipe reset */
11824 - le16_to_cpus(&ctrl_msg->dr.wIndex);
11825 + le16_to_cpus(&ctrl_msg->dr.index);
11826 usb_endpoint_running(adapter->usb_dev,
11827 - ctrl_msg->dr.wIndex & ~USB_DIR_IN,
11828 - (ctrl_msg->dr.wIndex & USB_DIR_IN) == 0);
11829 + ctrl_msg->dr.index & ~USB_DIR_IN,
11830 + (ctrl_msg->dr.index & USB_DIR_IN) == 0);
11831
11832 /* toggle is reset on clear */
11833 usb_settoggle(adapter->usb_dev,
11834 - ctrl_msg->dr.wIndex & ~USB_DIR_IN,
11835 - (ctrl_msg->dr.wIndex & USB_DIR_IN) == 0,
11836 + ctrl_msg->dr.index & ~USB_DIR_IN,
11837 + (ctrl_msg->dr.index & USB_DIR_IN) == 0,
11838 0);
11839
11840
11841 @@ -235,7 +235,7 @@ int __devinit st5481_setup_usb(struct st
11842 struct usb_interface_descriptor *altsetting;
11843 struct usb_endpoint_descriptor *endpoint;
11844 int status;
11845 - struct urb *urb;
11846 + urb_t *urb;
11847 u_char *buf;
11848
11849 DBG(1,"");
11850 @@ -307,7 +307,7 @@ int __devinit st5481_setup_usb(struct st
11851 * Release buffers and URBs for the interrupt and control
11852 * endpoint.
11853 */
11854 -void st5481_release_usb(struct st5481_adapter *adapter)
11855 +void __devexit st5481_release_usb(struct st5481_adapter *adapter)
11856 {
11857 struct st5481_intr *intr = &adapter->intr;
11858 struct st5481_ctrl *ctrl = &adapter->ctrl;
11859 @@ -443,7 +443,7 @@ st5481_setup_isocpipes(struct urb* urb[2
11860 return retval;
11861 }
11862
11863 -void st5481_release_isocpipes(struct urb* urb[2])
11864 +void __devexit st5481_release_isocpipes(struct urb* urb[2])
11865 {
11866 int j;
11867
11868 @@ -484,18 +484,16 @@ static void usb_in_complete(struct urb *
11869 ptr = urb->transfer_buffer;
11870 while (len > 0) {
11871 if (in->mode == L1_MODE_TRANS) {
11872 - /* swap rx bytes to get hearable audio */
11873 - register unsigned char *dest = in->rcvbuf;
11874 + memcpy(in->rcvbuf, ptr, len);
11875 status = len;
11876 - for (; len; len--)
11877 - *dest++ = isdnhdlc_bit_rev_tab[*ptr++];
11878 + len = 0;
11879 } else {
11880 - status = isdnhdlc_decode(&in->hdlc_state, ptr, len, &count,
11881 - in->rcvbuf, in->bufsize);
11882 + status = hdlc_decode(&in->hdlc_state, ptr, len, &count,
11883 + in->rcvbuf, in->bufsize);
11884 ptr += count;
11885 len -= count;
11886 }
11887 -
11888 +
11889 if (status > 0) {
11890 // Good frame received
11891 DBG(4,"count=%d",status);
11892 @@ -549,7 +547,7 @@ int __devinit st5481_setup_in(struct st5
11893 return retval;
11894 }
11895
11896 -void st5481_release_in(struct st5481_in *in)
11897 +void __devexit st5481_release_in(struct st5481_in *in)
11898 {
11899 DBG(2,"");
11900
11901 @@ -562,8 +560,7 @@ void st5481_release_in(struct st5481_in
11902 */
11903 int st5481_isoc_flatten(struct urb *urb)
11904 {
11905 - struct iso_packet_descriptor *pipd;
11906 - struct iso_packet_descriptor *pend;
11907 + piso_packet_descriptor_t pipd,pend;
11908 unsigned char *src,*dst;
11909 unsigned int len;
11910
11911 @@ -624,10 +621,15 @@ void st5481_in_mode(struct st5481_in *in
11912
11913 if (in->mode != L1_MODE_NULL) {
11914 if (in->mode != L1_MODE_TRANS)
11915 - isdnhdlc_rcv_init(&in->hdlc_state,
11916 - in->mode == L1_MODE_HDLC_56K);
11917 + hdlc_rcv_init(&in->hdlc_state,
11918 + in->mode == L1_MODE_HDLC_56K);
11919
11920 st5481_usb_pipe_reset(in->adapter, in->ep, NULL, NULL);
11921 +#if 0
11922 + st5481_usb_device_ctrl_msg(in->adapter, in->counter,
11923 + in->packet_size,
11924 + st5481_start_rcv, in);
11925 +#endif
11926 st5481_usb_device_ctrl_msg(in->adapter, in->counter,
11927 in->packet_size,
11928 NULL, NULL);
11929 --- a/drivers/isdn/hisax/tei.c
11930 +++ b/drivers/isdn/hisax/tei.c
11931 @@ -1,4 +1,4 @@
11932 -/* $Id: tei.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11933 +/* $Id: tei.c,v 2.20 2001/09/24 13:22:57 kai Exp $
11934 *
11935 * Author Karsten Keil
11936 * based on the teles driver from Jan den Ouden
11937 @@ -21,7 +21,7 @@
11938 #include <linux/init.h>
11939 #include <linux/random.h>
11940
11941 -const char *tei_revision = "$Revision: 1.1.4.1 $";
11942 +const char *tei_revision = "$Revision: 2.20 $";
11943
11944 #define ID_REQUEST 1
11945 #define ID_ASSIGNED 2
11946 --- a/drivers/isdn/hisax/teleint.c
11947 +++ b/drivers/isdn/hisax/teleint.c
11948 @@ -1,4 +1,4 @@
11949 -/* $Id: teleint.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11950 +/* $Id: teleint.c,v 1.16 2001/09/24 13:22:57 kai Exp $
11951 *
11952 * low level stuff for TeleInt isdn cards
11953 *
11954 @@ -19,7 +19,7 @@
11955
11956 extern const char *CardType[];
11957
11958 -const char *TeleInt_revision = "$Revision: 1.1.4.1 $";
11959 +const char *TeleInt_revision = "$Revision: 1.16 $";
11960
11961 #define byteout(addr,val) outb(val,addr)
11962 #define bytein(addr) inb(addr)
11963 --- a/drivers/isdn/hisax/teles0.c
11964 +++ b/drivers/isdn/hisax/teles0.c
11965 @@ -1,4 +1,4 @@
11966 -/* $Id: teles0.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11967 +/* $Id: teles0.c,v 2.15 2001/09/24 13:22:57 kai Exp $
11968 *
11969 * low level stuff for Teles Memory IO isdn cards
11970 *
11971 @@ -24,7 +24,7 @@
11972
11973 extern const char *CardType[];
11974
11975 -const char *teles0_revision = "$Revision: 1.1.4.1 $";
11976 +const char *teles0_revision = "$Revision: 2.15 $";
11977
11978 #define TELES_IOMEM_SIZE 0x400
11979 #define byteout(addr,val) outb(val,addr)
11980 @@ -189,8 +189,10 @@ release_io_teles0(struct IsdnCardState *
11981 {
11982 if (cs->hw.teles0.cfg_reg)
11983 release_region(cs->hw.teles0.cfg_reg, 8);
11984 +#ifdef COMPAT_HAS_ISA_IOREMAP
11985 iounmap((unsigned char *)cs->hw.teles0.membase);
11986 release_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE);
11987 +#endif
11988 }
11989
11990 static int
11991 @@ -327,6 +329,7 @@ setup_teles0(struct IsdnCard *card)
11992 /* 16.0 and 8.0 designed for IOM1 */
11993 test_and_set_bit(HW_IOM1, &cs->HW_Flags);
11994 cs->hw.teles0.phymem = card->para[1];
11995 +#ifdef COMPAT_HAS_ISA_IOREMAP
11996 if (check_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE)) {
11997 printk(KERN_WARNING
11998 "HiSax: %s memory region %lx-%lx already in use\n",
11999 @@ -342,6 +345,9 @@ setup_teles0(struct IsdnCard *card)
12000 }
12001 cs->hw.teles0.membase =
12002 (unsigned long) ioremap(cs->hw.teles0.phymem, TELES_IOMEM_SIZE);
12003 +#else
12004 + cs->hw.teles0.membase = cs->hw.teles0.phymem;
12005 +#endif
12006 printk(KERN_INFO
12007 "HiSax: %s config irq:%d mem:0x%lX cfg:0x%X\n",
12008 CardType[cs->typ], cs->irq,
12009 --- a/drivers/isdn/hisax/teles3.c
12010 +++ b/drivers/isdn/hisax/teles3.c
12011 @@ -1,4 +1,4 @@
12012 -/* $Id: teles3.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12013 +/* $Id: teles3.c,v 2.19 2001/09/24 13:22:57 kai Exp $
12014 *
12015 * low level stuff for Teles 16.3 & PNP isdn cards
12016 *
12017 @@ -15,14 +15,13 @@
12018 */
12019 #define __NO_VERSION__
12020 #include <linux/init.h>
12021 -#include <linux/isapnp.h>
12022 #include "hisax.h"
12023 #include "isac.h"
12024 #include "hscx.h"
12025 #include "isdnl1.h"
12026
12027 extern const char *CardType[];
12028 -const char *teles3_revision = "$Revision: 1.1.4.1 $";
12029 +const char *teles3_revision = "$Revision: 2.19 $";
12030
12031 #define byteout(addr,val) outb(val,addr)
12032 #define bytein(addr) inb(addr)
12033 @@ -255,24 +254,6 @@ Teles_card_msg(struct IsdnCardState *cs,
12034 return(0);
12035 }
12036
12037 -#ifdef __ISAPNP__
12038 -static struct isapnp_device_id teles_ids[] __initdata = {
12039 - { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110),
12040 - ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110),
12041 - (unsigned long) "Teles 16.3 PnP" },
12042 - { ISAPNP_VENDOR('C', 'T', 'X'), ISAPNP_FUNCTION(0x0),
12043 - ISAPNP_VENDOR('C', 'T', 'X'), ISAPNP_FUNCTION(0x0),
12044 - (unsigned long) "Creatix 16.3 PnP" },
12045 - { ISAPNP_VENDOR('C', 'P', 'Q'), ISAPNP_FUNCTION(0x1002),
12046 - ISAPNP_VENDOR('C', 'P', 'Q'), ISAPNP_FUNCTION(0x1002),
12047 - (unsigned long) "Compaq ISDN S0" },
12048 - { 0, }
12049 -};
12050 -
12051 -static struct isapnp_device_id *tdev = &teles_ids[0];
12052 -static struct pci_bus *pnp_c __devinitdata = NULL;
12053 -#endif
12054 -
12055 int __devinit
12056 setup_teles3(struct IsdnCard *card)
12057 {
12058 @@ -286,47 +267,6 @@ setup_teles3(struct IsdnCard *card)
12059 && (cs->typ != ISDN_CTYPE_TELESPCMCIA) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA))
12060 return (0);
12061
12062 -#ifdef __ISAPNP__
12063 - if (!card->para[1] && isapnp_present()) {
12064 - struct pci_bus *pb;
12065 - struct pci_dev *pd;
12066 -
12067 - while(tdev->card_vendor) {
12068 - if ((pb = isapnp_find_card(tdev->card_vendor,
12069 - tdev->card_device, pnp_c))) {
12070 - pnp_c = pb;
12071 - pd = NULL;
12072 - if ((pd = isapnp_find_dev(pnp_c,
12073 - tdev->vendor, tdev->function, pd))) {
12074 - printk(KERN_INFO "HiSax: %s detected\n",
12075 - (char *)tdev->driver_data);
12076 - pd->prepare(pd);
12077 - pd->deactivate(pd);
12078 - pd->activate(pd);
12079 - card->para[3] = pd->resource[2].start;
12080 - card->para[2] = pd->resource[1].start;
12081 - card->para[1] = pd->resource[0].start;
12082 - card->para[0] = pd->irq_resource[0].start;
12083 - if (!card->para[0] || !card->para[1] || !card->para[2]) {
12084 - printk(KERN_ERR "Teles PnP:some resources are missing %ld/%lx/%lx\n",
12085 - card->para[0], card->para[1], card->para[2]);
12086 - pd->deactivate(pd);
12087 - return(0);
12088 - }
12089 - break;
12090 - } else {
12091 - printk(KERN_ERR "Teles PnP: PnP error card found, no device\n");
12092 - }
12093 - }
12094 - tdev++;
12095 - pnp_c=NULL;
12096 - }
12097 - if (!tdev->card_vendor) {
12098 - printk(KERN_INFO "Teles PnP: no ISAPnP card found\n");
12099 - return(0);
12100 - }
12101 - }
12102 -#endif
12103 if (cs->typ == ISDN_CTYPE_16_3) {
12104 cs->hw.teles3.cfg_reg = card->para[1];
12105 switch (cs->hw.teles3.cfg_reg) {
12106 --- a/drivers/isdn/hisax/telespci.c
12107 +++ b/drivers/isdn/hisax/telespci.c
12108 @@ -1,4 +1,4 @@
12109 -/* $Id: telespci.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12110 +/* $Id: telespci.c,v 2.23 2001/09/24 13:22:57 kai Exp $
12111 *
12112 * low level stuff for Teles PCI isdn cards
12113 *
12114 @@ -20,9 +20,10 @@
12115 #include "hscx.h"
12116 #include "isdnl1.h"
12117 #include <linux/pci.h>
12118 +#include <linux/isdn_compat.h>
12119
12120 extern const char *CardType[];
12121 -const char *telespci_revision = "$Revision: 1.1.4.1 $";
12122 +const char *telespci_revision = "$Revision: 2.23 $";
12123
12124 #define ZORAN_PO_RQ_PEN 0x02000000
12125 #define ZORAN_PO_WR 0x00800000
12126 @@ -307,10 +308,10 @@ setup_telespci(struct IsdnCard *card)
12127 printk(KERN_WARNING "Teles: No IRQ for PCI card found\n");
12128 return(0);
12129 }
12130 - cs->hw.teles0.membase = (u_long) ioremap(pci_resource_start(dev_tel, 0),
12131 + cs->hw.teles0.membase = (u_long) ioremap(pci_resource_start_mem(dev_tel, 0),
12132 PAGE_SIZE);
12133 printk(KERN_INFO "Found: Zoran, base-address: 0x%lx, irq: 0x%x\n",
12134 - pci_resource_start(dev_tel, 0), dev_tel->irq);
12135 + pci_resource_start_mem(dev_tel, 0), dev_tel->irq);
12136 } else {
12137 printk(KERN_WARNING "TelesPCI: No PCI card found\n");
12138 return(0);
12139 --- a/drivers/isdn/hisax/w6692.c
12140 +++ b/drivers/isdn/hisax/w6692.c
12141 @@ -1,4 +1,4 @@
12142 -/* $Id: w6692.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12143 +/* $Id: w6692.c,v 1.18 2001/09/24 13:22:57 kai Exp $
12144 *
12145 * Winbond W6692 specific routines
12146 *
12147 @@ -18,6 +18,7 @@
12148 #include "isdnl1.h"
12149 #include <linux/interrupt.h>
12150 #include <linux/pci.h>
12151 +#include <linux/isdn_compat.h>
12152
12153 /* table entry in the PCI devices list */
12154 typedef struct {
12155 @@ -29,20 +30,14 @@ typedef struct {
12156
12157 static const PCI_ENTRY id_list[] =
12158 {
12159 - {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, "Winbond", "W6692"},
12160 {PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, "Dynalink/AsusCom", "IS64PH"},
12161 - {0, 0, "U.S.Robotics", "ISDN PCI Card TA"}
12162 + {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, "Winbond", "W6692"},
12163 + {0, 0, NULL, NULL}
12164 };
12165
12166 -#define W6692_SV_USR 0x16ec
12167 -#define W6692_SD_USR 0x3409
12168 -#define W6692_WINBOND 0
12169 -#define W6692_DYNALINK 1
12170 -#define W6692_USR 2
12171 -
12172 extern const char *CardType[];
12173
12174 -const char *w6692_revision = "$Revision: 1.1.4.1 $";
12175 +const char *w6692_revision = "$Revision: 1.18 $";
12176
12177 #define DBUSY_TIMER_VALUE 80
12178
12179 @@ -675,6 +670,16 @@ setstack_W6692(struct PStack *st, struct
12180 static void
12181 DC_Close_W6692(struct IsdnCardState *cs)
12182 {
12183 +#if 0
12184 + if (cs->dc.w6692.mon_rx) {
12185 + kfree(cs->dc.w6692.mon_rx);
12186 + cs->dc.w6692.mon_rx = NULL;
12187 + }
12188 + if (cs->dc.w6692.mon_tx) {
12189 + kfree(cs->dc.w6692.mon_tx);
12190 + cs->dc.w6692.mon_tx = NULL;
12191 + }
12192 +#endif
12193 }
12194
12195 static void
12196 @@ -865,38 +870,31 @@ setstack_w6692(struct PStack *st, struct
12197 return (0);
12198 }
12199
12200 -void resetW6692(struct IsdnCardState *cs)
12201 -{
12202 - cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST);
12203 - schedule_timeout((10*HZ)/1000);
12204 - cs->writeW6692(cs, W_D_CTL, 0x00);
12205 - schedule_timeout((10*HZ)/1000);
12206 - cs->writeW6692(cs, W_IMASK, 0xff);
12207 - cs->writeW6692(cs, W_D_SAM, 0xff);
12208 - cs->writeW6692(cs, W_D_TAM, 0xff);
12209 - cs->writeW6692(cs, W_D_EXIM, 0x00);
12210 - cs->writeW6692(cs, W_D_MODE, W_D_MODE_RACT);
12211 - cs->writeW6692(cs, W_IMASK, 0x18);
12212 - if (cs->subtyp == W6692_USR) {
12213 - /* seems that USR implemented some power control features
12214 - * Pin 79 is connected to the oscilator circuit so we
12215 - * have to handle it here
12216 - */
12217 - cs->writeW6692(cs, W_PCTL, 0x80);
12218 - cs->writeW6692(cs, W_XDATA, 0x00);
12219 - }
12220 -}
12221 -
12222 void __init initW6692(struct IsdnCardState *cs, int part)
12223 {
12224 if (part & 1) {
12225 cs->tqueue.routine = (void *) (void *) W6692_bh;
12226 cs->setstack_d = setstack_W6692;
12227 cs->DC_Close = DC_Close_W6692;
12228 +#if 0
12229 + cs->dc.w6692.mon_tx = NULL;
12230 + cs->dc.w6692.mon_rx = NULL;
12231 +#endif
12232 cs->dbusytimer.function = (void *) dbusy_timer_handler;
12233 cs->dbusytimer.data = (long) cs;
12234 init_timer(&cs->dbusytimer);
12235 - resetW6692(cs);
12236 +
12237 + cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST);
12238 + cs->writeW6692(cs, W_D_CTL, 0x00);
12239 + cs->writeW6692(cs, W_IMASK, 0xff);
12240 +#if 0
12241 + cs->dc.w6692.mocr = 0xaa;
12242 +#endif
12243 + cs->writeW6692(cs, W_D_SAM, 0xff);
12244 + cs->writeW6692(cs, W_D_TAM, 0xff);
12245 + cs->writeW6692(cs, W_D_EXIM, 0x00);
12246 + cs->writeW6692(cs, W_D_MODE, W_D_MODE_RACT);
12247 + cs->writeW6692(cs, W_IMASK, 0x18);
12248 ph_command(cs, W_L1CMD_RST);
12249 cs->dc.w6692.ph_state = W_L1CMD_RST;
12250 W6692_new_ph(cs);
12251 @@ -963,14 +961,9 @@ w6692_card_msg(struct IsdnCardState *cs,
12252 {
12253 switch (mt) {
12254 case CARD_RESET:
12255 - resetW6692(cs);
12256 return (0);
12257 case CARD_RELEASE:
12258 - cs->writeW6692(cs, W_IMASK, 0xff);
12259 release_region(cs->hw.w6692.iobase, 256);
12260 - if (cs->subtyp == W6692_USR) {
12261 - cs->writeW6692(cs, W_XDATA, 0x04);
12262 - }
12263 return (0);
12264 case CARD_INIT:
12265 initW6692(cs, 3);
12266 @@ -1013,7 +1006,6 @@ setup_w6692(struct IsdnCard *card)
12267 if (dev_w6692) {
12268 if (pci_enable_device(dev_w6692))
12269 continue;
12270 - cs->subtyp = id_idx;
12271 break;
12272 }
12273 id_idx++;
12274 @@ -1023,14 +1015,7 @@ setup_w6692(struct IsdnCard *card)
12275 pci_irq = dev_w6692->irq;
12276 /* I think address 0 is allways the configuration area */
12277 /* and address 1 is the real IO space KKe 03.09.99 */
12278 - pci_ioaddr = pci_resource_start(dev_w6692, 1);
12279 - /* USR ISDN PCI card TA need some special handling */
12280 - if (cs->subtyp == W6692_WINBOND) {
12281 - if ((W6692_SV_USR == dev_w6692->subsystem_vendor) &&
12282 - (W6692_SD_USR == dev_w6692->subsystem_device)) {
12283 - cs->subtyp = W6692_USR;
12284 - }
12285 - }
12286 + pci_ioaddr = pci_resource_start_io(dev_w6692, 1);
12287 }
12288 if (!found) {
12289 printk(KERN_WARNING "W6692: No PCI card found\n");
12290 @@ -1047,18 +1032,18 @@ setup_w6692(struct IsdnCard *card)
12291 }
12292 cs->hw.w6692.iobase = pci_ioaddr;
12293 printk(KERN_INFO "Found: %s %s, I/O base: 0x%x, irq: %d\n",
12294 - id_list[cs->subtyp].vendor_name, id_list[cs->subtyp].card_name,
12295 - pci_ioaddr, pci_irq);
12296 + id_list[id_idx].vendor_name, id_list[id_idx].card_name,
12297 + pci_ioaddr, dev_w6692->irq);
12298 if (check_region((cs->hw.w6692.iobase), 256)) {
12299 printk(KERN_WARNING
12300 "HiSax: %s I/O ports %x-%x already in use\n",
12301 - id_list[cs->subtyp].card_name,
12302 + id_list[id_idx].card_name,
12303 cs->hw.w6692.iobase,
12304 cs->hw.w6692.iobase + 255);
12305 return (0);
12306 } else {
12307 request_region(cs->hw.w6692.iobase, 256,
12308 - id_list[cs->subtyp].card_name);
12309 + id_list[id_idx].card_name);
12310 }
12311 #else
12312 printk(KERN_WARNING "HiSax: W6692 and NO_PCI_BIOS\n");
12313 @@ -1068,7 +1053,7 @@ setup_w6692(struct IsdnCard *card)
12314
12315 printk(KERN_INFO
12316 "HiSax: %s config irq:%d I/O:%x\n",
12317 - id_list[cs->subtyp].card_name, cs->irq,
12318 + id_list[id_idx].card_name, cs->irq,
12319 cs->hw.w6692.iobase);
12320
12321 cs->readW6692 = &ReadW6692;
12322 --- a/drivers/isdn/hisax/w6692.h
12323 +++ b/drivers/isdn/hisax/w6692.h
12324 @@ -1,4 +1,4 @@
12325 -/* $Id: w6692.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12326 +/* $Id: w6692.h,v 1.4 2001/09/24 13:22:57 kai Exp $
12327 *
12328 * Winbond W6692 specific defines
12329 *
12330 --- a/drivers/isdn/hysdn/boardergo.c
12331 +++ b/drivers/isdn/hysdn/boardergo.c
12332 @@ -1,27 +1,41 @@
12333 -/* $Id: boardergo.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12334 - *
12335 +/* $Id: boardergo.c,v 1.9 2001/07/19 20:39:51 kai Exp $
12336 +
12337 * Linux driver for HYSDN cards, specific routines for ergo type boards.
12338 *
12339 - * Author Werner Cornelius (werner@titro.de) for Hypercope GmbH
12340 - * Copyright 1999 by Werner Cornelius (werner@titro.de)
12341 - *
12342 - * This software may be used and distributed according to the terms
12343 - * of the GNU General Public License, incorporated herein by reference.
12344 - *
12345 * As all Linux supported cards Champ2, Ergo and Metro2/4 use the same
12346 * DPRAM interface and layout with only minor differences all related
12347 * stuff is done here, not in separate modules.
12348 *
12349 + * written by Werner Cornelius (werner@titro.de) for Hypercope GmbH
12350 + *
12351 + * Copyright 1999 by Werner Cornelius (werner@titro.de)
12352 + *
12353 + * This program is free software; you can redistribute it and/or modify
12354 + * it under the terms of the GNU General Public License as published by
12355 + * the Free Software Foundation; either version 2, or (at your option)
12356 + * any later version.
12357 + *
12358 + * This program is distributed in the hope that it will be useful,
12359 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12360 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12361 + * GNU General Public License for more details.
12362 + *
12363 + * You should have received a copy of the GNU General Public License
12364 + * along with this program; if not, write to the Free Software
12365 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
12366 + *
12367 */
12368
12369 +#define __NO_VERSION__
12370 #include <linux/config.h>
12371 -#include <linux/sched.h>
12372 +#include <linux/module.h>
12373 +#include <linux/version.h>
12374 +#include <asm/io.h>
12375 #include <linux/signal.h>
12376 #include <linux/kernel.h>
12377 #include <linux/ioport.h>
12378 #include <linux/interrupt.h>
12379 #include <linux/vmalloc.h>
12380 -#include <asm/io.h>
12381
12382 #include "hysdn_defs.h"
12383 #include "boardergo.h"
12384 @@ -45,11 +59,10 @@ ergo_interrupt(int intno, void *dev_id,
12385 if (!card->irq_enabled)
12386 return; /* other device interrupting or irq switched off */
12387
12388 - save_flags(flags);
12389 - cli(); /* no further irqs allowed */
12390 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12391
12392 if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) {
12393 - restore_flags(flags); /* restore old state */
12394 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12395 return; /* no interrupt requested by E1 */
12396 }
12397 /* clear any pending ints on the board */
12398 @@ -63,7 +76,7 @@ ergo_interrupt(int intno, void *dev_id,
12399 queue_task(&card->irq_queue, &tq_immediate);
12400 mark_bh(IMMEDIATE_BH);
12401 }
12402 - restore_flags(flags);
12403 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12404 } /* ergo_interrupt */
12405
12406 /******************************************************************************/
12407 @@ -83,17 +96,15 @@ ergo_irq_bh(hysdn_card * card)
12408 return; /* invalid call */
12409
12410 dpr = card->dpram; /* point to DPRAM */
12411 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12412
12413 - save_flags(flags);
12414 - cli();
12415 if (card->hw_lock) {
12416 - restore_flags(flags); /* hardware currently unavailable */
12417 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12418 return;
12419 }
12420 card->hw_lock = 1; /* we now lock the hardware */
12421
12422 do {
12423 - sti(); /* reenable other ints */
12424 again = 0; /* assume loop not to be repeated */
12425
12426 if (!dpr->ToHyFlag) {
12427 @@ -113,15 +124,13 @@ ergo_irq_bh(hysdn_card * card)
12428 again = 1; /* restart loop */
12429 }
12430 } /* a message has arrived for us */
12431 - cli(); /* no further ints */
12432 if (again) {
12433 dpr->ToHyInt = 1;
12434 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */
12435 } else
12436 card->hw_lock = 0; /* free hardware again */
12437 } while (again); /* until nothing more to do */
12438 -
12439 - restore_flags(flags);
12440 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12441 } /* ergo_irq_bh */
12442
12443
12444 @@ -138,8 +147,7 @@ ergo_stopcard(hysdn_card * card)
12445 #ifdef CONFIG_HYSDN_CAPI
12446 hycapi_capi_stop(card);
12447 #endif /* CONFIG_HYSDN_CAPI */
12448 - save_flags(flags);
12449 - cli();
12450 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12451 val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */
12452 val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1); /* mask irq */
12453 byteout(card->iobase + PCI9050_INTR_REG, val);
12454 @@ -147,8 +155,7 @@ ergo_stopcard(hysdn_card * card)
12455 byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RESET); /* reset E1 processor */
12456 card->state = CARD_STATE_UNUSED;
12457 card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */
12458 -
12459 - restore_flags(flags);
12460 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12461 } /* ergo_stopcard */
12462
12463 /**************************************************************************/
12464 @@ -163,20 +170,17 @@ ergo_set_errlog_state(hysdn_card * card,
12465 card->err_log_state = ERRLOG_STATE_OFF; /* must be off */
12466 return;
12467 }
12468 - save_flags(flags);
12469 - cli();
12470 -
12471 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12472 if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) ||
12473 ((card->err_log_state == ERRLOG_STATE_ON) && on)) {
12474 - restore_flags(flags);
12475 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12476 return; /* nothing to do */
12477 }
12478 if (on)
12479 card->err_log_state = ERRLOG_STATE_START; /* request start */
12480 else
12481 card->err_log_state = ERRLOG_STATE_STOP; /* request stop */
12482 -
12483 - restore_flags(flags);
12484 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12485 queue_task(&card->irq_queue, &tq_immediate);
12486 mark_bh(IMMEDIATE_BH);
12487 } /* ergo_set_errlog_state */
12488 @@ -245,9 +249,6 @@ ergo_writebootimg(struct HYSDN_CARD *car
12489 while (!dpram->ToHyNoDpramErrLog); /* reread volatile register to flush PCI */
12490
12491 byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN); /* start E1 processor */
12492 - /* the interrupts are still masked */
12493 -
12494 - sti();
12495 set_current_state(TASK_INTERRUPTIBLE);
12496 schedule_timeout((20 * HZ) / 1000); /* Timeout 20ms */
12497
12498 @@ -282,7 +283,6 @@ ergo_writebootseq(struct HYSDN_CARD *car
12499 dst = sp->Data; /* point to data in spool structure */
12500 buflen = sp->Len; /* maximum len of spooled data */
12501 wr_mirror = sp->WrPtr; /* only once read */
12502 - sti();
12503
12504 /* try until all bytes written or error */
12505 i = 0x1000; /* timeout value */
12506 @@ -358,9 +358,7 @@ ergo_waitpofready(struct HYSDN_CARD *car
12507
12508 if (card->debug_flags & LOG_POF_RECORD)
12509 hysdn_addlog(card, "ERGO: pof boot success");
12510 - save_flags(flags);
12511 - cli();
12512 -
12513 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12514 card->state = CARD_STATE_RUN; /* now card is running */
12515 /* enable the cards interrupt */
12516 byteout(card->iobase + PCI9050_INTR_REG,
12517 @@ -371,8 +369,7 @@ ergo_waitpofready(struct HYSDN_CARD *car
12518 dpr->ToPcFlag = 0; /* reset data indicator */
12519 dpr->ToHyInt = 1;
12520 dpr->ToPcInt = 1; /* interrupt to E1 for all cards */
12521 -
12522 - restore_flags(flags);
12523 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12524 if ((hynet_enable & (1 << card->myid))
12525 && (i = hysdn_net_create(card)))
12526 {
12527 @@ -387,7 +384,6 @@ ergo_waitpofready(struct HYSDN_CARD *car
12528 #endif /* CONFIG_HYSDN_CAPI */
12529 return (0); /* success */
12530 } /* data has arrived */
12531 - sti();
12532 set_current_state(TASK_INTERRUPTIBLE);
12533 schedule_timeout((50 * HZ) / 1000); /* Timeout 50ms */
12534 } /* wait until timeout */
12535 --- a/drivers/isdn/hysdn/boardergo.h
12536 +++ b/drivers/isdn/hysdn/boardergo.h
12537 @@ -1,4 +1,4 @@
12538 -/* $Id: boardergo.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12539 +/* $Id$
12540 *
12541 * Linux driver for HYSDN cards, definitions for ergo type boards (buffers..).
12542 *
12543 @@ -10,6 +10,7 @@
12544 *
12545 */
12546
12547 +#include <linux/isdn_compat.h>
12548
12549 /************************************************/
12550 /* defines for the dual port memory of the card */
12551 --- a/drivers/isdn/hysdn/hycapi.c
12552 +++ b/drivers/isdn/hysdn/hycapi.c
12553 @@ -1,4 +1,4 @@
12554 -/* $Id: hycapi.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12555 +/* $Id$
12556 *
12557 * Linux driver for HYSDN cards, CAPI2.0-Interface.
12558 *
12559 @@ -29,7 +29,7 @@
12560 #include "hysdn_defs.h"
12561 #include <linux/kernelcapi.h>
12562
12563 -static char hycapi_revision[]="$Revision: 1.1.4.1 $";
12564 +static char hycapi_revision[]="$Revision$";
12565
12566 unsigned int hycapi_enable = 0xffffffff;
12567 MODULE_PARM(hycapi_enable, "i");
12568 --- a/drivers/isdn/hysdn/hysdn_boot.c
12569 +++ b/drivers/isdn/hysdn/hysdn_boot.c
12570 @@ -1,4 +1,4 @@
12571 -/* $Id: hysdn_boot.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12572 +/* $Id$
12573 *
12574 * Linux driver for HYSDN cards
12575 * specific routines for booting and pof handling
12576 @@ -143,7 +143,7 @@ pof_handle_data(hysdn_card * card, int d
12577 (boot->pof_recid == TAG_CABSDATA) ? "CABSDATA" : "ABSDATA",
12578 datlen, boot->pof_recoffset);
12579
12580 - if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen)) < 0)
12581 + if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen) < 0))
12582 return (boot->last_error); /* error writing data */
12583
12584 if (boot->pof_recoffset + datlen >= boot->pof_reclen)
12585 --- a/drivers/isdn/hysdn/hysdn_defs.h
12586 +++ b/drivers/isdn/hysdn/hysdn_defs.h
12587 @@ -1,4 +1,4 @@
12588 -/* $Id: hysdn_defs.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12589 +/* $Id: hysdn_defs.h,v 1.10 2001/09/24 13:23:03 kai Exp $
12590 *
12591 * Linux driver for HYSDN cards
12592 * global definitions and exported vars and functions.
12593 @@ -19,6 +19,11 @@
12594 #include <linux/interrupt.h>
12595 #include <linux/tqueue.h>
12596 #include <linux/skbuff.h>
12597 +#include <linux/isdn_compat.h>
12598 +#include <linux/spinlock.h>
12599 +
12600 +#define HYSDN_SPIN_LOCK(a,b) spin_lock(a)
12601 +#define HYSDN_SPIN_UNLOCK(a,b) spin_unlock(a)
12602
12603 /****************************/
12604 /* storage type definitions */
12605 @@ -176,6 +181,7 @@ typedef struct HYSDN_CARD {
12606 struct tq_struct irq_queue; /* interrupt task queue */
12607 uchar volatile irq_enabled; /* interrupt enabled if != 0 */
12608 uchar volatile hw_lock; /* hardware is currently locked -> no access */
12609 + spinlock_t irq_lock;
12610
12611 /* boot process */
12612 void *boot; /* pointer to boot private data */
12613 --- a/drivers/isdn/hysdn/hysdn_init.c
12614 +++ b/drivers/isdn/hysdn/hysdn_init.c
12615 @@ -1,4 +1,4 @@
12616 -/* $Id: hysdn_init.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12617 +/* $Id$
12618 *
12619 * Linux driver for HYSDN cards, init functions.
12620 *
12621 @@ -21,6 +21,7 @@
12622
12623 #include "hysdn_defs.h"
12624
12625 +#ifndef COMPAT_HAS_2_2_PCI
12626 static struct pci_device_id hysdn_pci_tbl[] __initdata = {
12627 {PCI_VENDOR_ID_HYPERCOPE, PCI_DEVICE_ID_HYPERCOPE_PLX, PCI_ANY_ID, PCI_SUBDEVICE_ID_HYPERCOPE_METRO},
12628 {PCI_VENDOR_ID_HYPERCOPE, PCI_DEVICE_ID_HYPERCOPE_PLX, PCI_ANY_ID, PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2},
12629 @@ -29,11 +30,12 @@ static struct pci_device_id hysdn_pci_tb
12630 { } /* Terminating entry */
12631 };
12632 MODULE_DEVICE_TABLE(pci, hysdn_pci_tbl);
12633 +#endif
12634 MODULE_DESCRIPTION("ISDN4Linux: Driver for HYSDN cards");
12635 MODULE_AUTHOR("Werner Cornelius");
12636 MODULE_LICENSE("GPL");
12637
12638 -static char *hysdn_init_revision = "$Revision: 1.1.4.1 $";
12639 +static char *hysdn_init_revision = "$Revision$";
12640 int cardmax; /* number of found cards */
12641 hysdn_card *card_root = NULL; /* pointer to first card */
12642
12643 @@ -91,11 +93,11 @@ search_cards(void)
12644 card->myid = cardmax; /* set own id */
12645 card->bus = akt_pcidev->bus->number;
12646 card->devfn = akt_pcidev->devfn; /* slot + function */
12647 - card->subsysid = akt_pcidev->subsystem_device;
12648 + pci_get_sub_system(akt_pcidev,card->subsysid);
12649 card->irq = akt_pcidev->irq;
12650 - card->iobase = pci_resource_start(akt_pcidev, PCI_REG_PLX_IO_BASE);
12651 - card->plxbase = pci_resource_start(akt_pcidev, PCI_REG_PLX_MEM_BASE);
12652 - card->membase = pci_resource_start(akt_pcidev, PCI_REG_MEMORY_BASE);
12653 + card->iobase = pci_resource_start_io(akt_pcidev, PCI_REG_PLX_IO_BASE);
12654 + card->plxbase = pci_resource_start_mem(akt_pcidev, PCI_REG_PLX_MEM_BASE);
12655 + card->membase = pci_resource_start_mem(akt_pcidev, PCI_REG_MEMORY_BASE);
12656 card->brdtype = BD_NONE; /* unknown */
12657 card->debug_flags = DEF_DEB_FLAGS; /* set default debug */
12658 card->faxchans = 0; /* default no fax channels */
12659 --- a/drivers/isdn/hysdn/hysdn_net.c
12660 +++ b/drivers/isdn/hysdn/hysdn_net.c
12661 @@ -1,4 +1,4 @@
12662 -/* $Id: hysdn_net.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12663 +/* $Id$
12664 *
12665 * Linux driver for HYSDN cards, net (ethernet type) handling routines.
12666 *
12667 @@ -29,7 +29,7 @@ unsigned int hynet_enable = 0xffffffff;
12668 MODULE_PARM(hynet_enable, "i");
12669
12670 /* store the actual version for log reporting */
12671 -char *hysdn_net_revision = "$Revision: 1.1.4.1 $";
12672 +char *hysdn_net_revision = "$Revision$";
12673
12674 #define MAX_SKB_BUFFERS 20 /* number of buffers for keeping TX-data */
12675
12676 @@ -45,6 +45,10 @@ struct net_local {
12677 /* additional vars may be added here */
12678 char dev_name[9]; /* our own device name */
12679
12680 +#ifdef COMPAT_NO_SOFTNET
12681 + struct sk_buff *tx_skb; /* buffer for tx operation */
12682 +
12683 +#else
12684 /* Tx control lock. This protects the transmit buffer ring
12685 * state along with the "tx full" state of the driver. This
12686 * means all netif_queue flow control actions are protected
12687 @@ -56,6 +60,7 @@ struct net_local {
12688 int sk_count; /* number of buffers currently in ring */
12689
12690 int is_open; /* flag controlling module locking */
12691 +#endif
12692 }; /* net_local */
12693
12694
12695 @@ -83,11 +88,19 @@ net_open(struct net_device *dev)
12696 hysdn_card *card = dev->priv;
12697 int i;
12698
12699 +#ifdef COMPAT_NO_SOFTNET
12700 + dev->tbusy = 0; /* non busy state */
12701 + dev->interrupt = 0;
12702 + if (!dev->start)
12703 + MOD_INC_USE_COUNT; /* increment only if device is down */
12704 + dev->start = 1; /* and started */
12705 +#else
12706 if (!((struct net_local *) dev)->is_open)
12707 MOD_INC_USE_COUNT; /* increment only if interface is actually down */
12708 ((struct net_local *) dev)->is_open = 1; /* device actually open */
12709
12710 netif_start_queue(dev); /* start tx-queueing */
12711 +#endif
12712
12713 /* Fill in the MAC-level header (if not already set) */
12714 if (!card->mac_addr[0]) {
12715 @@ -104,6 +117,7 @@ net_open(struct net_device *dev)
12716 return (0);
12717 } /* net_open */
12718
12719 +#ifndef COMPAT_NO_SOFTNET
12720 /*******************************************/
12721 /* flush the currently occupied tx-buffers */
12722 /* must only be called when device closed */
12723 @@ -119,6 +133,7 @@ flush_tx_buffers(struct net_local *nl)
12724 nl->sk_count--;
12725 }
12726 } /* flush_tx_buffers */
12727 +#endif
12728
12729
12730 /*********************************************************************/
12731 @@ -129,6 +144,15 @@ static int
12732 net_close(struct net_device *dev)
12733 {
12734
12735 +#ifdef COMPAT_NO_SOFTNET
12736 + dev->tbusy = 1; /* we are busy */
12737 +
12738 + if (dev->start)
12739 + MOD_DEC_USE_COUNT; /* dec only if device has been active */
12740 +
12741 + dev->start = 0; /* and not started */
12742 +
12743 +#else
12744 netif_stop_queue(dev); /* disable queueing */
12745
12746 if (((struct net_local *) dev)->is_open)
12747 @@ -136,9 +160,52 @@ net_close(struct net_device *dev)
12748 ((struct net_local *) dev)->is_open = 0;
12749 flush_tx_buffers((struct net_local *) dev);
12750
12751 +#endif
12752 return (0); /* success */
12753 } /* net_close */
12754
12755 +#ifdef COMPAT_NO_SOFTNET
12756 +/************************************/
12757 +/* send a packet on this interface. */
12758 +/* only for kernel versions < 2.3.33 */
12759 +/************************************/
12760 +static int
12761 +net_send_packet(struct sk_buff *skb, struct net_device *dev)
12762 +{
12763 + struct net_local *lp = (struct net_local *) dev;
12764 +
12765 + if (dev->tbusy) {
12766 + /*
12767 + * If we get here, some higher level has decided we are broken.
12768 + * There should really be a "kick me" function call instead.
12769 + * As ISDN may have higher timeouts than real ethernet 10s timeout
12770 + */
12771 + int tickssofar = jiffies - dev->trans_start;
12772 + if (tickssofar < (10000 * HZ) / 1000)
12773 + return 1;
12774 + printk(KERN_WARNING "%s: transmit timed out. \n", dev->name);
12775 + dev->tbusy = 0;
12776 + dev->trans_start = jiffies;
12777 + }
12778 + /*
12779 + * Block a timer-based transmit from overlapping. This could better be
12780 + * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
12781 + */
12782 + if (test_and_set_bit(0, (void *) &dev->tbusy) != 0)
12783 + printk(KERN_WARNING "%s: Transmitter access conflict.\n", dev->name);
12784 +
12785 + else {
12786 + lp->stats.tx_bytes += skb->len;
12787 + dev->trans_start = jiffies;
12788 + lp->tx_skb = skb; /* remember skb pointer */
12789 + queue_task(&((hysdn_card *) dev->priv)->irq_queue, &tq_immediate);
12790 + mark_bh(IMMEDIATE_BH);
12791 + }
12792 +
12793 + return (0); /* success */
12794 +} /* net_send_packet */
12795 +
12796 +#else
12797 /************************************/
12798 /* send a packet on this interface. */
12799 /* new style for kernel >= 2.3.33 */
12800 @@ -176,6 +243,7 @@ net_send_packet(struct sk_buff *skb, str
12801 return (0); /* success */
12802 } /* net_send_packet */
12803
12804 +#endif
12805
12806
12807 /***********************************************************************/
12808 @@ -190,6 +258,15 @@ hysdn_tx_netack(hysdn_card * card)
12809 if (!lp)
12810 return; /* non existing device */
12811
12812 +#ifdef COMPAT_NO_SOFTNET
12813 + if (lp->tx_skb)
12814 + dev_kfree_skb(lp->tx_skb); /* free tx pointer */
12815 + lp->tx_skb = NULL; /* reset pointer */
12816 +
12817 + lp->stats.tx_packets++;
12818 + lp->netdev.tbusy = 0;
12819 + mark_bh(NET_BH); /* Inform upper layers. */
12820 +#else
12821
12822 if (!lp->sk_count)
12823 return; /* error condition */
12824 @@ -203,6 +280,7 @@ hysdn_tx_netack(hysdn_card * card)
12825
12826 if (lp->sk_count-- == MAX_SKB_BUFFERS) /* dec usage count */
12827 netif_start_queue((struct net_device *) lp);
12828 +#endif
12829 } /* hysdn_tx_netack */
12830
12831 /*****************************************************/
12832 @@ -250,10 +328,15 @@ hysdn_tx_netget(hysdn_card * card)
12833 if (!lp)
12834 return (NULL); /* non existing device */
12835
12836 +#ifdef COMPAT_NO_SOFTNET
12837 + return (lp->tx_skb); /* return packet pointer */
12838 +
12839 +#else
12840 if (!lp->sk_count)
12841 return (NULL); /* nothing available */
12842
12843 return (lp->skbs[lp->out_idx]); /* next packet to send */
12844 +#endif
12845 } /* hysdn_tx_netget */
12846
12847
12848 @@ -296,15 +379,21 @@ hysdn_net_create(hysdn_card * card)
12849 }
12850 memset(dev, 0, sizeof(struct net_local)); /* clean the structure */
12851
12852 +#ifndef COMPAT_NO_SOFTNET
12853 spin_lock_init(&((struct net_local *) dev)->lock);
12854 +#endif
12855
12856 /* initialise necessary or informing fields */
12857 dev->base_addr = card->iobase; /* IO address */
12858 dev->irq = card->irq; /* irq */
12859 dev->init = net_init; /* the init function of the device */
12860 +#ifdef COMPAT_NO_SOFTNET
12861 + dev->name = ((struct net_local *) dev)->dev_name; /* device name */
12862 +#else
12863 if(dev->name) {
12864 strcpy(dev->name, ((struct net_local *) dev)->dev_name);
12865 }
12866 +#endif
12867 if ((i = register_netdev(dev))) {
12868 printk(KERN_WARNING "HYSDN: unable to create network device\n");
12869 kfree(dev);
12870 @@ -333,7 +422,9 @@ hysdn_net_release(hysdn_card * card)
12871 card->netif = NULL; /* clear out pointer */
12872 dev->stop(dev); /* close the device */
12873
12874 +#ifndef COMPAT_NO_SOFTNET
12875 flush_tx_buffers((struct net_local *) dev); /* empty buffers */
12876 +#endif
12877
12878 unregister_netdev(dev); /* release the device */
12879 kfree(dev); /* release the memory allocated */
12880 --- a/drivers/isdn/hysdn/hysdn_pof.h
12881 +++ b/drivers/isdn/hysdn/hysdn_pof.h
12882 @@ -1,4 +1,4 @@
12883 -/* $Id: hysdn_pof.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12884 +/* $Id$
12885 *
12886 * Linux driver for HYSDN cards, definitions used for handling pof-files.
12887 *
12888 --- a/drivers/isdn/hysdn/hysdn_procconf.c
12889 +++ b/drivers/isdn/hysdn/hysdn_procconf.c
12890 @@ -1,4 +1,4 @@
12891 -/* $Id: hysdn_procconf.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12892 +/* $Id$
12893 *
12894 * Linux driver for HYSDN cards, /proc/net filesystem dir and conf functions.
12895 *
12896 @@ -17,11 +17,13 @@
12897 #include <linux/poll.h>
12898 #include <linux/proc_fs.h>
12899 #include <linux/pci.h>
12900 +#ifndef COMPAT_USE_MODCOUNT_LOCK
12901 #include <linux/smp_lock.h>
12902 +#endif
12903
12904 #include "hysdn_defs.h"
12905
12906 -static char *hysdn_procconf_revision = "$Revision: 1.1.4.1 $";
12907 +static char *hysdn_procconf_revision = "$Revision$";
12908
12909 #define INFO_OUT_LEN 80 /* length of info line including lf */
12910
12911 @@ -212,32 +214,29 @@ hysdn_conf_write(struct file *file, cons
12912 static ssize_t
12913 hysdn_conf_read(struct file *file, char *buf, size_t count, loff_t * off)
12914 {
12915 - loff_t pos = *off;
12916 char *cp;
12917 int i;
12918
12919 if (off != &file->f_pos) /* fs error check */
12920 return -ESPIPE;
12921
12922 - if (!(file->f_mode & FMODE_READ))
12923 - return -EPERM;
12924 -
12925 - if (!(cp = file->private_data))
12926 - return (-EFAULT); /* should never happen */
12927 -
12928 - i = strlen(cp); /* get total string length */
12929 -
12930 - if (pos != (unsigned)pos || pos >= i)
12931 - return 0;
12932 -
12933 - /* still bytes to transfer */
12934 - cp += pos; /* point to desired data offset */
12935 - i -= pos; /* remaining length */
12936 - if (i > count)
12937 - i = count; /* limit length to transfer */
12938 - if (copy_to_user(buf, cp, i))
12939 - return (-EFAULT); /* copy error */
12940 - *off = pos + i; /* adjust offset */
12941 + if (file->f_mode & FMODE_READ) {
12942 + if (!(cp = file->private_data))
12943 + return (-EFAULT); /* should never happen */
12944 + i = strlen(cp); /* get total string length */
12945 + if (*off < i) {
12946 + /* still bytes to transfer */
12947 + cp += *off; /* point to desired data offset */
12948 + i -= *off; /* remaining length */
12949 + if (i > count)
12950 + i = count; /* limit length to transfer */
12951 + if (copy_to_user(buf, cp, i))
12952 + return (-EFAULT); /* copy error */
12953 + *off += i; /* adjust offset */
12954 + } else
12955 + return (0);
12956 + } else
12957 + return (-EPERM); /* no permission to read */
12958
12959 return (i);
12960 } /* hysdn_conf_read */
12961 @@ -254,7 +253,11 @@ hysdn_conf_open(struct inode *ino, struc
12962 char *cp, *tmp;
12963
12964 /* now search the addressed card */
12965 +#ifdef COMPAT_USE_MODCOUNT_LOCK
12966 + MOD_INC_USE_COUNT;
12967 +#else
12968 lock_kernel();
12969 +#endif
12970 card = card_root;
12971 while (card) {
12972 pd = card->procconf;
12973 @@ -263,7 +266,11 @@ hysdn_conf_open(struct inode *ino, struc
12974 card = card->next; /* search next entry */
12975 }
12976 if (!card) {
12977 +#ifdef COMPAT_USE_MODCOUNT_LOCK
12978 + MOD_DEC_USE_COUNT;
12979 +#else
12980 unlock_kernel();
12981 +#endif
12982 return (-ENODEV); /* device is unknown/invalid */
12983 }
12984 if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
12985 @@ -274,7 +281,11 @@ hysdn_conf_open(struct inode *ino, struc
12986 /* write only access -> write boot file or conf line */
12987
12988 if (!(cnf = kmalloc(sizeof(struct conf_writedata), GFP_KERNEL))) {
12989 +#ifdef COMPAT_USE_MODCOUNT_LOCK
12990 + MOD_DEC_USE_COUNT;
12991 +#else
12992 unlock_kernel();
12993 +#endif
12994 return (-EFAULT);
12995 }
12996 cnf->card = card;
12997 @@ -286,7 +297,11 @@ hysdn_conf_open(struct inode *ino, struc
12998 /* read access -> output card info data */
12999
13000 if (!(tmp = (char *) kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) {
13001 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13002 + MOD_DEC_USE_COUNT;
13003 +#else
13004 unlock_kernel();
13005 +#endif
13006 return (-EFAULT); /* out of memory */
13007 }
13008 filep->private_data = tmp; /* start of string */
13009 @@ -320,10 +335,16 @@ hysdn_conf_open(struct inode *ino, struc
13010 *cp++ = '\n';
13011 *cp = 0; /* end of string */
13012 } else { /* simultaneous read/write access forbidden ! */
13013 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13014 + MOD_DEC_USE_COUNT;
13015 +#else
13016 unlock_kernel();
13017 +#endif
13018 return (-EPERM); /* no permission this time */
13019 }
13020 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13021 unlock_kernel();
13022 +#endif
13023 return (0);
13024 } /* hysdn_conf_open */
13025
13026 @@ -338,7 +359,9 @@ hysdn_conf_close(struct inode *ino, stru
13027 int retval = 0;
13028 struct proc_dir_entry *pd;
13029
13030 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13031 lock_kernel();
13032 +#endif
13033 /* search the addressed card */
13034 card = card_root;
13035 while (card) {
13036 @@ -348,7 +371,9 @@ hysdn_conf_close(struct inode *ino, stru
13037 card = card->next; /* search next entry */
13038 }
13039 if (!card) {
13040 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13041 unlock_kernel();
13042 +#endif
13043 return (-ENODEV); /* device is unknown/invalid */
13044 }
13045 if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
13046 @@ -371,7 +396,11 @@ hysdn_conf_close(struct inode *ino, stru
13047 if (filep->private_data)
13048 kfree(filep->private_data); /* release memory */
13049 }
13050 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13051 + MOD_DEC_USE_COUNT;
13052 +#else
13053 unlock_kernel();
13054 +#endif
13055 return (retval);
13056 } /* hysdn_conf_close */
13057
13058 @@ -387,6 +416,9 @@ static struct file_operations conf_fops
13059 release: hysdn_conf_close,
13060 };
13061
13062 +#ifdef COMPAT_NO_SOFTNET
13063 +static struct inode_operations conf_inode_operations;
13064 +#endif
13065 /*****************************/
13066 /* hysdn subdir in /proc/net */
13067 /*****************************/
13068 @@ -415,8 +447,17 @@ hysdn_procconf_init(void)
13069 if ((card->procconf = (void *) create_proc_entry(conf_name,
13070 S_IFREG | S_IRUGO | S_IWUSR,
13071 hysdn_proc_entry)) != NULL) {
13072 +#ifdef COMPAT_NO_SOFTNET
13073 + memset(&conf_inode_operations, 0, sizeof(struct inode_operations));
13074 + conf_inode_operations.default_file_ops = &conf_fops;
13075 +
13076 + ((struct proc_dir_entry *) card->procconf)->ops = &conf_inode_operations;
13077 +#else
13078 ((struct proc_dir_entry *) card->procconf)->proc_fops = &conf_fops;
13079 +#ifdef COMPAT_HAS_FILEOP_OWNER
13080 ((struct proc_dir_entry *) card->procconf)->owner = THIS_MODULE;
13081 +#endif
13082 +#endif
13083 hysdn_proclog_init(card); /* init the log file entry */
13084 }
13085 card = card->next; /* next entry */
13086 --- a/drivers/isdn/hysdn/hysdn_proclog.c
13087 +++ b/drivers/isdn/hysdn/hysdn_proclog.c
13088 @@ -1,4 +1,4 @@
13089 -/* $Id: hysdn_proclog.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13090 +/* $Id$
13091 *
13092 * Linux driver for HYSDN cards, /proc/net filesystem log functions.
13093 *
13094 @@ -16,7 +16,9 @@
13095 #include <linux/poll.h>
13096 #include <linux/proc_fs.h>
13097 #include <linux/pci.h>
13098 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13099 #include <linux/smp_lock.h>
13100 +#endif
13101
13102 #include "hysdn_defs.h"
13103
13104 @@ -115,8 +117,7 @@ put_log_buffer(hysdn_card * card, char *
13105 strcpy(ib->log_start, cp); /* set output string */
13106 ib->next = NULL;
13107 ib->proc_ctrl = pd; /* point to own control structure */
13108 - save_flags(flags);
13109 - cli();
13110 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13111 ib->usage_cnt = pd->if_used;
13112 if (!pd->log_head)
13113 pd->log_head = ib; /* new head */
13114 @@ -124,7 +125,7 @@ put_log_buffer(hysdn_card * card, char *
13115 pd->log_tail->next = ib; /* follows existing messages */
13116 pd->log_tail = ib; /* new tail */
13117 i = pd->del_lock++; /* get lock state */
13118 - restore_flags(flags);
13119 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13120
13121 /* delete old entrys */
13122 if (!i)
13123 @@ -210,7 +211,6 @@ hysdn_log_read(struct file *file, char *
13124 word ino;
13125 struct procdata *pd = NULL;
13126 hysdn_card *card;
13127 - loff_t pos = *off;
13128
13129 if (!*((struct log_data **) file->private_data)) {
13130 if (file->f_flags & O_NONBLOCK)
13131 @@ -235,11 +235,11 @@ hysdn_log_read(struct file *file, char *
13132 return (0);
13133
13134 inf->usage_cnt--; /* new usage count */
13135 - file->private_data = &inf->next; /* next structure */
13136 + (struct log_data **) file->private_data = &inf->next; /* next structure */
13137 if ((len = strlen(inf->log_start)) <= count) {
13138 if (copy_to_user(buf, inf->log_start, len))
13139 return -EFAULT;
13140 - *off = pos + len;
13141 + file->f_pos += len;
13142 return (len);
13143 }
13144 return (0);
13145 @@ -255,7 +255,11 @@ hysdn_log_open(struct inode *ino, struct
13146 struct procdata *pd = NULL;
13147 ulong flags;
13148
13149 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13150 + MOD_INC_USE_COUNT;
13151 +#else
13152 lock_kernel();
13153 +#endif
13154 card = card_root;
13155 while (card) {
13156 pd = card->proclog;
13157 @@ -264,7 +268,11 @@ hysdn_log_open(struct inode *ino, struct
13158 card = card->next; /* search next entry */
13159 }
13160 if (!card) {
13161 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13162 + MOD_DEC_USE_COUNT;
13163 +#else
13164 unlock_kernel();
13165 +#endif
13166 return (-ENODEV); /* device is unknown/invalid */
13167 }
13168 filep->private_data = card; /* remember our own card */
13169 @@ -274,19 +282,24 @@ hysdn_log_open(struct inode *ino, struct
13170 } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
13171
13172 /* read access -> log/debug read */
13173 - save_flags(flags);
13174 - cli();
13175 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13176 pd->if_used++;
13177 if (pd->log_head)
13178 - filep->private_data = &(pd->log_tail->next);
13179 + (struct log_data **) filep->private_data = &(pd->log_tail->next);
13180 else
13181 - filep->private_data = &(pd->log_head);
13182 - restore_flags(flags);
13183 + (struct log_data **) filep->private_data = &(pd->log_head);
13184 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13185 } else { /* simultaneous read/write access forbidden ! */
13186 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13187 + MOD_DEC_USE_COUNT;
13188 +#else
13189 unlock_kernel();
13190 +#endif
13191 return (-EPERM); /* no permission this time */
13192 }
13193 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13194 unlock_kernel();
13195 +#endif
13196 return (0);
13197 } /* hysdn_log_open */
13198
13199 @@ -306,7 +319,9 @@ hysdn_log_close(struct inode *ino, struc
13200 int flags, retval = 0;
13201
13202
13203 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13204 lock_kernel();
13205 +#endif
13206 if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
13207 /* write only access -> write debug level written */
13208 retval = 0; /* success */
13209 @@ -314,8 +329,7 @@ hysdn_log_close(struct inode *ino, struc
13210 /* read access -> log/debug read, mark one further file as closed */
13211
13212 pd = NULL;
13213 - save_flags(flags);
13214 - cli();
13215 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13216 inf = *((struct log_data **) filep->private_data); /* get first log entry */
13217 if (inf)
13218 pd = (struct procdata *) inf->proc_ctrl; /* still entries there */
13219 @@ -338,7 +352,7 @@ hysdn_log_close(struct inode *ino, struc
13220 inf->usage_cnt--; /* decrement usage count for buffers */
13221 inf = inf->next;
13222 }
13223 - restore_flags(flags);
13224 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13225
13226 if (pd)
13227 if (pd->if_used <= 0) /* delete buffers if last file closed */
13228 @@ -348,7 +362,11 @@ hysdn_log_close(struct inode *ino, struc
13229 kfree(inf);
13230 }
13231 } /* read access */
13232 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13233 + MOD_DEC_USE_COUNT;
13234 +#else
13235 unlock_kernel();
13236 +#endif
13237
13238 return (retval);
13239 } /* hysdn_log_close */
13240 @@ -400,6 +418,9 @@ static struct file_operations log_fops =
13241 release: hysdn_log_close,
13242 };
13243
13244 +#ifdef COMPAT_NO_SOFTNET
13245 +struct inode_operations log_inode_operations;
13246 +#endif
13247
13248 /***********************************************************************************/
13249 /* hysdn_proclog_init is called when the module is loaded after creating the cards */
13250 @@ -414,10 +435,20 @@ hysdn_proclog_init(hysdn_card * card)
13251
13252 if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
13253 memset(pd, 0, sizeof(struct procdata));
13254 +#ifdef COMPAT_NO_SOFTNET
13255 + memset(&log_inode_operations, 0, sizeof(struct inode_operations));
13256 + log_inode_operations.default_file_ops = &log_fops;
13257 +#endif
13258 sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
13259 if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) {
13260 +#ifdef COMPAT_NO_SOFTNET
13261 + pd->log->ops = &log_inode_operations; /* set new operations table */
13262 +#else
13263 pd->log->proc_fops = &log_fops;
13264 +#ifdef COMPAT_HAS_FILEOP_OWNER
13265 pd->log->owner = THIS_MODULE;
13266 +#endif
13267 +#endif
13268 }
13269
13270 init_waitqueue_head(&(pd->rd_queue));
13271 --- a/drivers/isdn/hysdn/hysdn_sched.c
13272 +++ b/drivers/isdn/hysdn/hysdn_sched.c
13273 @@ -1,4 +1,4 @@
13274 -/* $Id: hysdn_sched.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13275 +/* $Id: hysdn_sched.c,v 1.9 2001/09/24 13:23:03 kai Exp $
13276 *
13277 * Linux driver for HYSDN cards
13278 * scheduler routines for handling exchange card <-> pc.
13279 @@ -12,11 +12,9 @@
13280 */
13281
13282 #include <linux/config.h>
13283 -#include <linux/sched.h>
13284 #include <linux/signal.h>
13285 #include <linux/kernel.h>
13286 #include <linux/ioport.h>
13287 -#include <linux/interrupt.h>
13288 #include <asm/io.h>
13289
13290 #include "hysdn_defs.h"
13291 @@ -151,22 +149,19 @@ hysdn_tx_cfgline(hysdn_card * card, ucha
13292
13293 if (card->debug_flags & LOG_SCHED_ASYN)
13294 hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1);
13295 -
13296 - save_flags(flags);
13297 - cli();
13298 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13299 while (card->async_busy) {
13300 - sti();
13301 -
13302 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13303 if (card->debug_flags & LOG_SCHED_ASYN)
13304 hysdn_addlog(card, "async tx-cfg delayed");
13305
13306 set_current_state(TASK_INTERRUPTIBLE);
13307 schedule_timeout((20 * HZ) / 1000); /* Timeout 20ms */
13308 if (!--cnt) {
13309 - restore_flags(flags);
13310 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13311 return (-ERR_ASYNC_TIME); /* timed out */
13312 }
13313 - cli();
13314 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13315 } /* wait for buffer to become free */
13316
13317 strcpy(card->async_data, line);
13318 @@ -177,31 +172,26 @@ hysdn_tx_cfgline(hysdn_card * card, ucha
13319 /* now queue the task */
13320 queue_task(&card->irq_queue, &tq_immediate);
13321 mark_bh(IMMEDIATE_BH);
13322 - sti();
13323 -
13324 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13325 if (card->debug_flags & LOG_SCHED_ASYN)
13326 hysdn_addlog(card, "async tx-cfg data queued");
13327
13328 cnt++; /* short delay */
13329 - cli();
13330 -
13331 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13332 while (card->async_busy) {
13333 - sti();
13334 -
13335 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13336 if (card->debug_flags & LOG_SCHED_ASYN)
13337 hysdn_addlog(card, "async tx-cfg waiting for tx-ready");
13338
13339 set_current_state(TASK_INTERRUPTIBLE);
13340 schedule_timeout((20 * HZ) / 1000); /* Timeout 20ms */
13341 if (!--cnt) {
13342 - restore_flags(flags);
13343 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13344 return (-ERR_ASYNC_TIME); /* timed out */
13345 }
13346 - cli();
13347 + HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13348 } /* wait for buffer to become free again */
13349 -
13350 - restore_flags(flags);
13351 -
13352 + HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13353 if (card->debug_flags & LOG_SCHED_ASYN)
13354 hysdn_addlog(card, "async tx-cfg data send");
13355
13356 --- a/drivers/isdn/icn/icn.c
13357 +++ b/drivers/isdn/icn/icn.c
13358 @@ -1,4 +1,4 @@
13359 -/* $Id: icn.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13360 +/* $Id$
13361 *
13362 * ISDN low-level module for the ICN active ISDN-Card.
13363 *
13364 @@ -41,7 +41,7 @@ MODULE_PARM_DESC(icn_id2, "ID-String of
13365 #undef MAP_DEBUG
13366
13367 static char
13368 -*revision = "$Revision: 1.1.4.1 $";
13369 +*revision = "$Revision$";
13370
13371 static int icn_addcard(int, char *, char *);
13372
13373 @@ -1634,6 +1634,7 @@ icn_addcard(int port, char *id1, char *i
13374 }
13375
13376 #ifndef MODULE
13377 +#ifdef COMPAT_HAS_NEW_SETUP
13378 static int __init
13379 icn_setup(char *line)
13380 {
13381 @@ -1643,6 +1644,14 @@ icn_setup(char *line)
13382 static char sid2[20];
13383
13384 str = get_options(line, 2, ints);
13385 +#else
13386 +void
13387 +icn_setup(char *str, int *ints)
13388 +{
13389 + char *p;
13390 + static char sid[20];
13391 + static char sid2[20];
13392 +#endif
13393 if (ints[0])
13394 portbase = ints[1];
13395 if (ints[0] > 1)
13396 @@ -1656,9 +1665,13 @@ icn_setup(char *line)
13397 icn_id2 = sid2;
13398 }
13399 }
13400 +#ifdef COMPAT_HAS_NEW_SETUP
13401 return(1);
13402 }
13403 __setup("icn=", icn_setup);
13404 +#else
13405 +}
13406 +#endif
13407 #endif /* MODULE */
13408
13409 static int __init icn_init(void)
13410 --- a/drivers/isdn/icn/icn.h
13411 +++ b/drivers/isdn/icn/icn.h
13412 @@ -1,4 +1,4 @@
13413 -/* $Id: icn.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13414 +/* $Id$
13415 *
13416 * ISDN lowlevel-module for the ICN active ISDN-Card.
13417 *
13418 --- a/drivers/isdn/isdn_audio.c
13419 +++ b/drivers/isdn/isdn_audio.c
13420 @@ -1,9 +1,9 @@
13421 -/* $Id: isdn_audio.c,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
13422 +/* $Id: isdn_audio.c,v 1.24 2002/08/13 09:57:26 keil Exp $
13423 *
13424 * Linux ISDN subsystem, audio conversion and compression (linklevel).
13425 *
13426 * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
13427 - * DTMF code (c) 1996 by Christian Mock (cm@kukuruz.ping.at)
13428 + * DTMF code (c) 1996 by Christian Mock (cm@tahina.priv.at)
13429 * Silence detection (c) 1998 by Armin Schindler (mac@gismo.telekom.de)
13430 *
13431 * This software may be used and distributed according to the terms
13432 @@ -15,7 +15,7 @@
13433 #include "isdn_audio.h"
13434 #include "isdn_common.h"
13435
13436 -char *isdn_audio_revision = "$Revision: 1.1.4.1 $";
13437 +char *isdn_audio_revision = "$Revision: 1.24 $";
13438
13439 /*
13440 * Misc. lookup-tables.
13441 @@ -169,19 +169,39 @@ static char isdn_audio_ulaw_to_alaw[] =
13442 0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a
13443 };
13444
13445 -#define NCOEFF 8 /* number of frequencies to be analyzed */
13446 -#define DTMF_TRESH 4000 /* above this is dtmf */
13447 +#define NCOEFF 16 /* number of frequencies to be analyzed */
13448 +#define DTMF_TRESH 25000 /* above this is dtmf */
13449 #define SILENCE_TRESH 200 /* below this is silence */
13450 +#define H2_TRESH 20000 /* 2nd harmonic */
13451 #define AMP_BITS 9 /* bits per sample, reduced to avoid overflow */
13452 #define LOGRP 0
13453 #define HIGRP 1
13454
13455 +typedef struct {
13456 + int grp; /* low/high group */
13457 + int k; /* k */
13458 + int k2; /* k fuer 2. harmonic */
13459 +} dtmf_t;
13460 +
13461 /* For DTMF recognition:
13462 * 2 * cos(2 * PI * k / N) precalculated for all k
13463 */
13464 static int cos2pik[NCOEFF] =
13465 {
13466 - 55813, 53604, 51193, 48591, 38114, 33057, 25889, 18332
13467 + 55812, 29528, 53603, 24032, 51193, 14443, 48590, 6517,
13468 + 38113, -21204, 33057, -32186, 25889, -45081, 18332, -55279
13469 +};
13470 +
13471 +static dtmf_t dtmf_tones[8] =
13472 +{
13473 + {LOGRP, 0, 1}, /* 697 Hz */
13474 + {LOGRP, 2, 3}, /* 770 Hz */
13475 + {LOGRP, 4, 5}, /* 852 Hz */
13476 + {LOGRP, 6, 7}, /* 941 Hz */
13477 + {HIGRP, 8, 9}, /* 1209 Hz */
13478 + {HIGRP, 10, 11}, /* 1336 Hz */
13479 + {HIGRP, 12, 13}, /* 1477 Hz */
13480 + {HIGRP, 14, 15} /* 1633 Hz */
13481 };
13482
13483 static char dtmf_matrix[4][4] =
13484 @@ -208,7 +228,7 @@ isdn_audio_tlookup(const u_char *table,
13485 : "memory", "ax");
13486 #else
13487 while (n--)
13488 - *buff = table[*(unsigned char *)buff], buff++;
13489 + *buff++ = table[*(unsigned char *)buff];
13490 #endif
13491 }
13492
13493 @@ -479,18 +499,6 @@ isdn_audio_goertzel(int *sample, modem_i
13494 sk2 = sk1;
13495 sk1 = sk;
13496 }
13497 - /* Avoid overflows */
13498 - sk >>= 1;
13499 - sk2 >>= 1;
13500 - /* compute |X(k)|**2 */
13501 - /* report overflows. This should not happen. */
13502 - /* Comment this out if desired */
13503 - if (sk < -32768 || sk > 32767)
13504 - printk(KERN_DEBUG
13505 - "isdn_audio: dtmf goertzel overflow, sk=%d\n", sk);
13506 - if (sk2 < -32768 || sk2 > 32767)
13507 - printk(KERN_DEBUG
13508 - "isdn_audio: dtmf goertzel overflow, sk2=%d\n", sk2);
13509 result[k] =
13510 ((sk * sk) >> AMP_BITS) -
13511 ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) +
13512 @@ -514,58 +522,28 @@ isdn_audio_eval_dtmf(modem_info * info)
13513 int grp[2];
13514 char what;
13515 char *p;
13516 - int thresh;
13517
13518 while ((skb = skb_dequeue(&info->dtmf_queue))) {
13519 result = (int *) skb->data;
13520 s = info->dtmf_state;
13521 - grp[LOGRP] = grp[HIGRP] = -1;
13522 + grp[LOGRP] = grp[HIGRP] = -2;
13523 silence = 0;
13524 - thresh = 0;
13525 - for (i = 0; i < NCOEFF; i++) {
13526 - if (result[i] > DTMF_TRESH) {
13527 - if (result[i] > thresh)
13528 - thresh = result[i];
13529 - }
13530 - else if (result[i] < SILENCE_TRESH)
13531 + for (i = 0; i < 8; i++) {
13532 + if ((result[dtmf_tones[i].k] > DTMF_TRESH) &&
13533 + (result[dtmf_tones[i].k2] < H2_TRESH))
13534 + grp[dtmf_tones[i].grp] = (grp[dtmf_tones[i].grp] == -2) ? i : -1;
13535 + else if ((result[dtmf_tones[i].k] < SILENCE_TRESH) &&
13536 + (result[dtmf_tones[i].k2] < SILENCE_TRESH))
13537 silence++;
13538 }
13539 - if (silence == NCOEFF)
13540 + if (silence == 8)
13541 what = ' ';
13542 else {
13543 - if (thresh > 0) {
13544 - thresh = thresh >> 4; /* touchtones must match within 12 dB */
13545 - for (i = 0; i < NCOEFF; i++) {
13546 - if (result[i] < thresh)
13547 - continue; /* ignore */
13548 - /* good level found. This is allowed only one time per group */
13549 - if (i < NCOEFF / 2) {
13550 - /* lowgroup*/
13551 - if (grp[LOGRP] >= 0) {
13552 - // Bad. Another tone found. */
13553 - grp[LOGRP] = -1;
13554 - break;
13555 - }
13556 - else
13557 - grp[LOGRP] = i;
13558 - }
13559 - else { /* higroup */
13560 - if (grp[HIGRP] >= 0) { // Bad. Another tone found. */
13561 - grp[HIGRP] = -1;
13562 - break;
13563 - }
13564 - else
13565 - grp[HIGRP] = i - NCOEFF/2;
13566 - }
13567 - }
13568 - if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) {
13569 - what = dtmf_matrix[grp[LOGRP]][grp[HIGRP]];
13570 - if (s->last != ' ' && s->last != '.')
13571 - s->last = what; /* min. 1 non-DTMF between DTMF */
13572 - } else
13573 - what = '.';
13574 - }
13575 - else
13576 + if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) {
13577 + what = dtmf_matrix[grp[LOGRP]][grp[HIGRP] - 4];
13578 + if (s->last != ' ' && s->last != '.')
13579 + s->last = what; /* min. 1 non-DTMF between DTMF */
13580 + } else
13581 what = '.';
13582 }
13583 if ((what != s->last) && (what != ' ') && (what != '.')) {
13584 --- a/drivers/isdn/isdn_audio.h
13585 +++ b/drivers/isdn/isdn_audio.h
13586 @@ -1,4 +1,4 @@
13587 -/* $Id: isdn_audio.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
13588 +/* $Id: isdn_audio.h,v 1.10 2001/09/24 13:22:42 kai Exp $
13589 *
13590 * Linux ISDN subsystem, audio conversion and compression (linklevel).
13591 *
13592 @@ -20,7 +20,6 @@ typedef struct adpcm_state {
13593
13594 typedef struct dtmf_state {
13595 char last;
13596 - char llast;
13597 int idx;
13598 int buf[DTMF_NPOINTS];
13599 } dtmf_state;
13600 --- a/drivers/isdn/isdn_bsdcomp.c
13601 +++ b/drivers/isdn/isdn_bsdcomp.c
13602 @@ -105,6 +105,14 @@ MODULE_LICENSE("Dual BSD/GPL");
13603
13604 #define DEBUG 1
13605
13606 +#ifdef CONFIG_ISDN_WITH_ABC
13607 +#define BSD_C_MALLOC(x) kmalloc((x),GFP_ATOMIC)
13608 +#define BSD_C_FREE(x) kfree(x)
13609 +#else
13610 +#define BSD_C_MALLOC(x) vmalloc(x)
13611 +#define BSD_C_FREE(x) vfree(x)
13612 +#endif
13613 +
13614 /*
13615 * A dictionary for doing BSD compress.
13616 */
13617 @@ -285,7 +293,7 @@ static void bsd_free (void *state)
13618 * Release the dictionary
13619 */
13620 if (db->dict) {
13621 - vfree (db->dict);
13622 + BSD_C_FREE (db->dict);
13623 db->dict = NULL;
13624 }
13625
13626 @@ -293,7 +301,7 @@ static void bsd_free (void *state)
13627 * Release the string buffer
13628 */
13629 if (db->lens) {
13630 - vfree (db->lens);
13631 + BSD_C_FREE (db->lens);
13632 db->lens = NULL;
13633 }
13634
13635 @@ -350,14 +358,19 @@ static void *bsd_alloc (struct isdn_ppp_
13636 * Allocate space for the dictionary. This may be more than one page in
13637 * length.
13638 */
13639 - db->dict = (struct bsd_dict *) vmalloc (hsize * sizeof (struct bsd_dict));
13640 + db->dict = (struct bsd_dict *) BSD_C_MALLOC (hsize * sizeof (struct bsd_dict));
13641 +
13642 + MOD_INC_USE_COUNT;
13643 + /*
13644 + ** MOD_INC_USE_COUNT must be before bsd_free
13645 + ** bsd_free make MOD_DEC_USE_COUNT if db != NULL
13646 + */
13647 +
13648 if (!db->dict) {
13649 bsd_free (db);
13650 return NULL;
13651 }
13652
13653 - MOD_INC_USE_COUNT;
13654 -
13655 /*
13656 * If this is the compression buffer then there is no length data.
13657 * For decompression, the length information is needed as well.
13658 @@ -365,7 +378,7 @@ static void *bsd_alloc (struct isdn_ppp_
13659 if (!decomp)
13660 db->lens = NULL;
13661 else {
13662 - db->lens = (unsigned short *) vmalloc ((maxmaxcode + 1) *
13663 + db->lens = (unsigned short *) BSD_C_MALLOC ((maxmaxcode + 1) *
13664 sizeof (db->lens[0]));
13665 if (!db->lens) {
13666 bsd_free (db); /* calls MOD_DEC_USE_COUNT; */
13667 @@ -478,7 +491,11 @@ static int bsd_compress (void *state, st
13668 int hval,disp,ilen,mxcode;
13669 unsigned char *rptr = skb_in->data;
13670 int isize = skb_in->len;
13671 +#ifdef CONFIG_ISDN_WITH_ABC
13672 + long secure = 0;
13673 +#endif
13674
13675 +#ifndef CONFIG_ISDN_WITH_ABC
13676 #define OUTPUT(ent) \
13677 { \
13678 bitno -= n_bits; \
13679 @@ -490,17 +507,45 @@ static int bsd_compress (void *state, st
13680 bitno += 8; \
13681 } while (bitno <= 24); \
13682 }
13683 +#else
13684 +#define OUTPUT(ent) \
13685 + { \
13686 + secure = 0; \
13687 + bitno -= n_bits; \
13688 + accm |= ((ent) << bitno); \
13689 + do { \
13690 + if(skb_out && skb_tailroom(skb_out) > 0) \
13691 + *(skb_put(skb_out,1)) = (unsigned char) (accm>>24); \
13692 + accm <<= 8; \
13693 + bitno += 8; \
13694 + } while (bitno <= 24 && ++secure < 10000); \
13695 + if(secure >= 10000) { \
13696 + printk(KERN_DEBUG "BSD in OUTPUT secure counter reached\n"); \
13697 + return 0; \
13698 + } \
13699 + }
13700 +#endif
13701
13702 /*
13703 * If the protocol is not in the range we're interested in,
13704 * just return without compressing the packet. If it is,
13705 * the protocol becomes the first byte to compress.
13706 */
13707 +#ifdef CONFIG_ISDN_WITH_ABC
13708 + ent = proto;
13709 +
13710 + if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) ) {
13711 +
13712 + printk(KERN_DEBUG "bsd_compress called with %x\n",proto);
13713 + return 0;
13714 + }
13715 +#else
13716 printk(KERN_DEBUG "bsd_compress called with %x\n",proto);
13717
13718 ent = proto;
13719 if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) )
13720 return 0;
13721 +#endif
13722
13723 db = (struct bsd_db *) state;
13724 hshift = db->hshift;
13725 @@ -538,6 +583,9 @@ static int bsd_compress (void *state, st
13726
13727 /* continue probing until a match or invalid entry */
13728 disp = (hval == 0) ? 1 : hval;
13729 +#ifdef CONFIG_ISDN_WITH_ABC
13730 + secure = 0;
13731 +#endif
13732
13733 do {
13734 hval += disp;
13735 @@ -546,7 +594,15 @@ static int bsd_compress (void *state, st
13736 dictp = dict_ptr (db, hval);
13737 if (dictp->codem1 >= max_ent)
13738 goto nomatch;
13739 +#ifndef CONFIG_ISDN_WITH_ABC
13740 } while (dictp->fcode != fcode);
13741 +#else
13742 + } while (dictp->fcode != fcode && ++secure < 100000);
13743 + if(secure >= 100000) {
13744 + printk(KERN_DEBUG "BSD: compress while dictp->fcode != fcode secure-counter reached\n");
13745 + return 0;
13746 + }
13747 +#endif
13748
13749 ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */
13750 continue;
13751 @@ -669,6 +725,9 @@ static int bsd_decompress (void *state,
13752 int ilen;
13753 int codelen;
13754 int extra;
13755 +#ifdef CONFIG_ISDN_WITH_ABC
13756 + unsigned long secure = 0;
13757 +#endif
13758
13759 db = (struct bsd_db *) state;
13760 max_ent = db->max_ent;
13761 @@ -677,7 +736,9 @@ static int bsd_decompress (void *state,
13762 n_bits = db->n_bits;
13763 tgtbitno = 32 - n_bits; /* bitno when we have a code */
13764
13765 +#ifndef CONFIG_ISDN_WITH_ABC
13766 printk(KERN_DEBUG "bsd_decompress called\n");
13767 +#endif
13768
13769 if(!skb_in || !skb_out) {
13770 printk(KERN_ERR "bsd_decompress called with NULL parameter\n");
13771 @@ -795,7 +856,11 @@ static int bsd_decompress (void *state,
13772
13773 p = skb_put(skb_out,codelen);
13774 p += codelen;
13775 +#ifdef CONFIG_ISDN_WITH_ABC
13776 + for(secure = 0; finchar > LAST && secure < 50000;secure++) {
13777 +#else
13778 while (finchar > LAST) {
13779 +#endif
13780 struct bsd_dict *dictp2 = dict_ptr (db, finchar);
13781
13782 dictp = dict_ptr (db, dictp2->cptr);
13783 @@ -822,6 +887,12 @@ static int bsd_decompress (void *state,
13784 }
13785 }
13786 *--p = finchar;
13787 +#ifdef CONFIG_ISDN_WITH_ABC
13788 + if(secure >= 50000) {
13789 + printk(KERN_DEBUG "BSD: decompress secure-counter reached\n");
13790 + return DECOMP_FATALERROR;
13791 + }
13792 +#endif
13793
13794 #ifdef DEBUG
13795 if (--codelen != 0)
13796 @@ -851,12 +922,23 @@ static int bsd_decompress (void *state,
13797 /* look for a free hash table entry */
13798 if (dictp->codem1 < max_ent) {
13799 disp = (hval == 0) ? 1 : hval;
13800 +#ifdef CONFIG_ISDN_WITH_ABC
13801 + secure = 0;
13802 +#endif
13803 do {
13804 hval += disp;
13805 if (hval >= db->hsize)
13806 hval -= db->hsize;
13807 dictp = dict_ptr (db, hval);
13808 +#ifndef CONFIG_ISDN_WITH_ABC
13809 } while (dictp->codem1 < max_ent);
13810 +#else
13811 + } while (dictp->codem1 < max_ent && ++secure < 50000);
13812 + if(secure >= 50000) {
13813 + printk(KERN_DEBUG "BSD: decomp while (dictp->codem1 < max_ent) secure-counter reached\n");
13814 + return DECOMP_FATALERROR;
13815 + }
13816 +#endif
13817 }
13818
13819 /*
13820 @@ -895,11 +977,21 @@ static int bsd_decompress (void *state,
13821 db->comp_bytes += skb_in->len - BSD_OVHD;
13822 db->uncomp_bytes += skb_out->len;
13823
13824 +#ifdef CONFIG_ISDN_WITH_ABC
13825 + /*
13826 + ** bsd_check will call bsd_clear
13827 + ** and so on the internal tables will be cleared.
13828 + **
13829 + ** I think that's not what we will at this point ?????
13830 + ** For me at works without bsd_check.
13831 + */
13832 +#else
13833 if (bsd_check(db)) {
13834 if (db->debug)
13835 printk(KERN_DEBUG "bsd_decomp%d: peer should have cleared dictionary on %d\n",
13836 db->unit, db->seqno - 1);
13837 }
13838 +#endif
13839 return skb_out->len;
13840 }
13841
13842 --- a/drivers/isdn/isdn_common.c
13843 +++ b/drivers/isdn/isdn_common.c
13844 @@ -1,4 +1,4 @@
13845 -/* $Id: isdn_common.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
13846 +/* $Id: isdn_common.c,v 1.137 2002/02/09 21:19:11 keil Exp $
13847 *
13848 * Linux ISDN subsystem, common used functions (linklevel).
13849 *
13850 @@ -19,6 +19,7 @@
13851 #include <linux/vmalloc.h>
13852 #include <linux/isdn.h>
13853 #include <linux/smp_lock.h>
13854 +#include <linux/list.h>
13855 #include "isdn_common.h"
13856 #include "isdn_tty.h"
13857 #include "isdn_net.h"
13858 @@ -33,7 +34,9 @@
13859 #include <linux/isdn_divertif.h>
13860 #endif /* CONFIG_ISDN_DIVERSION */
13861 #include "isdn_v110.h"
13862 +#ifdef HAVE_DEVFS_FS
13863 #include <linux/devfs_fs_kernel.h>
13864 +#endif /* HAVE_DEVFS_FS */
13865
13866 /* Debugflags */
13867 #undef ISDN_DEBUG_STATCALLB
13868 @@ -44,7 +47,7 @@ MODULE_LICENSE("GPL");
13869
13870 isdn_dev *dev;
13871
13872 -static char *isdn_revision = "$Revision: 1.1.4.1 $";
13873 +static char *isdn_revision = "$Revision: 1.137 $";
13874
13875 extern char *isdn_net_revision;
13876 extern char *isdn_tty_revision;
13877 @@ -67,19 +70,19 @@ static isdn_divert_if *divert_if; /* = N
13878
13879 static int isdn_writebuf_stub(int, int, const u_char *, int, int);
13880 static void set_global_features(void);
13881 +#ifdef HAVE_DEVFS_FS
13882 static void isdn_register_devfs(int);
13883 static void isdn_unregister_devfs(int);
13884 +#endif /* HAVE_DEVFS_FS */
13885 static int isdn_wildmat(char *s, char *p);
13886
13887 void
13888 isdn_lock_drivers(void)
13889 {
13890 int i;
13891 - isdn_ctrl cmd;
13892
13893 - for (i = 0; i < ISDN_MAX_DRIVERS; i++) {
13894 - if (!dev->drv[i])
13895 - continue;
13896 + for (i = 0; i < dev->drivers; i++) {
13897 + isdn_ctrl cmd;
13898
13899 cmd.driver = i;
13900 cmd.arg = 0;
13901 @@ -101,10 +104,7 @@ isdn_unlock_drivers(void)
13902 {
13903 int i;
13904
13905 - for (i = 0; i < ISDN_MAX_DRIVERS; i++) {
13906 - if (!dev->drv[i])
13907 - continue;
13908 -
13909 + for (i = 0; i < dev->drivers; i++)
13910 if (dev->drv[i]->locks > 0) {
13911 isdn_ctrl cmd;
13912
13913 @@ -114,7 +114,6 @@ isdn_unlock_drivers(void)
13914 isdn_command(&cmd);
13915 dev->drv[i]->locks--;
13916 }
13917 - }
13918 }
13919
13920 void
13921 @@ -473,6 +472,7 @@ isdn_status_callback(isdn_ctrl * c)
13922 dev->drv[di]->flags &= ~DRV_FLAG_RUNNING;
13923 break;
13924 case ISDN_STAT_ICALL:
13925 + case ISDN_STAT_ICALLW:
13926 if (i < 0)
13927 return -1;
13928 #ifdef ISDN_DEBUG_STATCALLB
13929 @@ -718,7 +718,9 @@ isdn_status_callback(isdn_ctrl * c)
13930 dev->drvmap[i] = -1;
13931 dev->chanmap[i] = -1;
13932 dev->usage[i] &= ~ISDN_USAGE_DISABLED;
13933 +#ifdef HAVE_DEVFS_FS
13934 isdn_unregister_devfs(i);
13935 +#endif /* HAVE_DEVFS_FS */
13936 }
13937 dev->drivers--;
13938 dev->channels -= dev->drv[di]->channels;
13939 @@ -755,6 +757,10 @@ isdn_status_callback(isdn_ctrl * c)
13940 if (divert_if)
13941 return(divert_if->stat_callback(c));
13942 #endif /* CONFIG_ISDN_DIVERSION */
13943 + case ISDN_STAT_ALERT:
13944 + case ISDN_STAT_PROCEED:
13945 + isdn_tty_stat_callback(i, c);
13946 + break;
13947 default:
13948 return -1;
13949 }
13950 @@ -900,72 +906,239 @@ isdn_minor2chan(int minor)
13951 return (dev->chanmap[minor]);
13952 }
13953
13954 -static char *
13955 -isdn_statstr(void)
13956 +// ----------------------------------------------------------------------
13957 +// /dev/isdninfo
13958 +//
13959 +// This device has somewhat insane semantics, but we need to support
13960 +// them for the sake of compatibility.
13961 +//
13962 +// After opening, the first read will succeed and return the current state
13963 +// Then, unless O_NONBLOCK is set, it will block until a state change happens
13964 +// and then return the new state.
13965 +// Also, if the buffer size for the read is too small, we'll just return
13966 +// EOF
13967 +
13968 +struct isdnstatus_dev {
13969 + struct list_head list;
13970 + int update;
13971 +};
13972 +
13973 +static DECLARE_WAIT_QUEUE_HEAD(isdnstatus_waitq);
13974 +static LIST_HEAD(isdnstatus_devs);
13975 +static spinlock_t isdnstatus_devs_lock = SPIN_LOCK_UNLOCKED;
13976 +
13977 +void
13978 +isdn_info_update(void)
13979 +{
13980 + struct list_head *p;
13981 + struct isdnstatus_dev *idev;
13982 +
13983 + spin_lock(&isdnstatus_devs_lock);
13984 + list_for_each(p, &isdnstatus_devs) {
13985 + idev = list_entry(p, struct isdnstatus_dev, list);
13986 + idev->update = 1;
13987 + }
13988 + spin_unlock(&isdnstatus_devs_lock);
13989 + wake_up_interruptible(&isdnstatus_waitq);
13990 +}
13991 +
13992 +static int
13993 +isdnstatus_open(struct inode *ino, struct file *filep)
13994 +{
13995 + struct isdnstatus_dev *p;
13996 +
13997 + p = kmalloc(sizeof(struct isdnstatus_dev), GFP_USER);
13998 + if (!p)
13999 + return -ENOMEM;
14000 +
14001 + /* At opening time we allow a single update */
14002 + p->update = 1;
14003 + spin_lock(&isdnstatus_devs_lock);
14004 + list_add(&p->list, &isdnstatus_devs);
14005 + spin_unlock(&isdnstatus_devs_lock);
14006 + filep->private_data = p;
14007 +
14008 + return 0;
14009 +}
14010 +
14011 +static void
14012 +isdnstatus_close(struct inode *ino, struct file *filep)
14013 +{
14014 + struct isdnstatus_dev *p = filep->private_data;
14015 +
14016 + spin_lock(&isdnstatus_devs_lock);
14017 + list_del(&p->list);
14018 + spin_unlock(&isdnstatus_devs_lock);
14019 + kfree(p);
14020 +}
14021 +
14022 +// FIXME we don't lock against the state changing whilst being
14023 +// printed
14024 +
14025 +void
14026 +isdn_statstr(char *buf)
14027 {
14028 - static char istatbuf[2048];
14029 char *p;
14030 int i;
14031
14032 - sprintf(istatbuf, "idmap:\t");
14033 - p = istatbuf + strlen(istatbuf);
14034 + p = buf;
14035 + p += sprintf(p, "idmap:\t");
14036 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14037 - sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]);
14038 - p = istatbuf + strlen(istatbuf);
14039 + p += sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]);
14040 }
14041 - sprintf(p, "\nchmap:\t");
14042 - p = istatbuf + strlen(istatbuf);
14043 + p += sprintf(p, "\nchmap:\t");
14044 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14045 - sprintf(p, "%d ", dev->chanmap[i]);
14046 - p = istatbuf + strlen(istatbuf);
14047 + p += sprintf(p, "%d ", dev->chanmap[i]);
14048 }
14049 - sprintf(p, "\ndrmap:\t");
14050 - p = istatbuf + strlen(istatbuf);
14051 + p += sprintf(p, "\ndrmap:\t");
14052 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14053 - sprintf(p, "%d ", dev->drvmap[i]);
14054 - p = istatbuf + strlen(istatbuf);
14055 + p += sprintf(p, "%d ", dev->drvmap[i]);
14056 }
14057 - sprintf(p, "\nusage:\t");
14058 - p = istatbuf + strlen(istatbuf);
14059 + p += sprintf(p, "\nusage:\t");
14060 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14061 - sprintf(p, "%d ", dev->usage[i]);
14062 - p = istatbuf + strlen(istatbuf);
14063 + p += sprintf(p, "%d ", dev->usage[i]);
14064 }
14065 - sprintf(p, "\nflags:\t");
14066 - p = istatbuf + strlen(istatbuf);
14067 + p += sprintf(p, "\nflags:\t");
14068 for (i = 0; i < ISDN_MAX_DRIVERS; i++) {
14069 if (dev->drv[i]) {
14070 - sprintf(p, "%ld ", dev->drv[i]->online);
14071 - p = istatbuf + strlen(istatbuf);
14072 + p += sprintf(p, "%ld ", dev->drv[i]->online);
14073 } else {
14074 - sprintf(p, "? ");
14075 - p = istatbuf + strlen(istatbuf);
14076 + p += sprintf(p, "? ");
14077 }
14078 }
14079 - sprintf(p, "\nphone:\t");
14080 - p = istatbuf + strlen(istatbuf);
14081 + p += sprintf(p, "\nphone:\t");
14082 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14083 - sprintf(p, "%s ", dev->num[i]);
14084 - p = istatbuf + strlen(istatbuf);
14085 + p += sprintf(p, "%s ", dev->num[i]);
14086 }
14087 - sprintf(p, "\n");
14088 - return istatbuf;
14089 + p += sprintf(p, "\n");
14090 }
14091
14092 -/* Module interface-code */
14093 +static ssize_t
14094 +isdnstatus_read(struct file *file, char *buf, size_t count, loff_t * off)
14095 +{
14096 + static DECLARE_MUTEX(istatbuf_mutex);
14097 + static char istatbuf[2048];
14098
14099 -void
14100 -isdn_info_update(void)
14101 + DECLARE_WAITQUEUE(wait, current);
14102 + struct isdnstatus_dev *idev;
14103 + int retval = 0;
14104 + unsigned int len;
14105 +
14106 + idev = file->private_data;
14107 +
14108 + if (off != &file->f_pos)
14109 + return -ESPIPE;
14110 +
14111 + add_wait_queue(&isdnstatus_waitq, &wait);
14112 + for (;;) {
14113 + set_current_state(TASK_INTERRUPTIBLE);
14114 +
14115 + if (idev->update)
14116 + break;
14117 +
14118 + retval = -EAGAIN;
14119 + if (file->f_flags & O_NONBLOCK)
14120 + break;
14121 +
14122 + retval = -ERESTARTSYS;
14123 + if (signal_pending(current))
14124 + break;
14125 +
14126 + schedule();
14127 + }
14128 + __set_current_state(TASK_RUNNING);
14129 + remove_wait_queue(&isdnstatus_waitq, &wait);
14130 +
14131 + if (!idev->update)
14132 + goto out;
14133 +
14134 + idev->update = 0;
14135 + down(&istatbuf_mutex);
14136 + isdn_statstr(istatbuf);
14137 + len = strlen(istatbuf);
14138 + if (len > count) {
14139 + retval = 0;
14140 + goto out_unlock;
14141 + }
14142 + if (copy_to_user(buf, istatbuf, len)) {
14143 + retval = -EFAULT;
14144 + goto out_unlock;
14145 + }
14146 + *off += len;
14147 + retval = len;
14148 +
14149 + out_unlock:
14150 + up(&istatbuf_mutex);
14151 + out:
14152 + return retval;
14153 +}
14154 +
14155 +static ssize_t
14156 +isdnstatus_write(struct file *file, const char *buf, size_t count, loff_t * off)
14157 {
14158 - infostruct *p = dev->infochain;
14159 + return -EINVAL;
14160 +}
14161 +
14162 +static unsigned int
14163 +isdnstatus_poll(struct file *file, poll_table * wait)
14164 +{
14165 + struct isdnstatus_dev *idev;
14166 + unsigned int mask = 0;
14167 +
14168 + idev = file->private_data;
14169
14170 - while (p) {
14171 - *(p->private) = 1;
14172 - p = (infostruct *) p->next;
14173 + poll_wait(file, &isdnstatus_waitq, wait);
14174 + if (idev->update) {
14175 + mask |= POLLIN | POLLRDNORM;
14176 }
14177 - wake_up_interruptible(&(dev->info_waitq));
14178 + return mask;
14179 }
14180
14181 +static int
14182 +isdnstatus_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
14183 +{
14184 + int retval;
14185 + isdn_net_ioctl_phone phone;
14186 +
14187 + switch (cmd) {
14188 + case IIOCGETDVR:
14189 + return (TTY_DV +
14190 + (NET_DV << 8) +
14191 + (INF_DV << 16));
14192 + case IIOCGETCPS:
14193 + if (arg) {
14194 + ulong *p = (ulong *) arg;
14195 + int i;
14196 + if ((retval = verify_area(VERIFY_WRITE, (void *) arg,
14197 + sizeof(ulong) * ISDN_MAX_CHANNELS * 2)))
14198 + return retval;
14199 + for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14200 + put_user(dev->ibytes[i], p++);
14201 + put_user(dev->obytes[i], p++);
14202 + }
14203 + return 0;
14204 + } else
14205 + return -EINVAL;
14206 + break;
14207 +#ifdef CONFIG_NETDEVICES
14208 + case IIOCNETGPN:
14209 + /* Get peer phone number of a connected
14210 + * isdn network interface */
14211 + if (arg) {
14212 + if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone)))
14213 + return -EFAULT;
14214 + return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg);
14215 + } else
14216 + return -EINVAL;
14217 +#endif
14218 + default:
14219 + return -EINVAL;
14220 + }
14221 +}
14222 +
14223 +// ----------------------------------------------------------------------
14224 +
14225 +
14226 static ssize_t
14227 isdn_read(struct file *file, char *buf, size_t count, loff_t * off)
14228 {
14229 @@ -976,37 +1149,16 @@ isdn_read(struct file *file, char *buf,
14230 int chidx;
14231 int retval;
14232 char *p;
14233 - loff_t pos = *off;
14234
14235 if (off != &file->f_pos)
14236 return -ESPIPE;
14237
14238 - if (pos != (unsigned) pos)
14239 - return -EINVAL;
14240 -
14241 +#ifndef COMPAT_HAVE_READ_LOCK_KERNEL
14242 lock_kernel();
14243 - if (minor == ISDN_MINOR_STATUS) {
14244 - if (!file->private_data) {
14245 - if (file->f_flags & O_NONBLOCK) {
14246 - retval = -EAGAIN;
14247 - goto out;
14248 - }
14249 - interruptible_sleep_on(&(dev->info_waitq));
14250 - }
14251 - p = isdn_statstr();
14252 - file->private_data = 0;
14253 - if ((len = strlen(p)) <= count) {
14254 - if (copy_to_user(buf, p, len)) {
14255 - retval = -EFAULT;
14256 - goto out;
14257 - }
14258 - *off = pos + len;
14259 - retval = len;
14260 - goto out;
14261 - }
14262 - retval = 0;
14263 - goto out;
14264 - }
14265 +#endif
14266 + if (minor == ISDN_MINOR_STATUS)
14267 + return isdnstatus_read(file, buf, count, off);
14268 +
14269 if (!dev->drivers) {
14270 retval = -ENODEV;
14271 goto out;
14272 @@ -1031,7 +1183,7 @@ isdn_read(struct file *file, char *buf,
14273 cli();
14274 len = isdn_readbchan(drvidx, chidx, p, 0, count,
14275 &dev->drv[drvidx]->rcv_waitq[chidx]);
14276 - *off = pos + len;
14277 + *off += len;
14278 restore_flags(flags);
14279 if (copy_to_user(buf,p,len))
14280 len = -EFAULT;
14281 @@ -1052,6 +1204,9 @@ isdn_read(struct file *file, char *buf,
14282 }
14283 interruptible_sleep_on(&(dev->drv[drvidx]->st_waitq));
14284 }
14285 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14286 + if(drvidx || (len = isdn_dw_abc_lcr_readstat(buf,count)) < 1) {
14287 +#endif
14288 if (dev->drv[drvidx]->interface->readstat) {
14289 if (count > dev->drv[drvidx]->stavail)
14290 count = dev->drv[drvidx]->stavail;
14291 @@ -1065,6 +1220,9 @@ isdn_read(struct file *file, char *buf,
14292 } else {
14293 len = 0;
14294 }
14295 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14296 + }
14297 +#endif
14298 save_flags(flags);
14299 cli();
14300 if (len)
14301 @@ -1072,7 +1230,7 @@ isdn_read(struct file *file, char *buf,
14302 else
14303 dev->drv[drvidx]->stavail = 0;
14304 restore_flags(flags);
14305 - *off = pos + len;
14306 + *off += len;
14307 retval = len;
14308 goto out;
14309 }
14310 @@ -1084,7 +1242,9 @@ isdn_read(struct file *file, char *buf,
14311 #endif
14312 retval = -ENODEV;
14313 out:
14314 +#ifndef COMPAT_HAVE_READ_LOCK_KERNEL
14315 unlock_kernel();
14316 +#endif
14317 return retval;
14318 }
14319
14320 @@ -1096,15 +1256,18 @@ isdn_write(struct file *file, const char
14321 int chidx;
14322 int retval;
14323
14324 + if (minor == ISDN_MINOR_STATUS)
14325 + return isdnstatus_write(file, buf, count, off);
14326 +
14327 if (off != &file->f_pos)
14328 return -ESPIPE;
14329
14330 - if (minor == ISDN_MINOR_STATUS)
14331 - return -EPERM;
14332 if (!dev->drivers)
14333 return -ENODEV;
14334
14335 +#ifndef COMPAT_HAVE_WRITE_LOCK_KERNEL
14336 lock_kernel();
14337 +#endif
14338 if (minor <= ISDN_MINOR_BMAX) {
14339 printk(KERN_WARNING "isdn_write minor %d obsolete!\n", minor);
14340 drvidx = isdn_minor2drv(minor);
14341 @@ -1149,7 +1312,9 @@ isdn_write(struct file *file, const char
14342 #endif
14343 retval = -ENODEV;
14344 out:
14345 +#ifndef COMPAT_HAVE_WRITE_LOCK_KERNEL
14346 unlock_kernel();
14347 +#endif
14348 return retval;
14349 }
14350
14351 @@ -1160,15 +1325,12 @@ isdn_poll(struct file *file, poll_table
14352 unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
14353 int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL);
14354
14355 +#ifndef COMPAT_HAVE_POLL_LOCK_KERNEL
14356 lock_kernel();
14357 - if (minor == ISDN_MINOR_STATUS) {
14358 - poll_wait(file, &(dev->info_waitq), wait);
14359 - /* mask = POLLOUT | POLLWRNORM; */
14360 - if (file->private_data) {
14361 - mask |= POLLIN | POLLRDNORM;
14362 - }
14363 - goto out;
14364 - }
14365 +#endif
14366 + if (minor == ISDN_MINOR_STATUS)
14367 + return isdnstatus_poll(file, wait);
14368 +
14369 if (minor >= ISDN_MINOR_CTRL && minor <= ISDN_MINOR_CTRLMAX) {
14370 if (drvidx < 0) {
14371 /* driver deregistered while file open */
14372 @@ -1190,7 +1352,9 @@ isdn_poll(struct file *file, poll_table
14373 #endif
14374 mask = POLLERR;
14375 out:
14376 +#ifndef COMPAT_HAVE_POLL_LOCK_KERNEL
14377 unlock_kernel();
14378 +#endif
14379 return mask;
14380 }
14381
14382 @@ -1220,42 +1384,9 @@ isdn_ioctl(struct inode *inode, struct f
14383 #define phone iocpar.phone
14384 #define cfg iocpar.cfg
14385
14386 - if (minor == ISDN_MINOR_STATUS) {
14387 - switch (cmd) {
14388 - case IIOCGETDVR:
14389 - return (TTY_DV +
14390 - (NET_DV << 8) +
14391 - (INF_DV << 16));
14392 - case IIOCGETCPS:
14393 - if (arg) {
14394 - ulong *p = (ulong *) arg;
14395 - int i;
14396 - if ((ret = verify_area(VERIFY_WRITE, (void *) arg,
14397 - sizeof(ulong) * ISDN_MAX_CHANNELS * 2)))
14398 - return ret;
14399 - for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14400 - put_user(dev->ibytes[i], p++);
14401 - put_user(dev->obytes[i], p++);
14402 - }
14403 - return 0;
14404 - } else
14405 - return -EINVAL;
14406 - break;
14407 -#ifdef CONFIG_NETDEVICES
14408 - case IIOCNETGPN:
14409 - /* Get peer phone number of a connected
14410 - * isdn network interface */
14411 - if (arg) {
14412 - if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone)))
14413 - return -EFAULT;
14414 - return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg);
14415 - } else
14416 - return -EINVAL;
14417 -#endif
14418 - default:
14419 - return -EINVAL;
14420 - }
14421 - }
14422 + if (minor == ISDN_MINOR_STATUS)
14423 + return isdnstatus_ioctl(inode, file, cmd, arg);
14424 +
14425 if (!dev->drivers)
14426 return -ENODEV;
14427 if (minor <= ISDN_MINOR_BMAX) {
14428 @@ -1277,11 +1408,34 @@ isdn_ioctl(struct inode *inode, struct f
14429 */
14430 switch (cmd) {
14431 case IIOCNETDWRSET:
14432 +#ifdef CONFIG_ISDN_WITH_ABC
14433 + if (arg) {
14434 +
14435 + if (copy_from_user(name, (char *) arg, sizeof(name))) {
14436 +
14437 + return(-EFAULT);
14438 +
14439 + } else {
14440 +
14441 + isdn_net_dev *p = isdn_net_findif(name);
14442 +
14443 + if(p == NULL)
14444 + return(-EINVAL);
14445 +
14446 + return(isdn_dw_abc_reset_interface(p->local,1));
14447 + }
14448 + }
14449 +#else
14450 printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n");
14451 +#endif
14452 return(-EINVAL);
14453 case IIOCNETLCR:
14454 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14455 + return(isdn_dw_abc_lcr_ioctl(arg));
14456 +#else
14457 printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
14458 return -ENODEV;
14459 +#endif
14460 #ifdef CONFIG_NETDEVICES
14461 case IIOCNETAIF:
14462 /* Add a network-interface */
14463 @@ -1657,22 +1811,12 @@ isdn_open(struct inode *ino, struct file
14464 int chidx;
14465 int retval = -ENODEV;
14466
14467 +#ifdef COMPAT_USE_MODCOUNT_LOCK
14468 + MOD_INC_USE_COUNT;
14469 +#endif
14470
14471 if (minor == ISDN_MINOR_STATUS) {
14472 - infostruct *p;
14473 -
14474 - if ((p = kmalloc(sizeof(infostruct), GFP_KERNEL))) {
14475 - p->next = (char *) dev->infochain;
14476 - p->private = (char *) &(filep->private_data);
14477 - dev->infochain = p;
14478 - /* At opening we allow a single update */
14479 - filep->private_data = (char *) 1;
14480 - retval = 0;
14481 - goto out;
14482 - } else {
14483 - retval = -ENOMEM;
14484 - goto out;
14485 - }
14486 + return isdnstatus_open(ino, filep);
14487 }
14488 if (!dev->channels)
14489 goto out;
14490 @@ -1695,6 +1839,9 @@ isdn_open(struct inode *ino, struct file
14491 if (drvidx < 0)
14492 goto out;
14493 isdn_lock_drivers();
14494 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14495 + if(!drvidx) isdn_dw_abc_lcr_open();
14496 +#endif
14497 retval = 0;
14498 goto out;
14499 }
14500 @@ -1707,6 +1854,10 @@ isdn_open(struct inode *ino, struct file
14501 }
14502 #endif
14503 out:
14504 +#ifdef COMPAT_USE_MODCOUNT_LOCK
14505 + if (retval)
14506 + MOD_DEC_USE_COUNT;
14507 +#endif
14508 return retval;
14509 }
14510
14511 @@ -1715,25 +1866,11 @@ isdn_close(struct inode *ino, struct fil
14512 {
14513 uint minor = MINOR(ino->i_rdev);
14514
14515 +#ifndef COMPAT_USE_MODCOUNT_LOCK
14516 lock_kernel();
14517 +#endif
14518 if (minor == ISDN_MINOR_STATUS) {
14519 - infostruct *p = dev->infochain;
14520 - infostruct *q = NULL;
14521 -
14522 - while (p) {
14523 - if (p->private == (char *) &(filep->private_data)) {
14524 - if (q)
14525 - q->next = p->next;
14526 - else
14527 - dev->infochain = (infostruct *) (p->next);
14528 - kfree(p);
14529 - goto out;
14530 - }
14531 - q = p;
14532 - p = (infostruct *) (p->next);
14533 - }
14534 - printk(KERN_WARNING "isdn: No private data while closing isdnctrl\n");
14535 - goto out;
14536 + isdnstatus_close(ino, filep);
14537 }
14538 isdn_unlock_drivers();
14539 if (minor <= ISDN_MINOR_BMAX)
14540 @@ -1741,6 +1878,12 @@ isdn_close(struct inode *ino, struct fil
14541 if (minor <= ISDN_MINOR_CTRLMAX) {
14542 if (dev->profd == current)
14543 dev->profd = NULL;
14544 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14545 + {
14546 + int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL);
14547 + if(!drvidx) isdn_dw_abc_lcr_close();
14548 + }
14549 +#endif
14550 goto out;
14551 }
14552 #ifdef CONFIG_ISDN_PPP
14553 @@ -1749,13 +1892,19 @@ isdn_close(struct inode *ino, struct fil
14554 #endif
14555
14556 out:
14557 +#ifdef COMPAT_USE_MODCOUNT_LOCK
14558 + MOD_DEC_USE_COUNT;
14559 +#else
14560 unlock_kernel();
14561 +#endif
14562 return 0;
14563 }
14564
14565 static struct file_operations isdn_fops =
14566 {
14567 +#ifdef COMPAT_HAS_FILEOP_OWNER
14568 owner: THIS_MODULE,
14569 +#endif
14570 llseek: no_llseek,
14571 read: isdn_read,
14572 write: isdn_write,
14573 @@ -1808,6 +1957,15 @@ isdn_get_free_channel(int usage, int l2_
14574 if (USG_NONE(dev->usage[i]) &&
14575 (dev->drvmap[i] != -1)) {
14576 int d = dev->drvmap[i];
14577 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
14578 + if(jiffies < dev->dwabc_chan_external_inuse[i]) {
14579 +
14580 + if((dev->dwabc_chan_external_inuse[i] - jiffies) > (HZ * 120))
14581 + dev->dwabc_chan_external_inuse[i] = 0;
14582 + else
14583 + continue;
14584 + }
14585 +#endif
14586 if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) &&
14587 ((pre_dev != d) || (pre_chan != dev->chanmap[i])))
14588 continue;
14589 @@ -1826,7 +1984,11 @@ isdn_get_free_channel(int usage, int l2_
14590 restore_flags(flags);
14591 return i;
14592 } else {
14593 +#ifdef CONFIG_ISDN_WITH_ABC
14594 + if ((pre_dev == d) && ((pre_chan == dev->chanmap[i]) || pre_chan > 1000)) {
14595 +#else
14596 if ((pre_dev == d) && (pre_chan == dev->chanmap[i])) {
14597 +#endif
14598 dev->usage[i] &= ISDN_USAGE_EXCLUSIVE;
14599 dev->usage[i] |= usage;
14600 isdn_info_update();
14601 @@ -2013,7 +2175,7 @@ isdn_add_channels(driver *d, int drvidx,
14602
14603 if ((adding) && (d->rcverr))
14604 kfree(d->rcverr);
14605 - if (!(d->rcverr = kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14606 + if (!(d->rcverr = (int *) kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14607 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n");
14608 return -1;
14609 }
14610 @@ -2021,7 +2183,7 @@ isdn_add_channels(driver *d, int drvidx,
14611
14612 if ((adding) && (d->rcvcount))
14613 kfree(d->rcvcount);
14614 - if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14615 + if (!(d->rcvcount = (int *) kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14616 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
14617 if (!adding) kfree(d->rcverr);
14618 return -1;
14619 @@ -2033,7 +2195,8 @@ isdn_add_channels(driver *d, int drvidx,
14620 skb_queue_purge(&d->rpqueue[j]);
14621 kfree(d->rpqueue);
14622 }
14623 - if (!(d->rpqueue = kmalloc(sizeof(struct sk_buff_head) * m, GFP_KERNEL))) {
14624 + if (!(d->rpqueue =
14625 + (struct sk_buff_head *) kmalloc(sizeof(struct sk_buff_head) * m, GFP_KERNEL))) {
14626 printk(KERN_WARNING "register_isdn: Could not alloc rpqueue\n");
14627 if (!adding) {
14628 kfree(d->rcvcount);
14629 @@ -2047,7 +2210,8 @@ isdn_add_channels(driver *d, int drvidx,
14630
14631 if ((adding) && (d->rcv_waitq))
14632 kfree(d->rcv_waitq);
14633 - d->rcv_waitq = kmalloc(sizeof(wait_queue_head_t) * 2 * m, GFP_KERNEL);
14634 + d->rcv_waitq = (wait_queue_head_t *)
14635 + kmalloc(sizeof(wait_queue_head_t) * 2 * m, GFP_KERNEL);
14636 if (!d->rcv_waitq) {
14637 printk(KERN_WARNING "register_isdn: Could not alloc rcv_waitq\n");
14638 if (!adding) {
14639 @@ -2071,7 +2235,9 @@ isdn_add_channels(driver *d, int drvidx,
14640 if (dev->chanmap[k] < 0) {
14641 dev->chanmap[k] = j;
14642 dev->drvmap[k] = drvidx;
14643 +#ifdef HAVE_DEVFS_FS
14644 isdn_register_devfs(k);
14645 +#endif /* HAVE_DEVFS_FS */
14646 break;
14647 }
14648 restore_flags(flags);
14649 @@ -2135,6 +2301,7 @@ int DIVERT_REG_NAME(isdn_divert_if *i_di
14650 i_div->ll_cmd = isdn_command; /* set command function */
14651 i_div->drv_to_name = map_drvname;
14652 i_div->name_to_drv = map_namedrv;
14653 + i_div->dial_net_name = isdn_net_force_dial;
14654 MOD_INC_USE_COUNT;
14655 divert_if = i_div; /* remember interface */
14656 return(DIVERT_NO_ERR);
14657 @@ -2172,7 +2339,7 @@ register_isdn(isdn_if * i)
14658 printk(KERN_WARNING "register_isdn: No write routine given.\n");
14659 return 0;
14660 }
14661 - if (!(d = kmalloc(sizeof(driver), GFP_KERNEL))) {
14662 + if (!(d = (driver *) kmalloc(sizeof(driver), GFP_KERNEL))) {
14663 printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n");
14664 return 0;
14665 }
14666 @@ -2232,6 +2399,7 @@ isdn_getrev(const char *revision)
14667 return rev;
14668 }
14669
14670 +#ifdef HAVE_DEVFS_FS
14671 #ifdef CONFIG_DEVFS_FS
14672
14673 static devfs_handle_t devfs_handle;
14674 @@ -2321,6 +2489,7 @@ static void isdn_cleanup_devfs(void)
14675 }
14676
14677 #endif /* CONFIG_DEVFS_FS */
14678 +#endif /* HAVE_DEVFS_FS */
14679
14680 /*
14681 * Allocate and initialize all data, register modem-devices
14682 @@ -2338,7 +2507,6 @@ static int __init isdn_init(void)
14683 init_timer(&dev->timer);
14684 dev->timer.function = isdn_timer_funct;
14685 init_MUTEX(&dev->sem);
14686 - init_waitqueue_head(&dev->info_waitq);
14687 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14688 dev->drvmap[i] = -1;
14689 dev->chanmap[i] = -1;
14690 @@ -2352,7 +2520,9 @@ static int __init isdn_init(void)
14691 vfree(dev);
14692 return -EIO;
14693 }
14694 +#ifdef HAVE_DEVFS_FS
14695 isdn_init_devfs();
14696 +#endif /* HAVE_DEVFS_FS */
14697 if ((i = isdn_tty_modem_init()) < 0) {
14698 printk(KERN_WARNING "isdn: Could not register tty devices\n");
14699 if (i == -3)
14700 @@ -2360,7 +2530,9 @@ static int __init isdn_init(void)
14701 if (i <= -2)
14702 tty_unregister_driver(&dev->mdm.tty_modem);
14703 vfree(dev);
14704 +#ifdef HAVE_DEVFS_FS
14705 isdn_cleanup_devfs();
14706 +#endif /* HAVE_DEVFS_FS */
14707 devfs_unregister_chrdev(ISDN_MAJOR, "isdn");
14708 return -EIO;
14709 }
14710 @@ -2371,7 +2543,9 @@ static int __init isdn_init(void)
14711 tty_unregister_driver(&dev->mdm.cua_modem);
14712 for (i = 0; i < ISDN_MAX_CHANNELS; i++)
14713 kfree(dev->mdm.info[i].xmit_buf - 4);
14714 +#ifdef HAVE_DEVFS_FS
14715 isdn_cleanup_devfs();
14716 +#endif /* HAVE_DEVFS_FS */
14717 devfs_unregister_chrdev(ISDN_MAJOR, "isdn");
14718 vfree(dev);
14719 return -EIO;
14720 @@ -2397,6 +2571,9 @@ static int __init isdn_init(void)
14721 printk("\n");
14722 #endif
14723 isdn_info_update();
14724 +#ifdef CONFIG_ISDN_WITH_ABC
14725 + isdn_dw_abc_init_func();
14726 +#endif
14727 return 0;
14728 }
14729
14730 @@ -2405,7 +2582,7 @@ static int __init isdn_init(void)
14731 */
14732 static void __exit isdn_exit(void)
14733 {
14734 - unsigned long flags;
14735 + int flags;
14736 int i;
14737
14738 #ifdef CONFIG_ISDN_PPP
14739 @@ -2439,13 +2616,18 @@ static void __exit isdn_exit(void)
14740 printk(KERN_WARNING "isdn: controldevice busy, remove cancelled\n");
14741 restore_flags(flags);
14742 } else {
14743 +#ifdef HAVE_DEVFS_FS
14744 isdn_cleanup_devfs();
14745 +#endif /* HAVE_DEVFS_FS */
14746 del_timer(&dev->timer);
14747 restore_flags(flags);
14748 /* call vfree with interrupts enabled, else it will hang */
14749 vfree(dev);
14750 printk(KERN_NOTICE "ISDN-subsystem unloaded\n");
14751 }
14752 +#ifdef CONFIG_ISDN_WITH_ABC
14753 + isdn_dw_abc_release_func();
14754 +#endif
14755 }
14756
14757 module_init(isdn_init);
14758 --- a/drivers/isdn/isdn_common.h
14759 +++ b/drivers/isdn/isdn_common.h
14760 @@ -1,4 +1,4 @@
14761 -/* $Id: isdn_common.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
14762 +/* $Id: isdn_common.h,v 1.22 2001/09/24 13:22:42 kai Exp $
14763 *
14764 * header for Linux ISDN subsystem
14765 * common used functions and debugging-switches (linklevel).
14766 @@ -24,6 +24,9 @@
14767 #undef ISDN_DEBUG_NET_DIAL
14768 #undef ISDN_DEBUG_NET_ICALL
14769
14770 +#ifdef CONFIG_ISDN_WITH_ABC
14771 +int isdn_net_force_dial_lp(isdn_net_local *);
14772 +#endif
14773 /* Prototypes */
14774 extern void isdn_MOD_INC_USE_COUNT(void);
14775 extern void isdn_MOD_DEC_USE_COUNT(void);
14776 --- a/drivers/isdn/isdn_concap.c
14777 +++ b/drivers/isdn/isdn_concap.c
14778 @@ -1,4 +1,4 @@
14779 -/* $Id: isdn_concap.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
14780 +/* $Id: isdn_concap.c,v 1.9 2001/09/24 13:22:42 kai Exp $
14781 *
14782 * Linux ISDN subsystem, protocol encapsulation
14783 *
14784 --- a/drivers/isdn/isdn_concap.h
14785 +++ b/drivers/isdn/isdn_concap.h
14786 @@ -1,4 +1,4 @@
14787 -/* $Id: isdn_concap.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
14788 +/* $Id: isdn_concap.h,v 1.4 2001/09/24 13:22:42 kai Exp $
14789 *
14790 * Linux ISDN subsystem, protocol encapsulation
14791 *
14792 --- /dev/null
14793 +++ b/drivers/isdn/isdn_dwabc.c
14794 @@ -0,0 +1,1053 @@
14795 +
14796 +/* $Id: isdn_dwabc.c,v 1.27 2001/12/01 23:18:21 detabc Exp $
14797 +
14798 + * Linux ISDN subsystem, abc-extension releated funktions.
14799 + *
14800 + * Copyright by abc GmbH
14801 + * written by Detlef Wengorz <detlefw@isdn4linux.de>
14802 + *
14803 + * This program is free software; you can redistribute it and/or modify
14804 + * it under the terms of the GNU General Public License as published by
14805 + * the Free Software Foundation; either version 2, or (at your option)
14806 + * any later version.
14807 + *
14808 + */
14809 +
14810 +#include <linux/config.h>
14811 +#define __NO_VERSION__
14812 +
14813 +#ifdef CONFIG_ISDN_WITH_ABC
14814 +
14815 +static char *dwabcrevison = "$Revision: 1.27 $";
14816 +
14817 +#include <asm/semaphore.h>
14818 +#define CONFIG_ISDN_WITH_ABC_NEED_DWSJIFFIES 1
14819 +#include <linux/list.h>
14820 +#include <linux/isdn.h>
14821 +#include "isdn_common.h"
14822 +#include "isdn_net.h"
14823 +
14824 +#include <linux/skbuff.h>
14825 +
14826 +#include <net/udp.h>
14827 +#include <net/checksum.h>
14828 +#include <linux/isdn_dwabc.h>
14829 +
14830 +
14831 +#if CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS && CONFIG_ISDN_PPP
14832 +#include <linux/isdn_ppp.h>
14833 +extern struct isdn_ppp_compressor *isdn_ippp_comp_head;
14834 +#define ipc_head isdn_ippp_comp_head
14835 +#ifndef CI_BSD_COMPRESS
14836 +#define CI_BSD_COMPRESS 21
14837 +#endif
14838 +#endif
14839 +
14840 +#define NBYTEORDER_30BYTES 0x1e00
14841 +#define DWABC_TMRES (HZ / 10)
14842 +
14843 +#define VERBLEVEL (dev->net_verbose > 2)
14844 +
14845 +static struct timer_list dw_abc_timer;
14846 +
14847 +
14848 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14849 +static ISDN_DWSPINLOCK lcr_spin = ISDN_DWSPIN_UNLOCKED;
14850 +#define LCR_LOCK() isdn_dwspin_trylock(&lcr_spin)
14851 +#define LCR_ULOCK() isdn_dwspin_unlock(&lcr_spin)
14852 +
14853 +typedef struct ISDN_DW_ABC_LCR {
14854 +
14855 + struct list_head dll;
14856 + char lcr_printbuf[64 + ISDN_MSNLEN + ISDN_MSNLEN];
14857 + char *lcr_poin;
14858 + char *lcr_epoin;
14859 +
14860 +} ISDN_DW_ABC_LCR;
14861 +
14862 +static LIST_HEAD(lcr_dll);
14863 +static atomic_t lcr_open_count = ATOMIC_INIT(0);
14864 +static volatile ulong lcr_call_counter = 0;
14865 +
14866 +
14867 +static int myjiftime(char *p,u_long nj)
14868 +{
14869 + sprintf(p,"%02ld:%02ld.%02ld",
14870 + ((nj / 100) / 60) % 100, (nj / 100) % 60,nj % 100);
14871 +
14872 + return(8);
14873 +}
14874 +
14875 +
14876 +static void dw_lcr_clear_all(void)
14877 +{
14878 + struct list_head *lh;
14879 +
14880 + if(!LCR_LOCK()) {
14881 +
14882 + while((lh = lcr_dll.next) != &lcr_dll) {
14883 +
14884 + ISDN_DW_ABC_LCR *p = list_entry(lh,ISDN_DW_ABC_LCR,dll);
14885 + list_del(&p->dll);
14886 + kfree(p);
14887 + }
14888 +
14889 + LCR_ULOCK();
14890 + }
14891 +}
14892 +
14893 +void isdn_dw_abc_lcr_open(void)
14894 +{ atomic_inc(&lcr_open_count); }
14895 +
14896 +void isdn_dw_abc_lcr_close(void)
14897 +{
14898 + if(atomic_dec_and_test(&lcr_open_count))
14899 + dw_lcr_clear_all();
14900 +}
14901 +
14902 +int isdn_dw_abc_lcr_lock(void)
14903 +{ return(LCR_LOCK()); }
14904 +
14905 +void isdn_dw_abc_lcr_ulock(void)
14906 +{ LCR_ULOCK(); }
14907 +
14908 +
14909 +size_t isdn_dw_abc_lcr_readstat(char *buf,size_t count)
14910 +{
14911 + size_t retw = 0;
14912 +
14913 + while(buf != NULL && count > 0) {
14914 +
14915 + struct list_head *lh = NULL;
14916 + ISDN_DW_ABC_LCR *p = NULL;
14917 + char *dp = NULL;
14918 + size_t n;
14919 +
14920 + if((n = LCR_LOCK())) {
14921 +
14922 + if(!retw)
14923 + retw = n;
14924 +
14925 + break;
14926 + }
14927 +
14928 +
14929 + while((lh = lcr_dll.next) != &lcr_dll) {
14930 +
14931 + p = list_entry(lh,ISDN_DW_ABC_LCR,dll);
14932 +
14933 + if(p->lcr_poin >= p->lcr_epoin) {
14934 +
14935 + list_del(&p->dll);
14936 + kfree(p);
14937 + p = NULL;
14938 +
14939 + } else break;
14940 + }
14941 +
14942 + if(p == NULL) {
14943 +
14944 + LCR_ULOCK();
14945 + break;
14946 + }
14947 +
14948 + n = p->lcr_epoin - p->lcr_poin;
14949 +
14950 + if(n > count)
14951 + n = count;
14952 +
14953 + dp = p->lcr_poin;
14954 + p->lcr_poin += n;
14955 + retw += n;
14956 + LCR_ULOCK();
14957 + copy_to_user(buf,dp,n);
14958 + buf += n;
14959 + }
14960 +
14961 + return(retw);
14962 +}
14963 +
14964 +
14965 +static void isdn_dw_abc_lcr_clear_helper(isdn_net_local *lp)
14966 +{
14967 + if(lp != NULL) {
14968 +
14969 + void *a,*b;
14970 +
14971 + a = lp->dw_abc_lcr_cmd;
14972 + b = lp->dw_abc_lcr_io;
14973 + lp->dw_abc_lcr_io = NULL;
14974 + lp->dw_abc_lcr_cmd = NULL;
14975 + lp->dw_abc_lcr_callid =
14976 + lp->dw_abc_lcr_start_request =
14977 + lp->dw_abc_lcr_end_request = 0;
14978 +
14979 + if(a) kfree(a);
14980 + if(b) kfree(b);
14981 + }
14982 +}
14983 +
14984 +void isdn_dw_abc_lcr_clear(isdn_net_local *lp)
14985 +{
14986 + if(!LCR_LOCK()) {
14987 + isdn_dw_abc_lcr_clear_helper(lp);
14988 + LCR_ULOCK();
14989 + }
14990 +}
14991 +
14992 +
14993 +u_long isdn_dw_abc_lcr_call_number( isdn_net_local *lp,isdn_ctrl *call_cmd)
14994 +{
14995 + u_long mid = 0;
14996 +
14997 + if(LCR_LOCK())
14998 + return(0);
14999 +
15000 + isdn_dw_abc_lcr_clear_helper(lp);
15001 +
15002 + if( atomic_read(&lcr_open_count) > 0 &&
15003 + lp != NULL &&
15004 + call_cmd != NULL) {
15005 +
15006 + ISDN_DW_ABC_LCR *lc = NULL;
15007 + int ab = 0;
15008 +
15009 + if((lp->dw_abc_lcr_cmd =
15010 + ( isdn_ctrl *)kmalloc(sizeof(isdn_ctrl),GFP_ATOMIC)) == NULL) {
15011 +
15012 +no_mem_out:;
15013 + isdn_dw_abc_lcr_clear_helper(lp);
15014 + LCR_ULOCK();
15015 + printk(KERN_DEBUG "%s %d : LCR no memory\n",__FILE__,__LINE__);
15016 + return(0);
15017 + }
15018 +
15019 + memcpy(lp->dw_abc_lcr_cmd,call_cmd,sizeof(*call_cmd));
15020 + while(!(lp->dw_abc_lcr_callid = mid = lcr_call_counter++));
15021 +
15022 + lp->dw_abc_lcr_end_request = lp->dw_abc_lcr_start_request = jiffies;
15023 + lp->dw_abc_lcr_end_request += HZ * 3;
15024 +
15025 + if((lc = (ISDN_DW_ABC_LCR *)kmalloc(sizeof(*lc),GFP_KERNEL)) == NULL)
15026 + goto no_mem_out;
15027 +
15028 + lc->lcr_poin = lc->lcr_epoin = lc->lcr_printbuf;
15029 + lc->lcr_epoin += myjiftime(lc->lcr_epoin,jiffies);
15030 +
15031 + sprintf(lc->lcr_epoin," DW_ABC_LCR\t%lu\t%.*s\t%.*s\n",
15032 + mid,
15033 + (int)ISDN_MSNLEN,
15034 + call_cmd->parm.setup.eazmsn,
15035 + (int)ISDN_MSNLEN,
15036 + call_cmd->parm.setup.phone);
15037 +
15038 + lc->lcr_epoin += strlen(lc->lcr_epoin);
15039 + ab = lc->lcr_epoin - lc->lcr_poin;
15040 +
15041 + list_add_tail(&lc->dll,&lcr_dll);
15042 + LCR_ULOCK();
15043 +
15044 + if(ab > 0) {
15045 +
15046 + if(dev->drv[0] != NULL ) {
15047 +
15048 + dev->drv[0]->stavail += ab;
15049 + wake_up_interruptible(&dev->drv[0]->st_waitq);
15050 + }
15051 + }
15052 +
15053 + } else LCR_ULOCK();
15054 +
15055 + return(mid);
15056 +}
15057 +
15058 +
15059 +int isdn_dw_abc_lcr_ioctl(u_long arg)
15060 +{
15061 + struct ISDN_DWABC_LCR_IOCTL i;
15062 + int need = sizeof(struct ISDN_DWABC_LCR_IOCTL);
15063 + isdn_net_dev *p;
15064 +
15065 + memset(&i,0,sizeof(struct ISDN_DWABC_LCR_IOCTL));
15066 + copy_from_user(&i,(char *)arg,sizeof(int));
15067 +
15068 + if(i.lcr_ioctl_sizeof < need)
15069 + need = i.lcr_ioctl_sizeof;
15070 +
15071 + if(need > 0)
15072 + copy_from_user(&i,(char *)arg,need);
15073 +
15074 + if(LCR_LOCK())
15075 + return(-EAGAIN);
15076 +
15077 + p = dev->netdev;
15078 +
15079 + for(;p ; p = p->next) {
15080 +
15081 + isdn_net_local *lp = p->local;
15082 +
15083 + if( lp->dw_abc_lcr_callid != i.lcr_ioctl_callid)
15084 + continue;
15085 +
15086 + if(lp->dw_abc_lcr_cmd == NULL)
15087 + continue;
15088 +
15089 + if(lp->dw_abc_lcr_io == NULL)
15090 + lp->dw_abc_lcr_io = (struct ISDN_DWABC_LCR_IOCTL *)
15091 + kmalloc(sizeof(struct ISDN_DWABC_LCR_IOCTL),GFP_ATOMIC);
15092 +
15093 + if(lp->dw_abc_lcr_io == NULL) {
15094 +
15095 + printk(KERN_DEBUG "%s %d : no memory\n",__FILE__,__LINE__);
15096 + continue;
15097 + }
15098 +
15099 + memcpy(lp->dw_abc_lcr_io,&i,sizeof(struct ISDN_DWABC_LCR_IOCTL));
15100 +
15101 + if(i.lcr_ioctl_flags & DWABC_LCR_FLG_NEWNUMBER) {
15102 +
15103 + char *xx = i.lcr_ioctl_nr;
15104 + char *exx = xx + sizeof(i.lcr_ioctl_nr);
15105 + char *d = lp->dw_abc_lcr_cmd->parm.setup.phone;
15106 + char *ed = d + sizeof(lp->dw_abc_lcr_cmd->parm.setup.phone) - 1;
15107 +
15108 + while(d < ed && xx < exx && *xx) *(d++) = *(xx++);
15109 + while(d < ed) *(d++) = 0;
15110 + *d = 0;
15111 + }
15112 + }
15113 +
15114 + LCR_ULOCK();
15115 + return(0);
15116 +}
15117 +
15118 +#endif
15119 +
15120 +
15121 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
15122 +int dw_abc_udp_test(struct sk_buff *skb,struct net_device *ndev)
15123 +{
15124 + if(ndev != NULL && skb != NULL && skb->protocol == htons(ETH_P_IP)) {
15125 +
15126 + struct iphdr *iph = (struct iphdr *)skb->data;
15127 + isdn_net_local *lp = (isdn_net_local *) ndev->priv;
15128 + int rklen = skb->len;
15129 +
15130 + if (skb->nh.raw > skb->data && skb->nh.raw < skb->tail) {
15131 +
15132 + rklen -= (char *)skb->nh.raw - (char *)skb->data;
15133 + iph = (struct iphdr *)skb->nh.raw;
15134 + }
15135 +
15136 + if(rklen >= 20 && iph->version == 4 &&
15137 + !(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_UDP_CHECK)) {
15138 +
15139 + if( iph->tot_len == NBYTEORDER_30BYTES &&
15140 + iph->protocol == IPPROTO_UDP) {
15141 +
15142 + struct udphdr *udp =
15143 + (struct udphdr *)((char *)iph + (iph->ihl << 2));
15144 +
15145 + ushort usrc = ntohs(udp->source);
15146 +
15147 + if( udp->dest == htons(25001) &&
15148 + usrc >= 20000 && usrc < 25000) {
15149 +
15150 + char *p = (char *)(udp + 1);
15151 +
15152 + if(p[0] == p[1]) {
15153 +
15154 + char mc = 0;
15155 +
15156 + switch(*p) {
15157 + case 0x30:
15158 +
15159 + mc = *p;
15160 +
15161 + if((lp->flags & ISDN_NET_CONNECTED) && (!lp->dialstate))
15162 + mc++;
15163 +
15164 + break;
15165 +
15166 + case 0x32:
15167 +
15168 + mc = *p;
15169 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
15170 + if((lp->flags & ISDN_NET_CONNECTED) && (!lp->dialstate)) {
15171 +
15172 + mc++;
15173 + break;
15174 + }
15175 +
15176 + if(!isdn_net_force_dial_lp(lp)) mc++;
15177 +#endif
15178 + break;
15179 +
15180 + case 0x11:
15181 + mc = *p + 1;
15182 + isdn_dw_abc_reset_interface(lp,1);
15183 + break;
15184 +
15185 + case 0x28: mc = *p + 1; break;
15186 + case 0x2a:
15187 + case 0x2c:
15188 +
15189 + mc = *p;
15190 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
15191 + if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_UDP_HANGUP)) {
15192 +
15193 + if(lp->isdn_device >= 0) {
15194 +
15195 + isdn_net_hangup(ndev);
15196 + mc = *p + 1;
15197 + }
15198 + }
15199 +#endif
15200 + break;
15201 + }
15202 +
15203 + if(mc) {
15204 +
15205 + struct sk_buff *nskb;
15206 + int need = 2+sizeof(struct iphdr)+sizeof(struct udphdr);
15207 + int hneed = need + ndev->hard_header_len;
15208 +
15209 + if((nskb = (struct sk_buff *)dev_alloc_skb(hneed)) != NULL) {
15210 +
15211 + ushort n = sizeof(struct udphdr) + 2;
15212 + struct iphdr *niph;
15213 + struct udphdr *nup;
15214 + skb_reserve(nskb,ndev->hard_header_len);
15215 +
15216 + if((niph = (struct iphdr *)skb_put(nskb,need))==NULL){
15217 +
15218 + printk(KERN_DEBUG "%s: skb_put failt (%d bytes)\n", lp->name,hneed);
15219 + dev_kfree_skb(nskb);
15220 + return(0);
15221 + }
15222 +
15223 + nup = (struct udphdr *)(niph + 1);
15224 + ((char *)(nup + 1))[0] = mc;
15225 + ((char *)(nup + 1))[1] = mc;
15226 + nup->source=udp->dest;
15227 + nup->dest=udp->source;
15228 + nup->len=htons(n);
15229 + nup->check=0; /* dont need checksum */
15230 + memset((void *)niph,0,sizeof(*niph));
15231 + niph->version=4;
15232 + niph->ihl=5;
15233 + niph->tot_len=NBYTEORDER_30BYTES;
15234 + niph->ttl = 32;
15235 + niph->protocol = IPPROTO_UDP;
15236 + niph->saddr=iph->daddr;
15237 + niph->daddr=iph->saddr;
15238 + niph->id=iph->id;
15239 + niph->check=ip_fast_csum((unsigned char *)niph,niph->ihl);
15240 + nskb->dev = ndev;
15241 + nskb->pkt_type = PACKET_HOST;
15242 + nskb->protocol = htons(ETH_P_IP);
15243 + nskb->mac.raw = nskb->data;
15244 + netif_rx(nskb);
15245 + }
15246 +
15247 + return(1);
15248 + }
15249 + }
15250 + }
15251 + }
15252 + }
15253 + }
15254 +
15255 + return(0);
15256 +}
15257 +#endif
15258 +
15259 +
15260 +void isdn_dw_clear_if(ulong pm,isdn_net_local *lp)
15261 +{
15262 + if(lp != NULL) {
15263 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
15264 + isdn_dw_abc_lcr_clear(lp);
15265 +#endif
15266 + }
15267 +}
15268 +
15269 +
15270 +
15271 +static void dw_abc_timer_func(u_long dont_need_yet)
15272 +{
15273 + register u_long t;
15274 +
15275 + if(!((t = ++isdn_dwabc_jiffies.msec_100) & 1))
15276 + if(isdn_dwabc_jiffies.msec_200++ & 1)
15277 + isdn_dwabc_jiffies.msec_400++;
15278 +
15279 + if(!(t % 5))
15280 + if(isdn_dwabc_jiffies.msec_500++ & 1)
15281 + isdn_dwabc_jiffies.msec_1000++;
15282 +
15283 + dw_abc_timer.expires = jiffies + DWABC_TMRES;
15284 + add_timer(&dw_abc_timer);
15285 +}
15286 +
15287 +
15288 +void isdn_dw_abc_init_func(void)
15289 +{
15290 +
15291 + init_timer(&dw_abc_timer);
15292 + dw_abc_timer.function = dw_abc_timer_func;
15293 +
15294 +
15295 + printk( KERN_INFO
15296 + "abc-extension %s Kernel 0x%06X\n"
15297 + "written by\nDetlef Wengorz <detlefw@isdn4linux.de>\n"
15298 + "Installed options:\n"
15299 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
15300 + "CONFIG_ISDN_WITH_ABC_CALLB\n"
15301 +#endif
15302 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
15303 + "CONFIG_ISDN_WITH_ABC_UDP_CHECK\n"
15304 +#endif
15305 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
15306 + "CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP\n"
15307 +#endif
15308 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
15309 + "CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL\n"
15310 +#endif
15311 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
15312 + "CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ\n"
15313 +#endif
15314 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
15315 + "CONFIG_ISDN_WITH_ABC_LCR_SUPPORT\n"
15316 +#endif
15317 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
15318 + "CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER\n"
15319 +#endif
15320 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
15321 + "CONFIG_ISDN_WITH_ABC_CH_EXTINUSE\n"
15322 +#endif
15323 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
15324 + "CONFIG_ISDN_WITH_ABC_CONN_ERROR\n"
15325 +#endif
15326 +#ifdef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
15327 + "CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS\n"
15328 +#endif
15329 + "loaded\n",
15330 + dwabcrevison,LINUX_VERSION_CODE);
15331 + dwsjiffies = 0;
15332 + dw_abc_timer.expires = jiffies + DWABC_TMRES;
15333 + add_timer(&dw_abc_timer);
15334 +}
15335 +
15336 +void isdn_dw_abc_release_func(void)
15337 +{
15338 + del_timer(&dw_abc_timer);
15339 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
15340 + dw_lcr_clear_all();
15341 +#endif
15342 + printk( KERN_INFO
15343 + "abc-extension %s Kernel 0x%06X\n"
15344 + "written by\n"
15345 + "Detlef Wengorz <detlefw@isdn4linux.de>\n"
15346 + "unloaded\n",
15347 + dwabcrevison,LINUX_VERSION_CODE);
15348 +}
15349 +
15350 +
15351 +void isdn_dwabc_test_phone(isdn_net_local *lp)
15352 +{
15353 + if(lp != NULL) {
15354 +
15355 + isdn_net_phone *h = lp->phone[0];
15356 + ulong oflags = lp->dw_abc_flags;
15357 + int secure = 0;
15358 +
15359 + lp->dw_abc_flags = 0;
15360 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
15361 + *lp->dw_out_msn = 0;
15362 +#endif
15363 +
15364 + for(;h != NULL && secure < 1000;secure++,h = h->next) {
15365 +
15366 + char *p = h->num;
15367 + char *ep = p + ISDN_MSNLEN;
15368 +
15369 + for(;p < ep && *p && (*p <= ' ' || *p == '"' || *p == '\'');p++);
15370 +
15371 + if(p >= ep)
15372 + continue;
15373 +
15374 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
15375 + if(*p == '>') {
15376 +
15377 + if(++p < ep && *p != '<' && *p != '>') {
15378 +
15379 + char *d = lp->dw_out_msn;
15380 +
15381 + for(;*p && (p < ep) && (*p == ' ' || *p == '\t');p++);
15382 + for(ep--;*p && (p < ep);) *(d++) = *(p++);
15383 + *d = 0;
15384 + continue;
15385 + }
15386 + }
15387 +#endif
15388 +
15389 + if(*p == '~') {
15390 +
15391 + /* abc switch's */
15392 +
15393 + for(p++;p < ep && *p;p++) switch(*p) {
15394 + case 'u': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_CHECK; break;
15395 + case 'h': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_HANGUP; break;
15396 + case 'd': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_DIAL; break;
15397 + case 'c': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE; break;
15398 + case 'e': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_CONN_ERROR; break;
15399 + case 'l': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_LCR; break;
15400 +
15401 + case 'x':
15402 + case 'X': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER; break;
15403 +
15404 + case 'B': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_BSD_COMPRESS; break;
15405 + case 'L': lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_LEASED_LINE; break;
15406 +
15407 + case '"':
15408 + case ' ':
15409 + case '\t':
15410 + case '\'': break;
15411 +
15412 + default:
15413 + printk(KERN_DEBUG"isdn_net: %s abc-switch <~%c> unknown\n",lp->name,*p);
15414 + break;
15415 + }
15416 + }
15417 + }
15418 +
15419 + if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_LEASED_LINE) {
15420 +
15421 + lp->dw_abc_flags |=
15422 + ISDN_DW_ABC_FLAG_NO_UDP_CHECK |
15423 + ISDN_DW_ABC_FLAG_NO_UDP_HANGUP |
15424 + ISDN_DW_ABC_FLAG_NO_UDP_DIAL |
15425 + ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE |
15426 + ISDN_DW_ABC_FLAG_NO_CONN_ERROR |
15427 + ISDN_DW_ABC_FLAG_NO_LCR;
15428 + }
15429 +
15430 + if(dev->net_verbose && (lp->dw_abc_flags != oflags || dev->net_verbose > 4))
15431 + printk(KERN_DEBUG "isdn_net %s abc-flags 0x%lx\n",lp->name,lp->dw_abc_flags);
15432 +
15433 + }
15434 +}
15435 +
15436 +
15437 +int isdn_dw_abc_reset_interface(isdn_net_local *lp,int with_message)
15438 +{
15439 + int r = -EINVAL;
15440 +
15441 + if(lp != NULL) {
15442 +
15443 + r = 0;
15444 +
15445 + lp->dw_abc_bchan_last_connect = 0;
15446 + lp->dw_abc_dialstart = 0;
15447 + lp->dw_abc_inuse_secure = 0;
15448 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
15449 + lp->dw_abc_bchan_errcnt = 0;
15450 +#endif
15451 +
15452 + if(with_message && dev->net_verbose > 0)
15453 + printk(KERN_INFO
15454 + "%s: NOTE: reset (clear) abc-interface-secure-counter\n",
15455 + lp->name);
15456 + }
15457 +
15458 + return(r);
15459 +}
15460 +
15461 +
15462 +#if CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS && CONFIG_ISDN_PPP
15463 +
15464 +#define DWBSD_PKT_FIRST_LEN 16
15465 +#define DWBSD_PKT_SWITCH 165
15466 +#define DWBSD_PKT_BSD 189
15467 +
15468 +#define DWBSD_VERSION 0x2
15469 +
15470 +void dwabc_bsd_first_gen(isdn_net_local *lp)
15471 +{
15472 + if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP &&
15473 + (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)) {
15474 +
15475 + struct sk_buff *skb = NULL;
15476 + char *p = NULL;
15477 + char *ep = NULL;
15478 +
15479 + if((skb =(struct sk_buff *)dev_alloc_skb(128)) == NULL) {
15480 +
15481 + printk(KERN_INFO "%s: dwabc: alloc-skb failed for 128 bytes\n",lp->name);
15482 + return;
15483 + }
15484 +
15485 + skb_reserve(skb,64);
15486 + p = skb_put(skb,DWBSD_PKT_FIRST_LEN);
15487 + ep = p + DWBSD_PKT_FIRST_LEN;
15488 +
15489 + *(p++) = DWBSD_PKT_SWITCH;
15490 + *(p++) = DWBSD_VERSION;
15491 + for(;p < ep;p++) *(p++) = 0;
15492 +
15493 + isdn_net_write_super(lp, skb);
15494 +
15495 + if(dev->net_verbose > 2)
15496 + printk(KERN_INFO "%s: dwabc: sending comm-header version 0x%x\n",lp->name,DWBSD_VERSION);
15497 + }
15498 +}
15499 +
15500 +
15501 +void dwabc_bsd_free(isdn_net_local *lp)
15502 +{
15503 + if(lp != NULL) {
15504 +
15505 + if(lp->dw_abc_bsd_stat_rx || lp->dw_abc_bsd_stat_tx) {
15506 +
15507 + struct isdn_ppp_compressor *c = NULL;
15508 +
15509 + if(!(c = (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor)) {
15510 +
15511 + printk(KERN_WARNING
15512 + "%s: PANIC: freeing bsd compressmemory without compressor\n",
15513 + lp->name);
15514 +
15515 + } else {
15516 +
15517 + if(lp->dw_abc_bsd_stat_rx) (*c->free)(lp->dw_abc_bsd_stat_rx);
15518 + if(lp->dw_abc_bsd_stat_tx) (*c->free)(lp->dw_abc_bsd_stat_tx);
15519 +
15520 + if(dev->net_verbose > 2)
15521 + printk(KERN_INFO
15522 + "%s: free bsd compress-memory\n",
15523 + lp->name);
15524 + }
15525 + }
15526 +
15527 + lp->dw_abc_bsd_compressor = NULL;
15528 + lp->dw_abc_bsd_stat_rx = NULL;
15529 + lp->dw_abc_bsd_stat_tx = NULL;
15530 + lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_BSDAKTIV;
15531 +
15532 + if(dev->net_verbose > 0) {
15533 +
15534 + if(lp->dw_abc_bsd_rcv != lp->dw_abc_bsd_bsd_rcv) {
15535 +
15536 + printk(KERN_INFO "%s: Receive %lu<-%lu kb\n",lp->name,
15537 + lp->dw_abc_bsd_rcv >> 10 , lp->dw_abc_bsd_bsd_rcv >> 10);
15538 + }
15539 +
15540 +
15541 + if(lp->dw_abc_bsd_snd != lp->dw_abc_bsd_bsd_snd) {
15542 +
15543 + printk(KERN_INFO "%s: Send %lu->%lu kb\n",lp->name,
15544 + lp->dw_abc_bsd_snd >> 10 , lp->dw_abc_bsd_bsd_snd >> 10);
15545 + }
15546 + }
15547 +
15548 + lp->dw_abc_bsd_rcv =
15549 + lp->dw_abc_bsd_bsd_rcv =
15550 + lp->dw_abc_bsd_snd =
15551 + lp->dw_abc_bsd_bsd_snd = 0;
15552 + }
15553 +}
15554 +
15555 +
15556 +int dwabc_bsd_init(isdn_net_local *lp)
15557 +{
15558 + int r = 1;
15559 +
15560 + if(lp != NULL) {
15561 +
15562 + dwabc_bsd_free(lp);
15563 +
15564 + if(lp->p_encap == ISDN_NET_ENCAP_RAWIP) {
15565 +
15566 + void *rx = NULL;
15567 + void *tx = NULL;
15568 + struct isdn_ppp_comp_data *cp = NULL;
15569 + struct isdn_ppp_compressor *c = NULL;
15570 +
15571 + if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) do {
15572 +
15573 + for(c = ipc_head ;
15574 + c != NULL && c->num != CI_BSD_COMPRESS; c = c->next);
15575 +
15576 + if(c == NULL) {
15577 +
15578 + printk(KERN_INFO
15579 + "%s: Module isdn_bsdcompress not loaded\n",
15580 + lp->name);
15581 +
15582 + break;
15583 + }
15584 +
15585 + cp = (struct isdn_ppp_comp_data *)
15586 + kmalloc(sizeof(struct isdn_ppp_comp_data),GFP_ATOMIC);
15587 +
15588 + if(cp == NULL) {
15589 +
15590 + printk(KERN_INFO
15591 + "%s: allocation of isdn_ppp_comp_data failed\n",
15592 + lp->name);
15593 +
15594 + break;
15595 + }
15596 +
15597 + memset(cp,0,sizeof(*cp));
15598 + cp->num = CI_BSD_COMPRESS;
15599 + cp->optlen = 1;
15600 +
15601 + /*
15602 + ** set BSD_VERSION 1 and 12 bits compressmode
15603 + */
15604 + *cp->options = (1 << 5) | 12;
15605 +
15606 + if((rx = (*c->alloc)(cp)) == NULL) {
15607 +
15608 + printk(KERN_INFO
15609 + "%s: allocation of bsd rx-memory failed\n",
15610 + lp->name);
15611 +
15612 + break;
15613 + }
15614 +
15615 + if(!(*c->init)(rx,cp,0,1)) {
15616 +
15617 + printk(KERN_INFO
15618 + "%s: init of bsd rx-stream failed\n",lp->name);
15619 +
15620 + break;
15621 + }
15622 +
15623 + cp->flags = IPPP_COMP_FLAG_XMIT;
15624 +
15625 + if((tx = (*c->alloc)(cp)) == NULL) {
15626 +
15627 + printk(KERN_INFO
15628 + "%s: allocation of bsd tx-memory failed\n",
15629 + lp->name);
15630 +
15631 + break;
15632 + }
15633 +
15634 + if(!(*c->init)(tx,cp,0,1)) {
15635 +
15636 + printk(KERN_INFO
15637 + "%s: init of bsd tx-stream failed\n",
15638 + lp->name);
15639 +
15640 + break;
15641 + }
15642 +
15643 + lp->dw_abc_bsd_compressor = (void *)c;
15644 + lp->dw_abc_bsd_stat_rx = rx;
15645 + lp->dw_abc_bsd_stat_tx = tx;
15646 + rx = tx = NULL;
15647 + r = 0;
15648 +
15649 + if(dev->net_verbose > 2)
15650 + printk(KERN_INFO
15651 + "%s: bsd compress-memory and init ok\n",
15652 + lp->name);
15653 +
15654 + } while(0);
15655 +
15656 + if(cp != NULL)
15657 + kfree(cp);
15658 +
15659 + if(c != NULL) {
15660 +
15661 + if(tx != NULL) (*c->free)(tx);
15662 + if(rx != NULL) (*c->free)(rx);
15663 + }
15664 +
15665 + } else if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) {
15666 +
15667 + printk(KERN_INFO
15668 + "%s: bsd-compress only with encapsulation rawip allowed\n",
15669 + lp->name);
15670 + }
15671 + }
15672 +
15673 + return(r);
15674 +}
15675 +
15676 +struct sk_buff *dwabc_bsd_compress( isdn_net_local *lp,
15677 + struct sk_buff *skb,
15678 + struct net_device *ndev)
15679 +{
15680 + if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP &&
15681 + (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) &&
15682 + (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_BSDAKTIV)) {
15683 +
15684 + if(lp->dw_abc_bsd_stat_tx != NULL && lp->dw_abc_bsd_compressor) {
15685 +
15686 + struct isdn_ppp_compressor *cp =
15687 + (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor;
15688 +
15689 + struct sk_buff *nskb = (struct sk_buff *)
15690 + dev_alloc_skb(skb->len * 2 + ndev->hard_header_len);
15691 +
15692 + int l = 0;
15693 +
15694 + if(nskb == NULL) {
15695 +
15696 + (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15697 + printk(KERN_INFO "%s: dwabc-compress no memory\n",lp->name);
15698 +
15699 + } else {
15700 +
15701 + skb_reserve(nskb,ndev->hard_header_len);
15702 + *(unsigned char *)skb_put(nskb,1) = DWBSD_PKT_BSD;
15703 + l = (*cp->compress)(lp->dw_abc_bsd_stat_tx,skb,nskb,0x21);
15704 +
15705 + if(l < 1 || l > skb->len) {
15706 +
15707 + (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15708 + dev_kfree_skb(nskb);
15709 +
15710 + } else {
15711 +
15712 + u_short sqnr;
15713 +
15714 + dev_kfree_skb(skb);
15715 + skb = nskb;
15716 + sqnr = ((*(u_char *)skb->data) << 8) +
15717 + ((u_char)skb->data[1]);
15718 +
15719 + if(sqnr > 65500)
15720 + (void)(*cp->reset)
15721 + (lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15722 + }
15723 + }
15724 + }
15725 + }
15726 +
15727 + return(skb);
15728 +}
15729 +
15730 +struct sk_buff *dwabc_bsd_rx_pkt( isdn_net_local *lp,
15731 + struct sk_buff *skb,
15732 + struct net_device *ndev)
15733 +{
15734 + struct sk_buff *r = skb;
15735 +
15736 + if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP &&
15737 + (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)) {
15738 +
15739 + unsigned char *p = (unsigned char *)skb->data;
15740 + struct isdn_ppp_compressor *cp =
15741 + (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor;
15742 +
15743 + if(*p == DWBSD_PKT_SWITCH) {
15744 +
15745 + if(skb->len == DWBSD_PKT_FIRST_LEN) {
15746 +
15747 + if((lp->dw_abc_remote_version = p[1]) < 0x2) {
15748 +
15749 + printk(KERN_INFO
15750 + "%s: I can't really talk with remote version 0x%x\n"
15751 + "Please upgrade remote or disable rawip-compression\n",
15752 + lp->name,
15753 + p[1]);
15754 + }
15755 +
15756 + lp->dw_abc_if_flags |= ISDN_DW_ABC_IFFLAG_BSDAKTIV;
15757 + dev_kfree_skb(skb);
15758 +
15759 + if(cp && lp->dw_abc_bsd_stat_tx)
15760 + (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15761 +
15762 + if(dev->net_verbose > 2)
15763 + printk(KERN_INFO
15764 + "%s: receive comm-header rem-version 0x%02x\n",
15765 + lp->name,
15766 + lp->dw_abc_remote_version);
15767 +
15768 + return(NULL);
15769 + }
15770 +
15771 + } else if(*p == DWBSD_PKT_BSD && lp->dw_abc_bsd_stat_rx != NULL && cp) {
15772 +
15773 + struct sk_buff *nskb = NULL;
15774 +
15775 + if(test_and_set_bit(ISDN_DW_ABC_BITLOCK_RECEIVE,
15776 + &lp->dw_abc_bitlocks)) {
15777 +
15778 + printk(KERN_INFO "%s: bsd-decomp called recursivly\n",lp->name);
15779 + dev_kfree_skb(skb);
15780 + dwabc_bsd_first_gen(lp);
15781 + return(NULL);
15782 + }
15783 +
15784 + nskb = (struct sk_buff *)
15785 + dev_alloc_skb(2048 + ndev->hard_header_len);
15786 +
15787 + if(nskb != NULL) {
15788 +
15789 + int l = 0;
15790 + u_short sqnr;
15791 +
15792 + skb_reserve(nskb,ndev->hard_header_len);
15793 + skb_pull(skb, 1);
15794 + sqnr = ((*(u_char *)skb->data) << 8) | ((u_char)skb->data[1]);
15795 +
15796 + if(!sqnr && cp && lp->dw_abc_bsd_stat_rx)
15797 + (void)(*cp->reset)(lp->dw_abc_bsd_stat_rx,0,0,NULL,0,NULL);
15798 +
15799 + if((l = (*cp->decompress)
15800 + (lp->dw_abc_bsd_stat_rx,skb,nskb,NULL)) < 1 || l>8000) {
15801 +
15802 + printk(KERN_INFO "%s: abc-decomp failed\n",lp->name);
15803 + dev_kfree_skb(nskb);
15804 + dev_kfree_skb(skb);
15805 + nskb = NULL;
15806 + dwabc_bsd_first_gen(lp);
15807 +
15808 + } else {
15809 +
15810 + if (nskb->data[0] & 0x1)
15811 + skb_pull(nskb, 1); /* protocol ID is only 8 bit */
15812 + else
15813 + skb_pull(nskb, 2);
15814 +
15815 + nskb->dev = skb->dev;
15816 + nskb->pkt_type = skb->pkt_type;
15817 + nskb->mac.raw = nskb->data;
15818 + dev_kfree_skb(skb);
15819 + }
15820 +
15821 + } else {
15822 +
15823 + printk(KERN_INFO "%s: PANIC abc-decomp no memory\n",lp->name);
15824 + dev_kfree_skb(skb);
15825 + dwabc_bsd_first_gen(lp);
15826 + }
15827 +
15828 + clear_bit(ISDN_DW_ABC_BITLOCK_RECEIVE,&lp->dw_abc_bitlocks);
15829 + r = nskb;
15830 + }
15831 + }
15832 +
15833 + return(r);
15834 +}
15835 +
15836 +#else
15837 +int dwabc_bsd_init(isdn_net_local *lp) { return(1); }
15838 +void dwabc_bsd_free(isdn_net_local *lp) { return; }
15839 +void dwabc_bsd_first_gen(isdn_net_local *lp) { return ; }
15840 +
15841 +struct sk_buff *dwabc_bsd_compress(isdn_net_local *lp,struct sk_buff *skb,struct net_device *ndev)
15842 +{ return(skb); }
15843 +
15844 +struct sk_buff *dwabc_bsd_rx_pkt(isdn_net_local *lp,struct sk_buff *skb,struct net_device *ndev)
15845 +{ return(skb); }
15846 +#endif
15847 +#endif
15848 --- a/drivers/isdn/isdn_net.c
15849 +++ b/drivers/isdn/isdn_net.c
15850 @@ -1,4 +1,4 @@
15851 -/* $Id: isdn_net.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
15852 +/* $Id: isdn_net.c,v 1.153 2002/08/17 18:35:23 detabc Exp $
15853 *
15854 * Linux ISDN subsystem, network interfaces and related functions (linklevel).
15855 *
15856 @@ -9,14 +9,6 @@
15857 * This software may be used and distributed according to the terms
15858 * of the GNU General Public License, incorporated herein by reference.
15859 *
15860 - * Data Over Voice (DOV) support added - Guy Ellis 23-Mar-02
15861 - * guy@traverse.com.au
15862 - * Outgoing calls - looks for a 'V' in first char of dialed number
15863 - * Incoming calls - checks first character of eaz as follows:
15864 - * Numeric - accept DATA only - original functionality
15865 - * 'V' - accept VOICE (DOV) only
15866 - * 'B' - accept BOTH DATA and DOV types
15867 - *
15868 * Jan 2001: fix CISCO HDLC Bjoern A. Zeeb <i4l@zabbadoz.net>
15869 * for info on the protocol, see
15870 * http://i4l.zabbadoz.net/i4l/cisco-hdlc.txt
15871 @@ -38,6 +30,10 @@
15872 #include "isdn_concap.h"
15873 #endif
15874
15875 +#ifdef CONFIG_ISDN_WITH_ABC
15876 +#include <linux/isdn_dwabc.h>
15877 +#define isdn_net_log_skb(skb,lp) isdn_net_log_skb_dwabc(skb,lp,NULL)
15878 +#endif
15879
15880 /*
15881 * Outline of new tbusy handling:
15882 @@ -79,7 +75,11 @@ static __inline__ int isdn_net_device_st
15883 dev = lp->master;
15884 else
15885 dev = &n->dev;
15886 +#ifdef COMPAT_NO_SOFTNET
15887 + return dev->start;
15888 +#else
15889 return netif_running(dev);
15890 +#endif
15891 }
15892
15893 /*
15894 @@ -143,6 +143,10 @@ static __inline__ void isdn_net_inc_fram
15895 atomic_inc(&lp->frame_cnt);
15896 if (isdn_net_device_busy(lp))
15897 isdn_net_device_stop_queue(lp);
15898 +#if 0
15899 + printk(KERN_DEBUG "%s: inc_frame_cnt now %d\n", lp->name,
15900 + atomic_read(&lp->frame_cnt));
15901 +#endif
15902 }
15903
15904 static __inline__ void isdn_net_dec_frame_cnt(isdn_net_local *lp)
15905 @@ -157,11 +161,19 @@ static __inline__ void isdn_net_dec_fram
15906 isdn_net_device_wake_queue(lp);
15907 }
15908 }
15909 +#if 0
15910 + printk(KERN_DEBUG "%s: dec_frame_cnt now %d\n", lp->name,
15911 + atomic_read(&lp->frame_cnt));
15912 +#endif
15913 }
15914
15915 static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
15916 {
15917 atomic_set(&lp->frame_cnt, 0);
15918 +#if 0
15919 + printk(KERN_DEBUG "%s: zero_frame_cnt now %d\n", lp->name,
15920 + atomic_read(&lp->frame_cnt));
15921 +#endif
15922 }
15923
15924 /* For 2.2.x we leave the transmitter busy timeout at 2 secs, just
15925 @@ -173,23 +185,101 @@ static __inline__ void isdn_net_zero_fra
15926 * which might rely on the tx timeout. If so, we'll find out this way...
15927 */
15928
15929 +#ifdef COMPAT_NO_SOFTNET
15930 +#define ISDN_NET_TX_TIMEOUT (2*HZ)
15931 +#else
15932 #define ISDN_NET_TX_TIMEOUT (20*HZ)
15933 +#endif
15934
15935 /* Prototypes */
15936
15937 +#ifndef CONFIG_ISDN_WITH_ABC
15938 int isdn_net_force_dial_lp(isdn_net_local *);
15939 +#endif
15940 static int isdn_net_start_xmit(struct sk_buff *, struct net_device *);
15941
15942 static void isdn_net_ciscohdlck_connected(isdn_net_local *lp);
15943 static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp);
15944
15945 -char *isdn_net_revision = "$Revision: 1.1.4.1 $";
15946 +char *isdn_net_revision = "$Revision: 1.153 $";
15947
15948 /*
15949 * Code for raw-networking over ISDN
15950 */
15951 +#ifdef CONFIG_ISDN_WITH_ABC
15952 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
15953 +static int isdn_dwabc_encap_with_conerr(isdn_net_local *lp)
15954 +{
15955 + if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR)
15956 + return(0);
15957 +
15958 + return(
15959 + lp->p_encap == ISDN_NET_ENCAP_SYNCPPP ||
15960 + lp->p_encap == ISDN_NET_ENCAP_RAWIP ||
15961 + lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK ||
15962 + lp->p_encap == ISDN_NET_ENCAP_UIHDLC );
15963 +}
15964 +
15965 +static int isdn_dwabc_conerr_ippktok(struct sk_buff *skb)
15966 +{
15967 + struct iphdr *iph = (struct iphdr *)skb->data;
15968 + return(iph->version == 6 || (skb->len >= 20 && iph->version == 4));
15969 +}
15970 +
15971 +#endif
15972 +
15973 +static int isdn_dwabc_is_interface_disabled(isdn_net_local *lp)
15974 +{
15975 + if(lp == NULL)
15976 + return(0);
15977 +
15978 + lp->dw_abc_inuse_secure = 0;
15979 + lp->dw_abc_dialstart = 0;
15980 +
15981 + /*
15982 + ** check for jiffies overflow
15983 + */
15984 + if(lp->dw_abc_bchan_last_connect > jiffies) {
15985 +
15986 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
15987 + lp->dw_abc_bchan_errcnt = 0;
15988 +#endif
15989 + lp->dw_abc_bchan_last_connect = 0;
15990 + }
15991 +
15992 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
15993 + if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR) && isdn_dwabc_encap_with_conerr(lp)) {
15994 +
15995 + if(lp->dw_abc_bchan_errcnt > 3 && !(lp->dw_abc_bchan_errcnt & 3)) {
15996
15997 + ulong nj = jiffies;
15998 + ulong delay = lp->dw_abc_bchan_errcnt *
15999 + lp->dw_abc_bchan_errcnt *
16000 + lp->dw_abc_bchan_errcnt;
16001 +
16002 + if(delay > 86400) delay = 86400;
16003 + delay = (lp->dw_abc_bchan_last_connect + delay * HZ);
16004 +
16005 + if(delay > nj) {
16006 +
16007 + printk(KERN_INFO
16008 + "%s: interface auto-disabled (bchannel connect-error %lu seconds left)\n",
16009 + lp->name,(delay - nj) / HZ);
16010 +
16011 + return(1);
16012 + }
16013 + }
16014 + }
16015 +#endif
16016 + return(0);
16017 +}
16018 +#endif
16019 +
16020 +#ifdef CONFIG_ISDN_WITH_ABC
16021 +void
16022 +#else
16023 static void
16024 +#endif
16025 isdn_net_unreachable(struct net_device *dev, struct sk_buff *skb, char *reason)
16026 {
16027 if(skb) {
16028 @@ -297,6 +387,12 @@ isdn_net_unbind_channel(isdn_net_local *
16029
16030 save_flags(flags);
16031 cli();
16032 +#ifdef CONFIG_ISDN_WITH_ABC
16033 + isdn_dw_clear_if(0l,lp);
16034 + lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN;
16035 + lp->dw_abc_inuse_secure = 0;
16036 + dwabc_bsd_free(lp);
16037 +#endif
16038 skb_queue_purge(&lp->super_tx_queue);
16039
16040 if (!lp->master) { /* reset only master device */
16041 @@ -351,6 +447,26 @@ isdn_net_autohup()
16042 if ((l->flags & ISDN_NET_CONNECTED) && (!l->dialstate)) {
16043 anymore = 1;
16044 l->huptimer++;
16045 +#ifdef CONFIG_ISDN_WITH_ABC
16046 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16047 + if( isdn_dwabc_encap_with_conerr(l) && l->dw_abc_bchan_errcnt > 0) {
16048 +
16049 + int n = 180;
16050 +
16051 + if(l->dw_abc_bchan_errcnt > 3) n = 120;
16052 + if(l->dw_abc_bchan_errcnt > 6) n = 90;
16053 + if(l->dw_abc_bchan_errcnt > 9) n = 60;
16054 +
16055 + if(l->huptimer > n) {
16056 +
16057 + printk(KERN_INFO "%s: bchan conf-error auto-secure-hangup\n",l->name);
16058 + isdn_net_hangup(&p->dev);
16059 + p = (isdn_net_dev *) p->next;
16060 + continue;
16061 + }
16062 + }
16063 +#endif
16064 +#endif
16065 /*
16066 * if there is some dialmode where timeout-hangup
16067 * should _not_ be done, check for that here
16068 @@ -465,8 +581,32 @@ isdn_net_stat_callback(int idx, isdn_ctr
16069 printk(KERN_INFO "%s: Chargesum is %d\n", lp->name,
16070 lp->charge);
16071 isdn_net_unbind_channel(lp);
16072 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16073 + if(lp->dw_abc_bchan_errcnt) {
16074 +
16075 + printk(KERN_INFO
16076 + "%s: Note: bchannel-error-counter is %hd\n",
16077 + lp->name,
16078 + lp->dw_abc_bchan_errcnt);
16079 + }
16080 +#endif
16081 return 1;
16082 }
16083 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
16084 + if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE)) {
16085 + if((lp->dialstate == 4 || lp->dialstate == 12) &&
16086 + lp->dw_abc_dialstart && (idx < ISDN_MAX_CHANNELS)) {
16087 +
16088 + if((jiffies - lp->dw_abc_dialstart) < (HZ >>2)) {
16089 +
16090 + lp->dw_abc_if_flags |= ISDN_DW_ABC_IFFLAG_NODCHAN;
16091 + lp->dialstate = 1;
16092 + dev->dwabc_chan_external_inuse[idx] = jiffies + HZ * 30;
16093 + printk(KERN_INFO "%s: Channel %d look like external in use\n",lp->name,idx);
16094 + }
16095 + }
16096 + }
16097 +#endif
16098 break;
16099 #ifdef CONFIG_ISDN_X25
16100 case ISDN_STAT_BHUP:
16101 @@ -507,6 +647,19 @@ isdn_net_stat_callback(int idx, isdn_ctr
16102 }
16103 }
16104 printk(KERN_INFO "isdn_net: %s connected\n", lp->name);
16105 +#ifdef CONFIG_ISDN_WITH_ABC
16106 + if(!dwabc_bsd_init(lp)) dwabc_bsd_first_gen(lp);
16107 + lp->dw_abc_bchan_last_connect = jiffies;
16108 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16109 + if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR)) {
16110 +
16111 + lp->dw_abc_bchan_errcnt += isdn_dwabc_encap_with_conerr(lp);
16112 +
16113 + if(lp->dw_abc_bchan_errcnt > 32000)
16114 + lp->dw_abc_bchan_errcnt = 32000;
16115 + }
16116 +#endif
16117 +#endif
16118 /* If first Chargeinfo comes before B-Channel connect,
16119 * we correct the timestamp here.
16120 */
16121 @@ -578,7 +731,6 @@ isdn_net_dial(void)
16122 int i;
16123 unsigned long flags;
16124 isdn_ctrl cmd;
16125 - u_char *phone_number;
16126
16127 while (p) {
16128 isdn_net_local *lp = p->local;
16129 @@ -597,6 +749,47 @@ isdn_net_dial(void)
16130 */
16131 save_flags(flags);
16132 cli();
16133 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
16134 + if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE) &&
16135 + (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_NODCHAN)) {
16136 +
16137 + int chi = 0;
16138 + short lsecure = 0;
16139 +
16140 + lsecure = lp->dw_abc_inuse_secure;
16141 + isdn_net_unbind_channel(lp);
16142 + lp->dw_abc_inuse_secure = lsecure + 1;
16143 +
16144 + /* Grab a free ISDN-Channel */
16145 + if ((lsecure >= ISDN_MAX_CHANNELS ) || (chi =
16146 + isdn_get_free_channel(
16147 + ISDN_USAGE_NET,
16148 + lp->l2_proto,
16149 + lp->l3_proto,
16150 + lp->pre_device,
16151 + lp->pre_channel,
16152 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16153 + (*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn)
16154 +#else
16155 + lp->msn)
16156 +#endif
16157 + ) < 0) {
16158 +
16159 + restore_flags(flags);
16160 + isdn_net_unreachable(&p->dev, NULL,
16161 + "DWABC: redial-external-inuse NO FREE CHANNEL\n");
16162 + isdn_net_hangup(&p->dev);
16163 + break;
16164 + }
16165 +
16166 + isdn_net_bind_channel(lp, chi);
16167 + lp->dialstate = 1;
16168 + lp->dialstarted = 0;
16169 + lp->dialwait_timer = 0;
16170 + }
16171 +
16172 + lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN;
16173 +#endif
16174 lp->dial = lp->phone[1];
16175 restore_flags(flags);
16176 if (!lp->dial) {
16177 @@ -621,18 +814,69 @@ isdn_net_dial(void)
16178 cmd.arg = lp->isdn_channel;
16179 cmd.command = ISDN_CMD_CLREAZ;
16180 isdn_command(&cmd);
16181 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16182 + sprintf(cmd.parm.num, "%s",
16183 + isdn_map_eaz2msn((*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn, cmd.driver));
16184 +#else
16185 sprintf(cmd.parm.num, "%s", isdn_map_eaz2msn(lp->msn, cmd.driver));
16186 +#endif
16187 cmd.command = ISDN_CMD_SETEAZ;
16188 isdn_command(&cmd);
16189 lp->dialretry = 0;
16190 anymore = 1;
16191 lp->dialstate++;
16192 +#ifdef CONFIG_ISDN_WITH_ABC
16193 + lp->onhtime = lp->dw_abc_old_onhtime;
16194 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
16195 + isdn_dw_abc_lcr_clear(lp);
16196 +#endif
16197 +#endif
16198 /* Fall through */
16199 case 3:
16200 /* Setup interface, dial current phone-number, switch to next number.
16201 * If list of phone-numbers is exhausted, increment
16202 * retry-counter.
16203 */
16204 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
16205 + if(!isdn_dw_abc_lcr_lock()) {
16206 +
16207 + if( lp->dw_abc_lcr_cmd != NULL &&
16208 + lp->dw_abc_lcr_start_request !=
16209 + lp->dw_abc_lcr_end_request) {
16210 +
16211 + if( lp->dw_abc_lcr_io == NULL &&
16212 + lp->dw_abc_lcr_start_request <= jiffies &&
16213 + lp->dw_abc_lcr_end_request > jiffies) {
16214 +
16215 + isdn_dw_abc_lcr_ulock();
16216 + anymore = 1;
16217 + break;
16218 + }
16219 +
16220 + if(lp->dw_abc_lcr_io != NULL) {
16221 +
16222 + if(lp->dw_abc_lcr_io->lcr_ioctl_flags &
16223 + DWABC_LCR_FLG_DISABLE) {
16224 +
16225 + isdn_dw_abc_lcr_ulock();
16226 + isdn_net_hangup(&p->dev);
16227 + break;
16228 + }
16229 +
16230 + if(lp->dw_abc_lcr_io->lcr_ioctl_flags &
16231 + DWABC_LCR_FLG_NEWHUPTIME) {
16232 + lp->onhtime = lp->dw_abc_lcr_io->lcr_ioctl_onhtime;
16233 + }
16234 + }
16235 +
16236 + memcpy(&cmd,lp->dw_abc_lcr_cmd,sizeof(cmd));
16237 + isdn_dw_abc_lcr_ulock();
16238 + goto dw_abc_lcr_next_click;
16239 + }
16240 +
16241 + isdn_dw_abc_lcr_ulock();
16242 + }
16243 +#endif
16244 if(dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF)) {
16245 char *s;
16246 if (dev->global_flags & ISDN_GLOBAL_STOPPED)
16247 @@ -677,20 +921,7 @@ isdn_net_dial(void)
16248 break;
16249 }
16250
16251 - cmd.driver = lp->isdn_device;
16252 - cmd.command = ISDN_CMD_DIAL;
16253 - cmd.parm.setup.si2 = 0;
16254 -
16255 - /* check for DOV */
16256 - phone_number = lp->dial->num;
16257 - if ((*phone_number == 'v') ||
16258 - (*phone_number == 'V')) { /* DOV call */
16259 - cmd.parm.setup.si1 = 1;
16260 - } else { /* DATA call */
16261 - cmd.parm.setup.si1 = 7;
16262 - }
16263 -
16264 - strcpy(cmd.parm.setup.phone, phone_number);
16265 + sprintf(cmd.parm.setup.phone, "%s", lp->dial->num);
16266 /*
16267 * Switch to next number or back to start if at end of list.
16268 */
16269 @@ -710,17 +941,70 @@ isdn_net_dial(void)
16270 }
16271 }
16272 restore_flags(flags);
16273 + cmd.driver = lp->isdn_device;
16274 + cmd.command = ISDN_CMD_DIAL;
16275 + cmd.parm.setup.si1 = 7;
16276 + cmd.parm.setup.si2 = 0;
16277 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16278 + sprintf(cmd.parm.setup.eazmsn, "%s",
16279 + isdn_map_eaz2msn((*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn, cmd.driver));
16280 +#else
16281 sprintf(cmd.parm.setup.eazmsn, "%s",
16282 isdn_map_eaz2msn(lp->msn, cmd.driver));
16283 +#endif
16284 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
16285 + /*
16286 + ** if callback-out we dont need
16287 + ** low-cost-routing LCR
16288 + */
16289 + if(!(lp->flags & ISDN_NET_CBOUT) &&
16290 + !(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_LCR)) {
16291 +
16292 + isdn_dw_abc_lcr_call_number(lp,&cmd);
16293 +
16294 + if(lp->dw_abc_lcr_start_request != lp->dw_abc_lcr_end_request) {
16295 +
16296 + if(dev->net_verbose > 2) {
16297 +
16298 + printk(KERN_INFO
16299 + "%s: Waiting for LCR-response from isdnlog %s -> %s...\n",
16300 + lp->name,
16301 + cmd.parm.setup.eazmsn,
16302 + cmd.parm.setup.phone);
16303 + }
16304 +
16305 + anymore = 1;
16306 + break;
16307 + }
16308 + }
16309 +
16310 +dw_abc_lcr_next_click:;
16311 + isdn_dw_abc_lcr_clear(lp);
16312 +#endif
16313 i = isdn_dc2minor(lp->isdn_device, lp->isdn_channel);
16314 if (i >= 0) {
16315 strcpy(dev->num[i], cmd.parm.setup.phone);
16316 dev->usage[i] |= ISDN_USAGE_OUTGOING;
16317 isdn_info_update();
16318 }
16319 - printk(KERN_INFO "%s: dialing %d %s... %s\n", lp->name,
16320 - lp->dialretry, cmd.parm.setup.phone,
16321 - (cmd.parm.setup.si1 == 1) ? "DOV" : "");
16322 +#ifdef CONFIG_ISDN_WITH_ABC
16323 + printk(KERN_INFO "%s: dialing %d %s -> %s...\n", lp->name,
16324 + lp->dialretry,
16325 + cmd.parm.setup.eazmsn,
16326 + cmd.parm.setup.phone);
16327 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16328 + if(lp->dw_abc_bchan_errcnt) {
16329 +
16330 + printk(KERN_INFO
16331 + "%s: Note: bchannel-error-counter is %hd\n",
16332 + lp->name,
16333 + lp->dw_abc_bchan_errcnt);
16334 + }
16335 +#endif
16336 +#else
16337 + printk(KERN_INFO "%s: dialing %d %s...\n", lp->name,
16338 + lp->dialretry, cmd.parm.setup.phone);
16339 +#endif
16340 lp->dtimer = 0;
16341 #ifdef ISDN_DEBUG_NET_DIAL
16342 printk(KERN_DEBUG "dial: d=%d c=%d\n", lp->isdn_device,
16343 @@ -741,6 +1025,10 @@ isdn_net_dial(void)
16344 lp->dialstate =
16345 (lp->cbdelay &&
16346 (lp->flags & ISDN_NET_CBOUT)) ? 12 : 4;
16347 +#ifdef CONFIG_ISDN_WITH_ABC
16348 + lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN;
16349 + lp->dw_abc_dialstart = jiffies;
16350 +#endif
16351 break;
16352 case 4:
16353 /* Wait for D-Channel-connect.
16354 @@ -890,6 +1178,15 @@ isdn_net_hangup(struct net_device *d)
16355 isdn_command(&cmd);
16356 printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, lp->charge);
16357 isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
16358 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16359 + if(lp->dw_abc_bchan_errcnt) {
16360 +
16361 + printk(KERN_INFO
16362 + "%s: Note: bchannel-error-counter is %hd\n",
16363 + lp->name,
16364 + lp->dw_abc_bchan_errcnt);
16365 + }
16366 +#endif
16367 }
16368 isdn_net_unbind_channel(lp);
16369 }
16370 @@ -899,8 +1196,13 @@ typedef struct {
16371 unsigned short dest;
16372 } ip_ports;
16373
16374 +#ifdef CONFIG_ISDN_WITH_ABC
16375 +void
16376 +isdn_net_log_skb_dwabc(struct sk_buff * skb, isdn_net_local * lp,char *reason)
16377 +#else
16378 static void
16379 isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
16380 +#endif
16381 {
16382 u_char *p = skb->nh.raw; /* hopefully, this was set correctly */
16383 unsigned short proto = ntohs(skb->protocol);
16384 @@ -972,7 +1274,13 @@ isdn_net_log_skb(struct sk_buff * skb, i
16385 break;
16386 }
16387 printk(KERN_INFO
16388 +#ifdef CONFIG_ISDN_WITH_ABC
16389 + "%s %s: %d.%d.%d.%d -> %d.%d.%d.%d%s\n",
16390 + (reason == NULL) ? "OPEN" : reason,
16391 + (lp != NULL) ? lp->name : "",
16392 +#else
16393 "OPEN: %d.%d.%d.%d -> %d.%d.%d.%d%s\n",
16394 +#endif
16395
16396 p[12], p[13], p[14], p[15],
16397 p[16], p[17], p[18], p[19],
16398 @@ -980,7 +1288,13 @@ isdn_net_log_skb(struct sk_buff * skb, i
16399 break;
16400 case ETH_P_ARP:
16401 printk(KERN_INFO
16402 +#ifdef CONFIG_ISDN_WITH_ABC
16403 + "%s %s: ARP %d.%d.%d.%d -> *.*.*.* ?%d.%d.%d.%d\n",
16404 + (reason == NULL) ? "OPEN" : reason,
16405 + (lp != NULL) ? lp->name : "",
16406 +#else
16407 "OPEN: ARP %d.%d.%d.%d -> *.*.*.* ?%d.%d.%d.%d\n",
16408 +#endif
16409 p[14], p[15], p[16], p[17],
16410 p[24], p[25], p[26], p[27]);
16411 break;
16412 @@ -1004,11 +1318,22 @@ void isdn_net_write_super(isdn_net_local
16413 }
16414
16415 spin_lock_bh(&lp->xmit_lock);
16416 +
16417 if (!isdn_net_lp_busy(lp)) {
16418 +#ifdef CONFIG_ISDN_WITH_ABC
16419 + if(!skb_queue_empty(&lp->super_tx_queue)) {
16420 + /*
16421 + ** don't reverse the frame flow
16422 + ** compression need frames in order and maybe other's too
16423 + */
16424 + skb_queue_tail(&lp->super_tx_queue, skb);
16425 + skb = skb_dequeue(&lp->super_tx_queue);
16426 + }
16427 +#endif
16428 isdn_net_writebuf_skb(lp, skb);
16429 - } else {
16430 - skb_queue_tail(&lp->super_tx_queue, skb);
16431 - }
16432 +
16433 + } else skb_queue_tail(&lp->super_tx_queue, skb);
16434 +
16435 spin_unlock_bh(&lp->xmit_lock);
16436 }
16437
16438 @@ -1056,7 +1381,6 @@ void isdn_net_writebuf_skb(isdn_net_loca
16439 printk(KERN_WARNING "%s: HL driver queue full\n", lp->name);
16440 goto error;
16441 }
16442 -
16443 lp->transcount += len;
16444 isdn_net_inc_frame_cnt(lp);
16445 return;
16446 @@ -1064,9 +1388,19 @@ void isdn_net_writebuf_skb(isdn_net_loca
16447 error:
16448 dev_kfree_skb(skb);
16449 lp->stats.tx_errors++;
16450 -
16451 }
16452
16453 +#if 0
16454 +int isdn_net_send_skb(struct net_device *ndev, isdn_net_local * lp,struct sk_buff *skb)
16455 +{
16456 + if (isdn_net_lp_busy(lp)) {
16457 + printk(KERN_WARNING "isdn_net_send_skb: HL channel busy\n");
16458 + return 1;
16459 + }
16460 + isdn_net_writebuf_skb(lp, skb);
16461 + return 0;
16462 +}
16463 +#endif
16464
16465 /*
16466 * Helper function for isdn_net_start_xmit.
16467 @@ -1109,7 +1443,54 @@ isdn_net_xmit(struct net_device *ndev, s
16468
16469 /* Reset hangup-timeout */
16470 lp->huptimer = 0; // FIXME?
16471 +#ifdef CONFIG_ISDN_WITH_ABC
16472 +
16473 + if(test_and_set_bit(ISDN_DW_ABC_BITLOCK_SEND,&lp->dw_abc_bitlocks)) {
16474 +
16475 + if(dev->net_verbose > 2)
16476 + printk(KERN_INFO "%s: isdn_net_xmit called recursivly\n",lp->name);
16477 +
16478 + spin_unlock_bh(&lp->xmit_lock);
16479 + return(1);
16480 + }
16481 +
16482 + if(skb != NULL) {
16483 +
16484 + int l = skb->len;
16485 + int nl = l;
16486 +
16487 + if( lp->p_encap == ISDN_NET_ENCAP_RAWIP &&
16488 + (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_BSDAKTIV)) {
16489 +
16490 + if((skb = dwabc_bsd_compress(lp,skb,ndev)) != NULL) {
16491 +
16492 + int r = 0;
16493 + nl = skb->len;
16494 + skb_queue_tail(&lp->super_tx_queue,skb);
16495 +
16496 + if(l != nl && (r = isdn_dc2minor(lp->isdn_device,lp->isdn_channel)) >= 0) {
16497 +
16498 + dev->obytes[r] += l - nl;
16499 + lp->stats.tx_bytes += l - nl;
16500 + }
16501 + }
16502 +
16503 + } else skb_queue_tail(&lp->super_tx_queue,skb);
16504 +
16505 + if(lp->p_encap == ISDN_NET_ENCAP_RAWIP) {
16506 +
16507 + lp->dw_abc_bsd_snd += l;
16508 + lp->dw_abc_bsd_bsd_snd += nl;
16509 + }
16510 + }
16511 + clear_bit(ISDN_DW_ABC_BITLOCK_SEND,&lp->dw_abc_bitlocks);
16512 +
16513 + while(!isdn_net_lp_busy(lp) && (skb = skb_dequeue(&lp->super_tx_queue)))
16514 + isdn_net_writebuf_skb(lp, skb);
16515 +
16516 +#else
16517 isdn_net_writebuf_skb(lp, skb);
16518 +#endif
16519 spin_unlock_bh(&lp->xmit_lock);
16520
16521 /* the following stuff is here for backwards compatibility.
16522 @@ -1143,6 +1524,69 @@ isdn_net_xmit(struct net_device *ndev, s
16523
16524 return retv;
16525
16526 +#if 0
16527 + if (lp->cps > lp->triggercps) {
16528 + /* Device overloaded */
16529 +
16530 + /*
16531 + * Packet-delivery via round-robin over master
16532 + * and all connected slaves.
16533 + */
16534 + if (lp->master) {
16535 + /* Slaves always deliver themselves */
16536 + spin_lock_bh(&lp->xmit_lock);
16537 + if (!isdn_net_lp_busy(lp)) {
16538 + isdn_net_writebuf_skb(lp, skb);
16539 + ret = 0;
16540 + } else {
16541 + isdn_net_device_stop_queue(lp);
16542 + ret = 1;
16543 + }
16544 + ret = isdn_net_send_skb(ndev, lp, skb);
16545 + spin_unlock_bh(&lp->xmit_lock);
16546 + } else {
16547 + isdn_net_local *slp = (isdn_net_local *) (lp->srobin->priv);
16548 + /* Master delivers via srobin and maintains srobin */
16549 + if (lp->srobin == ndev) {
16550 + spin_lock_bh(&lp->xmit_lock);
16551 + ret = isdn_net_send_skb(ndev, lp, skb);
16552 + spin_unlock_bh(&lp->xmit_lock);
16553 + } else {
16554 + ret = isdn_net_start_xmit(skb, lp->srobin);
16555 + }
16556 + lp->srobin = (slp->slave) ? slp->slave : ndev;
16557 + slp = (isdn_net_local *) (lp->srobin->priv);
16558 + if (!((slp->flags & ISDN_NET_CONNECTED) && (slp->dialstate == 0)))
16559 + lp->srobin = ndev;
16560 + }
16561 + /* Slave-startup using delay-variable */
16562 + if (lp->slave) {
16563 + if (!lp->sqfull) {
16564 + /* First time overload: set timestamp only */
16565 + lp->sqfull = 1;
16566 + lp->sqfull_stamp = jiffies;
16567 + } else {
16568 + /* subsequent overload: if slavedelay exceeded, start dialing */
16569 + if ((jiffies - lp->sqfull_stamp) > lp->slavedelay)
16570 + isdn_net_force_dial_lp((isdn_net_local *) lp->slave->priv);
16571 + }
16572 + }
16573 + } else {
16574 + /* Not overloaded, deliver locally */
16575 + spin_lock_bh(&lp->xmit_lock);
16576 + if (!isdn_net_lp_busy(lp)) {
16577 + isdn_net_writebuf_skb(lp, skb);
16578 + ret = 0;
16579 + } else {
16580 + isdn_net_device_stop_queue(lp);
16581 + ret = 1;
16582 + }
16583 + spin_unlock_bh(&lp->xmit_lock);
16584 + if (lp->sqfull && ((jiffies - lp->sqfull_stamp) > (lp->slavedelay + (10 * HZ))))
16585 + lp->sqfull = 0;
16586 + }
16587 + return ret;
16588 +#endif
16589 }
16590
16591 static void
16592 @@ -1161,6 +1605,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb,
16593 }
16594
16595
16596 +#ifndef COMPAT_NO_SOFTNET
16597 void isdn_net_tx_timeout(struct net_device * ndev)
16598 {
16599 isdn_net_local *lp = (isdn_net_local *) ndev->priv;
16600 @@ -1188,19 +1633,206 @@ void isdn_net_tx_timeout(struct net_devi
16601 ndev->trans_start = jiffies;
16602 netif_wake_queue(ndev);
16603 }
16604 +#endif
16605
16606 /*
16607 * Try sending a packet.
16608 * If this interface isn't connected to a ISDN-Channel, find a free channel,
16609 * and start dialing.
16610 */
16611 +#ifdef CONFIG_ISDN_WITH_ABC
16612 +static int dwabc_isdn_net_start_xmit(struct sk_buff *,struct net_device *);
16613 +
16614 +static int isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
16615 +{
16616 + if(skb == NULL || ndev == NULL)
16617 + return(dwabc_isdn_net_start_xmit(skb,ndev));
16618 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
16619 + if(!(((isdn_net_local *)ndev->priv)->dw_abc_flags &
16620 + ISDN_DW_ABC_FLAG_NO_UDP_CHECK)) {
16621 +
16622 + if(dw_abc_udp_test(skb,ndev)) {
16623 + dev_kfree_skb(skb);
16624 + return(0);
16625 + }
16626 + }
16627 +#endif
16628 + return(dwabc_isdn_net_start_xmit(skb,ndev));
16629 +}
16630 +
16631 +
16632 +#ifdef CONFIG_ISDN_WITH_ABC
16633 +int isdn_auto_dial_helper( isdn_net_local *lp,
16634 + struct sk_buff *skb,
16635 + int dm_manual_allowed)
16636 +/**********************************************************************
16637 + return's:
16638 + -1 dial not allowed or impossible
16639 + 0 interface is connected
16640 + 1 dial is started
16641 +***********************************************************************/
16642 +{
16643 + int retw = -1;
16644 + int chi;
16645 + ulong flags;
16646 + char *errmsg = NULL;
16647 +
16648 +#ifdef ISDN_DEBUG_NET_DUMP
16649 + {
16650 + char *buf = skb->data;
16651 + isdn_dumppkt("S:", buf, skb->len, 40);
16652 + }
16653 +#endif
16654 + if (lp->flags & ISDN_NET_CONNECTED)
16655 + return(0);
16656 +
16657 + save_flags(flags);
16658 + cli();
16659 +
16660 + do {
16661 +
16662 + /* Log packet, which triggered dialing */
16663 + if (dev->net_verbose)
16664 + isdn_net_log_skb(skb, lp);
16665 + /* only do autodial if allowed by config */
16666 + if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) {
16667 + errmsg = "dial rejected: interface not in dialmode `auto'";
16668 +
16669 + if(dm_manual_allowed &&
16670 + !(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_MANUAL)) {
16671 +
16672 + errmsg =
16673 + "dial rejected: interface not in dialmode `auto or manual'";
16674 + }
16675 + break;
16676 + }
16677 +
16678 + if (!lp->phone[1]) {
16679 +
16680 + errmsg = "No phone number";
16681 + break;
16682 + }
16683 +
16684 + if(lp->dialwait_timer <= 0) {
16685 +
16686 + if( lp->dialstarted > 0 &&
16687 + lp->dialtimeout > 0 &&
16688 + jiffies < (lp->dialstarted + lp->dialtimeout + lp->dialwait)) {
16689 +
16690 + lp->dialwait_timer =
16691 + lp->dialstarted + lp->dialtimeout + lp->dialwait;
16692 + }
16693 + }
16694 +
16695 + if(lp->dialwait_timer > 0) {
16696 +
16697 + if(jiffies < lp->dialwait_timer) {
16698 +
16699 + errmsg = "dial rejected: retry-time not reached";
16700 + break;
16701 +
16702 + } else lp->dialwait_timer = 0;
16703 + }
16704 +#ifdef CONFIG_ISDN_WITH_ABC
16705 + if(isdn_dwabc_is_interface_disabled(lp))
16706 + break;
16707 +#endif
16708 + /* Grab a free ISDN-Channel */
16709 + if (((chi =
16710 + isdn_get_free_channel(
16711 + ISDN_USAGE_NET,
16712 + lp->l2_proto,
16713 + lp->l3_proto,
16714 + lp->pre_device,
16715 + lp->pre_channel,
16716 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16717 + (*lp->dw_out_msn) ? lp->dw_out_msn :
16718 +#endif
16719 + lp->msn)
16720 + ) < 0) &&
16721 + ((chi =
16722 + isdn_get_free_channel(
16723 + ISDN_USAGE_NET,
16724 + lp->l2_proto,
16725 + lp->l3_proto,
16726 + lp->pre_device,
16727 + lp->pre_channel^1,
16728 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16729 + (*lp->dw_out_msn) ? lp->dw_out_msn :
16730 +#endif
16731 + lp->msn)
16732 + ) < 0)) {
16733 +
16734 + errmsg = "No channel";
16735 + break;
16736 + }
16737 +
16738 + lp->dialstate = 1;
16739 + /* Connect interface with channel */
16740 + isdn_net_bind_channel(lp, chi);
16741 +#ifdef CONFIG_ISDN_PPP
16742 + if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) {
16743 + /* no 'first_skb' handling for syncPPP */
16744 + if (isdn_ppp_bind(lp) < 0) {
16745 + isdn_net_unbind_channel(lp);
16746 + break;
16747 + }
16748 +
16749 + isdn_net_dial(); /* Initiate dialing */
16750 + netif_stop_queue(&lp->netdev->dev);
16751 + retw = 1;
16752 + break;
16753 + /* let upper layer requeue skb packet */
16754 + }
16755 +#endif
16756 + /* Initiate dialing */
16757 + isdn_net_dial();
16758 + isdn_net_device_stop_queue(lp);
16759 + retw = 1;
16760 +
16761 + } while(0);
16762 +
16763 + if(retw < 0 && errmsg != NULL)
16764 + isdn_net_unreachable(&lp->netdev->dev, skb, errmsg);
16765 +
16766 + restore_flags(flags);
16767 + return(retw);
16768 +}
16769 +#endif
16770 +
16771 +
16772 +
16773 +static int
16774 +dwabc_isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
16775 +#else
16776 static int
16777 isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
16778 +#endif
16779 {
16780 isdn_net_local *lp = (isdn_net_local *) ndev->priv;
16781 #ifdef CONFIG_ISDN_X25
16782 struct concap_proto * cprot = lp -> netdev -> cprot;
16783 #endif
16784 +#ifdef COMPAT_NO_SOFTNET
16785 + /* some comment as with the softnet TX timeout
16786 + when this happens, it's a bug in the HL card driver
16787 + and should be fixed there, so we can supposedly get rid of
16788 + this here at all.
16789 + I added a debugging message to find out if it ever occurs --KG
16790 + */
16791 +
16792 + if (ndev->tbusy) {
16793 + if (jiffies - ndev->trans_start < ISDN_NET_TX_TIMEOUT)
16794 + return 1;
16795 + if (!lp->dialstate){
16796 + lp->stats.tx_errors++;
16797 + printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n",
16798 + ndev->name, lp->dialstate);
16799 + }
16800 + ndev->trans_start = jiffies;
16801 + netif_wake_queue(ndev);
16802 + }
16803 +#endif
16804 #ifdef CONFIG_ISDN_X25
16805 /* At this point hard_start_xmit() passes control to the encapsulation
16806 protocol (if present).
16807 @@ -1220,6 +1852,40 @@ isdn_net_start_xmit(struct sk_buff *skb,
16808 } else
16809 #endif
16810 /* auto-dialing xmit function */
16811 +#ifdef CONFIG_ISDN_WITH_ABC
16812 + {
16813 + int r;
16814 +
16815 + isdn_net_adjust_hdr(skb, ndev);
16816 +
16817 + if(!(r = isdn_auto_dial_helper(lp,skb,0))) {
16818 +
16819 + /*
16820 + ** Device is connected to an ISDN channel
16821 + */
16822 + ndev->trans_start = jiffies;
16823 +
16824 + if (!lp->dialstate) {
16825 +
16826 + /*
16827 + ** ISDN connection is established, try sending
16828 + */
16829 + r = isdn_net_xmit(ndev, skb);
16830 +
16831 + } else r = 1;
16832 +
16833 + if(r)
16834 + netif_stop_queue(ndev);
16835 +
16836 + } else if(r < 0) {
16837 +
16838 + dev_kfree_skb(skb);
16839 + r = 0;
16840 + }
16841 +
16842 + return(r);
16843 + }
16844 +#else
16845 {
16846 #ifdef ISDN_DEBUG_NET_DUMP
16847 u_char *buf;
16848 @@ -1256,6 +1922,14 @@ isdn_net_start_xmit(struct sk_buff *skb,
16849 } else
16850 lp->dialwait_timer = 0;
16851 }
16852 +#ifdef CONFIG_ISDN_WITH_ABC
16853 + if(isdn_dwabc_is_interface_disabled(lp)) {
16854 +
16855 + dev_kfree_skb(skb);
16856 + restore_flags(flags);
16857 + return(0);
16858 + }
16859 +#endif
16860 /* Grab a free ISDN-Channel */
16861 if (((chi =
16862 isdn_get_free_channel(
16863 @@ -1264,6 +1938,9 @@ isdn_net_start_xmit(struct sk_buff *skb,
16864 lp->l3_proto,
16865 lp->pre_device,
16866 lp->pre_channel,
16867 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16868 + (*lp->dw_out_msn) ? lp->dw_out_msn :
16869 +#endif
16870 lp->msn)
16871 ) < 0) &&
16872 ((chi =
16873 @@ -1273,6 +1950,9 @@ isdn_net_start_xmit(struct sk_buff *skb,
16874 lp->l3_proto,
16875 lp->pre_device,
16876 lp->pre_channel^1,
16877 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16878 + (*lp->dw_out_msn) ? lp->dw_out_msn :
16879 +#endif
16880 lp->msn)
16881 ) < 0)) {
16882 restore_flags(flags);
16883 @@ -1296,16 +1976,6 @@ isdn_net_start_xmit(struct sk_buff *skb,
16884 restore_flags(flags);
16885 return 0; /* STN (skb to nirvana) ;) */
16886 }
16887 -#ifdef CONFIG_IPPP_FILTER
16888 - if (isdn_ppp_autodial_filter(skb, lp)) {
16889 - isdn_ppp_free(lp);
16890 - isdn_net_unbind_channel(lp);
16891 - restore_flags(flags);
16892 - isdn_net_unreachable(ndev, skb, "dial rejected: packet filtered");
16893 - dev_kfree_skb(skb);
16894 - return 0;
16895 - }
16896 -#endif
16897 restore_flags(flags);
16898 isdn_net_dial(); /* Initiate dialing */
16899 netif_stop_queue(ndev);
16900 @@ -1337,6 +2007,7 @@ isdn_net_start_xmit(struct sk_buff *skb,
16901 }
16902 }
16903 return 1;
16904 +#endif
16905 }
16906
16907 /*
16908 @@ -1356,6 +2027,9 @@ isdn_net_close(struct net_device *dev)
16909 if( cprot && cprot -> pops ) cprot -> pops -> close( cprot );
16910 #endif
16911 netif_stop_queue(dev);
16912 +#ifdef COMPAT_NO_SOFTNET
16913 + dev->start = 0;
16914 +#endif
16915 if ((p = (((isdn_net_local *) dev->priv)->slave))) {
16916 /* If this interface has slaves, stop them also */
16917 while (p) {
16918 @@ -1776,6 +2450,10 @@ isdn_net_ciscohdlck_receive(isdn_net_loc
16919 }
16920
16921 switch (type) {
16922 + case CISCO_TYPE_INET:
16923 + skb->protocol = htons(ETH_P_IP);
16924 + netif_rx(skb);
16925 + break;
16926 case CISCO_TYPE_SLARP:
16927 isdn_net_ciscohdlck_slarp_in(lp, skb);
16928 goto out_free;
16929 @@ -1785,11 +2463,11 @@ isdn_net_ciscohdlck_receive(isdn_net_loc
16930 "\"no cdp enable\" on cisco.\n", lp->name);
16931 goto out_free;
16932 default:
16933 - /* no special cisco protocol */
16934 - skb->protocol = htons(type);
16935 - netif_rx(skb);
16936 - return;
16937 + printk(KERN_WARNING "%s: Unknown Cisco type 0x%04x\n",
16938 + lp->name, type);
16939 + goto out_free;
16940 }
16941 + return;
16942
16943 out_free:
16944 kfree_skb(skb);
16945 @@ -1803,9 +2481,19 @@ isdn_net_receive(struct net_device *ndev
16946 {
16947 isdn_net_local *lp = (isdn_net_local *) ndev->priv;
16948 isdn_net_local *olp = lp; /* original 'lp' */
16949 +#ifdef CONFIG_ISDN_PPP
16950 + int proto = PPP_PROTOCOL(skb->data);
16951 +#endif
16952 #ifdef CONFIG_ISDN_X25
16953 struct concap_proto *cprot = lp -> netdev -> cprot;
16954 #endif
16955 +#ifdef CONFIG_ISDN_WITH_ABC
16956 + struct net_device *ondev = ndev;
16957 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
16958 + ulong lp_huptimer = 0;
16959 + ulong olp_huptimer = 0;
16960 +#endif
16961 +#endif
16962 lp->transcount += skb->len;
16963
16964 lp->stats.rx_packets++;
16965 @@ -1819,6 +2507,10 @@ isdn_net_receive(struct net_device *ndev
16966 lp->stats.rx_packets++;
16967 lp->stats.rx_bytes += skb->len;
16968 }
16969 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
16970 + lp_huptimer = lp->huptimer;
16971 + olp_huptimer = olp->huptimer;
16972 +#endif
16973 skb->dev = ndev;
16974 skb->pkt_type = PACKET_HOST;
16975 skb->mac.raw = skb->data;
16976 @@ -1840,9 +2532,40 @@ isdn_net_receive(struct net_device *ndev
16977 /* Fall through */
16978 case ISDN_NET_ENCAP_RAWIP:
16979 /* RAW-IP without MAC-Header */
16980 +#ifdef CONFIG_ISDN_WITH_ABC
16981 + if(olp->p_encap == ISDN_NET_ENCAP_RAWIP) {
16982 +
16983 + ushort l = skb->len;
16984 + short r = 0;
16985 +
16986 + olp->dw_abc_bsd_bsd_rcv += l;
16987 +
16988 + if((skb = dwabc_bsd_rx_pkt(olp,skb,ondev)) == NULL) {
16989 +
16990 + olp->dw_abc_bsd_rcv += l;
16991 + return;
16992 + }
16993 +
16994 + olp->dw_abc_bsd_rcv += skb->len;
16995 +
16996 + if( l != skb->len &&
16997 + (r=isdn_dc2minor(olp->isdn_device,olp->isdn_channel))>=0) {
16998 +
16999 + dev->ibytes[r] += skb->len - l;
17000 + olp->stats.rx_bytes += skb->len - l;
17001 +
17002 + if(olp != lp)
17003 + lp->stats.rx_bytes += skb->len - l;
17004 + }
17005 + }
17006 +#endif
17007 olp->huptimer = 0;
17008 lp->huptimer = 0;
17009 skb->protocol = htons(ETH_P_IP);
17010 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
17011 + if(isdn_dwabc_conerr_ippktok(skb))
17012 + lp->dw_abc_bchan_errcnt = 0;
17013 +#endif
17014 break;
17015 case ISDN_NET_ENCAP_CISCOHDLCK:
17016 isdn_net_ciscohdlck_receive(lp, skb);
17017 @@ -1862,8 +2585,22 @@ isdn_net_receive(struct net_device *ndev
17018 break;
17019 #ifdef CONFIG_ISDN_PPP
17020 case ISDN_NET_ENCAP_SYNCPPP:
17021 - /* huptimer is done in isdn_ppp_push_higher */
17022 + /*
17023 + * If encapsulation is syncppp, don't reset
17024 + * huptimer on LCP packets.
17025 + */
17026 + if (proto != PPP_LCP) {
17027 + olp->huptimer = 0;
17028 + lp->huptimer = 0;
17029 + }
17030 isdn_ppp_receive(lp->netdev, olp, skb);
17031 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17032 + if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) {
17033 +
17034 + lp->huptimer = lp_huptimer + 1;
17035 + olp->huptimer = olp_huptimer+ 1;
17036 + }
17037 +#endif
17038 return;
17039 #endif
17040
17041 @@ -1873,6 +2610,15 @@ isdn_net_receive(struct net_device *ndev
17042 if(cprot) if(cprot -> pops)
17043 if( cprot -> pops -> data_ind){
17044 cprot -> pops -> data_ind(cprot,skb);
17045 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
17046 + lp->dw_abc_bchan_errcnt = 0;
17047 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17048 + if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) {
17049 + lp->huptimer = lp_huptimer;
17050 + olp->huptimer = olp_huptimer;
17051 + }
17052 +#endif
17053 +#endif
17054 return;
17055 };
17056 #endif /* CONFIG_ISDN_X25 */
17057 @@ -1882,6 +2628,15 @@ isdn_net_receive(struct net_device *ndev
17058 return;
17059 }
17060
17061 +#ifdef CONFIG_ISDN_WITH_ABC
17062 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17063 + if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) {
17064 +
17065 + lp->huptimer = lp_huptimer;
17066 + olp->huptimer = olp_huptimer;
17067 + }
17068 +#endif
17069 +#endif
17070 netif_rx(skb);
17071 return;
17072 }
17073 @@ -2160,7 +2915,10 @@ isdn_net_find_icall(int di, int ch, int
17074 isdn_net_phone *n;
17075 ulong flags;
17076 char nr[ISDN_MSNLEN];
17077 - char *my_eaz;
17078 +#ifdef CONFIG_ISDN_WITH_ABC
17079 + if(dev->net_verbose > 2)
17080 + printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=0x%04X\n", di, ch, idx,dev->usage[idx]);
17081 +#endif
17082
17083 /* Search name in netdev-chain */
17084 save_flags(flags);
17085 @@ -2182,17 +2940,15 @@ isdn_net_find_icall(int di, int ch, int
17086 eaz = setup->eazmsn;
17087 if (dev->net_verbose > 1)
17088 printk(KERN_INFO "isdn_net: call from %s,%d,%d -> %s\n", nr, si1, si2, eaz);
17089 - /* Accept DATA and VOICE calls at this stage
17090 - local eaz is checked later for allowed call types */
17091 - if ((si1 != 7) && (si1 != 1)) {
17092 - restore_flags(flags);
17093 - if (dev->net_verbose > 1)
17094 - printk(KERN_INFO "isdn_net: Service-Indicator not 1 or 7, ignored\n");
17095 - return 0;
17096 - }
17097 -
17098 -n = (isdn_net_phone *) 0;
17099 -p = dev->netdev;
17100 + /* Accept only calls with Si1 = 7 (Data-Transmission) */
17101 + if (si1 != 7) {
17102 + restore_flags(flags);
17103 + if (dev->net_verbose > 1)
17104 + printk(KERN_INFO "isdn_net: Service-Indicator not 7, ignored\n");
17105 + return 0;
17106 + }
17107 + n = (isdn_net_phone *) 0;
17108 + p = dev->netdev;
17109 ematch = wret = swapped = 0;
17110 #ifdef ISDN_DEBUG_NET_ICALL
17111 printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=%d\n", di, ch, idx,
17112 @@ -2212,25 +2968,8 @@ p = dev->netdev;
17113 break;
17114 }
17115 swapped = 0;
17116 - /* check acceptable call types for DOV */
17117 - my_eaz = isdn_map_eaz2msn(lp->msn, di);
17118 - if (si1 == 1) { /* it's a DOV call, check if we allow it */
17119 - if (*my_eaz == 'v' || *my_eaz == 'V' ||
17120 - *my_eaz == 'b' || *my_eaz == 'B')
17121 - my_eaz++; /* skip to allow a match */
17122 - else
17123 - my_eaz = 0; /* force non match */
17124 - } else { /* it's a DATA call, check if we allow it */
17125 - if (*my_eaz == 'b' || *my_eaz == 'B')
17126 - my_eaz++; /* skip to allow a match */
17127 - }
17128 - if (my_eaz)
17129 - matchret = isdn_msncmp(eaz, my_eaz);
17130 - else
17131 - matchret = 1;
17132 - if (!matchret)
17133 - ematch = 1;
17134 -
17135 + if (!(matchret = isdn_msncmp(eaz, isdn_map_eaz2msn(lp->msn, di))))
17136 + ematch = 1;
17137 /* Remember if more numbers eventually can match */
17138 if (matchret > wret)
17139 wret = matchret;
17140 @@ -2238,17 +2977,122 @@ p = dev->netdev;
17141 printk(KERN_DEBUG "n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n",
17142 lp->name, lp->msn, lp->flags, lp->dialstate);
17143 #endif
17144 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
17145 + if ((!matchret) && /* EAZ is matching */
17146 + (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */
17147 + (USG_NONE(dev->usage[idx]))) || /* and ch. unused or */
17148 + (lp->dialstate == 4) || (lp->dialstate == 12) || /* if dialing */
17149 + ((lp->flags & ISDN_NET_CBOUT) != 0 && /* init a callback */
17150 + lp->outgoing != 0 )))
17151 +
17152 + /*
17153 + ** we dont stop call's anymore (both sides call's syncron)
17154 + ** it will be problem in any case.
17155 + ** both sides will make the same.
17156 + ** i try later to make a switch (check the phon-numbers)
17157 + ** to detect with side must be stop the call.
17158 + */
17159 +#else
17160 if ((!matchret) && /* EAZ is matching */
17161 (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */
17162 (USG_NONE(dev->usage[idx]))) || /* and ch. unused or */
17163 ((((lp->dialstate == 4) || (lp->dialstate == 12)) && /* if dialing */
17164 (!(lp->flags & ISDN_NET_CALLBACK))) /* but no callback */
17165 )))
17166 +#endif
17167 {
17168 #ifdef ISDN_DEBUG_NET_ICALL
17169 printk(KERN_DEBUG "n_fi: match1, pdev=%d pch=%d\n",
17170 lp->pre_device, lp->pre_channel);
17171 #endif
17172 +#ifdef CONFIG_ISDN_WITH_ABC
17173 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
17174 + {
17175 + int use_this_call = 0;
17176 +
17177 + if(!(lp->flags & ISDN_NET_CBOUT) && ((lp->dialstate == 4) || (lp->dialstate == 12))) {
17178 +
17179 + /*
17180 + ** searching for a diff. in the calling-number and the EAZ
17181 + ** the remote will make the same
17182 + */
17183 +
17184 + char *pnr = nr;
17185 + char *pea = eaz;
17186 +
17187 + for(;*pnr;pnr++);
17188 + for(;*pea;pea++);
17189 + for(pnr--,pea--;pnr >= nr && pea >= eaz && *pea != *pnr;pnr--,pea--);
17190 +
17191 + if(pnr < nr || pea < eaz || *pea > *pnr) {
17192 +
17193 + p = (isdn_net_dev *) p->next;
17194 + continue;
17195 + }
17196 +
17197 + use_this_call = 1;
17198 + }
17199 +
17200 + if( use_this_call ||
17201 + ((lp->flags & ISDN_NET_CBOUT) && (lp->flags & ISDN_NET_CONNECTED))) {
17202 +
17203 + /*
17204 + ** the incoming call was to quick.
17205 + ** the callback-delay-time ist not reached.
17206 + ** in that case we can stop the call
17207 + */
17208 +
17209 + if(lp->isdn_device > -1 && lp->isdn_channel > -1) {
17210 +
17211 + int minor = isdn_dc2minor(lp->isdn_device,lp->isdn_channel);
17212 +
17213 + if(lp->isdn_device != di || lp->isdn_channel != ch) {
17214 +
17215 + isdn_ctrl cmd;
17216 +
17217 + memset((void *)&cmd,0,sizeof(cmd));
17218 + cmd.driver = lp->isdn_device;
17219 + cmd.command = ISDN_CMD_HANGUP;
17220 + cmd.arg = lp->isdn_channel;
17221 + (void) dev->drv[cmd.driver]->interface->command(&cmd);
17222 + isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
17223 +
17224 + if(dev->net_verbose > 1) {
17225 +
17226 + printk(KERN_INFO
17227 + "%s: found outgoing call hangup old call on di %d ch %d\n",
17228 + lp->name,lp->isdn_device,lp->isdn_channel);
17229 + }
17230 +
17231 + } else if (dev->net_verbose > 1) {
17232 +
17233 + printk(KERN_INFO "%s: found outgoing call on same di %d ch %d\n",
17234 + lp->name,lp->isdn_device,lp->isdn_channel);
17235 + }
17236 +
17237 + if(minor >= 0) {
17238 +
17239 + dev->rx_netdev[minor] = NULL;
17240 + dev->st_netdev[minor] = NULL;
17241 + }
17242 +
17243 + isdn_free_channel(lp->isdn_device,
17244 + lp->isdn_channel, ISDN_USAGE_NET);
17245 +
17246 + } else if (dev->net_verbose > 1) {
17247 +
17248 + printk(KERN_INFO "%s: found outgoing call reset callstate \n",lp->name);
17249 + }
17250 +
17251 + lp->flags &= ~ISDN_NET_CONNECTED;
17252 + lp->isdn_device = -1;
17253 + lp->isdn_channel = -1;
17254 + lp->dtimer = 0;
17255 + lp->dialstate = 0;
17256 + }
17257 + }
17258 +#endif
17259 +#endif
17260 if (dev->usage[idx] & ISDN_USAGE_EXCLUSIVE) {
17261 if ((lp->pre_channel != ch) ||
17262 (lp->pre_device != di)) {
17263 @@ -2377,6 +3221,12 @@ p = dev->netdev;
17264 continue;
17265 }
17266 }
17267 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
17268 + if(isdn_dwabc_is_interface_disabled(lp)) {
17269 + restore_flags(flags);
17270 + return 3;
17271 + }
17272 +#endif
17273 if (lp->flags & ISDN_NET_CALLBACK) {
17274 int chi;
17275 /*
17276 @@ -2429,6 +3279,47 @@ p = dev->netdev;
17277 restore_flags(flags);
17278 return 0;
17279 } else {
17280 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
17281 + {
17282 + /*
17283 + ** this is a sanity-check.
17284 + ** check for double use (device and channel)
17285 + ** will be very near to a kernel-crash in that case
17286 + */
17287 + isdn_net_dev *sp = dev->netdev;
17288 + int s_shl;
17289 + isdn_net_local *ml;
17290 +
17291 + for(s_shl=0; s_shl < 2048 && sp != NULL; sp = (isdn_net_dev *)sp->next, s_shl++) {
17292 +
17293 + if(sp == p || (ml = sp->local) == NULL)
17294 + continue;
17295 +
17296 + if(ml->isdn_device != di || ml->isdn_channel != ch)
17297 + continue;
17298 +
17299 + if(ml->dialstate != 4 && ml->dialstate != 12) {
17300 +
17301 + /*
17302 + ** wrong situation
17303 + */
17304 + break;
17305 + }
17306 +
17307 + isdn_net_unbind_channel(ml);
17308 + }
17309 +
17310 + if(sp != NULL) {
17311 +
17312 + printk(KERN_DEBUG
17313 +"%s: call from %s -> %s (drv %d chan %d duplicated with %s) \n",
17314 + lp->name, nr, eaz,di,ch,
17315 + sp->local->name );
17316 +
17317 + restore_flags(flags);
17318 + return 3;
17319 + }}
17320 +#endif
17321 printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", lp->name, nr,
17322 eaz);
17323 /* if this interface is dialing, it does it probably on a different
17324 @@ -2518,7 +3409,11 @@ isdn_net_force_dial_lp(isdn_net_local *
17325 lp->l3_proto,
17326 lp->pre_device,
17327 lp->pre_channel,
17328 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
17329 + (*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn)
17330 +#else
17331 lp->msn)
17332 +#endif
17333 ) < 0) {
17334 printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n", lp->name);
17335 restore_flags(flags);
17336 @@ -2601,7 +3496,11 @@ isdn_net_new(char *name, struct net_devi
17337 strcpy(netdev->local->name, " ");
17338 else
17339 strcpy(netdev->local->name, name);
17340 +#ifdef COMPAT_NO_SOFTNET
17341 + netdev->dev.name = netdev->local->name;
17342 +#else
17343 strcpy(netdev->dev.name, netdev->local->name);
17344 +#endif
17345 netdev->dev.priv = netdev->local;
17346 netdev->dev.init = isdn_net_init;
17347 netdev->local->p_encap = ISDN_NET_ENCAP_RAWIP;
17348 @@ -2619,11 +3518,13 @@ isdn_net_new(char *name, struct net_devi
17349 ((isdn_net_local *) q->priv)->slave = &(netdev->dev);
17350 } else {
17351 /* Device shall be a master */
17352 +#ifndef COMPAT_NO_SOFTNET
17353 /*
17354 * Watchdog timer (currently) for master only.
17355 */
17356 netdev->dev.tx_timeout = isdn_net_tx_timeout;
17357 netdev->dev.watchdog_timeo = ISDN_NET_TX_TIMEOUT;
17358 +#endif
17359 if (register_netdev(&netdev->dev) != 0) {
17360 printk(KERN_WARNING "isdn_net: Could not register net-device\n");
17361 kfree(netdev->local);
17362 @@ -2660,6 +3561,9 @@ isdn_net_new(char *name, struct net_devi
17363 netdev->local->hupflags = ISDN_INHUP; /* Do hangup even on incoming calls */
17364 netdev->local->onhtime = 10; /* Default hangup-time for saving costs
17365 of those who forget configuring this */
17366 +#ifdef CONFIG_ISDN_WITH_ABC
17367 + netdev->local->dw_abc_old_onhtime = netdev->local->onhtime;
17368 +#endif
17369 netdev->local->dialmax = 1;
17370 netdev->local->flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL; /* Hangup before Callback, manual dial */
17371 netdev->local->cbdelay = 25; /* Wait 5 secs before Callback */
17372 @@ -2833,7 +3737,6 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg
17373
17374 /* If binding is exclusive, try to grab the channel */
17375 save_flags(flags);
17376 - cli();
17377 if ((i = isdn_get_free_channel(ISDN_USAGE_NET,
17378 lp->l2_proto, lp->l3_proto, drvidx,
17379 chidx, lp->msn)) < 0) {
17380 @@ -2862,6 +3765,9 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg
17381 lp->pre_device = drvidx;
17382 lp->pre_channel = chidx;
17383 lp->onhtime = cfg->onhtime;
17384 +#ifdef CONFIG_ISDN_WITH_ABC
17385 + lp->dw_abc_old_onhtime = lp->onhtime;
17386 +#endif
17387 lp->charge = cfg->charge;
17388 lp->l2_proto = cfg->l2_proto;
17389 lp->l3_proto = cfg->l3_proto;
17390 @@ -2935,6 +3841,9 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg
17391 }
17392 }
17393 lp->p_encap = cfg->p_encap;
17394 +#ifdef CONFIG_ISDN_WITH_ABC
17395 + isdn_dw_abc_reset_interface(lp,0);
17396 +#endif
17397 return 0;
17398 }
17399 return -ENODEV;
17400 @@ -3011,6 +3920,9 @@ isdn_net_addphone(isdn_net_ioctl_phone *
17401 n->num[sizeof(n->num) - 1] = 0;
17402 n->next = p->local->phone[phone->outgoing & 1];
17403 p->local->phone[phone->outgoing & 1] = n;
17404 +#ifdef CONFIG_ISDN_WITH_ABC
17405 + isdn_dwabc_test_phone(p->local);
17406 +#endif
17407 return 0;
17408 }
17409 return -ENODEV;
17410 @@ -3104,6 +4016,9 @@ isdn_net_delphone(isdn_net_ioctl_phone *
17411 else
17412 p->local->phone[inout] = n->next;
17413 kfree(n);
17414 +#ifdef CONFIG_ISDN_WITH_ABC
17415 + isdn_dwabc_test_phone(p->local);
17416 +#endif
17417 restore_flags(flags);
17418 return 0;
17419 }
17420 @@ -3139,6 +4054,9 @@ isdn_net_rmallphone(isdn_net_dev * p)
17421 p->local->phone[i] = NULL;
17422 }
17423 p->local->dial = NULL;
17424 +#ifdef CONFIG_ISDN_WITH_ABC
17425 + isdn_dwabc_test_phone(p->local);
17426 +#endif
17427 restore_flags(flags);
17428 return 0;
17429 }
17430 @@ -3222,6 +4140,10 @@ isdn_net_realrm(isdn_net_dev * p, isdn_n
17431 /* If no more net-devices remain, disable auto-hangup timer */
17432 if (dev->netdev == NULL)
17433 isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 0);
17434 +#ifdef CONFIG_ISDN_WITH_ABC
17435 + isdn_dw_clear_if(~0l,p->local);
17436 + dwabc_bsd_free(p->local);
17437 +#endif
17438 restore_flags(flags);
17439 kfree(p->local);
17440 kfree(p);
17441 --- a/drivers/isdn/isdn_net.h
17442 +++ b/drivers/isdn/isdn_net.h
17443 @@ -1,4 +1,4 @@
17444 -/* $Id: isdn_net.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
17445 +/* $Id: isdn_net.h,v 1.23 2001/11/07 22:35:48 kai Exp $
17446 *
17447 * header for Linux ISDN subsystem, network related functions (linklevel).
17448 *
17449 @@ -26,6 +26,7 @@
17450 #define CISCO_ADDR_BROADCAST 0x8f
17451 #define CISCO_CTRL 0x00
17452 #define CISCO_TYPE_CDP 0x2000
17453 +#define CISCO_TYPE_INET 0x0800
17454 #define CISCO_TYPE_SLARP 0x8035
17455 #define CISCO_SLARP_REQUEST 0
17456 #define CISCO_SLARP_REPLY 1
17457 @@ -106,8 +107,6 @@ static __inline__ void isdn_net_add_to_b
17458 spin_lock_irqsave(&nd->queue_lock, flags);
17459
17460 lp = nd->queue;
17461 -// printk(KERN_DEBUG __FUNCTION__": lp:%s(%p) nlp:%s(%p) last(%p)\n",
17462 -// lp->name, lp, nlp->name, nlp, lp->last);
17463 nlp->last = lp->last;
17464 lp->last->next = nlp;
17465 lp->last = nlp;
17466 @@ -127,20 +126,12 @@ static __inline__ void isdn_net_rm_from_
17467 if (lp->master)
17468 master_lp = (isdn_net_local *) lp->master->priv;
17469
17470 -// printk(KERN_DEBUG __FUNCTION__": lp:%s(%p) mlp:%s(%p) last(%p) next(%p) mndq(%p)\n",
17471 -// lp->name, lp, master_lp->name, master_lp, lp->last, lp->next, master_lp->netdev->queue);
17472 spin_lock_irqsave(&master_lp->netdev->queue_lock, flags);
17473 lp->last->next = lp->next;
17474 lp->next->last = lp->last;
17475 - if (master_lp->netdev->queue == lp) {
17476 + if (master_lp->netdev->queue == lp)
17477 master_lp->netdev->queue = lp->next;
17478 - if (lp->next == lp) { /* last in queue */
17479 - master_lp->netdev->queue = master_lp->netdev->local;
17480 - }
17481 - }
17482 lp->next = lp->last = lp; /* (re)set own pointers */
17483 -// printk(KERN_DEBUG __FUNCTION__": mndq(%p)\n",
17484 -// master_lp->netdev->queue);
17485 spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags);
17486 }
17487
17488 --- a/drivers/isdn/isdn_ppp.c
17489 +++ b/drivers/isdn/isdn_ppp.c
17490 @@ -1,4 +1,4 @@
17491 -/* $Id: isdn_ppp.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
17492 +/* $Id: isdn_ppp.c,v 1.94 2001/11/07 22:35:48 kai Exp $
17493 *
17494 * Linux ISDN subsystem, functions for synchronous PPP (linklevel).
17495 *
17496 @@ -13,9 +13,6 @@
17497 #include <linux/isdn.h>
17498 #include <linux/poll.h>
17499 #include <linux/ppp-comp.h>
17500 -#ifdef CONFIG_IPPP_FILTER
17501 -#include <linux/filter.h>
17502 -#endif
17503
17504 #include "isdn_common.h"
17505 #include "isdn_ppp.h"
17506 @@ -72,11 +69,19 @@ static void isdn_ppp_mp_cleanup( isdn_ne
17507 static int isdn_ppp_bundle(struct ippp_struct *, int unit);
17508 #endif /* CONFIG_ISDN_MPP */
17509
17510 -char *isdn_ppp_revision = "$Revision: 1.1.4.1 $";
17511 +char *isdn_ppp_revision = "$Revision: 1.94 $";
17512
17513 static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS];
17514
17515 +#ifndef CONFIG_ISDN_WITH_ABC
17516 static struct isdn_ppp_compressor *ipc_head = NULL;
17517 +#else
17518 + /*
17519 + ** make compressor's common usable
17520 + */
17521 +struct isdn_ppp_compressor *isdn_ippp_comp_head = NULL;
17522 +#define ipc_head isdn_ippp_comp_head
17523 +#endif
17524
17525 /*
17526 * frame log (debug)
17527 @@ -110,11 +115,8 @@ isdn_ppp_free(isdn_net_local * lp)
17528 unsigned long flags;
17529 struct ippp_struct *is;
17530
17531 - if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
17532 - printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
17533 - __FUNCTION__, lp->ppp_slot);
17534 + if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS)
17535 return 0;
17536 - }
17537
17538 save_flags(flags);
17539 cli();
17540 @@ -130,12 +132,7 @@ isdn_ppp_free(isdn_net_local * lp)
17541 lp->netdev->pb->ref_ct--;
17542 spin_unlock(&lp->netdev->pb->lock);
17543 #endif /* CONFIG_ISDN_MPP */
17544 - if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
17545 - printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n",
17546 - __FUNCTION__, lp->ppp_slot);
17547 - restore_flags(flags);
17548 - return 0;
17549 - }
17550 +
17551 is = ippp_table[lp->ppp_slot];
17552 if ((is->state & IPPP_CONNECT))
17553 isdn_ppp_closewait(lp->ppp_slot); /* force wakeup on ippp device */
17554 @@ -231,13 +228,12 @@ isdn_ppp_bind(isdn_net_local * lp)
17555 void
17556 isdn_ppp_wakeup_daemon(isdn_net_local * lp)
17557 {
17558 - if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
17559 - printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
17560 - __FUNCTION__, lp->ppp_slot);
17561 + if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS)
17562 return;
17563 - }
17564 +
17565 ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK;
17566 - wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq);
17567 +
17568 + wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq);
17569 }
17570
17571 /*
17572 @@ -250,14 +246,13 @@ isdn_ppp_closewait(int slot)
17573 {
17574 struct ippp_struct *is;
17575
17576 - if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
17577 - printk(KERN_ERR "%s: slot(%d) out of range\n",
17578 - __FUNCTION__, slot);
17579 + if (slot < 0 || slot >= ISDN_MAX_CHANNELS)
17580 return 0;
17581 - }
17582 is = ippp_table[slot];
17583 +
17584 if (is->state)
17585 wake_up_interruptible(&is->wq);
17586 +
17587 is->state = IPPP_CLOSEWAIT;
17588 return 1;
17589 }
17590 @@ -295,9 +290,11 @@ isdn_ppp_open(int min, struct file *file
17591 return -EBUSY;
17592 }
17593 is = file->private_data = ippp_table[slot];
17594 -
17595 - printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n",
17596 - slot, min, is->state);
17597 +
17598 +#if 0
17599 + if (is->debug & 0x1)
17600 +#endif
17601 + printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n", slot, min, is->state);
17602
17603 /* compression stuff */
17604 is->link_compressor = is->compressor = NULL;
17605 @@ -327,10 +324,7 @@ isdn_ppp_open(int min, struct file *file
17606 */
17607 is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */
17608 #endif
17609 -#ifdef CONFIG_IPPP_FILTER
17610 - is->pass_filter.filter = NULL;
17611 - is->active_filter.filter = NULL;
17612 -#endif
17613 +
17614 is->state = IPPP_OPEN;
17615
17616 return 0;
17617 @@ -349,20 +343,12 @@ isdn_ppp_release(int min, struct file *f
17618 return;
17619 is = file->private_data;
17620
17621 - if (!is) {
17622 - printk(KERN_ERR "%s: no file->private_data\n", __FUNCTION__);
17623 - return;
17624 - }
17625 if (is->debug & 0x1)
17626 printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", min, (long) is->lp);
17627
17628 if (is->lp) { /* a lp address says: this link is still up */
17629 isdn_net_dev *p = is->lp->netdev;
17630
17631 - if (!p) {
17632 - printk(KERN_ERR "%s: no lp->netdev\n", __FUNCTION__);
17633 - return;
17634 - }
17635 is->state &= ~IPPP_CONNECT; /* -> effect: no call of wakeup */
17636 /*
17637 * isdn_net_hangup() calls isdn_ppp_free()
17638 @@ -385,18 +371,8 @@ isdn_ppp_release(int min, struct file *f
17639 slhc_free(is->slcomp);
17640 is->slcomp = NULL;
17641 #endif
17642 -#ifdef CONFIG_IPPP_FILTER
17643 - if (is->pass_filter.filter) {
17644 - kfree(is->pass_filter.filter);
17645 - is->pass_filter.filter = NULL;
17646 - }
17647 - if (is->active_filter.filter) {
17648 - kfree(is->active_filter.filter);
17649 - is->active_filter.filter = NULL;
17650 - }
17651 -#endif
17652
17653 -/* TODO: if this was the previous master: link the stuff to the new master */
17654 +/* TODO: if this was the previous master: link the the stuff to the new master */
17655 if(is->comp_stat)
17656 is->compressor->free(is->comp_stat);
17657 if(is->link_comp_stat)
17658 @@ -509,13 +485,15 @@ isdn_ppp_ioctl(int min, struct file *fil
17659 if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) {
17660 if (lp) {
17661 /* OK .. we are ready to send buffers */
17662 - is->pppcfg = val; /* isdn_ppp_xmit test for SC_ENABLE_IP !!! */
17663 netif_wake_queue(&lp->netdev->dev);
17664 - break;
17665 }
17666 }
17667 is->pppcfg = val;
17668 break;
17669 +#if 0
17670 + case PPPIOCGSTAT: /* read PPP statistic information */
17671 + break;
17672 +#endif
17673 case PPPIOCGIDLE: /* get idle time information */
17674 if (lp) {
17675 struct ppp_idle pidle;
17676 @@ -604,39 +582,6 @@ isdn_ppp_ioctl(int min, struct file *fil
17677 }
17678 return set_arg((void *)arg,&pci,sizeof(struct pppcallinfo));
17679 }
17680 -#ifdef CONFIG_IPPP_FILTER
17681 - case PPPIOCSPASS:
17682 - case PPPIOCSACTIVE:
17683 - {
17684 - struct sock_fprog uprog, *filtp;
17685 - struct sock_filter *code = NULL;
17686 - int len, err;
17687 -
17688 - if (copy_from_user(&uprog, (void *) arg, sizeof(uprog)))
17689 - return -EFAULT;
17690 - if (uprog.len > 0 && uprog.len < 65536) {
17691 - len = uprog.len * sizeof(struct sock_filter);
17692 - code = kmalloc(len, GFP_KERNEL);
17693 - if (code == NULL)
17694 - return -ENOMEM;
17695 - if (copy_from_user(code, uprog.filter, len)) {
17696 - kfree(code);
17697 - return -EFAULT;
17698 - }
17699 - err = sk_chk_filter(code, uprog.len);
17700 - if (err) {
17701 - kfree(code);
17702 - return err;
17703 - }
17704 - }
17705 - filtp = (cmd == PPPIOCSPASS) ? &is->pass_filter : &is->active_filter;
17706 - if (filtp->filter)
17707 - kfree(filtp->filter);
17708 - filtp->filter = code;
17709 - filtp->len = uprog.len;
17710 - break;
17711 - }
17712 -#endif /* CONFIG_IPPP_FILTER */
17713 default:
17714 break;
17715 }
17716 @@ -699,7 +644,7 @@ isdn_ppp_fill_rq(unsigned char *buf, int
17717 struct ippp_struct *is;
17718
17719 if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
17720 - printk(KERN_WARNING "ippp: illegal slot(%d).\n", slot);
17721 + printk(KERN_WARNING "ippp: illegal slot.\n");
17722 return 0;
17723 }
17724 is = ippp_table[slot];
17725 @@ -976,8 +921,7 @@ void isdn_ppp_receive(isdn_net_dev * net
17726
17727 slot = lp->ppp_slot;
17728 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17729 - printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot(%d)\n",
17730 - lp->ppp_slot);
17731 + printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot %d\n", lp->ppp_slot);
17732 kfree_skb(skb);
17733 return;
17734 }
17735 @@ -1026,23 +970,19 @@ isdn_ppp_push_higher(isdn_net_dev * net_
17736 {
17737 struct net_device *dev = &net_dev->dev;
17738 struct ippp_struct *is, *mis;
17739 - isdn_net_local *mlp = NULL;
17740 int slot;
17741
17742 slot = lp->ppp_slot;
17743 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17744 - printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot(%d)\n",
17745 - lp->ppp_slot);
17746 + printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot %d\n", lp->ppp_slot);
17747 goto drop_packet;
17748 }
17749 is = ippp_table[slot];
17750
17751 if (lp->master) { // FIXME?
17752 - mlp = (isdn_net_local *) lp->master->priv;
17753 - slot = mlp->ppp_slot;
17754 + slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
17755 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17756 - printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n",
17757 - lp->ppp_slot);
17758 + printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot %d\n", lp->ppp_slot);
17759 goto drop_packet;
17760 }
17761 }
17762 @@ -1076,11 +1016,6 @@ isdn_ppp_push_higher(isdn_net_dev * net_
17763 case PPP_VJC_UNCOMP:
17764 if (is->debug & 0x20)
17765 printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n");
17766 - if (net_dev->local->ppp_slot < 0) {
17767 - printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n",
17768 - __FUNCTION__, net_dev->local->ppp_slot);
17769 - goto drop_packet;
17770 - }
17771 if (slhc_remember(ippp_table[net_dev->local->ppp_slot]->slcomp, skb->data, skb->len) <= 0) {
17772 printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n");
17773 goto drop_packet;
17774 @@ -1102,11 +1037,6 @@ isdn_ppp_push_higher(isdn_net_dev * net_
17775 }
17776 skb_put(skb, skb_old->len + 128);
17777 memcpy(skb->data, skb_old->data, skb_old->len);
17778 - if (net_dev->local->ppp_slot < 0) {
17779 - printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n",
17780 - __FUNCTION__, net_dev->local->ppp_slot);
17781 - goto drop_packet;
17782 - }
17783 pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp,
17784 skb->data, skb_old->len);
17785 kfree_skb(skb_old);
17786 @@ -1133,36 +1063,12 @@ isdn_ppp_push_higher(isdn_net_dev * net_
17787 return;
17788 }
17789
17790 -#ifdef CONFIG_IPPP_FILTER
17791 - /* check if the packet passes the pass and active filters
17792 - * the filter instructions are constructed assuming
17793 - * a four-byte PPP header on each packet (which is still present) */
17794 - skb_push(skb, 4);
17795 - skb->data[0] = 0; /* indicate inbound */
17796 -
17797 - if (is->pass_filter.filter
17798 - && sk_run_filter(skb, is->pass_filter.filter,
17799 - is->pass_filter.len) == 0) {
17800 - if (is->debug & 0x2)
17801 - printk(KERN_DEBUG "IPPP: inbound frame filtered.\n");
17802 - kfree_skb(skb);
17803 - return;
17804 - }
17805 - if (!(is->active_filter.filter
17806 - && sk_run_filter(skb, is->active_filter.filter,
17807 - is->active_filter.len) == 0)) {
17808 - if (is->debug & 0x2)
17809 - printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
17810 - lp->huptimer = 0;
17811 - if (mlp)
17812 - mlp->huptimer = 0;
17813 - }
17814 - skb_pull(skb, 4);
17815 -#else /* CONFIG_IPPP_FILTER */
17816 - lp->huptimer = 0;
17817 - if (mlp)
17818 - mlp->huptimer = 0;
17819 -#endif /* CONFIG_IPPP_FILTER */
17820 + /* Reset hangup-timer */
17821 + lp->huptimer = 0;
17822 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
17823 + lp->dw_abc_bchan_errcnt = 0;
17824 +#endif
17825 +
17826 skb->dev = dev;
17827 skb->mac.raw = skb->data;
17828 netif_rx(skb);
17829 @@ -1199,6 +1105,7 @@ static unsigned char *isdn_ppp_skb_push(
17830 return skb_push(skb,len);
17831 }
17832
17833 +
17834 /*
17835 * send ppp frame .. we expect a PIDCOMPressable proto --
17836 * (here: currently always PPP_IP,PPP_VJC_COMP,PPP_VJC_UNCOMP)
17837 @@ -1214,25 +1121,23 @@ isdn_ppp_xmit(struct sk_buff *skb, struc
17838 isdn_net_dev *nd;
17839 unsigned int proto = PPP_IP; /* 0x21 */
17840 struct ippp_struct *ipt,*ipts;
17841 - int slot, retval = 0;
17842 + int slot;
17843
17844 mlp = (isdn_net_local *) (netdev->priv);
17845 nd = mlp->netdev; /* get master lp */
17846
17847 slot = mlp->ppp_slot;
17848 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17849 - printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
17850 - mlp->ppp_slot);
17851 + printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot %d\n", mlp->ppp_slot);
17852 kfree_skb(skb);
17853 - goto out;
17854 + return 0;
17855 }
17856 ipts = ippp_table[slot];
17857
17858 if (!(ipts->pppcfg & SC_ENABLE_IP)) { /* PPP connected ? */
17859 if (ipts->debug & 0x1)
17860 printk(KERN_INFO "%s: IP frame delayed.\n", netdev->name);
17861 - retval = 1;
17862 - goto out;
17863 + return 1;
17864 }
17865
17866 switch (ntohs(skb->protocol)) {
17867 @@ -1246,25 +1151,24 @@ isdn_ppp_xmit(struct sk_buff *skb, struc
17868 printk(KERN_ERR "isdn_ppp: skipped unsupported protocol: %#x.\n",
17869 skb->protocol);
17870 dev_kfree_skb(skb);
17871 - goto out;
17872 + return 0;
17873 }
17874
17875 lp = isdn_net_get_locked_lp(nd);
17876 if (!lp) {
17877 printk(KERN_WARNING "%s: all channels busy - requeuing!\n", netdev->name);
17878 - retval = 1;
17879 - goto out;
17880 + return 1;
17881 }
17882 /* we have our lp locked from now on */
17883
17884 slot = lp->ppp_slot;
17885 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17886 - printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
17887 - lp->ppp_slot);
17888 + printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot %d\n", lp->ppp_slot);
17889 kfree_skb(skb);
17890 - goto unlock;
17891 + return 0;
17892 }
17893 ipt = ippp_table[slot];
17894 + lp->huptimer = 0;
17895
17896 /*
17897 * after this line .. requeueing in the device queue is no longer allowed!!!
17898 @@ -1275,34 +1179,6 @@ isdn_ppp_xmit(struct sk_buff *skb, struc
17899 */
17900 skb_pull(skb,IPPP_MAX_HEADER);
17901
17902 -#ifdef CONFIG_IPPP_FILTER
17903 - /* check if we should pass this packet
17904 - * the filter instructions are constructed assuming
17905 - * a four-byte PPP header on each packet */
17906 - skb_push(skb, 4);
17907 - skb->data[0] = 1; /* indicate outbound */
17908 - *(u_int16_t *)(skb->data + 2) = htons(proto);
17909 -
17910 - if (ipt->pass_filter.filter
17911 - && sk_run_filter(skb, ipt->pass_filter.filter,
17912 - ipt->pass_filter.len) == 0) {
17913 - if (ipt->debug & 0x4)
17914 - printk(KERN_DEBUG "IPPP: outbound frame filtered.\n");
17915 - kfree_skb(skb);
17916 - goto unlock;
17917 - }
17918 - if (!(ipt->active_filter.filter
17919 - && sk_run_filter(skb, ipt->active_filter.filter,
17920 - ipt->active_filter.len) == 0)) {
17921 - if (ipt->debug & 0x4)
17922 - printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
17923 - lp->huptimer = 0;
17924 - }
17925 - skb_pull(skb, 4);
17926 -#else /* CONFIG_IPPP_FILTER */
17927 - lp->huptimer = 0;
17928 -#endif /* CONFIG_IPPP_FILTER */
17929 -
17930 if (ipt->debug & 0x4)
17931 printk(KERN_DEBUG "xmit skb, len %d\n", (int) skb->len);
17932 if (ipts->debug & 0x40)
17933 @@ -1440,54 +1316,9 @@ isdn_ppp_xmit(struct sk_buff *skb, struc
17934
17935 unlock:
17936 spin_unlock_bh(&lp->xmit_lock);
17937 - out:
17938 - return retval;
17939 + return 0;
17940 }
17941
17942 -#ifdef CONFIG_IPPP_FILTER
17943 -/*
17944 - * check if this packet may trigger auto-dial.
17945 - */
17946 -
17947 -int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp)
17948 -{
17949 - struct ippp_struct *is = ippp_table[lp->ppp_slot];
17950 - u_int16_t proto;
17951 - int drop = 0;
17952 -
17953 - switch (ntohs(skb->protocol)) {
17954 - case ETH_P_IP:
17955 - proto = PPP_IP;
17956 - break;
17957 - case ETH_P_IPX:
17958 - proto = PPP_IPX;
17959 - break;
17960 - default:
17961 - printk(KERN_ERR "isdn_ppp_autodial_filter: unsupported protocol 0x%x.\n",
17962 - skb->protocol);
17963 - return 1;
17964 - }
17965 -
17966 - /* the filter instructions are constructed assuming
17967 - * a four-byte PPP header on each packet. we have to
17968 - * temporarily remove part of the fake header stuck on
17969 - * earlier.
17970 - */
17971 - skb_pull(skb, IPPP_MAX_HEADER - 4);
17972 - skb->data[0] = 1; /* indicate outbound */
17973 - *(u_int16_t *)(skb->data + 2) = htons(proto);
17974 -
17975 - drop |= is->pass_filter.filter
17976 - && sk_run_filter(skb, is->pass_filter.filter,
17977 - is->pass_filter.len) == 0;
17978 - drop |= is->active_filter.filter
17979 - && sk_run_filter(skb, is->active_filter.filter,
17980 - is->active_filter.len) == 0;
17981 -
17982 - skb_push(skb, IPPP_MAX_HEADER - 4);
17983 - return drop;
17984 -}
17985 -#endif
17986 #ifdef CONFIG_ISDN_MPP
17987
17988 /* this is _not_ rfc1990 header, but something we convert both short and long
17989 @@ -1537,15 +1368,8 @@ static ippp_bundle * isdn_ppp_mp_bundle_
17990
17991 static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to )
17992 {
17993 - struct ippp_struct * is;
17994 -
17995 - if (lp->ppp_slot < 0) {
17996 - printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
17997 - __FUNCTION__, lp->ppp_slot);
17998 - return(-EINVAL);
17999 - }
18000 -
18001 - is = ippp_table[lp->ppp_slot];
18002 + struct ippp_struct * is = ippp_table[lp->ppp_slot];
18003 +
18004 if (add_to) {
18005 if( lp->netdev->pb )
18006 lp->netdev->pb->ref_ct--;
18007 @@ -1591,8 +1415,7 @@ static void isdn_ppp_mp_receive(isdn_net
18008 stats = &mp->stats;
18009 slot = lp->ppp_slot;
18010 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18011 - printk(KERN_ERR "%s: lp->ppp_slot(%d)\n",
18012 - __FUNCTION__, lp->ppp_slot);
18013 + printk(KERN_ERR "isdn_ppp_mp_receive: lp->ppp_slot %d\n", lp->ppp_slot);
18014 stats->frame_drops++;
18015 dev_kfree_skb(skb);
18016 spin_unlock_irqrestore(&mp->lock, flags);
18017 @@ -1628,8 +1451,7 @@ static void isdn_ppp_mp_receive(isdn_net
18018 for (lpq = net_dev->queue;;) {
18019 slot = lpq->ppp_slot;
18020 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18021 - printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n",
18022 - __FUNCTION__, lpq->ppp_slot);
18023 + printk(KERN_ERR "isdn_ppp_mp_receive: lpq->ppp_slot %d\n", lpq->ppp_slot);
18024 } else {
18025 u32 lls = ippp_table[slot]->last_link_seqno;
18026 if (MP_LT(lls, minseq))
18027 @@ -1861,14 +1683,9 @@ void isdn_ppp_mp_reassembly( isdn_net_de
18028 struct sk_buff * skb;
18029 unsigned int tot_len;
18030
18031 - if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
18032 - printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
18033 - __FUNCTION__, lp->ppp_slot);
18034 - return;
18035 - }
18036 if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) {
18037 if( ippp_table[lp->ppp_slot]->debug & 0x40 )
18038 - printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, "
18039 + printk(KERN_DEBUG"isdn_mppp: reassembly: frame %d, "
18040 "len %d\n", MP_SEQ(from), from->len );
18041 skb = from;
18042 skb_pull(skb, MP_HEADER_LEN);
18043 @@ -1987,10 +1804,8 @@ isdn_ppp_dev_ioctl_stats(int slot, struc
18044 memset(&t, 0, sizeof(struct ppp_stats));
18045 if (dev->flags & IFF_UP) {
18046 t.p.ppp_ipackets = lp->stats.rx_packets;
18047 - t.p.ppp_ibytes = lp->stats.rx_bytes;
18048 t.p.ppp_ierrors = lp->stats.rx_errors;
18049 t.p.ppp_opackets = lp->stats.tx_packets;
18050 - t.p.ppp_obytes = lp->stats.tx_bytes;
18051 t.p.ppp_oerrors = lp->stats.tx_errors;
18052 #ifdef CONFIG_ISDN_PPP_VJ
18053 if (slot >= 0 && ippp_table[slot]->slcomp) {
18054 @@ -2018,6 +1833,9 @@ isdn_ppp_dev_ioctl(struct net_device *de
18055 int len;
18056 isdn_net_local *lp = (isdn_net_local *) dev->priv;
18057
18058 +#if 0
18059 + printk(KERN_DEBUG "ippp, dev_ioctl: cmd %#08x , %d \n", cmd, lp->ppp_slot);
18060 +#endif
18061
18062 if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP)
18063 return -EINVAL;
18064 @@ -2432,7 +2250,7 @@ static void isdn_ppp_ccp_reset_trans(str
18065 return;
18066 }
18067 rs->state = CCPResetSentReq;
18068 - /* We always expect an Ack if the decompressor doesn't
18069 + /* We always expect an Ack if the decompressor doesnt
18070 know better */
18071 rs->expra = 1;
18072 rs->dlen = 0;
18073 @@ -2583,7 +2401,13 @@ static struct sk_buff *isdn_ppp_compress
18074 }
18075
18076 if(type) { /* type=1 => Link compression */
18077 +#if 0
18078 + compressor = is->link_compressor;
18079 + stat = is->link_comp_stat;
18080 + new_proto = PPP_LINK_COMP;
18081 +#else
18082 return skb_in;
18083 +#endif
18084 }
18085 else {
18086 if(!master) {
18087 @@ -2631,31 +2455,18 @@ static struct sk_buff *isdn_ppp_compress
18088 static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
18089 struct sk_buff *skb,int proto)
18090 {
18091 - struct ippp_struct *is;
18092 + struct ippp_struct *is = ippp_table[lp->ppp_slot];
18093 struct ippp_struct *mis;
18094 int len;
18095 struct isdn_ppp_resetparams rsparm;
18096 unsigned char rsdata[IPPP_RESET_MAXDATABYTES];
18097
18098 - printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n",
18099 - lp->ppp_slot);
18100 - if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
18101 - printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
18102 - __FUNCTION__, lp->ppp_slot);
18103 - return;
18104 - }
18105 - is = ippp_table[lp->ppp_slot];
18106 + printk(KERN_DEBUG "Received CCP frame from peer\n");
18107 isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
18108
18109 - if(lp->master) {
18110 - int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
18111 - if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18112 - printk(KERN_ERR "%s: slot(%d) out of range\n",
18113 - __FUNCTION__, slot);
18114 - return;
18115 - }
18116 - mis = ippp_table[slot];
18117 - } else
18118 + if(lp->master)
18119 + mis = ippp_table[((isdn_net_local *) (lp->master->priv))->ppp_slot];
18120 + else
18121 mis = is;
18122
18123 switch(skb->data[0]) {
18124 @@ -2807,18 +2618,13 @@ static void isdn_ppp_receive_ccp(isdn_ne
18125
18126 static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb)
18127 {
18128 - struct ippp_struct *mis,*is;
18129 - int proto, slot = lp->ppp_slot;
18130 + struct ippp_struct *mis,*is = ippp_table[lp->ppp_slot];
18131 + int proto;
18132 unsigned char *data;
18133
18134 if(!skb || skb->len < 3)
18135 return;
18136 - if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18137 - printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
18138 - __FUNCTION__, slot);
18139 - return;
18140 - }
18141 - is = ippp_table[slot];
18142 +
18143 /* Daemon may send with or without address and control field comp */
18144 data = skb->data;
18145 if(!(is->pppcfg & SC_COMP_AC) && data[0] == 0xff && data[1] == 0x03) {
18146 @@ -2834,17 +2640,12 @@ static void isdn_ppp_send_ccp(isdn_net_d
18147 printk(KERN_DEBUG "Received CCP frame from daemon:\n");
18148 isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
18149
18150 - if (lp->master) {
18151 - slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
18152 - if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18153 - printk(KERN_ERR "%s: slot(%d) out of range\n",
18154 - __FUNCTION__, slot);
18155 - return;
18156 - }
18157 - mis = ippp_table[slot];
18158 - } else
18159 - mis = is;
18160 - if (mis != is)
18161 + if(lp->master)
18162 + mis = ippp_table[((isdn_net_local *) (lp->master->priv))->ppp_slot];
18163 + else
18164 + mis = is;
18165 +
18166 + if(mis != is)
18167 printk(KERN_DEBUG "isdn_ppp: Ouch! Master CCP sends on slave slot!\n");
18168
18169 switch(data[2]) {
18170 --- a/drivers/isdn/isdn_ppp.h
18171 +++ b/drivers/isdn/isdn_ppp.h
18172 @@ -1,4 +1,4 @@
18173 -/* $Id: isdn_ppp.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18174 +/* $Id: isdn_ppp.h,v 1.18 2001/09/24 13:22:42 kai Exp $
18175 *
18176 * header for Linux ISDN subsystem, functions for synchronous PPP (linklevel).
18177 *
18178 @@ -19,7 +19,6 @@ extern int isdn_ppp_init(void);
18179 extern void isdn_ppp_cleanup(void);
18180 extern int isdn_ppp_free(isdn_net_local *);
18181 extern int isdn_ppp_bind(isdn_net_local *);
18182 -extern int isdn_ppp_autodial_filter(struct sk_buff *, isdn_net_local *);
18183 extern int isdn_ppp_xmit(struct sk_buff *, struct net_device *);
18184 extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *);
18185 extern int isdn_ppp_dev_ioctl(struct net_device *, struct ifreq *, int);
18186 --- a/drivers/isdn/isdn_tty.c
18187 +++ b/drivers/isdn/isdn_tty.c
18188 @@ -1,4 +1,4 @@
18189 -/* $Id: isdn_tty.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18190 +/* $Id: isdn_tty.c,v 1.104 2002/02/09 21:19:11 keil Exp $
18191 *
18192 * Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
18193 *
18194 @@ -53,7 +53,7 @@ static int bit2si[8] =
18195 static int si2bit[8] =
18196 {4, 1, 4, 4, 4, 4, 4, 4};
18197
18198 -char *isdn_tty_revision = "$Revision: 1.1.4.1 $";
18199 +char *isdn_tty_revision = "$Revision: 1.104 $";
18200
18201
18202 /* isdn_tty_try_read() is called from within isdn_tty_rcv_skb()
18203 @@ -321,7 +321,10 @@ isdn_tty_tint(modem_info * info)
18204 info->send_outstanding++;
18205 info->msr &= ~UART_MSR_CTS;
18206 info->lsr &= ~UART_LSR_TEMT;
18207 - tty_wakeup(tty);
18208 + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
18209 + tty->ldisc.write_wakeup)
18210 + (tty->ldisc.write_wakeup) (tty);
18211 + wake_up_interruptible(&tty->write_wait);
18212 return;
18213 }
18214 if (slen < 0) {
18215 @@ -1211,7 +1214,10 @@ isdn_tty_write(struct tty_struct *tty, i
18216 /* If DLE decoding results in zero-transmit, but
18217 * c originally was non-zero, do a wakeup.
18218 */
18219 - tty_wakeup(tty);
18220 + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
18221 + tty->ldisc.write_wakeup)
18222 + (tty->ldisc.write_wakeup) (tty);
18223 + wake_up_interruptible(&tty->write_wait);
18224 info->msr |= UART_MSR_CTS;
18225 info->lsr |= UART_LSR_TEMT;
18226 }
18227 @@ -1232,6 +1238,7 @@ isdn_tty_write(struct tty_struct *tty, i
18228 }
18229 }
18230 } else
18231 +#ifdef ISDN_TTY_FCLASS1
18232 if (TTY_IS_FCLASS1(info)) {
18233 int cc = isdn_tty_handleDLEdown(info, m, c);
18234
18235 @@ -1252,6 +1259,7 @@ isdn_tty_write(struct tty_struct *tty, i
18236 info->xmit_count += cc;
18237 } else
18238 #endif
18239 +#endif
18240 info->xmit_count += c;
18241 } else {
18242 info->msr |= UART_MSR_CTS;
18243 @@ -1329,7 +1337,10 @@ isdn_tty_flush_buffer(struct tty_struct
18244 isdn_tty_cleanup_xmit(info);
18245 info->xmit_count = 0;
18246 restore_flags(flags);
18247 - tty_wakeup(tty);
18248 + wake_up_interruptible(&tty->write_wait);
18249 + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
18250 + tty->ldisc.write_wakeup)
18251 + (tty->ldisc.write_wakeup) (tty);
18252 }
18253
18254 static void
18255 @@ -1858,7 +1869,8 @@ isdn_tty_close(struct tty_struct *tty, s
18256 isdn_tty_shutdown(info);
18257 if (tty->driver.flush_buffer)
18258 tty->driver.flush_buffer(tty);
18259 - tty_ldisc_flush(tty);
18260 + if (tty->ldisc.flush_buffer)
18261 + tty->ldisc.flush_buffer(tty);
18262 info->tty = 0;
18263 info->ncarrier = 0;
18264 tty->closing = 0;
18265 @@ -2306,6 +2318,22 @@ isdn_tty_stat_callback(int i, isdn_ctrl
18266 isdn_tty_at_cout("\r\n", info);
18267 }
18268 return 1;
18269 + case ISDN_STAT_ALERT:
18270 +#ifdef ISDN_TTY_STAT_DEBUG
18271 + printk(KERN_DEBUG "tty_STAT_ALERT ttyI%d\n", info->line);
18272 +#endif
18273 + /* Signal RINGING to tty-device if requested */
18274 + if (info->emu.mdmreg[REG_ALERT] & BIT_ALERT)
18275 + isdn_tty_modem_result(RESULT_RINGING, info);
18276 + return 1;
18277 + case ISDN_STAT_PROCEED:
18278 +#ifdef ISDN_TTY_STAT_DEBUG
18279 + printk(KERN_DEBUG "tty_STAT_PROCEED ttyI%d\n", info->line);
18280 +#endif
18281 + /* Signal PROCEEDING to tty-device if requested */
18282 + if (info->emu.mdmreg[REG_PROCEED] & BIT_PROCEED)
18283 + isdn_tty_modem_result(RESULT_PROCEEDING, info);
18284 + return 1;
18285 case ISDN_STAT_DCONN:
18286 #ifdef ISDN_TTY_STAT_DEBUG
18287 printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line);
18288 @@ -2618,7 +2646,7 @@ isdn_tty_modem_result(int code, modem_in
18289 static char *msg[] =
18290 {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR",
18291 "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER",
18292 - "RINGING", "NO MSN/EAZ", "VCON", "RUNG"};
18293 + "RINGING", "NO MSN/EAZ", "VCON", "RUNG", "PROCEEDING"};
18294 ulong flags;
18295 char s[ISDN_MSNLEN+10];
18296
18297 @@ -2781,7 +2809,8 @@ isdn_tty_modem_result(int code, modem_in
18298 restore_flags(flags);
18299 return;
18300 }
18301 - tty_ldisc_flush(info->tty);
18302 + if (info->tty->ldisc.flush_buffer)
18303 + info->tty->ldisc.flush_buffer(info->tty);
18304 if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
18305 (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
18306 (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
18307 @@ -3296,9 +3325,11 @@ isdn_tty_cmd_PLUSF(char **p, modem_info
18308 #ifdef CONFIG_ISDN_TTY_FAX
18309 if (TTY_IS_FCLASS2(info))
18310 sprintf(rs, "\r\n2");
18311 +#ifdef ISDN_TTY_FCLASS1
18312 else if (TTY_IS_FCLASS1(info))
18313 sprintf(rs, "\r\n1");
18314 #endif
18315 +#endif
18316 isdn_tty_at_cout(rs, info);
18317 break;
18318 case '=':
18319 @@ -3313,6 +3344,7 @@ isdn_tty_cmd_PLUSF(char **p, modem_info
18320 m->mdmreg[REG_PSIZE] * 16;
18321 break;
18322 #ifdef CONFIG_ISDN_TTY_FAX
18323 +#ifdef ISDN_TTY_FCLASS1
18324 case '1':
18325 p[0]++;
18326 if (!(dev->global_features &
18327 @@ -3324,6 +3356,7 @@ isdn_tty_cmd_PLUSF(char **p, modem_info
18328 info->xmit_size =
18329 m->mdmreg[REG_PSIZE] * 16;
18330 break;
18331 +#endif
18332 case '2':
18333 p[0]++;
18334 if (!(dev->global_features &
18335 @@ -3348,9 +3381,11 @@ isdn_tty_cmd_PLUSF(char **p, modem_info
18336 p[0]++;
18337 strcpy(rs, "\r\n0,");
18338 #ifdef CONFIG_ISDN_TTY_FAX
18339 +#ifdef ISDN_TTY_FCLASS1
18340 if (dev->global_features &
18341 ISDN_FEATURE_L3_FCLASS1)
18342 strcat(rs, "1,");
18343 +#endif
18344 if (dev->global_features &
18345 ISDN_FEATURE_L3_FCLASS2)
18346 strcat(rs, "2,");
18347 --- a/drivers/isdn/isdn_tty.h
18348 +++ b/drivers/isdn/isdn_tty.h
18349 @@ -1,4 +1,4 @@
18350 -/* $Id: isdn_tty.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18351 +/* $Id: isdn_tty.h,v 1.25 2002/02/09 21:19:11 keil Exp $
18352 *
18353 * header for Linux ISDN subsystem, tty related functions (linklevel).
18354 *
18355 @@ -78,6 +78,10 @@
18356 #define BIT_CPNFCON 2
18357 #define REG_CDN 23
18358 #define BIT_CDN 4
18359 +#define REG_ALERT 23
18360 +#define BIT_ALERT 8
18361 +#define REG_PROCEED 23
18362 +#define BIT_PROCEED 16
18363
18364 /* defines for result codes */
18365 #define RESULT_OK 0
18366 @@ -93,10 +97,13 @@
18367 #define RESULT_NO_MSN_EAZ 10
18368 #define RESULT_VCON 11
18369 #define RESULT_RUNG 12
18370 +#define RESULT_PROCEEDING 13
18371
18372 +#ifdef ISDN_TTY_FCLASS1
18373 #define TTY_IS_FCLASS1(info) \
18374 ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
18375 (info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS1))
18376 +#endif
18377 #define TTY_IS_FCLASS2(info) \
18378 ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
18379 (info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2))
18380 --- a/drivers/isdn/isdn_ttyfax.c
18381 +++ b/drivers/isdn/isdn_ttyfax.c
18382 @@ -1,4 +1,4 @@
18383 -/* $Id: isdn_ttyfax.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18384 +/* $Id: isdn_ttyfax.c,v 1.9 2001/09/24 13:22:43 kai Exp $
18385 *
18386 * Linux ISDN subsystem, tty_fax AT-command emulator (linklevel).
18387 *
18388 @@ -20,7 +20,7 @@
18389 #include "isdn_ttyfax.h"
18390
18391
18392 -static char *isdn_tty_fax_revision = "$Revision: 1.1.4.1 $";
18393 +static char *isdn_tty_fax_revision = "$Revision: 1.9 $";
18394
18395 #define PARSE_ERROR1 { isdn_tty_fax_modem_result(1, info); return 1; }
18396
18397 @@ -148,6 +148,7 @@ isdn_tty_fax_modem_result(int code, mode
18398 }
18399 }
18400
18401 +#ifdef ISDN_TTY_FCLASS1
18402 int
18403 isdn_tty_fax_command1(modem_info * info, isdn_ctrl * c)
18404 {
18405 @@ -186,6 +187,7 @@ isdn_tty_fax_command1(modem_info * info,
18406 }
18407 return (0);
18408 }
18409 +#endif
18410
18411 int
18412 isdn_tty_fax_command(modem_info * info, isdn_ctrl * c)
18413 @@ -193,8 +195,10 @@ isdn_tty_fax_command(modem_info * info,
18414 T30_s *f = info->fax;
18415 char rs[10];
18416
18417 +#ifdef ISDN_TTY_FCLASS1
18418 if (TTY_IS_FCLASS1(info))
18419 return (isdn_tty_fax_command1(info, c));
18420 +#endif
18421
18422 #ifdef ISDN_TTY_FAX_CMD_DEBUG
18423 printk(KERN_DEBUG "isdn_tty: Fax cmd %d on ttyI%d\n",
18424 @@ -312,6 +316,7 @@ isdn_tty_fax_bitorder(modem_info * info,
18425 }
18426 }
18427
18428 +#ifdef ISDN_TTY_FCLASS1
18429 /*
18430 * Parse AT+F.. FAX class 1 commands
18431 */
18432 @@ -403,6 +408,7 @@ isdn_tty_cmd_FCLASS1(char **p, modem_inf
18433 }
18434 return 1;
18435 }
18436 +#endif
18437
18438 /*
18439 * Parse AT+F.. FAX class 2 commands
18440 @@ -970,6 +976,70 @@ isdn_tty_cmd_FCLASS2(char **p, modem_inf
18441 }
18442 return 0;
18443 }
18444 +#if 0
18445 + /* LO=n - Flow control opts */
18446 + if (!strncmp(p[0], "LO", 2)) { /* TODO */
18447 + p[0] += 2;
18448 + switch (*p[0]) {
18449 + case '?':
18450 + p[0]++;
18451 + sprintf(rs, "\r\n%d", f->lo);
18452 + isdn_tty_at_cout(rs, info);
18453 + break;
18454 + case '=':
18455 + p[0]++;
18456 + if (*p[0] == '?') {
18457 + p[0]++;
18458 + sprintf(rs, "\r\n0,1,2");
18459 + isdn_tty_at_cout(rs, info);
18460 + } else {
18461 + par = isdn_getnum(p);
18462 + if ((par < 0) || (par > 2))
18463 + PARSE_ERROR1;
18464 + f->lo = par;
18465 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18466 + printk(KERN_DEBUG "isdn_tty: Fax FLO=%d\n", par);
18467 +#endif
18468 + }
18469 + break;
18470 + default:
18471 + PARSE_ERROR1;
18472 + }
18473 + return 0;
18474 + }
18475 +#endif
18476 +#if 0
18477 + /* LPL=n - Doc for polling cmd */
18478 + if (!strncmp(p[0], "LPL", 3)) { /* TODO */
18479 + p[0] += 3;
18480 + switch (*p[0]) {
18481 + case '?':
18482 + p[0]++;
18483 + sprintf(rs, "\r\n%d", f->lpl);
18484 + isdn_tty_at_cout(rs, info);
18485 + break;
18486 + case '=':
18487 + p[0]++;
18488 + if (*p[0] == '?') {
18489 + p[0]++;
18490 + sprintf(rs, "\r\n0,1");
18491 + isdn_tty_at_cout(rs, info);
18492 + } else {
18493 + par = isdn_getnum(p);
18494 + if ((par < 0) || (par > 1))
18495 + PARSE_ERROR1;
18496 + f->lpl = par;
18497 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18498 + printk(KERN_DEBUG "isdn_tty: Fax FLPL=%d\n", par);
18499 +#endif
18500 + }
18501 + break;
18502 + default:
18503 + PARSE_ERROR1;
18504 + }
18505 + return 0;
18506 + }
18507 +#endif
18508
18509 /* MDL? - DCE Model */
18510 if (!strncmp(p[0], "MDL?", 4)) {
18511 @@ -1049,6 +1119,38 @@ isdn_tty_cmd_FCLASS2(char **p, modem_inf
18512 }
18513 return 0;
18514 }
18515 +#if 0
18516 + /* PTS=n - Page transfer status */
18517 + if (!strncmp(p[0], "PTS", 3)) { /* TODO */
18518 + p[0] += 3;
18519 + switch (*p[0]) {
18520 + case '?':
18521 + p[0]++;
18522 + sprintf(rs, "\r\n%d", f->pts);
18523 + isdn_tty_at_cout(rs, info);
18524 + break;
18525 + case '=':
18526 + p[0]++;
18527 + if (*p[0] == '?') {
18528 + p[0]++;
18529 + sprintf(rs, "\r\n0-5");
18530 + isdn_tty_at_cout(rs, info);
18531 + } else {
18532 + par = isdn_getnum(p);
18533 + if ((par < 0) || (par > 5))
18534 + PARSE_ERROR1;
18535 + f->pts = par;
18536 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18537 + printk(KERN_DEBUG "isdn_tty: Fax FPTS=%d\n", par);
18538 +#endif
18539 + }
18540 + break;
18541 + default:
18542 + PARSE_ERROR1;
18543 + }
18544 + return 0;
18545 + }
18546 +#endif
18547
18548 /* REL=n - Phase C received EOL alignment */
18549 if (!strncmp(p[0], "REL", 3)) {
18550 @@ -1091,6 +1193,38 @@ isdn_tty_cmd_FCLASS2(char **p, modem_inf
18551 isdn_tty_at_cout(rs, info);
18552 return 0;
18553 }
18554 +#if 0
18555 + /* SPL=n - Enable polling */
18556 + if (!strncmp(p[0], "SPL", 3)) { /* TODO */
18557 + p[0] += 3;
18558 + switch (*p[0]) {
18559 + case '?':
18560 + p[0]++;
18561 + sprintf(rs, "\r\n%d", f->spl);
18562 + isdn_tty_at_cout(rs, info);
18563 + break;
18564 + case '=':
18565 + p[0]++;
18566 + if (*p[0] == '?') {
18567 + p[0]++;
18568 + sprintf(rs, "\r\n0,1");
18569 + isdn_tty_at_cout(rs, info);
18570 + } else {
18571 + par = isdn_getnum(p);
18572 + if ((par < 0) || (par > 1))
18573 + PARSE_ERROR1;
18574 + f->spl = par;
18575 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18576 + printk(KERN_DEBUG "isdn_tty: Fax FSPL=%d\n", par);
18577 +#endif
18578 + }
18579 + break;
18580 + default:
18581 + PARSE_ERROR1;
18582 + }
18583 + return 0;
18584 + }
18585 +#endif
18586
18587 /* Phase C Transmit Data Block Size */
18588 if (!strncmp(p[0], "TBC=", 4)) { /* dummy, not used */
18589 @@ -1116,7 +1250,9 @@ isdn_tty_cmd_PLUSF_FAX(char **p, modem_i
18590 {
18591 if (TTY_IS_FCLASS2(info))
18592 return (isdn_tty_cmd_FCLASS2(p, info));
18593 +#ifdef ISDN_TTY_FCLASS1
18594 else if (TTY_IS_FCLASS1(info))
18595 return (isdn_tty_cmd_FCLASS1(p, info));
18596 +#endif
18597 PARSE_ERROR1;
18598 }
18599 --- a/drivers/isdn/isdn_ttyfax.h
18600 +++ b/drivers/isdn/isdn_ttyfax.h
18601 @@ -1,4 +1,4 @@
18602 -/* $Id: isdn_ttyfax.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18603 +/* $Id: isdn_ttyfax.h,v 1.3 2001/09/24 13:22:43 kai Exp $
18604 *
18605 * header for Linux ISDN subsystem, tty_fax related functions (linklevel).
18606 *
18607 --- a/drivers/isdn/isdn_v110.c
18608 +++ b/drivers/isdn/isdn_v110.c
18609 @@ -1,4 +1,4 @@
18610 -/* $Id: isdn_v110.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18611 +/* $Id: isdn_v110.c,v 1.8 2001/09/24 13:22:43 kai Exp $
18612 *
18613 * Linux ISDN subsystem, V.110 related functions (linklevel).
18614 *
18615 @@ -19,7 +19,7 @@
18616
18617 #undef ISDN_V110_DEBUG
18618
18619 -char *isdn_v110_revision = "$Revision: 1.1.4.1 $";
18620 +char *isdn_v110_revision = "$Revision: 1.8 $";
18621
18622 #define V110_38400 255
18623 #define V110_19200 15
18624 @@ -138,6 +138,14 @@ isdn_v110_close(isdn_v110_stream * v)
18625 return;
18626 #ifdef ISDN_V110_DEBUG
18627 printk(KERN_DEBUG "v110 close\n");
18628 +#if 0
18629 + printk(KERN_DEBUG "isdn_v110_close: nbytes=%d\n", v->nbytes);
18630 + printk(KERN_DEBUG "isdn_v110_close: nbits=%d\n", v->nbits);
18631 + printk(KERN_DEBUG "isdn_v110_close: key=%d\n", v->key);
18632 + printk(KERN_DEBUG "isdn_v110_close: SyncInit=%d\n", v->SyncInit);
18633 + printk(KERN_DEBUG "isdn_v110:close: decodelen=%d\n", v->decodelen);
18634 + printk(KERN_DEBUG "isdn_v110_close: framelen=%d\n", v->framelen);
18635 +#endif
18636 #endif
18637 kfree(v->encodebuf);
18638 kfree(v);
18639 --- a/drivers/isdn/isdn_v110.h
18640 +++ b/drivers/isdn/isdn_v110.h
18641 @@ -1,4 +1,4 @@
18642 -/* $Id: isdn_v110.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18643 +/* $Id: isdn_v110.h,v 1.5 2001/09/24 13:22:43 kai Exp $
18644 *
18645 * Linux ISDN subsystem, V.110 related functions (linklevel).
18646 *
18647 --- a/drivers/isdn/isdn_x25iface.c
18648 +++ b/drivers/isdn/isdn_x25iface.c
18649 @@ -1,4 +1,4 @@
18650 -/* $Id: isdn_x25iface.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18651 +/* $Id: isdn_x25iface.c,v 1.10 2001/09/24 13:22:43 kai Exp $
18652 *
18653 * Linux ISDN subsystem, X.25 related functions
18654 *
18655 --- a/drivers/isdn/isdn_x25iface.h
18656 +++ b/drivers/isdn/isdn_x25iface.h
18657 @@ -1,4 +1,4 @@
18658 -/* $Id: isdn_x25iface.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18659 +/* $Id: isdn_x25iface.h,v 1.4 2001/09/24 13:22:43 kai Exp $
18660 *
18661 * header for Linux ISDN subsystem, x.25 related functions
18662 *
18663 --- a/drivers/isdn/isdnloop/isdnloop.c
18664 +++ b/drivers/isdn/isdnloop/isdnloop.c
18665 @@ -1,4 +1,4 @@
18666 -/* $Id: isdnloop.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
18667 +/* $Id: isdnloop.c,v 1.17 2001/08/30 10:45:42 kai Exp $
18668 *
18669 * ISDN low-level module implementing a dummy loop driver.
18670 *
18671 @@ -14,7 +14,7 @@
18672 #include <linux/init.h>
18673 #include "isdnloop.h"
18674
18675 -static char *revision = "$Revision: 1.1.4.1 $";
18676 +static char *revision = "$Revision$";
18677 static char *isdnloop_id;
18678
18679 MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
18680 @@ -22,8 +22,8 @@ MODULE_AUTHOR("Fritz Elfert");
18681 MODULE_LICENSE("GPL");
18682 MODULE_PARM(isdnloop_id, "s");
18683 MODULE_PARM_DESC(isdnloop_id, "ID-String of first card");
18684 -
18685 -static int isdnloop_addcard(char *);
18686 +
18687 + static int isdnloop_addcard(char *);
18688
18689 /*
18690 * Free queue completely.
18691 @@ -1542,11 +1542,7 @@ isdnloop_init(void)
18692 } else
18693 strcpy(rev, " ??? ");
18694 printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
18695 -
18696 - if (isdnloop_id)
18697 - return (isdnloop_addcard(isdnloop_id));
18698 -
18699 - return 0;
18700 + return (isdnloop_addcard(isdnloop_id));
18701 }
18702
18703 static void __exit
18704 --- a/drivers/isdn/isdnloop/isdnloop.h
18705 +++ b/drivers/isdn/isdnloop/isdnloop.h
18706 @@ -1,4 +1,4 @@
18707 -/* $Id: isdnloop.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
18708 +/* $Id$
18709 *
18710 * Loopback lowlevel module for testing of linklevel.
18711 *
18712 --- a/drivers/isdn/pcbit/callbacks.c
18713 +++ b/drivers/isdn/pcbit/callbacks.c
18714 @@ -3,7 +3,7 @@
18715 *
18716 * Copyright (C) 1996 Universidade de Lisboa
18717 *
18718 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18719 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18720 *
18721 * This software may be used and distributed according to the terms of
18722 * the GNU General Public License, incorporated herein by reference.
18723 --- a/drivers/isdn/pcbit/callbacks.h
18724 +++ b/drivers/isdn/pcbit/callbacks.h
18725 @@ -3,7 +3,7 @@
18726 *
18727 * Copyright (C) 1996 Universidade de Lisboa
18728 *
18729 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18730 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18731 *
18732 * This software may be used and distributed according to the terms of
18733 * the GNU General Public License, incorporated herein by reference.
18734 --- a/drivers/isdn/pcbit/capi.c
18735 +++ b/drivers/isdn/pcbit/capi.c
18736 @@ -4,7 +4,7 @@
18737 *
18738 * Copyright (C) 1996 Universidade de Lisboa
18739 *
18740 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18741 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18742 *
18743 * This software may be used and distributed according to the terms of
18744 * the GNU General Public License, incorporated herein by reference.
18745 --- a/drivers/isdn/pcbit/capi.h
18746 +++ b/drivers/isdn/pcbit/capi.h
18747 @@ -3,7 +3,7 @@
18748 *
18749 * Copyright (C) 1996 Universidade de Lisboa
18750 *
18751 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18752 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18753 *
18754 * This software may be used and distributed according to the terms of
18755 * the GNU General Public License, incorporated herein by reference.
18756 @@ -63,7 +63,8 @@ extern int capi_disc_resp(struct pcbit_c
18757 extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen);
18758 #endif
18759
18760 -static inline struct pcbit_chan *
18761 +extern __inline__
18762 +struct pcbit_chan *
18763 capi_channel(struct pcbit_dev *dev, struct sk_buff *skb)
18764 {
18765 ushort callref;
18766 --- a/drivers/isdn/pcbit/drv.c
18767 +++ b/drivers/isdn/pcbit/drv.c
18768 @@ -3,7 +3,7 @@
18769 *
18770 * Copyright (C) 1996 Universidade de Lisboa
18771 *
18772 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18773 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18774 *
18775 * This software may be used and distributed according to the terms of
18776 * the GNU General Public License, incorporated herein by reference.
18777 @@ -35,7 +35,9 @@
18778 #include <linux/isdnif.h>
18779 #include <asm/string.h>
18780 #include <asm/io.h>
18781 +#ifdef COMPAT_HAS_ISA_IOREMAP
18782 #include <linux/ioport.h>
18783 +#endif
18784
18785 #include "pcbit.h"
18786 #include "edss1.h"
18787 @@ -89,6 +91,7 @@ int pcbit_init_dev(int board, int mem_ba
18788
18789 if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) {
18790 dev->ph_mem = mem_base;
18791 +#ifdef COMPAT_HAS_ISA_IOREMAP
18792 if (check_mem_region(dev->ph_mem, 4096)) {
18793 printk(KERN_WARNING
18794 "PCBIT: memory region %lx-%lx already in use\n",
18795 @@ -100,6 +103,9 @@ int pcbit_init_dev(int board, int mem_ba
18796 request_mem_region(dev->ph_mem, 4096, "PCBIT mem");
18797 }
18798 dev->sh_mem = (unsigned char*)ioremap(dev->ph_mem, 4096);
18799 +#else
18800 + dev->sh_mem = (unsigned char*) mem_base;
18801 +#endif
18802 }
18803 else
18804 {
18805 @@ -112,8 +118,10 @@ int pcbit_init_dev(int board, int mem_ba
18806 dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL);
18807 if (!dev->b1) {
18808 printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
18809 +#ifdef COMPAT_HAS_ISA_IOREMAP
18810 iounmap((unsigned char*)dev->sh_mem);
18811 release_mem_region(dev->ph_mem, 4096);
18812 +#endif
18813 kfree(dev);
18814 return -ENOMEM;
18815 }
18816 @@ -122,8 +130,10 @@ int pcbit_init_dev(int board, int mem_ba
18817 if (!dev->b2) {
18818 printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
18819 kfree(dev->b1);
18820 +#ifdef COMPAT_HAS_ISA_IOREMAP
18821 iounmap((unsigned char*)dev->sh_mem);
18822 release_mem_region(dev->ph_mem, 4096);
18823 +#endif
18824 kfree(dev);
18825 return -ENOMEM;
18826 }
18827 @@ -144,8 +154,10 @@ int pcbit_init_dev(int board, int mem_ba
18828 {
18829 kfree(dev->b1);
18830 kfree(dev->b2);
18831 +#ifdef COMPAT_HAS_ISA_IOREMAP
18832 iounmap((unsigned char*)dev->sh_mem);
18833 release_mem_region(dev->ph_mem, 4096);
18834 +#endif
18835 kfree(dev);
18836 dev_pcbit[board] = NULL;
18837 return -EIO;
18838 @@ -166,8 +178,10 @@ int pcbit_init_dev(int board, int mem_ba
18839 free_irq(irq, dev);
18840 kfree(dev->b1);
18841 kfree(dev->b2);
18842 +#ifdef COMPAT_HAS_ISA_IOREMAP
18843 iounmap((unsigned char*)dev->sh_mem);
18844 release_mem_region(dev->ph_mem, 4096);
18845 +#endif
18846 kfree(dev);
18847 dev_pcbit[board] = NULL;
18848 return -EIO;
18849 @@ -197,8 +211,10 @@ int pcbit_init_dev(int board, int mem_ba
18850 free_irq(irq, dev);
18851 kfree(dev->b1);
18852 kfree(dev->b2);
18853 +#ifdef COMPAT_HAS_ISA_IOREMAP
18854 iounmap((unsigned char*)dev->sh_mem);
18855 release_mem_region(dev->ph_mem, 4096);
18856 +#endif
18857 kfree(dev);
18858 dev_pcbit[board] = NULL;
18859 return -EIO;
18860 @@ -235,8 +251,10 @@ void pcbit_terminate(int board)
18861 del_timer(&dev->b2->fsm_timer);
18862 kfree(dev->b1);
18863 kfree(dev->b2);
18864 +#ifdef COMPAT_HAS_ISA_IOREMAP
18865 iounmap((unsigned char*)dev->sh_mem);
18866 release_mem_region(dev->ph_mem, 4096);
18867 +#endif
18868 kfree(dev);
18869 }
18870 }
18871 @@ -430,7 +448,7 @@ int pcbit_writecmd(const u_char* buf, in
18872 switch(dev->l2_state) {
18873 case L2_LWMODE:
18874 /* check (size <= rdp_size); write buf into board */
18875 - if (len < 0 || len > BANK4 + 1)
18876 + if (len > BANK4 + 1)
18877 {
18878 printk("pcbit_writecmd: invalid length %d\n", len);
18879 return -EINVAL;
18880 @@ -609,6 +627,20 @@ void pcbit_l3_receive(struct pcbit_dev *
18881 dev->b1->s_refnum,
18882 dev->b2->s_refnum);
18883 #endif
18884 +#if 0
18885 + if (dev->b1->s_refnum == refnum)
18886 + chan = dev->b1;
18887 + else {
18888 +
18889 + if (dev->b2->s_refnum == refnum)
18890 + chan = dev->b2;
18891 + else {
18892 + chan = NULL;
18893 + printk(KERN_WARNING "Connection Confirm - refnum doesn't match chan\n");
18894 + break;
18895 + }
18896 + }
18897 +#else
18898 /* We just try to find a channel in the right state */
18899
18900 if (dev->b1->fsm_state == ST_CALL_INIT)
18901 @@ -622,6 +654,7 @@ void pcbit_l3_receive(struct pcbit_dev *
18902 break;
18903 }
18904 }
18905 +#endif
18906 if (capi_decode_conn_conf(chan, skb, &complete)) {
18907 printk(KERN_DEBUG "conn_conf indicates error\n");
18908 pcbit_fsm_event(dev, chan, EV_ERROR, NULL);
18909 --- a/drivers/isdn/pcbit/edss1.c
18910 +++ b/drivers/isdn/pcbit/edss1.c
18911 @@ -4,7 +4,7 @@
18912 *
18913 * Copyright (C) 1996 Universidade de Lisboa
18914 *
18915 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18916 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18917 *
18918 * This software may be used and distributed according to the terms of
18919 * the GNU General Public License, incorporated herein by reference.
18920 --- a/drivers/isdn/pcbit/edss1.h
18921 +++ b/drivers/isdn/pcbit/edss1.h
18922 @@ -3,7 +3,7 @@
18923 *
18924 * Copyright (C) 1996 Universidade de Lisboa
18925 *
18926 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18927 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18928 *
18929 * This software may be used and distributed according to the terms of
18930 * the GNU General Public License, incorporated herein by reference.
18931 --- a/drivers/isdn/pcbit/layer2.c
18932 +++ b/drivers/isdn/pcbit/layer2.c
18933 @@ -3,7 +3,7 @@
18934 *
18935 * Copyright (C) 1996 Universidade de Lisboa
18936 *
18937 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18938 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18939 *
18940 * This software may be used and distributed according to the terms of
18941 * the GNU General Public License, incorporated herein by reference.
18942 @@ -369,11 +369,16 @@ pcbit_receive(struct pcbit_dev *dev)
18943
18944 if (dev->read_frame) {
18945 printk(KERN_DEBUG "pcbit_receive: Type 0 frame and read_frame != NULL\n");
18946 +#if 0
18947 + pcbit_l2_error(dev);
18948 + return;
18949 +#else
18950 /* discard previous queued frame */
18951 if (dev->read_frame->skb)
18952 kfree_skb(dev->read_frame->skb);
18953 kfree(dev->read_frame);
18954 dev->read_frame = NULL;
18955 +#endif
18956 }
18957 frame = kmalloc(sizeof(struct frame_buf), GFP_ATOMIC);
18958
18959 @@ -449,10 +454,14 @@ pcbit_receive(struct pcbit_dev *dev)
18960
18961 if (!(frame = dev->read_frame)) {
18962 printk("Type 1 frame and no frame queued\n");
18963 +#if 1
18964 /* usually after an error: toss frame */
18965 dev->readptr += tt;
18966 if (dev->readptr > dev->sh_mem + BANK2 + BANKLEN)
18967 dev->readptr -= BANKLEN;
18968 +#else
18969 + pcbit_l2_error(dev);
18970 +#endif
18971 return;
18972
18973 }
18974 --- a/drivers/isdn/pcbit/layer2.h
18975 +++ b/drivers/isdn/pcbit/layer2.h
18976 @@ -3,7 +3,7 @@
18977 *
18978 * Copyright (C) 1996 Universidade de Lisboa
18979 *
18980 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18981 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18982 *
18983 * This software may be used and distributed according to the terms of
18984 * the GNU General Public License, incorporated herein by reference.
18985 --- a/drivers/isdn/pcbit/module.c
18986 +++ b/drivers/isdn/pcbit/module.c
18987 @@ -3,7 +3,7 @@
18988 *
18989 * Copyright (C) 1996 Universidade de Lisboa
18990 *
18991 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18992 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18993 *
18994 * This software may be used and distributed according to the terms of
18995 * the GNU General Public License, incorporated herein by reference.
18996 @@ -92,6 +92,7 @@ static void __exit pcbit_exit(void)
18997 }
18998
18999 #ifndef MODULE
19000 +#ifdef COMPAT_HAS_NEW_SETUP
19001 #define MAX_PARA (MAX_PCBIT_CARDS * 2)
19002 static int __init pcbit_setup(char *line)
19003 {
19004 @@ -100,6 +101,11 @@ static int __init pcbit_setup(char *line
19005 int ints[MAX_PARA+1];
19006
19007 str = get_options(line, MAX_PARA, ints);
19008 +#else
19009 +void pcbit_setup(char *str, int *ints)
19010 +{
19011 + int i, j, argc;
19012 +#endif
19013 argc = ints[0];
19014 i = 0;
19015 j = 1;
19016 @@ -118,9 +124,13 @@ static int __init pcbit_setup(char *line
19017
19018 i++;
19019 }
19020 +#ifdef COMPAT_HAS_NEW_SETUP
19021 return(1);
19022 }
19023 __setup("pcbit=", pcbit_setup);
19024 +#else
19025 +}
19026 +#endif
19027 #endif
19028
19029 module_init(pcbit_init);
19030 --- a/drivers/isdn/pcbit/pcbit.h
19031 +++ b/drivers/isdn/pcbit/pcbit.h
19032 @@ -3,7 +3,7 @@
19033 *
19034 * Copyright (C) 1996 Universidade de Lisboa
19035 *
19036 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
19037 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
19038 *
19039 * This software may be used and distributed according to the terms of
19040 * the GNU General Public License, incorporated herein by reference.
19041 --- a/drivers/isdn/sc/card.h
19042 +++ b/drivers/isdn/sc/card.h
19043 @@ -1,4 +1,4 @@
19044 -/* $Id: card.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19045 +/* $Id$
19046 *
19047 * Driver parameters for SpellCaster ISA ISDN adapters
19048 *
19049 --- a/drivers/isdn/sc/command.c
19050 +++ b/drivers/isdn/sc/command.c
19051 @@ -1,4 +1,4 @@
19052 -/* $Id: command.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19053 +/* $Id$
19054 *
19055 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19056 *
19057 @@ -95,7 +95,7 @@ int get_card_from_id(int driver)
19058 if(adapter[i]->driverId == driver)
19059 return i;
19060 }
19061 - return -ENODEV;
19062 + return -NODEV;
19063 }
19064
19065 /*
19066 --- a/drivers/isdn/sc/debug.c
19067 +++ b/drivers/isdn/sc/debug.c
19068 @@ -1,4 +1,4 @@
19069 -/* $Id: debug.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19070 +/* $Id$
19071 *
19072 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19073 *
19074 --- a/drivers/isdn/sc/debug.h
19075 +++ b/drivers/isdn/sc/debug.h
19076 @@ -1,4 +1,4 @@
19077 -/* $Id: debug.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19078 +/* $Id$
19079 *
19080 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19081 *
19082 --- a/drivers/isdn/sc/event.c
19083 +++ b/drivers/isdn/sc/event.c
19084 @@ -1,4 +1,4 @@
19085 -/* $Id: event.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19086 +/* $Id$
19087 *
19088 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19089 *
19090 --- a/drivers/isdn/sc/init.c
19091 +++ b/drivers/isdn/sc/init.c
19092 @@ -514,6 +514,15 @@ int identify_board(unsigned long rambase
19093 schedule_timeout(HZ);
19094 sig = readl(rambase + SIG_OFFSET);
19095 pr_debug("Looking for a signature, got 0x%x\n", sig);
19096 +#if 0
19097 +/*
19098 + * For Gary:
19099 + * If it's a timing problem, it should be gone with the above schedule()
19100 + * Another possible reason may be the missing volatile in the original
19101 + * code. readl() does this for us.
19102 + */
19103 + printk(""); /* Hack! Doesn't work without this !!!??? */
19104 +#endif
19105 if(sig == SIGNATURE)
19106 return PRI_BOARD;
19107
19108 @@ -525,6 +534,9 @@ int identify_board(unsigned long rambase
19109 schedule_timeout(HZ);
19110 sig = readl(rambase + SIG_OFFSET);
19111 pr_debug("Looking for a signature, got 0x%x\n", sig);
19112 +#if 0
19113 + printk(""); /* Hack! Doesn't work without this !!!??? */
19114 +#endif
19115 if(sig == SIGNATURE)
19116 return BRI_BOARD;
19117
19118 --- a/drivers/isdn/sc/interrupt.c
19119 +++ b/drivers/isdn/sc/interrupt.c
19120 @@ -1,4 +1,4 @@
19121 -/* $Id: interrupt.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19122 +/* $Id$
19123 *
19124 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19125 *
19126 --- a/drivers/isdn/sc/ioctl.c
19127 +++ b/drivers/isdn/sc/ioctl.c
19128 @@ -23,6 +23,9 @@ extern int send_and_receive(int, unsigne
19129
19130 extern board *adapter[];
19131
19132 +#if 0
19133 +static char *ChannelStates[] = { "Idle", "Ready", "Connecting", "Connected", "Disconnecting" };
19134 +#endif
19135
19136 int GetStatus(int card, boardInfo *);
19137
19138 --- a/drivers/isdn/sc/message.c
19139 +++ b/drivers/isdn/sc/message.c
19140 @@ -1,4 +1,4 @@
19141 -/* $Id: message.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19142 +/* $Id$
19143 *
19144 * functions for sending and receiving control messages
19145 *
19146 --- a/drivers/isdn/sc/message.h
19147 +++ b/drivers/isdn/sc/message.h
19148 @@ -1,4 +1,4 @@
19149 -/* $Id: message.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19150 +/* $Id$
19151 *
19152 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19153 *
19154 --- a/drivers/isdn/sc/packet.c
19155 +++ b/drivers/isdn/sc/packet.c
19156 @@ -1,4 +1,4 @@
19157 -/* $Id: packet.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19158 +/* $Id$
19159 *
19160 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19161 *
19162 --- a/drivers/isdn/sc/shmem.c
19163 +++ b/drivers/isdn/sc/shmem.c
19164 @@ -1,4 +1,4 @@
19165 -/* $Id: shmem.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19166 +/* $Id$
19167 *
19168 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19169 *
19170 --- a/drivers/isdn/sc/timer.c
19171 +++ b/drivers/isdn/sc/timer.c
19172 @@ -1,4 +1,4 @@
19173 -/* $Id: timer.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19174 +/* $Id$
19175 *
19176 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
19177 *
19178 --- a/drivers/isdn/tpam/tpam.h
19179 +++ b/drivers/isdn/tpam/tpam.h
19180 @@ -1,4 +1,4 @@
19181 -/* $Id: tpam.h,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19182 +/* $Id: tpam.h,v 1.3 2001/09/24 13:23:12 kai Exp $
19183 *
19184 * Turbo PAM ISDN driver for Linux. (Kernel Driver)
19185 *
19186 --- a/drivers/isdn/tpam/tpam_commands.c
19187 +++ b/drivers/isdn/tpam/tpam_commands.c
19188 @@ -1,4 +1,4 @@
19189 -/* $Id: tpam_commands.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19190 +/* $Id: tpam_commands.c,v 1.3 2001/09/24 13:23:12 kai Exp $
19191 *
19192 * Turbo PAM ISDN driver for Linux. (Kernel Driver - ISDN commands)
19193 *
19194 --- a/drivers/isdn/tpam/tpam_crcpc.c
19195 +++ b/drivers/isdn/tpam/tpam_crcpc.c
19196 @@ -1,4 +1,4 @@
19197 -/* $Id: tpam_crcpc.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19198 +/* $Id$
19199 *
19200 * Turbo PAM ISDN driver for Linux. (Kernel Driver - CRC encoding)
19201 *
19202 --- a/drivers/isdn/tpam/tpam_hdlc.c
19203 +++ b/drivers/isdn/tpam/tpam_hdlc.c
19204 @@ -1,4 +1,4 @@
19205 -/* $Id: tpam_hdlc.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19206 +/* $Id: tpam_hdlc.c,v 1.3 2001/09/24 13:23:12 kai Exp $
19207 *
19208 * Turbo PAM ISDN driver for Linux. (Kernel Driver - HDLC encoding)
19209 *
19210 --- a/drivers/isdn/tpam/tpam_main.c
19211 +++ b/drivers/isdn/tpam/tpam_main.c
19212 @@ -1,4 +1,4 @@
19213 -/* $Id: tpam_main.c,v 1.1.2.2 2001/12/09 18:45:14 kai Exp $
19214 +/* $Id$
19215 *
19216 * Turbo PAM ISDN driver for Linux. (Kernel Driver - main routines)
19217 *
19218 @@ -254,7 +254,7 @@ static struct pci_driver tpam_driver = {
19219 name: "tpam",
19220 id_table: tpam_pci_tbl,
19221 probe: tpam_probe,
19222 - remove: __devexit_p(tpam_remove),
19223 + remove: tpam_remove,
19224 };
19225
19226 static int __init tpam_init(void) {
19227 --- a/drivers/isdn/tpam/tpam_memory.c
19228 +++ b/drivers/isdn/tpam/tpam_memory.c
19229 @@ -1,4 +1,4 @@
19230 -/* $Id: tpam_memory.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19231 +/* $Id$
19232 *
19233 * Turbo PAM ISDN driver for Linux. (Kernel Driver - Board Memory Access)
19234 *
19235 --- a/drivers/isdn/tpam/tpam_nco.c
19236 +++ b/drivers/isdn/tpam/tpam_nco.c
19237 @@ -1,4 +1,4 @@
19238 -/* $Id: tpam_nco.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19239 +/* $Id$
19240 *
19241 * Turbo PAM ISDN driver for Linux.
19242 * (Kernel Driver - Low Level NCO Manipulation)
19243 --- a/drivers/isdn/tpam/tpam_queues.c
19244 +++ b/drivers/isdn/tpam/tpam_queues.c
19245 @@ -1,4 +1,4 @@
19246 -/* $Id: tpam_queues.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19247 +/* $Id$
19248 *
19249 * Turbo PAM ISDN driver for Linux. (Kernel Driver)
19250 *
19251 @@ -146,7 +146,6 @@ void tpam_irq(int irq, void *dev_id, str
19252 do {
19253 hpic = readl(card->bar0 + TPAM_HPIC_REGISTER);
19254 if (waiting_too_long++ > 0xfffffff) {
19255 - kfree_skb(skb);
19256 spin_unlock(&card->lock);
19257 printk(KERN_ERR "TurboPAM(tpam_irq): "
19258 "waiting too long...\n");
19259 --- a/include/linux/b1lli.h
19260 +++ b/include/linux/b1lli.h
19261 @@ -1,4 +1,4 @@
19262 -/* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $
19263 +/* $Id$
19264 *
19265 * ISDN lowlevel-module for AVM B1-card.
19266 *
19267 --- a/include/linux/b1pcmcia.h
19268 +++ b/include/linux/b1pcmcia.h
19269 @@ -1,4 +1,4 @@
19270 -/* $Id: b1pcmcia.h,v 1.1.8.2 2001/09/23 22:25:05 kai Exp $
19271 +/* $Id$
19272 *
19273 * Exported functions of module b1pcmcia to be called by
19274 * avm_cs card services module.
19275 --- a/include/linux/capi.h
19276 +++ b/include/linux/capi.h
19277 @@ -1,4 +1,4 @@
19278 -/* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
19279 +/* $Id$
19280 *
19281 * CAPI 2.0 Interface for Linux
19282 *
19283 --- a/include/linux/concap.h
19284 +++ b/include/linux/concap.h
19285 @@ -1,4 +1,4 @@
19286 -/* $Id: concap.h,v 1.2.8.1 2001/09/23 22:25:05 kai Exp $
19287 +/* $Id: concap.h,v 1.3 2001/09/24 13:23:13 kai Exp $
19288 *
19289 * Copyright 1997 by Henner Eisen <eis@baty.hanse.de>
19290 *
19291 @@ -11,6 +11,7 @@
19292 #ifdef __KERNEL__
19293 #include <linux/skbuff.h>
19294 #include <linux/netdevice.h>
19295 +#include <linux/isdn_compat.h>
19296
19297 /* Stuff to support encapsulation protocols genericly. The encapsulation
19298 protocol is processed at the uppermost layer of the network interface.
19299 --- a/include/linux/hysdn_if.h
19300 +++ b/include/linux/hysdn_if.h
19301 @@ -1,4 +1,4 @@
19302 -/* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $
19303 +/* $Id$
19304 *
19305 * Linux driver for HYSDN cards
19306 * ioctl definitions shared by hynetmgr and driver.
19307 --- a/include/linux/isdn/tpam.h
19308 +++ b/include/linux/isdn/tpam.h
19309 @@ -1,4 +1,4 @@
19310 -/* $Id: tpam.h,v 1.1.2.1 2001/11/20 14:19:38 kai Exp $
19311 +/* $Id$
19312 *
19313 * Turbo PAM ISDN driver for Linux. (Kernel Driver)
19314 *
19315 --- a/include/linux/isdn.h
19316 +++ b/include/linux/isdn.h
19317 @@ -1,4 +1,4 @@
19318 -/* $Id: isdn.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
19319 +/* $Id: isdn.h,v 1.125 2001/12/01 23:18:21 detabc Exp $
19320 *
19321 * Main header for the Linux ISDN subsystem (linklevel).
19322 *
19323 @@ -14,6 +14,7 @@
19324 #ifndef __ISDN_H__
19325 #define __ISDN_H__
19326
19327 +#include <linux/isdn_compat.h>
19328 #include <linux/ioctl.h>
19329
19330 #ifdef CONFIG_COBALT_MICRO_SERVER
19331 @@ -93,9 +94,15 @@
19332 #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */
19333 #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */
19334
19335 +#ifdef BIG_PHONE_NUMBERS
19336 #define ISDN_MSNLEN 32
19337 #define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */
19338 #define TTY_DV 0x06 /* Data version for iprofd etc. */
19339 +#else
19340 +#define ISDN_MSNLEN 20
19341 +#define NET_DV 0x05 /* Data version for isdn_net_ioctl_cfg */
19342 +#define TTY_DV 0x05 /* Data version for iprofd etc. */
19343 +#endif
19344
19345 #define INF_DV 0x01 /* Data version for /dev/isdninfo */
19346
19347 @@ -187,6 +194,61 @@ typedef struct {
19348 #define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1))
19349 #define ISDN_MINOR_STATUS 255
19350
19351 +#ifndef CONFIG_ISDN_WITH_ABC
19352 +#undef CONFIG_ISDN_WITH_ABC_CALLB
19353 +#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK
19354 +#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
19355 +#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
19356 +#undef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
19357 +#undef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
19358 +#undef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
19359 +#undef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
19360 +#undef CONFIG_ISDN_WITH_ABC_CONN_ERROR
19361 +#undef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
19362 +#else /* CONFIG_ISDN_WITH_ABC */
19363 +#include <linux/isdn_dwabc.h>
19364 +
19365 +
19366 +typedef struct DWABCJIFFIES {
19367 +
19368 + u_long msec_1000;
19369 + u_long msec_500;
19370 + u_long msec_400;
19371 + u_long msec_200;
19372 + u_long msec_100;
19373 +
19374 +} DWABCJIFFIES;
19375 +
19376 +
19377 +#ifdef CONFIG_ISDN_WITH_ABC_NEED_DWSJIFFIES
19378 +DWABCJIFFIES isdn_dwabc_jiffies;
19379 +#else
19380 +extern DWABCJIFFIES isdn_dwabc_jiffies;
19381 +#endif
19382 +#define dwsjiffies (isdn_dwabc_jiffies.msec_1000)
19383 +
19384 +#define ISDN_DW_ABC_FLAG_UNUSED00001 0x00000001L
19385 +#define ISDN_DW_ABC_FLAG_NO_UDP_CHECK 0x00000002L
19386 +#define ISDN_DW_ABC_FLAG_NO_UDP_HANGUP 0x00000004L
19387 +#define ISDN_DW_ABC_FLAG_NO_UDP_DIAL 0x00000008L
19388 +#define ISDN_DW_ABC_FLAG_UNUSED00010 0x00000010L
19389 +#define ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER 0x00000020L
19390 +#define ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE 0x00000040L
19391 +#define ISDN_DW_ABC_FLAG_NO_CONN_ERROR 0x00000080L
19392 +#define ISDN_DW_ABC_FLAG_BSD_COMPRESS 0x00000100L
19393 +#define ISDN_DW_ABC_FLAG_NO_LCR 0x00000200L
19394 +#define ISDN_DW_ABC_FLAG_LEASED_LINE 0x00001000L
19395 +
19396 +#define ISDN_DW_ABC_IFFLAG_NODCHAN 0x00000001L
19397 +#define ISDN_DW_ABC_IFFLAG_BSDAKTIV 0x00000002L
19398 +
19399 +#define ISDN_DW_ABC_BITLOCK_SEND 0
19400 +#define ISDN_DW_ABC_BITLOCK_RECEIVE 1
19401 +
19402 +#endif /* CONFIG_ISDN_WITH_ABC */
19403 +
19404 +
19405 +
19406 #ifdef CONFIG_ISDN_PPP
19407
19408 #ifdef CONFIG_ISDN_PPP_VJ
19409 @@ -204,9 +266,11 @@ typedef struct {
19410 # include <linux/concap.h>
19411 #endif
19412
19413 +#ifdef HAVE_DEVFS_FS
19414 #ifdef CONFIG_DEVFS_FS
19415 # include <linux/devfs_fs_kernel.h>
19416 #endif
19417 +#endif /* HAVE_DEVFS_FS */
19418
19419 #include <linux/isdnif.h>
19420
19421 @@ -272,6 +336,12 @@ typedef struct {
19422 #define ISDN_NET_CALLBACK 0x04 /* activate callback */
19423 #define ISDN_NET_CBHUP 0x08 /* hangup before callback */
19424 #define ISDN_NET_CBOUT 0x10 /* remote machine does callback */
19425 +#if 0
19426 +/* Unused??? */
19427 +#define ISDN_NET_CLONE 0x08 /* clone a tmp interface when called */
19428 +#define ISDN_NET_TMP 0x10 /* tmp interface until getting an IP */
19429 +#define ISDN_NET_DYNAMIC 0x20 /* this link is dynamically allocated */
19430 +#endif
19431
19432 #define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
19433
19434 @@ -386,6 +456,38 @@ typedef struct isdn_net_local_s {
19435 char cisco_debserint; /* debugging flag of cisco hdlc with slarp */
19436 struct timer_list cisco_timer;
19437 struct tq_struct tqueue;
19438 +#ifdef CONFIG_ISDN_WITH_ABC
19439 + ulong dw_abc_flags;
19440 + ulong dw_abc_if_flags;
19441 + int dw_abc_inuse_secure;
19442 + ulong dw_abc_dialstart;
19443 + int dw_abc_old_onhtime;
19444 + int dw_abc_remote_version;
19445 + int dw_abc_bitlocks;
19446 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
19447 + char dw_out_msn[ISDN_MSNLEN]; /* eaz for outgoing call if *out_msn != 0 */
19448 +#endif
19449 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
19450 + ulong dw_abc_lcr_callid;
19451 + ulong dw_abc_lcr_start_request;
19452 + ulong dw_abc_lcr_end_request;
19453 + isdn_ctrl *dw_abc_lcr_cmd;
19454 + struct ISDN_DWABC_LCR_IOCTL *dw_abc_lcr_io;
19455 +#endif
19456 + ulong dw_abc_bchan_last_connect;
19457 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
19458 + short dw_abc_bchan_errcnt;
19459 +#endif
19460 +#ifdef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
19461 + void *dw_abc_bsd_compressor;
19462 + void *dw_abc_bsd_stat_rx;
19463 + void *dw_abc_bsd_stat_tx;
19464 +#endif
19465 + ulong dw_abc_bsd_snd;
19466 + ulong dw_abc_bsd_bsd_snd;
19467 + ulong dw_abc_bsd_rcv;
19468 + ulong dw_abc_bsd_bsd_rcv;
19469 +#endif
19470 } isdn_net_local;
19471
19472 /* the interface itself */
19473 @@ -608,12 +710,13 @@ typedef struct isdn_devt {
19474 int tflags; /* Timer-Flags: */
19475 /* see ISDN_TIMER_..defines */
19476 int global_flags;
19477 - infostruct *infochain; /* List of open info-devs. */
19478 - wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
19479 struct timer_list timer; /* Misc.-function Timer */
19480 int chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel */
19481 int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */
19482 int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */
19483 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
19484 + ulong dwabc_chan_external_inuse[ISDN_MAX_CHANNELS];
19485 +#endif
19486 char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
19487 /* Remote number of active ch.*/
19488 int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */
19489 @@ -631,6 +734,7 @@ typedef struct isdn_devt {
19490 isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
19491 struct semaphore sem; /* serialize list access*/
19492 unsigned long global_features;
19493 +#ifdef HAVE_DEVFS_FS
19494 #ifdef CONFIG_DEVFS_FS
19495 devfs_handle_t devfs_handle_isdninfo;
19496 devfs_handle_t devfs_handle_isdnctrl;
19497 @@ -640,10 +744,41 @@ typedef struct isdn_devt {
19498 devfs_handle_t devfs_handle_ipppX[ISDN_MAX_CHANNELS];
19499 #endif
19500 #endif /* CONFIG_DEVFS_FS */
19501 +#endif /* HAVE_DEVFS_FS */
19502 } isdn_dev;
19503
19504 extern isdn_dev *dev;
19505
19506 +#ifdef CONFIG_ISDN_WITH_ABC
19507 +extern int isdn_auto_dial_helper(isdn_net_local *,struct sk_buff *,int);
19508 +extern void dwisdn_nfw_send(isdn_net_local *lp,int drop_only);
19509 +extern void isdn_net_unreachable(struct net_device *,struct sk_buff *,char *);
19510 +extern void isdn_net_log_skb_dwabc(struct sk_buff *,isdn_net_local *,char *);
19511 +extern void isdn_net_hangup(struct net_device *d);
19512 +extern void isdn_dw_clear_if(ulong pm,isdn_net_local *);
19513 +extern void isdn_dwabc_test_phone(isdn_net_local *);
19514 +extern void isdn_dw_abc_init_func(void);
19515 +extern void isdn_dw_abc_release_func(void);
19516 +extern int isdn_dw_abc_reset_interface(isdn_net_local *,int);
19517 +extern int dwabc_bsd_init(isdn_net_local *lp);
19518 +extern void dwabc_bsd_free(isdn_net_local *lp);
19519 +extern struct sk_buff *dwabc_bsd_compress(isdn_net_local *,struct sk_buff *,struct net_device *);
19520 +extern void dwabc_bsd_first_gen(isdn_net_local *);
19521 +extern struct sk_buff *dwabc_bsd_rx_pkt(isdn_net_local *,struct sk_buff *,struct net_device *);
19522 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
19523 +extern size_t isdn_dw_abc_lcr_readstat(char *,size_t);
19524 +extern ulong isdn_dw_abc_lcr_call_number(isdn_net_local *,isdn_ctrl *);
19525 +extern void isdn_dw_abc_lcr_open(void);
19526 +extern void isdn_dw_abc_lcr_close(void);
19527 +extern int isdn_dw_abc_lcr_ioctl(ulong);
19528 +extern void isdn_dw_abc_lcr_clear(isdn_net_local *);
19529 +extern int isdn_dw_abc_lcr_lock(void);
19530 +extern void isdn_dw_abc_lcr_ulock(void);
19531 +#endif
19532 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
19533 +extern int dw_abc_udp_test(struct sk_buff *skb,struct net_device *ndev);
19534 +#endif
19535 +#endif
19536
19537 #endif /* __KERNEL__ */
19538
19539 --- /dev/null
19540 +++ b/include/linux/isdn_compat.h
19541 @@ -0,0 +1,261 @@
19542 +/* $Id: isdn_compat.h,v 1.53 2001/09/24 13:23:13 kai Exp $
19543 + *
19544 + * Linux ISDN subsystem
19545 + * Compatibility for various Linux kernel versions
19546 + *
19547 + * This software may be used and distributed according to the terms
19548 + * of the GNU General Public License, incorporated herein by reference.
19549 + *
19550 + */
19551 +
19552 +#ifndef _LINUX_ISDN_COMPAT_H
19553 +#define _LINUX_ISDN_COMPAT_H
19554 +
19555 +#ifdef __KERNEL__
19556 +
19557 +#ifndef ISDN_COMPAT_NOT_GENERIC
19558 +/* when using std2kern -u, this part is left out and instead provided
19559 + by the .ctrl files */
19560 +
19561 +#include <linux/version.h>
19562 +
19563 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)
19564 +
19565 +#define set_current_state(sta) (current->state = sta)
19566 +#define module_init(x) int init_module(void) { return x(); }
19567 +#define module_exit(x) void cleanup_module(void) { x(); }
19568 +#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0 = 0; } while (0)
19569 +#define init_MUTEX(x) *(x)=MUTEX
19570 +#define init_MUTEX_LOCKED(x) *(x)=MUTEX_LOCKED
19571 +#define __devinit
19572 +#define __devinitdata
19573 +
19574 +#else /* 2.2.18 and later */
19575 +
19576 +#define COMPAT_HAS_NEW_SETUP
19577 +#define COMPAT_HAS_NEW_WAITQ
19578 +
19579 +#endif
19580 +
19581 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
19582 +
19583 +#define dev_kfree_skb_irq(a) dev_kfree_skb(a)
19584 +#define dev_kfree_skb_any(a) dev_kfree_skb(a)
19585 +#define COMPAT_HAS_2_2_PCI
19586 +#define get_pcibase(ps, nr) ps->base_address[nr]
19587 +#define pci_resource_start_io(pdev, nr) ((pdev)->base_address[nr] & PCI_BASE_ADDRESS_IO_MASK)
19588 +#define pci_resource_start_mem(pdev, nr) ((pdev)->base_address[nr] & PCI_BASE_ADDRESS_MEM_MASK)
19589 +#define pci_get_sub_vendor(pdev, id) pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &id)
19590 +#define pci_get_sub_system(pdev, id) pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &id)
19591 +
19592 +#define __exit
19593 +#define __devinit
19594 +#define __devinitdata
19595 +
19596 +#define net_device device
19597 +#define COMPAT_NO_SOFTNET
19598 +#define netif_running(d) test_bit(LINK_STATE_START, &d->state)
19599 +#define COMPAT_NEED_MPPP_DEFS
19600 +#define spin_lock_bh(lock)
19601 +#define spin_unlock_bh(lock)
19602 +#define COMPAT_NEED_SPIN_LOCK_BH
19603 +#define i_count_read(ic) ic
19604 +#define i_count_inc(ic) ic++
19605 +#define COMPAT_USE_MODCOUNT_LOCK
19606 +#define devfs_register_chrdev(m,n,f) register_chrdev(m,n,f)
19607 +#define devfs_unregister_chrdev(m,n) unregister_chrdev(m,n)
19608 +#define COMPAT_NEED_PCI_IDS
19609 +#define in_irq() (local_irq_count[smp_processor_id()] != 0)
19610 +
19611 +#else /* 2.4.0 and later */
19612 +
19613 +#define pci_resource_start_io(pdev, nr) pci_resource_start(pdev, nr)
19614 +#define pci_resource_start_mem(pdev, nr) pci_resource_start(pdev, nr)
19615 +#define get_pcibase(ps, nr) ps->resource[nr].start
19616 +#define pci_get_sub_system(pdev, id) id = pdev->subsystem_device
19617 +#define pci_get_sub_vendor(pdev, id) id = pdev->subsystem_vendor
19618 +
19619 +#define BIG_PHONE_NUMBERS
19620 +#define COMPAT_HAS_ISA_IOREMAP
19621 +#define i_count_read(ic) atomic_read(&ic)
19622 +#define i_count_inc(ic) atomic_inc(&ic)
19623 +#define COMPAT_HAS_FILEOP_OWNER
19624 +#define COMPAT_HAVE_NEW_FILLDIR
19625 +#define COMPAT_has_fileops_in_inode
19626 +#define COMPAT_HAS_init_special_inode
19627 +#define COMPAT_d_alloc_root_one_parameter
19628 +#define HAVE_DEVFS_FS
19629 +#define COMPAT_HAS_SCHEDULE_TASK
19630 +#define COMPAT_HAS_USB_IDTAB
19631 +
19632 +#endif
19633 +
19634 +#endif /* ISDN_COMPAT_GENERIC */
19635 +
19636 +#ifdef COMPAT_HAS_2_2_PCI
19637 +#include <linux/pci.h>
19638 +#ifdef __powerpc__
19639 +static inline int pci_enable_device(struct pci_dev *dev)
19640 +{
19641 + u16 cmd;
19642 + pci_read_config_word(dev, PCI_COMMAND, &cmd);
19643 + cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_IO | PCI_COMMAND_SERR;
19644 + cmd &= ~PCI_COMMAND_FAST_BACK;
19645 + pci_write_config_word(dev, PCI_COMMAND, cmd);
19646 + return(0);
19647 +}
19648 +#else
19649 +static inline int pci_enable_device(struct pci_dev *dev)
19650 +{
19651 + return 0;
19652 +}
19653 +#endif /* __powerpc__ */
19654 +
19655 +#define PCI_ANY_ID (~0)
19656 +
19657 +/* as this is included multiple times, we make it inline */
19658 +
19659 +static inline struct pci_dev * pci_find_subsys(unsigned int vendor, unsigned int device,
19660 + unsigned int ss_vendor, unsigned int ss_device,
19661 + struct pci_dev *from)
19662 +{
19663 + unsigned short subsystem_vendor, subsystem_device;
19664 +
19665 + while ((from = pci_find_device(vendor, device, from))) {
19666 + pci_read_config_word(from, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor);
19667 + pci_read_config_word(from, PCI_SUBSYSTEM_ID, &subsystem_device);
19668 + if ((ss_vendor == PCI_ANY_ID || subsystem_vendor == ss_vendor) &&
19669 + (ss_device == PCI_ANY_ID || subsystem_device == ss_device))
19670 + return from;
19671 + }
19672 + return NULL;
19673 +}
19674 +#endif
19675 +
19676 +#ifdef COMPAT_NO_SOFTNET
19677 +#include <linux/netdevice.h>
19678 +
19679 +/*
19680 + * Tell upper layers that the network device is ready to xmit more frames.
19681 + */
19682 +static void __inline__ netif_wake_queue(struct net_device * dev)
19683 +{
19684 + dev->tbusy = 0;
19685 + mark_bh(NET_BH);
19686 +}
19687 +
19688 +/*
19689 + * called during net_device open()
19690 + */
19691 +static void __inline__ netif_start_queue(struct net_device * dev)
19692 +{
19693 + dev->tbusy = 0;
19694 + /* actually, we never use the interrupt flag at all */
19695 + dev->interrupt = 0;
19696 + dev->start = 1;
19697 +}
19698 +
19699 +/*
19700 + * Ask upper layers to temporarily cease passing us more xmit frames.
19701 + */
19702 +static void __inline__ netif_stop_queue(struct net_device * dev)
19703 +{
19704 + dev->tbusy = 1;
19705 +}
19706 +
19707 +#endif /* COMPAT_NO_SOFTNET */
19708 +
19709 +#ifndef COMPAT_HAS_NEW_WAITQ
19710 +typedef struct wait_queue wait_queue_t;
19711 +typedef struct wait_queue *wait_queue_head_t;
19712 +
19713 +#define DECLARE_WAITQUEUE(wait, current) struct wait_queue wait = { current, NULL }
19714 +#define DECLARE_WAIT_QUEUE_HEAD(wait) wait_queue_head_t wait
19715 +#define init_waitqueue_head(x) *(x)=NULL
19716 +#define init_waitqueue_entry(q,p) ((q)->task)=(p)
19717 +#endif /* COMPAT_HAS_NEW_WAITQ */
19718 +
19719 +#ifdef COMPAT_NEED_PCI_IDS
19720 +
19721 +#define PCI_ANY_ID (~0)
19722 +
19723 +#define PCI_VENDOR_ID_DYNALINK 0x0675
19724 +#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702
19725 +
19726 +#define PCI_DEVICE_ID_WINBOND2_6692 0x6692
19727 +
19728 +#define PCI_DEVICE_ID_PLX_R685 0x1030
19729 +#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151
19730 +#define PCI_DEVICE_ID_PLX_R753 0x1152
19731 +
19732 +#define PCI_VENDOR_ID_ELSA 0x1048
19733 +#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000
19734 +#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
19735 +
19736 +#define PCI_VENDOR_ID_EICON 0x1133
19737 +#define PCI_DEVICE_ID_EICON_DIVA20PRO 0xe001
19738 +#define PCI_DEVICE_ID_EICON_DIVA20 0xe002
19739 +#define PCI_DEVICE_ID_EICON_DIVA20PRO_U 0xe003
19740 +#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004
19741 +#define PCI_DEVICE_ID_EICON_DIVA201 0xe005
19742 +#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010
19743 +#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012
19744 +#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013
19745 +#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014
19746 +
19747 +#define PCI_VENDOR_ID_CCD 0x1397
19748 +#define PCI_DEVICE_ID_CCD_2BD0 0x2BD0
19749 +#define PCI_DEVICE_ID_CCD_B000 0xB000
19750 +#define PCI_DEVICE_ID_CCD_B006 0xB006
19751 +#define PCI_DEVICE_ID_CCD_B007 0xB007
19752 +#define PCI_DEVICE_ID_CCD_B008 0xB008
19753 +#define PCI_DEVICE_ID_CCD_B009 0xB009
19754 +#define PCI_DEVICE_ID_CCD_B00A 0xB00A
19755 +#define PCI_DEVICE_ID_CCD_B00B 0xB00B
19756 +#define PCI_DEVICE_ID_CCD_B00C 0xB00C
19757 +#define PCI_DEVICE_ID_CCD_B100 0xB100
19758 +
19759 +#define PCI_VENDOR_ID_ASUSTEK 0x1043
19760 +#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675
19761 +
19762 +#define PCI_VENDOR_ID_BERKOM 0x0871
19763 +#define PCI_DEVICE_ID_BERKOM_A1T 0xFFA1
19764 +#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xFFA2
19765 +#define PCI_DEVICE_ID_BERKOM_A4T 0xFFA4
19766 +#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xFFA8
19767 +
19768 +#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016
19769 +
19770 +#define PCI_DEVICE_ID_TIGERJET_100 0x0002
19771 +
19772 +#define PCI_VENDOR_ID_ANIGMA 0x1051
19773 +#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100
19774 +
19775 +#define PCI_VENDOR_ID_ZOLTRIX 0x15b0
19776 +#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2BD0
19777 +
19778 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070
19779 +#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
19780 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
19781 +#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073
19782 +
19783 +#define PCI_DEVICE_ID_AVM_B1 0x0700
19784 +#define PCI_DEVICE_ID_AVM_C4 0x0800
19785 +#define PCI_DEVICE_ID_AVM_C2 0x1100
19786 +#define PCI_DEVICE_ID_AVM_T1 0x1200
19787 +
19788 +#define PCI_VENDOR_ID_HYPERCOPE 0x1365
19789 +#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050
19790 +#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104
19791 +#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106
19792 +#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107
19793 +#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108
19794 +#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS 0x0109
19795 +
19796 +#define PCI_VENDOR_ID_ABOCOM 0x13D1
19797 +#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1
19798 +
19799 +#endif /* COMPAT_NEED_PCI_IDS */
19800 +
19801 +#endif /* __KERNEL__ */
19802 +#endif /* _LINUX_ISDN_COMPAT_H */
19803 --- a/include/linux/isdn_divertif.h
19804 +++ b/include/linux/isdn_divertif.h
19805 @@ -1,4 +1,4 @@
19806 -/* $Id: isdn_divertif.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
19807 +/* $Id$
19808 *
19809 * Header for the diversion supplementary interface for i4l.
19810 *
19811 @@ -14,7 +14,7 @@
19812 /***********************************************************/
19813 /* magic value is also used to control version information */
19814 /***********************************************************/
19815 -#define DIVERT_IF_MAGIC 0x25873401
19816 +#define DIVERT_IF_MAGIC 0x25873402
19817 #define DIVERT_CMD_REG 0x00 /* register command */
19818 #define DIVERT_CMD_REL 0x01 /* release command */
19819 #define DIVERT_NO_ERR 0x00 /* return value no error */
19820 @@ -34,6 +34,7 @@ typedef struct
19821 int (*ll_cmd)(isdn_ctrl *); /* supplied by hl on return */
19822 char * (*drv_to_name)(int); /* map a driver id to name, supplied by hl */
19823 int (*name_to_drv)(char *); /* map a driver id to name, supplied by hl */
19824 + int (*dial_net_name)(char *); /* force dial of a ll net interface */
19825 } isdn_divert_if;
19826
19827 /*********************/
19828 --- /dev/null
19829 +++ b/include/linux/isdn_dwabc.h
19830 @@ -0,0 +1,84 @@
19831 +/* $Id: isdn_dwabc.h,v 1.9 2001/09/26 20:32:08 detabc Exp $
19832 + *
19833 + * Header for the Linux ISDN abc-extension.
19834 + *
19835 + * Copyright by abc GmbH
19836 + * written by Detlef Wengorz <detlefw@isdn4linux.de>
19837 + *
19838 + * This software may be used and distributed according to the terms
19839 + * of the GNU General Public License, incorporated herein by reference.
19840 + *
19841 + */
19842 +
19843 +#ifndef ISDN_DWABC_H
19844 +#define ISDN_DWABC_H
19845 +
19846 +#ifdef __KERNEL__
19847 +#include <linux/types.h>
19848 +#include <linux/kernel.h>
19849 +#include <linux/sched.h>
19850 +#include <linux/smp.h>
19851 +#include <linux/spinlock.h>
19852 +#include <linux/errno.h>
19853 +
19854 +
19855 +typedef struct ISDN_DWSPINLOCK {
19856 +
19857 + spinlock_t spin;
19858 + short owner;
19859 + short my_flags;
19860 + ulong irq_flags;
19861 +
19862 +} ISDN_DWSPINLOCK;
19863 +
19864 +#define ISDN_DWSPIN_UNLOCKED \
19865 + (ISDN_DWSPINLOCK) { \
19866 + spin: SPIN_LOCK_UNLOCKED, \
19867 + owner: -1, \
19868 + my_flags: 0, \
19869 + irq_flags: 0, \
19870 + }
19871 +
19872 +#define ISDN_DWSPIN_INIT(x) \
19873 + do { *(x) = ISDN_DWSPIN_UNLOCKED; } while(0);
19874 +
19875 +static __inline__ int isdn_dwspin_trylock(ISDN_DWSPINLOCK *spin)
19876 +{
19877 + if(!spin_trylock(&spin->spin)) {
19878 +
19879 + if(spin->owner == smp_processor_id())
19880 + return(-EAGAIN);
19881 +
19882 + spin_lock(&spin->spin);
19883 + }
19884 +
19885 + spin->owner = smp_processor_id();
19886 + return(0);
19887 +}
19888 +
19889 +static __inline__ void isdn_dwspin_unlock(ISDN_DWSPINLOCK *spin)
19890 +{
19891 + spin->owner = -1;
19892 + spin_unlock(&spin->spin);
19893 +}
19894 +
19895 +
19896 +#else
19897 +#include <sys/types.h>
19898 +#endif
19899 +
19900 +#define DWABC_LCR_FLG_NEWNUMBER 0x00000001L
19901 +#define DWABC_LCR_FLG_DISABLE 0x00000002L
19902 +#define DWABC_LCR_FLG_NEWHUPTIME 0x00000004L
19903 +
19904 +
19905 +struct ISDN_DWABC_LCR_IOCTL {
19906 +
19907 + int lcr_ioctl_sizeof; /* mustbe sizeof(ISDN_DWABC_LCR_IOCTL) */
19908 + u_short lcr_ioctl_onhtime; /* new hanguptime */
19909 + u_long lcr_ioctl_callid; /* callid from lcr-subsystem */
19910 + u_long lcr_ioctl_flags; /* see above */
19911 + char lcr_ioctl_nr[32]; /* new destination phonenumber */
19912 +};
19913 +
19914 +#endif
19915 --- a/include/linux/isdn_lzscomp.h
19916 +++ b/include/linux/isdn_lzscomp.h
19917 @@ -1,4 +1,4 @@
19918 -/* $Id: isdn_lzscomp.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
19919 +/* $Id$
19920 *
19921 * Header for isdn_lzscomp.c
19922 * Concentrated here to not mess up half a dozen kernel headers with code
19923 --- a/include/linux/isdn_ppp.h
19924 +++ b/include/linux/isdn_ppp.h
19925 @@ -8,6 +8,7 @@
19926 #ifndef _LINUX_ISDN_PPP_H
19927 #define _LINUX_ISDN_PPP_H
19928
19929 +#include <linux/isdn_compat.h>
19930
19931 #define CALLTYPE_INCOMING 0x1
19932 #define CALLTYPE_OUTGOING 0x2
19933 @@ -33,6 +34,11 @@ struct pppcallinfo
19934 #define PPPIOCSCOMPRESSOR _IOW('t',135,int)
19935 #define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
19936
19937 +#ifdef COMPAT_NEED_MPPP_DEFS
19938 +#define PPP_MP 0x003d
19939 +#define PPP_COMPFRAG 0x00fb
19940 +#define PPP_CCPFRAG 0x80fb
19941 +#endif
19942
19943 #define SC_MP_PROT 0x00000200
19944 #define SC_REJ_MP_PROT 0x00000400
19945 @@ -65,9 +71,6 @@ struct isdn_ppp_comp_data {
19946
19947 #include <linux/config.h>
19948
19949 -#ifdef CONFIG_IPPP_FILTER
19950 -#include <linux/filter.h>
19951 -#endif
19952
19953 #define DECOMP_ERR_NOMEM (-10)
19954
19955 @@ -226,10 +229,6 @@ struct ippp_struct {
19956 unsigned char *cbuf;
19957 struct slcompress *slcomp;
19958 #endif
19959 -#ifdef CONFIG_IPPP_FILTER
19960 - struct sock_fprog pass_filter; /* filter for packets to pass */
19961 - struct sock_fprog active_filter; /* filter for pkts to reset idle */
19962 -#endif
19963 unsigned long debug;
19964 struct isdn_ppp_compressor *compressor,*decompressor;
19965 struct isdn_ppp_compressor *link_compressor,*link_decompressor;
19966 --- a/include/linux/isdnif.h
19967 +++ b/include/linux/isdnif.h
19968 @@ -1,4 +1,4 @@
19969 -/* $Id: isdnif.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
19970 +/* $Id: isdnif.h,v 1.43 2002/02/09 21:19:11 keil Exp $
19971 *
19972 * Linux ISDN subsystem
19973 * Definition of the interface between the subsystem and its low-level drivers.
19974 @@ -14,6 +14,7 @@
19975 #ifndef __ISDNIF_H__
19976 #define __ISDNIF_H__
19977
19978 +#include <linux/isdn_compat.h>
19979
19980 /*
19981 * Values for general protocol-selection
19982 @@ -213,6 +214,8 @@ typedef struct
19983 #define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */
19984 #define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */
19985 #define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */
19986 +#define ISDN_STAT_ALERT 279 /* Signal alerting */
19987 +#define ISDN_STAT_PROCEED 280 /* Signal proceeding */
19988
19989 /*
19990 * Audio commands
19991 --- a/include/linux/kernelcapi.h
19992 +++ b/include/linux/kernelcapi.h
19993 @@ -1,12 +1,10 @@
19994 -/* $Id: kernelcapi.h,v 1.1.4.2 2002/01/28 18:25:10 kai Exp $
19995 +/*
19996 + * $Id: kernelcapi.h,v 1.9 2000/11/28 09:34:02 kai Exp $
19997 *
19998 * Kernel CAPI 2.0 Interface for Linux
19999 *
20000 * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
20001 *
20002 - * This software may be used and distributed according to the terms
20003 - * of the GNU General Public License, incorporated herein by reference.
20004 - *
20005 */
20006
20007 #ifndef __KERNELCAPI_H__
This page took 0.826935 seconds and 5 git commands to generate.