c9833e2a30f64180f23337861e481ad4cdf414bc
[openwrt.git] / target / linux / linux-2.4 / patches / 200-i4l.patch
1 diff -rNu linux-2.4.29.old/Documentation/isdn/CREDITS linux-2.4.29/Documentation/isdn/CREDITS
2 --- linux-2.4.29.old/Documentation/isdn/CREDITS 2005-03-22 14:48:26.000000000 +0100
3 +++ linux-2.4.29/Documentation/isdn/CREDITS     2005-03-22 15:06:50.246454160 +0100
4 @@ -37,7 +37,7 @@
5  Andreas Kool (akool@Kool.f.EUnet.de)
6    For contribution of the isdnlog/isdnrep-tool
7  
8 -Pedro Roque Marques (pedro_m@yahoo.com)
9 +Pedro Roque Marques (roque@di.fc.ul.pt)
10    For lot of new ideas and the pcbit driver.
11  
12  Eberhard Moenkeberg (emoenke@gwdg.de)
13 diff -rNu linux-2.4.29.old/Documentation/isdn/HiSax.cert linux-2.4.29/Documentation/isdn/HiSax.cert
14 --- linux-2.4.29.old/Documentation/isdn/HiSax.cert      2005-03-22 14:48:26.000000000 +0100
15 +++ linux-2.4.29/Documentation/isdn/HiSax.cert  2005-03-22 15:06:50.264451424 +0100
16 @@ -68,6 +68,8 @@
17  drivers/isdn/hisax/elsa.c
18  drivers/isdn/hisax/diva.c
19  drivers/isdn/hisax/hfc_pci.c
20 +drivers/isdn/hisax/hfc_usbr.c
21 +drivers/isdn/hisax/hfc_usb.c
22  
23  Please send any changes, bugfixes and patches to me rather than implementing
24  them directly into the HiSax sources.
25 diff -rNu linux-2.4.29.old/Documentation/isdn/INTERFACE linux-2.4.29/Documentation/isdn/INTERFACE
26 --- linux-2.4.29.old/Documentation/isdn/INTERFACE       2005-03-22 14:48:26.000000000 +0100
27 +++ linux-2.4.29/Documentation/isdn/INTERFACE   2005-03-22 15:06:50.288447776 +0100
28 @@ -1,4 +1,4 @@
29 -$Id: INTERFACE,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
30 +$Id: INTERFACE,v 1.17 2002/01/31 13:26:35 keil Exp $
31  
32  Description of the Interface between Linklevel and Hardwarelevel
33    of isdn4linux:
34 @@ -399,7 +399,7 @@
35                      protocol-Id is one of the constants ISDN_PROTO_L3...
36        parm.fax    = Pointer to T30_s fax struct. (fax usage only)
37  
38 -  ISDN_CMD_GETL2: (currently unused)
39 +  ISDN_CMD_GETL3: (currently unused)
40  
41      With this command, the HL-driver is told to return the current
42      setting of the Layer-3-protocol.
43 @@ -781,3 +781,22 @@
44        arg         = channel-number, locally to the driver. (starting with 0)
45        parm        = unused.
46  
47 +  ISDN_STAT_ALERT:
48 +
49 +    With this call, the HL-driver signals the receive of an ALERTING message to the LL.
50 +
51 +    Parameter:
52 +      driver      = driver-Id
53 +      command     = ISDN_STAT_ALERT
54 +      arg         = channel-number, locally to the driver. (starting with 0)
55 +
56 +  ISDN_STAT_PROCEED:
57 +
58 +    With this call, the HL-driver signals the receive of an CALL PROCEEDING message
59 +    to the LL.
60 +
61 +    Parameter:
62 +      driver      = driver-Id
63 +      command     = ISDN_STAT_PROCEED
64 +      arg         = channel-number, locally to the driver. (starting with 0)
65 +
66 diff -rNu linux-2.4.29.old/Documentation/isdn/INTERFACE.fax linux-2.4.29/Documentation/isdn/INTERFACE.fax
67 --- linux-2.4.29.old/Documentation/isdn/INTERFACE.fax   2005-03-22 14:48:26.000000000 +0100
68 +++ linux-2.4.29/Documentation/isdn/INTERFACE.fax       2005-03-22 15:06:50.312444128 +0100
69 @@ -1,4 +1,4 @@
70 -$Id: INTERFACE.fax,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
71 +$Id: INTERFACE.fax,v 1.2 2000/08/06 09:22:50 armin Exp $
72  
73  
74  Description of the fax-subinterface between linklevel and hardwarelevel of 
75 diff -rNu linux-2.4.29.old/Documentation/isdn/README linux-2.4.29/Documentation/isdn/README
76 --- linux-2.4.29.old/Documentation/isdn/README  2005-03-22 14:48:26.000000000 +0100
77 +++ linux-2.4.29/Documentation/isdn/README      2005-03-22 15:06:50.340439872 +0100
78 @@ -278,6 +278,12 @@
79                                        1 = Add CPN to FCON message on
80                              Bit 2:    0 = Add CDN to RING/FCON message off
81                                        1 = Add CDN to RING/FCON message on
82 +                            Bit 3:    0 = Do not signal RINGING
83 +                                      1 = Signal RINGING if ALERT was received
84 +                            Bit 4:    0 = Do not signal PROCEEDING
85 +                                      1 = Signal PROCEEDING if CALL PROCEEDING
86 +                                          was received
87 +
88  
89    Last but not least a (at the moment fairly primitive) device to request
90    the line-status (/dev/isdninfo) is made available.
91 diff -rNu linux-2.4.29.old/Documentation/isdn/README.HiSax linux-2.4.29/Documentation/isdn/README.HiSax
92 --- linux-2.4.29.old/Documentation/isdn/README.HiSax    2005-03-22 14:48:26.000000000 +0100
93 +++ linux-2.4.29/Documentation/isdn/README.HiSax        2005-03-22 15:06:50.372435008 +0100
94 @@ -41,10 +41,9 @@
95  ELSA Quickstep 3000PCI
96  ELSA PCMCIA
97  ITK ix1-micro Rev.2
98 -Eicon Diva 2.0 ISA and PCI (S0 and U interface, no PRO version)
99 -Eicon Diva 2.01 ISA and PCI
100 -Eicon Diva 2.02 PCI
101 -Eicon Diva Piccola
102 +Eicon.Diehl Diva 2.0 ISA and PCI (S0 and U interface, no PRO version)
103 +Eicon.Diehl Diva 2.01 ISA and PCI
104 +Eicon.Diehl Diva Piccola
105  ASUSCOM NETWORK INC. ISDNLink 128K PC adapter (order code I-IN100-ST-D)
106  Dynalink IS64PH (OEM version of ASUSCOM NETWORK INC. ISDNLink 128K adapter)
107  PCBIT-DP (OEM version of ASUSCOM NETWORK INC. ISDNLink)
108 @@ -53,7 +52,6 @@
109  Sedlbauer Speed Star/Speed Star2 (PCMCIA)
110  Sedlbauer ISDN-Controller PC/104
111  USR Sportster internal TA (compatible Stollmann tina-pp V3)
112 -USR internal TA PCI
113  ith Kommunikationstechnik GmbH MIC 16 ISA card
114  Traverse Technologie NETjet PCI S0 card and NETspider U card
115  Ovislink ISDN sc100-p card (NETjet driver)
116 @@ -68,14 +66,14 @@
117  HFC-PCI based cards
118  Winbond W6692 based cards
119  HFC-S+, HFC-SP/PCMCIA cards
120 -formula-n enternow
121 -Gerdes Power ISDN
122 +HFC-USB ISDN TAs
123  
124  Note: PCF, PCF-Pro: up to now, only the ISDN part is supported
125        PCC-8: not tested yet
126        Eicon.Diehl Diva U interface not tested
127  
128  If you know other passive cards with the Siemens chipset, please let me know.
129 +To use the PNP cards you need the isapnptools.
130  You can combine any card, if there is no conflict between the resources
131  (io, mem, irq).
132  
133 @@ -91,15 +89,8 @@
134  modules. It is included in the normal "make [menu]config" target at the
135  kernel. Don't forget it, especially to select the right D-channel protocol.
136  
137 -Please note: In older versions of the HiSax driver, all PnP cards
138 -needed to be configured with isapnp and worked only with the HiSax
139 -driver used as a module.
140 -
141 -In the current version, HiSax will automatically use the in-kernel
142 -ISAPnP support, provided you selected it during kernel configuration
143 -(CONFIG_ISAPNP), if you don't give the io=, irq= command line parameters.
144 -
145 -The affected card types are: 4,7,12,14,19,27-30
146 +Please note: All PnP cards need to be configured with isapnp and will work
147 +only with the HiSax driver used as a module.
148  
149  a) when built as a module
150  -------------------------
151 @@ -200,8 +191,6 @@
152     37  HFC 2BDS0 S+, SP         irq,io 
153     38  NETspider U PCI card     none
154     39  HFC 2BDS0 SP/PCMCIA      irq,io (set with cardmgr)
155 -   40   hotplug interface
156 -   41   Formula-n enter:now PCI  none
157  
158  At the moment IRQ sharing is only possible with PCI cards. Please make sure
159  that your IRQ is free and enabled for ISA use.
160 @@ -227,13 +216,6 @@
161                     (IO 1 (BASE 0x0180))
162     modprobe hisax type=4 protocol=2 irq=10 io0=0x580 io1=0x180
163  
164 -   In the current version of HiSax, you can instead simply use
165 -
166 -   modprobe hisax type=4 protocol=2
167 -
168 -   if you configured your kernel for ISAPnP. Don't run isapnp in
169 -   this case!
170 -
171  6. Teles 16.3, Euro ISDN, I/O base 280 hex, IRQ 12 and
172     Teles 16.0, 1TR6, IRQ 5, Memory d0000 hex
173     modprobe hisax type=3,1 protocol=2,1 io=0x280 mem=0,0xd0000
174 @@ -314,9 +296,7 @@
175     36  W6692 based PCI cards   none
176     37  HFC 2BDS0 S+,SP/PCMCIA  ONLY WORKS AS A MODULE !
177     38  NETspider U PCI card    none
178 -   39  HFC 2BDS0 SP/PCMCIA     ONLY WORKS AS A MODULE !
179 -   40   hotplug interface      ONLY WORKS AS A MODULE !
180 -   41   Formula-n enter:now PCI none
181 +
182  
183  Running the driver
184  ------------------
185 diff -rNu linux-2.4.29.old/Documentation/isdn/README.act2000 linux-2.4.29/Documentation/isdn/README.act2000
186 --- linux-2.4.29.old/Documentation/isdn/README.act2000  2005-03-22 14:48:26.000000000 +0100
187 +++ linux-2.4.29/Documentation/isdn/README.act2000      2005-03-22 15:06:50.388432576 +0100
188 @@ -1,4 +1,4 @@
189 -$Id: README.act2000,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
190 +$Id: README.act2000,v 1.3 2000/08/06 09:22:51 armin Exp $
191  
192  This document describes the ACT2000 driver for the
193  IBM Active 2000 ISDN card.
194 diff -rNu linux-2.4.29.old/Documentation/isdn/README.audio linux-2.4.29/Documentation/isdn/README.audio
195 --- linux-2.4.29.old/Documentation/isdn/README.audio    2005-03-22 14:48:26.000000000 +0100
196 +++ linux-2.4.29/Documentation/isdn/README.audio        2005-03-22 15:06:50.404430144 +0100
197 @@ -1,4 +1,4 @@
198 -$Id: README.audio,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
199 +$Id: README.audio,v 1.8 1999/07/11 17:17:29 armin Exp $
200  
201  ISDN subsystem for Linux.
202    Description of audio mode.
203 diff -rNu linux-2.4.29.old/Documentation/isdn/README.eicon linux-2.4.29/Documentation/isdn/README.eicon
204 --- linux-2.4.29.old/Documentation/isdn/README.eicon    2005-03-22 14:48:26.000000000 +0100
205 +++ linux-2.4.29/Documentation/isdn/README.eicon        2005-03-22 15:06:50.479418744 +0100
206 @@ -1,4 +1,4 @@
207 -$Id: README.eicon,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
208 +$Id: README.eicon,v 1.10 2000/08/13 12:19:15 armin Exp $
209  
210  (c) 1999,2000 Armin Schindler (mac@melware.de)
211  (c) 1999,2000 Cytronics & Melware (info@melware.de)
212 diff -rNu linux-2.4.29.old/Documentation/isdn/README.hysdn linux-2.4.29/Documentation/isdn/README.hysdn
213 --- linux-2.4.29.old/Documentation/isdn/README.hysdn    2005-03-22 14:48:26.000000000 +0100
214 +++ linux-2.4.29/Documentation/isdn/README.hysdn        2005-03-22 15:06:50.522412208 +0100
215 @@ -1,4 +1,4 @@
216 -$Id: README.hysdn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
217 +$Id: README.hysdn,v 1.3.6.1 2001/02/10 14:41:19 kai Exp $
218  The hysdn driver has been written by
219  by Werner Cornelius (werner@isdn4linux.de or werner@titro.de) 
220  for Hypercope GmbH Aachen Germany. Hypercope agreed to publish this driver
221 diff -rNu linux-2.4.29.old/Documentation/isdn/README.icn linux-2.4.29/Documentation/isdn/README.icn
222 --- linux-2.4.29.old/Documentation/isdn/README.icn      2005-03-22 14:48:26.000000000 +0100
223 +++ linux-2.4.29/Documentation/isdn/README.icn  2005-03-22 15:06:50.550407952 +0100
224 @@ -1,4 +1,4 @@
225 -$Id: README.icn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
226 +$Id: README.icn,v 1.7 2000/08/06 09:22:51 armin Exp $
227  
228  You can get the ICN-ISDN-card from:
229  
230 diff -rNu linux-2.4.29.old/Documentation/isdn/README.pcbit linux-2.4.29/Documentation/isdn/README.pcbit
231 --- linux-2.4.29.old/Documentation/isdn/README.pcbit    2005-03-22 14:48:26.000000000 +0100
232 +++ linux-2.4.29/Documentation/isdn/README.pcbit        2005-03-22 15:06:50.567405368 +0100
233 @@ -37,4 +37,4 @@
234  regards,
235    Pedro.
236                 
237 -<pedro_m@yahoo.com>
238 +<roque@di.fc.ul.pt>
239 diff -rNu linux-2.4.29.old/Documentation/isdn/abcext_kernel.help linux-2.4.29/Documentation/isdn/abcext_kernel.help
240 --- linux-2.4.29.old/Documentation/isdn/abcext_kernel.help      1970-01-01 01:00:00.000000000 +0100
241 +++ linux-2.4.29/Documentation/isdn/abcext_kernel.help  2005-03-22 15:06:50.600400352 +0100
242 @@ -0,0 +1,166 @@
243
244 +ISDN-ABC-DW Extension
245 +CONFIG_ISDN_WITH_ABC
246 +   These are many brand new Options and Features for the
247 +   ISDN SUBSYSTEM. Including Logical Device bindings,
248 +   Compression and other good stuff for Optimizing your
249 +   ISDN System.
250 +
251 +   To Use this Extensions you MUST HAVE THE NEWEST
252 +   ISDN4K-UTILS. You must have Version 3.1-Beta6 or
253 +   higher. Elsewhere you can not configure this Extensions.
254 +
255 +   WARNING ! THIS STUF IS NOT PRODUCTION RELEASE THE
256 +   FUNCTION ARE UNDER DEVELOPMENT. This ist BETA-CODE.
257 +   You can use it at you Own Risk.
258 +
259 +   For more Information on these Extensions take a look at
260 +   "linux/Documentation/isdn/dw-abc-extension-howto.txt or
261 +   Online at the Web "http://www.mediatronix.de/i4l/index.html"
262 +
263 +   Please Report Bugs to "mario@mediatronix.de" or
264 +   "delefw@isdn4linux.de"
265 +
266 +D-Channel-Callback with Channel in use check
267 +CONFIG_ISDN_WITH_ABC_CALLB
268 +   When a Interface is declared as an Callback Interface,
269 +   the Interface is checking that the other Side is not
270 +   Calling on the same time before the Interface is Dialing.
271 +
272 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
273 +   for more Information
274 +
275 +   In most case answer with "Yes" when you have Callback devices,
276 +   otherwise leave it "No"
277 +
278 +Outgoing-EAZ-Support
279 +CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
280 +   Enables the Feature to Define an other EAZ or MSN for
281 +   Outgoing calls on an Interface.
282 +
283 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
284 +   for more Information
285 +
286 +Least Cost Router Support
287 +CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
288 +   This is the final Kernel Code for configuring an Least
289 +   Cost Router Softwarebased. The other Job is to do the
290 +   action in ISDNLOG. You need the ISDNLOG to use this 
291 +   function. Currently the ISDNLOG have not the Support for
292 +   this Option.
293 +   So in most situations let the Option off.
294 +
295 +TCP keepalive detect and response
296 +CONFIG_ISDN_WITH_ABC_IPV4_TCP_KEEPALIVE
297 +   This Option works only with the TCP/IP V4. It enables
298 +   the Function that ISDN Devices are Answering TCP_KEEPALIVE Pakets
299 +   localy. So that TCP KEEPALIVE Pakets not longer takes the Line
300 +   open.
301 +
302 +Drop frames Sourceadresse is not Interfaceadress
303 +CONFIG_ISDN_WITH_ABC_IPV4_DYNADDR
304 +   This Option works only with the TCP/IP V4. It will allow only
305 +   the Transmitt of Pakets where the Sourceadresse is the Interface
306 +   adress. It is usefull when you have Lines with Dynamic IP.
307 +
308 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
309 +   for more Information
310 +
311 +Receive do not reset the Hanguptimer
312 +CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
313 +   When you activate this option than the reiceive of pakets do
314 +   not reset the Hanguptimer. It is very usefull because if the
315 +   Paket vor your Network your Network generate an Response and
316 +   the Transmit is reseting the HUPTIMER. But when the Paket is
317 +   Rejected at your firewall your network generate no Response
318 +   and no Sendtraffic is generated. So in this case there is no 
319 +   need to Reset the Huptimer because you have only received Data.
320 +   With that option only Transmitted Data/Pakets will reset the
321 +   HUPTIMER.
322 +
323 +Support of (device-channel) and Binding Groups
324 +CONFIG_ISDN_WITH_ABC_ICALL_BIND
325 +   This Option enables the Feature to Bind logical ISDN Interfaces
326 +   to an prefered ISDN Card or ISDN Card plus Channel. So you have
327 +   the Chance to keep Channels exclusively for one (or more) 
328 +   Connection. Very usefull when you have more channels and Use 
329 +   Calling Line Identification, because you can organize that your
330 +   call is going out over the Line with the right EAZ for the CLI.
331 +
332 +Skip channel if used external (Dial Only)
333 +CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
334 +   When you have more than One ISDN Card in your System and you
335 +   will Dialout with an Interface you can become the Situation
336 +   that an External Device such a Telephone or Fax is Using the
337 +   B-Channels. Normaly ISDN4Linux does not detect this Situation
338 +   and dial everytime of the "External Busy" line out. With this
339 +   Option Enabled the I4L will detect that he can not dialout on
340 +   This Card and dial over the next Card out.
341 +
342 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
343 +   for more Information
344 +
345 +Interface autodisable if Config error
346 +CONFIG_ISDN_WITH_ABC_CONN_ERROR
347 +   This Option will detect an Device which generate Telephone
348 +   Cost but does not Function correctly because there are
349 +   Configerrors on one of the Site. In this Situation the
350 +   Interface will be marked as Unsuably for some time to do
351 +   not call every time this Site.
352 +
353 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
354 +   for more Information
355 +
356 +UDP-Info-Support
357 +CONFIG_ISDN_WITH_ABC_UDP_CHECK
358 +   This is the Mainoption to Enable or Disable the UDP
359 +   Info Support. An Option to Controll ISDN-Interfaces
360 +   Remotely. For this very Complex thing take a look at
361 +
362 +   "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
363 +   for more Information.
364 +
365 +UDP Hangup Support
366 +CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
367 +
368 +   Sorry no more Information!
369 +
370 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
371 +   for more Information
372 +   
373 +UDP Dial Support
374 +CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
375 +
376 +   Sorry no more Information!
377 +
378 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
379 +   for more Information
380 +   
381 +Limit on the line frames to two
382 +CONFIG_ISDN_WITH_ABC_FRAME_LIMIT
383 +
384 +   This Option enables support for sending only 2 Pakets on
385 +   the Fly to the ISDN Driver. It is very usefull when you
386 +   will use the new RAW-IP Compression. Because of sending
387 +   Only 2 Pakets on the Fly makes the risk of overflowing
388 +   the ISDN Driver very smaller.
389 +
390 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
391 +   for more Information
392 +
393 +Compression with RAWIP and X75I
394 +CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
395 +
396 +   With this Option you have the ability to make Datacompression
397 +   on RAW-IP Lines. It is function on HDLC and X75I Connection,
398 +   but the Prefered L2-Protocol for Compression is X75I because
399 +   the HDLC Protocol have no Errorcorrection.
400 +
401 +   To Use this Option YOU MUST HAVE ENABLED THE OPTION:
402 +   Support synchronous PPP
403 +   and must load after loading the main isdndrivers the
404 +   Modul "isdn_bsdcomp".
405 +
406 +   See "linux/Documentation/isdn/dw-abc-extension-howto.txt" 
407 +   for more Information
408 +
409 diff -rNu linux-2.4.29.old/drivers/isdn/Config.in linux-2.4.29/drivers/isdn/Config.in
410 --- linux-2.4.29.old/drivers/isdn/Config.in     2005-03-22 14:47:56.000000000 +0100
411 +++ linux-2.4.29/drivers/isdn/Config.in 2005-03-22 15:06:44.259364336 +0100
412 @@ -4,11 +4,9 @@
413  
414  # only included if CONFIG_ISDN != n
415  
416 -define_bool CONFIG_ISDN_BOOL y
417  if [ "$CONFIG_INET" != "n" ]; then
418     bool '  Support synchronous PPP' CONFIG_ISDN_PPP
419     if [ "$CONFIG_ISDN_PPP" != "n" ]; then
420 -      dep_bool     '    PPP filtering for ISDN' CONFIG_IPPP_FILTER $CONFIG_FILTER
421        bool         '    Use VJ-compression with synchronous PPP' CONFIG_ISDN_PPP_VJ
422        bool         '    Support generic MP (RFC 1717)' CONFIG_ISDN_MPP
423        dep_tristate '    Support BSD compression' CONFIG_ISDN_PPP_BSDCOMP $CONFIG_ISDN
424 @@ -23,6 +21,30 @@
425  fi
426  
427  mainmenu_option next_comment
428 +comment 'ISDN abc-dw-extension'
429 +bool 'Enable isdn-abc-dw-extension' CONFIG_ISDN_WITH_ABC
430 +if [ "$CONFIG_ISDN_WITH_ABC" != "n" ]; then
431 +       bool '  Use D-Channel-Callback with Channel in use check' CONFIG_ISDN_WITH_ABC_CALLB
432 +       bool '  Enable Outgoing-EAZ-Support' CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
433 +       bool '  Enable LCR-Support (need isdnlog)' CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
434 +       bool '  RX dont reset hanguptimeout' CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
435 +       if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
436 +               bool '  Enable UDP-Info-Support' CONFIG_ISDN_WITH_ABC_UDP_CHECK
437 +               if [ "$CONFIG_ISDN_WITH_ABC_UDP_CHECK" != "n" ]; then
438 +                       bool '    Enable Hangup-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
439 +                       bool '    Enable Dial-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
440 +               fi
441 +       fi
442 +
443 +       bool '  Skip channel if used external (dial only)' CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
444 +       bool '  Support interface-auto-disable if config-error' CONFIG_ISDN_WITH_ABC_CONN_ERROR
445 +       if [ "$CONFIG_ISDN_PPP" != "n" ]; then
446 +               bool '  Enable Compression with rawip and x75i' CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
447 +       fi
448 +fi
449 +endmenu
450 +
451 +mainmenu_option next_comment
452  comment 'ISDN feature submodules'
453     dep_tristate 'isdnloop support' CONFIG_ISDN_DRV_LOOP $CONFIG_ISDN
454     dep_tristate 'Support isdn diversion services' CONFIG_ISDN_DIVERSION $CONFIG_ISDN
455 @@ -34,7 +56,6 @@
456  comment 'Passive ISDN cards'
457  dep_tristate 'HiSax SiemensChipSet driver support' CONFIG_ISDN_DRV_HISAX $CONFIG_ISDN
458  if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then
459 -   define_bool CONFIG_ISDN_HISAX y
460     comment '  D-channel protocol features'
461     bool '  HiSax Support for EURO/DSS1' CONFIG_HISAX_EURO
462     if [ "$CONFIG_HISAX_EURO" != "n" ]; then
463 @@ -45,31 +66,28 @@
464     fi
465     bool '  HiSax Support for german 1TR6' CONFIG_HISAX_1TR6
466     bool '  HiSax Support for US NI1' CONFIG_HISAX_NI1
467 -   int  '  Maximum number of cards supported by HiSax' CONFIG_HISAX_MAX_CARDS 8
468     comment '  HiSax supported cards'
469 -   if [ "$CONFIG_ISA" != "n" ]; then
470 -      bool '  Teles 16.0/8.0' CONFIG_HISAX_16_0
471 -      bool '  Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3
472 -      bool '  AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1
473 -      bool '  ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2
474 -      bool '  ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM
475 -      bool '  TELEINT cards' CONFIG_HISAX_TELEINT
476 -      bool '  HFC-S based cards' CONFIG_HISAX_HFCS
477 -      bool '  USR Sportster internal TA' CONFIG_HISAX_SPORTSTER
478 -      bool '  MIC card' CONFIG_HISAX_MIC
479 -      bool '  Siemens I-Surf card' CONFIG_HISAX_ISURF
480 -      bool '  HST Saphir card' CONFIG_HISAX_HSTSAPHIR
481 -   fi
482 +   bool '  Teles 16.0/8.0' CONFIG_HISAX_16_0
483 +   bool '  Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3
484     bool '  Teles PCI' CONFIG_HISAX_TELESPCI 
485     bool '  Teles S0Box' CONFIG_HISAX_S0BOX 
486 +   bool '  AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1
487     bool '  AVM PnP/PCI (Fritz!PnP/PCI)' CONFIG_HISAX_FRITZPCI
488     bool '  AVM A1 PCMCIA (Fritz)' CONFIG_HISAX_AVM_A1_PCMCIA
489     bool '  Elsa cards' CONFIG_HISAX_ELSA
490 +   bool '  ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2
491     bool '  Eicon.Diehl Diva cards' CONFIG_HISAX_DIEHLDIVA
492 +   bool '  ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM
493 +   bool '  TELEINT cards' CONFIG_HISAX_TELEINT
494 +   bool '  HFC-S based cards' CONFIG_HISAX_HFCS
495     bool '  Sedlbauer cards' CONFIG_HISAX_SEDLBAUER
496 +   bool '  USR Sportster internal TA' CONFIG_HISAX_SPORTSTER
497 +   bool '  MIC card' CONFIG_HISAX_MIC
498     bool '  NETjet card' CONFIG_HISAX_NETJET
499     bool '  NETspider U card' CONFIG_HISAX_NETJET_U
500     bool '  Niccy PnP/PCI card' CONFIG_HISAX_NICCY
501 +   bool '  Siemens I-Surf card' CONFIG_HISAX_ISURF
502 +   bool '  HST Saphir card' CONFIG_HISAX_HSTSAPHIR
503     bool '  Telekom A4T card' CONFIG_HISAX_BKM_A4T
504     bool '  Scitel Quadro card' CONFIG_HISAX_SCT_QUADRO
505     bool '  Gazel cards' CONFIG_HISAX_GAZEL
506 @@ -78,20 +96,27 @@
507     bool '  HFC-S+, HFC-SP, HFC-PCMCIA cards' CONFIG_HISAX_HFC_SX
508     if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
509  #      bool '  TESTEMULATOR (EXPERIMENTAL)' CONFIG_HISAX_TESTEMU
510 -      bool '  Formula-n enter:now PCI card' CONFIG_HISAX_ENTERNOW_PCI
511        if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then
512          bool '  Am7930' CONFIG_HISAX_AMD7930
513        fi
514     fi
515     bool '  HiSax debugging' CONFIG_HISAX_DEBUG
516  
517 -   dep_tristate 'Sedlbauer PCMCIA cards'                              CONFIG_HISAX_SEDLBAUER_CS  $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
518 -   dep_tristate 'ELSA PCMCIA MicroLink cards'                         CONFIG_HISAX_ELSA_CS       $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
519 -   dep_tristate 'AVM A1 PCMCIA cards'                                 CONFIG_HISAX_AVM_A1_CS     $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA $CONFIG_HISAX_AVM_A1_PCMCIA
520 -   dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)'                CONFIG_HISAX_ST5481        $CONFIG_ISDN_DRV_HISAX    $CONFIG_EXPERIMENTAL
521 -   dep_tristate 'AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP  $CONFIG_ISDN_DRV_HISAX                $CONFIG_EXPERIMENTAL
522 -   dep_tristate 'Auerswald devices ISDN support'                      CONFIG_USB_AUERISDN        $CONFIG_ISDN_DRV_HISAX
523 +   dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_PCMCIA
524 +   dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_PCMCIA
525 +   dep_tristate 'Colognechip HFC-USB support' CONFIG_HISAX_HFC_USB_CS $CONFIG_HISAX $CONFIG_USB
526 +   dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_HISAX $CONFIG_USB $CONFIG_EXPERIMENTAL
527 +   dep_tristate 'Fritz!PCIv2 support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_HISAX $CONFIG_EXPERIMENTAL
528  
529 +   if [ "$CONFIG_HISAX_SEDLBAUER_CS" != "n" ]; then
530 +      define_bool CONFIG_HISAX_SEDLBAUER y
531 +   fi
532 +   if [ "$CONFIG_HISAX_ELSA_CS" != "n" ]; then
533 +      define_bool CONFIG_HISAX_ELSA y
534 +   fi
535 +   if [ "$CONFIG_HISAX_HFC_USB_CS" != "n" ]; then
536 +      define_bool CONFIG_HISAX_HFC_USB y
537 +   fi
538  fi
539  endmenu
540  
541 diff -rNu linux-2.4.29.old/drivers/isdn/Makefile linux-2.4.29/drivers/isdn/Makefile
542 --- linux-2.4.29.old/drivers/isdn/Makefile      2005-03-22 14:47:56.000000000 +0100
543 +++ linux-2.4.29/drivers/isdn/Makefile  2005-03-22 15:06:44.277361600 +0100
544 @@ -2,7 +2,7 @@
545  
546  # The target object and module list name.
547  
548 -O_TARGET       := vmlinux-obj.o
549 +O_TARGET       := isdn.a
550  
551  # Objects that export symbols.
552  
553 @@ -32,9 +32,9 @@
554  
555  # Object files in subdirectories
556  
557 -mod-subdirs                            := avmb1 eicon hisax
558 +mod-subdirs                            := avmb1 eicon
559  subdir-$(CONFIG_ISDN_DIVERSION)                += divert
560 -subdir-$(CONFIG_ISDN_HISAX)            += hisax
561 +subdir-$(CONFIG_ISDN_DRV_HISAX)                += hisax
562  subdir-$(CONFIG_ISDN_DRV_ICN)          += icn
563  subdir-$(CONFIG_ISDN_DRV_PCBIT)                += pcbit
564  subdir-$(CONFIG_ISDN_DRV_SC)           += sc
565 diff -rNu linux-2.4.29.old/drivers/isdn/act2000/act2000.h linux-2.4.29/drivers/isdn/act2000/act2000.h
566 --- linux-2.4.29.old/drivers/isdn/act2000/act2000.h     2005-03-22 14:47:56.000000000 +0100
567 +++ linux-2.4.29/drivers/isdn/act2000/act2000.h 2005-03-22 15:06:44.103388048 +0100
568 @@ -1,4 +1,4 @@
569 -/* $Id: act2000.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
570 +/* $Id$
571   *
572   * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
573   *
574 @@ -178,19 +178,19 @@
575          char regname[35];                /* Name used for request_region     */
576  } act2000_card;
577  
578 -static inline void act2000_schedule_tx(act2000_card *card)
579 +extern __inline__ void act2000_schedule_tx(act2000_card *card)
580  {
581          queue_task(&card->snd_tq, &tq_immediate);
582          mark_bh(IMMEDIATE_BH);
583  }
584  
585 -static inline void act2000_schedule_rx(act2000_card *card)
586 +extern __inline__ void act2000_schedule_rx(act2000_card *card)
587  {
588          queue_task(&card->rcv_tq, &tq_immediate);
589          mark_bh(IMMEDIATE_BH);
590  }
591  
592 -static inline void act2000_schedule_poll(act2000_card *card)
593 +extern __inline__ void act2000_schedule_poll(act2000_card *card)
594  {
595          queue_task(&card->poll_tq, &tq_immediate);
596          mark_bh(IMMEDIATE_BH);
597 diff -rNu linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.c linux-2.4.29/drivers/isdn/act2000/act2000_isa.c
598 --- linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.c 2005-03-22 14:47:56.000000000 +0100
599 +++ linux-2.4.29/drivers/isdn/act2000/act2000_isa.c     2005-03-22 15:06:44.135383184 +0100
600 @@ -1,4 +1,4 @@
601 -/* $Id: act2000_isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
602 +/* $Id$
603   *
604   * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version).
605   *
606 @@ -178,8 +178,7 @@
607                  card->flags &= ~ACT2000_FLAGS_PVALID;
608          }
609          if (!check_region(portbase, ISA_REGION)) {
610 -                if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL)
611 -                       return -EIO;
612 +                request_region(portbase, ACT2000_PORTLEN, card->regname);
613                  card->port = portbase;
614                  card->flags |= ACT2000_FLAGS_PVALID;
615                  return 0;
616 @@ -341,6 +340,9 @@
617                 while (skb->len) {
618                         if (act2000_isa_writeb(card, *(skb->data))) {
619                                 /* Fifo is full, but more data to send */
620 +#if 0
621 +                               printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l);
622 +#endif
623                                 test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock);
624                                 /* Schedule myself */
625                                 act2000_schedule_tx(card);
626 @@ -363,6 +365,9 @@
627                 } else
628                         dev_kfree_skb(skb);
629                 card->sbuf = NULL;
630 +#if 0
631 +               printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l);
632 +#endif
633         }
634  }
635  
636 diff -rNu linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.h linux-2.4.29/drivers/isdn/act2000/act2000_isa.h
637 --- linux-2.4.29.old/drivers/isdn/act2000/act2000_isa.h 2005-03-22 14:47:56.000000000 +0100
638 +++ linux-2.4.29/drivers/isdn/act2000/act2000_isa.h     2005-03-22 15:06:44.152380600 +0100
639 @@ -1,4 +1,4 @@
640 -/* $Id: act2000_isa.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
641 +/* $Id$
642   *
643   * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version).
644   *
645 diff -rNu linux-2.4.29.old/drivers/isdn/act2000/capi.c linux-2.4.29/drivers/isdn/act2000/capi.c
646 --- linux-2.4.29.old/drivers/isdn/act2000/capi.c        2005-03-22 14:47:56.000000000 +0100
647 +++ linux-2.4.29/drivers/isdn/act2000/capi.c    2005-03-22 15:06:44.172377560 +0100
648 @@ -1,4 +1,4 @@
649 -/* $Id: capi.c,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   * CAPI encoder/decoder
654 @@ -76,6 +76,10 @@
655         {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"},
656         {{ 0x86, 0x03}, "DATA_B3_RESP"},
657         {{ 0xff, 0x03}, "MANUFACTURER_RESP"},
658 +#if 0
659 +/* CAPI 2.0 */
660 +       {{ 0x05, 0x80}, "LISTEN_REQ (CAPI 2.0)"},
661 +#endif
662  #endif
663         {{ 0x00, 0x00}, NULL},
664  };
665 diff -rNu linux-2.4.29.old/drivers/isdn/act2000/capi.h linux-2.4.29/drivers/isdn/act2000/capi.h
666 --- linux-2.4.29.old/drivers/isdn/act2000/capi.h        2005-03-22 14:47:56.000000000 +0100
667 +++ linux-2.4.29/drivers/isdn/act2000/capi.h    2005-03-22 15:06:44.187375280 +0100
668 @@ -1,4 +1,4 @@
669 -/* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
670 +/* $Id$
671   *
672   * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
673   *
674 @@ -294,6 +294,19 @@
675                         __u16 plci;
676                         __u16 info;
677                 } select_b3_protocol_conf;
678 +#if 0
679 +               struct listen_req {
680 +                       __u32 controller;
681 +                       __u32 infomask;  
682 +                       __u32 cipmask;
683 +                       __u32 cipmask2;
684 +                       __u16 dummy; /* 2 Length-bytes of 2 Structs MUST always be 0!!! */
685 +               } listen_req;
686 +               struct listen_conf {
687 +                       __u32  controller;
688 +                       __u16 info;
689 +               } listen_conf;
690 +#else
691                 struct listen_req {
692                         __u8  controller;
693                         __u32 infomask __attribute__ ((packed));  
694 @@ -304,6 +317,7 @@
695                         __u8  controller;
696                         __u16 info __attribute__ ((packed));
697                 } listen_conf;
698 +#endif
699                 struct data_b3_req {
700                         __u16 fakencci;
701                         __u16 datalen;
702 @@ -330,7 +344,7 @@
703         } msg;
704  } actcapi_msg;
705  
706 -static inline unsigned short
707 +extern __inline__ unsigned short
708  actcapi_nextsmsg(act2000_card *card)
709  {
710         unsigned long flags;
711 diff -rNu linux-2.4.29.old/drivers/isdn/act2000/module.c linux-2.4.29/drivers/isdn/act2000/module.c
712 --- linux-2.4.29.old/drivers/isdn/act2000/module.c      2005-03-22 14:47:56.000000000 +0100
713 +++ linux-2.4.29/drivers/isdn/act2000/module.c  2005-03-22 15:06:44.202373000 +0100
714 @@ -1,4 +1,4 @@
715 -/* $Id: module.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
716 +/* $Id$
717   *
718   * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
719   *
720 @@ -630,6 +630,10 @@
721          card->interface.features =
722                 ISDN_FEATURE_L2_X75I |
723                 ISDN_FEATURE_L2_HDLC |
724 +#if 0
725 +/* Not yet! New Firmware is on the way ... */
726 +               ISDN_FEATURE_L2_TRANS |
727 +#endif
728                 ISDN_FEATURE_L3_TRANS |
729                 ISDN_FEATURE_P_UNKNOWN;
730          card->interface.hl_hdrlen = 20;
731 @@ -843,6 +847,39 @@
732          }
733          printk(KERN_INFO "%s unloaded\n", DRIVERNAME);
734  }
735 +#if 0
736 +#ifndef MODULE
737 +void
738 +act2000_setup(char *str, int *ints)
739 +{
740 +        int i, j, argc, port, irq, bus;
741 +       
742 +        argc = ints[0];
743 +        i = 1;
744 +        if (argc)
745 +                while (argc) {
746 +                        port = irq = -1;
747 +                       bus = 0;
748 +                        if (argc) {
749 +                                bus = ints[i];
750 +                                i++;
751 +                                argc--;
752 +                        }
753 +                        if (argc) {
754 +                                port = ints[i];
755 +                                i++;
756 +                                argc--;
757 +                        }
758 +                        if (argc) {
759 +                                irq = ints[i];
760 +                                i++;
761 +                                argc--;
762 +                        }
763 +                       act2000_addcard(bus, port, irq, act_id);
764 +               }
765 +}
766 +#endif
767 +#endif
768  
769  module_init(act2000_init);
770  module_exit(act2000_exit);
771 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/avm_cs.c linux-2.4.29/drivers/isdn/avmb1/avm_cs.c
772 --- linux-2.4.29.old/drivers/isdn/avmb1/avm_cs.c        2005-03-22 14:47:56.000000000 +0100
773 +++ linux-2.4.29/drivers/isdn/avmb1/avm_cs.c    2005-03-22 15:06:44.696297912 +0100
774 @@ -1,4 +1,4 @@
775 -/* $Id: avm_cs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
776 +/* $Id: avm_cs.c,v 1.6 2001/09/24 13:22:44 kai Exp $
777   *
778   * A PCMCIA client driver for AVM B1/M1/M2
779   *
780 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/avmcard.h linux-2.4.29/drivers/isdn/avmb1/avmcard.h
781 --- linux-2.4.29.old/drivers/isdn/avmb1/avmcard.h       2005-03-22 14:47:56.000000000 +0100
782 +++ linux-2.4.29/drivers/isdn/avmb1/avmcard.h   2005-03-22 15:06:44.711295632 +0100
783 @@ -1,4 +1,4 @@
784 -/* $Id: avmcard.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
785 +/* $Id: avmcard.h,v 1.12 2001/09/24 13:22:44 kai Exp $
786   *
787   * Copyright 1999 by Carsten Paeth <calle@calle.de>
788   *
789 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1.c linux-2.4.29/drivers/isdn/avmb1/b1.c
790 --- linux-2.4.29.old/drivers/isdn/avmb1/b1.c    2005-03-22 14:47:56.000000000 +0100
791 +++ linux-2.4.29/drivers/isdn/avmb1/b1.c        2005-03-22 15:06:44.733292288 +0100
792 @@ -1,4 +1,4 @@
793 -/* $Id: b1.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
794 +/* $Id: b1.c,v 1.26 2001/09/24 13:22:44 kai Exp $
795   * 
796   * Common module for AVM B1 cards.
797   * 
798 @@ -20,6 +20,7 @@
799  #include <linux/kernelcapi.h>
800  #include <asm/io.h>
801  #include <linux/init.h>
802 +#include <linux/isdn_compat.h>
803  #include <asm/uaccess.h>
804  #include <linux/netdevice.h>
805  #include "capilli.h"
806 @@ -27,7 +28,7 @@
807  #include "capicmd.h"
808  #include "capiutil.h"
809  
810 -static char *revision = "$Revision: 1.1.4.1 $";
811 +static char *revision = "$Revision: 1.26 $";
812  
813  /* ------------------------------------------------------------- */
814  
815 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1dma.c linux-2.4.29/drivers/isdn/avmb1/b1dma.c
816 --- linux-2.4.29.old/drivers/isdn/avmb1/b1dma.c 2005-03-22 14:47:56.000000000 +0100
817 +++ linux-2.4.29/drivers/isdn/avmb1/b1dma.c     2005-03-22 15:06:44.750289704 +0100
818 @@ -1,4 +1,4 @@
819 -/* $Id: b1dma.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
820 +/* $Id: b1dma.c,v 1.18 2001/09/24 13:22:44 kai Exp $
821   * 
822   * Common module for AVM B1 cards that support dma with AMCC
823   * 
824 @@ -21,6 +21,7 @@
825  #include <linux/kernelcapi.h>
826  #include <asm/io.h>
827  #include <linux/init.h>
828 +#include <linux/isdn_compat.h>
829  #include <asm/uaccess.h>
830  #include <linux/netdevice.h>
831  #include "capilli.h"
832 @@ -28,7 +29,11 @@
833  #include "capicmd.h"
834  #include "capiutil.h"
835  
836 -static char *revision = "$Revision: 1.1.4.1 $";
837 +#if BITS_PER_LONG != 32
838 +#error FIXME: driver requires 32-bit platform
839 +#endif
840 +
841 +static char *revision = "$Revision: 1.18 $";
842  
843  /* ------------------------------------------------------------- */
844  
845 @@ -851,7 +856,7 @@
846         __u8 flag;
847         int len = 0;
848         char *s;
849 -       u_long txaddr, txlen, rxaddr, rxlen, csr;
850 +       __u32 txaddr, txlen, rxaddr, rxlen, csr;
851  
852         len += sprintf(page+len, "%-16s %s\n", "name", card->name);
853         len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port);
854 @@ -907,12 +912,12 @@
855         save_flags(flags);
856         cli();
857  
858 -       txaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x2c));
859 -       txaddr -= (u_long)card->dma->sendbuf;
860 +       txaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x2c));
861 +       txaddr -= (__u32)card->dma->sendbuf;
862         txlen  = b1dmainmeml(card->mbase+0x30);
863  
864 -       rxaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x24));
865 -       rxaddr -= (u_long)card->dma->recvbuf;
866 +       rxaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x24));
867 +       rxaddr -= (__u32)card->dma->recvbuf;
868         rxlen  = b1dmainmeml(card->mbase+0x28);
869  
870         csr  = b1dmainmeml(card->mbase+AMCC_INTCSR);
871 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1isa.c linux-2.4.29/drivers/isdn/avmb1/b1isa.c
872 --- linux-2.4.29.old/drivers/isdn/avmb1/b1isa.c 2005-03-22 14:47:56.000000000 +0100
873 +++ linux-2.4.29/drivers/isdn/avmb1/b1isa.c     2005-03-22 15:06:44.766287272 +0100
874 @@ -1,4 +1,4 @@
875 -/* $Id: b1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
876 +/* $Id: b1isa.c,v 1.14 2001/09/24 13:22:44 kai Exp $
877   * 
878   * Module for AVM B1 ISA-card.
879   * 
880 @@ -19,12 +19,13 @@
881  #include <linux/capi.h>
882  #include <linux/init.h>
883  #include <asm/io.h>
884 +#include <linux/isdn_compat.h>
885  #include "capicmd.h"
886  #include "capiutil.h"
887  #include "capilli.h"
888  #include "avmcard.h"
889  
890 -static char *revision = "$Revision: 1.1.4.1 $";
891 +static char *revision = "$Revision: 1.14 $";
892  
893  /* ------------------------------------------------------------- */
894  
895 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1pci.c linux-2.4.29/drivers/isdn/avmb1/b1pci.c
896 --- linux-2.4.29.old/drivers/isdn/avmb1/b1pci.c 2005-03-22 14:47:56.000000000 +0100
897 +++ linux-2.4.29/drivers/isdn/avmb1/b1pci.c     2005-03-22 15:06:44.781284992 +0100
898 @@ -1,4 +1,4 @@
899 -/* $Id: b1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
900 +/* $Id: b1pci.c,v 1.40 2001/09/24 13:22:44 kai Exp $
901   * 
902   * Module for AVM B1 PCI-card.
903   * 
904 @@ -21,21 +21,24 @@
905  #include <linux/capi.h>
906  #include <asm/io.h>
907  #include <linux/init.h>
908 +#include <linux/isdn_compat.h>
909  #include "capicmd.h"
910  #include "capiutil.h"
911  #include "capilli.h"
912  #include "avmcard.h"
913  
914 -static char *revision = "$Revision: 1.1.4.1 $";
915 +static char *revision = "$Revision: 1.40 $";
916  
917  /* ------------------------------------------------------------- */
918  
919 +#ifndef COMPAT_HAS_2_2_PCI
920  static struct pci_device_id b1pci_pci_tbl[] __initdata = {
921         { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_B1, PCI_ANY_ID, PCI_ANY_ID },
922         { }                             /* Terminating entry */
923  };
924  
925  MODULE_DEVICE_TABLE(pci, b1pci_pci_tbl);
926 +#endif
927  MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 PCI card");
928  MODULE_AUTHOR("Carsten Paeth");
929  MODULE_LICENSE("GPL");
930 @@ -416,14 +419,14 @@
931         }
932         param.irq = dev->irq;
933  
934 -       if (pci_resource_start(dev, 2)) { /* B1 PCI V4 */
935 +       if (pci_resource_start_io(dev, 2)) { /* B1 PCI V4 */
936  #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
937                 driver = &b1pciv4_driver;
938  
939                 pci_set_master(dev);
940  #endif
941 -               param.membase = pci_resource_start(dev, 0);
942 -               param.port = pci_resource_start(dev, 2);
943 +               param.membase = pci_resource_start_mem(dev, 0);
944 +               param.port = pci_resource_start_io(dev, 2);
945  
946                 printk(KERN_INFO
947                 "%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n",
948 @@ -440,7 +443,7 @@
949                 }
950         } else {
951                 param.membase = 0;
952 -               param.port = pci_resource_start(dev, 1);
953 +               param.port = pci_resource_start_io(dev, 1);
954  
955                 printk(KERN_INFO
956                 "%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n",
957 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/b1pcmcia.c linux-2.4.29/drivers/isdn/avmb1/b1pcmcia.c
958 --- linux-2.4.29.old/drivers/isdn/avmb1/b1pcmcia.c      2005-03-22 14:47:56.000000000 +0100
959 +++ linux-2.4.29/drivers/isdn/avmb1/b1pcmcia.c  2005-03-22 15:06:44.796282712 +0100
960 @@ -1,4 +1,4 @@
961 -/* $Id: b1pcmcia.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
962 +/* $Id: b1pcmcia.c,v 1.17 2001/09/24 13:22:44 kai Exp $
963   * 
964   * Module for AVM B1/M1/M2 PCMCIA-card.
965   * 
966 @@ -25,7 +25,7 @@
967  #include "capilli.h"
968  #include "avmcard.h"
969  
970 -static char *revision = "$Revision: 1.1.4.1 $";
971 +static char *revision = "$Revision: 1.17 $";
972  
973  /* ------------------------------------------------------------- */
974  
975 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/c4.c linux-2.4.29/drivers/isdn/avmb1/c4.c
976 --- linux-2.4.29.old/drivers/isdn/avmb1/c4.c    2005-03-22 14:47:56.000000000 +0100
977 +++ linux-2.4.29/drivers/isdn/avmb1/c4.c        2005-03-22 15:06:44.812280280 +0100
978 @@ -1,4 +1,4 @@
979 -/* $Id: c4.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
980 +/* $Id: c4.c,v 1.38 2001/09/24 13:22:44 kai Exp $
981   * 
982   * Module for AVM C4 & C2 card.
983   * 
984 @@ -18,6 +18,7 @@
985  #include <linux/interrupt.h>
986  #include <linux/ioport.h>
987  #include <linux/pci.h>
988 +#include <linux/isdn_compat.h>
989  #include <linux/capi.h>
990  #include <linux/kernelcapi.h>
991  #include <linux/init.h>
992 @@ -29,7 +30,7 @@
993  #include "capilli.h"
994  #include "avmcard.h"
995  
996 -static char *revision = "$Revision: 1.1.4.1 $";
997 +static char *revision = "$Revision: 1.38 $";
998  
999  #undef CONFIG_C4_DEBUG
1000  #undef CONFIG_C4_POLLDEBUG
1001 @@ -38,6 +39,7 @@
1002  
1003  static int suppress_pollack;
1004  
1005 +#ifndef COMPAT_HAS_2_2_PCI
1006  static struct pci_device_id c4_pci_tbl[] __initdata = {
1007         { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C4 },
1008         { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C2 },
1009 @@ -45,6 +47,7 @@
1010  };
1011  
1012  MODULE_DEVICE_TABLE(pci, c4_pci_tbl);
1013 +#endif
1014  MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards");
1015  MODULE_AUTHOR("Carsten Paeth");
1016  MODULE_LICENSE("GPL");
1017 @@ -1328,9 +1331,9 @@
1018                 }
1019                 pci_set_master(dev);
1020  
1021 -               param.port = pci_resource_start(dev, 1);
1022 +               param.port = pci_resource_start_io(dev, 1);
1023                 param.irq = dev->irq;
1024 -               param.membase = pci_resource_start(dev, 0);
1025 +               param.membase = pci_resource_start_mem(dev, 0);
1026    
1027                 printk(KERN_INFO
1028                         "%s: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n",
1029 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capi.c linux-2.4.29/drivers/isdn/avmb1/capi.c
1030 --- linux-2.4.29.old/drivers/isdn/avmb1/capi.c  2005-03-22 14:47:56.000000000 +0100
1031 +++ linux-2.4.29/drivers/isdn/avmb1/capi.c      2005-03-22 15:06:44.849274656 +0100
1032 @@ -1,4 +1,4 @@
1033 -/* $Id: capi.c,v 1.1.4.2 2001/12/09 18:45:13 kai Exp $
1034 +/* $Id: capi.c,v 1.59 2001/11/07 22:35:48 kai Exp $
1035   *
1036   * CAPI 2.0 Interface for Linux
1037   *
1038 @@ -23,6 +23,7 @@
1039  #include <linux/smp_lock.h>
1040  #include <linux/timer.h>
1041  #include <linux/wait.h>
1042 +#include <linux/isdn_compat.h>
1043  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1044  #include <linux/tty.h>
1045  #ifdef CONFIG_PPP
1046 @@ -30,6 +31,9 @@
1047  #include <linux/ppp_defs.h>
1048  #include <linux/if_ppp.h>
1049  #undef CAPI_PPP_ON_RAW_DEVICE
1050 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1051 +#include <linux/ppp_channel.h>
1052 +#endif /* CAPI_PPP_ON_RAW_DEVICE */
1053  #endif /* CONFIG_PPP */
1054  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1055  #include <linux/skbuff.h>
1056 @@ -38,14 +42,16 @@
1057  #include <linux/capi.h>
1058  #include <linux/kernelcapi.h>
1059  #include <linux/init.h>
1060 +#ifdef HAVE_DEVFS_FS
1061  #include <linux/devfs_fs_kernel.h>
1062 +#endif /* HAVE_DEVFS_FS */
1063  #include "capiutil.h"
1064  #include "capicmd.h"
1065  #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
1066  #include "capifs.h"
1067  #endif
1068  
1069 -static char *revision = "$Revision: 1.1.4.2 $";
1070 +static char *revision = "$Revision: 1.59 $";
1071  
1072  MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
1073  MODULE_AUTHOR("Carsten Paeth");
1074 @@ -87,10 +93,10 @@
1075         struct capincci  *nccip;
1076         unsigned int      minor;
1077  
1078 -       u16              applid;
1079 -       u32              ncci;
1080 -       u16              datahandle;
1081 -       u16              msgid;
1082 +       __u16            applid;
1083 +       __u32            ncci;
1084 +       __u16            datahandle;
1085 +       __u16            msgid;
1086  
1087         struct file      *file;
1088         struct tty_struct *tty;
1089 @@ -112,16 +118,22 @@
1090         /* transmit path */
1091         struct datahandle_queue {
1092                     struct datahandle_queue *next;
1093 -                   u16                      datahandle;
1094 +                   __u16                    datahandle;
1095         } *ackqueue;
1096         int nack;
1097  
1098 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1099 +       /* interface to generic ppp layer */
1100 +       struct ppp_channel      chan;
1101 +       int                     chan_connected;
1102 +       int                     chan_index;
1103 +#endif
1104  };
1105  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1106  
1107  struct capincci {
1108         struct capincci *next;
1109 -       u32              ncci;
1110 +       __u32            ncci;
1111         struct capidev  *cdev;
1112  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1113         struct capiminor *minorp;
1114 @@ -131,8 +143,8 @@
1115  struct capidev {
1116         struct capidev *next;
1117         struct file    *file;
1118 -       u16             applid;
1119 -       u16             errcode;
1120 +       __u16           applid;
1121 +       __u16           errcode;
1122         unsigned int    minor;
1123         unsigned        userflags;
1124  
1125 @@ -156,22 +168,28 @@
1126  static struct capiminor *minors = 0;
1127  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1128  
1129 +#ifdef COMPAT_HAS_kmem_cache
1130  static kmem_cache_t *capidev_cachep = 0;
1131  static kmem_cache_t *capincci_cachep = 0;
1132  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1133  static kmem_cache_t *capiminor_cachep = 0;
1134  static kmem_cache_t *capidh_cachep = 0;
1135  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1136 +#endif
1137  
1138  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1139  /* -------- datahandles --------------------------------------------- */
1140  
1141 -static int capincci_add_ack(struct capiminor *mp, u16 datahandle)
1142 +int capincci_add_ack(struct capiminor *mp, __u16 datahandle)
1143  {
1144         struct datahandle_queue *n, **pp;
1145  
1146         n = (struct datahandle_queue *)
1147 +#ifdef COMPAT_HAS_kmem_cache
1148         kmem_cache_alloc(capidh_cachep, GFP_ATOMIC);
1149 +#else
1150 +       kmalloc(sizeof(struct datahandle_queue), GFP_ATOMIC);
1151 +#endif
1152         if (!n) {
1153            printk(KERN_ERR "capi: alloc datahandle failed\n");
1154            return -1;
1155 @@ -184,7 +202,7 @@
1156         return 0;
1157  }
1158  
1159 -static int capiminor_del_ack(struct capiminor *mp, u16 datahandle)
1160 +int capiminor_del_ack(struct capiminor *mp, __u16 datahandle)
1161  {
1162         struct datahandle_queue **pp, *p;
1163  
1164 @@ -192,7 +210,11 @@
1165                 if ((*pp)->datahandle == datahandle) {
1166                         p = *pp;
1167                         *pp = (*pp)->next;
1168 +#ifdef COMPAT_HAS_kmem_cache
1169                         kmem_cache_free(capidh_cachep, p);
1170 +#else
1171 +                       kfree(p);
1172 +#endif
1173                         mp->nack--;
1174                         return 0;
1175                 }
1176 @@ -200,7 +222,7 @@
1177         return -1;
1178  }
1179  
1180 -static void capiminor_del_all_ack(struct capiminor *mp)
1181 +void capiminor_del_all_ack(struct capiminor *mp)
1182  {
1183         struct datahandle_queue **pp, *p;
1184  
1185 @@ -208,7 +230,11 @@
1186         while (*pp) {
1187                 p = *pp;
1188                 *pp = (*pp)->next;
1189 +#ifdef COMPAT_HAS_kmem_cache
1190                 kmem_cache_free(capidh_cachep, p);
1191 +#else
1192 +               kfree(p);
1193 +#endif
1194                 mp->nack--;
1195         }
1196  }
1197 @@ -216,13 +242,17 @@
1198  
1199  /* -------- struct capiminor ---------------------------------------- */
1200  
1201 -static struct capiminor *capiminor_alloc(u16 applid, u32 ncci)
1202 +struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci)
1203  {
1204         struct capiminor *mp, **pp;
1205          unsigned int minor = 0;
1206  
1207         MOD_INC_USE_COUNT;
1208 +#ifdef COMPAT_HAS_kmem_cache
1209         mp = (struct capiminor *)kmem_cache_alloc(capiminor_cachep, GFP_ATOMIC);
1210 +#else
1211 +       mp = (struct capiminor *)kmalloc(sizeof(struct capiminor), GFP_ATOMIC);
1212 +#endif
1213         if (!mp) {
1214                 MOD_DEC_USE_COUNT;
1215                 printk(KERN_ERR "capi: can't alloc capiminor\n");
1216 @@ -257,7 +287,7 @@
1217         return mp;
1218  }
1219  
1220 -static void capiminor_free(struct capiminor *mp)
1221 +void capiminor_free(struct capiminor *mp)
1222  {
1223         struct capiminor **pp;
1224  
1225 @@ -271,7 +301,11 @@
1226                         skb_queue_purge(&mp->inqueue);
1227                         skb_queue_purge(&mp->outqueue);
1228                         capiminor_del_all_ack(mp);
1229 +#ifdef COMPAT_HAS_kmem_cache
1230                         kmem_cache_free(capiminor_cachep, mp);
1231 +#else
1232 +                       kfree(mp);
1233 +#endif
1234                         MOD_DEC_USE_COUNT;
1235  #ifdef _DEBUG_REFCOUNT
1236                         printk(KERN_DEBUG "capiminor_free %d\n", GET_USE_COUNT(THIS_MODULE));
1237 @@ -283,7 +317,7 @@
1238         }
1239  }
1240  
1241 -static struct capiminor *capiminor_find(unsigned int minor)
1242 +struct capiminor *capiminor_find(unsigned int minor)
1243  {
1244         struct capiminor *p;
1245         for (p = minors; p && p->minor != minor; p = p->next)
1246 @@ -294,7 +328,7 @@
1247  
1248  /* -------- struct capincci ----------------------------------------- */
1249  
1250 -static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
1251 +static struct capincci *capincci_alloc(struct capidev *cdev, __u32 ncci)
1252  {
1253         struct capincci *np, **pp;
1254  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1255 @@ -302,7 +336,11 @@
1256         kdev_t kdev;
1257  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1258  
1259 +#ifdef COMPAT_HAS_kmem_cache
1260         np = (struct capincci *)kmem_cache_alloc(capincci_cachep, GFP_ATOMIC);
1261 +#else
1262 +       np = (struct capincci *)kmalloc(sizeof(struct capincci), GFP_ATOMIC);
1263 +#endif
1264         if (!np)
1265                 return 0;
1266         memset(np, 0, sizeof(struct capincci));
1267 @@ -331,7 +369,7 @@
1268          return np;
1269  }
1270  
1271 -static void capincci_free(struct capidev *cdev, u32 ncci)
1272 +static void capincci_free(struct capidev *cdev, __u32 ncci)
1273  {
1274         struct capincci *np, **pp;
1275  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1276 @@ -367,7 +405,11 @@
1277                                 }
1278                         }
1279  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1280 +#ifdef COMPAT_HAS_kmem_cache
1281                         kmem_cache_free(capincci_cachep, np);
1282 +#else
1283 +                       kfree(np);
1284 +#endif
1285                         if (*pp == 0) return;
1286                 } else {
1287                         pp = &(*pp)->next;
1288 @@ -375,7 +417,7 @@
1289         }
1290  }
1291  
1292 -static struct capincci *capincci_find(struct capidev *cdev, u32 ncci)
1293 +struct capincci *capincci_find(struct capidev *cdev, __u32 ncci)
1294  {
1295         struct capincci *p;
1296  
1297 @@ -393,7 +435,11 @@
1298         struct capidev *cdev;
1299         struct capidev **pp;
1300  
1301 +#ifdef COMPAT_HAS_kmem_cache
1302         cdev = (struct capidev *)kmem_cache_alloc(capidev_cachep, GFP_KERNEL);
1303 +#else
1304 +       cdev = (struct capidev *)kmalloc(sizeof(struct capidev), GFP_KERNEL);
1305 +#endif
1306         if (!cdev)
1307                 return 0;
1308         memset(cdev, 0, sizeof(struct capidev));
1309 @@ -423,10 +469,14 @@
1310         if (*pp)
1311                 *pp = cdev->next;
1312  
1313 +#ifdef COMPAT_HAS_kmem_cache
1314         kmem_cache_free(capidev_cachep, cdev);
1315 +#else
1316 +       kfree(cdev);
1317 +#endif
1318  }
1319  
1320 -static struct capidev *capidev_find(u16 applid)
1321 +static struct capidev *capidev_find(__u16 applid)
1322  {
1323         struct capidev *p;
1324         for (p=capidev_openlist; p; p = p->next) {
1325 @@ -439,13 +489,13 @@
1326  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1327  /* -------- handle data queue --------------------------------------- */
1328  
1329 -static struct sk_buff *
1330 +struct sk_buff *
1331  gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
1332  {
1333         struct sk_buff *nskb;
1334         nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_ATOMIC);
1335         if (nskb) {
1336 -               u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
1337 +               __u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
1338                 unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
1339                 capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
1340                 capimsg_setu16(s, 2, mp->applid);
1341 @@ -458,11 +508,11 @@
1342         return nskb;
1343  }
1344  
1345 -static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
1346 +int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
1347  {
1348         struct sk_buff *nskb;
1349         unsigned int datalen;
1350 -       u16 errcode, datahandle;
1351 +       __u16 errcode, datahandle;
1352  
1353         datalen = skb->len - CAPIMSG_LEN(skb->data);
1354         if (mp->tty) {
1355 @@ -504,6 +554,28 @@
1356                 kfree_skb(skb);
1357                 return 0;
1358  
1359 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1360 +       } else if (mp->chan_connected) {
1361 +               if ((nskb = gen_data_b3_resp_for(mp, skb)) == 0) {
1362 +                       printk(KERN_ERR "capi: gen_data_b3_resp failed\n");
1363 +                       return -1;
1364 +               }
1365 +               datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4);
1366 +               errcode = (*capifuncs->capi_put_message)(mp->applid, nskb);
1367 +               if (errcode != CAPI_NOERROR) {
1368 +                       printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
1369 +                                       errcode);
1370 +                       kfree_skb(nskb);
1371 +                       return -1;
1372 +               }
1373 +               (void)skb_pull(skb, CAPIMSG_LEN(skb->data));
1374 +#ifdef _DEBUG_DATAFLOW
1375 +               printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ppp\n",
1376 +                                       datahandle, skb->len);
1377 +#endif
1378 +               ppp_input(&mp->chan, skb);
1379 +               return 0;
1380 +#endif
1381         } else if (mp->file) {
1382                 if (skb_queue_len(&mp->recvqueue) > CAPINC_MAX_RECVQUEUE) {
1383  #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
1384 @@ -538,7 +610,7 @@
1385         return -1;
1386  }
1387  
1388 -static void handle_minor_recv(struct capiminor *mp)
1389 +void handle_minor_recv(struct capiminor *mp)
1390  {
1391         struct sk_buff *skb;
1392         while ((skb = skb_dequeue(&mp->inqueue)) != 0) {
1393 @@ -552,13 +624,13 @@
1394         }
1395  }
1396  
1397 -static int handle_minor_send(struct capiminor *mp)
1398 +int handle_minor_send(struct capiminor *mp)
1399  {
1400         struct sk_buff *skb;
1401 -       u16 len;
1402 +       __u16 len;
1403         int count = 0;
1404 -       u16 errcode;
1405 -       u16 datahandle;
1406 +       __u16 errcode;
1407 +       __u16 datahandle;
1408  
1409         if (mp->tty && mp->ttyoutstop) {
1410  #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
1411 @@ -569,7 +641,7 @@
1412  
1413         while ((skb = skb_dequeue(&mp->outqueue)) != 0) {
1414                 datahandle = mp->datahandle;
1415 -               len = (u16)skb->len;
1416 +               len = (__u16)skb->len;
1417                 skb_push(skb, CAPI_DATA_B3_REQ_LEN);
1418                 memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
1419                 capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
1420 @@ -578,7 +650,7 @@
1421                 capimsg_setu8 (skb->data, 5, CAPI_REQ);
1422                 capimsg_setu16(skb->data, 6, mp->msgid++);
1423                 capimsg_setu32(skb->data, 8, mp->ncci); /* NCCI */
1424 -               capimsg_setu32(skb->data, 12, (u32) skb->data); /* Data32 */
1425 +               capimsg_setu32(skb->data, 12, (__u32) skb->data); /* Data32 */
1426                 capimsg_setu16(skb->data, 16, len);     /* Data length */
1427                 capimsg_setu16(skb->data, 18, datahandle);
1428                 capimsg_setu16(skb->data, 20, 0);       /* Flags */
1429 @@ -620,16 +692,16 @@
1430  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1431  /* -------- function called by lower level -------------------------- */
1432  
1433 -static void capi_signal(u16 applid, void *param)
1434 +static void capi_signal(__u16 applid, void *param)
1435  {
1436         struct capidev *cdev = (struct capidev *)param;
1437  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1438         struct capiminor *mp;
1439 -       u16 datahandle;
1440 +       __u16 datahandle;
1441  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1442         struct capincci *np;
1443         struct sk_buff *skb = 0;
1444 -       u32 ncci;
1445 +       __u32 ncci;
1446  
1447         (void) (*capifuncs->capi_get_message) (applid, &skb);
1448         if (!skb) {
1449 @@ -683,6 +755,12 @@
1450  #endif
1451                 kfree_skb(skb);
1452                 (void)capiminor_del_ack(mp, datahandle);
1453 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1454 +               if (mp->chan_connected) {
1455 +                       ppp_output_wakeup(&mp->chan);
1456 +                       return;
1457 +               }
1458 +#endif
1459                 if (mp->tty) {
1460                         if (mp->tty->ldisc.write_wakeup)
1461                                 mp->tty->ldisc.write_wakeup(mp->tty);
1462 @@ -758,7 +836,7 @@
1463         struct capidev *cdev = (struct capidev *)file->private_data;
1464         struct sk_buff *skb;
1465         int retval;
1466 -       u16 mlen;
1467 +       __u16 mlen;
1468  
1469          if (ppos != &file->f_pos)
1470                 return -ESPIPE;
1471 @@ -998,7 +1076,7 @@
1472                                                 sizeof(ncci));
1473                         if (retval)
1474                                 return -EFAULT;
1475 -                       nccip = capincci_find(cdev, (u32) ncci);
1476 +                       nccip = capincci_find(cdev, (__u32) ncci);
1477                         if (!nccip)
1478                                 return 0;
1479  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1480 @@ -1023,7 +1101,7 @@
1481                                                 sizeof(ncci));
1482                         if (retval)
1483                                 return -EFAULT;
1484 -                       nccip = capincci_find(cdev, (u32) ncci);
1485 +                       nccip = capincci_find(cdev, (__u32) ncci);
1486                         if (!nccip || (mp = nccip->minorp) == 0)
1487                                 return -ESRCH;
1488                         return mp->minor;
1489 @@ -1070,7 +1148,9 @@
1490  
1491  static struct file_operations capi_fops =
1492  {
1493 +#ifdef COMPAT_HAS_FILEOP_OWNER
1494         owner:          THIS_MODULE,
1495 +#endif
1496         llseek:         no_llseek,
1497         read:           capi_read,
1498         write:          capi_write,
1499 @@ -1233,6 +1313,45 @@
1500                 return -EINVAL;
1501  
1502         switch (cmd) {
1503 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1504 +       case PPPIOCATTACH:
1505 +               {
1506 +                       int retval, val;
1507 +                       if (get_user(val, (int *) arg))
1508 +                               break;
1509 +                       if (mp->chan_connected)
1510 +                               return -EALREADY;
1511 +                       mp->chan.private = mp;
1512 +#if 1
1513 +                       return -EINVAL;
1514 +#else
1515 +                       mp->chan.ops = &ppp_ops;
1516 +#endif
1517 +
1518 +                       retval = ppp_register_channel(&mp->chan, val);
1519 +                       if (retval)
1520 +                               return retval;
1521 +                       mp->chan_connected = 1;
1522 +                       mp->chan_index = val;
1523 +               }
1524 +               return 0;
1525 +       case PPPIOCDETACH:
1526 +               {
1527 +                       if (!mp->chan_connected)
1528 +                               return -ENXIO;
1529 +                       ppp_unregister_channel(&mp->chan);
1530 +                       mp->chan_connected = 0;
1531 +               }
1532 +               return 0;
1533 +       case PPPIOCGUNIT:
1534 +               {
1535 +                       if (!mp->chan_connected)
1536 +                               return -ENXIO;
1537 +                       if (put_user(mp->chan_index, (int *) arg))
1538 +                               return -EFAULT;
1539 +               }
1540 +               return 0;
1541 +#endif
1542         }
1543         return -EINVAL;
1544  }
1545 @@ -1260,7 +1379,9 @@
1546  
1547  static struct file_operations capinc_raw_fops =
1548  {
1549 +#ifdef COMPAT_HAS_FILEOP_OWNER
1550         owner:          THIS_MODULE,
1551 +#endif
1552         llseek:         no_llseek,
1553         read:           capinc_raw_read,
1554         write:          capinc_raw_write,
1555 @@ -1272,7 +1393,7 @@
1556  
1557  /* -------- tty_operations for capincci ----------------------------- */
1558  
1559 -static int capinc_tty_open(struct tty_struct * tty, struct file * file)
1560 +int capinc_tty_open(struct tty_struct * tty, struct file * file)
1561  {
1562         struct capiminor *mp;
1563  
1564 @@ -1300,7 +1421,7 @@
1565         return 0;
1566  }
1567  
1568 -static void capinc_tty_close(struct tty_struct * tty, struct file * file)
1569 +void capinc_tty_close(struct tty_struct * tty, struct file * file)
1570  {
1571         struct capiminor *mp;
1572  
1573 @@ -1325,8 +1446,8 @@
1574  #endif
1575  }
1576  
1577 -static int capinc_tty_write(struct tty_struct * tty, int from_user,
1578 -                           const unsigned char *buf, int count)
1579 +int capinc_tty_write(struct tty_struct * tty, int from_user,
1580 +                     const unsigned char *buf, int count)
1581  {
1582         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1583         struct sk_buff *skb;
1584 @@ -1377,7 +1498,7 @@
1585         return count;
1586  }
1587  
1588 -static void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1589 +void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1590  {
1591         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1592         struct sk_buff *skb;
1593 @@ -1414,7 +1535,7 @@
1594         }
1595  }
1596  
1597 -static void capinc_tty_flush_chars(struct tty_struct *tty)
1598 +void capinc_tty_flush_chars(struct tty_struct *tty)
1599  {
1600         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1601         struct sk_buff *skb;
1602 @@ -1440,7 +1561,7 @@
1603         (void)handle_minor_recv(mp);
1604  }
1605  
1606 -static int capinc_tty_write_room(struct tty_struct *tty)
1607 +int capinc_tty_write_room(struct tty_struct *tty)
1608  {
1609         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1610         int room;
1611 @@ -1458,7 +1579,7 @@
1612         return room;
1613  }
1614  
1615 -static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1616 +int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1617  {
1618         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1619         if (!mp || !mp->nccip) {
1620 @@ -1476,7 +1597,7 @@
1621         return mp->outbytes;
1622  }
1623  
1624 -static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
1625 +int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
1626                     unsigned int cmd, unsigned long arg)
1627  {
1628         int error = 0;
1629 @@ -1488,14 +1609,14 @@
1630         return error;
1631  }
1632  
1633 -static void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
1634 +void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
1635  {
1636  #ifdef _DEBUG_TTYFUNCS
1637         printk(KERN_DEBUG "capinc_tty_set_termios\n");
1638  #endif
1639  }
1640  
1641 -static void capinc_tty_throttle(struct tty_struct * tty)
1642 +void capinc_tty_throttle(struct tty_struct * tty)
1643  {
1644         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1645  #ifdef _DEBUG_TTYFUNCS
1646 @@ -1505,7 +1626,7 @@
1647                 mp->ttyinstop = 1;
1648  }
1649  
1650 -static void capinc_tty_unthrottle(struct tty_struct * tty)
1651 +void capinc_tty_unthrottle(struct tty_struct * tty)
1652  {
1653         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1654  #ifdef _DEBUG_TTYFUNCS
1655 @@ -1517,7 +1638,7 @@
1656         }
1657  }
1658  
1659 -static void capinc_tty_stop(struct tty_struct *tty)
1660 +void capinc_tty_stop(struct tty_struct *tty)
1661  {
1662         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1663  #ifdef _DEBUG_TTYFUNCS
1664 @@ -1528,7 +1649,7 @@
1665         }
1666  }
1667  
1668 -static void capinc_tty_start(struct tty_struct *tty)
1669 +void capinc_tty_start(struct tty_struct *tty)
1670  {
1671         struct capiminor *mp = (struct capiminor *)tty->driver_data;
1672  #ifdef _DEBUG_TTYFUNCS
1673 @@ -1540,43 +1661,49 @@
1674         }
1675  }
1676  
1677 -static void capinc_tty_hangup(struct tty_struct *tty)
1678 +void capinc_tty_hangup(struct tty_struct *tty)
1679  {
1680  #ifdef _DEBUG_TTYFUNCS
1681         printk(KERN_DEBUG "capinc_tty_hangup\n");
1682  #endif
1683  }
1684  
1685 -static void capinc_tty_break_ctl(struct tty_struct *tty, int state)
1686 +void capinc_tty_break_ctl(struct tty_struct *tty, int state)
1687  {
1688  #ifdef _DEBUG_TTYFUNCS
1689         printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state);
1690  #endif
1691  }
1692  
1693 -static void capinc_tty_flush_buffer(struct tty_struct *tty)
1694 +void capinc_tty_flush_buffer(struct tty_struct *tty)
1695  {
1696  #ifdef _DEBUG_TTYFUNCS
1697         printk(KERN_DEBUG "capinc_tty_flush_buffer\n");
1698  #endif
1699  }
1700  
1701 -static void capinc_tty_set_ldisc(struct tty_struct *tty)
1702 +void capinc_tty_set_ldisc(struct tty_struct *tty)
1703  {
1704  #ifdef _DEBUG_TTYFUNCS
1705         printk(KERN_DEBUG "capinc_tty_set_ldisc\n");
1706  #endif
1707  }
1708  
1709 -static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1710 +void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1711  {
1712  #ifdef _DEBUG_TTYFUNCS
1713         printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch);
1714  #endif
1715  }
1716  
1717 -static int capinc_tty_read_proc(char *page, char **start, off_t off,
1718 -                               int count, int *eof, void *data)
1719 +int capinc_tty_read_proc(char *page, char **start, off_t off,
1720 +                         int count, int *eof, void *data)
1721 +{
1722 +       return 0;
1723 +}
1724 +
1725 +int capinc_write_proc(struct file *file, const char *buffer,
1726 +                         unsigned long count, void *data)
1727  {
1728         return 0;
1729  }
1730 @@ -1588,7 +1715,7 @@
1731  static struct termios *capinc_tty_termios[CAPINC_NR_PORTS];
1732  static struct termios *capinc_tty_termios_locked[CAPINC_NR_PORTS];
1733  
1734 -static int capinc_tty_init(void)
1735 +int capinc_tty_init(void)
1736  {
1737         struct tty_driver *drv = &capinc_tty_driver;
1738  
1739 @@ -1646,7 +1773,7 @@
1740         return 0;
1741  }
1742  
1743 -static void capinc_tty_exit(void)
1744 +void capinc_tty_exit(void)
1745  {
1746         struct tty_driver *drv = &capinc_tty_driver;
1747         int retval;
1748 @@ -1771,8 +1898,9 @@
1749  
1750  /* -------- init function and module interface ---------------------- */
1751  
1752 +#ifdef COMPAT_HAS_kmem_cache
1753  
1754 -static void alloc_exit(void)
1755 +static void __exit alloc_exit(void)
1756  {
1757         if (capidev_cachep) {
1758                 (void)kmem_cache_destroy(capidev_cachep);
1759 @@ -1837,8 +1965,9 @@
1760  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1761         return 0;
1762  }
1763 +#endif
1764  
1765 -static void lower_callback(unsigned int cmd, u32 contr, void *data)
1766 +static void lower_callback(unsigned int cmd, __u32 contr, void *data)
1767  {
1768         struct capi_ncciinfo *np;
1769         struct capidev *cdev;
1770 @@ -1900,15 +2029,19 @@
1771                 MOD_DEC_USE_COUNT;
1772                 return -EIO;
1773         }
1774 +#ifdef HAVE_DEVFS_FS
1775          devfs_register_series (NULL, "capi/r%u", CAPINC_NR_PORTS,
1776                               DEVFS_FL_DEFAULT,
1777                                capi_rawmajor, 0,
1778                                S_IFCHR | S_IRUSR | S_IWUSR,
1779                                &capinc_raw_fops, NULL);
1780 +#endif
1781  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1782 +#ifdef HAVE_DEVFS_FS
1783         devfs_register (NULL, "isdn/capi20", DEVFS_FL_DEFAULT,
1784                         capi_major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
1785                         &capi_fops, NULL);
1786 +#endif
1787         printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major);
1788  
1789         if ((capifuncs = attach_capi_interface(&cuser)) == 0) {
1790 @@ -1918,9 +2051,11 @@
1791  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1792                 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1793  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1794 +#ifdef HAVE_DEVFS_FS
1795                 devfs_unregister(devfs_find_handle(NULL, "capi20",
1796                                                    capi_major, 0,
1797                                                    DEVFS_SPECIAL_CHR, 0));
1798 +#endif
1799                 return -EIO;
1800         }
1801  
1802 @@ -1934,8 +2069,10 @@
1803         }
1804  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1805  
1806 +#ifdef COMPAT_HAS_kmem_cache
1807         if (alloc_init() < 0) {
1808  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1809 +#ifdef HAVE_DEVFS_FS
1810                 unsigned int j;
1811                 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1812                 for (j = 0; j < CAPINC_NR_PORTS; j++) {
1813 @@ -1943,16 +2080,20 @@
1814                         sprintf(devname, "capi/r%u", j);
1815                         devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0));
1816                 }
1817 +#endif
1818                 capinc_tty_exit();
1819  #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1820                 (void) detach_capi_interface(&cuser);
1821                 devfs_unregister_chrdev(capi_major, "capi20");
1822 +#ifdef HAVE_DEVFS_FS
1823                 devfs_unregister(devfs_find_handle(NULL, "capi20",
1824                                                    capi_major, 0,
1825                                                    DEVFS_SPECIAL_CHR, 0));
1826 +#endif
1827                 MOD_DEC_USE_COUNT;
1828                 return -ENOMEM;
1829         }
1830 +#endif /* COMPAT_HAS_kmem_cache */
1831  
1832         (void)proc_init();
1833  
1834 @@ -1975,23 +2116,31 @@
1835  static void __exit capi_exit(void)
1836  {
1837  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1838 +#ifdef HAVE_DEVFS_FS
1839         unsigned int j;
1840  #endif
1841 +#endif
1842 +#ifdef COMPAT_HAS_kmem_cache
1843         alloc_exit();
1844 +#endif
1845         (void)proc_exit();
1846  
1847         devfs_unregister_chrdev(capi_major, "capi20");
1848 +#ifdef HAVE_DEVFS_FS
1849         devfs_unregister(devfs_find_handle(NULL, "isdn/capi20", capi_major, 0, DEVFS_SPECIAL_CHR, 0));
1850 +#endif
1851  
1852  #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1853         capinc_tty_exit();
1854         devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1855 +#ifdef HAVE_DEVFS_FS
1856         for (j = 0; j < CAPINC_NR_PORTS; j++) {
1857                 char devname[32];
1858                 sprintf(devname, "capi/r%u", j);
1859                 devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0));
1860         }
1861  #endif
1862 +#endif
1863         (void) detach_capi_interface(&cuser);
1864         printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev);
1865  }
1866 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capicmd.h linux-2.4.29/drivers/isdn/avmb1/capicmd.h
1867 --- linux-2.4.29.old/drivers/isdn/avmb1/capicmd.h       2005-03-22 14:47:56.000000000 +0100
1868 +++ linux-2.4.29/drivers/isdn/avmb1/capicmd.h   2005-03-22 15:06:44.865272224 +0100
1869 @@ -1,4 +1,4 @@
1870 -/* $Id: capicmd.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1871 +/* $Id: capicmd.h,v 1.4 2001/09/24 13:22:44 kai Exp $
1872   * 
1873   * CAPI 2.0 Interface for Linux
1874   * 
1875 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capidev.h linux-2.4.29/drivers/isdn/avmb1/capidev.h
1876 --- linux-2.4.29.old/drivers/isdn/avmb1/capidev.h       2005-03-22 14:47:56.000000000 +0100
1877 +++ linux-2.4.29/drivers/isdn/avmb1/capidev.h   2005-03-22 15:06:44.880269944 +0100
1878 @@ -1,4 +1,4 @@
1879 -/* $Id: capidev.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1880 +/* $Id: capidev.h,v 1.8 2001/09/24 13:22:44 kai Exp $
1881   *
1882   * CAPI 2.0 Interface for Linux
1883   *
1884 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capidrv.c linux-2.4.29/drivers/isdn/avmb1/capidrv.c
1885 --- linux-2.4.29.old/drivers/isdn/avmb1/capidrv.c       2005-03-22 14:47:56.000000000 +0100
1886 +++ linux-2.4.29/drivers/isdn/avmb1/capidrv.c   2005-03-22 15:06:44.918264168 +0100
1887 @@ -1,4 +1,4 @@
1888 -/* $Id: capidrv.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1889 +/* $Id: capidrv.c,v 1.45 2001/09/24 13:22:44 kai Exp $
1890   *
1891   * ISDN4Linux Driver, using capi20 interface (kernelcapi)
1892   *
1893 @@ -35,7 +35,7 @@
1894  #include "capicmd.h"
1895  #include "capidrv.h"
1896  
1897 -static char *revision = "$Revision: 1.1.4.1 $";
1898 +static char *revision = "$Revision: 1.45 $";
1899  static int debugmode = 0;
1900  
1901  MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux");
1902 @@ -105,7 +105,6 @@
1903                                 int oldstate;
1904                                 /* */
1905                                 __u16 datahandle;
1906 -                                spinlock_t lock;
1907                                 struct ncci_datahandle_queue {
1908                                     struct ncci_datahandle_queue *next;
1909                                     __u16                         datahandle;
1910 @@ -423,7 +422,6 @@
1911         nccip->plcip = plcip;
1912         nccip->chan = plcip->chan;
1913         nccip->datahandle = 0;
1914 -        nccip->lock = SPIN_LOCK_UNLOCKED;
1915  
1916         nccip->next = plcip->ncci_list;
1917         plcip->ncci_list = nccip;
1918 @@ -480,7 +478,6 @@
1919                            __u16 datahandle, int len)
1920  {
1921         struct ncci_datahandle_queue *n, **pp;
1922 -       unsigned long flags;
1923  
1924         n = (struct ncci_datahandle_queue *)
1925                 kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC);
1926 @@ -491,31 +488,25 @@
1927         n->next = 0;
1928         n->datahandle = datahandle;
1929         n->len = len;
1930 -       spin_lock_irqsave(&nccip->lock, flags);
1931         for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) ;
1932         *pp = n;
1933 -       spin_unlock_irqrestore(&nccip->lock, flags);
1934         return 0;
1935  }
1936  
1937  static int capidrv_del_ack(struct capidrv_ncci *nccip, __u16 datahandle)
1938  {
1939         struct ncci_datahandle_queue **pp, *p;
1940 -       unsigned long flags;
1941         int len;
1942  
1943 -       spin_lock_irqsave(&nccip->lock, flags);
1944         for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) {
1945                 if ((*pp)->datahandle == datahandle) {
1946                         p = *pp;
1947                         len = p->len;
1948                         *pp = (*pp)->next;
1949 -                       spin_unlock_irqrestore(&nccip->lock, flags);
1950                         kfree(p);
1951                         return len;
1952                 }
1953         }
1954 -        spin_unlock_irqrestore(&nccip->lock, flags);
1955         return -1;
1956  }
1957  
1958 @@ -523,25 +514,13 @@
1959  
1960  static void send_message(capidrv_contr * card, _cmsg * cmsg)
1961  {
1962 -       struct sk_buff  *skb;
1963 -       size_t          len;
1964 -       u16             err;
1965 -
1966 +       struct sk_buff *skb;
1967 +       size_t len;
1968         capi_cmsg2message(cmsg, cmsg->buf);
1969         len = CAPIMSG_LEN(cmsg->buf);
1970         skb = alloc_skb(len, GFP_ATOMIC);
1971 -       if(!skb) {
1972 -               printk(KERN_ERR "no skb len(%d) memory\n", len);
1973 -               return;
1974 -       }
1975         memcpy(skb_put(skb, len), cmsg->buf, len);
1976 -       err = (*capifuncs->capi_put_message) (global.appid, skb);
1977 -       if (err) {
1978 -               printk(KERN_WARNING "%s: capi_put_message error: %04x\n",
1979 -                       __FUNCTION__, err);
1980 -               kfree_skb(skb);
1981 -               return;
1982 -       }
1983 +       (*capifuncs->capi_put_message) (global.appid, skb);
1984         global.nsentctlpkt++;
1985  }
1986  
1987 @@ -1932,8 +1911,10 @@
1988                         (void)capidrv_del_ack(nccip, datahandle);
1989                         return 0;
1990                 }
1991 +#if 1
1992                 printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n",
1993                        card->contrnr, skb_headroom(skb), msglen);
1994 +#endif
1995                 memcpy(skb_push(nskb, msglen), sendcmsg.buf, msglen);
1996                 errcode = (*capifuncs->capi_put_message) (global.appid, nskb);
1997                 if (errcode == CAPI_NOERROR) {
1998 @@ -2035,6 +2016,52 @@
1999         send_message(card, &cmdcmsg);
2000  }
2001  
2002 +#if 0
2003 +static void disable_dchannel_trace(capidrv_contr *card)
2004 +{
2005 +        __u8 manufacturer[CAPI_MANUFACTURER_LEN];
2006 +        capi_version version;
2007 +       __u16 contr = card->contrnr;
2008 +       __u16 errcode;
2009 +       __u16 avmversion[3];
2010 +
2011 +        errcode = (*capifuncs->capi_get_manufacturer)(contr, manufacturer);
2012 +        if (errcode != CAPI_NOERROR) {
2013 +          printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n",
2014 +                       card->name, errcode);
2015 +          return;
2016 +       }
2017 +       if (strstr(manufacturer, "AVM") == 0) {
2018 +          printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n",
2019 +                       card->name, manufacturer);
2020 +          return;
2021 +       }
2022 +        errcode = (*capifuncs->capi_get_version)(contr, &version);
2023 +        if (errcode != CAPI_NOERROR) {
2024 +          printk(KERN_ERR "%s: can't get version (0x%x)\n",
2025 +                       card->name, errcode);
2026 +          return;
2027 +       }
2028 +       avmversion[0] = (version.majormanuversion >> 4) & 0x0f;
2029 +       avmversion[1] = (version.majormanuversion << 4) & 0xf0;
2030 +       avmversion[1] |= (version.minormanuversion >> 4) & 0x0f;
2031 +       avmversion[2] |= version.minormanuversion & 0x0f;
2032 +
2033 +        if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) {
2034 +               printk(KERN_INFO "%s: D2 trace disabled\n", card->name);
2035 +       } else {
2036 +               printk(KERN_INFO "%s: D3 trace disabled\n", card->name);
2037 +       }
2038 +       capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid,
2039 +                                  card->msgid++,
2040 +                                  contr,
2041 +                                  0x214D5641,  /* ManuID */
2042 +                                  0,           /* Class */
2043 +                                  1,           /* Function */
2044 +                                  (_cstruct)"\004\000\000\000\000");
2045 +       send_message(card, &cmdcmsg);
2046 +}
2047 +#endif
2048  
2049  static void send_listen(capidrv_contr *card)
2050  {
2051 @@ -2200,10 +2227,10 @@
2052                         free_ncci(card, card->bchans[card->nbchan-1].nccip);
2053                 if (card->bchans[card->nbchan-1].plcip)
2054                         free_plci(card, card->bchans[card->nbchan-1].plcip);
2055 +               if (card->plci_list)
2056 +                       printk(KERN_ERR "capidrv: bug in free_plci()\n");
2057                 card->nbchan--;
2058         }
2059 -       if (card->plci_list)
2060 -               printk(KERN_ERR "capidrv: bug in free_plci()\n");
2061         kfree(card->bchans);
2062         card->bchans = 0;
2063  
2064 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capidrv.h linux-2.4.29/drivers/isdn/avmb1/capidrv.h
2065 --- linux-2.4.29.old/drivers/isdn/avmb1/capidrv.h       2005-03-22 14:47:56.000000000 +0100
2066 +++ linux-2.4.29/drivers/isdn/avmb1/capidrv.h   2005-03-22 15:06:44.935261584 +0100
2067 @@ -1,4 +1,4 @@
2068 -/* $Id: capidrv.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2069 +/* $Id: capidrv.h,v 1.4 2001/09/24 13:22:44 kai Exp $
2070   *
2071   * ISDN4Linux Driver, using capi20 interface (kernelcapi)
2072   *
2073 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capifs.c linux-2.4.29/drivers/isdn/avmb1/capifs.c
2074 --- linux-2.4.29.old/drivers/isdn/avmb1/capifs.c        2005-03-22 14:47:56.000000000 +0100
2075 +++ linux-2.4.29/drivers/isdn/avmb1/capifs.c    2005-03-22 15:06:44.950259304 +0100
2076 @@ -1,4 +1,4 @@
2077 -/* $Id: capifs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2078 +/* $Id: capifs.c,v 1.22 2001/09/24 13:22:44 kai Exp $
2079   * 
2080   * Copyright 2000 by Carsten Paeth <calle@calle.de>
2081   *
2082 @@ -25,6 +25,7 @@
2083  #include <linux/major.h>
2084  #include <linux/slab.h>
2085  #include <linux/ctype.h>
2086 +#include <linux/isdn_compat.h>
2087  #include <asm/bitops.h>
2088  #include <asm/uaccess.h>
2089  
2090 @@ -32,7 +33,7 @@
2091  MODULE_AUTHOR("Carsten Paeth");
2092  MODULE_LICENSE("GPL");
2093  
2094 -static char *revision = "$Revision: 1.1.4.1 $";
2095 +static char *revision = "$Revision: 1.22 $";
2096  
2097  struct capifs_ncci {
2098         struct inode *inode;
2099 @@ -69,14 +70,21 @@
2100  static int capifs_root_readdir(struct file *,void *,filldir_t);
2101  static struct dentry *capifs_root_lookup(struct inode *,struct dentry *);
2102  static int capifs_revalidate(struct dentry *, int);
2103 +#ifdef COMPAT_VFS_2_4
2104  static struct inode *capifs_new_inode(struct super_block *sb);
2105 +#endif
2106  
2107  static struct file_operations capifs_root_operations = {
2108 +#ifdef COMPAT_VFS_2_4
2109         read:           generic_read_dir,
2110 +#endif
2111         readdir:        capifs_root_readdir,
2112  };
2113  
2114  struct inode_operations capifs_root_inode_operations = {
2115 +#ifndef COMPAT_VFS_2_4
2116 +       default_file_ops: &capifs_root_operations, /* file operations */
2117 +#endif
2118         lookup: capifs_root_lookup,
2119  };
2120  
2121 @@ -101,12 +109,20 @@
2122         switch(nr)
2123         {
2124         case 0:
2125 +#ifdef COMPAT_VFS_2_4
2126                 if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
2127 +#else
2128 +               if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0)
2129 +#endif
2130                         return 0;
2131                 filp->f_pos = ++nr;
2132                 /* fall through */
2133         case 1:
2134 +#ifdef COMPAT_VFS_2_4
2135                 if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
2136 +#else
2137 +               if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0)
2138 +#endif
2139                         return 0;
2140                 filp->f_pos = ++nr;
2141                 /* fall through */
2142 @@ -118,7 +134,11 @@
2143                                 char *p = numbuf;
2144                                 if (np->type) *p++ = np->type;
2145                                 sprintf(p, "%u", np->num);
2146 +#ifdef COMPAT_VFS_2_4
2147                                 if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_UNKNOWN) < 0 )
2148 +#else
2149 +                               if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 )
2150 +#endif
2151                                         return 0;
2152                         }
2153                         filp->f_pos = ++nr;
2154 @@ -180,7 +200,7 @@
2155  
2156         dentry->d_inode = np->inode;
2157         if ( dentry->d_inode )
2158 -               atomic_inc(&dentry->d_inode->i_count);
2159 +               i_count_inc(dentry->d_inode->i_count);
2160         
2161         d_add(dentry, dentry->d_inode);
2162  
2163 @@ -199,9 +219,9 @@
2164  
2165         for ( i = 0 ; i < sbi->max_ncci ; i++ ) {
2166                 if ( (inode = sbi->nccis[i].inode) ) {
2167 -                       if (atomic_read(&inode->i_count) != 1 )
2168 +                       if (i_count_read(inode->i_count) != 1 )
2169                                 printk("capifs_put_super: badness: entry %d count %d\n",
2170 -                                      i, (unsigned)atomic_read(&inode->i_count));
2171 +                                      i, (unsigned)i_count_read(inode->i_count));
2172                         inode->i_nlink--;
2173                         iput(inode);
2174                 }
2175 @@ -213,11 +233,24 @@
2176  
2177         kfree(sbi->nccis);
2178         kfree(sbi);
2179 +#ifndef COMPAT_VFS_2_4
2180 +       MOD_DEC_USE_COUNT;
2181 +#endif
2182  }
2183  
2184 +#ifdef COMPAT_VFS_2_4
2185  static int capifs_statfs(struct super_block *sb, struct statfs *buf);
2186 +#else
2187 +static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz);
2188 +static void capifs_write_inode(struct inode *inode) { };
2189 +static void capifs_read_inode(struct inode *inode);
2190 +#endif
2191  
2192  static struct super_operations capifs_sops = {
2193 +#ifndef COMPAT_VFS_2_4
2194 +       read_inode:     capifs_read_inode,
2195 +       write_inode:    capifs_write_inode,
2196 +#endif
2197         put_super:      capifs_put_super,
2198         statfs:         capifs_statfs,
2199  };
2200 @@ -288,6 +321,10 @@
2201         struct dentry * root;
2202         struct capifs_sb_info *sbi;
2203  
2204 +#ifndef COMPAT_VFS_2_4
2205 +       MOD_INC_USE_COUNT;
2206 +       lock_super(s);
2207 +#endif
2208         /* Super block already completed? */
2209         if (s->s_root)
2210                 goto out;
2211 @@ -322,6 +359,7 @@
2212         /*
2213          * Get the root inode and dentry, but defer checking for errors.
2214          */
2215 +#ifdef COMPAT_VFS_2_4
2216         root_inode = capifs_new_inode(s);
2217         if (root_inode) {
2218                 root_inode->i_ino = 1;
2219 @@ -331,6 +369,10 @@
2220                 root_inode->i_nlink = 2;
2221         } 
2222         root = d_alloc_root(root_inode);
2223 +#else
2224 +       root_inode = iget(s, 1); /* inode 1 == root directory */
2225 +       root = d_alloc_root(root_inode, NULL);
2226 +#endif
2227  
2228         /*
2229          * Check whether somebody else completed the super block.
2230 @@ -370,11 +412,34 @@
2231         mounts = s;
2232  
2233  out:   /* Success ... somebody else completed the super block for us. */ 
2234 +#ifndef COMPAT_VFS_2_4
2235 +       unlock_super(s);
2236 +#endif
2237         return s;
2238  fail:
2239 +#ifndef COMPAT_VFS_2_4
2240 +       unlock_super(s);
2241 +       MOD_DEC_USE_COUNT;
2242 +#endif
2243         return NULL;
2244  }
2245  
2246 +#ifndef COMPAT_VFS_2_4
2247 +static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
2248 +{
2249 +       struct statfs tmp;
2250 +
2251 +       tmp.f_type = CAPIFS_SUPER_MAGIC;
2252 +       tmp.f_bsize = 1024;
2253 +       tmp.f_blocks = 0;
2254 +       tmp.f_bfree = 0;
2255 +       tmp.f_bavail = 0;
2256 +       tmp.f_files = 0;
2257 +       tmp.f_ffree = 0;
2258 +       tmp.f_namelen = NAME_MAX;
2259 +       return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
2260 +}
2261 +#else
2262  static int capifs_statfs(struct super_block *sb, struct statfs *buf)
2263  {
2264         buf->f_type = CAPIFS_SUPER_MAGIC;
2265 @@ -387,7 +452,9 @@
2266         buf->f_namelen = NAME_MAX;
2267         return 0;
2268  }
2269 +#endif
2270  
2271 +#ifdef COMPAT_VFS_2_4
2272  static struct inode *capifs_new_inode(struct super_block *sb)
2273  {
2274         struct inode *inode = new_inode(sb);
2275 @@ -399,8 +466,51 @@
2276         }
2277         return inode;
2278  }
2279 +#else
2280 +static void capifs_read_inode(struct inode *inode)
2281 +{
2282 +       ino_t ino = inode->i_ino;
2283 +       struct capifs_sb_info *sbi = SBI(inode->i_sb);
2284 +
2285 +       inode->i_mode = 0;
2286 +       inode->i_nlink = 0;
2287 +       inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
2288 +       inode->i_blocks = 0;
2289 +       inode->i_blksize = 1024;
2290 +       inode->i_uid = inode->i_gid = 0;
2291 +
2292 +       if ( ino == 1 ) {
2293 +               inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
2294 +               inode->i_op = &capifs_root_inode_operations;
2295 +               inode->i_nlink = 2;
2296 +               return;
2297 +       } 
2298  
2299 +       ino -= 2;
2300 +       if ( ino >= sbi->max_ncci )
2301 +               return;         /* Bogus */
2302 +       
2303 +#ifdef COMPAT_VFS_2_4
2304 +       init_special_inode(inode, S_IFCHR, 0);
2305 +#else
2306 +       inode->i_mode = S_IFCHR;
2307 +       inode->i_op = &chrdev_inode_operations;
2308 +#endif
2309 +
2310 +       return;
2311 +}
2312 +#endif
2313 +
2314 +#ifndef COMPAT_VFS_2_4
2315 +static struct file_system_type capifs_fs_type = {
2316 +       "capifs",
2317 +       0,
2318 +       capifs_read_super,
2319 +       NULL
2320 +};
2321 +#else
2322  static DECLARE_FSTYPE(capifs_fs_type, "capifs", capifs_read_super, 0);
2323 +#endif
2324  
2325  void capifs_new_ncci(char type, unsigned int num, kdev_t device)
2326  {
2327 @@ -421,16 +531,26 @@
2328                                 break;
2329                         }
2330                 }
2331 +#ifdef COMPAT_VFS_2_4
2332                 if ( ino >= sbi->max_ncci )
2333                         continue;
2334  
2335                 if ((np->inode = capifs_new_inode(sb)) != NULL) {
2336 +#else
2337 +               if ((np->inode = iget(sb, ino+2)) != NULL) {
2338 +#endif
2339                         struct inode *inode = np->inode;
2340                         inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
2341                         inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
2342 +#ifdef COMPAT_VFS_2_4
2343                         inode->i_nlink = 1;
2344                         inode->i_ino = ino + 2;
2345                         init_special_inode(inode, sbi->mode|S_IFCHR, np->kdev);
2346 +#else
2347 +                       inode->i_mode = sbi->mode | S_IFCHR;
2348 +                       inode->i_rdev = np->kdev;
2349 +                       inode->i_nlink++;
2350 +#endif
2351                 }
2352         }
2353  }
2354 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capifs.h linux-2.4.29/drivers/isdn/avmb1/capifs.h
2355 --- linux-2.4.29.old/drivers/isdn/avmb1/capifs.h        2005-03-22 14:47:56.000000000 +0100
2356 +++ linux-2.4.29/drivers/isdn/avmb1/capifs.h    2005-03-22 15:06:44.965257024 +0100
2357 @@ -1,4 +1,4 @@
2358 -/* $Id: capifs.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2359 +/* $Id: capifs.h,v 1.4 2001/09/24 13:22:44 kai Exp $
2360   * 
2361   * Copyright 2000 by Carsten Paeth <calle@calle.de>
2362   *
2363 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capilli.h linux-2.4.29/drivers/isdn/avmb1/capilli.h
2364 --- linux-2.4.29.old/drivers/isdn/avmb1/capilli.h       2005-03-22 14:47:56.000000000 +0100
2365 +++ linux-2.4.29/drivers/isdn/avmb1/capilli.h   2005-03-22 15:06:44.980254744 +0100
2366 @@ -1,4 +1,4 @@
2367 -/* $Id: capilli.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2368 +/* $Id: capilli.h,v 1.5 2001/09/24 13:22:44 kai Exp $
2369   * 
2370   * Kernel CAPI 2.0 Driver Interface for Linux
2371   * 
2372 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capiutil.c linux-2.4.29/drivers/isdn/avmb1/capiutil.c
2373 --- linux-2.4.29.old/drivers/isdn/avmb1/capiutil.c      2005-03-22 14:47:56.000000000 +0100
2374 +++ linux-2.4.29/drivers/isdn/avmb1/capiutil.c  2005-03-22 15:06:44.997252160 +0100
2375 @@ -1,4 +1,4 @@
2376 -/* $Id: capiutil.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2377 +/* $Id: capiutil.c,v 1.16 2001/09/24 13:22:44 kai Exp $
2378   *
2379   * CAPI 2.0 convert capi message to capi message struct
2380   *
2381 @@ -19,6 +19,7 @@
2382  #include <linux/init.h>
2383  #include <asm/segment.h>
2384  #include <linux/config.h>
2385 +#include <linux/isdn_compat.h>
2386  #include "capiutil.h"
2387  
2388  MODULE_DESCRIPTION("CAPI4Linux: CAPI message conversion support");
2389 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/capiutil.h linux-2.4.29/drivers/isdn/avmb1/capiutil.h
2390 --- linux-2.4.29.old/drivers/isdn/avmb1/capiutil.h      2005-03-22 14:47:56.000000000 +0100
2391 +++ linux-2.4.29/drivers/isdn/avmb1/capiutil.h  2005-03-22 15:06:45.040245624 +0100
2392 @@ -1,4 +1,4 @@
2393 -/* $Id: capiutil.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2394 +/* $Id: capiutil.h,v 1.7 2001/09/24 13:22:44 kai Exp $
2395   *
2396   * CAPI 2.0 defines & types
2397   *
2398 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/kcapi.c linux-2.4.29/drivers/isdn/avmb1/kcapi.c
2399 --- linux-2.4.29.old/drivers/isdn/avmb1/kcapi.c 2005-03-22 14:47:56.000000000 +0100
2400 +++ linux-2.4.29/drivers/isdn/avmb1/kcapi.c     2005-03-22 15:06:45.062242280 +0100
2401 @@ -1,4 +1,4 @@
2402 -/* $Id: kcapi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2403 +/* $Id: kcapi.c,v 1.28 2001/09/24 13:22:44 kai Exp $
2404   * 
2405   * Kernel CAPI 2.0 Module
2406   * 
2407 @@ -21,6 +21,7 @@
2408  #include <linux/proc_fs.h>
2409  #include <linux/skbuff.h>
2410  #include <linux/tqueue.h>
2411 +#include <linux/isdn_compat.h>
2412  #include <linux/capi.h>
2413  #include <linux/kernelcapi.h>
2414  #include <linux/locks.h>
2415 @@ -33,7 +34,7 @@
2416  #include <linux/b1lli.h>
2417  #endif
2418  
2419 -static char *revision = "$Revision: 1.1.4.1 $";
2420 +static char *revision = "$Revision: 1.28 $";
2421  
2422  /* ------------------------------------------------------------- */
2423  
2424 @@ -64,7 +65,6 @@
2425         __u32 ncci;
2426         __u32 winsize;
2427         int   nmsg;
2428 -        spinlock_t lock;
2429         struct msgidqueue *msgidqueue;
2430         struct msgidqueue *msgidlast;
2431         struct msgidqueue *msgidfree;
2432 @@ -104,14 +104,14 @@
2433  #define APPL(a)                   (&applications[(a)-1])
2434  #define        VALID_APPLID(a)    ((a) && (a) <= CAPI_MAXAPPL && APPL(a)->applid == a)
2435  #define APPL_IS_FREE(a)    (APPL(a)->applid == 0)
2436 -#define APPL_MARK_FREE(a)  do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0)
2437 -#define APPL_MARK_USED(a)  do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0)
2438 +#define APPL_MARK_FREE(a)  do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0);
2439 +#define APPL_MARK_USED(a)  do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0);
2440  
2441  #define NCCI2CTRL(ncci)    (((ncci) >> 24) & 0x7f)
2442  
2443  #define VALID_CARD(c)     ((c) > 0 && (c) <= CAPI_MAXCONTR)
2444  #define CARD(c)                   (&cards[(c)-1])
2445 -#define CARDNR(cp)        ((((cp)-cards)+1) & 0xff)
2446 +#define CARDNR(cp)        (((cp)-cards)+1)
2447  
2448  static struct capi_appl applications[CAPI_MAXAPPL];
2449  static struct capi_ctr cards[CAPI_MAXCONTR];
2450 @@ -535,9 +535,13 @@
2451          * of devices. Devices can only removed in
2452          * user process, not in bh.
2453          */
2454 +#ifdef COMPAT_HAS_SCHEDULE_TASK
2455         MOD_INC_USE_COUNT;
2456         if (schedule_task(&tq_state_notify) == 0)
2457                 MOD_DEC_USE_COUNT;
2458 +#else
2459 +       queue_task(&tq_state_notify, &tq_scheduler);
2460 +#endif
2461         return 0;
2462  }
2463  
2464 @@ -546,13 +550,7 @@
2465  static void notify_up(__u32 contr)
2466  {
2467         struct capi_interface_user *p;
2468 -       __u16 appl;
2469  
2470 -       for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
2471 -               if (!VALID_APPLID(appl)) continue;
2472 -               if (APPL(appl)->releasing) continue;
2473 -               CARD(contr)->driver->register_appl(CARD(contr), appl, &APPL(appl)->rparam);
2474 -       }
2475          printk(KERN_NOTICE "kcapi: notify up contr %d\n", contr);
2476         spin_lock(&capi_users_lock);
2477         for (p = capi_users; p; p = p->next) {
2478 @@ -639,7 +637,9 @@
2479                 kfree(np);
2480                 MOD_DEC_USE_COUNT;
2481         }
2482 +#ifdef COMPAT_HAS_SCHEDULE_TASK
2483         MOD_DEC_USE_COUNT;
2484 +#endif
2485  }
2486         
2487  /* -------- NCCI Handling ------------------------------------- */
2488 @@ -647,7 +647,6 @@
2489  static inline void mq_init(struct capi_ncci * np)
2490  {
2491         int i;
2492 -        np->lock = SPIN_LOCK_UNLOCKED;
2493         np->msgidqueue = 0;
2494         np->msgidlast = 0;
2495         np->nmsg = 0;
2496 @@ -662,11 +661,8 @@
2497  static inline int mq_enqueue(struct capi_ncci * np, __u16 msgid)
2498  {
2499         struct msgidqueue *mq;
2500 -       spin_lock_bh(&np->lock);
2501 -       if ((mq = np->msgidfree) == 0) {
2502 -               spin_unlock_bh(&np->lock);
2503 +       if ((mq = np->msgidfree) == 0)
2504                 return 0;
2505 -       }
2506         np->msgidfree = mq->next;
2507         mq->msgid = msgid;
2508         mq->next = 0;
2509 @@ -676,14 +672,12 @@
2510         if (!np->msgidqueue)
2511                 np->msgidqueue = mq;
2512         np->nmsg++;
2513 -       spin_unlock_bh(&np->lock);
2514         return 1;
2515  }
2516  
2517  static inline int mq_dequeue(struct capi_ncci * np, __u16 msgid)
2518  {
2519         struct msgidqueue **pp;
2520 -       spin_lock_bh(&np->lock);
2521         for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
2522                 if ((*pp)->msgid == msgid) {
2523                         struct msgidqueue *mq = *pp;
2524 @@ -693,11 +687,9 @@
2525                         mq->next = np->msgidfree;
2526                         np->msgidfree = mq;
2527                         np->nmsg--;
2528 -                       spin_unlock_bh(&np->lock);
2529                         return 1;
2530                 }
2531         }
2532 -       spin_unlock_bh(&np->lock);
2533         return 0;
2534  }
2535  
2536 @@ -720,16 +712,12 @@
2537                         nextpp = &(*pp)->next;
2538                 }
2539         }
2540 -       if (APPL(appl)->releasing) { /* only release if the application was marked for release */
2541 -               printk(KERN_DEBUG "kcapi: appl %d releasing(%d)\n", appl, APPL(appl)->releasing);
2542 -               APPL(appl)->releasing--;
2543 -               if (APPL(appl)->releasing <= 0) {
2544 -                       APPL(appl)->signal = 0;
2545 -                       APPL_MARK_FREE(appl);
2546 -                       printk(KERN_INFO "kcapi: appl %d down\n", appl);
2547 -               }
2548 -       } else
2549 -               printk(KERN_WARNING "kcapi: appl %d card%d released without request\n", appl, card->cnr);
2550 +       APPL(appl)->releasing--;
2551 +       if (APPL(appl)->releasing <= 0) {
2552 +               APPL(appl)->signal = 0;
2553 +               APPL_MARK_FREE(appl);
2554 +               printk(KERN_INFO "kcapi: appl %d down\n", appl);
2555 +       }
2556  }
2557  /*
2558   * ncci management
2559 @@ -882,7 +870,16 @@
2560  
2561  static void controllercb_ready(struct capi_ctr * card)
2562  {
2563 +       __u16 appl;
2564 +
2565         card->cardstate = CARD_RUNNING;
2566 +
2567 +       for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
2568 +               if (!VALID_APPLID(appl)) continue;
2569 +               if (APPL(appl)->releasing) continue;
2570 +               card->driver->register_appl(card, appl, &APPL(appl)->rparam);
2571 +       }
2572 +
2573          printk(KERN_NOTICE "kcapi: card %d \"%s\" ready.\n",
2574                 CARDNR(card), card->name);
2575  
2576 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/t1isa.c linux-2.4.29/drivers/isdn/avmb1/t1isa.c
2577 --- linux-2.4.29.old/drivers/isdn/avmb1/t1isa.c 2005-03-22 14:47:56.000000000 +0100
2578 +++ linux-2.4.29/drivers/isdn/avmb1/t1isa.c     2005-03-22 15:06:45.078239848 +0100
2579 @@ -1,4 +1,4 @@
2580 -/* $Id: t1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2581 +/* $Id: t1isa.c,v 1.22 2001/09/24 13:22:44 kai Exp $
2582   * 
2583   * Module for AVM T1 HEMA-card.
2584   * 
2585 @@ -19,13 +19,14 @@
2586  #include <linux/capi.h>
2587  #include <linux/kernelcapi.h>
2588  #include <linux/init.h>
2589 +#include <linux/isdn_compat.h>
2590  #include <asm/io.h>
2591  #include "capicmd.h"
2592  #include "capiutil.h"
2593  #include "capilli.h"
2594  #include "avmcard.h"
2595  
2596 -static char *revision = "$Revision: 1.1.4.1 $";
2597 +static char *revision = "$Revision: 1.22 $";
2598  
2599  /* ------------------------------------------------------------- */
2600  
2601 diff -rNu linux-2.4.29.old/drivers/isdn/avmb1/t1pci.c linux-2.4.29/drivers/isdn/avmb1/t1pci.c
2602 --- linux-2.4.29.old/drivers/isdn/avmb1/t1pci.c 2005-03-22 14:47:56.000000000 +0100
2603 +++ linux-2.4.29/drivers/isdn/avmb1/t1pci.c     2005-03-22 15:06:45.094237416 +0100
2604 @@ -1,4 +1,4 @@
2605 -/* $Id: t1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2606 +/* $Id: t1pci.c,v 1.25 2001/09/24 13:22:44 kai Exp $
2607   * 
2608   * Module for AVM T1 PCI-card.
2609   * 
2610 @@ -18,6 +18,7 @@
2611  #include <linux/interrupt.h>
2612  #include <linux/ioport.h>
2613  #include <linux/pci.h>
2614 +#include <linux/isdn_compat.h>
2615  #include <linux/capi.h>
2616  #include <linux/init.h>
2617  #include <asm/io.h>
2618 @@ -26,19 +27,21 @@
2619  #include "capilli.h"
2620  #include "avmcard.h"
2621  
2622 -static char *revision = "$Revision: 1.1.4.1 $";
2623 +static char *revision = "$Revision: 1.25 $";
2624  
2625  #undef CONFIG_T1PCI_DEBUG
2626  #undef CONFIG_T1PCI_POLLDEBUG
2627  
2628  /* ------------------------------------------------------------- */
2629  
2630 +#ifndef COMPAT_HAS_2_2_PCI
2631  static struct pci_device_id t1pci_pci_tbl[] __initdata = {
2632         { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_T1, PCI_ANY_ID, PCI_ANY_ID },
2633         { }                             /* Terminating entry */
2634  };
2635  
2636  MODULE_DEVICE_TABLE(pci, t1pci_pci_tbl);
2637 +#endif
2638  MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 PCI card");
2639  MODULE_AUTHOR("Carsten Paeth");
2640  MODULE_LICENSE("GPL");
2641 @@ -264,9 +267,9 @@
2642                 }
2643                 pci_set_master(dev);
2644  
2645 -               param.port = pci_resource_start(dev, 1);
2646 +               param.port = pci_resource_start_io(dev, 1);
2647                 param.irq = dev->irq;
2648 -               param.membase = pci_resource_start(dev, 0);
2649 +               param.membase = pci_resource_start_mem(dev, 0);
2650  
2651                 printk(KERN_INFO
2652                         "%s: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x\n",
2653 diff -rNu linux-2.4.29.old/drivers/isdn/divert/divert_procfs.c linux-2.4.29/drivers/isdn/divert/divert_procfs.c
2654 --- linux-2.4.29.old/drivers/isdn/divert/divert_procfs.c        2005-03-22 14:47:56.000000000 +0100
2655 +++ linux-2.4.29/drivers/isdn/divert/divert_procfs.c    2005-03-22 15:06:45.158227688 +0100
2656 @@ -1,4 +1,4 @@
2657 -/* $Id: divert_procfs.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2658 +/* $Id$
2659   *
2660   * Filesystem handling for the diversion supplementary services.
2661   *
2662 @@ -14,13 +14,16 @@
2663  #include <linux/module.h>
2664  #include <linux/version.h>
2665  #include <linux/poll.h>
2666 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2667  #include <linux/smp_lock.h>
2668 +#endif
2669  #ifdef CONFIG_PROC_FS
2670  #include <linux/proc_fs.h>
2671  #else
2672  #include <linux/fs.h>
2673  #endif
2674  #include <linux/isdnif.h>
2675 +#include <linux/isdn_compat.h>
2676  #include "isdn_divert.h"
2677  
2678  /*********************************/
2679 @@ -80,7 +83,6 @@
2680  isdn_divert_read(struct file *file, char *buf, size_t count, loff_t * off)
2681  {
2682         struct divert_info *inf;
2683 -       loff_t pos = *off;
2684         int len;
2685  
2686         if (!*((struct divert_info **) file->private_data)) {
2687 @@ -92,11 +94,11 @@
2688                 return (0);
2689  
2690         inf->usage_cnt--;       /* new usage count */
2691 -       file->private_data = &inf->next;        /* next structure */
2692 +       (struct divert_info **) file->private_data = &inf->next;        /* next structure */
2693         if ((len = strlen(inf->info_start)) <= count) {
2694                 if (copy_to_user(buf, inf->info_start, len))
2695                         return -EFAULT;
2696 -               *off = pos + len;
2697 +               file->f_pos += len;
2698                 return (len);
2699         }
2700         return (0);
2701 @@ -136,17 +138,23 @@
2702  {
2703         unsigned long flags;
2704  
2705 +#ifdef COMPAT_USE_MODCOUNT_LOCK
2706 +       MOD_INC_USE_COUNT;
2707 +#else
2708         lock_kernel();
2709 +#endif
2710         save_flags(flags);
2711         cli();
2712         if_used++;
2713         if (divert_info_head)
2714 -               filep->private_data = &(divert_info_tail->next);
2715 +               (struct divert_info **) filep->private_data = &(divert_info_tail->next);
2716         else
2717 -               filep->private_data = &divert_info_head;
2718 +               (struct divert_info **) filep->private_data = &divert_info_head;
2719         restore_flags(flags);
2720         /*  start_divert(); */
2721 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2722         unlock_kernel();
2723 +#endif
2724         return (0);
2725  }                              /* isdn_divert_open */
2726  
2727 @@ -159,7 +167,9 @@
2728         struct divert_info *inf;
2729         unsigned long flags;
2730  
2731 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2732         lock_kernel();
2733 +#endif
2734         save_flags(flags);
2735         cli();
2736         if_used--;
2737 @@ -175,7 +185,11 @@
2738                         divert_info_head = divert_info_head->next;
2739                         kfree(inf);
2740                 }
2741 +#ifdef COMPAT_USE_MODCOUNT_LOCK
2742 +       MOD_DEC_USE_COUNT;
2743 +#else
2744         unlock_kernel();
2745 +#endif
2746         return (0);
2747  }                              /* isdn_divert_close */
2748  
2749 @@ -276,6 +290,9 @@
2750         open:           isdn_divert_open,
2751         release:        isdn_divert_close,                                      
2752  };
2753 +#ifdef COMPAT_NO_SOFTNET
2754 +struct inode_operations divert_file_inode_operations;
2755 +#endif
2756  
2757  /****************************/
2758  /* isdn subdir in /proc/net */
2759 @@ -302,8 +319,16 @@
2760                 remove_proc_entry("isdn", proc_net);
2761                 return (-1);
2762         }
2763 +#ifdef COMPAT_NO_SOFTNET
2764 +       memset(&divert_file_inode_operations, 0, sizeof(struct inode_operations));
2765 +       divert_file_inode_operations.default_file_ops = &isdn_fops;
2766 +       isdn_divert_entry->ops = &divert_file_inode_operations;
2767 +#else
2768         isdn_divert_entry->proc_fops = &isdn_fops; 
2769 +#ifdef COMPAT_HAS_FILEOP_OWNER
2770         isdn_divert_entry->owner = THIS_MODULE; 
2771 +#endif
2772 +#endif  /* COMPAT_NO_SOFTNET */
2773  #endif /* CONFIG_PROC_FS */
2774  
2775         return (0);
2776 diff -rNu linux-2.4.29.old/drivers/isdn/divert/isdn_divert.c linux-2.4.29/drivers/isdn/divert/isdn_divert.c
2777 --- linux-2.4.29.old/drivers/isdn/divert/isdn_divert.c  2005-03-22 14:47:56.000000000 +0100
2778 +++ linux-2.4.29/drivers/isdn/divert/isdn_divert.c      2005-03-22 15:06:45.173225408 +0100
2779 @@ -1,4 +1,4 @@
2780 -/* $Id: isdn_divert.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2781 +/* $Id$
2782   *
2783   * DSS1 main diversion supplementary handling for i4l.
2784   *
2785 @@ -84,6 +84,9 @@
2786         restore_flags(flags); 
2787         break;
2788  
2789 +     case NETWORK_DIAL:
2790 +       divert_if.dial_net_name(cs->deflect_dest);  
2791 +
2792       case DEFLECT_AUTODEL:
2793       default:
2794         save_flags(flags);
2795 @@ -452,6 +455,7 @@
2796           case DEFLECT_PROCEED:
2797           case DEFLECT_REPORT:
2798           case DEFLECT_REJECT:
2799 +         case NETWORK_DIAL:
2800             if (dv->rule.action == DEFLECT_PROCEED)
2801             if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime))) 
2802                return(0); /* no external deflection needed */  
2803 @@ -495,6 +499,11 @@
2804             else
2805               { cs->deflect_dest[0] = '\0';
2806                retval = 4; /* only proceed */
2807 +              if (cs->akt_state == NETWORK_DIAL) {
2808 +                strcpy(cs->deflect_dest,dv->rule.to_nr);
2809 +                cs->timer.expires = jiffies + 10;
2810 +                retval = 0;
2811 +              }
2812               }  
2813             sprintf(cs->info,"%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n",
2814                     cs->akt_state,
2815 @@ -739,6 +748,18 @@
2816                        } 
2817  
2818  
2819 +#if 0
2820 +  sprintf(st, "0x%lx 0x%lx",ic->arg, ic->parm.dss1_io.ll_id);
2821 +  p = st + strlen(st);
2822 +  p1 = ic->parm.dss1_io.data;
2823 +  i = ic->parm.dss1_io.datalen;
2824 +  while ((i > 0) && (p - st < 530))
2825 +   { p += sprintf(p," %02x",(*p1++) & 0xFF);
2826 +     i--;
2827 +   }
2828 +  sprintf(p, "\n");
2829 +  put_info_buffer(st);
2830 +#endif
2831                     break;
2832   
2833                    default:
2834 diff -rNu linux-2.4.29.old/drivers/isdn/divert/isdn_divert.h linux-2.4.29/drivers/isdn/divert/isdn_divert.h
2835 --- linux-2.4.29.old/drivers/isdn/divert/isdn_divert.h  2005-03-22 14:47:56.000000000 +0100
2836 +++ linux-2.4.29/drivers/isdn/divert/isdn_divert.h      2005-03-22 15:06:45.189222976 +0100
2837 @@ -1,4 +1,4 @@
2838 -/* $Id: isdn_divert.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2839 +/* $Id$
2840   *
2841   * Header for the diversion supplementary ioctl interface.
2842   *
2843 @@ -36,9 +36,10 @@
2844  #define DEFLECT_PROCEED   2  /* deflect when externally triggered */
2845  #define DEFLECT_ALERT     3  /* alert and deflect after delay */ 
2846  #define DEFLECT_REJECT    4  /* reject immediately */
2847 -#define DIVERT_ACTIVATE   5  /* diversion activate */
2848 -#define DIVERT_DEACTIVATE 6  /* diversion deactivate */
2849 -#define DIVERT_REPORT     7  /* interrogation result */ 
2850 +#define NETWORK_DIAL      5  /* dial a network interface */
2851 +#define DIVERT_ACTIVATE   16 /* diversion activate */
2852 +#define DIVERT_DEACTIVATE 17 /* diversion deactivate */
2853 +#define DIVERT_REPORT     18 /* interrogation result */ 
2854  #define DEFLECT_AUTODEL 255  /* only for internal use */ 
2855  
2856  #define DEFLECT_ALL_IDS   0xFFFFFFFF /* all drivers selected */
2857 @@ -60,6 +61,7 @@
2858                         2 = report call, send proceed, wait max waittime secs
2859                         3 = report call, alert and deflect after waittime 
2860                         4 = report call, reject immediately  
2861 +                       5 = dial net interface specified in to_nr  
2862                         actions 1-2 only take place if interface is opened 
2863                     */
2864     u_char waittime; /* maximum wait time for proceeding */ 
2865 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/Divas_mod.c linux-2.4.29/drivers/isdn/eicon/Divas_mod.c
2866 --- linux-2.4.29.old/drivers/isdn/eicon/Divas_mod.c     2005-03-22 14:47:56.000000000 +0100
2867 +++ linux-2.4.29/drivers/isdn/eicon/Divas_mod.c 2005-03-22 15:06:45.229216896 +0100
2868 @@ -20,6 +20,7 @@
2869  #include "adapter.h"
2870  #include "uxio.h"
2871  
2872 +#include <linux/isdn_compat.h>
2873  
2874  MODULE_DESCRIPTION("ISDN4Linux: Driver for Eicon Diva Server cards");
2875  MODULE_AUTHOR("Armin Schindler");
2876 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/common.c linux-2.4.29/drivers/isdn/eicon/common.c
2877 --- linux-2.4.29.old/drivers/isdn/eicon/common.c        2005-03-22 14:47:56.000000000 +0100
2878 +++ linux-2.4.29/drivers/isdn/eicon/common.c    2005-03-22 15:06:45.301205952 +0100
2879 @@ -808,9 +808,7 @@
2880         
2881         while(i--)
2882         {
2883 -            if (card->state == DIA_RUNNING)
2884 -               DivaDoCardDpc(card);
2885 -            card++;
2886 +               DivaDoCardDpc(card++);
2887         }
2888  }
2889  
2890 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon.h linux-2.4.29/drivers/isdn/eicon/eicon.h
2891 --- linux-2.4.29.old/drivers/isdn/eicon/eicon.h 2005-03-22 14:47:56.000000000 +0100
2892 +++ linux-2.4.29/drivers/isdn/eicon/eicon.h     2005-03-22 15:06:45.371195312 +0100
2893 @@ -1,4 +1,4 @@
2894 -/* $Id: eicon.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2895 +/* $Id: eicon.h,v 1.26 2001/09/24 13:22:47 kai Exp $
2896   *
2897   * ISDN low-level module for Eicon active ISDN-Cards.
2898   *
2899 @@ -348,19 +348,19 @@
2900  extern char *eicon_ctype_name[];
2901  
2902  
2903 -static inline void eicon_schedule_tx(eicon_card *card)
2904 +extern __inline__ void eicon_schedule_tx(eicon_card *card)
2905  {
2906          queue_task(&card->snd_tq, &tq_immediate);
2907          mark_bh(IMMEDIATE_BH);
2908  }
2909  
2910 -static inline void eicon_schedule_rx(eicon_card *card)
2911 +extern __inline__ void eicon_schedule_rx(eicon_card *card)
2912  {
2913          queue_task(&card->rcv_tq, &tq_immediate);
2914          mark_bh(IMMEDIATE_BH);
2915  }
2916  
2917 -static inline void eicon_schedule_ack(eicon_card *card)
2918 +extern __inline__ void eicon_schedule_ack(eicon_card *card)
2919  {
2920          queue_task(&card->ack_tq, &tq_immediate);
2921          mark_bh(IMMEDIATE_BH);
2922 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_dsp.h linux-2.4.29/drivers/isdn/eicon/eicon_dsp.h
2923 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_dsp.h     2005-03-22 14:47:56.000000000 +0100
2924 +++ linux-2.4.29/drivers/isdn/eicon/eicon_dsp.h 2005-03-22 15:06:45.386193032 +0100
2925 @@ -1,4 +1,4 @@
2926 -/* $Id: eicon_dsp.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2927 +/* $Id: eicon_dsp.h,v 1.8 2001/09/24 13:22:47 kai Exp $
2928   *
2929   * ISDN lowlevel-module for Eicon active cards.
2930   * DSP definitions
2931 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.c linux-2.4.29/drivers/isdn/eicon/eicon_idi.c
2932 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.c     2005-03-22 14:47:56.000000000 +0100
2933 +++ linux-2.4.29/drivers/isdn/eicon/eicon_idi.c 2005-03-22 15:06:45.421187712 +0100
2934 @@ -1,4 +1,4 @@
2935 -/* $Id: eicon_idi.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2936 +/* $Id: eicon_idi.c,v 1.45 2001/11/07 22:35:48 kai Exp $
2937   *
2938   * ISDN lowlevel-module for Eicon active cards.
2939   * IDI interface 
2940 @@ -25,7 +25,7 @@
2941  
2942  #undef EICON_FULL_SERVICE_OKTETT
2943  
2944 -char *eicon_idi_revision = "$Revision: 1.1.4.1 $";
2945 +char *eicon_idi_revision = "$Revision: 1.45 $";
2946  
2947  eicon_manifbuf *manbuf;
2948  
2949 @@ -1583,6 +1583,37 @@
2950                 return;
2951         }
2952  
2953 +#if 0 
2954 +       eicon_sff_dochead *doc = (eicon_sff_dochead *)skb->data;
2955 +       eicon_sff_pagehead *page = (eicon_sff_pagehead *)skb->data + sizeof(eicon_sff_dochead);
2956 +
2957 +       printk(KERN_DEBUG"SFF: doc %d / page %d (skb : %d)\n", 
2958 +               sizeof(eicon_sff_dochead), 
2959 +               sizeof(eicon_sff_pagehead), skb->len);
2960 +
2961 +       if (skb->len >= sizeof(eicon_sff_dochead)) {
2962 +               printk(KERN_DEBUG"SFF: id = 0x%x\n", doc->id);
2963 +               printk(KERN_DEBUG"SFF: version = 0x%x\n", doc->version);
2964 +               printk(KERN_DEBUG"SFF: reserved1 = 0x%x\n", doc->reserved1);
2965 +               printk(KERN_DEBUG"SFF: userinfo = 0x%x\n", doc->userinfo);
2966 +               printk(KERN_DEBUG"SFF: pagecount = 0x%x\n", doc->pagecount);
2967 +               printk(KERN_DEBUG"SFF: off1pagehead = 0x%x\n", doc->off1pagehead);
2968 +               printk(KERN_DEBUG"SFF: offnpagehead = 0x%x\n", doc->offnpagehead);
2969 +               printk(KERN_DEBUG"SFF: offdocend = 0x%x\n", doc->offdocend);
2970 +       }
2971 +       if (skb->len >= (sizeof(eicon_sff_dochead) + sizeof(eicon_sff_pagehead))) {
2972 +               printk(KERN_DEBUG"SFFp: id = 0x%x\n", page->pageheadid);
2973 +               printk(KERN_DEBUG"SFFp: len = 0x%x\n", page->pageheadlen);
2974 +               printk(KERN_DEBUG"SFFp: resvert = 0x%x\n", page->resvert);
2975 +               printk(KERN_DEBUG"SFFp: reshoriz = 0x%x\n", page->reshoriz);
2976 +               printk(KERN_DEBUG"SFFp: coding = 0x%x\n", page->coding);
2977 +               printk(KERN_DEBUG"SFFp: reserved2 = 0x%x\n", page->reserved2);
2978 +               printk(KERN_DEBUG"SFFp: linelength = 0x%x\n", page->linelength);
2979 +               printk(KERN_DEBUG"SFFp: pagelength = 0x%x\n", page->pagelength);
2980 +               printk(KERN_DEBUG"SFFp: offprevpage = 0x%x\n", page->offprevpage);
2981 +               printk(KERN_DEBUG"SFFp: offnextpage = 0x%x\n", page->offnextpage);
2982 +       }
2983 +#endif
2984  
2985         
2986         if (chan->fax->direction == ISDN_TTY_FAX_CONN_IN) {
2987 @@ -2054,8 +2085,7 @@
2988                                 OutBuf.Len++;
2989                         } else {
2990                                 *OutBuf.Next++ = 0;
2991 -                               *(__u16 *) OutBuf.Next = (__u16) LineBuf.Len;
2992 -                               OutBuf.Next += sizeof(__u16);
2993 +                               *((__u16 *) OutBuf.Next)++ = (__u16) LineBuf.Len;
2994                                 OutBuf.Len += 3;
2995                         }
2996                         memcpy(OutBuf.Next, LineBuf.Data, LineBuf.Len);
2997 @@ -2385,6 +2415,12 @@
2998                                 } else {
2999                                         if (chan->e.B2Id)
3000                                                 idi_do_req(ccard, chan, REMOVE, 1);
3001 +#if 0
3002 +                                       if (chan->e.D3Id) {
3003 +                                               idi_do_req(ccard, chan, REMOVE, 0);
3004 +                                               idi_do_req(ccard, chan, ASSIGN, 0);
3005 +                                       }
3006 +#endif
3007                                         chan->statectrl &= ~WAITING_FOR_HANGUP;
3008                                         chan->statectrl &= ~IN_HOLD;
3009                                         if (chan->statectrl & HAVE_CONN_REQ) {
3010 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.h linux-2.4.29/drivers/isdn/eicon/eicon_idi.h
3011 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_idi.h     2005-03-22 14:47:56.000000000 +0100
3012 +++ linux-2.4.29/drivers/isdn/eicon/eicon_idi.h 2005-03-22 15:06:45.437185280 +0100
3013 @@ -1,4 +1,4 @@
3014 -/* $Id: eicon_idi.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3015 +/* $Id: eicon_idi.h,v 1.12 2001/09/24 13:22:47 kai Exp $
3016   *
3017   * ISDN lowlevel-module for the Eicon active cards.
3018   * IDI-Interface
3019 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_io.c linux-2.4.29/drivers/isdn/eicon/eicon_io.c
3020 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_io.c      2005-03-22 14:47:56.000000000 +0100
3021 +++ linux-2.4.29/drivers/isdn/eicon/eicon_io.c  2005-03-22 15:06:45.453182848 +0100
3022 @@ -1,4 +1,4 @@
3023 -/* $Id: eicon_io.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3024 +/* $Id: eicon_io.c,v 1.15 2001/09/24 13:22:47 kai Exp $
3025   *
3026   * ISDN low-level module for Eicon active ISDN-Cards.
3027   * Code for communicating with hardware.
3028 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.c linux-2.4.29/drivers/isdn/eicon/eicon_isa.c
3029 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.c     2005-03-22 14:47:56.000000000 +0100
3030 +++ linux-2.4.29/drivers/isdn/eicon/eicon_isa.c 2005-03-22 15:06:45.469180416 +0100
3031 @@ -1,4 +1,4 @@
3032 -/* $Id: eicon_isa.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3033 +/* $Id: eicon_isa.c,v 1.18 2001/11/07 22:35:48 kai Exp $
3034   *
3035   * ISDN low-level module for Eicon active ISDN-Cards.
3036   * Hardware-specific code for old ISA cards.
3037 @@ -20,7 +20,7 @@
3038  #define release_shmem release_region
3039  #define request_shmem request_region
3040  
3041 -char *eicon_isa_revision = "$Revision: 1.1.4.1 $";
3042 +char *eicon_isa_revision = "$Revision: 1.18 $";
3043  
3044  #undef EICON_MCA_DEBUG
3045  
3046 @@ -38,8 +38,12 @@
3047  static void
3048  eicon_isa_release_shmem(eicon_isa_card *card) {
3049         if (card->mvalid) {
3050 +#ifdef COMPAT_HAS_ISA_IOREMAP
3051                 iounmap(card->shmem);
3052                 release_mem_region(card->physmem, card->ramsize);
3053 +#else
3054 +               release_shmem((unsigned long)card->shmem, card->ramsize);
3055 +#endif
3056         }
3057         card->mvalid = 0;
3058  }
3059 @@ -94,12 +98,20 @@
3060                          Mem, Id);
3061                 return -1;
3062         }
3063 +#ifdef COMPAT_HAS_ISA_IOREMAP
3064         if (check_mem_region(Mem, RAMSIZE)) {
3065 +#else
3066 +       if (check_shmem(Mem, RAMSIZE)) {
3067 +#endif
3068                 printk(KERN_WARNING "eicon_isa_boot: memory at 0x%x already in use.\n", Mem);
3069                 return -1;
3070         }
3071  
3072 +#ifdef COMPAT_HAS_ISA_IOREMAP
3073         amem = (unsigned long) ioremap(Mem, RAMSIZE);
3074 +#else
3075 +       amem = (unsigned long) Mem;
3076 +#endif
3077          writew(0x55aa, amem + 0x402);
3078          if (readw(amem + 0x402) != 0x55aa) primary = 0;
3079         writew(0, amem + 0x402);
3080 @@ -109,12 +121,16 @@
3081         if (primary) {
3082                 printk(KERN_INFO "Eicon: assuming pri card at 0x%x\n", Mem);
3083                 writeb(0, amem + 0x3ffe);
3084 +#ifdef COMPAT_HAS_ISA_IOREMAP
3085                 iounmap((unsigned char *)amem);
3086 +#endif
3087                 return EICON_CTYPE_ISAPRI;
3088         } else {
3089                 printk(KERN_INFO "Eicon: assuming bri card at 0x%x\n", Mem);
3090                 writeb(0, amem + 0x400);
3091 +#ifdef COMPAT_HAS_ISA_IOREMAP
3092                 iounmap((unsigned char *)amem);
3093 +#endif
3094                 return EICON_CTYPE_ISABRI;
3095         }
3096         return -1;
3097 @@ -151,6 +167,7 @@
3098         else
3099                 card->ramsize  = RAMSIZE;
3100  
3101 +#ifdef COMPAT_HAS_ISA_IOREMAP
3102         if (check_mem_region(card->physmem, card->ramsize)) {
3103                 printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
3104                         card->physmem);
3105 @@ -159,6 +176,16 @@
3106         }
3107         request_mem_region(card->physmem, card->ramsize, "Eicon ISA ISDN");
3108         card->shmem = (eicon_isa_shmem *) ioremap(card->physmem, card->ramsize);
3109 +#else
3110 +       /* Register shmem */
3111 +       if (check_shmem((unsigned long)card->shmem, card->ramsize)) {
3112 +               printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
3113 +                       (unsigned long)card->shmem);
3114 +               kfree(code);
3115 +               return -EBUSY;
3116 +       }
3117 +       request_shmem((unsigned long)card->shmem, card->ramsize, "Eicon ISA ISDN");
3118 +#endif
3119  #ifdef EICON_MCA_DEBUG
3120         printk(KERN_INFO "eicon_isa_boot: card->ramsize = %d.\n", card->ramsize);
3121  #endif
3122 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.h linux-2.4.29/drivers/isdn/eicon/eicon_isa.h
3123 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_isa.h     2005-03-22 14:47:56.000000000 +0100
3124 +++ linux-2.4.29/drivers/isdn/eicon/eicon_isa.h 2005-03-22 15:06:45.485177984 +0100
3125 @@ -1,4 +1,4 @@
3126 -/* $Id: eicon_isa.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3127 +/* $Id: eicon_isa.h,v 1.11 2001/09/24 13:22:47 kai Exp $
3128   *
3129   * ISDN low-level module for Eicon active ISDN-Cards.
3130   *
3131 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_mod.c linux-2.4.29/drivers/isdn/eicon/eicon_mod.c
3132 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_mod.c     2005-03-22 14:47:56.000000000 +0100
3133 +++ linux-2.4.29/drivers/isdn/eicon/eicon_mod.c 2005-03-22 15:06:45.505174944 +0100
3134 @@ -1,4 +1,4 @@
3135 -/* $Id: eicon_mod.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3136 +/* $Id: eicon_mod.c,v 1.44 2001/11/20 09:48:25 armin Exp $
3137   *
3138   * ISDN lowlevel-module for Eicon active cards.
3139   * 
3140 @@ -44,7 +44,7 @@
3141  static eicon_card *cards = (eicon_card *) NULL;   /* glob. var , contains
3142                                                       start of card-list   */
3143  
3144 -static char *eicon_revision = "$Revision: 1.1.4.1 $";
3145 +static char *eicon_revision = "$Revision: 1.44 $";
3146  
3147  extern char *eicon_pci_revision;
3148  extern char *eicon_isa_revision;
3149 @@ -639,6 +639,18 @@
3150  static int
3151  if_writecmd(const u_char * buf, int len, int user, int id, int channel)
3152  {
3153 +#if 0
3154 +       /* Not yet used */
3155 +        eicon_card *card = eicon_findcard(id);
3156 +
3157 +        if (card) {
3158 +                if (!card->flags & EICON_FLAGS_RUNNING)
3159 +                        return (len);
3160 +                return (len);
3161 +        }
3162 +        printk(KERN_ERR
3163 +               "eicon: if_writecmd called with invalid driverId!\n");
3164 +#endif
3165          return (len);
3166  }
3167  
3168 @@ -665,11 +677,8 @@
3169                         else
3170                                 cnt = skb->len;
3171  
3172 -                       if (user) {
3173 -                               spin_unlock_irqrestore(&eicon_lock, flags);
3174 +                       if (user)
3175                                 copy_to_user(p, skb->data, cnt);
3176 -                               spin_lock_irqsave(&eicon_lock, flags);
3177 -                       }
3178                         else
3179                                 memcpy(p, skb->data, cnt);
3180  
3181 @@ -1459,6 +1468,7 @@
3182  
3183  #ifndef MODULE
3184  
3185 +#ifdef COMPAT_HAS_NEW_SETUP
3186  static int __init
3187  eicon_setup(char *line)
3188  {
3189 @@ -1467,6 +1477,12 @@
3190         char *str;
3191  
3192         str = get_options(line, 4, ints);
3193 +#else
3194 +void
3195 +eicon_setup(char *str, int *ints)
3196 +{
3197 +        int i, argc;
3198 +#endif
3199  
3200          argc = ints[0];
3201          i = 1;
3202 @@ -1494,9 +1510,13 @@
3203  #else
3204         printk(KERN_INFO "Eicon ISDN active driver setup\n");
3205  #endif
3206 +#ifdef COMPAT_HAS_NEW_SETUP
3207         return(1);
3208  }
3209  __setup("eicon=", eicon_setup);
3210 +#else
3211 +}
3212 +#endif
3213  
3214  #endif /* MODULE */
3215  
3216 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.c linux-2.4.29/drivers/isdn/eicon/eicon_pci.c
3217 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.c     2005-03-22 14:47:56.000000000 +0100
3218 +++ linux-2.4.29/drivers/isdn/eicon/eicon_pci.c 2005-03-22 15:06:45.522172360 +0100
3219 @@ -1,4 +1,4 @@
3220 -/* $Id: eicon_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3221 +/* $Id: eicon_pci.c,v 1.18 2001/09/24 13:22:47 kai Exp $
3222   *
3223   * ISDN low-level module for Eicon active ISDN-Cards.
3224   * Hardware-specific code for PCI cards.
3225 @@ -24,7 +24,7 @@
3226  #include "adapter.h"
3227  #include "uxio.h"
3228  
3229 -char *eicon_pci_revision = "$Revision: 1.1.4.1 $";
3230 +char *eicon_pci_revision = "$Revision: 1.18 $";
3231  
3232  #if CONFIG_PCI          /* intire stuff is only for PCI */
3233  #ifdef CONFIG_ISDN_DRV_EICON_PCI
3234 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.h linux-2.4.29/drivers/isdn/eicon/eicon_pci.h
3235 --- linux-2.4.29.old/drivers/isdn/eicon/eicon_pci.h     2005-03-22 14:47:56.000000000 +0100
3236 +++ linux-2.4.29/drivers/isdn/eicon/eicon_pci.h 2005-03-22 15:06:45.538169928 +0100
3237 @@ -1,4 +1,4 @@
3238 -/* $Id: eicon_pci.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3239 +/* $Id: eicon_pci.h,v 1.7 2001/09/24 13:22:47 kai Exp $
3240   *
3241   * ISDN low-level module for Eicon active ISDN-Cards (PCI part).
3242   *
3243 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/fourbri.c linux-2.4.29/drivers/isdn/eicon/fourbri.c
3244 --- linux-2.4.29.old/drivers/isdn/eicon/fourbri.c       2005-03-22 14:47:56.000000000 +0100
3245 +++ linux-2.4.29/drivers/isdn/eicon/fourbri.c   2005-03-22 15:06:45.553167648 +0100
3246 @@ -337,8 +337,7 @@
3247  static int diva_server_4bri_start(card_t *card, byte *channels)
3248  {
3249         byte *ctl;
3250 -       byte *shared;
3251 -       int i;
3252 +       byte *shared, i;
3253         int adapter_num;
3254  
3255         DPRINTF(("divas: start Diva Server 4BRI"));
3256 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/kprintf.c linux-2.4.29/drivers/isdn/eicon/kprintf.c
3257 --- linux-2.4.29.old/drivers/isdn/eicon/kprintf.c       2005-03-22 14:47:56.000000000 +0100
3258 +++ linux-2.4.29/drivers/isdn/eicon/kprintf.c   2005-03-22 15:06:45.601160352 +0100
3259 @@ -18,6 +18,468 @@
3260  #include "divalog.h"
3261  #include "uxio.h"
3262  
3263 +/*
3264 + * Implementation of printf and sprintf for kernel
3265 + */
3266 +
3267 +#define MAX_BUFF    (80)        /* limit size of temporary buffers */
3268 +
3269 +#define WRITE_CHAR(BUFFER, SIZE, C) \
3270 +  if (--(SIZE) < 0) { (BUFFER)--; *(BUFFER) = '\0'; return; } *(BUFFER)++ = (C)
3271 +
3272 +
3273 +/*
3274 + * convert a number to decimal ASCII
3275 + */
3276 +
3277 +static
3278 +void    do_decimal( char            *temp,
3279 +                    int             temp_len,
3280 +                    unsigned int    value,
3281 +                    char            *s)
3282 +
3283 +{
3284 +    int     i;
3285 +
3286 +    temp[0] = '\0';
3287 +
3288 +    for (i = 1; i < temp_len; i++)
3289 +    {
3290 +        temp[i] = (char) ((value % 10) + (int) '0');
3291 +        value /= 10;
3292 +    }
3293 +
3294 +    for (i = (temp_len - 1); temp[i] == '0'; i--)
3295 +    {
3296 +        ;
3297 +    }
3298 +
3299 +    if (i == 0)
3300 +    {
3301 +        i++;
3302 +    }
3303 +
3304 +    while (i >= 0)
3305 +    {
3306 +        *s++ = temp[i--];
3307 +    }
3308 +
3309 +    return;
3310 +}
3311 +
3312 +/*
3313 + * convert a number to octal ASCII
3314 + */
3315 +
3316 +static
3317 +void    do_octal(   char            *temp,
3318 +                    unsigned int    value,
3319 +                    char            *s)
3320 +
3321 +{
3322 +    int     i;
3323 +
3324 +    temp[0] = '\0';
3325 +
3326 +    for (i = 1; i <= 11; i++)
3327 +    {
3328 +        temp[i] = (char) ((value & 07) + (int) '0');
3329 +        value >>= 3;
3330 +    }
3331 +    temp[11] &= '3';
3332 +
3333 +    for (i = 11; temp[i] == '0'; i--)
3334 +    {
3335 +        ;
3336 +    }
3337 +
3338 +    if (i == 0)
3339 +    {
3340 +        i++;
3341 +    }
3342 +
3343 +    while (i >= 0)
3344 +    {
3345 +        *s++ = temp[i--];
3346 +    }
3347 +
3348 +    return;
3349 +}
3350 +
3351 +/*
3352 + * convert a number to hex ASCII
3353 + */
3354 +
3355 +static
3356 +void    do_hex( char            *temp,
3357 +                unsigned int    value,
3358 +                char            *s)
3359 +
3360 +{
3361 +    int     i;
3362 +    static
3363 +    char    *dec_to_hex = "0123456789abcdef";
3364 +
3365 +    temp[0] = '\0';
3366 +
3367 +    for (i = 1; i <= 8; i++)
3368 +    {
3369 +        temp[i] = dec_to_hex[value & 0x0f];
3370 +        value >>= 4;
3371 +    }
3372 +
3373 +    for (i = 8; temp[i] == '0'; i--)
3374 +    {
3375 +        ;
3376 +    }
3377 +
3378 +    if (i == 0)
3379 +    {
3380 +        i++;
3381 +    }
3382 +
3383 +    while (i >= 0)
3384 +    {
3385 +        *s++ = temp[i--];
3386 +    }
3387 +
3388 +    return;
3389 +}
3390 +
3391 +/*
3392 + * convert a buffer to ASCII HEX
3393 + */
3394 +
3395 +static
3396 +void    do_buffer(  char    *buffer,
3397 +                    int     length,
3398 +                    char    *s)
3399 +
3400 +{
3401 +    static
3402 +    char    hex_char [] = "0123456789abcdef";
3403 +    char    *b = buffer;
3404 +    int     hex_byte;
3405 +    int     nybble;
3406 +
3407 +    length = (length >= ((MAX_BUFF / 3) + 1)) ? (MAX_BUFF / 3) : length;
3408 +
3409 +    while (length)
3410 +    {
3411 +        hex_byte = (int) *b++;
3412 +        nybble = (hex_byte >> 4) & 0xf;
3413 +        *s++ = hex_char[nybble];
3414 +        nybble = hex_byte & 0xf;
3415 +        *s++ = hex_char[nybble];
3416 +        *s++ = ' ';
3417 +        length--;
3418 +    }
3419 +    *s = '\0';
3420 +
3421 +    return;
3422 +}
3423 +
3424 +/*
3425 + * Body of sprintf function: behaves just like standard sprintf, except we
3426 + * have an extra argument (buffer size) which we use to ensure we don't
3427 + * overflow
3428 + */
3429 +
3430 +void    Divas_vsprintf(   char    *buffer,
3431 +                    int     size,
3432 +                    char    *fmt,
3433 +                    va_list argptr)
3434 +
3435 +{
3436 +    char        c;          /* single character buffer */
3437 +    int         i;          /* handy scratch counter */
3438 +    int         f;          /* format character (after %) */
3439 +    char        *str;       /* pointer into string */
3440 +    char        temp[20];   /* temp buffer used in printing numbers */
3441 +    char        string[MAX_BUFF]; /* output from number conversion */
3442 +    int         length;     /* length of string "str" */
3443 +    char        fill;       /* fill character ' ' or '0' */
3444 +    boolean_t   leftjust;   /* TRUE if left justified, else right justified */
3445 +    int         fmax, fmin; /* field specifiers % MIN . MAX s */
3446 +    int         leading;    /* number of leading/trailing fill characters */
3447 +    char        sign;       /* set to '-' for negative decimals */
3448 +    int         number;     /* numeric argument */
3449 +
3450 +    char        *buff_ptr;  /* pointer to user's buffer of hex data */
3451 +    int         buff_len;   /* length of hex data */
3452 +
3453 +    /* make sure we have somthing to write into */
3454 +
3455 +    if ((!buffer) || (size <= 0))
3456 +    {
3457 +        return;
3458 +    }
3459 +
3460 +    while (TRUE)
3461 +    {
3462 +        /* echo characters until end or '%' encountered */
3463 +
3464 +        while ((c = *fmt++) != '%')
3465 +        {
3466 +            if (!c)
3467 +            {
3468 +                *buffer = '\0';
3469 +                return;
3470 +            }
3471 +            WRITE_CHAR(buffer, size, c);
3472 +        }
3473 +
3474 +        /* echo %% as % */
3475 +
3476 +        if (*fmt == '%')
3477 +        {
3478 +            WRITE_CHAR(buffer, size, *fmt);
3479 +            continue;
3480 +        }
3481 +
3482 +        /* %- turns on left-justify */
3483 +
3484 +        if ((leftjust = (boolean_t) ((*fmt == '-') ? TRUE : FALSE)))
3485 +        {
3486 +            fmt++;
3487 +        }
3488 +
3489 +        /* %0 turns on zero filling */
3490 +
3491 +        if (*fmt == '0')
3492 +        {
3493 +            fill = '0';
3494 +        }
3495 +        else
3496 +        {
3497 +            fill = ' ';
3498 +        }
3499 +
3500 +        /* minium field width specifier for %d, u, x, c, s */
3501 +
3502 +        fmin = 0;
3503 +
3504 +        if (*fmt == '*')
3505 +        {
3506 +            fmin = va_arg(argptr, int);
3507 +            fmt++;
3508 +        }
3509 +        else
3510 +        {
3511 +            while ('0' <= *fmt && *fmt <= '9')
3512 +            {
3513 +                fmin = (fmin * 10) + (*fmt++ - '0');
3514 +            }
3515 +        }
3516 +
3517 +        /* maximum string width specifier for %s */
3518 +
3519 +        fmax = 0;
3520 +
3521 +        if (*fmt == '.')
3522 +        {
3523 +            if (*(++fmt) == '*')
3524 +            {
3525 +                fmax = va_arg(argptr, int);
3526 +                fmt++;
3527 +            }
3528 +            else
3529 +            {
3530 +                while ('0' <= *fmt && *fmt <= '9')
3531 +                {
3532 +                    fmax = (fmax * 10) + (*fmt++ - '0');
3533 +                }
3534 +            }
3535 +        }
3536 +
3537 +        /* skip over 'l' option (ints are assumed same size as longs) */
3538 +
3539 +        if (*fmt == 'l')
3540 +        {
3541 +            fmt++;
3542 +        }
3543 +
3544 +        /* get the format chacater */
3545 +
3546 +        if (!(f = *fmt++))
3547 +        {
3548 +            WRITE_CHAR(buffer, size, '%');
3549 +            *buffer = '\0';
3550 +            return;
3551 +        }
3552 +
3553 +        sign = '\0';        /* sign == '-' for negative decimal */
3554 +
3555 +        str = string;
3556 +
3557 +        switch (f)
3558 +        {
3559 +        case 'c' :
3560 +            string[0] = (char) va_arg(argptr, int);
3561 +            string[1] = '\0';
3562 +            fmax = 0;
3563 +            fill = ' ';
3564 +            break;
3565 +
3566 +        case 's' :
3567 +            str = va_arg(argptr, char *);
3568 +            fill = ' ';
3569 +            break;
3570 +
3571 +        case 'D' :
3572 +        case 'd' :
3573 +            number = va_arg(argptr, int);
3574 +            if (number < 0)
3575 +            {
3576 +                sign = '-';
3577 +                number = -number;
3578 +            }
3579 +            do_decimal(temp, DIM(temp), (unsigned int) number, str);
3580 +            fmax = 0;
3581 +            break;
3582 +
3583 +        case 'U' :
3584 +        case 'u' :
3585 +            number = va_arg(argptr, int);
3586 +            do_decimal(temp, DIM(temp), (unsigned int) number, str);
3587 +            fmax = 0;
3588 +            break;
3589 +
3590 +        case 'O' :
3591 +        case 'o' :
3592 +            number = va_arg(argptr, int);
3593 +            do_octal(temp, (unsigned int) number, str);
3594 +            fmax = 0;
3595 +            break;
3596 +
3597 +        case 'X' :
3598 +        case 'x' :
3599 +            number = va_arg(argptr, int);
3600 +            do_hex(temp, (unsigned int) number, str);
3601 +            fmax = 0;
3602 +            break;
3603 +
3604 +        case 'H' :
3605 +        case 'h' :
3606 +            buff_ptr = va_arg(argptr, char *);
3607 +            buff_len = va_arg(argptr, int);
3608 +            do_buffer(buff_ptr, buff_len, str);
3609 +            fmax = 0;
3610 +            break;
3611 +
3612 +        default :
3613 +            WRITE_CHAR(buffer, size, ((char) f));
3614 +            break;
3615 +        }
3616 +
3617 +        /* get the length of the string */
3618 +
3619 +        length = 0;
3620 +        while (str[length])
3621 +        {
3622 +            length++;
3623 +        }
3624 +
3625 +        /* make sure we have fmax and fmin values that are O.K. */
3626 +
3627 +        if (fmin > DIM(string) || fmin < 0)
3628 +        {
3629 +            fmin = 0;
3630 +        }
3631 +
3632 +        if (fmax > DIM(string) || fmax < 0)
3633 +        {
3634 +            fmax = 0;
3635 +        }
3636 +
3637 +        /* figure out how many leading characters thare are */
3638 +
3639 +        leading = 0;
3640 +
3641 +        if (fmax || fmin)
3642 +        {
3643 +            if (fmax)
3644 +            {
3645 +                if (length > fmax)
3646 +                {
3647 +                    length = fmax;
3648 +                }
3649 +            }
3650 +
3651 +            if (fmin)
3652 +            {
3653 +                leading = fmin - length;
3654 +            }
3655 +
3656 +            if (sign == '-')
3657 +            {
3658 +                leading--;
3659 +            }
3660 +        }
3661 +
3662 +        /* output sign now, if fill is numeric */
3663 +
3664 +        if (sign == '-' && fill == '0')
3665 +        {
3666 +            WRITE_CHAR(buffer, size, '-');
3667 +        }
3668 +
3669 +        /* if right justified, output fill characters */
3670 +
3671 +        if (!leftjust)
3672 +        {
3673 +            for (i = 0; i < leading; i++)
3674 +            {
3675 +                WRITE_CHAR(buffer, size, fill);
3676 +            }
3677 +        }
3678 +
3679 +        /* output sign now, if fill is spaces */
3680 +
3681 +        if (sign == '-' && fill == ' ')
3682 +        {
3683 +            WRITE_CHAR(buffer, size, '-');
3684 +        }
3685 +
3686 +        /* now the actual value */
3687 +
3688 +        for (i = 0; i < length; i++)
3689 +        {
3690 +            WRITE_CHAR(buffer, size, str[i]);
3691 +        }
3692 +
3693 +        /* if left justified, fill out with the fill character */
3694 +
3695 +        if (leftjust)
3696 +        {
3697 +            for (i = 0; i < leading; i++)
3698 +            {
3699 +                WRITE_CHAR(buffer, size, fill);
3700 +            }
3701 +        }
3702 +    }
3703 +}
3704 +
3705 +/*
3706 + * sprintf for kernel
3707 + *
3708 + * call our vsprintf assuming user has a big buffer....
3709 + */
3710 +
3711 +void    DivasSprintf(char *buffer, char *fmt, ...)
3712 +
3713 +{
3714 +    va_list     argptr;         /* pointer to additional args */
3715 +
3716 +    va_start(argptr, fmt);
3717 +
3718 +    Divas_vsprintf(buffer, 1024, fmt, argptr);
3719 +
3720 +    va_end(argptr);
3721 +
3722 +    return;
3723 +}
3724 +
3725  void    DivasPrintf(char  *fmt, ...)
3726  
3727  {
3728 @@ -40,7 +502,7 @@
3729  
3730      /* call vsprintf to format the user's information */
3731  
3732 -    vsnprintf(log.buffer, DIM(log.buffer), fmt, argptr);
3733 +    Divas_vsprintf(log.buffer, DIM(log.buffer), fmt, argptr);
3734  
3735      va_end(argptr);
3736  
3737 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/lincfg.c linux-2.4.29/drivers/isdn/eicon/lincfg.c
3738 --- linux-2.4.29.old/drivers/isdn/eicon/lincfg.c        2005-03-22 14:47:56.000000000 +0100
3739 +++ linux-2.4.29/drivers/isdn/eicon/lincfg.c    2005-03-22 15:06:45.620157464 +0100
3740 @@ -26,6 +26,9 @@
3741  #include "uxio.h"
3742  
3743  #include <linux/pci.h>
3744 +#ifndef COMPAT_HAS_2_2_PCI
3745 +#include <linux/pci_ids.h>
3746 +#endif
3747  #include <linux/kernel.h>
3748  #include <linux/ioport.h>
3749  
3750 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/linchr.c linux-2.4.29/drivers/isdn/eicon/linchr.c
3751 --- linux-2.4.29.old/drivers/isdn/eicon/linchr.c        2005-03-22 14:47:56.000000000 +0100
3752 +++ linux-2.4.29/drivers/isdn/eicon/linchr.c    2005-03-22 15:06:45.635155184 +0100
3753 @@ -154,17 +154,17 @@
3754         klog_t *pHeadItem;
3755  
3756         if (BufferSize < sizeof(klog_t))
3757 +       {
3758 +               printk(KERN_WARNING "Divas: Divalog buffer specifed a size that is too small (%d - %d required)\n",
3759 +                       BufferSize, sizeof(klog_t));
3760                 return -EIO;
3761 +       }
3762  
3763         pHeadItem = (klog_t *) DivasLogFifoRead();
3764  
3765         if (pHeadItem)
3766         {
3767 -               if(copy_to_user(pClientLogBuffer, pHeadItem, sizeof(klog_t)))
3768 -               {
3769 -                       kfree(pHeadItem);
3770 -                       return -EFAULT;
3771 -               }
3772 +               memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t));
3773                 kfree(pHeadItem);
3774                 return sizeof(klog_t);
3775         }
3776 diff -rNu linux-2.4.29.old/drivers/isdn/eicon/linio.c linux-2.4.29/drivers/isdn/eicon/linio.c
3777 --- linux-2.4.29.old/drivers/isdn/eicon/linio.c 2005-03-22 14:47:56.000000000 +0100
3778 +++ linux-2.4.29/drivers/isdn/eicon/linio.c     2005-03-22 15:06:45.651152752 +0100
3779 @@ -15,6 +15,7 @@
3780  #include <linux/slab.h>
3781  #include <linux/pci.h>
3782  #include <linux/delay.h>
3783 +#include <linux/isdn_compat.h>
3784  #undef N_DATA
3785  
3786  #include "uxio.h"
3787 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/Makefile linux-2.4.29/drivers/isdn/hisax/Makefile
3788 --- linux-2.4.29.old/drivers/isdn/hisax/Makefile        2005-03-22 14:47:56.000000000 +0100
3789 +++ linux-2.4.29/drivers/isdn/hisax/Makefile    2005-03-22 15:06:45.819127216 +0100
3790 @@ -4,20 +4,17 @@
3791  
3792  O_TARGET         := vmlinux-obj.o
3793  
3794 -# Define maximum number of cards
3795 -
3796 -EXTRA_CFLAGS      += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
3797 -
3798  # Objects that export symbols.
3799  
3800 -export-objs      := config.o hisax_isac.o isdnhdlc.o
3801 +export-objs      := config.o fsm.o hisax_isac.o
3802  
3803  # Multipart objects.
3804  
3805  list-multi       := hisax.o hisax_st5481.o
3806  hisax-objs       := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \
3807                      lmgr.o q931.o callc.o fsm.o cert.o
3808 -hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o
3809 +hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o \
3810 +                    st5481_hdlc.o
3811  
3812  # Optional parts of multipart objects.
3813  hisax-objs-$(CONFIG_HISAX_EURO) += l3dss1.o
3814 @@ -33,7 +30,7 @@
3815  hisax-objs-$(CONFIG_HISAX_FRITZPCI) += avm_pci.o isac.o arcofi.o
3816  hisax-objs-$(CONFIG_HISAX_ELSA) += elsa.o isac.o arcofi.o hscx.o
3817  hisax-objs-$(CONFIG_HISAX_IX1MICROR2) += ix1_micro.o isac.o arcofi.o hscx.o
3818 -hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o ipacx.o
3819 +hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o
3820  hisax-objs-$(CONFIG_HISAX_ASUSCOM) += asuscom.o isac.o arcofi.o hscx.o
3821  hisax-objs-$(CONFIG_HISAX_TELEINT) += teleint.o isac.o arcofi.o hfc_2bs0.o
3822  hisax-objs-$(CONFIG_HISAX_SEDLBAUER) += sedlbauer.o isac.o arcofi.o hscx.o isar.o
3823 @@ -44,6 +41,7 @@
3824  hisax-objs-$(CONFIG_HISAX_HFCS) += hfcscard.o hfc_2bds0.o
3825  hisax-objs-$(CONFIG_HISAX_HFC_PCI) += hfc_pci.o
3826  hisax-objs-$(CONFIG_HISAX_HFC_SX) += hfc_sx.o
3827 +hisax-objs-$(CONFIG_HISAX_HFC_USB) += hfc_usbr.o
3828  hisax-objs-$(CONFIG_HISAX_NICCY) += niccy.o isac.o arcofi.o hscx.o
3829  hisax-objs-$(CONFIG_HISAX_ISURF) += isurf.o isac.o arcofi.o isar.o
3830  hisax-objs-$(CONFIG_HISAX_HSTSAPHIR) += saphir.o isac.o arcofi.o hscx.o
3831 @@ -51,7 +49,6 @@
3832  hisax-objs-$(CONFIG_HISAX_SCT_QUADRO) += bkm_a8.o isac.o arcofi.o hscx.o
3833  hisax-objs-$(CONFIG_HISAX_GAZEL) += gazel.o isac.o arcofi.o hscx.o
3834  hisax-objs-$(CONFIG_HISAX_W6692) += w6692.o
3835 -hisax-objs-$(CONFIG_HISAX_ENTERNOW_PCI) += enternow_pci.o amd7930_fn.o
3836  #hisax-objs-$(CONFIG_HISAX_TESTEMU) += testemu.o
3837  
3838  hisax-objs += $(sort $(hisax-objs-y))
3839 @@ -61,10 +58,9 @@
3840  obj-$(CONFIG_ISDN_DRV_HISAX)           += hisax.o
3841  obj-$(CONFIG_HISAX_SEDLBAUER_CS)       += sedlbauer_cs.o
3842  obj-$(CONFIG_HISAX_ELSA_CS)            += elsa_cs.o
3843 -obj-$(CONFIG_HISAX_AVM_A1_CS)          += avma1_cs.o
3844 -obj-$(CONFIG_HISAX_ST5481)             += hisax_st5481.o isdnhdlc.o
3845 -obj-$(CONFIG_HISAX_FRITZ_PCIPNP)        += hisax_isac.o hisax_fcpcipnp.o
3846 -obj-$(CONFIG_USB_AUERISDN)             += isdnhdlc.o
3847 +obj-$(CONFIG_HISAX_HFC_USB_CS)         += hfc_usb.o
3848 +obj-$(CONFIG_HISAX_ST5481)             += hisax_st5481.o
3849 +obj-$(CONFIG_HISAX_FRITZ_PCIPNP)        += hisax_fcpcipnp.o hisax_isac.o
3850  
3851  CERT := $(shell md5sum -c md5sums.asc >> /dev/null;echo $$?)
3852  CFLAGS_cert.o := -DCERTIFICATION=$(CERT)
3853 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/amd7930.c linux-2.4.29/drivers/isdn/hisax/amd7930.c
3854 --- linux-2.4.29.old/drivers/isdn/hisax/amd7930.c       1970-01-01 01:00:00.000000000 +0100
3855 +++ linux-2.4.29/drivers/isdn/hisax/amd7930.c   2005-03-22 15:06:45.837124480 +0100
3856 @@ -0,0 +1,755 @@
3857 +/* $Id: amd7930.c,v 1.8 2001/09/24 13:22:55 kai Exp $
3858 + *
3859 + * HiSax ISDN driver - chip specific routines for AMD 7930
3860 + *
3861 + * Author       Brent Baccala
3862 + * Copyright    by Brent Baccala <baccala@FreeSoft.org>
3863 + *
3864 + * This software may be used and distributed according to the terms
3865 + * of the GNU General Public License, incorporated herein by reference.
3866 + *
3867 + *    - Existing ISDN HiSax driver provides all the smarts
3868 + *    - it compiles, runs, talks to an isolated phone switch, connects
3869 + *      to a Cisco, pings go through
3870 + *    - AMD 7930 support only (no DBRI yet)
3871 + *    - no US NI-1 support (may not work on US phone system - untested)
3872 + *    - periodic packet loss, apparently due to lost interrupts
3873 + *    - ISDN sometimes freezes, requiring reboot before it will work again
3874 + *
3875 + * The code is unreliable enough to be consider alpha
3876 + *
3877 + * This file is (c) under GNU General Public License
3878 + *
3879 + * Advanced Micro Devices' Am79C30A is an ISDN/audio chip used in the
3880 + * SparcStation 1+.  The chip provides microphone and speaker interfaces
3881 + * which provide mono-channel audio at 8K samples per second via either
3882 + * 8-bit A-law or 8-bit mu-law encoding.  Also, the chip features an
3883 + * ISDN BRI Line Interface Unit (LIU), I.430 S/T physical interface,
3884 + * which performs basic D channel LAPD processing and provides raw
3885 + * B channel data.  The digital audio channel, the two ISDN B channels,
3886 + * and two 64 Kbps channels to the microprocessor are all interconnected
3887 + * via a multiplexer.
3888 + *
3889 + * This driver interfaces to the Linux HiSax ISDN driver, which performs
3890 + * all high-level Q.921 and Q.931 ISDN functions.  The file is not
3891 + * itself a hardware driver; rather it uses functions exported by
3892 + * the AMD7930 driver in the sparcaudio subsystem (drivers/sbus/audio),
3893 + * allowing the chip to be simultaneously used for both audio and ISDN data.
3894 + * The hardware driver does _no_ buffering, but provides several callbacks
3895 + * which are called during interrupt service and should therefore run quickly.
3896 + *
3897 + * D channel transmission is performed by passing the hardware driver the
3898 + * address and size of an skb's data area, then waiting for a callback
3899 + * to signal successful transmission of the packet.  A task is then
3900 + * queued to notify the HiSax driver that another packet may be transmitted.
3901 + *
3902 + * D channel reception is quite simple, mainly because of:
3903 + *   1) the slow speed of the D channel - 16 kbps, and
3904 + *   2) the presence of an 8- or 32-byte (depending on chip version) FIFO
3905 + *      to buffer the D channel data on the chip
3906 + * Worst case scenario of back-to-back packets with the 8 byte buffer
3907 + * at 16 kbps yields an service time of 4 ms - long enough to preclude
3908 + * the need for fancy buffering.  We queue a background task that copies
3909 + * data out of the receive buffer into an skb, and the hardware driver
3910 + * simply does nothing until we're done with the receive buffer and
3911 + * reset it for a new packet.
3912 + *
3913 + * B channel processing is more complex, because of:
3914 + *   1) the faster speed - 64 kbps,
3915 + *   2) the lack of any on-chip buffering (it interrupts for every byte), and
3916 + *   3) the lack of any chip support for HDLC encapsulation
3917 + *
3918 + * The HiSax driver can put each B channel into one of three modes -
3919 + * L1_MODE_NULL (channel disabled), L1_MODE_TRANS (transparent data relay),
3920 + * and L1_MODE_HDLC (HDLC encapsulation by low-level driver).
3921 + * L1_MODE_HDLC is the most common, used for almost all "pure" digital
3922 + * data sessions.  L1_MODE_TRANS is used for ISDN audio.
3923 + *
3924 + * HDLC B channel transmission is performed via a large buffer into
3925 + * which the skb is copied while performing HDLC bit-stuffing.  A CRC
3926 + * is computed and attached to the end of the buffer, which is then
3927 + * passed to the low-level routines for raw transmission.  Once
3928 + * transmission is complete, the hardware driver is set to enter HDLC
3929 + * idle by successive transmission of mark (all 1) bytes, waiting for
3930 + * the ISDN driver to prepare another packet for transmission and
3931 + * deliver it.
3932 + *
3933 + * HDLC B channel reception is performed via an X-byte ring buffer
3934 + * divided into N sections of X/N bytes each.  Defaults: X=256 bytes, N=4.
3935 + * As the hardware driver notifies us that each section is full, we
3936 + * hand it the next section and schedule a background task to peruse
3937 + * the received section, bit-by-bit, with an HDLC decoder.  As
3938 + * packets are detected, they are copied into a large buffer while
3939 + * decoding HDLC bit-stuffing.  The ending CRC is verified, and if
3940 + * it is correct, we alloc a new skb of the correct length (which we
3941 + * now know), copy the packet into it, and hand it to the upper layers.
3942 + * Optimization: for large packets, we hand the buffer (which also
3943 + * happens to be an skb) directly to the upper layer after an skb_trim,
3944 + * and alloc a new large buffer for future packets, thus avoiding a copy.
3945 + * Then we return to HDLC processing; state is saved between calls.
3946 + * 
3947 + */
3948 +
3949 +#define __NO_VERSION__
3950 +#include "hisax.h"
3951 +#include "../../sbus/audio/amd7930.h"
3952 +#include "isac.h"
3953 +#include "isdnl1.h"
3954 +#include "rawhdlc.h"
3955 +#include <linux/interrupt.h>
3956 +
3957 +static const char *amd7930_revision = "$Revision: 1.8 $";
3958 +
3959 +#define RCV_BUFSIZE    1024    /* Size of raw receive buffer in bytes */
3960 +#define RCV_BUFBLKS    4       /* Number of blocks to divide buffer into
3961 +                                * (must divide RCV_BUFSIZE) */
3962 +
3963 +static void Bchan_fill_fifo(struct BCState *, struct sk_buff *);
3964 +
3965 +static void
3966 +Bchan_xmt_bh(struct BCState *bcs)
3967 +{
3968 +       struct sk_buff *skb;
3969 +
3970 +       if (bcs->hw.amd7930.tx_skb != NULL) {
3971 +               dev_kfree_skb(bcs->hw.amd7930.tx_skb);
3972 +               bcs->hw.amd7930.tx_skb = NULL;
3973 +       }
3974 +
3975 +       if ((skb = skb_dequeue(&bcs->squeue))) {
3976 +               Bchan_fill_fifo(bcs, skb);
3977 +       } else {
3978 +               clear_bit(BC_FLG_BUSY, &bcs->Flag);
3979 +               bcs->event |= 1 << B_XMTBUFREADY;
3980 +               queue_task(&bcs->tqueue, &tq_immediate);
3981 +               mark_bh(IMMEDIATE_BH);
3982 +       }
3983 +}
3984 +
3985 +static void
3986 +Bchan_xmit_callback(struct BCState *bcs)
3987 +{
3988 +       queue_task(&bcs->hw.amd7930.tq_xmt, &tq_immediate);
3989 +       mark_bh(IMMEDIATE_BH);
3990 +}
3991 +
3992 +/* B channel transmission: two modes (three, if you count L1_MODE_NULL)
3993 + *
3994 + * L1_MODE_HDLC - We need to do HDLC encapsulation before transmiting
3995 + * the packet (i.e. make_raw_hdlc_data).  Since this can be a
3996 + * time-consuming operation, our completion callback just schedules
3997 + * a bottom half to do encapsulation for the next packet.  In between,
3998 + * the link will just idle
3999 + *
4000 + * L1_MODE_TRANS - Data goes through, well, transparent.  No HDLC encap,
4001 + * and we can't just let the link idle, so the "bottom half" actually
4002 + * gets called during the top half (it's our callback routine in this case),
4003 + * but it's a lot faster now since we don't call make_raw_hdlc_data
4004 + */
4005 +
4006 +static void
4007 +Bchan_fill_fifo(struct BCState *bcs, struct sk_buff *skb)
4008 +{
4009 +       struct IsdnCardState *cs = bcs->cs;
4010 +       int len;
4011 +
4012 +       if ((cs->debug & L1_DEB_HSCX) || (cs->debug & L1_DEB_HSCX_FIFO)) {
4013 +               char tmp[1024];
4014 +               char *t = tmp;
4015 +
4016 +               t += sprintf(t, "amd7930_fill_fifo %c cnt %d",
4017 +                            bcs->channel ? 'B' : 'A', skb->len);
4018 +               if (cs->debug & L1_DEB_HSCX_FIFO)
4019 +                       QuickHex(t, skb->data, skb->len);
4020 +               debugl1(cs, tmp);
4021 +       }
4022 +
4023 +       if (bcs->mode == L1_MODE_HDLC) {
4024 +               len = make_raw_hdlc_data(skb->data, skb->len,
4025 +                                        bcs->hw.amd7930.tx_buff, RAW_BUFMAX);
4026 +               if (len > 0)
4027 +                       amd7930_bxmit(0, bcs->channel,
4028 +                                     bcs->hw.amd7930.tx_buff, len,
4029 +                                     (void *) &Bchan_xmit_callback,
4030 +                                     (void *) bcs);
4031 +               dev_kfree_skb(skb);
4032 +       } else if (bcs->mode == L1_MODE_TRANS) {
4033 +               amd7930_bxmit(0, bcs->channel,
4034 +                             bcs->hw.amd7930.tx_buff, skb->len,
4035 +                             (void *) &Bchan_xmt_bh,
4036 +                             (void *) bcs);
4037 +               bcs->hw.amd7930.tx_skb = skb;
4038 +       } else {
4039 +               dev_kfree_skb(skb);
4040 +       }
4041 +}
4042 +
4043 +static void
4044 +Bchan_mode(struct BCState *bcs, int mode, int bc)
4045 +{
4046 +       struct IsdnCardState *cs = bcs->cs;
4047 +
4048 +       if (cs->debug & L1_DEB_HSCX) {
4049 +               char tmp[40];
4050 +               sprintf(tmp, "AMD 7930 mode %d bchan %d/%d",
4051 +                       mode, bc, bcs->channel);
4052 +               debugl1(cs, tmp);
4053 +       }
4054 +       bcs->mode = mode;
4055 +}
4056 +
4057 +/* Bchan_l2l1 is the entry point for upper layer routines that want to
4058 + * transmit on the B channel.  PH_DATA_REQ is a normal packet that
4059 + * we either start transmitting (if idle) or queue (if busy).
4060 + * PH_PULL_REQ can be called to request a callback message (PH_PULL_CNF)
4061 + * once the link is idle.  After a "pull" callback, the upper layer
4062 + * routines can use PH_PULL_IND to send data.
4063 + */
4064 +
4065 +static void
4066 +Bchan_l2l1(struct PStack *st, int pr, void *arg)
4067 +{
4068 +       struct sk_buff *skb = arg;
4069 +
4070 +       switch (pr) {
4071 +               case (PH_DATA_REQ):
4072 +                       if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4073 +                               skb_queue_tail(&st->l1.bcs->squeue, skb);
4074 +                       } else {
4075 +                               test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
4076 +                               Bchan_fill_fifo(st->l1.bcs, skb);
4077 +                       }
4078 +                       break;
4079 +               case (PH_PULL_IND):
4080 +                       if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4081 +                               printk(KERN_WARNING "amd7930: this shouldn't happen\n");
4082 +                               break;
4083 +                       }
4084 +                       test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
4085 +                       Bchan_fill_fifo(st->l1.bcs, skb);
4086 +                       break;
4087 +               case (PH_PULL_REQ):
4088 +                       if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4089 +                               clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4090 +                               st->l1.l1l2(st, PH_PULL_CNF, NULL);
4091 +                       } else
4092 +                               set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4093 +                       break;
4094 +       }
4095 +}
4096 +
4097 +/* Receiver callback and bottom half - decodes HDLC at leisure (if
4098 + * L1_MODE_HDLC) and passes newly received skb on via bcs->rqueue.  If
4099 + * a large packet is received, stick rv_skb (the buffer that the
4100 + * packet has been decoded into) on the receive queue and alloc a new
4101 + * (large) skb to act as buffer for future receives.  If a small
4102 + * packet is received, leave rv_skb alone, alloc a new skb of the
4103 + * correct size, and copy the packet into it
4104 + */
4105 +
4106 +static void
4107 +Bchan_recv_callback(struct BCState *bcs)
4108 +{
4109 +       struct amd7930_hw *hw = &bcs->hw.amd7930;
4110 +
4111 +       hw->rv_buff_in += RCV_BUFSIZE/RCV_BUFBLKS;
4112 +       hw->rv_buff_in %= RCV_BUFSIZE;
4113 +
4114 +       if (hw->rv_buff_in != hw->rv_buff_out) {
4115 +               amd7930_brecv(0, bcs->channel,
4116 +                             hw->rv_buff + hw->rv_buff_in,
4117 +                             RCV_BUFSIZE/RCV_BUFBLKS,
4118 +                             (void *) &Bchan_recv_callback, (void *) bcs);
4119 +       }
4120 +
4121 +       queue_task(&hw->tq_rcv, &tq_immediate);
4122 +       mark_bh(IMMEDIATE_BH);
4123 +}
4124 +
4125 +static void
4126 +Bchan_rcv_bh(struct BCState *bcs)
4127 +{
4128 +       struct IsdnCardState *cs = bcs->cs;
4129 +       struct amd7930_hw *hw = &bcs->hw.amd7930;
4130 +       struct sk_buff *skb;
4131 +       int len;
4132 +
4133 +       if (cs->debug & L1_DEB_HSCX) {
4134 +               char tmp[1024];
4135 +
4136 +               sprintf(tmp, "amd7930_Bchan_rcv (%d/%d)",
4137 +                       hw->rv_buff_in, hw->rv_buff_out);
4138 +               debugl1(cs, tmp);
4139 +               QuickHex(tmp, hw->rv_buff + hw->rv_buff_out,
4140 +                        RCV_BUFSIZE/RCV_BUFBLKS);
4141 +               debugl1(cs, tmp);
4142 +       }
4143 +
4144 +       do {
4145 +               if (bcs->mode == L1_MODE_HDLC) {
4146 +                       while ((len = read_raw_hdlc_data(hw->hdlc_state,
4147 +                                                        hw->rv_buff + hw->rv_buff_out, RCV_BUFSIZE/RCV_BUFBLKS,
4148 +                                                        hw->rv_skb->tail, HSCX_BUFMAX))) {
4149 +                               if (len > 0 && (cs->debug & L1_DEB_HSCX_FIFO)) {
4150 +                                       char tmp[1024];
4151 +                                       char *t = tmp;
4152 +
4153 +                                       t += sprintf(t, "amd7930_Bchan_rcv %c cnt %d", bcs->channel ? 'B' : 'A', len);
4154 +                                       QuickHex(t, hw->rv_skb->tail, len);
4155 +                                       debugl1(cs, tmp);
4156 +                               }
4157 +
4158 +                               if (len > HSCX_BUFMAX/2) {
4159 +                                       /* Large packet received */
4160 +
4161 +                                       if (!(skb = dev_alloc_skb(HSCX_BUFMAX))) {
4162 +                                               printk(KERN_WARNING "amd7930: receive out of memory");
4163 +                                       } else {
4164 +                                               skb_put(hw->rv_skb, len);
4165 +                                               skb_queue_tail(&bcs->rqueue, hw->rv_skb);
4166 +                                               hw->rv_skb = skb;
4167 +                                               bcs->event |= 1 << B_RCVBUFREADY;
4168 +                                               queue_task(&bcs->tqueue, &tq_immediate);
4169 +                                       }
4170 +                               } else if (len > 0) {
4171 +                                       /* Small packet received */
4172 +
4173 +                                       if (!(skb = dev_alloc_skb(len))) {
4174 +                                               printk(KERN_WARNING "amd7930: receive out of memory\n");
4175 +                                       } else {
4176 +                                               memcpy(skb_put(skb, len), hw->rv_skb->tail, len);
4177 +                                               skb_queue_tail(&bcs->rqueue, skb);
4178 +                                               bcs->event |= 1 << B_RCVBUFREADY;
4179 +                                               queue_task(&bcs->tqueue, &tq_immediate);
4180 +                                               mark_bh(IMMEDIATE_BH);
4181 +                                       }
4182 +                               } else {
4183 +                                       /* Reception Error */
4184 +                                       /* printk("amd7930: B channel receive error\n"); */
4185 +                               }
4186 +                       }
4187 +               } else if (bcs->mode == L1_MODE_TRANS) {
4188 +                       if (!(skb = dev_alloc_skb(RCV_BUFSIZE/RCV_BUFBLKS))) {
4189 +                               printk(KERN_WARNING "amd7930: receive out of memory\n");
4190 +                       } else {
4191 +                               memcpy(skb_put(skb, RCV_BUFSIZE/RCV_BUFBLKS),
4192 +                                      hw->rv_buff + hw->rv_buff_out,
4193 +                                      RCV_BUFSIZE/RCV_BUFBLKS);
4194 +                               skb_queue_tail(&bcs->rqueue, skb);
4195 +                               bcs->event |= 1 << B_RCVBUFREADY;
4196 +                               queue_task(&bcs->tqueue, &tq_immediate);
4197 +                               mark_bh(IMMEDIATE_BH);
4198 +                       }
4199 +               }
4200 +
4201 +               if (hw->rv_buff_in == hw->rv_buff_out) {
4202 +                       /* Buffer was filled up - need to restart receiver */
4203 +                       amd7930_brecv(0, bcs->channel,
4204 +                                     hw->rv_buff + hw->rv_buff_in,
4205 +                                     RCV_BUFSIZE/RCV_BUFBLKS,
4206 +                                     (void *) &Bchan_recv_callback,
4207 +                                     (void *) bcs);
4208 +               }
4209 +
4210 +               hw->rv_buff_out += RCV_BUFSIZE/RCV_BUFBLKS;
4211 +               hw->rv_buff_out %= RCV_BUFSIZE;
4212 +
4213 +       } while (hw->rv_buff_in != hw->rv_buff_out);
4214 +}
4215 +
4216 +static void
4217 +Bchan_close(struct BCState *bcs)
4218 +{
4219 +       struct sk_buff *skb;
4220 +
4221 +       Bchan_mode(bcs, 0, 0);
4222 +       amd7930_bclose(0, bcs->channel);
4223 +
4224 +       if (test_bit(BC_FLG_INIT, &bcs->Flag)) {
4225 +               skb_queue_purge(&bcs->rqueue);
4226 +               skb_queue_purge(&bcs->squeue);
4227 +       }
4228 +       test_and_clear_bit(BC_FLG_INIT, &bcs->Flag);
4229 +}
4230 +
4231 +static int
4232 +Bchan_open(struct BCState *bcs)
4233 +{
4234 +       struct amd7930_hw *hw = &bcs->hw.amd7930;
4235 +
4236 +       if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
4237 +               skb_queue_head_init(&bcs->rqueue);
4238 +               skb_queue_head_init(&bcs->squeue);
4239 +       }
4240 +       test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
4241 +
4242 +       amd7930_bopen(0, bcs->channel, 0xff);
4243 +       hw->rv_buff_in = 0;
4244 +       hw->rv_buff_out = 0;
4245 +       hw->tx_skb = NULL;
4246 +       init_hdlc_state(hw->hdlc_state, 0);
4247 +       amd7930_brecv(0, bcs->channel,
4248 +                     hw->rv_buff + hw->rv_buff_in, RCV_BUFSIZE/RCV_BUFBLKS,
4249 +                     (void *) &Bchan_recv_callback, (void *) bcs);
4250 +
4251 +       bcs->event = 0;
4252 +       bcs->tx_cnt = 0;
4253 +       return (0);
4254 +}
4255 +
4256 +static void
4257 +Bchan_init(struct BCState *bcs)
4258 +{
4259 +       if (!(bcs->hw.amd7930.tx_buff = kmalloc(RAW_BUFMAX, GFP_ATOMIC))) {
4260 +               printk(KERN_WARNING
4261 +                      "HiSax: No memory for amd7930.tx_buff\n");
4262 +               return;
4263 +       }
4264 +       if (!(bcs->hw.amd7930.rv_buff = kmalloc(RCV_BUFSIZE, GFP_ATOMIC))) {
4265 +               printk(KERN_WARNING
4266 +                      "HiSax: No memory for amd7930.rv_buff\n");
4267 +               return;
4268 +       }
4269 +       if (!(bcs->hw.amd7930.rv_skb = dev_alloc_skb(HSCX_BUFMAX))) {
4270 +               printk(KERN_WARNING
4271 +                      "HiSax: No memory for amd7930.rv_skb\n");
4272 +               return;
4273 +       }
4274 +       if (!(bcs->hw.amd7930.hdlc_state = kmalloc(sizeof(struct hdlc_state),
4275 +                                                  GFP_ATOMIC))) {
4276 +               printk(KERN_WARNING
4277 +                      "HiSax: No memory for amd7930.hdlc_state\n");
4278 +               return;
4279 +       }
4280 +
4281 +       bcs->hw.amd7930.tq_rcv.sync = 0;
4282 +       bcs->hw.amd7930.tq_rcv.routine = (void (*)(void *)) &Bchan_rcv_bh;
4283 +       bcs->hw.amd7930.tq_rcv.data = (void *) bcs;
4284 +
4285 +       bcs->hw.amd7930.tq_xmt.sync = 0;
4286 +       bcs->hw.amd7930.tq_xmt.routine = (void (*)(void *)) &Bchan_xmt_bh;
4287 +       bcs->hw.amd7930.tq_xmt.data = (void *) bcs;
4288 +}
4289 +
4290 +static void
4291 +Bchan_manl1(struct PStack *st, int pr,
4292 +         void *arg)
4293 +{
4294 +       switch (pr) {
4295 +               case (PH_ACTIVATE_REQ):
4296 +                       test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
4297 +                       Bchan_mode(st->l1.bcs, st->l1.mode, st->l1.bc);
4298 +                       st->l1.l1man(st, PH_ACTIVATE_CNF, NULL);
4299 +                       break;
4300 +               case (PH_DEACTIVATE_REQ):
4301 +                       if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag))
4302 +                               Bchan_mode(st->l1.bcs, 0, 0);
4303 +                       test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
4304 +                       break;
4305 +       }
4306 +}
4307 +
4308 +int
4309 +setstack_amd7930(struct PStack *st, struct BCState *bcs)
4310 +{
4311 +       if (Bchan_open(bcs))
4312 +               return (-1);
4313 +       st->l1.bcs = bcs;
4314 +       st->l2.l2l1 = Bchan_l2l1;
4315 +       st->ma.manl1 = Bchan_manl1;
4316 +       setstack_manager(st);
4317 +       bcs->st = st;
4318 +       return (0);
4319 +}
4320 +
4321 +
4322 +static void
4323 +amd7930_drecv_callback(void *arg, int error, unsigned int count)
4324 +{
4325 +       struct IsdnCardState *cs = (struct IsdnCardState *) arg;
4326 +       static struct tq_struct task;
4327 +       struct sk_buff *skb;
4328 +
4329 +        /* NOTE: This function is called directly from an interrupt handler */
4330 +
4331 +       if (1) {
4332 +               if (!(skb = alloc_skb(count, GFP_ATOMIC)))
4333 +                       printk(KERN_WARNING "HiSax: D receive out of memory\n");
4334 +               else {
4335 +                       memcpy(skb_put(skb, count), cs->rcvbuf, count);
4336 +                       skb_queue_tail(&cs->rq, skb);
4337 +               }
4338 +
4339 +               task.routine = (void *) DChannel_proc_rcv;
4340 +               task.data = (void *) cs;
4341 +               queue_task(&task, &tq_immediate);
4342 +               mark_bh(IMMEDIATE_BH);
4343 +       }
4344 +
4345 +       if (cs->debug & L1_DEB_ISAC_FIFO) {
4346 +               char tmp[128];
4347 +               char *t = tmp;
4348 +
4349 +               t += sprintf(t, "amd7930 Drecv cnt %d", count);
4350 +               if (error) t += sprintf(t, " ERR %x", error);
4351 +               QuickHex(t, cs->rcvbuf, count);
4352 +               debugl1(cs, tmp);
4353 +       }
4354 +
4355 +       amd7930_drecv(0, cs->rcvbuf, MAX_DFRAME_LEN,
4356 +                     &amd7930_drecv_callback, cs);
4357 +}
4358 +
4359 +static void
4360 +amd7930_dxmit_callback(void *arg, int error)
4361 +{
4362 +       struct IsdnCardState *cs = (struct IsdnCardState *) arg;
4363 +       static struct tq_struct task;
4364 +
4365 +        /* NOTE: This function is called directly from an interrupt handler */
4366 +
4367 +       /* may wish to do retransmission here, if error indicates collision */
4368 +
4369 +       if (cs->debug & L1_DEB_ISAC_FIFO) {
4370 +               char tmp[128];
4371 +               char *t = tmp;
4372 +
4373 +               t += sprintf(t, "amd7930 Dxmit cnt %d", cs->tx_skb->len);
4374 +               if (error) t += sprintf(t, " ERR %x", error);
4375 +               QuickHex(t, cs->tx_skb->data, cs->tx_skb->len);
4376 +               debugl1(cs, tmp);
4377 +       }
4378 +
4379 +       cs->tx_skb = NULL;
4380 +
4381 +       task.routine = (void *) DChannel_proc_xmt;
4382 +       task.data = (void *) cs;
4383 +       queue_task(&task, &tq_immediate);
4384 +       mark_bh(IMMEDIATE_BH);
4385 +}
4386 +
4387 +static void
4388 +amd7930_Dchan_l2l1(struct PStack *st, int pr, void *arg)
4389 +{
4390 +       struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware;
4391 +       struct sk_buff *skb = arg;
4392 +       char str[64];
4393 +
4394 +       switch (pr) {
4395 +               case (PH_DATA_REQ):
4396 +                       if (cs->tx_skb) {
4397 +                               skb_queue_tail(&cs->sq, skb);
4398 +#ifdef L2FRAME_DEBUG           /* psa */
4399 +                               if (cs->debug & L1_DEB_LAPD)
4400 +                                       Logl2Frame(cs, skb, "PH_DATA Queued", 0);
4401 +#endif
4402 +                       } else {
4403 +                               if ((cs->dlogflag) && (!(skb->data[2] & 1))) {
4404 +                                       /* I-FRAME */
4405 +                                       LogFrame(cs, skb->data, skb->len);
4406 +                                       sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei);
4407 +                                       dlogframe(cs, skb->data+4, skb->len-4,
4408 +                                                 str);
4409 +                               }
4410 +                               cs->tx_skb = skb;
4411 +                               cs->tx_cnt = 0;
4412 +#ifdef L2FRAME_DEBUG           /* psa */
4413 +                               if (cs->debug & L1_DEB_LAPD)
4414 +                                       Logl2Frame(cs, skb, "PH_DATA", 0);
4415 +#endif
4416 +                               amd7930_dxmit(0, skb->data, skb->len,
4417 +                                             &amd7930_dxmit_callback, cs);
4418 +                       }
4419 +                       break;
4420 +               case (PH_PULL_IND):
4421 +                       if (cs->tx_skb) {
4422 +                               if (cs->debug & L1_DEB_WARN)
4423 +                                       debugl1(cs, " l2l1 tx_skb exist this shouldn't happen");
4424 +                               skb_queue_tail(&cs->sq, skb);
4425 +                               break;
4426 +                       }
4427 +                       if ((cs->dlogflag) && (!(skb->data[2] & 1))) {  /* I-FRAME */
4428 +                               LogFrame(cs, skb->data, skb->len);
4429 +                               sprintf(str, "Q.931 frame user->network tei %d", st->l2.tei);
4430 +                               dlogframe(cs, skb->data + 4, skb->len - 4,
4431 +                                         str);
4432 +                       }
4433 +                       cs->tx_skb = skb;
4434 +                       cs->tx_cnt = 0;
4435 +#ifdef L2FRAME_DEBUG           /* psa */
4436 +                       if (cs->debug & L1_DEB_LAPD)
4437 +                               Logl2Frame(cs, skb, "PH_DATA_PULLED", 0);
4438 +#endif
4439 +                       amd7930_dxmit(0, cs->tx_skb->data, cs->tx_skb->len,
4440 +                                     &amd7930_dxmit_callback, cs);
4441 +                       break;
4442 +               case (PH_PULL_REQ):
4443 +#ifdef L2FRAME_DEBUG           /* psa */
4444 +                       if (cs->debug & L1_DEB_LAPD)
4445 +                               debugl1(cs, "-> PH_REQUEST_PULL");
4446 +#endif
4447 +                       if (!cs->tx_skb) {
4448 +                               test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4449 +                               st->l1.l1l2(st, PH_PULL_CNF, NULL);
4450 +                       } else
4451 +                               test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4452 +                       break;
4453 +       }
4454 +}
4455 +
4456 +int
4457 +setDstack_amd7930(struct PStack *st, struct IsdnCardState *cs)
4458 +{
4459 +       st->l2.l2l1 = amd7930_Dchan_l2l1;
4460 +       if (! cs->rcvbuf) {
4461 +               printk("setDstack_amd7930: No cs->rcvbuf!\n");
4462 +       } else {
4463 +               amd7930_drecv(0, cs->rcvbuf, MAX_DFRAME_LEN,
4464 +                             &amd7930_drecv_callback, cs);
4465 +       }
4466 +       return (0);
4467 +}
4468 +
4469 +static void
4470 +manl1_msg(struct IsdnCardState *cs, int msg, void *arg) {
4471 +       struct PStack *st;
4472 +
4473 +       st = cs->stlist;
4474 +       while (st) {
4475 +               st->ma.manl1(st, msg, arg);
4476 +               st = st->next;
4477 +       }
4478 +}
4479 +
4480 +static void
4481 +amd7930_new_ph(struct IsdnCardState *cs)
4482 +{
4483 +       switch (amd7930_get_liu_state(0)) {
4484 +               case 3:
4485 +                       manl1_msg(cs, PH_POWERUP_CNF, NULL);
4486 +                        break;
4487 +
4488 +               case 7:
4489 +                       manl1_msg(cs, PH_I4_P8_IND, NULL);
4490 +                       break;
4491 +
4492 +               case 8:
4493 +                       manl1_msg(cs, PH_RSYNC_IND, NULL);
4494 +                       break;
4495 +       }
4496 +}
4497 +
4498 +/* amd7930 LIU state change callback */
4499 +
4500 +static void
4501 +amd7930_liu_callback(struct IsdnCardState *cs)
4502 +{
4503 +       static struct tq_struct task;
4504 +
4505 +       if (!cs)
4506 +               return;
4507 +
4508 +       if (cs->debug & L1_DEB_ISAC) {
4509 +               char tmp[32];
4510 +               sprintf(tmp, "amd7930_liu state %d", amd7930_get_liu_state(0));
4511 +               debugl1(cs, tmp);
4512 +       }
4513 +
4514 +       task.sync = 0;
4515 +       task.routine = (void *) &amd7930_new_ph;
4516 +       task.data = (void *) cs;
4517 +       queue_task(&task, &tq_immediate);
4518 +       mark_bh(IMMEDIATE_BH);
4519 +}
4520 +
4521 +void
4522 +amd7930_l1cmd(struct IsdnCardState *cs, int msg, void *arg)
4523 +{
4524 +       u_char val;
4525 +       char tmp[32];
4526 +       
4527 +       if (cs->debug & L1_DEB_ISAC) {
4528 +               char tmp[32];
4529 +               sprintf(tmp, "amd7930_l1cmd msg %x", msg);
4530 +               debugl1(cs, tmp);
4531 +       }
4532 +
4533 +       switch(msg) {
4534 +               case PH_RESET_REQ:
4535 +                       if (amd7930_get_liu_state(0) <= 3)
4536 +                               amd7930_liu_activate(0,0);
4537 +                       else
4538 +                               amd7930_liu_deactivate(0);
4539 +                       break;
4540 +               case PH_ENABLE_REQ:
4541 +                       break;
4542 +               case PH_INFO3_REQ:
4543 +                       amd7930_liu_activate(0,0);
4544 +                       break;
4545 +               case PH_TESTLOOP_REQ:
4546 +                       break;
4547 +               default:
4548 +                       if (cs->debug & L1_DEB_WARN) {
4549 +                               sprintf(tmp, "amd7930_l1cmd unknown %4x", msg);
4550 +                               debugl1(cs, tmp);
4551 +                       }
4552 +                       break;
4553 +       }
4554 +}
4555 +
4556 +static void init_amd7930(struct IsdnCardState *cs)
4557 +{
4558 +       Bchan_init(&cs->bcs[0]);
4559 +       Bchan_init(&cs->bcs[1]);
4560 +       cs->bcs[0].BC_SetStack = setstack_amd7930;
4561 +       cs->bcs[1].BC_SetStack = setstack_amd7930;
4562 +       cs->bcs[0].BC_Close = Bchan_close;
4563 +       cs->bcs[1].BC_Close = Bchan_close;
4564 +       Bchan_mode(cs->bcs, 0, 0);
4565 +       Bchan_mode(cs->bcs + 1, 0, 0);
4566 +}
4567 +
4568 +void
4569 +release_amd7930(struct IsdnCardState *cs)
4570 +{
4571 +}
4572 +
4573 +static int
4574 +amd7930_card_msg(struct IsdnCardState *cs, int mt, void *arg)
4575 +{
4576 +       switch (mt) {
4577 +               case CARD_RESET:
4578 +                       return(0);
4579 +               case CARD_RELEASE:
4580 +                       release_amd7930(cs);
4581 +                       return(0);
4582 +               case CARD_INIT:
4583 +                       cs->l1cmd = amd7930_l1cmd;
4584 +                       amd7930_liu_init(0, &amd7930_liu_callback, (void *)cs);
4585 +                       init_amd7930(cs);
4586 +                       return(0);
4587 +               case CARD_TEST:
4588 +                       return(0);
4589 +       }
4590 +       return(0);
4591 +}
4592 +
4593 +int __init
4594 +setup_amd7930(struct IsdnCard *card)
4595 +{
4596 +       struct IsdnCardState *cs = card->cs;
4597 +       char tmp[64];
4598 +
4599 +       strcpy(tmp, amd7930_revision);
4600 +       printk(KERN_INFO "HiSax: AMD7930 driver Rev. %s\n", HiSax_getrev(tmp));
4601 +       if (cs->typ != ISDN_CTYPE_AMD7930)
4602 +               return (0);
4603 +
4604 +        cs->irq = amd7930_get_irqnum(0);
4605 +        if (cs->irq == 0)
4606 +               return (0);
4607 +
4608 +       cs->cardmsg = &amd7930_card_msg;
4609 +
4610 +       return (1);
4611 +}
4612 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/arcofi.c linux-2.4.29/drivers/isdn/hisax/arcofi.c
4613 --- linux-2.4.29.old/drivers/isdn/hisax/arcofi.c        2005-03-22 14:47:56.000000000 +0100
4614 +++ linux-2.4.29/drivers/isdn/hisax/arcofi.c    2005-03-22 15:06:45.852122200 +0100
4615 @@ -1,4 +1,4 @@
4616 -/* $Id: arcofi.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4617 +/* $Id: arcofi.c,v 1.14 2001/09/24 13:22:55 kai Exp $
4618   *
4619   * Ansteuerung ARCOFI 2165
4620   *
4621 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/arcofi.h linux-2.4.29/drivers/isdn/hisax/arcofi.h
4622 --- linux-2.4.29.old/drivers/isdn/hisax/arcofi.h        2005-03-22 14:47:56.000000000 +0100
4623 +++ linux-2.4.29/drivers/isdn/hisax/arcofi.h    2005-03-22 15:06:45.872119160 +0100
4624 @@ -1,4 +1,4 @@
4625 -/* $Id: arcofi.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4626 +/* $Id$
4627   *
4628   * Ansteuerung ARCOFI 2165
4629   *
4630 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/asuscom.c linux-2.4.29/drivers/isdn/hisax/asuscom.c
4631 --- linux-2.4.29.old/drivers/isdn/hisax/asuscom.c       2005-03-22 14:47:56.000000000 +0100
4632 +++ linux-2.4.29/drivers/isdn/hisax/asuscom.c   2005-03-22 15:06:45.889116576 +0100
4633 @@ -1,4 +1,4 @@
4634 -/* $Id: asuscom.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4635 +/* $Id: asuscom.c,v 1.14 2001/09/24 13:22:55 kai Exp $
4636   *
4637   * low level stuff for ASUSCOM NETWORK INC. ISDNLink cards
4638   *
4639 @@ -14,7 +14,6 @@
4640  
4641  #define __NO_VERSION__
4642  #include <linux/init.h>
4643 -#include <linux/isapnp.h>
4644  #include "hisax.h"
4645  #include "isac.h"
4646  #include "ipac.h"
4647 @@ -23,7 +22,7 @@
4648  
4649  extern const char *CardType[];
4650  
4651 -const char *Asuscom_revision = "$Revision: 1.1.4.1 $";
4652 +const char *Asuscom_revision = "$Revision: 1.14 $";
4653  
4654  #define byteout(addr,val) outb(val,addr)
4655  #define bytein(addr) inb(addr)
4656 @@ -310,27 +309,6 @@
4657         return(0);
4658  }
4659  
4660 -#ifdef __ISAPNP__
4661 -static struct isapnp_device_id asus_ids[] __initdata = {
4662 -       { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688),
4663 -         ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), 
4664 -         (unsigned long) "Asus1688 PnP" },
4665 -       { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1690),
4666 -         ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1690), 
4667 -         (unsigned long) "Asus1690 PnP" },
4668 -       { ISAPNP_VENDOR('S', 'I', 'E'), ISAPNP_FUNCTION(0x0020),
4669 -         ISAPNP_VENDOR('S', 'I', 'E'), ISAPNP_FUNCTION(0x0020), 
4670 -         (unsigned long) "Isurf2 PnP" },
4671 -       { ISAPNP_VENDOR('E', 'L', 'F'), ISAPNP_FUNCTION(0x0000),
4672 -         ISAPNP_VENDOR('E', 'L', 'F'), ISAPNP_FUNCTION(0x0000), 
4673 -         (unsigned long) "Iscas TE320" },
4674 -       { 0, }
4675 -};
4676 -
4677 -static struct isapnp_device_id *adev = &asus_ids[0];
4678 -static struct pci_bus *pnp_c __devinitdata = NULL;
4679 -#endif
4680 -
4681  int __init
4682  setup_asuscom(struct IsdnCard *card)
4683  {
4684 @@ -343,45 +321,7 @@
4685         printk(KERN_INFO "HiSax: Asuscom ISDNLink driver Rev. %s\n", HiSax_getrev(tmp));
4686         if (cs->typ != ISDN_CTYPE_ASUSCOM)
4687                 return (0);
4688 -#ifdef __ISAPNP__
4689 -       if (!card->para[1] && isapnp_present()) {
4690 -               struct pci_bus *pb;
4691 -               struct pci_dev *pd;
4692 -
4693 -               while(adev->card_vendor) {
4694 -                       if ((pb = isapnp_find_card(adev->card_vendor,
4695 -                               adev->card_device, pnp_c))) {
4696 -                               pnp_c = pb;
4697 -                               pd = NULL;
4698 -                               if ((pd = isapnp_find_dev(pnp_c,
4699 -                                       adev->vendor, adev->function, pd))) {
4700 -                                       printk(KERN_INFO "HiSax: %s detected\n",
4701 -                                               (char *)adev->driver_data);
4702 -                                       pd->prepare(pd);
4703 -                                       pd->deactivate(pd);
4704 -                                       pd->activate(pd);
4705 -                                       card->para[1] = pd->resource[0].start;
4706 -                                       card->para[0] = pd->irq_resource[0].start;
4707 -                                       if (!card->para[0] || !card->para[1]) {
4708 -                                               printk(KERN_ERR "AsusPnP:some resources are missing %ld/%lx\n",
4709 -                                               card->para[0], card->para[1]);
4710 -                                               pd->deactivate(pd);
4711 -                                               return(0);
4712 -                                       }
4713 -                                       break;
4714 -                               } else {
4715 -                                       printk(KERN_ERR "AsusPnP: PnP error card found, no device\n");
4716 -                               }
4717 -                       }
4718 -                       adev++;
4719 -                       pnp_c=NULL;
4720 -               } 
4721 -               if (!adev->card_vendor) {
4722 -                       printk(KERN_INFO "AsusPnP: no ISAPnP card found\n");
4723 -                       return(0);
4724 -               }
4725 -       }
4726 -#endif
4727 +
4728         bytecnt = 8;
4729         cs->hw.asus.cfg_reg = card->para[1];
4730         cs->irq = card->para[0];
4731 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/avm_a1.c linux-2.4.29/drivers/isdn/hisax/avm_a1.c
4732 --- linux-2.4.29.old/drivers/isdn/hisax/avm_a1.c        2005-03-22 14:47:56.000000000 +0100
4733 +++ linux-2.4.29/drivers/isdn/hisax/avm_a1.c    2005-03-22 15:06:45.904114296 +0100
4734 @@ -1,4 +1,4 @@
4735 -/* $Id: avm_a1.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4736 +/* $Id: avm_a1.c,v 2.15 2001/09/24 13:22:55 kai Exp $
4737   *
4738   * low level stuff for AVM A1 (Fritz) isdn cards
4739   *
4740 @@ -18,7 +18,7 @@
4741  #include "isdnl1.h"
4742  
4743  extern const char *CardType[];
4744 -static const char *avm_revision = "$Revision: 1.1.4.1 $";
4745 +static const char *avm_revision = "$Revision: 2.15 $";
4746  
4747  #define         AVM_A1_STAT_ISAC       0x01
4748  #define         AVM_A1_STAT_HSCX       0x02
4749 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/avm_a1p.c linux-2.4.29/drivers/isdn/hisax/avm_a1p.c
4750 --- linux-2.4.29.old/drivers/isdn/hisax/avm_a1p.c       2005-03-22 14:47:56.000000000 +0100
4751 +++ linux-2.4.29/drivers/isdn/hisax/avm_a1p.c   2005-03-22 15:06:45.919112016 +0100
4752 @@ -1,4 +1,4 @@
4753 -/* $Id: avm_a1p.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4754 +/* $Id: avm_a1p.c,v 2.9 2001/09/24 13:22:55 kai Exp $
4755   *
4756   * low level stuff for the following AVM cards:
4757   * A1 PCMCIA
4758 @@ -57,7 +57,7 @@
4759  #define byteout(addr,val) outb(val,addr)
4760  #define bytein(addr) inb(addr)
4761  
4762 -static const char *avm_revision = "$Revision: 1.1.4.1 $";
4763 +static const char *avm_revision = "$Revision: 2.9 $";
4764  
4765  static inline u_char
4766  ReadISAC(struct IsdnCardState *cs, u_char offset)
4767 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/avm_pci.c linux-2.4.29/drivers/isdn/hisax/avm_pci.c
4768 --- linux-2.4.29.old/drivers/isdn/hisax/avm_pci.c       2005-03-22 14:47:56.000000000 +0100
4769 +++ linux-2.4.29/drivers/isdn/hisax/avm_pci.c   2005-03-22 15:06:45.945108064 +0100
4770 @@ -1,4 +1,4 @@
4771 -/* $Id: avm_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4772 +/* $Id: avm_pci.c,v 1.29 2001/09/24 13:22:55 kai Exp $
4773   *
4774   * low level stuff for AVM Fritz!PCI and ISA PnP isdn cards
4775   *
4776 @@ -19,11 +19,11 @@
4777  #include "isac.h"
4778  #include "isdnl1.h"
4779  #include <linux/pci.h>
4780 -#include <linux/isapnp.h>
4781 +#include <linux/isdn_compat.h>
4782  #include <linux/interrupt.h>
4783  
4784  extern const char *CardType[];
4785 -static const char *avm_pci_rev = "$Revision: 1.1.4.1 $";
4786 +static const char *avm_pci_rev = "$Revision: 1.29 $";
4787  
4788  #define  AVM_FRITZ_PCI         1
4789  #define  AVM_FRITZ_PNP         2
4790 @@ -291,8 +291,7 @@
4791                         debugl1(cs, "hdlc_empty_fifo: incoming packet too large");
4792                 return;
4793         }
4794 -       p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx;
4795 -       ptr = (u_int *)p;
4796 +       ptr = (u_int *) p = bcs->hw.hdlc.rcvbuf + bcs->hw.hdlc.rcvidx;
4797         bcs->hw.hdlc.rcvidx += count;
4798         if (cs->subtyp == AVM_FRITZ_PCI) {
4799                 outl(idx, cs->hw.avm.cfg_reg + 4);
4800 @@ -353,8 +352,7 @@
4801         }
4802         if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
4803                 debugl1(cs, "hdlc_fill_fifo %d/%ld", count, bcs->tx_skb->len);
4804 -       p = bcs->tx_skb->data;
4805 -       ptr = (u_int *)p;
4806 +       ptr = (u_int *) p = bcs->tx_skb->data;
4807         skb_pull(bcs->tx_skb, count);
4808         bcs->tx_cnt -= count;
4809         bcs->hw.hdlc.count += count;
4810 @@ -766,10 +764,6 @@
4811  }
4812  
4813  static struct pci_dev *dev_avm __initdata = NULL;
4814 -#ifdef __ISAPNP__
4815 -static struct pci_bus *bus_avm __initdata = NULL;
4816 -static struct pci_dev *pnp_avm __initdata = NULL;
4817 -#endif
4818  
4819  int __init
4820  setup_avm_pcipnp(struct IsdnCard *card)
4821 @@ -783,47 +777,10 @@
4822         if (cs->typ != ISDN_CTYPE_FRITZPCI)
4823                 return (0);
4824         if (card->para[1]) {
4825 -               /* old manual method */
4826                 cs->hw.avm.cfg_reg = card->para[1];
4827                 cs->irq = card->para[0];
4828                 cs->subtyp = AVM_FRITZ_PNP;
4829         } else {
4830 -#ifdef __ISAPNP__
4831 -               if (isapnp_present()) {
4832 -                       struct pci_bus *ba;
4833 -                       if ((ba = isapnp_find_card(
4834 -                               ISAPNP_VENDOR('A', 'V', 'M'),
4835 -                               ISAPNP_FUNCTION(0x0900), bus_avm))) {
4836 -                               bus_avm = ba;
4837 -                               pnp_avm = NULL;
4838 -                               if ((pnp_avm = isapnp_find_dev(bus_avm,
4839 -                                       ISAPNP_VENDOR('A', 'V', 'M'),
4840 -                                       ISAPNP_FUNCTION(0x0900), pnp_avm))) {
4841 -                                       pnp_avm->prepare(pnp_avm);
4842 -                                       pnp_avm->deactivate(pnp_avm);
4843 -                                       pnp_avm->activate(pnp_avm);
4844 -                                       cs->hw.avm.cfg_reg =
4845 -                                               pnp_avm->resource[0].start;
4846 -                                       cs->irq = 
4847 -                                               pnp_avm->irq_resource[0].start;
4848 -                                       if (!cs->irq) {
4849 -                                               printk(KERN_ERR "FritzPnP:No IRQ\n");
4850 -                                               pnp_avm->deactivate(pnp_avm);
4851 -                                               return(0);
4852 -                                       }
4853 -                                       if (!cs->hw.avm.cfg_reg) {
4854 -                                               printk(KERN_ERR "FritzPnP:No IO address\n");
4855 -                                               pnp_avm->deactivate(pnp_avm);
4856 -                                               return(0);
4857 -                                       }
4858 -                                       cs->subtyp = AVM_FRITZ_PNP;
4859 -                                       goto ready;
4860 -                               }
4861 -                       }
4862 -               } else {
4863 -                       printk(KERN_INFO "FritzPnP: no ISA PnP present\n");
4864 -               }
4865 -#endif
4866  #if CONFIG_PCI
4867                 if (!pci_present()) {
4868                         printk(KERN_ERR "FritzPCI: no PCI bus present\n");
4869 @@ -838,7 +795,7 @@
4870                         }
4871                         if (pci_enable_device(dev_avm))
4872                                 return(0);
4873 -                       cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
4874 +                       cs->hw.avm.cfg_reg = pci_resource_start_io(dev_avm, 1);
4875                         if (!cs->hw.avm.cfg_reg) {
4876                                 printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
4877                                 return(0);
4878 @@ -854,7 +811,6 @@
4879                 return (0);
4880  #endif /* CONFIG_PCI */
4881         }
4882 -ready:
4883         cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10;
4884         if (check_region((cs->hw.avm.cfg_reg), 32)) {
4885                 printk(KERN_WARNING
4886 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/bkm_a4t.c linux-2.4.29/drivers/isdn/hisax/bkm_a4t.c
4887 --- linux-2.4.29.old/drivers/isdn/hisax/bkm_a4t.c       2005-03-22 14:47:56.000000000 +0100
4888 +++ linux-2.4.29/drivers/isdn/hisax/bkm_a4t.c   2005-03-22 15:06:45.962105480 +0100
4889 @@ -1,4 +1,4 @@
4890 -/* $Id: bkm_a4t.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4891 +/* $Id: bkm_a4t.c,v 1.22 2001/09/24 13:22:55 kai Exp $
4892   *
4893   * low level stuff for T-Berkom A4T
4894   *
4895 @@ -20,11 +20,12 @@
4896  #include "jade.h"
4897  #include "isdnl1.h"
4898  #include <linux/pci.h>
4899 +#include <linux/isdn_compat.h>
4900  #include "bkm_ax.h"
4901  
4902  extern const char *CardType[];
4903  
4904 -const char *bkm_a4t_revision = "$Revision: 1.1.4.1 $";
4905 +const char *bkm_a4t_revision = "$Revision: 1.22 $";
4906  
4907  
4908  static inline u_char
4909 @@ -293,13 +294,13 @@
4910                 u16 sub_sys;
4911                 u16 sub_vendor;
4912  
4913 -               sub_vendor = dev_a4t->subsystem_vendor;
4914 -               sub_sys = dev_a4t->subsystem_device;
4915 +               pci_get_sub_vendor(dev_a4t,sub_vendor);
4916 +               pci_get_sub_system(dev_a4t,sub_sys);
4917                 if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
4918                         if (pci_enable_device(dev_a4t))
4919                                 return(0);
4920                         found = 1;
4921 -                       pci_memaddr = pci_resource_start(dev_a4t, 0);
4922 +                       pci_memaddr = pci_resource_start_mem(dev_a4t, 0);
4923                         cs->irq = dev_a4t->irq;
4924                         break;
4925                 }
4926 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/bkm_a8.c linux-2.4.29/drivers/isdn/hisax/bkm_a8.c
4927 --- linux-2.4.29.old/drivers/isdn/hisax/bkm_a8.c        2005-03-22 14:47:56.000000000 +0100
4928 +++ linux-2.4.29/drivers/isdn/hisax/bkm_a8.c    2005-03-22 15:06:45.982102440 +0100
4929 @@ -1,4 +1,4 @@
4930 -/* $Id: bkm_a8.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4931 +/* $Id: bkm_a8.c,v 1.22 2001/09/24 13:22:55 kai Exp $
4932   *
4933   * low level stuff for Scitel Quadro (4*S0, passive)
4934   *
4935 @@ -20,6 +20,7 @@
4936  #include "hscx.h"
4937  #include "isdnl1.h"
4938  #include <linux/pci.h>
4939 +#include <linux/isdn_compat.h>
4940  #include "bkm_ax.h"
4941  
4942  #if CONFIG_PCI
4943 @@ -28,7 +29,7 @@
4944  
4945  extern const char *CardType[];
4946  
4947 -const char sct_quadro_revision[] = "$Revision: 1.1.4.1 $";
4948 +const char sct_quadro_revision[] = "$Revision: 1.22 $";
4949  
4950  static const char *sct_quadro_subtypes[] =
4951  {
4952 @@ -329,13 +330,13 @@
4953                 while ((dev_a8 = pci_find_device(PCI_VENDOR_ID_PLX,
4954                         PCI_DEVICE_ID_PLX_9050, dev_a8))) {
4955                         
4956 -                       sub_vendor_id = dev_a8->subsystem_vendor;
4957 -                       sub_sys_id = dev_a8->subsystem_device;
4958 +                       pci_get_sub_vendor(dev_a8,sub_vendor_id);
4959 +                       pci_get_sub_system(dev_a8,sub_sys_id);
4960                         if ((sub_sys_id == PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) &&
4961                                 (sub_vendor_id == PCI_VENDOR_ID_BERKOM)) {
4962                                 if (pci_enable_device(dev_a8))
4963                                         return(0);
4964 -                               pci_ioaddr1 = pci_resource_start(dev_a8, 1);
4965 +                               pci_ioaddr1 = pci_resource_start_io(dev_a8, 1);
4966                                 pci_irq = dev_a8->irq;
4967                                 pci_bus = dev_a8->bus->number;
4968                                 pci_device_fn = dev_a8->devfn;
4969 @@ -365,7 +366,7 @@
4970                         pci_ioaddr1 &= PCI_BASE_ADDRESS_IO_MASK;
4971                         pcibios_write_config_dword(pci_bus, pci_device_fn,
4972                                 PCI_BASE_ADDRESS_1, pci_ioaddr1);
4973 -                       dev_a8->resource[ 1].start = pci_ioaddr1;
4974 +                       get_pcibase(dev_a8, 1) = pci_ioaddr1;
4975                 }
4976  #endif /* End HACK */
4977         }
4978 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/bkm_ax.h linux-2.4.29/drivers/isdn/hisax/bkm_ax.h
4979 --- linux-2.4.29.old/drivers/isdn/hisax/bkm_ax.h        2005-03-22 14:47:56.000000000 +0100
4980 +++ linux-2.4.29/drivers/isdn/hisax/bkm_ax.h    2005-03-22 15:06:46.010098184 +0100
4981 @@ -1,4 +1,4 @@
4982 -/* $Id: bkm_ax.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4983 +/* $Id$
4984   *
4985   * low level decls for T-Berkom cards A4T and Scitel Quadro (4*S0, passive)
4986   *
4987 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/callc.c linux-2.4.29/drivers/isdn/hisax/callc.c
4988 --- linux-2.4.29.old/drivers/isdn/hisax/callc.c 2005-03-22 14:47:56.000000000 +0100
4989 +++ linux-2.4.29/drivers/isdn/hisax/callc.c     2005-03-22 15:06:46.027095600 +0100
4990 @@ -1,4 +1,4 @@
4991 -/* $Id: callc.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
4992 +/* $Id: callc.c,v 2.59 2002/02/09 21:19:11 keil Exp $
4993   *
4994   * Author       Karsten Keil
4995   * Copyright    by Karsten Keil      <keil@isdn4linux.de>
4996 @@ -26,7 +26,7 @@
4997  #define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module))
4998  #endif /* MODULE */
4999  
5000 -const char *lli_revision = "$Revision: 1.1.4.1 $";
5001 +const char *lli_revision = "$Revision: 2.59 $";
5002  
5003  extern struct IsdnCard cards[];
5004  extern int nrcards;
5005 @@ -145,9 +145,11 @@
5006         EV_PROCEED,             /* 20 */
5007         EV_ALERT,               /* 21 */ 
5008         EV_REDIR,               /* 22 */ 
5009 +       EV_ALERTING,            /* 23 */
5010 +       EV_PROCEEDING,          /* 24 */
5011  };
5012  
5013 -#define EVENT_COUNT (EV_REDIR + 1)
5014 +#define EVENT_COUNT (EV_PROCEEDING + 1)
5015  
5016  static char *strEvent[] =
5017  {
5018 @@ -174,6 +176,8 @@
5019         "EV_PROCEED",
5020         "EV_ALERT",
5021         "EV_REDIR",
5022 +       "EV_ALERTING",
5023 +       "EV_PROCEEDING",
5024  };
5025  
5026  
5027 @@ -286,6 +290,22 @@
5028  }
5029  
5030  static void
5031 +lli_alerting(struct FsmInst *fi, int event, void *arg)
5032 +{
5033 +       struct Channel *chanp = fi->userdata;
5034 +       
5035 +       HL_LL(chanp, ISDN_STAT_ALERT);
5036 +}
5037 +
5038 +static void
5039 +lli_proceeding(struct FsmInst *fi, int event, void *arg)
5040 +{
5041 +       struct Channel *chanp = fi->userdata;
5042 +       
5043 +       HL_LL(chanp, ISDN_STAT_PROCEED);
5044 +}
5045 +
5046 +static void
5047  lli_resume(struct FsmInst *fi, int event, void *arg)
5048  {
5049         struct Channel *chanp = fi->userdata;
5050 @@ -784,6 +804,8 @@
5051          {ST_OUT_DIAL,           EV_DISCONNECT_IND,      lli_release_req},
5052          {ST_OUT_DIAL,           EV_RELEASE,             lli_dhup_close},
5053          {ST_OUT_DIAL,           EV_NOSETUP_RSP,         lli_no_setup_rsp},
5054 +        {ST_OUT_DIAL,           EV_PROCEEDING,         lli_proceeding},
5055 +        {ST_OUT_DIAL,           EV_ALERTING,           lli_alerting},
5056          {ST_OUT_DIAL,           EV_SETUP_ERR,           lli_error},
5057          {ST_IN_WAIT_LL,         EV_LEASED_REL,          lli_failure_l},
5058          {ST_IN_WAIT_LL,         EV_ACCEPTD,             lli_setup_rsp},
5059 @@ -925,7 +947,7 @@
5060         ic.driver = cs->myid;
5061         ic.command = ISDN_STAT_REDIR;
5062         ic.arg = chan; 
5063 -       ic.parm.num[0] = result;
5064 +       (ulong)(ic.parm.num[0]) = result;
5065         cs->iif.statcallb(&ic);
5066  } /* stat_redir_result */
5067  
5068 @@ -997,8 +1019,13 @@
5069                         FsmEvent(&chanp->fi, EV_RELEASE, NULL);
5070                         break;
5071                 case (CC_PROCEED_SEND | INDICATION):
5072 +                       break;
5073                 case (CC_PROCEEDING | INDICATION):
5074 +                       FsmEvent(&chanp->fi, EV_PROCEEDING, NULL);
5075 +                       break;
5076                 case (CC_ALERTING | INDICATION):
5077 +                       FsmEvent(&chanp->fi, EV_ALERTING, NULL);
5078 +                       break;
5079                 case (CC_PROGRESS | INDICATION):
5080                 case (CC_NOTIFY | INDICATION):
5081                         break;
5082 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/cert.c linux-2.4.29/drivers/isdn/hisax/cert.c
5083 --- linux-2.4.29.old/drivers/isdn/hisax/cert.c  2005-03-22 14:47:56.000000000 +0100
5084 +++ linux-2.4.29/drivers/isdn/hisax/cert.c      2005-03-22 15:06:46.042093320 +0100
5085 @@ -1,4 +1,4 @@
5086 -/* $Id: cert.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
5087 +/* $Id: cert.c,v 2.6 2001/09/24 13:22:56 kai Exp $
5088   *
5089   * Author       Karsten Keil
5090   * Copyright    by Karsten Keil      <keil@isdn4linux.de>
5091 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/config.c linux-2.4.29/drivers/isdn/hisax/config.c
5092 --- linux-2.4.29.old/drivers/isdn/hisax/config.c        2005-03-22 14:47:56.000000000 +0100
5093 +++ linux-2.4.29/drivers/isdn/hisax/config.c    2005-03-22 15:06:46.077088000 +0100
5094 @@ -1,4 +1,4 @@
5095 -/* $Id: config.c,v 1.1.4.5 2001/12/09 19:19:26 kai Exp $
5096 +/* $Id: config.c,v 2.84 2002/08/13 09:55:29 keil Exp $
5097   *
5098   * Author       Karsten Keil
5099   * Copyright    by Karsten Keil      <keil@isdn4linux.de>
5100 @@ -24,6 +24,11 @@
5101  #include <linux/kernel_stat.h>
5102  #include <linux/tqueue.h>
5103  #include <linux/interrupt.h>
5104 +
5105 +#ifdef CONFIG_HISAX_HFC_USB
5106 +#include "hisax_loadable.h"
5107 +#endif
5108 +
5109  #define HISAX_STATUS_BUFSIZE 4096
5110  #define INCLUDE_INLINE_FUNCS
5111  
5112 @@ -75,8 +80,7 @@
5113   *   37 HFC 2BDS0 S+/SP         p0=irq p1=iobase
5114   *   38 Travers Technologies NETspider-U PCI card
5115   *   39 HFC 2BDS0-SP PCMCIA     p0=irq p1=iobase
5116 - *   40 hotplug interface
5117 - *   41 Formula-n enter:now ISDN PCI a/b   none
5118 + *   40 HFC-S USB               none
5119   *
5120   * protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6 or ISDN_PTYPE_NI1
5121   *
5122 @@ -95,11 +99,17 @@
5123         "Siemens I-Surf", "Acer P10", "HST Saphir", "Telekom A4T",
5124         "Scitel Quadro", "Gazel", "HFC 2BDS0 PCI", "Winbond 6692",
5125         "HFC 2BDS0 SX", "NETspider-U", "HFC-2BDS0-SP PCMCIA",
5126 -       "Hotplug", "Formula-n enter:now PCI a/b", 
5127 +       "HFC-S USB",
5128  };
5129  
5130  void HiSax_closecard(int cardnr);
5131  
5132 +#ifdef CONFIG_HISAX_HFC_USB
5133 +#define DEFAULT_CARD ISDN_CTYPE_HFC_USB
5134 +#define DEFAULT_CFG {0,0,0,0}
5135 +EXPORT_SYMBOL(hisax_register_hfcusb);
5136 +#endif
5137 +
5138  #ifdef CONFIG_HISAX_ELSA
5139  #define DEFAULT_CARD ISDN_CTYPE_ELSA
5140  #define DEFAULT_CFG {0,0,0,0}
5141 @@ -339,19 +349,27 @@
5142         NULL, \
5143  }
5144  
5145 -struct IsdnCard cards[HISAX_MAX_CARDS] = {
5146 +#define EMPTY_CARD     {0, DEFAULT_PROTO, {0, 0, 0, 0}, NULL}
5147 +
5148 +struct IsdnCard cards[] = {
5149         FIRST_CARD,
5150 +       EMPTY_CARD,
5151 +       EMPTY_CARD,
5152 +       EMPTY_CARD,
5153 +       EMPTY_CARD,
5154 +       EMPTY_CARD,
5155 +       EMPTY_CARD,
5156 +       EMPTY_CARD,
5157  };
5158  
5159 -#define HISAX_IDSIZE (HISAX_MAX_CARDS*8)
5160 -static char HiSaxID[HISAX_IDSIZE] __devinitdata = { 0, };
5161 +static char HiSaxID[64] __devinitdata = { 0, };
5162  
5163  char *HiSax_id __devinitdata = HiSaxID;
5164  #ifdef MODULE
5165  /* Variables for insmod */
5166 -static int type[HISAX_MAX_CARDS] __devinitdata = { 0, };
5167 -static int protocol[HISAX_MAX_CARDS] __devinitdata = { 0, };
5168 -static int io[HISAX_MAX_CARDS] __devinitdata = { 0, };
5169 +static int type[8] __devinitdata = { 0, };
5170 +static int protocol[8] __devinitdata = { 0, };
5171 +static int io[8] __devinitdata = { 0, };
5172  #undef IO0_IO1
5173  #ifdef CONFIG_HISAX_16_3
5174  #define IO0_IO1
5175 @@ -361,27 +379,23 @@
5176  #define IO0_IO1
5177  #endif
5178  #ifdef IO0_IO1
5179 -static int io0[HISAX_MAX_CARDS] __devinitdata = { 0, };
5180 -static int io1[HISAX_MAX_CARDS] __devinitdata = { 0, };
5181 +static int io0[8] __devinitdata = { 0, };
5182 +static int io1[8] __devinitdata = { 0, };
5183  #endif
5184 -static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, };
5185 -static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, };
5186 +static int irq[8] __devinitdata = { 0, };
5187 +static int mem[8] __devinitdata = { 0, };
5188  static char *id __devinitdata = HiSaxID;
5189  
5190 -#define PARM_PARA "1-" __MODULE_STRING(HISAX_MAX_CARDS) "i"
5191 -
5192 -MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards");
5193  MODULE_AUTHOR("Karsten Keil");
5194 -MODULE_LICENSE("GPL");
5195 -MODULE_PARM(type, PARM_PARA);
5196 -MODULE_PARM(protocol, PARM_PARA);
5197 -MODULE_PARM(io, PARM_PARA);
5198 -MODULE_PARM(irq, PARM_PARA);
5199 -MODULE_PARM(mem, PARM_PARA);
5200 +MODULE_PARM(type, "1-8i");
5201 +MODULE_PARM(protocol, "1-8i");
5202 +MODULE_PARM(io, "1-8i");
5203 +MODULE_PARM(irq, "1-8i");
5204 +MODULE_PARM(mem, "1-8i");
5205  MODULE_PARM(id, "s");
5206  #ifdef IO0_IO1
5207 -MODULE_PARM(io0, PARM_PARA);
5208 -MODULE_PARM(io1, PARM_PARA);
5209 +MODULE_PARM(io0, "1-8i");
5210 +MODULE_PARM(io1, "1-8i");
5211  #endif
5212  #endif /* MODULE */
5213  
5214 @@ -432,6 +446,7 @@
5215  }
5216  
5217  #ifndef MODULE
5218 +#ifdef COMPAT_HAS_NEW_SETUP
5219  #define MAX_ARG        (HISAX_MAX_CARDS*5)
5220  static int __init HiSax_setup(char *line)
5221  {
5222 @@ -440,12 +455,16 @@
5223         char *str;
5224  
5225         str = get_options(line, MAX_ARG, ints);
5226 +#else
5227 +void __init HiSax_setup(char *str, int *ints)
5228 +{
5229 +       int i, j, argc;
5230 +#endif
5231         argc = ints[0];
5232         printk(KERN_DEBUG "HiSax_setup: argc(%d) str(%s)\n", argc, str);
5233         i = 0;
5234         j = 1;
5235         while (argc && (i < HISAX_MAX_CARDS)) {
5236 -               cards[i].protocol = DEFAULT_PROTO;
5237                 if (argc) {
5238                         cards[i].typ = ints[j];
5239                         j++;
5240 @@ -473,19 +492,21 @@
5241                 }
5242                 i++;
5243         }
5244 -       if (str && *str) {
5245 -               if (strlen(str) < HISAX_IDSIZE)
5246 -                       strcpy(HiSaxID, str);
5247 -               else
5248 -                       printk(KERN_WARNING "HiSax: ID too long!");
5249 -       } else
5250 +       if (str && *str) {
5251 +               strcpy(HiSaxID, str);
5252 +               HiSax_id = HiSaxID;
5253 +       } else {
5254                 strcpy(HiSaxID, "HiSax");
5255 -
5256 -       HiSax_id = HiSaxID;
5257 +               HiSax_id = HiSaxID;
5258 +       }
5259 +#ifdef COMPAT_HAS_NEW_SETUP
5260         return 1;
5261  }
5262  
5263  __setup("hisax=", HiSax_setup);
5264 +#else
5265 +}
5266 +#endif /* COMPAT_HAS_NEW_SETUP */
5267  #endif /* MODULES */
5268  
5269  #if CARD_TELES0
5270 @@ -560,6 +581,10 @@
5271  extern int setup_hfcpci(struct IsdnCard *card);
5272  #endif
5273  
5274 +#if CONFIG_HISAX_HFC_USB
5275 +extern int setup_hfc_usb(struct IsdnCard *card);
5276 +#endif
5277 +
5278  #if CARD_HFC_SX
5279  extern int setup_hfcsx(struct IsdnCard *card);
5280  #endif
5281 @@ -604,10 +629,6 @@
5282  extern int setup_netjet_u(struct IsdnCard *card);
5283  #endif
5284  
5285 -#if CARD_FN_ENTERNOW_PCI
5286 -extern int setup_enternow_pci(struct IsdnCard *card);
5287 -#endif
5288 -
5289  /*
5290   * Find card with given driverId
5291   */
5292 @@ -899,7 +920,8 @@
5293         return 3;
5294  }
5295  
5296 -static int __devinit checkcard(int cardnr, char *id, int *busy_flag)
5297 +static int __devinit checkcard(int cardnr, char *id, int *busy_flag,
5298 +                              void *load_drv)
5299  {
5300         long flags;
5301         int ret = 0;
5302 @@ -1093,6 +1115,12 @@
5303                 ret = setup_hfcsx(card);
5304                 break;
5305  #endif
5306 +#if CONFIG_HISAX_HFC_USB
5307 +       case ISDN_CTYPE_HFC_USB:
5308 +               cs->hw.hfcusb.drv = load_drv;
5309 +               ret = setup_hfc_usb(card);
5310 +               break;
5311 +#endif
5312  #if CARD_NICCY
5313         case ISDN_CTYPE_NICCY:
5314                 ret = setup_niccy(card);
5315 @@ -1143,11 +1171,6 @@
5316                 ret = setup_netjet_u(card);
5317                 break;
5318  #endif
5319 -#if CARD_FN_ENTERNOW_PCI
5320 -       case ISDN_CTYPE_ENTERNOW:
5321 -               ret = setup_enternow_pci(card);
5322 -               break;
5323 -#endif
5324         case ISDN_CTYPE_DYNAMIC:
5325                 ret = 2;
5326                 break;
5327 @@ -1186,6 +1209,9 @@
5328         case ISDN_CTYPE_DYNAMIC:
5329                 ret = 0;
5330                 break;
5331 +       case ISDN_CTYPE_HFC_USB:
5332 +               ret = cs->cardmsg(cs, CARD_INIT, NULL);
5333 +               break;
5334         default:
5335                 ret = init_card(cs);
5336                 break;
5337 @@ -1257,16 +1283,13 @@
5338                         else
5339                                 sprintf(ids, "%s%d", id, i);
5340                 }
5341 -               if (checkcard(i, ids, busy_flag)) {
5342 +               if (checkcard(i, ids, busy_flag, NULL)) {
5343                         foundcards++;
5344                         i++;
5345                 } else {
5346 -                       /* make sure we don't oops the module */
5347 -                       if (cards[i].typ > 0 && cards[i].typ <= ISDN_CTYPE_COUNT) {
5348 -                               printk(KERN_WARNING
5349 -                                       "HiSax: Card %s not installed !\n",
5350 -                                       CardType[cards[i].typ]);
5351 -                       }
5352 +                       printk(KERN_WARNING
5353 +                              "HiSax: Card %s not installed !\n",
5354 +                              CardType[cards[i].typ]);
5355                         HiSax_shiftcards(i);
5356                         nrcards--;
5357                 }
5358 @@ -1342,6 +1365,49 @@
5359  #endif
5360  }
5361  
5362 +#ifdef CONFIG_HISAX_HFC_USB
5363 +int
5364 +hisax_register_hfcusb(struct hisax_drvreg *l1drv)
5365 +{
5366 +       int i;
5367 +       char ids[30];
5368 +
5369 +       if (l1drv->version != HISAX_LOAD_VERSION)
5370 +               return 1;
5371 +
5372 +       switch (l1drv->cmd) {
5373 +       case HISAX_LOAD_CHKVER:
5374 +               break;  /* success */
5375 +
5376 +       case HISAX_LOAD_REGISTER:
5377 +               for (i = 0; i < HISAX_MAX_CARDS; i++) {
5378 +                       if (!cards[i].typ)
5379 +                               break;
5380 +               }
5381 +               if (i >= HISAX_MAX_CARDS)
5382 +                       return 1;       /* no space */
5383 +               cards[i].typ = ISDN_CTYPE_HFC_USB;      /* setup type */
5384 +               cards[i].protocol = DEFAULT_PROTO;
5385 +               sprintf(ids, "%s%d", l1drv->drvname, i);
5386 +               if (checkcard(i, ids, NULL, (void *) l1drv)) {
5387 +                       nrcards++;
5388 +                       return 0;
5389 +               }
5390 +               if (cards[i].cs)
5391 +                       kfree((void *) cards[i].cs);
5392 +               cards[i].cs = NULL;
5393 +               cards[i].typ = 0;       /* no card present */
5394 +               return 1;
5395 +               break;
5396 +
5397 +       default:
5398 +               return 1;       /* unknown command */
5399 +       }
5400 +
5401 +       return 0;
5402 +}                              /* hisax_register_hfcusb */
5403 +#endif
5404 +
5405  static int __init HiSax_init(void)
5406  {
5407         int i, retval;
5408 @@ -1408,8 +1474,6 @@
5409                 if (protocol[i]) {
5410                         cards[j].protocol = protocol[i];
5411                         nzproto++;
5412 -               } else {
5413 -                       cards[j].protocol = DEFAULT_PROTO;
5414                 }
5415                 switch (type[i]) {
5416                 case ISDN_CTYPE_16_0:
5417 @@ -1487,22 +1551,15 @@
5418                         } else {
5419                                 /* QUADRO is a 4 BRI card */
5420                                 cards[j++].para[0] = 1;
5421 -                               /* we need to check if further cards can be added */
5422 -                               if (j < HISAX_MAX_CARDS) {
5423 -                                       cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5424 -                                       cards[j].protocol = protocol[i];
5425 -                                       cards[j++].para[0] = 2;
5426 -                               }
5427 -                               if (j < HISAX_MAX_CARDS) {
5428 -                                       cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5429 -                                       cards[j].protocol = protocol[i];
5430 -                                       cards[j++].para[0] = 3;
5431 -                               }
5432 -                               if (j < HISAX_MAX_CARDS) {
5433 -                                       cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5434 -                                       cards[j].protocol = protocol[i];
5435 -                                       cards[j].para[0] = 4;
5436 -                               }
5437 +                               cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5438 +                               cards[j].protocol = protocol[i];
5439 +                               cards[j++].para[0] = 2;
5440 +                               cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5441 +                               cards[j].protocol = protocol[i];
5442 +                               cards[j++].para[0] = 3;
5443 +                               cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
5444 +                               cards[j].protocol = protocol[i];
5445 +                               cards[j].para[0] = 4;
5446                         }
5447                         break;
5448                 }
5449 @@ -1526,10 +1583,15 @@
5450                nrcards, (nrcards > 1) ? "s" : "");
5451  
5452         /* Install only, if at least one card found */
5453 -       if (!HiSax_inithardware(NULL))
5454 -               return -ENODEV;
5455 +       if (!HiSax_inithardware(NULL)) {
5456 +               retval = -EIO;
5457 +               goto out_isdnl1;
5458 +       }
5459 +
5460         return 0;
5461  
5462 + out_isdnl1:
5463 +       Isdnl1Free();
5464   out_tei:
5465         TeiFree();
5466   out_isdnl2:
5467 @@ -1576,8 +1638,6 @@
5468                 cards[i].typ = type[i];
5469                 if (protocol[i]) {
5470                         cards[i].protocol = protocol[i];
5471 -               } else {
5472 -                       cards[i].protocol = DEFAULT_PROTO;
5473                 }
5474         }
5475         cards[0].para[0] = pcm_irq;
5476 @@ -1595,8 +1655,7 @@
5477         printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5478                nrcards, (nrcards > 1) ? "s" : "");
5479  
5480 -       if (!HiSax_inithardware(busy_flag))
5481 -               return -ENODEV;
5482 +       HiSax_inithardware(busy_flag);
5483         printk(KERN_NOTICE "HiSax: module installed\n");
5484  #endif
5485         return 0;
5486 @@ -1619,8 +1678,6 @@
5487                 cards[i].typ = type[i];
5488                 if (protocol[i]) {
5489                         cards[i].protocol = protocol[i];
5490 -               } else {
5491 -                       cards[i].protocol = DEFAULT_PROTO;
5492                 }
5493         }
5494         cards[0].para[0] = pcm_irq;
5495 @@ -1638,8 +1695,7 @@
5496         printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5497                nrcards, (nrcards > 1) ? "s" : "");
5498  
5499 -       if (!HiSax_inithardware(busy_flag))
5500 -               return -ENODEV;
5501 +       HiSax_inithardware(busy_flag);
5502         printk(KERN_NOTICE "HiSax: module installed\n");
5503  #endif
5504         return 0;
5505 @@ -1662,8 +1718,6 @@
5506                 cards[i].typ = type[i];
5507                 if (protocol[i]) {
5508                         cards[i].protocol = protocol[i];
5509 -               } else {
5510 -                       cards[i].protocol = DEFAULT_PROTO;
5511                 }
5512         }
5513         cards[0].para[0] = pcm_irq;
5514 @@ -1681,8 +1735,7 @@
5515         printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5516                nrcards, (nrcards > 1) ? "s" : "");
5517  
5518 -       if (!HiSax_inithardware(busy_flag))
5519 -               return -ENODEV;
5520 +       HiSax_inithardware(busy_flag);
5521         printk(KERN_NOTICE "HiSax: module installed\n");
5522  #endif
5523         return 0;
5524 @@ -1705,8 +1758,6 @@
5525                 cards[i].typ = type[i];
5526                 if (protocol[i]) {
5527                         cards[i].protocol = protocol[i];
5528 -               } else {
5529 -                       cards[i].protocol = DEFAULT_PROTO;
5530                 }
5531         }
5532         cards[0].para[0] = pcm_irq;
5533 @@ -1724,8 +1775,7 @@
5534         printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
5535                nrcards, (nrcards > 1) ? "s" : "");
5536  
5537 -       if (!HiSax_inithardware(busy_flag))
5538 -               return -ENODEV;
5539 +       HiSax_inithardware(busy_flag);
5540         printk(KERN_NOTICE "HiSax: module installed\n");
5541  #endif
5542         return 0;
5543 @@ -1743,7 +1793,7 @@
5544                 sprintf(ids, "HiSax%d", nrcards);
5545         else
5546                 sprintf(ids, "HiSax");
5547 -       if (!checkcard(nrcards, ids, busy_flag)) {
5548 +       if (!checkcard(nrcards, ids, busy_flag, NULL)) {
5549                 return -1;
5550         }
5551         ret = nrcards;
5552 @@ -1785,7 +1835,7 @@
5553         cards[i].protocol = protocol;
5554         sprintf(id, "%s%d", name, i);
5555         nrcards++;
5556 -       retval = checkcard(i, id, 0);
5557 +       retval = checkcard(i, id, 0, NULL);
5558         if (retval == 0) { // yuck
5559                 cards[i].typ = 0;
5560                 nrcards--;
5561 @@ -2117,9 +2167,6 @@
5562         {PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA20,     PCI_ANY_ID, PCI_ANY_ID},
5563         {PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA20_U,   PCI_ANY_ID, PCI_ANY_ID},
5564         {PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA201,    PCI_ANY_ID, PCI_ANY_ID},
5565 -//#########################################################################################    
5566 -       {PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA202,    PCI_ANY_ID, PCI_ANY_ID},
5567 -//#########################################################################################    
5568  #endif
5569  #ifdef CONFIG_HISAX_ELSA
5570         {PCI_VENDOR_ID_ELSA,     PCI_DEVICE_ID_ELSA_MICROLINK,   PCI_ANY_ID, PCI_ANY_ID},
5571 @@ -2178,11 +2225,3 @@
5572  
5573  module_init(HiSax_init);
5574  module_exit(HiSax_exit);
5575 -
5576 -EXPORT_SYMBOL(FsmNew);
5577 -EXPORT_SYMBOL(FsmFree);
5578 -EXPORT_SYMBOL(FsmEvent);
5579 -EXPORT_SYMBOL(FsmChangeState);
5580 -EXPORT_SYMBOL(FsmInitTimer);
5581 -EXPORT_SYMBOL(FsmDelTimer);
5582 -EXPORT_SYMBOL(FsmRestartTimer);
5583 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/diva.c linux-2.4.29/drivers/isdn/hisax/diva.c
5584 --- linux-2.4.29.old/drivers/isdn/hisax/diva.c  2005-03-22 14:47:56.000000000 +0100
5585 +++ linux-2.4.29/drivers/isdn/hisax/diva.c      2005-03-22 15:06:46.106083592 +0100
5586 @@ -1,4 +1,4 @@
5587 -/* $Id: diva.c,v 1.1.4.2 2002/08/30 11:21:00 keil Exp $
5588 +/* $Id: diva.c,v 1.33 2001/09/24 13:22:56 kai Exp $
5589   *
5590   * low level stuff for Eicon.Diehl Diva Family ISDN cards
5591   *
5592 @@ -22,14 +22,13 @@
5593  #include "isac.h"
5594  #include "hscx.h"
5595  #include "ipac.h"
5596 -#include "ipacx.h"
5597  #include "isdnl1.h"
5598  #include <linux/pci.h>
5599 -#include <linux/isapnp.h>
5600 +#include <linux/isdn_compat.h>
5601  
5602  extern const char *CardType[];
5603  
5604 -const char *Diva_revision = "$Revision: 1.1.4.2 $";
5605 +const char *Diva_revision = "$Revision: 1.33 $";
5606  
5607  #define byteout(addr,val) outb(val,addr)
5608  #define bytein(addr) inb(addr)
5609 @@ -51,7 +50,6 @@
5610  #define DIVA_PCI       2
5611  #define DIVA_IPAC_ISA  3
5612  #define DIVA_IPAC_PCI  4
5613 -#define DIVA_IPACX_PCI 5
5614  
5615  /* CTRL (Read) */
5616  #define DIVA_IRQ_STAT  0x01
5617 @@ -71,12 +69,10 @@
5618  #define PITA_MISC_REG          0x1c
5619  #ifdef __BIG_ENDIAN
5620  #define PITA_PARA_SOFTRESET    0x00000001
5621 -#define PITA_SER_SOFTRESET     0x00000002
5622  #define PITA_PARA_MPX_MODE     0x00000004
5623  #define PITA_INT0_ENABLE       0x00000200
5624  #else
5625  #define PITA_PARA_SOFTRESET    0x01000000
5626 -#define PITA_SER_SOFTRESET     0x02000000
5627  #define PITA_PARA_MPX_MODE     0x04000000
5628  #define PITA_INT0_ENABLE       0x00020000
5629  #endif
5630 @@ -244,47 +240,6 @@
5631         memwritereg(cs->hw.diva.cfg_reg, offset + (hscx ? 0x40 : 0), value);
5632  }
5633  
5634 -/* IO-Functions for IPACX type cards */
5635 -static u_char
5636 -MemReadISAC_IPACX(struct IsdnCardState *cs, u_char offset)
5637 -{
5638 -       return (memreadreg(cs->hw.diva.cfg_reg, offset));
5639 -}
5640 -
5641 -static void
5642 -MemWriteISAC_IPACX(struct IsdnCardState *cs, u_char offset, u_char value)
5643 -{
5644 -       memwritereg(cs->hw.diva.cfg_reg, offset, value);
5645 -}
5646 -
5647 -static void
5648 -MemReadISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size)
5649 -{
5650 -       while(size--)
5651 -               *data++ = memreadreg(cs->hw.diva.cfg_reg, 0);
5652 -}
5653 -
5654 -static void
5655 -MemWriteISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size)
5656 -{
5657 -       while(size--)
5658 -               memwritereg(cs->hw.diva.cfg_reg, 0, *data++);
5659 -}
5660 -
5661 -static u_char
5662 -MemReadHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset)
5663 -{
5664 -       return(memreadreg(cs->hw.diva.cfg_reg, offset + 
5665 -                    (hscx ? IPACX_OFF_B2 : IPACX_OFF_B1)));
5666 -}
5667 -
5668 -static void
5669 -MemWriteHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value)
5670 -{
5671 -       memwritereg(cs->hw.diva.cfg_reg, offset + 
5672 -              (hscx ? IPACX_OFF_B2 : IPACX_OFF_B1), value);
5673 -}
5674 -
5675  /*
5676   * fast interrupt HSCX stuff goes here
5677   */
5678 @@ -595,7 +550,7 @@
5679         u_char exval;
5680         struct BCState *bcs;
5681  
5682 -       if (val & 0x01) { // EXB
5683 +       if (val & 0x01) {
5684                 bcs = cs->bcs + 1;
5685                 exval = MemReadHSCX(cs, 1, HSCX_EXIR);
5686                 if (exval & 0x40) {
5687 @@ -622,7 +577,7 @@
5688                         debugl1(cs, "HSCX B interrupt %x", val);
5689                 Memhscx_interrupt(cs, val, 1);
5690         }
5691 -       if (val & 0x02) {       // EXA
5692 +       if (val & 0x02) {
5693                 bcs = cs->bcs;
5694                 exval = MemReadHSCX(cs, 0, HSCX_EXIR);
5695                 if (exval & 0x40) {
5696 @@ -644,7 +599,7 @@
5697                 } else if (cs->debug & L1_DEB_HSCX)
5698                         debugl1(cs, "HSCX A EXIR %x", exval);
5699         }
5700 -       if (val & 0x04) {       // ICA
5701 +       if (val & 0x04) {
5702                 exval = MemReadHSCX(cs, 0, HSCX_ISTA);
5703                 if (cs->debug & L1_DEB_HSCX)
5704                         debugl1(cs, "HSCX A interrupt %x", exval);
5705 @@ -705,31 +660,12 @@
5706         memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xC0);
5707  }
5708  
5709 -static void
5710 -diva_irq_ipacx_pci(int intno, void *dev_id, struct pt_regs *regs)
5711 -{
5712 -       struct IsdnCardState *cs = dev_id;
5713 -       u_char val;
5714 -       u_char *cfg;
5715 -
5716 -       if (!cs) {
5717 -               printk(KERN_WARNING "Diva: Spurious interrupt!\n");
5718 -               return;
5719 -       }
5720 -       cfg = (u_char *) cs->hw.diva.pci_cfg;
5721 -       val = *cfg;
5722 -       if (!(val &PITA_INT0_STATUS)) return; // other shared IRQ
5723 -  interrupt_ipacx(cs);      // handler for chip
5724 -       *cfg = PITA_INT0_STATUS;  // Reset PLX interrupt
5725 -}
5726 -
5727  void
5728  release_io_diva(struct IsdnCardState *cs)
5729  {
5730         int bytecnt;
5731  
5732 -       if ((cs->subtyp == DIVA_IPAC_PCI) || 
5733 -           (cs->subtyp == DIVA_IPACX_PCI)   ) {
5734 +       if (cs->subtyp == DIVA_IPAC_PCI) {
5735                 u_int *cfg = (unsigned int *)cs->hw.diva.pci_cfg;
5736  
5737                 *cfg = 0; /* disable INT0/1 */ 
5738 @@ -776,16 +712,6 @@
5739                 set_current_state(TASK_UNINTERRUPTIBLE);
5740                 schedule_timeout((10*HZ)/1000);
5741                 memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xc0);
5742 -       } else if (cs->subtyp == DIVA_IPACX_PCI) {
5743 -               unsigned int *ireg = (unsigned int *)(cs->hw.diva.pci_cfg +
5744 -                                       PITA_MISC_REG);
5745 -               *ireg = PITA_PARA_SOFTRESET | PITA_PARA_MPX_MODE;
5746 -               set_current_state(TASK_UNINTERRUPTIBLE);
5747 -               schedule_timeout((10*HZ)/1000);
5748 -               *ireg = PITA_PARA_MPX_MODE | PITA_SER_SOFTRESET;
5749 -               set_current_state(TASK_UNINTERRUPTIBLE);
5750 -               schedule_timeout((10*HZ)/1000);
5751 -               MemWriteISAC_IPACX(cs, IPACX_MASK, 0xff); // Interrupts off
5752         } else { /* DIVA 2.0 */
5753                 cs->hw.diva.ctrl_reg = 0;        /* Reset On */
5754                 byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
5755 @@ -814,9 +740,7 @@
5756  {
5757         int blink = 0;
5758  
5759 -       if ((cs->subtyp == DIVA_IPAC_ISA) ||
5760 -           (cs->subtyp == DIVA_IPAC_PCI) ||
5761 -           (cs->subtyp == DIVA_IPACX_PCI)   )
5762 +       if ((cs->subtyp == DIVA_IPAC_ISA) || (cs->subtyp == DIVA_IPAC_PCI))
5763                 return;
5764         del_timer(&cs->hw.diva.tl);
5765         if (cs->hw.diva.status & DIVA_ASSIGN)
5766 @@ -859,12 +783,6 @@
5767                         release_io_diva(cs);
5768                         return(0);
5769                 case CARD_INIT:
5770 -                       if (cs->subtyp == DIVA_IPACX_PCI) {
5771 -                               ireg = (unsigned int *)cs->hw.diva.pci_cfg;
5772 -                               *ireg = PITA_INT0_ENABLE;
5773 -                         init_ipacx(cs, 3); // init chip and enable interrupts
5774 -        return (0);
5775 -                       }
5776                         if (cs->subtyp == DIVA_IPAC_PCI) {
5777                                 ireg = (unsigned int *)cs->hw.diva.pci_cfg;
5778                                 *ireg = PITA_INT0_ENABLE;
5779 @@ -901,9 +819,7 @@
5780                         }
5781                         break;
5782         }
5783 -       if ((cs->subtyp != DIVA_IPAC_ISA) && 
5784 -           (cs->subtyp != DIVA_IPAC_PCI) &&
5785 -           (cs->subtyp != DIVA_IPACX_PCI)   )
5786 +       if ((cs->subtyp != DIVA_IPAC_ISA) && (cs->subtyp != DIVA_IPAC_PCI))
5787                 diva_led_handler(cs);
5788         return(0);
5789  }
5790 @@ -911,40 +827,11 @@
5791  static struct pci_dev *dev_diva __initdata = NULL;
5792  static struct pci_dev *dev_diva_u __initdata = NULL;
5793  static struct pci_dev *dev_diva201 __initdata = NULL;
5794 -static struct pci_dev *dev_diva202 __initdata = NULL;
5795 -
5796 -#ifdef __ISAPNP__
5797 -static struct isapnp_device_id diva_ids[] __initdata = {
5798 -       { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
5799 -         ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), 
5800 -         (unsigned long) "Diva picola" },
5801 -       { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
5802 -         ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x51), 
5803 -         (unsigned long) "Diva picola" },
5804 -       { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
5805 -         ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71), 
5806 -         (unsigned long) "Diva 2.0" },
5807 -       { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
5808 -         ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x71), 
5809 -         (unsigned long) "Diva 2.0" },
5810 -       { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
5811 -         ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1), 
5812 -         (unsigned long) "Diva 2.01" },
5813 -       { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
5814 -         ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0xA1), 
5815 -         (unsigned long) "Diva 2.01" },
5816 -       { 0, }
5817 -};
5818 -
5819 -static struct isapnp_device_id *pdev = &diva_ids[0];
5820 -static struct pci_bus *pnp_c __devinitdata = NULL;
5821 -#endif
5822 -
5823  
5824  int __init
5825  setup_diva(struct IsdnCard *card)
5826  {
5827 -       int bytecnt = 8;
5828 +       int bytecnt;
5829         u_char val;
5830         struct IsdnCardState *cs = card->cs;
5831         char tmp[64];
5832 @@ -977,75 +864,8 @@
5833                         cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
5834                 }
5835                 cs->irq = card->para[0];
5836 +               bytecnt = 8;
5837         } else {
5838 -#ifdef __ISAPNP__
5839 -               if (isapnp_present()) {
5840 -                       struct pci_bus *pb;
5841 -                       struct pci_dev *pd;
5842 -
5843 -                       while(pdev->card_vendor) {
5844 -                               if ((pb = isapnp_find_card(pdev->card_vendor,
5845 -                                       pdev->card_device, pnp_c))) {
5846 -                                       pnp_c = pb;
5847 -                                       pd = NULL;
5848 -                                       if ((pd = isapnp_find_dev(pnp_c,
5849 -                                               pdev->vendor, pdev->function, pd))) {
5850 -                                               printk(KERN_INFO "HiSax: %s detected\n",
5851 -                                                       (char *)pdev->driver_data);
5852 -                                               pd->prepare(pd);
5853 -                                               pd->deactivate(pd);
5854 -                                               pd->activate(pd);
5855 -                                               card->para[1] =
5856 -                                                       pd->resource[0].start;
5857 -                                               card->para[0] =
5858 -                                                       pd->irq_resource[0].start;
5859 -                                               if (!card->para[0] || !card->para[1]) {
5860 -                                                       printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
5861 -                                                               card->para[0], card->para[1]);
5862 -                                                       pd->deactivate(pd);
5863 -                                                       return(0);
5864 -                                               }
5865 -                                               cs->hw.diva.cfg_reg  = card->para[1];
5866 -                                               cs->irq = card->para[0];
5867 -                                               if (pdev->function == ISAPNP_FUNCTION(0xA1)) {
5868 -                                                       cs->subtyp = DIVA_IPAC_ISA;
5869 -                                                       cs->hw.diva.ctrl = 0;
5870 -                                                       cs->hw.diva.isac =
5871 -                                                               card->para[1] + DIVA_IPAC_DATA;
5872 -                                                       cs->hw.diva.hscx =
5873 -                                                               card->para[1] + DIVA_IPAC_DATA;
5874 -                                                       cs->hw.diva.isac_adr =
5875 -                                                               card->para[1] + DIVA_IPAC_ADR;
5876 -                                                       cs->hw.diva.hscx_adr =
5877 -                                                               card->para[1] + DIVA_IPAC_ADR;
5878 -                                                       test_and_set_bit(HW_IPAC, &cs->HW_Flags);
5879 -                                               } else {
5880 -                                                       cs->subtyp = DIVA_ISA;
5881 -                                                       cs->hw.diva.ctrl =
5882 -                                                               card->para[1] + DIVA_ISA_CTRL;
5883 -                                                       cs->hw.diva.isac =
5884 -                                                               card->para[1] + DIVA_ISA_ISAC_DATA;
5885 -                                                       cs->hw.diva.hscx =
5886 -                                                               card->para[1] + DIVA_HSCX_DATA;
5887 -                                                       cs->hw.diva.isac_adr =
5888 -                                                               card->para[1] + DIVA_ISA_ISAC_ADR;
5889 -                                                       cs->hw.diva.hscx_adr =
5890 -                                                               card->para[1] + DIVA_HSCX_ADR;
5891 -                                               }
5892 -                                               goto ready;
5893 -                                       } else {
5894 -                                               printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
5895 -                                               return(0);
5896 -                                       }
5897 -                               }
5898 -                               pdev++;
5899 -                               pnp_c=NULL;
5900 -                       } 
5901 -                       if (!pdev->card_vendor) {
5902 -                               printk(KERN_INFO "Diva PnP: no ISAPnP card found\n");
5903 -                       }
5904 -               }
5905 -#endif
5906  #if CONFIG_PCI
5907                 if (!pci_present()) {
5908                         printk(KERN_ERR "Diva: no PCI bus present\n");
5909 @@ -1059,14 +879,14 @@
5910                                 return(0);
5911                         cs->subtyp = DIVA_PCI;
5912                         cs->irq = dev_diva->irq;
5913 -                       cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
5914 +                       cs->hw.diva.cfg_reg = pci_resource_start_io(dev_diva, 2);
5915                 } else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON,
5916                         PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) {
5917                         if (pci_enable_device(dev_diva_u))
5918                                 return(0);
5919                         cs->subtyp = DIVA_PCI;
5920                         cs->irq = dev_diva_u->irq;
5921 -                       cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2);
5922 +                       cs->hw.diva.cfg_reg = pci_resource_start_io(dev_diva_u, 2);
5923                 } else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON,
5924                         PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) {
5925                         if (pci_enable_device(dev_diva201))
5926 @@ -1074,19 +894,9 @@
5927                         cs->subtyp = DIVA_IPAC_PCI;
5928                         cs->irq = dev_diva201->irq;
5929                         cs->hw.diva.pci_cfg =
5930 -                               (ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096);
5931 +                               (ulong) ioremap(pci_resource_start_mem(dev_diva201, 0), 4096);
5932                         cs->hw.diva.cfg_reg =
5933 -                               (ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096);
5934 -               } else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON,
5935 -                       PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) {
5936 -                       if (pci_enable_device(dev_diva202))
5937 -                               return(0);
5938 -                       cs->subtyp = DIVA_IPACX_PCI;
5939 -                       cs->irq = dev_diva202->irq;
5940 -                       cs->hw.diva.pci_cfg =
5941 -                               (ulong) ioremap(pci_resource_start(dev_diva202, 0), 4096);
5942 -                       cs->hw.diva.cfg_reg =
5943 -                               (ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096);
5944 +                               (ulong) ioremap(pci_resource_start_mem(dev_diva201, 1), 4096);
5945                 } else {
5946                         printk(KERN_WARNING "Diva: No PCI card found\n");
5947                         return(0);
5948 @@ -1107,8 +917,7 @@
5949                 printk(KERN_WARNING "Diva: unable to config DIVA PCI\n");
5950                 return (0);
5951  #endif /* CONFIG_PCI */
5952 -               if ((cs->subtyp == DIVA_IPAC_PCI) ||
5953 -                   (cs->subtyp == DIVA_IPACX_PCI)   ) {
5954 +               if (cs->subtyp == DIVA_IPAC_PCI) {
5955                         cs->hw.diva.ctrl = 0;
5956                         cs->hw.diva.isac = 0;
5957                         cs->hw.diva.hscx = 0;
5958 @@ -1125,23 +934,18 @@
5959                         bytecnt = 32;
5960                 }
5961         }
5962 -ready:
5963 +
5964         printk(KERN_INFO
5965                 "Diva: %s card configured at %#lx IRQ %d\n",
5966                 (cs->subtyp == DIVA_PCI) ? "PCI" :
5967                 (cs->subtyp == DIVA_ISA) ? "ISA" : 
5968 -               (cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" :
5969 -               (cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
5970 +               (cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" : "IPAC PCI",
5971                 cs->hw.diva.cfg_reg, cs->irq);
5972 -       if ((cs->subtyp == DIVA_IPAC_PCI)  || 
5973 -           (cs->subtyp == DIVA_IPACX_PCI) || 
5974 -           (cs->subtyp == DIVA_PCI)         )
5975 -               printk(KERN_INFO "Diva: %s space at %#lx\n",
5976 -                       (cs->subtyp == DIVA_PCI) ? "PCI" :
5977 -                       (cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
5978 +       if ((cs->subtyp == DIVA_IPAC_PCI) || (cs->subtyp == DIVA_PCI))
5979 +               printk(KERN_INFO "Diva: %s PCI space at %#lx\n",
5980 +                       (cs->subtyp == DIVA_PCI) ? "PCI" : "IPAC PCI",
5981                         cs->hw.diva.pci_cfg);
5982 -       if ((cs->subtyp != DIVA_IPAC_PCI) &&
5983 -           (cs->subtyp != DIVA_IPACX_PCI)   ) {
5984 +       if (cs->subtyp != DIVA_IPAC_PCI) {
5985                 if (check_region(cs->hw.diva.cfg_reg, bytecnt)) {
5986                         printk(KERN_WARNING
5987                                "HiSax: %s config port %lx-%lx already in use\n",
5988 @@ -1177,17 +981,6 @@
5989                 cs->irq_func = &diva_irq_ipac_pci;
5990                 val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
5991                 printk(KERN_INFO "Diva: IPAC version %x\n", val);
5992 -       } else if (cs->subtyp == DIVA_IPACX_PCI) {
5993 -               cs->readisac  = &MemReadISAC_IPACX;
5994 -               cs->writeisac = &MemWriteISAC_IPACX;
5995 -               cs->readisacfifo  = &MemReadISACfifo_IPACX;
5996 -               cs->writeisacfifo = &MemWriteISACfifo_IPACX;
5997 -               cs->BC_Read_Reg  = &MemReadHSCX_IPACX;
5998 -               cs->BC_Write_Reg = &MemWriteHSCX_IPACX;
5999 -               cs->BC_Send_Data = 0; // function located in ipacx module
6000 -               cs->irq_func = &diva_irq_ipacx_pci;
6001 -               printk(KERN_INFO "Diva: IPACX Design Id: %x\n", 
6002 -            MemReadISAC_IPACX(cs, IPACX_ID) &0x3F);
6003         } else { /* DIVA 2.0 */
6004                 cs->hw.diva.tl.function = (void *) diva_led_handler;
6005                 cs->hw.diva.tl.data = (long) cs;
6006 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/elsa.c linux-2.4.29/drivers/isdn/hisax/elsa.c
6007 --- linux-2.4.29.old/drivers/isdn/hisax/elsa.c  2005-03-22 14:47:56.000000000 +0100
6008 +++ linux-2.4.29/drivers/isdn/hisax/elsa.c      2005-03-22 15:06:46.123081008 +0100
6009 @@ -1,4 +1,4 @@
6010 -/* $Id: elsa.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6011 +/* $Id: elsa.c,v 2.32 2001/09/24 13:22:56 kai Exp $
6012   *
6013   * low level stuff for Elsa isdn cards
6014   *
6015 @@ -28,13 +28,13 @@
6016  #include "hscx.h"
6017  #include "isdnl1.h"
6018  #include <linux/pci.h>
6019 -#include <linux/isapnp.h>
6020 +#include <linux/isdn_compat.h>
6021  #include <linux/serial.h>
6022  #include <linux/serial_reg.h>
6023  
6024  extern const char *CardType[];
6025  
6026 -const char *Elsa_revision = "$Revision: 1.1.4.1 $";
6027 +const char *Elsa_revision = "$Revision: 2.32 $";
6028  const char *Elsa_Types[] =
6029  {"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
6030   "PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI", 
6031 @@ -864,21 +864,6 @@
6032  static         struct pci_dev *dev_qs1000 __devinitdata = NULL;
6033  static         struct pci_dev *dev_qs3000 __devinitdata = NULL;
6034  
6035 -#ifdef __ISAPNP__
6036 -static struct isapnp_device_id elsa_ids[] __initdata = {
6037 -       { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
6038 -         ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133), 
6039 -         (unsigned long) "Elsa QS1000" },
6040 -       { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
6041 -         ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134), 
6042 -         (unsigned long) "Elsa QS3000" },
6043 -       { 0, }
6044 -};
6045 -
6046 -static struct isapnp_device_id *pdev = &elsa_ids[0];
6047 -static struct pci_bus *pnp_c __devinitdata = NULL;
6048 -#endif
6049 -
6050  int __devinit
6051  setup_elsa(struct IsdnCard *card)
6052  {
6053 @@ -893,7 +878,6 @@
6054         cs->hw.elsa.ctrl_reg = 0;
6055         cs->hw.elsa.status = 0;
6056         cs->hw.elsa.MFlag = 0;
6057 -       cs->subtyp = 0;
6058         if (cs->typ == ISDN_CTYPE_ELSA) {
6059                 cs->hw.elsa.base = card->para[0];
6060                 printk(KERN_INFO "Elsa: Microlink IO probing\n");
6061 @@ -955,60 +939,9 @@
6062                         return (0);
6063                 }
6064         } else if (cs->typ == ISDN_CTYPE_ELSA_PNP) {
6065 -#ifdef __ISAPNP__
6066 -               if (!card->para[1] && isapnp_present()) {
6067 -                       struct pci_bus *pb;
6068 -                       struct pci_dev *pd;
6069 -
6070 -                       while(pdev->card_vendor) {
6071 -                               if ((pb = isapnp_find_card(pdev->card_vendor,
6072 -                                       pdev->card_device, pnp_c))) {
6073 -                                       pnp_c = pb;
6074 -                                       pd = NULL;
6075 -                                       if ((pd = isapnp_find_dev(pnp_c,
6076 -                                               pdev->vendor, pdev->function, pd))) {
6077 -                                               printk(KERN_INFO "HiSax: %s detected\n",
6078 -                                                       (char *)pdev->driver_data);
6079 -                                               pd->prepare(pd);
6080 -                                               pd->deactivate(pd);
6081 -                                               pd->activate(pd);
6082 -                                               card->para[1] =
6083 -                                                       pd->resource[0].start;
6084 -                                               card->para[0] =
6085 -                                                       pd->irq_resource[0].start;
6086 -                                               if (!card->para[0] || !card->para[1]) {
6087 -                                                       printk(KERN_ERR "Elsa PnP:some resources are missing %ld/%lx\n",
6088 -                                                               card->para[0], card->para[1]);
6089 -                                                       pd->deactivate(pd);
6090 -                                                       return(0);
6091 -                                               }
6092 -                                               if (pdev->function == ISAPNP_FUNCTION(0x133))
6093 -                                                       cs->subtyp = ELSA_QS1000;
6094 -                                               else
6095 -                                                       cs->subtyp = ELSA_QS3000;
6096 -                                               break;
6097 -                                       } else {
6098 -                                               printk(KERN_ERR "Elsa PnP: PnP error card found, no device\n");
6099 -                                               return(0);
6100 -                                       }
6101 -                               }
6102 -                               pdev++;
6103 -                               pnp_c=NULL;
6104 -                       } 
6105 -                       if (!pdev->card_vendor) {
6106 -                               printk(KERN_INFO "Elsa PnP: no ISAPnP card found\n");
6107 -                               return(0);
6108 -                       }
6109 -               }
6110 -#endif
6111 -               if (card->para[1] && card->para[0]) { 
6112 -                       cs->hw.elsa.base = card->para[1];
6113 -                       cs->irq = card->para[0];
6114 -                       if (!cs->subtyp)
6115 -                               cs->subtyp = ELSA_QS1000;
6116 -               } else {
6117 -                       printk(KERN_ERR "Elsa PnP: no parameter\n");
6118 -               }
6119 +               cs->hw.elsa.base = card->para[1];
6120 +               cs->irq = card->para[0];
6121 +               cs->subtyp = ELSA_QS1000;
6122                 cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG;
6123                 cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE;
6124                 cs->hw.elsa.isac = cs->hw.elsa.base + ELSA_ISAC;
6125 @@ -1058,16 +991,16 @@
6126                                 return(0);
6127                         cs->subtyp = ELSA_QS1000PCI;
6128                         cs->irq = dev_qs1000->irq;
6129 -                       cs->hw.elsa.cfg = pci_resource_start(dev_qs1000, 1);
6130 -                       cs->hw.elsa.base = pci_resource_start(dev_qs1000, 3);
6131 +                       cs->hw.elsa.cfg = pci_resource_start_io(dev_qs1000, 1);
6132 +                       cs->hw.elsa.base = pci_resource_start_io(dev_qs1000, 3);
6133                 } else if ((dev_qs3000 = pci_find_device(PCI_VENDOR_ID_ELSA,
6134                         PCI_DEVICE_ID_ELSA_QS3000, dev_qs3000))) {
6135                         if (pci_enable_device(dev_qs3000))
6136                                 return(0);
6137                         cs->subtyp = ELSA_QS3000PCI;
6138                         cs->irq = dev_qs3000->irq;
6139 -                       cs->hw.elsa.cfg = pci_resource_start(dev_qs3000, 1);
6140 -                       cs->hw.elsa.base = pci_resource_start(dev_qs3000, 3);
6141 +                       cs->hw.elsa.cfg = pci_resource_start_io(dev_qs3000, 1);
6142 +                       cs->hw.elsa.base = pci_resource_start_io(dev_qs3000, 3);
6143                 } else {
6144                         printk(KERN_WARNING "Elsa: No PCI card found\n");
6145                         return(0);
6146 @@ -1123,7 +1056,6 @@
6147                         break;
6148                 case ELSA_PCFPRO:
6149                 case ELSA_PCF:
6150 -               case ELSA_QS3000:
6151                 case ELSA_QS3000PCI:
6152                         bytecnt = 16;
6153                         break;
6154 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/elsa_cs.c linux-2.4.29/drivers/isdn/hisax/elsa_cs.c
6155 --- linux-2.4.29.old/drivers/isdn/hisax/elsa_cs.c       2005-03-22 14:47:56.000000000 +0100
6156 +++ linux-2.4.29/drivers/isdn/hisax/elsa_cs.c   2005-03-22 15:06:46.138078728 +0100
6157 @@ -72,7 +72,7 @@
6158  MODULE_PARM(pc_debug, "i");
6159  #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
6160  static char *version =
6161 -"elsa_cs.c $Revision: 1.1.4.1 $ $Date: 2001/11/20 14:19:35 $ (K.Lichtenwalder)";
6162 +"elsa_cs.c $Revision: 1.2 $ $Date: 2001/09/24 13:22:56 $ (K.Lichtenwalder)";
6163  #else
6164  #define DEBUG(n, args...)
6165  #endif
6166 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/elsa_ser.c linux-2.4.29/drivers/isdn/hisax/elsa_ser.c
6167 --- linux-2.4.29.old/drivers/isdn/hisax/elsa_ser.c      2005-03-22 14:47:56.000000000 +0100
6168 +++ linux-2.4.29/drivers/isdn/hisax/elsa_ser.c  2005-03-22 15:06:46.158075688 +0100
6169 @@ -1,4 +1,4 @@
6170 -/* $Id: elsa_ser.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6171 +/* $Id: elsa_ser.c,v 2.14 2001/09/24 13:22:56 kai Exp $
6172   *
6173   * stuff for the serial modem on ELSA cards
6174   *
6175 @@ -396,6 +396,74 @@
6176         }
6177  }
6178  
6179 +#if 0
6180 +static inline void check_modem_status(struct IsdnCardState *cs)
6181 +{
6182 +       int     status;
6183 +       struct async_struct *info = cs->hw.elsa.info;
6184 +       struct  async_icount *icount;
6185 +       
6186 +       status = serial_inp(info, UART_MSR);
6187 +
6188 +       if (status & UART_MSR_ANY_DELTA) {
6189 +               icount = &info->state->icount;
6190 +               /* update input line counters */
6191 +               if (status & UART_MSR_TERI)
6192 +                       icount->rng++;
6193 +               if (status & UART_MSR_DDSR)
6194 +                       icount->dsr++;
6195 +               if (status & UART_MSR_DDCD) {
6196 +                       icount->dcd++;
6197 +               }
6198 +               if (status & UART_MSR_DCTS)
6199 +                       icount->cts++;
6200 +//             wake_up(&info->delta_msr_wait);
6201 +       }
6202 +
6203 +       if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
6204 +#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
6205 +               printk("ttys%d CD now %s...", info->line,
6206 +                      (status & UART_MSR_DCD) ? "on" : "off");
6207 +#endif         
6208 +               if (status & UART_MSR_DCD)
6209 +//                     wake_up(&info->open_wait);
6210 +;
6211 +               else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
6212 +                          (info->flags & ASYNC_CALLOUT_NOHUP))) {
6213 +#ifdef SERIAL_DEBUG_OPEN
6214 +                       printk("doing serial hangup...");
6215 +#endif
6216 +                       if (info->tty)
6217 +                               tty_hangup(info->tty);
6218 +               }
6219 +       }
6220 +#if 0
6221 +       if (info->flags & ASYNC_CTS_FLOW) {
6222 +               if (info->tty->hw_stopped) {
6223 +                       if (status & UART_MSR_CTS) {
6224 +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
6225 +                               printk("CTS tx start...");
6226 +#endif
6227 +                               info->tty->hw_stopped = 0;
6228 +                               info->IER |= UART_IER_THRI;
6229 +                               serial_outp(info, UART_IER, info->IER);
6230 +//                             rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
6231 +                               return;
6232 +                       }
6233 +               } else {
6234 +                       if (!(status & UART_MSR_CTS)) {
6235 +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
6236 +                               printk("CTS tx stop...");
6237 +#endif
6238 +                               info->tty->hw_stopped = 1;
6239 +                               info->IER &= ~UART_IER_THRI;
6240 +                               serial_outp(info, UART_IER, info->IER);
6241 +                       }
6242 +               }
6243 +       }
6244 +#endif 0
6245 +}
6246 +#endif
6247  
6248  static void rs_interrupt_elsa(int irq, struct IsdnCardState *cs)
6249  {
6250 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/fsm.c linux-2.4.29/drivers/isdn/hisax/fsm.c
6251 --- linux-2.4.29.old/drivers/isdn/hisax/fsm.c   2005-03-22 14:47:56.000000000 +0100
6252 +++ linux-2.4.29/drivers/isdn/hisax/fsm.c       2005-03-22 15:06:46.174073256 +0100
6253 @@ -1,4 +1,4 @@
6254 -/* $Id: fsm.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6255 +/* $Id$
6256   *
6257   * Finite state machine
6258   *
6259 @@ -21,6 +21,14 @@
6260  
6261  #define FSM_TIMER_DEBUG 0
6262  
6263 +EXPORT_SYMBOL(FsmNew);
6264 +EXPORT_SYMBOL(FsmFree);
6265 +EXPORT_SYMBOL(FsmEvent);
6266 +EXPORT_SYMBOL(FsmChangeState);
6267 +EXPORT_SYMBOL(FsmInitTimer);
6268 +EXPORT_SYMBOL(FsmDelTimer);
6269 +EXPORT_SYMBOL(FsmRestartTimer);
6270 +
6271  int __init
6272  FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
6273  {
6274 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/fsm.h linux-2.4.29/drivers/isdn/hisax/fsm.h
6275 --- linux-2.4.29.old/drivers/isdn/hisax/fsm.h   2005-03-22 14:47:56.000000000 +0100
6276 +++ linux-2.4.29/drivers/isdn/hisax/fsm.h       2005-03-22 15:06:46.189070976 +0100
6277 @@ -1,4 +1,4 @@
6278 -/* $Id: fsm.h,v 1.1.2.1 2001/11/20 14:19:35 kai Exp $
6279 +/* $Id$
6280   *
6281   * Finite state machine
6282   *
6283 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/gazel.c linux-2.4.29/drivers/isdn/hisax/gazel.c
6284 --- linux-2.4.29.old/drivers/isdn/hisax/gazel.c 2005-03-22 14:47:56.000000000 +0100
6285 +++ linux-2.4.29/drivers/isdn/hisax/gazel.c     2005-03-22 15:06:46.205068544 +0100
6286 @@ -1,4 +1,4 @@
6287 -/* $Id: gazel.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6288 +/* $Id: gazel.c,v 2.19 2001/09/24 13:22:56 kai Exp $
6289   *
6290   * low level stuff for Gazel isdn cards
6291   *
6292 @@ -20,9 +20,10 @@
6293  #include "isdnl1.h"
6294  #include "ipac.h"
6295  #include <linux/pci.h>
6296 +#include <linux/isdn_compat.h>
6297  
6298  extern const char *CardType[];
6299 -const char *gazel_revision = "$Revision: 1.1.4.1 $";
6300 +const char *gazel_revision = "$Revision: 2.19 $";
6301  
6302  #define R647      1
6303  #define R685      2
6304 @@ -563,8 +564,8 @@
6305                         if (pci_enable_device(dev_tel))
6306                                 return 1;
6307                         pci_irq = dev_tel->irq;
6308 -                       pci_ioaddr0 = pci_resource_start(dev_tel, 1);
6309 -                       pci_ioaddr1 = pci_resource_start(dev_tel, 2);
6310 +                       pci_ioaddr0 = pci_resource_start_io(dev_tel, 1);
6311 +                       pci_ioaddr1 = pci_resource_start_io(dev_tel, 2);
6312                         found = 1;
6313                 }
6314                 if (found)
6315 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.c linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.c
6316 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.c     2005-03-22 14:47:56.000000000 +0100
6317 +++ linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.c 2005-03-22 15:06:46.221066112 +0100
6318 @@ -1,4 +1,4 @@
6319 -/* $Id: hfc_2bds0.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6320 +/* $Id: hfc_2bds0.c,v 1.18 2001/09/24 13:22:56 kai Exp $
6321   *
6322   * specific routines for CCD's HFC 2BDS0
6323   *
6324 @@ -616,6 +616,17 @@
6325  */
6326         if (!cs)
6327                 return;
6328 +#if 0  
6329 +       if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) {
6330 +               if (cs->debug)
6331 +                       debugl1(cs, "D-Channel Busy cleared");
6332 +               stptr = cs->stlist;
6333 +               while (stptr != NULL) {
6334 +                       stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL);
6335 +                       stptr = stptr->next;
6336 +               }
6337 +       }
6338 +#endif
6339         if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
6340                 switch (cs->dc.hfcd.ph_state) {
6341                         case (0):
6342 @@ -1090,6 +1101,32 @@
6343                         cs->hw.hfcD.mst_m |= HFCD_MASTER;
6344                         cs->writeisac(cs, HFCD_MST_MODE, cs->hw.hfcD.mst_m);
6345                         break;
6346 +#if 0
6347 +               case (HW_TESTLOOP | REQUEST):
6348 +                       u_char val = 0;
6349 +                       if (1 & (int) arg)
6350 +                               val |= 0x0c;
6351 +                       if (2 & (int) arg)
6352 +                               val |= 0x3;
6353 +                       if (test_bit(HW_IOM1, &cs->HW_Flags)) {
6354 +                               /* IOM 1 Mode */
6355 +                               if (!val) {
6356 +                                       cs->writeisac(cs, ISAC_SPCR, 0xa);
6357 +                                       cs->writeisac(cs, ISAC_ADF1, 0x2);
6358 +                               } else {
6359 +                                       cs->writeisac(cs, ISAC_SPCR, val);
6360 +                                       cs->writeisac(cs, ISAC_ADF1, 0xa);
6361 +                               }
6362 +                       } else {
6363 +                               /* IOM 2 Mode */
6364 +                               cs->writeisac(cs, ISAC_SPCR, val);
6365 +                               if (val)
6366 +                                       cs->writeisac(cs, ISAC_ADF1, 0x8);
6367 +                               else
6368 +                                       cs->writeisac(cs, ISAC_ADF1, 0x0);
6369 +                       }
6370 +                       break;
6371 +#endif
6372                 default:
6373                         if (cs->debug & L1_DEB_WARN)
6374                                 debugl1(cs, "hfcd_l1hw unknown pr %4x", pr);
6375 @@ -1106,6 +1143,20 @@
6376  static void
6377  hfc_dbusy_timer(struct IsdnCardState *cs)
6378  {
6379 +#if 0
6380 +       struct PStack *stptr;
6381 +       if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
6382 +               if (cs->debug)
6383 +                       debugl1(cs, "D-Channel Busy");
6384 +               test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags);
6385 +               stptr = cs->stlist;
6386 +               
6387 +               while (stptr != NULL) {
6388 +                       stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL);
6389 +                       stptr = stptr->next;
6390 +               }
6391 +       }
6392 +#endif
6393  }
6394  
6395  unsigned int __init
6396 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.h linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.h
6397 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bds0.h     2005-03-22 14:47:56.000000000 +0100
6398 +++ linux-2.4.29/drivers/isdn/hisax/hfc_2bds0.h 2005-03-22 15:06:46.236063832 +0100
6399 @@ -1,4 +1,4 @@
6400 -/* $Id: hfc_2bds0.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6401 +/* $Id: hfc_2bds0.h,v 1.6 2001/09/24 13:22:56 kai Exp $
6402   *
6403   * specific defines for CCD's HFC 2BDS0
6404   *
6405 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.c linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.c
6406 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.c      2005-03-22 14:47:56.000000000 +0100
6407 +++ linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.c  2005-03-22 15:06:46.272058360 +0100
6408 @@ -1,4 +1,4 @@
6409 -/* $Id: hfc_2bs0.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6410 +/* $Id: hfc_2bs0.c,v 1.20 2001/09/24 13:22:56 kai Exp $
6411   *
6412   * specific routines for CCD's HFC 2BS0
6413   *
6414 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.h linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.h
6415 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_2bs0.h      2005-03-22 14:47:56.000000000 +0100
6416 +++ linux-2.4.29/drivers/isdn/hisax/hfc_2bs0.h  2005-03-22 15:06:46.288055928 +0100
6417 @@ -1,4 +1,4 @@
6418 -/* $Id: hfc_2bs0.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6419 +/* $Id: hfc_2bs0.h,v 1.5 2001/09/24 13:22:56 kai Exp $
6420   *
6421   * specific defines for CCD's HFC 2BS0
6422   *
6423 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.c linux-2.4.29/drivers/isdn/hisax/hfc_pci.c
6424 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.c       2005-03-22 14:47:56.000000000 +0100
6425 +++ linux-2.4.29/drivers/isdn/hisax/hfc_pci.c   2005-03-22 15:06:46.305053344 +0100
6426 @@ -1,4 +1,4 @@
6427 -/* $Id: hfc_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6428 +/* $Id: hfc_pci.c,v 1.48 2001/09/24 13:22:56 kai Exp $
6429   *
6430   * low level driver for CCD´s hfc-pci based cards
6431   *
6432 @@ -22,11 +22,12 @@
6433  #include "hfc_pci.h"
6434  #include "isdnl1.h"
6435  #include <linux/pci.h>
6436 +#include <linux/isdn_compat.h>
6437  #include <linux/interrupt.h>
6438  
6439  extern const char *CardType[];
6440  
6441 -static const char *hfcpci_revision = "$Revision: 1.1.4.1 $";
6442 +static const char *hfcpci_revision = "$Revision: 1.48 $";
6443  
6444  /* table entry in the PCI devices list */
6445  typedef struct {
6446 @@ -76,8 +77,6 @@
6447  {
6448         unsigned long flags;
6449  
6450 -       printk(KERN_INFO "HiSax: release hfcpci at %p\n",
6451 -               cs->hw.hfcpci.pci_io);
6452         save_flags(flags);
6453         cli();
6454         cs->hw.hfcpci.int_m2 = 0;       /* interrupt output off ! */
6455 @@ -88,11 +87,13 @@
6456         set_current_state(TASK_UNINTERRUPTIBLE);
6457         schedule_timeout((30 * HZ) / 1000);     /* Timeout 30ms */
6458         Write_hfc(cs, HFCPCI_CIRM, 0);  /* Reset Off */
6459 +#if CONFIG_PCI
6460         pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, 0);  /* disable memory mapped ports + busmaster */
6461 +#endif                         /* CONFIG_PCI */
6462         del_timer(&cs->hw.hfcpci.timer);
6463         kfree(cs->hw.hfcpci.share_start);
6464         cs->hw.hfcpci.share_start = NULL;
6465 -       iounmap((void *)cs->hw.hfcpci.pci_io);
6466 +       vfree(cs->hw.hfcpci.pci_io);
6467  }
6468  
6469  /********************************************************************************/
6470 @@ -687,10 +688,6 @@
6471                                 debugl1(cs, "hfcpci_fill_fifo_trans %d frame length %d discarded",
6472                                         bcs->channel, bcs->tx_skb->len);
6473  
6474 -                       if (bcs->st->lli.l1writewakeup &&
6475 -                           (PACKET_NOACK != bcs->tx_skb->pkt_type))
6476 -                               bcs->st->lli.l1writewakeup(bcs->st, bcs->tx_skb->len);
6477 -
6478                         dev_kfree_skb_any(bcs->tx_skb);
6479                         cli();
6480                         bcs->tx_skb = skb_dequeue(&bcs->squeue);        /* fetch next data */
6481 @@ -1146,6 +1143,20 @@
6482  static void
6483  hfcpci_dbusy_timer(struct IsdnCardState *cs)
6484  {
6485 +#if 0
6486 +       struct PStack *stptr;
6487 +       if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
6488 +               if (cs->debug)
6489 +                       debugl1(cs, "D-Channel Busy");
6490 +               test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags);
6491 +               stptr = cs->stlist;
6492 +
6493 +               while (stptr != NULL) {
6494 +                       stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL);
6495 +                       stptr = stptr->next;
6496 +               }
6497 +       }
6498 +#endif
6499  }
6500  
6501  /*************************************/
6502 @@ -1550,6 +1561,17 @@
6503   */
6504         if (!cs)
6505                 return;
6506 +#if 0
6507 +       if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) {
6508 +               if (cs->debug)
6509 +                       debugl1(cs, "D-Channel Busy cleared");
6510 +               stptr = cs->stlist;
6511 +               while (stptr != NULL) {
6512 +                       stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL);
6513 +                       stptr = stptr->next;
6514 +               }
6515 +       }
6516 +#endif
6517         if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
6518                 if (!cs->hw.hfcpci.nt_mode)
6519                         switch (cs->dc.hfcpci.ph_state) {
6520 @@ -1712,7 +1734,7 @@
6521                                 if (pci_enable_device(tmp_hfcpci))
6522                                         continue;
6523                                 pci_set_master(tmp_hfcpci);
6524 -                               if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
6525 +                               if ((card->para[0]) && (card->para[0] != (get_pcibase(tmp_hfcpci, 0) & PCI_BASE_ADDRESS_IO_MASK)))
6526                                         continue;
6527                                 else
6528                                         break;
6529 @@ -1729,7 +1751,7 @@
6530                                 printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n");
6531                                 return (0);
6532                         }
6533 -                       cs->hw.hfcpci.pci_io = (char *) dev_hfcpci->resource[ 1].start;
6534 +                       cs->hw.hfcpci.pci_io = (char *) get_pcibase(dev_hfcpci, 1);
6535                         printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
6536                 } else {
6537                         printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
6538 @@ -1746,7 +1768,7 @@
6539                         printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
6540                         return 0;
6541                 }
6542 -               cs->hw.hfcpci.fifos = (void *)
6543 +               (ulong) cs->hw.hfcpci.fifos =
6544                     (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
6545                 pcibios_write_config_dword(cs->hw.hfcpci.pci_bus,
6546                                        cs->hw.hfcpci.pci_device_fn, 0x80,
6547 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.h linux-2.4.29/drivers/isdn/hisax/hfc_pci.h
6548 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_pci.h       2005-03-22 14:47:56.000000000 +0100
6549 +++ linux-2.4.29/drivers/isdn/hisax/hfc_pci.h   2005-03-22 15:06:46.320051064 +0100
6550 @@ -1,4 +1,4 @@
6551 -/* $Id: hfc_pci.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6552 +/* $Id: hfc_pci.h,v 1.10 2001/09/24 13:22:56 kai Exp $
6553   *
6554   * specific defines for CCD's HFC 2BDS0 PCI chips
6555   *
6556 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.c linux-2.4.29/drivers/isdn/hisax/hfc_sx.c
6557 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.c        2005-03-22 14:47:56.000000000 +0100
6558 +++ linux-2.4.29/drivers/isdn/hisax/hfc_sx.c    2005-03-22 15:06:46.350046504 +0100
6559 @@ -1,4 +1,4 @@
6560 -/* $Id: hfc_sx.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6561 +/* $Id: hfc_sx.c,v 1.12 2001/09/24 13:22:56 kai Exp $
6562   *
6563   * level driver for CCD´s hfc-s+/sp based cards
6564   *
6565 @@ -17,11 +17,10 @@
6566  #include "hfc_sx.h"
6567  #include "isdnl1.h"
6568  #include <linux/interrupt.h>
6569 -#include <linux/isapnp.h>
6570  
6571  extern const char *CardType[];
6572  
6573 -static const char *hfcsx_revision = "$Revision: 1.1.4.1 $";
6574 +static const char *hfcsx_revision = "$Revision: 1.12 $";
6575  
6576  /***************************************/
6577  /* IRQ-table for CCDs demo board       */
6578 @@ -940,6 +939,20 @@
6579  static void
6580  hfcsx_dbusy_timer(struct IsdnCardState *cs)
6581  {
6582 +#if 0
6583 +       struct PStack *stptr;
6584 +       if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) {
6585 +               if (cs->debug)
6586 +                       debugl1(cs, "D-Channel Busy");
6587 +               test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags);
6588 +               stptr = cs->stlist;
6589 +
6590 +               while (stptr != NULL) {
6591 +                       stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL);
6592 +                       stptr = stptr->next;
6593 +               }
6594 +       }
6595 +#endif
6596  }
6597  
6598  /*************************************/
6599 @@ -1333,6 +1346,17 @@
6600   */
6601         if (!cs)
6602                 return;
6603 +#if 0
6604 +       if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) {
6605 +               if (cs->debug)
6606 +                       debugl1(cs, "D-Channel Busy cleared");
6607 +               stptr = cs->stlist;
6608 +               while (stptr != NULL) {
6609 +                       stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL);
6610 +                       stptr = stptr->next;
6611 +               }
6612 +       }
6613 +#endif
6614         if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
6615                 if (!cs->hw.hfcsx.nt_mode)
6616                         switch (cs->dc.hfcsx.ph_state) {
6617 @@ -1461,17 +1485,7 @@
6618         return (0);
6619  }
6620  
6621 -#ifdef __ISAPNP__
6622 -static struct isapnp_device_id hfc_ids[] __initdata = {
6623 -       { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620),
6624 -         ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620), 
6625 -         (unsigned long) "Teles 16.3c2" },
6626 -       { 0, }
6627 -};
6628  
6629 -static struct isapnp_device_id *hdev = &hfc_ids[0];
6630 -static struct pci_bus *pnp_c __devinitdata = NULL;
6631 -#endif
6632  
6633  int __devinit
6634  setup_hfcsx(struct IsdnCard *card)
6635 @@ -1482,45 +1496,6 @@
6636  
6637         strcpy(tmp, hfcsx_revision);
6638         printk(KERN_INFO "HiSax: HFC-SX driver Rev. %s\n", HiSax_getrev(tmp));
6639 -#ifdef __ISAPNP__
6640 -       if (!card->para[1] && isapnp_present()) {
6641 -               struct pci_bus *pb;
6642 -               struct pci_dev *pd;
6643 -
6644 -               while(hdev->card_vendor) {
6645 -                       if ((pb = isapnp_find_card(hdev->card_vendor,
6646 -                               hdev->card_device, pnp_c))) {
6647 -                               pnp_c = pb;
6648 -                               pd = NULL;
6649 -                               if ((pd = isapnp_find_dev(pnp_c,
6650 -                                       hdev->vendor, hdev->function, pd))) {
6651 -                                       printk(KERN_INFO "HiSax: %s detected\n",
6652 -                                               (char *)hdev->driver_data);
6653 -                                       pd->prepare(pd);
6654 -                                       pd->deactivate(pd);
6655 -                                       pd->activate(pd);
6656 -                                       card->para[1] = pd->resource[0].start;
6657 -                                       card->para[0] = pd->irq_resource[0].start;
6658 -                                       if (!card->para[0] || !card->para[1]) {
6659 -                                               printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n",
6660 -                                               card->para[0], card->para[1]);
6661 -                                               pd->deactivate(pd);
6662 -                                               return(0);
6663 -                                       }
6664 -                                       break;
6665 -                               } else {
6666 -                                       printk(KERN_ERR "HFC PnP: PnP error card found, no device\n");
6667 -                               }
6668 -                       }
6669 -                       hdev++;
6670 -                       pnp_c=NULL;
6671 -               } 
6672 -               if (!hdev->card_vendor) {
6673 -                       printk(KERN_INFO "HFC PnP: no ISAPnP card found\n");
6674 -                       return(0);
6675 -               }
6676 -       }
6677 -#endif
6678         cs->hw.hfcsx.base = card->para[1] & 0xfffe;
6679         cs->irq = card->para[0];
6680         cs->hw.hfcsx.int_s1 = 0;
6681 @@ -1603,3 +1578,7 @@
6682         cs->auxcmd = &hfcsx_auxcmd;
6683         return (1);
6684  }
6685 +
6686 +
6687 +
6688 +
6689 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.h linux-2.4.29/drivers/isdn/hisax/hfc_sx.h
6690 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_sx.h        2005-03-22 14:47:56.000000000 +0100
6691 +++ linux-2.4.29/drivers/isdn/hisax/hfc_sx.h    2005-03-22 15:06:46.365044224 +0100
6692 @@ -1,4 +1,4 @@
6693 -/* $Id: hfc_sx.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
6694 +/* $Id$
6695   *
6696   * specific defines for CCD's HFC 2BDS0 S+,SP chips
6697   *
6698 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_usb.c linux-2.4.29/drivers/isdn/hisax/hfc_usb.c
6699 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_usb.c       1970-01-01 01:00:00.000000000 +0100
6700 +++ linux-2.4.29/drivers/isdn/hisax/hfc_usb.c   2005-03-22 15:06:46.381041792 +0100
6701 @@ -0,0 +1,1189 @@
6702 +/* $Id: hfc_usb.c,v 2.3 2001/07/06 21:30:11 werner Exp $
6703 + *
6704 + *
6705 + *
6706 + * Author       (C) 2001 Werner Cornelius (werner@isdn-development.de)
6707 + *              modular driver for Colognechip HFC-USB chip
6708 + *              as plugin for HiSax isdn driver
6709 + *              type approval valid for HFC-S USB based TAs
6710 + *
6711 + * Copyright 2001  by Werner Cornelius (werner@isdn-development.de)
6712 + *
6713 + * This program is free software; you can redistribute it and/or modify
6714 + * it under the terms of the GNU General Public License as published by
6715 + * the Free Software Foundation; either version 2, or (at your option)
6716 + * any later version.
6717 + *
6718 + * This program is distributed in the hope that it will be useful,
6719 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6720 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6721 + * GNU General Public License for more details.
6722 + *
6723 + * You should have received a copy of the GNU General Public License
6724 + * along with this program; if not, write to the Free Software
6725 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6726 + *
6727 + */
6728 +
6729 +#include <linux/types.h>
6730 +#include <linux/stddef.h>
6731 +#include <linux/timer.h>
6732 +#include <linux/config.h>
6733 +#include <linux/isdn_compat.h>
6734 +#include <linux/init.h>
6735 +#include "hisax.h"
6736 +#include <linux/module.h>
6737 +#include <linux/kernel_stat.h>
6738 +#include <linux/tqueue.h>
6739 +#include <linux/usb.h>
6740 +#include <linux/kernel.h>
6741 +#include <linux/smp_lock.h>
6742 +#include <linux/sched.h>
6743 +#include "hisax_loadable.h"
6744 +
6745 +#define INCLUDE_INLINE_FUNCS
6746 +
6747 +/***********/
6748 +/* defines */
6749 +/***********/
6750 +#define HFC_CTRL_TIMEOUT 5     /* 5ms timeout writing/reading regs */
6751 +#define HFC_TIMER_T3     7000  /* timeout for l1 activation timer */
6752 +
6753 +#define HFCUSB_L1_STATECHANGE   0      /* L1 state changed */
6754 +#define HFCUSB_L1_DRX           1      /* D-frame received */
6755 +#define HFCUSB_L1_ERX           2      /* E-frame received */
6756 +#define HFCUSB_L1_DTX           4      /* D-frames completed */
6757 +
6758 +#define MAX_BCH_SIZE        2048       /* allowed B-channel packet size */
6759 +
6760 +#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
6761 +#define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
6762 +
6763 +#define HFCUSB_CHIP_ID    0x16 /* Chip ID register index */
6764 +#define HFCUSB_CIRM       0x00 /* cirm register index */
6765 +#define HFCUSB_USB_SIZE   0x07 /* int length register */
6766 +#define HFCUSB_USB_SIZE_I 0x06 /* iso length register */
6767 +#define HFCUSB_F_CROSS    0x0b /* bit order register */
6768 +#define HFCUSB_CLKDEL     0x37 /* bit delay register */
6769 +#define HFCUSB_CON_HDLC   0xfa /* channel connect register */
6770 +#define HFCUSB_HDLC_PAR   0xfb
6771 +#define HFCUSB_SCTRL      0x31 /* S-bus control register (tx) */
6772 +#define HFCUSB_SCTRL_E    0x32 /* same for E and special funcs */
6773 +#define HFCUSB_SCTRL_R    0x33 /* S-bus control register (rx) */
6774 +#define HFCUSB_F_THRES    0x0c /* threshold register */
6775 +#define HFCUSB_FIFO       0x0f /* fifo select register */
6776 +#define HFCUSB_F_USAGE    0x1a /* fifo usage register */
6777 +#define HFCUSB_MST_MODE0  0x14
6778 +#define HFCUSB_MST_MODE1  0x15
6779 +#define HFCUSB_P_DATA     0x1f
6780 +#define HFCUSB_INC_RES_F  0x0e
6781 +#define HFCUSB_STATES     0x30
6782 +
6783 +#define HFCUSB_CHIPID 0x40     /* ID value of HFC-USB */
6784 +
6785 +/******************/
6786 +/* fifo registers */
6787 +/******************/
6788 +#define HFCUSB_NUM_FIFOS   8   /* maximum number of fifos */
6789 +#define HFCUSB_B1_TX       0   /* index for B1 transmit bulk/int */
6790 +#define HFCUSB_B1_RX       1   /* index for B1 receive bulk/int */
6791 +#define HFCUSB_B2_TX       2
6792 +#define HFCUSB_B2_RX       3
6793 +#define HFCUSB_D_TX        4
6794 +#define HFCUSB_D_RX        5
6795 +#define HFCUSB_PCM_TX      6
6796 +#define HFCUSB_PCM_RX      7
6797 +
6798 +/************/
6799 +/* LED mask */
6800 +/************/
6801 +#define LED_DRIVER         0x1
6802 +#define LED_L1             0x2
6803 +#define LED_BCH            0x4
6804 +
6805 +/**********/
6806 +/* macros */
6807 +/**********/
6808 +#define Write_hfc(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),0,0,HFC_CTRL_TIMEOUT)
6809 +#define Read_hfc(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
6810 +
6811 +#ifdef COMPAT_HAS_USB_IDTAB
6812 +/****************************************/
6813 +/* data defining the devices to be used */
6814 +/****************************************/
6815 +static __devinitdata const struct usb_device_id hfc_usb_idtab[3] = {
6816 +       {USB_DEVICE(0x959, 0x2bd0)},    /* Colognechip ROM */
6817 +       {USB_DEVICE(0x7b0, 0x0006)},    /* USB TA 128 */
6818 +       {}                      /* end with an all-zeroes entry */
6819 +};
6820 +#endif
6821 +
6822 +/*************************************************/
6823 +/* entry and size of output/input control buffer */
6824 +/*************************************************/
6825 +#define HFC_CTRL_BUFSIZE 32
6826 +typedef struct {
6827 +       __u8 hfc_reg;           /* register number */
6828 +       __u8 reg_val;           /* value to be written (or read) */
6829 +} ctrl_buft;
6830 +
6831 +/***************************************************************/
6832 +/* structure defining input+output fifos (interrupt/bulk mode) */
6833 +/***************************************************************/
6834 +struct hfcusb_data;            /* forward definition */
6835 +typedef struct {
6836 +       int fifonum;            /* fifo index attached to this structure */
6837 +       __u8 fifo_mask;         /* mask for this fifo */
6838 +       int active;             /* fifo is currently active */
6839 +       struct hfcusb_data *hfc;        /* pointer to main structure */
6840 +       int pipe;               /* address of endpoint */
6841 +       __u8 usb_maxlen;        /* maximum length for usb transfer */
6842 +       int max_size;           /* maximum size of receive/send packet */
6843 +       int transmode;          /* transparent mode selected */
6844 +       int framenum;           /* number of frame when last tx completed */
6845 +       int rx_offset;          /* offset inside rx buffer */
6846 +       int next_complete;      /* complete marker */
6847 +       __u8 *act_ptr;          /* pointer to next data */
6848 +       __u8 intervall;         /* interrupt interval */
6849 +       struct sk_buff *buff;   /* actual used buffer */
6850 +       urb_t urb;              /* transfer structure for usb routines */
6851 +       __u8 buffer[128];       /* buffer incoming/outgoing data */
6852 +} usb_fifo;
6853 +
6854 +/*********************************************/
6855 +/* structure holding all data for one device */
6856 +/*********************************************/
6857 +typedef struct hfcusb_data {
6858 +       struct hisax_drvreg regd;       /* register data and callbacks */
6859 +       struct usb_device *dev; /* our device */
6860 +       int if_used;            /* used interface number */
6861 +       int alt_used;           /* used alternate config */
6862 +       int ctrl_paksize;       /* control pipe packet size */
6863 +       int ctrl_in_pipe, ctrl_out_pipe;        /* handles for control pipe */
6864 +
6865 +       /* control pipe background handling */
6866 +       ctrl_buft ctrl_buff[HFC_CTRL_BUFSIZE];  /* buffer holding queued data */
6867 +       volatile int ctrl_in_idx, ctrl_out_idx, ctrl_cnt;       /* input/output pointer + count */
6868 +       urb_t ctrl_urb;         /* transfer structure for control channel */
6869 +       devrequest ctrl_write;  /* buffer for control write request */
6870 +       devrequest ctrl_read;   /* same for read request */
6871 +
6872 +       volatile __u8 dfifo_fill;       /* value read from tx d-fifo */
6873 +       volatile __u8 active_fifos;     /* fifos currently active as bit mask */
6874 +       volatile __u8 threshold_mask;   /* threshold actually reported */
6875 +       volatile __u8 service_request;  /* fifo needs service from task */
6876 +       volatile __u8 ctrl_fifo;        /* last selected fifo */
6877 +       volatile __u8 bch_enables;      /* or mask for sctrl_r and sctrl register values */
6878 +        volatile __u8 led_req;          /* request status of adapters leds */ 
6879 +        volatile __u8 led_act;          /* active status of adapters leds */ 
6880 +       usb_fifo fifos[HFCUSB_NUM_FIFOS];       /* structure holding all fifo data */
6881 +
6882 +       /* layer 1 activation/deactivation handling */
6883 +       volatile __u8 l1_state; /* actual l1 state */
6884 +       volatile ulong l1_event;        /* event mask */
6885 +       struct tq_struct l1_tq; /* l1 bh structure */
6886 +       struct timer_list t3_timer;     /* timer for activation/deactivation */
6887 +       struct timer_list t4_timer;     /* timer for activation/deactivation */
6888 +} hfcusb_data;
6889 +
6890 +#if 0
6891 +static void
6892 +usb_dump_urb(purb_t purb)
6893 +{
6894 +       printk("urb                   :%p\n", purb);
6895 +       printk("next                  :%p\n", purb->next);
6896 +       printk("dev                   :%p\n", purb->dev);
6897 +       printk("pipe                  :%08X\n", purb->pipe);
6898 +       printk("status                :%d\n", purb->status);
6899 +       printk("transfer_flags        :%08X\n", purb->transfer_flags);
6900 +       printk("transfer_buffer       :%p\n", purb->transfer_buffer);
6901 +       printk("transfer_buffer_length:%d\n",
6902 +              purb->transfer_buffer_length);
6903 +       printk("actual_length         :%d\n", purb->actual_length);
6904 +       printk("setup_packet          :%p\n", purb->setup_packet);
6905 +       printk("start_frame           :%d\n", purb->start_frame);
6906 +       printk("number_of_packets     :%d\n", purb->number_of_packets);
6907 +       printk("interval              :%d\n", purb->interval);
6908 +       printk("error_count           :%d\n", purb->error_count);
6909 +       printk("context               :%p\n", purb->context);
6910 +       printk("complete              :%p\n", purb->complete);
6911 +}
6912 +#endif
6913 +
6914 +/*************************************************************************/
6915 +/* bottom half handler for L1 activation/deactiavtaion + D-chan + E-chan */
6916 +/*************************************************************************/
6917 +static void
6918 +usb_l1d_bh(hfcusb_data * hfc)
6919 +{
6920 +
6921 +       while (hfc->l1_event) {
6922 +               if (test_and_clear_bit
6923 +                   (HFCUSB_L1_STATECHANGE, &hfc->l1_event)) {
6924 +                       if (hfc->l1_state == 7)
6925 +                           hfc->led_req |= LED_L1;
6926 +                       else
6927 +                           hfc->led_req &= ~LED_L1;
6928 +                       if ((hfc->l1_state == 7) ||
6929 +                           (hfc->l1_state == 3))
6930 +                           hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6931 +                                              (hfc->l1_state ==
6932 +                                               7) ? (PH_ACTIVATE |
6933 +                                                     INDICATION)
6934 +                                              : (PH_DEACTIVATE | INDICATION),
6935 +                                              NULL);
6936 +               }
6937 +               if (test_and_clear_bit(HFCUSB_L1_DRX, &hfc->l1_event)) {
6938 +                       hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6939 +                                          PH_DATA | INDICATION,
6940 +                                          (void *) 0);
6941 +               }
6942 +               if (test_and_clear_bit(HFCUSB_L1_ERX, &hfc->l1_event)) {
6943 +                       hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6944 +                                          PH_DATA | INDICATION,
6945 +                                          (void *) 1);
6946 +               }
6947 +               if (test_and_clear_bit(HFCUSB_L1_DTX, &hfc->l1_event)) {
6948 +                       hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
6949 +                                          PH_DATA | CONFIRM, NULL);
6950 +               }
6951 +       }                       /* while */
6952 +}                              /* usb_l1d_bh */
6953 +
6954 +/******************************************************/
6955 +/* start next background transfer for control channel */
6956 +/******************************************************/
6957 +static void
6958 +ctrl_start_transfer(hfcusb_data * hfc)
6959 +{
6960 +
6961 +       if (hfc->ctrl_cnt) {
6962 +               switch (hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg) {
6963 +                       case HFCUSB_F_USAGE:
6964 +                               hfc->ctrl_urb.pipe = hfc->ctrl_in_pipe;
6965 +                               hfc->ctrl_urb.setup_packet =
6966 +                                   (u_char *) & hfc->ctrl_read;
6967 +                               hfc->ctrl_urb.transfer_buffer_length = 1;
6968 +                               hfc->ctrl_read.index =
6969 +                                   hfc->ctrl_buff[hfc->ctrl_out_idx].
6970 +                                   hfc_reg;
6971 +                               hfc->ctrl_urb.transfer_buffer =
6972 +                                   (char *) &hfc->dfifo_fill;
6973 +                               break;
6974 +
6975 +                       default:        /* write register */
6976 +                               hfc->ctrl_urb.pipe = hfc->ctrl_out_pipe;
6977 +                               hfc->ctrl_urb.setup_packet =
6978 +                                   (u_char *) & hfc->ctrl_write;
6979 +                               hfc->ctrl_urb.transfer_buffer = NULL;
6980 +                               hfc->ctrl_urb.transfer_buffer_length = 0;
6981 +                               hfc->ctrl_write.index =
6982 +                                   hfc->ctrl_buff[hfc->ctrl_out_idx].
6983 +                                   hfc_reg;
6984 +                               hfc->ctrl_write.value =
6985 +                                   hfc->ctrl_buff[hfc->ctrl_out_idx].
6986 +                                   reg_val;
6987 +                               break;
6988 +               }
6989 +               usb_submit_urb(&hfc->ctrl_urb); /* start transfer */
6990 +       }
6991 +}                              /* ctrl_start_transfer */
6992 +
6993 +/************************************/
6994 +/* queue a control transfer request */
6995 +/* return 0 on success.             */
6996 +/************************************/
6997 +static int
6998 +queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val)
6999 +{
7000 +       ctrl_buft *buf;
7001 +
7002 +       if (hfc->ctrl_cnt >= HFC_CTRL_BUFSIZE)
7003 +               return (1);     /* no space left */
7004 +       buf = hfc->ctrl_buff + hfc->ctrl_in_idx;        /* pointer to new index */
7005 +       buf->hfc_reg = reg;
7006 +       buf->reg_val = val;
7007 +       if (++hfc->ctrl_in_idx >= HFC_CTRL_BUFSIZE)
7008 +               hfc->ctrl_in_idx = 0;   /* pointer wrap */
7009 +       if (++hfc->ctrl_cnt == 1)
7010 +               ctrl_start_transfer(hfc);
7011 +       return (0);
7012 +}                              /* queue_control_request */
7013 +
7014 +/**************************************/
7015 +/* called when timer t3 or t4 expires */
7016 +/**************************************/
7017 +static void
7018 +l1_timer_expire(hfcusb_data * hfc)
7019 +{
7020 +    if (timer_pending(&hfc->t4_timer))
7021 +       del_timer(&hfc->t4_timer);
7022 +    queue_control_request(hfc, HFCUSB_STATES, 0x40);
7023 +    test_and_set_bit(HFCUSB_L1_STATECHANGE,
7024 +                    &hfc->l1_event);
7025 +    queue_task(&hfc->l1_tq, &tq_immediate);
7026 +    mark_bh(IMMEDIATE_BH);
7027 +} /* l1_timer_expire */
7028 +
7029 +/**************************************************/
7030 +/* (re)fills a tx-fifo urb. Queuing is done later */
7031 +/**************************************************/
7032 +static void
7033 +fill_tx_urb(usb_fifo * fifo)
7034 +{
7035 +       struct sk_buff *skb;
7036 +       long flags;
7037 +       int i, ii = 0;
7038 +
7039 +       fifo->urb.dev = fifo->hfc->dev;
7040 +       if ((fifo->buff)
7041 +           && (fifo->urb.transfer_buffer_length < fifo->usb_maxlen)) {
7042 +               switch (fifo->fifonum) {
7043 +                       case HFCUSB_B1_TX:
7044 +                       case HFCUSB_B2_TX:
7045 +                               skb = fifo->buff;
7046 +                               fifo->buff = NULL;
7047 +                               fifo->hfc->regd.bch_l1l2(fifo->hfc->regd.
7048 +                                                        arg_hisax,
7049 +                                                        (fifo->fifonum ==
7050 +                                                         HFCUSB_B1_TX) ? 0
7051 +                                                        : 1,
7052 +                                                        (PH_DATA |
7053 +                                                         CONFIRM),
7054 +                                                        (void *) skb);
7055 +                               fifo->hfc->service_request |=
7056 +                                   fifo->fifo_mask;
7057 +                               return;
7058 +                       case HFCUSB_D_TX:
7059 +                               dev_kfree_skb_any(fifo->buff);
7060 +                               fifo->buff = NULL;
7061 +                               save_flags(flags);
7062 +                               cli();
7063 +                               fifo->hfc->dfifo_fill = 0xff;   /* currently invalid data */
7064 +                               queue_control_request(fifo->hfc,
7065 +                                                     HFCUSB_FIFO,
7066 +                                                     HFCUSB_D_TX);
7067 +                               queue_control_request(fifo->hfc,
7068 +                                                     HFCUSB_F_USAGE, 0);
7069 +                               restore_flags(flags);
7070 +                               return;
7071 +                       default:
7072 +                               return; /* error, invalid fifo */
7073 +               }
7074 +       }
7075 +
7076 +       /* check if new buffer needed */
7077 +       if (!fifo->buff) {
7078 +               switch (fifo->fifonum) {
7079 +                       case HFCUSB_B1_TX:
7080 +                               if (fifo->hfc->regd.bsk[0])
7081 +                                       fifo->buff = *fifo->hfc->regd.bsk[0];   /* B1-channel tx buffer */
7082 +                               break;
7083 +                       case HFCUSB_B2_TX:
7084 +                               if (fifo->hfc->regd.bsk[1])
7085 +                                       fifo->buff = *fifo->hfc->regd.bsk[1];   /* B2-channel tx buffer */
7086 +                               break;
7087 +                       case HFCUSB_D_TX:
7088 +                               if (fifo->hfc->regd.dsq)
7089 +                                       fifo->buff = skb_dequeue(fifo->hfc->regd.dsq);  /* D-channel tx queue */
7090 +                               break;
7091 +                       default:
7092 +                               return; /* error, invalid fifo */
7093 +               }
7094 +               if (!fifo->buff) {
7095 +                       fifo->active = 0;       /* we are inactive now */
7096 +                       fifo->hfc->active_fifos &= ~fifo->fifo_mask;
7097 +                       if (fifo->fifonum == HFCUSB_D_TX) {
7098 +                               test_and_set_bit(HFCUSB_L1_DTX,
7099 +                                                &fifo->hfc->l1_event);
7100 +                               queue_task(&fifo->hfc->l1_tq,
7101 +                                          &tq_immediate);
7102 +                               mark_bh(IMMEDIATE_BH);
7103 +                       }
7104 +                       return;
7105 +               }
7106 +               fifo->act_ptr = fifo->buff->data;       /* start of data */
7107 +               fifo->active = 1;
7108 +               ii = 1;
7109 +               fifo->hfc->active_fifos |= fifo->fifo_mask;
7110 +               fifo->hfc->service_request &= ~fifo->fifo_mask;
7111 +       }
7112 +       /* fillup the send buffer */
7113 +       i = fifo->buff->len - (fifo->act_ptr - fifo->buff->data);       /* remaining length */
7114 +       fifo->buffer[0] = !fifo->transmode;     /* not eof */
7115 +       if (i > (fifo->usb_maxlen - ii)) {
7116 +               i = fifo->usb_maxlen - ii;
7117 +       }
7118 +       if (i)
7119 +               memcpy(fifo->buffer + ii, fifo->act_ptr, i);
7120 +       fifo->urb.transfer_buffer_length = i + ii;
7121 +        fifo->rx_offset = ii;
7122 +}                              /* fill_tx_urb */
7123 +
7124 +/************************************************/
7125 +/* transmit completion routine for all tx fifos */
7126 +/************************************************/
7127 +static void
7128 +tx_complete(purb_t urb)
7129 +{
7130 +       usb_fifo *fifo = (usb_fifo *) urb->context;     /* pointer to our fifo */
7131 +
7132 +       fifo->hfc->service_request &= ~fifo->fifo_mask; /* no further handling */
7133 +       fifo->framenum = usb_get_current_frame_number(fifo->hfc->dev);
7134 +
7135 +       /* check for deactivation or error */
7136 +       if ((!fifo->active) || (urb->status)) {
7137 +               fifo->hfc->active_fifos &= ~fifo->fifo_mask;    /* we are inactive */
7138 +               fifo->active = 0;
7139 +               if ((fifo->buff) && (fifo->fifonum == HFCUSB_D_TX)) {
7140 +                       dev_kfree_skb_any(fifo->buff);
7141 +               }
7142 +               fifo->buff = NULL;
7143 +               return;
7144 +       }
7145 +       fifo->act_ptr += (urb->transfer_buffer_length - fifo->rx_offset);       /* adjust pointer */
7146 +       fill_tx_urb(fifo);      /* refill the urb */
7147 +       fifo->hfc->threshold_mask |= fifo->fifo_mask;   /* assume threshold reached */
7148 +       if (fifo->buff)
7149 +               fifo->hfc->service_request |= fifo->fifo_mask;  /* need to restart */
7150 +}                              /* tx_complete */
7151 +
7152 +/***********************************************/
7153 +/* receive completion routine for all rx fifos */
7154 +/***********************************************/
7155 +static void
7156 +rx_complete(purb_t urb)
7157 +{
7158 +       usb_fifo *fifo = (usb_fifo *) urb->context;     /* pointer to our fifo */
7159 +       hfcusb_data *hfc = fifo->hfc;
7160 +       usb_fifo *txfifo;
7161 +       __u8 last_state;
7162 +       int i, ii, currcnt, hdlci;
7163 +       struct sk_buff *skb;
7164 +
7165 +       urb->dev = hfc->dev; /* security init */
7166 +       if ((!fifo->active) || (urb->status)) {
7167 +               hfc->service_request &= ~fifo->fifo_mask;       /* no further handling */
7168 +               hfc->active_fifos &= ~fifo->fifo_mask;  /* we are inactive */
7169 +               fifo->urb.interval = 0; /* cancel automatic rescheduling */
7170 +               if (fifo->buff) {
7171 +                       dev_kfree_skb_any(fifo->buff);
7172 +                       fifo->buff = NULL;
7173 +               }
7174 +               return;
7175 +       }
7176 +
7177 +       /* first check for any status changes */
7178 +       if ((urb->actual_length < fifo->rx_offset)
7179 +           || (urb->actual_length > fifo->usb_maxlen))
7180 +               return;         /* error condition */
7181 +
7182 +       if (fifo->rx_offset) {
7183 +               hfc->threshold_mask = fifo->buffer[1];  /* update threshold status */
7184 +               fifo->next_complete = fifo->buffer[0] & 1;
7185 +               if ((fifo->fifonum == HFCUSB_D_RX) &&
7186 +                   (hfc->led_req != hfc->led_act))
7187 +                   queue_control_request(hfc, HFCUSB_P_DATA, hfc->led_req);
7188 +
7189 +               /* check if rescheduling needed */
7190 +               if ((i =
7191 +                    hfc->service_request & hfc->active_fifos & ~hfc->
7192 +                    threshold_mask)) {
7193 +                       currcnt =
7194 +                           usb_get_current_frame_number(hfc->dev);
7195 +                       txfifo = hfc->fifos + HFCUSB_B1_TX;
7196 +                       ii = 3;
7197 +                       while (ii--) {
7198 +                               if ((i & txfifo->fifo_mask)
7199 +                                   && (currcnt != txfifo->framenum)) {
7200 +                                       hfc->service_request &=
7201 +                                           ~txfifo->fifo_mask;
7202 +                                       if (!txfifo->buff)
7203 +                                               fill_tx_urb(txfifo);
7204 +                                       if (txfifo->buff)
7205 +                                               usb_submit_urb(&txfifo->
7206 +                                                              urb);
7207 +                               }
7208 +                               txfifo += 2;
7209 +                       }
7210 +               }
7211 +
7212 +               /* handle l1 events */
7213 +               if ((fifo->buffer[0] >> 4) != hfc->l1_state) {
7214 +                       last_state = hfc->l1_state;
7215 +                       hfc->l1_state = fifo->buffer[0] >> 4;   /* update status */
7216 +                       if (timer_pending(&hfc->t4_timer))
7217 +                           del_timer(&hfc->t4_timer);
7218 +                       if (((hfc->l1_state == 3) && 
7219 +                            ((last_state == 7) || 
7220 +                             (last_state == 8))) || 
7221 +                           ((timer_pending(&hfc->t3_timer) &&
7222 +                           (hfc->l1_state == 8)))) {
7223 +                           hfc->t4_timer.expires = jiffies + 2;
7224 +                           add_timer(&hfc->t4_timer);
7225 +                       } else { 
7226 +                               if (timer_pending(&hfc->t3_timer)
7227 +                                   && (hfc->l1_state == 7))
7228 +                                       del_timer(&hfc->t3_timer);      /* no longer needed */
7229 +                               test_and_set_bit(HFCUSB_L1_STATECHANGE,
7230 +                                                &hfc->l1_event);
7231 +                               queue_task(&hfc->l1_tq, &tq_immediate);
7232 +                               mark_bh(IMMEDIATE_BH);
7233 +                       }
7234 +               }
7235 +       }
7236 +
7237 +       /* check the length for data and move if present */
7238 +       if (fifo->next_complete || (urb->actual_length > fifo->rx_offset)) {
7239 +               i = fifo->buff->len + urb->actual_length - fifo->rx_offset;     /* new total length */
7240 +               hdlci = (fifo->transmode) ? 0 : 3;
7241 +               if (i <= (fifo->max_size + hdlci)) {
7242 +                       memcpy(fifo->act_ptr,
7243 +                              fifo->buffer + fifo->rx_offset,
7244 +                              urb->actual_length - fifo->rx_offset);
7245 +                       fifo->act_ptr +=
7246 +                           (urb->actual_length - fifo->rx_offset);
7247 +                       fifo->buff->len +=
7248 +                           (urb->actual_length - fifo->rx_offset);
7249 +               } else
7250 +                       fifo->buff->len = fifo->max_size + 4;   /* mark frame as to long */
7251 +               if (fifo->next_complete && (urb->actual_length < fifo->usb_maxlen)) {
7252 +                   /* the frame is complete */
7253 +                   fifo->next_complete = 0;
7254 +                   if (((!*(fifo->act_ptr - 1)) || fifo->transmode) &&
7255 +                       (fifo->buff->len >= (hdlci + 1))
7256 +                       && (fifo->buff->len <=
7257 +                           (fifo->max_size + hdlci)) &&
7258 +                       ((skb = dev_alloc_skb(fifo->max_size + hdlci)) != NULL)) {
7259 +                       fifo->buff->len -= hdlci;       /* adjust size */
7260 +                       switch (fifo->fifonum) {
7261 +                           case HFCUSB_D_RX:
7262 +                               skb_queue_tail(hfc->regd.
7263 +                                              drq,
7264 +                                              fifo->buff);
7265 +                               test_and_set_bit
7266 +                                   (HFCUSB_L1_DRX,
7267 +                                    &hfc->l1_event);
7268 +                               queue_task(&hfc->l1_tq,
7269 +                                          &tq_immediate);
7270 +                               mark_bh(IMMEDIATE_BH);
7271 +                               break;
7272 +
7273 +                           case HFCUSB_B1_RX:
7274 +                               if (hfc->regd.brq[0]) {
7275 +                                   skb_queue_tail
7276 +                                       (hfc->regd.
7277 +                                        brq[0],
7278 +                                        fifo->buff);
7279 +                                   hfc->regd.
7280 +                                       bch_l1l2(hfc->
7281 +                                                regd.
7282 +                                                arg_hisax,
7283 +                                                0,
7284 +                                                PH_DATA
7285 +                                                |
7286 +                                                INDICATION,
7287 +                                                (void *)
7288 +                                                fifo->
7289 +                                                buff);
7290 +                               } else
7291 +                                   dev_kfree_skb_any
7292 +                                       (fifo->buff);
7293 +                               break;
7294 +                               
7295 +                           case HFCUSB_B2_RX:
7296 +                               if (hfc->regd.brq[1]) {
7297 +                                   skb_queue_tail
7298 +                                       (hfc->regd.
7299 +                                        brq[1],
7300 +                                        fifo->buff);
7301 +                                   hfc->regd.
7302 +                                       bch_l1l2(hfc->
7303 +                                                regd.
7304 +                                                arg_hisax,
7305 +                                                1,
7306 +                                                PH_DATA
7307 +                                                |
7308 +                                                INDICATION,
7309 +                                                (void
7310 +                                                 *)
7311 +                                                fifo->
7312 +                                                buff);
7313 +                               } else
7314 +                                   dev_kfree_skb_any
7315 +                                       (fifo->buff);
7316 +                               break;
7317 +
7318 +                           case HFCUSB_PCM_RX:
7319 +                               skb_queue_tail(&hfc->regd.
7320 +                                              erq,
7321 +                                              fifo->buff);
7322 +                               test_and_set_bit
7323 +                                   (HFCUSB_L1_ERX,
7324 +                                    &hfc->l1_event);
7325 +                               queue_task(&hfc->l1_tq,
7326 +                                          &tq_immediate);
7327 +                               mark_bh(IMMEDIATE_BH);
7328 +                               break;
7329 +
7330 +                           default:
7331 +                               dev_kfree_skb_any(fifo->
7332 +                                                 buff);
7333 +                               break;
7334 +                       }
7335 +                       fifo->buff = skb;
7336 +                   } 
7337 +                   fifo->buff->len = 0;        /* reset counter */
7338 +                   fifo->act_ptr = fifo->buff->data;   /* and pointer */
7339 +               }
7340 +       }
7341 +       fifo->rx_offset = (urb->actual_length < fifo->usb_maxlen) ? 2 : 0;
7342 +}                              /* rx_complete */
7343 +
7344 +/***************************************************/
7345 +/* start the interrupt transfer for the given fifo */
7346 +/***************************************************/
7347 +static void
7348 +start_rx_fifo(usb_fifo * fifo)
7349 +{
7350 +       if (fifo->buff)
7351 +               return;         /* still active */
7352 +       if (!
7353 +           (fifo->buff =
7354 +            dev_alloc_skb(fifo->max_size + (fifo->transmode ? 0 : 3))))
7355 +               return;
7356 +       fifo->act_ptr = fifo->buff->data;
7357 +       FILL_INT_URB(&fifo->urb, fifo->hfc->dev, fifo->pipe, fifo->buffer,
7358 +                    fifo->usb_maxlen, rx_complete, fifo, fifo->intervall);
7359 +       fifo->next_complete = 0;
7360 +       fifo->rx_offset = 2;
7361 +       fifo->active = 1;       /* must be marked active */
7362 +       fifo->hfc->active_fifos |= fifo->fifo_mask;
7363 +       if (usb_submit_urb(&fifo->urb)) {
7364 +               fifo->active = 0;
7365 +               fifo->hfc->active_fifos &= ~fifo->fifo_mask;
7366 +               dev_kfree_skb_any(fifo->buff);
7367 +               fifo->buff = NULL;
7368 +       }
7369 +}                              /* start_rx_fifo */
7370 +
7371 +/***************************************************************/
7372 +/* control completion routine handling background control cmds */
7373 +/***************************************************************/
7374 +static void
7375 +ctrl_complete(purb_t urb)
7376 +{
7377 +       hfcusb_data *hfc = (hfcusb_data *) urb->context;
7378 +
7379 +       urb->dev = hfc->dev;
7380 +       if (hfc->ctrl_cnt) {
7381 +               switch (hfc->ctrl_buff[hfc->ctrl_out_idx].hfc_reg) {
7382 +                       case HFCUSB_FIFO:
7383 +                               hfc->ctrl_fifo =
7384 +                                   hfc->ctrl_buff[hfc->ctrl_out_idx].
7385 +                                   reg_val;
7386 +                               break;
7387 +                       case HFCUSB_F_USAGE:
7388 +                               if (!hfc->dfifo_fill) {
7389 +                                       fill_tx_urb(hfc->fifos +
7390 +                                                   HFCUSB_D_TX);
7391 +                                       if (hfc->fifos[HFCUSB_D_TX].buff)
7392 +                                               usb_submit_urb(&hfc->
7393 +                                                              fifos
7394 +                                                              [HFCUSB_D_TX].
7395 +                                                              urb);
7396 +                               } else {
7397 +                                       queue_control_request(hfc,
7398 +                                                             HFCUSB_FIFO,
7399 +                                                             HFCUSB_D_TX);
7400 +                                       queue_control_request(hfc,
7401 +                                                             HFCUSB_F_USAGE,
7402 +                                                             0);
7403 +                               }
7404 +                               break;
7405 +                       case HFCUSB_SCTRL_R:
7406 +                               switch (hfc->ctrl_fifo) {
7407 +                                       case HFCUSB_B1_RX:
7408 +                                               if (hfc->bch_enables & 1)
7409 +                                                       start_rx_fifo(hfc->
7410 +                                                                     fifos
7411 +                                                                     +
7412 +                                                                     HFCUSB_B1_RX);
7413 +                                               break;
7414 +                                       case HFCUSB_B2_RX:
7415 +                                               if (hfc->bch_enables & 2)
7416 +                                                       start_rx_fifo(hfc->
7417 +                                                                     fifos
7418 +                                                                     +
7419 +                                                                     HFCUSB_B2_RX);
7420 +                                               break;
7421 +                               }
7422 +                               if (hfc->bch_enables & 3)
7423 +                                   hfc->led_req |= LED_BCH;
7424 +                               else
7425 +                                   hfc->led_req &= ~LED_BCH;
7426 +                               break;
7427 +                       case HFCUSB_P_DATA:
7428 +                               hfc->led_act =
7429 +                                   hfc->ctrl_buff[hfc->ctrl_out_idx].
7430 +                                   reg_val;
7431 +                               break;
7432 +               }
7433 +               hfc->ctrl_cnt--;        /* decrement actual count */
7434 +               if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE)
7435 +                       hfc->ctrl_out_idx = 0;  /* pointer wrap */
7436 +               ctrl_start_transfer(hfc);       /* start next transfer */
7437 +       }
7438 +}                              /* ctrl_complete */
7439 +
7440 +/*****************************************/
7441 +/* Layer 1 + D channel access from HiSax */
7442 +/*****************************************/
7443 +static void
7444 +hfcusb_l1_access(void *drvarg, int pr, void *arg)
7445 +{
7446 +       hfcusb_data *hfc = (hfcusb_data *) drvarg;
7447 +
7448 +       switch (pr) {
7449 +               case (PH_DATA | REQUEST):
7450 +               case (PH_PULL | INDICATION):
7451 +                       skb_queue_tail(hfc->regd.dsq,
7452 +                                      (struct sk_buff *) arg);
7453 +                       if (!hfc->fifos[HFCUSB_D_TX].active
7454 +                           && !hfc->dfifo_fill) {
7455 +                               fill_tx_urb(hfc->fifos + HFCUSB_D_TX);
7456 +                               hfc->active_fifos |=
7457 +                                   hfc->fifos[HFCUSB_D_TX].fifo_mask;
7458 +                               usb_submit_urb(&hfc->fifos[HFCUSB_D_TX].
7459 +                                              urb);
7460 +                       }
7461 +                       break;
7462 +               case (PH_ACTIVATE | REQUEST):
7463 +                   switch (hfc->l1_state) {
7464 +                       case 6:
7465 +                       case 8:
7466 +                               hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
7467 +                                                  (PH_DEACTIVATE |
7468 +                                                  INDICATION), NULL);
7469 +
7470 +                               break;
7471 +                       case 7:
7472 +                               hfc->regd.dch_l1l2(hfc->regd.arg_hisax,
7473 +                                                  (PH_ACTIVATE |
7474 +                                                  INDICATION), NULL);
7475 +
7476 +                               break;
7477 +                       default:
7478 +                               queue_control_request(hfc, HFCUSB_STATES, 0x60);        /* start activation */
7479 +                               hfc->t3_timer.expires =
7480 +                                   jiffies + (HFC_TIMER_T3 * HZ) / 1000;
7481 +                               if (!timer_pending(&hfc->t3_timer))
7482 +                                       add_timer(&hfc->t3_timer);
7483 +                               break;
7484 +                   }
7485 +                   break;
7486 +
7487 +               case (PH_DEACTIVATE | REQUEST):
7488 +                       queue_control_request(hfc, HFCUSB_STATES, 0x40);        /* start deactivation */
7489 +                       break;
7490 +               default:
7491 +                       printk(KERN_INFO "unknown hfcusb l1_access 0x%x\n",
7492 +                              pr);
7493 +                       break;
7494 +       }
7495 +}                              /* hfcusb_l1_access */
7496 +
7497 +/*******************************/
7498 +/* B channel access from HiSax */
7499 +/*******************************/
7500 +static void
7501 +hfcusb_bch_access(void *drvarg, int chan, int pr, void *arg)
7502 +{
7503 +       hfcusb_data *hfc = (hfcusb_data *) drvarg;
7504 +       usb_fifo *fifo = hfc->fifos + (chan ? HFCUSB_B2_TX : HFCUSB_B1_TX);
7505 +       long flags;
7506 +
7507 +       switch (pr) {
7508 +               case (PH_DATA | REQUEST):
7509 +               case (PH_PULL | INDICATION):
7510 +                       save_flags(flags);
7511 +                       cli();
7512 +                       if (!fifo->active) {
7513 +                               fill_tx_urb(fifo);
7514 +                               hfc->active_fifos |= fifo->fifo_mask;
7515 +                               usb_submit_urb(&fifo->urb);
7516 +                       }
7517 +                       restore_flags(flags);
7518 +                       break;
7519 +               case (PH_ACTIVATE | REQUEST):
7520 +                       if (!((int) arg)) {
7521 +                               hfc->bch_enables &= ~(1 << chan);
7522 +                               if (fifo->active) {
7523 +                                       fifo->active = 0;
7524 +                                       usb_unlink_urb(&fifo->urb);
7525 +                               }
7526 +                               save_flags(flags);
7527 +                               cli();
7528 +                               queue_control_request(hfc, HFCUSB_FIFO,
7529 +                                                     fifo->fifonum);
7530 +                               queue_control_request(hfc,
7531 +                                                     HFCUSB_INC_RES_F, 2);
7532 +                               queue_control_request(hfc, HFCUSB_CON_HDLC,
7533 +                                                     9);
7534 +                               queue_control_request(hfc, HFCUSB_SCTRL,
7535 +                                                     0x40 +
7536 +                                                     hfc->bch_enables);
7537 +                               queue_control_request(hfc, HFCUSB_SCTRL_R,
7538 +                                                     hfc->bch_enables);
7539 +                               restore_flags(flags);
7540 +                               fifo++;
7541 +                               if (fifo->active) {
7542 +                                       fifo->active = 0;
7543 +                                       usb_unlink_urb(&fifo->urb);
7544 +                               }
7545 +                               return; /* fifo deactivated */
7546 +                       }
7547 +                       fifo->transmode = ((int) arg == L1_MODE_TRANS);
7548 +                       fifo->max_size =
7549 +                           ((fifo->transmode) ? fifo->
7550 +                            usb_maxlen : MAX_BCH_SIZE);
7551 +                       (fifo + 1)->transmode = fifo->transmode;
7552 +                       (fifo + 1)->max_size = fifo->max_size;
7553 +                       hfc->bch_enables |= (1 << chan);
7554 +                       save_flags(flags);
7555 +                       cli();
7556 +                       queue_control_request(hfc, HFCUSB_FIFO,
7557 +                                             fifo->fifonum);
7558 +                       queue_control_request(hfc, HFCUSB_CON_HDLC,
7559 +                                             ((!fifo->
7560 +                                               transmode) ? 9 : 11));
7561 +                       queue_control_request(hfc, HFCUSB_INC_RES_F, 2);
7562 +                       queue_control_request(hfc, HFCUSB_SCTRL,
7563 +                                             0x40 + hfc->bch_enables);
7564 +                       if ((int) arg == L1_MODE_HDLC)
7565 +                               queue_control_request(hfc, HFCUSB_CON_HDLC,
7566 +                                                     8);
7567 +                       queue_control_request(hfc, HFCUSB_FIFO,
7568 +                                             fifo->fifonum + 1);
7569 +                       queue_control_request(hfc, HFCUSB_CON_HDLC,
7570 +                                             ((!fifo->
7571 +                                               transmode) ? 8 : 10));
7572 +                       queue_control_request(hfc, HFCUSB_INC_RES_F, 2);
7573 +                       queue_control_request(hfc, HFCUSB_SCTRL_R,
7574 +                                             hfc->bch_enables);
7575 +                       restore_flags(flags);
7576 +
7577 +                       break;
7578 +
7579 +               default:
7580 +                       printk(KERN_INFO
7581 +                              "unknown hfcusb bch_access chan %d 0x%x\n",
7582 +                              chan, pr);
7583 +                       break;
7584 +       }
7585 +}                              /* hfcusb_bch_access */
7586 +
7587 +/***************************************************************************/
7588 +/* usb_init is called once when a new matching device is detected to setup */
7589 +/* main parmeters. It registers the driver at the main hisax module.       */
7590 +/* on success 0 is returned.                                               */
7591 +/***************************************************************************/
7592 +static int
7593 +usb_init(hfcusb_data * hfc)
7594 +{
7595 +       usb_fifo *fifo;
7596 +       int i;
7597 +       u_char b;
7598 +
7599 +       /* check the chip id */
7600 +       if ((Read_hfc(hfc, HFCUSB_CHIP_ID, &b) != 1) ||
7601 +           (b != HFCUSB_CHIPID)) {
7602 +               printk(KERN_INFO "HFC-USB: Invalid chip id 0x%02x\n", b);
7603 +               return (1);
7604 +       }
7605 +
7606 +       /* first set the needed config, interface and alternate */
7607 +       usb_set_configuration(hfc->dev, 1);
7608 +       usb_set_interface(hfc->dev, hfc->if_used, hfc->alt_used);
7609 +
7610 +        /* init the led state request */
7611 +       hfc->led_req = LED_DRIVER;
7612 +
7613 +       /* now we initialise the chip */
7614 +       Write_hfc(hfc, HFCUSB_CIRM, 0x10);      /* aux = output, reset off */
7615 +       Write_hfc(hfc, HFCUSB_P_DATA, 0);       /* leds = off */
7616 +       Write_hfc(hfc, HFCUSB_USB_SIZE,
7617 +                 (hfc->fifos[HFCUSB_B1_TX].usb_maxlen >> 3) |
7618 +                 ((hfc->fifos[HFCUSB_B1_RX].usb_maxlen >> 3) << 4));
7619 +
7620 +       /* enable PCM/GCI master mode */
7621 +       Write_hfc(hfc, HFCUSB_MST_MODE1, 0);    /* set default values */
7622 +       Write_hfc(hfc, HFCUSB_MST_MODE0, 1);    /* enable master mode */
7623 +
7624 +       /* init the fifos */
7625 +       Write_hfc(hfc, HFCUSB_F_THRES, (HFCUSB_TX_THRESHOLD >> 3) |
7626 +                 ((HFCUSB_RX_THRESHOLD >> 3) << 4));
7627 +
7628 +       for (i = 0, fifo = hfc->fifos + i; i < HFCUSB_NUM_FIFOS;
7629 +            i++, fifo++) {
7630 +               Write_hfc(hfc, HFCUSB_FIFO, i); /* select the desired fifo */
7631 +
7632 +               fifo->transmode = 0;    /* hdlc mode selected */
7633 +               fifo->buff = NULL;      /* init buffer pointer */
7634 +               fifo->max_size =
7635 +                   (i <= HFCUSB_B2_RX) ? MAX_BCH_SIZE : MAX_DFRAME_LEN;
7636 +               Write_hfc(hfc, HFCUSB_HDLC_PAR, ((i <= HFCUSB_B2_RX) ? 0 : 2)); /* data length */
7637 +               Write_hfc(hfc, HFCUSB_CON_HDLC, ((i & 1) ? 0x08 : 0x09));       /* rx hdlc, tx fill 1 */
7638 +               Write_hfc(hfc, HFCUSB_INC_RES_F, 2);    /* reset the fifo */
7639 +       }
7640 +
7641 +       Write_hfc(hfc, HFCUSB_CLKDEL, 0x0f);    /* clock delay value */
7642 +       Write_hfc(hfc, HFCUSB_STATES, 3 | 0x10);        /* set deactivated mode */
7643 +       Write_hfc(hfc, HFCUSB_STATES, 3);       /* enable state machine */
7644 +
7645 +       Write_hfc(hfc, HFCUSB_SCTRL_R, 0);      /* disable both B receivers */
7646 +       Write_hfc(hfc, HFCUSB_SCTRL, 0x40);     /* disable B transmitters + cap mode */
7647 +
7648 +       /* init the l1 timer */
7649 +       init_timer(&hfc->t3_timer);
7650 +       hfc->t3_timer.data = (long) hfc;
7651 +       hfc->t3_timer.function = (void *) l1_timer_expire;
7652 +       hfc->t4_timer.data = (long) hfc;
7653 +       hfc->t4_timer.function = (void *) l1_timer_expire;
7654 +       hfc->l1_tq.routine = (void *) (void *) usb_l1d_bh;
7655 +       hfc->l1_tq.sync = 0;
7656 +       hfc->l1_tq.data = hfc;
7657 +
7658 +       /* init the background control machinery */
7659 +       hfc->ctrl_read.requesttype = 0xc0;
7660 +       hfc->ctrl_read.request = 1;
7661 +       hfc->ctrl_read.length = 1;
7662 +       hfc->ctrl_write.requesttype = 0x40;
7663 +       hfc->ctrl_write.request = 0;
7664 +       hfc->ctrl_write.length = 0;
7665 +       FILL_CONTROL_URB(&hfc->ctrl_urb, hfc->dev, hfc->ctrl_out_pipe,
7666 +                        (u_char *) & hfc->ctrl_write, NULL, 0,
7667 +                        ctrl_complete, hfc);
7668 +
7669 +       /* init the TX-urbs */
7670 +       fifo = hfc->fifos + HFCUSB_D_TX;
7671 +       FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe,
7672 +                     (u_char *) fifo->buffer, 0, tx_complete, fifo);
7673 +       fifo = hfc->fifos + HFCUSB_B1_TX;
7674 +       FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe,
7675 +                     (u_char *) fifo->buffer, 0, tx_complete, fifo);
7676 +       fifo = hfc->fifos + HFCUSB_B2_TX;
7677 +       FILL_BULK_URB(&fifo->urb, hfc->dev, fifo->pipe,
7678 +                     (u_char *) fifo->buffer, 0, tx_complete, fifo);
7679 +
7680 +       /* init the E-buffer */
7681 +       skb_queue_head_init(&hfc->regd.erq);
7682 +
7683 +       /* now register ourself at hisax */
7684 +       hfc->regd.version = HISAX_LOAD_VERSION; /* set our version */
7685 +       hfc->regd.cmd = HISAX_LOAD_REGISTER;    /* register command */
7686 +       hfc->regd.argl1 = (void *) hfc; /* argument for our local routine */
7687 +       hfc->regd.dch_l2l1 = hfcusb_l1_access;
7688 +       hfc->regd.bch_l2l1 = hfcusb_bch_access;
7689 +       hfc->regd.drvname = "hfc_usb";
7690 +       if (hisax_register_hfcusb(&hfc->regd)) {
7691 +               printk(KERN_INFO "HFC-USB failed to register at hisax\n");
7692 +               Write_hfc(hfc, HFCUSB_CIRM, 0x08);      /* aux = input, reset on */
7693 +               return (1);
7694 +       }
7695 +
7696 +       /* startup the D- and E-channel fifos */
7697 +       start_rx_fifo(hfc->fifos + HFCUSB_D_RX);        /* D-fifo */
7698 +       if (hfc->fifos[HFCUSB_PCM_RX].pipe)
7699 +               start_rx_fifo(hfc->fifos + HFCUSB_PCM_RX);      /* E-fifo */
7700 +
7701 +       return (0);
7702 +}                              /* usb_init */
7703 +
7704 +/*************************************************/
7705 +/* function called to probe a new plugged device */
7706 +/*************************************************/
7707 +static void *
7708 +hfc_usb_probe(struct usb_device *dev, unsigned int interface
7709 +#ifdef COMPAT_HAS_USB_IDTAB
7710 +             , const struct usb_device_id *id_table)
7711 +#else
7712 +    )
7713 +#endif
7714 +{
7715 +       hfcusb_data *context;
7716 +       struct usb_interface *ifp = dev->actconfig->interface + interface;
7717 +       struct usb_interface_descriptor *ifdp =
7718 +           ifp->altsetting + ifp->act_altsetting;
7719 +       struct usb_endpoint_descriptor *epd;
7720 +       int i, idx, ep_msk;
7721 +
7722 +#ifdef COMPAT_HAS_USB_IDTAB
7723 +       if (id_table && (dev->descriptor.idVendor == id_table->idVendor) &&
7724 +           (dev->descriptor.idProduct == id_table->idProduct) &&
7725 +#else
7726 +       if ((((dev->descriptor.idVendor == 0x959) &&
7727 +           (dev->descriptor.idProduct == 0x2bd0)) ||
7728 +           ((dev->descriptor.idVendor == 0x7b0) &&
7729 +           (dev->descriptor.idProduct == 0x0006))) &&
7730 +#endif
7731 +           (ifdp->bNumEndpoints >= 6) && (ifdp->bNumEndpoints <= 16)) {
7732 +               if (!(context = kmalloc(sizeof(hfcusb_data), GFP_KERNEL))) {
7733 +                       return (NULL);  /* got no mem */
7734 +               };
7735 +               memset(context, 0, sizeof(hfcusb_data));        /* clear the structure */
7736 +               i = ifdp->bNumEndpoints;        /* get number of endpoints */
7737 +               ep_msk = 0;     /* none found */
7738 +               epd = ifdp->endpoint;   /* first endpoint descriptor */
7739 +               while (i-- && ((ep_msk & 0xcf) != 0xcf)) {
7740 +
7741 +                       idx = (((epd->bEndpointAddress & 0x7f) - 1) << 1);      /* get endpoint base */
7742 +                       if (idx < 7) {
7743 +                               switch (epd->bmAttributes) {
7744 +                                       case USB_ENDPOINT_XFER_INT:
7745 +                                               if (!
7746 +                                                   (epd->
7747 +                                                    bEndpointAddress &
7748 +                                                    0x80))
7749 +                                                       break;  /* only interrupt in allowed */
7750 +                                               idx++;  /* input index is odd */
7751 +                                               context->fifos[idx].pipe =
7752 +                                                   usb_rcvintpipe(dev,
7753 +                                                                  epd->
7754 +                                                                  bEndpointAddress);
7755 +                                               break;
7756 +
7757 +                                       case USB_ENDPOINT_XFER_BULK:
7758 +                                               if (epd->
7759 +                                                   bEndpointAddress &
7760 +                                                   0x80)
7761 +                                                       break;  /* only bulk out allowed */
7762 +                                               context->fifos[idx].pipe =
7763 +                                                   usb_sndbulkpipe(dev,
7764 +                                                                   epd->
7765 +                                                                   bEndpointAddress);
7766 +                                               break;
7767 +                                       default:
7768 +                                               context->fifos[idx].pipe = 0;   /* reset data */
7769 +                               }       /* switch attribute */
7770 +
7771 +                               if (context->fifos[idx].pipe) {
7772 +                                       context->fifos[idx].fifonum = idx;
7773 +                                       context->fifos[idx].fifo_mask =
7774 +                                           1 << idx;
7775 +                                       context->fifos[idx].hfc = context;
7776 +                                       context->fifos[idx].usb_maxlen =
7777 +                                           epd->wMaxPacketSize;
7778 +                                       context->fifos[idx].intervall =
7779 +                                           epd->bInterval;
7780 +                                       ep_msk |= (1 << idx);
7781 +                               } else
7782 +                                       ep_msk &= ~(1 << idx);
7783 +                       }       /* idx < 7 */
7784 +                       epd++;
7785 +               }
7786 +
7787 +               if ((ep_msk & 0x3f) != 0x3f) {
7788 +                       kfree(context);
7789 +                       return (NULL);
7790 +               }
7791 +               MOD_INC_USE_COUNT;      /* lock our module */
7792 +               context->dev = dev;     /* save device */
7793 +               context->if_used = interface;   /* save used interface */
7794 +               context->alt_used = ifp->act_altsetting;        /* and alternate config */
7795 +               context->ctrl_paksize = dev->descriptor.bMaxPacketSize0;        /* control size */
7796 +
7797 +               /* create the control pipes needed for register access */
7798 +               context->ctrl_in_pipe = usb_rcvctrlpipe(context->dev, 0);
7799 +               context->ctrl_out_pipe = usb_sndctrlpipe(context->dev, 0);
7800 +
7801 +               /* init the chip and register the driver */
7802 +               if (usb_init(context)) {
7803 +                       kfree(context);
7804 +                       MOD_DEC_USE_COUNT;
7805 +                       return (NULL);
7806 +               }
7807 +
7808 +               printk(KERN_INFO
7809 +                      "HFC-USB: New device if=%d alt=%d registered\n",
7810 +                      context->if_used, context->alt_used);
7811 +               return (context);
7812 +       }
7813 +
7814 +       return (NULL);          /* no matching entry */
7815 +}                              /* hfc_usb_probe */
7816 +
7817 +/****************************************************/
7818 +/* function called when an active device is removed */
7819 +/****************************************************/
7820 +static void
7821 +hfc_usb_disconnect(struct usb_device *usbdev, void *drv_context)
7822 +{
7823 +       hfcusb_data *context = drv_context;
7824 +       int i;
7825 +       struct sk_buff *skb;
7826 +
7827 +       /* tell all fifos to terminate */
7828 +       for (i = 0; i < HFCUSB_NUM_FIFOS; i++)
7829 +               if (context->fifos[i].active) {
7830 +                       context->fifos[i].active = 0;
7831 +                       usb_unlink_urb(&context->fifos[i].urb);
7832 +               }
7833 +       while (context->active_fifos) {
7834 +               set_current_state(TASK_INTERRUPTIBLE);
7835 +               /* Timeout 10ms */
7836 +               schedule_timeout((10 * HZ) / 1000);
7837 +       }
7838 +       if (timer_pending(&context->t3_timer))
7839 +               del_timer(&context->t3_timer);
7840 +       context->regd.release_driver(context->regd.arg_hisax);
7841 +       while ((skb = skb_dequeue(&context->regd.erq)) != NULL)
7842 +               dev_kfree_skb_any(skb);
7843 +
7844 +       kfree(context);         /* free our structure again */
7845 +       MOD_DEC_USE_COUNT;      /* and decrement the usage counter */
7846 +}                              /* hfc_usb_disconnect */
7847 +
7848 +/************************************/
7849 +/* our driver information structure */
7850 +/************************************/
7851 +static struct usb_driver hfc_drv = {
7852 +       name:"hfc_usb",
7853 +#ifdef COMPAT_HAS_USB_IDTAB
7854 +       id_table:hfc_usb_idtab,
7855 +#endif
7856 +       probe:hfc_usb_probe,
7857 +       disconnect:hfc_usb_disconnect,
7858 +};
7859 +
7860 +static void __exit
7861 +hfc_usb_exit(void)
7862 +{
7863 +
7864 +       usb_deregister(&hfc_drv);       /* release our driver */
7865 +       printk(KERN_INFO "HFC-USB module removed\n");
7866 +}
7867 +
7868 +static int __init
7869 +hfc_usb_init(void)
7870 +{
7871 +       struct hisax_drvreg drv;
7872 +
7873 +       drv.version = HISAX_LOAD_VERSION;       /* set our version */
7874 +       drv.cmd = HISAX_LOAD_CHKVER;    /* check command only */
7875 +       if (hisax_register_hfcusb(&drv)) {
7876 +               printk(KERN_INFO "HFC-USB <-> hisax version conflict\n");
7877 +               return (-1);    /* unable to register */
7878 +       }
7879 +       if (usb_register(&hfc_drv)) {
7880 +               printk(KERN_INFO
7881 +                      "Unable to register HFC-USB module at usb stack\n");
7882 +               return (-1);    /* unable to register */
7883 +       }
7884 +
7885 +       printk(KERN_INFO "HFC-USB module loaded\n");
7886 +       return (0);
7887 +}
7888 +
7889 +module_init(hfc_usb_init);
7890 +module_exit(hfc_usb_exit);
7891 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfc_usbr.c linux-2.4.29/drivers/isdn/hisax/hfc_usbr.c
7892 --- linux-2.4.29.old/drivers/isdn/hisax/hfc_usbr.c      1970-01-01 01:00:00.000000000 +0100
7893 +++ linux-2.4.29/drivers/isdn/hisax/hfc_usbr.c  2005-03-22 15:06:46.397039360 +0100
7894 @@ -0,0 +1,471 @@
7895 +/* $Id: hfc_usbr.c,v 2.5 2001/07/06 21:30:11 werner Exp $
7896 +
7897 + * hfc_usb.c  low level driver for CCD´s hfc-usb single chip controllers
7898 + *            type approval valid for HFC-S USB based TAs
7899 + *
7900 + * Author     Werner Cornelius (werner@isdn-development.de)
7901 + *
7902 + * Copyright 2001  by Werner Cornelius (werner@isdn4linux.de)
7903 + *
7904 + * This program is free software; you can redistribute it and/or modify
7905 + * it under the terms of the GNU General Public License as published by
7906 + * the Free Software Foundation; either version 2, or (at your option)
7907 + * any later version.
7908 + *
7909 + * This program is distributed in the hope that it will be useful,
7910 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7911 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7912 + * GNU General Public License for more details.
7913 + *
7914 + * You should have received a copy of the GNU General Public License
7915 + * along with this program; if not, write to the Free Software
7916 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7917 + *
7918 + */
7919 +
7920 +#define __NO_VERSION__
7921 +#include <linux/init.h>
7922 +#include "hisax.h"
7923 +#include "isdnl1.h"
7924 +#include "hisax_loadable.h"
7925 +
7926 +extern const char *CardType[];
7927 +
7928 +static const char *hfcusb_revision = "$Revision: 2.5 $";
7929 +
7930 +/*********************************/
7931 +/* schedule a new b_channel task */
7932 +/*********************************/
7933 +static void
7934 +hfcusb_sched_event(struct BCState *bcs, int event)
7935 +{
7936 +       bcs->event |= 1 << event;
7937 +       queue_task(&bcs->tqueue, &tq_immediate);
7938 +       mark_bh(IMMEDIATE_BH);
7939 +}
7940 +
7941 +/************************************************/
7942 +/* select a b-channel entry matching and active */
7943 +/************************************************/
7944 +static
7945 +struct BCState *
7946 +Sel_BCS(struct IsdnCardState *cs, int channel)
7947 +{
7948 +       if (cs->bcs[0].mode && (cs->bcs[0].channel == channel))
7949 +               return (&cs->bcs[0]);
7950 +       else if (cs->bcs[1].mode && (cs->bcs[1].channel == channel))
7951 +               return (&cs->bcs[1]);
7952 +       else
7953 +               return (NULL);
7954 +}
7955 +
7956 +/**********************************************/
7957 +/* transfer function (D-channel from l2 to l1 */
7958 +/**********************************************/
7959 +static void
7960 +hfcusb_d_l2l1(struct PStack *st, int pr, void *arg)
7961 +{
7962 +       struct IsdnCardState *cs = st->l1.hardware;
7963 +       struct hisax_drvreg *drv = cs->hw.hfcusb.drv;
7964 +
7965 +       if (drv) {
7966 +               switch (pr) {
7967 +                       case (PH_DATA | REQUEST):
7968 +                       case (PH_PULL | INDICATION):
7969 +                               cs->hw.hfcusb.dch_tx_busy = 1;
7970 +                               break;
7971 +                       case (PH_PULL | REQUEST):
7972 +                               if (!cs->hw.hfcusb.dch_tx_busy) {
7973 +                                       test_and_clear_bit(FLG_L1_PULL_REQ,
7974 +                                                          &st->l1.Flags);
7975 +                                       st->l1.l1l2(st, PH_PULL | CONFIRM,
7976 +                                                   NULL);
7977 +                               } else
7978 +                                       test_and_set_bit(FLG_L1_PULL_REQ,
7979 +                                                        &st->l1.Flags);
7980 +                               return;
7981 +               }
7982 +               drv->dch_l2l1(drv, pr, arg);
7983 +       } else
7984 +               debugl1(cs, "hfcusb l2l1 called without existing driver");
7985 +}                              /* hfcusb_d_l2l1 */
7986 +
7987 +/*****************************/
7988 +/* E-channel receive routine */
7989 +/*****************************/
7990 +static void
7991 +EChannel_proc_rcv(struct IsdnCardState *cs)
7992 +{
7993 +       u_char *ptr;
7994 +       struct sk_buff *skb;
7995 +       struct hisax_drvreg *usbdrv =
7996 +           (struct hisax_drvreg *) cs->hw.hfcusb.drv;
7997 +
7998 +
7999 +       while ((skb = skb_dequeue(&usbdrv->erq)) != NULL) {
8000 +               if (cs->debug & DEB_DLOG_HEX) {
8001 +                       ptr = cs->dlog;
8002 +                       if ((skb->len) < MAX_DLOG_SPACE / 3 - 10) {
8003 +                               *ptr++ = 'E';
8004 +                               *ptr++ = 'C';
8005 +                               *ptr++ = 'H';
8006 +                               *ptr++ = 'O';
8007 +                               *ptr++ = ':';
8008 +                               ptr += QuickHex(ptr, skb->data, skb->len);
8009 +                               ptr--;
8010 +                               *ptr++ = '\n';
8011 +                               *ptr = 0;
8012 +                               HiSax_putstatus(cs, NULL, cs->dlog);
8013 +                       } else
8014 +                               HiSax_putstatus(cs, "LogEcho: ",
8015 +                                               "warning Frame too big (%d)",
8016 +                                               skb->len);
8017 +               }
8018 +               dev_kfree_skb_any(skb);
8019 +       }
8020 +}
8021 +
8022 +/******************************************/
8023 +/* transfer function called from L1 to L2 */
8024 +/******************************************/
8025 +static void
8026 +hfcusb_d_l1l2(void *cs1, int pr, void *arg)
8027 +{
8028 +       struct IsdnCardState *cs = (struct IsdnCardState *) cs1;
8029 +
8030 +       switch (pr) {
8031 +               case (PH_DATA | INDICATION):
8032 +                       if (!((int) arg))
8033 +                               DChannel_proc_rcv(cs);
8034 +                       else
8035 +                               EChannel_proc_rcv(cs);
8036 +                       break;
8037 +
8038 +               case (PH_DATA | CONFIRM):
8039 +                       cs->hw.hfcusb.dch_tx_busy = 0;
8040 +                       DChannel_proc_xmt(cs);
8041 +                       break;
8042 +
8043 +               case (PH_ACTIVATE | INDICATION):
8044 +               case (PH_ACTIVATE | CONFIRM):
8045 +                       cs->stlist->l1.l1l2(cs->stlist, pr, arg);
8046 +                       if (cs->debug & L1_DEB_ISAC)
8047 +                               debugl1(cs, "layer 1 activated");
8048 +                       break;
8049 +
8050 +               case (PH_DEACTIVATE | INDICATION):
8051 +               case (PH_DEACTIVATE | CONFIRM):
8052 +                       cs->stlist->l1.l1l2(cs->stlist, pr, arg);
8053 +                       if (cs->debug & L1_DEB_ISAC)
8054 +                               debugl1(cs, "layer 1 deactivated");
8055 +                       break;
8056 +
8057 +               default:
8058 +                       debugl1(cs, "unknown l1 msg 0x%x ", pr);
8059 +       }
8060 +}                              /* hfcusb_d_l1l2 */
8061 +
8062 +
8063 +/******************************************/
8064 +/* transfer function called from L1 to L2 */
8065 +/******************************************/
8066 +static void
8067 +hfcusb_b_l1l2(void *cs1, int chan, int pr, void *arg)
8068 +{
8069 +       struct IsdnCardState *cs = (struct IsdnCardState *) cs1;
8070 +       struct BCState *bcs = Sel_BCS(cs, chan);
8071 +
8072 +       switch (pr) {
8073 +               case (PH_DATA | INDICATION):
8074 +                       if (!bcs)
8075 +                               return;
8076 +                       hfcusb_sched_event(bcs, B_RCVBUFREADY);
8077 +                       break;
8078 +
8079 +               case (PH_DATA | CONFIRM):
8080 +                       if (!bcs)
8081 +                               return;
8082 +                       bcs->tx_cnt -= bcs->tx_skb->len;
8083 +                       if (bcs->st->lli.l1writewakeup &&
8084 +                           (PACKET_NOACK != bcs->tx_skb->pkt_type))
8085 +                               bcs->st->lli.l1writewakeup(bcs->st,
8086 +                                                          bcs->tx_skb->
8087 +                                                          len);
8088 +                       dev_kfree_skb_any(bcs->tx_skb);
8089 +                       bcs->tx_skb = skb_dequeue(&bcs->squeue);
8090 +                       break;
8091 +
8092 +               case (PH_ACTIVATE | INDICATION):
8093 +               case (PH_ACTIVATE | CONFIRM):
8094 +                       cs->stlist->l1.l1l2(cs->stlist, pr, arg);
8095 +                       if (cs->debug & L1_DEB_ISAC)
8096 +                               debugl1(cs, "layer 1 activated");
8097 +                       break;
8098 +
8099 +               case (PH_DEACTIVATE | INDICATION):
8100 +               case (PH_DEACTIVATE | CONFIRM):
8101 +                       cs->stlist->l1.l1l2(cs->stlist, pr, arg);
8102 +                       if (cs->debug & L1_DEB_ISAC)
8103 +                               debugl1(cs, "layer 1 deactivated");
8104 +                       break;
8105 +
8106 +               default:
8107 +                       debugl1(cs, "unknown l1 b msg 0x%x ", pr);
8108 +       }
8109 +}                              /* hfcusb_b_l1l2 */
8110 +
8111 +
8112 +/***********************************************/
8113 +/* called during init setting l1 stack pointer */
8114 +/***********************************************/
8115 +void
8116 +setstack_hfcusb(struct PStack *st, struct IsdnCardState *cs)
8117 +{
8118 +       st->l2.l2l1 = hfcusb_d_l2l1;
8119 +}
8120 +
8121 +/**************************************/
8122 +/* send B-channel data if not blocked */
8123 +/**************************************/
8124 +static void
8125 +hfcusb_send_data(struct BCState *bcs)
8126 +{
8127 +       struct IsdnCardState *cs = bcs->cs;
8128 +       struct hisax_drvreg *drv =
8129 +           (struct hisax_drvreg *) cs->hw.hfcusb.drv;
8130 +
8131 +       if (!drv)
8132 +               return;
8133 +       drv->bch_l2l1(drv->argl1, bcs->channel, PH_DATA | REQUEST,
8134 +                     bcs->tx_skb);
8135 +}
8136 +
8137 +/***************************************************************/
8138 +/* activate/deactivate hardware for selected channels and mode */
8139 +/***************************************************************/
8140 +void
8141 +mode_hfcusb(struct BCState *bcs, int mode, int bc)
8142 +{
8143 +       struct IsdnCardState *cs = bcs->cs;
8144 +       struct hisax_drvreg *drv = cs->hw.hfcusb.drv;
8145 +
8146 +       if (!drv)
8147 +               return;
8148 +       if (cs->debug & L1_DEB_HSCX)
8149 +               debugl1(cs, "HFCUSB bchannel mode %d bchan %d/%d",
8150 +                       mode, bc, bcs->channel);
8151 +       bcs->mode = mode;
8152 +       bcs->channel = bc;
8153 +       if (mode) {
8154 +               drv->bsk[bc] = &bcs->tx_skb;
8155 +               drv->brq[bc] = &bcs->rqueue;
8156 +       }
8157 +       drv->bch_l2l1(drv->argl1, bc, PH_ACTIVATE | REQUEST,
8158 +                     (void *) mode);
8159 +       if (!mode) {
8160 +               drv->bsk[bc] = NULL;
8161 +               drv->brq[bc] = NULL;
8162 +       }
8163 +}
8164 +
8165 +/******************************/
8166 +/* Layer2 -> Layer 1 Transfer */
8167 +/******************************/
8168 +static void
8169 +hfcusb_b_l2l1(struct PStack *st, int pr, void *arg)
8170 +{
8171 +       struct sk_buff *skb = arg;
8172 +       struct hisax_drvreg *drv = st->l1.bcs->cs->hw.hfcusb.drv;
8173 +       long flags;
8174 +
8175 +       switch (pr) {
8176 +               case (PH_DATA | REQUEST):
8177 +                       save_flags(flags);
8178 +                       cli();
8179 +                       if (st->l1.bcs->tx_skb) {
8180 +                               skb_queue_tail(&st->l1.bcs->squeue, skb);
8181 +                               restore_flags(flags);
8182 +                       } else {
8183 +                               st->l1.bcs->tx_skb = skb;
8184 +                               st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
8185 +                               restore_flags(flags);
8186 +                       }
8187 +                       break;
8188 +               case (PH_PULL | INDICATION):
8189 +                       if (st->l1.bcs->tx_skb) {
8190 +                               printk(KERN_WARNING
8191 +                                      "hfc_l2l1: this shouldn't happen\n");
8192 +                               break;
8193 +                       }
8194 +                       save_flags(flags);
8195 +                       cli();
8196 +                       st->l1.bcs->tx_skb = skb;
8197 +                       st->l1.bcs->cs->BC_Send_Data(st->l1.bcs);
8198 +                       restore_flags(flags);
8199 +                       break;
8200 +               case (PH_PULL | REQUEST):
8201 +                       if (!st->l1.bcs->tx_skb) {
8202 +                               test_and_clear_bit(FLG_L1_PULL_REQ,
8203 +                                                  &st->l1.Flags);
8204 +                               st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
8205 +                       } else
8206 +                               test_and_set_bit(FLG_L1_PULL_REQ,
8207 +                                                &st->l1.Flags);
8208 +                       break;
8209 +               case (PH_ACTIVATE | REQUEST):
8210 +                       if (drv) {
8211 +                               test_and_set_bit(BC_FLG_ACTIV,
8212 +                                                &st->l1.bcs->Flag);
8213 +                               mode_hfcusb(st->l1.bcs, st->l1.mode,
8214 +                                           st->l1.bc);
8215 +                               l1_msg_b(st, pr, arg);
8216 +                       }
8217 +                       break;
8218 +               case (PH_DEACTIVATE | REQUEST):
8219 +                       l1_msg_b(st, pr, arg);
8220 +                       break;
8221 +               case (PH_DEACTIVATE | CONFIRM):
8222 +                       test_and_clear_bit(BC_FLG_ACTIV,
8223 +                                          &st->l1.bcs->Flag);
8224 +                       test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
8225 +                       mode_hfcusb(st->l1.bcs, 0, st->l1.bc);
8226 +                       st->l1.l1l2(st, PH_DEACTIVATE | CONFIRM, NULL);
8227 +                       break;
8228 +       }
8229 +}
8230 +
8231 +/******************************************/
8232 +/* deactivate B-channel access and queues */
8233 +/******************************************/
8234 +static void
8235 +close_hfcusb(struct BCState *bcs)
8236 +{
8237 +       mode_hfcusb(bcs, 0, bcs->channel);
8238 +       if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
8239 +               skb_queue_purge(&bcs->rqueue);
8240 +               skb_queue_purge(&bcs->squeue);
8241 +               if (bcs->tx_skb) {
8242 +                       dev_kfree_skb_any(bcs->tx_skb);
8243 +                       bcs->tx_skb = NULL;
8244 +                       test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
8245 +               }
8246 +       }
8247 +}
8248 +
8249 +/*************************************/
8250 +/* init B-channel queues and control */
8251 +/*************************************/
8252 +static int
8253 +open_hfcusbstate(struct IsdnCardState *cs, struct BCState *bcs)
8254 +{
8255 +       if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
8256 +               skb_queue_head_init(&bcs->rqueue);
8257 +               skb_queue_head_init(&bcs->squeue);
8258 +       }
8259 +       bcs->tx_skb = NULL;
8260 +       test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
8261 +       bcs->event = 0;
8262 +       bcs->tx_cnt = 0;
8263 +       return (0);
8264 +}
8265 +
8266 +/*********************************/
8267 +/* inits the stack for B-channel */
8268 +/*********************************/
8269 +static int
8270 +setstack_2b(struct PStack *st, struct BCState *bcs)
8271 +{
8272 +       bcs->channel = st->l1.bc;
8273 +       if (open_hfcusbstate(st->l1.hardware, bcs))
8274 +               return (-1);
8275 +       st->l1.bcs = bcs;
8276 +       st->l2.l2l1 = hfcusb_b_l2l1;
8277 +       setstack_manager(st);
8278 +       bcs->st = st;
8279 +       setstack_l1_B(st);
8280 +       return (0);
8281 +}
8282 +
8283 +/********************************/
8284 +/* called for card init message */
8285 +/********************************/
8286 +void __devinit
8287 +inithfcusb(struct IsdnCardState *cs)
8288 +{
8289 +       cs->setstack_d = setstack_hfcusb;
8290 +       cs->BC_Send_Data = &hfcusb_send_data;
8291 +       cs->bcs[0].BC_SetStack = setstack_2b;
8292 +       cs->bcs[1].BC_SetStack = setstack_2b;
8293 +       cs->bcs[0].BC_Close = close_hfcusb;
8294 +       cs->bcs[1].BC_Close = close_hfcusb;
8295 +       mode_hfcusb(cs->bcs, 0, 0);
8296 +       mode_hfcusb(cs->bcs + 1, 0, 1);
8297 +}
8298 +
8299 +
8300 +
8301 +/*******************************************/
8302 +/* handle card messages from control layer */
8303 +/*******************************************/
8304 +static int
8305 +hfcusb_card_msg(struct IsdnCardState *cs, int mt, void *arg)
8306 +{
8307 +       if (cs->debug & L1_DEB_ISAC)
8308 +               debugl1(cs, "HFCUSB: card_msg %x", mt);
8309 +       switch (mt) {
8310 +               case CARD_INIT:
8311 +                       inithfcusb(cs);
8312 +                       return (0);
8313 +               case CARD_RELEASE:
8314 +               case CARD_RESET:
8315 +               case CARD_TEST:
8316 +                       return (0);
8317 +       }
8318 +       return (0);
8319 +}
8320 +
8321 +
8322 +extern void
8323 + HiSax_closecard(int cardnr);
8324 +/*****************************/
8325 +/* release a driver instance */
8326 +/* called when hardware is   */
8327 +/* no longer present.        */
8328 +/*****************************/
8329 +static void
8330 +release_hfcdrv(void *arg)
8331 +{
8332 +       struct IsdnCardState *cs = (struct IsdnCardState *) arg;
8333 +
8334 +       cs->hw.hfcusb.drv = NULL;       /* disable any further use of driver */
8335 +       HiSax_closecard(cs->cardnr);
8336 +}                              /* release_hfcdrv */
8337 +
8338 +/*********************************************/
8339 +/* called once when a new device is detected */
8340 +/* initialises local data                    */
8341 +/*********************************************/
8342 +int
8343 +setup_hfc_usb(struct IsdnCard *card)
8344 +{
8345 +       struct IsdnCardState *cs = card->cs;
8346 +       char tmp[64];
8347 +       struct hisax_drvreg *usbdrv =
8348 +           (struct hisax_drvreg *) cs->hw.hfcusb.drv;
8349 +
8350 +       if (!usbdrv)
8351 +               return (0);     /* no driver data present */
8352 +
8353 +       strcpy(tmp, hfcusb_revision);
8354 +       printk(KERN_INFO "HiSax: HFC-USB driver Rev. %s\n",
8355 +              HiSax_getrev(tmp));
8356 +
8357 +       usbdrv->release_driver = &release_hfcdrv;       /* release routine */
8358 +       usbdrv->arg_hisax = (void *) cs;        /* parameter for calling */
8359 +       usbdrv->dch_l1l2 = &hfcusb_d_l1l2;      /* access from L1 to HiSax */
8360 +       usbdrv->bch_l1l2 = &hfcusb_b_l1l2;
8361 +       usbdrv->drq = &cs->rq;
8362 +       usbdrv->dsq = &cs->sq;
8363 +       cs->cardmsg = &hfcusb_card_msg;
8364 +       return (1);             /* success */
8365 +}
8366 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hfcscard.c linux-2.4.29/drivers/isdn/hisax/hfcscard.c
8367 --- linux-2.4.29.old/drivers/isdn/hisax/hfcscard.c      2005-03-22 14:47:56.000000000 +0100
8368 +++ linux-2.4.29/drivers/isdn/hisax/hfcscard.c  2005-03-22 15:06:46.412037080 +0100
8369 @@ -1,4 +1,4 @@
8370 -/* $Id: hfcscard.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
8371 +/* $Id: hfcscard.c,v 1.10 2001/09/24 13:22:56 kai Exp $
8372   *
8373   * low level stuff for hfcs based cards (Teles3c, ACER P10)
8374   *
8375 @@ -12,14 +12,13 @@
8376  
8377  #define __NO_VERSION__
8378  #include <linux/init.h>
8379 -#include <linux/isapnp.h>
8380  #include "hisax.h"
8381  #include "hfc_2bds0.h"
8382  #include "isdnl1.h"
8383  
8384  extern const char *CardType[];
8385  
8386 -static const char *hfcs_revision = "$Revision: 1.1.4.1 $";
8387 +static const char *hfcs_revision = "$Revision: 1.10 $";
8388  
8389  static void
8390  hfcs_interrupt(int intno, void *dev_id, struct pt_regs *regs)
8391 @@ -140,36 +139,6 @@
8392         return(0);
8393  }
8394  
8395 -#ifdef __ISAPNP__
8396 -static struct isapnp_device_id hfc_ids[] __initdata = {
8397 -       { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114),
8398 -         ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), 
8399 -         (unsigned long) "Acer P10" },
8400 -       { ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0002),
8401 -         ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0002), 
8402 -         (unsigned long) "Billion 2" },
8403 -       { ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0001),
8404 -         ISAPNP_VENDOR('B', 'I', 'L'), ISAPNP_FUNCTION(0x0001), 
8405 -         (unsigned long) "Billion 1" },
8406 -       { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x7410),
8407 -         ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x7410), 
8408 -         (unsigned long) "IStar PnP" },
8409 -       { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2610),
8410 -         ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2610), 
8411 -         (unsigned long) "Teles 16.3c" },
8412 -       { ISAPNP_VENDOR('S', 'F', 'M'), ISAPNP_FUNCTION(0x0001),
8413 -         ISAPNP_VENDOR('S', 'F', 'M'), ISAPNP_FUNCTION(0x0001), 
8414 -         (unsigned long) "Tornado Tipa C" },
8415 -       { ISAPNP_VENDOR('K', 'Y', 'E'), ISAPNP_FUNCTION(0x0001),
8416 -         ISAPNP_VENDOR('K', 'Y', 'E'), ISAPNP_FUNCTION(0x0001), 
8417 -         (unsigned long) "Genius Speed Surfer" },
8418 -       { 0, }
8419 -};
8420 -
8421 -static struct isapnp_device_id *hdev = &hfc_ids[0];
8422 -static struct pci_bus *pnp_c __devinitdata = NULL;
8423 -#endif
8424 -
8425  int __init
8426  setup_hfcs(struct IsdnCard *card)
8427  {
8428 @@ -178,46 +147,6 @@
8429  
8430         strcpy(tmp, hfcs_revision);
8431         printk(KERN_INFO "HiSax: HFC-S driver Rev. %s\n", HiSax_getrev(tmp));
8432 -
8433 -#ifdef __ISAPNP__
8434 -       if (!card->para[1] && isapnp_present()) {
8435 -               struct pci_bus *pb;
8436 -               struct pci_dev *pd;
8437 -
8438 -               while(hdev->card_vendor) {
8439 -                       if ((pb = isapnp_find_card(hdev->card_vendor,
8440 -                               hdev->card_device, pnp_c))) {
8441 -                               pnp_c = pb;
8442 -                               pd = NULL;
8443 -                               if ((pd = isapnp_find_dev(pnp_c,
8444 -                                       hdev->vendor, hdev->function, pd))) {
8445 -                                       printk(KERN_INFO "HiSax: %s detected\n",
8446 -                                               (char *)hdev->driver_data);
8447 -                                       pd->prepare(pd);
8448 -                                       pd->deactivate(pd);
8449 -                                       pd->activate(pd);
8450 -                                       card->para[1] = pd->resource[0].start;
8451 -                                       card->para[0] = pd->irq_resource[0].start;
8452 -                                       if (!card->para[0] || !card->para[1]) {
8453 -                                               printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n",
8454 -                                               card->para[0], card->para[1]);
8455 -                                               pd->deactivate(pd);
8456 -                                               return(0);
8457 -                                       }
8458 -                                       break;
8459 -                               } else {
8460 -                                       printk(KERN_ERR "HFC PnP: PnP error card found, no device\n");
8461 -                               }
8462 -                       }
8463 -                       hdev++;
8464 -                       pnp_c=NULL;
8465 -               } 
8466 -               if (!hdev->card_vendor) {
8467 -                       printk(KERN_INFO "HFC PnP: no ISAPnP card found\n");
8468 -                       return(0);
8469 -               }
8470 -       }
8471 -#endif
8472         cs->hw.hfcD.addr = card->para[1] & 0xfffe;
8473         cs->irq = card->para[0];
8474         cs->hw.hfcD.cip = 0;
8475 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax.h linux-2.4.29/drivers/isdn/hisax/hisax.h
8476 --- linux-2.4.29.old/drivers/isdn/hisax/hisax.h 2005-03-22 14:47:56.000000000 +0100
8477 +++ linux-2.4.29/drivers/isdn/hisax/hisax.h     2005-03-22 15:06:46.431034192 +0100
8478 @@ -1,4 +1,4 @@
8479 -/* $Id: hisax.h,v 1.1.4.2 2001/12/09 19:15:28 kai Exp $
8480 +/* $Id: hisax.h,v 2.64 2001/09/24 13:22:56 kai Exp $
8481   *
8482   * Basic declarations, defines and prototypes
8483   *
8484 @@ -24,7 +24,9 @@
8485  #include <linux/isdnif.h>
8486  #include <linux/tty.h>
8487  #include <linux/serial_reg.h>
8488 +#ifndef COMPAT_NO_SOFTNET
8489  #include <linux/netdevice.h>
8490 +#endif
8491  
8492  #define ERROR_STATISTIC
8493  
8494 @@ -68,9 +70,6 @@
8495  #define DL_DATA                0x0220
8496  #define DL_FLUSH       0x0224
8497  #define DL_UNIT_DATA   0x0230
8498 -
8499 -#define MDL_BC_RELEASE  0x0278  // Formula-n enter:now
8500 -#define MDL_BC_ASSIGN   0x027C  // Formula-n enter:now
8501  #define MDL_ASSIGN     0x0280
8502  #define MDL_REMOVE     0x0284
8503  #define MDL_ERROR      0x0288
8504 @@ -472,8 +471,6 @@
8505  #define BC_FLG_FTI_RUN 13
8506  #define BC_FLG_LL_OK   14
8507  #define BC_FLG_LL_CONN 15
8508 -#define BC_FLG_FTI_FTS 16
8509 -#define BC_FLG_FRH_WAIT        17
8510  
8511  #define L1_MODE_NULL   0
8512  #define L1_MODE_TRANS  1
8513 @@ -695,6 +692,13 @@
8514         struct timer_list timer;
8515  };
8516  
8517 +#ifdef CONFIG_HISAX_HFC_USB
8518 +struct hfcUSB_hw {  
8519 +        void *drv; /* pointer to driver structure */
8520 +        int dch_tx_busy;
8521 +};
8522 +#endif
8523 +
8524  struct hfcSX_hw {
8525          unsigned long base;
8526         unsigned char cirm;
8527 @@ -838,17 +842,6 @@
8528         int ph_state;
8529  };
8530  
8531 -struct amd7930_chip {
8532 -       u_char lmr1;
8533 -       u_char ph_state;
8534 -       u_char old_state;
8535 -       u_char flg_t3;
8536 -       unsigned int tx_xmtlen;
8537 -       struct timer_list timer3;
8538 -       void (*ph_command) (struct IsdnCardState *, u_char, char *);
8539 -       void (*setIrqMask) (struct IsdnCardState *, u_char);
8540 -};
8541 -
8542  struct icc_chip {
8543         int ph_state;
8544         u_char *mon_tx;
8545 @@ -902,6 +895,9 @@
8546                 struct njet_hw njet;
8547                 struct hfcD_hw hfcD;
8548                 struct hfcPCI_hw hfcpci;
8549 +#ifdef CONFIG_HISAX_HFC_USB
8550 +               struct hfcUSB_hw hfcusb;
8551 +#endif
8552                 struct hfcSX_hw hfcsx;
8553                 struct ix1_hw niccy;
8554                 struct isurf_hw isurf;
8555 @@ -945,7 +941,6 @@
8556                 struct hfcpci_chip hfcpci;
8557                 struct hfcsx_chip hfcsx;
8558                 struct w6692_chip w6692;
8559 -               struct amd7930_chip amd7930;
8560                 struct icc_chip icc;
8561         } dc;
8562         u_char *rcvbuf;
8563 @@ -967,6 +962,8 @@
8564  #define  MON0_TX       4
8565  #define  MON1_TX       8
8566  
8567 +#define         HISAX_MAX_CARDS        8
8568 +
8569  #define  ISDN_CTYPE_16_0       1
8570  #define  ISDN_CTYPE_8_0                2
8571  #define  ISDN_CTYPE_16_3       3
8572 @@ -1006,8 +1003,8 @@
8573  #define  ISDN_CTYPE_HFC_SX      37
8574  #define  ISDN_CTYPE_NETJET_U   38
8575  #define  ISDN_CTYPE_HFC_SP_PCMCIA      39
8576 -#define  ISDN_CTYPE_DYNAMIC     40
8577 -#define  ISDN_CTYPE_ENTERNOW   41
8578 +#define  ISDN_CTYPE_HFC_USB     40
8579 +#define  ISDN_CTYPE_DYNAMIC     41
8580  #define  ISDN_CTYPE_COUNT      41
8581  
8582  
8583 @@ -1267,10 +1264,6 @@
8584  #define CARD_NETJET_U 0
8585  #endif
8586  
8587 -#ifdef CONFIG_HISAX_ENTERNOW_PCI
8588 -#define CARD_FN_ENTERNOW_PCI 1
8589 -#endif
8590 -
8591  #define TEI_PER_CARD 1
8592  
8593  /* L1 Debug */
8594 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_debug.h linux-2.4.29/drivers/isdn/hisax/hisax_debug.h
8595 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_debug.h   2005-03-22 14:47:56.000000000 +0100
8596 +++ linux-2.4.29/drivers/isdn/hisax/hisax_debug.h       2005-03-22 15:06:46.452031000 +0100
8597 @@ -28,7 +28,7 @@
8598  
8599  #define DBG(level, format, arg...) do { \
8600  if (level & __debug_variable) \
8601 -printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \
8602 +printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg); \
8603  } while (0)
8604  
8605  #define DBG_PACKET(level,data,count) \
8606 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.c linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.c
8607 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.c        2005-03-22 14:47:56.000000000 +0100
8608 +++ linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.c    2005-03-22 15:06:46.468028568 +0100
8609 @@ -20,22 +20,19 @@
8610   *
8611   * o POWER PC
8612   * o clean up debugging
8613 - * o tx_skb at PH_DEACTIVATE time
8614   */
8615  
8616  #include <linux/version.h>
8617  #include <linux/module.h>
8618  #include <linux/init.h>
8619  #include <linux/pci.h>
8620 -#include <linux/isapnp.h>
8621 +#include "hisax_isapnp.h"
8622  #include <linux/kmod.h>
8623  #include <linux/slab.h>
8624  #include <linux/skbuff.h>
8625  #include <linux/netdevice.h>
8626 -
8627 -#include <asm/io.h>
8628 -
8629  #include "hisax_fcpcipnp.h"
8630 +#include "hisax_isac.h"
8631  
8632  // debugging cruft
8633  #define __debug_variable debug
8634 @@ -46,10 +43,14 @@
8635  MODULE_PARM(debug, "i");
8636  #endif
8637  
8638 -MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
8639 +MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>");
8640  MODULE_DESCRIPTION("AVM Fritz!PCI/PnP ISDN driver");
8641  
8642 -static struct pci_device_id fcpci_ids[] __devinitdata = {
8643 +#ifndef PCI_DEVICE_ID_AVM_A1_V2
8644 +#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00
8645 +#endif
8646 +
8647 +static struct pci_device_id fcpci_ids[] __initdata = {
8648         { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1   , PCI_ANY_ID, PCI_ANY_ID,
8649           0, 0, (unsigned long) "Fritz!Card PCI" },
8650         { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID,
8651 @@ -58,7 +59,7 @@
8652  };
8653  MODULE_DEVICE_TABLE(pci, fcpci_ids);
8654  
8655 -static struct isapnp_device_id fcpnp_ids[] __devinitdata = {
8656 +static struct isapnp_device_id fcpnp_ids[] __initdata = {
8657         { ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900),
8658           ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900), 
8659           (unsigned long) "Fritz!Card PnP" },
8660 @@ -68,7 +69,8 @@
8661  
8662  static int protocol = 2;       /* EURO-ISDN Default */
8663  MODULE_PARM(protocol, "i");
8664 -MODULE_LICENSE("GPL");
8665 +
8666 +static LIST_HEAD(adapter_list);
8667  
8668  // ----------------------------------------------------------------------
8669  
8670 @@ -147,7 +149,7 @@
8671         outb(idx, adapter->io + AVM_INDEX);
8672         val = inb(adapter->io + AVM_DATA + (offset & 0xf));
8673         spin_unlock_irqrestore(&adapter->hw_lock, flags);
8674 -       DBG(0x1000, " port %#x, value %#x",
8675 +       DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8676             offset, val);
8677         return val;
8678  }
8679 @@ -160,7 +162,7 @@
8680                 AVM_IDX_ISAC_REG_HIGH : AVM_IDX_ISAC_REG_LOW;
8681         unsigned long flags;
8682  
8683 -       DBG(0x1000, " port %#x, value %#x",
8684 +       DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8685             offset, value);
8686         spin_lock_irqsave(&adapter->hw_lock, flags);
8687         outb(idx, adapter->io + AVM_INDEX);
8688 @@ -240,7 +242,7 @@
8689         outl(offset, adapter->io + AVM_ISACSX_INDEX);
8690         val = inl(adapter->io + AVM_ISACSX_DATA);
8691         spin_unlock_irqrestore(&adapter->hw_lock, flags);
8692 -       DBG(0x1000, " port %#x, value %#x",
8693 +       DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8694             offset, val);
8695  
8696         return val;
8697 @@ -252,7 +254,7 @@
8698         struct fritz_adapter *adapter = isac->priv;
8699         unsigned long flags;
8700  
8701 -       DBG(0x1000, " port %#x, value %#x",
8702 +       DBG(0x1000, __FUNCTION__ " port %#x, value %#x",
8703             offset, value);
8704         spin_lock_irqsave(&adapter->hw_lock, flags);
8705         outl(offset, adapter->io + AVM_ISACSX_INDEX);
8706 @@ -375,6 +377,9 @@
8707  
8708         DBG(0x40, "hdlc_fill_fifo");
8709  
8710 +       if (!skb)
8711 +               BUG();
8712 +
8713         if (skb->len == 0)
8714                 BUG();
8715  
8716 @@ -515,7 +520,6 @@
8717         }
8718         skb_push(bcs->tx_skb, bcs->tx_cnt);
8719         bcs->tx_cnt = 0;
8720 -       hdlc_fill_fifo(bcs);
8721  }
8722  
8723  static inline void hdlc_xpr_irq(struct fritz_bcs *bcs)
8724 @@ -536,7 +540,7 @@
8725         dev_kfree_skb_irq(skb);
8726  }
8727  
8728 -static void hdlc_irq_one(struct fritz_bcs *bcs, u32 stat)
8729 +static void hdlc_irq(struct fritz_bcs *bcs, u32 stat)
8730  {
8731         DBG(0x10, "ch%d stat %#x", bcs->channel, stat);
8732         if (stat & HDLC_INT_RPR) {
8733 @@ -553,7 +557,7 @@
8734         }
8735  }
8736  
8737 -static inline void hdlc_irq(struct fritz_adapter *adapter)
8738 +static inline void hdlc_interrupt(struct fritz_adapter *adapter)
8739  {
8740         int nr;
8741         u32 stat;
8742 @@ -562,7 +566,7 @@
8743                 stat = adapter->read_hdlc_status(adapter, nr);
8744                 DBG(0x10, "HDLC %c stat %#x", 'A' + nr, stat);
8745                 if (stat & HDLC_INT_MASK)
8746 -                       hdlc_irq_one(&adapter->bcs[nr], stat);
8747 +                       hdlc_irq(&adapter->bcs[nr], stat);
8748         }
8749  }
8750  
8751 @@ -584,14 +588,14 @@
8752                 adapter->write_ctrl(bcs, 5);
8753                 break;
8754         case L1_MODE_TRANS:
8755 +               bcs->ctrl.sr.mode = HDLC_MODE_TRANS;
8756 +               adapter->write_ctrl(bcs, 5);
8757 +               bcs->ctrl.sr.cmd = HDLC_CMD_XRS;
8758 +               adapter->write_ctrl(bcs, 1);
8759 +               bcs->ctrl.sr.cmd = 0;
8760 +               break;
8761         case L1_MODE_HDLC:
8762 -               bcs->rcvidx = 0;
8763 -               bcs->tx_cnt = 0;
8764 -               bcs->tx_skb = NULL;
8765 -               if (mode == L1_MODE_TRANS)
8766 -                       bcs->ctrl.sr.mode = HDLC_MODE_TRANS;
8767 -               else
8768 -                       bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG;
8769 +               bcs->ctrl.sr.mode = HDLC_MODE_ITF_FLG;
8770                 adapter->write_ctrl(bcs, 5);
8771                 bcs->ctrl.sr.cmd = HDLC_CMD_XRS;
8772                 adapter->write_ctrl(bcs, 1);
8773 @@ -645,10 +649,10 @@
8774                 return;
8775         DBG(2, "STATUS0 %#x", val);
8776         if (val & AVM_STATUS0_IRQ_ISAC)
8777 -               isacsx_irq(&adapter->isac);
8778 +               isacsx_interrupt(&adapter->isac);
8779  
8780         if (val & AVM_STATUS0_IRQ_HDLC)
8781 -               hdlc_irq(adapter);
8782 +               hdlc_interrupt(adapter);
8783  }
8784  
8785  static void fcpci_irq(int intno, void *dev, struct pt_regs *regs)
8786 @@ -662,10 +666,10 @@
8787                 return;
8788         DBG(2, "sval %#x", sval);
8789         if (!(sval & AVM_STATUS0_IRQ_ISAC))
8790 -               isac_irq(&adapter->isac);
8791 +               isac_interrupt(&adapter->isac);
8792  
8793         if (!(sval & AVM_STATUS0_IRQ_HDLC))
8794 -               hdlc_irq(adapter);
8795 +               hdlc_interrupt(adapter);
8796  }
8797  
8798  // ----------------------------------------------------------------------
8799 @@ -681,11 +685,6 @@
8800  {
8801         outb(AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER | 
8802              AVM_STATUS0_ENA_IRQ, adapter->io + AVM_STATUS0);
8803 -
8804 -       outb(AVM_STATUS1_ENA_IOM | adapter->irq, 
8805 -            adapter->io + AVM_STATUS1);
8806 -       set_current_state(TASK_UNINTERRUPTIBLE);
8807 -       schedule_timeout(50*HZ / 1000); /* Timeout 50ms */
8808  }
8809  
8810  // ----------------------------------------------------------------------
8811 @@ -693,6 +692,7 @@
8812  static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter)
8813  {
8814         u32 val = 0;
8815 +       struct pci_dev *pdev = adapter->pci_dev;
8816         int retval;
8817  
8818         DBG(1,"");
8819 @@ -700,21 +700,21 @@
8820         isac_init(&adapter->isac); // FIXME is this okay now
8821  
8822         retval = -EBUSY;
8823 -       if (!request_region(adapter->io, 32, "fcpcipnp"))
8824 +       if (!request_region(adapter->io, 32, "hisax_fcpcipnp"))
8825                 goto err;
8826  
8827         switch (adapter->type) {
8828         case AVM_FRITZ_PCIV2:
8829 -               retval = request_irq(adapter->irq, fcpci2_irq, SA_SHIRQ, 
8830 -                                    "fcpcipnp", adapter);
8831 +               retval = request_irq(pdev->irq, fcpci2_irq, SA_SHIRQ, 
8832 +                                    "hisax_fcpcipnp", adapter);
8833                 break;
8834         case AVM_FRITZ_PCI:
8835 -               retval = request_irq(adapter->irq, fcpci_irq, SA_SHIRQ,
8836 -                                    "fcpcipnp", adapter);
8837 +               retval = request_irq(pdev->irq, fcpci_irq, SA_SHIRQ,
8838 +                                    "hisax_fcpcipnp", adapter);
8839                 break;
8840         case AVM_FRITZ_PNP:
8841 -               retval = request_irq(adapter->irq, fcpci_irq, 0,
8842 -                                    "fcpcipnp", adapter);
8843 +               retval = request_irq(pdev->irq, fcpci_irq, 0,
8844 +                                    "hisax_fcpcipnp", adapter);
8845                 break;
8846         }
8847         if (retval)
8848 @@ -808,11 +808,23 @@
8849  
8850  static void __devexit fcpcipnp_release(struct fritz_adapter *adapter)
8851  {
8852 +       struct pci_dev *pdev = adapter->pci_dev;
8853 +
8854         DBG(1,"");
8855  
8856         outb(0, adapter->io + AVM_STATUS0);
8857 -       free_irq(adapter->irq, adapter);
8858 +       free_irq(pdev->irq, adapter);
8859         release_region(adapter->io, 32);
8860 +
8861 +       switch (adapter->type) {
8862 +       case AVM_FRITZ_PCI:
8863 +       case AVM_FRITZ_PCIV2:
8864 +               pci_disable_device(pdev);
8865 +               break;
8866 +       case AVM_FRITZ_PNP:
8867 +               pdev->deactivate(pdev);
8868 +               break;
8869 +       }
8870  }
8871  
8872  // ----------------------------------------------------------------------
8873 @@ -830,6 +842,8 @@
8874  
8875         memset(adapter, 0, sizeof(struct fritz_adapter));
8876  
8877 +       adapter->pci_dev = pdev;
8878 +
8879         SET_MODULE_OWNER(&adapter->isac.hisax_d_if);
8880         adapter->isac.hisax_d_if.ifc.priv = &adapter->isac;
8881         adapter->isac.hisax_d_if.ifc.l2l1 = isac_d_l2l1;
8882 @@ -840,6 +854,7 @@
8883                 adapter->bcs[i].b_if.ifc.priv = &adapter->bcs[i];
8884                 adapter->bcs[i].b_if.ifc.l2l1 = fritz_b_l2l1;
8885         }
8886 +       list_add(&adapter->list, &adapter_list);
8887  
8888         pci_set_drvdata(pdev, adapter);
8889  
8890 @@ -854,6 +869,7 @@
8891  static void delete_adapter(struct fritz_adapter *adapter)
8892  {
8893         hisax_unregister(&adapter->isac.hisax_d_if);
8894 +       list_del(&adapter->list);
8895         kfree(adapter);
8896  }
8897  
8898 @@ -863,12 +879,15 @@
8899         struct fritz_adapter *adapter;
8900         int retval;
8901  
8902 +       printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at %s\n",
8903 +              (char *) ent->driver_data, pdev->slot_name);
8904 +
8905         retval = -ENOMEM;
8906         adapter = new_adapter(pdev);
8907         if (!adapter)
8908                 goto err;
8909  
8910 -       if (pdev->device == PCI_DEVICE_ID_AVM_A1_V2) 
8911 +       if (pdev->device == 0x0e00) 
8912                 adapter->type = AVM_FRITZ_PCIV2;
8913         else
8914                 adapter->type = AVM_FRITZ_PCI;
8915 @@ -876,12 +895,7 @@
8916         retval = pci_enable_device(pdev);
8917         if (retval)
8918                 goto err_free;
8919 -
8920         adapter->io = pci_resource_start(pdev, 1);
8921 -       adapter->irq = pdev->irq;
8922 -
8923 -       printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at %s\n",
8924 -              (char *) ent->driver_data, pdev->slot_name);
8925  
8926         retval = fcpcipnp_setup(adapter);
8927         if (retval)
8928 @@ -901,6 +915,9 @@
8929         struct fritz_adapter *adapter;
8930         int retval;
8931  
8932 +       printk(KERN_INFO "hisax_fcpcipnp: found adapter %s\n",
8933 +              (char *) ent->driver_data);
8934 +
8935         retval = -ENOMEM;
8936         adapter = new_adapter(pdev);
8937         if (!adapter)
8938 @@ -912,11 +929,8 @@
8939         pdev->deactivate(pdev); // why?
8940         pdev->activate(pdev);
8941         adapter->io = pdev->resource[0].start;
8942 -       adapter->irq = pdev->irq_resource[0].start;
8943 -
8944 -       printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at IO %#x irq %d\n",
8945 -              (char *) ent->driver_data, adapter->io, adapter->irq);
8946 -
8947 +       pdev->irq = pdev->irq_resource[0].start;
8948 +       
8949         retval = fcpcipnp_setup(adapter);
8950         if (retval)
8951                 goto err_free;
8952 @@ -929,43 +943,35 @@
8953         return retval;
8954  }
8955  
8956 -static void __devexit fcpci_remove(struct pci_dev *pdev)
8957 -{
8958 -       struct fritz_adapter *adapter = pci_get_drvdata(pdev);
8959 -
8960 -       fcpcipnp_release(adapter);
8961 -       pci_disable_device(pdev);
8962 -       delete_adapter(adapter);
8963 -}
8964 -
8965 -static void __devexit fcpnp_remove(struct pci_dev *pdev)
8966 +static void __devexit fcpcipnp_remove(struct pci_dev *pdev)
8967  {
8968         struct fritz_adapter *adapter = pci_get_drvdata(pdev);
8969  
8970         fcpcipnp_release(adapter);
8971 -       pdev->deactivate(pdev);
8972         delete_adapter(adapter);
8973  }
8974  
8975  static struct pci_driver fcpci_driver = {
8976 -       name:     "fcpci",
8977 -       probe:    fcpci_probe,
8978 -       remove:   __devexit_p(fcpci_remove),
8979 +       name: "fcpci",
8980 +       probe: fcpci_probe,
8981 +       remove: fcpcipnp_remove,
8982         id_table: fcpci_ids,
8983  };
8984  
8985  static struct isapnp_driver fcpnp_driver = {
8986 -       name:     "fcpnp",
8987 -       probe:    fcpnp_probe,
8988 -       remove:   __devexit_p(fcpnp_remove),
8989 +       name: "fcpnp",
8990 +       probe: fcpnp_probe,
8991 +       remove: fcpcipnp_remove,
8992         id_table: fcpnp_ids,
8993  };
8994  
8995 -static int __init hisax_fcpcipnp_init(void)
8996 +static LIST_HEAD(isapnp_drivers);
8997 +
8998 +static int __init hisax_fcpci_init(void)
8999  {
9000         int retval, pci_nr_found;
9001  
9002 -       printk(KERN_INFO "hisax_fcpcipnp: Fritz!Card PCI/PCIv2/PnP ISDN driver v0.0.1\n");
9003 +       printk(KERN_INFO "hisax_fcpcipnp: Fritz!PCI/PnP ISDN driver v0.0.1\n");
9004  
9005         retval = pci_register_driver(&fcpci_driver);
9006         if (retval < 0)
9007 @@ -976,15 +982,14 @@
9008         if (retval < 0)
9009                 goto out_unregister_pci;
9010  
9011 -#if !defined(CONFIG_HOTPLUG) || defined(MODULE)
9012 +#if !defined(CONFIG_HOTPLUG) && defined(MODULE)
9013         if (pci_nr_found + retval == 0) {
9014                 retval = -ENODEV;
9015                 goto out_unregister_isapnp;
9016 -       }
9017  #endif
9018         return 0;
9019  
9020 -#if !defined(CONFIG_HOTPLUG) || defined(MODULE)
9021 +#if !defined(CONFIG_HOTPLUG) && defined(MODULE)
9022   out_unregister_isapnp:
9023         isapnp_unregister_driver(&fcpnp_driver);
9024  #endif
9025 @@ -994,11 +999,15 @@
9026         return retval;
9027  }
9028  
9029 -static void __exit hisax_fcpcipnp_exit(void)
9030 +static void __exit hisax_fcpci_exit(void)
9031  {
9032         isapnp_unregister_driver(&fcpnp_driver);
9033         pci_unregister_driver(&fcpci_driver);
9034  }
9035  
9036 -module_init(hisax_fcpcipnp_init);
9037 -module_exit(hisax_fcpcipnp_exit);
9038 +module_init(hisax_fcpci_init);
9039 +module_exit(hisax_fcpci_exit);
9040 +
9041 +#ifdef __ISAPNP__
9042 +#include "hisax_isapnp.c"
9043 +#endif
9044 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.h linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.h
9045 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_fcpcipnp.h        2005-03-22 14:47:56.000000000 +0100
9046 +++ linux-2.4.29/drivers/isdn/hisax/hisax_fcpcipnp.h    2005-03-22 15:06:46.484026136 +0100
9047 @@ -43,10 +43,12 @@
9048  };
9049  
9050  struct fritz_adapter {
9051 +       struct list_head list;
9052 +       struct pci_dev *pci_dev;
9053 +
9054         int type;
9055         spinlock_t hw_lock;
9056         unsigned int io;
9057 -       unsigned int irq;
9058         struct isac isac;
9059  
9060         struct fritz_bcs bcs[2];
9061 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.c linux-2.4.29/drivers/isdn/hisax/hisax_isac.c
9062 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.c    2005-03-22 14:47:56.000000000 +0100
9063 +++ linux-2.4.29/drivers/isdn/hisax/hisax_isac.c        2005-03-22 15:06:46.543017168 +0100
9064 @@ -34,7 +34,7 @@
9065  static int debug = 1;
9066  MODULE_PARM(debug, "i");
9067  
9068 -static char *ISACVer[] = {
9069 +static char *ISACVer[] __devinitdata = {
9070    "2086/2186 V1.1", 
9071    "2085 B1", 
9072    "2085 B2",
9073 @@ -42,10 +42,6 @@
9074  };
9075  #endif
9076  
9077 -MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
9078 -MODULE_DESCRIPTION("ISAC/ISAC-SX driver");
9079 -MODULE_LICENSE("GPL");
9080 -
9081  #define DBG_WARN      0x0001
9082  #define DBG_IRQ       0x0002
9083  #define DBG_L1M       0x0004
9084 @@ -438,7 +434,7 @@
9085         va_end(args);
9086  }
9087  
9088 -static void isac_version(struct isac *cs)
9089 +static void __devinit isac_version(struct isac *cs)
9090  {
9091         int val;
9092  
9093 @@ -602,7 +598,7 @@
9094         }
9095  }
9096  
9097 -void isac_irq(struct isac *isac)
9098 +void isac_interrupt(struct isac *isac)
9099  {
9100         unsigned char val;
9101  
9102 @@ -635,8 +631,6 @@
9103         if (val & ISAC_ISTA_SIN) {
9104                 DBG(DBG_WARN, "SIN");
9105         }
9106 -       isac->write_isac(isac, ISAC_MASK, 0xff);
9107 -       isac->write_isac(isac, ISAC_MASK, 0x00);
9108  }
9109  
9110  // ======================================================================
9111 @@ -742,7 +736,7 @@
9112         }
9113  }
9114  
9115 -void isacsx_irq(struct isac *isac)
9116 +void isacsx_interrupt(struct isac *isac)
9117  {
9118         unsigned char val;
9119  
9120 @@ -755,7 +749,7 @@
9121                 isacsx_cic_interrupt(isac);
9122  }
9123  
9124 -void isac_init(struct isac *isac)
9125 +void __devinit isac_init(struct isac *isac)
9126  {
9127         isac->tx_skb = NULL;
9128         isac->l1m.fsm = &l1fsm;
9129 @@ -770,7 +764,7 @@
9130         FsmInitTimer(&isac->l1m, &isac->timer);
9131  }
9132  
9133 -void isac_setup(struct isac *isac)
9134 +void __devinit isac_setup(struct isac *isac)
9135  {
9136         int val, eval;
9137  
9138 @@ -781,7 +775,7 @@
9139  
9140         isac->write_isac(isac, ISAC_MASK, 0xff);
9141         isac->mocr = 0xaa;
9142 -       if (test_bit(ISAC_IOM1, &isac->flags)) {
9143 +       if (test_bit(HW_IOM1, &isac->flags)) {
9144                 /* IOM 1 Mode */
9145                 isac->write_isac(isac, ISAC_ADF2, 0x0);
9146                 isac->write_isac(isac, ISAC_SPCR, 0xa);
9147 @@ -817,7 +811,7 @@
9148         FsmEvent(&isac->l1m, (val >> 2) & 0xf, NULL);
9149  
9150         isac->write_isac(isac, ISAC_MASK, 0x0);
9151 -       // RESET Receiver and Transmitter
9152 +       /* RESET Receiver and Transmitter */
9153         isac->write_isac(isac, ISAC_CMDR, ISAC_CMDR_XRES | ISAC_CMDR_RRES);
9154  }
9155  
9156 @@ -888,10 +882,10 @@
9157  EXPORT_SYMBOL(isac_d_l2l1);
9158  
9159  EXPORT_SYMBOL(isacsx_setup);
9160 -EXPORT_SYMBOL(isacsx_irq);
9161 +EXPORT_SYMBOL(isacsx_interrupt);
9162  
9163  EXPORT_SYMBOL(isac_setup);
9164 -EXPORT_SYMBOL(isac_irq);
9165 +EXPORT_SYMBOL(isac_interrupt);
9166  
9167  module_init(hisax_isac_init);
9168  module_exit(hisax_isac_exit);
9169 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.h linux-2.4.29/drivers/isdn/hisax/hisax_isac.h
9170 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_isac.h    2005-03-22 14:47:56.000000000 +0100
9171 +++ linux-2.4.29/drivers/isdn/hisax/hisax_isac.h        2005-03-22 15:06:46.559014736 +0100
9172 @@ -8,7 +8,7 @@
9173  #define TIMER3_VALUE 7000
9174  #define MAX_DFRAME_LEN_L1 300
9175  
9176 -#define ISAC_IOM1      0
9177 +#define HW_IOM1        0
9178  
9179  struct isac {
9180         void *priv;
9181 @@ -37,9 +37,9 @@
9182  void isac_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg);
9183  
9184  void isac_setup(struct isac *isac);
9185 -void isac_irq(struct isac *isac);
9186 +void isac_interrupt(struct isac *isac);
9187  
9188  void isacsx_setup(struct isac *isac);
9189 -void isacsx_irq(struct isac *isac);
9190 +void isacsx_interrupt(struct isac *isac);
9191  
9192  #endif
9193 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.c linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.c
9194 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.c  1970-01-01 01:00:00.000000000 +0100
9195 +++ linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.c      2005-03-22 15:06:46.576012152 +0100
9196 @@ -0,0 +1,105 @@
9197 +// FIXME copied
9198 +static const struct isapnp_device_id *
9199 +isapnp_match_device(const struct isapnp_device_id *ids, struct pci_dev *dev)
9200 +{
9201 +       DBG(1,"");
9202 +
9203 +       while (ids->card_vendor || ids->card_device) {
9204 +               if ((ids->card_vendor == ISAPNP_ANY_ID || ids->card_vendor == dev->bus->vendor) &&
9205 +                   (ids->card_device == ISAPNP_ANY_ID || ids->card_device == dev->bus->device) &&
9206 +                    (ids->vendor == ISAPNP_ANY_ID || ids->vendor == dev->vendor) &&
9207 +                    (ids->function == ISAPNP_ANY_ID || ids->function == dev->device))
9208 +                       return ids;
9209 +               ids++;
9210 +       }
9211 +       return NULL;
9212 +}
9213 +
9214 +/**
9215 + * pci_dev_driver - get the pci_driver of a device
9216 + * @dev: the device to query
9217 + *
9218 + * Returns the appropriate pci_driver structure or %NULL if there is no 
9219 + * registered driver for the device.
9220 + */
9221 +struct pci_driver *isapnp_dev_driver(const struct pci_dev *dev)
9222 +{
9223 +       return dev->driver;
9224 +}
9225 +
9226 +static int isapnp_announce_device(struct isapnp_driver *drv, struct pci_dev *dev)
9227 +{
9228 +       const struct isapnp_device_id *id;
9229 +       int ret = 0;
9230 +
9231 +       DBG(1,"");
9232 +
9233 +       if (drv->id_table) {
9234 +               id = isapnp_match_device(drv->id_table, dev);
9235 +               if (!id) {
9236 +                       ret = 0;
9237 +                       goto out;
9238 +               }
9239 +       } else
9240 +               id = NULL;
9241 +
9242 +//     dev_probe_lock();
9243 +       if (drv->probe(dev, id) >= 0) {
9244 +               dev->driver = (struct pci_driver *) drv;
9245 +               ret = 1;
9246 +       }
9247 +//     dev_probe_unlock();
9248 +out:
9249 +       return ret;
9250 +}
9251 +
9252 +/**
9253 + * FIXME pci_register_driver - register a new pci driver
9254 + * @drv: the driver structure to register
9255 + * 
9256 + * Adds the driver structure to the list of registered drivers
9257 + * Returns the number of pci devices which were claimed by the driver
9258 + * during registration.  The driver remains registered even if the
9259 + * return value is zero.
9260 + */
9261 +int isapnp_register_driver(struct isapnp_driver *drv)
9262 +{
9263 +       struct pci_dev *dev;
9264 +       int count = 0;
9265 +
9266 +       DBG(1,"");
9267 +
9268 +       list_add_tail(&drv->node, &isapnp_drivers);
9269 +       isapnp_for_each_dev(dev) {
9270 +               if (!isapnp_dev_driver(dev))
9271 +                       count += isapnp_announce_device(drv, dev);
9272 +       }
9273 +       return count;
9274 +}
9275 +
9276 +/**
9277 + * pci_unregister_driver - unregister a pci driver
9278 + * @drv: the driver structure to unregister
9279 + * 
9280 + * Deletes the driver structure from the list of registered PCI drivers,
9281 + * gives it a chance to clean up by calling its remove() function for
9282 + * each device it was responsible for, and marks those devices as
9283 + * driverless.
9284 + */
9285 +
9286 +void isapnp_unregister_driver(struct isapnp_driver *drv)
9287 +{
9288 +       struct pci_dev *dev;
9289 +
9290 +       DBG(1,"");
9291 +
9292 +       list_del(&drv->node);
9293 +       isapnp_for_each_dev(dev) {
9294 +               if (dev->driver == (struct pci_driver *) drv) {
9295 +                       if (drv->remove)
9296 +                               drv->remove(dev);
9297 +                       dev->driver = NULL;
9298 +               }
9299 +       }
9300 +}
9301 +
9302 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.h linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.h
9303 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_isapnp.h  1970-01-01 01:00:00.000000000 +0100
9304 +++ linux-2.4.29/drivers/isdn/hisax/hisax_isapnp.h      2005-03-22 15:06:46.590010024 +0100
9305 @@ -0,0 +1,33 @@
9306 +#ifndef __HISAX_ISAPNP_H__
9307 +#define __HISAX_ISAPNP_H__
9308 +
9309 +#include <linux/isapnp.h>
9310 +
9311 +#ifdef COMPAT_NEED_ISAPNP_DRIVER
9312 +struct isapnp_driver {
9313 +       struct list_head node;
9314 +       char *name;
9315 +       const struct isapnp_device_id *id_table;        /* NULL if wants all devices */
9316 +       int  (*probe)  (struct pci_dev *dev, const struct isapnp_device_id *id);        /* New device inserted */
9317 +       void (*remove) (struct pci_dev *dev);   /* Device removed (NULL if not a hot-plug capable driver) */
9318 +};
9319 +#endif
9320 +#ifdef __ISAPNP__
9321 +
9322 +int isapnp_register_driver(struct isapnp_driver *drv);
9323 +void isapnp_unregister_driver(struct isapnp_driver *drv);
9324 +
9325 +#else
9326 +
9327 +static inline int isapnp_register_driver(struct isapnp_driver *drv) 
9328 +{ 
9329 +       return 0;
9330 +}
9331 +
9332 +static inline void isapnp_unregister_driver(struct isapnp_driver *drv) 
9333 +{ 
9334 +}
9335 +
9336 +#endif
9337 +
9338 +#endif
9339 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hisax_loadable.h linux-2.4.29/drivers/isdn/hisax/hisax_loadable.h
9340 --- linux-2.4.29.old/drivers/isdn/hisax/hisax_loadable.h        1970-01-01 01:00:00.000000000 +0100
9341 +++ linux-2.4.29/drivers/isdn/hisax/hisax_loadable.h    2005-03-22 15:06:46.606007592 +0100
9342 @@ -0,0 +1,74 @@
9343 +/* $Id: hisax_loadable.h,v 2.1 2001/06/08 22:19:16 werner Exp $
9344 + *
9345 + *
9346 + * Author       (C) 2001 Werner Cornelius (werner@isdn-development.de)
9347 + *              modular driver for Colognechip HFC-USB chip
9348 + *              as plugin for HiSax isdn driver
9349 + *
9350 + * Copyright 2001  by Werner Cornelius (werner@isdn4linux.de)
9351 + *
9352 + * This program is free software; you can redistribute it and/or modify
9353 + * it under the terms of the GNU General Public License as published by
9354 + * the Free Software Foundation; either version 2, or (at your option)
9355 + * any later version.
9356 + *
9357 + * This program is distributed in the hope that it will be useful,
9358 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9359 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9360 + * GNU General Public License for more details.
9361 + *
9362 + * You should have received a copy of the GNU General Public License
9363 + * along with this program; if not, write to the Free Software
9364 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
9365 + *
9366 + */
9367 +
9368 +#include <linux/types.h>
9369 +#include <linux/skbuff.h>
9370 +
9371 +/***************************************/
9372 +/* additional defines for l1 constants */
9373 +/***************************************/
9374 +#define B1_DATA       0x1f0
9375 +#define B1_SETMODE    0x1f4
9376 +#define B2_DATA       0x1f8
9377 +#define B2_SETMODE    0x1fc
9378 +
9379 +
9380 +/********************************************************/
9381 +/* structure used for register and release of L1 driver */
9382 +/********************************************************/
9383 +struct hisax_drvreg {
9384 +       int version;            /* actual version for check */
9385 +       int cmd;                /* command code */
9386 +
9387 +       /* function pointers set by hisax during register call */
9388 +       void (*release_driver) (void *arg_hisax);       /* set by hisax, release function for driver */
9389 +       void (*dch_l1l2) (void *arg_hisax, int pr, void *arg);  /* set by hisax, notify dch+l1 events */
9390 +       void (*bch_l1l2) (void *arg_hisax, int chan, int pr, void *arg);        /* set by hisax, notify bch events */
9391 +       void *arg_hisax;        /* argument when calling hisax main */
9392 +       struct sk_buff_head *drq;       /* pointer to D-receive queue */
9393 +       struct sk_buff_head *dsq;       /* pointer to D-send queue */
9394 +       struct sk_buff_head erq;        /* E-receive queue */
9395 +       struct sk_buff_head *brq[2];    /* pointer to B-receive queues */
9396 +       struct sk_buff **bsk[2];        /* pointer to B-transmit buffer */
9397 +
9398 +       /* function pointers set by l1 driver before calling the register function */
9399 +       void (*dch_l2l1) (void *argl1, int pr, void *arg);      /* function dch+l1 from hisax -> l1 */
9400 +       void (*bch_l2l1) (void *argl1, int chan, int pr, void *arg);    /* function bch from hisax -> l1 */
9401 +       void *argl1;            /* pointer to l1 data structure when calling l1 */
9402 +
9403 +       char *drvname;          /* driver name for hisax usage */
9404 +};
9405 +
9406 +/**************************/
9407 +/* constants and commands */
9408 +/**************************/
9409 +#define HISAX_LOAD_VERSION  4  /* change when interface changes */
9410 +#define HISAX_LOAD_CHKVER   0  /* check version command (returns 0 on success) */
9411 +#define HISAX_LOAD_REGISTER 1  /* register the L1 driver and return 0 on success */
9412 +
9413 +/***************************************/
9414 +/* definition of the register function */
9415 +/***************************************/
9416 +extern int hisax_register_hfcusb(struct hisax_drvreg *l1drv);
9417 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hscx.c linux-2.4.29/drivers/isdn/hisax/hscx.c
9418 --- linux-2.4.29.old/drivers/isdn/hisax/hscx.c  2005-03-22 14:47:56.000000000 +0100
9419 +++ linux-2.4.29/drivers/isdn/hisax/hscx.c      2005-03-22 15:06:46.621005312 +0100
9420 @@ -1,4 +1,4 @@
9421 -/* $Id: hscx.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9422 +/* $Id: hscx.c,v 1.24 2001/09/24 13:22:56 kai Exp $
9423   *
9424   * HSCX specific routines
9425   *
9426 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hscx.h linux-2.4.29/drivers/isdn/hisax/hscx.h
9427 --- linux-2.4.29.old/drivers/isdn/hisax/hscx.h  2005-03-22 14:47:56.000000000 +0100
9428 +++ linux-2.4.29/drivers/isdn/hisax/hscx.h      2005-03-22 15:06:46.640002424 +0100
9429 @@ -1,4 +1,4 @@
9430 -/* $Id: hscx.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9431 +/* $Id: hscx.h,v 1.8 2001/09/24 13:22:56 kai Exp $
9432   *
9433   * HSCX specific defines
9434   *
9435 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/hscx_irq.c linux-2.4.29/drivers/isdn/hisax/hscx_irq.c
9436 --- linux-2.4.29.old/drivers/isdn/hisax/hscx_irq.c      2005-03-22 14:47:56.000000000 +0100
9437 +++ linux-2.4.29/drivers/isdn/hisax/hscx_irq.c  2005-03-22 15:06:46.655999992 +0100
9438 @@ -1,4 +1,4 @@
9439 -/* $Id: hscx_irq.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9440 +/* $Id: hscx_irq.c,v 1.18 2001/09/24 13:22:56 kai Exp $
9441   *
9442   * low level b-channel stuff for Siemens HSCX
9443   *
9444 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/icc.c linux-2.4.29/drivers/isdn/hisax/icc.c
9445 --- linux-2.4.29.old/drivers/isdn/hisax/icc.c   2005-03-22 14:47:56.000000000 +0100
9446 +++ linux-2.4.29/drivers/isdn/hisax/icc.c       2005-03-22 15:06:46.672997408 +0100
9447 @@ -1,4 +1,4 @@
9448 -/* $Id: icc.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9449 +/* $Id: icc.c,v 1.8 2001/09/24 13:22:56 kai Exp $
9450   *
9451   * ICC specific routines
9452   *
9453 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/icc.h linux-2.4.29/drivers/isdn/hisax/icc.h
9454 --- linux-2.4.29.old/drivers/isdn/hisax/icc.h   2005-03-22 14:47:56.000000000 +0100
9455 +++ linux-2.4.29/drivers/isdn/hisax/icc.h       2005-03-22 15:06:46.687995128 +0100
9456 @@ -1,4 +1,4 @@
9457 -/* $Id: icc.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9458 +/* $Id: icc.h,v 1.4 2001/09/24 13:22:56 kai Exp $
9459   *
9460   * ICC specific routines
9461   *
9462 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/ipac.h linux-2.4.29/drivers/isdn/hisax/ipac.h
9463 --- linux-2.4.29.old/drivers/isdn/hisax/ipac.h  2005-03-22 14:47:56.000000000 +0100
9464 +++ linux-2.4.29/drivers/isdn/hisax/ipac.h      2005-03-22 15:06:46.702992848 +0100
9465 @@ -1,4 +1,4 @@
9466 -/* $Id: ipac.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9467 +/* $Id: ipac.h,v 1.7 2001/09/24 13:22:56 kai Exp $
9468   *
9469   * IPAC specific defines
9470   *
9471 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isac.c linux-2.4.29/drivers/isdn/hisax/isac.c
9472 --- linux-2.4.29.old/drivers/isdn/hisax/isac.c  2005-03-22 14:47:56.000000000 +0100
9473 +++ linux-2.4.29/drivers/isdn/hisax/isac.c      2005-03-22 15:06:46.844971264 +0100
9474 @@ -1,4 +1,4 @@
9475 -/* $Id: isac.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9476 +/* $Id: isac.c,v 1.31 2001/09/24 13:22:56 kai Exp $
9477   *
9478   * ISAC specific routines
9479   *
9480 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isac.h linux-2.4.29/drivers/isdn/hisax/isac.h
9481 --- linux-2.4.29.old/drivers/isdn/hisax/isac.h  2005-03-22 14:47:56.000000000 +0100
9482 +++ linux-2.4.29/drivers/isdn/hisax/isac.h      2005-03-22 15:06:47.111930680 +0100
9483 @@ -1,4 +1,4 @@
9484 -/* $Id: isac.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9485 +/* $Id: isac.h,v 1.9 2001/09/24 13:22:56 kai Exp $
9486   *
9487   * ISAC specific defines
9488   *
9489 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isar.c linux-2.4.29/drivers/isdn/hisax/isar.c
9490 --- linux-2.4.29.old/drivers/isdn/hisax/isar.c  2005-03-22 14:47:56.000000000 +0100
9491 +++ linux-2.4.29/drivers/isdn/hisax/isar.c      2005-03-22 15:06:47.302901648 +0100
9492 @@ -1,4 +1,4 @@
9493 -/* $Id: isar.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9494 +/* $Id: isar.c,v 1.22 2001/09/23 12:00:05 keil Exp $
9495   *
9496   * isar.c   ISAR (Siemens PSB 7110) specific routines
9497   *
9498 @@ -21,12 +21,10 @@
9499  #define DLE    0x10
9500  #define ETX    0x03
9501  
9502 -#define FAXMODCNT      13
9503 -const  u_char  faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146};
9504 -static u_int   modmask = 0x1fff;
9505 -static int     frm_extra_delay = 2;
9506 -static int     para_TOA = 6;
9507 -const   u_char  *FC1_CMD[] = {"FAE", "FTS", "FRS", "FTM", "FRM", "FTH", "FRH", "CTRL" };
9508 +
9509 +const u_char faxmodulation_s[] = "3,24,48,72,73,74,96,97,98,121,122,145,146"; 
9510 +const u_char faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146}; 
9511 +#define FAXMODCNT 13
9512  
9513  void isar_setup(struct IsdnCardState *cs);
9514  static void isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para);
9515 @@ -127,7 +125,7 @@
9516         ireg->clsb = cs->BC_Read_Reg(cs, 1, ISAR_CTRL_L);
9517  #if DUMP_MBOXFRAME
9518         if (cs->debug & L1_DEB_HSCX)
9519 -               debugl1(cs, "irq_stat(%02x,%02x,%d)", ireg->iis, ireg->cmsb,
9520 +               debugl1(cs, "rcv_mbox(%02x,%02x,%d)", ireg->iis, ireg->cmsb,
9521                         ireg->clsb);
9522  #endif
9523  }
9524 @@ -414,7 +412,6 @@
9525         }
9526         cs->debug = debug;
9527         isar_setup(cs);
9528 -
9529         ret = 0;
9530  reterrflg:
9531         restore_flags(flags);
9532 @@ -428,21 +425,6 @@
9533         return(ret);
9534  }
9535  
9536 -static inline void
9537 -ll_deliver_faxstat(struct BCState *bcs, u_char status)
9538 -{
9539 -        isdn_ctrl ic;
9540 -       struct Channel *chanp = (struct Channel *) bcs->st->lli.userdata;
9541
9542 -       if (bcs->cs->debug & L1_DEB_HSCX)
9543 -               debugl1(bcs->cs, "HL->LL FAXIND %x", status);
9544 -       ic.driver = bcs->cs->myid;
9545 -       ic.command = ISDN_STAT_FAXIND;
9546 -       ic.arg = chanp->chan;
9547 -       ic.parm.aux.cmd = status;
9548 -       bcs->cs->iif.statcallb(&ic);
9549 -}
9550 -
9551  extern void BChannel_bh(struct BCState *);
9552  #define B_LL_NOCARRIER 8
9553  #define B_LL_CONNECT   9
9554 @@ -599,6 +581,7 @@
9555                                 if (ireg->cmsb & SART_NMD) { /* ABORT */
9556                                         if (cs->debug & L1_DEB_WARN)
9557                                                 debugl1(cs, "isar_rcv_frame: no more data");
9558 +                                       cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9559                                         bcs->hw.isar.rcvidx = 0;
9560                                         send_DLE_ETX(bcs);
9561                                         sendmsg(cs, SET_DPS(bcs->hw.isar.dpath) |
9562 @@ -609,6 +592,7 @@
9563                                 }
9564                         } else {
9565                                 printk(KERN_WARNING "HiSax: skb out of memory\n");
9566 +                               cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9567                         }
9568                         break;
9569                 }
9570 @@ -633,9 +617,8 @@
9571                         bcs->hw.isar.rcvidx = 0;
9572                         cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9573                 } else {
9574 -                       if (ireg->cmsb & HDLC_FSD) {
9575 +                       if (ireg->cmsb & HDLC_FSD)
9576                                 bcs->hw.isar.rcvidx = 0;
9577 -                       }
9578                         ptr = bcs->hw.isar.rcvbuf + bcs->hw.isar.rcvidx;
9579                         bcs->hw.isar.rcvidx += ireg->clsb;
9580                         rcv_mbox(cs, ireg, ptr);
9581 @@ -646,8 +629,6 @@
9582                                         if (cs->debug & L1_DEB_WARN)
9583                                                 debugl1(cs, "isar frame to short %d",
9584                                                         bcs->hw.isar.rcvidx);
9585 -                                       printk(KERN_WARNING "ISAR: frame to short %d\n",
9586 -                                               bcs->hw.isar.rcvidx);
9587                                 } else if (!(skb = dev_alloc_skb(bcs->hw.isar.rcvidx))) {
9588                                         printk(KERN_WARNING "ISAR: receive out of memory\n");
9589                                 } else {
9590 @@ -658,7 +639,6 @@
9591                                         isar_sched_event(bcs, B_RCVBUFREADY);
9592                                         send_DLE_ETX(bcs);
9593                                         isar_sched_event(bcs, B_LL_OK);
9594 -                                       test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9595                                 }
9596                                 bcs->hw.isar.rcvidx = 0;
9597                         }
9598 @@ -666,14 +646,13 @@
9599                 if (ireg->cmsb & SART_NMD) { /* ABORT */
9600                         if (cs->debug & L1_DEB_WARN)
9601                                 debugl1(cs, "isar_rcv_frame: no more data");
9602 +                       cs->BC_Write_Reg(cs, 1, ISAR_IIA, 0);
9603                         bcs->hw.isar.rcvidx = 0;
9604 +                       send_DLE_ETX(bcs);
9605                         sendmsg(cs, SET_DPS(bcs->hw.isar.dpath) |
9606                                 ISAR_HIS_PUMPCTRL, PCTRL_CMD_ESC, 0, NULL);
9607                         bcs->hw.isar.state = STFAX_ESCAPE;
9608 -                       if (test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag)) {
9609 -                               send_DLE_ETX(bcs);
9610 -                               isar_sched_event(bcs, B_LL_NOCARRIER);
9611 -                       }
9612 +                       isar_sched_event(bcs, B_LL_NOCARRIER);
9613                 }
9614                 break;
9615         default:
9616 @@ -977,6 +956,21 @@
9617         }
9618  }
9619  
9620 +static inline void
9621 +ll_deliver_faxstat(struct BCState *bcs, u_char status)
9622 +{
9623 +        isdn_ctrl ic;
9624 +       struct Channel *chanp = (struct Channel *) bcs->st->lli.userdata;
9625
9626 +       if (bcs->cs->debug & L1_DEB_HSCX)
9627 +               debugl1(bcs->cs, "HL->LL FAXIND %x", status);
9628 +       ic.driver = bcs->cs->myid;
9629 +       ic.command = ISDN_STAT_FAXIND;
9630 +       ic.arg = chanp->chan;
9631 +       ic.parm.aux.cmd = status;
9632 +       bcs->cs->iif.statcallb(&ic);
9633 +}
9634 +
9635  static void
9636  isar_pump_statev_fax(struct BCState *bcs, u_char devt) {
9637         struct IsdnCardState *cs = bcs->cs;
9638 @@ -1081,22 +1075,19 @@
9639                         if (cs->debug & L1_DEB_HSCX)
9640                                 debugl1(cs, "pump stev RSP_DISC");
9641                         if (bcs->hw.isar.state == STFAX_ESCAPE) {
9642 -                               p1 = 5;
9643                                 switch(bcs->hw.isar.newcmd) {
9644                                         case 0:
9645                                                 bcs->hw.isar.state = STFAX_READY;
9646                                                 break;
9647 -                                       case PCTRL_CMD_FTM:
9648 -                                               p1 = 2;
9649                                         case PCTRL_CMD_FTH:
9650 +                                       case PCTRL_CMD_FTM:
9651 +                                               p1 = 10;
9652                                                 sendmsg(cs, dps | ISAR_HIS_PUMPCTRL,
9653                                                         PCTRL_CMD_SILON, 1, &p1);
9654                                                 bcs->hw.isar.state = STFAX_SILDET;
9655                                                 break;
9656 -                                       case PCTRL_CMD_FRM:
9657 -                                               if (frm_extra_delay)
9658 -                                                       mdelay(frm_extra_delay);
9659                                         case PCTRL_CMD_FRH:
9660 +                                       case PCTRL_CMD_FRM:
9661                                                 p1 = bcs->hw.isar.mod = bcs->hw.isar.newmod;
9662                                                 bcs->hw.isar.newmod = 0;
9663                                                 bcs->hw.isar.cmd = bcs->hw.isar.newcmd;
9664 @@ -1215,9 +1206,6 @@
9665                                         isar_pump_statev_modem(bcs, ireg->cmsb);
9666                                 } else if (bcs->mode == L1_MODE_FAX) {
9667                                         isar_pump_statev_fax(bcs, ireg->cmsb);
9668 -                               } else if (ireg->cmsb == PSEV_10MS_TIMER) {
9669 -                                       if (cs->debug & L1_DEB_HSCX)
9670 -                                               debugl1(cs, "pump stev TIMER");
9671                                 } else {
9672                                         if (cs->debug & L1_DEB_WARN)
9673                                                 debugl1(cs, "isar IIS_PSTEV pmode %d stat %x",
9674 @@ -1278,9 +1266,6 @@
9675         if (test_and_clear_bit(BC_FLG_LL_CONN, &bcs->Flag)) {
9676                 isar_sched_event(bcs, B_LL_CONNECT);
9677         }
9678 -       if (test_and_clear_bit(BC_FLG_FTI_FTS, &bcs->Flag)) {
9679 -               isar_sched_event(bcs, B_LL_OK);
9680 -       }
9681  }
9682  
9683  static void
9684 @@ -1303,7 +1288,7 @@
9685                         } else {
9686                                 param[5] = PV32P6_ATN;
9687                         }
9688 -                       param[0] = para_TOA; /* 6 db */
9689 +                       param[0] = 6; /* 6 db */
9690                         param[1] = PV32P2_V23R | PV32P2_V22A | PV32P2_V22B |
9691                                    PV32P2_V22C | PV32P2_V21 | PV32P2_BEL; 
9692                         param[2] = PV32P3_AMOD | PV32P3_V32B | PV32P3_V23B;
9693 @@ -1319,7 +1304,7 @@
9694                         } else {
9695                                 param[1] = PFAXP2_ATN;
9696                         }
9697 -                       param[0] = para_TOA; /* 6 db */
9698 +                       param[0] = 6; /* 6 db */
9699                         sendmsg(cs, dps | ISAR_HIS_PUMPCFG, ctrl, 2, param);
9700                         bcs->hw.isar.state = STFAX_NULL;
9701                         bcs->hw.isar.newcmd = 0;
9702 @@ -1348,6 +1333,7 @@
9703                                 "\0\0");
9704                         break;
9705                 case L1_MODE_HDLC:
9706 +               case L1_MODE_FAX:
9707                         param[0] = 0;
9708                         sendmsg(cs, dps | ISAR_HIS_SARTCFG, SMODE_HDLC, 1,
9709                                 param);
9710 @@ -1359,9 +1345,6 @@
9711                         sendmsg(cs, dps | ISAR_HIS_SARTCFG, ctrl, 2,
9712                                 param);
9713                         break;
9714 -               case L1_MODE_FAX:
9715 -                       /* SART must not configured with FAX */
9716 -                       break;
9717         }
9718         udelay(1000);
9719         sendmsg(cs, dps | ISAR_HIS_BSTREQ, 0, 0, NULL);
9720 @@ -1465,7 +1448,6 @@
9721  
9722         switch(cmd) {
9723                 case ISDN_FAX_CLASS1_FTM:
9724 -                       test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9725                         if (bcs->hw.isar.state == STFAX_READY) {
9726                                 p1 = para;
9727                                 ctrl = PCTRL_CMD_FTM;
9728 @@ -1489,7 +1471,6 @@
9729                         }
9730                         break;
9731                 case ISDN_FAX_CLASS1_FTH:
9732 -                       test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9733                         if (bcs->hw.isar.state == STFAX_READY) {
9734                                 p1 = para;
9735                                 ctrl = PCTRL_CMD_FTH;
9736 @@ -1513,7 +1494,6 @@
9737                         }
9738                         break;
9739                 case ISDN_FAX_CLASS1_FRM:
9740 -                       test_and_clear_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9741                         if (bcs->hw.isar.state == STFAX_READY) {
9742                                 p1 = para;
9743                                 ctrl = PCTRL_CMD_FRM;
9744 @@ -1537,7 +1517,6 @@
9745                         }
9746                         break;
9747                 case ISDN_FAX_CLASS1_FRH:
9748 -                       test_and_set_bit(BC_FLG_FRH_WAIT, &bcs->Flag);
9749                         if (bcs->hw.isar.state == STFAX_READY) {
9750                                 p1 = para;
9751                                 ctrl = PCTRL_CMD_FRH;
9752 @@ -1560,11 +1539,6 @@
9753                                 bcs->hw.isar.state = STFAX_ESCAPE; 
9754                         }
9755                         break;
9756 -               case ISDN_FAXPUMP_HALT:
9757 -                       bcs->hw.isar.state = STFAX_NULL;
9758 -                       nom = 0;
9759 -                       ctrl = PCTRL_CMD_HALT;
9760 -                       break;
9761         }
9762         if (ctrl)
9763                 sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, ctrl, nom, &p1);
9764 @@ -1658,15 +1632,6 @@
9765                         l1_msg_b(st, pr, arg);
9766                         break;
9767                 case (PH_DEACTIVATE | CONFIRM):
9768 -                       switch(st->l1.mode) {
9769 -                               case L1_MODE_TRANS:
9770 -                               case L1_MODE_HDLC:
9771 -                               case L1_MODE_V32:
9772 -                                       break;
9773 -                               case L1_MODE_FAX:
9774 -                                       isar_pump_cmd(st->l1.bcs, ISDN_FAXPUMP_HALT, 0);
9775 -                                       break;
9776 -                       }
9777                         test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
9778                         test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
9779                         if (st->l1.bcs->cs->debug & L1_DEB_HSCX)
9780 @@ -1758,51 +1723,6 @@
9781                                                 test_and_set_bit(BC_FLG_DLEETX,
9782                                                         &bcs->Flag);
9783                                         break;
9784 -                               case ISDN_FAX_CLASS1_FTS:
9785 -                                       if (ic->parm.aux.subcmd == AT_QUERY) {
9786 -                                               ic->command = ISDN_STAT_FAXIND;
9787 -                                               ic->parm.aux.cmd = ISDN_FAX_CLASS1_OK;
9788 -                                               cs->iif.statcallb(ic);
9789 -                                               return(0);
9790 -                                       } else if (ic->parm.aux.subcmd == AT_EQ_QUERY) {
9791 -                                               strcpy(ic->parm.aux.para, "0-255");
9792 -                                               ic->command = ISDN_STAT_FAXIND;
9793 -                                               ic->parm.aux.cmd = ISDN_FAX_CLASS1_QUERY;
9794 -                                               cs->iif.statcallb(ic);
9795 -                                               return(0);
9796 -                                       } else if (ic->parm.aux.subcmd == AT_EQ_VALUE) {
9797 -                                               if (cs->debug & L1_DEB_HSCX)
9798 -                                                       debugl1(cs, "isar_auxcmd %s=%d",
9799 -                                                               FC1_CMD[ic->parm.aux.cmd], ic->parm.aux.para[0]);
9800 -                                               if (bcs->hw.isar.state == STFAX_READY) {
9801 -                                                       if (! ic->parm.aux.para[0]) {
9802 -                                                               ic->command = ISDN_STAT_FAXIND;
9803 -                                                               ic->parm.aux.cmd = ISDN_FAX_CLASS1_OK;
9804 -                                                               cs->iif.statcallb(ic);
9805 -                                                               return(0);
9806 -                                                       }
9807 -                                                       if (! test_and_set_bit(BC_FLG_FTI_RUN, &bcs->Flag)) {
9808 -                                                               /* n*10 ms */
9809 -                                                               bcs->hw.isar.ftimer.expires =
9810 -                                                                       jiffies + ((ic->parm.aux.para[0] * 10 * HZ)/1000);
9811 -                                                               test_and_set_bit(BC_FLG_FTI_FTS, &bcs->Flag);
9812 -                                                               add_timer(&bcs->hw.isar.ftimer);
9813 -                                                               return(0);
9814 -                                                       } else {
9815 -                                                               if (cs->debug)
9816 -                                                                       debugl1(cs, "isar FTS=%d and FTI busy",
9817 -                                                                               ic->parm.aux.para[0]);
9818 -                                                       }
9819 -                                               } else {
9820 -                                                       if (cs->debug)
9821 -                                                               debugl1(cs, "isar FTS=%d and isar.state not ready(%x)",
9822 -                                                                       ic->parm.aux.para[0],bcs->hw.isar.state);
9823 -                                               }
9824 -                                               ic->command = ISDN_STAT_FAXIND;
9825 -                                               ic->parm.aux.cmd = ISDN_FAX_CLASS1_ERROR;
9826 -                                               cs->iif.statcallb(ic);
9827 -                                       }
9828 -                                       break;
9829                                 case ISDN_FAX_CLASS1_FRM:
9830                                 case ISDN_FAX_CLASS1_FRH:
9831                                 case ISDN_FAX_CLASS1_FTM:
9832 @@ -1815,24 +1735,16 @@
9833                                                 cs->iif.statcallb(ic);
9834                                                 return(0);
9835                                         } else if (ic->parm.aux.subcmd == AT_EQ_QUERY) {
9836 -                                               char *p = ic->parm.aux.para;
9837 -                                               for(i=0;i<FAXMODCNT;i++)
9838 -                                                       if ((1<<i) & modmask)
9839 -                                                               p += sprintf(p, "%d,", faxmodulation[i]);
9840 -                                               p--;
9841 -                                               *p=0;
9842 +                                               strcpy(ic->parm.aux.para, faxmodulation_s);
9843                                                 ic->command = ISDN_STAT_FAXIND;
9844                                                 ic->parm.aux.cmd = ISDN_FAX_CLASS1_QUERY;
9845                                                 cs->iif.statcallb(ic);
9846                                                 return(0);
9847                                         } else if (ic->parm.aux.subcmd == AT_EQ_VALUE) {
9848 -                                               if (cs->debug & L1_DEB_HSCX)
9849 -                                                       debugl1(cs, "isar_auxcmd %s=%d",
9850 -                                                               FC1_CMD[ic->parm.aux.cmd], ic->parm.aux.para[0]);
9851                                                 for(i=0;i<FAXMODCNT;i++)
9852                                                         if (faxmodulation[i]==ic->parm.aux.para[0])
9853                                                                 break;
9854 -                                               if ((i < FAXMODCNT) && ((1<<i) & modmask) && 
9855 +                                               if ((FAXMODCNT > i) && 
9856                                                         test_bit(BC_FLG_INIT, &bcs->Flag)) {
9857                                                         isar_pump_cmd(bcs,
9858                                                                 ic->parm.aux.cmd,
9859 @@ -1850,7 +1762,7 @@
9860                         break;
9861                 case (ISDN_CMD_IOCTL):
9862                         switch (ic->arg) {
9863 -                               case 9: /* load firmware */
9864 +                               case (9): /* load firmware */
9865                                         features = ISDN_FEATURE_L2_MODEM |
9866                                                 ISDN_FEATURE_L2_FAX |
9867                                                 ISDN_FEATURE_L3_FCLASS1;
9868 @@ -1860,26 +1772,6 @@
9869                                         else 
9870                                                 ll_run(cs, features);
9871                                         break;
9872 -                               case 20:
9873 -                                       features = *(unsigned int *) ic->parm.num;
9874 -                                       printk(KERN_DEBUG "HiSax: max modulation old(%04x) new(%04x)\n",
9875 -                                               modmask, features);
9876 -                                       modmask = features;
9877 -                                       break;
9878 -                               case 21:
9879 -                                       features = *(unsigned int *) ic->parm.num;
9880 -                                       printk(KERN_DEBUG "HiSax: FRM extra delay old(%d) new(%d) ms\n",
9881 -                                               frm_extra_delay, features);
9882 -                                       if (features >= 0)
9883 -                                               frm_extra_delay = features;
9884 -                                       break;
9885 -                               case 22:
9886 -                                       features = *(unsigned int *) ic->parm.num;
9887 -                                       printk(KERN_DEBUG "HiSax: TOA old(%d) new(%d) db\n",
9888 -                                               para_TOA, features);
9889 -                                       if (features >= 0 && features < 32)
9890 -                                               para_TOA = features;
9891 -                                       break;
9892                                 default:
9893                                         printk(KERN_DEBUG "HiSax: invalid ioctl %d\n",
9894                                                (int) ic->arg);
9895 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isar.h linux-2.4.29/drivers/isdn/hisax/isar.h
9896 --- linux-2.4.29.old/drivers/isdn/hisax/isar.h  2005-03-22 14:47:56.000000000 +0100
9897 +++ linux-2.4.29/drivers/isdn/hisax/isar.h      2005-03-22 15:06:47.457878088 +0100
9898 @@ -1,4 +1,4 @@
9899 -/* $Id: isar.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9900 +/* $Id: isar.h,v 1.11 2001/09/24 13:22:56 kai Exp $
9901   *
9902   * ISAR (Siemens PSB 7110) specific defines
9903   *
9904 @@ -28,8 +28,6 @@
9905  #define ISAR_HIS_FIRM          0x1e
9906  #define ISAR_HIS_STDSP         0x08
9907  #define ISAR_HIS_DIAG          0x05
9908 -#define ISAR_HIS_WAITSTATE     0x27
9909 -#define ISAR_HIS_TIMERIRQ      0x25
9910  #define ISAR_HIS_P0CFG         0x3c
9911  #define ISAR_HIS_P12CFG                0x24
9912  #define ISAR_HIS_SARTCFG       0x25    
9913 @@ -45,10 +43,6 @@
9914  #define ISAR_HIS_DPS2          0x80
9915  #define SET_DPS(x)             ((x<<6) & 0xc0)
9916  
9917 -#define ISAR_CMD_TIMERIRQ_OFF  0x20
9918 -#define ISAR_CMD_TIMERIRQ_ON   0x21
9919 -
9920 -
9921  #define ISAR_IIS_MSCMSD                0x3f
9922  #define ISAR_IIS_VNR           0x15
9923  #define ISAR_IIS_DKEY          0x03
9924 @@ -213,8 +207,6 @@
9925  #define STFAX_ESCAPE   5
9926  #define STFAX_SILDET   6
9927  
9928 -#define ISDN_FAXPUMP_HALT      100
9929 -
9930  extern int ISARVersion(struct IsdnCardState *cs, char *s);
9931  extern void isar_int_main(struct IsdnCardState *cs);
9932  extern void initisar(struct IsdnCardState *cs);
9933 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl1.c linux-2.4.29/drivers/isdn/hisax/isdnl1.c
9934 --- linux-2.4.29.old/drivers/isdn/hisax/isdnl1.c        2005-03-22 14:47:56.000000000 +0100
9935 +++ linux-2.4.29/drivers/isdn/hisax/isdnl1.c    2005-03-22 15:06:47.582859088 +0100
9936 @@ -1,4 +1,4 @@
9937 -/* $Id: isdnl1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9938 +/* $Id: isdnl1.c,v 2.46 2001/09/24 13:22:56 kai Exp $
9939   *
9940   * common low level stuff for Siemens Chipsetbased isdn cards
9941   *
9942 @@ -18,7 +18,7 @@
9943   *
9944   */
9945  
9946 -const char *l1_revision = "$Revision: 1.1.4.1 $";
9947 +const char *l1_revision = "$Revision: 2.46 $";
9948  
9949  #define __NO_VERSION__
9950  #include <linux/init.h>
9951 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl1.h linux-2.4.29/drivers/isdn/hisax/isdnl1.h
9952 --- linux-2.4.29.old/drivers/isdn/hisax/isdnl1.h        2005-03-22 14:47:56.000000000 +0100
9953 +++ linux-2.4.29/drivers/isdn/hisax/isdnl1.h    2005-03-22 15:06:47.615854072 +0100
9954 @@ -1,4 +1,4 @@
9955 -/* $Id: isdnl1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9956 +/* $Id: isdnl1.h,v 2.12 2001/09/24 13:22:56 kai Exp $
9957   *
9958   * Layer 1 defines
9959   *
9960 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl2.c linux-2.4.29/drivers/isdn/hisax/isdnl2.c
9961 --- linux-2.4.29.old/drivers/isdn/hisax/isdnl2.c        2005-03-22 14:47:56.000000000 +0100
9962 +++ linux-2.4.29/drivers/isdn/hisax/isdnl2.c    2005-03-22 15:06:47.631851640 +0100
9963 @@ -1,4 +1,4 @@
9964 -/* $Id: isdnl2.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9965 +/* $Id: isdnl2.c,v 2.30 2001/09/24 13:22:56 kai Exp $
9966   *
9967   * Author       Karsten Keil
9968   *              based on the teles driver from Jan den Ouden
9969 @@ -20,7 +20,7 @@
9970  #include "hisax.h"
9971  #include "isdnl2.h"
9972  
9973 -const char *l2_revision = "$Revision: 1.1.4.1 $";
9974 +const char *l2_revision = "$Revision: 2.30 $";
9975  
9976  static void l2m_debug(struct FsmInst *fi, char *fmt, ...);
9977  
9978 @@ -1418,8 +1418,8 @@
9979         freewin(st);
9980         st->l2.tei = -1;
9981         stop_t200(st, 17);
9982 -       st5_dl_release_l2l3(st);
9983         FsmChangeState(fi, ST_L2_1);
9984 +       st5_dl_release_l2l3(st);
9985  }
9986  
9987  static void
9988 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl2.h linux-2.4.29/drivers/isdn/hisax/isdnl2.h
9989 --- linux-2.4.29.old/drivers/isdn/hisax/isdnl2.h        2005-03-22 14:47:56.000000000 +0100
9990 +++ linux-2.4.29/drivers/isdn/hisax/isdnl2.h    2005-03-22 15:06:47.647849208 +0100
9991 @@ -1,4 +1,4 @@
9992 -/* $Id: isdnl2.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
9993 +/* $Id$
9994   *
9995   * Layer 2 defines
9996   *
9997 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl3.c linux-2.4.29/drivers/isdn/hisax/isdnl3.c
9998 --- linux-2.4.29.old/drivers/isdn/hisax/isdnl3.c        2005-03-22 14:47:56.000000000 +0100
9999 +++ linux-2.4.29/drivers/isdn/hisax/isdnl3.c    2005-03-22 15:06:47.663846776 +0100
10000 @@ -1,4 +1,4 @@
10001 -/* $Id: isdnl3.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10002 +/* $Id: isdnl3.c,v 2.22 2001/09/24 13:22:56 kai Exp $
10003   *
10004   * Author       Karsten Keil
10005   *              based on the teles driver from Jan den Ouden
10006 @@ -21,7 +21,7 @@
10007  #include "isdnl3.h"
10008  #include <linux/config.h>
10009  
10010 -const char *l3_revision = "$Revision: 1.1.4.1 $";
10011 +const char *l3_revision = "$Revision: 2.22 $";
10012  
10013  static struct Fsm l3fsm;
10014  
10015 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isdnl3.h linux-2.4.29/drivers/isdn/hisax/isdnl3.h
10016 --- linux-2.4.29.old/drivers/isdn/hisax/isdnl3.h        2005-03-22 14:47:56.000000000 +0100
10017 +++ linux-2.4.29/drivers/isdn/hisax/isdnl3.h    2005-03-22 15:06:47.679844344 +0100
10018 @@ -1,4 +1,4 @@
10019 -/* $Id: isdnl3.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10020 +/* $Id$
10021   *
10022   * This software may be used and distributed according to the terms
10023   * of the GNU General Public License, incorporated herein by reference.
10024 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/isurf.c linux-2.4.29/drivers/isdn/hisax/isurf.c
10025 --- linux-2.4.29.old/drivers/isdn/hisax/isurf.c 2005-03-22 14:47:56.000000000 +0100
10026 +++ linux-2.4.29/drivers/isdn/hisax/isurf.c     2005-03-22 15:06:47.699841304 +0100
10027 @@ -1,4 +1,4 @@
10028 -/* $Id: isurf.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10029 +/* $Id: isurf.c,v 1.12 2001/09/24 13:22:56 kai Exp $
10030   *
10031   * low level stuff for Siemens I-Surf/I-Talk cards
10032   *
10033 @@ -16,11 +16,10 @@
10034  #include "isac.h"
10035  #include "isar.h"
10036  #include "isdnl1.h"
10037 -#include <linux/isapnp.h>
10038  
10039  extern const char *CardType[];
10040  
10041 -static const char *ISurf_revision = "$Revision: 1.1.4.1 $";
10042 +static const char *ISurf_revision = "$Revision: 1.12 $";
10043  
10044  #define byteout(addr,val) outb(val,addr)
10045  #define bytein(addr) inb(addr)
10046 @@ -128,8 +127,10 @@
10047  release_io_isurf(struct IsdnCardState *cs)
10048  {
10049         release_region(cs->hw.isurf.reset, 1);
10050 +#ifdef COMPAT_HAS_ISA_IOREMAP
10051         iounmap((unsigned char *)cs->hw.isurf.isar);
10052         release_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE);
10053 +#endif
10054  }
10055  
10056  static void
10057 @@ -194,10 +195,6 @@
10058         return(isar_auxcmd(cs, ic));
10059  }
10060  
10061 -#ifdef __ISAPNP__
10062 -static struct pci_bus *pnp_surf __devinitdata = NULL;
10063 -#endif
10064 -
10065  int __init
10066  setup_isurf(struct IsdnCard *card)
10067  {
10068 @@ -215,58 +212,9 @@
10069                 cs->hw.isurf.phymem = card->para[2];
10070                 cs->irq = card->para[0];
10071         } else {
10072 -#ifdef __ISAPNP__
10073 -               struct pci_bus *pb;
10074 -               struct pci_dev *pd;
10075 -
10076 -               if (isapnp_present()) {
10077 -                       cs->subtyp = 0;
10078 -                       if ((pb = isapnp_find_card(
10079 -                               ISAPNP_VENDOR('S', 'I', 'E'),
10080 -                               ISAPNP_FUNCTION(0x0010), pnp_surf))) {
10081 -                               pnp_surf = pb;
10082 -                               pd = NULL;
10083 -                               if (!(pd = isapnp_find_dev(pnp_surf,
10084 -                                       ISAPNP_VENDOR('S', 'I', 'E'),
10085 -                                       ISAPNP_FUNCTION(0x0010), pd))) {
10086 -                                       printk(KERN_ERR "ISurfPnP: PnP error card found, no device\n");
10087 -                                       return (0);
10088 -                               }
10089 -                               pd->prepare(pd);
10090 -                               pd->deactivate(pd);
10091 -                               pd->activate(pd);
10092 -                               /* The ISA-PnP logic apparently
10093 -                                * expects upper limit address to be
10094 -                                * set. Since the isa-pnp module
10095 -                                * doesn't do this, so we have to make
10096 -                                * up for it.
10097 -                                */
10098 -                               isapnp_cfg_begin(pd->bus->number, pd->devfn);
10099 -                               isapnp_write_word(ISAPNP_CFG_MEM+3, 
10100 -                                       pd->resource[8].end >> 8);
10101 -                               isapnp_cfg_end();
10102 -                               cs->hw.isurf.reset = pd->resource[0].start;
10103 -                               cs->hw.isurf.phymem = pd->resource[8].start;
10104 -                               cs->irq = pd->irq_resource[0].start;
10105 -                               if (!cs->irq || !cs->hw.isurf.reset || !cs->hw.isurf.phymem) {
10106 -                                       printk(KERN_ERR "ISurfPnP:some resources are missing %d/%x/%lx\n",
10107 -                                               cs->irq, cs->hw.isurf.reset, cs->hw.isurf.phymem);
10108 -                                       pd->deactivate(pd);
10109 -                                       return(0);
10110 -                               }
10111 -                       } else {
10112 -                               printk(KERN_INFO "ISurfPnP: no ISAPnP card found\n");
10113 -                               return(0);
10114 -                       }
10115 -               } else {
10116 -                       printk(KERN_INFO "ISurfPnP: no ISAPnP bus found\n");
10117 -                       return(0);
10118 -               }
10119 -#else
10120                 printk(KERN_WARNING "HiSax: %s port/mem not set\n",
10121                         CardType[card->typ]);
10122                 return (0);
10123 -#endif
10124         }
10125         if (check_region(cs->hw.isurf.reset, 1)) {
10126                 printk(KERN_WARNING
10127 @@ -277,6 +225,7 @@
10128         } else {
10129                 request_region(cs->hw.isurf.reset, 1, "isurf isdn");
10130         }
10131 +#ifdef COMPAT_HAS_ISA_IOREMAP
10132         if (check_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE)) {
10133                 printk(KERN_WARNING
10134                         "HiSax: %s memory region %lx-%lx already in use\n",
10135 @@ -292,6 +241,10 @@
10136         cs->hw.isurf.isar =
10137                 (unsigned long) ioremap(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE);
10138         cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET;
10139 +#else
10140 +       cs->hw.isurf.isar = cs->hw.isurf.phymem + ISURF_ISAR_OFFSET;
10141 +       cs->hw.isurf.isac = cs->hw.isurf.phymem + ISURF_ISAC_OFFSET;
10142 +#endif
10143         printk(KERN_INFO
10144                "ISurf: defined at 0x%x 0x%lx IRQ %d\n",
10145                cs->hw.isurf.reset,
10146 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/ix1_micro.c linux-2.4.29/drivers/isdn/hisax/ix1_micro.c
10147 --- linux-2.4.29.old/drivers/isdn/hisax/ix1_micro.c     2005-03-22 14:47:56.000000000 +0100
10148 +++ linux-2.4.29/drivers/isdn/hisax/ix1_micro.c 2005-03-22 15:06:47.714839024 +0100
10149 @@ -1,4 +1,4 @@
10150 -/* $Id: ix1_micro.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10151 +/* $Id: ix1_micro.c,v 2.12 2001/09/24 13:22:56 kai Exp $
10152   *
10153   * low level stuff for ITK ix1-micro Rev.2 isdn cards
10154   * derived from the original file teles3.c from Karsten Keil
10155 @@ -19,14 +19,13 @@
10156  
10157  #define __NO_VERSION__
10158  #include <linux/init.h>
10159 -#include <linux/isapnp.h>
10160  #include "hisax.h"
10161  #include "isac.h"
10162  #include "hscx.h"
10163  #include "isdnl1.h"
10164  
10165  extern const char *CardType[];
10166 -const char *ix1_revision = "$Revision: 1.1.4.1 $";
10167 +const char *ix1_revision = "$Revision: 2.12 $";
10168  
10169  #define byteout(addr,val) outb(val,addr)
10170  #define bytein(addr) inb(addr)
10171 @@ -219,21 +218,6 @@
10172         return(0);
10173  }
10174  
10175 -#ifdef __ISAPNP__
10176 -static struct isapnp_device_id itk_ids[] __initdata = {
10177 -       { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25),
10178 -         ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), 
10179 -         (unsigned long) "ITK micro 2" },
10180 -       { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x29),
10181 -         ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x29), 
10182 -         (unsigned long) "ITK micro 2." },
10183 -       { 0, }
10184 -};
10185 -
10186 -static struct isapnp_device_id *idev = &itk_ids[0];
10187 -static struct pci_bus *pnp_c __devinitdata = NULL;
10188 -#endif
10189 -
10190  
10191  int __init
10192  setup_ix1micro(struct IsdnCard *card)
10193 @@ -246,45 +230,6 @@
10194         if (cs->typ != ISDN_CTYPE_IX1MICROR2)
10195                 return (0);
10196  
10197 -#ifdef __ISAPNP__
10198 -       if (!card->para[1] && isapnp_present()) {
10199 -               struct pci_bus *pb;
10200 -               struct pci_dev *pd;
10201 -
10202 -               while(idev->card_vendor) {
10203 -                       if ((pb = isapnp_find_card(idev->card_vendor,
10204 -                               idev->card_device, pnp_c))) {
10205 -                               pnp_c = pb;
10206 -                               pd = NULL;
10207 -                               if ((pd = isapnp_find_dev(pnp_c,
10208 -                                       idev->vendor, idev->function, pd))) {
10209 -                                       printk(KERN_INFO "HiSax: %s detected\n",
10210 -                                               (char *)idev->driver_data);
10211 -                                       pd->prepare(pd);
10212 -                                       pd->deactivate(pd);
10213 -                                       pd->activate(pd);
10214 -                                       card->para[1] = pd->resource[0].start;
10215 -                                       card->para[0] = pd->irq_resource[0].start;
10216 -                                       if (!card->para[0] || !card->para[1]) {
10217 -                                               printk(KERN_ERR "ITK PnP:some resources are missing %ld/%lx\n",
10218 -                                               card->para[0], card->para[1]);
10219 -                                               pd->deactivate(pd);
10220 -                                               return(0);
10221 -                                       }
10222 -                                       break;
10223 -                               } else {
10224 -                                       printk(KERN_ERR "ITK PnP: PnP error card found, no device\n");
10225 -                               }
10226 -                       }
10227 -                       idev++;
10228 -                       pnp_c=NULL;
10229 -               } 
10230 -               if (!idev->card_vendor) {
10231 -                       printk(KERN_INFO "ITK PnP: no ISAPnP card found\n");
10232 -                       return(0);
10233 -               }
10234 -       }
10235 -#endif
10236         /* IO-Ports */
10237         cs->hw.ix1.isac_ale = card->para[1] + ISAC_COMMAND_OFFSET;
10238         cs->hw.ix1.hscx_ale = card->para[1] + HSCX_COMMAND_OFFSET;
10239 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/jade.c linux-2.4.29/drivers/isdn/hisax/jade.c
10240 --- linux-2.4.29.old/drivers/isdn/hisax/jade.c  2005-03-22 14:47:56.000000000 +0100
10241 +++ linux-2.4.29/drivers/isdn/hisax/jade.c      2005-03-22 15:06:47.729836744 +0100
10242 @@ -1,4 +1,4 @@
10243 -/* $Id: jade.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10244 +/* $Id: jade.c,v 1.9 2001/09/24 13:22:56 kai Exp $
10245   *
10246   * JADE stuff (derived from original hscx.c)
10247   *
10248 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/jade.h linux-2.4.29/drivers/isdn/hisax/jade.h
10249 --- linux-2.4.29.old/drivers/isdn/hisax/jade.h  2005-03-22 14:47:56.000000000 +0100
10250 +++ linux-2.4.29/drivers/isdn/hisax/jade.h      2005-03-22 15:06:47.745834312 +0100
10251 @@ -1,4 +1,4 @@
10252 -/* $Id: jade.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10253 +/* $Id: jade.h,v 1.5 2001/09/24 13:22:56 kai Exp $
10254   *
10255   * JADE specific defines
10256   *
10257 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/jade_irq.c linux-2.4.29/drivers/isdn/hisax/jade_irq.c
10258 --- linux-2.4.29.old/drivers/isdn/hisax/jade_irq.c      2005-03-22 14:47:56.000000000 +0100
10259 +++ linux-2.4.29/drivers/isdn/hisax/jade_irq.c  2005-03-22 15:06:47.760832032 +0100
10260 @@ -1,4 +1,4 @@
10261 -/* $Id: jade_irq.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10262 +/* $Id: jade_irq.c,v 1.7 2001/09/24 13:22:56 kai Exp $
10263   *
10264   * Low level JADE IRQ stuff (derived from original hscx_irq.c)
10265   *
10266 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.c linux-2.4.29/drivers/isdn/hisax/l3_1tr6.c
10267 --- linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.c       2005-03-22 14:47:56.000000000 +0100
10268 +++ linux-2.4.29/drivers/isdn/hisax/l3_1tr6.c   2005-03-22 15:06:47.777829448 +0100
10269 @@ -1,4 +1,4 @@
10270 -/* $Id: l3_1tr6.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10271 +/* $Id: l3_1tr6.c,v 2.15 2001/09/24 13:22:56 kai Exp $
10272   *
10273   * German 1TR6 D-channel protocol
10274   *
10275 @@ -20,7 +20,7 @@
10276  #include <linux/ctype.h>
10277  
10278  extern char *HiSax_getrev(const char *revision);
10279 -const char *l3_1tr6_revision = "$Revision: 1.1.4.1 $";
10280 +const char *l3_1tr6_revision = "$Revision: 2.15 $";
10281  
10282  #define MsgHead(ptr, cref, mty, dis) \
10283         *ptr++ = dis; \
10284 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.h linux-2.4.29/drivers/isdn/hisax/l3_1tr6.h
10285 --- linux-2.4.29.old/drivers/isdn/hisax/l3_1tr6.h       2005-03-22 14:47:56.000000000 +0100
10286 +++ linux-2.4.29/drivers/isdn/hisax/l3_1tr6.h   2005-03-22 15:06:47.796826560 +0100
10287 @@ -1,4 +1,4 @@
10288 -/* $Id: l3_1tr6.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10289 +/* $Id$
10290   *
10291   * German 1TR6 D-channel protocol defines
10292   *
10293 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3dss1.c linux-2.4.29/drivers/isdn/hisax/l3dss1.c
10294 --- linux-2.4.29.old/drivers/isdn/hisax/l3dss1.c        2005-03-22 14:47:56.000000000 +0100
10295 +++ linux-2.4.29/drivers/isdn/hisax/l3dss1.c    2005-03-22 15:06:47.822822608 +0100
10296 @@ -1,4 +1,4 @@
10297 -/* $Id: l3dss1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10298 +/* $Id: l3dss1.c,v 2.32 2001/09/24 13:22:56 kai Exp $
10299   *
10300   * EURO/DSS1 D-channel protocol
10301   *
10302 @@ -27,7 +27,7 @@
10303  #include <linux/config.h>
10304  
10305  extern char *HiSax_getrev(const char *revision);
10306 -const char *dss1_revision = "$Revision: 1.1.4.1 $";
10307 +const char *dss1_revision = "$Revision: 2.32 $";
10308  
10309  #define EXT_BEARER_CAPS 1
10310  
10311 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3dss1.h linux-2.4.29/drivers/isdn/hisax/l3dss1.h
10312 --- linux-2.4.29.old/drivers/isdn/hisax/l3dss1.h        2005-03-22 14:47:56.000000000 +0100
10313 +++ linux-2.4.29/drivers/isdn/hisax/l3dss1.h    2005-03-22 15:06:47.842819568 +0100
10314 @@ -1,4 +1,4 @@
10315 -/* $Id: l3dss1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10316 +/* $Id$
10317   *
10318   * DSS1 (Euro) D-channel protocol defines
10319   *
10320 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3ni1.c linux-2.4.29/drivers/isdn/hisax/l3ni1.c
10321 --- linux-2.4.29.old/drivers/isdn/hisax/l3ni1.c 2005-03-22 14:47:56.000000000 +0100
10322 +++ linux-2.4.29/drivers/isdn/hisax/l3ni1.c     2005-03-22 15:06:47.859816984 +0100
10323 @@ -1,4 +1,4 @@
10324 -/* $Id: l3ni1.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10325 +/* $Id: l3ni1.c,v 2.8 2001/09/24 13:22:56 kai Exp $
10326   *
10327   * NI1 D-channel protocol
10328   *
10329 @@ -25,7 +25,7 @@
10330  #include <linux/ctype.h>
10331  
10332  extern char *HiSax_getrev(const char *revision);
10333 -const char *ni1_revision = "$Revision: 1.1.4.1 $";
10334 +const char *ni1_revision = "$Revision: 2.8 $";
10335  
10336  #define EXT_BEARER_CAPS 1
10337  
10338 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/l3ni1.h linux-2.4.29/drivers/isdn/hisax/l3ni1.h
10339 --- linux-2.4.29.old/drivers/isdn/hisax/l3ni1.h 2005-03-22 14:47:56.000000000 +0100
10340 +++ linux-2.4.29/drivers/isdn/hisax/l3ni1.h     2005-03-22 15:06:47.877814248 +0100
10341 @@ -1,4 +1,4 @@
10342 -/* $Id: l3ni1.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10343 +/* $Id$
10344   *
10345   * NI1 D-channel protocol
10346   *
10347 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/lmgr.c linux-2.4.29/drivers/isdn/hisax/lmgr.c
10348 --- linux-2.4.29.old/drivers/isdn/hisax/lmgr.c  2005-03-22 14:47:56.000000000 +0100
10349 +++ linux-2.4.29/drivers/isdn/hisax/lmgr.c      2005-03-22 15:06:47.895811512 +0100
10350 @@ -1,4 +1,4 @@
10351 -/* $Id: lmgr.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10352 +/* $Id$
10353   *
10354   * Layermanagement module
10355   *
10356 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/md5sums.asc linux-2.4.29/drivers/isdn/hisax/md5sums.asc
10357 --- linux-2.4.29.old/drivers/isdn/hisax/md5sums.asc     2005-03-22 14:47:56.000000000 +0100
10358 +++ linux-2.4.29/drivers/isdn/hisax/md5sums.asc 2005-03-22 15:06:47.910809232 +0100
10359 @@ -1,33 +1,22 @@
10360 ------BEGIN PGP SIGNED MESSAGE-----
10361 -Hash: SHA1
10362 -
10363  # This are valid md5sums for certificated HiSax driver.
10364  # The certification is valid only if the md5sums of all files match.
10365  # The certification is valid only for ELSA Microlink PCI,
10366 -# Eicon Technology Diva 2.01 PCI, Sedlbauer SpeedFax+,
10367 -# HFC-S PCI A based cards and HFC-S USB based ISDN
10368 -# terminal adapters in the moment.
10369 +# Eicon Technology Diva 2.01 PCI, Sedlbauer SpeedFax+, 
10370 +# HFC-S PCI A based cards and HFC-S USB based isdn tas 
10371 +# in the moment.
10372  # Read ../../../Documentation/isdn/HiSax.cert for more informations.
10373  # 
10374 -cd4a9917e1147039d5dfc66440d42054  isac.c
10375 -211840e78b56c9d4753be9c85da21a50  isdnl1.c
10376 -5ce9b1fff42a02f9c2eb4fb81c701b1f  isdnl2.c
10377 -6948de0c43513dd23c6706feb5fc2209  isdnl3.c
10378 -3730780b69368218d756024165efea79  tei.c
10379 -16e72710eb58da01415b877490f5d2ac  callc.c
10380 -6abc55c77e0f3149ae9334f3257a1a1a  cert.c
10381 -27bdb2800d4590e00da20eff241edc47  l3dss1.c
10382 -df8bb877b854c4302d396b554e4e84ef  l3_1tr6.c
10383 -9d8b4bed15370063d1b16e47080f50e1  elsa.c
10384 -210f4a3f1eebca70229d786b15cf3e90  diva.c
10385 -4ddf21079dd77e892380f789bae250a7  sedlbauer.c
10386 -8200d818771e3cbdef2a3c3e818d25ac  hfc_pci.c
10387 +6f9433a8b696076562562d090e3c420f  isac.c
10388 +13c3eed869f5139f44c563e3a8fea1f5  isdnl1.c
10389 +addcff863b0ff1e366c0f2ae9fa6e81e  isdnl2.c
10390 +7076deb94a363945c21ea27aca4a720a  isdnl3.c
10391 +51c603829b6cc4f8421f744ad657ceff  tei.c
10392 +669050ab5079f02887ed0239d86e5474  callc.c
10393 +ecacd146b8f8881ef9349935dab3df4a  cert.c
10394 +fadeb3b85bb23bc1ac48470c0848d6fa  l3dss1.c
10395 +cf7dec9fac6283716904d26b99188476  l3_1tr6.c
10396 +2f75c8765e1be13d114d5f4433cf364b  elsa.c
10397 +b4cf8a4dceed9ea6dcba65a85b4eecc7  diva.c
10398 +dee3f8f40c6fe78a4b57729804b7e6cd  sedlbauer.c
10399 +0d79fe6dfc5bfaa4826970c41a6d273d  hfc_pci.c
10400  # end of md5sums
10401 ------BEGIN PGP SIGNATURE-----
10402 -Version: GnuPG v1.0.6 (GNU/Linux)
10403 -Comment: For info see http://www.gnupg.org
10404 -
10405 -iD8DBQE9rE91DiY0VZsg4ukRAkKfAJ4xWUfqjc0hW+V+JPue5yr7mrt+RwCdGdSf
10406 -GIKgAEdRLzERmpt/bCCwAbY=
10407 -=FaHw
10408 ------END PGP SIGNATURE-----
10409 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/mic.c linux-2.4.29/drivers/isdn/hisax/mic.c
10410 --- linux-2.4.29.old/drivers/isdn/hisax/mic.c   2005-03-22 14:47:56.000000000 +0100
10411 +++ linux-2.4.29/drivers/isdn/hisax/mic.c       2005-03-22 15:06:47.926806800 +0100
10412 @@ -1,4 +1,4 @@
10413 -/* $Id: mic.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10414 +/* $Id: mic.c,v 1.12 2001/09/24 13:22:56 kai Exp $
10415   *
10416   * low level stuff for mic cards
10417   *
10418 @@ -19,7 +19,7 @@
10419  
10420  extern const char *CardType[];
10421  
10422 -const char *mic_revision = "$Revision: 1.1.4.1 $";
10423 +const char *mic_revision = "$Revision: 1.12 $";
10424  
10425  #define byteout(addr,val) outb(val,addr)
10426  #define bytein(addr) inb(addr)
10427 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/netjet.c linux-2.4.29/drivers/isdn/hisax/netjet.c
10428 --- linux-2.4.29.old/drivers/isdn/hisax/netjet.c        2005-03-22 14:47:56.000000000 +0100
10429 +++ linux-2.4.29/drivers/isdn/hisax/netjet.c    2005-03-22 15:06:47.941804520 +0100
10430 @@ -1,4 +1,4 @@
10431 -/* $Id: netjet.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10432 +/* $Id: netjet.c,v 1.29 2001/09/24 13:22:56 kai Exp $
10433   *
10434   * low level stuff for Traverse Technologie NETJet ISDN cards
10435   *
10436 @@ -8,9 +8,7 @@
10437   * This software may be used and distributed according to the terms
10438   * of the GNU General Public License, incorporated herein by reference.
10439   *
10440 - * Thanks to Traverse Technologies Australia for documents and information
10441 - *
10442 - * 16-Apr-2002 - led code added - Guy Ellis (guy@traverse.com.au)
10443 + * Thanks to Traverse Technologie Australia for documents and information
10444   *
10445   */
10446  
10447 @@ -26,7 +24,7 @@
10448  #include <asm/io.h>
10449  #include "netjet.h"
10450  
10451 -const char *NETjet_revision = "$Revision: 1.1.4.1 $";
10452 +const char *NETjet_revision = "$Revision: 1.29 $";
10453  
10454  /* Interface functions */
10455  
10456 @@ -135,7 +133,6 @@
10457  mode_tiger(struct BCState *bcs, int mode, int bc)
10458  {
10459         struct IsdnCardState *cs = bcs->cs;
10460 -        u_char led;
10461  
10462         if (cs->debug & L1_DEB_HSCX)
10463                 debugl1(cs, "Tiger mode %d bchan %d/%d",
10464 @@ -157,15 +154,6 @@
10465                                         cs->hw.njet.dmactrl);
10466                                 byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0);
10467                         }
10468 -                        if (cs->typ == ISDN_CTYPE_NETJET_S)
10469 -                        {
10470 -                                // led off
10471 -                                led = bc & 0x01;
10472 -                                led = 0x01 << (6 + led); // convert to mask
10473 -                                led = ~led;
10474 -                                cs->hw.njet.auxd &= led;
10475 -                                byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
10476 -                        }
10477                         break;
10478                 case (L1_MODE_TRANS):
10479                         break;
10480 @@ -191,14 +179,6 @@
10481                         bcs->hw.tiger.sendp = bcs->hw.tiger.send;
10482                         bcs->hw.tiger.free = NETJET_DMA_TXSIZE;
10483                         test_and_set_bit(BC_FLG_EMPTY, &bcs->Flag);
10484 -                        if (cs->typ == ISDN_CTYPE_NETJET_S)
10485 -                        {
10486 -                                // led on
10487 -                                led = bc & 0x01;
10488 -                                led = 0x01 << (6 + led); // convert to mask
10489 -                                cs->hw.njet.auxd |= led;
10490 -                                byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
10491 -                        }
10492                         break;
10493         }
10494         if (cs->debug & L1_DEB_HSCX)
10495 @@ -874,13 +854,9 @@
10496                 case (PH_ACTIVATE | REQUEST):
10497                         test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
10498                         mode_tiger(st->l1.bcs, st->l1.mode, st->l1.bc);
10499 -                       /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG */
10500 -                       st->l1.bcs->cs->cardmsg(st->l1.bcs->cs, MDL_BC_ASSIGN, (void *)(&st->l1.bc));
10501                         l1_msg_b(st, pr, arg);
10502                         break;
10503                 case (PH_DEACTIVATE | REQUEST):
10504 -                       /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG */
10505 -                       st->l1.bcs->cs->cardmsg(st->l1.bcs->cs, MDL_BC_RELEASE, (void *)(&st->l1.bc));
10506                         l1_msg_b(st, pr, arg);
10507                         break;
10508                 case (PH_DEACTIVATE | CONFIRM):
10509 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/netjet.h linux-2.4.29/drivers/isdn/hisax/netjet.h
10510 --- linux-2.4.29.old/drivers/isdn/hisax/netjet.h        2005-03-22 14:47:56.000000000 +0100
10511 +++ linux-2.4.29/drivers/isdn/hisax/netjet.h    2005-03-22 15:06:47.956802240 +0100
10512 @@ -1,4 +1,4 @@
10513 -/* $Id: netjet.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10514 +/* $Id: netjet.h,v 2.8 2001/09/24 13:22:56 kai Exp $
10515   *
10516   * NETjet common header file
10517   *
10518 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/niccy.c linux-2.4.29/drivers/isdn/hisax/niccy.c
10519 --- linux-2.4.29.old/drivers/isdn/hisax/niccy.c 2005-03-22 14:47:56.000000000 +0100
10520 +++ linux-2.4.29/drivers/isdn/hisax/niccy.c     2005-03-22 15:06:47.977799048 +0100
10521 @@ -1,4 +1,4 @@
10522 -/* $Id: niccy.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10523 +/* $Id: niccy.c,v 1.21 2001/10/20 22:05:00 kai Exp $
10524   *
10525   * low level stuff for Dr. Neuhaus NICCY PnP and NICCY PCI and
10526   * compatible (SAGEM cybermodem)
10527 @@ -22,10 +22,10 @@
10528  #include "hscx.h"
10529  #include "isdnl1.h"
10530  #include <linux/pci.h>
10531 -#include <linux/isapnp.h>
10532 +#include <linux/isdn_compat.h>
10533  
10534  extern const char *CardType[];
10535 -const char *niccy_revision = "$Revision: 1.1.4.1 $";
10536 +const char *niccy_revision = "$Revision: 1.21 $";
10537  
10538  #define byteout(addr,val) outb(val,addr)
10539  #define bytein(addr) inb(addr)
10540 @@ -239,9 +239,6 @@
10541  }
10542  
10543  static struct pci_dev *niccy_dev __initdata = NULL;
10544 -#ifdef __ISAPNP__
10545 -static struct pci_bus *pnp_c __devinitdata = NULL;
10546 -#endif
10547  
10548  int __init
10549  setup_niccy(struct IsdnCard *card)
10550 @@ -253,39 +250,7 @@
10551         printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
10552         if (cs->typ != ISDN_CTYPE_NICCY)
10553                 return (0);
10554 -#ifdef __ISAPNP__
10555 -       if (!card->para[1] && isapnp_present()) {
10556 -               struct pci_bus *pb;
10557 -               struct pci_dev *pd;
10558 -
10559 -               if ((pb = isapnp_find_card(
10560 -                       ISAPNP_VENDOR('S', 'D', 'A'),
10561 -                       ISAPNP_FUNCTION(0x0150), pnp_c))) {
10562 -                       pnp_c = pb;
10563 -                       pd = NULL;
10564 -                       if (!(pd = isapnp_find_dev(pnp_c,
10565 -                               ISAPNP_VENDOR('S', 'D', 'A'),
10566 -                               ISAPNP_FUNCTION(0x0150), pd))) {
10567 -                               printk(KERN_ERR "NiccyPnP: PnP error card found, no device\n");
10568 -                               return (0);
10569 -                       }
10570 -                       pd->prepare(pd);
10571 -                       pd->deactivate(pd);
10572 -                       pd->activate(pd);
10573 -                       card->para[1] = pd->resource[0].start;
10574 -                       card->para[2] = pd->resource[1].start;
10575 -                       card->para[0] = pd->irq_resource[0].start;
10576 -                       if (!card->para[0] || !card->para[1] || !card->para[2]) {
10577 -                               printk(KERN_ERR "NiccyPnP:some resources are missing %ld/%lx/%lx\n",
10578 -                                       card->para[0], card->para[1], card->para[2]);
10579 -                               pd->deactivate(pd);
10580 -                               return(0);
10581 -                       }
10582 -               } else {
10583 -                       printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
10584 -               }
10585 -       }
10586 -#endif
10587 +
10588         if (card->para[1]) {
10589                 cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
10590                 cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
10591 @@ -331,12 +296,12 @@
10592                                 return(0);
10593                         }
10594                         cs->irq = niccy_dev->irq;
10595 -                       cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
10596 +                       cs->hw.niccy.cfg_reg = pci_resource_start_io(niccy_dev, 0);
10597                         if (!cs->hw.niccy.cfg_reg) {
10598                                 printk(KERN_WARNING "Niccy: No IO-Adr for PCI cfg found\n");
10599                                 return(0);
10600                         }
10601 -                       pci_ioaddr = pci_resource_start(niccy_dev, 1);
10602 +                       pci_ioaddr = pci_resource_start_io(niccy_dev, 1);
10603                         if (!pci_ioaddr) {
10604                                 printk(KERN_WARNING "Niccy: No IO-Adr for PCI card found\n");
10605                                 return(0);
10606 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/nj_s.c linux-2.4.29/drivers/isdn/hisax/nj_s.c
10607 --- linux-2.4.29.old/drivers/isdn/hisax/nj_s.c  2005-03-22 14:47:56.000000000 +0100
10608 +++ linux-2.4.29/drivers/isdn/hisax/nj_s.c      2005-03-22 15:06:47.993796616 +0100
10609 @@ -1,4 +1,4 @@
10610 -/* $Id: nj_s.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10611 +/* $Id: nj_s.c,v 2.13 2001/09/24 13:22:56 kai Exp $
10612   *
10613   * This software may be used and distributed according to the terms
10614   * of the GNU General Public License, incorporated herein by reference.
10615 @@ -12,11 +12,12 @@
10616  #include "isac.h"
10617  #include "isdnl1.h"
10618  #include <linux/pci.h>
10619 +#include <linux/isdn_compat.h>
10620  #include <linux/interrupt.h>
10621  #include <linux/ppp_defs.h>
10622  #include "netjet.h"
10623  
10624 -const char *NETjet_S_revision = "$Revision: 1.1.4.1 $";
10625 +const char *NETjet_S_revision = "$Revision: 2.13 $";
10626  
10627  static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
10628  {
10629 @@ -130,7 +131,6 @@
10630                         release_io_netjet(cs);
10631                         return(0);
10632                 case CARD_INIT:
10633 -                       reset_netjet_s(cs);
10634                         inittiger(cs);
10635                         clear_pending_isac_ints(cs);
10636                         initisac(cs);
10637 @@ -180,19 +180,11 @@
10638                                 printk(KERN_WARNING "NETjet-S: No IRQ for PCI card found\n");
10639                                 return(0);
10640                         }
10641 -                       cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
10642 +                       cs->hw.njet.base = pci_resource_start_io(dev_netjet, 0);
10643                         if (!cs->hw.njet.base) {
10644                                 printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n");
10645                                 return(0);
10646                         }
10647 -                       /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG www.formula-n.com */
10648 -                       if ((dev_netjet->subsystem_vendor == 0x55) &&
10649 -                               (dev_netjet->subsystem_device == 0x02)) {
10650 -                               printk(KERN_WARNING "Netjet: You tried to load this driver with an incompatible TigerJet-card\n");
10651 -                               printk(KERN_WARNING "Use type=41 for Formula-n enter:now ISDN PCI and compatible\n");
10652 -                               return(0);
10653 -                       }
10654 -                       /* end new code */
10655                 } else {
10656                         printk(KERN_WARNING "NETjet-S: No PCI card found\n");
10657                         return(0);
10658 @@ -263,6 +255,7 @@
10659         } else {
10660                 request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn");
10661         }
10662 +       reset_netjet_s(cs);
10663         cs->readisac  = &NETjet_ReadIC;
10664         cs->writeisac = &NETjet_WriteIC;
10665         cs->readisacfifo  = &NETjet_ReadICfifo;
10666 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/nj_u.c linux-2.4.29/drivers/isdn/hisax/nj_u.c
10667 --- linux-2.4.29.old/drivers/isdn/hisax/nj_u.c  2005-03-22 14:47:56.000000000 +0100
10668 +++ linux-2.4.29/drivers/isdn/hisax/nj_u.c      2005-03-22 15:06:48.008794336 +0100
10669 @@ -1,4 +1,4 @@
10670 -/* $Id: nj_u.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $ 
10671 +/* $Id: nj_u.c,v 2.14 2001/09/24 13:22:56 kai Exp $ 
10672   *
10673   * This software may be used and distributed according to the terms
10674   * of the GNU General Public License, incorporated herein by reference.
10675 @@ -12,11 +12,12 @@
10676  #include "icc.h"
10677  #include "isdnl1.h"
10678  #include <linux/pci.h>
10679 +#include <linux/isdn_compat.h>
10680  #include <linux/interrupt.h>
10681  #include <linux/ppp_defs.h>
10682  #include "netjet.h"
10683  
10684 -const char *NETjet_U_revision = "$Revision: 1.1.4.1 $";
10685 +const char *NETjet_U_revision = "$Revision: 2.14 $";
10686  
10687  static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
10688  {
10689 @@ -181,7 +182,7 @@
10690                                 printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n");
10691                                 return(0);
10692                         }
10693 -                       cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
10694 +                       cs->hw.njet.base = pci_resource_start_io(dev_netjet, 0);
10695                         if (!cs->hw.njet.base) {
10696                                 printk(KERN_WARNING "NETspider-U: No IO-Adr for PCI card found\n");
10697                                 return(0);
10698 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/q931.c linux-2.4.29/drivers/isdn/hisax/q931.c
10699 --- linux-2.4.29.old/drivers/isdn/hisax/q931.c  2005-03-22 14:47:56.000000000 +0100
10700 +++ linux-2.4.29/drivers/isdn/hisax/q931.c      2005-03-22 15:06:48.032790688 +0100
10701 @@ -1,4 +1,4 @@
10702 -/* $Id: q931.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
10703 +/* $Id: q931.c,v 1.12 2001/09/24 13:22:56 kai Exp $
10704   *
10705   * code to decode ITU Q.931 call control messages
10706   *
10707 @@ -197,6 +197,31 @@
10708  
10709  #define MT_N1_LEN (sizeof(mt_n1) / sizeof(struct MessageType))
10710  
10711 +#if 0
10712 +static struct MessageType fac_1tr6[] =
10713 +{
10714 +       {FAC_Sperre, "Sperre"},
10715 +       {FAC_Forward1, "Forward 1"},
10716 +       {FAC_Forward2, "Forward 2"},
10717 +       {FAC_Konferenz, "Konferenz"},
10718 +       {FAC_GrabBchan, "Grab Bchannel"},
10719 +       {FAC_Reactivate, "Reactivate"},
10720 +       {FAC_Konferenz3, "Dreier Konferenz"},
10721 +       {FAC_Dienstwechsel1, "Einseitiger Dienstwechsel"},
10722 +       {FAC_Dienstwechsel2, "Zweiseitiger Dienstwechsel"},
10723 +       {FAC_NummernIdent, "Rufnummer-Identifizierung"},
10724 +       {FAC_GBG, "GBG"},
10725 +       {FAC_DisplayUebergeben, "Display Uebergeben"},
10726 +       {FAC_DisplayUmgeleitet, "Display Umgeleitet"},
10727 +       {FAC_Unterdruecke, "Unterdruecke Rufnummer"},
10728 +       {FAC_Deactivate, "Deactivate"},
10729 +       {FAC_Activate, "Activate"},
10730 +       {FAC_SPV, "SPV"},
10731 +       {FAC_Rueckwechsel, "Rueckwechsel"},
10732 +       {FAC_Umleitung, "Umleitung"}
10733 +};
10734 +#define FAC_1TR6_LEN (sizeof(fac_1tr6) / sizeof(struct MessageType))
10735 +#endif
10736  
10737  static int
10738  prbits(char *dest, u_char b, int start, int len)
10739 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.c linux-2.4.29/drivers/isdn/hisax/rawhdlc.c
10740 --- linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.c       1970-01-01 01:00:00.000000000 +0100
10741 +++ linux-2.4.29/drivers/isdn/hisax/rawhdlc.c   2005-03-22 15:06:48.047788408 +0100
10742 @@ -0,0 +1,543 @@
10743 +/* $Id: rawhdlc.c,v 1.7 2001/09/24 13:22:57 kai Exp $
10744 + *
10745 + * support routines for cards that don't support HDLC
10746 + *
10747 + * Author     Brent Baccala
10748 + * Copyright  by Karsten Keil <keil@isdn4linux.de>
10749 + *            by Brent Baccala <baccala@FreeSoft.org>
10750 + *
10751 + * This software may be used and distributed according to the terms
10752 + * of the GNU General Public License, incorporated herein by reference.
10753 + *
10754 + *
10755 + * Some passive ISDN cards, such as the Traverse NETJet and the AMD 7930,
10756 + * don't perform HDLC encapsulation over the B channel.  Drivers for
10757 + * such cards use support routines in this file to perform B channel HDLC.
10758 + *
10759 + * Bit-synchronous HDLC encapsulation is a means of encapsulating packets
10760 + * over a continuously transmitting serial communications link.
10761 + * It looks like this:
10762 + *
10763 + *      11111111101111110...........0111111011111111111
10764 + *      iiiiiiiiiffffffffdddddddddddffffffffiiiiiiiiiii
10765 + *
10766 + *      i = idle     f = flag     d = data
10767 + *
10768 + * When idle, the channel sends a continuous string of ones (mark
10769 + * idle; illustrated), or a continuous string of flag characters (flag
10770 + * idle).  The beginning of a data frame is marked by a flag character
10771 + * (01111110), then comes the actual data, followed by another flag
10772 + * character, after which another frame may be sent immediately (a
10773 + * single flag may serve as both the end of one frame and the start of
10774 + * the next), or the link may return to idle.  Obviously, the flag
10775 + * character can not appear anywhere in the data (or a false
10776 + * end-of-frame would occur), so the transmitter performs
10777 + * "bit-stuffing" - inserting a zero bit after every five one bits,
10778 + * irregardless of the original bit after the five ones.  Byte
10779 + * ordering is irrelevent at this point - the data is treated as a
10780 + * string of bits, not bytes.  Since no more than 5 ones may now occur
10781 + * in a row, the flag sequence, with its 6 ones, is unique.
10782 + *
10783 + * Upon reception, a zero bit that occur after 5 one bits is simply
10784 + * discarded.  A series of 6 one bits is end-of-frame, and a series of
10785 + * 7 one bits is an abort.  Once bit-stuffing has been corrected for,
10786 + * an integer number of bytes should now be present.  The last two
10787 + * of these bytes form the Frame Check Sequence, a CRC that is verified
10788 + * and then discarded.  Note that bit-stuffing is performed on the FCS
10789 + * just as if it were regular data.
10790 + *
10791 + *
10792 + *
10793 + * int make_raw_hdlc_data(u_char *src, u_int slen,
10794 + *                        u_char *dst, u_int dsize)
10795 + *
10796 + *   Used for transmission.  Copies slen bytes from src to dst, performing
10797 + *   HDLC encapsulation (flag bytes, bit-stuffing, CRC) in the process.
10798 + *   dsize is size of destination buffer, and should be at least
10799 + *   ((6*slen)/5)+5 bytes to ensure adequate space will be available.
10800 + *   Function returns length (in bytes) of valid destination buffer, or
10801 + *   0 upon destination overflow.
10802 + *
10803 + * void init_hdlc_state(struct hdlc_state *stateptr, int mode)
10804 + *
10805 + *   Initializes hdlc_state structure before first call to read_raw_hdlc_data
10806 + *
10807 + *   mode = 0: Sane mode
10808 + *   mode = 1/2: 
10809 + *             Insane mode; NETJet use a shared unsigned int memory block (
10810 + *            with busmaster DMA), the bit pattern of every word is 
10811 + *            <8 B1> <8 B2> <8 Mon> <2 D> <4 C/I> <MX> <MR>
10812 + *            according to Siemens IOM-2 interface, so we have to handle
10813 + *             the src buffer as unsigned int and have to shift/mask the
10814 + *             B-channel bytes.
10815 + *             mode 1 -> B1  mode 2  -> B2 data is used
10816 + *
10817 + * int read_raw_hdlc_data(struct hdlc_state *saved_state,
10818 + *                        u_char *src, u_int slen,
10819 + *                        u_char *dst, u_int dsize)
10820 + *
10821 + *   Used for reception.  Scans source buffer bit-by-bit looking for
10822 + *   valid HDLC frames, which are copied to destination buffer.  HDLC
10823 + *   state information is stored in a structure, which allows this
10824 + *   function to process frames spread across several blocks of raw
10825 + *   HDLC data.  Part of the state information is bit offsets into
10826 + *   the source and destination buffers.
10827 + *
10828 + *   A return value >0 indicates the length of a valid frame, now
10829 + *   stored in the destination buffer.  In this case, the source
10830 + *   buffer might not be completely processed, so this function should
10831 + *   be called again with the same source buffer, possibly with a
10832 + *   different destination buffer.
10833 + *
10834 + *   A return value of zero indicates that the source buffer was
10835 + *   completely processed without finding a valid end-of-packet;
10836 + *   however, we might be in the middle of packet reception, so
10837 + *   the function should be called again with the next block of
10838 + *   raw HDLC data and the same destination buffer.  It is NOT
10839 + *   permitted to change the destination buffer in this case,
10840 + *   since data may already have begun to be stored there.
10841 + *
10842 + *   A return value of -1 indicates some kind of error - destination
10843 + *   buffer overflow, CRC check failed, frame not a multiple of 8
10844 + *   bits.  Destination buffer probably contains invalid data, which
10845 + *   should be discarded.  Call function again with same source buffer
10846 + *   and a new (or same) destination buffer.
10847 + *
10848 + *   Suggested calling sequence:
10849 + *
10850 + *      init_hdlc_state(...);
10851 + *      for (EACH_RAW_DATA_BLOCK) {
10852 + *         while (len = read_raw_hdlc_data(...)) {
10853 + *             if (len == -1) DISCARD_FRAME;
10854 + *             else PROCESS_FRAME;
10855 + *         }
10856 + *      }
10857 + *
10858 + *
10859 + * Test the code in this file as follows:
10860 + *    gcc -DDEBUGME -o rawhdlctest rawhdlc.c
10861 + *    ./rawhdlctest < rawdata
10862 + *
10863 + * The file "rawdata" can be easily generated from a HISAX B-channel
10864 + * hex dump (CF CF CF 02 ...) using the following perl script:
10865 + *
10866 + * while(<>) {
10867 + *     @hexlist = split ' ';
10868 + *     while ($hexstr = shift(@hexlist)) {
10869 + *         printf "%c", hex($hexstr);
10870 + *     }
10871 + * }
10872 + *
10873 + */
10874 +
10875 +#ifdef DEBUGME
10876 +#include <stdio.h>
10877 +#endif
10878 +
10879 +#include <linux/types.h>
10880 +#include <linux/ppp_defs.h>
10881 +#include "rawhdlc.h"
10882 +
10883 +/* There's actually an identical copy of this table in the PPP code
10884 + * (ppp_crc16_table), but I don't want this code dependent on PPP
10885 + */
10886 +
10887 +// static 
10888 +__u16 fcstab[256] =
10889 +{
10890 +       0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
10891 +       0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
10892 +       0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
10893 +       0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
10894 +       0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
10895 +       0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
10896 +       0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
10897 +       0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
10898 +       0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
10899 +       0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
10900 +       0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
10901 +       0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
10902 +       0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
10903 +       0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
10904 +       0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
10905 +       0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
10906 +       0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
10907 +       0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
10908 +       0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
10909 +       0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
10910 +       0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
10911 +       0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
10912 +       0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
10913 +       0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
10914 +       0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
10915 +       0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
10916 +       0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
10917 +       0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
10918 +       0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
10919 +       0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
10920 +       0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
10921 +       0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
10922 +};
10923 +
10924 +#define HDLC_ZERO_SEARCH 0
10925 +#define HDLC_FLAG_SEARCH 1
10926 +#define HDLC_FLAG_FOUND  2
10927 +#define HDLC_FRAME_FOUND 3
10928 +#define HDLC_NULL 4
10929 +#define HDLC_PART 5
10930 +#define HDLC_FULL 6
10931 +
10932 +#define HDLC_FLAG_VALUE        0x7e
10933 +
10934 +
10935 +#define MAKE_RAW_BYTE for (j=0; j<8; j++) { \
10936 +                       bitcnt++;\
10937 +                       out_val >>= 1;\
10938 +                       if (val & 1) {\
10939 +                               s_one++;\
10940 +                               out_val |= 0x80;\
10941 +                       } else {\
10942 +                               s_one = 0;\
10943 +                               out_val &= 0x7f;\
10944 +                       }\
10945 +                       if (bitcnt==8) {\
10946 +                               if (d_cnt == dsize) return 0;\
10947 +                               dst[d_cnt++] = out_val;\
10948 +                               bitcnt = 0;\
10949 +                       }\
10950 +                       if (s_one == 5) {\
10951 +                               out_val >>= 1;\
10952 +                               out_val &= 0x7f;\
10953 +                               bitcnt++;\
10954 +                               s_one = 0;\
10955 +                       }\
10956 +                       if (bitcnt==8) {\
10957 +                               if (d_cnt == dsize) return 0;\
10958 +                               dst[d_cnt++] = out_val;\
10959 +                               bitcnt = 0;\
10960 +                       }\
10961 +                       val >>= 1;\
10962 +               }
10963 +
10964 +/* Optimization suggestion: If needed, this function could be
10965 + * dramatically sped up using a state machine.  Each state would
10966 + * correspond to having seen N one bits, and being offset M bits into
10967 + * the current output byte.  N ranges from 0 to 4, M from 0 to 7, so
10968 + * we need 5*8 = 35 states.  Each state would have a table with 256
10969 + * entries, one for each input character.  Each entry would contain
10970 + * three output characters, an output state, an a byte increment
10971 + * that's either 1 or 2.  All this could fit in four bytes; so we need
10972 + * 4 bytes * 256 characters = 1 KB for each state (35 KB total).  Zero
10973 + * the output buffer before you start.  For each character in your
10974 + * input, you look it up in the current state's table and get three
10975 + * bytes to be or'ed into the output at the current byte offset, and
10976 + * an byte increment to move your pointer forward.  A simple Perl
10977 + * script could generate the tables.  Given HDLC semantics, probably
10978 + * would be better to set output to all 1s, then use ands instead of ors.
10979 + * A smaller state machine could operate on nibbles instead of bytes.
10980 + * A state machine for 32-bit architectures could use word offsets
10981 + * instead of byte offsets, requiring 5*32 = 160 states; probably
10982 + * best to work on nibbles in such a case.
10983 + */
10984 +
10985 +
10986 +int make_raw_hdlc_data(u_char *src, u_int slen, u_char *dst, u_int dsize)
10987 +{
10988 +       register u_int i,d_cnt=0;
10989 +       register u_char j;
10990 +       register u_char val;
10991 +       register u_char s_one = 0;
10992 +       register u_char out_val = 0;
10993 +       register u_char bitcnt = 0;
10994 +       u_int fcs;
10995 +       
10996 +       
10997 +       dst[d_cnt++] = HDLC_FLAG_VALUE;
10998 +       fcs = PPP_INITFCS;
10999 +       for (i=0; i<slen; i++) {
11000 +               val = src[i];
11001 +               fcs = PPP_FCS (fcs, val);
11002 +               MAKE_RAW_BYTE;
11003 +       }
11004 +       fcs ^= 0xffff;
11005 +       val = fcs & 0xff;
11006 +       MAKE_RAW_BYTE;
11007 +       val = (fcs>>8) & 0xff;
11008 +       MAKE_RAW_BYTE;
11009 +       val = HDLC_FLAG_VALUE;
11010 +       for (j=0; j<8; j++) { 
11011 +               bitcnt++;
11012 +               out_val >>= 1;
11013 +               if (val & 1)
11014 +                       out_val |= 0x80;
11015 +               else
11016 +                       out_val &= 0x7f;
11017 +               if (bitcnt==8) {
11018 +                       if (d_cnt == dsize) return 0;
11019 +                       dst[d_cnt++] = out_val;
11020 +                       bitcnt = 0;
11021 +               }
11022 +               val >>= 1;
11023 +       }
11024 +       if (bitcnt) {
11025 +               while (8>bitcnt++) {
11026 +                       out_val >>= 1;
11027 +                       out_val |= 0x80;
11028 +               }
11029 +               if (d_cnt == dsize) return 0;
11030 +               dst[d_cnt++] = out_val;
11031 +       }
11032 +
11033 +       return d_cnt;
11034 +}
11035 +
11036 +void init_hdlc_state(struct hdlc_state *stateptr, int mode)
11037 +{
11038 +       stateptr->state = HDLC_ZERO_SEARCH;
11039 +       stateptr->r_one = 0;
11040 +       stateptr->r_val = 0;
11041 +       stateptr->o_bitcnt = 0;
11042 +       stateptr->i_bitcnt = 0;
11043 +       stateptr->insane_mode = mode;
11044 +}
11045 +
11046 +/* Optimization suggestion: A similar state machine could surely
11047 + * be developed for this function as well.
11048 + */
11049 +
11050 +int read_raw_hdlc_data(struct hdlc_state *saved_state,
11051 +                       u_char *src, u_int slen, u_char *dst, u_int dsize)
11052 +{
11053 +       int retval=0;
11054 +       register u_char val;
11055 +       register u_char state = saved_state->state;
11056 +       register u_char r_one = saved_state->r_one;
11057 +       register u_char r_val = saved_state->r_val;
11058 +       register u_int o_bitcnt = saved_state->o_bitcnt;
11059 +       register u_int i_bitcnt = saved_state->i_bitcnt;
11060 +       register u_int fcs    = saved_state->fcs;
11061 +       register u_int *isrc = (u_int *) src;
11062 +        
11063 +       /* Use i_bitcnt (bit offset into source buffer) to reload "val"
11064 +        * in case we're starting up again partway through a source buffer
11065 +        */
11066 +
11067 +       if ((i_bitcnt >> 3) < slen) {
11068 +               if (saved_state->insane_mode==1) {
11069 +                       val = isrc[(i_bitcnt >> 3)] & 0xff;
11070 +               } else if (saved_state->insane_mode==2) {
11071 +                       val = (isrc[i_bitcnt >> 3] >>8) & 0xff;
11072 +               } else {
11073 +                       val = src[i_bitcnt >> 3];
11074 +               }
11075 +               val >>= i_bitcnt & 7;
11076 +       }
11077 +
11078 +       /* One bit per loop.  Keep going until we've got something to
11079 +        * report (retval != 0), or we exhaust the source buffer
11080 +        */
11081 +
11082 +       while ((retval == 0) && ((i_bitcnt >> 3) < slen)) {
11083 +               if ((i_bitcnt & 7) == 0) {
11084 +                       if (saved_state->insane_mode==1) {
11085 +                               val = isrc[(i_bitcnt >> 3)] & 0xff;
11086 +                       } else if (saved_state->insane_mode==2) {
11087 +                               val = (isrc[i_bitcnt >> 3] >>8) & 0xff;
11088 +                       } else {
11089 +                               val = src[i_bitcnt >> 3];
11090 +                       }
11091 +#ifdef DEBUGME
11092 +                       printf("Input byte %d: 0x%2x\n", i_bitcnt>>3, val);
11093 +#endif
11094 +                       if (val == 0xff) {
11095 +                               state = HDLC_ZERO_SEARCH;
11096 +                               o_bitcnt = 0;
11097 +                               r_one = 0;
11098 +                               i_bitcnt += 8;
11099 +                               continue;
11100 +                       }
11101 +               }
11102 +
11103 +#ifdef DEBUGME
11104 +               /* printf("Data bit=%d (%d/%d)\n", val&1, i_bitcnt>>3, i_bitcnt&7);*/
11105 +#endif
11106 +
11107 +               if (state == HDLC_ZERO_SEARCH) {
11108 +                       if (val & 1) {
11109 +                               r_one++;
11110 +                       } else {
11111 +                               r_one=0;
11112 +                               state= HDLC_FLAG_SEARCH;
11113 +                       }
11114 +               } else if (state == HDLC_FLAG_SEARCH) { 
11115 +                       if (val & 1) {
11116 +                               r_one++;
11117 +                               if (r_one>6) {
11118 +                                       state=HDLC_ZERO_SEARCH;
11119 +                               }
11120 +                       } else {
11121 +                               if (r_one==6) {
11122 +                                       o_bitcnt=0;
11123 +                                       r_val=0;
11124 +                                       state=HDLC_FLAG_FOUND;
11125 +                               }
11126 +                               r_one=0;
11127 +                       }
11128 +               } else if (state ==  HDLC_FLAG_FOUND) {
11129 +                       if (val & 1) {
11130 +                               r_one++;
11131 +                               if (r_one>6) {
11132 +                                       state=HDLC_ZERO_SEARCH;
11133 +                               } else {
11134 +                                       r_val >>= 1;
11135 +                                       r_val |= 0x80;
11136 +                                       o_bitcnt++;
11137 +                               }
11138 +                       } else {
11139 +                               if (r_one==6) {
11140 +                                       o_bitcnt=0;
11141 +                                       r_val=0;
11142 +                                       r_one=0;
11143 +                                       i_bitcnt++;
11144 +                                       val >>= 1;
11145 +                                       continue;
11146 +                               } else if (r_one!=5) {
11147 +                                       r_val >>= 1;
11148 +                                       r_val &= 0x7f;
11149 +                                       o_bitcnt++;
11150 +                               }
11151 +                               r_one=0;        
11152 +                       }
11153 +                       if ((state != HDLC_ZERO_SEARCH) &&
11154 +                               !(o_bitcnt & 7)) {
11155 +#ifdef DEBUGME
11156 +                               printf("HDLC_FRAME_FOUND at i_bitcnt:%d\n",i_bitcnt);
11157 +#endif
11158 +                               state=HDLC_FRAME_FOUND;
11159 +                               fcs = PPP_INITFCS;
11160 +                               dst[0] = r_val;
11161 +                               fcs = PPP_FCS (fcs, r_val);
11162 +                       }
11163 +               } else if (state ==  HDLC_FRAME_FOUND) {
11164 +                       if (val & 1) {
11165 +                               r_one++;
11166 +                               if (r_one>6) {
11167 +                                       state=HDLC_ZERO_SEARCH;
11168 +                                       o_bitcnt=0;
11169 +                               } else {
11170 +                                       r_val >>= 1;
11171 +                                       r_val |= 0x80;
11172 +                                       o_bitcnt++;
11173 +                               }
11174 +                       } else {
11175 +                               if (r_one==6) {
11176 +                                       r_val=0; 
11177 +                                       r_one=0;
11178 +                                       o_bitcnt++;
11179 +                                       if (o_bitcnt & 7) {
11180 +                                               /* Alignment error */
11181 +#ifdef DEBUGME
11182 +                                               printf("Alignment error\n");
11183 +#endif
11184 +                                               state=HDLC_FLAG_SEARCH;
11185 +                                               retval = -1;
11186 +                                       } else if (fcs==PPP_GOODFCS) {
11187 +                                               /* Valid frame */
11188 +                                               state=HDLC_FLAG_FOUND;
11189 +                                               retval = (o_bitcnt>>3)-3;
11190 +                                       } else {
11191 +                                               /* CRC error */
11192 +#ifdef DEBUGME
11193 +                                               printf("CRC error; fcs was 0x%x, should have been 0x%x\n", fcs, PPP_GOODFCS);
11194 +#endif
11195 +                                               state=HDLC_FLAG_FOUND;
11196 +                                               retval = -1;
11197 +                                       }
11198 +                               } else if (r_one==5) {
11199 +                                       r_one=0;
11200 +                                       i_bitcnt++;
11201 +                                       val >>= 1;
11202 +                                       continue;
11203 +                               } else {
11204 +                                       r_val >>= 1;
11205 +                                       r_val &= 0x7f;
11206 +                                       o_bitcnt++;
11207 +                               }
11208 +                               r_one=0;        
11209 +                       }
11210 +                       if ((state == HDLC_FRAME_FOUND) &&
11211 +                               !(o_bitcnt & 7)) {
11212 +                               if ((o_bitcnt>>3)>=dsize) {
11213 +                                       /* Buffer overflow error */
11214 +#ifdef DEBUGME
11215 +                                       printf("Buffer overflow error\n");
11216 +#endif
11217 +                                       r_val=0; 
11218 +                                       state=HDLC_FLAG_SEARCH;
11219 +                                       retval = -1;
11220 +                               } else {
11221 +                                       dst[(o_bitcnt>>3)-1] = r_val;
11222 +                                       fcs = PPP_FCS (fcs, r_val);
11223 +#ifdef DEBUGME
11224 +                                       printf("Output byte %d: 0x%02x; FCS 0x%04x\n", (o_bitcnt>>3)-1, r_val, fcs);
11225 +#endif
11226 +                               }
11227 +                       }
11228 +               }
11229 +               i_bitcnt ++;
11230 +               val >>= 1;
11231 +       }
11232 +
11233 +       /* We exhausted the source buffer before anything else happened
11234 +        * (retval==0).  Reset i_bitcnt in expectation of a new source
11235 +        * buffer.  Other, we either had an error or a valid frame, so
11236 +        * reset o_bitcnt in expectation of a new destination buffer.
11237 +        */
11238 +
11239 +       if (retval == 0) {
11240 +               i_bitcnt = 0;
11241 +       } else {
11242 +               o_bitcnt = 0;
11243 +       }
11244 +
11245 +       saved_state->state = state;
11246 +       saved_state->r_one = r_one;
11247 +       saved_state->r_val = r_val;
11248 +       saved_state->fcs = fcs;
11249 +       saved_state->o_bitcnt = o_bitcnt;
11250 +       saved_state->i_bitcnt = i_bitcnt;
11251 +
11252 +       return (retval);
11253 +}
11254 +
11255 +
11256 +
11257 +#ifdef DEBUGME
11258 +
11259 +char buffer[1024];
11260 +char obuffer[1024];
11261 +
11262 +main()
11263 +{
11264 +  int buflen=0;
11265 +  int len;
11266 +  struct hdlc_state hdlc_state;
11267 +
11268 +  while((buffer[buflen] = getc(stdin)) != EOF && buflen<1024) buflen++;
11269 +
11270 +  printf("buflen = %d\n", buflen);
11271 +
11272 +  init_hdlc_state(&hdlc_state, 0);
11273 +
11274 +  while (len = read_raw_hdlc_data(&hdlc_state,buffer,buflen,obuffer,1024)) {
11275 +    if (len == -1) printf("Error @ byte %d/bit %d\n",
11276 +                         hdlc_state.i_bitcnt>>3, hdlc_state.i_bitcnt & 7);
11277 +    else {
11278 +      printf("Frame received: len %d\n", len);
11279 +    }
11280 +  }
11281 +
11282 +  printf("Done\n");
11283 +}
11284 +
11285 +#endif
11286 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.h linux-2.4.29/drivers/isdn/hisax/rawhdlc.h
11287 --- linux-2.4.29.old/drivers/isdn/hisax/rawhdlc.h       1970-01-01 01:00:00.000000000 +0100
11288 +++ linux-2.4.29/drivers/isdn/hisax/rawhdlc.h   2005-03-22 15:06:48.076784000 +0100
11289 @@ -0,0 +1,28 @@
11290 +/* $Id: rawhdlc.h,v 1.5 2001/09/24 13:22:57 kai Exp $
11291 + *
11292 + * Author     Brent Baccala
11293 + * Copyright  by Brent Baccala <baccala@FreeSoft.org>
11294 + *
11295 + * This software may be used and distributed according to the terms
11296 + * of the GNU General Public License, incorporated herein by reference.
11297 + *
11298 + */
11299 +
11300 +#ifndef RAWHDLC_H
11301 +struct hdlc_state {
11302 +       char insane_mode;
11303 +       u_char state;
11304 +       u_char r_one;
11305 +       u_char r_val;
11306 +       u_int o_bitcnt;
11307 +       u_int i_bitcnt;
11308 +       u_int fcs;
11309 +};
11310 +
11311 +
11312 +int make_raw_hdlc_data(u_char *src, u_int slen, u_char *dst, u_int dsize);
11313 +void init_hdlc_state(struct hdlc_state *stateptr, int mode);
11314 +int read_raw_hdlc_data(struct hdlc_state *saved_state,
11315 +                       u_char *src, u_int slen, u_char *dst, u_int dsize);
11316 +#define RAWHDLC_H
11317 +#endif
11318 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/s0box.c linux-2.4.29/drivers/isdn/hisax/s0box.c
11319 --- linux-2.4.29.old/drivers/isdn/hisax/s0box.c 2005-03-22 14:47:56.000000000 +0100
11320 +++ linux-2.4.29/drivers/isdn/hisax/s0box.c     2005-03-22 15:06:48.092781568 +0100
11321 @@ -1,4 +1,4 @@
11322 -/* $Id: s0box.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11323 +/* $Id: s0box.c,v 2.6 2001/09/24 13:22:57 kai Exp $
11324   *
11325   * low level stuff for Creatix S0BOX
11326   *
11327 @@ -18,7 +18,7 @@
11328  #include "isdnl1.h"
11329  
11330  extern const char *CardType[];
11331 -const char *s0box_revision = "$Revision: 1.1.4.1 $";
11332 +const char *s0box_revision = "$Revision: 2.6 $";
11333  
11334  static inline void
11335  writereg(unsigned int padr, signed int addr, u_char off, u_char val) {
11336 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/saphir.c linux-2.4.29/drivers/isdn/hisax/saphir.c
11337 --- linux-2.4.29.old/drivers/isdn/hisax/saphir.c        2005-03-22 14:47:56.000000000 +0100
11338 +++ linux-2.4.29/drivers/isdn/hisax/saphir.c    2005-03-22 15:06:48.107779288 +0100
11339 @@ -1,4 +1,4 @@
11340 -/* $Id: saphir.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11341 +/* $Id: saphir.c,v 1.10 2001/09/24 13:22:57 kai Exp $
11342   *
11343   * low level stuff for HST Saphir 1
11344   *
11345 @@ -20,7 +20,7 @@
11346  #include "isdnl1.h"
11347  
11348  extern const char *CardType[];
11349 -static char *saphir_rev = "$Revision: 1.1.4.1 $";
11350 +static char *saphir_rev = "$Revision: 1.10 $";
11351  
11352  #define byteout(addr,val) outb(val,addr)
11353  #define bytein(addr) inb(addr)
11354 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/sedlbauer.c linux-2.4.29/drivers/isdn/hisax/sedlbauer.c
11355 --- linux-2.4.29.old/drivers/isdn/hisax/sedlbauer.c     2005-03-22 14:47:56.000000000 +0100
11356 +++ linux-2.4.29/drivers/isdn/hisax/sedlbauer.c 2005-03-22 15:06:48.123776856 +0100
11357 @@ -1,4 +1,4 @@
11358 -/* $Id: sedlbauer.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11359 +/* $Id: sedlbauer.c,v 1.34 2002/02/09 21:00:57 keil Exp $
11360   *
11361   * low level stuff for Sedlbauer cards
11362   * includes support for the Sedlbauer speed star (speed star II),
11363 @@ -48,18 +48,19 @@
11364  #include "isar.h"
11365  #include "isdnl1.h"
11366  #include <linux/pci.h>
11367 -#include <linux/isapnp.h>
11368 +#include <linux/isdn_compat.h>
11369  
11370  extern const char *CardType[];
11371  
11372 -const char *Sedlbauer_revision = "$Revision: 1.1.4.1 $";
11373 +const char *Sedlbauer_revision = "$Revision: 1.34 $";
11374  
11375  const char *Sedlbauer_Types[] =
11376         {"None", "speed card/win", "speed star", "speed fax+",
11377         "speed win II / ISDN PC/104", "speed star II", "speed pci",
11378 -       "speed fax+ pyramid", "speed fax+ pci"};
11379 +       "speed fax+ pyramid", "speed fax+ pci", "HST Saphir III"};
11380  
11381  #define PCI_SUBVENDOR_SPEEDFAX_PYRAMID 0x51
11382 +#define PCI_SUBVENDOR_HST_SAPHIR3      0x52
11383  #define PCI_SUBVENDOR_SEDLBAUER_PCI    0x53
11384  #define PCI_SUBVENDOR_SPEEDFAX_PCI     0x54
11385  #define PCI_SUB_ID_SEDLBAUER           0x01
11386 @@ -72,6 +73,7 @@
11387  #define SEDL_SPEED_PCI         6
11388  #define SEDL_SPEEDFAX_PYRAMID  7
11389  #define SEDL_SPEEDFAX_PCI      8
11390 +#define HST_SAPHIR3            9
11391  
11392  #define SEDL_CHIP_TEST         0
11393  #define SEDL_CHIP_ISAC_HSCX    1
11394 @@ -531,21 +533,6 @@
11395  
11396  static struct pci_dev *dev_sedl __devinitdata = NULL;
11397  
11398 -#ifdef __ISAPNP__
11399 -static struct isapnp_device_id sedl_ids[] __initdata = {
11400 -       { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
11401 -         ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01), 
11402 -         (unsigned long) "Speed win" },
11403 -       { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02),
11404 -         ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x02), 
11405 -         (unsigned long) "Speed Fax+" },
11406 -       { 0, }
11407 -};
11408 -
11409 -static struct isapnp_device_id *pdev = &sedl_ids[0];
11410 -static struct pci_bus *pnp_c __devinitdata = NULL;
11411 -#endif
11412 -
11413  int __devinit
11414  setup_sedlbauer(struct IsdnCard *card)
11415  {
11416 @@ -581,57 +568,6 @@
11417                         bytecnt = 16;
11418                 }
11419         } else {
11420 -#ifdef __ISAPNP__
11421 -               if (isapnp_present()) {
11422 -                       struct pci_bus *pb;
11423 -                       struct pci_dev *pd;
11424 -
11425 -                       while(pdev->card_vendor) {
11426 -                               if ((pb = isapnp_find_card(pdev->card_vendor,
11427 -                                       pdev->card_device, pnp_c))) {
11428 -                                       pnp_c = pb;
11429 -                                       pd = NULL;
11430 -                                       if ((pd = isapnp_find_dev(pnp_c,
11431 -                                               pdev->vendor, pdev->function, pd))) {
11432 -                                               printk(KERN_INFO "HiSax: %s detected\n",
11433 -                                                       (char *)pdev->driver_data);
11434 -                                               pd->prepare(pd);
11435 -                                               pd->deactivate(pd);
11436 -                                               pd->activate(pd);
11437 -                                               card->para[1] =
11438 -                                                       pd->resource[0].start;
11439 -                                               card->para[0] =
11440 -                                                       pd->irq_resource[0].start;
11441 -                                               if (!card->para[0] || !card->para[1]) {
11442 -                                                       printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n",
11443 -                                                               card->para[0], card->para[1]);
11444 -                                                       pd->deactivate(pd);
11445 -                                                       return(0);
11446 -                                               }
11447 -                                               cs->hw.sedl.cfg_reg = card->para[1];
11448 -                                               cs->irq = card->para[0];
11449 -                                               if (pdev->function == ISAPNP_FUNCTION(0x2)) {
11450 -                                                       cs->subtyp = SEDL_SPEED_FAX;
11451 -                                                       cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
11452 -                                                       bytecnt = 16;
11453 -                                               } else {
11454 -                                                       cs->subtyp = SEDL_SPEED_CARD_WIN;
11455 -                                                       cs->hw.sedl.chip = SEDL_CHIP_TEST;
11456 -                                               }
11457 -                                               goto ready;
11458 -                                       } else {
11459 -                                               printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
11460 -                                               return(0);
11461 -                                       }
11462 -                               }
11463 -                               pdev++;
11464 -                               pnp_c=NULL;
11465 -                       } 
11466 -                       if (!pdev->card_vendor) {
11467 -                               printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
11468 -                       }
11469 -               }
11470 -#endif
11471  /* Probe for Sedlbauer speed pci */
11472  #if CONFIG_PCI
11473                 if (!pci_present()) {
11474 @@ -647,15 +583,15 @@
11475                                 printk(KERN_WARNING "Sedlbauer: No IRQ for PCI card found\n");
11476                                 return(0);
11477                         }
11478 -                       cs->hw.sedl.cfg_reg = pci_resource_start(dev_sedl, 0);
11479 +                       cs->hw.sedl.cfg_reg = pci_resource_start_io(dev_sedl, 0);
11480                 } else {
11481                         printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
11482                         return(0);
11483                 }
11484                 cs->irq_flags |= SA_SHIRQ;
11485                 cs->hw.sedl.bus = SEDL_BUS_PCI;
11486 -               sub_vendor_id = dev_sedl->subsystem_vendor;
11487 -               sub_id = dev_sedl->subsystem_device;
11488 +               pci_get_sub_vendor(dev_sedl,sub_vendor_id);
11489 +               pci_get_sub_system(dev_sedl,sub_id);
11490                 printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n",
11491                         sub_vendor_id, sub_id);
11492                 printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n",
11493 @@ -670,6 +606,9 @@
11494                 } else if (sub_vendor_id == PCI_SUBVENDOR_SPEEDFAX_PCI) {
11495                         cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
11496                         cs->subtyp = SEDL_SPEEDFAX_PCI;
11497 +               } else if (sub_vendor_id == PCI_SUBVENDOR_HST_SAPHIR3) {
11498 +                       cs->hw.sedl.chip = SEDL_CHIP_IPAC;
11499 +                       cs->subtyp = HST_SAPHIR3;
11500                 } else if (sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER_PCI) {
11501                         cs->hw.sedl.chip = SEDL_CHIP_IPAC;
11502                         cs->subtyp = SEDL_SPEED_PCI;
11503 @@ -683,8 +622,8 @@
11504                 cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF;
11505                 byteout(cs->hw.sedl.cfg_reg, 0xff);
11506                 byteout(cs->hw.sedl.cfg_reg, 0x00);
11507 -               byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd);
11508 -               byteout(cs->hw.sedl.cfg_reg+ 5, 0x02);
11509 +               byteout(cs->hw.sedl.cfg_reg +2, 0xdd);
11510 +               byteout(cs->hw.sedl.cfg_reg +5, 0x02);
11511                 byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
11512                 save_flags(flags);
11513                 sti();
11514 @@ -697,7 +636,7 @@
11515                 return (0);
11516  #endif /* CONFIG_PCI */
11517         }       
11518 -ready: 
11519 +       
11520         /* In case of the sedlbauer pcmcia card, this region is in use,
11521          * reserved for us by the card manager. So we do not check it
11522          * here, it would fail.
11523 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/sportster.c linux-2.4.29/drivers/isdn/hisax/sportster.c
11524 --- linux-2.4.29.old/drivers/isdn/hisax/sportster.c     2005-03-22 14:47:56.000000000 +0100
11525 +++ linux-2.4.29/drivers/isdn/hisax/sportster.c 2005-03-22 15:06:48.169769864 +0100
11526 @@ -1,4 +1,4 @@
11527 -/* $Id: sportster.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
11528 +/* $Id: sportster.c,v 1.16 2001/09/24 13:22:57 kai Exp $
11529   *
11530   * low level stuff for USR Sportster internal TA
11531   *
11532 @@ -20,7 +20,7 @@
11533  #include "isdnl1.h"
11534  
11535  extern const char *CardType[];
11536 -const char *sportster_revision = "$Revision: 1.1.4.1 $";
11537 +const char *sportster_revision = "$Revision: 1.16 $";
11538  
11539  #define byteout(addr,val) outb(val,addr)
11540  #define bytein(addr) inb(addr)
11541 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481-debug.h linux-2.4.29/drivers/isdn/hisax/st5481-debug.h
11542 --- linux-2.4.29.old/drivers/isdn/hisax/st5481-debug.h  1970-01-01 01:00:00.000000000 +0100
11543 +++ linux-2.4.29/drivers/isdn/hisax/st5481-debug.h      2005-03-22 15:06:48.184767584 +0100
11544 @@ -0,0 +1,103 @@
11545 +#define ST5481_DEBUG 0x0
11546 +
11547 +#if ST5481_DEBUG
11548 +
11549 +
11550 +/*
11551 +  DEBUG flags. Set compile option  ST5481_DEBUG with the following bits set to trace
11552 +  the given subsections:
11553 +
11554 +  0x01:  USB
11555 +  0x02:  D
11556 +  0x04:  B
11557 +  0x08:  PH
11558 +  0x10:  PACKET_DUMP D out
11559 +  0x20:  ISO_DUMP D out
11560 +  0x40:  PACKET_DUMP D in
11561 +  0x80:  ISO_DUMP in
11562 +  0x100: PACKET_DUMP B out
11563 +  0x200: ISO_DUMP B out
11564 +  0x400: PACKET_DUMP B in
11565 +*/
11566 +
11567 +#define DBG(level, format, arg...) \
11568 +if (level &  ST5481_DEBUG) \
11569 +printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg) \
11570 +
11571 +static inline void 
11572 +dump_packet(const char *name,const u_char *data,int pkt_len)
11573 +{
11574 +#define DUMP_HDR_SIZE 200
11575 +#define DUMP_TLR_SIZE 8
11576 +       if (pkt_len) {
11577 +               int i,len1,len2;
11578 +
11579 +               printk(KERN_DEBUG "%s: length=%d,data=",name,pkt_len);
11580 +
11581 +               if (pkt_len >  DUMP_HDR_SIZE+ DUMP_TLR_SIZE) {
11582 +                       len1 = DUMP_HDR_SIZE;
11583 +                       len2 = DUMP_TLR_SIZE;
11584 +               } else {
11585 +                       len1 = pkt_len > DUMP_HDR_SIZE ? DUMP_HDR_SIZE : pkt_len;
11586 +                       len2 = 0;                       
11587 +               }
11588 +               for (i = 0; i < len1; ++i) {
11589 +                       printk ("%.2x", data[i]);
11590 +               }
11591 +               if (len2) {
11592 +                       printk ("..");
11593 +                       for (i = pkt_len-DUMP_TLR_SIZE; i < pkt_len; ++i) {
11594 +                               printk ("%.2x", data[i]);
11595 +                       }
11596 +               }
11597 +               printk ("\n");
11598 +       }
11599 +#undef DUMP_HDR_SIZE
11600 +#undef DUMP_TLR_SIZE
11601 +}
11602 +
11603 +static inline void 
11604 +dump_iso_packet(const char *name,urb_t *urb)
11605 +{
11606 +       int i,j;
11607 +       int len,ofs;
11608 +       u_char *data;
11609 +
11610 +       printk(KERN_DEBUG "%s: packets=%d,errors=%d\n",
11611 +              name,urb->number_of_packets,urb->error_count);
11612 +       for (i = 0; i  < urb->number_of_packets; ++i) {
11613 +               if (urb->pipe & USB_DIR_IN) {
11614 +                       len = urb->iso_frame_desc[i].actual_length;
11615 +               } else {
11616 +                       len = urb->iso_frame_desc[i].length;
11617 +               }
11618 +               ofs = urb->iso_frame_desc[i].offset;
11619 +               printk(KERN_DEBUG "len=%.2d,ofs=%.3d ",len,ofs);
11620 +               if (len) {
11621 +                       data = urb->transfer_buffer+ofs;
11622 +                       for (j=0; j < len; j++) {
11623 +                               printk ("%.2x", data[j]);
11624 +                       }
11625 +               }
11626 +               printk("\n");
11627 +       }
11628 +}
11629 +
11630 +#define DUMP_PACKET(level,data,count) \
11631 +  if (level & ST5481_DEBUG) dump_packet(__FUNCTION__,data,count)
11632 +#define DUMP_SKB(level,skb) \
11633 +  if ((level & ST5481_DEBUG) && skb) dump_packet(__FUNCTION__,skb->data,skb->len)
11634 +#define DUMP_ISO_PACKET(level,urb) \
11635 +  if (level & ST5481_DEBUG) dump_iso_packet(__FUNCTION__,urb)
11636 +
11637 +#else
11638 +
11639 +#define DBG(level,format, arg...) do {} while (0)
11640 +#define DUMP_PACKET(level,data,count) do {} while (0)
11641 +#define DUMP_SKB(level,skb) do {} while (0)
11642 +#define DUMP_ISO_PACKET(level,urb) do {} while (0)
11643 +
11644 +#endif
11645 +
11646 +
11647 +
11648 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481.h linux-2.4.29/drivers/isdn/hisax/st5481.h
11649 --- linux-2.4.29.old/drivers/isdn/hisax/st5481.h        2005-03-22 14:47:56.000000000 +0100
11650 +++ linux-2.4.29/drivers/isdn/hisax/st5481.h    2005-03-22 15:06:48.201765000 +0100
11651 @@ -219,15 +219,15 @@
11652  #define L1_EVENT_COUNT (EV_TIMER3 + 1)
11653  
11654  #define ERR(format, arg...) \
11655 -printk(KERN_ERR "%s:%s: " format "\n" , __FILE__,  __FUNCTION__ , ## arg)
11656 +printk(KERN_ERR __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg)
11657  
11658  #define WARN(format, arg...) \
11659 -printk(KERN_WARNING "%s:%s: " format "\n" , __FILE__,  __FUNCTION__ , ## arg)
11660 +printk(KERN_WARNING __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg)
11661  
11662  #define INFO(format, arg...) \
11663 -printk(KERN_INFO "%s:%s: " format "\n" , __FILE__,  __FUNCTION__ , ## arg)
11664 +printk(KERN_INFO __FILE__ ": " __FUNCTION__ ": " format "\n" , ## arg)
11665  
11666 -#include "isdnhdlc.h"
11667 +#include "st5481_hdlc.h"
11668  #include "fsm.h"
11669  #include "hisax_if.h"
11670  #include <linux/skbuff.h>
11671 @@ -236,7 +236,7 @@
11672   * FIFO handling
11673   */
11674  
11675 -/* Generic FIFO structure */
11676 +/* Generic FIFO structure */ 
11677  struct fifo {
11678         u_char r,w,count,size;
11679         spinlock_t lock;
11680 @@ -270,7 +270,7 @@
11681                 index = -1;
11682         } else {
11683                 // Return index where to get the next data to add to the FIFO
11684 -               index = fifo->w++ & (fifo->size-1);
11685 +               index = fifo->w++ & (fifo->size-1); 
11686                 fifo->count++;
11687         }
11688         spin_unlock_irqrestore(&fifo->lock, flags);
11689 @@ -289,13 +289,13 @@
11690                 return -1;
11691         }
11692  
11693 -       spin_lock_irqsave(&fifo->lock, flags);
11694 +       spin_lock_irqsave(&fifo->lock, flags);          
11695         if (!fifo->count) {
11696                 // FIFO empty
11697                 index = -1;
11698         } else {
11699                 // Return index where to get the next data from the FIFO
11700 -               index = fifo->r++ & (fifo->size-1);
11701 +               index = fifo->r++ & (fifo->size-1); 
11702                 fifo->count--;
11703         }
11704         spin_unlock_irqrestore(&fifo->lock, flags);
11705 @@ -309,7 +309,7 @@
11706  typedef void (*ctrl_complete_t)(void *);
11707  
11708  typedef struct ctrl_msg {
11709 -       struct usb_ctrlrequest dr;
11710 +       devrequest dr;
11711         ctrl_complete_t complete;
11712         void *context;
11713  } ctrl_msg; 
11714 @@ -336,7 +336,7 @@
11715  };
11716  
11717  struct st5481_d_out {
11718 -       struct isdnhdlc_vars hdlc_state;
11719 +       struct hdlc_vars hdlc_state;
11720         struct urb *urb[2]; /* double buffering */
11721         unsigned long busy;
11722         struct sk_buff *tx_skb;
11723 @@ -344,7 +344,7 @@
11724  };
11725  
11726  struct st5481_b_out {
11727 -       struct isdnhdlc_vars hdlc_state;
11728 +       struct hdlc_vars hdlc_state;
11729         struct urb *urb[2]; /* double buffering */
11730         u_char flow_event;
11731         u_long busy;
11732 @@ -352,7 +352,7 @@
11733  };
11734  
11735  struct st5481_in {
11736 -       struct isdnhdlc_vars hdlc_state;
11737 +       struct hdlc_vars hdlc_state;
11738         struct urb *urb[2]; /* double buffering */
11739         int mode;
11740         int bufsize;
11741 @@ -478,7 +478,7 @@
11742    if (level & __debug_variable) dump_iso_packet(__FUNCTION__,urb)
11743  
11744  static void __attribute__((unused))
11745 -dump_iso_packet(const char *name,struct urb *urb)
11746 +dump_iso_packet(const char *name,urb_t *urb)
11747  {
11748         int i,j;
11749         int len,ofs;
11750 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_b.c linux-2.4.29/drivers/isdn/hisax/st5481_b.c
11751 --- linux-2.4.29.old/drivers/isdn/hisax/st5481_b.c      2005-03-22 14:47:56.000000000 +0100
11752 +++ linux-2.4.29/drivers/isdn/hisax/st5481_b.c  2005-03-22 15:06:48.216762720 +0100
11753 @@ -67,28 +67,24 @@
11754                                 bytes_sent = buf_size - len;
11755                                 if (skb->len < bytes_sent)
11756                                         bytes_sent = skb->len;
11757 -                               {       /* swap tx bytes to get hearable audio data */
11758 -                                       register unsigned char *src  = skb->data;
11759 -                                       register unsigned char *dest = urb->transfer_buffer+len;
11760 -                                       register unsigned int count;
11761 -                                       for (count = 0; count < bytes_sent; count++)
11762 -                                               *dest++ = isdnhdlc_bit_rev_tab[*src++];
11763 -                               }
11764 +
11765 +                               memcpy(urb->transfer_buffer+len, skb->data, bytes_sent);
11766 +                               
11767                                 len += bytes_sent;
11768                         } else {
11769 -                               len += isdnhdlc_encode(&b_out->hdlc_state,
11770 -                                                      skb->data, skb->len, &bytes_sent,
11771 -                                                      urb->transfer_buffer+len, buf_size-len);
11772 +                               len += hdlc_encode(&b_out->hdlc_state, 
11773 +                                                  skb->data, skb->len, &bytes_sent,
11774 +                                                  urb->transfer_buffer+len, buf_size-len);
11775                         }
11776  
11777                         skb_pull(skb, bytes_sent);
11778 -
11779 +                       
11780                         if (!skb->len) {
11781                                 // Frame sent
11782                                 b_out->tx_skb = NULL;
11783                                 B_L1L2(bcs, PH_DATA | CONFIRM, (void *) skb->truesize);
11784                                 dev_kfree_skb_any(skb);
11785 -
11786 +                               
11787  /*                             if (!(bcs->tx_skb = skb_dequeue(&bcs->sq))) { */
11788  /*                                     st5481B_sched_event(bcs, B_XMTBUFREADY); */
11789  /*                             } */
11790 @@ -99,9 +95,9 @@
11791                                 len = buf_size;
11792                         } else {
11793                                 // Send flags
11794 -                               len += isdnhdlc_encode(&b_out->hdlc_state,
11795 -                                                      NULL, 0, &bytes_sent,
11796 -                                                      urb->transfer_buffer+len, buf_size-len);
11797 +                               len += hdlc_encode(&b_out->hdlc_state, 
11798 +                                                  NULL, 0, &bytes_sent,
11799 +                                                  urb->transfer_buffer+len, buf_size-len);
11800                         }
11801                 }       
11802         }
11803 @@ -213,7 +209,7 @@
11804         if (bcs->mode != L1_MODE_NULL) {
11805                 // Open the B channel
11806                 if (bcs->mode != L1_MODE_TRANS) {
11807 -                       isdnhdlc_out_init(&b_out->hdlc_state, 0, bcs->mode == L1_MODE_HDLC_56K);
11808 +                       hdlc_out_init(&b_out->hdlc_state, 0, bcs->mode == L1_MODE_HDLC_56K);
11809                 }
11810                 st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2, NULL, NULL);
11811         
11812 @@ -279,7 +275,7 @@
11813                                       usb_b_out_complete, bcs);
11814  }
11815  
11816 -static void st5481_release_b_out(struct st5481_bcs *bcs)
11817 +static void __devexit st5481_release_b_out(struct st5481_bcs *bcs)
11818  {
11819         struct st5481_b_out *b_out = &bcs->b_out;
11820  
11821 @@ -320,7 +316,7 @@
11822  /*
11823   * Release buffers and URBs for the B channels
11824   */
11825 -void st5481_release_b(struct st5481_bcs *bcs)
11826 +void __devexit st5481_release_b(struct st5481_bcs *bcs)
11827  {
11828         DBG(4,"");
11829  
11830 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_d.c linux-2.4.29/drivers/isdn/hisax/st5481_d.c
11831 --- linux-2.4.29.old/drivers/isdn/hisax/st5481_d.c      2005-03-22 14:47:56.000000000 +0100
11832 +++ linux-2.4.29/drivers/isdn/hisax/st5481_d.c  2005-03-22 15:06:48.231760440 +0100
11833 @@ -162,8 +162,8 @@
11834         {ST_L1_F8, EV_TIMER3,            l1_timer3},
11835         {ST_L1_F8, EV_IND_DP,            l1_go_f3},
11836         {ST_L1_F8, EV_IND_AP,            l1_go_f6},
11837 -       {ST_L1_F8, EV_IND_AI8,           l1_go_f7},
11838 -       {ST_L1_F8, EV_IND_AI10,          l1_go_f7},
11839 +       {ST_L1_F8, EV_IND_AI8,           l1_go_f8},
11840 +       {ST_L1_F8, EV_IND_AI10,          l1_go_f8},
11841         {ST_L1_F8, EV_IND_RSY,           l1_ignore},
11842  };
11843  
11844 @@ -297,7 +297,7 @@
11845         unsigned int num_packets, packet_offset;
11846         int len, buf_size, bytes_sent;
11847         struct sk_buff *skb;
11848 -       struct iso_packet_descriptor *desc;
11849 +       iso_packet_descriptor_t *desc;
11850  
11851         if (d_out->fsm.state != ST_DOUT_NORMAL)
11852                 return;
11853 @@ -313,15 +313,15 @@
11854         buf_size = NUM_ISO_PACKETS_D * SIZE_ISO_PACKETS_D_OUT;
11855         
11856         if (skb) {
11857 -               len = isdnhdlc_encode(&d_out->hdlc_state,
11858 -                                     skb->data, skb->len, &bytes_sent,
11859 -                                     urb->transfer_buffer, buf_size);
11860 +               len = hdlc_encode(&d_out->hdlc_state, 
11861 +                                 skb->data, skb->len, &bytes_sent,
11862 +                                 urb->transfer_buffer, buf_size);
11863                 skb_pull(skb,bytes_sent);
11864         } else {
11865                 // Send flags or idle
11866 -               len = isdnhdlc_encode(&d_out->hdlc_state,
11867 -                                     NULL, 0, &bytes_sent,
11868 -                                     urb->transfer_buffer, buf_size);
11869 +               len = hdlc_encode(&d_out->hdlc_state, 
11870 +                                 NULL, 0, &bytes_sent,
11871 +                                 urb->transfer_buffer, buf_size);
11872         }
11873         
11874         if (len < buf_size) {
11875 @@ -413,7 +413,7 @@
11876  
11877         DBG(2,"len=%d",skb->len);
11878  
11879 -       isdnhdlc_out_init(&d_out->hdlc_state, 1, 0);
11880 +       hdlc_out_init(&d_out->hdlc_state, 1, 0);
11881  
11882         if (test_and_set_bit(buf_nr, &d_out->busy)) {
11883                 WARN("ep %d urb %d busy %#lx", EP_D_OUT, buf_nr, d_out->busy);
11884 @@ -422,9 +422,9 @@
11885         urb = d_out->urb[buf_nr];
11886  
11887         DBG_SKB(0x10, skb);
11888 -       len = isdnhdlc_encode(&d_out->hdlc_state,
11889 -                             skb->data, skb->len, &bytes_sent,
11890 -                             urb->transfer_buffer, 16);
11891 +       len = hdlc_encode(&d_out->hdlc_state, 
11892 +                         skb->data, skb->len, &bytes_sent,
11893 +                         urb->transfer_buffer, 16);
11894         skb_pull(skb, bytes_sent);
11895  
11896         if(len < 16)
11897 @@ -673,7 +673,7 @@
11898                                       usb_d_out_complete, adapter);
11899  }
11900  
11901 -static void st5481_release_d_out(struct st5481_adapter *adapter)
11902 +static void __devexit st5481_release_d_out(struct st5481_adapter *adapter)
11903  {
11904         struct st5481_d_out *d_out = &adapter->d_out;
11905  
11906 @@ -723,7 +723,7 @@
11907         return retval;
11908  }
11909  
11910 -void st5481_release_d(struct st5481_adapter *adapter)
11911 +void __devexit st5481_release_d(struct st5481_adapter *adapter)
11912  {
11913         DBG(2,"");
11914  
11915 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_init.c linux-2.4.29/drivers/isdn/hisax/st5481_init.c
11916 --- linux-2.4.29.old/drivers/isdn/hisax/st5481_init.c   2005-03-22 14:47:56.000000000 +0100
11917 +++ linux-2.4.29/drivers/isdn/hisax/st5481_init.c       2005-03-22 15:06:48.268754816 +0100
11918 @@ -14,6 +14,7 @@
11919   * TODO:
11920   *
11921   * b layer1 delay?
11922 + * hdlc as module
11923   * hotplug / unregister issues
11924   * mod_inc/dec_use_count
11925   * unify parts of d/b channel usb handling
11926 @@ -177,7 +178,7 @@
11927  static struct usb_driver st5481_usb_driver = {
11928         name: "st5481_usb",
11929         probe: probe_st5481,
11930 -       disconnect: __devexit_p(disconnect_st5481),
11931 +       disconnect: disconnect_st5481,
11932         id_table: st5481_ids,
11933  };
11934  
11935 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/st5481_usb.c linux-2.4.29/drivers/isdn/hisax/st5481_usb.c
11936 --- linux-2.4.29.old/drivers/isdn/hisax/st5481_usb.c    2005-03-22 14:47:56.000000000 +0100
11937 +++ linux-2.4.29/drivers/isdn/hisax/st5481_usb.c        2005-03-22 15:06:48.284752384 +0100
11938 @@ -41,9 +41,9 @@
11939                 (unsigned char *)&ctrl->msg_fifo.data[r_index];
11940         
11941         DBG(1,"request=0x%02x,value=0x%04x,index=%x",
11942 -           ((struct ctrl_msg *)urb->setup_packet)->dr.bRequest,
11943 -           ((struct ctrl_msg *)urb->setup_packet)->dr.wValue,
11944 -           ((struct ctrl_msg *)urb->setup_packet)->dr.wIndex);
11945 +           ((struct ctrl_msg *)urb->setup_packet)->dr.request,
11946 +           ((struct ctrl_msg *)urb->setup_packet)->dr.value,
11947 +           ((struct ctrl_msg *)urb->setup_packet)->dr.index);
11948  
11949         // Prepare the URB
11950         urb->dev = adapter->usb_dev;
11951 @@ -69,11 +69,11 @@
11952         }
11953         ctrl_msg = &ctrl->msg_fifo.data[w_index]; 
11954     
11955 -       ctrl_msg->dr.bRequestType = requesttype;
11956 -       ctrl_msg->dr.bRequest = request;
11957 -       ctrl_msg->dr.wValue = cpu_to_le16p(&value);
11958 -       ctrl_msg->dr.wIndex = cpu_to_le16p(&index);
11959 -       ctrl_msg->dr.wLength = 0;
11960 +       ctrl_msg->dr.requesttype = requesttype;
11961 +       ctrl_msg->dr.request = request;
11962 +       ctrl_msg->dr.value = cpu_to_le16p(&value);
11963 +       ctrl_msg->dr.index = cpu_to_le16p(&index);
11964 +       ctrl_msg->dr.length = 0;
11965         ctrl_msg->complete = complete;
11966         ctrl_msg->context = context;
11967  
11968 @@ -140,17 +140,17 @@
11969  
11970         ctrl_msg = (struct ctrl_msg *)urb->setup_packet;
11971         
11972 -       if (ctrl_msg->dr.bRequest == USB_REQ_CLEAR_FEATURE) {
11973 +       if (ctrl_msg->dr.request == USB_REQ_CLEAR_FEATURE) {
11974                 /* Special case handling for pipe reset */
11975 -               le16_to_cpus(&ctrl_msg->dr.wIndex);
11976 +               le16_to_cpus(&ctrl_msg->dr.index);
11977                 usb_endpoint_running(adapter->usb_dev,
11978 -                                    ctrl_msg->dr.wIndex & ~USB_DIR_IN, 
11979 -                                    (ctrl_msg->dr.wIndex & USB_DIR_IN) == 0);
11980 +                                    ctrl_msg->dr.index & ~USB_DIR_IN, 
11981 +                                    (ctrl_msg->dr.index & USB_DIR_IN) == 0);
11982  
11983                 /* toggle is reset on clear */
11984                 usb_settoggle(adapter->usb_dev, 
11985 -                             ctrl_msg->dr.wIndex & ~USB_DIR_IN, 
11986 -                             (ctrl_msg->dr.wIndex & USB_DIR_IN) == 0,
11987 +                             ctrl_msg->dr.index & ~USB_DIR_IN, 
11988 +                             (ctrl_msg->dr.index & USB_DIR_IN) == 0,
11989                               0);
11990  
11991  
11992 @@ -235,7 +235,7 @@
11993         struct usb_interface_descriptor *altsetting;
11994         struct usb_endpoint_descriptor *endpoint;
11995         int status;
11996 -       struct urb *urb;
11997 +       urb_t *urb;
11998         u_char *buf;
11999         
12000         DBG(1,"");
12001 @@ -307,7 +307,7 @@
12002   * Release buffers and URBs for the interrupt and control
12003   * endpoint.
12004   */
12005 -void st5481_release_usb(struct st5481_adapter *adapter)
12006 +void __devexit st5481_release_usb(struct st5481_adapter *adapter)
12007  {
12008         struct st5481_intr *intr = &adapter->intr;
12009         struct st5481_ctrl *ctrl = &adapter->ctrl;
12010 @@ -443,7 +443,7 @@
12011         return retval;
12012  }
12013  
12014 -void st5481_release_isocpipes(struct urb* urb[2])
12015 +void __devexit st5481_release_isocpipes(struct urb* urb[2])
12016  {
12017         int j;
12018  
12019 @@ -484,18 +484,16 @@
12020         ptr = urb->transfer_buffer;
12021         while (len > 0) {
12022                 if (in->mode == L1_MODE_TRANS) {
12023 -                       /* swap rx bytes to get hearable audio */
12024 -                       register unsigned char *dest = in->rcvbuf;
12025 +                       memcpy(in->rcvbuf, ptr, len);
12026                         status = len;
12027 -                       for (; len; len--)
12028 -                               *dest++ = isdnhdlc_bit_rev_tab[*ptr++];
12029 +                       len = 0;
12030                 } else {
12031 -                       status = isdnhdlc_decode(&in->hdlc_state, ptr, len, &count,
12032 -                                                in->rcvbuf, in->bufsize);
12033 +                       status = hdlc_decode(&in->hdlc_state, ptr, len, &count,
12034 +                                            in->rcvbuf, in->bufsize);
12035                         ptr += count;
12036                         len -= count;
12037                 }
12038 -
12039 +               
12040                 if (status > 0) {
12041                         // Good frame received
12042                         DBG(4,"count=%d",status);
12043 @@ -549,7 +547,7 @@
12044         return retval;
12045  }
12046  
12047 -void st5481_release_in(struct st5481_in *in)
12048 +void __devexit st5481_release_in(struct st5481_in *in)
12049  {
12050         DBG(2,"");
12051  
12052 @@ -562,8 +560,7 @@
12053   */
12054  int st5481_isoc_flatten(struct urb *urb)
12055  {
12056 -       struct iso_packet_descriptor *pipd;
12057 -       struct iso_packet_descriptor *pend;
12058 +       piso_packet_descriptor_t pipd,pend;
12059         unsigned char *src,*dst;
12060         unsigned int len;
12061         
12062 @@ -624,10 +621,15 @@
12063  
12064         if (in->mode != L1_MODE_NULL) {
12065                 if (in->mode != L1_MODE_TRANS)
12066 -                       isdnhdlc_rcv_init(&in->hdlc_state,
12067 -                                         in->mode == L1_MODE_HDLC_56K);
12068 +                       hdlc_rcv_init(&in->hdlc_state,
12069 +                                     in->mode == L1_MODE_HDLC_56K);
12070                 
12071                 st5481_usb_pipe_reset(in->adapter, in->ep, NULL, NULL);
12072 +#if 0
12073 +               st5481_usb_device_ctrl_msg(in->adapter, in->counter,
12074 +                                          in->packet_size,
12075 +                                          st5481_start_rcv, in);
12076 +#endif
12077                 st5481_usb_device_ctrl_msg(in->adapter, in->counter,
12078                                            in->packet_size,
12079                                            NULL, NULL);
12080 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/tei.c linux-2.4.29/drivers/isdn/hisax/tei.c
12081 --- linux-2.4.29.old/drivers/isdn/hisax/tei.c   2005-03-22 14:47:56.000000000 +0100
12082 +++ linux-2.4.29/drivers/isdn/hisax/tei.c       2005-03-22 15:06:48.316747520 +0100
12083 @@ -1,4 +1,4 @@
12084 -/* $Id: tei.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12085 +/* $Id: tei.c,v 2.20 2001/09/24 13:22:57 kai Exp $
12086   *
12087   * Author       Karsten Keil
12088   *              based on the teles driver from Jan den Ouden
12089 @@ -21,7 +21,7 @@
12090  #include <linux/init.h>
12091  #include <linux/random.h>
12092  
12093 -const char *tei_revision = "$Revision: 1.1.4.1 $";
12094 +const char *tei_revision = "$Revision: 2.20 $";
12095  
12096  #define ID_REQUEST     1
12097  #define ID_ASSIGNED    2
12098 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/teleint.c linux-2.4.29/drivers/isdn/hisax/teleint.c
12099 --- linux-2.4.29.old/drivers/isdn/hisax/teleint.c       2005-03-22 14:47:56.000000000 +0100
12100 +++ linux-2.4.29/drivers/isdn/hisax/teleint.c   2005-03-22 15:06:48.330745392 +0100
12101 @@ -1,4 +1,4 @@
12102 -/* $Id: teleint.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12103 +/* $Id: teleint.c,v 1.16 2001/09/24 13:22:57 kai Exp $
12104   *
12105   * low level stuff for TeleInt isdn cards
12106   *
12107 @@ -19,7 +19,7 @@
12108  
12109  extern const char *CardType[];
12110  
12111 -const char *TeleInt_revision = "$Revision: 1.1.4.1 $";
12112 +const char *TeleInt_revision = "$Revision: 1.16 $";
12113  
12114  #define byteout(addr,val) outb(val,addr)
12115  #define bytein(addr) inb(addr)
12116 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/teles0.c linux-2.4.29/drivers/isdn/hisax/teles0.c
12117 --- linux-2.4.29.old/drivers/isdn/hisax/teles0.c        2005-03-22 14:47:56.000000000 +0100
12118 +++ linux-2.4.29/drivers/isdn/hisax/teles0.c    2005-03-22 15:06:48.348742656 +0100
12119 @@ -1,4 +1,4 @@
12120 -/* $Id: teles0.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12121 +/* $Id: teles0.c,v 2.15 2001/09/24 13:22:57 kai Exp $
12122   *
12123   * low level stuff for Teles Memory IO isdn cards
12124   *
12125 @@ -24,7 +24,7 @@
12126  
12127  extern const char *CardType[];
12128  
12129 -const char *teles0_revision = "$Revision: 1.1.4.1 $";
12130 +const char *teles0_revision = "$Revision: 2.15 $";
12131  
12132  #define TELES_IOMEM_SIZE       0x400
12133  #define byteout(addr,val) outb(val,addr)
12134 @@ -189,8 +189,10 @@
12135  {
12136         if (cs->hw.teles0.cfg_reg)
12137                 release_region(cs->hw.teles0.cfg_reg, 8);
12138 +#ifdef COMPAT_HAS_ISA_IOREMAP
12139         iounmap((unsigned char *)cs->hw.teles0.membase);
12140         release_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE);
12141 +#endif
12142  }
12143  
12144  static int
12145 @@ -327,6 +329,7 @@
12146         /* 16.0 and 8.0 designed for IOM1 */
12147         test_and_set_bit(HW_IOM1, &cs->HW_Flags);
12148         cs->hw.teles0.phymem = card->para[1];
12149 +#ifdef COMPAT_HAS_ISA_IOREMAP
12150         if (check_mem_region(cs->hw.teles0.phymem, TELES_IOMEM_SIZE)) {
12151                 printk(KERN_WARNING
12152                         "HiSax: %s memory region %lx-%lx already in use\n",
12153 @@ -342,6 +345,9 @@
12154         }
12155         cs->hw.teles0.membase =
12156                 (unsigned long) ioremap(cs->hw.teles0.phymem, TELES_IOMEM_SIZE);
12157 +#else
12158 +       cs->hw.teles0.membase = cs->hw.teles0.phymem;
12159 +#endif
12160         printk(KERN_INFO
12161                "HiSax: %s config irq:%d mem:0x%lX cfg:0x%X\n",
12162                CardType[cs->typ], cs->irq,
12163 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/teles3.c linux-2.4.29/drivers/isdn/hisax/teles3.c
12164 --- linux-2.4.29.old/drivers/isdn/hisax/teles3.c        2005-03-22 14:47:56.000000000 +0100
12165 +++ linux-2.4.29/drivers/isdn/hisax/teles3.c    2005-03-22 15:06:48.367739768 +0100
12166 @@ -1,4 +1,4 @@
12167 -/* $Id: teles3.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12168 +/* $Id: teles3.c,v 2.19 2001/09/24 13:22:57 kai Exp $
12169   *
12170   * low level stuff for Teles 16.3 & PNP isdn cards
12171   *
12172 @@ -15,14 +15,13 @@
12173   */
12174  #define __NO_VERSION__
12175  #include <linux/init.h>
12176 -#include <linux/isapnp.h>
12177  #include "hisax.h"
12178  #include "isac.h"
12179  #include "hscx.h"
12180  #include "isdnl1.h"
12181  
12182  extern const char *CardType[];
12183 -const char *teles3_revision = "$Revision: 1.1.4.1 $";
12184 +const char *teles3_revision = "$Revision: 2.19 $";
12185  
12186  #define byteout(addr,val) outb(val,addr)
12187  #define bytein(addr) inb(addr)
12188 @@ -255,24 +254,6 @@
12189         return(0);
12190  }
12191  
12192 -#ifdef __ISAPNP__
12193 -static struct isapnp_device_id teles_ids[] __initdata = {
12194 -       { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110),
12195 -         ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110), 
12196 -         (unsigned long) "Teles 16.3 PnP" },
12197 -       { ISAPNP_VENDOR('C', 'T', 'X'), ISAPNP_FUNCTION(0x0),
12198 -         ISAPNP_VENDOR('C', 'T', 'X'), ISAPNP_FUNCTION(0x0), 
12199 -         (unsigned long) "Creatix 16.3 PnP" },
12200 -       { ISAPNP_VENDOR('C', 'P', 'Q'), ISAPNP_FUNCTION(0x1002),
12201 -         ISAPNP_VENDOR('C', 'P', 'Q'), ISAPNP_FUNCTION(0x1002), 
12202 -         (unsigned long) "Compaq ISDN S0" },
12203 -       { 0, }
12204 -};
12205 -
12206 -static struct isapnp_device_id *tdev = &teles_ids[0];
12207 -static struct pci_bus *pnp_c __devinitdata = NULL;
12208 -#endif
12209 -
12210  int __devinit
12211  setup_teles3(struct IsdnCard *card)
12212  {
12213 @@ -286,47 +267,6 @@
12214             && (cs->typ != ISDN_CTYPE_TELESPCMCIA) && (cs->typ != ISDN_CTYPE_COMPAQ_ISA))
12215                 return (0);
12216  
12217 -#ifdef __ISAPNP__
12218 -       if (!card->para[1] && isapnp_present()) {
12219 -               struct pci_bus *pb;
12220 -               struct pci_dev *pd;
12221 -
12222 -               while(tdev->card_vendor) {
12223 -                       if ((pb = isapnp_find_card(tdev->card_vendor,
12224 -                               tdev->card_device, pnp_c))) {
12225 -                               pnp_c = pb;
12226 -                               pd = NULL;
12227 -                               if ((pd = isapnp_find_dev(pnp_c,
12228 -                                       tdev->vendor, tdev->function, pd))) {
12229 -                                       printk(KERN_INFO "HiSax: %s detected\n",
12230 -                                               (char *)tdev->driver_data);
12231 -                                       pd->prepare(pd);
12232 -                                       pd->deactivate(pd);
12233 -                                       pd->activate(pd);
12234 -                                       card->para[3] = pd->resource[2].start;
12235 -                                       card->para[2] = pd->resource[1].start;
12236 -                                       card->para[1] = pd->resource[0].start;
12237 -                                       card->para[0] = pd->irq_resource[0].start;
12238 -                                       if (!card->para[0] || !card->para[1] || !card->para[2]) {
12239 -                                               printk(KERN_ERR "Teles PnP:some resources are missing %ld/%lx/%lx\n",
12240 -                                               card->para[0], card->para[1], card->para[2]);
12241 -                                               pd->deactivate(pd);
12242 -                                               return(0);
12243 -                                       }
12244 -                                       break;
12245 -                               } else {
12246 -                                       printk(KERN_ERR "Teles PnP: PnP error card found, no device\n");
12247 -                               }
12248 -                       }
12249 -                       tdev++;
12250 -                       pnp_c=NULL;
12251 -               } 
12252 -               if (!tdev->card_vendor) {
12253 -                       printk(KERN_INFO "Teles PnP: no ISAPnP card found\n");
12254 -                       return(0);
12255 -               }
12256 -       }
12257 -#endif
12258         if (cs->typ == ISDN_CTYPE_16_3) {
12259                 cs->hw.teles3.cfg_reg = card->para[1];
12260                 switch (cs->hw.teles3.cfg_reg) {
12261 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/telespci.c linux-2.4.29/drivers/isdn/hisax/telespci.c
12262 --- linux-2.4.29.old/drivers/isdn/hisax/telespci.c      2005-03-22 14:47:56.000000000 +0100
12263 +++ linux-2.4.29/drivers/isdn/hisax/telespci.c  2005-03-22 15:06:48.382737488 +0100
12264 @@ -1,4 +1,4 @@
12265 -/* $Id: telespci.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12266 +/* $Id: telespci.c,v 2.23 2001/09/24 13:22:57 kai Exp $
12267   *
12268   * low level stuff for Teles PCI isdn cards
12269   *
12270 @@ -20,9 +20,10 @@
12271  #include "hscx.h"
12272  #include "isdnl1.h"
12273  #include <linux/pci.h>
12274 +#include <linux/isdn_compat.h>
12275  
12276  extern const char *CardType[];
12277 -const char *telespci_revision = "$Revision: 1.1.4.1 $";
12278 +const char *telespci_revision = "$Revision: 2.23 $";
12279  
12280  #define ZORAN_PO_RQ_PEN        0x02000000
12281  #define ZORAN_PO_WR    0x00800000
12282 @@ -307,10 +308,10 @@
12283                         printk(KERN_WARNING "Teles: No IRQ for PCI card found\n");
12284                         return(0);
12285                 }
12286 -               cs->hw.teles0.membase = (u_long) ioremap(pci_resource_start(dev_tel, 0),
12287 +               cs->hw.teles0.membase = (u_long) ioremap(pci_resource_start_mem(dev_tel, 0),
12288                         PAGE_SIZE);
12289                 printk(KERN_INFO "Found: Zoran, base-address: 0x%lx, irq: 0x%x\n",
12290 -                       pci_resource_start(dev_tel, 0), dev_tel->irq);
12291 +                       pci_resource_start_mem(dev_tel, 0), dev_tel->irq);
12292         } else {
12293                 printk(KERN_WARNING "TelesPCI: No PCI card found\n");
12294                 return(0);
12295 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/w6692.c linux-2.4.29/drivers/isdn/hisax/w6692.c
12296 --- linux-2.4.29.old/drivers/isdn/hisax/w6692.c 2005-03-22 14:47:56.000000000 +0100
12297 +++ linux-2.4.29/drivers/isdn/hisax/w6692.c     2005-03-22 15:06:48.398735056 +0100
12298 @@ -1,4 +1,4 @@
12299 -/* $Id: w6692.c,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12300 +/* $Id: w6692.c,v 1.18 2001/09/24 13:22:57 kai Exp $
12301   *
12302   * Winbond W6692 specific routines
12303   *
12304 @@ -18,6 +18,7 @@
12305  #include "isdnl1.h"
12306  #include <linux/interrupt.h>
12307  #include <linux/pci.h>
12308 +#include <linux/isdn_compat.h>
12309  
12310  /* table entry in the PCI devices list */
12311  typedef struct {
12312 @@ -29,20 +30,14 @@
12313  
12314  static const PCI_ENTRY id_list[] =
12315  {
12316 -       {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, "Winbond", "W6692"},
12317         {PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, "Dynalink/AsusCom", "IS64PH"},
12318 -       {0, 0, "U.S.Robotics", "ISDN PCI Card TA"}
12319 +       {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, "Winbond", "W6692"},
12320 +       {0, 0, NULL, NULL}
12321  };
12322  
12323 -#define W6692_SV_USR   0x16ec
12324 -#define W6692_SD_USR   0x3409
12325 -#define W6692_WINBOND  0
12326 -#define W6692_DYNALINK 1
12327 -#define W6692_USR      2
12328 -
12329  extern const char *CardType[];
12330  
12331 -const char *w6692_revision = "$Revision: 1.1.4.1 $";
12332 +const char *w6692_revision = "$Revision: 1.18 $";
12333  
12334  #define DBUSY_TIMER_VALUE 80
12335  
12336 @@ -675,6 +670,16 @@
12337  static void
12338  DC_Close_W6692(struct IsdnCardState *cs)
12339  {
12340 +#if 0
12341 +       if (cs->dc.w6692.mon_rx) {
12342 +               kfree(cs->dc.w6692.mon_rx);
12343 +               cs->dc.w6692.mon_rx = NULL;
12344 +       }
12345 +       if (cs->dc.w6692.mon_tx) {
12346 +               kfree(cs->dc.w6692.mon_tx);
12347 +               cs->dc.w6692.mon_tx = NULL;
12348 +       }
12349 +#endif
12350  }
12351  
12352  static void
12353 @@ -865,38 +870,31 @@
12354         return (0);
12355  }
12356  
12357 -void resetW6692(struct IsdnCardState *cs)
12358 -{
12359 -       cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST);
12360 -       schedule_timeout((10*HZ)/1000);
12361 -       cs->writeW6692(cs, W_D_CTL, 0x00);
12362 -       schedule_timeout((10*HZ)/1000);
12363 -       cs->writeW6692(cs, W_IMASK, 0xff);
12364 -       cs->writeW6692(cs, W_D_SAM, 0xff);
12365 -       cs->writeW6692(cs, W_D_TAM, 0xff);
12366 -       cs->writeW6692(cs, W_D_EXIM, 0x00);
12367 -       cs->writeW6692(cs, W_D_MODE, W_D_MODE_RACT);
12368 -       cs->writeW6692(cs, W_IMASK, 0x18);
12369 -       if (cs->subtyp == W6692_USR) {
12370 -               /* seems that USR implemented some power control features
12371 -                * Pin 79 is connected to the oscilator circuit so we
12372 -                * have to handle it here
12373 -                */
12374 -               cs->writeW6692(cs, W_PCTL, 0x80);
12375 -               cs->writeW6692(cs, W_XDATA, 0x00);
12376 -       }
12377 -}
12378 -
12379  void __init initW6692(struct IsdnCardState *cs, int part)
12380  {
12381         if (part & 1) {
12382                 cs->tqueue.routine = (void *) (void *) W6692_bh;
12383                 cs->setstack_d = setstack_W6692;
12384                 cs->DC_Close = DC_Close_W6692;
12385 +#if 0
12386 +               cs->dc.w6692.mon_tx = NULL;
12387 +               cs->dc.w6692.mon_rx = NULL;
12388 +#endif
12389                 cs->dbusytimer.function = (void *) dbusy_timer_handler;
12390                 cs->dbusytimer.data = (long) cs;
12391                 init_timer(&cs->dbusytimer);
12392 -               resetW6692(cs);
12393 +
12394 +               cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST);
12395 +               cs->writeW6692(cs, W_D_CTL, 0x00);
12396 +               cs->writeW6692(cs, W_IMASK, 0xff);
12397 +#if 0
12398 +               cs->dc.w6692.mocr = 0xaa;
12399 +#endif
12400 +               cs->writeW6692(cs, W_D_SAM, 0xff);
12401 +               cs->writeW6692(cs, W_D_TAM, 0xff);
12402 +               cs->writeW6692(cs, W_D_EXIM, 0x00);
12403 +               cs->writeW6692(cs, W_D_MODE, W_D_MODE_RACT);
12404 +               cs->writeW6692(cs, W_IMASK, 0x18);
12405                 ph_command(cs, W_L1CMD_RST);
12406                 cs->dc.w6692.ph_state = W_L1CMD_RST;
12407                 W6692_new_ph(cs);
12408 @@ -963,14 +961,9 @@
12409  {
12410         switch (mt) {
12411                 case CARD_RESET:
12412 -                       resetW6692(cs);
12413                         return (0);
12414                 case CARD_RELEASE:
12415 -                       cs->writeW6692(cs, W_IMASK, 0xff);
12416                         release_region(cs->hw.w6692.iobase, 256);
12417 -                       if (cs->subtyp == W6692_USR) {
12418 -                               cs->writeW6692(cs, W_XDATA, 0x04);
12419 -                       }
12420                         return (0);
12421                 case CARD_INIT:
12422                         initW6692(cs, 3);
12423 @@ -1013,7 +1006,6 @@
12424                 if (dev_w6692) {
12425                         if (pci_enable_device(dev_w6692))
12426                                 continue;
12427 -                       cs->subtyp = id_idx;
12428                         break;
12429                 }
12430                 id_idx++;
12431 @@ -1023,14 +1015,7 @@
12432                 pci_irq = dev_w6692->irq;
12433                 /* I think address 0 is allways the configuration area */
12434                 /* and address 1 is the real IO space KKe 03.09.99 */
12435 -               pci_ioaddr = pci_resource_start(dev_w6692, 1);
12436 -               /* USR ISDN PCI card TA need some special handling */
12437 -               if (cs->subtyp == W6692_WINBOND) {
12438 -                       if ((W6692_SV_USR == dev_w6692->subsystem_vendor) &&
12439 -                           (W6692_SD_USR == dev_w6692->subsystem_device)) {
12440 -                               cs->subtyp = W6692_USR;
12441 -                       }
12442 -               }
12443 +               pci_ioaddr = pci_resource_start_io(dev_w6692, 1);
12444         }
12445         if (!found) {
12446                 printk(KERN_WARNING "W6692: No PCI card found\n");
12447 @@ -1047,18 +1032,18 @@
12448         }
12449         cs->hw.w6692.iobase = pci_ioaddr;
12450         printk(KERN_INFO "Found: %s %s, I/O base: 0x%x, irq: %d\n",
12451 -              id_list[cs->subtyp].vendor_name, id_list[cs->subtyp].card_name,
12452 -              pci_ioaddr, pci_irq);
12453 +              id_list[id_idx].vendor_name, id_list[id_idx].card_name,
12454 +              pci_ioaddr, dev_w6692->irq);
12455         if (check_region((cs->hw.w6692.iobase), 256)) {
12456                 printk(KERN_WARNING
12457                        "HiSax: %s I/O ports %x-%x already in use\n",
12458 -                      id_list[cs->subtyp].card_name,
12459 +                      id_list[id_idx].card_name,
12460                        cs->hw.w6692.iobase,
12461                        cs->hw.w6692.iobase + 255);
12462                 return (0);
12463         } else {
12464                 request_region(cs->hw.w6692.iobase, 256,
12465 -                              id_list[cs->subtyp].card_name);
12466 +                              id_list[id_idx].card_name);
12467         }
12468  #else
12469         printk(KERN_WARNING "HiSax: W6692 and NO_PCI_BIOS\n");
12470 @@ -1068,7 +1053,7 @@
12471  
12472         printk(KERN_INFO
12473                "HiSax: %s config irq:%d I/O:%x\n",
12474 -              id_list[cs->subtyp].card_name, cs->irq,
12475 +              id_list[id_idx].card_name, cs->irq,
12476                cs->hw.w6692.iobase);
12477  
12478         cs->readW6692 = &ReadW6692;
12479 diff -rNu linux-2.4.29.old/drivers/isdn/hisax/w6692.h linux-2.4.29/drivers/isdn/hisax/w6692.h
12480 --- linux-2.4.29.old/drivers/isdn/hisax/w6692.h 2005-03-22 14:47:56.000000000 +0100
12481 +++ linux-2.4.29/drivers/isdn/hisax/w6692.h     2005-03-22 15:06:48.414732624 +0100
12482 @@ -1,4 +1,4 @@
12483 -/* $Id: w6692.h,v 1.1.4.1 2001/11/20 14:19:36 kai Exp $
12484 +/* $Id: w6692.h,v 1.4 2001/09/24 13:22:57 kai Exp $
12485   *
12486   * Winbond W6692 specific defines
12487   *
12488 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/boardergo.c linux-2.4.29/drivers/isdn/hysdn/boardergo.c
12489 --- linux-2.4.29.old/drivers/isdn/hysdn/boardergo.c     2005-03-22 14:47:56.000000000 +0100
12490 +++ linux-2.4.29/drivers/isdn/hysdn/boardergo.c 2005-03-22 15:06:48.468724416 +0100
12491 @@ -1,27 +1,41 @@
12492 -/* $Id: boardergo.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12493 - *
12494 +/* $Id: boardergo.c,v 1.9 2001/07/19 20:39:51 kai Exp $
12495 +
12496   * Linux driver for HYSDN cards, specific routines for ergo type boards.
12497   *
12498 - * Author    Werner Cornelius (werner@titro.de) for Hypercope GmbH
12499 - * Copyright 1999 by Werner Cornelius (werner@titro.de)
12500 - *
12501 - * This software may be used and distributed according to the terms
12502 - * of the GNU General Public License, incorporated herein by reference.
12503 - *
12504   * As all Linux supported cards Champ2, Ergo and Metro2/4 use the same
12505   * DPRAM interface and layout with only minor differences all related
12506   * stuff is done here, not in separate modules.
12507   *
12508 + * written by Werner Cornelius (werner@titro.de) for Hypercope GmbH
12509 + *
12510 + * Copyright 1999  by Werner Cornelius (werner@titro.de)
12511 + *
12512 + * This program is free software; you can redistribute it and/or modify
12513 + * it under the terms of the GNU General Public License as published by
12514 + * the Free Software Foundation; either version 2, or (at your option)
12515 + * any later version.
12516 + *
12517 + * This program is distributed in the hope that it will be useful,
12518 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12519 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12520 + * GNU General Public License for more details.
12521 + *
12522 + * You should have received a copy of the GNU General Public License
12523 + * along with this program; if not, write to the Free Software
12524 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
12525 + *
12526   */
12527  
12528 +#define __NO_VERSION__
12529  #include <linux/config.h>
12530 -#include <linux/sched.h>
12531 +#include <linux/module.h>
12532 +#include <linux/version.h>
12533 +#include <asm/io.h>
12534  #include <linux/signal.h>
12535  #include <linux/kernel.h>
12536  #include <linux/ioport.h>
12537  #include <linux/interrupt.h>
12538  #include <linux/vmalloc.h>
12539 -#include <asm/io.h>
12540  
12541  #include "hysdn_defs.h"
12542  #include "boardergo.h"
12543 @@ -45,11 +59,10 @@
12544         if (!card->irq_enabled)
12545                 return;         /* other device interrupting or irq switched off */
12546  
12547 -       save_flags(flags);
12548 -       cli();                  /* no further irqs allowed */
12549 +       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12550  
12551         if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) {
12552 -               restore_flags(flags);   /* restore old state */
12553 +               HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12554                 return;         /* no interrupt requested by E1 */
12555         }
12556         /* clear any pending ints on the board */
12557 @@ -63,7 +76,7 @@
12558                 queue_task(&card->irq_queue, &tq_immediate);
12559                 mark_bh(IMMEDIATE_BH);
12560         }
12561 -       restore_flags(flags);
12562 +       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12563  }                              /* ergo_interrupt */
12564  
12565  /******************************************************************************/
12566 @@ -83,17 +96,15 @@
12567                 return;         /* invalid call */
12568  
12569         dpr = card->dpram;      /* point to DPRAM */
12570 +       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12571  
12572 -       save_flags(flags);
12573 -       cli();
12574         if (card->hw_lock) {
12575 -               restore_flags(flags);   /* hardware currently unavailable */
12576 +               HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12577                 return;
12578         }
12579         card->hw_lock = 1;      /* we now lock the hardware */
12580  
12581         do {
12582 -               sti();          /* reenable other ints */
12583                 again = 0;      /* assume loop not to be repeated */
12584  
12585                 if (!dpr->ToHyFlag) {
12586 @@ -113,15 +124,13 @@
12587                                 again = 1;      /* restart loop */
12588                         }
12589                 }               /* a message has arrived for us */
12590 -               cli();          /* no further ints */
12591                 if (again) {
12592                         dpr->ToHyInt = 1;
12593                         dpr->ToPcInt = 1;       /* interrupt to E1 for all cards */
12594                 } else
12595                         card->hw_lock = 0;      /* free hardware again */
12596         } while (again);        /* until nothing more to do */
12597 -
12598 -       restore_flags(flags);
12599 +       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12600  }                              /* ergo_irq_bh */
12601  
12602  
12603 @@ -138,8 +147,7 @@
12604  #ifdef CONFIG_HYSDN_CAPI
12605         hycapi_capi_stop(card);
12606  #endif /* CONFIG_HYSDN_CAPI */
12607 -       save_flags(flags);
12608 -       cli();
12609 +       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12610         val = bytein(card->iobase + PCI9050_INTR_REG);  /* get actual value */
12611         val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1);        /* mask irq */
12612         byteout(card->iobase + PCI9050_INTR_REG, val);
12613 @@ -147,8 +155,7 @@
12614         byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RESET);      /* reset E1 processor */
12615         card->state = CARD_STATE_UNUSED;
12616         card->err_log_state = ERRLOG_STATE_OFF;         /* currently no log active */
12617 -
12618 -       restore_flags(flags);
12619 +       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12620  }                              /* ergo_stopcard */
12621  
12622  /**************************************************************************/
12623 @@ -163,20 +170,17 @@
12624                 card->err_log_state = ERRLOG_STATE_OFF;         /* must be off */
12625                 return;
12626         }
12627 -       save_flags(flags);
12628 -       cli();
12629 -
12630 +       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12631         if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) ||
12632             ((card->err_log_state == ERRLOG_STATE_ON) && on)) {
12633 -               restore_flags(flags);
12634 +               HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12635                 return;         /* nothing to do */
12636         }
12637         if (on)
12638                 card->err_log_state = ERRLOG_STATE_START;       /* request start */
12639         else
12640                 card->err_log_state = ERRLOG_STATE_STOP;        /* request stop */
12641 -
12642 -       restore_flags(flags);
12643 +       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12644         queue_task(&card->irq_queue, &tq_immediate);
12645         mark_bh(IMMEDIATE_BH);
12646  }                              /* ergo_set_errlog_state */
12647 @@ -245,9 +249,6 @@
12648                 while (!dpram->ToHyNoDpramErrLog);      /* reread volatile register to flush PCI */
12649  
12650                 byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN);        /* start E1 processor */
12651 -               /* the interrupts are still masked */
12652 -
12653 -               sti();
12654                 set_current_state(TASK_INTERRUPTIBLE);
12655                 schedule_timeout((20 * HZ) / 1000);     /* Timeout 20ms */
12656  
12657 @@ -282,7 +283,6 @@
12658         dst = sp->Data;         /* point to data in spool structure */
12659         buflen = sp->Len;       /* maximum len of spooled data */
12660         wr_mirror = sp->WrPtr;  /* only once read */
12661 -       sti();
12662  
12663         /* try until all bytes written or error */
12664         i = 0x1000;             /* timeout value */
12665 @@ -358,9 +358,7 @@
12666  
12667                         if (card->debug_flags & LOG_POF_RECORD)
12668                                 hysdn_addlog(card, "ERGO: pof boot success");
12669 -                       save_flags(flags);
12670 -                       cli();
12671 -
12672 +                       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
12673                         card->state = CARD_STATE_RUN;   /* now card is running */
12674                         /* enable the cards interrupt */
12675                         byteout(card->iobase + PCI9050_INTR_REG,
12676 @@ -371,8 +369,7 @@
12677                         dpr->ToPcFlag = 0;      /* reset data indicator */
12678                         dpr->ToHyInt = 1;
12679                         dpr->ToPcInt = 1;       /* interrupt to E1 for all cards */
12680 -
12681 -                       restore_flags(flags);
12682 +                       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
12683                         if ((hynet_enable & (1 << card->myid)) 
12684                             && (i = hysdn_net_create(card))) 
12685                         {
12686 @@ -387,7 +384,6 @@
12687  #endif /* CONFIG_HYSDN_CAPI */
12688                         return (0);     /* success */
12689                 }               /* data has arrived */
12690 -               sti();
12691                 set_current_state(TASK_INTERRUPTIBLE);
12692                 schedule_timeout((50 * HZ) / 1000);     /* Timeout 50ms */
12693         }                       /* wait until timeout */
12694 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/boardergo.h linux-2.4.29/drivers/isdn/hysdn/boardergo.h
12695 --- linux-2.4.29.old/drivers/isdn/hysdn/boardergo.h     2005-03-22 14:47:56.000000000 +0100
12696 +++ linux-2.4.29/drivers/isdn/hysdn/boardergo.h 2005-03-22 15:06:48.485721832 +0100
12697 @@ -1,4 +1,4 @@
12698 -/* $Id: boardergo.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12699 +/* $Id$
12700   *
12701   * Linux driver for HYSDN cards, definitions for ergo type boards (buffers..).
12702   *
12703 @@ -10,6 +10,7 @@
12704   *
12705   */
12706  
12707 +#include <linux/isdn_compat.h>
12708  
12709  /************************************************/
12710  /* defines for the dual port memory of the card */
12711 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hycapi.c linux-2.4.29/drivers/isdn/hysdn/hycapi.c
12712 --- linux-2.4.29.old/drivers/isdn/hysdn/hycapi.c        2005-03-22 14:47:57.000000000 +0100
12713 +++ linux-2.4.29/drivers/isdn/hysdn/hycapi.c    2005-03-22 15:06:48.500719552 +0100
12714 @@ -1,4 +1,4 @@
12715 -/* $Id: hycapi.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12716 +/* $Id$
12717   *
12718   * Linux driver for HYSDN cards, CAPI2.0-Interface.
12719   *
12720 @@ -29,7 +29,7 @@
12721  #include "hysdn_defs.h"
12722  #include <linux/kernelcapi.h>
12723  
12724 -static char hycapi_revision[]="$Revision: 1.1.4.1 $";
12725 +static char hycapi_revision[]="$Revision$";
12726  
12727  unsigned int hycapi_enable = 0xffffffff; 
12728  MODULE_PARM(hycapi_enable, "i");
12729 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_boot.c linux-2.4.29/drivers/isdn/hysdn/hysdn_boot.c
12730 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_boot.c    2005-03-22 14:47:56.000000000 +0100
12731 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_boot.c        2005-03-22 15:06:48.516717120 +0100
12732 @@ -1,4 +1,4 @@
12733 -/* $Id: hysdn_boot.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12734 +/* $Id$
12735   *
12736   * Linux driver for HYSDN cards
12737   * specific routines for booting and pof handling
12738 @@ -143,7 +143,7 @@
12739                                              (boot->pof_recid == TAG_CABSDATA) ? "CABSDATA" : "ABSDATA",
12740                                              datlen, boot->pof_recoffset);
12741  
12742 -                       if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen)) < 0)
12743 +                       if ((boot->last_error = card->writebootseq(card, boot->buf.BootBuf, datlen) < 0))
12744                                 return (boot->last_error);      /* error writing data */
12745  
12746                         if (boot->pof_recoffset + datlen >= boot->pof_reclen)
12747 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_defs.h linux-2.4.29/drivers/isdn/hysdn/hysdn_defs.h
12748 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_defs.h    2005-03-22 14:47:56.000000000 +0100
12749 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_defs.h        2005-03-22 15:06:48.533714536 +0100
12750 @@ -1,4 +1,4 @@
12751 -/* $Id: hysdn_defs.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12752 +/* $Id: hysdn_defs.h,v 1.10 2001/09/24 13:23:03 kai Exp $
12753   *
12754   * Linux driver for HYSDN cards
12755   * global definitions and exported vars and functions.
12756 @@ -19,6 +19,11 @@
12757  #include <linux/interrupt.h>
12758  #include <linux/tqueue.h>
12759  #include <linux/skbuff.h>
12760 +#include <linux/isdn_compat.h>
12761 +#include <linux/spinlock.h>
12762 +
12763 +#define HYSDN_SPIN_LOCK(a,b) spin_lock(a)
12764 +#define HYSDN_SPIN_UNLOCK(a,b) spin_unlock(a)
12765  
12766  /****************************/
12767  /* storage type definitions */
12768 @@ -176,6 +181,7 @@
12769         struct tq_struct irq_queue;     /* interrupt task queue */
12770         uchar volatile irq_enabled;     /* interrupt enabled if != 0 */
12771         uchar volatile hw_lock; /* hardware is currently locked -> no access */
12772 +       spinlock_t irq_lock;
12773  
12774         /* boot process */
12775         void *boot;             /* pointer to boot private data */
12776 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_init.c linux-2.4.29/drivers/isdn/hysdn/hysdn_init.c
12777 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_init.c    2005-03-22 14:47:57.000000000 +0100
12778 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_init.c        2005-03-22 15:06:48.551711800 +0100
12779 @@ -1,4 +1,4 @@
12780 -/* $Id: hysdn_init.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12781 +/* $Id$
12782   *
12783   * Linux driver for HYSDN cards, init functions.
12784   *
12785 @@ -21,6 +21,7 @@
12786  
12787  #include "hysdn_defs.h"
12788  
12789 +#ifndef COMPAT_HAS_2_2_PCI
12790  static struct pci_device_id hysdn_pci_tbl[] __initdata = {
12791         {PCI_VENDOR_ID_HYPERCOPE, PCI_DEVICE_ID_HYPERCOPE_PLX, PCI_ANY_ID, PCI_SUBDEVICE_ID_HYPERCOPE_METRO},
12792         {PCI_VENDOR_ID_HYPERCOPE, PCI_DEVICE_ID_HYPERCOPE_PLX, PCI_ANY_ID, PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2},
12793 @@ -29,11 +30,12 @@
12794         { }                             /* Terminating entry */
12795  };
12796  MODULE_DEVICE_TABLE(pci, hysdn_pci_tbl);
12797 +#endif
12798  MODULE_DESCRIPTION("ISDN4Linux: Driver for HYSDN cards");
12799  MODULE_AUTHOR("Werner Cornelius");
12800  MODULE_LICENSE("GPL");
12801  
12802 -static char *hysdn_init_revision = "$Revision: 1.1.4.1 $";
12803 +static char *hysdn_init_revision = "$Revision$";
12804  int cardmax;                   /* number of found cards */
12805  hysdn_card *card_root = NULL;  /* pointer to first card */
12806  
12807 @@ -91,11 +93,11 @@
12808                 card->myid = cardmax;   /* set own id */
12809                 card->bus = akt_pcidev->bus->number;
12810                 card->devfn = akt_pcidev->devfn;        /* slot + function */
12811 -               card->subsysid = akt_pcidev->subsystem_device;
12812 +               pci_get_sub_system(akt_pcidev,card->subsysid);
12813                 card->irq = akt_pcidev->irq;
12814 -               card->iobase = pci_resource_start(akt_pcidev, PCI_REG_PLX_IO_BASE);
12815 -               card->plxbase = pci_resource_start(akt_pcidev, PCI_REG_PLX_MEM_BASE);
12816 -               card->membase = pci_resource_start(akt_pcidev, PCI_REG_MEMORY_BASE);
12817 +               card->iobase = pci_resource_start_io(akt_pcidev, PCI_REG_PLX_IO_BASE);
12818 +               card->plxbase = pci_resource_start_mem(akt_pcidev, PCI_REG_PLX_MEM_BASE);
12819 +               card->membase = pci_resource_start_mem(akt_pcidev, PCI_REG_MEMORY_BASE);
12820                 card->brdtype = BD_NONE;        /* unknown */
12821                 card->debug_flags = DEF_DEB_FLAGS;      /* set default debug */
12822                 card->faxchans = 0;     /* default no fax channels */
12823 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_net.c linux-2.4.29/drivers/isdn/hysdn/hysdn_net.c
12824 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_net.c     2005-03-22 14:47:57.000000000 +0100
12825 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_net.c 2005-03-22 15:06:48.567709368 +0100
12826 @@ -1,4 +1,4 @@
12827 -/* $Id: hysdn_net.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
12828 +/* $Id$
12829   *
12830   * Linux driver for HYSDN cards, net (ethernet type) handling routines.
12831   *
12832 @@ -29,7 +29,7 @@
12833  MODULE_PARM(hynet_enable, "i");
12834  
12835  /* store the actual version for log reporting */
12836 -char *hysdn_net_revision = "$Revision: 1.1.4.1 $";
12837 +char *hysdn_net_revision = "$Revision$";
12838  
12839  #define MAX_SKB_BUFFERS 20     /* number of buffers for keeping TX-data */
12840  
12841 @@ -45,6 +45,10 @@
12842         /* additional vars may be added here */
12843         char dev_name[9];       /* our own device name */
12844  
12845 +#ifdef COMPAT_NO_SOFTNET
12846 +       struct sk_buff *tx_skb; /* buffer for tx operation */
12847 +
12848 +#else
12849         /* Tx control lock.  This protects the transmit buffer ring
12850          * state along with the "tx full" state of the driver.  This
12851          * means all netif_queue flow control actions are protected
12852 @@ -56,6 +60,7 @@
12853         int sk_count;           /* number of buffers currently in ring */
12854  
12855         int is_open;            /* flag controlling module locking */
12856 +#endif
12857  };                             /* net_local */
12858  
12859  
12860 @@ -83,11 +88,19 @@
12861         hysdn_card *card = dev->priv;
12862         int i;
12863  
12864 +#ifdef COMPAT_NO_SOFTNET
12865 +       dev->tbusy = 0;         /* non busy state */
12866 +       dev->interrupt = 0;
12867 +       if (!dev->start)
12868 +               MOD_INC_USE_COUNT;      /* increment only if device is down */
12869 +       dev->start = 1;         /* and started */
12870 +#else
12871         if (!((struct net_local *) dev)->is_open)
12872                 MOD_INC_USE_COUNT;      /* increment only if interface is actually down */
12873         ((struct net_local *) dev)->is_open = 1;        /* device actually open */
12874  
12875         netif_start_queue(dev); /* start tx-queueing */
12876 +#endif
12877  
12878         /* Fill in the MAC-level header (if not already set) */
12879         if (!card->mac_addr[0]) {
12880 @@ -104,6 +117,7 @@
12881         return (0);
12882  }                              /* net_open */
12883  
12884 +#ifndef COMPAT_NO_SOFTNET
12885  /*******************************************/
12886  /* flush the currently occupied tx-buffers */
12887  /* must only be called when device closed  */
12888 @@ -119,6 +133,7 @@
12889                 nl->sk_count--;
12890         }
12891  }                              /* flush_tx_buffers */
12892 +#endif
12893  
12894  
12895  /*********************************************************************/
12896 @@ -129,6 +144,15 @@
12897  net_close(struct net_device *dev)
12898  {
12899  
12900 +#ifdef COMPAT_NO_SOFTNET
12901 +       dev->tbusy = 1;         /* we are busy */
12902 +
12903 +       if (dev->start)
12904 +               MOD_DEC_USE_COUNT;      /* dec only if device has been active */
12905 +
12906 +       dev->start = 0;         /* and not started */
12907 +
12908 +#else
12909         netif_stop_queue(dev);  /* disable queueing */
12910  
12911         if (((struct net_local *) dev)->is_open)
12912 @@ -136,9 +160,52 @@
12913         ((struct net_local *) dev)->is_open = 0;
12914         flush_tx_buffers((struct net_local *) dev);
12915  
12916 +#endif
12917         return (0);             /* success */
12918  }                              /* net_close */
12919  
12920 +#ifdef COMPAT_NO_SOFTNET
12921 +/************************************/
12922 +/* send a packet on this interface. */
12923 +/* only for kernel versions < 2.3.33 */
12924 +/************************************/
12925 +static int
12926 +net_send_packet(struct sk_buff *skb, struct net_device *dev)
12927 +{
12928 +       struct net_local *lp = (struct net_local *) dev;
12929 +
12930 +       if (dev->tbusy) {
12931 +               /*
12932 +                * If we get here, some higher level has decided we are broken.
12933 +                * There should really be a "kick me" function call instead.
12934 +                * As ISDN may have higher timeouts than real ethernet 10s timeout
12935 +                */
12936 +               int tickssofar = jiffies - dev->trans_start;
12937 +               if (tickssofar < (10000 * HZ) / 1000)
12938 +                       return 1;
12939 +               printk(KERN_WARNING "%s: transmit timed out. \n", dev->name);
12940 +               dev->tbusy = 0;
12941 +               dev->trans_start = jiffies;
12942 +       }
12943 +       /*
12944 +        * Block a timer-based transmit from overlapping. This could better be
12945 +        * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
12946 +        */
12947 +       if (test_and_set_bit(0, (void *) &dev->tbusy) != 0)
12948 +               printk(KERN_WARNING "%s: Transmitter access conflict.\n", dev->name);
12949 +
12950 +       else {
12951 +               lp->stats.tx_bytes += skb->len;
12952 +               dev->trans_start = jiffies;
12953 +               lp->tx_skb = skb;       /* remember skb pointer */
12954 +               queue_task(&((hysdn_card *) dev->priv)->irq_queue, &tq_immediate);
12955 +               mark_bh(IMMEDIATE_BH);
12956 +       }
12957 +
12958 +       return (0);             /* success */
12959 +}                              /* net_send_packet */
12960 +
12961 +#else
12962  /************************************/
12963  /* send a packet on this interface. */
12964  /* new style for kernel >= 2.3.33   */
12965 @@ -176,6 +243,7 @@
12966         return (0);             /* success */
12967  }                              /* net_send_packet */
12968  
12969 +#endif
12970  
12971  
12972  /***********************************************************************/
12973 @@ -190,6 +258,15 @@
12974         if (!lp)
12975                 return;         /* non existing device */
12976  
12977 +#ifdef COMPAT_NO_SOFTNET
12978 +       if (lp->tx_skb)
12979 +               dev_kfree_skb(lp->tx_skb);      /* free tx pointer */
12980 +       lp->tx_skb = NULL;      /* reset pointer */
12981 +
12982 +       lp->stats.tx_packets++;
12983 +       lp->netdev.tbusy = 0;
12984 +       mark_bh(NET_BH);        /* Inform upper layers. */
12985 +#else
12986  
12987         if (!lp->sk_count)
12988                 return;         /* error condition */
12989 @@ -203,6 +280,7 @@
12990  
12991         if (lp->sk_count-- == MAX_SKB_BUFFERS)  /* dec usage count */
12992                 netif_start_queue((struct net_device *) lp);
12993 +#endif
12994  }                              /* hysdn_tx_netack */
12995  
12996  /*****************************************************/
12997 @@ -250,10 +328,15 @@
12998         if (!lp)
12999                 return (NULL);  /* non existing device */
13000  
13001 +#ifdef COMPAT_NO_SOFTNET
13002 +       return (lp->tx_skb);    /* return packet pointer */
13003 +
13004 +#else
13005         if (!lp->sk_count)
13006                 return (NULL);  /* nothing available */
13007  
13008         return (lp->skbs[lp->out_idx]);         /* next packet to send */
13009 +#endif
13010  }                              /* hysdn_tx_netget */
13011  
13012  
13013 @@ -296,15 +379,21 @@
13014         }
13015         memset(dev, 0, sizeof(struct net_local));       /* clean the structure */
13016  
13017 +#ifndef COMPAT_NO_SOFTNET
13018         spin_lock_init(&((struct net_local *) dev)->lock);
13019 +#endif
13020  
13021         /* initialise necessary or informing fields */
13022         dev->base_addr = card->iobase;  /* IO address */
13023         dev->irq = card->irq;   /* irq */
13024         dev->init = net_init;   /* the init function of the device */
13025 +#ifdef COMPAT_NO_SOFTNET
13026 +       dev->name = ((struct net_local *) dev)->dev_name;       /* device name */
13027 +#else
13028         if(dev->name) {
13029                 strcpy(dev->name, ((struct net_local *) dev)->dev_name);
13030         } 
13031 +#endif
13032         if ((i = register_netdev(dev))) {
13033                 printk(KERN_WARNING "HYSDN: unable to create network device\n");
13034                 kfree(dev);
13035 @@ -333,7 +422,9 @@
13036         card->netif = NULL;     /* clear out pointer */
13037         dev->stop(dev);         /* close the device */
13038  
13039 +#ifndef COMPAT_NO_SOFTNET
13040         flush_tx_buffers((struct net_local *) dev);     /* empty buffers */
13041 +#endif
13042  
13043         unregister_netdev(dev); /* release the device */
13044         kfree(dev);             /* release the memory allocated */
13045 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_pof.h linux-2.4.29/drivers/isdn/hysdn/hysdn_pof.h
13046 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_pof.h     2005-03-22 14:47:57.000000000 +0100
13047 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_pof.h 2005-03-22 15:06:48.583706936 +0100
13048 @@ -1,4 +1,4 @@
13049 -/* $Id: hysdn_pof.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13050 +/* $Id$
13051   *
13052   * Linux driver for HYSDN cards, definitions used for handling pof-files.
13053   *
13054 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_procconf.c linux-2.4.29/drivers/isdn/hysdn/hysdn_procconf.c
13055 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_procconf.c        2005-03-22 14:47:56.000000000 +0100
13056 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_procconf.c    2005-03-22 15:06:48.598704656 +0100
13057 @@ -1,4 +1,4 @@
13058 -/* $Id: hysdn_procconf.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13059 +/* $Id$
13060   *
13061   * Linux driver for HYSDN cards, /proc/net filesystem dir and conf functions.
13062   *
13063 @@ -17,11 +17,13 @@
13064  #include <linux/poll.h>
13065  #include <linux/proc_fs.h>
13066  #include <linux/pci.h>
13067 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13068  #include <linux/smp_lock.h>
13069 +#endif
13070  
13071  #include "hysdn_defs.h"
13072  
13073 -static char *hysdn_procconf_revision = "$Revision: 1.1.4.1 $";
13074 +static char *hysdn_procconf_revision = "$Revision$";
13075  
13076  #define INFO_OUT_LEN 80                /* length of info line including lf */
13077  
13078 @@ -212,32 +214,29 @@
13079  static ssize_t
13080  hysdn_conf_read(struct file *file, char *buf, size_t count, loff_t * off)
13081  {
13082 -       loff_t pos = *off;
13083         char *cp;
13084         int i;
13085  
13086         if (off != &file->f_pos)        /* fs error check */
13087                 return -ESPIPE;
13088  
13089 -       if (!(file->f_mode & FMODE_READ))
13090 -               return -EPERM;
13091 -
13092 -       if (!(cp = file->private_data))
13093 -               return (-EFAULT);       /* should never happen */
13094 -
13095 -       i = strlen(cp); /* get total string length */
13096 -
13097 -       if (pos != (unsigned)pos || pos >= i)
13098 -               return 0;
13099 -
13100 -       /* still bytes to transfer */
13101 -       cp += pos;      /* point to desired data offset */
13102 -       i -= pos;       /* remaining length */
13103 -       if (i > count)
13104 -               i = count;      /* limit length to transfer */
13105 -       if (copy_to_user(buf, cp, i))
13106 -               return (-EFAULT);       /* copy error */
13107 -       *off = pos + i; /* adjust offset */
13108 +       if (file->f_mode & FMODE_READ) {
13109 +               if (!(cp = file->private_data))
13110 +                       return (-EFAULT);       /* should never happen */
13111 +               i = strlen(cp); /* get total string length */
13112 +               if (*off < i) {
13113 +                       /* still bytes to transfer */
13114 +                       cp += *off;     /* point to desired data offset */
13115 +                       i -= *off;      /* remaining length */
13116 +                       if (i > count)
13117 +                               i = count;      /* limit length to transfer */
13118 +                       if (copy_to_user(buf, cp, i))
13119 +                               return (-EFAULT);       /* copy error */
13120 +                       *off += i;      /* adjust offset */
13121 +               } else
13122 +                       return (0);
13123 +       } else
13124 +               return (-EPERM);        /* no permission to read */
13125  
13126         return (i);
13127  }                              /* hysdn_conf_read */
13128 @@ -254,7 +253,11 @@
13129         char *cp, *tmp;
13130  
13131         /* now search the addressed card */
13132 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13133 +       MOD_INC_USE_COUNT;
13134 +#else
13135         lock_kernel();
13136 +#endif
13137         card = card_root;
13138         while (card) {
13139                 pd = card->procconf;
13140 @@ -263,7 +266,11 @@
13141                 card = card->next;      /* search next entry */
13142         }
13143         if (!card) {
13144 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13145 +               MOD_DEC_USE_COUNT;
13146 +#else
13147                 unlock_kernel();
13148 +#endif
13149                 return (-ENODEV);       /* device is unknown/invalid */
13150         }
13151         if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
13152 @@ -274,7 +281,11 @@
13153                 /* write only access -> write boot file or conf line */
13154  
13155                 if (!(cnf = kmalloc(sizeof(struct conf_writedata), GFP_KERNEL))) {
13156 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13157 +                       MOD_DEC_USE_COUNT;
13158 +#else
13159                         unlock_kernel();
13160 +#endif
13161                         return (-EFAULT);
13162                 }
13163                 cnf->card = card;
13164 @@ -286,7 +297,11 @@
13165                 /* read access -> output card info data */
13166  
13167                 if (!(tmp = (char *) kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) {
13168 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13169 +                       MOD_DEC_USE_COUNT;
13170 +#else
13171                         unlock_kernel();
13172 +#endif
13173                         return (-EFAULT);       /* out of memory */
13174                 }
13175                 filep->private_data = tmp;      /* start of string */
13176 @@ -320,10 +335,16 @@
13177                 *cp++ = '\n';
13178                 *cp = 0;        /* end of string */
13179         } else {                /* simultaneous read/write access forbidden ! */
13180 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13181 +               MOD_DEC_USE_COUNT;
13182 +#else
13183                 unlock_kernel();
13184 +#endif
13185                 return (-EPERM);        /* no permission this time */
13186         }
13187 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13188         unlock_kernel();
13189 +#endif
13190         return (0);
13191  }                              /* hysdn_conf_open */
13192  
13193 @@ -338,7 +359,9 @@
13194         int retval = 0;
13195         struct proc_dir_entry *pd;
13196  
13197 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13198         lock_kernel();
13199 +#endif
13200         /* search the addressed card */
13201         card = card_root;
13202         while (card) {
13203 @@ -348,7 +371,9 @@
13204                 card = card->next;      /* search next entry */
13205         }
13206         if (!card) {
13207 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13208                 unlock_kernel();
13209 +#endif
13210                 return (-ENODEV);       /* device is unknown/invalid */
13211         }
13212         if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
13213 @@ -371,7 +396,11 @@
13214                 if (filep->private_data)
13215                         kfree(filep->private_data);     /* release memory */
13216         }
13217 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13218 +       MOD_DEC_USE_COUNT;
13219 +#else
13220         unlock_kernel();
13221 +#endif
13222         return (retval);
13223  }                              /* hysdn_conf_close */
13224  
13225 @@ -387,6 +416,9 @@
13226         release:        hysdn_conf_close,                                       
13227  };
13228  
13229 +#ifdef COMPAT_NO_SOFTNET
13230 +static struct inode_operations conf_inode_operations;
13231 +#endif
13232  /*****************************/
13233  /* hysdn subdir in /proc/net */
13234  /*****************************/
13235 @@ -415,8 +447,17 @@
13236                 if ((card->procconf = (void *) create_proc_entry(conf_name,
13237                                              S_IFREG | S_IRUGO | S_IWUSR,
13238                                             hysdn_proc_entry)) != NULL) {
13239 +#ifdef COMPAT_NO_SOFTNET
13240 +                       memset(&conf_inode_operations, 0, sizeof(struct inode_operations));
13241 +                       conf_inode_operations.default_file_ops = &conf_fops;
13242 +
13243 +                       ((struct proc_dir_entry *) card->procconf)->ops = &conf_inode_operations;
13244 +#else
13245                         ((struct proc_dir_entry *) card->procconf)->proc_fops = &conf_fops;
13246 +#ifdef COMPAT_HAS_FILEOP_OWNER
13247                         ((struct proc_dir_entry *) card->procconf)->owner = THIS_MODULE;
13248 +#endif
13249 +#endif
13250                         hysdn_proclog_init(card);       /* init the log file entry */
13251                 }
13252                 card = card->next;      /* next entry */
13253 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_proclog.c linux-2.4.29/drivers/isdn/hysdn/hysdn_proclog.c
13254 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_proclog.c 2005-03-22 14:47:56.000000000 +0100
13255 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_proclog.c     2005-03-22 15:06:48.613702376 +0100
13256 @@ -1,4 +1,4 @@
13257 -/* $Id: hysdn_proclog.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13258 +/* $Id$
13259   *
13260   * Linux driver for HYSDN cards, /proc/net filesystem log functions.
13261   *
13262 @@ -16,7 +16,9 @@
13263  #include <linux/poll.h>
13264  #include <linux/proc_fs.h>
13265  #include <linux/pci.h>
13266 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13267  #include <linux/smp_lock.h>
13268 +#endif
13269  
13270  #include "hysdn_defs.h"
13271  
13272 @@ -115,8 +117,7 @@
13273         strcpy(ib->log_start, cp);      /* set output string */
13274         ib->next = NULL;
13275         ib->proc_ctrl = pd;     /* point to own control structure */
13276 -       save_flags(flags);
13277 -       cli();
13278 +       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13279         ib->usage_cnt = pd->if_used;
13280         if (!pd->log_head)
13281                 pd->log_head = ib;      /* new head */
13282 @@ -124,7 +125,7 @@
13283                 pd->log_tail->next = ib;        /* follows existing messages */
13284         pd->log_tail = ib;      /* new tail */
13285         i = pd->del_lock++;     /* get lock state */
13286 -       restore_flags(flags);
13287 +       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13288  
13289         /* delete old entrys */
13290         if (!i)
13291 @@ -210,7 +211,6 @@
13292         word ino;
13293         struct procdata *pd = NULL;
13294         hysdn_card *card;
13295 -       loff_t pos = *off;
13296  
13297         if (!*((struct log_data **) file->private_data)) {
13298                 if (file->f_flags & O_NONBLOCK)
13299 @@ -235,11 +235,11 @@
13300                 return (0);
13301  
13302         inf->usage_cnt--;       /* new usage count */
13303 -       file->private_data = &inf->next;        /* next structure */
13304 +       (struct log_data **) file->private_data = &inf->next;   /* next structure */
13305         if ((len = strlen(inf->log_start)) <= count) {
13306                 if (copy_to_user(buf, inf->log_start, len))
13307                         return -EFAULT;
13308 -               *off = pos + len;
13309 +               file->f_pos += len;
13310                 return (len);
13311         }
13312         return (0);
13313 @@ -255,7 +255,11 @@
13314         struct procdata *pd = NULL;
13315         ulong flags;
13316  
13317 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13318 +       MOD_INC_USE_COUNT;
13319 +#else
13320         lock_kernel();
13321 +#endif
13322         card = card_root;
13323         while (card) {
13324                 pd = card->proclog;
13325 @@ -264,7 +268,11 @@
13326                 card = card->next;      /* search next entry */
13327         }
13328         if (!card) {
13329 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13330 +               MOD_DEC_USE_COUNT;
13331 +#else
13332                 unlock_kernel();
13333 +#endif
13334                 return (-ENODEV);       /* device is unknown/invalid */
13335         }
13336         filep->private_data = card;     /* remember our own card */
13337 @@ -274,19 +282,24 @@
13338         } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
13339  
13340                 /* read access -> log/debug read */
13341 -               save_flags(flags);
13342 -               cli();
13343 +               HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13344                 pd->if_used++;
13345                 if (pd->log_head)
13346 -                       filep->private_data = &(pd->log_tail->next);
13347 +                       (struct log_data **) filep->private_data = &(pd->log_tail->next);
13348                 else
13349 -                       filep->private_data = &(pd->log_head);
13350 -               restore_flags(flags);
13351 +                       (struct log_data **) filep->private_data = &(pd->log_head);
13352 +               HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13353         } else {                /* simultaneous read/write access forbidden ! */
13354 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13355 +               MOD_DEC_USE_COUNT;
13356 +#else
13357                 unlock_kernel();
13358 +#endif
13359                 return (-EPERM);        /* no permission this time */
13360         }
13361 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13362         unlock_kernel();
13363 +#endif
13364         return (0);
13365  }                              /* hysdn_log_open */
13366  
13367 @@ -306,7 +319,9 @@
13368         int flags, retval = 0;
13369  
13370  
13371 +#ifndef COMPAT_USE_MODCOUNT_LOCK
13372         lock_kernel();
13373 +#endif
13374         if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
13375                 /* write only access -> write debug level written */
13376                 retval = 0;     /* success */
13377 @@ -314,8 +329,7 @@
13378                 /* read access -> log/debug read, mark one further file as closed */
13379  
13380                 pd = NULL;
13381 -               save_flags(flags);
13382 -               cli();
13383 +               HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13384                 inf = *((struct log_data **) filep->private_data);      /* get first log entry */
13385                 if (inf)
13386                         pd = (struct procdata *) inf->proc_ctrl;        /* still entries there */
13387 @@ -338,7 +352,7 @@
13388                         inf->usage_cnt--;       /* decrement usage count for buffers */
13389                         inf = inf->next;
13390                 }
13391 -               restore_flags(flags);
13392 +               HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13393  
13394                 if (pd)
13395                         if (pd->if_used <= 0)   /* delete buffers if last file closed */
13396 @@ -348,7 +362,11 @@
13397                                         kfree(inf);
13398                                 }
13399         }                       /* read access */
13400 +#ifdef COMPAT_USE_MODCOUNT_LOCK
13401 +       MOD_DEC_USE_COUNT;
13402 +#else
13403         unlock_kernel();
13404 +#endif
13405  
13406         return (retval);
13407  }                              /* hysdn_log_close */
13408 @@ -400,6 +418,9 @@
13409         release:        hysdn_log_close,                                        
13410  };
13411  
13412 +#ifdef COMPAT_NO_SOFTNET
13413 +struct inode_operations log_inode_operations;
13414 +#endif
13415  
13416  /***********************************************************************************/
13417  /* hysdn_proclog_init is called when the module is loaded after creating the cards */
13418 @@ -414,10 +435,20 @@
13419  
13420         if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
13421                 memset(pd, 0, sizeof(struct procdata));
13422 +#ifdef COMPAT_NO_SOFTNET
13423 +               memset(&log_inode_operations, 0, sizeof(struct inode_operations));
13424 +               log_inode_operations.default_file_ops = &log_fops;
13425 +#endif
13426                 sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
13427                 if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) {
13428 +#ifdef COMPAT_NO_SOFTNET
13429 +                       pd->log->ops = &log_inode_operations;   /* set new operations table */
13430 +#else
13431                         pd->log->proc_fops = &log_fops; 
13432 +#ifdef COMPAT_HAS_FILEOP_OWNER
13433                         pd->log->owner = THIS_MODULE;
13434 +#endif
13435 +#endif
13436                 }
13437  
13438                 init_waitqueue_head(&(pd->rd_queue));
13439 diff -rNu linux-2.4.29.old/drivers/isdn/hysdn/hysdn_sched.c linux-2.4.29/drivers/isdn/hysdn/hysdn_sched.c
13440 --- linux-2.4.29.old/drivers/isdn/hysdn/hysdn_sched.c   2005-03-22 14:47:57.000000000 +0100
13441 +++ linux-2.4.29/drivers/isdn/hysdn/hysdn_sched.c       2005-03-22 15:06:48.630699792 +0100
13442 @@ -1,4 +1,4 @@
13443 -/* $Id: hysdn_sched.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13444 +/* $Id: hysdn_sched.c,v 1.9 2001/09/24 13:23:03 kai Exp $
13445   *
13446   * Linux driver for HYSDN cards
13447   * scheduler routines for handling exchange card <-> pc.
13448 @@ -12,11 +12,9 @@
13449   */
13450  
13451  #include <linux/config.h>
13452 -#include <linux/sched.h>
13453  #include <linux/signal.h>
13454  #include <linux/kernel.h>
13455  #include <linux/ioport.h>
13456 -#include <linux/interrupt.h>
13457  #include <asm/io.h>
13458  
13459  #include "hysdn_defs.h"
13460 @@ -151,22 +149,19 @@
13461  
13462         if (card->debug_flags & LOG_SCHED_ASYN)
13463                 hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1);
13464 -
13465 -       save_flags(flags);
13466 -       cli();
13467 +       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13468         while (card->async_busy) {
13469 -               sti();
13470 -
13471 +               HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13472                 if (card->debug_flags & LOG_SCHED_ASYN)
13473                         hysdn_addlog(card, "async tx-cfg delayed");
13474  
13475                 set_current_state(TASK_INTERRUPTIBLE);
13476                 schedule_timeout((20 * HZ) / 1000);     /* Timeout 20ms */
13477                 if (!--cnt) {
13478 -                       restore_flags(flags);
13479 +                       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13480                         return (-ERR_ASYNC_TIME);       /* timed out */
13481                 }
13482 -               cli();
13483 +               HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13484         }                       /* wait for buffer to become free */
13485  
13486         strcpy(card->async_data, line);
13487 @@ -177,31 +172,26 @@
13488         /* now queue the task */
13489         queue_task(&card->irq_queue, &tq_immediate);
13490         mark_bh(IMMEDIATE_BH);
13491 -       sti();
13492 -
13493 +       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13494         if (card->debug_flags & LOG_SCHED_ASYN)
13495                 hysdn_addlog(card, "async tx-cfg data queued");
13496  
13497         cnt++;                  /* short delay */
13498 -       cli();
13499 -
13500 +       HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13501         while (card->async_busy) {
13502 -               sti();
13503 -
13504 +               HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13505                 if (card->debug_flags & LOG_SCHED_ASYN)
13506                         hysdn_addlog(card, "async tx-cfg waiting for tx-ready");
13507  
13508                 set_current_state(TASK_INTERRUPTIBLE);
13509                 schedule_timeout((20 * HZ) / 1000);     /* Timeout 20ms */
13510                 if (!--cnt) {
13511 -                       restore_flags(flags);
13512 +                       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13513                         return (-ERR_ASYNC_TIME);       /* timed out */
13514                 }
13515 -               cli();
13516 +               HYSDN_SPIN_LOCK(&card->irq_lock, flags);
13517         }                       /* wait for buffer to become free again */
13518 -
13519 -       restore_flags(flags);
13520 -
13521 +       HYSDN_SPIN_UNLOCK(&card->irq_lock, flags);
13522         if (card->debug_flags & LOG_SCHED_ASYN)
13523                 hysdn_addlog(card, "async tx-cfg data send");
13524  
13525 diff -rNu linux-2.4.29.old/drivers/isdn/icn/icn.c linux-2.4.29/drivers/isdn/icn/icn.c
13526 --- linux-2.4.29.old/drivers/isdn/icn/icn.c     2005-03-22 14:47:56.000000000 +0100
13527 +++ linux-2.4.29/drivers/isdn/icn/icn.c 2005-03-22 15:06:48.722685808 +0100
13528 @@ -1,4 +1,4 @@
13529 -/* $Id: icn.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13530 +/* $Id$
13531   *
13532   * ISDN low-level module for the ICN active ISDN-Card.
13533   *
13534 @@ -41,7 +41,7 @@
13535  #undef MAP_DEBUG
13536  
13537  static char
13538 -*revision = "$Revision: 1.1.4.1 $";
13539 +*revision = "$Revision$";
13540  
13541  static int icn_addcard(int, char *, char *);
13542  
13543 @@ -1634,6 +1634,7 @@
13544  }
13545  
13546  #ifndef MODULE
13547 +#ifdef COMPAT_HAS_NEW_SETUP
13548  static int __init
13549  icn_setup(char *line)
13550  {
13551 @@ -1643,6 +1644,14 @@
13552         static char sid2[20];
13553  
13554         str = get_options(line, 2, ints);
13555 +#else
13556 +void
13557 +icn_setup(char *str, int *ints)
13558 +{
13559 +       char *p;
13560 +       static char sid[20];
13561 +       static char sid2[20];
13562 +#endif
13563         if (ints[0])
13564                 portbase = ints[1];
13565         if (ints[0] > 1)
13566 @@ -1656,9 +1665,13 @@
13567                         icn_id2 = sid2;
13568                 }
13569         }
13570 +#ifdef COMPAT_HAS_NEW_SETUP
13571         return(1);
13572  }
13573  __setup("icn=", icn_setup);
13574 +#else
13575 +}
13576 +#endif
13577  #endif /* MODULE */
13578  
13579  static int __init icn_init(void)
13580 diff -rNu linux-2.4.29.old/drivers/isdn/icn/icn.h linux-2.4.29/drivers/isdn/icn/icn.h
13581 --- linux-2.4.29.old/drivers/isdn/icn/icn.h     2005-03-22 14:47:56.000000000 +0100
13582 +++ linux-2.4.29/drivers/isdn/icn/icn.h 2005-03-22 15:06:48.752681248 +0100
13583 @@ -1,4 +1,4 @@
13584 -/* $Id: icn.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
13585 +/* $Id$
13586   *
13587   * ISDN lowlevel-module for the ICN active ISDN-Card.
13588   *
13589 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_audio.c linux-2.4.29/drivers/isdn/isdn_audio.c
13590 --- linux-2.4.29.old/drivers/isdn/isdn_audio.c  2005-03-22 14:47:56.000000000 +0100
13591 +++ linux-2.4.29/drivers/isdn/isdn_audio.c      2005-03-22 15:06:44.306357192 +0100
13592 @@ -1,9 +1,9 @@
13593 -/* $Id: isdn_audio.c,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
13594 +/* $Id: isdn_audio.c,v 1.24 2002/08/13 09:57:26 keil Exp $
13595   *
13596   * Linux ISDN subsystem, audio conversion and compression (linklevel).
13597   *
13598   * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
13599 - * DTMF code (c) 1996 by Christian Mock (cm@kukuruz.ping.at)
13600 + * DTMF code (c) 1996 by Christian Mock (cm@tahina.priv.at)
13601   * Silence detection (c) 1998 by Armin Schindler (mac@gismo.telekom.de)
13602   *
13603   * This software may be used and distributed according to the terms
13604 @@ -15,7 +15,7 @@
13605  #include "isdn_audio.h"
13606  #include "isdn_common.h"
13607  
13608 -char *isdn_audio_revision = "$Revision: 1.1.4.1 $";
13609 +char *isdn_audio_revision = "$Revision: 1.24 $";
13610  
13611  /*
13612   * Misc. lookup-tables.
13613 @@ -169,19 +169,39 @@
13614         0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a
13615  };
13616  
13617 -#define NCOEFF            8     /* number of frequencies to be analyzed       */
13618 -#define DTMF_TRESH     4000     /* above this is dtmf                         */
13619 +#define NCOEFF           16     /* number of frequencies to be analyzed       */
13620 +#define DTMF_TRESH    25000     /* above this is dtmf                         */
13621  #define SILENCE_TRESH   200     /* below this is silence                      */
13622 +#define H2_TRESH      20000     /* 2nd harmonic                               */
13623  #define AMP_BITS          9     /* bits per sample, reduced to avoid overflow */
13624  #define LOGRP             0
13625  #define HIGRP             1
13626  
13627 +typedef struct {
13628 +       int grp;                /* low/high group     */
13629 +       int k;                  /* k                  */
13630 +       int k2;                 /* k fuer 2. harmonic */
13631 +} dtmf_t;
13632 +
13633  /* For DTMF recognition:
13634   * 2 * cos(2 * PI * k / N) precalculated for all k
13635   */
13636  static int cos2pik[NCOEFF] =
13637  {
13638 -       55813, 53604, 51193, 48591, 38114, 33057, 25889, 18332
13639 +       55812, 29528, 53603, 24032, 51193, 14443, 48590, 6517,
13640 +       38113, -21204, 33057, -32186, 25889, -45081, 18332, -55279
13641 +};
13642 +
13643 +static dtmf_t dtmf_tones[8] =
13644 +{
13645 +       {LOGRP, 0, 1},          /*  697 Hz */
13646 +       {LOGRP, 2, 3},          /*  770 Hz */
13647 +       {LOGRP, 4, 5},          /*  852 Hz */
13648 +       {LOGRP, 6, 7},          /*  941 Hz */
13649 +       {HIGRP, 8, 9},          /* 1209 Hz */
13650 +       {HIGRP, 10, 11},        /* 1336 Hz */
13651 +       {HIGRP, 12, 13},        /* 1477 Hz */
13652 +       {HIGRP, 14, 15}         /* 1633 Hz */
13653  };
13654  
13655  static char dtmf_matrix[4][4] =
13656 @@ -208,7 +228,7 @@
13657         :       "memory", "ax");
13658  #else
13659         while (n--)
13660 -               *buff = table[*(unsigned char *)buff], buff++;
13661 +               *buff++ = table[*(unsigned char *)buff];
13662  #endif
13663  }
13664  
13665 @@ -479,18 +499,6 @@
13666                         sk2 = sk1;
13667                         sk1 = sk;
13668                 }
13669 -               /* Avoid overflows */
13670 -               sk >>= 1;
13671 -               sk2 >>= 1;
13672 -               /* compute |X(k)|**2 */
13673 -               /* report overflows. This should not happen. */
13674 -               /* Comment this out if desired */
13675 -               if (sk < -32768 || sk > 32767)
13676 -                       printk(KERN_DEBUG
13677 -                              "isdn_audio: dtmf goertzel overflow, sk=%d\n", sk);
13678 -               if (sk2 < -32768 || sk2 > 32767)
13679 -                       printk(KERN_DEBUG
13680 -                              "isdn_audio: dtmf goertzel overflow, sk2=%d\n", sk2);
13681                 result[k] =
13682                     ((sk * sk) >> AMP_BITS) -
13683                     ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) +
13684 @@ -514,58 +522,28 @@
13685         int grp[2];
13686         char what;
13687         char *p;
13688 -       int thresh;
13689  
13690         while ((skb = skb_dequeue(&info->dtmf_queue))) {
13691                 result = (int *) skb->data;
13692                 s = info->dtmf_state;
13693 -               grp[LOGRP] = grp[HIGRP] = -1;
13694 +               grp[LOGRP] = grp[HIGRP] = -2;
13695                 silence = 0;
13696 -               thresh = 0;
13697 -               for (i = 0; i < NCOEFF; i++) {
13698 -                       if (result[i] > DTMF_TRESH) {
13699 -                               if (result[i] > thresh)
13700 -                                       thresh = result[i];
13701 -                       }
13702 -                       else if (result[i] < SILENCE_TRESH)
13703 +               for (i = 0; i < 8; i++) {
13704 +                       if ((result[dtmf_tones[i].k] > DTMF_TRESH) &&
13705 +                           (result[dtmf_tones[i].k2] < H2_TRESH))
13706 +                               grp[dtmf_tones[i].grp] = (grp[dtmf_tones[i].grp] == -2) ? i : -1;
13707 +                       else if ((result[dtmf_tones[i].k] < SILENCE_TRESH) &&
13708 +                             (result[dtmf_tones[i].k2] < SILENCE_TRESH))
13709                                 silence++;
13710                 }
13711 -               if (silence == NCOEFF)
13712 +               if (silence == 8)
13713                         what = ' ';
13714                 else {
13715 -                       if (thresh > 0) {
13716 -                               thresh = thresh >> 4;  /* touchtones must match within 12 dB */
13717 -                               for (i = 0; i < NCOEFF; i++) {
13718 -                                       if (result[i] < thresh)
13719 -                                               continue;  /* ignore */
13720 -                                       /* good level found. This is allowed only one time per group */
13721 -                                       if (i < NCOEFF / 2) {
13722 -                                               /* lowgroup*/
13723 -                                               if (grp[LOGRP] >= 0) {
13724 -                                                       // Bad. Another tone found. */
13725 -                                                       grp[LOGRP] = -1;
13726 -                                                       break;
13727 -                                               }
13728 -                                               else
13729 -                                                       grp[LOGRP] = i;
13730 -                                       }
13731 -                                       else { /* higroup */
13732 -                                               if (grp[HIGRP] >= 0) { // Bad. Another tone found. */
13733 -                                                       grp[HIGRP] = -1;
13734 -                                                       break;
13735 -                                               }
13736 -                                               else
13737 -                                                       grp[HIGRP] = i - NCOEFF/2;
13738 -                                       }
13739 -                               }
13740 -                               if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) {
13741 -                                       what = dtmf_matrix[grp[LOGRP]][grp[HIGRP]];
13742 -                                       if (s->last != ' ' && s->last != '.')
13743 -                                               s->last = what; /* min. 1 non-DTMF between DTMF */
13744 -                               } else
13745 -                                       what = '.';
13746 -                       }
13747 -                       else
13748 +                       if ((grp[LOGRP] >= 0) && (grp[HIGRP] >= 0)) {
13749 +                               what = dtmf_matrix[grp[LOGRP]][grp[HIGRP] - 4];
13750 +                               if (s->last != ' ' && s->last != '.')
13751 +                                       s->last = what; /* min. 1 non-DTMF between DTMF */
13752 +                       } else
13753                                 what = '.';
13754                 }
13755                 if ((what != s->last) && (what != ' ') && (what != '.')) {
13756 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_audio.h linux-2.4.29/drivers/isdn/isdn_audio.h
13757 --- linux-2.4.29.old/drivers/isdn/isdn_audio.h  2005-03-22 14:47:56.000000000 +0100
13758 +++ linux-2.4.29/drivers/isdn/isdn_audio.h      2005-03-22 15:06:44.321354912 +0100
13759 @@ -1,4 +1,4 @@
13760 -/* $Id: isdn_audio.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
13761 +/* $Id: isdn_audio.h,v 1.10 2001/09/24 13:22:42 kai Exp $
13762   *
13763   * Linux ISDN subsystem, audio conversion and compression (linklevel).
13764   *
13765 @@ -20,7 +20,6 @@
13766  
13767  typedef struct dtmf_state {
13768         char last;
13769 -       char llast;
13770         int idx;
13771         int buf[DTMF_NPOINTS];
13772  } dtmf_state;
13773 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_bsdcomp.c linux-2.4.29/drivers/isdn/isdn_bsdcomp.c
13774 --- linux-2.4.29.old/drivers/isdn/isdn_bsdcomp.c        2005-03-22 14:47:56.000000000 +0100
13775 +++ linux-2.4.29/drivers/isdn/isdn_bsdcomp.c    2005-03-22 15:06:44.339352176 +0100
13776 @@ -105,6 +105,14 @@
13777  
13778  #define DEBUG 1
13779  
13780 +#ifdef CONFIG_ISDN_WITH_ABC
13781 +#define BSD_C_MALLOC(x)     kmalloc((x),GFP_ATOMIC)
13782 +#define BSD_C_FREE(x)       kfree(x)
13783 +#else
13784 +#define BSD_C_MALLOC(x)     vmalloc(x)
13785 +#define BSD_C_FREE(x)       vfree(x)
13786 +#endif
13787 +
13788  /*
13789   * A dictionary for doing BSD compress.
13790   */
13791 @@ -285,7 +293,7 @@
13792                  * Release the dictionary
13793                  */
13794                 if (db->dict) {
13795 -                       vfree (db->dict);
13796 +                       BSD_C_FREE (db->dict);
13797                         db->dict = NULL;
13798                 }
13799  
13800 @@ -293,7 +301,7 @@
13801                  * Release the string buffer
13802                  */
13803                 if (db->lens) {
13804 -                       vfree (db->lens);
13805 +                       BSD_C_FREE (db->lens);
13806                         db->lens = NULL;
13807                 }
13808  
13809 @@ -350,14 +358,19 @@
13810          * Allocate space for the dictionary. This may be more than one page in
13811          * length.
13812          */
13813 -       db->dict = (struct bsd_dict *) vmalloc (hsize * sizeof (struct bsd_dict));
13814 +       db->dict = (struct bsd_dict *) BSD_C_MALLOC (hsize * sizeof (struct bsd_dict));
13815 +
13816 +       MOD_INC_USE_COUNT;
13817 +       /*
13818 +       ** MOD_INC_USE_COUNT must be before bsd_free
13819 +       ** bsd_free make MOD_DEC_USE_COUNT if db != NULL
13820 +       */
13821 +
13822         if (!db->dict) {
13823                 bsd_free (db);
13824                 return NULL;
13825         }
13826  
13827 -       MOD_INC_USE_COUNT;
13828 -
13829         /*
13830          * If this is the compression buffer then there is no length data.
13831          * For decompression, the length information is needed as well.
13832 @@ -365,7 +378,7 @@
13833         if (!decomp)
13834                 db->lens = NULL;
13835         else {
13836 -               db->lens = (unsigned short *) vmalloc ((maxmaxcode + 1) *
13837 +               db->lens = (unsigned short *) BSD_C_MALLOC ((maxmaxcode + 1) *
13838                         sizeof (db->lens[0]));
13839                 if (!db->lens) {
13840                         bsd_free (db); /* calls MOD_DEC_USE_COUNT; */
13841 @@ -478,7 +491,11 @@
13842         int hval,disp,ilen,mxcode;
13843         unsigned char *rptr = skb_in->data;
13844         int isize = skb_in->len;
13845 +#ifdef CONFIG_ISDN_WITH_ABC
13846 +       long secure = 0;
13847 +#endif
13848  
13849 +#ifndef CONFIG_ISDN_WITH_ABC
13850  #define OUTPUT(ent)                    \
13851    {                                    \
13852      bitno -= n_bits;                   \
13853 @@ -490,17 +507,45 @@
13854         bitno += 8;                     \
13855      } while (bitno <= 24);             \
13856    }
13857 +#else
13858 +#define OUTPUT(ent)                    \
13859 +  {                                    \
13860 +       secure = 0;                                     \
13861 +    bitno -= n_bits;                   \
13862 +    accm |= ((ent) << bitno);          \
13863 +    do {                               \
13864 +        if(skb_out && skb_tailroom(skb_out) > 0)       \
13865 +               *(skb_put(skb_out,1)) = (unsigned char) (accm>>24); \
13866 +       accm <<= 8;                     \
13867 +       bitno += 8;                     \
13868 +       } while (bitno <= 24 && ++secure < 10000);              \
13869 +       if(secure >= 10000) {                                                   \
13870 +               printk(KERN_DEBUG "BSD in OUTPUT secure counter reached\n");    \
13871 +               return 0;                                                                       \
13872 +       }                                                                                               \
13873 +  }
13874 +#endif
13875  
13876         /*
13877          * If the protocol is not in the range we're interested in,
13878          * just return without compressing the packet.  If it is,
13879          * the protocol becomes the first byte to compress.
13880          */
13881 +#ifdef CONFIG_ISDN_WITH_ABC
13882 +       ent = proto;
13883 +
13884 +       if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) ) {
13885 +
13886 +               printk(KERN_DEBUG "bsd_compress called with %x\n",proto);
13887 +               return 0;
13888 +       }
13889 +#else
13890         printk(KERN_DEBUG "bsd_compress called with %x\n",proto);
13891         
13892         ent = proto;
13893         if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) )
13894                 return 0;
13895 +#endif
13896  
13897         db      = (struct bsd_db *) state;
13898         hshift  = db->hshift;
13899 @@ -538,6 +583,9 @@
13900         
13901                 /* continue probing until a match or invalid entry */
13902                 disp = (hval == 0) ? 1 : hval;
13903 +#ifdef CONFIG_ISDN_WITH_ABC
13904 +               secure = 0;
13905 +#endif
13906  
13907                 do {
13908                         hval += disp;
13909 @@ -546,7 +594,15 @@
13910                         dictp = dict_ptr (db, hval);
13911                         if (dictp->codem1 >= max_ent)
13912                                 goto nomatch;
13913 +#ifndef CONFIG_ISDN_WITH_ABC
13914                 } while (dictp->fcode != fcode);
13915 +#else
13916 +               } while (dictp->fcode != fcode && ++secure < 100000);
13917 +               if(secure >= 100000) {
13918 +                       printk(KERN_DEBUG "BSD: compress while dictp->fcode != fcode secure-counter reached\n");
13919 +                       return 0;
13920 +               }
13921 +#endif
13922  
13923                 ent = dictp->codem1 + 1;        /* finally found (prefix,suffix) */
13924                 continue;
13925 @@ -669,6 +725,9 @@
13926         int ilen;
13927         int codelen;
13928         int extra;
13929 +#ifdef CONFIG_ISDN_WITH_ABC
13930 +       unsigned long secure = 0;
13931 +#endif
13932  
13933         db       = (struct bsd_db *) state;
13934         max_ent  = db->max_ent;
13935 @@ -677,7 +736,9 @@
13936         n_bits   = db->n_bits;
13937         tgtbitno = 32 - n_bits; /* bitno when we have a code */
13938  
13939 +#ifndef CONFIG_ISDN_WITH_ABC
13940         printk(KERN_DEBUG "bsd_decompress called\n");
13941 +#endif
13942  
13943         if(!skb_in || !skb_out) {
13944                 printk(KERN_ERR "bsd_decompress called with NULL parameter\n");
13945 @@ -795,7 +856,11 @@
13946  
13947                 p     = skb_put(skb_out,codelen);
13948                 p += codelen;
13949 +#ifdef CONFIG_ISDN_WITH_ABC
13950 +               for(secure = 0; finchar > LAST && secure < 50000;secure++) {
13951 +#else
13952                 while (finchar > LAST) {
13953 +#endif
13954                         struct bsd_dict *dictp2 = dict_ptr (db, finchar);
13955             
13956                         dictp = dict_ptr (db, dictp2->cptr);
13957 @@ -822,6 +887,12 @@
13958                         }
13959                 }
13960                 *--p = finchar;
13961 +#ifdef CONFIG_ISDN_WITH_ABC
13962 +               if(secure >= 50000) {
13963 +                       printk(KERN_DEBUG "BSD: decompress secure-counter reached\n");
13964 +                       return DECOMP_FATALERROR;
13965 +               }
13966 +#endif
13967         
13968  #ifdef DEBUG
13969                 if (--codelen != 0)
13970 @@ -851,12 +922,23 @@
13971                         /* look for a free hash table entry */
13972                         if (dictp->codem1 < max_ent) {
13973                                 disp = (hval == 0) ? 1 : hval;
13974 +#ifdef CONFIG_ISDN_WITH_ABC
13975 +                               secure = 0;
13976 +#endif
13977                                 do {
13978                                         hval += disp;
13979                                         if (hval >= db->hsize)
13980                                                 hval -= db->hsize;
13981                                         dictp = dict_ptr (db, hval);
13982 +#ifndef CONFIG_ISDN_WITH_ABC
13983                                 } while (dictp->codem1 < max_ent);
13984 +#else
13985 +                               } while (dictp->codem1 < max_ent && ++secure < 50000);
13986 +                               if(secure >= 50000) {
13987 +                                       printk(KERN_DEBUG "BSD: decomp while (dictp->codem1 < max_ent) secure-counter reached\n");
13988 +                                       return DECOMP_FATALERROR;
13989 +                               }
13990 +#endif
13991                         }
13992             
13993                         /*
13994 @@ -895,11 +977,21 @@
13995         db->comp_bytes   += skb_in->len - BSD_OVHD;
13996         db->uncomp_bytes += skb_out->len;
13997  
13998 +#ifdef CONFIG_ISDN_WITH_ABC
13999 +       /*
14000 +       ** bsd_check will call bsd_clear 
14001 +       ** and so on the internal tables will be cleared.
14002 +       **
14003 +       ** I think that's not what we will at this point ?????
14004 +       ** For me at works without bsd_check.
14005 +       */
14006 +#else
14007         if (bsd_check(db)) {
14008                 if (db->debug)
14009                         printk(KERN_DEBUG "bsd_decomp%d: peer should have cleared dictionary on %d\n",
14010                                 db->unit, db->seqno - 1);
14011         }
14012 +#endif
14013         return skb_out->len;
14014  }
14015  
14016 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_common.c linux-2.4.29/drivers/isdn/isdn_common.c
14017 --- linux-2.4.29.old/drivers/isdn/isdn_common.c 2005-03-22 14:47:56.000000000 +0100
14018 +++ linux-2.4.29/drivers/isdn/isdn_common.c     2005-03-22 15:06:44.359349136 +0100
14019 @@ -1,4 +1,4 @@
14020 -/* $Id: isdn_common.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
14021 +/* $Id: isdn_common.c,v 1.137 2002/02/09 21:19:11 keil Exp $
14022   *
14023   * Linux ISDN subsystem, common used functions (linklevel).
14024   *
14025 @@ -19,6 +19,7 @@
14026  #include <linux/vmalloc.h>
14027  #include <linux/isdn.h>
14028  #include <linux/smp_lock.h>
14029 +#include <linux/list.h>
14030  #include "isdn_common.h"
14031  #include "isdn_tty.h"
14032  #include "isdn_net.h"
14033 @@ -33,7 +34,9 @@
14034  #include <linux/isdn_divertif.h>
14035  #endif /* CONFIG_ISDN_DIVERSION */
14036  #include "isdn_v110.h"
14037 +#ifdef HAVE_DEVFS_FS
14038  #include <linux/devfs_fs_kernel.h>
14039 +#endif /* HAVE_DEVFS_FS */
14040  
14041  /* Debugflags */
14042  #undef ISDN_DEBUG_STATCALLB
14043 @@ -44,7 +47,7 @@
14044  
14045  isdn_dev *dev;
14046  
14047 -static char *isdn_revision = "$Revision: 1.1.4.1 $";
14048 +static char *isdn_revision = "$Revision: 1.137 $";
14049  
14050  extern char *isdn_net_revision;
14051  extern char *isdn_tty_revision;
14052 @@ -67,19 +70,19 @@
14053  
14054  static int isdn_writebuf_stub(int, int, const u_char *, int, int);
14055  static void set_global_features(void);
14056 +#ifdef HAVE_DEVFS_FS
14057  static void isdn_register_devfs(int);
14058  static void isdn_unregister_devfs(int);
14059 +#endif /* HAVE_DEVFS_FS */
14060  static int isdn_wildmat(char *s, char *p);
14061  
14062  void
14063  isdn_lock_drivers(void)
14064  {
14065         int i;
14066 -       isdn_ctrl cmd;
14067  
14068 -       for (i = 0; i < ISDN_MAX_DRIVERS; i++) {
14069 -               if (!dev->drv[i])
14070 -                       continue;
14071 +       for (i = 0; i < dev->drivers; i++) {
14072 +               isdn_ctrl cmd;
14073  
14074                 cmd.driver = i;
14075                 cmd.arg = 0;
14076 @@ -101,10 +104,7 @@
14077  {
14078         int i;
14079  
14080 -       for (i = 0; i < ISDN_MAX_DRIVERS; i++) {
14081 -               if (!dev->drv[i])
14082 -                       continue;
14083 -
14084 +       for (i = 0; i < dev->drivers; i++)
14085                 if (dev->drv[i]->locks > 0) {
14086                         isdn_ctrl cmd;
14087  
14088 @@ -114,7 +114,6 @@
14089                         isdn_command(&cmd);
14090                         dev->drv[i]->locks--;
14091                 }
14092 -       }
14093  }
14094  
14095  void
14096 @@ -473,6 +472,7 @@
14097                         dev->drv[di]->flags &= ~DRV_FLAG_RUNNING;
14098                         break;
14099                 case ISDN_STAT_ICALL:
14100 +               case ISDN_STAT_ICALLW:
14101                         if (i < 0)
14102                                 return -1;
14103  #ifdef ISDN_DEBUG_STATCALLB
14104 @@ -718,7 +718,9 @@
14105                                         dev->drvmap[i] = -1;
14106                                         dev->chanmap[i] = -1;
14107                                         dev->usage[i] &= ~ISDN_USAGE_DISABLED;
14108 +#ifdef HAVE_DEVFS_FS
14109                                         isdn_unregister_devfs(i);
14110 +#endif /* HAVE_DEVFS_FS */
14111                                 }
14112                         dev->drivers--;
14113                         dev->channels -= dev->drv[di]->channels;
14114 @@ -755,6 +757,10 @@
14115                          if (divert_if)
14116                            return(divert_if->stat_callback(c));
14117  #endif /* CONFIG_ISDN_DIVERSION */
14118 +               case ISDN_STAT_ALERT:
14119 +               case ISDN_STAT_PROCEED:
14120 +                       isdn_tty_stat_callback(i, c);
14121 +                       break;
14122                 default:
14123                         return -1;
14124         }
14125 @@ -900,72 +906,239 @@
14126         return (dev->chanmap[minor]);
14127  }
14128  
14129 -static char *
14130 -isdn_statstr(void)
14131 +// ----------------------------------------------------------------------
14132 +// /dev/isdninfo
14133 +// 
14134 +// This device has somewhat insane semantics, but we need to support
14135 +// them for the sake of compatibility.
14136 +//
14137 +// After opening, the first read will succeed and return the current state
14138 +// Then, unless O_NONBLOCK is set, it will block until a state change happens
14139 +// and then return the new state.
14140 +// Also, if the buffer size for the read is too small, we'll just return
14141 +// EOF
14142 +
14143 +struct isdnstatus_dev {
14144 +       struct list_head list;
14145 +       int update;
14146 +};
14147 +
14148 +static DECLARE_WAIT_QUEUE_HEAD(isdnstatus_waitq);
14149 +static LIST_HEAD(isdnstatus_devs);
14150 +static spinlock_t isdnstatus_devs_lock = SPIN_LOCK_UNLOCKED;
14151 +
14152 +void
14153 +isdn_info_update(void)
14154 +{
14155 +       struct list_head *p;
14156 +       struct isdnstatus_dev *idev;
14157 +
14158 +       spin_lock(&isdnstatus_devs_lock);
14159 +       list_for_each(p, &isdnstatus_devs) {
14160 +               idev = list_entry(p, struct isdnstatus_dev, list);
14161 +               idev->update = 1;
14162 +       }
14163 +       spin_unlock(&isdnstatus_devs_lock);
14164 +       wake_up_interruptible(&isdnstatus_waitq);
14165 +}
14166 +
14167 +static int
14168 +isdnstatus_open(struct inode *ino, struct file *filep)
14169 +{
14170 +       struct isdnstatus_dev *p;
14171 +
14172 +       p = kmalloc(sizeof(struct isdnstatus_dev), GFP_USER);
14173 +       if (!p)
14174 +               return -ENOMEM;
14175 +
14176 +       /* At opening time we allow a single update */
14177 +       p->update = 1;
14178 +       spin_lock(&isdnstatus_devs_lock);
14179 +       list_add(&p->list, &isdnstatus_devs);
14180 +       spin_unlock(&isdnstatus_devs_lock);
14181 +       filep->private_data = p;
14182 +
14183 +       return 0;
14184 +}
14185 +
14186 +static void
14187 +isdnstatus_close(struct inode *ino, struct file *filep)
14188 +{
14189 +       struct isdnstatus_dev *p = filep->private_data;
14190 +
14191 +       spin_lock(&isdnstatus_devs_lock);
14192 +       list_del(&p->list);
14193 +       spin_unlock(&isdnstatus_devs_lock);
14194 +       kfree(p);
14195 +}
14196 +
14197 +// FIXME we don't lock against the state changing whilst being
14198 +// printed
14199 +
14200 +void
14201 +isdn_statstr(char *buf)
14202  {
14203 -       static char istatbuf[2048];
14204         char *p;
14205         int i;
14206  
14207 -       sprintf(istatbuf, "idmap:\t");
14208 -       p = istatbuf + strlen(istatbuf);
14209 +       p = buf;
14210 +       p += sprintf(p, "idmap:\t");
14211         for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14212 -               sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]);
14213 -               p = istatbuf + strlen(istatbuf);
14214 +               p += sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]);
14215         }
14216 -       sprintf(p, "\nchmap:\t");
14217 -       p = istatbuf + strlen(istatbuf);
14218 +       p += sprintf(p, "\nchmap:\t");
14219         for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14220 -               sprintf(p, "%d ", dev->chanmap[i]);
14221 -               p = istatbuf + strlen(istatbuf);
14222 +               p += sprintf(p, "%d ", dev->chanmap[i]);
14223         }
14224 -       sprintf(p, "\ndrmap:\t");
14225 -       p = istatbuf + strlen(istatbuf);
14226 +       p += sprintf(p, "\ndrmap:\t");
14227         for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14228 -               sprintf(p, "%d ", dev->drvmap[i]);
14229 -               p = istatbuf + strlen(istatbuf);
14230 +               p += sprintf(p, "%d ", dev->drvmap[i]);
14231         }
14232 -       sprintf(p, "\nusage:\t");
14233 -       p = istatbuf + strlen(istatbuf);
14234 +       p += sprintf(p, "\nusage:\t");
14235         for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14236 -               sprintf(p, "%d ", dev->usage[i]);
14237 -               p = istatbuf + strlen(istatbuf);
14238 +               p += sprintf(p, "%d ", dev->usage[i]);
14239         }
14240 -       sprintf(p, "\nflags:\t");
14241 -       p = istatbuf + strlen(istatbuf);
14242 +       p += sprintf(p, "\nflags:\t");
14243         for (i = 0; i < ISDN_MAX_DRIVERS; i++) {
14244                 if (dev->drv[i]) {
14245 -                       sprintf(p, "%ld ", dev->drv[i]->online);
14246 -                       p = istatbuf + strlen(istatbuf);
14247 +                       p += sprintf(p, "%ld ", dev->drv[i]->online);
14248                 } else {
14249 -                       sprintf(p, "? ");
14250 -                       p = istatbuf + strlen(istatbuf);
14251 +                       p += sprintf(p, "? ");
14252                 }
14253         }
14254 -       sprintf(p, "\nphone:\t");
14255 -       p = istatbuf + strlen(istatbuf);
14256 +       p += sprintf(p, "\nphone:\t");
14257         for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14258 -               sprintf(p, "%s ", dev->num[i]);
14259 -               p = istatbuf + strlen(istatbuf);
14260 +               p += sprintf(p, "%s ", dev->num[i]);
14261         }
14262 -       sprintf(p, "\n");
14263 -       return istatbuf;
14264 +       p += sprintf(p, "\n");
14265  }
14266  
14267 -/* Module interface-code */
14268 +static ssize_t
14269 +isdnstatus_read(struct file *file, char *buf, size_t count, loff_t * off)
14270 +{
14271 +       static DECLARE_MUTEX(istatbuf_mutex);
14272 +       static char istatbuf[2048];
14273  
14274 -void
14275 -isdn_info_update(void)
14276 +        DECLARE_WAITQUEUE(wait, current);
14277 +       struct isdnstatus_dev *idev;
14278 +       int retval = 0;
14279 +       unsigned int len;
14280 +
14281 +       idev = file->private_data;
14282 +
14283 +       if (off != &file->f_pos)
14284 +               return -ESPIPE;
14285 +
14286 +        add_wait_queue(&isdnstatus_waitq, &wait);
14287 +        for (;;) {
14288 +                set_current_state(TASK_INTERRUPTIBLE);
14289 +                
14290 +               if (idev->update)
14291 +                        break;
14292 +
14293 +                retval = -EAGAIN;
14294 +                if (file->f_flags & O_NONBLOCK)
14295 +                        break;
14296 +
14297 +                retval = -ERESTARTSYS;
14298 +                if (signal_pending(current))
14299 +                        break;
14300 +
14301 +                schedule();
14302 +        }
14303 +        __set_current_state(TASK_RUNNING);
14304 +        remove_wait_queue(&isdnstatus_waitq, &wait);
14305 +
14306 +       if (!idev->update)
14307 +               goto out;
14308 +
14309 +       idev->update = 0;
14310 +       down(&istatbuf_mutex);
14311 +       isdn_statstr(istatbuf);
14312 +       len = strlen(istatbuf);
14313 +       if (len > count) {
14314 +               retval = 0;
14315 +               goto out_unlock;
14316 +       }
14317 +       if (copy_to_user(buf, istatbuf, len)) {
14318 +               retval = -EFAULT;
14319 +               goto out_unlock;
14320 +       }
14321 +       *off += len;
14322 +       retval = len;
14323 +
14324 + out_unlock:
14325 +       up(&istatbuf_mutex);
14326 + out:
14327 +       return retval;
14328 +}
14329 +
14330 +static ssize_t
14331 +isdnstatus_write(struct file *file, const char *buf, size_t count, loff_t * off)
14332  {
14333 -       infostruct *p = dev->infochain;
14334 +       return -EINVAL;
14335 +}
14336 +
14337 +static unsigned int
14338 +isdnstatus_poll(struct file *file, poll_table * wait)
14339 +{
14340 +       struct isdnstatus_dev *idev;
14341 +       unsigned int mask = 0;
14342 +
14343 +       idev = file->private_data;
14344  
14345 -       while (p) {
14346 -               *(p->private) = 1;
14347 -               p = (infostruct *) p->next;
14348 +       poll_wait(file, &isdnstatus_waitq, wait);
14349 +       if (idev->update) {
14350 +               mask |= POLLIN | POLLRDNORM;
14351         }
14352 -       wake_up_interruptible(&(dev->info_waitq));
14353 +       return mask;
14354  }
14355  
14356 +static int
14357 +isdnstatus_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
14358 +{
14359 +       int retval;
14360 +       isdn_net_ioctl_phone phone;
14361 +
14362 +       switch (cmd) {
14363 +       case IIOCGETDVR:
14364 +               return (TTY_DV +
14365 +                       (NET_DV << 8) +
14366 +                       (INF_DV << 16));
14367 +       case IIOCGETCPS:
14368 +               if (arg) {
14369 +                       ulong *p = (ulong *) arg;
14370 +                       int i;
14371 +                       if ((retval = verify_area(VERIFY_WRITE, (void *) arg,
14372 +                                              sizeof(ulong) * ISDN_MAX_CHANNELS * 2)))
14373 +                               return retval;
14374 +                       for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14375 +                               put_user(dev->ibytes[i], p++);
14376 +                               put_user(dev->obytes[i], p++);
14377 +                       }
14378 +                       return 0;
14379 +               } else
14380 +                       return -EINVAL;
14381 +               break;
14382 +#ifdef CONFIG_NETDEVICES
14383 +       case IIOCNETGPN:
14384 +               /* Get peer phone number of a connected 
14385 +                * isdn network interface */
14386 +               if (arg) {
14387 +                       if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone)))
14388 +                               return -EFAULT;
14389 +                       return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg);
14390 +               } else
14391 +                       return -EINVAL;
14392 +#endif
14393 +       default:
14394 +               return -EINVAL;
14395 +       }
14396 +}
14397 +
14398 +// ----------------------------------------------------------------------
14399 +
14400 +
14401  static ssize_t
14402  isdn_read(struct file *file, char *buf, size_t count, loff_t * off)
14403  {
14404 @@ -976,37 +1149,16 @@
14405         int chidx;
14406         int retval;
14407         char *p;
14408 -       loff_t pos = *off;
14409  
14410         if (off != &file->f_pos)
14411                 return -ESPIPE;
14412  
14413 -       if (pos != (unsigned) pos)
14414 -               return -EINVAL;
14415 -
14416 +#ifndef COMPAT_HAVE_READ_LOCK_KERNEL
14417         lock_kernel();
14418 -       if (minor == ISDN_MINOR_STATUS) {
14419 -               if (!file->private_data) {
14420 -                       if (file->f_flags & O_NONBLOCK) {
14421 -                               retval = -EAGAIN;
14422 -                               goto out;
14423 -                       }
14424 -                       interruptible_sleep_on(&(dev->info_waitq));
14425 -               }
14426 -               p = isdn_statstr();
14427 -               file->private_data = 0;
14428 -               if ((len = strlen(p)) <= count) {
14429 -                       if (copy_to_user(buf, p, len)) {
14430 -                               retval = -EFAULT;
14431 -                               goto out;
14432 -                       }
14433 -                       *off = pos + len;
14434 -                       retval = len;
14435 -                       goto out;
14436 -               }
14437 -               retval = 0;
14438 -               goto out;
14439 -       }
14440 +#endif
14441 +       if (minor == ISDN_MINOR_STATUS)
14442 +               return isdnstatus_read(file, buf, count, off);
14443 +         
14444         if (!dev->drivers) {
14445                 retval = -ENODEV;
14446                 goto out;
14447 @@ -1031,7 +1183,7 @@
14448                 cli();
14449                 len = isdn_readbchan(drvidx, chidx, p, 0, count,
14450                                      &dev->drv[drvidx]->rcv_waitq[chidx]);
14451 -               *off = pos + len;
14452 +               *off += len;
14453                 restore_flags(flags);
14454                 if (copy_to_user(buf,p,len)) 
14455                         len = -EFAULT;
14456 @@ -1052,6 +1204,9 @@
14457                         }
14458                         interruptible_sleep_on(&(dev->drv[drvidx]->st_waitq));
14459                 }
14460 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14461 +               if(drvidx || (len = isdn_dw_abc_lcr_readstat(buf,count)) < 1) {
14462 +#endif
14463                 if (dev->drv[drvidx]->interface->readstat) {
14464                         if (count > dev->drv[drvidx]->stavail)
14465                                 count = dev->drv[drvidx]->stavail;
14466 @@ -1061,6 +1216,9 @@
14467                 } else {
14468                         len = 0;
14469                 }
14470 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14471 +               }
14472 +#endif
14473                 save_flags(flags);
14474                 cli();
14475                 if (len)
14476 @@ -1068,7 +1226,7 @@
14477                 else
14478                         dev->drv[drvidx]->stavail = 0;
14479                 restore_flags(flags);
14480 -               *off = pos + len;
14481 +               *off += len;
14482                 retval = len;
14483                 goto out;
14484         }
14485 @@ -1080,7 +1238,9 @@
14486  #endif
14487         retval = -ENODEV;
14488   out:
14489 +#ifndef COMPAT_HAVE_READ_LOCK_KERNEL
14490         unlock_kernel();
14491 +#endif
14492         return retval;
14493  }
14494  
14495 @@ -1092,15 +1252,18 @@
14496         int chidx;
14497         int retval;
14498  
14499 +       if (minor == ISDN_MINOR_STATUS)
14500 +               return isdnstatus_write(file, buf, count, off);
14501 +
14502         if (off != &file->f_pos)
14503                 return -ESPIPE;
14504  
14505 -       if (minor == ISDN_MINOR_STATUS)
14506 -               return -EPERM;
14507         if (!dev->drivers)
14508                 return -ENODEV;
14509  
14510 +#ifndef COMPAT_HAVE_WRITE_LOCK_KERNEL
14511         lock_kernel();
14512 +#endif
14513         if (minor <= ISDN_MINOR_BMAX) {
14514                 printk(KERN_WARNING "isdn_write minor %d obsolete!\n", minor);
14515                 drvidx = isdn_minor2drv(minor);
14516 @@ -1145,7 +1308,9 @@
14517  #endif
14518         retval = -ENODEV;
14519   out:
14520 +#ifndef COMPAT_HAVE_WRITE_LOCK_KERNEL
14521         unlock_kernel();
14522 +#endif
14523         return retval;
14524  }
14525  
14526 @@ -1156,15 +1321,12 @@
14527         unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
14528         int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL);
14529  
14530 +#ifndef COMPAT_HAVE_POLL_LOCK_KERNEL
14531         lock_kernel();
14532 -       if (minor == ISDN_MINOR_STATUS) {
14533 -               poll_wait(file, &(dev->info_waitq), wait);
14534 -               /* mask = POLLOUT | POLLWRNORM; */
14535 -               if (file->private_data) {
14536 -                       mask |= POLLIN | POLLRDNORM;
14537 -               }
14538 -               goto out;
14539 -       }
14540 +#endif
14541 +       if (minor == ISDN_MINOR_STATUS)
14542 +               return isdnstatus_poll(file, wait);
14543 +
14544         if (minor >= ISDN_MINOR_CTRL && minor <= ISDN_MINOR_CTRLMAX) {
14545                 if (drvidx < 0) {
14546                         /* driver deregistered while file open */
14547 @@ -1186,7 +1348,9 @@
14548  #endif
14549         mask = POLLERR;
14550   out:
14551 +#ifndef COMPAT_HAVE_POLL_LOCK_KERNEL
14552         unlock_kernel();
14553 +#endif
14554         return mask;
14555  }
14556  
14557 @@ -1216,42 +1380,9 @@
14558  #define phone iocpar.phone
14559  #define cfg   iocpar.cfg
14560  
14561 -       if (minor == ISDN_MINOR_STATUS) {
14562 -               switch (cmd) {
14563 -                       case IIOCGETDVR:
14564 -                               return (TTY_DV +
14565 -                                       (NET_DV << 8) +
14566 -                                       (INF_DV << 16));
14567 -                       case IIOCGETCPS:
14568 -                               if (arg) {
14569 -                                       ulong *p = (ulong *) arg;
14570 -                                       int i;
14571 -                                       if ((ret = verify_area(VERIFY_WRITE, (void *) arg,
14572 -                                                              sizeof(ulong) * ISDN_MAX_CHANNELS * 2)))
14573 -                                               return ret;
14574 -                                       for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14575 -                                               put_user(dev->ibytes[i], p++);
14576 -                                               put_user(dev->obytes[i], p++);
14577 -                                       }
14578 -                                       return 0;
14579 -                               } else
14580 -                                       return -EINVAL;
14581 -                               break;
14582 -#ifdef CONFIG_NETDEVICES
14583 -                       case IIOCNETGPN:
14584 -                               /* Get peer phone number of a connected 
14585 -                                * isdn network interface */
14586 -                               if (arg) {
14587 -                                       if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone)))
14588 -                                               return -EFAULT;
14589 -                                       return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg);
14590 -                               } else
14591 -                                       return -EINVAL;
14592 -#endif
14593 -                       default:
14594 -                               return -EINVAL;
14595 -               }
14596 -       }
14597 +       if (minor == ISDN_MINOR_STATUS)
14598 +               return isdnstatus_ioctl(inode, file, cmd, arg);
14599 +
14600         if (!dev->drivers)
14601                 return -ENODEV;
14602         if (minor <= ISDN_MINOR_BMAX) {
14603 @@ -1273,11 +1404,34 @@
14604   */
14605                 switch (cmd) {
14606                         case IIOCNETDWRSET:
14607 +#ifdef CONFIG_ISDN_WITH_ABC
14608 +                               if (arg) {
14609 +
14610 +                                       if (copy_from_user(name, (char *) arg, sizeof(name))) {
14611 +
14612 +                                               return(-EFAULT);
14613 +
14614 +                                       } else {
14615 +
14616 +                                               isdn_net_dev *p = isdn_net_findif(name);
14617 +
14618 +                                               if(p == NULL)
14619 +                                                       return(-EINVAL);
14620 +
14621 +                                               return(isdn_dw_abc_reset_interface(p->local,1));
14622 +                                       }
14623 +                               } 
14624 +#else
14625                                 printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n");
14626 +#endif
14627                                 return(-EINVAL);
14628                         case IIOCNETLCR:
14629 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14630 +                               return(isdn_dw_abc_lcr_ioctl(arg));
14631 +#else
14632                                 printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
14633                                 return -ENODEV;
14634 +#endif
14635  #ifdef CONFIG_NETDEVICES
14636                         case IIOCNETAIF:
14637                                 /* Add a network-interface */
14638 @@ -1650,22 +1804,12 @@
14639         int chidx;
14640         int retval = -ENODEV;
14641  
14642 +#ifdef COMPAT_USE_MODCOUNT_LOCK
14643 +       MOD_INC_USE_COUNT;
14644 +#endif
14645  
14646         if (minor == ISDN_MINOR_STATUS) {
14647 -               infostruct *p;
14648 -
14649 -               if ((p = kmalloc(sizeof(infostruct), GFP_KERNEL))) {
14650 -                       p->next = (char *) dev->infochain;
14651 -                       p->private = (char *) &(filep->private_data);
14652 -                       dev->infochain = p;
14653 -                       /* At opening we allow a single update */
14654 -                       filep->private_data = (char *) 1;
14655 -                       retval = 0;
14656 -                       goto out;
14657 -               } else {
14658 -                       retval = -ENOMEM;
14659 -                       goto out;
14660 -               }
14661 +               return isdnstatus_open(ino, filep);
14662         }
14663         if (!dev->channels)
14664                 goto out;
14665 @@ -1688,6 +1832,9 @@
14666                 if (drvidx < 0)
14667                         goto out;
14668                 isdn_lock_drivers();
14669 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14670 +               if(!drvidx) isdn_dw_abc_lcr_open();
14671 +#endif
14672                 retval = 0;
14673                 goto out;
14674         }
14675 @@ -1700,6 +1847,10 @@
14676         }
14677  #endif
14678   out:
14679 +#ifdef COMPAT_USE_MODCOUNT_LOCK
14680 +       if (retval)
14681 +               MOD_DEC_USE_COUNT;
14682 +#endif
14683         return retval;
14684  }
14685  
14686 @@ -1708,25 +1859,11 @@
14687  {
14688         uint minor = MINOR(ino->i_rdev);
14689  
14690 +#ifndef COMPAT_USE_MODCOUNT_LOCK
14691         lock_kernel();
14692 +#endif
14693         if (minor == ISDN_MINOR_STATUS) {
14694 -               infostruct *p = dev->infochain;
14695 -               infostruct *q = NULL;
14696 -
14697 -               while (p) {
14698 -                       if (p->private == (char *) &(filep->private_data)) {
14699 -                               if (q)
14700 -                                       q->next = p->next;
14701 -                               else
14702 -                                       dev->infochain = (infostruct *) (p->next);
14703 -                               kfree(p);
14704 -                               goto out;
14705 -                       }
14706 -                       q = p;
14707 -                       p = (infostruct *) (p->next);
14708 -               }
14709 -               printk(KERN_WARNING "isdn: No private data while closing isdnctrl\n");
14710 -               goto out;
14711 +               isdnstatus_close(ino, filep);
14712         }
14713         isdn_unlock_drivers();
14714         if (minor <= ISDN_MINOR_BMAX)
14715 @@ -1734,6 +1871,12 @@
14716         if (minor <= ISDN_MINOR_CTRLMAX) {
14717                 if (dev->profd == current)
14718                         dev->profd = NULL;
14719 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
14720 +               {
14721 +                       int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL);
14722 +                       if(!drvidx) isdn_dw_abc_lcr_close();
14723 +               }
14724 +#endif
14725                 goto out;
14726         }
14727  #ifdef CONFIG_ISDN_PPP
14728 @@ -1742,13 +1885,19 @@
14729  #endif
14730  
14731   out:
14732 +#ifdef COMPAT_USE_MODCOUNT_LOCK
14733 +       MOD_DEC_USE_COUNT;
14734 +#else
14735         unlock_kernel();
14736 +#endif
14737         return 0;
14738  }
14739  
14740  static struct file_operations isdn_fops =
14741  {
14742 +#ifdef COMPAT_HAS_FILEOP_OWNER
14743         owner:          THIS_MODULE,
14744 +#endif
14745         llseek:         no_llseek,
14746         read:           isdn_read,
14747         write:          isdn_write,
14748 @@ -1801,6 +1950,15 @@
14749                 if (USG_NONE(dev->usage[i]) &&
14750                     (dev->drvmap[i] != -1)) {
14751                         int d = dev->drvmap[i];
14752 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
14753 +                       if(jiffies < dev->dwabc_chan_external_inuse[i]) {
14754 +
14755 +                               if((dev->dwabc_chan_external_inuse[i] - jiffies) > (HZ * 120))
14756 +                                       dev->dwabc_chan_external_inuse[i] = 0;
14757 +                               else 
14758 +                                       continue;
14759 +                       }
14760 +#endif
14761                         if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) &&
14762                         ((pre_dev != d) || (pre_chan != dev->chanmap[i])))
14763                                 continue;
14764 @@ -1819,7 +1977,11 @@
14765                                                 restore_flags(flags);
14766                                                 return i;
14767                                         } else {
14768 +#ifdef CONFIG_ISDN_WITH_ABC
14769 +                                               if ((pre_dev == d) && ((pre_chan == dev->chanmap[i]) || pre_chan > 1000)) {
14770 +#else
14771                                                 if ((pre_dev == d) && (pre_chan == dev->chanmap[i])) {
14772 +#endif
14773                                                         dev->usage[i] &= ISDN_USAGE_EXCLUSIVE;
14774                                                         dev->usage[i] |= usage;
14775                                                         isdn_info_update();
14776 @@ -2006,7 +2168,7 @@
14777  
14778         if ((adding) && (d->rcverr))
14779                 kfree(d->rcverr);
14780 -       if (!(d->rcverr = kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14781 +       if (!(d->rcverr = (int *) kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14782                 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n");
14783                 return -1;
14784         }
14785 @@ -2014,7 +2176,7 @@
14786  
14787         if ((adding) && (d->rcvcount))
14788                 kfree(d->rcvcount);
14789 -       if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14790 +       if (!(d->rcvcount = (int *) kmalloc(sizeof(int) * m, GFP_KERNEL))) {
14791                 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
14792                 if (!adding) kfree(d->rcverr);
14793                 return -1;
14794 @@ -2026,7 +2188,8 @@
14795                         skb_queue_purge(&d->rpqueue[j]);
14796                 kfree(d->rpqueue);
14797         }
14798 -       if (!(d->rpqueue = kmalloc(sizeof(struct sk_buff_head) * m, GFP_KERNEL))) {
14799 +       if (!(d->rpqueue =
14800 +             (struct sk_buff_head *) kmalloc(sizeof(struct sk_buff_head) * m, GFP_KERNEL))) {
14801                 printk(KERN_WARNING "register_isdn: Could not alloc rpqueue\n");
14802                 if (!adding) {
14803                         kfree(d->rcvcount);
14804 @@ -2040,7 +2203,8 @@
14805  
14806         if ((adding) && (d->rcv_waitq))
14807                 kfree(d->rcv_waitq);
14808 -       d->rcv_waitq = kmalloc(sizeof(wait_queue_head_t) * 2 * m, GFP_KERNEL);
14809 +       d->rcv_waitq = (wait_queue_head_t *)
14810 +               kmalloc(sizeof(wait_queue_head_t) * 2 * m, GFP_KERNEL);
14811         if (!d->rcv_waitq) {
14812                 printk(KERN_WARNING "register_isdn: Could not alloc rcv_waitq\n");
14813                 if (!adding) {
14814 @@ -2064,7 +2228,9 @@
14815                         if (dev->chanmap[k] < 0) {
14816                                 dev->chanmap[k] = j;
14817                                 dev->drvmap[k] = drvidx;
14818 +#ifdef HAVE_DEVFS_FS
14819                                 isdn_register_devfs(k);
14820 +#endif /* HAVE_DEVFS_FS */
14821                                 break;
14822                         }
14823         restore_flags(flags);
14824 @@ -2128,6 +2294,7 @@
14825          i_div->ll_cmd = isdn_command; /* set command function */
14826          i_div->drv_to_name = map_drvname; 
14827          i_div->name_to_drv = map_namedrv; 
14828 +        i_div->dial_net_name = isdn_net_force_dial; 
14829          MOD_INC_USE_COUNT;
14830          divert_if = i_div; /* remember interface */
14831          return(DIVERT_NO_ERR);
14832 @@ -2165,7 +2332,7 @@
14833                 printk(KERN_WARNING "register_isdn: No write routine given.\n");
14834                 return 0;
14835         }
14836 -       if (!(d = kmalloc(sizeof(driver), GFP_KERNEL))) {
14837 +       if (!(d = (driver *) kmalloc(sizeof(driver), GFP_KERNEL))) {
14838                 printk(KERN_WARNING "register_isdn: Could not alloc driver-struct\n");
14839                 return 0;
14840         }
14841 @@ -2225,6 +2392,7 @@
14842         return rev;
14843  }
14844  
14845 +#ifdef HAVE_DEVFS_FS
14846  #ifdef CONFIG_DEVFS_FS
14847  
14848  static devfs_handle_t devfs_handle;
14849 @@ -2314,6 +2482,7 @@
14850  }
14851  
14852  #endif  /* CONFIG_DEVFS_FS */
14853 +#endif /* HAVE_DEVFS_FS */
14854  
14855  /*
14856   * Allocate and initialize all data, register modem-devices
14857 @@ -2331,7 +2500,6 @@
14858         init_timer(&dev->timer);
14859         dev->timer.function = isdn_timer_funct;
14860         init_MUTEX(&dev->sem);
14861 -       init_waitqueue_head(&dev->info_waitq);
14862         for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
14863                 dev->drvmap[i] = -1;
14864                 dev->chanmap[i] = -1;
14865 @@ -2345,7 +2513,9 @@
14866                 vfree(dev);
14867                 return -EIO;
14868         }
14869 +#ifdef HAVE_DEVFS_FS
14870         isdn_init_devfs();
14871 +#endif /* HAVE_DEVFS_FS */
14872         if ((i = isdn_tty_modem_init()) < 0) {
14873                 printk(KERN_WARNING "isdn: Could not register tty devices\n");
14874                 if (i == -3)
14875 @@ -2353,7 +2523,9 @@
14876                 if (i <= -2)
14877                         tty_unregister_driver(&dev->mdm.tty_modem);
14878                 vfree(dev);
14879 +#ifdef HAVE_DEVFS_FS
14880                 isdn_cleanup_devfs();
14881 +#endif /* HAVE_DEVFS_FS */
14882                 devfs_unregister_chrdev(ISDN_MAJOR, "isdn");
14883                 return -EIO;
14884         }
14885 @@ -2364,7 +2536,9 @@
14886                 tty_unregister_driver(&dev->mdm.cua_modem);
14887                 for (i = 0; i < ISDN_MAX_CHANNELS; i++)
14888                         kfree(dev->mdm.info[i].xmit_buf - 4);
14889 +#ifdef HAVE_DEVFS_FS
14890                 isdn_cleanup_devfs();
14891 +#endif /* HAVE_DEVFS_FS */
14892                 devfs_unregister_chrdev(ISDN_MAJOR, "isdn");
14893                 vfree(dev);
14894                 return -EIO;
14895 @@ -2390,6 +2564,9 @@
14896         printk("\n");
14897  #endif
14898         isdn_info_update();
14899 +#ifdef CONFIG_ISDN_WITH_ABC
14900 +       isdn_dw_abc_init_func();
14901 +#endif
14902         return 0;
14903  }
14904  
14905 @@ -2398,7 +2575,7 @@
14906   */
14907  static void __exit isdn_exit(void)
14908  {
14909 -       unsigned long flags;
14910 +       int flags;
14911         int i;
14912  
14913  #ifdef CONFIG_ISDN_PPP
14914 @@ -2432,13 +2609,18 @@
14915                 printk(KERN_WARNING "isdn: controldevice busy, remove cancelled\n");
14916                 restore_flags(flags);
14917         } else {
14918 +#ifdef HAVE_DEVFS_FS
14919                 isdn_cleanup_devfs();
14920 +#endif /* HAVE_DEVFS_FS */
14921                 del_timer(&dev->timer);
14922                 restore_flags(flags);
14923                 /* call vfree with interrupts enabled, else it will hang */
14924                 vfree(dev);
14925                 printk(KERN_NOTICE "ISDN-subsystem unloaded\n");
14926         }
14927 +#ifdef CONFIG_ISDN_WITH_ABC
14928 +       isdn_dw_abc_release_func();
14929 +#endif
14930  }
14931  
14932  module_init(isdn_init);
14933 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_common.h linux-2.4.29/drivers/isdn/isdn_common.h
14934 --- linux-2.4.29.old/drivers/isdn/isdn_common.h 2005-03-22 14:47:56.000000000 +0100
14935 +++ linux-2.4.29/drivers/isdn/isdn_common.h     2005-03-22 15:06:44.374346856 +0100
14936 @@ -1,4 +1,4 @@
14937 -/* $Id: isdn_common.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
14938 +/* $Id: isdn_common.h,v 1.22 2001/09/24 13:22:42 kai Exp $
14939   *
14940   * header for Linux ISDN subsystem
14941   * common used functions and debugging-switches (linklevel).
14942 @@ -24,6 +24,9 @@
14943  #undef  ISDN_DEBUG_NET_DIAL
14944  #undef  ISDN_DEBUG_NET_ICALL
14945  
14946 +#ifdef CONFIG_ISDN_WITH_ABC
14947 +int isdn_net_force_dial_lp(isdn_net_local *);
14948 +#endif
14949  /* Prototypes */
14950  extern void isdn_MOD_INC_USE_COUNT(void);
14951  extern void isdn_MOD_DEC_USE_COUNT(void);
14952 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_concap.c linux-2.4.29/drivers/isdn/isdn_concap.c
14953 --- linux-2.4.29.old/drivers/isdn/isdn_concap.c 2005-03-22 14:47:56.000000000 +0100
14954 +++ linux-2.4.29/drivers/isdn/isdn_concap.c     2005-03-22 15:06:44.389344576 +0100
14955 @@ -1,4 +1,4 @@
14956 -/* $Id: isdn_concap.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
14957 +/* $Id: isdn_concap.c,v 1.9 2001/09/24 13:22:42 kai Exp $
14958   * 
14959   * Linux ISDN subsystem, protocol encapsulation
14960   *
14961 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_concap.h linux-2.4.29/drivers/isdn/isdn_concap.h
14962 --- linux-2.4.29.old/drivers/isdn/isdn_concap.h 2005-03-22 14:47:56.000000000 +0100
14963 +++ linux-2.4.29/drivers/isdn/isdn_concap.h     2005-03-22 15:06:44.405342144 +0100
14964 @@ -1,4 +1,4 @@
14965 -/* $Id: isdn_concap.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
14966 +/* $Id: isdn_concap.h,v 1.4 2001/09/24 13:22:42 kai Exp $
14967   *
14968   * Linux ISDN subsystem, protocol encapsulation
14969   *
14970 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_dwabc.c linux-2.4.29/drivers/isdn/isdn_dwabc.c
14971 --- linux-2.4.29.old/drivers/isdn/isdn_dwabc.c  1970-01-01 01:00:00.000000000 +0100
14972 +++ linux-2.4.29/drivers/isdn/isdn_dwabc.c      2005-03-22 15:06:44.421339712 +0100
14973 @@ -0,0 +1,1053 @@
14974 +
14975 +/* $Id: isdn_dwabc.c,v 1.27 2001/12/01 23:18:21 detabc Exp $
14976 +
14977 + * Linux ISDN subsystem, abc-extension releated funktions.
14978 + *
14979 + * Copyright           by abc GmbH
14980 + *                     written by Detlef Wengorz <detlefw@isdn4linux.de>
14981 + *
14982 + * This program is free software; you can redistribute it and/or modify
14983 + * it under the terms of the GNU General Public License as published by
14984 + * the Free Software Foundation; either version 2, or (at your option)
14985 + * any later version.
14986 + *
14987 + */
14988 +
14989 +#include <linux/config.h>
14990 +#define __NO_VERSION__
14991 +
14992 +#ifdef CONFIG_ISDN_WITH_ABC
14993 +
14994 +static char *dwabcrevison = "$Revision: 1.27 $";
14995 +
14996 +#include <asm/semaphore.h>
14997 +#define CONFIG_ISDN_WITH_ABC_NEED_DWSJIFFIES   1
14998 +#include <linux/list.h>
14999 +#include <linux/isdn.h>
15000 +#include "isdn_common.h"
15001 +#include "isdn_net.h"
15002 +
15003 +#include <linux/skbuff.h>
15004 +
15005 +#include <net/udp.h>
15006 +#include <net/checksum.h>
15007 +#include <linux/isdn_dwabc.h>
15008 +
15009 +
15010 +#if CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS && CONFIG_ISDN_PPP
15011 +#include <linux/isdn_ppp.h>
15012 +extern struct isdn_ppp_compressor *isdn_ippp_comp_head;
15013 +#define ipc_head isdn_ippp_comp_head
15014 +#ifndef CI_BSD_COMPRESS
15015 +#define CI_BSD_COMPRESS 21
15016 +#endif
15017 +#endif
15018 +
15019 +#define NBYTEORDER_30BYTES      0x1e00 
15020 +#define DWABC_TMRES (HZ / 10)
15021 +
15022 +#define VERBLEVEL (dev->net_verbose > 2)
15023 +
15024 +static struct timer_list dw_abc_timer;
15025 +
15026 +
15027 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
15028 +static ISDN_DWSPINLOCK lcr_spin = ISDN_DWSPIN_UNLOCKED;
15029 +#define LCR_LOCK() isdn_dwspin_trylock(&lcr_spin)
15030 +#define LCR_ULOCK() isdn_dwspin_unlock(&lcr_spin)
15031 +
15032 +typedef struct ISDN_DW_ABC_LCR {
15033 +
15034 +       struct list_head dll;
15035 +       char lcr_printbuf[64 + ISDN_MSNLEN + ISDN_MSNLEN];
15036 +       char *lcr_poin;
15037 +       char *lcr_epoin;
15038 +
15039 +} ISDN_DW_ABC_LCR;
15040 +
15041 +static LIST_HEAD(lcr_dll);
15042 +static atomic_t lcr_open_count         =       ATOMIC_INIT(0);
15043 +static volatile  ulong lcr_call_counter        = 0;
15044 +
15045 +
15046 +static int myjiftime(char *p,u_long nj)
15047 +{
15048 +       sprintf(p,"%02ld:%02ld.%02ld",
15049 +               ((nj / 100) / 60) % 100, (nj / 100) % 60,nj % 100);
15050 +
15051 +       return(8);
15052 +}
15053 +
15054 +
15055 +static void dw_lcr_clear_all(void)
15056 +{
15057 +       struct list_head *lh;
15058 +
15059 +       if(!LCR_LOCK()) {
15060 +
15061 +               while((lh = lcr_dll.next) != &lcr_dll) {
15062 +
15063 +                       ISDN_DW_ABC_LCR *p = list_entry(lh,ISDN_DW_ABC_LCR,dll);
15064 +                       list_del(&p->dll);
15065 +                       kfree(p);
15066 +               }
15067 +
15068 +               LCR_ULOCK();
15069 +       }
15070 +}
15071 +
15072 +void isdn_dw_abc_lcr_open(void) 
15073 +{ atomic_inc(&lcr_open_count); }
15074 +
15075 +void isdn_dw_abc_lcr_close(void) 
15076 +{ 
15077 +       if(atomic_dec_and_test(&lcr_open_count))
15078 +               dw_lcr_clear_all();
15079 +}
15080 +
15081 +int isdn_dw_abc_lcr_lock(void) 
15082 +{ return(LCR_LOCK()); }
15083 +
15084 +void isdn_dw_abc_lcr_ulock(void) 
15085 +{ LCR_ULOCK(); }
15086 +
15087 +
15088 +size_t isdn_dw_abc_lcr_readstat(char *buf,size_t count) 
15089 +{
15090 +       size_t  retw = 0;
15091 +
15092 +       while(buf != NULL && count > 0) {
15093 +
15094 +               struct list_head *lh = NULL;
15095 +               ISDN_DW_ABC_LCR *p = NULL;
15096 +               char *dp = NULL;
15097 +               size_t  n;
15098 +
15099 +               if((n = LCR_LOCK())) {
15100 +
15101 +                       if(!retw)
15102 +                               retw = n;
15103 +
15104 +                       break;
15105 +               }
15106 +
15107 +
15108 +               while((lh = lcr_dll.next) != &lcr_dll) {
15109 +
15110 +                       p = list_entry(lh,ISDN_DW_ABC_LCR,dll);
15111 +
15112 +                       if(p->lcr_poin >= p->lcr_epoin) {
15113 +
15114 +                               list_del(&p->dll);
15115 +                               kfree(p);
15116 +                               p = NULL;
15117 +
15118 +                       } else break;
15119 +               }
15120 +
15121 +               if(p == NULL) {
15122 +                               
15123 +                       LCR_ULOCK();
15124 +                       break;
15125 +               }
15126 +
15127 +               n = p->lcr_epoin - p->lcr_poin;
15128 +
15129 +               if(n > count)
15130 +                       n = count;
15131 +
15132 +               dp = p->lcr_poin;
15133 +               p->lcr_poin += n;
15134 +               retw += n;
15135 +               LCR_ULOCK();
15136 +               copy_to_user(buf,dp,n);
15137 +               buf += n;
15138 +       }
15139 +
15140 +       return(retw);
15141 +}
15142 +
15143 +
15144 +static void isdn_dw_abc_lcr_clear_helper(isdn_net_local *lp)
15145 +{
15146 +       if(lp != NULL) {
15147 +
15148 +               void *a,*b;
15149 +
15150 +               a = lp->dw_abc_lcr_cmd;  
15151 +               b = lp->dw_abc_lcr_io;
15152 +               lp->dw_abc_lcr_io = NULL;
15153 +               lp->dw_abc_lcr_cmd = NULL;
15154 +               lp->dw_abc_lcr_callid = 
15155 +               lp->dw_abc_lcr_start_request =
15156 +               lp->dw_abc_lcr_end_request = 0;
15157 +               
15158 +               if(a) kfree(a);
15159 +               if(b) kfree(b);
15160 +       }
15161 +}
15162 +
15163 +void isdn_dw_abc_lcr_clear(isdn_net_local *lp)
15164 +{
15165 +       if(!LCR_LOCK()) {
15166 +               isdn_dw_abc_lcr_clear_helper(lp);
15167 +               LCR_ULOCK();
15168 +       }
15169 +}
15170 +
15171 +
15172 +u_long isdn_dw_abc_lcr_call_number( isdn_net_local *lp,isdn_ctrl *call_cmd)
15173 +{
15174 +       u_long mid = 0;
15175 +
15176 +       if(LCR_LOCK())
15177 +               return(0);
15178 +
15179 +       isdn_dw_abc_lcr_clear_helper(lp);
15180 +
15181 +       if( atomic_read(&lcr_open_count) > 0 && 
15182 +               lp != NULL                                              && 
15183 +               call_cmd != NULL) {
15184 +
15185 +               ISDN_DW_ABC_LCR  *lc = NULL;
15186 +               int ab = 0;
15187 +
15188 +               if((lp->dw_abc_lcr_cmd = 
15189 +                       ( isdn_ctrl *)kmalloc(sizeof(isdn_ctrl),GFP_ATOMIC)) == NULL) {
15190 +
15191 +no_mem_out:;
15192 +                       isdn_dw_abc_lcr_clear_helper(lp);
15193 +                       LCR_ULOCK();
15194 +                       printk(KERN_DEBUG "%s %d : LCR no memory\n",__FILE__,__LINE__);
15195 +                       return(0);
15196 +               }
15197 +
15198 +               memcpy(lp->dw_abc_lcr_cmd,call_cmd,sizeof(*call_cmd));
15199 +               while(!(lp->dw_abc_lcr_callid = mid = lcr_call_counter++));
15200 +               
15201 +               lp->dw_abc_lcr_end_request = lp->dw_abc_lcr_start_request = jiffies;
15202 +               lp->dw_abc_lcr_end_request += HZ * 3;
15203 +
15204 +               if((lc = (ISDN_DW_ABC_LCR  *)kmalloc(sizeof(*lc),GFP_KERNEL)) == NULL)
15205 +                       goto no_mem_out;
15206 +
15207 +               lc->lcr_poin = lc->lcr_epoin = lc->lcr_printbuf;
15208 +               lc->lcr_epoin += myjiftime(lc->lcr_epoin,jiffies);
15209 +
15210 +               sprintf(lc->lcr_epoin," DW_ABC_LCR\t%lu\t%.*s\t%.*s\n",
15211 +                       mid,
15212 +                       (int)ISDN_MSNLEN,
15213 +                       call_cmd->parm.setup.eazmsn,
15214 +                       (int)ISDN_MSNLEN,
15215 +                       call_cmd->parm.setup.phone);
15216 +
15217 +               lc->lcr_epoin += strlen(lc->lcr_epoin);
15218 +               ab = lc->lcr_epoin - lc->lcr_poin;
15219 +
15220 +               list_add_tail(&lc->dll,&lcr_dll);
15221 +               LCR_ULOCK();
15222 +
15223 +               if(ab > 0) {
15224 +
15225 +                       if(dev->drv[0] != NULL ) {
15226 +
15227 +                               dev->drv[0]->stavail += ab;
15228 +                               wake_up_interruptible(&dev->drv[0]->st_waitq);
15229 +                       }
15230 +               }
15231 +
15232 +       } else LCR_ULOCK();
15233 +
15234 +       return(mid);
15235 +}
15236 +
15237 +
15238 +int isdn_dw_abc_lcr_ioctl(u_long arg)
15239 +{
15240 +       struct ISDN_DWABC_LCR_IOCTL     i;
15241 +       int need = sizeof(struct ISDN_DWABC_LCR_IOCTL); 
15242 +       isdn_net_dev *p; 
15243 +
15244 +       memset(&i,0,sizeof(struct ISDN_DWABC_LCR_IOCTL));
15245 +       copy_from_user(&i,(char *)arg,sizeof(int));
15246 +
15247 +       if(i.lcr_ioctl_sizeof < need)
15248 +               need = i.lcr_ioctl_sizeof;
15249 +
15250 +       if(need > 0) 
15251 +               copy_from_user(&i,(char *)arg,need);
15252 +
15253 +        if(LCR_LOCK())
15254 +               return(-EAGAIN);
15255 +
15256 +        p = dev->netdev; 
15257 +
15258 +        for(;p ; p = p->next) {
15259 +
15260 +               isdn_net_local *lp = p->local;
15261 +
15262 +               if(     lp->dw_abc_lcr_callid != i.lcr_ioctl_callid)
15263 +                       continue;
15264 +
15265 +               if(lp->dw_abc_lcr_cmd == NULL) 
15266 +                       continue;
15267 +
15268 +               if(lp->dw_abc_lcr_io == NULL)
15269 +                       lp->dw_abc_lcr_io = (struct ISDN_DWABC_LCR_IOCTL *)
15270 +                               kmalloc(sizeof(struct ISDN_DWABC_LCR_IOCTL),GFP_ATOMIC);
15271 +
15272 +               if(lp->dw_abc_lcr_io == NULL) {
15273 +
15274 +                       printk(KERN_DEBUG "%s %d : no memory\n",__FILE__,__LINE__);
15275 +                       continue;
15276 +               }
15277 +
15278 +               memcpy(lp->dw_abc_lcr_io,&i,sizeof(struct ISDN_DWABC_LCR_IOCTL));
15279 +
15280 +               if(i.lcr_ioctl_flags & DWABC_LCR_FLG_NEWNUMBER) {
15281 +
15282 +                       char *xx = i.lcr_ioctl_nr;
15283 +                       char *exx = xx + sizeof(i.lcr_ioctl_nr);
15284 +                       char *d = lp->dw_abc_lcr_cmd->parm.setup.phone;
15285 +                       char *ed = d + sizeof(lp->dw_abc_lcr_cmd->parm.setup.phone) - 1;
15286 +
15287 +                       while(d < ed && xx < exx && *xx) *(d++) = *(xx++);
15288 +                       while(d < ed) *(d++) = 0;
15289 +                       *d = 0;
15290 +               }
15291 +        }
15292 +
15293 +        LCR_ULOCK();
15294 +        return(0);
15295 +}
15296 +
15297 +#endif
15298 +
15299 +
15300 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
15301 +int dw_abc_udp_test(struct sk_buff *skb,struct net_device *ndev)
15302 +{
15303 +       if(ndev != NULL && skb != NULL && skb->protocol == htons(ETH_P_IP)) {
15304 +
15305 +               struct iphdr *iph = (struct iphdr *)skb->data;
15306 +               isdn_net_local *lp = (isdn_net_local *) ndev->priv;
15307 +               int rklen = skb->len;
15308 +
15309 +               if (skb->nh.raw > skb->data && skb->nh.raw < skb->tail) {
15310 +
15311 +                       rklen -= (char *)skb->nh.raw - (char *)skb->data;
15312 +                       iph = (struct iphdr *)skb->nh.raw;
15313 +               }
15314 +
15315 +               if(rklen >= 20 && iph->version == 4 && 
15316 +                       !(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_UDP_CHECK)) {
15317 +
15318 +                       if(     iph->tot_len == NBYTEORDER_30BYTES      && 
15319 +                               iph->protocol == IPPROTO_UDP) {
15320 +
15321 +                               struct udphdr *udp = 
15322 +                                       (struct udphdr *)((char *)iph + (iph->ihl << 2));
15323 +
15324 +                               ushort usrc = ntohs(udp->source);
15325 +
15326 +                               if(     udp->dest == htons(25001) && 
15327 +                                       usrc >= 20000 && usrc < 25000) {
15328 +
15329 +                                       char *p = (char *)(udp + 1);
15330 +
15331 +                                       if(p[0] == p[1]) {
15332 +
15333 +                                               char mc = 0;
15334 +
15335 +                                               switch(*p) {
15336 +                                               case 0x30:
15337 +
15338 +                                                       mc = *p;
15339 +
15340 +                                                       if((lp->flags & ISDN_NET_CONNECTED) && (!lp->dialstate))
15341 +                                                               mc++;
15342 +
15343 +                                                       break;
15344 +
15345 +                                               case 0x32:
15346 +
15347 +                                                       mc = *p;
15348 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
15349 +                                                       if((lp->flags & ISDN_NET_CONNECTED) && (!lp->dialstate)) {
15350 +
15351 +                                                               mc++;
15352 +                                                               break;
15353 +                                                       }
15354 +
15355 +                                                       if(!isdn_net_force_dial_lp(lp)) mc++;
15356 +#endif
15357 +                                                       break;
15358 +
15359 +                                               case 0x11:
15360 +                                                       mc = *p + 1;
15361 +                                                       isdn_dw_abc_reset_interface(lp,1);
15362 +                                                       break;
15363 +
15364 +                                               case 0x28:      mc = *p + 1;    break;
15365 +                                               case 0x2a:
15366 +                                               case 0x2c:
15367 +
15368 +                                                       mc = *p;
15369 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
15370 +                                                       if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_UDP_HANGUP)) {
15371 +
15372 +                                                               if(lp->isdn_device >= 0) {
15373 +
15374 +                                                                       isdn_net_hangup(ndev);
15375 +                                                                       mc = *p + 1;
15376 +                                                               }
15377 +                                                       }
15378 +#endif
15379 +                                                       break;
15380 +                                               }
15381 +
15382 +                                               if(mc) {
15383 +
15384 +                                                       struct sk_buff *nskb;
15385 +                                                       int need = 2+sizeof(struct iphdr)+sizeof(struct udphdr);
15386 +                                                       int hneed = need + ndev->hard_header_len;
15387 +
15388 +                                                       if((nskb = (struct sk_buff *)dev_alloc_skb(hneed)) != NULL) {
15389 +
15390 +                                                               ushort n = sizeof(struct udphdr) + 2;
15391 +                                                               struct iphdr *niph;
15392 +                                                               struct udphdr *nup;
15393 +                                                               skb_reserve(nskb,ndev->hard_header_len);
15394 +
15395 +                                                               if((niph = (struct iphdr *)skb_put(nskb,need))==NULL){
15396 +
15397 +                                                                       printk(KERN_DEBUG "%s: skb_put failt (%d bytes)\n", lp->name,hneed);
15398 +                                                                       dev_kfree_skb(nskb);
15399 +                                                                       return(0);
15400 +                                                               }
15401 +
15402 +                                                               nup = (struct udphdr *)(niph + 1);
15403 +                                                               ((char *)(nup + 1))[0] = mc;
15404 +                                                               ((char *)(nup + 1))[1] = mc;
15405 +                                                               nup->source=udp->dest;
15406 +                                                               nup->dest=udp->source;
15407 +                                                               nup->len=htons(n);
15408 +                                                               nup->check=0; /* dont need checksum */
15409 +                                                               memset((void *)niph,0,sizeof(*niph));
15410 +                                                               niph->version=4;
15411 +                                                               niph->ihl=5;
15412 +                                                               niph->tot_len=NBYTEORDER_30BYTES;
15413 +                                                               niph->ttl = 32;
15414 +                                                               niph->protocol = IPPROTO_UDP;
15415 +                                                               niph->saddr=iph->daddr;
15416 +                                                               niph->daddr=iph->saddr;
15417 +                                                               niph->id=iph->id;
15418 +                                                               niph->check=ip_fast_csum((unsigned char *)niph,niph->ihl);
15419 +                                                               nskb->dev = ndev;
15420 +                                                               nskb->pkt_type = PACKET_HOST;
15421 +                                                               nskb->protocol = htons(ETH_P_IP);
15422 +                                                               nskb->mac.raw = nskb->data;
15423 +                                                               netif_rx(nskb);
15424 +                                                       }
15425 +
15426 +                                                       return(1);
15427 +                                               }
15428 +                                       }
15429 +                               }
15430 +                       }
15431 +               }
15432 +       }
15433 +
15434 +       return(0);
15435 +}
15436 +#endif
15437 +
15438 +
15439 +void isdn_dw_clear_if(ulong pm,isdn_net_local *lp)
15440 +{
15441 +       if(lp != NULL) {
15442 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
15443 +               isdn_dw_abc_lcr_clear(lp);
15444 +#endif
15445 +       }
15446 +}
15447 +
15448 +
15449 +
15450 +static void dw_abc_timer_func(u_long dont_need_yet)
15451 +{
15452 +       register u_long t;
15453 +
15454 +       if(!((t = ++isdn_dwabc_jiffies.msec_100) & 1))
15455 +               if(isdn_dwabc_jiffies.msec_200++ & 1)
15456 +                       isdn_dwabc_jiffies.msec_400++;
15457 +       
15458 +       if(!(t % 5)) 
15459 +               if(isdn_dwabc_jiffies.msec_500++ & 1)
15460 +                       isdn_dwabc_jiffies.msec_1000++;
15461 +
15462 +       dw_abc_timer.expires = jiffies + DWABC_TMRES;
15463 +       add_timer(&dw_abc_timer);
15464 +}
15465 +
15466 +
15467 +void isdn_dw_abc_init_func(void)
15468 +{
15469 +
15470 +       init_timer(&dw_abc_timer);
15471 +       dw_abc_timer.function = dw_abc_timer_func;
15472 +
15473 +
15474 +       printk( KERN_INFO
15475 +               "abc-extension %s Kernel 0x%06X\n"
15476 +               "written by\nDetlef Wengorz <detlefw@isdn4linux.de>\n"
15477 +               "Installed options:\n"
15478 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
15479 +               "CONFIG_ISDN_WITH_ABC_CALLB\n"
15480 +#endif
15481 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
15482 +               "CONFIG_ISDN_WITH_ABC_UDP_CHECK\n"
15483 +#endif
15484 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
15485 +               "CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP\n"
15486 +#endif
15487 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
15488 +               "CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL\n"
15489 +#endif
15490 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
15491 +               "CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ\n"
15492 +#endif
15493 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
15494 +               "CONFIG_ISDN_WITH_ABC_LCR_SUPPORT\n"
15495 +#endif
15496 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
15497 +               "CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER\n"
15498 +#endif
15499 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
15500 +               "CONFIG_ISDN_WITH_ABC_CH_EXTINUSE\n"
15501 +#endif
15502 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
15503 +               "CONFIG_ISDN_WITH_ABC_CONN_ERROR\n"
15504 +#endif
15505 +#ifdef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
15506 +               "CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS\n"
15507 +#endif
15508 +               "loaded\n",
15509 +               dwabcrevison,LINUX_VERSION_CODE);
15510 +               dwsjiffies = 0;
15511 +               dw_abc_timer.expires = jiffies + DWABC_TMRES;
15512 +               add_timer(&dw_abc_timer);
15513 +}
15514 +
15515 +void isdn_dw_abc_release_func(void)
15516 +{
15517 +       del_timer(&dw_abc_timer);
15518 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
15519 +       dw_lcr_clear_all();
15520 +#endif
15521 +       printk( KERN_INFO
15522 +               "abc-extension %s  Kernel 0x%06X\n"
15523 +               "written by\n"
15524 +               "Detlef Wengorz <detlefw@isdn4linux.de>\n"
15525 +               "unloaded\n",
15526 +               dwabcrevison,LINUX_VERSION_CODE);
15527 +}
15528 +
15529 +
15530 +void isdn_dwabc_test_phone(isdn_net_local *lp) 
15531 +{
15532 +       if(lp != NULL) {
15533 +
15534 +               isdn_net_phone *h = lp->phone[0];
15535 +               ulong oflags = lp->dw_abc_flags;
15536 +               int secure = 0;
15537 +
15538 +               lp->dw_abc_flags = 0;
15539 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
15540 +               *lp->dw_out_msn = 0;
15541 +#endif
15542 +
15543 +               for(;h != NULL && secure < 1000;secure++,h = h->next) {
15544 +
15545 +                       char *p         =       h->num;
15546 +                       char *ep        =       p + ISDN_MSNLEN;
15547 +
15548 +                       for(;p < ep && *p && (*p <= ' ' || *p == '"' || *p == '\'');p++);
15549 +
15550 +                       if(p >= ep)
15551 +                               continue;
15552 +
15553 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
15554 +                       if(*p == '>') {
15555 +
15556 +                               if(++p < ep && *p != '<' && *p != '>') {
15557 +
15558 +                                       char *d = lp->dw_out_msn;
15559 +
15560 +                                       for(;*p && (p < ep) && (*p == ' ' || *p == '\t');p++);
15561 +                                       for(ep--;*p && (p < ep);) *(d++) = *(p++);
15562 +                                       *d = 0;
15563 +                                       continue;
15564 +                               }
15565 +                       }
15566 +#endif
15567 +
15568 +                       if(*p == '~') {
15569 +
15570 +                               /* abc switch's */
15571 +
15572 +                               for(p++;p < ep && *p;p++) switch(*p) {
15573 +                               case 'u':       lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_CHECK;                      break;
15574 +                               case 'h':       lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_HANGUP;                     break;
15575 +                               case 'd':       lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_UDP_DIAL;                       break;
15576 +                               case 'c':       lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE;            break;
15577 +                               case 'e':   lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_CONN_ERROR;                 break;
15578 +                               case 'l':   lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_NO_LCR;                                break;
15579 +
15580 +                               case 'x':
15581 +                               case 'X':       lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER;           break;
15582 +
15583 +                               case 'B':       lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_BSD_COMPRESS;                      break;
15584 +                               case 'L':       lp->dw_abc_flags |= ISDN_DW_ABC_FLAG_LEASED_LINE;                       break;
15585 +
15586 +                               case '"':
15587 +                               case ' ':
15588 +                               case '\t':
15589 +                               case '\'':      break;
15590 +
15591 +                               default:        
15592 +                                       printk(KERN_DEBUG"isdn_net: %s abc-switch <~%c> unknown\n",lp->name,*p);
15593 +                                       break;
15594 +                               }
15595 +                       }
15596 +               }
15597 +
15598 +               if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_LEASED_LINE) {
15599 +
15600 +                       lp->dw_abc_flags |= 
15601 +                                       ISDN_DW_ABC_FLAG_NO_UDP_CHECK           |
15602 +                                       ISDN_DW_ABC_FLAG_NO_UDP_HANGUP          |
15603 +                                       ISDN_DW_ABC_FLAG_NO_UDP_DIAL            |
15604 +                                       ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE         |
15605 +                                       ISDN_DW_ABC_FLAG_NO_CONN_ERROR          |
15606 +                                       ISDN_DW_ABC_FLAG_NO_LCR;
15607 +               }
15608 +
15609 +               if(dev->net_verbose  && (lp->dw_abc_flags != oflags || dev->net_verbose > 4))
15610 +                       printk(KERN_DEBUG "isdn_net %s abc-flags 0x%lx\n",lp->name,lp->dw_abc_flags);
15611 +
15612 +       }
15613 +}
15614 +
15615 +
15616 +int isdn_dw_abc_reset_interface(isdn_net_local *lp,int with_message)
15617 +{
15618 +       int r = -EINVAL;
15619 +
15620 +       if(lp != NULL) {
15621 +
15622 +               r = 0;
15623 +
15624 +               lp->dw_abc_bchan_last_connect = 0;
15625 +               lp->dw_abc_dialstart = 0;
15626 +               lp->dw_abc_inuse_secure = 0;
15627 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
15628 +               lp->dw_abc_bchan_errcnt = 0;
15629 +#endif
15630 +
15631 +               if(with_message && dev->net_verbose > 0)
15632 +                       printk(KERN_INFO
15633 +                               "%s: NOTE: reset (clear) abc-interface-secure-counter\n",
15634 +                               lp->name);
15635 +       }
15636 +
15637 +       return(r);
15638 +}
15639 +
15640 +       
15641 +#if CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS && CONFIG_ISDN_PPP
15642 +
15643 +#define DWBSD_PKT_FIRST_LEN 16
15644 +#define DWBSD_PKT_SWITCH       165
15645 +#define DWBSD_PKT_BSD          189
15646 +
15647 +#define DWBSD_VERSION          0x2
15648 +
15649 +void dwabc_bsd_first_gen(isdn_net_local *lp)
15650 +{
15651 +       if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP && 
15652 +               (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)) { 
15653 +               
15654 +               struct sk_buff *skb = NULL;
15655 +               char *p = NULL;
15656 +               char *ep = NULL;
15657 +
15658 +               if((skb =(struct sk_buff *)dev_alloc_skb(128)) == NULL) {
15659 +
15660 +                       printk(KERN_INFO "%s: dwabc: alloc-skb failed for 128 bytes\n",lp->name);
15661 +                       return;
15662 +               }
15663 +
15664 +               skb_reserve(skb,64);
15665 +               p = skb_put(skb,DWBSD_PKT_FIRST_LEN);
15666 +               ep = p + DWBSD_PKT_FIRST_LEN;
15667 +
15668 +               *(p++) = DWBSD_PKT_SWITCH;
15669 +               *(p++) = DWBSD_VERSION;
15670 +               for(;p < ep;p++)        *(p++) = 0;
15671 +
15672 +               isdn_net_write_super(lp, skb);
15673 +
15674 +               if(dev->net_verbose > 2)
15675 +                       printk(KERN_INFO "%s: dwabc: sending comm-header version 0x%x\n",lp->name,DWBSD_VERSION);
15676 +       }
15677 +}
15678 +
15679 +
15680 +void dwabc_bsd_free(isdn_net_local *lp)
15681 +{
15682 +       if(lp != NULL) {
15683 +
15684 +               if(lp->dw_abc_bsd_stat_rx || lp->dw_abc_bsd_stat_tx) {
15685 +
15686 +                       struct isdn_ppp_compressor *c = NULL;
15687 +
15688 +                       if(!(c = (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor)) {
15689 +
15690 +                               printk(KERN_WARNING
15691 +                               "%s: PANIC: freeing bsd compressmemory without compressor\n",
15692 +                                       lp->name);
15693 +
15694 +                       } else {
15695 +
15696 +                               if(lp->dw_abc_bsd_stat_rx) (*c->free)(lp->dw_abc_bsd_stat_rx);
15697 +                               if(lp->dw_abc_bsd_stat_tx) (*c->free)(lp->dw_abc_bsd_stat_tx);
15698 +
15699 +                               if(dev->net_verbose > 2)
15700 +                                       printk(KERN_INFO
15701 +                                               "%s: free bsd compress-memory\n",
15702 +                                               lp->name);
15703 +                       }
15704 +               }
15705 +
15706 +               lp->dw_abc_bsd_compressor = NULL;
15707 +               lp->dw_abc_bsd_stat_rx = NULL;
15708 +               lp->dw_abc_bsd_stat_tx = NULL;
15709 +               lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_BSDAKTIV;
15710 +
15711 +               if(dev->net_verbose > 0) {
15712 +
15713 +                       if(lp->dw_abc_bsd_rcv != lp->dw_abc_bsd_bsd_rcv) {
15714 +
15715 +                               printk(KERN_INFO "%s: Receive %lu<-%lu kb\n",lp->name,
15716 +                                       lp->dw_abc_bsd_rcv >> 10 , lp->dw_abc_bsd_bsd_rcv >> 10);
15717 +                       }
15718 +
15719 +
15720 +                       if(lp->dw_abc_bsd_snd != lp->dw_abc_bsd_bsd_snd) {
15721 +
15722 +                               printk(KERN_INFO "%s: Send  %lu->%lu kb\n",lp->name,
15723 +                                       lp->dw_abc_bsd_snd >> 10 , lp->dw_abc_bsd_bsd_snd >> 10);
15724 +                       }
15725 +               }
15726 +
15727 +               lp->dw_abc_bsd_rcv              =
15728 +               lp->dw_abc_bsd_bsd_rcv  =
15729 +               lp->dw_abc_bsd_snd              =
15730 +               lp->dw_abc_bsd_bsd_snd  = 0;
15731 +       }
15732 +}
15733 +
15734 +
15735 +int dwabc_bsd_init(isdn_net_local *lp)
15736 +{
15737 +       int r = 1;
15738 +
15739 +       if(lp != NULL) {
15740 +
15741 +               dwabc_bsd_free(lp);
15742 +
15743 +               if(lp->p_encap == ISDN_NET_ENCAP_RAWIP) {
15744 +
15745 +                       void *rx = NULL;
15746 +                       void *tx = NULL;
15747 +                       struct isdn_ppp_comp_data *cp = NULL;
15748 +                       struct isdn_ppp_compressor *c = NULL;
15749 +
15750 +                       if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) do {
15751 +
15752 +                               for(c = ipc_head ;
15753 +                                       c != NULL && c->num != CI_BSD_COMPRESS; c = c->next);
15754 +
15755 +                               if(c == NULL) {
15756 +
15757 +                                       printk(KERN_INFO
15758 +                                               "%s: Module isdn_bsdcompress not loaded\n",
15759 +                                               lp->name);
15760 +
15761 +                                       break;
15762 +                               }
15763 +
15764 +                               cp = (struct isdn_ppp_comp_data *)
15765 +                                       kmalloc(sizeof(struct isdn_ppp_comp_data),GFP_ATOMIC);
15766 +
15767 +                               if(cp == NULL) {
15768 +
15769 +                                       printk(KERN_INFO
15770 +                                               "%s: allocation of isdn_ppp_comp_data failed\n",
15771 +                                               lp->name);
15772 +
15773 +                                       break;
15774 +                               }
15775 +
15776 +                               memset(cp,0,sizeof(*cp));
15777 +                               cp->num = CI_BSD_COMPRESS;
15778 +                               cp->optlen = 1;
15779 +                                       
15780 +                               /*
15781 +                               ** set BSD_VERSION 1 and 12 bits compressmode
15782 +                               */
15783 +                               *cp->options = (1 << 5) | 12;
15784 +
15785 +                               if((rx = (*c->alloc)(cp)) == NULL) {
15786 +
15787 +                                       printk(KERN_INFO
15788 +                                               "%s: allocation of bsd rx-memory failed\n",
15789 +                                               lp->name);
15790 +
15791 +                                       break;
15792 +                               }
15793 +                                       
15794 +                               if(!(*c->init)(rx,cp,0,1)) {
15795 +
15796 +                                       printk(KERN_INFO 
15797 +                                               "%s: init of bsd rx-stream  failed\n",lp->name);
15798 +
15799 +                                       break;
15800 +                               }
15801 +
15802 +                               cp->flags = IPPP_COMP_FLAG_XMIT;
15803 +                                               
15804 +                               if((tx = (*c->alloc)(cp)) == NULL) {
15805 +
15806 +                                       printk(KERN_INFO
15807 +                                               "%s: allocation of bsd tx-memory failed\n",
15808 +                                               lp->name);
15809 +
15810 +                                       break;
15811 +                               }
15812 +
15813 +                               if(!(*c->init)(tx,cp,0,1)) {
15814 +
15815 +                                       printk(KERN_INFO
15816 +                                               "%s: init of bsd tx-stream  failed\n",
15817 +                                               lp->name);
15818 +
15819 +                                       break;
15820 +                               }
15821 +
15822 +                               lp->dw_abc_bsd_compressor = (void *)c;
15823 +                               lp->dw_abc_bsd_stat_rx = rx;
15824 +                               lp->dw_abc_bsd_stat_tx = tx;
15825 +                               rx = tx = NULL;
15826 +                               r = 0;
15827 +
15828 +                               if(dev->net_verbose > 2)
15829 +                                       printk(KERN_INFO
15830 +                                               "%s: bsd compress-memory and init ok\n",
15831 +                                               lp->name);
15832 +
15833 +                       } while(0);
15834 +
15835 +                       if(cp != NULL)
15836 +                               kfree(cp);
15837 +
15838 +                       if(c != NULL) {
15839 +
15840 +                               if(tx != NULL) (*c->free)(tx);
15841 +                               if(rx != NULL) (*c->free)(rx);
15842 +                       }
15843 +
15844 +               } else if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS) {
15845 +               
15846 +                       printk(KERN_INFO
15847 +                               "%s: bsd-compress only with encapsulation rawip allowed\n",
15848 +                               lp->name);
15849 +               }
15850 +       }
15851 +
15852 +       return(r);
15853 +}
15854 +
15855 +struct sk_buff *dwabc_bsd_compress(    isdn_net_local *lp,
15856 +                                                                       struct sk_buff *skb,
15857 +                                                                       struct net_device *ndev)
15858 +{
15859 +       if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP    && 
15860 +               (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)      &&
15861 +               (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_BSDAKTIV)) {
15862 +
15863 +               if(lp->dw_abc_bsd_stat_tx != NULL && lp->dw_abc_bsd_compressor) {
15864 +
15865 +                       struct isdn_ppp_compressor *cp = 
15866 +                               (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor;
15867 +
15868 +                       struct sk_buff *nskb = (struct sk_buff *)
15869 +                               dev_alloc_skb(skb->len * 2 + ndev->hard_header_len);
15870 +
15871 +                       int l = 0;
15872 +
15873 +                       if(nskb == NULL) {
15874 +
15875 +                               (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15876 +                               printk(KERN_INFO "%s: dwabc-compress no memory\n",lp->name);
15877 +
15878 +                       } else {
15879 +
15880 +                               skb_reserve(nskb,ndev->hard_header_len);
15881 +                               *(unsigned char *)skb_put(nskb,1) = DWBSD_PKT_BSD;
15882 +                               l = (*cp->compress)(lp->dw_abc_bsd_stat_tx,skb,nskb,0x21);
15883 +
15884 +                               if(l < 1 || l > skb->len) {
15885 +
15886 +                                       (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15887 +                                       dev_kfree_skb(nskb);
15888 +
15889 +                               } else {
15890 +
15891 +                                       u_short sqnr;
15892 +
15893 +                                       dev_kfree_skb(skb);
15894 +                                       skb = nskb;
15895 +                                       sqnr = ((*(u_char *)skb->data) << 8) + 
15896 +                                                       ((u_char)skb->data[1]);
15897 +
15898 +                                       if(sqnr > 65500)
15899 +                                               (void)(*cp->reset)
15900 +                                                       (lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15901 +                               }
15902 +                       }
15903 +               }
15904 +       }
15905 +
15906 +       return(skb);
15907 +}
15908 +
15909 +struct sk_buff *dwabc_bsd_rx_pkt(      isdn_net_local *lp,
15910 +                                                                       struct sk_buff *skb,
15911 +                                                                       struct net_device *ndev)
15912 +{
15913 +       struct sk_buff *r = skb;
15914 +
15915 +       if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP && 
15916 +               (lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)) { 
15917 +
15918 +               unsigned char *p = (unsigned char *)skb->data;
15919 +               struct isdn_ppp_compressor *cp = 
15920 +                       (struct isdn_ppp_compressor *)lp->dw_abc_bsd_compressor;
15921 +
15922 +               if(*p == DWBSD_PKT_SWITCH) {
15923 +
15924 +                       if(skb->len == DWBSD_PKT_FIRST_LEN) {
15925 +
15926 +                               if((lp->dw_abc_remote_version = p[1]) < 0x2) {
15927 +
15928 +                                       printk(KERN_INFO 
15929 +                                               "%s: I can't really talk with remote version 0x%x\n"
15930 +                                               "Please upgrade remote or disable rawip-compression\n",
15931 +                                               lp->name,
15932 +                                               p[1]);
15933 +                               }
15934 +
15935 +                               lp->dw_abc_if_flags |= ISDN_DW_ABC_IFFLAG_BSDAKTIV;
15936 +                               dev_kfree_skb(skb);
15937 +
15938 +                               if(cp && lp->dw_abc_bsd_stat_tx) 
15939 +                                       (void)(*cp->reset)(lp->dw_abc_bsd_stat_tx,0,0,NULL,0,NULL);
15940 +
15941 +                               if(dev->net_verbose > 2)
15942 +                                       printk(KERN_INFO 
15943 +                                               "%s: receive comm-header rem-version 0x%02x\n",
15944 +                                               lp->name,
15945 +                                               lp->dw_abc_remote_version);
15946 +
15947 +                               return(NULL);
15948 +                       }
15949 +
15950 +               } else if(*p == DWBSD_PKT_BSD && lp->dw_abc_bsd_stat_rx != NULL && cp) {
15951 +
15952 +                       struct sk_buff *nskb = NULL;
15953 +
15954 +                       if(test_and_set_bit(ISDN_DW_ABC_BITLOCK_RECEIVE,
15955 +                               &lp->dw_abc_bitlocks)) {
15956 +
15957 +                               printk(KERN_INFO "%s: bsd-decomp called recursivly\n",lp->name);
15958 +                               dev_kfree_skb(skb);
15959 +                               dwabc_bsd_first_gen(lp);
15960 +                               return(NULL);
15961 +                       } 
15962 +                       
15963 +                       nskb = (struct sk_buff *)
15964 +                               dev_alloc_skb(2048 + ndev->hard_header_len);
15965 +
15966 +                       if(nskb != NULL) {
15967 +
15968 +                               int l = 0;
15969 +                               u_short sqnr;
15970 +
15971 +                               skb_reserve(nskb,ndev->hard_header_len);
15972 +                               skb_pull(skb, 1);
15973 +                               sqnr = ((*(u_char *)skb->data) << 8) | ((u_char)skb->data[1]);
15974 +
15975 +                               if(!sqnr && cp && lp->dw_abc_bsd_stat_rx)
15976 +                                       (void)(*cp->reset)(lp->dw_abc_bsd_stat_rx,0,0,NULL,0,NULL);
15977 +
15978 +                               if((l = (*cp->decompress)
15979 +                                       (lp->dw_abc_bsd_stat_rx,skb,nskb,NULL)) < 1 || l>8000) {
15980 +
15981 +                                       printk(KERN_INFO "%s: abc-decomp failed\n",lp->name);
15982 +                                       dev_kfree_skb(nskb);
15983 +                                       dev_kfree_skb(skb);
15984 +                                       nskb = NULL;
15985 +                                       dwabc_bsd_first_gen(lp);
15986 +
15987 +                               } else {
15988 +
15989 +                                       if (nskb->data[0] & 0x1)
15990 +                                               skb_pull(nskb, 1);   /* protocol ID is only 8 bit */
15991 +                                       else
15992 +                                               skb_pull(nskb, 2);
15993 +
15994 +                                       nskb->dev = skb->dev;
15995 +                                       nskb->pkt_type = skb->pkt_type;
15996 +                                       nskb->mac.raw = nskb->data;
15997 +                                       dev_kfree_skb(skb);
15998 +                               }
15999 +
16000 +                       } else {
16001 +
16002 +                               printk(KERN_INFO "%s: PANIC abc-decomp no memory\n",lp->name);
16003 +                               dev_kfree_skb(skb);
16004 +                               dwabc_bsd_first_gen(lp);
16005 +                       }
16006 +
16007 +                       clear_bit(ISDN_DW_ABC_BITLOCK_RECEIVE,&lp->dw_abc_bitlocks);
16008 +                       r = nskb;
16009 +               }
16010 +       }
16011 +
16012 +       return(r);
16013 +}
16014 +
16015 +#else
16016 +int dwabc_bsd_init(isdn_net_local *lp) { return(1); }
16017 +void dwabc_bsd_free(isdn_net_local *lp) { return; }
16018 +void dwabc_bsd_first_gen(isdn_net_local *lp) { return ; }
16019 +
16020 +struct sk_buff *dwabc_bsd_compress(isdn_net_local *lp,struct sk_buff *skb,struct net_device *ndev)
16021 +{ return(skb); }
16022 +
16023 +struct sk_buff *dwabc_bsd_rx_pkt(isdn_net_local *lp,struct sk_buff *skb,struct net_device *ndev)
16024 +{ return(skb); }
16025 +#endif
16026 +#endif
16027 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_net.c linux-2.4.29/drivers/isdn/isdn_net.c
16028 --- linux-2.4.29.old/drivers/isdn/isdn_net.c    2005-03-22 14:47:56.000000000 +0100
16029 +++ linux-2.4.29/drivers/isdn/isdn_net.c        2005-03-22 15:06:44.447335760 +0100
16030 @@ -1,4 +1,4 @@
16031 -/* $Id: isdn_net.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
16032 +/* $Id: isdn_net.c,v 1.153 2002/08/17 18:35:23 detabc Exp $
16033   *
16034   * Linux ISDN subsystem, network interfaces and related functions (linklevel).
16035   *
16036 @@ -9,14 +9,6 @@
16037   * This software may be used and distributed according to the terms
16038   * of the GNU General Public License, incorporated herein by reference.
16039   *
16040 - * Data Over Voice (DOV) support added - Guy Ellis 23-Mar-02 
16041 - *                                       guy@traverse.com.au
16042 - * Outgoing calls - looks for a 'V' in first char of dialed number
16043 - * Incoming calls - checks first character of eaz as follows:
16044 - *   Numeric - accept DATA only - original functionality
16045 - *   'V'     - accept VOICE (DOV) only
16046 - *   'B'     - accept BOTH DATA and DOV types
16047 - *
16048   * Jan 2001: fix CISCO HDLC      Bjoern A. Zeeb <i4l@zabbadoz.net>
16049   *           for info on the protocol, see 
16050   *           http://i4l.zabbadoz.net/i4l/cisco-hdlc.txt
16051 @@ -38,6 +30,10 @@
16052  #include "isdn_concap.h"
16053  #endif
16054  
16055 +#ifdef CONFIG_ISDN_WITH_ABC
16056 +#include <linux/isdn_dwabc.h>
16057 +#define isdn_net_log_skb(skb,lp) isdn_net_log_skb_dwabc(skb,lp,NULL)
16058 +#endif
16059  
16060  /*
16061   * Outline of new tbusy handling: 
16062 @@ -79,7 +75,11 @@
16063                 dev = lp->master;
16064         else
16065                 dev = &n->dev;
16066 +#ifdef COMPAT_NO_SOFTNET
16067 +       return dev->start;
16068 +#else
16069         return netif_running(dev);
16070 +#endif
16071  }
16072  
16073  /*
16074 @@ -143,6 +143,10 @@
16075         atomic_inc(&lp->frame_cnt);
16076         if (isdn_net_device_busy(lp))
16077                 isdn_net_device_stop_queue(lp);
16078 +#if 0
16079 +       printk(KERN_DEBUG "%s: inc_frame_cnt now %d\n", lp->name, 
16080 +             atomic_read(&lp->frame_cnt));
16081 +#endif
16082  }
16083  
16084  static __inline__ void isdn_net_dec_frame_cnt(isdn_net_local *lp)
16085 @@ -157,11 +161,19 @@
16086                         isdn_net_device_wake_queue(lp);
16087                 }
16088         }                                                                      
16089 +#if 0
16090 +       printk(KERN_DEBUG "%s: dec_frame_cnt now %d\n", lp->name, 
16091 +              atomic_read(&lp->frame_cnt));
16092 +#endif
16093  }
16094  
16095  static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
16096  {
16097         atomic_set(&lp->frame_cnt, 0);
16098 +#if 0
16099 +       printk(KERN_DEBUG "%s: zero_frame_cnt now %d\n", lp->name,
16100 +              atomic_read(&lp->frame_cnt));
16101 +#endif
16102  }
16103  
16104  /* For 2.2.x we leave the transmitter busy timeout at 2 secs, just 
16105 @@ -173,23 +185,101 @@
16106   * which might rely on the tx timeout. If so, we'll find out this way...
16107   */
16108  
16109 +#ifdef COMPAT_NO_SOFTNET
16110 +#define ISDN_NET_TX_TIMEOUT (2*HZ)
16111 +#else
16112  #define ISDN_NET_TX_TIMEOUT (20*HZ) 
16113 +#endif
16114  
16115  /* Prototypes */
16116  
16117 +#ifndef CONFIG_ISDN_WITH_ABC
16118  int isdn_net_force_dial_lp(isdn_net_local *);
16119 +#endif
16120  static int isdn_net_start_xmit(struct sk_buff *, struct net_device *);
16121  
16122  static void isdn_net_ciscohdlck_connected(isdn_net_local *lp);
16123  static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp);
16124  
16125 -char *isdn_net_revision = "$Revision: 1.1.4.1 $";
16126 +char *isdn_net_revision = "$Revision: 1.153 $";
16127  
16128   /*
16129    * Code for raw-networking over ISDN
16130    */
16131 +#ifdef CONFIG_ISDN_WITH_ABC
16132 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16133 +static int isdn_dwabc_encap_with_conerr(isdn_net_local *lp)
16134 +{
16135 +       if(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR)
16136 +               return(0);
16137 +
16138 +       return( 
16139 +               lp->p_encap == ISDN_NET_ENCAP_SYNCPPP                   ||
16140 +               lp->p_encap == ISDN_NET_ENCAP_RAWIP                     ||
16141 +               lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK                ||
16142 +               lp->p_encap == ISDN_NET_ENCAP_UIHDLC                    );
16143 +}
16144 +
16145 +static int isdn_dwabc_conerr_ippktok(struct sk_buff *skb)
16146 +{
16147 +               struct iphdr *iph = (struct iphdr *)skb->data;
16148 +               return(iph->version == 6 || (skb->len >= 20 && iph->version == 4));
16149 +}
16150 +
16151 +#endif
16152 +
16153 +static int isdn_dwabc_is_interface_disabled(isdn_net_local *lp)
16154 +{
16155 +       if(lp == NULL)
16156 +               return(0);
16157 +
16158 +       lp->dw_abc_inuse_secure = 0;
16159 +       lp->dw_abc_dialstart = 0;
16160 +
16161 +       /*
16162 +       ** check for jiffies overflow
16163 +       */
16164 +       if(lp->dw_abc_bchan_last_connect > jiffies) {
16165 +
16166 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16167 +               lp->dw_abc_bchan_errcnt = 0;
16168 +#endif
16169 +               lp->dw_abc_bchan_last_connect = 0;
16170 +       }
16171 +
16172 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16173 +       if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR) && isdn_dwabc_encap_with_conerr(lp)) {
16174 +
16175 +               if(lp->dw_abc_bchan_errcnt > 3 && !(lp->dw_abc_bchan_errcnt & 3)) {
16176  
16177 +                       ulong nj = jiffies;
16178 +                       ulong delay =   lp->dw_abc_bchan_errcnt * 
16179 +                                                       lp->dw_abc_bchan_errcnt * 
16180 +                                                       lp->dw_abc_bchan_errcnt;
16181 +
16182 +                       if(delay > 86400) delay = 86400;
16183 +                       delay = (lp->dw_abc_bchan_last_connect + delay * HZ);
16184 +
16185 +                       if(delay > nj) {
16186 +
16187 +                               printk(KERN_INFO 
16188 +                                       "%s: interface auto-disabled (bchannel connect-error %lu seconds left)\n",
16189 +                                       lp->name,(delay - nj) / HZ);
16190 +
16191 +                               return(1);
16192 +                       }
16193 +               }
16194 +       }
16195 +#endif
16196 +       return(0);
16197 +}
16198 +#endif
16199 +
16200 +#ifdef CONFIG_ISDN_WITH_ABC
16201 +void
16202 +#else
16203  static void
16204 +#endif
16205  isdn_net_unreachable(struct net_device *dev, struct sk_buff *skb, char *reason)
16206  {
16207         if(skb) {
16208 @@ -297,6 +387,12 @@
16209  
16210         save_flags(flags);
16211         cli();
16212 +#ifdef CONFIG_ISDN_WITH_ABC
16213 +       isdn_dw_clear_if(0l,lp);
16214 +       lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN;
16215 +       lp->dw_abc_inuse_secure = 0;
16216 +       dwabc_bsd_free(lp);
16217 +#endif
16218         skb_queue_purge(&lp->super_tx_queue);
16219  
16220         if (!lp->master) {      /* reset only master device */
16221 @@ -351,6 +447,26 @@
16222                 if ((l->flags & ISDN_NET_CONNECTED) && (!l->dialstate)) {
16223                         anymore = 1;
16224                         l->huptimer++;
16225 +#ifdef CONFIG_ISDN_WITH_ABC
16226 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16227 +                       if(     isdn_dwabc_encap_with_conerr(l) && l->dw_abc_bchan_errcnt > 0) {
16228 +
16229 +                               int n = 180;
16230 +
16231 +                               if(l->dw_abc_bchan_errcnt > 3) n = 120;
16232 +                               if(l->dw_abc_bchan_errcnt > 6) n = 90;
16233 +                               if(l->dw_abc_bchan_errcnt > 9) n = 60;
16234 +
16235 +                               if(l->huptimer > n) {
16236 +
16237 +                                       printk(KERN_INFO "%s: bchan conf-error auto-secure-hangup\n",l->name);
16238 +                                       isdn_net_hangup(&p->dev);
16239 +                                       p = (isdn_net_dev *) p->next;
16240 +                                       continue;
16241 +                               }
16242 +                       }
16243 +#endif
16244 +#endif
16245                         /*
16246                          * if there is some dialmode where timeout-hangup
16247                          * should _not_ be done, check for that here
16248 @@ -465,8 +581,32 @@
16249                                         printk(KERN_INFO "%s: Chargesum is %d\n", lp->name,
16250                                                lp->charge);
16251                                         isdn_net_unbind_channel(lp);
16252 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16253 +                                       if(lp->dw_abc_bchan_errcnt) {
16254 +
16255 +                                               printk(KERN_INFO
16256 +                                                       "%s: Note: bchannel-error-counter is %hd\n",
16257 +                                                       lp->name,
16258 +                                                       lp->dw_abc_bchan_errcnt);
16259 +                                       }
16260 +#endif
16261                                         return 1;
16262                                 }
16263 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
16264 +                               if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE)) {
16265 +                                       if((lp->dialstate == 4 || lp->dialstate == 12) && 
16266 +                                               lp->dw_abc_dialstart && (idx < ISDN_MAX_CHANNELS)) {
16267 +                                       
16268 +                                               if((jiffies - lp->dw_abc_dialstart) < (HZ >>2)) {
16269 +
16270 +                                                       lp->dw_abc_if_flags |= ISDN_DW_ABC_IFFLAG_NODCHAN;
16271 +                                                       lp->dialstate = 1;
16272 +                                                       dev->dwabc_chan_external_inuse[idx] = jiffies + HZ * 30;
16273 +                                                       printk(KERN_INFO "%s: Channel %d look like external in use\n",lp->name,idx);
16274 +                                               }
16275 +                                       }
16276 +                               }
16277 +#endif
16278                                 break;
16279  #ifdef CONFIG_ISDN_X25
16280                         case ISDN_STAT_BHUP:
16281 @@ -507,6 +647,19 @@
16282                                                         }
16283                                                 }
16284                                                 printk(KERN_INFO "isdn_net: %s connected\n", lp->name);
16285 +#ifdef CONFIG_ISDN_WITH_ABC
16286 +                                               if(!dwabc_bsd_init(lp)) dwabc_bsd_first_gen(lp);
16287 +                                               lp->dw_abc_bchan_last_connect = jiffies;
16288 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16289 +                                               if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CONN_ERROR)) {
16290 +
16291 +                                                       lp->dw_abc_bchan_errcnt += isdn_dwabc_encap_with_conerr(lp);
16292 +                                                       
16293 +                                                       if(lp->dw_abc_bchan_errcnt > 32000)
16294 +                                                               lp->dw_abc_bchan_errcnt = 32000;
16295 +                                               }
16296 +#endif
16297 +#endif
16298                                                 /* If first Chargeinfo comes before B-Channel connect,
16299                                                  * we correct the timestamp here.
16300                                                  */
16301 @@ -578,7 +731,6 @@
16302         int i;
16303         unsigned long flags;
16304         isdn_ctrl cmd;
16305 -        u_char *phone_number;
16306  
16307         while (p) {
16308                 isdn_net_local *lp = p->local;
16309 @@ -597,6 +749,47 @@
16310                                  */
16311                                 save_flags(flags);
16312                                 cli();
16313 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
16314 +                               if(!(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE) &&
16315 +                                       (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_NODCHAN)) {
16316 +
16317 +                                       int chi = 0;
16318 +                                       short lsecure = 0;
16319 +
16320 +                                       lsecure = lp->dw_abc_inuse_secure;
16321 +                                       isdn_net_unbind_channel(lp);
16322 +                                       lp->dw_abc_inuse_secure = lsecure + 1;
16323 +
16324 +                                       /* Grab a free ISDN-Channel */
16325 +                                       if ((lsecure >= ISDN_MAX_CHANNELS ) || (chi = 
16326 +                                               isdn_get_free_channel(
16327 +                                                       ISDN_USAGE_NET,
16328 +                                                       lp->l2_proto,
16329 +                                                       lp->l3_proto,
16330 +                                                       lp->pre_device,
16331 +                                                       lp->pre_channel,
16332 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16333 +                                                       (*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn)
16334 +#else
16335 +                                                       lp->msn)
16336 +#endif
16337 +                                                       ) < 0) {
16338 +
16339 +                                               restore_flags(flags);
16340 +                                               isdn_net_unreachable(&p->dev, NULL,
16341 +                                                       "DWABC: redial-external-inuse NO FREE CHANNEL\n");
16342 +                                               isdn_net_hangup(&p->dev);
16343 +                                               break;
16344 +                                       }
16345 +
16346 +                                       isdn_net_bind_channel(lp, chi);
16347 +                                       lp->dialstate = 1;
16348 +                                       lp->dialstarted = 0;
16349 +                                       lp->dialwait_timer = 0;
16350 +                               }
16351 +
16352 +                               lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN;
16353 +#endif
16354                                 lp->dial = lp->phone[1];
16355                                 restore_flags(flags);
16356                                 if (!lp->dial) {
16357 @@ -621,18 +814,69 @@
16358                                 cmd.arg = lp->isdn_channel;
16359                                 cmd.command = ISDN_CMD_CLREAZ;
16360                                 isdn_command(&cmd);
16361 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16362 +                               sprintf(cmd.parm.num, "%s",
16363 +                                       isdn_map_eaz2msn((*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn, cmd.driver));
16364 +#else
16365                                 sprintf(cmd.parm.num, "%s", isdn_map_eaz2msn(lp->msn, cmd.driver));
16366 +#endif
16367                                 cmd.command = ISDN_CMD_SETEAZ;
16368                                 isdn_command(&cmd);
16369                                 lp->dialretry = 0;
16370                                 anymore = 1;
16371                                 lp->dialstate++;
16372 +#ifdef CONFIG_ISDN_WITH_ABC
16373 +                               lp->onhtime = lp->dw_abc_old_onhtime;
16374 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
16375 +                               isdn_dw_abc_lcr_clear(lp);
16376 +#endif
16377 +#endif
16378                                 /* Fall through */
16379                         case 3:
16380                                 /* Setup interface, dial current phone-number, switch to next number.
16381                                  * If list of phone-numbers is exhausted, increment
16382                                  * retry-counter.
16383                                  */
16384 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
16385 +                               if(!isdn_dw_abc_lcr_lock()) {
16386 +
16387 +                                       if(     lp->dw_abc_lcr_cmd != NULL              &&
16388 +                                               lp->dw_abc_lcr_start_request    != 
16389 +                                               lp->dw_abc_lcr_end_request) {
16390 +
16391 +                                               if(     lp->dw_abc_lcr_io == NULL                               && 
16392 +                                                       lp->dw_abc_lcr_start_request <= jiffies &&
16393 +                                                       lp->dw_abc_lcr_end_request > jiffies) {
16394 +                                                       
16395 +                                                       isdn_dw_abc_lcr_ulock();
16396 +                                                       anymore = 1;
16397 +                                                       break;
16398 +                                               }
16399 +
16400 +                                               if(lp->dw_abc_lcr_io != NULL) {
16401 +
16402 +                                                       if(lp->dw_abc_lcr_io->lcr_ioctl_flags & 
16403 +                                                               DWABC_LCR_FLG_DISABLE) {
16404 +
16405 +                                                               isdn_dw_abc_lcr_ulock();
16406 +                                                               isdn_net_hangup(&p->dev);
16407 +                                                               break;
16408 +                                                       }
16409 +
16410 +                                                       if(lp->dw_abc_lcr_io->lcr_ioctl_flags & 
16411 +                                                               DWABC_LCR_FLG_NEWHUPTIME) {
16412 +                                                               lp->onhtime = lp->dw_abc_lcr_io->lcr_ioctl_onhtime;
16413 +                                                       }
16414 +                                               }
16415 +
16416 +                                               memcpy(&cmd,lp->dw_abc_lcr_cmd,sizeof(cmd));
16417 +                                               isdn_dw_abc_lcr_ulock();
16418 +                                               goto dw_abc_lcr_next_click;
16419 +                                       }
16420 +
16421 +                                       isdn_dw_abc_lcr_ulock();
16422 +                               }
16423 +#endif
16424                                 if(dev->global_flags & ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF)) {
16425                                         char *s;
16426                                         if (dev->global_flags & ISDN_GLOBAL_STOPPED)
16427 @@ -677,20 +921,7 @@
16428                                                         break;
16429                                                 }
16430  
16431 -                                       cmd.driver = lp->isdn_device;
16432 -                                       cmd.command = ISDN_CMD_DIAL;
16433 -                                       cmd.parm.setup.si2 = 0;
16434 -
16435 -                                        /* check for DOV */
16436 -                                        phone_number = lp->dial->num;
16437 -                                        if ((*phone_number == 'v') ||
16438 -                                           (*phone_number == 'V')) { /* DOV call */
16439 -                                                cmd.parm.setup.si1 = 1;
16440 -                                        } else { /* DATA call */
16441 -                                                cmd.parm.setup.si1 = 7;
16442 -                                       }
16443 -
16444 -                                       strcpy(cmd.parm.setup.phone, phone_number);
16445 +                                       sprintf(cmd.parm.setup.phone, "%s", lp->dial->num);
16446                                         /*
16447                                          * Switch to next number or back to start if at end of list.
16448                                          */
16449 @@ -710,17 +941,70 @@
16450                                                 }
16451                                         }
16452                                         restore_flags(flags);
16453 +                                       cmd.driver = lp->isdn_device;
16454 +                                       cmd.command = ISDN_CMD_DIAL;
16455 +                                       cmd.parm.setup.si1 = 7;
16456 +                                       cmd.parm.setup.si2 = 0;
16457 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ 
16458 +                                       sprintf(cmd.parm.setup.eazmsn, "%s",
16459 +                                               isdn_map_eaz2msn((*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn, cmd.driver));
16460 +#else
16461                                         sprintf(cmd.parm.setup.eazmsn, "%s",
16462                                                 isdn_map_eaz2msn(lp->msn, cmd.driver));
16463 +#endif
16464 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
16465 +                                       /*
16466 +                                       ** if callback-out we dont need 
16467 +                                       ** low-cost-routing LCR
16468 +                                       */
16469 +                                   if(!(lp->flags & ISDN_NET_CBOUT) &&
16470 +                                               !(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_NO_LCR)) {
16471 +
16472 +                                               isdn_dw_abc_lcr_call_number(lp,&cmd);
16473 +                                               
16474 +                                               if(lp->dw_abc_lcr_start_request != lp->dw_abc_lcr_end_request) {
16475 +
16476 +                                                       if(dev->net_verbose > 2) {
16477 +
16478 +                                                               printk(KERN_INFO 
16479 +                                       "%s: Waiting for LCR-response from isdnlog %s -> %s...\n",
16480 +                                                                       lp->name,
16481 +                                                                       cmd.parm.setup.eazmsn,
16482 +                                                                       cmd.parm.setup.phone);
16483 +                                                       }
16484 +                                                               
16485 +                                                       anymore = 1;
16486 +                                                       break;
16487 +                                               }
16488 +                                       } 
16489 +
16490 +dw_abc_lcr_next_click:;
16491 +                                       isdn_dw_abc_lcr_clear(lp);
16492 +#endif
16493                                         i = isdn_dc2minor(lp->isdn_device, lp->isdn_channel);
16494                                         if (i >= 0) {
16495                                                 strcpy(dev->num[i], cmd.parm.setup.phone);
16496                                                 dev->usage[i] |= ISDN_USAGE_OUTGOING;
16497                                                 isdn_info_update();
16498                                         }
16499 -                                       printk(KERN_INFO "%s: dialing %d %s... %s\n", lp->name,
16500 -                                              lp->dialretry, cmd.parm.setup.phone,
16501 -                                              (cmd.parm.setup.si1 == 1) ? "DOV" : "");
16502 +#ifdef CONFIG_ISDN_WITH_ABC
16503 +                                       printk(KERN_INFO "%s: dialing %d %s -> %s...\n", lp->name,
16504 +                                              lp->dialretry, 
16505 +                                                  cmd.parm.setup.eazmsn,
16506 +                                                  cmd.parm.setup.phone);
16507 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16508 +                                       if(lp->dw_abc_bchan_errcnt) {
16509 +
16510 +                                               printk(KERN_INFO
16511 +                                                       "%s: Note: bchannel-error-counter is %hd\n",
16512 +                                                       lp->name,
16513 +                                                       lp->dw_abc_bchan_errcnt);
16514 +                                       }
16515 +#endif
16516 +#else
16517 +                                       printk(KERN_INFO "%s: dialing %d %s...\n", lp->name,
16518 +                                              lp->dialretry, cmd.parm.setup.phone);
16519 +#endif
16520                                         lp->dtimer = 0;
16521  #ifdef ISDN_DEBUG_NET_DIAL
16522                                         printk(KERN_DEBUG "dial: d=%d c=%d\n", lp->isdn_device,
16523 @@ -741,6 +1025,10 @@
16524                                 lp->dialstate =
16525                                     (lp->cbdelay &&
16526                                      (lp->flags & ISDN_NET_CBOUT)) ? 12 : 4;
16527 +#ifdef CONFIG_ISDN_WITH_ABC
16528 +                               lp->dw_abc_if_flags &= ~ISDN_DW_ABC_IFFLAG_NODCHAN;
16529 +                               lp->dw_abc_dialstart = jiffies;
16530 +#endif
16531                                 break;
16532                         case 4:
16533                                 /* Wait for D-Channel-connect.
16534 @@ -890,6 +1178,15 @@
16535                 isdn_command(&cmd);
16536                 printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, lp->charge);
16537                 isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
16538 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
16539 +               if(lp->dw_abc_bchan_errcnt) {
16540 +
16541 +                       printk(KERN_INFO
16542 +                               "%s: Note: bchannel-error-counter is %hd\n",
16543 +                               lp->name,
16544 +                               lp->dw_abc_bchan_errcnt);
16545 +               }
16546 +#endif
16547         }
16548         isdn_net_unbind_channel(lp);
16549  }
16550 @@ -899,8 +1196,13 @@
16551         unsigned short dest;
16552  } ip_ports;
16553  
16554 +#ifdef CONFIG_ISDN_WITH_ABC
16555 +void
16556 +isdn_net_log_skb_dwabc(struct sk_buff * skb, isdn_net_local * lp,char *reason)
16557 +#else
16558  static void
16559  isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
16560 +#endif
16561  {
16562         u_char *p = skb->nh.raw; /* hopefully, this was set correctly */
16563         unsigned short proto = ntohs(skb->protocol);
16564 @@ -972,7 +1274,13 @@
16565                                         break;
16566                         }
16567                         printk(KERN_INFO
16568 +#ifdef CONFIG_ISDN_WITH_ABC
16569 +                               "%s %s: %d.%d.%d.%d -> %d.%d.%d.%d%s\n",
16570 +                               (reason == NULL) ? "OPEN" : reason,
16571 +                               (lp != NULL) ? lp->name : "",
16572 +#else
16573                                 "OPEN: %d.%d.%d.%d -> %d.%d.%d.%d%s\n",
16574 +#endif
16575  
16576                                p[12], p[13], p[14], p[15],
16577                                p[16], p[17], p[18], p[19],
16578 @@ -980,7 +1288,13 @@
16579                         break;
16580                 case ETH_P_ARP:
16581                         printk(KERN_INFO
16582 +#ifdef CONFIG_ISDN_WITH_ABC
16583 +                               "%s %s: ARP %d.%d.%d.%d -> *.*.*.* ?%d.%d.%d.%d\n",
16584 +                               (reason == NULL) ? "OPEN" : reason,
16585 +                               (lp != NULL) ? lp->name : "",
16586 +#else
16587                                 "OPEN: ARP %d.%d.%d.%d -> *.*.*.* ?%d.%d.%d.%d\n",
16588 +#endif
16589                                p[14], p[15], p[16], p[17],
16590                                p[24], p[25], p[26], p[27]);
16591                         break;
16592 @@ -1004,11 +1318,22 @@
16593         }
16594  
16595         spin_lock_bh(&lp->xmit_lock);
16596 +
16597         if (!isdn_net_lp_busy(lp)) {
16598 +#ifdef CONFIG_ISDN_WITH_ABC
16599 +               if(!skb_queue_empty(&lp->super_tx_queue)) {
16600 +                       /*
16601 +                       ** don't reverse the frame flow
16602 +                       ** compression need frames in order and maybe other's too
16603 +                       */
16604 +                       skb_queue_tail(&lp->super_tx_queue, skb); 
16605 +                       skb = skb_dequeue(&lp->super_tx_queue);
16606 +               }
16607 +#endif
16608                 isdn_net_writebuf_skb(lp, skb);
16609 -       } else {
16610 -               skb_queue_tail(&lp->super_tx_queue, skb);
16611 -       }
16612 +
16613 +       } else skb_queue_tail(&lp->super_tx_queue, skb);
16614 +
16615         spin_unlock_bh(&lp->xmit_lock);
16616  }
16617  
16618 @@ -1056,7 +1381,6 @@
16619                 printk(KERN_WARNING "%s: HL driver queue full\n", lp->name);
16620                 goto error;
16621         }
16622 -       
16623         lp->transcount += len;
16624         isdn_net_inc_frame_cnt(lp);
16625         return;
16626 @@ -1064,9 +1388,19 @@
16627   error:
16628         dev_kfree_skb(skb);
16629         lp->stats.tx_errors++;
16630 -
16631  }
16632  
16633 +#if 0
16634 +int isdn_net_send_skb(struct net_device *ndev, isdn_net_local * lp,struct sk_buff *skb)
16635 +{
16636 +       if (isdn_net_lp_busy(lp)) {
16637 +               printk(KERN_WARNING "isdn_net_send_skb: HL channel busy\n");
16638 +               return 1;
16639 +       }
16640 +       isdn_net_writebuf_skb(lp, skb);
16641 +       return 0;
16642 +}
16643 +#endif
16644  
16645  /*
16646   *  Helper function for isdn_net_start_xmit.
16647 @@ -1109,7 +1443,54 @@
16648  
16649         /* Reset hangup-timeout */
16650         lp->huptimer = 0; // FIXME?
16651 +#ifdef CONFIG_ISDN_WITH_ABC
16652 +
16653 +       if(test_and_set_bit(ISDN_DW_ABC_BITLOCK_SEND,&lp->dw_abc_bitlocks)) {
16654 +
16655 +               if(dev->net_verbose > 2)
16656 +                       printk(KERN_INFO "%s: isdn_net_xmit  called recursivly\n",lp->name);
16657 +
16658 +               spin_unlock_bh(&lp->xmit_lock);
16659 +               return(1);
16660 +       }
16661 +
16662 +       if(skb != NULL) {
16663 +
16664 +               int l = skb->len;
16665 +               int nl = l;
16666 +
16667 +               if(     lp->p_encap == ISDN_NET_ENCAP_RAWIP &&
16668 +                               (lp->dw_abc_if_flags & ISDN_DW_ABC_IFFLAG_BSDAKTIV)) {
16669 +
16670 +                       if((skb = dwabc_bsd_compress(lp,skb,ndev)) != NULL) {
16671 +
16672 +                               int r = 0;
16673 +                               nl = skb->len;
16674 +                               skb_queue_tail(&lp->super_tx_queue,skb);
16675 +
16676 +                               if(l != nl && (r = isdn_dc2minor(lp->isdn_device,lp->isdn_channel)) >= 0) {
16677 +
16678 +                                       dev->obytes[r] += l - nl;
16679 +                                       lp->stats.tx_bytes += l - nl;
16680 +                               }
16681 +                       }
16682 +
16683 +               } else skb_queue_tail(&lp->super_tx_queue,skb);
16684 +
16685 +               if(lp->p_encap == ISDN_NET_ENCAP_RAWIP) {
16686 +
16687 +                       lp->dw_abc_bsd_snd += l;
16688 +                       lp->dw_abc_bsd_bsd_snd += nl;
16689 +               }
16690 +       }
16691 +       clear_bit(ISDN_DW_ABC_BITLOCK_SEND,&lp->dw_abc_bitlocks);
16692 +
16693 +       while(!isdn_net_lp_busy(lp) && (skb = skb_dequeue(&lp->super_tx_queue)))
16694 +               isdn_net_writebuf_skb(lp, skb);
16695 +
16696 +#else
16697         isdn_net_writebuf_skb(lp, skb);
16698 +#endif
16699         spin_unlock_bh(&lp->xmit_lock);
16700  
16701         /* the following stuff is here for backwards compatibility.
16702 @@ -1143,6 +1524,69 @@
16703  
16704         return retv;
16705  
16706 +#if 0
16707 +       if (lp->cps > lp->triggercps) {
16708 +               /* Device overloaded */
16709 +
16710 +               /*
16711 +                * Packet-delivery via round-robin over master
16712 +                * and all connected slaves.
16713 +                */
16714 +               if (lp->master) {
16715 +                       /* Slaves always deliver themselves */
16716 +                       spin_lock_bh(&lp->xmit_lock);
16717 +                       if (!isdn_net_lp_busy(lp)) {
16718 +                               isdn_net_writebuf_skb(lp, skb);
16719 +                               ret = 0;
16720 +                       } else {
16721 +                               isdn_net_device_stop_queue(lp);
16722 +                               ret = 1;
16723 +                       }
16724 +                       ret = isdn_net_send_skb(ndev, lp, skb);
16725 +                       spin_unlock_bh(&lp->xmit_lock);
16726 +               } else {
16727 +                       isdn_net_local *slp = (isdn_net_local *) (lp->srobin->priv);
16728 +                       /* Master delivers via srobin and maintains srobin */
16729 +                       if (lp->srobin == ndev) {
16730 +                               spin_lock_bh(&lp->xmit_lock);
16731 +                               ret = isdn_net_send_skb(ndev, lp, skb);
16732 +                               spin_unlock_bh(&lp->xmit_lock);
16733 +                       } else {
16734 +                               ret = isdn_net_start_xmit(skb, lp->srobin);
16735 +                       }
16736 +                       lp->srobin = (slp->slave) ? slp->slave : ndev;
16737 +                       slp = (isdn_net_local *) (lp->srobin->priv);
16738 +                       if (!((slp->flags & ISDN_NET_CONNECTED) && (slp->dialstate == 0)))
16739 +                               lp->srobin = ndev;
16740 +               }
16741 +               /* Slave-startup using delay-variable */
16742 +               if (lp->slave) {
16743 +                       if (!lp->sqfull) {
16744 +                               /* First time overload: set timestamp only */
16745 +                               lp->sqfull = 1;
16746 +                               lp->sqfull_stamp = jiffies;
16747 +                       } else {
16748 +                               /* subsequent overload: if slavedelay exceeded, start dialing */
16749 +                               if ((jiffies - lp->sqfull_stamp) > lp->slavedelay)
16750 +                                       isdn_net_force_dial_lp((isdn_net_local *) lp->slave->priv);
16751 +                       }
16752 +               }
16753 +       } else {
16754 +               /* Not overloaded, deliver locally */
16755 +               spin_lock_bh(&lp->xmit_lock);
16756 +               if (!isdn_net_lp_busy(lp)) {
16757 +                       isdn_net_writebuf_skb(lp, skb);
16758 +                       ret = 0;
16759 +               } else {
16760 +                       isdn_net_device_stop_queue(lp);
16761 +                       ret = 1;
16762 +               }
16763 +               spin_unlock_bh(&lp->xmit_lock);
16764 +               if (lp->sqfull && ((jiffies - lp->sqfull_stamp) > (lp->slavedelay + (10 * HZ))))
16765 +                       lp->sqfull = 0;
16766 +       }
16767 +       return ret;
16768 +#endif
16769  }
16770  
16771  static void
16772 @@ -1161,6 +1605,7 @@
16773  }
16774  
16775  
16776 +#ifndef COMPAT_NO_SOFTNET
16777  void isdn_net_tx_timeout(struct net_device * ndev)
16778  {
16779         isdn_net_local *lp = (isdn_net_local *) ndev->priv;
16780 @@ -1188,19 +1633,206 @@
16781         ndev->trans_start = jiffies;
16782         netif_wake_queue(ndev);
16783  }
16784 +#endif
16785  
16786  /*
16787   * Try sending a packet.
16788   * If this interface isn't connected to a ISDN-Channel, find a free channel,
16789   * and start dialing.
16790   */
16791 +#ifdef CONFIG_ISDN_WITH_ABC
16792 +static int dwabc_isdn_net_start_xmit(struct sk_buff *,struct net_device *);
16793 +
16794 +static int isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
16795 +{
16796 +       if(skb == NULL || ndev == NULL)
16797 +               return(dwabc_isdn_net_start_xmit(skb,ndev));
16798 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
16799 +       if(!(((isdn_net_local *)ndev->priv)->dw_abc_flags & 
16800 +               ISDN_DW_ABC_FLAG_NO_UDP_CHECK)) {
16801 +
16802 +               if(dw_abc_udp_test(skb,ndev)) {
16803 +                       dev_kfree_skb(skb);
16804 +                       return(0);
16805 +               }
16806 +       }
16807 +#endif
16808 +       return(dwabc_isdn_net_start_xmit(skb,ndev));
16809 +}
16810 +
16811 +
16812 +#ifdef CONFIG_ISDN_WITH_ABC
16813 +int isdn_auto_dial_helper(     isdn_net_local *lp,
16814 +                                                       struct sk_buff *skb,
16815 +                                                       int dm_manual_allowed)
16816 +/**********************************************************************
16817 +       return's:
16818 +               -1              dial not allowed or impossible
16819 +               0               interface is connected
16820 +               1               dial is started
16821 +***********************************************************************/
16822 +{
16823 +       int retw = -1;
16824 +       int chi;
16825 +       ulong flags;
16826 +       char *errmsg = NULL;
16827 +
16828 +#ifdef ISDN_DEBUG_NET_DUMP
16829 +       {
16830 +               char *buf = skb->data;
16831 +               isdn_dumppkt("S:", buf, skb->len, 40);
16832 +       }
16833 +#endif
16834 +       if (lp->flags & ISDN_NET_CONNECTED) 
16835 +               return(0);
16836 +
16837 +       save_flags(flags);
16838 +       cli();
16839 +
16840 +       do {
16841 +
16842 +               /* Log packet, which triggered dialing */
16843 +               if (dev->net_verbose)
16844 +                       isdn_net_log_skb(skb, lp);
16845 +               /* only do autodial if allowed by config */
16846 +               if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) {
16847 +                       errmsg = "dial rejected: interface not in dialmode `auto'";
16848 +
16849 +                       if(dm_manual_allowed &&
16850 +                               !(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_MANUAL)) {
16851 +
16852 +                               errmsg = 
16853 +                               "dial rejected: interface not in dialmode `auto or manual'";
16854 +                       }
16855 +                       break;
16856 +               }
16857 +
16858 +               if (!lp->phone[1]) {
16859 +
16860 +                       errmsg = "No phone number";
16861 +                       break;
16862 +               }
16863 +
16864 +               if(lp->dialwait_timer <= 0) {
16865 +
16866 +                       if(     lp->dialstarted > 0 &&
16867 +                               lp->dialtimeout > 0 && 
16868 +                               jiffies < (lp->dialstarted + lp->dialtimeout + lp->dialwait)) {
16869 +
16870 +                               lp->dialwait_timer = 
16871 +                                       lp->dialstarted + lp->dialtimeout + lp->dialwait;
16872 +                       }
16873 +               }
16874 +
16875 +               if(lp->dialwait_timer > 0) {
16876 +
16877 +                       if(jiffies < lp->dialwait_timer) {
16878 +
16879 +                               errmsg = "dial rejected: retry-time not reached";
16880 +                               break;
16881 +
16882 +                       } else lp->dialwait_timer = 0;
16883 +               }
16884 +#ifdef CONFIG_ISDN_WITH_ABC
16885 +               if(isdn_dwabc_is_interface_disabled(lp))
16886 +                       break;
16887 +#endif
16888 +               /* Grab a free ISDN-Channel */
16889 +               if (((chi =
16890 +                               isdn_get_free_channel(
16891 +                                       ISDN_USAGE_NET,
16892 +                                       lp->l2_proto,
16893 +                                       lp->l3_proto,
16894 +                                       lp->pre_device,
16895 +                                       lp->pre_channel,
16896 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16897 +                                       (*lp->dw_out_msn) ? lp->dw_out_msn :
16898 +#endif
16899 +                                       lp->msn)
16900 +                       ) < 0) &&
16901 +                       ((chi =
16902 +                               isdn_get_free_channel(
16903 +                                       ISDN_USAGE_NET,
16904 +                                       lp->l2_proto,
16905 +                                       lp->l3_proto,
16906 +                                       lp->pre_device,
16907 +                                       lp->pre_channel^1,
16908 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
16909 +                                       (*lp->dw_out_msn) ? lp->dw_out_msn :
16910 +#endif
16911 +                                       lp->msn)
16912 +                       ) < 0)) {
16913 +
16914 +                               errmsg = "No channel";
16915 +                               break;
16916 +               }
16917 +
16918 +               lp->dialstate = 1;
16919 +               /* Connect interface with channel */
16920 +               isdn_net_bind_channel(lp, chi);
16921 +#ifdef CONFIG_ISDN_PPP
16922 +               if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) {
16923 +                       /* no 'first_skb' handling for syncPPP */
16924 +                       if (isdn_ppp_bind(lp) < 0) {
16925 +                               isdn_net_unbind_channel(lp);
16926 +                               break;
16927 +                       }
16928 +
16929 +                       isdn_net_dial();        /* Initiate dialing */
16930 +                       netif_stop_queue(&lp->netdev->dev);
16931 +                       retw = 1;
16932 +                       break;
16933 +                       /* let upper layer requeue skb packet */
16934 +               }
16935 +#endif
16936 +               /* Initiate dialing */
16937 +               isdn_net_dial();
16938 +               isdn_net_device_stop_queue(lp);
16939 +               retw = 1;
16940 +
16941 +       } while(0);
16942 +
16943 +       if(retw < 0 && errmsg != NULL)
16944 +               isdn_net_unreachable(&lp->netdev->dev, skb, errmsg);
16945 +
16946 +       restore_flags(flags);
16947 +       return(retw);
16948 +}
16949 +#endif
16950 +
16951 +
16952 +
16953 +static int
16954 +dwabc_isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
16955 +#else
16956  static int
16957  isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
16958 +#endif
16959  {
16960         isdn_net_local *lp = (isdn_net_local *) ndev->priv;
16961  #ifdef CONFIG_ISDN_X25
16962         struct concap_proto * cprot = lp -> netdev -> cprot;
16963  #endif
16964 +#ifdef COMPAT_NO_SOFTNET 
16965 +       /* some comment as with the softnet TX timeout
16966 +          when this happens, it's a bug in the HL card driver
16967 +          and should be fixed there, so we can supposedly get rid of 
16968 +          this here at all. 
16969 +          I added a debugging message to find out if it ever occurs --KG
16970 +       */
16971 +
16972 +       if (ndev->tbusy) {
16973 +               if (jiffies - ndev->trans_start < ISDN_NET_TX_TIMEOUT)
16974 +                       return 1;
16975 +               if (!lp->dialstate){
16976 +                       lp->stats.tx_errors++;
16977 +                       printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n",
16978 +                               ndev->name, lp->dialstate);
16979 +               }
16980 +               ndev->trans_start = jiffies;
16981 +               netif_wake_queue(ndev);
16982 +       }
16983 +#endif
16984  #ifdef CONFIG_ISDN_X25
16985  /* At this point hard_start_xmit() passes control to the encapsulation
16986     protocol (if present).
16987 @@ -1220,6 +1852,40 @@
16988         } else
16989  #endif
16990         /* auto-dialing xmit function */
16991 +#ifdef CONFIG_ISDN_WITH_ABC
16992 +       {
16993 +               int r;
16994 +
16995 +               isdn_net_adjust_hdr(skb, ndev);
16996 +
16997 +               if(!(r = isdn_auto_dial_helper(lp,skb,0))) {
16998 +
16999 +                       /* 
17000 +                       ** Device is connected to an ISDN channel
17001 +                       */ 
17002 +                       ndev->trans_start = jiffies;
17003 +
17004 +                       if (!lp->dialstate) {
17005 +
17006 +                               /* 
17007 +                               ** ISDN connection is established, try sending 
17008 +                               */
17009 +                               r = isdn_net_xmit(ndev, skb);
17010 +
17011 +                       } else r = 1;
17012 +
17013 +                       if(r)
17014 +                               netif_stop_queue(ndev);
17015 +
17016 +               } else if(r < 0) {
17017 +
17018 +                       dev_kfree_skb(skb);
17019 +                       r = 0;
17020 +               }
17021 +
17022 +               return(r);
17023 +       }
17024 +#else
17025         {
17026  #ifdef ISDN_DEBUG_NET_DUMP
17027                 u_char *buf;
17028 @@ -1256,6 +1922,14 @@
17029                                         } else
17030                                                 lp->dialwait_timer = 0;
17031                                 }
17032 +#ifdef CONFIG_ISDN_WITH_ABC
17033 +                               if(isdn_dwabc_is_interface_disabled(lp)) {
17034 +
17035 +                                       dev_kfree_skb(skb);
17036 +                                       restore_flags(flags);
17037 +                                       return(0);
17038 +                               }
17039 +#endif
17040                                 /* Grab a free ISDN-Channel */
17041                                 if (((chi =
17042                                      isdn_get_free_channel(
17043 @@ -1264,6 +1938,9 @@
17044                                                         lp->l3_proto,
17045                                                         lp->pre_device,
17046                                                         lp->pre_channel,
17047 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
17048 +                                                       (*lp->dw_out_msn) ? lp->dw_out_msn : 
17049 +#endif
17050                                                         lp->msn)
17051                                                         ) < 0) &&
17052                                         ((chi =
17053 @@ -1273,6 +1950,9 @@
17054                                                         lp->l3_proto,
17055                                                         lp->pre_device,
17056                                                         lp->pre_channel^1,
17057 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
17058 +                                                       (*lp->dw_out_msn) ? lp->dw_out_msn :
17059 +#endif
17060                                                         lp->msn)
17061                                                         ) < 0)) {
17062                                         restore_flags(flags);
17063 @@ -1296,16 +1976,6 @@
17064                                                 restore_flags(flags);
17065                                                 return 0;       /* STN (skb to nirvana) ;) */
17066                                         }
17067 -#ifdef CONFIG_IPPP_FILTER
17068 -                                       if (isdn_ppp_autodial_filter(skb, lp)) {
17069 -                                               isdn_ppp_free(lp);
17070 -                                               isdn_net_unbind_channel(lp);
17071 -                                               restore_flags(flags);
17072 -                                               isdn_net_unreachable(ndev, skb, "dial rejected: packet filtered");
17073 -                                               dev_kfree_skb(skb);
17074 -                                               return 0;
17075 -                                       }
17076 -#endif
17077                                         restore_flags(flags);
17078                                         isdn_net_dial();        /* Initiate dialing */
17079                                         netif_stop_queue(ndev);
17080 @@ -1337,6 +2007,7 @@
17081                 }
17082         }
17083         return 1;
17084 +#endif
17085  }
17086  
17087  /*
17088 @@ -1356,6 +2027,9 @@
17089         if( cprot && cprot -> pops ) cprot -> pops -> close( cprot );
17090  #endif
17091         netif_stop_queue(dev);
17092 +#ifdef COMPAT_NO_SOFTNET
17093 +       dev->start = 0;
17094 +#endif
17095         if ((p = (((isdn_net_local *) dev->priv)->slave))) {
17096                 /* If this interface has slaves, stop them also */
17097                 while (p) {
17098 @@ -1776,6 +2450,10 @@
17099         }
17100  
17101         switch (type) {
17102 +       case CISCO_TYPE_INET:
17103 +               skb->protocol = htons(ETH_P_IP);
17104 +               netif_rx(skb);
17105 +               break;
17106         case CISCO_TYPE_SLARP:
17107                 isdn_net_ciscohdlck_slarp_in(lp, skb);
17108                 goto out_free;
17109 @@ -1785,11 +2463,11 @@
17110                                 "\"no cdp enable\" on cisco.\n", lp->name);
17111                 goto out_free;
17112         default:
17113 -               /* no special cisco protocol */
17114 -               skb->protocol = htons(type);
17115 -               netif_rx(skb);
17116 -               return;
17117 +               printk(KERN_WARNING "%s: Unknown Cisco type 0x%04x\n",
17118 +                      lp->name, type);
17119 +               goto out_free;
17120         }
17121 +       return;
17122  
17123   out_free:
17124         kfree_skb(skb);
17125 @@ -1803,9 +2481,19 @@
17126  {
17127         isdn_net_local *lp = (isdn_net_local *) ndev->priv;
17128         isdn_net_local *olp = lp;       /* original 'lp' */
17129 +#ifdef CONFIG_ISDN_PPP
17130 +       int proto = PPP_PROTOCOL(skb->data);
17131 +#endif
17132  #ifdef CONFIG_ISDN_X25
17133         struct concap_proto *cprot = lp -> netdev -> cprot;
17134  #endif
17135 +#ifdef CONFIG_ISDN_WITH_ABC
17136 +       struct net_device *ondev = ndev;
17137 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17138 +       ulong lp_huptimer  = 0;
17139 +       ulong olp_huptimer = 0;
17140 +#endif
17141 +#endif
17142         lp->transcount += skb->len;
17143  
17144         lp->stats.rx_packets++;
17145 @@ -1819,6 +2507,10 @@
17146                 lp->stats.rx_packets++;
17147                 lp->stats.rx_bytes += skb->len;
17148         }
17149 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17150 +       lp_huptimer  = lp->huptimer;
17151 +       olp_huptimer = olp->huptimer;
17152 +#endif
17153         skb->dev = ndev;
17154         skb->pkt_type = PACKET_HOST;
17155         skb->mac.raw = skb->data;
17156 @@ -1840,9 +2532,40 @@
17157                         /* Fall through */
17158                 case ISDN_NET_ENCAP_RAWIP:
17159                         /* RAW-IP without MAC-Header */
17160 +#ifdef CONFIG_ISDN_WITH_ABC
17161 +                       if(olp->p_encap == ISDN_NET_ENCAP_RAWIP) {
17162 +
17163 +                               ushort l = skb->len;
17164 +                               short r = 0;
17165 +
17166 +                               olp->dw_abc_bsd_bsd_rcv += l;
17167 +
17168 +                               if((skb = dwabc_bsd_rx_pkt(olp,skb,ondev)) == NULL) {
17169 +
17170 +                                       olp->dw_abc_bsd_rcv += l;
17171 +                                       return;
17172 +                               }
17173 +
17174 +                               olp->dw_abc_bsd_rcv += skb->len;
17175 +
17176 +                               if(     l != skb->len && 
17177 +                                       (r=isdn_dc2minor(olp->isdn_device,olp->isdn_channel))>=0) {
17178 +
17179 +                                       dev->ibytes[r] += skb->len - l;
17180 +                                       olp->stats.rx_bytes += skb->len - l;
17181 +
17182 +                                       if(olp != lp)
17183 +                                               lp->stats.rx_bytes += skb->len - l;
17184 +                               }
17185 +                       }
17186 +#endif
17187                         olp->huptimer = 0;
17188                         lp->huptimer = 0;
17189                         skb->protocol = htons(ETH_P_IP);
17190 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
17191 +                       if(isdn_dwabc_conerr_ippktok(skb))
17192 +                               lp->dw_abc_bchan_errcnt = 0;
17193 +#endif
17194                         break;
17195                 case ISDN_NET_ENCAP_CISCOHDLCK:
17196                         isdn_net_ciscohdlck_receive(lp, skb);
17197 @@ -1862,8 +2585,22 @@
17198                         break;
17199  #ifdef CONFIG_ISDN_PPP
17200                 case ISDN_NET_ENCAP_SYNCPPP:
17201 -                       /* huptimer is done in isdn_ppp_push_higher */
17202 +                       /*
17203 +                        * If encapsulation is syncppp, don't reset
17204 +                        * huptimer on LCP packets.
17205 +                        */
17206 +                       if (proto != PPP_LCP) {
17207 +                               olp->huptimer = 0;
17208 +                               lp->huptimer = 0;
17209 +                       }
17210                         isdn_ppp_receive(lp->netdev, olp, skb);
17211 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17212 +                       if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) {
17213 +
17214 +                               lp->huptimer = lp_huptimer + 1;
17215 +                               olp->huptimer = olp_huptimer+ 1;
17216 +                       }
17217 +#endif
17218                         return;
17219  #endif
17220  
17221 @@ -1873,6 +2610,15 @@
17222                         if(cprot) if(cprot -> pops)
17223                                 if( cprot -> pops -> data_ind){
17224                                         cprot -> pops -> data_ind(cprot,skb);
17225 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
17226 +                                       lp->dw_abc_bchan_errcnt = 0;
17227 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17228 +                                       if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) {
17229 +                                               lp->huptimer = lp_huptimer;
17230 +                                               olp->huptimer = olp_huptimer;
17231 +                                       }
17232 +#endif
17233 +#endif
17234                                         return;
17235                                 };
17236  #endif /* CONFIG_ISDN_X25 */
17237 @@ -1882,6 +2628,15 @@
17238                         return;
17239         }
17240  
17241 +#ifdef CONFIG_ISDN_WITH_ABC
17242 +#ifdef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
17243 +       if(olp->dw_abc_flags & ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER) {
17244 +
17245 +               lp->huptimer = lp_huptimer;
17246 +               olp->huptimer = olp_huptimer;
17247 +       }
17248 +#endif
17249 +#endif
17250         netif_rx(skb);
17251         return;
17252  }
17253 @@ -2160,8 +2915,10 @@
17254         isdn_net_phone *n;
17255         ulong flags;
17256         char nr[32];
17257 -       char *my_eaz;
17258 -
17259 +#ifdef CONFIG_ISDN_WITH_ABC
17260 +       if(dev->net_verbose > 2)
17261 +               printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=0x%04X\n", di, ch, idx,dev->usage[idx]);
17262 +#endif
17263         /* Search name in netdev-chain */
17264         save_flags(flags);
17265         cli();
17266 @@ -2180,17 +2937,15 @@
17267                 eaz = setup->eazmsn;
17268         if (dev->net_verbose > 1)
17269                 printk(KERN_INFO "isdn_net: call from %s,%d,%d -> %s\n", nr, si1, si2, eaz);
17270 -        /* Accept DATA and VOICE calls at this stage
17271 -        local eaz is checked later for allowed call types */
17272 -        if ((si1 != 7) && (si1 != 1)) {
17273 -                restore_flags(flags);
17274 -                if (dev->net_verbose > 1)
17275 -                        printk(KERN_INFO "isdn_net: Service-Indicator not 1 or 7, ignored\n");
17276 -                return 0;
17277 -        }
17278 -
17279 -n = (isdn_net_phone *) 0;
17280 -p = dev->netdev;
17281 +       /* Accept only calls with Si1 = 7 (Data-Transmission) */
17282 +       if (si1 != 7) {
17283 +               restore_flags(flags);
17284 +               if (dev->net_verbose > 1)
17285 +                       printk(KERN_INFO "isdn_net: Service-Indicator not 7, ignored\n");
17286 +               return 0;
17287 +       }
17288 +       n = (isdn_net_phone *) 0;
17289 +       p = dev->netdev;
17290         ematch = wret = swapped = 0;
17291  #ifdef ISDN_DEBUG_NET_ICALL
17292         printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=%d\n", di, ch, idx,
17293 @@ -2210,25 +2965,8 @@
17294                                 break;
17295                 }
17296                 swapped = 0;
17297 -                /* check acceptable call types for DOV */
17298 -                my_eaz = isdn_map_eaz2msn(lp->msn, di);
17299 -                if (si1 == 1) { /* it's a DOV call, check if we allow it */
17300 -                        if (*my_eaz == 'v' || *my_eaz == 'V' ||
17301 -                           *my_eaz == 'b' || *my_eaz == 'B')
17302 -                                my_eaz++; /* skip to allow a match */
17303 -                        else
17304 -                                my_eaz = 0; /* force non match */
17305 -                } else { /* it's a DATA call, check if we allow it */
17306 -                        if (*my_eaz == 'b' || *my_eaz == 'B')
17307 -                                my_eaz++; /* skip to allow a match */
17308 -                }
17309 -                if (my_eaz)
17310 -                        matchret = isdn_msncmp(eaz, my_eaz);
17311 -                else
17312 -                        matchret = 1;
17313 -                if (!matchret)
17314 -                        ematch = 1;
17315 -
17316 +               if (!(matchret = isdn_msncmp(eaz, isdn_map_eaz2msn(lp->msn, di))))
17317 +                       ematch = 1;
17318                 /* Remember if more numbers eventually can match */
17319                 if (matchret > wret)
17320                         wret = matchret;
17321 @@ -2236,17 +2974,122 @@
17322                 printk(KERN_DEBUG "n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n",
17323                        lp->name, lp->msn, lp->flags, lp->dialstate);
17324  #endif
17325 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
17326 +               if ((!matchret) &&                                        /* EAZ is matching   */
17327 +                   (((!(lp->flags & ISDN_NET_CONNECTED)) &&              /* but not connected */
17328 +                     (USG_NONE(dev->usage[idx]))) ||                     /* and ch. unused or */
17329 +                    (lp->dialstate == 4) || (lp->dialstate == 12) ||           /* if dialing        */
17330 +                         ((lp->flags & ISDN_NET_CBOUT) != 0 &&                         /* init a callback      */
17331 +                         lp->outgoing != 0 )))
17332 +
17333 +               /*
17334 +               ** we dont stop call's anymore (both sides call's syncron)
17335 +               ** it will be problem in any case.
17336 +               ** both sides will make the same.
17337 +               ** i try later to make a switch (check the phon-numbers)
17338 +               ** to detect with side must be stop the call.
17339 +               */
17340 +#else
17341                 if ((!matchret) &&                                        /* EAZ is matching   */
17342                     (((!(lp->flags & ISDN_NET_CONNECTED)) &&              /* but not connected */
17343                       (USG_NONE(dev->usage[idx]))) ||                     /* and ch. unused or */
17344                      ((((lp->dialstate == 4) || (lp->dialstate == 12)) && /* if dialing        */
17345                        (!(lp->flags & ISDN_NET_CALLBACK)))                /* but no callback   */
17346                      )))
17347 +#endif
17348                          {
17349  #ifdef ISDN_DEBUG_NET_ICALL
17350                         printk(KERN_DEBUG "n_fi: match1, pdev=%d pch=%d\n",
17351                                lp->pre_device, lp->pre_channel);
17352  #endif
17353 +#ifdef CONFIG_ISDN_WITH_ABC
17354 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
17355 +                       {
17356 +                               int use_this_call = 0;
17357 +
17358 +                               if(!(lp->flags & ISDN_NET_CBOUT) && ((lp->dialstate == 4) || (lp->dialstate == 12))) {
17359 +
17360 +                                       /*
17361 +                                       ** searching for a diff. in the calling-number and the EAZ
17362 +                                       ** the remote will make the same
17363 +                                       */
17364 +
17365 +                                       char *pnr = nr;
17366 +                                       char *pea = eaz;
17367 +
17368 +                                       for(;*pnr;pnr++);
17369 +                                       for(;*pea;pea++);
17370 +                                       for(pnr--,pea--;pnr >= nr && pea >= eaz && *pea != *pnr;pnr--,pea--);
17371 +
17372 +                                       if(pnr < nr || pea < eaz || *pea > *pnr) {
17373 +
17374 +                                               p = (isdn_net_dev *) p->next;
17375 +                                               continue;
17376 +                                       }
17377 +
17378 +                                       use_this_call = 1;
17379 +                               }
17380 +                               
17381 +                               if( use_this_call || 
17382 +                                       ((lp->flags & ISDN_NET_CBOUT) && (lp->flags & ISDN_NET_CONNECTED))) {
17383 +
17384 +                                       /*
17385 +                                       ** the incoming call was to quick.
17386 +                                       ** the callback-delay-time ist not reached.
17387 +                                       ** in that case we can stop the call
17388 +                                       */
17389 +
17390 +                                       if(lp->isdn_device > -1 && lp->isdn_channel > -1) {
17391 +
17392 +                                               int minor = isdn_dc2minor(lp->isdn_device,lp->isdn_channel);
17393 +
17394 +                                               if(lp->isdn_device != di || lp->isdn_channel != ch) {
17395 +
17396 +                                                       isdn_ctrl cmd;
17397 +
17398 +                                                       memset((void *)&cmd,0,sizeof(cmd));
17399 +                                                       cmd.driver = lp->isdn_device;
17400 +                                                       cmd.command = ISDN_CMD_HANGUP;
17401 +                                                       cmd.arg = lp->isdn_channel;
17402 +                                                       (void) dev->drv[cmd.driver]->interface->command(&cmd);
17403 +                                                       isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
17404 +
17405 +                                                       if(dev->net_verbose > 1) {
17406 +
17407 +                                                               printk(KERN_INFO 
17408 +                               "%s: found outgoing call hangup old call on di %d ch %d\n",
17409 +                                                                       lp->name,lp->isdn_device,lp->isdn_channel);
17410 +                                                       }
17411 +
17412 +                                               } else if (dev->net_verbose > 1) {
17413 +
17414 +                                                       printk(KERN_INFO "%s: found outgoing call on same di %d ch %d\n",
17415 +                                                               lp->name,lp->isdn_device,lp->isdn_channel);
17416 +                                               }
17417 +
17418 +                                               if(minor >= 0) {
17419 +
17420 +                                                       dev->rx_netdev[minor] = NULL;
17421 +                                                       dev->st_netdev[minor] = NULL;
17422 +                                               }
17423 +
17424 +                                               isdn_free_channel(lp->isdn_device,
17425 +                                                       lp->isdn_channel, ISDN_USAGE_NET);
17426 +
17427 +                                       } else if (dev->net_verbose > 1) {
17428 +
17429 +                                               printk(KERN_INFO "%s: found outgoing call reset callstate \n",lp->name);
17430 +                                       }
17431 +
17432 +                                       lp->flags &= ~ISDN_NET_CONNECTED;
17433 +                                       lp->isdn_device = -1;
17434 +                                       lp->isdn_channel = -1;
17435 +                                       lp->dtimer = 0;
17436 +                                       lp->dialstate = 0;
17437 +                               }
17438 +                       }
17439 +#endif
17440 +#endif
17441                         if (dev->usage[idx] & ISDN_USAGE_EXCLUSIVE) {
17442                                 if ((lp->pre_channel != ch) ||
17443                                     (lp->pre_device != di)) {
17444 @@ -2375,6 +3218,12 @@
17445                                                 continue;
17446                                         }
17447                                 } 
17448 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
17449 +                               if(isdn_dwabc_is_interface_disabled(lp)) {
17450 +                                       restore_flags(flags);
17451 +                                       return 3;
17452 +                               }
17453 +#endif
17454                                 if (lp->flags & ISDN_NET_CALLBACK) {
17455                                         int chi;
17456                                         /*
17457 @@ -2427,6 +3276,47 @@
17458                                         restore_flags(flags);
17459                                         return 0;
17460                                 } else {
17461 +#ifdef CONFIG_ISDN_WITH_ABC_CALLB
17462 +                                       {
17463 +                                       /*
17464 +                                       ** this is a sanity-check.
17465 +                                       ** check for double use (device and channel)
17466 +                                       ** will be very near to a kernel-crash in that case
17467 +                                       */
17468 +                                       isdn_net_dev *sp = dev->netdev;
17469 +                                       int s_shl;
17470 +                                       isdn_net_local *ml;
17471 +
17472 +                                       for(s_shl=0; s_shl < 2048 && sp != NULL; sp = (isdn_net_dev *)sp->next, s_shl++) {
17473 +
17474 +                                               if(sp == p || (ml = sp->local) == NULL)
17475 +                                                       continue;
17476 +
17477 +                                               if(ml->isdn_device != di || ml->isdn_channel != ch)
17478 +                                                       continue;
17479 +
17480 +                                               if(ml->dialstate != 4 && ml->dialstate != 12) {
17481 +
17482 +                                                       /*
17483 +                                                       ** wrong situation
17484 +                                                       */
17485 +                                                       break;
17486 +                                               }
17487 +
17488 +                                               isdn_net_unbind_channel(ml);
17489 +                                       }
17490 +
17491 +                                       if(sp != NULL) {
17492 +
17493 +                                               printk(KERN_DEBUG
17494 +"%s: call from %s -> %s (drv %d chan %d duplicated with %s) \n",
17495 +                                                       lp->name, nr, eaz,di,ch,
17496 +                                                       sp->local->name );
17497 +
17498 +                                               restore_flags(flags);
17499 +                                               return 3;
17500 +                                       }}
17501 +#endif
17502                                         printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", lp->name, nr,
17503                                                eaz);
17504                                         /* if this interface is dialing, it does it probably on a different
17505 @@ -2516,7 +3406,11 @@
17506                                                         lp->l3_proto,
17507                                                         lp->pre_device,
17508                                                         lp->pre_channel,
17509 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
17510 +                                                       (*lp->dw_out_msn) ? lp->dw_out_msn : lp->msn)
17511 +#else
17512                                                         lp->msn)
17513 +#endif
17514                                                         ) < 0) {
17515                                 printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n", lp->name);
17516                                 restore_flags(flags);
17517 @@ -2599,7 +3493,11 @@
17518                 strcpy(netdev->local->name, "         ");
17519         else
17520                 strcpy(netdev->local->name, name);
17521 +#ifdef COMPAT_NO_SOFTNET
17522 +       netdev->dev.name = netdev->local->name;
17523 +#else
17524         strcpy(netdev->dev.name, netdev->local->name);
17525 +#endif
17526         netdev->dev.priv = netdev->local;
17527         netdev->dev.init = isdn_net_init;
17528         netdev->local->p_encap = ISDN_NET_ENCAP_RAWIP;
17529 @@ -2617,11 +3515,13 @@
17530                 ((isdn_net_local *) q->priv)->slave = &(netdev->dev);
17531         } else {
17532                 /* Device shall be a master */
17533 +#ifndef COMPAT_NO_SOFTNET
17534                 /*
17535                  * Watchdog timer (currently) for master only.
17536                  */
17537                 netdev->dev.tx_timeout = isdn_net_tx_timeout;
17538                 netdev->dev.watchdog_timeo = ISDN_NET_TX_TIMEOUT;
17539 +#endif
17540                 if (register_netdev(&netdev->dev) != 0) {
17541                         printk(KERN_WARNING "isdn_net: Could not register net-device\n");
17542                         kfree(netdev->local);
17543 @@ -2658,6 +3558,9 @@
17544         netdev->local->hupflags = ISDN_INHUP;   /* Do hangup even on incoming calls */
17545         netdev->local->onhtime = 10;    /* Default hangup-time for saving costs
17546            of those who forget configuring this */
17547 +#ifdef CONFIG_ISDN_WITH_ABC 
17548 +       netdev->local->dw_abc_old_onhtime = netdev->local->onhtime;
17549 +#endif
17550         netdev->local->dialmax = 1;
17551         netdev->local->flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL;     /* Hangup before Callback, manual dial */
17552         netdev->local->cbdelay = 25;    /* Wait 5 secs before Callback */
17553 @@ -2831,7 +3734,6 @@
17554  
17555                         /* If binding is exclusive, try to grab the channel */
17556                         save_flags(flags);
17557 -                       cli();
17558                         if ((i = isdn_get_free_channel(ISDN_USAGE_NET,
17559                                 lp->l2_proto, lp->l3_proto, drvidx,
17560                                 chidx, lp->msn)) < 0) {
17561 @@ -2859,6 +3761,9 @@
17562                 lp->pre_device = drvidx;
17563                 lp->pre_channel = chidx;
17564                 lp->onhtime = cfg->onhtime;
17565 +#ifdef CONFIG_ISDN_WITH_ABC 
17566 +               lp->dw_abc_old_onhtime = lp->onhtime;
17567 +#endif
17568                 lp->charge = cfg->charge;
17569                 lp->l2_proto = cfg->l2_proto;
17570                 lp->l3_proto = cfg->l3_proto;
17571 @@ -2932,6 +3837,9 @@
17572                         }
17573                 }
17574                 lp->p_encap = cfg->p_encap;
17575 +#ifdef CONFIG_ISDN_WITH_ABC 
17576 +               isdn_dw_abc_reset_interface(lp,0);
17577 +#endif
17578                 return 0;
17579         }
17580         return -ENODEV;
17581 @@ -3007,6 +3915,9 @@
17582                 strcpy(n->num, phone->phone);
17583                 n->next = p->local->phone[phone->outgoing & 1];
17584                 p->local->phone[phone->outgoing & 1] = n;
17585 +#ifdef CONFIG_ISDN_WITH_ABC
17586 +               isdn_dwabc_test_phone(p->local);
17587 +#endif
17588                 return 0;
17589         }
17590         return -ENODEV;
17591 @@ -3100,6 +4011,9 @@
17592                                 else
17593                                         p->local->phone[inout] = n->next;
17594                                 kfree(n);
17595 +#ifdef CONFIG_ISDN_WITH_ABC
17596 +                               isdn_dwabc_test_phone(p->local);
17597 +#endif
17598                                 restore_flags(flags);
17599                                 return 0;
17600                         }
17601 @@ -3135,6 +4049,9 @@
17602                 p->local->phone[i] = NULL;
17603         }
17604         p->local->dial = NULL;
17605 +#ifdef CONFIG_ISDN_WITH_ABC
17606 +       isdn_dwabc_test_phone(p->local);
17607 +#endif
17608         restore_flags(flags);
17609         return 0;
17610  }
17611 @@ -3218,6 +4135,10 @@
17612         /* If no more net-devices remain, disable auto-hangup timer */
17613         if (dev->netdev == NULL)
17614                 isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 0);
17615 +#ifdef CONFIG_ISDN_WITH_ABC
17616 +       isdn_dw_clear_if(~0l,p->local);
17617 +       dwabc_bsd_free(p->local);
17618 +#endif
17619         restore_flags(flags);
17620         kfree(p->local);
17621         kfree(p);
17622 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_net.h linux-2.4.29/drivers/isdn/isdn_net.h
17623 --- linux-2.4.29.old/drivers/isdn/isdn_net.h    2005-03-22 14:47:56.000000000 +0100
17624 +++ linux-2.4.29/drivers/isdn/isdn_net.h        2005-03-22 15:06:44.463333328 +0100
17625 @@ -1,4 +1,4 @@
17626 -/* $Id: isdn_net.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
17627 +/* $Id: isdn_net.h,v 1.23 2001/11/07 22:35:48 kai Exp $
17628   *
17629   * header for Linux ISDN subsystem, network related functions (linklevel).
17630   *
17631 @@ -26,6 +26,7 @@
17632  #define CISCO_ADDR_BROADCAST  0x8f
17633  #define CISCO_CTRL            0x00
17634  #define CISCO_TYPE_CDP        0x2000
17635 +#define CISCO_TYPE_INET       0x0800
17636  #define CISCO_TYPE_SLARP      0x8035
17637  #define CISCO_SLARP_REQUEST   0
17638  #define CISCO_SLARP_REPLY     1
17639 @@ -106,8 +107,6 @@
17640         spin_lock_irqsave(&nd->queue_lock, flags);
17641  
17642         lp = nd->queue;
17643 -//     printk(KERN_DEBUG __FUNCTION__": lp:%s(%p) nlp:%s(%p) last(%p)\n",
17644 -//             lp->name, lp, nlp->name, nlp, lp->last); 
17645         nlp->last = lp->last;
17646         lp->last->next = nlp;
17647         lp->last = nlp;
17648 @@ -127,20 +126,12 @@
17649         if (lp->master)
17650                 master_lp = (isdn_net_local *) lp->master->priv;
17651  
17652 -//     printk(KERN_DEBUG __FUNCTION__": lp:%s(%p) mlp:%s(%p) last(%p) next(%p) mndq(%p)\n",
17653 -//             lp->name, lp, master_lp->name, master_lp, lp->last, lp->next, master_lp->netdev->queue); 
17654         spin_lock_irqsave(&master_lp->netdev->queue_lock, flags);
17655         lp->last->next = lp->next;
17656         lp->next->last = lp->last;
17657 -       if (master_lp->netdev->queue == lp) {
17658 +       if (master_lp->netdev->queue == lp)
17659                 master_lp->netdev->queue = lp->next;
17660 -               if (lp->next == lp) { /* last in queue */
17661 -                       master_lp->netdev->queue = master_lp->netdev->local;
17662 -               }
17663 -       }
17664         lp->next = lp->last = lp;       /* (re)set own pointers */
17665 -//     printk(KERN_DEBUG __FUNCTION__": mndq(%p)\n",
17666 -//             master_lp->netdev->queue); 
17667         spin_unlock_irqrestore(&master_lp->netdev->queue_lock, flags);
17668  }
17669  
17670 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ppp.c linux-2.4.29/drivers/isdn/isdn_ppp.c
17671 --- linux-2.4.29.old/drivers/isdn/isdn_ppp.c    2005-03-22 14:47:56.000000000 +0100
17672 +++ linux-2.4.29/drivers/isdn/isdn_ppp.c        2005-03-22 15:06:44.481330592 +0100
17673 @@ -1,4 +1,4 @@
17674 -/* $Id: isdn_ppp.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
17675 +/* $Id: isdn_ppp.c,v 1.94 2001/11/07 22:35:48 kai Exp $
17676   *
17677   * Linux ISDN subsystem, functions for synchronous PPP (linklevel).
17678   *
17679 @@ -13,9 +13,6 @@
17680  #include <linux/isdn.h>
17681  #include <linux/poll.h>
17682  #include <linux/ppp-comp.h>
17683 -#ifdef CONFIG_IPPP_FILTER
17684 -#include <linux/filter.h>
17685 -#endif
17686  
17687  #include "isdn_common.h"
17688  #include "isdn_ppp.h"
17689 @@ -72,11 +69,19 @@
17690  static int isdn_ppp_bundle(struct ippp_struct *, int unit);
17691  #endif /* CONFIG_ISDN_MPP */
17692    
17693 -char *isdn_ppp_revision = "$Revision: 1.1.4.1 $";
17694 +char *isdn_ppp_revision = "$Revision: 1.94 $";
17695  
17696  static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS];
17697  
17698 +#ifndef CONFIG_ISDN_WITH_ABC
17699  static struct isdn_ppp_compressor *ipc_head = NULL;
17700 +#else
17701 +       /*
17702 +       ** make compressor's common usable
17703 +       */
17704 +struct isdn_ppp_compressor *isdn_ippp_comp_head = NULL;
17705 +#define ipc_head isdn_ippp_comp_head
17706 +#endif
17707  
17708  /*
17709   * frame log (debug)
17710 @@ -110,11 +115,8 @@
17711         unsigned long flags;
17712         struct ippp_struct *is;
17713  
17714 -       if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
17715 -               printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
17716 -                       __FUNCTION__, lp->ppp_slot);
17717 +       if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS)
17718                 return 0;
17719 -       }
17720  
17721         save_flags(flags);
17722         cli();
17723 @@ -130,12 +132,7 @@
17724         lp->netdev->pb->ref_ct--;
17725         spin_unlock(&lp->netdev->pb->lock);
17726  #endif /* CONFIG_ISDN_MPP */
17727 -       if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
17728 -               printk(KERN_ERR "%s: ppp_slot(%d) now invalid\n",
17729 -                       __FUNCTION__, lp->ppp_slot);
17730 -               restore_flags(flags);
17731 -               return 0;
17732 -       }
17733 +
17734         is = ippp_table[lp->ppp_slot];
17735         if ((is->state & IPPP_CONNECT))
17736                 isdn_ppp_closewait(lp->ppp_slot);       /* force wakeup on ippp device */
17737 @@ -231,13 +228,12 @@
17738  void
17739  isdn_ppp_wakeup_daemon(isdn_net_local * lp)
17740  {
17741 -       if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS) {
17742 -               printk(KERN_ERR "%s: ppp_slot(%d) out of range\n",
17743 -                       __FUNCTION__, lp->ppp_slot);
17744 +       if (lp->ppp_slot < 0 || lp->ppp_slot >= ISDN_MAX_CHANNELS)
17745                 return;
17746 -       }
17747 +
17748         ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK;
17749 -       wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq);
17750 +
17751 +               wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq);
17752  }
17753  
17754  /*
17755 @@ -250,14 +246,13 @@
17756  {
17757         struct ippp_struct *is;
17758  
17759 -       if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
17760 -               printk(KERN_ERR "%s: slot(%d) out of range\n",
17761 -                       __FUNCTION__, slot);
17762 +       if (slot < 0 || slot >= ISDN_MAX_CHANNELS)
17763                 return 0;
17764 -       }
17765         is = ippp_table[slot];
17766 +
17767         if (is->state)
17768                 wake_up_interruptible(&is->wq);
17769 +
17770         is->state = IPPP_CLOSEWAIT;
17771         return 1;
17772  }
17773 @@ -295,9 +290,11 @@
17774                 return -EBUSY;
17775         }
17776         is = file->private_data = ippp_table[slot];
17777 -       
17778 -       printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n",
17779 -              slot, min, is->state);
17780 +
17781 +#if 0
17782 +       if (is->debug & 0x1)
17783 +#endif
17784 +               printk(KERN_DEBUG "ippp, open, slot: %d, minor: %d, state: %04x\n", slot, min, is->state);
17785  
17786         /* compression stuff */
17787         is->link_compressor   = is->compressor = NULL;
17788 @@ -327,10 +324,7 @@
17789          */
17790         is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */
17791  #endif
17792 -#ifdef CONFIG_IPPP_FILTER
17793 -       is->pass_filter.filter = NULL;
17794 -       is->active_filter.filter = NULL;
17795 -#endif
17796 +
17797         is->state = IPPP_OPEN;
17798  
17799         return 0;
17800 @@ -349,20 +343,12 @@
17801                 return;
17802         is = file->private_data;
17803  
17804 -       if (!is) {
17805 -               printk(KERN_ERR "%s: no file->private_data\n", __FUNCTION__);
17806 -               return;
17807 -       }
17808         if (is->debug & 0x1)
17809                 printk(KERN_DEBUG "ippp: release, minor: %d %lx\n", min, (long) is->lp);
17810  
17811         if (is->lp) {           /* a lp address says: this link is still up */
17812                 isdn_net_dev *p = is->lp->netdev;
17813  
17814 -               if (!p) {
17815 -                       printk(KERN_ERR "%s: no lp->netdev\n", __FUNCTION__);
17816 -                       return;
17817 -               }
17818                 is->state &= ~IPPP_CONNECT;     /* -> effect: no call of wakeup */
17819                 /*
17820                  * isdn_net_hangup() calls isdn_ppp_free()
17821 @@ -385,18 +371,8 @@
17822         slhc_free(is->slcomp);
17823         is->slcomp = NULL;
17824  #endif
17825 -#ifdef CONFIG_IPPP_FILTER
17826 -       if (is->pass_filter.filter) {
17827 -               kfree(is->pass_filter.filter);
17828 -               is->pass_filter.filter = NULL;
17829 -       }
17830 -       if (is->active_filter.filter) {
17831 -               kfree(is->active_filter.filter);
17832 -               is->active_filter.filter = NULL;
17833 -       }
17834 -#endif
17835  
17836 -/* TODO: if this was the previous master: link the stuff to the new master */
17837 +/* TODO: if this was the previous master: link the the stuff to the new master */
17838         if(is->comp_stat)
17839                 is->compressor->free(is->comp_stat);
17840         if(is->link_comp_stat)
17841 @@ -509,13 +485,15 @@
17842                         if (val & SC_ENABLE_IP && !(is->pppcfg & SC_ENABLE_IP) && (is->state & IPPP_CONNECT)) {
17843                                 if (lp) {
17844                                         /* OK .. we are ready to send buffers */
17845 -                                       is->pppcfg = val; /* isdn_ppp_xmit test for SC_ENABLE_IP !!! */
17846                                         netif_wake_queue(&lp->netdev->dev);
17847 -                                       break;
17848                                 }
17849                         }
17850                         is->pppcfg = val;
17851                         break;
17852 +#if 0
17853 +               case PPPIOCGSTAT:       /* read PPP statistic information */
17854 +                       break;
17855 +#endif
17856                 case PPPIOCGIDLE:       /* get idle time information */
17857                         if (lp) {
17858                                 struct ppp_idle pidle;
17859 @@ -604,39 +582,6 @@
17860                                 }
17861                                 return set_arg((void *)arg,&pci,sizeof(struct pppcallinfo));
17862                         }
17863 -#ifdef CONFIG_IPPP_FILTER
17864 -               case PPPIOCSPASS:
17865 -               case PPPIOCSACTIVE:
17866 -                       {
17867 -                               struct sock_fprog uprog, *filtp;
17868 -                               struct sock_filter *code = NULL;
17869 -                               int len, err;
17870 -
17871 -                               if (copy_from_user(&uprog, (void *) arg, sizeof(uprog)))
17872 -                                       return -EFAULT;
17873 -                               if (uprog.len > 0 && uprog.len < 65536) {
17874 -                                       len = uprog.len * sizeof(struct sock_filter);
17875 -                                       code = kmalloc(len, GFP_KERNEL);
17876 -                                       if (code == NULL)
17877 -                                               return -ENOMEM;
17878 -                                       if (copy_from_user(code, uprog.filter, len)) {
17879 -                                               kfree(code);
17880 -                                               return -EFAULT;
17881 -                                       }
17882 -                                       err = sk_chk_filter(code, uprog.len);
17883 -                                       if (err) {
17884 -                                               kfree(code);
17885 -                                               return err;
17886 -                                       }
17887 -                               }
17888 -                               filtp = (cmd == PPPIOCSPASS) ? &is->pass_filter : &is->active_filter;
17889 -                               if (filtp->filter)
17890 -                                       kfree(filtp->filter);
17891 -                               filtp->filter = code;
17892 -                               filtp->len = uprog.len;
17893 -                               break;
17894 -                       }
17895 -#endif /* CONFIG_IPPP_FILTER */
17896                 default:
17897                         break;
17898         }
17899 @@ -699,7 +644,7 @@
17900         struct ippp_struct *is;
17901  
17902         if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
17903 -               printk(KERN_WARNING "ippp: illegal slot(%d).\n", slot);
17904 +               printk(KERN_WARNING "ippp: illegal slot.\n");
17905                 return 0;
17906         }
17907         is = ippp_table[slot];
17908 @@ -976,8 +921,7 @@
17909  
17910         slot = lp->ppp_slot;
17911         if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17912 -               printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot(%d)\n",
17913 -                       lp->ppp_slot);
17914 +               printk(KERN_ERR "isdn_ppp_receive: lp->ppp_slot %d\n", lp->ppp_slot);
17915                 kfree_skb(skb);
17916                 return;
17917         }
17918 @@ -1026,23 +970,19 @@
17919  {
17920         struct net_device *dev = &net_dev->dev;
17921         struct ippp_struct *is, *mis;
17922 -       isdn_net_local *mlp = NULL;
17923         int slot;
17924  
17925         slot = lp->ppp_slot;
17926         if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17927 -               printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot(%d)\n",
17928 -                       lp->ppp_slot);
17929 +               printk(KERN_ERR "isdn_ppp_push_higher: lp->ppp_slot %d\n", lp->ppp_slot);
17930                 goto drop_packet;
17931         }
17932         is = ippp_table[slot];
17933         
17934         if (lp->master) { // FIXME?
17935 -               mlp = (isdn_net_local *) lp->master->priv;
17936 -               slot = mlp->ppp_slot;
17937 +               slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
17938                 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
17939 -                       printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n",
17940 -                               lp->ppp_slot);
17941 +                       printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot %d\n", lp->ppp_slot);
17942                         goto drop_packet;
17943                 }
17944         }
17945 @@ -1076,11 +1016,6 @@
17946                 case PPP_VJC_UNCOMP:
17947                         if (is->debug & 0x20)
17948                                 printk(KERN_DEBUG "isdn_ppp: VJC_UNCOMP\n");
17949 -                       if (net_dev->local->ppp_slot < 0) {
17950 -                               printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n",
17951 -                                       __FUNCTION__, net_dev->local->ppp_slot);
17952 -                               goto drop_packet;
17953 -                       }
17954                         if (slhc_remember(ippp_table[net_dev->local->ppp_slot]->slcomp, skb->data, skb->len) <= 0) {
17955                                 printk(KERN_WARNING "isdn_ppp: received illegal VJC_UNCOMP frame!\n");
17956                                 goto drop_packet;
17957 @@ -1102,11 +1037,6 @@
17958                                 }
17959                                 skb_put(skb, skb_old->len + 128);
17960                                 memcpy(skb->data, skb_old->data, skb_old->len);
17961 -                               if (net_dev->local->ppp_slot < 0) {
17962 -                                       printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n",
17963 -                                               __FUNCTION__, net_dev->local->ppp_slot);
17964 -                                       goto drop_packet;
17965 -                               }
17966                                 pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp,
17967                                                 skb->data, skb_old->len);
17968                                 kfree_skb(skb_old);
17969 @@ -1133,36 +1063,12 @@
17970                         return;
17971         }
17972  
17973 -#ifdef CONFIG_IPPP_FILTER
17974 -       /* check if the packet passes the pass and active filters
17975 -        * the filter instructions are constructed assuming
17976 -        * a four-byte PPP header on each packet (which is still present) */
17977 -       skb_push(skb, 4);
17978 -       skb->data[0] = 0;       /* indicate inbound */
17979 -
17980 -       if (is->pass_filter.filter
17981 -           && sk_run_filter(skb, is->pass_filter.filter,
17982 -                           is->pass_filter.len) == 0) {
17983 -               if (is->debug & 0x2)
17984 -                       printk(KERN_DEBUG "IPPP: inbound frame filtered.\n");
17985 -               kfree_skb(skb);
17986 -               return;
17987 -       }
17988 -       if (!(is->active_filter.filter
17989 -             && sk_run_filter(skb, is->active_filter.filter,
17990 -                              is->active_filter.len) == 0)) {
17991 -               if (is->debug & 0x2)
17992 -                       printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
17993 -               lp->huptimer = 0;
17994 -               if (mlp)
17995 -                       mlp->huptimer = 0;
17996 -       }
17997 -       skb_pull(skb, 4);
17998 -#else /* CONFIG_IPPP_FILTER */
17999 -       lp->huptimer = 0;
18000 -       if (mlp)
18001 -               mlp->huptimer = 0;
18002 -#endif /* CONFIG_IPPP_FILTER */
18003 +       /* Reset hangup-timer */
18004 +       lp->huptimer = 0;
18005 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
18006 +       lp->dw_abc_bchan_errcnt = 0;
18007 +#endif
18008 +
18009         skb->dev = dev;
18010         skb->mac.raw = skb->data;
18011         netif_rx(skb);
18012 @@ -1199,6 +1105,7 @@
18013         return skb_push(skb,len);
18014  }
18015  
18016 +
18017  /*
18018   * send ppp frame .. we expect a PIDCOMPressable proto --
18019   *  (here: currently always PPP_IP,PPP_VJC_COMP,PPP_VJC_UNCOMP)
18020 @@ -1214,25 +1121,23 @@
18021         isdn_net_dev *nd;
18022         unsigned int proto = PPP_IP;     /* 0x21 */
18023         struct ippp_struct *ipt,*ipts;
18024 -       int slot, retval = 0;
18025 +       int slot;
18026  
18027         mlp = (isdn_net_local *) (netdev->priv);
18028         nd = mlp->netdev;       /* get master lp */
18029  
18030         slot = mlp->ppp_slot;
18031         if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18032 -               printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
18033 -                       mlp->ppp_slot);
18034 +               printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot %d\n", mlp->ppp_slot);
18035                 kfree_skb(skb);
18036 -               goto out;
18037 +               return 0;
18038         }
18039         ipts = ippp_table[slot];
18040  
18041         if (!(ipts->pppcfg & SC_ENABLE_IP)) {   /* PPP connected ? */
18042                 if (ipts->debug & 0x1)
18043                         printk(KERN_INFO "%s: IP frame delayed.\n", netdev->name);
18044 -               retval = 1;
18045 -               goto out;
18046 +               return 1;
18047         }
18048  
18049         switch (ntohs(skb->protocol)) {
18050 @@ -1246,25 +1151,24 @@
18051                         printk(KERN_ERR "isdn_ppp: skipped unsupported protocol: %#x.\n", 
18052                                skb->protocol);
18053                         dev_kfree_skb(skb);
18054 -                       goto out;
18055 +                       return 0;
18056         }
18057  
18058         lp = isdn_net_get_locked_lp(nd);
18059         if (!lp) {
18060                 printk(KERN_WARNING "%s: all channels busy - requeuing!\n", netdev->name);
18061 -               retval = 1;
18062 -               goto out;
18063 +               return 1;
18064         }
18065         /* we have our lp locked from now on */
18066  
18067         slot = lp->ppp_slot;
18068         if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18069 -               printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot(%d)\n",
18070 -                       lp->ppp_slot);
18071 +               printk(KERN_ERR "isdn_ppp_xmit: lp->ppp_slot %d\n", lp->ppp_slot);
18072                 kfree_skb(skb);
18073 -               goto unlock;
18074 +               return 0;
18075         }
18076         ipt = ippp_table[slot];
18077 +       lp->huptimer = 0;
18078  
18079         /*
18080          * after this line .. requeueing in the device queue is no longer allowed!!!
18081 @@ -1275,34 +1179,6 @@
18082          */
18083         skb_pull(skb,IPPP_MAX_HEADER);
18084  
18085 -#ifdef CONFIG_IPPP_FILTER
18086 -       /* check if we should pass this packet
18087 -        * the filter instructions are constructed assuming
18088 -        * a four-byte PPP header on each packet */
18089 -       skb_push(skb, 4);
18090 -       skb->data[0] = 1;       /* indicate outbound */
18091 -       *(u_int16_t *)(skb->data + 2) = htons(proto);
18092 -
18093 -       if (ipt->pass_filter.filter 
18094 -           && sk_run_filter(skb, ipt->pass_filter.filter,
18095 -                            ipt->pass_filter.len) == 0) {
18096 -               if (ipt->debug & 0x4)
18097 -                       printk(KERN_DEBUG "IPPP: outbound frame filtered.\n");
18098 -               kfree_skb(skb);
18099 -               goto unlock;
18100 -       }
18101 -       if (!(ipt->active_filter.filter
18102 -             && sk_run_filter(skb, ipt->active_filter.filter,
18103 -                              ipt->active_filter.len) == 0)) {
18104 -               if (ipt->debug & 0x4)
18105 -                       printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
18106 -               lp->huptimer = 0;
18107 -       }
18108 -       skb_pull(skb, 4);
18109 -#else /* CONFIG_IPPP_FILTER */
18110 -       lp->huptimer = 0;
18111 -#endif /* CONFIG_IPPP_FILTER */
18112 -
18113         if (ipt->debug & 0x4)
18114                 printk(KERN_DEBUG "xmit skb, len %d\n", (int) skb->len);
18115          if (ipts->debug & 0x40)
18116 @@ -1440,54 +1316,9 @@
18117  
18118   unlock:
18119         spin_unlock_bh(&lp->xmit_lock);
18120 - out:
18121 -       return retval;
18122 +       return 0;
18123  }
18124  
18125 -#ifdef CONFIG_IPPP_FILTER
18126 -/*
18127 - * check if this packet may trigger auto-dial.
18128 - */
18129 -
18130 -int isdn_ppp_autodial_filter(struct sk_buff *skb, isdn_net_local *lp)
18131 -{
18132 -       struct ippp_struct *is = ippp_table[lp->ppp_slot];
18133 -       u_int16_t proto;
18134 -       int drop = 0;
18135 -
18136 -       switch (ntohs(skb->protocol)) {
18137 -       case ETH_P_IP:
18138 -               proto = PPP_IP;
18139 -               break;
18140 -       case ETH_P_IPX:
18141 -               proto = PPP_IPX;
18142 -               break;
18143 -       default:
18144 -               printk(KERN_ERR "isdn_ppp_autodial_filter: unsupported protocol 0x%x.\n",
18145 -                      skb->protocol);
18146 -               return 1;
18147 -       }
18148 -
18149 -       /* the filter instructions are constructed assuming
18150 -        * a four-byte PPP header on each packet. we have to
18151 -        * temporarily remove part of the fake header stuck on
18152 -        * earlier.
18153 -        */
18154 -       skb_pull(skb, IPPP_MAX_HEADER - 4);
18155 -       skb->data[0] = 1;       /* indicate outbound */
18156 -       *(u_int16_t *)(skb->data + 2) = htons(proto);
18157 -       
18158 -       drop |= is->pass_filter.filter
18159 -               && sk_run_filter(skb, is->pass_filter.filter,
18160 -                                is->pass_filter.len) == 0;
18161 -       drop |= is->active_filter.filter
18162 -               && sk_run_filter(skb, is->active_filter.filter,
18163 -                                is->active_filter.len) == 0;
18164 -       
18165 -       skb_push(skb, IPPP_MAX_HEADER - 4);
18166 -       return drop;
18167 -}
18168 -#endif
18169  #ifdef CONFIG_ISDN_MPP
18170  
18171  /* this is _not_ rfc1990 header, but something we convert both short and long
18172 @@ -1537,15 +1368,8 @@
18173  
18174  static int isdn_ppp_mp_init( isdn_net_local * lp, ippp_bundle * add_to )
18175  {
18176 -       struct ippp_struct * is;
18177 -
18178 -       if (lp->ppp_slot < 0) {
18179 -               printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
18180 -                       __FUNCTION__, lp->ppp_slot);
18181 -               return(-EINVAL);
18182 -       }
18183 -
18184 -       is = ippp_table[lp->ppp_slot];
18185 +       struct ippp_struct * is = ippp_table[lp->ppp_slot];
18186 +   
18187         if (add_to) {
18188                 if( lp->netdev->pb )
18189                         lp->netdev->pb->ref_ct--;
18190 @@ -1591,8 +1415,7 @@
18191          stats = &mp->stats;
18192         slot = lp->ppp_slot;
18193         if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18194 -               printk(KERN_ERR "%s: lp->ppp_slot(%d)\n",
18195 -                       __FUNCTION__, lp->ppp_slot);
18196 +               printk(KERN_ERR "isdn_ppp_mp_receive: lp->ppp_slot %d\n", lp->ppp_slot);
18197                 stats->frame_drops++;
18198                 dev_kfree_skb(skb);
18199                 spin_unlock_irqrestore(&mp->lock, flags);
18200 @@ -1628,8 +1451,7 @@
18201         for (lpq = net_dev->queue;;) {
18202                 slot = lpq->ppp_slot;
18203                 if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18204 -                       printk(KERN_ERR "%s: lpq->ppp_slot(%d)\n",
18205 -                               __FUNCTION__, lpq->ppp_slot);
18206 +                       printk(KERN_ERR "isdn_ppp_mp_receive: lpq->ppp_slot %d\n", lpq->ppp_slot);
18207                 } else {
18208                         u32 lls = ippp_table[slot]->last_link_seqno;
18209                         if (MP_LT(lls, minseq))
18210 @@ -1861,14 +1683,9 @@
18211         struct sk_buff * skb;
18212         unsigned int tot_len;
18213  
18214 -       if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
18215 -               printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
18216 -                       __FUNCTION__, lp->ppp_slot);
18217 -               return;
18218 -       }
18219         if( MP_FLAGS(from) == (MP_BEGIN_FRAG | MP_END_FRAG) ) {
18220                 if( ippp_table[lp->ppp_slot]->debug & 0x40 )
18221 -                       printk(KERN_DEBUG "isdn_mppp: reassembly: frame %d, "
18222 +                       printk(KERN_DEBUG"isdn_mppp: reassembly: frame %d, "
18223                                         "len %d\n", MP_SEQ(from), from->len );
18224                 skb = from;
18225                 skb_pull(skb, MP_HEADER_LEN);
18226 @@ -1987,10 +1804,8 @@
18227         memset(&t, 0, sizeof(struct ppp_stats));
18228         if (dev->flags & IFF_UP) {
18229                 t.p.ppp_ipackets = lp->stats.rx_packets;
18230 -               t.p.ppp_ibytes = lp->stats.rx_bytes;
18231                 t.p.ppp_ierrors = lp->stats.rx_errors;
18232                 t.p.ppp_opackets = lp->stats.tx_packets;
18233 -               t.p.ppp_obytes = lp->stats.tx_bytes;
18234                 t.p.ppp_oerrors = lp->stats.tx_errors;
18235  #ifdef CONFIG_ISDN_PPP_VJ
18236                 if (slot >= 0 && ippp_table[slot]->slcomp) {
18237 @@ -2018,6 +1833,9 @@
18238         int len;
18239         isdn_net_local *lp = (isdn_net_local *) dev->priv;
18240  
18241 +#if 0
18242 +       printk(KERN_DEBUG "ippp, dev_ioctl: cmd %#08x , %d \n", cmd, lp->ppp_slot);
18243 +#endif
18244  
18245         if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP)
18246                 return -EINVAL;
18247 @@ -2431,7 +2249,7 @@
18248                                 return;
18249                         }
18250                         rs->state = CCPResetSentReq;
18251 -                       /* We always expect an Ack if the decompressor doesn't
18252 +                       /* We always expect an Ack if the decompressor doesnt
18253                            know better */
18254                         rs->expra = 1;
18255                         rs->dlen = 0;
18256 @@ -2582,7 +2400,13 @@
18257      }
18258  
18259         if(type) { /* type=1 => Link compression */
18260 +#if 0
18261 +               compressor = is->link_compressor;
18262 +               stat = is->link_comp_stat;
18263 +               new_proto = PPP_LINK_COMP;
18264 +#else
18265                 return skb_in;
18266 +#endif
18267         }
18268         else {
18269                 if(!master) {
18270 @@ -2630,31 +2454,18 @@
18271  static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
18272          struct sk_buff *skb,int proto)
18273  {
18274 -       struct ippp_struct *is;
18275 +       struct ippp_struct *is = ippp_table[lp->ppp_slot];
18276         struct ippp_struct *mis;
18277         int len;
18278         struct isdn_ppp_resetparams rsparm;
18279         unsigned char rsdata[IPPP_RESET_MAXDATABYTES];  
18280  
18281 -       printk(KERN_DEBUG "Received CCP frame from peer slot(%d)\n",
18282 -               lp->ppp_slot);
18283 -       if (lp->ppp_slot < 0 || lp->ppp_slot > ISDN_MAX_CHANNELS) {
18284 -               printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
18285 -                       __FUNCTION__, lp->ppp_slot);
18286 -               return;
18287 -       }
18288 -       is = ippp_table[lp->ppp_slot];
18289 +       printk(KERN_DEBUG "Received CCP frame from peer\n");
18290         isdn_ppp_frame_log("ccp-rcv", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
18291  
18292 -       if(lp->master) {
18293 -               int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
18294 -               if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18295 -                       printk(KERN_ERR "%s: slot(%d) out of range\n",
18296 -                               __FUNCTION__, slot);
18297 -                       return;
18298 -               }       
18299 -               mis = ippp_table[slot];
18300 -       } else
18301 +       if(lp->master)
18302 +               mis = ippp_table[((isdn_net_local *) (lp->master->priv))->ppp_slot];
18303 +       else
18304                 mis = is;
18305  
18306         switch(skb->data[0]) {
18307 @@ -2806,18 +2617,13 @@
18308  
18309  static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, struct sk_buff *skb)
18310  {
18311 -       struct ippp_struct *mis,*is;
18312 -       int proto, slot = lp->ppp_slot;
18313 +       struct ippp_struct *mis,*is = ippp_table[lp->ppp_slot];
18314 +       int proto;
18315         unsigned char *data;
18316  
18317         if(!skb || skb->len < 3)
18318                 return;
18319 -       if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18320 -               printk(KERN_ERR "%s: lp->ppp_slot(%d) out of range\n",
18321 -                       __FUNCTION__, slot);
18322 -               return;
18323 -       }       
18324 -       is = ippp_table[slot];
18325 +
18326         /* Daemon may send with or without address and control field comp */
18327         data = skb->data;
18328         if(!(is->pppcfg & SC_COMP_AC) && data[0] == 0xff && data[1] == 0x03) {
18329 @@ -2833,17 +2639,12 @@
18330         printk(KERN_DEBUG "Received CCP frame from daemon:\n");
18331         isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, is->unit,lp->ppp_slot);
18332  
18333 -       if (lp->master) {
18334 -               slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot;
18335 -               if (slot < 0 || slot > ISDN_MAX_CHANNELS) {
18336 -                       printk(KERN_ERR "%s: slot(%d) out of range\n",
18337 -                               __FUNCTION__, slot);
18338 -                       return;
18339 -               }       
18340 -               mis = ippp_table[slot];
18341 -       } else
18342 -               mis = is;
18343 -       if (mis != is)
18344 +        if(lp->master)
18345 +                mis = ippp_table[((isdn_net_local *) (lp->master->priv))->ppp_slot];
18346 +        else
18347 +                mis = is;
18348 +       
18349 +       if(mis != is)
18350                 printk(KERN_DEBUG "isdn_ppp: Ouch! Master CCP sends on slave slot!\n");
18351         
18352          switch(data[2]) {
18353 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ppp.h linux-2.4.29/drivers/isdn/isdn_ppp.h
18354 --- linux-2.4.29.old/drivers/isdn/isdn_ppp.h    2005-03-22 14:47:56.000000000 +0100
18355 +++ linux-2.4.29/drivers/isdn/isdn_ppp.h        2005-03-22 15:06:44.497328160 +0100
18356 @@ -1,4 +1,4 @@
18357 -/* $Id: isdn_ppp.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18358 +/* $Id: isdn_ppp.h,v 1.18 2001/09/24 13:22:42 kai Exp $
18359   *
18360   * header for Linux ISDN subsystem, functions for synchronous PPP (linklevel).
18361   *
18362 @@ -19,7 +19,6 @@
18363  extern void isdn_ppp_cleanup(void);
18364  extern int isdn_ppp_free(isdn_net_local *);
18365  extern int isdn_ppp_bind(isdn_net_local *);
18366 -extern int isdn_ppp_autodial_filter(struct sk_buff *, isdn_net_local *);
18367  extern int isdn_ppp_xmit(struct sk_buff *, struct net_device *);
18368  extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *);
18369  extern int isdn_ppp_dev_ioctl(struct net_device *, struct ifreq *, int);
18370 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_tty.c linux-2.4.29/drivers/isdn/isdn_tty.c
18371 --- linux-2.4.29.old/drivers/isdn/isdn_tty.c    2005-03-22 14:47:56.000000000 +0100
18372 +++ linux-2.4.29/drivers/isdn/isdn_tty.c        2005-03-22 15:06:44.524324056 +0100
18373 @@ -1,4 +1,4 @@
18374 -/* $Id: isdn_tty.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18375 +/* $Id: isdn_tty.c,v 1.104 2002/02/09 21:19:11 keil Exp $
18376   *
18377   * Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
18378   *
18379 @@ -53,7 +53,7 @@
18380  static int si2bit[8] =
18381  {4, 1, 4, 4, 4, 4, 4, 4};
18382  
18383 -char *isdn_tty_revision = "$Revision: 1.1.4.1 $";
18384 +char *isdn_tty_revision = "$Revision: 1.104 $";
18385  
18386  
18387  /* isdn_tty_try_read() is called from within isdn_tty_rcv_skb()
18388 @@ -321,7 +321,10 @@
18389                 info->send_outstanding++;
18390                 info->msr &= ~UART_MSR_CTS;
18391                 info->lsr &= ~UART_LSR_TEMT;
18392 -               tty_wakeup(tty);
18393 +               if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
18394 +                   tty->ldisc.write_wakeup)
18395 +                       (tty->ldisc.write_wakeup) (tty);
18396 +               wake_up_interruptible(&tty->write_wait);
18397                 return;
18398         }
18399         if (slen < 0) {
18400 @@ -1211,7 +1214,10 @@
18401                                                 /* If DLE decoding results in zero-transmit, but
18402                                                  * c originally was non-zero, do a wakeup.
18403                                                  */
18404 -                                               tty_wakeup(tty);
18405 +                                               if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
18406 +                                                tty->ldisc.write_wakeup)
18407 +                                                       (tty->ldisc.write_wakeup) (tty);
18408 +                                               wake_up_interruptible(&tty->write_wait);
18409                                                 info->msr |= UART_MSR_CTS;
18410                                                 info->lsr |= UART_LSR_TEMT;
18411                                         }
18412 @@ -1232,6 +1238,7 @@
18413                                         }
18414                                 }
18415                         } else
18416 +#ifdef ISDN_TTY_FCLASS1
18417                         if (TTY_IS_FCLASS1(info)) {
18418                                 int cc = isdn_tty_handleDLEdown(info, m, c);
18419                                 
18420 @@ -1252,6 +1259,7 @@
18421                                 info->xmit_count += cc;
18422                         } else
18423  #endif
18424 +#endif
18425                                 info->xmit_count += c;
18426                 } else {
18427                         info->msr |= UART_MSR_CTS;
18428 @@ -1329,7 +1337,10 @@
18429         isdn_tty_cleanup_xmit(info);
18430         info->xmit_count = 0;
18431         restore_flags(flags);
18432 -       tty_wakeup(tty);
18433 +       wake_up_interruptible(&tty->write_wait);
18434 +       if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
18435 +           tty->ldisc.write_wakeup)
18436 +               (tty->ldisc.write_wakeup) (tty);
18437  }
18438  
18439  static void
18440 @@ -1858,7 +1869,8 @@
18441         isdn_tty_shutdown(info);
18442         if (tty->driver.flush_buffer)
18443                 tty->driver.flush_buffer(tty);
18444 -       tty_ldisc_flush(tty);
18445 +       if (tty->ldisc.flush_buffer)
18446 +               tty->ldisc.flush_buffer(tty);
18447         info->tty = 0;
18448         info->ncarrier = 0;
18449         tty->closing = 0;
18450 @@ -2306,6 +2318,22 @@
18451                                   isdn_tty_at_cout("\r\n", info);
18452                                 }
18453                                 return 1;
18454 +                       case ISDN_STAT_ALERT:
18455 +#ifdef ISDN_TTY_STAT_DEBUG
18456 +                               printk(KERN_DEBUG "tty_STAT_ALERT ttyI%d\n", info->line);
18457 +#endif
18458 +                               /* Signal RINGING to tty-device if requested */
18459 +                               if (info->emu.mdmreg[REG_ALERT] & BIT_ALERT)
18460 +                                       isdn_tty_modem_result(RESULT_RINGING, info);
18461 +                               return 1;
18462 +                       case ISDN_STAT_PROCEED:
18463 +#ifdef ISDN_TTY_STAT_DEBUG
18464 +                               printk(KERN_DEBUG "tty_STAT_PROCEED ttyI%d\n", info->line);
18465 +#endif
18466 +                               /* Signal PROCEEDING to tty-device if requested */
18467 +                               if (info->emu.mdmreg[REG_PROCEED] & BIT_PROCEED)
18468 +                                       isdn_tty_modem_result(RESULT_PROCEEDING, info);
18469 +                               return 1;
18470                         case ISDN_STAT_DCONN:
18471  #ifdef ISDN_TTY_STAT_DEBUG
18472                                 printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line);
18473 @@ -2618,7 +2646,7 @@
18474         static char *msg[] =
18475         {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR",
18476          "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER",
18477 -        "RINGING", "NO MSN/EAZ", "VCON", "RUNG"};
18478 +        "RINGING", "NO MSN/EAZ", "VCON", "RUNG", "PROCEEDING"};
18479         ulong flags;
18480         char s[ISDN_MSNLEN+10];
18481  
18482 @@ -2781,7 +2809,8 @@
18483                         restore_flags(flags);
18484                         return;
18485                 }
18486 -               tty_ldisc_flush(info->tty);
18487 +               if (info->tty->ldisc.flush_buffer)
18488 +                       info->tty->ldisc.flush_buffer(info->tty);
18489                 if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
18490                     (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
18491                        (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
18492 @@ -3296,9 +3325,11 @@
18493  #ifdef CONFIG_ISDN_TTY_FAX
18494                                 if (TTY_IS_FCLASS2(info))
18495                                                 sprintf(rs, "\r\n2");
18496 +#ifdef ISDN_TTY_FCLASS1
18497                                 else if (TTY_IS_FCLASS1(info))
18498                                                 sprintf(rs, "\r\n1");
18499  #endif
18500 +#endif
18501                                 isdn_tty_at_cout(rs, info);
18502                                 break;
18503                         case '=':
18504 @@ -3313,6 +3344,7 @@
18505                                                     m->mdmreg[REG_PSIZE] * 16;
18506                                                 break;
18507  #ifdef CONFIG_ISDN_TTY_FAX
18508 +#ifdef ISDN_TTY_FCLASS1
18509                                         case '1':
18510                                                 p[0]++;
18511                                                 if (!(dev->global_features &
18512 @@ -3324,6 +3356,7 @@
18513                                                 info->xmit_size =
18514                                                     m->mdmreg[REG_PSIZE] * 16;
18515                                                 break;
18516 +#endif
18517                                         case '2':
18518                                                 p[0]++;
18519                                                 if (!(dev->global_features &
18520 @@ -3348,9 +3381,11 @@
18521                                                 p[0]++;
18522                                                 strcpy(rs, "\r\n0,");
18523  #ifdef CONFIG_ISDN_TTY_FAX
18524 +#ifdef ISDN_TTY_FCLASS1
18525                                                 if (dev->global_features &
18526                                                         ISDN_FEATURE_L3_FCLASS1)
18527                                                         strcat(rs, "1,");
18528 +#endif
18529                                                 if (dev->global_features &
18530                                                         ISDN_FEATURE_L3_FCLASS2)
18531                                                         strcat(rs, "2,");
18532 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_tty.h linux-2.4.29/drivers/isdn/isdn_tty.h
18533 --- linux-2.4.29.old/drivers/isdn/isdn_tty.h    2005-03-22 14:47:56.000000000 +0100
18534 +++ linux-2.4.29/drivers/isdn/isdn_tty.h        2005-03-22 15:06:44.545320864 +0100
18535 @@ -1,4 +1,4 @@
18536 -/* $Id: isdn_tty.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18537 +/* $Id: isdn_tty.h,v 1.25 2002/02/09 21:19:11 keil Exp $
18538   *
18539   * header for Linux ISDN subsystem, tty related functions (linklevel).
18540   *
18541 @@ -78,6 +78,10 @@
18542  #define BIT_CPNFCON   2
18543  #define REG_CDN      23
18544  #define BIT_CDN       4
18545 +#define REG_ALERT    23
18546 +#define BIT_ALERT     8
18547 +#define REG_PROCEED  23
18548 +#define BIT_PROCEED  16
18549  
18550  /* defines for result codes */
18551  #define RESULT_OK              0
18552 @@ -93,10 +97,13 @@
18553  #define RESULT_NO_MSN_EAZ      10
18554  #define RESULT_VCON            11
18555  #define RESULT_RUNG            12
18556 +#define RESULT_PROCEEDING      13
18557  
18558 +#ifdef ISDN_TTY_FCLASS1
18559  #define TTY_IS_FCLASS1(info) \
18560         ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
18561          (info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS1))
18562 +#endif
18563  #define TTY_IS_FCLASS2(info) \
18564         ((info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_FAX) && \
18565          (info->emu.mdmreg[REG_L3PROT] == ISDN_PROTO_L3_FCLASS2))
18566 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ttyfax.c linux-2.4.29/drivers/isdn/isdn_ttyfax.c
18567 --- linux-2.4.29.old/drivers/isdn/isdn_ttyfax.c 2005-03-22 14:47:56.000000000 +0100
18568 +++ linux-2.4.29/drivers/isdn/isdn_ttyfax.c     2005-03-22 15:06:44.561318432 +0100
18569 @@ -1,4 +1,4 @@
18570 -/* $Id: isdn_ttyfax.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18571 +/* $Id: isdn_ttyfax.c,v 1.9 2001/09/24 13:22:43 kai Exp $
18572   *
18573   * Linux ISDN subsystem, tty_fax AT-command emulator (linklevel).
18574   *
18575 @@ -20,7 +20,7 @@
18576  #include "isdn_ttyfax.h"
18577  
18578  
18579 -static char *isdn_tty_fax_revision = "$Revision: 1.1.4.1 $";
18580 +static char *isdn_tty_fax_revision = "$Revision: 1.9 $";
18581  
18582  #define PARSE_ERROR1 { isdn_tty_fax_modem_result(1, info); return 1; }
18583  
18584 @@ -148,6 +148,7 @@
18585         }
18586  }
18587  
18588 +#ifdef ISDN_TTY_FCLASS1
18589  int
18590  isdn_tty_fax_command1(modem_info * info, isdn_ctrl * c)
18591  {
18592 @@ -186,6 +187,7 @@
18593         }
18594         return (0);
18595  }
18596 +#endif
18597  
18598  int
18599  isdn_tty_fax_command(modem_info * info, isdn_ctrl * c)
18600 @@ -193,8 +195,10 @@
18601         T30_s *f = info->fax;
18602         char rs[10];
18603  
18604 +#ifdef ISDN_TTY_FCLASS1
18605         if (TTY_IS_FCLASS1(info))
18606                 return (isdn_tty_fax_command1(info, c));
18607 +#endif
18608  
18609  #ifdef ISDN_TTY_FAX_CMD_DEBUG
18610         printk(KERN_DEBUG "isdn_tty: Fax cmd %d on ttyI%d\n",
18611 @@ -312,6 +316,7 @@
18612         }
18613  }
18614  
18615 +#ifdef ISDN_TTY_FCLASS1
18616  /*
18617   * Parse AT+F.. FAX class 1 commands
18618   */
18619 @@ -403,6 +408,7 @@
18620         }
18621         return 1;
18622  }
18623 +#endif
18624  
18625  /*
18626   * Parse AT+F.. FAX class 2 commands
18627 @@ -970,6 +976,70 @@
18628                 }
18629                 return 0;
18630         }
18631 +#if 0
18632 +       /* LO=n - Flow control opts */
18633 +       if (!strncmp(p[0], "LO", 2)) {  /* TODO */
18634 +               p[0] += 2;
18635 +               switch (*p[0]) {
18636 +                       case '?':
18637 +                               p[0]++;
18638 +                               sprintf(rs, "\r\n%d", f->lo);
18639 +                               isdn_tty_at_cout(rs, info);
18640 +                               break;
18641 +                       case '=':
18642 +                               p[0]++;
18643 +                               if (*p[0] == '?') {
18644 +                                       p[0]++;
18645 +                                       sprintf(rs, "\r\n0,1,2");
18646 +                                       isdn_tty_at_cout(rs, info);
18647 +                               } else {
18648 +                                       par = isdn_getnum(p);
18649 +                                       if ((par < 0) || (par > 2))
18650 +                                               PARSE_ERROR1;
18651 +                                       f->lo = par;
18652 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18653 +                                       printk(KERN_DEBUG "isdn_tty: Fax FLO=%d\n", par);
18654 +#endif
18655 +                               }
18656 +                               break;
18657 +                       default:
18658 +                               PARSE_ERROR1;
18659 +               }
18660 +               return 0;
18661 +       }
18662 +#endif
18663 +#if 0
18664 +       /* LPL=n - Doc for polling cmd  */
18665 +       if (!strncmp(p[0], "LPL", 3)) {         /* TODO */
18666 +               p[0] += 3;
18667 +               switch (*p[0]) {
18668 +                       case '?':
18669 +                               p[0]++;
18670 +                               sprintf(rs, "\r\n%d", f->lpl);
18671 +                               isdn_tty_at_cout(rs, info);
18672 +                               break;
18673 +                       case '=':
18674 +                               p[0]++;
18675 +                               if (*p[0] == '?') {
18676 +                                       p[0]++;
18677 +                                       sprintf(rs, "\r\n0,1");
18678 +                                       isdn_tty_at_cout(rs, info);
18679 +                               } else {
18680 +                                       par = isdn_getnum(p);
18681 +                                       if ((par < 0) || (par > 1))
18682 +                                               PARSE_ERROR1;
18683 +                                       f->lpl = par;
18684 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18685 +                                       printk(KERN_DEBUG "isdn_tty: Fax FLPL=%d\n", par);
18686 +#endif
18687 +                               }
18688 +                               break;
18689 +                       default:
18690 +                               PARSE_ERROR1;
18691 +               }
18692 +               return 0;
18693 +       }
18694 +#endif
18695  
18696         /* MDL? - DCE Model       */
18697         if (!strncmp(p[0], "MDL?", 4)) {
18698 @@ -1049,6 +1119,38 @@
18699                 }
18700                 return 0;
18701         }
18702 +#if 0
18703 +       /* PTS=n - Page transfer status       */
18704 +       if (!strncmp(p[0], "PTS", 3)) {         /* TODO */
18705 +               p[0] += 3;
18706 +               switch (*p[0]) {
18707 +                       case '?':
18708 +                               p[0]++;
18709 +                               sprintf(rs, "\r\n%d", f->pts);
18710 +                               isdn_tty_at_cout(rs, info);
18711 +                               break;
18712 +                       case '=':
18713 +                               p[0]++;
18714 +                               if (*p[0] == '?') {
18715 +                                       p[0]++;
18716 +                                       sprintf(rs, "\r\n0-5");
18717 +                                       isdn_tty_at_cout(rs, info);
18718 +                               } else {
18719 +                                       par = isdn_getnum(p);
18720 +                                       if ((par < 0) || (par > 5))
18721 +                                               PARSE_ERROR1;
18722 +                                       f->pts = par;
18723 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18724 +                                       printk(KERN_DEBUG "isdn_tty: Fax FPTS=%d\n", par);
18725 +#endif
18726 +                               }
18727 +                               break;
18728 +                       default:
18729 +                               PARSE_ERROR1;
18730 +               }
18731 +               return 0;
18732 +       }
18733 +#endif
18734  
18735         /* REL=n - Phase C received EOL alignment */
18736         if (!strncmp(p[0], "REL", 3)) {
18737 @@ -1091,6 +1193,38 @@
18738                 isdn_tty_at_cout(rs, info);
18739                 return 0;
18740         }
18741 +#if 0
18742 +       /* SPL=n - Enable polling */
18743 +       if (!strncmp(p[0], "SPL", 3)) {         /* TODO */
18744 +               p[0] += 3;
18745 +               switch (*p[0]) {
18746 +                       case '?':
18747 +                               p[0]++;
18748 +                               sprintf(rs, "\r\n%d", f->spl);
18749 +                               isdn_tty_at_cout(rs, info);
18750 +                               break;
18751 +                       case '=':
18752 +                               p[0]++;
18753 +                               if (*p[0] == '?') {
18754 +                                       p[0]++;
18755 +                                       sprintf(rs, "\r\n0,1");
18756 +                                       isdn_tty_at_cout(rs, info);
18757 +                               } else {
18758 +                                       par = isdn_getnum(p);
18759 +                                       if ((par < 0) || (par > 1))
18760 +                                               PARSE_ERROR1;
18761 +                                       f->spl = par;
18762 +#ifdef ISDN_TTY_FAX_STAT_DEBUG
18763 +                                       printk(KERN_DEBUG "isdn_tty: Fax FSPL=%d\n", par);
18764 +#endif
18765 +                               }
18766 +                               break;
18767 +                       default:
18768 +                               PARSE_ERROR1;
18769 +               }
18770 +               return 0;
18771 +       }
18772 +#endif
18773  
18774         /* Phase C Transmit Data Block Size */
18775         if (!strncmp(p[0], "TBC=", 4)) {        /* dummy, not used */
18776 @@ -1116,7 +1250,9 @@
18777  {
18778         if (TTY_IS_FCLASS2(info))
18779                 return (isdn_tty_cmd_FCLASS2(p, info));
18780 +#ifdef ISDN_TTY_FCLASS1
18781         else if (TTY_IS_FCLASS1(info))
18782                 return (isdn_tty_cmd_FCLASS1(p, info));
18783 +#endif
18784         PARSE_ERROR1;
18785  }
18786 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_ttyfax.h linux-2.4.29/drivers/isdn/isdn_ttyfax.h
18787 --- linux-2.4.29.old/drivers/isdn/isdn_ttyfax.h 2005-03-22 14:47:56.000000000 +0100
18788 +++ linux-2.4.29/drivers/isdn/isdn_ttyfax.h     2005-03-22 15:06:44.576316152 +0100
18789 @@ -1,4 +1,4 @@
18790 -/* $Id: isdn_ttyfax.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18791 +/* $Id: isdn_ttyfax.h,v 1.3 2001/09/24 13:22:43 kai Exp $
18792   *
18793   * header for Linux ISDN subsystem, tty_fax related functions (linklevel).
18794   *
18795 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_v110.c linux-2.4.29/drivers/isdn/isdn_v110.c
18796 --- linux-2.4.29.old/drivers/isdn/isdn_v110.c   2005-03-22 14:47:56.000000000 +0100
18797 +++ linux-2.4.29/drivers/isdn/isdn_v110.c       2005-03-22 15:06:44.593313568 +0100
18798 @@ -1,4 +1,4 @@
18799 -/* $Id: isdn_v110.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18800 +/* $Id: isdn_v110.c,v 1.8 2001/09/24 13:22:43 kai Exp $
18801   *
18802   * Linux ISDN subsystem, V.110 related functions (linklevel).
18803   *
18804 @@ -19,7 +19,7 @@
18805  
18806  #undef ISDN_V110_DEBUG
18807  
18808 -char *isdn_v110_revision = "$Revision: 1.1.4.1 $";
18809 +char *isdn_v110_revision = "$Revision: 1.8 $";
18810  
18811  #define V110_38400 255
18812  #define V110_19200  15
18813 @@ -138,6 +138,14 @@
18814                 return;
18815  #ifdef ISDN_V110_DEBUG
18816         printk(KERN_DEBUG "v110 close\n");
18817 +#if 0
18818 +       printk(KERN_DEBUG "isdn_v110_close: nbytes=%d\n", v->nbytes);
18819 +       printk(KERN_DEBUG "isdn_v110_close: nbits=%d\n", v->nbits);
18820 +       printk(KERN_DEBUG "isdn_v110_close: key=%d\n", v->key);
18821 +       printk(KERN_DEBUG "isdn_v110_close: SyncInit=%d\n", v->SyncInit);
18822 +       printk(KERN_DEBUG "isdn_v110:close: decodelen=%d\n", v->decodelen);
18823 +       printk(KERN_DEBUG "isdn_v110_close: framelen=%d\n", v->framelen);
18824 +#endif
18825  #endif
18826         kfree(v->encodebuf);
18827         kfree(v);
18828 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_v110.h linux-2.4.29/drivers/isdn/isdn_v110.h
18829 --- linux-2.4.29.old/drivers/isdn/isdn_v110.h   2005-03-22 14:47:56.000000000 +0100
18830 +++ linux-2.4.29/drivers/isdn/isdn_v110.h       2005-03-22 15:06:44.608311288 +0100
18831 @@ -1,4 +1,4 @@
18832 -/* $Id: isdn_v110.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18833 +/* $Id: isdn_v110.h,v 1.5 2001/09/24 13:22:43 kai Exp $
18834   *
18835   * Linux ISDN subsystem, V.110 related functions (linklevel).
18836   *
18837 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_x25iface.c linux-2.4.29/drivers/isdn/isdn_x25iface.c
18838 --- linux-2.4.29.old/drivers/isdn/isdn_x25iface.c       2005-03-22 14:47:56.000000000 +0100
18839 +++ linux-2.4.29/drivers/isdn/isdn_x25iface.c   2005-03-22 15:06:44.626308552 +0100
18840 @@ -1,4 +1,4 @@
18841 -/* $Id: isdn_x25iface.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18842 +/* $Id: isdn_x25iface.c,v 1.10 2001/09/24 13:22:43 kai Exp $
18843   *
18844   * Linux ISDN subsystem, X.25 related functions
18845   *
18846 diff -rNu linux-2.4.29.old/drivers/isdn/isdn_x25iface.h linux-2.4.29/drivers/isdn/isdn_x25iface.h
18847 --- linux-2.4.29.old/drivers/isdn/isdn_x25iface.h       2005-03-22 14:47:56.000000000 +0100
18848 +++ linux-2.4.29/drivers/isdn/isdn_x25iface.h   2005-03-22 15:06:44.645305664 +0100
18849 @@ -1,4 +1,4 @@
18850 -/* $Id: isdn_x25iface.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
18851 +/* $Id: isdn_x25iface.h,v 1.4 2001/09/24 13:22:43 kai Exp $
18852   *
18853   * header for Linux ISDN subsystem, x.25 related functions
18854   *
18855 diff -rNu linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.c linux-2.4.29/drivers/isdn/isdnloop/isdnloop.c
18856 --- linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.c   2005-03-22 14:47:56.000000000 +0100
18857 +++ linux-2.4.29/drivers/isdn/isdnloop/isdnloop.c       2005-03-22 15:06:48.813671976 +0100
18858 @@ -1,4 +1,4 @@
18859 -/* $Id: isdnloop.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
18860 +/* $Id: isdnloop.c,v 1.17 2001/08/30 10:45:42 kai Exp $
18861   *
18862   * ISDN low-level module implementing a dummy loop driver.
18863   *
18864 @@ -14,7 +14,7 @@
18865  #include <linux/init.h>
18866  #include "isdnloop.h"
18867  
18868 -static char *revision = "$Revision: 1.1.4.1 $";
18869 +static char *revision = "$Revision$";
18870  static char *isdnloop_id;
18871  
18872  MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
18873 @@ -22,8 +22,8 @@
18874  MODULE_LICENSE("GPL");
18875  MODULE_PARM(isdnloop_id, "s");
18876  MODULE_PARM_DESC(isdnloop_id, "ID-String of first card");
18877 -
18878 -static int isdnloop_addcard(char *);
18879 +  
18880 +  static int isdnloop_addcard(char *);
18881  
18882  /*
18883   * Free queue completely.
18884 @@ -1542,11 +1542,7 @@
18885         } else
18886                 strcpy(rev, " ??? ");
18887         printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
18888 -
18889 -       if (isdnloop_id)
18890 -               return (isdnloop_addcard(isdnloop_id));
18891 -
18892 -       return 0;
18893 +       return (isdnloop_addcard(isdnloop_id));
18894  }
18895  
18896  static void __exit
18897 diff -rNu linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.h linux-2.4.29/drivers/isdn/isdnloop/isdnloop.h
18898 --- linux-2.4.29.old/drivers/isdn/isdnloop/isdnloop.h   2005-03-22 14:47:56.000000000 +0100
18899 +++ linux-2.4.29/drivers/isdn/isdnloop/isdnloop.h       2005-03-22 15:06:48.834668784 +0100
18900 @@ -1,4 +1,4 @@
18901 -/* $Id: isdnloop.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
18902 +/* $Id$
18903   *
18904   * Loopback lowlevel module for testing of linklevel.
18905   *
18906 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/callbacks.c linux-2.4.29/drivers/isdn/pcbit/callbacks.c
18907 --- linux-2.4.29.old/drivers/isdn/pcbit/callbacks.c     2005-03-22 14:47:56.000000000 +0100
18908 +++ linux-2.4.29/drivers/isdn/pcbit/callbacks.c 2005-03-22 15:06:48.909657384 +0100
18909 @@ -3,7 +3,7 @@
18910   *
18911   * Copyright (C) 1996 Universidade de Lisboa
18912   * 
18913 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18914 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18915   *
18916   * This software may be used and distributed according to the terms of 
18917   * the GNU General Public License, incorporated herein by reference.
18918 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/callbacks.h linux-2.4.29/drivers/isdn/pcbit/callbacks.h
18919 --- linux-2.4.29.old/drivers/isdn/pcbit/callbacks.h     2005-03-22 14:47:56.000000000 +0100
18920 +++ linux-2.4.29/drivers/isdn/pcbit/callbacks.h 2005-03-22 15:06:48.953650696 +0100
18921 @@ -3,7 +3,7 @@
18922   *
18923   * Copyright (C) 1996 Universidade de Lisboa
18924   * 
18925 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18926 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18927   *
18928   * This software may be used and distributed according to the terms of 
18929   * the GNU General Public License, incorporated herein by reference.
18930 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/capi.c linux-2.4.29/drivers/isdn/pcbit/capi.c
18931 --- linux-2.4.29.old/drivers/isdn/pcbit/capi.c  2005-03-22 14:47:56.000000000 +0100
18932 +++ linux-2.4.29/drivers/isdn/pcbit/capi.c      2005-03-22 15:06:49.042637168 +0100
18933 @@ -4,7 +4,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 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/capi.h linux-2.4.29/drivers/isdn/pcbit/capi.h
18943 --- linux-2.4.29.old/drivers/isdn/pcbit/capi.h  2005-03-22 14:47:56.000000000 +0100
18944 +++ linux-2.4.29/drivers/isdn/pcbit/capi.h      2005-03-22 15:06:49.071632760 +0100
18945 @@ -3,7 +3,7 @@
18946   *
18947   * Copyright (C) 1996 Universidade de Lisboa
18948   * 
18949 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18950 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18951   *
18952   * This software may be used and distributed according to the terms of 
18953   * the GNU General Public License, incorporated herein by reference.
18954 @@ -63,7 +63,8 @@
18955  extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen);
18956  #endif
18957  
18958 -static inline struct pcbit_chan * 
18959 +extern __inline__ 
18960 +struct pcbit_chan * 
18961  capi_channel(struct pcbit_dev *dev, struct sk_buff *skb)
18962  {
18963         ushort callref;
18964 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/drv.c linux-2.4.29/drivers/isdn/pcbit/drv.c
18965 --- linux-2.4.29.old/drivers/isdn/pcbit/drv.c   2005-03-22 14:47:56.000000000 +0100
18966 +++ linux-2.4.29/drivers/isdn/pcbit/drv.c       2005-03-22 15:06:49.091629720 +0100
18967 @@ -3,7 +3,7 @@
18968   *
18969   * Copyright (C) 1996 Universidade de Lisboa
18970   * 
18971 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
18972 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
18973   *
18974   * This software may be used and distributed according to the terms of 
18975   * the GNU General Public License, incorporated herein by reference.
18976 @@ -35,7 +35,9 @@
18977  #include <linux/isdnif.h>
18978  #include <asm/string.h>
18979  #include <asm/io.h>
18980 +#ifdef COMPAT_HAS_ISA_IOREMAP
18981  #include <linux/ioport.h>
18982 +#endif
18983  
18984  #include "pcbit.h"
18985  #include "edss1.h"
18986 @@ -89,6 +91,7 @@
18987  
18988         if (mem_base >= 0xA0000 && mem_base <= 0xFFFFF ) {
18989                 dev->ph_mem = mem_base;
18990 +#ifdef COMPAT_HAS_ISA_IOREMAP
18991                 if (check_mem_region(dev->ph_mem, 4096)) {
18992                         printk(KERN_WARNING
18993                                 "PCBIT: memory region %lx-%lx already in use\n",
18994 @@ -100,6 +103,9 @@
18995                         request_mem_region(dev->ph_mem, 4096, "PCBIT mem");
18996                 }
18997                 dev->sh_mem = (unsigned char*)ioremap(dev->ph_mem, 4096);
18998 +#else
18999 +               dev->sh_mem = (unsigned char*) mem_base;
19000 +#endif
19001         }
19002         else 
19003         {
19004 @@ -112,8 +118,10 @@
19005         dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL);
19006         if (!dev->b1) {
19007                 printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
19008 +#ifdef COMPAT_HAS_ISA_IOREMAP
19009                 iounmap((unsigned char*)dev->sh_mem);
19010                 release_mem_region(dev->ph_mem, 4096);
19011 +#endif
19012                 kfree(dev);
19013                 return -ENOMEM;
19014         }
19015 @@ -122,8 +130,10 @@
19016         if (!dev->b2) {
19017                 printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
19018                 kfree(dev->b1);
19019 +#ifdef COMPAT_HAS_ISA_IOREMAP
19020                 iounmap((unsigned char*)dev->sh_mem);
19021                 release_mem_region(dev->ph_mem, 4096);
19022 +#endif
19023                 kfree(dev);
19024                 return -ENOMEM;
19025         }
19026 @@ -144,8 +154,10 @@
19027         {
19028                 kfree(dev->b1);
19029                 kfree(dev->b2);
19030 +#ifdef COMPAT_HAS_ISA_IOREMAP
19031                 iounmap((unsigned char*)dev->sh_mem);
19032                 release_mem_region(dev->ph_mem, 4096);
19033 +#endif
19034                 kfree(dev);
19035                 dev_pcbit[board] = NULL;
19036                 return -EIO;
19037 @@ -166,8 +178,10 @@
19038                 free_irq(irq, dev);
19039                 kfree(dev->b1);
19040                 kfree(dev->b2);
19041 +#ifdef COMPAT_HAS_ISA_IOREMAP
19042                 iounmap((unsigned char*)dev->sh_mem);
19043                 release_mem_region(dev->ph_mem, 4096);
19044 +#endif
19045                 kfree(dev);
19046                 dev_pcbit[board] = NULL;
19047                 return -EIO;
19048 @@ -197,8 +211,10 @@
19049                 free_irq(irq, dev);
19050                 kfree(dev->b1);
19051                 kfree(dev->b2);
19052 +#ifdef COMPAT_HAS_ISA_IOREMAP
19053                 iounmap((unsigned char*)dev->sh_mem);
19054                 release_mem_region(dev->ph_mem, 4096);
19055 +#endif
19056                 kfree(dev);
19057                 dev_pcbit[board] = NULL;
19058                 return -EIO;
19059 @@ -235,8 +251,10 @@
19060                         del_timer(&dev->b2->fsm_timer);
19061                 kfree(dev->b1);
19062                 kfree(dev->b2);
19063 +#ifdef COMPAT_HAS_ISA_IOREMAP
19064                 iounmap((unsigned char*)dev->sh_mem);
19065                 release_mem_region(dev->ph_mem, 4096);
19066 +#endif
19067                 kfree(dev);
19068         }
19069  }
19070 @@ -430,7 +448,7 @@
19071         switch(dev->l2_state) {
19072         case L2_LWMODE:
19073                 /* check (size <= rdp_size); write buf into board */
19074 -               if (len < 0 || len > BANK4 + 1)
19075 +               if (len > BANK4 + 1)
19076                 {
19077                         printk("pcbit_writecmd: invalid length %d\n", len);
19078                         return -EINVAL;
19079 @@ -609,6 +627,20 @@
19080                        dev->b1->s_refnum, 
19081                        dev->b2->s_refnum);
19082  #endif
19083 +#if 0  
19084 +               if (dev->b1->s_refnum == refnum)
19085 +                       chan = dev->b1;
19086 +               else { 
19087 +                  
19088 +                       if (dev->b2->s_refnum == refnum)
19089 +                               chan = dev->b2;
19090 +                       else {
19091 +                               chan = NULL;
19092 +                               printk(KERN_WARNING "Connection Confirm - refnum doesn't match chan\n");
19093 +                               break;
19094 +                       }
19095 +               }
19096 +#else
19097                 /* We just try to find a channel in the right state */
19098  
19099                 if (dev->b1->fsm_state == ST_CALL_INIT)
19100 @@ -622,6 +654,7 @@
19101                                 break;
19102                         }
19103                 }
19104 +#endif
19105                 if (capi_decode_conn_conf(chan, skb, &complete)) {
19106                         printk(KERN_DEBUG "conn_conf indicates error\n");
19107                         pcbit_fsm_event(dev, chan, EV_ERROR, NULL);
19108 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/edss1.c linux-2.4.29/drivers/isdn/pcbit/edss1.c
19109 --- linux-2.4.29.old/drivers/isdn/pcbit/edss1.c 2005-03-22 14:47:56.000000000 +0100
19110 +++ linux-2.4.29/drivers/isdn/pcbit/edss1.c     2005-03-22 15:06:49.119625464 +0100
19111 @@ -4,7 +4,7 @@
19112   *
19113   * Copyright (C) 1996 Universidade de Lisboa
19114   * 
19115 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
19116 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
19117   *
19118   * This software may be used and distributed according to the terms of 
19119   * the GNU General Public License, incorporated herein by reference.
19120 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/edss1.h linux-2.4.29/drivers/isdn/pcbit/edss1.h
19121 --- linux-2.4.29.old/drivers/isdn/pcbit/edss1.h 2005-03-22 14:47:56.000000000 +0100
19122 +++ linux-2.4.29/drivers/isdn/pcbit/edss1.h     2005-03-22 15:06:49.161619080 +0100
19123 @@ -3,7 +3,7 @@
19124   *
19125   * Copyright (C) 1996 Universidade de Lisboa
19126   * 
19127 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
19128 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
19129   *
19130   * This software may be used and distributed according to the terms of 
19131   * the GNU General Public License, incorporated herein by reference.
19132 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/layer2.c linux-2.4.29/drivers/isdn/pcbit/layer2.c
19133 --- linux-2.4.29.old/drivers/isdn/pcbit/layer2.c        2005-03-22 14:47:56.000000000 +0100
19134 +++ linux-2.4.29/drivers/isdn/pcbit/layer2.c    2005-03-22 15:06:49.195613912 +0100
19135 @@ -3,7 +3,7 @@
19136   *
19137   * Copyright (C) 1996 Universidade de Lisboa
19138   *
19139 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
19140 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
19141   *
19142   * This software may be used and distributed according to the terms of
19143   * the GNU General Public License, incorporated herein by reference.
19144 @@ -369,11 +369,16 @@
19145  
19146                 if (dev->read_frame) {
19147                         printk(KERN_DEBUG "pcbit_receive: Type 0 frame and read_frame != NULL\n");
19148 +#if 0
19149 +                       pcbit_l2_error(dev);
19150 +                       return;
19151 +#else
19152                         /* discard previous queued frame */
19153                         if (dev->read_frame->skb)
19154                                 kfree_skb(dev->read_frame->skb);
19155                         kfree(dev->read_frame);
19156                         dev->read_frame = NULL;
19157 +#endif
19158                 }
19159                 frame = kmalloc(sizeof(struct frame_buf), GFP_ATOMIC);
19160  
19161 @@ -449,10 +454,14 @@
19162  
19163                 if (!(frame = dev->read_frame)) {
19164                         printk("Type 1 frame and no frame queued\n");
19165 +#if 1
19166                         /* usually after an error: toss frame */
19167                         dev->readptr += tt;
19168                         if (dev->readptr > dev->sh_mem + BANK2 + BANKLEN)
19169                                 dev->readptr -= BANKLEN;
19170 +#else
19171 +                       pcbit_l2_error(dev);
19172 +#endif
19173                         return;
19174  
19175                 }
19176 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/layer2.h linux-2.4.29/drivers/isdn/pcbit/layer2.h
19177 --- linux-2.4.29.old/drivers/isdn/pcbit/layer2.h        2005-03-22 14:47:56.000000000 +0100
19178 +++ linux-2.4.29/drivers/isdn/pcbit/layer2.h    2005-03-22 15:06:49.228608896 +0100
19179 @@ -3,7 +3,7 @@
19180   *
19181   * Copyright (C) 1996 Universidade de Lisboa
19182   * 
19183 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
19184 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
19185   *
19186   * This software may be used and distributed according to the terms of 
19187   * the GNU General Public License, incorporated herein by reference.
19188 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/module.c linux-2.4.29/drivers/isdn/pcbit/module.c
19189 --- linux-2.4.29.old/drivers/isdn/pcbit/module.c        2005-03-22 14:47:56.000000000 +0100
19190 +++ linux-2.4.29/drivers/isdn/pcbit/module.c    2005-03-22 15:06:49.251605400 +0100
19191 @@ -3,7 +3,7 @@
19192   *
19193   * Copyright (C) 1996 Universidade de Lisboa
19194   * 
19195 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
19196 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
19197   *
19198   * This software may be used and distributed according to the terms of 
19199   * the GNU General Public License, incorporated herein by reference.
19200 @@ -92,6 +92,7 @@
19201  }
19202  
19203  #ifndef MODULE
19204 +#ifdef COMPAT_HAS_NEW_SETUP
19205  #define MAX_PARA       (MAX_PCBIT_CARDS * 2)
19206  static int __init pcbit_setup(char *line)
19207  {
19208 @@ -100,6 +101,11 @@
19209         int ints[MAX_PARA+1];
19210  
19211         str = get_options(line, MAX_PARA, ints);
19212 +#else
19213 +void pcbit_setup(char *str, int *ints)
19214 +{
19215 +       int i, j, argc;
19216 +#endif
19217         argc = ints[0];
19218         i = 0;
19219         j = 1;
19220 @@ -118,9 +124,13 @@
19221  
19222                 i++;
19223         }
19224 +#ifdef COMPAT_HAS_NEW_SETUP
19225         return(1);
19226  }
19227  __setup("pcbit=", pcbit_setup);
19228 +#else
19229 +}
19230 +#endif
19231  #endif
19232  
19233  module_init(pcbit_init);
19234 diff -rNu linux-2.4.29.old/drivers/isdn/pcbit/pcbit.h linux-2.4.29/drivers/isdn/pcbit/pcbit.h
19235 --- linux-2.4.29.old/drivers/isdn/pcbit/pcbit.h 2005-03-22 14:47:56.000000000 +0100
19236 +++ linux-2.4.29/drivers/isdn/pcbit/pcbit.h     2005-03-22 15:06:49.284600384 +0100
19237 @@ -3,7 +3,7 @@
19238   *
19239   * Copyright (C) 1996 Universidade de Lisboa
19240   * 
19241 - * Written by Pedro Roque Marques (pedro_m@yahoo.com)
19242 + * Written by Pedro Roque Marques (roque@di.fc.ul.pt)
19243   *
19244   * This software may be used and distributed according to the terms of 
19245   * the GNU General Public License, incorporated herein by reference.
19246 diff -rNu linux-2.4.29.old/drivers/isdn/sc/card.h linux-2.4.29/drivers/isdn/sc/card.h
19247 --- linux-2.4.29.old/drivers/isdn/sc/card.h     2005-03-22 14:47:56.000000000 +0100
19248 +++ linux-2.4.29/drivers/isdn/sc/card.h 2005-03-22 15:06:49.333592936 +0100
19249 @@ -1,4 +1,4 @@
19250 -/* $Id: card.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19251 +/* $Id$
19252   *
19253   * Driver parameters for SpellCaster ISA ISDN adapters
19254   *
19255 diff -rNu linux-2.4.29.old/drivers/isdn/sc/command.c linux-2.4.29/drivers/isdn/sc/command.c
19256 --- linux-2.4.29.old/drivers/isdn/sc/command.c  2005-03-22 14:47:56.000000000 +0100
19257 +++ linux-2.4.29/drivers/isdn/sc/command.c      2005-03-22 15:06:49.348590656 +0100
19258 @@ -1,4 +1,4 @@
19259 -/* $Id: command.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19260 +/* $Id$
19261   *
19262   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19263   *
19264 @@ -95,7 +95,7 @@
19265                 if(adapter[i]->driverId == driver)
19266                         return i;
19267         }
19268 -       return -ENODEV;
19269 +       return -NODEV;
19270  }
19271  
19272  /* 
19273 diff -rNu linux-2.4.29.old/drivers/isdn/sc/debug.c linux-2.4.29/drivers/isdn/sc/debug.c
19274 --- linux-2.4.29.old/drivers/isdn/sc/debug.c    2005-03-22 14:47:56.000000000 +0100
19275 +++ linux-2.4.29/drivers/isdn/sc/debug.c        2005-03-22 15:06:49.363588376 +0100
19276 @@ -1,4 +1,4 @@
19277 -/* $Id: debug.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19278 +/* $Id$
19279   *
19280   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19281   *
19282 diff -rNu linux-2.4.29.old/drivers/isdn/sc/debug.h linux-2.4.29/drivers/isdn/sc/debug.h
19283 --- linux-2.4.29.old/drivers/isdn/sc/debug.h    2005-03-22 14:47:56.000000000 +0100
19284 +++ linux-2.4.29/drivers/isdn/sc/debug.h        2005-03-22 15:06:49.378586096 +0100
19285 @@ -1,4 +1,4 @@
19286 -/* $Id: debug.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19287 +/* $Id$
19288   *
19289   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19290   *
19291 diff -rNu linux-2.4.29.old/drivers/isdn/sc/event.c linux-2.4.29/drivers/isdn/sc/event.c
19292 --- linux-2.4.29.old/drivers/isdn/sc/event.c    2005-03-22 14:47:56.000000000 +0100
19293 +++ linux-2.4.29/drivers/isdn/sc/event.c        2005-03-22 15:06:49.394583664 +0100
19294 @@ -1,4 +1,4 @@
19295 -/* $Id: event.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19296 +/* $Id$
19297   *
19298   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19299   *
19300 diff -rNu linux-2.4.29.old/drivers/isdn/sc/init.c linux-2.4.29/drivers/isdn/sc/init.c
19301 --- linux-2.4.29.old/drivers/isdn/sc/init.c     2005-03-22 14:47:56.000000000 +0100
19302 +++ linux-2.4.29/drivers/isdn/sc/init.c 2005-03-22 15:06:49.432577888 +0100
19303 @@ -514,6 +514,15 @@
19304         schedule_timeout(HZ);
19305         sig = readl(rambase + SIG_OFFSET);
19306         pr_debug("Looking for a signature, got 0x%x\n", sig);
19307 +#if 0
19308 +/*
19309 + * For Gary: 
19310 + * If it's a timing problem, it should be gone with the above schedule()
19311 + * Another possible reason may be the missing volatile in the original
19312 + * code. readl() does this for us.
19313 + */
19314 +       printk("");     /* Hack! Doesn't work without this !!!??? */
19315 +#endif
19316         if(sig == SIGNATURE)
19317                 return PRI_BOARD;
19318  
19319 @@ -525,6 +534,9 @@
19320         schedule_timeout(HZ);
19321         sig = readl(rambase + SIG_OFFSET);
19322         pr_debug("Looking for a signature, got 0x%x\n", sig);
19323 +#if 0
19324 +       printk("");     /* Hack! Doesn't work without this !!!??? */
19325 +#endif
19326         if(sig == SIGNATURE)
19327                 return BRI_BOARD;
19328  
19329 diff -rNu linux-2.4.29.old/drivers/isdn/sc/interrupt.c linux-2.4.29/drivers/isdn/sc/interrupt.c
19330 --- linux-2.4.29.old/drivers/isdn/sc/interrupt.c        2005-03-22 14:47:56.000000000 +0100
19331 +++ linux-2.4.29/drivers/isdn/sc/interrupt.c    2005-03-22 15:06:49.447575608 +0100
19332 @@ -1,4 +1,4 @@
19333 -/* $Id: interrupt.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19334 +/* $Id$
19335   *
19336   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19337   *
19338 diff -rNu linux-2.4.29.old/drivers/isdn/sc/ioctl.c linux-2.4.29/drivers/isdn/sc/ioctl.c
19339 --- linux-2.4.29.old/drivers/isdn/sc/ioctl.c    2005-03-22 14:47:56.000000000 +0100
19340 +++ linux-2.4.29/drivers/isdn/sc/ioctl.c        2005-03-22 15:06:49.463573176 +0100
19341 @@ -23,6 +23,9 @@
19342  
19343  extern board *adapter[];
19344  
19345 +#if 0
19346 +static char *ChannelStates[] = { "Idle", "Ready", "Connecting", "Connected", "Disconnecting" };
19347 +#endif
19348  
19349  int GetStatus(int card, boardInfo *);
19350  
19351 diff -rNu linux-2.4.29.old/drivers/isdn/sc/message.c linux-2.4.29/drivers/isdn/sc/message.c
19352 --- linux-2.4.29.old/drivers/isdn/sc/message.c  2005-03-22 14:47:56.000000000 +0100
19353 +++ linux-2.4.29/drivers/isdn/sc/message.c      2005-03-22 15:06:49.478570896 +0100
19354 @@ -1,4 +1,4 @@
19355 -/* $Id: message.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19356 +/* $Id$
19357   *
19358   * functions for sending and receiving control messages
19359   *
19360 diff -rNu linux-2.4.29.old/drivers/isdn/sc/message.h linux-2.4.29/drivers/isdn/sc/message.h
19361 --- linux-2.4.29.old/drivers/isdn/sc/message.h  2005-03-22 14:47:56.000000000 +0100
19362 +++ linux-2.4.29/drivers/isdn/sc/message.h      2005-03-22 15:06:49.495568312 +0100
19363 @@ -1,4 +1,4 @@
19364 -/* $Id: message.h,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19365 +/* $Id$
19366   *
19367   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19368   *
19369 diff -rNu linux-2.4.29.old/drivers/isdn/sc/packet.c linux-2.4.29/drivers/isdn/sc/packet.c
19370 --- linux-2.4.29.old/drivers/isdn/sc/packet.c   2005-03-22 14:47:56.000000000 +0100
19371 +++ linux-2.4.29/drivers/isdn/sc/packet.c       2005-03-22 15:06:49.514565424 +0100
19372 @@ -1,4 +1,4 @@
19373 -/* $Id: packet.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19374 +/* $Id$
19375   *
19376   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19377   *
19378 diff -rNu linux-2.4.29.old/drivers/isdn/sc/shmem.c linux-2.4.29/drivers/isdn/sc/shmem.c
19379 --- linux-2.4.29.old/drivers/isdn/sc/shmem.c    2005-03-22 14:47:56.000000000 +0100
19380 +++ linux-2.4.29/drivers/isdn/sc/shmem.c        2005-03-22 15:06:49.560558432 +0100
19381 @@ -1,4 +1,4 @@
19382 -/* $Id: shmem.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19383 +/* $Id$
19384   *
19385   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19386   *
19387 diff -rNu linux-2.4.29.old/drivers/isdn/sc/timer.c linux-2.4.29/drivers/isdn/sc/timer.c
19388 --- linux-2.4.29.old/drivers/isdn/sc/timer.c    2005-03-22 14:47:56.000000000 +0100
19389 +++ linux-2.4.29/drivers/isdn/sc/timer.c        2005-03-22 15:06:49.575556152 +0100
19390 @@ -1,4 +1,4 @@
19391 -/* $Id: timer.c,v 1.1.4.1 2001/11/20 14:19:37 kai Exp $
19392 +/* $Id$
19393   *
19394   * Copyright (C) 1996  SpellCaster Telecommunications Inc.
19395   *
19396 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam.h linux-2.4.29/drivers/isdn/tpam/tpam.h
19397 --- linux-2.4.29.old/drivers/isdn/tpam/tpam.h   2005-03-22 14:47:57.000000000 +0100
19398 +++ linux-2.4.29/drivers/isdn/tpam/tpam.h       2005-03-22 15:06:49.648545056 +0100
19399 @@ -1,4 +1,4 @@
19400 -/* $Id: tpam.h,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19401 +/* $Id: tpam.h,v 1.3 2001/09/24 13:23:12 kai Exp $
19402   *
19403   * Turbo PAM ISDN driver for Linux. (Kernel Driver)
19404   *
19405 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_commands.c linux-2.4.29/drivers/isdn/tpam/tpam_commands.c
19406 --- linux-2.4.29.old/drivers/isdn/tpam/tpam_commands.c  2005-03-22 14:47:57.000000000 +0100
19407 +++ linux-2.4.29/drivers/isdn/tpam/tpam_commands.c      2005-03-22 15:06:49.664542624 +0100
19408 @@ -1,4 +1,4 @@
19409 -/* $Id: tpam_commands.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19410 +/* $Id: tpam_commands.c,v 1.3 2001/09/24 13:23:12 kai Exp $
19411   *
19412   * Turbo PAM ISDN driver for Linux. (Kernel Driver - ISDN commands)
19413   *
19414 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_crcpc.c linux-2.4.29/drivers/isdn/tpam/tpam_crcpc.c
19415 --- linux-2.4.29.old/drivers/isdn/tpam/tpam_crcpc.c     2005-03-22 14:47:57.000000000 +0100
19416 +++ linux-2.4.29/drivers/isdn/tpam/tpam_crcpc.c 2005-03-22 15:06:49.681540040 +0100
19417 @@ -1,4 +1,4 @@
19418 -/* $Id: tpam_crcpc.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19419 +/* $Id$
19420   *
19421   * Turbo PAM ISDN driver for Linux. (Kernel Driver - CRC encoding)
19422   *
19423 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_hdlc.c linux-2.4.29/drivers/isdn/tpam/tpam_hdlc.c
19424 --- linux-2.4.29.old/drivers/isdn/tpam/tpam_hdlc.c      2005-03-22 14:47:57.000000000 +0100
19425 +++ linux-2.4.29/drivers/isdn/tpam/tpam_hdlc.c  2005-03-22 15:06:49.702536848 +0100
19426 @@ -1,4 +1,4 @@
19427 -/* $Id: tpam_hdlc.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19428 +/* $Id: tpam_hdlc.c,v 1.3 2001/09/24 13:23:12 kai Exp $
19429   *
19430   * Turbo PAM ISDN driver for Linux. (Kernel Driver - HDLC encoding)
19431   *
19432 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_main.c linux-2.4.29/drivers/isdn/tpam/tpam_main.c
19433 --- linux-2.4.29.old/drivers/isdn/tpam/tpam_main.c      2005-03-22 14:47:57.000000000 +0100
19434 +++ linux-2.4.29/drivers/isdn/tpam/tpam_main.c  2005-03-22 15:06:49.717534568 +0100
19435 @@ -1,4 +1,4 @@
19436 -/* $Id: tpam_main.c,v 1.1.2.2 2001/12/09 18:45:14 kai Exp $
19437 +/* $Id$
19438   *
19439   * Turbo PAM ISDN driver for Linux. (Kernel Driver - main routines)
19440   *
19441 @@ -254,7 +254,7 @@
19442         name:           "tpam",
19443         id_table:       tpam_pci_tbl,
19444         probe:          tpam_probe,
19445 -       remove:         __devexit_p(tpam_remove),
19446 +       remove:         tpam_remove,
19447  };
19448  
19449  static int __init tpam_init(void) {
19450 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_memory.c linux-2.4.29/drivers/isdn/tpam/tpam_memory.c
19451 --- linux-2.4.29.old/drivers/isdn/tpam/tpam_memory.c    2005-03-22 14:47:57.000000000 +0100
19452 +++ linux-2.4.29/drivers/isdn/tpam/tpam_memory.c        2005-03-22 15:06:49.734531984 +0100
19453 @@ -1,4 +1,4 @@
19454 -/* $Id: tpam_memory.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19455 +/* $Id$
19456   *
19457   * Turbo PAM ISDN driver for Linux. (Kernel Driver - Board Memory Access)
19458   *
19459 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_nco.c linux-2.4.29/drivers/isdn/tpam/tpam_nco.c
19460 --- linux-2.4.29.old/drivers/isdn/tpam/tpam_nco.c       2005-03-22 14:47:57.000000000 +0100
19461 +++ linux-2.4.29/drivers/isdn/tpam/tpam_nco.c   2005-03-22 15:06:49.749529704 +0100
19462 @@ -1,4 +1,4 @@
19463 -/* $Id: tpam_nco.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19464 +/* $Id$
19465   *
19466   * Turbo PAM ISDN driver for Linux. 
19467   * (Kernel Driver - Low Level NCO Manipulation)
19468 diff -rNu linux-2.4.29.old/drivers/isdn/tpam/tpam_queues.c linux-2.4.29/drivers/isdn/tpam/tpam_queues.c
19469 --- linux-2.4.29.old/drivers/isdn/tpam/tpam_queues.c    2005-03-22 14:47:57.000000000 +0100
19470 +++ linux-2.4.29/drivers/isdn/tpam/tpam_queues.c        2005-03-22 15:06:49.764527424 +0100
19471 @@ -1,4 +1,4 @@
19472 -/* $Id: tpam_queues.c,v 1.1.2.1 2001/11/20 14:19:37 kai Exp $
19473 +/* $Id$
19474   *
19475   * Turbo PAM ISDN driver for Linux. (Kernel Driver)
19476   *
19477 @@ -146,7 +146,6 @@
19478                 do {
19479                         hpic = readl(card->bar0 + TPAM_HPIC_REGISTER);
19480                         if (waiting_too_long++ > 0xfffffff) {
19481 -                               kfree_skb(skb); 
19482                                 spin_unlock(&card->lock);
19483                                 printk(KERN_ERR "TurboPAM(tpam_irq): "
19484                                                 "waiting too long...\n");
19485 diff -rNu linux-2.4.29.old/include/linux/b1lli.h linux-2.4.29/include/linux/b1lli.h
19486 --- linux-2.4.29.old/include/linux/b1lli.h      2005-03-22 14:47:32.000000000 +0100
19487 +++ linux-2.4.29/include/linux/b1lli.h  2005-03-22 15:06:49.881509640 +0100
19488 @@ -1,4 +1,4 @@
19489 -/* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $
19490 +/* $Id$
19491   *
19492   * ISDN lowlevel-module for AVM B1-card.
19493   *
19494 diff -rNu linux-2.4.29.old/include/linux/b1pcmcia.h linux-2.4.29/include/linux/b1pcmcia.h
19495 --- linux-2.4.29.old/include/linux/b1pcmcia.h   2005-03-22 14:47:32.000000000 +0100
19496 +++ linux-2.4.29/include/linux/b1pcmcia.h       2005-03-22 15:06:49.862512528 +0100
19497 @@ -1,4 +1,4 @@
19498 -/* $Id: b1pcmcia.h,v 1.1.8.2 2001/09/23 22:25:05 kai Exp $
19499 +/* $Id$
19500   *
19501   * Exported functions of module b1pcmcia to be called by
19502   * avm_cs card services module.
19503 diff -rNu linux-2.4.29.old/include/linux/capi.h linux-2.4.29/include/linux/capi.h
19504 --- linux-2.4.29.old/include/linux/capi.h       2005-03-22 14:47:32.000000000 +0100
19505 +++ linux-2.4.29/include/linux/capi.h   2005-03-22 15:06:49.922503408 +0100
19506 @@ -1,4 +1,4 @@
19507 -/* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
19508 +/* $Id$
19509   * 
19510   * CAPI 2.0 Interface for Linux
19511   * 
19512 diff -rNu linux-2.4.29.old/include/linux/concap.h linux-2.4.29/include/linux/concap.h
19513 --- linux-2.4.29.old/include/linux/concap.h     2005-03-22 14:47:32.000000000 +0100
19514 +++ linux-2.4.29/include/linux/concap.h 2005-03-22 15:06:49.906505840 +0100
19515 @@ -1,4 +1,4 @@
19516 -/* $Id: concap.h,v 1.2.8.1 2001/09/23 22:25:05 kai Exp $
19517 +/* $Id: concap.h,v 1.3 2001/09/24 13:23:13 kai Exp $
19518   *
19519   * Copyright 1997 by Henner Eisen <eis@baty.hanse.de>
19520   *
19521 @@ -11,6 +11,7 @@
19522  #ifdef __KERNEL__
19523  #include <linux/skbuff.h>
19524  #include <linux/netdevice.h>
19525 +#include <linux/isdn_compat.h>
19526  
19527  /* Stuff to support encapsulation protocols genericly. The encapsulation
19528     protocol is processed at the uppermost layer of the network interface.
19529 diff -rNu linux-2.4.29.old/include/linux/hysdn_if.h linux-2.4.29/include/linux/hysdn_if.h
19530 --- linux-2.4.29.old/include/linux/hysdn_if.h   2005-03-22 14:47:32.000000000 +0100
19531 +++ linux-2.4.29/include/linux/hysdn_if.h       2005-03-22 15:06:49.974495504 +0100
19532 @@ -1,4 +1,4 @@
19533 -/* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $
19534 +/* $Id$
19535   *
19536   * Linux driver for HYSDN cards
19537   * ioctl definitions shared by hynetmgr and driver.
19538 diff -rNu linux-2.4.29.old/include/linux/isdn/tpam.h linux-2.4.29/include/linux/isdn/tpam.h
19539 --- linux-2.4.29.old/include/linux/isdn/tpam.h  2005-03-22 14:47:32.000000000 +0100
19540 +++ linux-2.4.29/include/linux/isdn/tpam.h      2005-03-22 15:06:49.947499608 +0100
19541 @@ -1,4 +1,4 @@
19542 -/* $Id: tpam.h,v 1.1.2.1 2001/11/20 14:19:38 kai Exp $
19543 +/* $Id$
19544   *
19545   * Turbo PAM ISDN driver for Linux. (Kernel Driver)
19546   *
19547 diff -rNu linux-2.4.29.old/include/linux/isdn.h linux-2.4.29/include/linux/isdn.h
19548 --- linux-2.4.29.old/include/linux/isdn.h       2005-03-22 14:47:31.000000000 +0100
19549 +++ linux-2.4.29/include/linux/isdn.h   2005-03-22 15:06:50.001491400 +0100
19550 @@ -1,4 +1,4 @@
19551 -/* $Id: isdn.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
19552 +/* $Id: isdn.h,v 1.125 2001/12/01 23:18:21 detabc Exp $
19553   *
19554   * Main header for the Linux ISDN subsystem (linklevel).
19555   *
19556 @@ -14,6 +14,7 @@
19557  #ifndef __ISDN_H__
19558  #define __ISDN_H__
19559  
19560 +#include <linux/isdn_compat.h>
19561  #include <linux/ioctl.h>
19562  
19563  #ifdef CONFIG_COBALT_MICRO_SERVER
19564 @@ -93,9 +94,15 @@
19565  #define ISDN_LMSNLEN         255 /* Length of tty's Listen-MSN string */
19566  #define ISDN_CMSGLEN        50  /* Length of CONNECT-Message to add for Modem */
19567  
19568 +#ifdef BIG_PHONE_NUMBERS
19569  #define ISDN_MSNLEN          32
19570  #define NET_DV 0x06  /* Data version for isdn_net_ioctl_cfg   */
19571  #define TTY_DV 0x06  /* Data version for iprofd etc.          */
19572 +#else
19573 +#define ISDN_MSNLEN          20
19574 +#define NET_DV 0x05  /* Data version for isdn_net_ioctl_cfg   */
19575 +#define TTY_DV 0x05  /* Data version for iprofd etc.          */
19576 +#endif
19577  
19578  #define INF_DV 0x01  /* Data version for /dev/isdninfo        */
19579  
19580 @@ -187,6 +194,61 @@
19581  #define ISDN_MINOR_PPPMAX   (128 + (ISDN_MAX_CHANNELS-1))
19582  #define ISDN_MINOR_STATUS   255
19583  
19584 +#ifndef CONFIG_ISDN_WITH_ABC
19585 +#undef CONFIG_ISDN_WITH_ABC_CALLB
19586 +#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK
19587 +#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
19588 +#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
19589 +#undef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
19590 +#undef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
19591 +#undef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
19592 +#undef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
19593 +#undef CONFIG_ISDN_WITH_ABC_CONN_ERROR
19594 +#undef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
19595 +#else /* CONFIG_ISDN_WITH_ABC */
19596 +#include <linux/isdn_dwabc.h>
19597 +
19598 +
19599 +typedef struct DWABCJIFFIES {
19600 +
19601 +       u_long  msec_1000;
19602 +       u_long  msec_500;
19603 +       u_long  msec_400;
19604 +       u_long  msec_200;
19605 +       u_long  msec_100;
19606 +
19607 +} DWABCJIFFIES;
19608 +
19609 +
19610 +#ifdef CONFIG_ISDN_WITH_ABC_NEED_DWSJIFFIES
19611 +DWABCJIFFIES isdn_dwabc_jiffies;
19612 +#else
19613 +extern DWABCJIFFIES isdn_dwabc_jiffies;
19614 +#endif
19615 +#define dwsjiffies (isdn_dwabc_jiffies.msec_1000)
19616 +
19617 +#define ISDN_DW_ABC_FLAG_UNUSED00001           0x00000001L
19618 +#define ISDN_DW_ABC_FLAG_NO_UDP_CHECK          0x00000002L
19619 +#define ISDN_DW_ABC_FLAG_NO_UDP_HANGUP         0x00000004L
19620 +#define ISDN_DW_ABC_FLAG_NO_UDP_DIAL           0x00000008L
19621 +#define ISDN_DW_ABC_FLAG_UNUSED00010           0x00000010L
19622 +#define ISDN_DW_ABC_FLAG_RCV_NO_HUPTIMER       0x00000020L
19623 +#define ISDN_DW_ABC_FLAG_NO_CH_EXTINUSE                0x00000040L
19624 +#define ISDN_DW_ABC_FLAG_NO_CONN_ERROR         0x00000080L
19625 +#define ISDN_DW_ABC_FLAG_BSD_COMPRESS          0x00000100L
19626 +#define ISDN_DW_ABC_FLAG_NO_LCR                                0x00000200L
19627 +#define ISDN_DW_ABC_FLAG_LEASED_LINE           0x00001000L
19628 +
19629 +#define ISDN_DW_ABC_IFFLAG_NODCHAN                     0x00000001L
19630 +#define ISDN_DW_ABC_IFFLAG_BSDAKTIV                    0x00000002L
19631 +
19632 +#define ISDN_DW_ABC_BITLOCK_SEND                       0
19633 +#define ISDN_DW_ABC_BITLOCK_RECEIVE                    1
19634 +
19635 +#endif /* CONFIG_ISDN_WITH_ABC */
19636 +
19637 +
19638 +
19639  #ifdef CONFIG_ISDN_PPP
19640  
19641  #ifdef CONFIG_ISDN_PPP_VJ
19642 @@ -204,9 +266,11 @@
19643  #  include <linux/concap.h>
19644  #endif
19645  
19646 +#ifdef HAVE_DEVFS_FS
19647  #ifdef CONFIG_DEVFS_FS
19648  #  include <linux/devfs_fs_kernel.h>
19649  #endif
19650 +#endif /* HAVE_DEVFS_FS */
19651  
19652  #include <linux/isdnif.h>
19653  
19654 @@ -272,6 +336,12 @@
19655  #define ISDN_NET_CALLBACK   0x04       /* activate callback                 */
19656  #define ISDN_NET_CBHUP      0x08       /* hangup before callback            */
19657  #define ISDN_NET_CBOUT      0x10       /* remote machine does callback      */
19658 +#if 0
19659 +/* Unused??? */
19660 +#define ISDN_NET_CLONE      0x08       /* clone a tmp interface when called */
19661 +#define ISDN_NET_TMP        0x10       /* tmp interface until getting an IP */
19662 +#define ISDN_NET_DYNAMIC    0x20       /* this link is dynamically allocated */
19663 +#endif
19664  
19665  #define ISDN_NET_MAGIC      0x49344C02 /* for paranoia-checking             */
19666  
19667 @@ -386,6 +456,38 @@
19668    char cisco_debserint;                        /* debugging flag of cisco hdlc with slarp */
19669    struct timer_list cisco_timer;
19670    struct tq_struct tqueue;
19671 +#ifdef CONFIG_ISDN_WITH_ABC
19672 +  ulong        dw_abc_flags;
19673 +  ulong        dw_abc_if_flags;
19674 +  int          dw_abc_inuse_secure;
19675 +  ulong        dw_abc_dialstart;
19676 +  int          dw_abc_old_onhtime;
19677 +  int          dw_abc_remote_version;
19678 +  int          dw_abc_bitlocks;
19679 +#ifdef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
19680 +  char dw_out_msn[ISDN_MSNLEN]; /* eaz for outgoing call if *out_msn != 0 */
19681 +#endif
19682 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
19683 +  ulong                                dw_abc_lcr_callid;
19684 +  ulong                                dw_abc_lcr_start_request;
19685 +  ulong                                dw_abc_lcr_end_request;
19686 +  isdn_ctrl                    *dw_abc_lcr_cmd;
19687 +  struct ISDN_DWABC_LCR_IOCTL  *dw_abc_lcr_io;
19688 +#endif
19689 +  ulong dw_abc_bchan_last_connect;
19690 +#ifdef CONFIG_ISDN_WITH_ABC_CONN_ERROR
19691 +  short dw_abc_bchan_errcnt;
19692 +#endif
19693 +#ifdef CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
19694 +  void *dw_abc_bsd_compressor;
19695 +  void *dw_abc_bsd_stat_rx;
19696 +  void *dw_abc_bsd_stat_tx;
19697 +#endif
19698 +  ulong        dw_abc_bsd_snd;
19699 +  ulong        dw_abc_bsd_bsd_snd;
19700 +  ulong        dw_abc_bsd_rcv;
19701 +  ulong        dw_abc_bsd_bsd_rcv;
19702 +#endif
19703  } isdn_net_local;
19704  
19705  /* the interface itself */
19706 @@ -608,12 +710,13 @@
19707         int               tflags;                    /* Timer-Flags:               */
19708         /*  see ISDN_TIMER_..defines  */
19709         int               global_flags;
19710 -       infostruct        *infochain;                /* List of open info-devs.    */
19711 -       wait_queue_head_t info_waitq;               /* Wait-Queue for isdninfo    */
19712         struct timer_list timer;                       /* Misc.-function Timer       */
19713         int               chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel  */
19714         int               drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index    */
19715         int               usage[ISDN_MAX_CHANNELS];  /* Used by tty/ip/voice       */
19716 +#ifdef CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
19717 +       ulong                     dwabc_chan_external_inuse[ISDN_MAX_CHANNELS];
19718 +#endif
19719         char              num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
19720         /* Remote number of active ch.*/
19721         int               m_idx[ISDN_MAX_CHANNELS];  /* Index for mdm....          */
19722 @@ -631,6 +734,7 @@
19723         isdn_v110_stream  *v110[ISDN_MAX_CHANNELS];  /* V.110 private data         */
19724         struct semaphore  sem;                       /* serialize list access*/
19725         unsigned long     global_features;
19726 +#ifdef HAVE_DEVFS_FS
19727  #ifdef CONFIG_DEVFS_FS
19728         devfs_handle_t devfs_handle_isdninfo;
19729         devfs_handle_t devfs_handle_isdnctrl;
19730 @@ -640,10 +744,41 @@
19731         devfs_handle_t devfs_handle_ipppX[ISDN_MAX_CHANNELS];
19732  #endif
19733  #endif /* CONFIG_DEVFS_FS */
19734 +#endif /* HAVE_DEVFS_FS */
19735  } isdn_dev;
19736  
19737  extern isdn_dev *dev;
19738  
19739 +#ifdef CONFIG_ISDN_WITH_ABC
19740 +extern int isdn_auto_dial_helper(isdn_net_local *,struct sk_buff *,int);
19741 +extern void dwisdn_nfw_send(isdn_net_local *lp,int drop_only);
19742 +extern void isdn_net_unreachable(struct net_device *,struct sk_buff *,char *);
19743 +extern void isdn_net_log_skb_dwabc(struct sk_buff *,isdn_net_local *,char *);
19744 +extern void isdn_net_hangup(struct net_device *d);
19745 +extern void isdn_dw_clear_if(ulong pm,isdn_net_local *);
19746 +extern void isdn_dwabc_test_phone(isdn_net_local *);
19747 +extern void isdn_dw_abc_init_func(void);
19748 +extern void isdn_dw_abc_release_func(void);
19749 +extern int isdn_dw_abc_reset_interface(isdn_net_local *,int);
19750 +extern int dwabc_bsd_init(isdn_net_local *lp);
19751 +extern void dwabc_bsd_free(isdn_net_local *lp);
19752 +extern struct sk_buff *dwabc_bsd_compress(isdn_net_local *,struct sk_buff *,struct net_device *);
19753 +extern void dwabc_bsd_first_gen(isdn_net_local *);
19754 +extern struct sk_buff *dwabc_bsd_rx_pkt(isdn_net_local *,struct sk_buff *,struct net_device *);
19755 +#ifdef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
19756 +extern size_t isdn_dw_abc_lcr_readstat(char *,size_t);
19757 +extern ulong isdn_dw_abc_lcr_call_number(isdn_net_local *,isdn_ctrl *);
19758 +extern void isdn_dw_abc_lcr_open(void);
19759 +extern void isdn_dw_abc_lcr_close(void);
19760 +extern int isdn_dw_abc_lcr_ioctl(ulong);
19761 +extern void isdn_dw_abc_lcr_clear(isdn_net_local *);
19762 +extern int isdn_dw_abc_lcr_lock(void);
19763 +extern void isdn_dw_abc_lcr_ulock(void);
19764 +#endif
19765 +#ifdef CONFIG_ISDN_WITH_ABC_UDP_CHECK
19766 +extern int dw_abc_udp_test(struct sk_buff *skb,struct net_device *ndev); 
19767 +#endif
19768 +#endif
19769  
19770  #endif /* __KERNEL__ */
19771  
19772 diff -rNu linux-2.4.29.old/include/linux/isdn_compat.h linux-2.4.29/include/linux/isdn_compat.h
19773 --- linux-2.4.29.old/include/linux/isdn_compat.h        1970-01-01 01:00:00.000000000 +0100
19774 +++ linux-2.4.29/include/linux/isdn_compat.h    2005-03-22 15:06:50.017488968 +0100
19775 @@ -0,0 +1,261 @@
19776 +/* $Id: isdn_compat.h,v 1.53 2001/09/24 13:23:13 kai Exp $
19777 + *
19778 + * Linux ISDN subsystem
19779 + * Compatibility for various Linux kernel versions
19780 + *
19781 + * This software may be used and distributed according to the terms
19782 + * of the GNU General Public License, incorporated herein by reference.
19783 + *
19784 + */
19785 +
19786 +#ifndef _LINUX_ISDN_COMPAT_H
19787 +#define _LINUX_ISDN_COMPAT_H
19788 +
19789 +#ifdef __KERNEL__
19790 +
19791 +#ifndef ISDN_COMPAT_NOT_GENERIC
19792 +/* when using std2kern -u, this part is left out and instead provided
19793 +   by the .ctrl files */
19794 +
19795 +#include <linux/version.h>
19796 +
19797 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)
19798 +
19799 +#define set_current_state(sta) (current->state = sta)
19800 +#define module_init(x) int init_module(void) { return x(); }
19801 +#define module_exit(x) void cleanup_module(void) { x(); }
19802 +#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0 = 0; } while (0)
19803 +#define init_MUTEX(x)                          *(x)=MUTEX
19804 +#define init_MUTEX_LOCKED(x)                   *(x)=MUTEX_LOCKED
19805 +#define __devinit
19806 +#define __devinitdata
19807 +
19808 +#else /* 2.2.18 and later */
19809 +
19810 +#define COMPAT_HAS_NEW_SETUP
19811 +#define COMPAT_HAS_NEW_WAITQ
19812 +
19813 +#endif
19814 +
19815 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
19816 +
19817 +#define dev_kfree_skb_irq(a) dev_kfree_skb(a)
19818 +#define dev_kfree_skb_any(a) dev_kfree_skb(a)
19819 +#define COMPAT_HAS_2_2_PCI
19820 +#define get_pcibase(ps, nr) ps->base_address[nr]
19821 +#define pci_resource_start_io(pdev, nr) ((pdev)->base_address[nr] & PCI_BASE_ADDRESS_IO_MASK)
19822 +#define pci_resource_start_mem(pdev, nr) ((pdev)->base_address[nr] & PCI_BASE_ADDRESS_MEM_MASK)
19823 +#define pci_get_sub_vendor(pdev, id)   pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &id)
19824 +#define pci_get_sub_system(pdev, id)   pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &id)
19825 +
19826 +#define __exit
19827 +#define __devinit
19828 +#define __devinitdata
19829 +
19830 +#define net_device device
19831 +#define COMPAT_NO_SOFTNET
19832 +#define netif_running(d) test_bit(LINK_STATE_START, &d->state)
19833 +#define COMPAT_NEED_MPPP_DEFS
19834 +#define spin_lock_bh(lock)
19835 +#define spin_unlock_bh(lock)
19836 +#define COMPAT_NEED_SPIN_LOCK_BH
19837 +#define i_count_read(ic) ic
19838 +#define i_count_inc(ic)  ic++
19839 +#define COMPAT_USE_MODCOUNT_LOCK
19840 +#define devfs_register_chrdev(m,n,f) register_chrdev(m,n,f)
19841 +#define devfs_unregister_chrdev(m,n) unregister_chrdev(m,n)
19842 +#define COMPAT_NEED_PCI_IDS
19843 +#define in_irq() (local_irq_count[smp_processor_id()] != 0)
19844 +
19845 +#else /* 2.4.0 and later */
19846 +
19847 +#define pci_resource_start_io(pdev, nr) pci_resource_start(pdev, nr)
19848 +#define pci_resource_start_mem(pdev, nr) pci_resource_start(pdev, nr)
19849 +#define get_pcibase(ps, nr) ps->resource[nr].start
19850 +#define pci_get_sub_system(pdev, id)   id = pdev->subsystem_device
19851 +#define pci_get_sub_vendor(pdev, id)   id = pdev->subsystem_vendor
19852 +
19853 +#define BIG_PHONE_NUMBERS
19854 +#define COMPAT_HAS_ISA_IOREMAP
19855 +#define i_count_read(ic) atomic_read(&ic)
19856 +#define i_count_inc(ic)  atomic_inc(&ic)
19857 +#define COMPAT_HAS_FILEOP_OWNER
19858 +#define COMPAT_HAVE_NEW_FILLDIR
19859 +#define COMPAT_has_fileops_in_inode
19860 +#define COMPAT_HAS_init_special_inode
19861 +#define COMPAT_d_alloc_root_one_parameter
19862 +#define HAVE_DEVFS_FS
19863 +#define COMPAT_HAS_SCHEDULE_TASK
19864 +#define COMPAT_HAS_USB_IDTAB
19865 +
19866 +#endif
19867 +
19868 +#endif /* ISDN_COMPAT_GENERIC */
19869 +
19870 +#ifdef COMPAT_HAS_2_2_PCI 
19871 +#include <linux/pci.h>
19872 +#ifdef __powerpc__
19873 +static inline int pci_enable_device(struct pci_dev *dev)
19874 +{
19875 +       u16 cmd;
19876 +       pci_read_config_word(dev, PCI_COMMAND, &cmd);
19877 +       cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_IO | PCI_COMMAND_SERR;
19878 +       cmd &= ~PCI_COMMAND_FAST_BACK;
19879 +       pci_write_config_word(dev, PCI_COMMAND, cmd);
19880 +       return(0);
19881 +}
19882 +#else
19883 +static inline int pci_enable_device(struct pci_dev *dev)
19884 +{
19885 +       return 0;
19886 +}
19887 +#endif /* __powerpc__ */
19888 +
19889 +#define PCI_ANY_ID (~0)
19890 +
19891 +/* as this is included multiple times, we make it inline */
19892 +
19893 +static inline struct pci_dev * pci_find_subsys(unsigned int vendor, unsigned int device,
19894 +                                       unsigned int ss_vendor, unsigned int ss_device,
19895 +                                       struct pci_dev *from)
19896 +{
19897 +       unsigned short subsystem_vendor, subsystem_device;
19898 +
19899 +       while ((from = pci_find_device(vendor, device, from))) {
19900 +               pci_read_config_word(from, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor);
19901 +               pci_read_config_word(from, PCI_SUBSYSTEM_ID, &subsystem_device);
19902 +               if ((ss_vendor == PCI_ANY_ID || subsystem_vendor == ss_vendor) &&
19903 +                   (ss_device == PCI_ANY_ID || subsystem_device == ss_device))
19904 +                       return from;
19905 +       }
19906 +       return NULL;
19907 +}
19908 +#endif
19909 +
19910 +#ifdef COMPAT_NO_SOFTNET
19911 +#include <linux/netdevice.h>
19912 +
19913 +/*
19914 + * Tell upper layers that the network device is ready to xmit more frames.
19915 + */
19916 +static void __inline__ netif_wake_queue(struct net_device * dev)
19917 +{
19918 +       dev->tbusy = 0;
19919 +       mark_bh(NET_BH);
19920 +}
19921 +
19922 +/*
19923 + * called during net_device open()
19924 + */
19925 +static void __inline__ netif_start_queue(struct net_device * dev)
19926 +{
19927 +       dev->tbusy = 0;
19928 +       /* actually, we never use the interrupt flag at all */
19929 +       dev->interrupt = 0;
19930 +       dev->start = 1;
19931 +}
19932 +
19933 +/*
19934 + * Ask upper layers to temporarily cease passing us more xmit frames.
19935 + */
19936 +static void __inline__ netif_stop_queue(struct net_device * dev)
19937 +{
19938 +       dev->tbusy = 1;
19939 +}
19940 +
19941 +#endif /* COMPAT_NO_SOFTNET */
19942 +
19943 +#ifndef COMPAT_HAS_NEW_WAITQ
19944 +typedef struct wait_queue wait_queue_t;
19945 +typedef struct wait_queue *wait_queue_head_t;
19946 +
19947 +#define DECLARE_WAITQUEUE(wait, current)       struct wait_queue wait = { current, NULL }
19948 +#define DECLARE_WAIT_QUEUE_HEAD(wait)          wait_queue_head_t wait
19949 +#define init_waitqueue_head(x)                 *(x)=NULL
19950 +#define init_waitqueue_entry(q,p)              ((q)->task)=(p)
19951 +#endif /* COMPAT_HAS_NEW_WAITQ */
19952 +
19953 +#ifdef COMPAT_NEED_PCI_IDS
19954 +
19955 +#define PCI_ANY_ID (~0)
19956 +
19957 +#define PCI_VENDOR_ID_DYNALINK          0x0675
19958 +#define PCI_DEVICE_ID_DYNALINK_IS64PH   0x1702
19959 +
19960 +#define PCI_DEVICE_ID_WINBOND2_6692    0x6692
19961 +
19962 +#define PCI_DEVICE_ID_PLX_R685         0x1030
19963 +#define PCI_DEVICE_ID_PLX_DJINN_ITOO    0x1151
19964 +#define PCI_DEVICE_ID_PLX_R753          0x1152
19965 +
19966 +#define PCI_VENDOR_ID_ELSA             0x1048
19967 +#define PCI_DEVICE_ID_ELSA_MICROLINK   0x1000
19968 +#define PCI_DEVICE_ID_ELSA_QS3000      0x3000
19969 +
19970 +#define PCI_VENDOR_ID_EICON            0x1133
19971 +#define PCI_DEVICE_ID_EICON_DIVA20PRO  0xe001
19972 +#define PCI_DEVICE_ID_EICON_DIVA20     0xe002
19973 +#define PCI_DEVICE_ID_EICON_DIVA20PRO_U        0xe003
19974 +#define PCI_DEVICE_ID_EICON_DIVA20_U   0xe004
19975 +#define PCI_DEVICE_ID_EICON_DIVA201    0xe005
19976 +#define PCI_DEVICE_ID_EICON_MAESTRA    0xe010
19977 +#define PCI_DEVICE_ID_EICON_MAESTRAQ   0xe012
19978 +#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013
19979 +#define PCI_DEVICE_ID_EICON_MAESTRAP   0xe014
19980
19981 +#define PCI_VENDOR_ID_CCD              0x1397
19982 +#define PCI_DEVICE_ID_CCD_2BD0         0x2BD0
19983 +#define PCI_DEVICE_ID_CCD_B000         0xB000
19984 +#define PCI_DEVICE_ID_CCD_B006         0xB006
19985 +#define PCI_DEVICE_ID_CCD_B007         0xB007
19986 +#define PCI_DEVICE_ID_CCD_B008         0xB008
19987 +#define PCI_DEVICE_ID_CCD_B009         0xB009
19988 +#define PCI_DEVICE_ID_CCD_B00A         0xB00A
19989 +#define PCI_DEVICE_ID_CCD_B00B         0xB00B
19990 +#define PCI_DEVICE_ID_CCD_B00C         0xB00C
19991 +#define PCI_DEVICE_ID_CCD_B100         0xB100
19992 +
19993 +#define PCI_VENDOR_ID_ASUSTEK           0x1043   
19994 +#define PCI_DEVICE_ID_ASUSTEK_0675      0x0675
19995 +
19996 +#define PCI_VENDOR_ID_BERKOM                   0x0871
19997 +#define PCI_DEVICE_ID_BERKOM_A1T               0xFFA1
19998 +#define PCI_DEVICE_ID_BERKOM_T_CONCEPT          0xFFA2
19999 +#define PCI_DEVICE_ID_BERKOM_A4T               0xFFA4
20000 +#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO      0xFFA8
20001 +
20002 +#define PCI_DEVICE_ID_SATSAGEM_NICCY   0x1016
20003 +
20004 +#define PCI_DEVICE_ID_TIGERJET_100     0x0002
20005 +
20006 +#define PCI_VENDOR_ID_ANIGMA           0x1051
20007 +#define PCI_DEVICE_ID_ANIGMA_MC145575  0x0100
20008 +
20009 +#define PCI_VENDOR_ID_ZOLTRIX          0x15b0
20010 +#define PCI_DEVICE_ID_ZOLTRIX_2BD0     0x2BD0
20011 +
20012 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070
20013 +#define PCI_DEVICE_ID_DIGI_DF_M_E      0x0071
20014 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
20015 +#define PCI_DEVICE_ID_DIGI_DF_M_A      0x0073
20016 +
20017 +#define PCI_DEVICE_ID_AVM_B1           0x0700
20018 +#define PCI_DEVICE_ID_AVM_C4           0x0800
20019 +#define PCI_DEVICE_ID_AVM_C2           0x1100
20020 +#define PCI_DEVICE_ID_AVM_T1           0x1200
20021 +
20022 +#define PCI_VENDOR_ID_HYPERCOPE                0x1365
20023 +#define PCI_DEVICE_ID_HYPERCOPE_PLX    0x9050
20024 +#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO     0x0104
20025 +#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO         0x0106
20026 +#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO        0x0107
20027 +#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2       0x0108
20028 +#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS       0x0109
20029 +
20030 +#define PCI_VENDOR_ID_ABOCOM            0x13D1
20031 +#define PCI_DEVICE_ID_ABOCOM_2BD1       0x2BD1
20032 +
20033 +#endif /* COMPAT_NEED_PCI_IDS */
20034 +
20035 +#endif /* __KERNEL__ */
20036 +#endif /* _LINUX_ISDN_COMPAT_H */
20037 diff -rNu linux-2.4.29.old/include/linux/isdn_divertif.h linux-2.4.29/include/linux/isdn_divertif.h
20038 --- linux-2.4.29.old/include/linux/isdn_divertif.h      2005-03-22 14:47:32.000000000 +0100
20039 +++ linux-2.4.29/include/linux/isdn_divertif.h  2005-03-22 15:06:50.032486688 +0100
20040 @@ -1,4 +1,4 @@
20041 -/* $Id: isdn_divertif.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
20042 +/* $Id$
20043   *
20044   * Header for the diversion supplementary interface for i4l.
20045   *
20046 @@ -14,7 +14,7 @@
20047  /***********************************************************/
20048  /* magic value is also used to control version information */
20049  /***********************************************************/
20050 -#define DIVERT_IF_MAGIC 0x25873401
20051 +#define DIVERT_IF_MAGIC 0x25873402
20052  #define DIVERT_CMD_REG  0x00  /* register command */
20053  #define DIVERT_CMD_REL  0x01  /* release command */
20054  #define DIVERT_NO_ERR   0x00  /* return value no error */
20055 @@ -34,6 +34,7 @@
20056      int (*ll_cmd)(isdn_ctrl *); /* supplied by hl on return */
20057      char * (*drv_to_name)(int); /* map a driver id to name, supplied by hl */
20058      int (*name_to_drv)(char *); /* map a driver id to name, supplied by hl */
20059 +    int (*dial_net_name)(char *); /* force dial of a ll net interface  */
20060    } isdn_divert_if;
20061  
20062  /*********************/
20063 diff -rNu linux-2.4.29.old/include/linux/isdn_dwabc.h linux-2.4.29/include/linux/isdn_dwabc.h
20064 --- linux-2.4.29.old/include/linux/isdn_dwabc.h 1970-01-01 01:00:00.000000000 +0100
20065 +++ linux-2.4.29/include/linux/isdn_dwabc.h     2005-03-22 15:06:50.048484256 +0100
20066 @@ -0,0 +1,84 @@
20067 +/* $Id: isdn_dwabc.h,v 1.9 2001/09/26 20:32:08 detabc Exp $
20068 + *
20069 + * Header for the Linux ISDN abc-extension.
20070 + *
20071 + * Copyright           by abc GmbH
20072 + *                     written by Detlef Wengorz <detlefw@isdn4linux.de>
20073 + * 
20074 + * This software may be used and distributed according to the terms
20075 + * of the GNU General Public License, incorporated herein by reference.
20076 + *
20077 + */
20078 +
20079 +#ifndef ISDN_DWABC_H
20080 +#define ISDN_DWABC_H
20081 +
20082 +#ifdef __KERNEL__
20083 +#include <linux/types.h>
20084 +#include <linux/kernel.h>
20085 +#include <linux/sched.h>
20086 +#include <linux/smp.h>
20087 +#include <linux/spinlock.h>
20088 +#include <linux/errno.h>
20089 +
20090 +
20091 +typedef struct ISDN_DWSPINLOCK {
20092 +
20093 +       spinlock_t      spin;
20094 +       short           owner;
20095 +       short           my_flags;
20096 +       ulong           irq_flags;
20097 +
20098 +} ISDN_DWSPINLOCK;
20099 +
20100 +#define ISDN_DWSPIN_UNLOCKED                           \
20101 +       (ISDN_DWSPINLOCK) {                                             \
20102 +               spin:           SPIN_LOCK_UNLOCKED,             \
20103 +               owner:          -1,                                             \
20104 +               my_flags:       0,                                              \
20105 +               irq_flags:      0,                                              \
20106 +       }
20107 +
20108 +#define ISDN_DWSPIN_INIT(x)                    \
20109 +                       do { *(x) = ISDN_DWSPIN_UNLOCKED; } while(0);
20110 +
20111 +static __inline__ int isdn_dwspin_trylock(ISDN_DWSPINLOCK *spin)
20112 +{
20113 +       if(!spin_trylock(&spin->spin)) {
20114 +
20115 +               if(spin->owner == smp_processor_id())
20116 +                       return(-EAGAIN);
20117 +
20118 +               spin_lock(&spin->spin);
20119 +       }
20120 +
20121 +       spin->owner = smp_processor_id();
20122 +       return(0);
20123 +}
20124 +
20125 +static __inline__ void isdn_dwspin_unlock(ISDN_DWSPINLOCK *spin)
20126 +{
20127 +       spin->owner = -1;
20128 +       spin_unlock(&spin->spin);
20129 +}
20130 +
20131 +
20132 +#else
20133 +#include <sys/types.h>
20134 +#endif
20135 +
20136 +#define DWABC_LCR_FLG_NEWNUMBER                0x00000001L
20137 +#define DWABC_LCR_FLG_DISABLE          0x00000002L
20138 +#define DWABC_LCR_FLG_NEWHUPTIME       0x00000004L
20139 +
20140 +
20141 +struct ISDN_DWABC_LCR_IOCTL {
20142 +
20143 +       int     lcr_ioctl_sizeof;       /* mustbe sizeof(ISDN_DWABC_LCR_IOCTL)  */
20144 +       u_short lcr_ioctl_onhtime;      /* new hanguptime                                               */
20145 +       u_long  lcr_ioctl_callid;       /* callid from lcr-subsystem                    */
20146 +       u_long  lcr_ioctl_flags;        /* see above                                                    */
20147 +       char    lcr_ioctl_nr[32];       /* new destination phonenumber                  */
20148 +};
20149 +
20150 +#endif
20151 diff -rNu linux-2.4.29.old/include/linux/isdn_lzscomp.h linux-2.4.29/include/linux/isdn_lzscomp.h
20152 --- linux-2.4.29.old/include/linux/isdn_lzscomp.h       2005-03-22 14:47:32.000000000 +0100
20153 +++ linux-2.4.29/include/linux/isdn_lzscomp.h   2005-03-22 15:06:50.089478024 +0100
20154 @@ -1,4 +1,4 @@
20155 -/* $Id: isdn_lzscomp.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
20156 +/* $Id$
20157   *
20158   * Header for isdn_lzscomp.c
20159   * Concentrated here to not mess up half a dozen kernel headers with code
20160 diff -rNu linux-2.4.29.old/include/linux/isdn_ppp.h linux-2.4.29/include/linux/isdn_ppp.h
20161 --- linux-2.4.29.old/include/linux/isdn_ppp.h   2005-03-22 14:47:31.000000000 +0100
20162 +++ linux-2.4.29/include/linux/isdn_ppp.h       2005-03-22 15:06:50.116473920 +0100
20163 @@ -8,6 +8,7 @@
20164  #ifndef _LINUX_ISDN_PPP_H
20165  #define _LINUX_ISDN_PPP_H
20166  
20167 +#include <linux/isdn_compat.h>
20168  
20169  #define CALLTYPE_INCOMING 0x1
20170  #define CALLTYPE_OUTGOING 0x2
20171 @@ -33,6 +34,11 @@
20172  #define PPPIOCSCOMPRESSOR _IOW('t',135,int)
20173  #define PPPIOCGIFNAME      _IOR('t',136, char [IFNAMSIZ] )
20174  
20175 +#ifdef COMPAT_NEED_MPPP_DEFS
20176 +#define PPP_MP          0x003d
20177 +#define PPP_COMPFRAG    0x00fb
20178 +#define PPP_CCPFRAG     0x80fb
20179 +#endif
20180  
20181  #define SC_MP_PROT       0x00000200
20182  #define SC_REJ_MP_PROT   0x00000400
20183 @@ -65,9 +71,6 @@
20184  
20185  #include <linux/config.h>
20186  
20187 -#ifdef CONFIG_IPPP_FILTER
20188 -#include <linux/filter.h>
20189 -#endif
20190  
20191  #define DECOMP_ERR_NOMEM       (-10)
20192  
20193 @@ -226,10 +229,6 @@
20194    unsigned char *cbuf;
20195    struct slcompress *slcomp;
20196  #endif
20197 -#ifdef CONFIG_IPPP_FILTER
20198 -  struct sock_fprog pass_filter;       /* filter for packets to pass */
20199 -  struct sock_fprog active_filter;     /* filter for pkts to reset idle */
20200 -#endif
20201    unsigned long debug;
20202    struct isdn_ppp_compressor *compressor,*decompressor;
20203    struct isdn_ppp_compressor *link_compressor,*link_decompressor;
20204 diff -rNu linux-2.4.29.old/include/linux/isdnif.h linux-2.4.29/include/linux/isdnif.h
20205 --- linux-2.4.29.old/include/linux/isdnif.h     2005-03-22 14:47:31.000000000 +0100
20206 +++ linux-2.4.29/include/linux/isdnif.h 2005-03-22 15:06:50.132471488 +0100
20207 @@ -1,4 +1,4 @@
20208 -/* $Id: isdnif.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
20209 +/* $Id: isdnif.h,v 1.43 2002/02/09 21:19:11 keil Exp $
20210   *
20211   * Linux ISDN subsystem
20212   * Definition of the interface between the subsystem and its low-level drivers.
20213 @@ -14,6 +14,7 @@
20214  #ifndef __ISDNIF_H__
20215  #define __ISDNIF_H__
20216  
20217 +#include <linux/isdn_compat.h>
20218  
20219  /*
20220   * Values for general protocol-selection
20221 @@ -213,6 +214,8 @@
20222  #define ISDN_STAT_FAXIND  276    /* FAX indications from HL-driver        */
20223  #define ISDN_STAT_AUDIO   277    /* DTMF, DSP indications                 */
20224  #define ISDN_STAT_DISCH   278    /* Disable/Enable channel usage          */
20225 +#define ISDN_STAT_ALERT   279    /* Signal alerting                       */
20226 +#define ISDN_STAT_PROCEED 280    /* Signal proceeding                     */
20227  
20228  /*
20229   * Audio commands
20230 diff -rNu linux-2.4.29.old/include/linux/kernelcapi.h linux-2.4.29/include/linux/kernelcapi.h
20231 --- linux-2.4.29.old/include/linux/kernelcapi.h 2005-03-22 14:47:32.000000000 +0100
20232 +++ linux-2.4.29/include/linux/kernelcapi.h     2005-03-22 15:06:50.147469208 +0100
20233 @@ -1,12 +1,10 @@
20234 -/* $Id: kernelcapi.h,v 1.1.4.2 2002/01/28 18:25:10 kai Exp $
20235 +/*
20236 + * $Id: kernelcapi.h,v 1.9 2000/11/28 09:34:02 kai Exp $
20237   * 
20238   * Kernel CAPI 2.0 Interface for Linux
20239   * 
20240   * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
20241   * 
20242 - * This software may be used and distributed according to the terms
20243 - * of the GNU General Public License, incorporated herein by reference.
20244 - *
20245   */
20246  
20247  #ifndef __KERNELCAPI_H__