c7352551f776705c87a56c5aae807a556e92127c
[openwrt/svn-archive/archive.git] / target / linux / generic-2.4 / patches / 200-i4l.patch
1 --- a/Documentation/isdn/CREDITS
2 +++ b/Documentation/isdn/CREDITS
3 @@ -37,7 +37,7 @@ Michael Knigge (knick@cove.han.de)
4 Andreas Kool (akool@Kool.f.EUnet.de)
5 For contribution of the isdnlog/isdnrep-tool
6
7 -Pedro Roque Marques (pedro_m@yahoo.com)
8 +Pedro Roque Marques (roque@di.fc.ul.pt)
9 For lot of new ideas and the pcbit driver.
10
11 Eberhard Moenkeberg (emoenke@gwdg.de)
12 --- a/Documentation/isdn/HiSax.cert
13 +++ b/Documentation/isdn/HiSax.cert
14 @@ -68,6 +68,8 @@ drivers/isdn/hisax/cert.c
15 drivers/isdn/hisax/elsa.c
16 drivers/isdn/hisax/diva.c
17 drivers/isdn/hisax/hfc_pci.c
18 +drivers/isdn/hisax/hfc_usbr.c
19 +drivers/isdn/hisax/hfc_usb.c
20
21 Please send any changes, bugfixes and patches to me rather than implementing
22 them directly into the HiSax sources.
23 --- a/Documentation/isdn/INTERFACE
24 +++ b/Documentation/isdn/INTERFACE
25 @@ -1,4 +1,4 @@
26 -$Id: INTERFACE,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
27 +$Id: INTERFACE,v 1.17 2002/01/31 13:26:35 keil Exp $
28
29 Description of the Interface between Linklevel and Hardwarelevel
30 of isdn4linux:
31 @@ -399,7 +399,7 @@ Description of the Interface between Lin
32 protocol-Id is one of the constants ISDN_PROTO_L3...
33 parm.fax = Pointer to T30_s fax struct. (fax usage only)
34
35 - ISDN_CMD_GETL2: (currently unused)
36 + ISDN_CMD_GETL3: (currently unused)
37
38 With this command, the HL-driver is told to return the current
39 setting of the Layer-3-protocol.
40 @@ -781,3 +781,22 @@ Description of the Interface between Lin
41 arg = channel-number, locally to the driver. (starting with 0)
42 parm = unused.
43
44 + ISDN_STAT_ALERT:
45 +
46 + With this call, the HL-driver signals the receive of an ALERTING message to the LL.
47 +
48 + Parameter:
49 + driver = driver-Id
50 + command = ISDN_STAT_ALERT
51 + arg = channel-number, locally to the driver. (starting with 0)
52 +
53 + ISDN_STAT_PROCEED:
54 +
55 + With this call, the HL-driver signals the receive of an CALL PROCEEDING message
56 + to the LL.
57 +
58 + Parameter:
59 + driver = driver-Id
60 + command = ISDN_STAT_PROCEED
61 + arg = channel-number, locally to the driver. (starting with 0)
62 +
63 --- a/Documentation/isdn/INTERFACE.fax
64 +++ b/Documentation/isdn/INTERFACE.fax
65 @@ -1,4 +1,4 @@
66 -$Id: INTERFACE.fax,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
67 +$Id: INTERFACE.fax,v 1.2 2000/08/06 09:22:50 armin Exp $
68
69
70 Description of the fax-subinterface between linklevel and hardwarelevel of
71 --- a/Documentation/isdn/README
72 +++ b/Documentation/isdn/README
73 @@ -278,6 +278,12 @@ README for the ISDN-subsystem
74 1 = Add CPN to FCON message on
75 Bit 2: 0 = Add CDN to RING/FCON message off
76 1 = Add CDN to RING/FCON message on
77 + Bit 3: 0 = Do not signal RINGING
78 + 1 = Signal RINGING if ALERT was received
79 + Bit 4: 0 = Do not signal PROCEEDING
80 + 1 = Signal PROCEEDING if CALL PROCEEDING
81 + was received
82 +
83
84 Last but not least a (at the moment fairly primitive) device to request
85 the line-status (/dev/isdninfo) is made available.
86 --- a/Documentation/isdn/README.HiSax
87 +++ b/Documentation/isdn/README.HiSax
88 @@ -41,10 +41,9 @@ ELSA Quickstep 3000 (same settings as QS
89 ELSA Quickstep 3000PCI
90 ELSA PCMCIA
91 ITK ix1-micro Rev.2
92 -Eicon Diva 2.0 ISA and PCI (S0 and U interface, no PRO version)
93 -Eicon Diva 2.01 ISA and PCI
94 -Eicon Diva 2.02 PCI
95 -Eicon Diva Piccola
96 +Eicon.Diehl Diva 2.0 ISA and PCI (S0 and U interface, no PRO version)
97 +Eicon.Diehl Diva 2.01 ISA and PCI
98 +Eicon.Diehl Diva Piccola
99 ASUSCOM NETWORK INC. ISDNLink 128K PC adapter (order code I-IN100-ST-D)
100 Dynalink IS64PH (OEM version of ASUSCOM NETWORK INC. ISDNLink 128K adapter)
101 PCBIT-DP (OEM version of ASUSCOM NETWORK INC. ISDNLink)
102 @@ -53,7 +52,6 @@ Sedlbauer Speed Card (Speed Win, Teledat
103 Sedlbauer Speed Star/Speed Star2 (PCMCIA)
104 Sedlbauer ISDN-Controller PC/104
105 USR Sportster internal TA (compatible Stollmann tina-pp V3)
106 -USR internal TA PCI
107 ith Kommunikationstechnik GmbH MIC 16 ISA card
108 Traverse Technologie NETjet PCI S0 card and NETspider U card
109 Ovislink ISDN sc100-p card (NETjet driver)
110 @@ -68,14 +66,14 @@ Gazel ISDN cards
111 HFC-PCI based cards
112 Winbond W6692 based cards
113 HFC-S+, HFC-SP/PCMCIA cards
114 -formula-n enternow
115 -Gerdes Power ISDN
116 +HFC-USB ISDN TAs
117
118 Note: PCF, PCF-Pro: up to now, only the ISDN part is supported
119 PCC-8: not tested yet
120 Eicon.Diehl Diva U interface not tested
121
122 If you know other passive cards with the Siemens chipset, please let me know.
123 +To use the PNP cards you need the isapnptools.
124 You can combine any card, if there is no conflict between the resources
125 (io, mem, irq).
126
127 @@ -91,15 +89,8 @@ There is also some config needed before
128 modules. It is included in the normal "make [menu]config" target at the
129 kernel. Don't forget it, especially to select the right D-channel protocol.
130
131 -Please note: In older versions of the HiSax driver, all PnP cards
132 -needed to be configured with isapnp and worked only with the HiSax
133 -driver used as a module.
134 -
135 -In the current version, HiSax will automatically use the in-kernel
136 -ISAPnP support, provided you selected it during kernel configuration
137 -(CONFIG_ISAPNP), if you don't give the io=, irq= command line parameters.
138 -
139 -The affected card types are: 4,7,12,14,19,27-30
140 +Please note: All PnP cards need to be configured with isapnp and will work
141 +only with the HiSax driver used as a module.
142
143 a) when built as a module
144 -------------------------
145 @@ -200,8 +191,6 @@ Card types:
146 37 HFC 2BDS0 S+, SP irq,io
147 38 NETspider U PCI card none
148 39 HFC 2BDS0 SP/PCMCIA irq,io (set with cardmgr)
149 - 40 hotplug interface
150 - 41 Formula-n enter:now PCI none
151
152 At the moment IRQ sharing is only possible with PCI cards. Please make sure
153 that your IRQ is free and enabled for ISA use.
154 @@ -227,13 +216,6 @@ Examples for module loading
155 (IO 1 (BASE 0x0180))
156 modprobe hisax type=4 protocol=2 irq=10 io0=0x580 io1=0x180
157
158 - In the current version of HiSax, you can instead simply use
159 -
160 - modprobe hisax type=4 protocol=2
161 -
162 - if you configured your kernel for ISAPnP. Don't run isapnp in
163 - this case!
164 -
165 6. Teles 16.3, Euro ISDN, I/O base 280 hex, IRQ 12 and
166 Teles 16.0, 1TR6, IRQ 5, Memory d0000 hex
167 modprobe hisax type=3,1 protocol=2,1 io=0x280 mem=0,0xd0000
168 @@ -314,9 +296,7 @@ type
169 36 W6692 based PCI cards none
170 37 HFC 2BDS0 S+,SP/PCMCIA ONLY WORKS AS A MODULE !
171 38 NETspider U PCI card none
172 - 39 HFC 2BDS0 SP/PCMCIA ONLY WORKS AS A MODULE !
173 - 40 hotplug interface ONLY WORKS AS A MODULE !
174 - 41 Formula-n enter:now PCI none
175 +
176
177 Running the driver
178 ------------------
179 --- a/Documentation/isdn/README.act2000
180 +++ b/Documentation/isdn/README.act2000
181 @@ -1,4 +1,4 @@
182 -$Id: README.act2000,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
183 +$Id: README.act2000,v 1.3 2000/08/06 09:22:51 armin Exp $
184
185 This document describes the ACT2000 driver for the
186 IBM Active 2000 ISDN card.
187 --- a/Documentation/isdn/README.audio
188 +++ b/Documentation/isdn/README.audio
189 @@ -1,4 +1,4 @@
190 -$Id: README.audio,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
191 +$Id: README.audio,v 1.8 1999/07/11 17:17:29 armin Exp $
192
193 ISDN subsystem for Linux.
194 Description of audio mode.
195 --- a/Documentation/isdn/README.eicon
196 +++ b/Documentation/isdn/README.eicon
197 @@ -1,4 +1,4 @@
198 -$Id: README.eicon,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
199 +$Id: README.eicon,v 1.10 2000/08/13 12:19:15 armin Exp $
200
201 (c) 1999,2000 Armin Schindler (mac@melware.de)
202 (c) 1999,2000 Cytronics & Melware (info@melware.de)
203 --- a/Documentation/isdn/README.hysdn
204 +++ b/Documentation/isdn/README.hysdn
205 @@ -1,4 +1,4 @@
206 -$Id: README.hysdn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
207 +$Id: README.hysdn,v 1.3.6.1 2001/02/10 14:41:19 kai Exp $
208 The hysdn driver has been written by
209 by Werner Cornelius (werner@isdn4linux.de or werner@titro.de)
210 for Hypercope GmbH Aachen Germany. Hypercope agreed to publish this driver
211 --- a/Documentation/isdn/README.icn
212 +++ b/Documentation/isdn/README.icn
213 @@ -1,4 +1,4 @@
214 -$Id: README.icn,v 1.1.4.1 2001/11/20 14:19:33 kai Exp $
215 +$Id: README.icn,v 1.7 2000/08/06 09:22:51 armin Exp $
216
217 You can get the ICN-ISDN-card from:
218
219 --- a/Documentation/isdn/README.pcbit
220 +++ b/Documentation/isdn/README.pcbit
221 @@ -37,4 +37,4 @@ mailing list (isdn4linux@listserv.isdn4l
222 regards,
223 Pedro.
224
225 -<pedro_m@yahoo.com>
226 +<roque@di.fc.ul.pt>
227 --- /dev/null
228 +++ b/Documentation/isdn/abcext_kernel.help
229 @@ -0,0 +1,166 @@
230 +
231 +ISDN-ABC-DW Extension
232 +CONFIG_ISDN_WITH_ABC
233 + These are many brand new Options and Features for the
234 + ISDN SUBSYSTEM. Including Logical Device bindings,
235 + Compression and other good stuff for Optimizing your
236 + ISDN System.
237 +
238 + To Use this Extensions you MUST HAVE THE NEWEST
239 + ISDN4K-UTILS. You must have Version 3.1-Beta6 or
240 + higher. Elsewhere you can not configure this Extensions.
241 +
242 + WARNING ! THIS STUF IS NOT PRODUCTION RELEASE THE
243 + FUNCTION ARE UNDER DEVELOPMENT. This ist BETA-CODE.
244 + You can use it at you Own Risk.
245 +
246 + For more Information on these Extensions take a look at
247 + "linux/Documentation/isdn/dw-abc-extension-howto.txt or
248 + Online at the Web "http://www.mediatronix.de/i4l/index.html"
249 +
250 + Please Report Bugs to "mario@mediatronix.de" or
251 + "delefw@isdn4linux.de"
252 +
253 +D-Channel-Callback with Channel in use check
254 +CONFIG_ISDN_WITH_ABC_CALLB
255 + When a Interface is declared as an Callback Interface,
256 + the Interface is checking that the other Side is not
257 + Calling on the same time before the Interface is Dialing.
258 +
259 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
260 + for more Information
261 +
262 + In most case answer with "Yes" when you have Callback devices,
263 + otherwise leave it "No"
264 +
265 +Outgoing-EAZ-Support
266 +CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
267 + Enables the Feature to Define an other EAZ or MSN for
268 + Outgoing calls on an Interface.
269 +
270 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
271 + for more Information
272 +
273 +Least Cost Router Support
274 +CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
275 + This is the final Kernel Code for configuring an Least
276 + Cost Router Softwarebased. The other Job is to do the
277 + action in ISDNLOG. You need the ISDNLOG to use this
278 + function. Currently the ISDNLOG have not the Support for
279 + this Option.
280 + So in most situations let the Option off.
281 +
282 +TCP keepalive detect and response
283 +CONFIG_ISDN_WITH_ABC_IPV4_TCP_KEEPALIVE
284 + This Option works only with the TCP/IP V4. It enables
285 + the Function that ISDN Devices are Answering TCP_KEEPALIVE Pakets
286 + localy. So that TCP KEEPALIVE Pakets not longer takes the Line
287 + open.
288 +
289 +Drop frames Sourceadresse is not Interfaceadress
290 +CONFIG_ISDN_WITH_ABC_IPV4_DYNADDR
291 + This Option works only with the TCP/IP V4. It will allow only
292 + the Transmitt of Pakets where the Sourceadresse is the Interface
293 + adress. It is usefull when you have Lines with Dynamic IP.
294 +
295 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
296 + for more Information
297 +
298 +Receive do not reset the Hanguptimer
299 +CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
300 + When you activate this option than the reiceive of pakets do
301 + not reset the Hanguptimer. It is very usefull because if the
302 + Paket vor your Network your Network generate an Response and
303 + the Transmit is reseting the HUPTIMER. But when the Paket is
304 + Rejected at your firewall your network generate no Response
305 + and no Sendtraffic is generated. So in this case there is no
306 + need to Reset the Huptimer because you have only received Data.
307 + With that option only Transmitted Data/Pakets will reset the
308 + HUPTIMER.
309 +
310 +Support of (device-channel) and Binding Groups
311 +CONFIG_ISDN_WITH_ABC_ICALL_BIND
312 + This Option enables the Feature to Bind logical ISDN Interfaces
313 + to an prefered ISDN Card or ISDN Card plus Channel. So you have
314 + the Chance to keep Channels exclusively for one (or more)
315 + Connection. Very usefull when you have more channels and Use
316 + Calling Line Identification, because you can organize that your
317 + call is going out over the Line with the right EAZ for the CLI.
318 +
319 +Skip channel if used external (Dial Only)
320 +CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
321 + When you have more than One ISDN Card in your System and you
322 + will Dialout with an Interface you can become the Situation
323 + that an External Device such a Telephone or Fax is Using the
324 + B-Channels. Normaly ISDN4Linux does not detect this Situation
325 + and dial everytime of the "External Busy" line out. With this
326 + Option Enabled the I4L will detect that he can not dialout on
327 + This Card and dial over the next Card out.
328 +
329 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
330 + for more Information
331 +
332 +Interface autodisable if Config error
333 +CONFIG_ISDN_WITH_ABC_CONN_ERROR
334 + This Option will detect an Device which generate Telephone
335 + Cost but does not Function correctly because there are
336 + Configerrors on one of the Site. In this Situation the
337 + Interface will be marked as Unsuably for some time to do
338 + not call every time this Site.
339 +
340 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
341 + for more Information
342 +
343 +UDP-Info-Support
344 +CONFIG_ISDN_WITH_ABC_UDP_CHECK
345 + This is the Mainoption to Enable or Disable the UDP
346 + Info Support. An Option to Controll ISDN-Interfaces
347 + Remotely. For this very Complex thing take a look at
348 +
349 + "linux/Documentation/isdn/dw-abc-extension-howto.txt"
350 + for more Information.
351 +
352 +UDP Hangup Support
353 +CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
354 +
355 + Sorry no more Information!
356 +
357 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
358 + for more Information
359 +
360 +UDP Dial Support
361 +CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
362 +
363 + Sorry no more Information!
364 +
365 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
366 + for more Information
367 +
368 +Limit on the line frames to two
369 +CONFIG_ISDN_WITH_ABC_FRAME_LIMIT
370 +
371 + This Option enables support for sending only 2 Pakets on
372 + the Fly to the ISDN Driver. It is very usefull when you
373 + will use the new RAW-IP Compression. Because of sending
374 + Only 2 Pakets on the Fly makes the risk of overflowing
375 + the ISDN Driver very smaller.
376 +
377 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
378 + for more Information
379 +
380 +Compression with RAWIP and X75I
381 +CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
382 +
383 + With this Option you have the ability to make Datacompression
384 + on RAW-IP Lines. It is function on HDLC and X75I Connection,
385 + but the Prefered L2-Protocol for Compression is X75I because
386 + the HDLC Protocol have no Errorcorrection.
387 +
388 + To Use this Option YOU MUST HAVE ENABLED THE OPTION:
389 + Support synchronous PPP
390 + and must load after loading the main isdndrivers the
391 + Modul "isdn_bsdcomp".
392 +
393 + See "linux/Documentation/isdn/dw-abc-extension-howto.txt"
394 + for more Information
395 +
396 --- a/drivers/isdn/Config.in
397 +++ b/drivers/isdn/Config.in
398 @@ -4,11 +4,9 @@
399
400 # only included if CONFIG_ISDN != n
401
402 -define_bool CONFIG_ISDN_BOOL y
403 if [ "$CONFIG_INET" != "n" ]; then
404 bool ' Support synchronous PPP' CONFIG_ISDN_PPP
405 if [ "$CONFIG_ISDN_PPP" != "n" ]; then
406 - dep_bool ' PPP filtering for ISDN' CONFIG_IPPP_FILTER $CONFIG_FILTER
407 bool ' Use VJ-compression with synchronous PPP' CONFIG_ISDN_PPP_VJ
408 bool ' Support generic MP (RFC 1717)' CONFIG_ISDN_MPP
409 dep_tristate ' Support BSD compression' CONFIG_ISDN_PPP_BSDCOMP $CONFIG_ISDN
410 @@ -23,6 +21,30 @@ if [ "$CONFIG_X25" != "n" ]; then
411 fi
412
413 mainmenu_option next_comment
414 +comment 'ISDN abc-dw-extension'
415 +bool 'Enable isdn-abc-dw-extension' CONFIG_ISDN_WITH_ABC
416 +if [ "$CONFIG_ISDN_WITH_ABC" != "n" ]; then
417 + bool ' Use D-Channel-Callback with Channel in use check' CONFIG_ISDN_WITH_ABC_CALLB
418 + bool ' Enable Outgoing-EAZ-Support' CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ
419 + bool ' Enable LCR-Support (need isdnlog)' CONFIG_ISDN_WITH_ABC_LCR_SUPPORT
420 + bool ' RX dont reset hanguptimeout' CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER
421 + if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
422 + bool ' Enable UDP-Info-Support' CONFIG_ISDN_WITH_ABC_UDP_CHECK
423 + if [ "$CONFIG_ISDN_WITH_ABC_UDP_CHECK" != "n" ]; then
424 + bool ' Enable Hangup-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP
425 + bool ' Enable Dial-Support with UDP-INFO' CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL
426 + fi
427 + fi
428 +
429 + bool ' Skip channel if used external (dial only)' CONFIG_ISDN_WITH_ABC_CH_EXTINUSE
430 + bool ' Support interface-auto-disable if config-error' CONFIG_ISDN_WITH_ABC_CONN_ERROR
431 + if [ "$CONFIG_ISDN_PPP" != "n" ]; then
432 + bool ' Enable Compression with rawip and x75i' CONFIG_ISDN_WITH_ABC_RAWIPCOMPRESS
433 + fi
434 +fi
435 +endmenu
436 +
437 +mainmenu_option next_comment
438 comment 'ISDN feature submodules'
439 dep_tristate 'isdnloop support' CONFIG_ISDN_DRV_LOOP $CONFIG_ISDN
440 dep_tristate 'Support isdn diversion services' CONFIG_ISDN_DIVERSION $CONFIG_ISDN
441 @@ -34,7 +56,6 @@ mainmenu_option next_comment
442 comment 'Passive ISDN cards'
443 dep_tristate 'HiSax SiemensChipSet driver support' CONFIG_ISDN_DRV_HISAX $CONFIG_ISDN
444 if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then
445 - define_bool CONFIG_ISDN_HISAX y
446 comment ' D-channel protocol features'
447 bool ' HiSax Support for EURO/DSS1' CONFIG_HISAX_EURO
448 if [ "$CONFIG_HISAX_EURO" != "n" ]; then
449 @@ -45,31 +66,28 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ];
450 fi
451 bool ' HiSax Support for german 1TR6' CONFIG_HISAX_1TR6
452 bool ' HiSax Support for US NI1' CONFIG_HISAX_NI1
453 - int ' Maximum number of cards supported by HiSax' CONFIG_HISAX_MAX_CARDS 8
454 comment ' HiSax supported cards'
455 - if [ "$CONFIG_ISA" != "n" ]; then
456 - bool ' Teles 16.0/8.0' CONFIG_HISAX_16_0
457 - bool ' Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3
458 - bool ' AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1
459 - bool ' ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2
460 - bool ' ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM
461 - bool ' TELEINT cards' CONFIG_HISAX_TELEINT
462 - bool ' HFC-S based cards' CONFIG_HISAX_HFCS
463 - bool ' USR Sportster internal TA' CONFIG_HISAX_SPORTSTER
464 - bool ' MIC card' CONFIG_HISAX_MIC
465 - bool ' Siemens I-Surf card' CONFIG_HISAX_ISURF
466 - bool ' HST Saphir card' CONFIG_HISAX_HSTSAPHIR
467 - fi
468 + bool ' Teles 16.0/8.0' CONFIG_HISAX_16_0
469 + bool ' Teles 16.3 or PNP or PCMCIA' CONFIG_HISAX_16_3
470 bool ' Teles PCI' CONFIG_HISAX_TELESPCI
471 bool ' Teles S0Box' CONFIG_HISAX_S0BOX
472 + bool ' AVM A1 (Fritz)' CONFIG_HISAX_AVM_A1
473 bool ' AVM PnP/PCI (Fritz!PnP/PCI)' CONFIG_HISAX_FRITZPCI
474 bool ' AVM A1 PCMCIA (Fritz)' CONFIG_HISAX_AVM_A1_PCMCIA
475 bool ' Elsa cards' CONFIG_HISAX_ELSA
476 + bool ' ITK ix1-micro Revision 2' CONFIG_HISAX_IX1MICROR2
477 bool ' Eicon.Diehl Diva cards' CONFIG_HISAX_DIEHLDIVA
478 + bool ' ASUSCOM ISA cards' CONFIG_HISAX_ASUSCOM
479 + bool ' TELEINT cards' CONFIG_HISAX_TELEINT
480 + bool ' HFC-S based cards' CONFIG_HISAX_HFCS
481 bool ' Sedlbauer cards' CONFIG_HISAX_SEDLBAUER
482 + bool ' USR Sportster internal TA' CONFIG_HISAX_SPORTSTER
483 + bool ' MIC card' CONFIG_HISAX_MIC
484 bool ' NETjet card' CONFIG_HISAX_NETJET
485 bool ' NETspider U card' CONFIG_HISAX_NETJET_U
486 bool ' Niccy PnP/PCI card' CONFIG_HISAX_NICCY
487 + bool ' Siemens I-Surf card' CONFIG_HISAX_ISURF
488 + bool ' HST Saphir card' CONFIG_HISAX_HSTSAPHIR
489 bool ' Telekom A4T card' CONFIG_HISAX_BKM_A4T
490 bool ' Scitel Quadro card' CONFIG_HISAX_SCT_QUADRO
491 bool ' Gazel cards' CONFIG_HISAX_GAZEL
492 @@ -78,20 +96,27 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ];
493 bool ' HFC-S+, HFC-SP, HFC-PCMCIA cards' CONFIG_HISAX_HFC_SX
494 if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
495 # bool ' TESTEMULATOR (EXPERIMENTAL)' CONFIG_HISAX_TESTEMU
496 - bool ' Formula-n enter:now PCI card' CONFIG_HISAX_ENTERNOW_PCI
497 if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then
498 bool ' Am7930' CONFIG_HISAX_AMD7930
499 fi
500 fi
501 bool ' HiSax debugging' CONFIG_HISAX_DEBUG
502
503 - dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
504 - dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
505 - dep_tristate 'AVM A1 PCMCIA cards' CONFIG_HISAX_AVM_A1_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA $CONFIG_HISAX_AVM_A1_PCMCIA
506 - dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
507 - dep_tristate 'AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
508 - dep_tristate 'Auerswald devices ISDN support' CONFIG_USB_AUERISDN $CONFIG_ISDN_DRV_HISAX
509 + dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_PCMCIA
510 + dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_PCMCIA
511 + dep_tristate 'Colognechip HFC-USB support' CONFIG_HISAX_HFC_USB_CS $CONFIG_HISAX $CONFIG_USB
512 + dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_HISAX $CONFIG_USB $CONFIG_EXPERIMENTAL
513 + dep_tristate 'Fritz!PCIv2 support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_HISAX $CONFIG_EXPERIMENTAL
514
515 + if [ "$CONFIG_HISAX_SEDLBAUER_CS" != "n" ]; then
516 + define_bool CONFIG_HISAX_SEDLBAUER y
517 + fi
518 + if [ "$CONFIG_HISAX_ELSA_CS" != "n" ]; then
519 + define_bool CONFIG_HISAX_ELSA y
520 + fi
521 + if [ "$CONFIG_HISAX_HFC_USB_CS" != "n" ]; then
522 + define_bool CONFIG_HISAX_HFC_USB y
523 + fi
524 fi
525 endmenu
526
527 --- a/drivers/isdn/Makefile
528 +++ b/drivers/isdn/Makefile
529 @@ -2,7 +2,7 @@
530
531 # The target object and module list name.
532
533 -O_TARGET := vmlinux-obj.o
534 +O_TARGET := isdn.a
535
536 # Objects that export symbols.
537
538 @@ -32,9 +32,9 @@ obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_
539
540 # Object files in subdirectories
541
542 -mod-subdirs := avmb1 eicon hisax
543 +mod-subdirs := avmb1 eicon
544 subdir-$(CONFIG_ISDN_DIVERSION) += divert
545 -subdir-$(CONFIG_ISDN_HISAX) += hisax
546 +subdir-$(CONFIG_ISDN_DRV_HISAX) += hisax
547 subdir-$(CONFIG_ISDN_DRV_ICN) += icn
548 subdir-$(CONFIG_ISDN_DRV_PCBIT) += pcbit
549 subdir-$(CONFIG_ISDN_DRV_SC) += sc
550 --- a/drivers/isdn/act2000/act2000.h
551 +++ b/drivers/isdn/act2000/act2000.h
552 @@ -1,4 +1,4 @@
553 -/* $Id: act2000.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
554 +/* $Id$
555 *
556 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
557 *
558 @@ -178,19 +178,19 @@ typedef struct act2000_card {
559 char regname[35]; /* Name used for request_region */
560 } act2000_card;
561
562 -static inline void act2000_schedule_tx(act2000_card *card)
563 +extern __inline__ void act2000_schedule_tx(act2000_card *card)
564 {
565 queue_task(&card->snd_tq, &tq_immediate);
566 mark_bh(IMMEDIATE_BH);
567 }
568
569 -static inline void act2000_schedule_rx(act2000_card *card)
570 +extern __inline__ void act2000_schedule_rx(act2000_card *card)
571 {
572 queue_task(&card->rcv_tq, &tq_immediate);
573 mark_bh(IMMEDIATE_BH);
574 }
575
576 -static inline void act2000_schedule_poll(act2000_card *card)
577 +extern __inline__ void act2000_schedule_poll(act2000_card *card)
578 {
579 queue_task(&card->poll_tq, &tq_immediate);
580 mark_bh(IMMEDIATE_BH);
581 --- a/drivers/isdn/act2000/act2000_isa.c
582 +++ b/drivers/isdn/act2000/act2000_isa.c
583 @@ -1,4 +1,4 @@
584 -/* $Id: act2000_isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
585 +/* $Id$
586 *
587 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version).
588 *
589 @@ -178,8 +178,7 @@ act2000_isa_config_port(act2000_card * c
590 card->flags &= ~ACT2000_FLAGS_PVALID;
591 }
592 if (!check_region(portbase, ISA_REGION)) {
593 - if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL)
594 - return -EIO;
595 + request_region(portbase, ACT2000_PORTLEN, card->regname);
596 card->port = portbase;
597 card->flags |= ACT2000_FLAGS_PVALID;
598 return 0;
599 @@ -341,6 +340,9 @@ act2000_isa_send(act2000_card * card)
600 while (skb->len) {
601 if (act2000_isa_writeb(card, *(skb->data))) {
602 /* Fifo is full, but more data to send */
603 +#if 0
604 + printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l);
605 +#endif
606 test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock);
607 /* Schedule myself */
608 act2000_schedule_tx(card);
609 @@ -363,6 +365,9 @@ act2000_isa_send(act2000_card * card)
610 } else
611 dev_kfree_skb(skb);
612 card->sbuf = NULL;
613 +#if 0
614 + printk(KERN_DEBUG "act2000_isa_send: %d bytes\n", l);
615 +#endif
616 }
617 }
618
619 --- a/drivers/isdn/act2000/act2000_isa.h
620 +++ b/drivers/isdn/act2000/act2000_isa.h
621 @@ -1,4 +1,4 @@
622 -/* $Id: act2000_isa.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
623 +/* $Id$
624 *
625 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000 (ISA-Version).
626 *
627 --- a/drivers/isdn/act2000/capi.c
628 +++ b/drivers/isdn/act2000/capi.c
629 @@ -1,4 +1,4 @@
630 -/* $Id: capi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
631 +/* $Id$
632 *
633 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
634 * CAPI encoder/decoder
635 @@ -76,6 +76,10 @@ static actcapi_msgdsc valid_msg[] = {
636 {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"},
637 {{ 0x86, 0x03}, "DATA_B3_RESP"},
638 {{ 0xff, 0x03}, "MANUFACTURER_RESP"},
639 +#if 0
640 +/* CAPI 2.0 */
641 + {{ 0x05, 0x80}, "LISTEN_REQ (CAPI 2.0)"},
642 +#endif
643 #endif
644 {{ 0x00, 0x00}, NULL},
645 };
646 --- a/drivers/isdn/act2000/capi.h
647 +++ b/drivers/isdn/act2000/capi.h
648 @@ -1,4 +1,4 @@
649 -/* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
650 +/* $Id$
651 *
652 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
653 *
654 @@ -294,6 +294,19 @@ typedef struct actcapi_msg {
655 __u16 plci;
656 __u16 info;
657 } select_b3_protocol_conf;
658 +#if 0
659 + struct listen_req {
660 + __u32 controller;
661 + __u32 infomask;
662 + __u32 cipmask;
663 + __u32 cipmask2;
664 + __u16 dummy; /* 2 Length-bytes of 2 Structs MUST always be 0!!! */
665 + } listen_req;
666 + struct listen_conf {
667 + __u32 controller;
668 + __u16 info;
669 + } listen_conf;
670 +#else
671 struct listen_req {
672 __u8 controller;
673 __u32 infomask __attribute__ ((packed));
674 @@ -304,6 +317,7 @@ typedef struct actcapi_msg {
675 __u8 controller;
676 __u16 info __attribute__ ((packed));
677 } listen_conf;
678 +#endif
679 struct data_b3_req {
680 __u16 fakencci;
681 __u16 datalen;
682 @@ -330,7 +344,7 @@ typedef struct actcapi_msg {
683 } msg;
684 } actcapi_msg;
685
686 -static inline unsigned short
687 +extern __inline__ unsigned short
688 actcapi_nextsmsg(act2000_card *card)
689 {
690 unsigned long flags;
691 --- a/drivers/isdn/act2000/module.c
692 +++ b/drivers/isdn/act2000/module.c
693 @@ -1,4 +1,4 @@
694 -/* $Id: module.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
695 +/* $Id$
696 *
697 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
698 *
699 @@ -630,6 +630,10 @@ act2000_alloccard(int bus, int port, int
700 card->interface.features =
701 ISDN_FEATURE_L2_X75I |
702 ISDN_FEATURE_L2_HDLC |
703 +#if 0
704 +/* Not yet! New Firmware is on the way ... */
705 + ISDN_FEATURE_L2_TRANS |
706 +#endif
707 ISDN_FEATURE_L3_TRANS |
708 ISDN_FEATURE_P_UNKNOWN;
709 card->interface.hl_hdrlen = 20;
710 @@ -843,6 +847,39 @@ static void __exit act2000_exit(void)
711 }
712 printk(KERN_INFO "%s unloaded\n", DRIVERNAME);
713 }
714 +#if 0
715 +#ifndef MODULE
716 +void
717 +act2000_setup(char *str, int *ints)
718 +{
719 + int i, j, argc, port, irq, bus;
720 +
721 + argc = ints[0];
722 + i = 1;
723 + if (argc)
724 + while (argc) {
725 + port = irq = -1;
726 + bus = 0;
727 + if (argc) {
728 + bus = ints[i];
729 + i++;
730 + argc--;
731 + }
732 + if (argc) {
733 + port = ints[i];
734 + i++;
735 + argc--;
736 + }
737 + if (argc) {
738 + irq = ints[i];
739 + i++;
740 + argc--;
741 + }
742 + act2000_addcard(bus, port, irq, act_id);
743 + }
744 +}
745 +#endif
746 +#endif
747
748 module_init(act2000_init);
749 module_exit(act2000_exit);
750 --- a/drivers/isdn/avmb1/avm_cs.c
751 +++ b/drivers/isdn/avmb1/avm_cs.c
752 @@ -1,4 +1,4 @@
753 -/* $Id: avm_cs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
754 +/* $Id: avm_cs.c,v 1.6 2001/09/24 13:22:44 kai Exp $
755 *
756 * A PCMCIA client driver for AVM B1/M1/M2
757 *
758 --- a/drivers/isdn/avmb1/avmcard.h
759 +++ b/drivers/isdn/avmb1/avmcard.h
760 @@ -1,4 +1,4 @@
761 -/* $Id: avmcard.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
762 +/* $Id: avmcard.h,v 1.12 2001/09/24 13:22:44 kai Exp $
763 *
764 * Copyright 1999 by Carsten Paeth <calle@calle.de>
765 *
766 --- a/drivers/isdn/avmb1/b1.c
767 +++ b/drivers/isdn/avmb1/b1.c
768 @@ -1,4 +1,4 @@
769 -/* $Id: b1.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
770 +/* $Id: b1.c,v 1.26 2001/09/24 13:22:44 kai Exp $
771 *
772 * Common module for AVM B1 cards.
773 *
774 @@ -20,6 +20,7 @@
775 #include <linux/kernelcapi.h>
776 #include <asm/io.h>
777 #include <linux/init.h>
778 +#include <linux/isdn_compat.h>
779 #include <asm/uaccess.h>
780 #include <linux/netdevice.h>
781 #include "capilli.h"
782 @@ -27,7 +28,7 @@
783 #include "capicmd.h"
784 #include "capiutil.h"
785
786 -static char *revision = "$Revision: 1.1.4.1 $";
787 +static char *revision = "$Revision: 1.26 $";
788
789 /* ------------------------------------------------------------- */
790
791 --- a/drivers/isdn/avmb1/b1dma.c
792 +++ b/drivers/isdn/avmb1/b1dma.c
793 @@ -1,4 +1,4 @@
794 -/* $Id: b1dma.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
795 +/* $Id: b1dma.c,v 1.18 2001/09/24 13:22:44 kai Exp $
796 *
797 * Common module for AVM B1 cards that support dma with AMCC
798 *
799 @@ -21,6 +21,7 @@
800 #include <linux/kernelcapi.h>
801 #include <asm/io.h>
802 #include <linux/init.h>
803 +#include <linux/isdn_compat.h>
804 #include <asm/uaccess.h>
805 #include <linux/netdevice.h>
806 #include "capilli.h"
807 @@ -28,7 +29,11 @@
808 #include "capicmd.h"
809 #include "capiutil.h"
810
811 -static char *revision = "$Revision: 1.1.4.1 $";
812 +#if BITS_PER_LONG != 32
813 +#error FIXME: driver requires 32-bit platform
814 +#endif
815 +
816 +static char *revision = "$Revision: 1.18 $";
817
818 /* ------------------------------------------------------------- */
819
820 @@ -851,7 +856,7 @@ int b1dmactl_read_proc(char *page, char
821 __u8 flag;
822 int len = 0;
823 char *s;
824 - u_long txaddr, txlen, rxaddr, rxlen, csr;
825 + __u32 txaddr, txlen, rxaddr, rxlen, csr;
826
827 len += sprintf(page+len, "%-16s %s\n", "name", card->name);
828 len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port);
829 @@ -907,12 +912,12 @@ int b1dmactl_read_proc(char *page, char
830 save_flags(flags);
831 cli();
832
833 - txaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x2c));
834 - txaddr -= (u_long)card->dma->sendbuf;
835 + txaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x2c));
836 + txaddr -= (__u32)card->dma->sendbuf;
837 txlen = b1dmainmeml(card->mbase+0x30);
838
839 - rxaddr = (u_long)phys_to_virt(b1dmainmeml(card->mbase+0x24));
840 - rxaddr -= (u_long)card->dma->recvbuf;
841 + rxaddr = (__u32)phys_to_virt(b1dmainmeml(card->mbase+0x24));
842 + rxaddr -= (__u32)card->dma->recvbuf;
843 rxlen = b1dmainmeml(card->mbase+0x28);
844
845 csr = b1dmainmeml(card->mbase+AMCC_INTCSR);
846 --- a/drivers/isdn/avmb1/b1isa.c
847 +++ b/drivers/isdn/avmb1/b1isa.c
848 @@ -1,4 +1,4 @@
849 -/* $Id: b1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
850 +/* $Id: b1isa.c,v 1.14 2001/09/24 13:22:44 kai Exp $
851 *
852 * Module for AVM B1 ISA-card.
853 *
854 @@ -19,12 +19,13 @@
855 #include <linux/capi.h>
856 #include <linux/init.h>
857 #include <asm/io.h>
858 +#include <linux/isdn_compat.h>
859 #include "capicmd.h"
860 #include "capiutil.h"
861 #include "capilli.h"
862 #include "avmcard.h"
863
864 -static char *revision = "$Revision: 1.1.4.1 $";
865 +static char *revision = "$Revision: 1.14 $";
866
867 /* ------------------------------------------------------------- */
868
869 --- a/drivers/isdn/avmb1/b1pci.c
870 +++ b/drivers/isdn/avmb1/b1pci.c
871 @@ -1,4 +1,4 @@
872 -/* $Id: b1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
873 +/* $Id: b1pci.c,v 1.40 2001/09/24 13:22:44 kai Exp $
874 *
875 * Module for AVM B1 PCI-card.
876 *
877 @@ -21,21 +21,24 @@
878 #include <linux/capi.h>
879 #include <asm/io.h>
880 #include <linux/init.h>
881 +#include <linux/isdn_compat.h>
882 #include "capicmd.h"
883 #include "capiutil.h"
884 #include "capilli.h"
885 #include "avmcard.h"
886
887 -static char *revision = "$Revision: 1.1.4.1 $";
888 +static char *revision = "$Revision: 1.40 $";
889
890 /* ------------------------------------------------------------- */
891
892 +#ifndef COMPAT_HAS_2_2_PCI
893 static struct pci_device_id b1pci_pci_tbl[] __initdata = {
894 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_B1, PCI_ANY_ID, PCI_ANY_ID },
895 { } /* Terminating entry */
896 };
897
898 MODULE_DEVICE_TABLE(pci, b1pci_pci_tbl);
899 +#endif
900 MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 PCI card");
901 MODULE_AUTHOR("Carsten Paeth");
902 MODULE_LICENSE("GPL");
903 @@ -416,14 +419,14 @@ static int add_card(struct pci_dev *dev)
904 }
905 param.irq = dev->irq;
906
907 - if (pci_resource_start(dev, 2)) { /* B1 PCI V4 */
908 + if (pci_resource_start_io(dev, 2)) { /* B1 PCI V4 */
909 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
910 driver = &b1pciv4_driver;
911
912 pci_set_master(dev);
913 #endif
914 - param.membase = pci_resource_start(dev, 0);
915 - param.port = pci_resource_start(dev, 2);
916 + param.membase = pci_resource_start_mem(dev, 0);
917 + param.port = pci_resource_start_io(dev, 2);
918
919 printk(KERN_INFO
920 "%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n",
921 @@ -440,7 +443,7 @@ static int add_card(struct pci_dev *dev)
922 }
923 } else {
924 param.membase = 0;
925 - param.port = pci_resource_start(dev, 1);
926 + param.port = pci_resource_start_io(dev, 1);
927
928 printk(KERN_INFO
929 "%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n",
930 --- a/drivers/isdn/avmb1/b1pcmcia.c
931 +++ b/drivers/isdn/avmb1/b1pcmcia.c
932 @@ -1,4 +1,4 @@
933 -/* $Id: b1pcmcia.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
934 +/* $Id: b1pcmcia.c,v 1.17 2001/09/24 13:22:44 kai Exp $
935 *
936 * Module for AVM B1/M1/M2 PCMCIA-card.
937 *
938 @@ -25,7 +25,7 @@
939 #include "capilli.h"
940 #include "avmcard.h"
941
942 -static char *revision = "$Revision: 1.1.4.1 $";
943 +static char *revision = "$Revision: 1.17 $";
944
945 /* ------------------------------------------------------------- */
946
947 --- a/drivers/isdn/avmb1/c4.c
948 +++ b/drivers/isdn/avmb1/c4.c
949 @@ -1,4 +1,4 @@
950 -/* $Id: c4.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
951 +/* $Id: c4.c,v 1.38 2001/09/24 13:22:44 kai Exp $
952 *
953 * Module for AVM C4 & C2 card.
954 *
955 @@ -18,6 +18,7 @@
956 #include <linux/interrupt.h>
957 #include <linux/ioport.h>
958 #include <linux/pci.h>
959 +#include <linux/isdn_compat.h>
960 #include <linux/capi.h>
961 #include <linux/kernelcapi.h>
962 #include <linux/init.h>
963 @@ -30,7 +31,7 @@
964 #include "capilli.h"
965 #include "avmcard.h"
966
967 -static char *revision = "$Revision: 1.1.4.1 $";
968 +static char *revision = "$Revision: 1.38 $";
969
970 #undef CONFIG_C4_DEBUG
971 #undef CONFIG_C4_POLLDEBUG
972 @@ -39,6 +40,7 @@ static char *revision = "$Revision: 1.1.
973
974 static int suppress_pollack;
975
976 +#ifndef COMPAT_HAS_2_2_PCI
977 static struct pci_device_id c4_pci_tbl[] __initdata = {
978 { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C4 },
979 { PCI_VENDOR_ID_DEC,PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C2 },
980 @@ -46,6 +48,7 @@ static struct pci_device_id c4_pci_tbl[]
981 };
982
983 MODULE_DEVICE_TABLE(pci, c4_pci_tbl);
984 +#endif
985 MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards");
986 MODULE_AUTHOR("Carsten Paeth");
987 MODULE_LICENSE("GPL");
988 @@ -1332,9 +1335,9 @@ static int __init search_cards(struct ca
989 }
990 pci_set_master(dev);
991
992 - param.port = pci_resource_start(dev, 1);
993 + param.port = pci_resource_start_io(dev, 1);
994 param.irq = dev->irq;
995 - param.membase = pci_resource_start(dev, 0);
996 + param.membase = pci_resource_start_mem(dev, 0);
997
998 printk(KERN_INFO
999 "%s: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n",
1000 --- a/drivers/isdn/avmb1/capi.c
1001 +++ b/drivers/isdn/avmb1/capi.c
1002 @@ -1,4 +1,4 @@
1003 -/* $Id: capi.c,v 1.1.4.2 2001/12/09 18:45:13 kai Exp $
1004 +/* $Id: capi.c,v 1.59 2001/11/07 22:35:48 kai Exp $
1005 *
1006 * CAPI 2.0 Interface for Linux
1007 *
1008 @@ -23,6 +23,7 @@
1009 #include <linux/smp_lock.h>
1010 #include <linux/timer.h>
1011 #include <linux/wait.h>
1012 +#include <linux/isdn_compat.h>
1013 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1014 #include <linux/tty.h>
1015 #ifdef CONFIG_PPP
1016 @@ -30,6 +31,9 @@
1017 #include <linux/ppp_defs.h>
1018 #include <linux/if_ppp.h>
1019 #undef CAPI_PPP_ON_RAW_DEVICE
1020 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1021 +#include <linux/ppp_channel.h>
1022 +#endif /* CAPI_PPP_ON_RAW_DEVICE */
1023 #endif /* CONFIG_PPP */
1024 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1025 #include <linux/skbuff.h>
1026 @@ -38,14 +42,16 @@
1027 #include <linux/capi.h>
1028 #include <linux/kernelcapi.h>
1029 #include <linux/init.h>
1030 +#ifdef HAVE_DEVFS_FS
1031 #include <linux/devfs_fs_kernel.h>
1032 +#endif /* HAVE_DEVFS_FS */
1033 #include "capiutil.h"
1034 #include "capicmd.h"
1035 #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
1036 #include "capifs.h"
1037 #endif
1038
1039 -static char *revision = "$Revision: 1.1.4.2 $";
1040 +static char *revision = "$Revision: 1.59 $";
1041
1042 MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
1043 MODULE_AUTHOR("Carsten Paeth");
1044 @@ -87,10 +93,10 @@ struct capiminor {
1045 struct capincci *nccip;
1046 unsigned int minor;
1047
1048 - u16 applid;
1049 - u32 ncci;
1050 - u16 datahandle;
1051 - u16 msgid;
1052 + __u16 applid;
1053 + __u32 ncci;
1054 + __u16 datahandle;
1055 + __u16 msgid;
1056
1057 struct file *file;
1058 struct tty_struct *tty;
1059 @@ -112,16 +118,22 @@ struct capiminor {
1060 /* transmit path */
1061 struct datahandle_queue {
1062 struct datahandle_queue *next;
1063 - u16 datahandle;
1064 + __u16 datahandle;
1065 } *ackqueue;
1066 int nack;
1067
1068 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1069 + /* interface to generic ppp layer */
1070 + struct ppp_channel chan;
1071 + int chan_connected;
1072 + int chan_index;
1073 +#endif
1074 };
1075 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1076
1077 struct capincci {
1078 struct capincci *next;
1079 - u32 ncci;
1080 + __u32 ncci;
1081 struct capidev *cdev;
1082 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1083 struct capiminor *minorp;
1084 @@ -131,8 +143,8 @@ struct capincci {
1085 struct capidev {
1086 struct capidev *next;
1087 struct file *file;
1088 - u16 applid;
1089 - u16 errcode;
1090 + __u16 applid;
1091 + __u16 errcode;
1092 unsigned int minor;
1093 unsigned userflags;
1094
1095 @@ -156,22 +168,28 @@ static struct capidev *capidev_openlist
1096 static struct capiminor *minors = 0;
1097 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1098
1099 +#ifdef COMPAT_HAS_kmem_cache
1100 static kmem_cache_t *capidev_cachep = 0;
1101 static kmem_cache_t *capincci_cachep = 0;
1102 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1103 static kmem_cache_t *capiminor_cachep = 0;
1104 static kmem_cache_t *capidh_cachep = 0;
1105 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1106 +#endif
1107
1108 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1109 /* -------- datahandles --------------------------------------------- */
1110
1111 -static int capincci_add_ack(struct capiminor *mp, u16 datahandle)
1112 +int capincci_add_ack(struct capiminor *mp, __u16 datahandle)
1113 {
1114 struct datahandle_queue *n, **pp;
1115
1116 n = (struct datahandle_queue *)
1117 +#ifdef COMPAT_HAS_kmem_cache
1118 kmem_cache_alloc(capidh_cachep, GFP_ATOMIC);
1119 +#else
1120 + kmalloc(sizeof(struct datahandle_queue), GFP_ATOMIC);
1121 +#endif
1122 if (!n) {
1123 printk(KERN_ERR "capi: alloc datahandle failed\n");
1124 return -1;
1125 @@ -184,7 +202,7 @@ static int capincci_add_ack(struct capim
1126 return 0;
1127 }
1128
1129 -static int capiminor_del_ack(struct capiminor *mp, u16 datahandle)
1130 +int capiminor_del_ack(struct capiminor *mp, __u16 datahandle)
1131 {
1132 struct datahandle_queue **pp, *p;
1133
1134 @@ -192,7 +210,11 @@ static int capiminor_del_ack(struct capi
1135 if ((*pp)->datahandle == datahandle) {
1136 p = *pp;
1137 *pp = (*pp)->next;
1138 +#ifdef COMPAT_HAS_kmem_cache
1139 kmem_cache_free(capidh_cachep, p);
1140 +#else
1141 + kfree(p);
1142 +#endif
1143 mp->nack--;
1144 return 0;
1145 }
1146 @@ -200,7 +222,7 @@ static int capiminor_del_ack(struct capi
1147 return -1;
1148 }
1149
1150 -static void capiminor_del_all_ack(struct capiminor *mp)
1151 +void capiminor_del_all_ack(struct capiminor *mp)
1152 {
1153 struct datahandle_queue **pp, *p;
1154
1155 @@ -208,7 +230,11 @@ static void capiminor_del_all_ack(struct
1156 while (*pp) {
1157 p = *pp;
1158 *pp = (*pp)->next;
1159 +#ifdef COMPAT_HAS_kmem_cache
1160 kmem_cache_free(capidh_cachep, p);
1161 +#else
1162 + kfree(p);
1163 +#endif
1164 mp->nack--;
1165 }
1166 }
1167 @@ -216,13 +242,17 @@ static void capiminor_del_all_ack(struct
1168
1169 /* -------- struct capiminor ---------------------------------------- */
1170
1171 -static struct capiminor *capiminor_alloc(u16 applid, u32 ncci)
1172 +struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci)
1173 {
1174 struct capiminor *mp, **pp;
1175 unsigned int minor = 0;
1176
1177 MOD_INC_USE_COUNT;
1178 +#ifdef COMPAT_HAS_kmem_cache
1179 mp = (struct capiminor *)kmem_cache_alloc(capiminor_cachep, GFP_ATOMIC);
1180 +#else
1181 + mp = (struct capiminor *)kmalloc(sizeof(struct capiminor), GFP_ATOMIC);
1182 +#endif
1183 if (!mp) {
1184 MOD_DEC_USE_COUNT;
1185 printk(KERN_ERR "capi: can't alloc capiminor\n");
1186 @@ -257,7 +287,7 @@ static struct capiminor *capiminor_alloc
1187 return mp;
1188 }
1189
1190 -static void capiminor_free(struct capiminor *mp)
1191 +void capiminor_free(struct capiminor *mp)
1192 {
1193 struct capiminor **pp;
1194
1195 @@ -271,7 +301,11 @@ static void capiminor_free(struct capimi
1196 skb_queue_purge(&mp->inqueue);
1197 skb_queue_purge(&mp->outqueue);
1198 capiminor_del_all_ack(mp);
1199 +#ifdef COMPAT_HAS_kmem_cache
1200 kmem_cache_free(capiminor_cachep, mp);
1201 +#else
1202 + kfree(mp);
1203 +#endif
1204 MOD_DEC_USE_COUNT;
1205 #ifdef _DEBUG_REFCOUNT
1206 printk(KERN_DEBUG "capiminor_free %d\n", GET_USE_COUNT(THIS_MODULE));
1207 @@ -283,7 +317,7 @@ static void capiminor_free(struct capimi
1208 }
1209 }
1210
1211 -static struct capiminor *capiminor_find(unsigned int minor)
1212 +struct capiminor *capiminor_find(unsigned int minor)
1213 {
1214 struct capiminor *p;
1215 for (p = minors; p && p->minor != minor; p = p->next)
1216 @@ -294,7 +328,7 @@ static struct capiminor *capiminor_find(
1217
1218 /* -------- struct capincci ----------------------------------------- */
1219
1220 -static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
1221 +static struct capincci *capincci_alloc(struct capidev *cdev, __u32 ncci)
1222 {
1223 struct capincci *np, **pp;
1224 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1225 @@ -302,7 +336,11 @@ static struct capincci *capincci_alloc(s
1226 kdev_t kdev;
1227 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1228
1229 +#ifdef COMPAT_HAS_kmem_cache
1230 np = (struct capincci *)kmem_cache_alloc(capincci_cachep, GFP_ATOMIC);
1231 +#else
1232 + np = (struct capincci *)kmalloc(sizeof(struct capincci), GFP_ATOMIC);
1233 +#endif
1234 if (!np)
1235 return 0;
1236 memset(np, 0, sizeof(struct capincci));
1237 @@ -331,7 +369,7 @@ static struct capincci *capincci_alloc(s
1238 return np;
1239 }
1240
1241 -static void capincci_free(struct capidev *cdev, u32 ncci)
1242 +static void capincci_free(struct capidev *cdev, __u32 ncci)
1243 {
1244 struct capincci *np, **pp;
1245 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1246 @@ -367,7 +405,11 @@ static void capincci_free(struct capidev
1247 }
1248 }
1249 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1250 +#ifdef COMPAT_HAS_kmem_cache
1251 kmem_cache_free(capincci_cachep, np);
1252 +#else
1253 + kfree(np);
1254 +#endif
1255 if (*pp == 0) return;
1256 } else {
1257 pp = &(*pp)->next;
1258 @@ -375,7 +417,7 @@ static void capincci_free(struct capidev
1259 }
1260 }
1261
1262 -static struct capincci *capincci_find(struct capidev *cdev, u32 ncci)
1263 +struct capincci *capincci_find(struct capidev *cdev, __u32 ncci)
1264 {
1265 struct capincci *p;
1266
1267 @@ -393,7 +435,11 @@ static struct capidev *capidev_alloc(str
1268 struct capidev *cdev;
1269 struct capidev **pp;
1270
1271 +#ifdef COMPAT_HAS_kmem_cache
1272 cdev = (struct capidev *)kmem_cache_alloc(capidev_cachep, GFP_KERNEL);
1273 +#else
1274 + cdev = (struct capidev *)kmalloc(sizeof(struct capidev), GFP_KERNEL);
1275 +#endif
1276 if (!cdev)
1277 return 0;
1278 memset(cdev, 0, sizeof(struct capidev));
1279 @@ -423,10 +469,14 @@ static void capidev_free(struct capidev
1280 if (*pp)
1281 *pp = cdev->next;
1282
1283 +#ifdef COMPAT_HAS_kmem_cache
1284 kmem_cache_free(capidev_cachep, cdev);
1285 +#else
1286 + kfree(cdev);
1287 +#endif
1288 }
1289
1290 -static struct capidev *capidev_find(u16 applid)
1291 +static struct capidev *capidev_find(__u16 applid)
1292 {
1293 struct capidev *p;
1294 for (p=capidev_openlist; p; p = p->next) {
1295 @@ -439,13 +489,13 @@ static struct capidev *capidev_find(u16
1296 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1297 /* -------- handle data queue --------------------------------------- */
1298
1299 -static struct sk_buff *
1300 +struct sk_buff *
1301 gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
1302 {
1303 struct sk_buff *nskb;
1304 nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_ATOMIC);
1305 if (nskb) {
1306 - u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
1307 + __u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
1308 unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
1309 capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
1310 capimsg_setu16(s, 2, mp->applid);
1311 @@ -458,11 +508,11 @@ gen_data_b3_resp_for(struct capiminor *m
1312 return nskb;
1313 }
1314
1315 -static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
1316 +int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
1317 {
1318 struct sk_buff *nskb;
1319 unsigned int datalen;
1320 - u16 errcode, datahandle;
1321 + __u16 errcode, datahandle;
1322
1323 datalen = skb->len - CAPIMSG_LEN(skb->data);
1324 if (mp->tty) {
1325 @@ -504,6 +554,28 @@ static int handle_recv_skb(struct capimi
1326 kfree_skb(skb);
1327 return 0;
1328
1329 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1330 + } else if (mp->chan_connected) {
1331 + if ((nskb = gen_data_b3_resp_for(mp, skb)) == 0) {
1332 + printk(KERN_ERR "capi: gen_data_b3_resp failed\n");
1333 + return -1;
1334 + }
1335 + datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4);
1336 + errcode = (*capifuncs->capi_put_message)(mp->applid, nskb);
1337 + if (errcode != CAPI_NOERROR) {
1338 + printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
1339 + errcode);
1340 + kfree_skb(nskb);
1341 + return -1;
1342 + }
1343 + (void)skb_pull(skb, CAPIMSG_LEN(skb->data));
1344 +#ifdef _DEBUG_DATAFLOW
1345 + printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ppp\n",
1346 + datahandle, skb->len);
1347 +#endif
1348 + ppp_input(&mp->chan, skb);
1349 + return 0;
1350 +#endif
1351 } else if (mp->file) {
1352 if (skb_queue_len(&mp->recvqueue) > CAPINC_MAX_RECVQUEUE) {
1353 #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
1354 @@ -538,7 +610,7 @@ static int handle_recv_skb(struct capimi
1355 return -1;
1356 }
1357
1358 -static void handle_minor_recv(struct capiminor *mp)
1359 +void handle_minor_recv(struct capiminor *mp)
1360 {
1361 struct sk_buff *skb;
1362 while ((skb = skb_dequeue(&mp->inqueue)) != 0) {
1363 @@ -552,13 +624,13 @@ static void handle_minor_recv(struct cap
1364 }
1365 }
1366
1367 -static int handle_minor_send(struct capiminor *mp)
1368 +int handle_minor_send(struct capiminor *mp)
1369 {
1370 struct sk_buff *skb;
1371 - u16 len;
1372 + __u16 len;
1373 int count = 0;
1374 - u16 errcode;
1375 - u16 datahandle;
1376 + __u16 errcode;
1377 + __u16 datahandle;
1378
1379 if (mp->tty && mp->ttyoutstop) {
1380 #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
1381 @@ -569,7 +641,7 @@ static int handle_minor_send(struct capi
1382
1383 while ((skb = skb_dequeue(&mp->outqueue)) != 0) {
1384 datahandle = mp->datahandle;
1385 - len = (u16)skb->len;
1386 + len = (__u16)skb->len;
1387 skb_push(skb, CAPI_DATA_B3_REQ_LEN);
1388 memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
1389 capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
1390 @@ -578,7 +650,7 @@ static int handle_minor_send(struct capi
1391 capimsg_setu8 (skb->data, 5, CAPI_REQ);
1392 capimsg_setu16(skb->data, 6, mp->msgid++);
1393 capimsg_setu32(skb->data, 8, mp->ncci); /* NCCI */
1394 - capimsg_setu32(skb->data, 12, (u32) skb->data); /* Data32 */
1395 + capimsg_setu32(skb->data, 12, (__u32) skb->data); /* Data32 */
1396 capimsg_setu16(skb->data, 16, len); /* Data length */
1397 capimsg_setu16(skb->data, 18, datahandle);
1398 capimsg_setu16(skb->data, 20, 0); /* Flags */
1399 @@ -620,16 +692,16 @@ static int handle_minor_send(struct capi
1400 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1401 /* -------- function called by lower level -------------------------- */
1402
1403 -static void capi_signal(u16 applid, void *param)
1404 +static void capi_signal(__u16 applid, void *param)
1405 {
1406 struct capidev *cdev = (struct capidev *)param;
1407 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1408 struct capiminor *mp;
1409 - u16 datahandle;
1410 + __u16 datahandle;
1411 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1412 struct capincci *np;
1413 struct sk_buff *skb = 0;
1414 - u32 ncci;
1415 + __u32 ncci;
1416
1417 (void) (*capifuncs->capi_get_message) (applid, &skb);
1418 if (!skb) {
1419 @@ -683,6 +755,12 @@ static void capi_signal(u16 applid, void
1420 #endif
1421 kfree_skb(skb);
1422 (void)capiminor_del_ack(mp, datahandle);
1423 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1424 + if (mp->chan_connected) {
1425 + ppp_output_wakeup(&mp->chan);
1426 + return;
1427 + }
1428 +#endif
1429 if (mp->tty) {
1430 if (mp->tty->ldisc.write_wakeup)
1431 mp->tty->ldisc.write_wakeup(mp->tty);
1432 @@ -758,7 +836,7 @@ capi_write(struct file *file, const char
1433 struct capidev *cdev = (struct capidev *)file->private_data;
1434 struct sk_buff *skb;
1435 int retval;
1436 - u16 mlen;
1437 + __u16 mlen;
1438
1439 if (ppos != &file->f_pos)
1440 return -ESPIPE;
1441 @@ -998,7 +1076,7 @@ capi_ioctl(struct inode *inode, struct f
1442 sizeof(ncci));
1443 if (retval)
1444 return -EFAULT;
1445 - nccip = capincci_find(cdev, (u32) ncci);
1446 + nccip = capincci_find(cdev, (__u32) ncci);
1447 if (!nccip)
1448 return 0;
1449 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1450 @@ -1023,7 +1101,7 @@ capi_ioctl(struct inode *inode, struct f
1451 sizeof(ncci));
1452 if (retval)
1453 return -EFAULT;
1454 - nccip = capincci_find(cdev, (u32) ncci);
1455 + nccip = capincci_find(cdev, (__u32) ncci);
1456 if (!nccip || (mp = nccip->minorp) == 0)
1457 return -ESRCH;
1458 return mp->minor;
1459 @@ -1070,7 +1148,9 @@ capi_release(struct inode *inode, struct
1460
1461 static struct file_operations capi_fops =
1462 {
1463 +#ifdef COMPAT_HAS_FILEOP_OWNER
1464 owner: THIS_MODULE,
1465 +#endif
1466 llseek: no_llseek,
1467 read: capi_read,
1468 write: capi_write,
1469 @@ -1233,6 +1313,45 @@ capinc_raw_ioctl(struct inode *inode, st
1470 return -EINVAL;
1471
1472 switch (cmd) {
1473 +#ifdef CAPI_PPP_ON_RAW_DEVICE
1474 + case PPPIOCATTACH:
1475 + {
1476 + int retval, val;
1477 + if (get_user(val, (int *) arg))
1478 + break;
1479 + if (mp->chan_connected)
1480 + return -EALREADY;
1481 + mp->chan.private = mp;
1482 +#if 1
1483 + return -EINVAL;
1484 +#else
1485 + mp->chan.ops = &ppp_ops;
1486 +#endif
1487 +
1488 + retval = ppp_register_channel(&mp->chan, val);
1489 + if (retval)
1490 + return retval;
1491 + mp->chan_connected = 1;
1492 + mp->chan_index = val;
1493 + }
1494 + return 0;
1495 + case PPPIOCDETACH:
1496 + {
1497 + if (!mp->chan_connected)
1498 + return -ENXIO;
1499 + ppp_unregister_channel(&mp->chan);
1500 + mp->chan_connected = 0;
1501 + }
1502 + return 0;
1503 + case PPPIOCGUNIT:
1504 + {
1505 + if (!mp->chan_connected)
1506 + return -ENXIO;
1507 + if (put_user(mp->chan_index, (int *) arg))
1508 + return -EFAULT;
1509 + }
1510 + return 0;
1511 +#endif
1512 }
1513 return -EINVAL;
1514 }
1515 @@ -1260,7 +1379,9 @@ capinc_raw_release(struct inode *inode,
1516
1517 static struct file_operations capinc_raw_fops =
1518 {
1519 +#ifdef COMPAT_HAS_FILEOP_OWNER
1520 owner: THIS_MODULE,
1521 +#endif
1522 llseek: no_llseek,
1523 read: capinc_raw_read,
1524 write: capinc_raw_write,
1525 @@ -1272,7 +1393,7 @@ static struct file_operations capinc_raw
1526
1527 /* -------- tty_operations for capincci ----------------------------- */
1528
1529 -static int capinc_tty_open(struct tty_struct * tty, struct file * file)
1530 +int capinc_tty_open(struct tty_struct * tty, struct file * file)
1531 {
1532 struct capiminor *mp;
1533
1534 @@ -1300,7 +1421,7 @@ static int capinc_tty_open(struct tty_st
1535 return 0;
1536 }
1537
1538 -static void capinc_tty_close(struct tty_struct * tty, struct file * file)
1539 +void capinc_tty_close(struct tty_struct * tty, struct file * file)
1540 {
1541 struct capiminor *mp;
1542
1543 @@ -1325,8 +1446,8 @@ static void capinc_tty_close(struct tty_
1544 #endif
1545 }
1546
1547 -static int capinc_tty_write(struct tty_struct * tty, int from_user,
1548 - const unsigned char *buf, int count)
1549 +int capinc_tty_write(struct tty_struct * tty, int from_user,
1550 + const unsigned char *buf, int count)
1551 {
1552 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1553 struct sk_buff *skb;
1554 @@ -1377,7 +1498,7 @@ static int capinc_tty_write(struct tty_s
1555 return count;
1556 }
1557
1558 -static void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1559 +void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1560 {
1561 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1562 struct sk_buff *skb;
1563 @@ -1414,7 +1535,7 @@ static void capinc_tty_put_char(struct t
1564 }
1565 }
1566
1567 -static void capinc_tty_flush_chars(struct tty_struct *tty)
1568 +void capinc_tty_flush_chars(struct tty_struct *tty)
1569 {
1570 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1571 struct sk_buff *skb;
1572 @@ -1440,7 +1561,7 @@ static void capinc_tty_flush_chars(struc
1573 (void)handle_minor_recv(mp);
1574 }
1575
1576 -static int capinc_tty_write_room(struct tty_struct *tty)
1577 +int capinc_tty_write_room(struct tty_struct *tty)
1578 {
1579 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1580 int room;
1581 @@ -1458,7 +1579,7 @@ static int capinc_tty_write_room(struct
1582 return room;
1583 }
1584
1585 -static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1586 +int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1587 {
1588 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1589 if (!mp || !mp->nccip) {
1590 @@ -1476,7 +1597,7 @@ static int capinc_tty_chars_in_buffer(st
1591 return mp->outbytes;
1592 }
1593
1594 -static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
1595 +int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
1596 unsigned int cmd, unsigned long arg)
1597 {
1598 int error = 0;
1599 @@ -1488,14 +1609,14 @@ static int capinc_tty_ioctl(struct tty_s
1600 return error;
1601 }
1602
1603 -static void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
1604 +void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
1605 {
1606 #ifdef _DEBUG_TTYFUNCS
1607 printk(KERN_DEBUG "capinc_tty_set_termios\n");
1608 #endif
1609 }
1610
1611 -static void capinc_tty_throttle(struct tty_struct * tty)
1612 +void capinc_tty_throttle(struct tty_struct * tty)
1613 {
1614 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1615 #ifdef _DEBUG_TTYFUNCS
1616 @@ -1505,7 +1626,7 @@ static void capinc_tty_throttle(struct t
1617 mp->ttyinstop = 1;
1618 }
1619
1620 -static void capinc_tty_unthrottle(struct tty_struct * tty)
1621 +void capinc_tty_unthrottle(struct tty_struct * tty)
1622 {
1623 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1624 #ifdef _DEBUG_TTYFUNCS
1625 @@ -1517,7 +1638,7 @@ static void capinc_tty_unthrottle(struct
1626 }
1627 }
1628
1629 -static void capinc_tty_stop(struct tty_struct *tty)
1630 +void capinc_tty_stop(struct tty_struct *tty)
1631 {
1632 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1633 #ifdef _DEBUG_TTYFUNCS
1634 @@ -1528,7 +1649,7 @@ static void capinc_tty_stop(struct tty_s
1635 }
1636 }
1637
1638 -static void capinc_tty_start(struct tty_struct *tty)
1639 +void capinc_tty_start(struct tty_struct *tty)
1640 {
1641 struct capiminor *mp = (struct capiminor *)tty->driver_data;
1642 #ifdef _DEBUG_TTYFUNCS
1643 @@ -1540,43 +1661,49 @@ static void capinc_tty_start(struct tty_
1644 }
1645 }
1646
1647 -static void capinc_tty_hangup(struct tty_struct *tty)
1648 +void capinc_tty_hangup(struct tty_struct *tty)
1649 {
1650 #ifdef _DEBUG_TTYFUNCS
1651 printk(KERN_DEBUG "capinc_tty_hangup\n");
1652 #endif
1653 }
1654
1655 -static void capinc_tty_break_ctl(struct tty_struct *tty, int state)
1656 +void capinc_tty_break_ctl(struct tty_struct *tty, int state)
1657 {
1658 #ifdef _DEBUG_TTYFUNCS
1659 printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state);
1660 #endif
1661 }
1662
1663 -static void capinc_tty_flush_buffer(struct tty_struct *tty)
1664 +void capinc_tty_flush_buffer(struct tty_struct *tty)
1665 {
1666 #ifdef _DEBUG_TTYFUNCS
1667 printk(KERN_DEBUG "capinc_tty_flush_buffer\n");
1668 #endif
1669 }
1670
1671 -static void capinc_tty_set_ldisc(struct tty_struct *tty)
1672 +void capinc_tty_set_ldisc(struct tty_struct *tty)
1673 {
1674 #ifdef _DEBUG_TTYFUNCS
1675 printk(KERN_DEBUG "capinc_tty_set_ldisc\n");
1676 #endif
1677 }
1678
1679 -static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1680 +void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1681 {
1682 #ifdef _DEBUG_TTYFUNCS
1683 printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch);
1684 #endif
1685 }
1686
1687 -static int capinc_tty_read_proc(char *page, char **start, off_t off,
1688 - int count, int *eof, void *data)
1689 +int capinc_tty_read_proc(char *page, char **start, off_t off,
1690 + int count, int *eof, void *data)
1691 +{
1692 + return 0;
1693 +}
1694 +
1695 +int capinc_write_proc(struct file *file, const char *buffer,
1696 + unsigned long count, void *data)
1697 {
1698 return 0;
1699 }
1700 @@ -1588,7 +1715,7 @@ static struct tty_struct *capinc_tty_tab
1701 static struct termios *capinc_tty_termios[CAPINC_NR_PORTS];
1702 static struct termios *capinc_tty_termios_locked[CAPINC_NR_PORTS];
1703
1704 -static int capinc_tty_init(void)
1705 +int capinc_tty_init(void)
1706 {
1707 struct tty_driver *drv = &capinc_tty_driver;
1708
1709 @@ -1646,7 +1773,7 @@ static int capinc_tty_init(void)
1710 return 0;
1711 }
1712
1713 -static void capinc_tty_exit(void)
1714 +void capinc_tty_exit(void)
1715 {
1716 struct tty_driver *drv = &capinc_tty_driver;
1717 int retval;
1718 @@ -1771,8 +1898,9 @@ static void __exit proc_exit(void)
1719
1720 /* -------- init function and module interface ---------------------- */
1721
1722 +#ifdef COMPAT_HAS_kmem_cache
1723
1724 -static void alloc_exit(void)
1725 +static void __exit alloc_exit(void)
1726 {
1727 if (capidev_cachep) {
1728 (void)kmem_cache_destroy(capidev_cachep);
1729 @@ -1837,8 +1965,9 @@ static int __init alloc_init(void)
1730 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1731 return 0;
1732 }
1733 +#endif
1734
1735 -static void lower_callback(unsigned int cmd, u32 contr, void *data)
1736 +static void lower_callback(unsigned int cmd, __u32 contr, void *data)
1737 {
1738 struct capi_ncciinfo *np;
1739 struct capidev *cdev;
1740 @@ -1900,15 +2029,19 @@ static int __init capi_init(void)
1741 MOD_DEC_USE_COUNT;
1742 return -EIO;
1743 }
1744 +#ifdef HAVE_DEVFS_FS
1745 devfs_register_series (NULL, "capi/r%u", CAPINC_NR_PORTS,
1746 DEVFS_FL_DEFAULT,
1747 capi_rawmajor, 0,
1748 S_IFCHR | S_IRUSR | S_IWUSR,
1749 &capinc_raw_fops, NULL);
1750 +#endif
1751 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1752 +#ifdef HAVE_DEVFS_FS
1753 devfs_register (NULL, "isdn/capi20", DEVFS_FL_DEFAULT,
1754 capi_major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
1755 &capi_fops, NULL);
1756 +#endif
1757 printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major);
1758
1759 if ((capifuncs = attach_capi_interface(&cuser)) == 0) {
1760 @@ -1918,9 +2051,11 @@ static int __init capi_init(void)
1761 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1762 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1763 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1764 +#ifdef HAVE_DEVFS_FS
1765 devfs_unregister(devfs_find_handle(NULL, "capi20",
1766 capi_major, 0,
1767 DEVFS_SPECIAL_CHR, 0));
1768 +#endif
1769 return -EIO;
1770 }
1771
1772 @@ -1934,8 +2069,10 @@ static int __init capi_init(void)
1773 }
1774 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1775
1776 +#ifdef COMPAT_HAS_kmem_cache
1777 if (alloc_init() < 0) {
1778 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1779 +#ifdef HAVE_DEVFS_FS
1780 unsigned int j;
1781 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1782 for (j = 0; j < CAPINC_NR_PORTS; j++) {
1783 @@ -1943,16 +2080,20 @@ static int __init capi_init(void)
1784 sprintf(devname, "capi/r%u", j);
1785 devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0));
1786 }
1787 +#endif
1788 capinc_tty_exit();
1789 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
1790 (void) detach_capi_interface(&cuser);
1791 devfs_unregister_chrdev(capi_major, "capi20");
1792 +#ifdef HAVE_DEVFS_FS
1793 devfs_unregister(devfs_find_handle(NULL, "capi20",
1794 capi_major, 0,
1795 DEVFS_SPECIAL_CHR, 0));
1796 +#endif
1797 MOD_DEC_USE_COUNT;
1798 return -ENOMEM;
1799 }
1800 +#endif /* COMPAT_HAS_kmem_cache */
1801
1802 (void)proc_init();
1803
1804 @@ -1975,23 +2116,31 @@ static int __init capi_init(void)
1805 static void __exit capi_exit(void)
1806 {
1807 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1808 +#ifdef HAVE_DEVFS_FS
1809 unsigned int j;
1810 #endif
1811 +#endif
1812 +#ifdef COMPAT_HAS_kmem_cache
1813 alloc_exit();
1814 +#endif
1815 (void)proc_exit();
1816
1817 devfs_unregister_chrdev(capi_major, "capi20");
1818 +#ifdef HAVE_DEVFS_FS
1819 devfs_unregister(devfs_find_handle(NULL, "isdn/capi20", capi_major, 0, DEVFS_SPECIAL_CHR, 0));
1820 +#endif
1821
1822 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1823 capinc_tty_exit();
1824 devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
1825 +#ifdef HAVE_DEVFS_FS
1826 for (j = 0; j < CAPINC_NR_PORTS; j++) {
1827 char devname[32];
1828 sprintf(devname, "capi/r%u", j);
1829 devfs_unregister(devfs_find_handle(NULL, devname, capi_rawmajor, j, DEVFS_SPECIAL_CHR, 0));
1830 }
1831 #endif
1832 +#endif
1833 (void) detach_capi_interface(&cuser);
1834 printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev);
1835 }
1836 --- a/drivers/isdn/avmb1/capicmd.h
1837 +++ b/drivers/isdn/avmb1/capicmd.h
1838 @@ -1,4 +1,4 @@
1839 -/* $Id: capicmd.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1840 +/* $Id: capicmd.h,v 1.4 2001/09/24 13:22:44 kai Exp $
1841 *
1842 * CAPI 2.0 Interface for Linux
1843 *
1844 --- a/drivers/isdn/avmb1/capidev.h
1845 +++ b/drivers/isdn/avmb1/capidev.h
1846 @@ -1,4 +1,4 @@
1847 -/* $Id: capidev.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1848 +/* $Id: capidev.h,v 1.8 2001/09/24 13:22:44 kai Exp $
1849 *
1850 * CAPI 2.0 Interface for Linux
1851 *
1852 --- a/drivers/isdn/avmb1/capidrv.c
1853 +++ b/drivers/isdn/avmb1/capidrv.c
1854 @@ -1,4 +1,4 @@
1855 -/* $Id: capidrv.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
1856 +/* $Id: capidrv.c,v 1.45 2001/09/24 13:22:44 kai Exp $
1857 *
1858 * ISDN4Linux Driver, using capi20 interface (kernelcapi)
1859 *
1860 @@ -35,7 +35,7 @@
1861 #include "capicmd.h"
1862 #include "capidrv.h"
1863
1864 -static char *revision = "$Revision: 1.1.4.1 $";
1865 +static char *revision = "$Revision: 1.45 $";
1866 static int debugmode = 0;
1867
1868 MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux");
1869 @@ -105,7 +105,6 @@ struct capidrv_contr {
1870 int oldstate;
1871 /* */
1872 __u16 datahandle;
1873 - spinlock_t lock;
1874 struct ncci_datahandle_queue {
1875 struct ncci_datahandle_queue *next;
1876 __u16 datahandle;
1877 @@ -423,7 +422,6 @@ static inline capidrv_ncci *new_ncci(cap
1878 nccip->plcip = plcip;
1879 nccip->chan = plcip->chan;
1880 nccip->datahandle = 0;
1881 - nccip->lock = SPIN_LOCK_UNLOCKED;
1882
1883 nccip->next = plcip->ncci_list;
1884 plcip->ncci_list = nccip;
1885 @@ -480,7 +478,6 @@ static int capidrv_add_ack(struct capidr
1886 __u16 datahandle, int len)
1887 {
1888 struct ncci_datahandle_queue *n, **pp;
1889 - unsigned long flags;
1890
1891 n = (struct ncci_datahandle_queue *)
1892 kmalloc(sizeof(struct ncci_datahandle_queue), GFP_ATOMIC);
1893 @@ -491,31 +488,25 @@ static int capidrv_add_ack(struct capidr
1894 n->next = 0;
1895 n->datahandle = datahandle;
1896 n->len = len;
1897 - spin_lock_irqsave(&nccip->lock, flags);
1898 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) ;
1899 *pp = n;
1900 - spin_unlock_irqrestore(&nccip->lock, flags);
1901 return 0;
1902 }
1903
1904 static int capidrv_del_ack(struct capidrv_ncci *nccip, __u16 datahandle)
1905 {
1906 struct ncci_datahandle_queue **pp, *p;
1907 - unsigned long flags;
1908 int len;
1909
1910 - spin_lock_irqsave(&nccip->lock, flags);
1911 for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) {
1912 if ((*pp)->datahandle == datahandle) {
1913 p = *pp;
1914 len = p->len;
1915 *pp = (*pp)->next;
1916 - spin_unlock_irqrestore(&nccip->lock, flags);
1917 kfree(p);
1918 return len;
1919 }
1920 }
1921 - spin_unlock_irqrestore(&nccip->lock, flags);
1922 return -1;
1923 }
1924
1925 @@ -523,25 +514,13 @@ static int capidrv_del_ack(struct capidr
1926
1927 static void send_message(capidrv_contr * card, _cmsg * cmsg)
1928 {
1929 - struct sk_buff *skb;
1930 - size_t len;
1931 - u16 err;
1932 -
1933 + struct sk_buff *skb;
1934 + size_t len;
1935 capi_cmsg2message(cmsg, cmsg->buf);
1936 len = CAPIMSG_LEN(cmsg->buf);
1937 skb = alloc_skb(len, GFP_ATOMIC);
1938 - if(!skb) {
1939 - printk(KERN_ERR "no skb len(%d) memory\n", len);
1940 - return;
1941 - }
1942 memcpy(skb_put(skb, len), cmsg->buf, len);
1943 - err = (*capifuncs->capi_put_message) (global.appid, skb);
1944 - if (err) {
1945 - printk(KERN_WARNING "%s: capi_put_message error: %04x\n",
1946 - __FUNCTION__, err);
1947 - kfree_skb(skb);
1948 - return;
1949 - }
1950 + (*capifuncs->capi_put_message) (global.appid, skb);
1951 global.nsentctlpkt++;
1952 }
1953
1954 @@ -1932,8 +1911,10 @@ static int if_sendbuf(int id, int channe
1955 (void)capidrv_del_ack(nccip, datahandle);
1956 return 0;
1957 }
1958 +#if 1
1959 printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n",
1960 card->contrnr, skb_headroom(skb), msglen);
1961 +#endif
1962 memcpy(skb_push(nskb, msglen), sendcmsg.buf, msglen);
1963 errcode = (*capifuncs->capi_put_message) (global.appid, nskb);
1964 if (errcode == CAPI_NOERROR) {
1965 @@ -2035,6 +2016,52 @@ static void enable_dchannel_trace(capidr
1966 send_message(card, &cmdcmsg);
1967 }
1968
1969 +#if 0
1970 +static void disable_dchannel_trace(capidrv_contr *card)
1971 +{
1972 + __u8 manufacturer[CAPI_MANUFACTURER_LEN];
1973 + capi_version version;
1974 + __u16 contr = card->contrnr;
1975 + __u16 errcode;
1976 + __u16 avmversion[3];
1977 +
1978 + errcode = (*capifuncs->capi_get_manufacturer)(contr, manufacturer);
1979 + if (errcode != CAPI_NOERROR) {
1980 + printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n",
1981 + card->name, errcode);
1982 + return;
1983 + }
1984 + if (strstr(manufacturer, "AVM") == 0) {
1985 + printk(KERN_ERR "%s: not from AVM, no d-channel trace possible (%s)\n",
1986 + card->name, manufacturer);
1987 + return;
1988 + }
1989 + errcode = (*capifuncs->capi_get_version)(contr, &version);
1990 + if (errcode != CAPI_NOERROR) {
1991 + printk(KERN_ERR "%s: can't get version (0x%x)\n",
1992 + card->name, errcode);
1993 + return;
1994 + }
1995 + avmversion[0] = (version.majormanuversion >> 4) & 0x0f;
1996 + avmversion[1] = (version.majormanuversion << 4) & 0xf0;
1997 + avmversion[1] |= (version.minormanuversion >> 4) & 0x0f;
1998 + avmversion[2] |= version.minormanuversion & 0x0f;
1999 +
2000 + if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) {
2001 + printk(KERN_INFO "%s: D2 trace disabled\n", card->name);
2002 + } else {
2003 + printk(KERN_INFO "%s: D3 trace disabled\n", card->name);
2004 + }
2005 + capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid,
2006 + card->msgid++,
2007 + contr,
2008 + 0x214D5641, /* ManuID */
2009 + 0, /* Class */
2010 + 1, /* Function */
2011 + (_cstruct)"\004\000\000\000\000");
2012 + send_message(card, &cmdcmsg);
2013 +}
2014 +#endif
2015
2016 static void send_listen(capidrv_contr *card)
2017 {
2018 @@ -2200,10 +2227,10 @@ static int capidrv_delcontr(__u16 contr)
2019 free_ncci(card, card->bchans[card->nbchan-1].nccip);
2020 if (card->bchans[card->nbchan-1].plcip)
2021 free_plci(card, card->bchans[card->nbchan-1].plcip);
2022 + if (card->plci_list)
2023 + printk(KERN_ERR "capidrv: bug in free_plci()\n");
2024 card->nbchan--;
2025 }
2026 - if (card->plci_list)
2027 - printk(KERN_ERR "capidrv: bug in free_plci()\n");
2028 kfree(card->bchans);
2029 card->bchans = 0;
2030
2031 --- a/drivers/isdn/avmb1/capidrv.h
2032 +++ b/drivers/isdn/avmb1/capidrv.h
2033 @@ -1,4 +1,4 @@
2034 -/* $Id: capidrv.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2035 +/* $Id: capidrv.h,v 1.4 2001/09/24 13:22:44 kai Exp $
2036 *
2037 * ISDN4Linux Driver, using capi20 interface (kernelcapi)
2038 *
2039 --- a/drivers/isdn/avmb1/capifs.c
2040 +++ b/drivers/isdn/avmb1/capifs.c
2041 @@ -1,4 +1,4 @@
2042 -/* $Id: capifs.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2043 +/* $Id: capifs.c,v 1.22 2001/09/24 13:22:44 kai Exp $
2044 *
2045 * Copyright 2000 by Carsten Paeth <calle@calle.de>
2046 *
2047 @@ -25,6 +25,7 @@
2048 #include <linux/major.h>
2049 #include <linux/slab.h>
2050 #include <linux/ctype.h>
2051 +#include <linux/isdn_compat.h>
2052 #include <asm/bitops.h>
2053 #include <asm/uaccess.h>
2054
2055 @@ -32,7 +33,7 @@ MODULE_DESCRIPTION("CAPI4Linux: /dev/cap
2056 MODULE_AUTHOR("Carsten Paeth");
2057 MODULE_LICENSE("GPL");
2058
2059 -static char *revision = "$Revision: 1.1.4.1 $";
2060 +static char *revision = "$Revision: 1.22 $";
2061
2062 struct capifs_ncci {
2063 struct inode *inode;
2064 @@ -69,14 +70,21 @@ static inline struct capifs_sb_info *SBI
2065 static int capifs_root_readdir(struct file *,void *,filldir_t);
2066 static struct dentry *capifs_root_lookup(struct inode *,struct dentry *);
2067 static int capifs_revalidate(struct dentry *, int);
2068 +#ifdef COMPAT_VFS_2_4
2069 static struct inode *capifs_new_inode(struct super_block *sb);
2070 +#endif
2071
2072 static struct file_operations capifs_root_operations = {
2073 +#ifdef COMPAT_VFS_2_4
2074 read: generic_read_dir,
2075 +#endif
2076 readdir: capifs_root_readdir,
2077 };
2078
2079 struct inode_operations capifs_root_inode_operations = {
2080 +#ifndef COMPAT_VFS_2_4
2081 + default_file_ops: &capifs_root_operations, /* file operations */
2082 +#endif
2083 lookup: capifs_root_lookup,
2084 };
2085
2086 @@ -101,12 +109,20 @@ static int capifs_root_readdir(struct fi
2087 switch(nr)
2088 {
2089 case 0:
2090 +#ifdef COMPAT_VFS_2_4
2091 if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0)
2092 +#else
2093 + if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0)
2094 +#endif
2095 return 0;
2096 filp->f_pos = ++nr;
2097 /* fall through */
2098 case 1:
2099 +#ifdef COMPAT_VFS_2_4
2100 if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0)
2101 +#else
2102 + if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0)
2103 +#endif
2104 return 0;
2105 filp->f_pos = ++nr;
2106 /* fall through */
2107 @@ -118,7 +134,11 @@ static int capifs_root_readdir(struct fi
2108 char *p = numbuf;
2109 if (np->type) *p++ = np->type;
2110 sprintf(p, "%u", np->num);
2111 +#ifdef COMPAT_VFS_2_4
2112 if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_UNKNOWN) < 0 )
2113 +#else
2114 + if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 )
2115 +#endif
2116 return 0;
2117 }
2118 filp->f_pos = ++nr;
2119 @@ -180,7 +200,7 @@ static struct dentry *capifs_root_lookup
2120
2121 dentry->d_inode = np->inode;
2122 if ( dentry->d_inode )
2123 - atomic_inc(&dentry->d_inode->i_count);
2124 + i_count_inc(dentry->d_inode->i_count);
2125
2126 d_add(dentry, dentry->d_inode);
2127
2128 @@ -199,9 +219,9 @@ static void capifs_put_super(struct supe
2129
2130 for ( i = 0 ; i < sbi->max_ncci ; i++ ) {
2131 if ( (inode = sbi->nccis[i].inode) ) {
2132 - if (atomic_read(&inode->i_count) != 1 )
2133 + if (i_count_read(inode->i_count) != 1 )
2134 printk("capifs_put_super: badness: entry %d count %d\n",
2135 - i, (unsigned)atomic_read(&inode->i_count));
2136 + i, (unsigned)i_count_read(inode->i_count));
2137 inode->i_nlink--;
2138 iput(inode);
2139 }
2140 @@ -213,11 +233,24 @@ static void capifs_put_super(struct supe
2141
2142 kfree(sbi->nccis);
2143 kfree(sbi);
2144 +#ifndef COMPAT_VFS_2_4
2145 + MOD_DEC_USE_COUNT;
2146 +#endif
2147 }
2148
2149 +#ifdef COMPAT_VFS_2_4
2150 static int capifs_statfs(struct super_block *sb, struct statfs *buf);
2151 +#else
2152 +static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz);
2153 +static void capifs_write_inode(struct inode *inode) { };
2154 +static void capifs_read_inode(struct inode *inode);
2155 +#endif
2156
2157 static struct super_operations capifs_sops = {
2158 +#ifndef COMPAT_VFS_2_4
2159 + read_inode: capifs_read_inode,
2160 + write_inode: capifs_write_inode,
2161 +#endif
2162 put_super: capifs_put_super,
2163 statfs: capifs_statfs,
2164 };
2165 @@ -288,6 +321,10 @@ struct super_block *capifs_read_super(st
2166 struct dentry * root;
2167 struct capifs_sb_info *sbi;
2168
2169 +#ifndef COMPAT_VFS_2_4
2170 + MOD_INC_USE_COUNT;
2171 + lock_super(s);
2172 +#endif
2173 /* Super block already completed? */
2174 if (s->s_root)
2175 goto out;
2176 @@ -322,6 +359,7 @@ struct super_block *capifs_read_super(st
2177 /*
2178 * Get the root inode and dentry, but defer checking for errors.
2179 */
2180 +#ifdef COMPAT_VFS_2_4
2181 root_inode = capifs_new_inode(s);
2182 if (root_inode) {
2183 root_inode->i_ino = 1;
2184 @@ -331,6 +369,10 @@ struct super_block *capifs_read_super(st
2185 root_inode->i_nlink = 2;
2186 }
2187 root = d_alloc_root(root_inode);
2188 +#else
2189 + root_inode = iget(s, 1); /* inode 1 == root directory */
2190 + root = d_alloc_root(root_inode, NULL);
2191 +#endif
2192
2193 /*
2194 * Check whether somebody else completed the super block.
2195 @@ -370,11 +412,34 @@ struct super_block *capifs_read_super(st
2196 mounts = s;
2197
2198 out: /* Success ... somebody else completed the super block for us. */
2199 +#ifndef COMPAT_VFS_2_4
2200 + unlock_super(s);
2201 +#endif
2202 return s;
2203 fail:
2204 +#ifndef COMPAT_VFS_2_4
2205 + unlock_super(s);
2206 + MOD_DEC_USE_COUNT;
2207 +#endif
2208 return NULL;
2209 }
2210
2211 +#ifndef COMPAT_VFS_2_4
2212 +static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
2213 +{
2214 + struct statfs tmp;
2215 +
2216 + tmp.f_type = CAPIFS_SUPER_MAGIC;
2217 + tmp.f_bsize = 1024;
2218 + tmp.f_blocks = 0;
2219 + tmp.f_bfree = 0;
2220 + tmp.f_bavail = 0;
2221 + tmp.f_files = 0;
2222 + tmp.f_ffree = 0;
2223 + tmp.f_namelen = NAME_MAX;
2224 + return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
2225 +}
2226 +#else
2227 static int capifs_statfs(struct super_block *sb, struct statfs *buf)
2228 {
2229 buf->f_type = CAPIFS_SUPER_MAGIC;
2230 @@ -387,7 +452,9 @@ static int capifs_statfs(struct super_bl
2231 buf->f_namelen = NAME_MAX;
2232 return 0;
2233 }
2234 +#endif
2235
2236 +#ifdef COMPAT_VFS_2_4
2237 static struct inode *capifs_new_inode(struct super_block *sb)
2238 {
2239 struct inode *inode = new_inode(sb);
2240 @@ -399,8 +466,51 @@ static struct inode *capifs_new_inode(st
2241 }
2242 return inode;
2243 }
2244 +#else
2245 +static void capifs_read_inode(struct inode *inode)
2246 +{
2247 + ino_t ino = inode->i_ino;
2248 + struct capifs_sb_info *sbi = SBI(inode->i_sb);
2249 +
2250 + inode->i_mode = 0;
2251 + inode->i_nlink = 0;
2252 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
2253 + inode->i_blocks = 0;
2254 + inode->i_blksize = 1024;
2255 + inode->i_uid = inode->i_gid = 0;
2256 +
2257 + if ( ino == 1 ) {
2258 + inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
2259 + inode->i_op = &capifs_root_inode_operations;
2260 + inode->i_nlink = 2;
2261 + return;
2262 + }
2263
2264 + ino -= 2;
2265 + if ( ino >= sbi->max_ncci )
2266 + return; /* Bogus */
2267 +
2268 +#ifdef COMPAT_VFS_2_4
2269 + init_special_inode(inode, S_IFCHR, 0);
2270 +#else
2271 + inode->i_mode = S_IFCHR;
2272 + inode->i_op = &chrdev_inode_operations;
2273 +#endif
2274 +
2275 + return;
2276 +}
2277 +#endif
2278 +
2279 +#ifndef COMPAT_VFS_2_4
2280 +static struct file_system_type capifs_fs_type = {
2281 + "capifs",
2282 + 0,
2283 + capifs_read_super,
2284 + NULL
2285 +};
2286 +#else
2287 static DECLARE_FSTYPE(capifs_fs_type, "capifs", capifs_read_super, 0);
2288 +#endif
2289
2290 void capifs_new_ncci(char type, unsigned int num, kdev_t device)
2291 {
2292 @@ -421,16 +531,26 @@ void capifs_new_ncci(char type, unsigned
2293 break;
2294 }
2295 }
2296 +#ifdef COMPAT_VFS_2_4
2297 if ( ino >= sbi->max_ncci )
2298 continue;
2299
2300 if ((np->inode = capifs_new_inode(sb)) != NULL) {
2301 +#else
2302 + if ((np->inode = iget(sb, ino+2)) != NULL) {
2303 +#endif
2304 struct inode *inode = np->inode;
2305 inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
2306 inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
2307 +#ifdef COMPAT_VFS_2_4
2308 inode->i_nlink = 1;
2309 inode->i_ino = ino + 2;
2310 init_special_inode(inode, sbi->mode|S_IFCHR, np->kdev);
2311 +#else
2312 + inode->i_mode = sbi->mode | S_IFCHR;
2313 + inode->i_rdev = np->kdev;
2314 + inode->i_nlink++;
2315 +#endif
2316 }
2317 }
2318 }
2319 --- a/drivers/isdn/avmb1/capifs.h
2320 +++ b/drivers/isdn/avmb1/capifs.h
2321 @@ -1,4 +1,4 @@
2322 -/* $Id: capifs.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2323 +/* $Id: capifs.h,v 1.4 2001/09/24 13:22:44 kai Exp $
2324 *
2325 * Copyright 2000 by Carsten Paeth <calle@calle.de>
2326 *
2327 --- a/drivers/isdn/avmb1/capilli.h
2328 +++ b/drivers/isdn/avmb1/capilli.h
2329 @@ -1,4 +1,4 @@
2330 -/* $Id: capilli.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2331 +/* $Id: capilli.h,v 1.5 2001/09/24 13:22:44 kai Exp $
2332 *
2333 * Kernel CAPI 2.0 Driver Interface for Linux
2334 *
2335 --- a/drivers/isdn/avmb1/capiutil.c
2336 +++ b/drivers/isdn/avmb1/capiutil.c
2337 @@ -1,4 +1,4 @@
2338 -/* $Id: capiutil.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2339 +/* $Id: capiutil.c,v 1.16 2001/09/24 13:22:44 kai Exp $
2340 *
2341 * CAPI 2.0 convert capi message to capi message struct
2342 *
2343 @@ -19,6 +19,7 @@
2344 #include <linux/init.h>
2345 #include <asm/segment.h>
2346 #include <linux/config.h>
2347 +#include <linux/isdn_compat.h>
2348 #include "capiutil.h"
2349
2350 MODULE_DESCRIPTION("CAPI4Linux: CAPI message conversion support");
2351 --- a/drivers/isdn/avmb1/capiutil.h
2352 +++ b/drivers/isdn/avmb1/capiutil.h
2353 @@ -1,4 +1,4 @@
2354 -/* $Id: capiutil.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2355 +/* $Id: capiutil.h,v 1.7 2001/09/24 13:22:44 kai Exp $
2356 *
2357 * CAPI 2.0 defines & types
2358 *
2359 --- a/drivers/isdn/avmb1/kcapi.c
2360 +++ b/drivers/isdn/avmb1/kcapi.c
2361 @@ -1,4 +1,4 @@
2362 -/* $Id: kcapi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2363 +/* $Id: kcapi.c,v 1.28 2001/09/24 13:22:44 kai Exp $
2364 *
2365 * Kernel CAPI 2.0 Module
2366 *
2367 @@ -21,6 +21,7 @@
2368 #include <linux/proc_fs.h>
2369 #include <linux/skbuff.h>
2370 #include <linux/tqueue.h>
2371 +#include <linux/isdn_compat.h>
2372 #include <linux/capi.h>
2373 #include <linux/kernelcapi.h>
2374 #include <linux/locks.h>
2375 @@ -33,7 +34,7 @@
2376 #include <linux/b1lli.h>
2377 #endif
2378
2379 -static char *revision = "$Revision: 1.1.4.1 $";
2380 +static char *revision = "$Revision: 1.28 $";
2381
2382 /* ------------------------------------------------------------- */
2383
2384 @@ -64,7 +65,6 @@ struct capi_ncci {
2385 __u32 ncci;
2386 __u32 winsize;
2387 int nmsg;
2388 - spinlock_t lock;
2389 struct msgidqueue *msgidqueue;
2390 struct msgidqueue *msgidlast;
2391 struct msgidqueue *msgidfree;
2392 @@ -104,14 +104,14 @@ static char capi_manufakturer[64] = "AVM
2393 #define APPL(a) (&applications[(a)-1])
2394 #define VALID_APPLID(a) ((a) && (a) <= CAPI_MAXAPPL && APPL(a)->applid == a)
2395 #define APPL_IS_FREE(a) (APPL(a)->applid == 0)
2396 -#define APPL_MARK_FREE(a) do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0)
2397 -#define APPL_MARK_USED(a) do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0)
2398 +#define APPL_MARK_FREE(a) do{ APPL(a)->applid=0; MOD_DEC_USE_COUNT; }while(0);
2399 +#define APPL_MARK_USED(a) do{ APPL(a)->applid=(a); MOD_INC_USE_COUNT; }while(0);
2400
2401 #define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f)
2402
2403 #define VALID_CARD(c) ((c) > 0 && (c) <= CAPI_MAXCONTR)
2404 #define CARD(c) (&cards[(c)-1])
2405 -#define CARDNR(cp) ((((cp)-cards)+1) & 0xff)
2406 +#define CARDNR(cp) (((cp)-cards)+1)
2407
2408 static struct capi_appl applications[CAPI_MAXAPPL];
2409 static struct capi_ctr cards[CAPI_MAXCONTR];
2410 @@ -535,9 +535,13 @@ static int notify_push(unsigned int cmd,
2411 * of devices. Devices can only removed in
2412 * user process, not in bh.
2413 */
2414 +#ifdef COMPAT_HAS_SCHEDULE_TASK
2415 MOD_INC_USE_COUNT;
2416 if (schedule_task(&tq_state_notify) == 0)
2417 MOD_DEC_USE_COUNT;
2418 +#else
2419 + queue_task(&tq_state_notify, &tq_scheduler);
2420 +#endif
2421 return 0;
2422 }
2423
2424 @@ -546,13 +550,7 @@ static int notify_push(unsigned int cmd,
2425 static void notify_up(__u32 contr)
2426 {
2427 struct capi_interface_user *p;
2428 - __u16 appl;
2429
2430 - for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
2431 - if (!VALID_APPLID(appl)) continue;
2432 - if (APPL(appl)->releasing) continue;
2433 - CARD(contr)->driver->register_appl(CARD(contr), appl, &APPL(appl)->rparam);
2434 - }
2435 printk(KERN_NOTICE "kcapi: notify up contr %d\n", contr);
2436 spin_lock(&capi_users_lock);
2437 for (p = capi_users; p; p = p->next) {
2438 @@ -639,7 +637,9 @@ static void notify_handler(void *dummy)
2439 kfree(np);
2440 MOD_DEC_USE_COUNT;
2441 }
2442 +#ifdef COMPAT_HAS_SCHEDULE_TASK
2443 MOD_DEC_USE_COUNT;
2444 +#endif
2445 }
2446
2447 /* -------- NCCI Handling ------------------------------------- */
2448 @@ -647,7 +647,6 @@ static void notify_handler(void *dummy)
2449 static inline void mq_init(struct capi_ncci * np)
2450 {
2451 int i;
2452 - np->lock = SPIN_LOCK_UNLOCKED;
2453 np->msgidqueue = 0;
2454 np->msgidlast = 0;
2455 np->nmsg = 0;
2456 @@ -662,11 +661,8 @@ static inline void mq_init(struct capi_n
2457 static inline int mq_enqueue(struct capi_ncci * np, __u16 msgid)
2458 {
2459 struct msgidqueue *mq;
2460 - spin_lock_bh(&np->lock);
2461 - if ((mq = np->msgidfree) == 0) {
2462 - spin_unlock_bh(&np->lock);
2463 + if ((mq = np->msgidfree) == 0)
2464 return 0;
2465 - }
2466 np->msgidfree = mq->next;
2467 mq->msgid = msgid;
2468 mq->next = 0;
2469 @@ -676,14 +672,12 @@ static inline int mq_enqueue(struct capi
2470 if (!np->msgidqueue)
2471 np->msgidqueue = mq;
2472 np->nmsg++;
2473 - spin_unlock_bh(&np->lock);
2474 return 1;
2475 }
2476
2477 static inline int mq_dequeue(struct capi_ncci * np, __u16 msgid)
2478 {
2479 struct msgidqueue **pp;
2480 - spin_lock_bh(&np->lock);
2481 for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
2482 if ((*pp)->msgid == msgid) {
2483 struct msgidqueue *mq = *pp;
2484 @@ -693,11 +687,9 @@ static inline int mq_dequeue(struct capi
2485 mq->next = np->msgidfree;
2486 np->msgidfree = mq;
2487 np->nmsg--;
2488 - spin_unlock_bh(&np->lock);
2489 return 1;
2490 }
2491 }
2492 - spin_unlock_bh(&np->lock);
2493 return 0;
2494 }
2495
2496 @@ -720,16 +712,12 @@ static void controllercb_appl_released(s
2497 nextpp = &(*pp)->next;
2498 }
2499 }
2500 - if (APPL(appl)->releasing) { /* only release if the application was marked for release */
2501 - printk(KERN_DEBUG "kcapi: appl %d releasing(%d)\n", appl, APPL(appl)->releasing);
2502 - APPL(appl)->releasing--;
2503 - if (APPL(appl)->releasing <= 0) {
2504 - APPL(appl)->signal = 0;
2505 - APPL_MARK_FREE(appl);
2506 - printk(KERN_INFO "kcapi: appl %d down\n", appl);
2507 - }
2508 - } else
2509 - printk(KERN_WARNING "kcapi: appl %d card%d released without request\n", appl, card->cnr);
2510 + APPL(appl)->releasing--;
2511 + if (APPL(appl)->releasing <= 0) {
2512 + APPL(appl)->signal = 0;
2513 + APPL_MARK_FREE(appl);
2514 + printk(KERN_INFO "kcapi: appl %d down\n", appl);
2515 + }
2516 }
2517 /*
2518 * ncci management
2519 @@ -882,7 +870,16 @@ error:
2520
2521 static void controllercb_ready(struct capi_ctr * card)
2522 {
2523 + __u16 appl;
2524 +
2525 card->cardstate = CARD_RUNNING;
2526 +
2527 + for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
2528 + if (!VALID_APPLID(appl)) continue;
2529 + if (APPL(appl)->releasing) continue;
2530 + card->driver->register_appl(card, appl, &APPL(appl)->rparam);
2531 + }
2532 +
2533 printk(KERN_NOTICE "kcapi: card %d \"%s\" ready.\n",
2534 CARDNR(card), card->name);
2535
2536 --- a/drivers/isdn/avmb1/t1isa.c
2537 +++ b/drivers/isdn/avmb1/t1isa.c
2538 @@ -1,4 +1,4 @@
2539 -/* $Id: t1isa.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2540 +/* $Id: t1isa.c,v 1.22 2001/09/24 13:22:44 kai Exp $
2541 *
2542 * Module for AVM T1 HEMA-card.
2543 *
2544 @@ -19,13 +19,14 @@
2545 #include <linux/capi.h>
2546 #include <linux/kernelcapi.h>
2547 #include <linux/init.h>
2548 +#include <linux/isdn_compat.h>
2549 #include <asm/io.h>
2550 #include "capicmd.h"
2551 #include "capiutil.h"
2552 #include "capilli.h"
2553 #include "avmcard.h"
2554
2555 -static char *revision = "$Revision: 1.1.4.1 $";
2556 +static char *revision = "$Revision: 1.22 $";
2557
2558 /* ------------------------------------------------------------- */
2559
2560 --- a/drivers/isdn/avmb1/t1pci.c
2561 +++ b/drivers/isdn/avmb1/t1pci.c
2562 @@ -1,4 +1,4 @@
2563 -/* $Id: t1pci.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
2564 +/* $Id: t1pci.c,v 1.25 2001/09/24 13:22:44 kai Exp $
2565 *
2566 * Module for AVM T1 PCI-card.
2567 *
2568 @@ -18,6 +18,7 @@
2569 #include <linux/interrupt.h>
2570 #include <linux/ioport.h>
2571 #include <linux/pci.h>
2572 +#include <linux/isdn_compat.h>
2573 #include <linux/capi.h>
2574 #include <linux/init.h>
2575 #include <asm/io.h>
2576 @@ -26,19 +27,21 @@
2577 #include "capilli.h"
2578 #include "avmcard.h"
2579
2580 -static char *revision = "$Revision: 1.1.4.1 $";
2581 +static char *revision = "$Revision: 1.25 $";
2582
2583 #undef CONFIG_T1PCI_DEBUG
2584 #undef CONFIG_T1PCI_POLLDEBUG
2585
2586 /* ------------------------------------------------------------- */
2587
2588 +#ifndef COMPAT_HAS_2_2_PCI
2589 static struct pci_device_id t1pci_pci_tbl[] __initdata = {
2590 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_T1, PCI_ANY_ID, PCI_ANY_ID },
2591 { } /* Terminating entry */
2592 };
2593
2594 MODULE_DEVICE_TABLE(pci, t1pci_pci_tbl);
2595 +#endif
2596 MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 PCI card");
2597 MODULE_AUTHOR("Carsten Paeth");
2598 MODULE_LICENSE("GPL");
2599 @@ -264,9 +267,9 @@ static int __init t1pci_init(void)
2600 }
2601 pci_set_master(dev);
2602
2603 - param.port = pci_resource_start(dev, 1);
2604 + param.port = pci_resource_start_io(dev, 1);
2605 param.irq = dev->irq;
2606 - param.membase = pci_resource_start(dev, 0);
2607 + param.membase = pci_resource_start_mem(dev, 0);
2608
2609 printk(KERN_INFO
2610 "%s: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x\n",
2611 --- a/drivers/isdn/divert/divert_procfs.c
2612 +++ b/drivers/isdn/divert/divert_procfs.c
2613 @@ -1,4 +1,4 @@
2614 -/* $Id: divert_procfs.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2615 +/* $Id$
2616 *
2617 * Filesystem handling for the diversion supplementary services.
2618 *
2619 @@ -14,13 +14,16 @@
2620 #include <linux/module.h>
2621 #include <linux/version.h>
2622 #include <linux/poll.h>
2623 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2624 #include <linux/smp_lock.h>
2625 +#endif
2626 #ifdef CONFIG_PROC_FS
2627 #include <linux/proc_fs.h>
2628 #else
2629 #include <linux/fs.h>
2630 #endif
2631 #include <linux/isdnif.h>
2632 +#include <linux/isdn_compat.h>
2633 #include "isdn_divert.h"
2634
2635 /*********************************/
2636 @@ -80,7 +83,6 @@ static ssize_t
2637 isdn_divert_read(struct file *file, char *buf, size_t count, loff_t * off)
2638 {
2639 struct divert_info *inf;
2640 - loff_t pos = *off;
2641 int len;
2642
2643 if (!*((struct divert_info **) file->private_data)) {
2644 @@ -92,11 +94,11 @@ isdn_divert_read(struct file *file, char
2645 return (0);
2646
2647 inf->usage_cnt--; /* new usage count */
2648 - file->private_data = &inf->next; /* next structure */
2649 + (struct divert_info **) file->private_data = &inf->next; /* next structure */
2650 if ((len = strlen(inf->info_start)) <= count) {
2651 if (copy_to_user(buf, inf->info_start, len))
2652 return -EFAULT;
2653 - *off = pos + len;
2654 + file->f_pos += len;
2655 return (len);
2656 }
2657 return (0);
2658 @@ -136,17 +138,23 @@ isdn_divert_open(struct inode *ino, stru
2659 {
2660 unsigned long flags;
2661
2662 +#ifdef COMPAT_USE_MODCOUNT_LOCK
2663 + MOD_INC_USE_COUNT;
2664 +#else
2665 lock_kernel();
2666 +#endif
2667 save_flags(flags);
2668 cli();
2669 if_used++;
2670 if (divert_info_head)
2671 - filep->private_data = &(divert_info_tail->next);
2672 + (struct divert_info **) filep->private_data = &(divert_info_tail->next);
2673 else
2674 - filep->private_data = &divert_info_head;
2675 + (struct divert_info **) filep->private_data = &divert_info_head;
2676 restore_flags(flags);
2677 /* start_divert(); */
2678 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2679 unlock_kernel();
2680 +#endif
2681 return (0);
2682 } /* isdn_divert_open */
2683
2684 @@ -159,7 +167,9 @@ isdn_divert_close(struct inode *ino, str
2685 struct divert_info *inf;
2686 unsigned long flags;
2687
2688 +#ifndef COMPAT_USE_MODCOUNT_LOCK
2689 lock_kernel();
2690 +#endif
2691 save_flags(flags);
2692 cli();
2693 if_used--;
2694 @@ -175,7 +185,11 @@ isdn_divert_close(struct inode *ino, str
2695 divert_info_head = divert_info_head->next;
2696 kfree(inf);
2697 }
2698 +#ifdef COMPAT_USE_MODCOUNT_LOCK
2699 + MOD_DEC_USE_COUNT;
2700 +#else
2701 unlock_kernel();
2702 +#endif
2703 return (0);
2704 } /* isdn_divert_close */
2705
2706 @@ -276,6 +290,9 @@ static struct file_operations isdn_fops
2707 open: isdn_divert_open,
2708 release: isdn_divert_close,
2709 };
2710 +#ifdef COMPAT_NO_SOFTNET
2711 +struct inode_operations divert_file_inode_operations;
2712 +#endif
2713
2714 /****************************/
2715 /* isdn subdir in /proc/net */
2716 @@ -302,8 +319,16 @@ divert_dev_init(void)
2717 remove_proc_entry("isdn", proc_net);
2718 return (-1);
2719 }
2720 +#ifdef COMPAT_NO_SOFTNET
2721 + memset(&divert_file_inode_operations, 0, sizeof(struct inode_operations));
2722 + divert_file_inode_operations.default_file_ops = &isdn_fops;
2723 + isdn_divert_entry->ops = &divert_file_inode_operations;
2724 +#else
2725 isdn_divert_entry->proc_fops = &isdn_fops;
2726 +#ifdef COMPAT_HAS_FILEOP_OWNER
2727 isdn_divert_entry->owner = THIS_MODULE;
2728 +#endif
2729 +#endif /* COMPAT_NO_SOFTNET */
2730 #endif /* CONFIG_PROC_FS */
2731
2732 return (0);
2733 --- a/drivers/isdn/divert/isdn_divert.c
2734 +++ b/drivers/isdn/divert/isdn_divert.c
2735 @@ -1,4 +1,4 @@
2736 -/* $Id: isdn_divert.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2737 +/* $Id$
2738 *
2739 * DSS1 main diversion supplementary handling for i4l.
2740 *
2741 @@ -84,6 +84,9 @@ static void deflect_timer_expire(ulong a
2742 restore_flags(flags);
2743 break;
2744
2745 + case NETWORK_DIAL:
2746 + divert_if.dial_net_name(cs->deflect_dest);
2747 +
2748 case DEFLECT_AUTODEL:
2749 default:
2750 save_flags(flags);
2751 @@ -452,6 +455,7 @@ int isdn_divert_icall(isdn_ctrl *ic)
2752 case DEFLECT_PROCEED:
2753 case DEFLECT_REPORT:
2754 case DEFLECT_REJECT:
2755 + case NETWORK_DIAL:
2756 if (dv->rule.action == DEFLECT_PROCEED)
2757 if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime)))
2758 return(0); /* no external deflection needed */
2759 @@ -495,6 +499,11 @@ int isdn_divert_icall(isdn_ctrl *ic)
2760 else
2761 { cs->deflect_dest[0] = '\0';
2762 retval = 4; /* only proceed */
2763 + if (cs->akt_state == NETWORK_DIAL) {
2764 + strcpy(cs->deflect_dest,dv->rule.to_nr);
2765 + cs->timer.expires = jiffies + 10;
2766 + retval = 0;
2767 + }
2768 }
2769 sprintf(cs->info,"%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n",
2770 cs->akt_state,
2771 @@ -739,6 +748,18 @@ int prot_stat_callback(isdn_ctrl *ic)
2772 }
2773
2774
2775 +#if 0
2776 + sprintf(st, "0x%lx 0x%lx",ic->arg, ic->parm.dss1_io.ll_id);
2777 + p = st + strlen(st);
2778 + p1 = ic->parm.dss1_io.data;
2779 + i = ic->parm.dss1_io.datalen;
2780 + while ((i > 0) && (p - st < 530))
2781 + { p += sprintf(p," %02x",(*p1++) & 0xFF);
2782 + i--;
2783 + }
2784 + sprintf(p, "\n");
2785 + put_info_buffer(st);
2786 +#endif
2787 break;
2788
2789 default:
2790 --- a/drivers/isdn/divert/isdn_divert.h
2791 +++ b/drivers/isdn/divert/isdn_divert.h
2792 @@ -1,4 +1,4 @@
2793 -/* $Id: isdn_divert.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2794 +/* $Id$
2795 *
2796 * Header for the diversion supplementary ioctl interface.
2797 *
2798 @@ -36,9 +36,10 @@
2799 #define DEFLECT_PROCEED 2 /* deflect when externally triggered */
2800 #define DEFLECT_ALERT 3 /* alert and deflect after delay */
2801 #define DEFLECT_REJECT 4 /* reject immediately */
2802 -#define DIVERT_ACTIVATE 5 /* diversion activate */
2803 -#define DIVERT_DEACTIVATE 6 /* diversion deactivate */
2804 -#define DIVERT_REPORT 7 /* interrogation result */
2805 +#define NETWORK_DIAL 5 /* dial a network interface */
2806 +#define DIVERT_ACTIVATE 16 /* diversion activate */
2807 +#define DIVERT_DEACTIVATE 17 /* diversion deactivate */
2808 +#define DIVERT_REPORT 18 /* interrogation result */
2809 #define DEFLECT_AUTODEL 255 /* only for internal use */
2810
2811 #define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */
2812 @@ -60,6 +61,7 @@ typedef struct
2813 2 = report call, send proceed, wait max waittime secs
2814 3 = report call, alert and deflect after waittime
2815 4 = report call, reject immediately
2816 + 5 = dial net interface specified in to_nr
2817 actions 1-2 only take place if interface is opened
2818 */
2819 u_char waittime; /* maximum wait time for proceeding */
2820 --- a/drivers/isdn/eicon/Divas_mod.c
2821 +++ b/drivers/isdn/eicon/Divas_mod.c
2822 @@ -20,6 +20,7 @@
2823 #include "adapter.h"
2824 #include "uxio.h"
2825
2826 +#include <linux/isdn_compat.h>
2827
2828 MODULE_DESCRIPTION("ISDN4Linux: Driver for Eicon Diva Server cards");
2829 MODULE_AUTHOR("Armin Schindler");
2830 --- a/drivers/isdn/eicon/common.c
2831 +++ b/drivers/isdn/eicon/common.c
2832 @@ -808,9 +808,7 @@ void DivasDoDpc(void *pData)
2833
2834 while(i--)
2835 {
2836 - if (card->state == DIA_RUNNING)
2837 - DivaDoCardDpc(card);
2838 - card++;
2839 + DivaDoCardDpc(card++);
2840 }
2841 }
2842
2843 --- a/drivers/isdn/eicon/eicon.h
2844 +++ b/drivers/isdn/eicon/eicon.h
2845 @@ -1,4 +1,4 @@
2846 -/* $Id: eicon.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2847 +/* $Id: eicon.h,v 1.26 2001/09/24 13:22:47 kai Exp $
2848 *
2849 * ISDN low-level module for Eicon active ISDN-Cards.
2850 *
2851 @@ -347,19 +347,19 @@ typedef struct eicon_card {
2852 extern char *eicon_ctype_name[];
2853
2854
2855 -static inline void eicon_schedule_tx(eicon_card *card)
2856 +extern __inline__ void eicon_schedule_tx(eicon_card *card)
2857 {
2858 queue_task(&card->snd_tq, &tq_immediate);
2859 mark_bh(IMMEDIATE_BH);
2860 }
2861
2862 -static inline void eicon_schedule_rx(eicon_card *card)
2863 +extern __inline__ void eicon_schedule_rx(eicon_card *card)
2864 {
2865 queue_task(&card->rcv_tq, &tq_immediate);
2866 mark_bh(IMMEDIATE_BH);
2867 }
2868
2869 -static inline void eicon_schedule_ack(eicon_card *card)
2870 +extern __inline__ void eicon_schedule_ack(eicon_card *card)
2871 {
2872 queue_task(&card->ack_tq, &tq_immediate);
2873 mark_bh(IMMEDIATE_BH);
2874 --- a/drivers/isdn/eicon/eicon_dsp.h
2875 +++ b/drivers/isdn/eicon/eicon_dsp.h
2876 @@ -1,4 +1,4 @@
2877 -/* $Id: eicon_dsp.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2878 +/* $Id: eicon_dsp.h,v 1.8 2001/09/24 13:22:47 kai Exp $
2879 *
2880 * ISDN lowlevel-module for Eicon active cards.
2881 * DSP definitions
2882 --- a/drivers/isdn/eicon/eicon_idi.c
2883 +++ b/drivers/isdn/eicon/eicon_idi.c
2884 @@ -1,4 +1,4 @@
2885 -/* $Id: eicon_idi.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2886 +/* $Id: eicon_idi.c,v 1.45 2001/11/07 22:35:48 kai Exp $
2887 *
2888 * ISDN lowlevel-module for Eicon active cards.
2889 * IDI interface
2890 @@ -25,7 +25,7 @@
2891
2892 #undef EICON_FULL_SERVICE_OKTETT
2893
2894 -char *eicon_idi_revision = "$Revision: 1.1.4.1 $";
2895 +char *eicon_idi_revision = "$Revision: 1.45 $";
2896
2897 eicon_manifbuf *manbuf;
2898
2899 @@ -1583,6 +1583,37 @@ idi_faxdata_rcv(eicon_card *ccard, eicon
2900 return;
2901 }
2902
2903 +#if 0
2904 + eicon_sff_dochead *doc = (eicon_sff_dochead *)skb->data;
2905 + eicon_sff_pagehead *page = (eicon_sff_pagehead *)skb->data + sizeof(eicon_sff_dochead);
2906 +
2907 + printk(KERN_DEBUG"SFF: doc %d / page %d (skb : %d)\n",
2908 + sizeof(eicon_sff_dochead),
2909 + sizeof(eicon_sff_pagehead), skb->len);
2910 +
2911 + if (skb->len >= sizeof(eicon_sff_dochead)) {
2912 + printk(KERN_DEBUG"SFF: id = 0x%x\n", doc->id);
2913 + printk(KERN_DEBUG"SFF: version = 0x%x\n", doc->version);
2914 + printk(KERN_DEBUG"SFF: reserved1 = 0x%x\n", doc->reserved1);
2915 + printk(KERN_DEBUG"SFF: userinfo = 0x%x\n", doc->userinfo);
2916 + printk(KERN_DEBUG"SFF: pagecount = 0x%x\n", doc->pagecount);
2917 + printk(KERN_DEBUG"SFF: off1pagehead = 0x%x\n", doc->off1pagehead);
2918 + printk(KERN_DEBUG"SFF: offnpagehead = 0x%x\n", doc->offnpagehead);
2919 + printk(KERN_DEBUG"SFF: offdocend = 0x%x\n", doc->offdocend);
2920 + }
2921 + if (skb->len >= (sizeof(eicon_sff_dochead) + sizeof(eicon_sff_pagehead))) {
2922 + printk(KERN_DEBUG"SFFp: id = 0x%x\n", page->pageheadid);
2923 + printk(KERN_DEBUG"SFFp: len = 0x%x\n", page->pageheadlen);
2924 + printk(KERN_DEBUG"SFFp: resvert = 0x%x\n", page->resvert);
2925 + printk(KERN_DEBUG"SFFp: reshoriz = 0x%x\n", page->reshoriz);
2926 + printk(KERN_DEBUG"SFFp: coding = 0x%x\n", page->coding);
2927 + printk(KERN_DEBUG"SFFp: reserved2 = 0x%x\n", page->reserved2);
2928 + printk(KERN_DEBUG"SFFp: linelength = 0x%x\n", page->linelength);
2929 + printk(KERN_DEBUG"SFFp: pagelength = 0x%x\n", page->pagelength);
2930 + printk(KERN_DEBUG"SFFp: offprevpage = 0x%x\n", page->offprevpage);
2931 + printk(KERN_DEBUG"SFFp: offnextpage = 0x%x\n", page->offnextpage);
2932 + }
2933 +#endif
2934
2935
2936 if (chan->fax->direction == ISDN_TTY_FAX_CONN_IN) {
2937 @@ -2054,8 +2085,7 @@ idi_faxdata_send(eicon_card *ccard, eico
2938 OutBuf.Len++;
2939 } else {
2940 *OutBuf.Next++ = 0;
2941 - *(__u16 *) OutBuf.Next = (__u16) LineBuf.Len;
2942 - OutBuf.Next += sizeof(__u16);
2943 + *((__u16 *) OutBuf.Next)++ = (__u16) LineBuf.Len;
2944 OutBuf.Len += 3;
2945 }
2946 memcpy(OutBuf.Next, LineBuf.Data, LineBuf.Len);
2947 @@ -2385,6 +2415,12 @@ idi_handle_ind(eicon_card *ccard, struct
2948 } else {
2949 if (chan->e.B2Id)
2950 idi_do_req(ccard, chan, REMOVE, 1);
2951 +#if 0
2952 + if (chan->e.D3Id) {
2953 + idi_do_req(ccard, chan, REMOVE, 0);
2954 + idi_do_req(ccard, chan, ASSIGN, 0);
2955 + }
2956 +#endif
2957 chan->statectrl &= ~WAITING_FOR_HANGUP;
2958 chan->statectrl &= ~IN_HOLD;
2959 if (chan->statectrl & HAVE_CONN_REQ) {
2960 --- a/drivers/isdn/eicon/eicon_idi.h
2961 +++ b/drivers/isdn/eicon/eicon_idi.h
2962 @@ -1,4 +1,4 @@
2963 -/* $Id: eicon_idi.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2964 +/* $Id: eicon_idi.h,v 1.12 2001/09/24 13:22:47 kai Exp $
2965 *
2966 * ISDN lowlevel-module for the Eicon active cards.
2967 * IDI-Interface
2968 --- a/drivers/isdn/eicon/eicon_io.c
2969 +++ b/drivers/isdn/eicon/eicon_io.c
2970 @@ -1,4 +1,4 @@
2971 -/* $Id: eicon_io.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2972 +/* $Id: eicon_io.c,v 1.15 2001/09/24 13:22:47 kai Exp $
2973 *
2974 * ISDN low-level module for Eicon active ISDN-Cards.
2975 * Code for communicating with hardware.
2976 --- a/drivers/isdn/eicon/eicon_isa.c
2977 +++ b/drivers/isdn/eicon/eicon_isa.c
2978 @@ -1,4 +1,4 @@
2979 -/* $Id: eicon_isa.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2980 +/* $Id: eicon_isa.c,v 1.18 2001/11/07 22:35:48 kai Exp $
2981 *
2982 * ISDN low-level module for Eicon active ISDN-Cards.
2983 * Hardware-specific code for old ISA cards.
2984 @@ -20,7 +20,7 @@
2985 #define release_shmem release_region
2986 #define request_shmem request_region
2987
2988 -char *eicon_isa_revision = "$Revision: 1.1.4.1 $";
2989 +char *eicon_isa_revision = "$Revision: 1.18 $";
2990
2991 #undef EICON_MCA_DEBUG
2992
2993 @@ -38,8 +38,12 @@ static int eicon_isa_valid_irq[] = {
2994 static void
2995 eicon_isa_release_shmem(eicon_isa_card *card) {
2996 if (card->mvalid) {
2997 +#ifdef COMPAT_HAS_ISA_IOREMAP
2998 iounmap(card->shmem);
2999 release_mem_region(card->physmem, card->ramsize);
3000 +#else
3001 + release_shmem((unsigned long)card->shmem, card->ramsize);
3002 +#endif
3003 }
3004 card->mvalid = 0;
3005 }
3006 @@ -94,12 +98,20 @@ eicon_isa_find_card(int Mem, int Irq, ch
3007 Mem, Id);
3008 return -1;
3009 }
3010 +#ifdef COMPAT_HAS_ISA_IOREMAP
3011 if (check_mem_region(Mem, RAMSIZE)) {
3012 +#else
3013 + if (check_shmem(Mem, RAMSIZE)) {
3014 +#endif
3015 printk(KERN_WARNING "eicon_isa_boot: memory at 0x%x already in use.\n", Mem);
3016 return -1;
3017 }
3018
3019 +#ifdef COMPAT_HAS_ISA_IOREMAP
3020 amem = (unsigned long) ioremap(Mem, RAMSIZE);
3021 +#else
3022 + amem = (unsigned long) Mem;
3023 +#endif
3024 writew(0x55aa, amem + 0x402);
3025 if (readw(amem + 0x402) != 0x55aa) primary = 0;
3026 writew(0, amem + 0x402);
3027 @@ -109,12 +121,16 @@ eicon_isa_find_card(int Mem, int Irq, ch
3028 if (primary) {
3029 printk(KERN_INFO "Eicon: assuming pri card at 0x%x\n", Mem);
3030 writeb(0, amem + 0x3ffe);
3031 +#ifdef COMPAT_HAS_ISA_IOREMAP
3032 iounmap((unsigned char *)amem);
3033 +#endif
3034 return EICON_CTYPE_ISAPRI;
3035 } else {
3036 printk(KERN_INFO "Eicon: assuming bri card at 0x%x\n", Mem);
3037 writeb(0, amem + 0x400);
3038 +#ifdef COMPAT_HAS_ISA_IOREMAP
3039 iounmap((unsigned char *)amem);
3040 +#endif
3041 return EICON_CTYPE_ISABRI;
3042 }
3043 return -1;
3044 @@ -151,6 +167,7 @@ eicon_isa_bootload(eicon_isa_card *card,
3045 else
3046 card->ramsize = RAMSIZE;
3047
3048 +#ifdef COMPAT_HAS_ISA_IOREMAP
3049 if (check_mem_region(card->physmem, card->ramsize)) {
3050 printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
3051 card->physmem);
3052 @@ -159,6 +176,16 @@ eicon_isa_bootload(eicon_isa_card *card,
3053 }
3054 request_mem_region(card->physmem, card->ramsize, "Eicon ISA ISDN");
3055 card->shmem = (eicon_isa_shmem *) ioremap(card->physmem, card->ramsize);
3056 +#else
3057 + /* Register shmem */
3058 + if (check_shmem((unsigned long)card->shmem, card->ramsize)) {
3059 + printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
3060 + (unsigned long)card->shmem);
3061 + kfree(code);
3062 + return -EBUSY;
3063 + }
3064 + request_shmem((unsigned long)card->shmem, card->ramsize, "Eicon ISA ISDN");
3065 +#endif
3066 #ifdef EICON_MCA_DEBUG
3067 printk(KERN_INFO "eicon_isa_boot: card->ramsize = %d.\n", card->ramsize);
3068 #endif
3069 --- a/drivers/isdn/eicon/eicon_isa.h
3070 +++ b/drivers/isdn/eicon/eicon_isa.h
3071 @@ -1,4 +1,4 @@
3072 -/* $Id: eicon_isa.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3073 +/* $Id: eicon_isa.h,v 1.11 2001/09/24 13:22:47 kai Exp $
3074 *
3075 * ISDN low-level module for Eicon active ISDN-Cards.
3076 *
3077 --- a/drivers/isdn/eicon/eicon_mod.c
3078 +++ b/drivers/isdn/eicon/eicon_mod.c
3079 @@ -1,4 +1,4 @@
3080 -/* $Id: eicon_mod.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3081 +/* $Id: eicon_mod.c,v 1.44 2001/11/20 09:48:25 armin Exp $
3082 *
3083 * ISDN lowlevel-module for Eicon active cards.
3084 *
3085 @@ -44,7 +44,7 @@
3086 static eicon_card *cards = (eicon_card *) NULL; /* glob. var , contains
3087 start of card-list */
3088
3089 -static char *eicon_revision = "$Revision: 1.1.4.1 $";
3090 +static char *eicon_revision = "$Revision: 1.44 $";
3091
3092 extern char *eicon_pci_revision;
3093 extern char *eicon_isa_revision;
3094 @@ -639,6 +639,18 @@ if_command(isdn_ctrl * c)
3095 static int
3096 if_writecmd(const u_char * buf, int len, int user, int id, int channel)
3097 {
3098 +#if 0
3099 + /* Not yet used */
3100 + eicon_card *card = eicon_findcard(id);
3101 +
3102 + if (card) {
3103 + if (!card->flags & EICON_FLAGS_RUNNING)
3104 + return (len);
3105 + return (len);
3106 + }
3107 + printk(KERN_ERR
3108 + "eicon: if_writecmd called with invalid driverId!\n");
3109 +#endif
3110 return (len);
3111 }
3112
3113 @@ -665,11 +677,8 @@ if_readstatus(u_char * buf, int len, int
3114 else
3115 cnt = skb->len;
3116
3117 - if (user) {
3118 - spin_unlock_irqrestore(&eicon_lock, flags);
3119 + if (user)
3120 copy_to_user(p, skb->data, cnt);
3121 - spin_lock_irqsave(&eicon_lock, flags);
3122 - }
3123 else
3124 memcpy(p, skb->data, cnt);
3125
3126 @@ -1459,6 +1468,7 @@ eicon_exit(void)
3127
3128 #ifndef MODULE
3129
3130 +#ifdef COMPAT_HAS_NEW_SETUP
3131 static int __init
3132 eicon_setup(char *line)
3133 {
3134 @@ -1467,6 +1477,12 @@ eicon_setup(char *line)
3135 char *str;
3136
3137 str = get_options(line, 4, ints);
3138 +#else
3139 +void
3140 +eicon_setup(char *str, int *ints)
3141 +{
3142 + int i, argc;
3143 +#endif
3144
3145 argc = ints[0];
3146 i = 1;
3147 @@ -1494,9 +1510,13 @@ eicon_setup(char *line)
3148 #else
3149 printk(KERN_INFO "Eicon ISDN active driver setup\n");
3150 #endif
3151 +#ifdef COMPAT_HAS_NEW_SETUP
3152 return(1);
3153 }
3154 __setup("eicon=", eicon_setup);
3155 +#else
3156 +}
3157 +#endif
3158
3159 #endif /* MODULE */
3160
3161 --- a/drivers/isdn/eicon/eicon_pci.c
3162 +++ b/drivers/isdn/eicon/eicon_pci.c
3163 @@ -1,4 +1,4 @@
3164 -/* $Id: eicon_pci.c,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3165 +/* $Id: eicon_pci.c,v 1.18 2001/09/24 13:22:47 kai Exp $
3166 *
3167 * ISDN low-level module for Eicon active ISDN-Cards.
3168 * Hardware-specific code for PCI cards.
3169 @@ -24,7 +24,7 @@
3170 #include "adapter.h"
3171 #include "uxio.h"
3172
3173 -char *eicon_pci_revision = "$Revision: 1.1.4.1 $";
3174 +char *eicon_pci_revision = "$Revision: 1.18 $";
3175
3176 #if CONFIG_PCI /* intire stuff is only for PCI */
3177 #ifdef CONFIG_ISDN_DRV_EICON_PCI
3178 --- a/drivers/isdn/eicon/eicon_pci.h
3179 +++ b/drivers/isdn/eicon/eicon_pci.h
3180 @@ -1,4 +1,4 @@
3181 -/* $Id: eicon_pci.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
3182 +/* $Id: eicon_pci.h,v 1.7 2001/09/24 13:22:47 kai Exp $
3183 *
3184 * ISDN low-level module for Eicon active ISDN-Cards (PCI part).
3185 *
3186 --- a/drivers/isdn/eicon/fourbri.c
3187 +++ b/drivers/isdn/eicon/fourbri.c
3188 @@ -337,8 +337,7 @@ static int diva_server_4bri_load(card_t
3189 static int diva_server_4bri_start(card_t *card, byte *channels)
3190 {
3191 byte *ctl;
3192 - byte *shared;
3193 - int i;
3194 + byte *shared, i;
3195 int adapter_num;
3196
3197 DPRINTF(("divas: start Diva Server 4BRI"));
3198 --- a/drivers/isdn/eicon/kprintf.c
3199 +++ b/drivers/isdn/eicon/kprintf.c
3200 @@ -18,6 +18,468 @@
3201 #include "divalog.h"
3202 #include "uxio.h"
3203
3204 +/*
3205 + * Implementation of printf and sprintf for kernel
3206 + */
3207 +
3208 +#define MAX_BUFF (80) /* limit size of temporary buffers */
3209 +
3210 +#define WRITE_CHAR(BUFFER, SIZE, C) \
3211 + if (--(SIZE) < 0) { (BUFFER)--; *(BUFFER) = '\0'; return; } *(BUFFER)++ = (C)
3212 +
3213 +
3214 +/*
3215 + * convert a number to decimal ASCII
3216 + */
3217 +
3218 +static
3219 +void do_decimal( char *temp,
3220 + int temp_len,
3221 + unsigned int value,
3222 + char *s)
3223 +
3224 +{
3225 + int i;
3226 +
3227 + temp[0] = '\0';
3228 +
3229 + for (i = 1; i < temp_len; i++)
3230 + {
3231 + temp[i] = (char) ((value % 10) + (int) '0');
3232 + value /= 10;
3233 + }
3234 +
3235 + for (i = (temp_len - 1); temp[i] == '0'; i--)
3236 + {
3237 + ;
3238 + }
3239 +
3240 + if (i == 0)
3241 + {
3242 + i++;
3243 + }
3244 +
3245 + while (i >= 0)
3246 + {
3247 + *s++ = temp[i--];
3248 + }
3249 +
3250 + return;
3251 +}
3252 +
3253 +/*
3254 + * convert a number to octal ASCII
3255 + */
3256 +
3257 +static
3258 +void do_octal( char *temp,
3259 + unsigned int value,
3260 + char *s)
3261 +
3262 +{
3263 + int i;
3264 +
3265 + temp[0] = '\0';
3266 +
3267 + for (i = 1; i <= 11; i++)
3268 + {
3269 + temp[i] = (char) ((value & 07) + (int) '0');
3270 + value >>= 3;
3271 + }
3272 + temp[11] &= '3';
3273 +
3274 + for (i = 11; temp[i] == '0'; i--)
3275 + {
3276 + ;
3277 + }
3278 +
3279 + if (i == 0)
3280 + {
3281 + i++;
3282 + }
3283 +
3284 + while (i >= 0)
3285 + {
3286 + *s++ = temp[i--];
3287 + }
3288 +
3289 + return;
3290 +}
3291 +
3292 +/*
3293 + * convert a number to hex ASCII
3294 + */
3295 +
3296 +static
3297 +void do_hex( char *temp,
3298 + unsigned int value,
3299 + char *s)
3300 +
3301 +{
3302 + int i;
3303 + static
3304 + char *dec_to_hex = "0123456789abcdef";
3305 +
3306 + temp[0] = '\0';
3307 +
3308 + for (i = 1; i <= 8; i++)
3309 + {
3310 + temp[i] = dec_to_hex[value & 0x0f];
3311 + value >>= 4;
3312 + }
3313 +
3314 + for (i = 8; temp[i] == '0'; i--)
3315 + {
3316 + ;
3317 + }
3318 +
3319 + if (i == 0)
3320 + {
3321 + i++;
3322 + }
3323 +
3324 + while (i >= 0)
3325 + {
3326 + *s++ = temp[i--];
3327 + }
3328 +
3329 + return;
3330 +}
3331 +
3332 +/*
3333 + * convert a buffer to ASCII HEX
3334 + */
3335 +
3336 +static
3337 +void do_buffer( char *buffer,
3338 + int length,
3339 + char *s)
3340 +
3341 +{
3342 + static
3343 + char hex_char [] = "0123456789abcdef";
3344 + char *b = buffer;
3345 + int hex_byte;
3346 + int nybble;
3347 +
3348 + length = (length >= ((MAX_BUFF / 3) + 1)) ? (MAX_BUFF / 3) : length;
3349 +
3350 + while (length)
3351 + {
3352 + hex_byte = (int) *b++;
3353 + nybble = (hex_byte >> 4) & 0xf;
3354 + *s++ = hex_char[nybble];
3355 + nybble = hex_byte & 0xf;
3356 + *s++ = hex_char[nybble];
3357 + *s++ = ' ';
3358 + length--;
3359 + }
3360 + *s = '\0';
3361 +
3362 + return;
3363 +}
3364 +
3365 +/*
3366 + * Body of sprintf function: behaves just like standard sprintf, except we
3367 + * have an extra argument (buffer size) which we use to ensure we don't
3368 + * overflow
3369 + */
3370 +
3371 +void Divas_vsprintf( char *buffer,
3372 + int size,
3373 + char *fmt,
3374 + va_list argptr)
3375 +
3376 +{
3377 + char c; /* single character buffer */
3378 + int i; /* handy scratch counter */
3379 + int f; /* format character (after %) */
3380 + char *str; /* pointer into string */
3381 + char temp[20]; /* temp buffer used in printing numbers */
3382 + char string[MAX_BUFF]; /* output from number conversion */
3383 + int length; /* length of string "str" */
3384 + char fill; /* fill character ' ' or '0' */
3385 + boolean_t leftjust; /* TRUE if left justified, else right justified */
3386 + int fmax, fmin; /* field specifiers % MIN . MAX s */
3387 + int leading; /* number of leading/trailing fill characters */
3388 + char sign; /* set to '-' for negative decimals */
3389 + int number; /* numeric argument */
3390 +
3391 + char *buff_ptr; /* pointer to user's buffer of hex data */
3392 + int buff_len; /* length of hex data */
3393 +
3394 + /* make sure we have somthing to write into */
3395 +
3396 + if ((!buffer) || (size <= 0))
3397 + {
3398 + return;
3399 + }
3400 +
3401 + while (TRUE)
3402 + {
3403 + /* echo characters until end or '%' encountered */
3404 +
3405 + while ((c = *fmt++) != '%')
3406 + {
3407 + if (!c)
3408 + {
3409 + *buffer = '\0';
3410 + return;
3411 + }
3412 + WRITE_CHAR(buffer, size, c);
3413 + }
3414 +
3415 + /* echo %% as % */
3416 +
3417 + if (*fmt == '%')
3418 + {
3419 + WRITE_CHAR(buffer, size, *fmt);
3420 + continue;
3421 + }
3422 +
3423 + /* %- turns on left-justify */
3424 +
3425 + if ((leftjust = (boolean_t) ((*fmt == '-') ? TRUE : FALSE)))
3426 + {
3427 + fmt++;
3428 + }
3429 +
3430 + /* %0 turns on zero filling */
3431 +
3432 + if (*fmt == '0')
3433 + {
3434 + fill = '0';
3435 + }
3436 + else
3437 + {
3438 + fill = ' ';
3439 + }
3440 +
3441 + /* minium field width specifier for %d, u, x, c, s */
3442 +
3443 + fmin = 0;
3444 +
3445 + if (*fmt == '*')
3446 + {
3447 + fmin = va_arg(argptr, int);
3448 + fmt++;
3449 + }
3450 + else
3451 + {
3452 + while ('0' <= *fmt && *fmt <= '9')
3453 + {
3454 + fmin = (fmin * 10) + (*fmt++ - '0');
3455 + }
3456 + }
3457 +
3458 + /* maximum string width specifier for %s */
3459 +
3460 + fmax = 0;
3461 +
3462 + if (*fmt == '.')
3463 + {
3464 + if (*(++fmt) == '*')
3465 + {
3466 + fmax = va_arg(argptr, int);
3467 + fmt++;
3468 + }
3469 + else
3470 + {
3471 + while ('0' <= *fmt && *fmt <= '9')
3472 + {
3473 + fmax = (fmax * 10) + (*fmt++ - '0');
3474 + }
3475 + }
3476 + }
3477 +
3478 + /* skip over 'l' option (ints are assumed same size as longs) */
3479 +
3480 + if (*fmt == 'l')
3481 + {
3482 + fmt++;
3483 + }
3484 +
3485 + /* get the format chacater */
3486 +
3487 + if (!(f = *fmt++))
3488 + {
3489 + WRITE_CHAR(buffer, size, '%');
3490 + *buffer = '\0';
3491 + return;
3492 + }
3493 +
3494 + sign = '\0'; /* sign == '-' for negative decimal */
3495 +
3496 + str = string;
3497 +
3498 + switch (f)
3499 + {
3500 + case 'c' :
3501 + string[0] = (char) va_arg(argptr, int);
3502 + string[1] = '\0';
3503 + fmax = 0;
3504 + fill = ' ';
3505 + break;
3506 +
3507 + case 's' :
3508 + str = va_arg(argptr, char *);
3509 + fill = ' ';
3510 + break;
3511 +
3512 + case 'D' :
3513 + case 'd' :
3514 + number = va_arg(argptr, int);
3515 + if (number < 0)
3516 + {
3517 + sign = '-';
3518 + number = -number;
3519 + }
3520 + do_decimal(temp, DIM(temp), (unsigned int) number, str);
3521 + fmax = 0;
3522 + break;
3523 +
3524 + case 'U' :
3525 + case 'u' :
3526 + number = va_arg(argptr, int);
3527 + do_decimal(temp, DIM(temp), (unsigned int) number, str);
3528 + fmax = 0;
3529 + break;
3530 +
3531 + case 'O' :
3532 + case 'o' :
3533 + number = va_arg(argptr, int);
3534 + do_octal(temp, (unsigned int) number, str);
3535 + fmax = 0;
3536 + break;
3537 +
3538 + case 'X' :
3539 + case 'x' :
3540 + number = va_arg(argptr, int);
3541 + do_hex(temp, (unsigned int) number, str);
3542 + fmax = 0;
3543 + break;
3544 +
3545 + case 'H' :
3546 + case 'h' :
3547 + buff_ptr = va_arg(argptr, char *);
3548 + buff_len = va_arg(argptr, int);
3549 + do_buffer(buff_ptr, buff_len, str);
3550 + fmax = 0;
3551 + break;
3552 +
3553 + default :
3554 + WRITE_CHAR(buffer, size, ((char) f));
3555 + break;
3556 + }
3557 +
3558 + /* get the length of the string */
3559 +
3560 + length = 0;
3561 + while (str[length])
3562 + {
3563 + length++;
3564 + }
3565 +
3566 + /* make sure we have fmax and fmin values that are O.K. */
3567 +
3568 + if (fmin > DIM(string) || fmin < 0)
3569 + {
3570 + fmin = 0;
3571 + }
3572 +
3573 + if (fmax > DIM(string) || fmax < 0)
3574 + {
3575 + fmax = 0;
3576 + }
3577 +
3578 + /* figure out how many leading characters thare are */
3579 +
3580 + leading = 0;
3581 +
3582 + if (fmax || fmin)
3583 + {
3584 + if (fmax)
3585 + {
3586 + if (length > fmax)
3587 + {
3588 + length = fmax;
3589 + }
3590 + }
3591 +
3592 + if (fmin)
3593 + {
3594 + leading = fmin - length;
3595 + }
3596 +
3597 + if (sign == '-')
3598 + {
3599 + leading--;
3600 + }
3601 + }
3602 +
3603 + /* output sign now, if fill is numeric */
3604 +
3605 + if (sign == '-' && fill == '0')
3606 + {
3607 + WRITE_CHAR(buffer, size, '-');
3608 + }
3609 +
3610 + /* if right justified, output fill characters */
3611 +
3612 + if (!leftjust)
3613 + {
3614 + for (i = 0; i < leading; i++)
3615 + {
3616 + WRITE_CHAR(buffer, size, fill);
3617 + }
3618 + }
3619 +
3620 + /* output sign now, if fill is spaces */
3621 +
3622 + if (sign == '-' && fill == ' ')
3623 + {
3624 + WRITE_CHAR(buffer, size, '-');
3625 + }
3626 +
3627 + /* now the actual value */
3628 +
3629 + for (i = 0; i < length; i++)
3630 + {
3631 + WRITE_CHAR(buffer, size, str[i]);
3632 + }
3633 +
3634 + /* if left justified, fill out with the fill character */
3635 +
3636 + if (leftjust)
3637 + {
3638 + for (i = 0; i < leading; i++)
3639 + {
3640 + WRITE_CHAR(buffer, size, fill);
3641 + }
3642 + }
3643 + }
3644 +}
3645 +
3646 +/*
3647 + * sprintf for kernel
3648 + *
3649 + * call our vsprintf assuming user has a big buffer....
3650 + */
3651 +
3652 +void DivasSprintf(char *buffer, char *fmt, ...)
3653 +
3654 +{
3655 + va_list argptr; /* pointer to additional args */
3656 +
3657 + va_start(argptr, fmt);
3658 +
3659 + Divas_vsprintf(buffer, 1024, fmt, argptr);
3660 +
3661 + va_end(argptr);
3662 +
3663 + return;
3664 +}
3665 +
3666 void DivasPrintf(char *fmt, ...)
3667
3668 {
3669 @@ -40,7 +502,7 @@ void DivasPrintf(char *fmt, ...)
3670
3671 /* call vsprintf to format the user's information */
3672
3673 - vsnprintf(log.buffer, DIM(log.buffer), fmt, argptr);
3674 + Divas_vsprintf(log.buffer, DIM(log.buffer), fmt, argptr);
3675
3676 va_end(argptr);
3677
3678 --- a/drivers/isdn/eicon/lincfg.c
3679 +++ b/drivers/isdn/eicon/lincfg.c
3680 @@ -26,6 +26,9 @@
3681 #include "uxio.h"
3682
3683 #include <linux/pci.h>
3684 +#ifndef COMPAT_HAS_2_2_PCI
3685 +#include <linux/pci_ids.h>
3686 +#endif
3687 #include <linux/kernel.h>
3688 #include <linux/ioport.h>
3689
3690 --- a/drivers/isdn/eicon/linchr.c
3691 +++ b/drivers/isdn/eicon/linchr.c
3692 @@ -154,17 +154,17 @@ ssize_t do_read(struct file *pFile, char
3693 klog_t *pHeadItem;
3694
3695 if (BufferSize < sizeof(klog_t))
3696 + {
3697 + printk(KERN_WARNING "Divas: Divalog buffer specifed a size that is too small (%d - %d required)\n",
3698 + BufferSize, sizeof(klog_t));
3699 return -EIO;
3700 + }
3701
3702 pHeadItem = (klog_t *) DivasLogFifoRead();
3703
3704 if (pHeadItem)
3705 {
3706 - if(copy_to_user(pClientLogBuffer, pHeadItem, sizeof(klog_t)))
3707 - {
3708 - kfree(pHeadItem);
3709 - return -EFAULT;
3710 - }
3711 + memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t));
3712 kfree(pHeadItem);
3713 return sizeof(klog_t);
3714 }
3715 --- a/drivers/isdn/eicon/linio.c
3716 +++ b/drivers/isdn/eicon/linio.c
3717 @@ -15,6 +15,7 @@
3718 #include <linux/slab.h>
3719 #include <linux/pci.h>
3720 #include <linux/delay.h>
3721 +#include <linux/isdn_compat.h>
3722 #undef N_DATA
3723
3724 #include "uxio.h"
3725 --- a/drivers/isdn/hisax/Makefile
3726 +++ b/drivers/isdn/hisax/Makefile
3727 @@ -4,20 +4,17 @@
3728
3729 O_TARGET := vmlinux-obj.o
3730
3731 -# Define maximum number of cards
3732 -
3733 -EXTRA_CFLAGS += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
3734 -
3735 # Objects that export symbols.
3736
3737 -export-objs := config.o hisax_isac.o isdnhdlc.o
3738 +export-objs := config.o fsm.o hisax_isac.o
3739
3740 # Multipart objects.
3741
3742 list-multi := hisax.o hisax_st5481.o
3743 hisax-objs := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \
3744 lmgr.o q931.o callc.o fsm.o cert.o
3745 -hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o
3746 +hisax_st5481-objs := st5481_init.o st5481_usb.o st5481_d.o st5481_b.o \
3747 + st5481_hdlc.o
3748
3749 # Optional parts of multipart objects.
3750 hisax-objs-$(CONFIG_HISAX_EURO) += l3dss1.o
3751 @@ -33,7 +30,7 @@ hisax-objs-$(CONFIG_HISAX_AVM_A1_PCMCIA)
3752 hisax-objs-$(CONFIG_HISAX_FRITZPCI) += avm_pci.o isac.o arcofi.o
3753 hisax-objs-$(CONFIG_HISAX_ELSA) += elsa.o isac.o arcofi.o hscx.o
3754 hisax-objs-$(CONFIG_HISAX_IX1MICROR2) += ix1_micro.o isac.o arcofi.o hscx.o
3755 -hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o ipacx.o
3756 +hisax-objs-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o
3757 hisax-objs-$(CONFIG_HISAX_ASUSCOM) += asuscom.o isac.o arcofi.o hscx.o
3758 hisax-objs-$(CONFIG_HISAX_TELEINT) += teleint.o isac.o arcofi.o hfc_2bs0.o
3759 hisax-objs-$(CONFIG_HISAX_SEDLBAUER) += sedlbauer.o isac.o arcofi.o hscx.o isar.o
3760 @@ -44,6 +41,7 @@ hisax-objs-$(CONFIG_HISAX_NETJET_U) += n
3761 hisax-objs-$(CONFIG_HISAX_HFCS) += hfcscard.o hfc_2bds0.o
3762 hisax-objs-$(CONFIG_HISAX_HFC_PCI) += hfc_pci.o
3763 hisax-objs-$(CONFIG_HISAX_HFC_SX) += hfc_sx.o
3764 +hisax-objs-$(CONFIG_HISAX_HFC_USB) += hfc_usbr.o
3765 hisax-objs-$(CONFIG_HISAX_NICCY) += niccy.o isac.o arcofi.o hscx.o
3766 hisax-objs-$(CONFIG_HISAX_ISURF) += isurf.o isac.o arcofi.o isar.o
3767 hisax-objs-$(CONFIG_HISAX_HSTSAPHIR) += saphir.o isac.o arcofi.o hscx.o
3768 @@ -51,7 +49,6 @@ hisax-objs-$(CONFIG_HISAX_BKM_A4T) += bk
3769 hisax-objs-$(CONFIG_HISAX_SCT_QUADRO) += bkm_a8.o isac.o arcofi.o hscx.o
3770 hisax-objs-$(CONFIG_HISAX_GAZEL) += gazel.o isac.o arcofi.o hscx.o
3771 hisax-objs-$(CONFIG_HISAX_W6692) += w6692.o
3772 -hisax-objs-$(CONFIG_HISAX_ENTERNOW_PCI) += enternow_pci.o amd7930_fn.o
3773 #hisax-objs-$(CONFIG_HISAX_TESTEMU) += testemu.o
3774
3775 hisax-objs += $(sort $(hisax-objs-y))
3776 @@ -61,10 +58,9 @@ hisax-objs += $(sort $(hisax-objs-y))
3777 obj-$(CONFIG_ISDN_DRV_HISAX) += hisax.o
3778 obj-$(CONFIG_HISAX_SEDLBAUER_CS) += sedlbauer_cs.o
3779 obj-$(CONFIG_HISAX_ELSA_CS) += elsa_cs.o
3780 -obj-$(CONFIG_HISAX_AVM_A1_CS) += avma1_cs.o
3781 -obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o isdnhdlc.o
3782 -obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_isac.o hisax_fcpcipnp.o
3783 -obj-$(CONFIG_USB_AUERISDN) += isdnhdlc.o
3784 +obj-$(CONFIG_HISAX_HFC_USB_CS) += hfc_usb.o
3785 +obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o
3786 +obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_fcpcipnp.o hisax_isac.o
3787
3788 CERT := $(shell md5sum -c md5sums.asc >> /dev/null;echo $$?)
3789 CFLAGS_cert.o := -DCERTIFICATION=$(CERT)
3790 --- /dev/null
3791 +++ b/drivers/isdn/hisax/amd7930.c
3792 @@ -0,0 +1,755 @@
3793 +/* $Id: amd7930.c,v 1.8 2001/09/24 13:22:55 kai Exp $
3794 + *
3795 + * HiSax ISDN driver - chip specific routines for AMD 7930
3796 + *
3797 + * Author Brent Baccala
3798 + * Copyright by Brent Baccala <baccala@FreeSoft.org>
3799 + *
3800 + * This software may be used and distributed according to the terms
3801 + * of the GNU General Public License, incorporated herein by reference.
3802 + *
3803 + * - Existing ISDN HiSax driver provides all the smarts
3804 + * - it compiles, runs, talks to an isolated phone switch, connects
3805 + * to a Cisco, pings go through
3806 + * - AMD 7930 support only (no DBRI yet)
3807 + * - no US NI-1 support (may not work on US phone system - untested)
3808 + * - periodic packet loss, apparently due to lost interrupts
3809 + * - ISDN sometimes freezes, requiring reboot before it will work again
3810 + *
3811 + * The code is unreliable enough to be consider alpha
3812 + *
3813 + * This file is (c) under GNU General Public License
3814 + *
3815 + * Advanced Micro Devices' Am79C30A is an ISDN/audio chip used in the
3816 + * SparcStation 1+. The chip provides microphone and speaker interfaces
3817 + * which provide mono-channel audio at 8K samples per second via either
3818 + * 8-bit A-law or 8-bit mu-law encoding. Also, the chip features an
3819 + * ISDN BRI Line Interface Unit (LIU), I.430 S/T physical interface,
3820 + * which performs basic D channel LAPD processing and provides raw
3821 + * B channel data. The digital audio channel, the two ISDN B channels,
3822 + * and two 64 Kbps channels to the microprocessor are all interconnected
3823 + * via a multiplexer.
3824 + *
3825 + * This driver interfaces to the Linux HiSax ISDN driver, which performs
3826 + * all high-level Q.921 and Q.931 ISDN functions. The file is not
3827 + * itself a hardware driver; rather it uses functions exported by
3828 + * the AMD7930 driver in the sparcaudio subsystem (drivers/sbus/audio),
3829 + * allowing the chip to be simultaneously used for both audio and ISDN data.
3830 + * The hardware driver does _no_ buffering, but provides several callbacks
3831 + * which are called during interrupt service and should therefore run quickly.
3832 + *
3833 + * D channel transmission is performed by passing the hardware driver the
3834 + * address and size of an skb's data area, then waiting for a callback
3835 + * to signal successful transmission of the packet. A task is then
3836 + * queued to notify the HiSax driver that another packet may be transmitted.
3837 + *
3838 + * D channel reception is quite simple, mainly because of:
3839 + * 1) the slow speed of the D channel - 16 kbps, and
3840 + * 2) the presence of an 8- or 32-byte (depending on chip version) FIFO
3841 + * to buffer the D channel data on the chip
3842 + * Worst case scenario of back-to-back packets with the 8 byte buffer
3843 + * at 16 kbps yields an service time of 4 ms - long enough to preclude
3844 + * the need for fancy buffering. We queue a background task that copies
3845 + * data out of the receive buffer into an skb, and the hardware driver
3846 + * simply does nothing until we're done with the receive buffer and
3847 + * reset it for a new packet.
3848 + *
3849 + * B channel processing is more complex, because of:
3850 + * 1) the faster speed - 64 kbps,
3851 + * 2) the lack of any on-chip buffering (it interrupts for every byte), and
3852 + * 3) the lack of any chip support for HDLC encapsulation
3853 + *
3854 + * The HiSax driver can put each B channel into one of three modes -
3855 + * L1_MODE_NULL (channel disabled), L1_MODE_TRANS (transparent data relay),
3856 + * and L1_MODE_HDLC (HDLC encapsulation by low-level driver).
3857 + * L1_MODE_HDLC is the most common, used for almost all "pure" digital
3858 + * data sessions. L1_MODE_TRANS is used for ISDN audio.
3859 + *
3860 + * HDLC B channel transmission is performed via a large buffer into
3861 + * which the skb is copied while performing HDLC bit-stuffing. A CRC
3862 + * is computed and attached to the end of the buffer, which is then
3863 + * passed to the low-level routines for raw transmission. Once
3864 + * transmission is complete, the hardware driver is set to enter HDLC
3865 + * idle by successive transmission of mark (all 1) bytes, waiting for
3866 + * the ISDN driver to prepare another packet for transmission and
3867 + * deliver it.
3868 + *
3869 + * HDLC B channel reception is performed via an X-byte ring buffer
3870 + * divided into N sections of X/N bytes each. Defaults: X=256 bytes, N=4.
3871 + * As the hardware driver notifies us that each section is full, we
3872 + * hand it the next section and schedule a background task to peruse
3873 + * the received section, bit-by-bit, with an HDLC decoder. As
3874 + * packets are detected, they are copied into a large buffer while
3875 + * decoding HDLC bit-stuffing. The ending CRC is verified, and if
3876 + * it is correct, we alloc a new skb of the correct length (which we
3877 + * now know), copy the packet into it, and hand it to the upper layers.
3878 + * Optimization: for large packets, we hand the buffer (which also
3879 + * happens to be an skb) directly to the upper layer after an skb_trim,
3880 + * and alloc a new large buffer for future packets, thus avoiding a copy.
3881 + * Then we return to HDLC processing; state is saved between calls.
3882 + *
3883 + */
3884 +
3885 +#define __NO_VERSION__
3886 +#include "hisax.h"
3887 +#include "../../sbus/audio/amd7930.h"
3888 +#include "isac.h"
3889 +#include "isdnl1.h"
3890 +#include "rawhdlc.h"
3891 +#include <linux/interrupt.h>
3892 +
3893 +static const char *amd7930_revision = "$Revision: 1.8 $";
3894 +
3895 +#define RCV_BUFSIZE 1024 /* Size of raw receive buffer in bytes */
3896 +#define RCV_BUFBLKS 4 /* Number of blocks to divide buffer into
3897 + * (must divide RCV_BUFSIZE) */
3898 +
3899 +static void Bchan_fill_fifo(struct BCState *, struct sk_buff *);
3900 +
3901 +static void
3902 +Bchan_xmt_bh(struct BCState *bcs)
3903 +{
3904 + struct sk_buff *skb;
3905 +
3906 + if (bcs->hw.amd7930.tx_skb != NULL) {
3907 + dev_kfree_skb(bcs->hw.amd7930.tx_skb);
3908 + bcs->hw.amd7930.tx_skb = NULL;
3909 + }
3910 +
3911 + if ((skb = skb_dequeue(&bcs->squeue))) {
3912 + Bchan_fill_fifo(bcs, skb);
3913 + } else {
3914 + clear_bit(BC_FLG_BUSY, &bcs->Flag);
3915 + bcs->event |= 1 << B_XMTBUFREADY;
3916 + queue_task(&bcs->tqueue, &tq_immediate);
3917 + mark_bh(IMMEDIATE_BH);
3918 + }
3919 +}
3920 +
3921 +static void
3922 +Bchan_xmit_callback(struct BCState *bcs)
3923 +{
3924 + queue_task(&bcs->hw.amd7930.tq_xmt, &tq_immediate);
3925 + mark_bh(IMMEDIATE_BH);
3926 +}
3927 +
3928 +/* B channel transmission: two modes (three, if you count L1_MODE_NULL)
3929 + *
3930 + * L1_MODE_HDLC - We need to do HDLC encapsulation before transmiting
3931 + * the packet (i.e. make_raw_hdlc_data). Since this can be a
3932 + * time-consuming operation, our completion callback just schedules
3933 + * a bottom half to do encapsulation for the next packet. In between,
3934 + * the link will just idle
3935 + *
3936 + * L1_MODE_TRANS - Data goes through, well, transparent. No HDLC encap,
3937 + * and we can't just let the link idle, so the "bottom half" actually
3938 + * gets called during the top half (it's our callback routine in this case),
3939 + * but it's a lot faster now since we don't call make_raw_hdlc_data
3940 + */
3941 +
3942 +static void
3943 +Bchan_fill_fifo(struct BCState *bcs, struct sk_buff *skb)
3944 +{
3945 + struct IsdnCardState *cs = bcs->cs;
3946 + int len;
3947 +
3948 + if ((cs->debug & L1_DEB_HSCX) || (cs->debug & L1_DEB_HSCX_FIFO)) {
3949 + char tmp[1024];
3950 + char *t = tmp;
3951 +
3952 + t += sprintf(t, "amd7930_fill_fifo %c cnt %d",
3953 + bcs->channel ? 'B' : 'A', skb->len);
3954 + if (cs->debug & L1_DEB_HSCX_FIFO)
3955 + QuickHex(t, skb->data, skb->len);
3956 + debugl1(cs, tmp);
3957 + }
3958 +
3959 + if (bcs->mode == L1_MODE_HDLC) {
3960 + len = make_raw_hdlc_data(skb->data, skb->len,
3961 + bcs->hw.amd7930.tx_buff, RAW_BUFMAX);
3962 + if (len > 0)
3963 + amd7930_bxmit(0, bcs->channel,
3964 + bcs->hw.amd7930.tx_buff, len,
3965 + (void *) &Bchan_xmit_callback,
3966 + (void *) bcs);
3967 + dev_kfree_skb(skb);
3968 + } else if (bcs->mode == L1_MODE_TRANS) {
3969 + amd7930_bxmit(0, bcs->channel,
3970 + bcs->hw.amd7930.tx_buff, skb->len,
3971 + (void *) &Bchan_xmt_bh,
3972 + (void *) bcs);
3973 + bcs->hw.amd7930.tx_skb = skb;
3974 + } else {
3975 + dev_kfree_skb(skb);
3976 + }
3977 +}
3978 +
3979 +static void
3980 +Bchan_mode(struct BCState *bcs, int mode, int bc)
3981 +{
3982 + struct IsdnCardState *cs = bcs->cs;
3983 +
3984 + if (cs->debug & L1_DEB_HSCX) {
3985 + char tmp[40];
3986 + sprintf(tmp, "AMD 7930 mode %d bchan %d/%d",
3987 + mode, bc, bcs->channel);
3988 + debugl1(cs, tmp);
3989 + }
3990 + bcs->mode = mode;
3991 +}
3992 +
3993 +/* Bchan_l2l1 is the entry point for upper layer routines that want to
3994 + * transmit on the B channel. PH_DATA_REQ is a normal packet that
3995 + * we either start transmitting (if idle) or queue (if busy).
3996 + * PH_PULL_REQ can be called to request a callback message (PH_PULL_CNF)
3997 + * once the link is idle. After a "pull" callback, the upper layer
3998 + * routines can use PH_PULL_IND to send data.
3999 + */
4000 +
4001 +static void
4002 +Bchan_l2l1(struct PStack *st, int pr, void *arg)
4003 +{
4004 + struct sk_buff *skb = arg;
4005 +
4006 + switch (pr) {
4007 + case (PH_DATA_REQ):
4008 + if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4009 + skb_queue_tail(&st->l1.bcs->squeue, skb);
4010 + } else {
4011 + test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
4012 + Bchan_fill_fifo(st->l1.bcs, skb);
4013 + }
4014 + break;
4015 + case (PH_PULL_IND):
4016 + if (test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4017 + printk(KERN_WARNING "amd7930: this shouldn't happen\n");
4018 + break;
4019 + }
4020 + test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag);
4021 + Bchan_fill_fifo(st->l1.bcs, skb);
4022 + break;
4023 + case (PH_PULL_REQ):
4024 + if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag)) {
4025 + clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4026 + st->l1.l1l2(st, PH_PULL_CNF, NULL);
4027 + } else
4028 + set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
4029 + break;
4030 + }
4031 +}
4032 +
4033 +/* Receiver callback and bottom half - decodes HDLC at leisure (if
4034 + * L1_MODE_HDLC) and passes newly received skb on via bcs->rqueue. If
4035 + * a large packet is received, stick rv_skb (the buffer that the
4036 + * packet has been decoded into) on the receive queue and alloc a new
4037 + * (large) skb to act as buffer for future receives. If a small
4038 + * packet is received, leave rv_skb alone, alloc a new skb of the
4039 + * correct size, and copy the packet into it
4040 + */
4041 +
4042 +static void
4043 +Bchan_recv_callback(struct BCState *bcs)
4044 +{
4045 + struct amd7930_hw *hw = &bcs->hw.amd7930;
4046 +
4047 + hw->rv_buff_in += RCV_BUFSIZE/RCV_BUFBLKS;
4048 + hw->rv_buff_in %= RCV_BUFSIZE;
4049 +
4050 + if (hw->rv_buff_in != hw->rv_buff_out) {
4051 + amd7930_brecv(0, bcs->channel,
4052 + hw->rv_buff + hw->rv_buff_in,
4053 + RCV_BUFSIZE/RCV_BUFBLKS,
4054 + (void *) &Bchan_recv_callback, (void *) bcs);
4055 + }
4056 +
4057 + queue_task(&hw->tq_rcv, &tq_immediate);
4058 + mark_bh(IMMEDIATE_BH);
4059 +}
4060 +
4061 +static void
4062 +Bchan_rcv_bh(struct BCState *bcs)
4063 +{
4064 + struct IsdnCardState *cs = bcs->cs;
4065 + struct amd7930_hw *hw = &bcs->hw.amd7930;
4066 + struct sk_buff *skb;
4067 + int len;
4068 +
4069 + if (cs->debug & L1_DEB_HSCX) {
4070 + char tmp[1024];
4071 +
4072 + sprintf(tmp, "amd7930_Bchan_rcv (%d/%d)",
4073 + hw->rv_buff_in, hw->rv_buff_out);
4074 + debugl1(cs, tmp);
4075 + QuickHex(tmp, hw->rv_buff + hw->rv_buff_out,
4076 + RCV_BUFSIZE/RCV_BUFBLKS);
4077 + debugl1(cs, tmp);
4078 + }
4079 +
4080 + do {
4081 + if (bcs->mode == L1_MODE_HDLC) {
4082 + while ((len = read_raw_hdlc_data(hw->hdlc_state,
4083 + hw->rv_buff + hw->rv_buff_out, RCV_BUFSIZE/RCV_BUFBLKS,
4084 + hw->rv_skb->tail, HSCX_BUFMAX))) {
4085 + if (len > 0 && (cs->debug & L1_DEB_HSCX_FIFO)) {
4086 + char tmp[1024];
4087 + char *t = tmp;
4088 +
4089 + t += sprintf(t, "amd7930_Bchan_rcv %c cnt %d", bcs->channel ? 'B' : 'A', len);
4090 + QuickHex(t, hw->rv_skb->tail, len);
4091 + debugl1(cs, tmp);
4092 + }
4093 +
4094 + if (len > HSCX_BUFMAX/2) {
4095 + /* Large packet received */
4096 +
4097 + if (!(skb = dev_alloc_skb(HSCX_BUFMAX))) {
4098 + printk(KERN_WARNING "amd7930: receive out of memory");
4099 + } else {
4100 + skb_put(hw->rv_skb, len);
4101 + skb_queue_tail(&bcs->rqueue, hw->rv_skb);
4102 + hw->rv_skb = skb;
4103 + bcs->event |= 1 << B_RCVBUFREADY;
4104 + queue_task(&bcs->tqueue, &tq_immediate);
4105 + }
4106 + } else if (len > 0) {
4107 + /* Small packet received */
4108 +
4109 + if (!(skb = dev_alloc_skb(len))) {
4110 + printk(KERN_WARNING "amd7930: receive out of memory\n");
4111 + } else {
4112 + memcpy(skb_put(skb, len), hw->rv_skb->tail, len);
4113 + skb_queue_tail(&bcs->rqueue, skb);
4114 + bcs->event |= 1 << B_RCVBUFREADY;
4115 + queue_task(&bcs->tqueue, &tq_immediate);
4116 + mark_bh(IMMEDIATE_BH);
4117 + }
4118 + } else {
4119 + /* Reception Error */
4120 + /* printk("amd7930: B channel receive error\n"); */
4121 + }
4122 + }
4123 + } else if (bcs->mode == L1_MODE_TRANS) {
4124 + if (!(skb = dev_alloc_skb(RCV_BUFSIZE/RCV_BUFBLKS))) {
4125 + printk(KERN_WARNING "amd7930: receive out of memory\n");
4126 + } else {
4127 + memcpy(skb_put(skb, RCV_BUFSIZE/RCV_BUFBLKS),
4128 + hw->rv_buff + hw->rv_buff_out,
4129 + RCV_BUFSIZE/RCV_BUFBLKS);
4130 + skb_queue_tail(&bcs->rqueue, skb);
4131 + bcs->event |= 1 << B_RCVBUFREADY;
4132 + queue_task(&bcs->tqueue, &tq_immediate);
4133 + mark_bh(IMMEDIATE_BH);
4134 + }
4135 + }
4136 +
4137 + if (hw->rv_buff_in == hw->rv_buff_out) {
4138 + /* Buffer was filled up - need to restart receiver */
4139 + amd7930_brecv(0, bcs->channel,
4140 + hw->rv_buff + hw->rv_buff_in,
4141 + RCV_BUFSIZE/RCV_BUFBLKS,
4142 + (void *) &Bchan_recv_callback,
4143 + (void *) bcs);
4144 + }
4145 +
4146 + hw->rv_buff_out += RCV_BUFSIZE/RCV_BUFBLKS;
4147 + hw->rv_buff_out %= RCV_BUFSIZE;
4148 +
4149 + } while (hw->rv_buff_in != hw->rv_buff_out);
4150 +}
4151 +
4152 +static void
4153 +Bchan_close(struct BCState *bcs)
4154 +{
4155 + struct sk_buff *skb;
4156 +
4157 + Bchan_mode(bcs, 0, 0);
4158 + amd7930_bclose(0, bcs->channel);
4159 +
4160 + if (test_bit(BC_FLG_INIT, &bcs->Flag)) {
4161 + skb_queue_purge(&bcs->rqueue);
4162 + skb_queue_purge(&bcs->squeue);
4163 + }
4164 + test_and_clear_bit(BC_FLG_INIT, &bcs->Flag);
4165 +}
4166 +
4167 +static int
4168 +Bchan_open(struct BCState *bcs)
4169 +{
4170 + struct amd7930_hw *hw = &bcs->hw.amd7930;
4171 +
4172 + if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
4173 + skb_queue_head_init(&bcs->rqueue);
4174 + skb_queue_head_init(&bcs->squeue);
4175 + }
4176 + test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
4177 +
4178 + amd7930_bopen(0, bcs->channel, 0xff);
4179 + hw->rv_buff_in = 0;
4180 + hw->rv_buff_out = 0;
4181 + hw->tx_skb = NULL;
4182 + init_hdlc_state(hw->hdlc_state, 0);
4183 + amd7930_brecv(0, bcs->channel,
4184 + hw->rv_buff + hw->rv_buff_in, RCV_BUFSIZE/RCV_BUFBLKS,
4185 + (void *) &Bchan_recv_callback, (void *) bcs);
4186 +
4187 + bcs->event = 0;
4188 + bcs->tx_cnt = 0;
4189 + return (0);
4190 +}
4191 +
4192 +static void
4193 +Bchan_init(struct BCState *bcs)
4194 +{
4195 + if (!(bcs->hw.amd7930.tx_buff = kmalloc(RAW_BUFMAX, GFP_ATOMIC))) {
4196 + printk(KERN_WARNING
4197 + "HiSax: No memory for amd7930.tx_buff\n");
4198 + return;
4199 + }
4200 + if (!(bcs->hw.amd7930.rv_buff = kmalloc(RCV_BUFSIZE, GFP_ATOMIC))) {
4201 + printk(KERN_WARNING
4202 + "HiSax: No memory for amd7930.rv_buff\n");
4203 + return;
4204 + }
4205 + if (!(bcs->hw.amd7930.rv_skb = dev_alloc_skb(HSCX_BUFMAX))) {
4206 + printk(KERN_WARNING
4207 + "HiSax: No memory for amd7930.rv_skb\n");
4208 + return;
4209 + }
4210 + if (!(bcs->hw.amd7930.hdlc_state = kmalloc(sizeof(struct hdlc_state),
4211 + GFP_ATOMIC))) {
4212 + printk(KERN_WARNING
4213 + "HiSax: No memory for amd7930.hdlc_state\n");
4214 + return;
4215 + }
4216 +
4217 + bcs->hw.amd7930.tq_rcv.sync = 0;
4218 + bcs->hw.amd7930.tq_rcv.routine = (void (*)(void *)) &Bchan_rcv_bh;
4219 + bcs->hw.amd7930.tq_rcv.data = (void *) bcs;
4220 +
4221 + bcs->hw.amd7930.tq_xmt.sync = 0;
4222 + bcs->hw.amd7930.tq_xmt.routine = (void (*)(void *)) &Bchan_xmt_bh;
4223 + bcs->hw.amd7930.tq_xmt.data = (void *) bcs;
4224 +}
4225 +
4226 +static void
4227 +Bchan_manl1(struct PStack *st, int pr,
4228 + void *arg)
4229 +{
4230 + switch (pr) {
4231 + case (PH_ACTIVATE_REQ):
4232 + test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
4233 + Bchan_mode(st->l1.bcs, st->l1.mode, st->l1.bc);
4234 + st->l1.l1man(st, PH_ACTIVATE_CNF, NULL);
4235 + break;
4236 + case (PH_DEACTIVATE_REQ):
4237 + if (!test_bit(BC_FLG_BUSY, &st->l1.bcs->Flag))
4238 + Bchan_mode(st->l1.bcs, 0, 0);
4239 + test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag);
4240 + break;
4241 + }
4242 +}
4243 +
4244 +int
4245 +setstack_amd7930(struct PStack *st, struct BCState *bcs)
4246 +{
4247 + if (Bchan_open(bcs))
4248 + return (-1);
4249 + st->l1.bcs = bcs;
4250 + st->l2.l2l1 = Bchan_l2l1;
4251 + st->ma.manl1 = Bchan_manl1;
4252 + setstack_manager(st);
4253 + bcs->st = st;
4254 + return (0);
4255 +}
4256 +
4257 +
4258 +static void
4259 +amd7930_drecv_callback(void *arg, int error, unsigned int count)
4260 +{
4261 + struct IsdnCardState *cs = (struct IsdnCardState *) arg;
4262 + static struct tq_struct task;
4263 + struct sk_buff *skb;
4264 +
4265 + /* NOTE: This function is called directly from an interrupt handler */
4266 +
4267 + if (1) {
4268 + if (!(skb = alloc_skb(count, GFP_ATOMIC)))
4269 + printk(KERN_WARNING "HiSax: D receive out of memory\n");
4270 + else {