1 /* $Id: config.c,v 2.23 1999/02/17 10:53:02 cpetig Exp $
3 * Author Karsten Keil (keil@isdn4linux.de)
4 * based on the teles driver from Jan den Ouden
8 * Revision 2.23 1999/02/17 10:53:02 cpetig
9 * Added Hisax_closecard to exported symbols.
10 * As indicated by Oliver Schoett <os@sdm.de>.
12 * If anyone is annoyed by exporting symbols deep inside the code, please
15 * Revision 2.22 1999/02/04 21:41:53 keil
18 * Revision 2.21 1999/02/04 10:48:52 keil
21 * Revision 2.20 1998/11/15 23:54:28 keil
24 * Revision 2.19 1998/08/13 23:36:18 keil
25 * HiSax 3.1 - don't work stable with current LinkLevel
27 * Revision 2.18 1998/07/30 21:01:37 niemann
28 * Fixed Sedlbauer Speed Fax PCMCIA missing isdnl3new
30 * Revision 2.17 1998/07/15 15:01:26 calle
31 * Support for AVM passive PCMCIA cards:
32 * A1 PCMCIA, FRITZ!Card PCMCIA and FRITZ!Card PCMCIA 2.0
34 * Revision 2.16 1998/05/25 14:10:03 keil
36 * X.75 and leased are working again.
38 * Revision 2.15 1998/05/25 12:57:43 keil
39 * HiSax golden code from certification, Don't use !!!
40 * No leased lines, no X75, but many changes.
42 * Revision 2.14 1998/04/15 16:38:25 keil
43 * Add S0Box and Teles PCI support
45 * Revision 2.13 1998/03/09 23:19:23 keil
48 * Revision 2.12 1998/02/11 17:28:02 keil
49 * Niccy PnP/PCI support
51 * Revision 2.11 1998/02/09 21:26:13 keil
52 * fix export module for 2.1
54 * Revision 2.10 1998/02/09 18:46:05 keil
55 * Support for Sedlbauer PCMCIA (Marcus Niemann)
57 * Revision 2.9 1998/02/03 23:31:28 keil
60 * Revision 2.8 1998/02/02 13:32:59 keil
63 * Revision 2.7 1998/01/31 21:41:44 keil
64 * changes for newer 2.1 kernels
66 * Revision 2.6 1997/11/08 21:35:43 keil
69 * Revision 2.5 1997/11/06 17:15:08 keil
70 * New 2.1 init; PCMCIA wrapper changes
72 * Revision 2.4 1997/10/29 19:07:52 keil
75 * Revision 2.3 1997/10/01 09:21:33 fritz
76 * Removed old compatibility stuff for 2.0.X kernels.
77 * From now on, this code is for 2.1.X ONLY!
78 * Old stuff is still in the separate branch.
80 * Revision 2.2 1997/09/11 17:24:46 keil
83 * Revision 2.1 1997/07/27 21:41:35 keil
86 * Revision 2.0 1997/06/26 11:06:28 keil
87 * New card and L1 interface.
88 * Eicon.Diehl Diva and Dynalink IS64PH support
90 * old changes removed /KKe
93 #include <linux/types.h>
94 #include <linux/stddef.h>
95 #include <linux/timer.h>
96 #include <linux/config.h>
98 #include <linux/module.h>
99 #include <linux/kernel_stat.h>
100 #include <linux/tqueue.h>
101 #include <linux/interrupt.h>
102 #define HISAX_STATUS_BUFSIZE 4096
103 #define INCLUDE_INLINE_FUNCS
106 * This structure array contains one entry per card. An entry looks
109 * { type, protocol, p0, p1, p2, NULL }
112 * 1 Teles 16.0 p0=irq p1=membase p2=iobase
113 * 2 Teles 8.0 p0=irq p1=membase
114 * 3 Teles 16.3 p0=irq p1=iobase
115 * 4 Creatix PNP p0=irq p1=IO0 (ISAC) p2=IO1 (HSCX)
116 * 5 AVM A1 (Fritz) p0=irq p1=iobase
117 * 6 ELSA PC [p0=iobase] or nothing (autodetect)
118 * 7 ELSA Quickstep p0=irq p1=iobase
119 * 8 Teles PCMCIA p0=irq p1=iobase
120 * 9 ITK ix1-micro p0=irq p1=iobase
121 * 10 ELSA PCMCIA p0=irq p1=iobase
122 * 11 Eicon.Diehl Diva p0=irq p1=iobase
123 * 12 Asuscom ISDNLink p0=irq p1=iobase
124 * 13 Teleint p0=irq p1=iobase
125 * 14 Teles 16.3c p0=irq p1=iobase
126 * 15 Sedlbauer speed p0=irq p1=iobase
127 * 15 Sedlbauer PC/104 p0=irq p1=iobase
128 * 15 Sedlbauer speed pci no parameter
129 * 16 USR Sportster internal p0=irq p1=iobase
130 * 17 MIC card p0=irq p1=iobase
131 * 18 ELSA Quickstep 1000PCI no parameter
132 * 19 Compaq ISDN S0 ISA card p0=irq p1=IO0 (HSCX) p2=IO1 (ISAC) p3=IO2
133 * 20 Travers Technologies NETjet PCI card
134 * 21 TELES PCI no parameter
135 * 22 Sedlbauer Speed Star p0=irq p1=iobase
137 * 24 Dr Neuhaus Niccy PnP/PCI card p0=irq p1=IO0 p2=IO1 (PnP only)
138 * 25 Teles S0Box p0=irq p1=iobase (from isapnp setup)
139 * 26 AVM A1 PCMCIA (Fritz) p0=irq p1=iobase
140 * 27 AVM PnP/PCI p0=irq p1=iobase (PCI no parameter)
141 * 28 Sedlbauer Speed Fax+ p0=irq p1=iobase (from isapnp setup)
143 * protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6 or ISDN_PTYPE_NI1
148 const char *CardType
[] =
149 {"No Card", "Teles 16.0", "Teles 8.0", "Teles 16.3", "Creatix/Teles PnP",
150 "AVM A1", "Elsa ML", "Elsa Quickstep", "Teles PCMCIA", "ITK ix1-micro Rev.2",
151 "Elsa PCMCIA", "Eicon.Diehl Diva", "ISDNLink", "TeleInt", "Teles 16.3c",
152 "Sedlbauer Speed Card", "USR Sportster", "ith mic Linux", "Elsa PCI",
153 "Compaq ISA", "NETjet", "Teles PCI", "Sedlbauer Speed Star (PCMCIA)",
154 "AMD 7930", "NICCY", "S0Box", "AVM A1 (PCMCIA)", "AVM Fritz PnP/PCI",
155 "Sedlbauer Speed Fax +"
158 #ifdef CONFIG_HISAX_ELSA
159 #define DEFAULT_CARD ISDN_CTYPE_ELSA
160 #define DEFAULT_CFG {0,0,0,0}
161 int elsa_init_pcmcia(void*, int, int*, int);
162 EXPORT_SYMBOL(elsa_init_pcmcia
);
164 #ifdef CONFIG_HISAX_AVM_A1
167 #define DEFAULT_CARD ISDN_CTYPE_A1
168 #define DEFAULT_CFG {10,0x340,0,0}
171 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
174 #define DEFAULT_CARD ISDN_CTYPE_A1_PCMCIA
175 #define DEFAULT_CFG {11,0x170,0,0}
176 int avm_a1_init_pcmcia(void*, int, int*, int);
177 EXPORT_SYMBOL(avm_a1_init_pcmcia
);
180 #ifdef CONFIG_HISAX_FRITZPCI
183 #define DEFAULT_CARD ISDN_CTYPE_FRITZPCI
184 #define DEFAULT_CFG {0,0,0,0}
187 #ifdef CONFIG_HISAX_16_3
190 #define DEFAULT_CARD ISDN_CTYPE_16_3
191 #define DEFAULT_CFG {15,0x180,0,0}
193 #ifdef CONFIG_HISAX_S0BOX
196 #define DEFAULT_CARD ISDN_CTYPE_S0BOX
197 #define DEFAULT_CFG {7,0x378,0,0}
199 #ifdef CONFIG_HISAX_16_0
202 #define DEFAULT_CARD ISDN_CTYPE_16_0
203 #define DEFAULT_CFG {15,0xd0000,0xd80,0}
206 #ifdef CONFIG_HISAX_TELESPCI
209 #define DEFAULT_CARD ISDN_CTYPE_TELESPCI
210 #define DEFAULT_CFG {0,0,0,0}
213 #ifdef CONFIG_HISAX_IX1MICROR2
216 #define DEFAULT_CARD ISDN_CTYPE_IX1MICROR2
217 #define DEFAULT_CFG {5,0x390,0,0}
220 #ifdef CONFIG_HISAX_DIEHLDIVA
223 #define DEFAULT_CARD ISDN_CTYPE_DIEHLDIVA
224 #define DEFAULT_CFG {0,0x0,0,0}
227 #ifdef CONFIG_HISAX_ASUSCOM
230 #define DEFAULT_CARD ISDN_CTYPE_ASUSCOM
231 #define DEFAULT_CFG {5,0x200,0,0}
234 #ifdef CONFIG_HISAX_TELEINT
237 #define DEFAULT_CARD ISDN_CTYPE_TELEINT
238 #define DEFAULT_CFG {5,0x300,0,0}
241 #ifdef CONFIG_HISAX_SEDLBAUER
244 #define DEFAULT_CARD ISDN_CTYPE_SEDLBAUER
245 #define DEFAULT_CFG {11,0x270,0,0}
246 int sedl_init_pcmcia(void*, int, int*, int);
247 EXPORT_SYMBOL(sedl_init_pcmcia
);
250 #ifdef CONFIG_HISAX_SPORTSTER
253 #define DEFAULT_CARD ISDN_CTYPE_SPORTSTER
254 #define DEFAULT_CFG {7,0x268,0,0}
257 #ifdef CONFIG_HISAX_MIC
260 #define DEFAULT_CARD ISDN_CTYPE_MIC
261 #define DEFAULT_CFG {12,0x3e0,0,0}
264 #ifdef CONFIG_HISAX_NETJET
267 #define DEFAULT_CARD ISDN_CTYPE_NETJET
268 #define DEFAULT_CFG {0,0,0,0}
271 #ifdef CONFIG_HISAX_TELES3C
274 #define DEFAULT_CARD ISDN_CTYPE_TELES3C
275 #define DEFAULT_CFG {5,0x500,0,0}
278 #ifdef CONFIG_HISAX_AMD7930
281 #define DEFAULT_CARD ISDN_CTYPE_AMD7930
282 #define DEFAULT_CFG {12,0x3e0,0,0}
285 #ifdef CONFIG_HISAX_NICCY
288 #define DEFAULT_CARD ISDN_CTYPE_NICCY
289 #define DEFAULT_CFG {0,0x0,0,0}
292 #ifdef CONFIG_HISAX_1TR6
293 #define DEFAULT_PROTO ISDN_PTYPE_1TR6
294 #define DEFAULT_PROTO_NAME "1TR6"
296 #ifdef CONFIG_HISAX_EURO
298 #define DEFAULT_PROTO ISDN_PTYPE_EURO
299 #undef DEFAULT_PROTO_NAME
300 #define DEFAULT_PROTO_NAME "EURO"
302 #ifdef CONFIG_HISAX_NI1
304 #define DEFAULT_PROTO ISDN_PTYPE_NI1
305 #undef DEFAULT_PROTO_NAME
306 #define DEFAULT_PROTO_NAME "NI1"
308 #ifndef DEFAULT_PROTO
309 #define DEFAULT_PROTO ISDN_PTYPE_UNKNOWN
310 #define DEFAULT_PROTO_NAME "UNKNOWN"
313 #error "HiSax: No cards configured"
316 #define FIRST_CARD { \
323 #define EMPTY_CARD {0, DEFAULT_PROTO, {0, 0, 0, 0}, NULL}
325 struct IsdnCard cards
[] =
337 static char HiSaxID
[64] HISAX_INITDATA
= "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
338 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" \
339 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
340 char *HiSax_id HISAX_INITDATA
= HiSaxID
;
342 /* Variables for insmod */
343 static int type
[] HISAX_INITDATA
=
344 {0, 0, 0, 0, 0, 0, 0, 0};
345 static int protocol
[] HISAX_INITDATA
=
346 {0, 0, 0, 0, 0, 0, 0, 0};
347 static int io
[] HISAX_INITDATA
=
348 {0, 0, 0, 0, 0, 0, 0, 0};
350 #ifdef CONFIG_HISAX_16_3
353 #ifdef CONFIG_HISAX_NICCY
358 static int io0
[] HISAX_INITDATA
=
359 {0, 0, 0, 0, 0, 0, 0, 0};
360 static int io1
[] HISAX_INITDATA
=
361 {0, 0, 0, 0, 0, 0, 0, 0};
363 static int irq
[] HISAX_INITDATA
=
364 {0, 0, 0, 0, 0, 0, 0, 0};
365 static int mem
[] HISAX_INITDATA
=
366 {0, 0, 0, 0, 0, 0, 0, 0};
367 static char *id HISAX_INITDATA
= HiSaxID
;
369 MODULE_AUTHOR("Karsten Keil");
370 MODULE_PARM(type
, "1-8i");
371 MODULE_PARM(protocol
, "1-8i");
372 MODULE_PARM(io
, "1-8i");
373 MODULE_PARM(irq
, "1-8i");
374 MODULE_PARM(mem
, "1-8i");
375 MODULE_PARM(id
, "s");
376 #ifdef CONFIG_HISAX_16_3 /* For Creatix/Teles PnP */
377 MODULE_PARM(io0
, "1-8i");
378 MODULE_PARM(io1
, "1-8i");
379 #endif /* CONFIG_HISAX_16_3 */
385 extern char *l1_revision
;
386 extern char *l2_revision
;
387 extern char *l3_revision
;
388 extern char *lli_revision
;
389 extern char *tei_revision
;
391 HISAX_INITFUNC(char *
392 HiSax_getrev(const char *revision
))
397 if ((p
= strchr(revision
, ':'))) {
399 p
= strchr(rev
, '$');
411 printk(KERN_INFO
"HiSax: Linux Driver for passive ISDN cards\n");
413 printk(KERN_INFO
"HiSax: Version 3.1a (module)\n");
415 printk(KERN_INFO
"HiSax: Version 3.1a (kernel)\n");
417 strcpy(tmp
, l1_revision
);
418 printk(KERN_INFO
"HiSax: Layer1 Revision %s\n", HiSax_getrev(tmp
));
419 strcpy(tmp
, l2_revision
);
420 printk(KERN_INFO
"HiSax: Layer2 Revision %s\n", HiSax_getrev(tmp
));
421 strcpy(tmp
, tei_revision
);
422 printk(KERN_INFO
"HiSax: TeiMgr Revision %s\n", HiSax_getrev(tmp
));
423 strcpy(tmp
, l3_revision
);
424 printk(KERN_INFO
"HiSax: Layer3 Revision %s\n", HiSax_getrev(tmp
));
425 strcpy(tmp
, lli_revision
);
426 printk(KERN_INFO
"HiSax: LinkLayer Revision %s\n", HiSax_getrev(tmp
));
427 certification_check(1);
431 HiSax_mod_dec_use_count(void)
437 HiSax_mod_inc_use_count(void)
443 #define HiSax_init init_module
446 HiSax_setup(char *str
, int *ints
)
453 while (argc
&& (i
< HISAX_MAX_CARDS
)) {
455 cards
[i
].typ
= ints
[j
];
460 cards
[i
].protocol
= ints
[j
];
465 cards
[i
].para
[0] = ints
[j
];
470 cards
[i
].para
[1] = ints
[j
];
475 cards
[i
].para
[2] = ints
[j
];
482 strcpy(HiSaxID
, str
);
485 strcpy(HiSaxID
, "HiSax");
492 extern int setup_teles0(struct IsdnCard
*card
);
496 extern int setup_teles3(struct IsdnCard
*card
);
500 extern int setup_s0box(struct IsdnCard
*card
);
504 extern int setup_telespci(struct IsdnCard
*card
);
508 extern int setup_avm_a1(struct IsdnCard
*card
);
511 #if CARD_AVM_A1_PCMCIA
512 extern int setup_avm_a1_pcmcia(struct IsdnCard
*card
);
516 extern int setup_avm_pcipnp(struct IsdnCard
*card
);
520 extern int setup_elsa(struct IsdnCard
*card
);
524 extern int setup_ix1micro(struct IsdnCard
*card
);
528 extern int setup_diva(struct IsdnCard
*card
);
532 extern int setup_asuscom(struct IsdnCard
*card
);
536 extern int setup_TeleInt(struct IsdnCard
*card
);
540 extern int setup_sedlbauer(struct IsdnCard
*card
);
544 extern int setup_sportster(struct IsdnCard
*card
);
548 extern int setup_mic(struct IsdnCard
*card
);
552 extern int setup_netjet(struct IsdnCard
*card
);
556 extern int setup_t163c(struct IsdnCard
*card
);
560 extern int setup_amd7930(struct IsdnCard
*card
);
564 extern int setup_niccy(struct IsdnCard
*card
);
568 * Find card with given driverId
570 static inline struct IsdnCardState
571 *hisax_findcard(int driverid
)
575 for (i
= 0; i
< nrcards
; i
++)
577 if (cards
[i
].cs
->myid
== driverid
)
578 return (cards
[i
].cs
);
583 HiSax_readstatus(u_char
* buf
, int len
, int user
, int id
, int channel
)
587 struct IsdnCardState
*cs
= hisax_findcard(id
);
590 if (len
> HISAX_STATUS_BUFSIZE
) {
591 printk(KERN_WARNING
"HiSax: status overflow readstat %d/%d\n",
592 len
, HISAX_STATUS_BUFSIZE
);
594 count
= cs
->status_end
- cs
->status_read
+1;
598 copy_to_user(p
, cs
->status_read
, count
);
600 memcpy(p
, cs
->status_read
, count
);
601 cs
->status_read
+= count
;
602 if (cs
->status_read
> cs
->status_end
)
603 cs
->status_read
= cs
->status_buf
;
607 if (count
> HISAX_STATUS_BUFSIZE
)
608 cnt
= HISAX_STATUS_BUFSIZE
;
612 copy_to_user(p
, cs
->status_read
, cnt
);
614 memcpy(p
, cs
->status_read
, cnt
);
616 cs
->status_read
+= cnt
% HISAX_STATUS_BUFSIZE
;
622 "HiSax: if_readstatus called with invalid driverId!\n");
628 jiftime(char *s
, long mark
)
633 *s
-- = mark
% 10 + '0';
635 *s
-- = mark
% 10 + '0';
638 *s
-- = mark
% 10 + '0';
640 *s
-- = mark
% 6 + '0';
643 *s
-- = mark
% 10 + '0';
645 *s
-- = mark
% 10 + '0';
649 static u_char tmpbuf
[HISAX_STATUS_BUFSIZE
];
652 VHiSax_putstatus(struct IsdnCardState
*cs
, char *head
, char *fmt
, va_list args
)
654 /* if head == NULL the fmt contains the full info */
666 p
+= jiftime(p
, jiffies
);
667 p
+= sprintf(p
, " %s", head
);
668 p
+= vsprintf(p
, fmt
, args
);
678 printk(KERN_WARNING
"HiSax: No CardStatus for message %s", p
);
679 restore_flags(flags
);
682 if (len
> HISAX_STATUS_BUFSIZE
) {
683 printk(KERN_WARNING
"HiSax: status overflow %d/%d\n",
684 len
, HISAX_STATUS_BUFSIZE
);
685 restore_flags(flags
);
689 i
= cs
->status_end
- cs
->status_write
+1;
693 memcpy(cs
->status_write
, p
, i
);
694 cs
->status_write
+= i
;
695 if (cs
->status_write
> cs
->status_end
)
696 cs
->status_write
= cs
->status_buf
;
699 memcpy(cs
->status_write
, p
, len
);
700 cs
->status_write
+= len
;
702 #ifdef KERNELSTACK_DEBUG
703 i
= (ulong
)&len
- current
->kernel_stack_page
;
704 sprintf(tmpbuf
, "kstack %s %lx use %ld\n", current
->comm
,
705 current
->kernel_stack_page
, i
);
706 len
= strlen(tmpbuf
);
707 for (p
= tmpbuf
, i
= len
; i
> 0; i
--, p
++) {
708 *cs
->status_write
++ = *p
;
709 if (cs
->status_write
> cs
->status_end
)
710 cs
->status_write
= cs
->status_buf
;
714 restore_flags(flags
);
716 ic
.command
= ISDN_STAT_STAVAIL
;
717 ic
.driver
= cs
->myid
;
719 cs
->iif
.statcallb(&ic
);
724 HiSax_putstatus(struct IsdnCardState
*cs
, char *head
, char *fmt
, ...)
729 VHiSax_putstatus(cs
, head
, fmt
, args
);
734 ll_run(struct IsdnCardState
*cs
)
741 ic
.driver
= cs
->myid
;
742 ic
.command
= ISDN_STAT_RUN
;
743 cs
->iif
.statcallb(&ic
);
744 restore_flags(flags
);
749 ll_stop(struct IsdnCardState
*cs
)
753 ic
.command
= ISDN_STAT_STOP
;
754 ic
.driver
= cs
->myid
;
755 cs
->iif
.statcallb(&ic
);
760 ll_unload(struct IsdnCardState
*cs
)
764 ic
.command
= ISDN_STAT_UNLOAD
;
765 ic
.driver
= cs
->myid
;
766 cs
->iif
.statcallb(&ic
);
768 kfree(cs
->status_buf
);
769 cs
->status_read
= NULL
;
770 cs
->status_write
= NULL
;
771 cs
->status_end
= NULL
;
776 closecard(int cardnr
)
778 struct IsdnCardState
*csta
= cards
[cardnr
].cs
;
780 if (csta
->bcs
->BC_Close
!= NULL
) {
781 csta
->bcs
->BC_Close(csta
->bcs
+ 1);
782 csta
->bcs
->BC_Close(csta
->bcs
);
789 discard_queue(&csta
->rq
);
790 discard_queue(&csta
->sq
);
792 dev_kfree_skb(csta
->tx_skb
);
803 csta
->cardmsg(csta
, CARD_RELEASE
, NULL
);
804 if (csta
->dbusytimer
.function
!= NULL
)
805 del_timer(&csta
->dbusytimer
);
809 HISAX_INITFUNC(static int init_card(struct IsdnCardState
*cs
))
811 int irq_cnt
, cnt
= 3;
816 irq_cnt
= kstat_irqs(cs
->irq
);
817 printk(KERN_INFO
"%s: IRQ %d count %d\n", CardType
[cs
->typ
], cs
->irq
,
819 if (cs
->cardmsg(cs
, CARD_SETIRQ
, NULL
)) {
820 printk(KERN_WARNING
"HiSax: couldn't get interrupt %d\n",
822 restore_flags(flags
);
826 cs
->cardmsg(cs
, CARD_INIT
, NULL
);
828 current
->state
= TASK_INTERRUPTIBLE
;
830 schedule_timeout((10 * HZ
) / 1000);
831 restore_flags(flags
);
832 printk(KERN_INFO
"%s: IRQ %d count %d\n", CardType
[cs
->typ
],
833 cs
->irq
, kstat_irqs(cs
->irq
));
834 if (kstat_irqs(cs
->irq
) == irq_cnt
) {
836 "%s: IRQ(%d) getting no interrupts during init %d\n",
837 CardType
[cs
->typ
], cs
->irq
, 4 - cnt
);
839 free_irq(cs
->irq
, cs
);
842 cs
->cardmsg(cs
, CARD_RESET
, NULL
);
846 cs
->cardmsg(cs
, CARD_TEST
, NULL
);
850 restore_flags(flags
);
854 HISAX_INITFUNC(static int
855 checkcard(int cardnr
, char *id
, int *busy_flag
))
859 struct IsdnCard
*card
= cards
+ cardnr
;
860 struct IsdnCardState
*cs
;
864 if (!(cs
= (struct IsdnCardState
*)
865 kmalloc(sizeof(struct IsdnCardState
), GFP_ATOMIC
))) {
867 "HiSax: No memory for IsdnCardState(card %d)\n",
869 restore_flags(flags
);
872 memset(cs
, 0, sizeof(struct IsdnCardState
));
875 cs
->debug
= L1_DEB_WARN
;
877 cs
->busy_flag
= busy_flag
;
880 test_and_set_bit(FLG_TWO_DCHAN
, &cs
->HW_Flags
);
882 cs
->protocol
= card
->protocol
;
884 if ((card
->typ
> 0) && (card
->typ
< 31)) {
885 if (!((1 << card
->typ
) & SUPORTED_CARDS
)) {
887 "HiSax: Support for %s Card not selected\n",
888 CardType
[card
->typ
]);
889 restore_flags(flags
);
894 "HiSax: Card Type %d out of range\n",
896 restore_flags(flags
);
899 if (!(cs
->dlog
= kmalloc(MAX_DLOG_SPACE
, GFP_ATOMIC
))) {
901 "HiSax: No memory for dlog(card %d)\n",
903 restore_flags(flags
);
906 if (!(cs
->status_buf
= kmalloc(HISAX_STATUS_BUFSIZE
, GFP_ATOMIC
))) {
908 "HiSax: No memory for status_buf(card %d)\n",
911 restore_flags(flags
);
917 cs
->status_read
= cs
->status_buf
;
918 cs
->status_write
= cs
->status_buf
;
919 cs
->status_end
= cs
->status_buf
+ HISAX_STATUS_BUFSIZE
- 1;
921 strcpy(cs
->iif
.id
, id
);
922 cs
->iif
.channels
= 2;
923 cs
->iif
.maxbufsize
= MAX_DATA_SIZE
;
924 cs
->iif
.hl_hdrlen
= MAX_HEADER_LEN
;
926 ISDN_FEATURE_L2_X75I
|
927 ISDN_FEATURE_L2_HDLC
|
928 ISDN_FEATURE_L2_MODEM
|
929 ISDN_FEATURE_L2_TRANS
|
930 ISDN_FEATURE_L3_TRANS
|
931 #ifdef CONFIG_HISAX_1TR6
932 ISDN_FEATURE_P_1TR6
|
934 #ifdef CONFIG_HISAX_EURO
935 ISDN_FEATURE_P_EURO
|
937 #ifdef CONFIG_HISAX_NI1
942 cs
->iif
.command
= HiSax_command
;
943 cs
->iif
.writecmd
= NULL
;
944 cs
->iif
.writebuf_skb
= HiSax_writebuf_skb
;
945 cs
->iif
.readstat
= HiSax_readstatus
;
946 register_isdn(&cs
->iif
);
947 cs
->myid
= cs
->iif
.channels
;
949 "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr
+ 1,
950 (card
->protocol
== ISDN_PTYPE_1TR6
) ? "1TR6" :
951 (card
->protocol
== ISDN_PTYPE_EURO
) ? "EDSS1" :
952 (card
->protocol
== ISDN_PTYPE_LEASED
) ? "LEASED" :
953 (card
->protocol
== ISDN_PTYPE_NI1
) ? "NI1" :
954 "NONE", cs
->iif
.id
, cs
->myid
);
957 case ISDN_CTYPE_16_0
:
959 ret
= setup_teles0(card
);
963 case ISDN_CTYPE_16_3
:
965 case ISDN_CTYPE_TELESPCMCIA
:
966 case ISDN_CTYPE_COMPAQ_ISA
:
967 ret
= setup_teles3(card
);
971 case ISDN_CTYPE_S0BOX
:
972 ret
= setup_s0box(card
);
976 case ISDN_CTYPE_TELESPCI
:
977 ret
= setup_telespci(card
);
982 ret
= setup_avm_a1(card
);
985 #if CARD_AVM_A1_PCMCIA
986 case ISDN_CTYPE_A1_PCMCIA
:
987 ret
= setup_avm_a1_pcmcia(card
);
991 case ISDN_CTYPE_FRITZPCI
:
992 ret
= setup_avm_pcipnp(card
);
996 case ISDN_CTYPE_ELSA
:
997 case ISDN_CTYPE_ELSA_PNP
:
998 case ISDN_CTYPE_ELSA_PCMCIA
:
999 case ISDN_CTYPE_ELSA_PCI
:
1000 ret
= setup_elsa(card
);
1004 case ISDN_CTYPE_IX1MICROR2
:
1005 ret
= setup_ix1micro(card
);
1009 case ISDN_CTYPE_DIEHLDIVA
:
1010 ret
= setup_diva(card
);
1014 case ISDN_CTYPE_ASUSCOM
:
1015 ret
= setup_asuscom(card
);
1019 case ISDN_CTYPE_TELEINT
:
1020 ret
= setup_TeleInt(card
);
1024 case ISDN_CTYPE_SEDLBAUER
:
1025 case ISDN_CTYPE_SEDLBAUER_PCMCIA
:
1026 case ISDN_CTYPE_SEDLBAUER_FAX
:
1027 ret
= setup_sedlbauer(card
);
1031 case ISDN_CTYPE_SPORTSTER
:
1032 ret
= setup_sportster(card
);
1036 case ISDN_CTYPE_MIC
:
1037 ret
= setup_mic(card
);
1041 case ISDN_CTYPE_NETJET
:
1042 ret
= setup_netjet(card
);
1046 case ISDN_CTYPE_TELES3C
:
1047 ret
= setup_t163c(card
);
1051 case ISDN_CTYPE_NICCY
:
1052 ret
= setup_niccy(card
);
1056 case ISDN_CTYPE_AMD7930
:
1057 ret
= setup_amd7930(card
);
1061 printk(KERN_WARNING
"HiSax: Unknown Card Typ %d\n",
1064 restore_flags(flags
);
1069 restore_flags(flags
);
1072 if (!(cs
->rcvbuf
= kmalloc(MAX_DFRAME_LEN_L1
, GFP_ATOMIC
))) {
1074 "HiSax: No memory for isac rcvbuf\n");
1081 cs
->tqueue
.next
= 0;
1082 cs
->tqueue
.sync
= 0;
1083 cs
->tqueue
.data
= cs
;
1085 skb_queue_head_init(&cs
->rq
);
1086 skb_queue_head_init(&cs
->sq
);
1088 init_bcstate(cs
, 0);
1089 init_bcstate(cs
, 1);
1090 ret
= init_card(cs
);
1093 restore_flags(flags
);
1096 init_tei(cs
, cs
->protocol
);
1098 /* ISAR needs firmware download first */
1099 if (!test_bit(HW_ISAR
, &cs
->HW_Flags
))
1101 restore_flags(flags
);
1106 HiSax_shiftcards(int idx
))
1110 for (i
= idx
; i
< (HISAX_MAX_CARDS
- 1); i
++)
1111 memcpy(&cards
[i
], &cards
[i
+ 1], sizeof(cards
[i
]));
1115 HiSax_inithardware(int *busy_flag
))
1122 char *next_id
= HiSax_id
;
1125 if (strchr(HiSax_id
, ','))
1127 else if (strchr(HiSax_id
, '%'))
1130 while (i
< nrcards
) {
1131 if (cards
[i
].typ
< 1)
1134 if ((next_id
= strchr(id
, t
))) {
1143 sprintf(ids
, "%s%d", id
, i
);
1145 if (checkcard(i
, ids
, busy_flag
)) {
1149 printk(KERN_WARNING
"HiSax: Card %s not installed !\n",
1150 CardType
[cards
[i
].typ
]);
1152 kfree((void *) cards
[i
].cs
);
1154 HiSax_shiftcards(i
);
1161 HiSax_closecard(int cardnr
)
1163 int i
,last
=nrcards
- 1;
1167 if (cards
[cardnr
].cs
) {
1168 ll_stop(cards
[cardnr
].cs
);
1169 release_tei(cards
[cardnr
].cs
);
1171 free_irq(cards
[cardnr
].cs
->irq
, cards
[cardnr
].cs
);
1172 kfree((void *) cards
[cardnr
].cs
);
1173 cards
[cardnr
].cs
= NULL
;
1177 cards
[i
] = cards
[i
+1];
1183 EXPORT_SYMBOL(HiSax_closecard
);
1186 HiSax_reportcard(int cardnr
)
1188 struct IsdnCardState
*cs
= cards
[cardnr
].cs
;
1189 struct PStack
*stptr
;
1190 struct l3_process
*pc
;
1193 printk(KERN_DEBUG
"HiSax: reportcard No %d\n", cardnr
+ 1);
1194 printk(KERN_DEBUG
"HiSax: Type %s\n", CardType
[cs
->typ
]);
1195 printk(KERN_DEBUG
"HiSax: debuglevel %x\n", cs
->debug
);
1196 printk(KERN_DEBUG
"HiSax: HiSax_reportcard address 0x%lX\n",
1197 (ulong
) & HiSax_reportcard
);
1198 printk(KERN_DEBUG
"HiSax: cs 0x%lX\n", (ulong
) cs
);
1199 printk(KERN_DEBUG
"HiSax: HW_Flags %x bc0 flg %x bc0 flg %x\n",
1200 cs
->HW_Flags
, cs
->bcs
[0].Flag
, cs
->bcs
[1].Flag
);
1201 printk(KERN_DEBUG
"HiSax: bcs 0 mode %d ch%d\n",
1202 cs
->bcs
[0].mode
, cs
->bcs
[0].channel
);
1203 printk(KERN_DEBUG
"HiSax: bcs 1 mode %d ch%d\n",
1204 cs
->bcs
[1].mode
, cs
->bcs
[1].channel
);
1205 printk(KERN_DEBUG
"HiSax: cs stl 0x%lX\n", (ulong
) & (cs
->stlist
));
1207 while (stptr
!= NULL
) {
1208 printk(KERN_DEBUG
"HiSax: dst%d 0x%lX\n", i
, (ulong
) stptr
);
1209 printk(KERN_DEBUG
"HiSax: dst%d stp 0x%lX\n", i
, (ulong
) stptr
->l1
.stlistp
);
1210 printk(KERN_DEBUG
"HiSax: tei %d sapi %d\n",
1211 stptr
->l2
.tei
, stptr
->l2
.sap
);
1212 printk(KERN_DEBUG
"HiSax: man 0x%lX\n", (ulong
) stptr
->ma
.layer
);
1213 pc
= stptr
->l3
.proc
;
1215 printk(KERN_DEBUG
"HiSax: l3proc %x 0x%lX\n", pc
->callref
,
1217 printk(KERN_DEBUG
"HiSax: state %d st 0x%lX chan 0x%lX\n",
1218 pc
->state
, (ulong
) pc
->st
, (ulong
) pc
->chan
);
1221 stptr
= stptr
->next
;
1224 for (j
= 0; j
< 2; j
++) {
1225 printk(KERN_DEBUG
"HiSax: ch%d 0x%lX\n", j
,
1226 (ulong
) & cs
->channel
[j
]);
1227 stptr
= cs
->channel
[j
].b_st
;
1229 while (stptr
!= NULL
) {
1230 printk(KERN_DEBUG
"HiSax: b_st%d 0x%lX\n", i
, (ulong
) stptr
);
1231 printk(KERN_DEBUG
"HiSax: man 0x%lX\n", (ulong
) stptr
->ma
.layer
);
1232 stptr
= stptr
->next
;
1246 #ifdef CONFIG_HISAX_ELSA
1247 if (type
[0] == ISDN_CTYPE_ELSA_PCMCIA
) {
1248 /* we have exported and return in this case */
1252 #ifdef CONFIG_HISAX_SEDLBAUER
1253 if (type
[0] == ISDN_CTYPE_SEDLBAUER_PCMCIA
) {
1254 /* we have to export and return in this case */
1258 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
1259 if (type
[0] == ISDN_CTYPE_A1_PCMCIA
) {
1260 /* we have to export and return in this case */
1268 if (id
) /* If id= string used */
1270 for (i
= 0; i
< HISAX_MAX_CARDS
; i
++) {
1271 cards
[i
].typ
= type
[i
];
1273 cards
[i
].protocol
= protocol
[i
];
1277 case ISDN_CTYPE_16_0
:
1278 cards
[i
].para
[0] = irq
[i
];
1279 cards
[i
].para
[1] = mem
[i
];
1280 cards
[i
].para
[2] = io
[i
];
1283 case ISDN_CTYPE_8_0
:
1284 cards
[i
].para
[0] = irq
[i
];
1285 cards
[i
].para
[1] = mem
[i
];
1289 case ISDN_CTYPE_PNP
:
1290 case ISDN_CTYPE_NICCY
:
1291 cards
[i
].para
[0] = irq
[i
];
1292 cards
[i
].para
[1] = io0
[i
];
1293 cards
[i
].para
[2] = io1
[i
];
1295 case ISDN_CTYPE_COMPAQ_ISA
:
1296 cards
[i
].para
[0] = irq
[i
];
1297 cards
[i
].para
[1] = io0
[i
];
1298 cards
[i
].para
[2] = io1
[i
];
1299 cards
[i
].para
[3] = io
[i
];
1302 case ISDN_CTYPE_ELSA
:
1303 cards
[i
].para
[0] = io
[i
];
1305 case ISDN_CTYPE_16_3
:
1306 case ISDN_CTYPE_TELESPCMCIA
:
1308 case ISDN_CTYPE_A1_PCMCIA
:
1309 case ISDN_CTYPE_ELSA_PNP
:
1310 case ISDN_CTYPE_ELSA_PCMCIA
:
1311 case ISDN_CTYPE_IX1MICROR2
:
1312 case ISDN_CTYPE_DIEHLDIVA
:
1313 case ISDN_CTYPE_ASUSCOM
:
1314 case ISDN_CTYPE_TELEINT
:
1315 case ISDN_CTYPE_SEDLBAUER
:
1316 case ISDN_CTYPE_SEDLBAUER_PCMCIA
:
1317 case ISDN_CTYPE_SEDLBAUER_FAX
:
1318 case ISDN_CTYPE_SPORTSTER
:
1319 case ISDN_CTYPE_MIC
:
1320 case ISDN_CTYPE_TELES3C
:
1321 case ISDN_CTYPE_S0BOX
:
1322 case ISDN_CTYPE_FRITZPCI
:
1323 cards
[i
].para
[0] = irq
[i
];
1324 cards
[i
].para
[1] = io
[i
];
1326 case ISDN_CTYPE_ELSA_PCI
:
1327 case ISDN_CTYPE_NETJET
:
1328 case ISDN_CTYPE_AMD7930
:
1329 case ISDN_CTYPE_TELESPCI
:
1334 printk(KERN_WARNING
"HiSax: Warning - no protocol specified\n");
1335 printk(KERN_WARNING
"HiSax: Note! module load syntax has changed.\n");
1336 printk(KERN_WARNING
"HiSax: using protocol %s\n", DEFAULT_PROTO_NAME
);
1342 strcpy(HiSaxID
, "HiSax");
1343 for (i
= 0; i
< HISAX_MAX_CARDS
; i
++)
1344 if (cards
[i
].typ
> 0)
1346 printk(KERN_DEBUG
"HiSax: Total %d card%s defined\n",
1347 nrcards
, (nrcards
> 1) ? "s" : "");
1354 if (HiSax_inithardware(NULL
)) {
1355 /* Install only, if at least one card found */
1356 /* No symbols to export, hide all symbols */
1359 printk(KERN_INFO
"HiSax: module installed\n");
1374 cleanup_module(void)
1376 int cardnr
= nrcards
-1;
1382 HiSax_closecard(cardnr
--);
1388 restore_flags(flags
);
1389 printk(KERN_INFO
"HiSax module removed\n");
1393 #ifdef CONFIG_HISAX_ELSA
1394 int elsa_init_pcmcia(void *pcm_iob
, int pcm_irq
, int *busy_flag
, int prot
)
1402 if (id
) /* If id= string used */
1404 /* Initialize all 8 structs, even though we only accept
1407 for (i
= 0; i
< HISAX_MAX_CARDS
; i
++) {
1408 cards
[i
].para
[0] = irq
[i
];
1409 cards
[i
].para
[1] = io
[i
];
1410 cards
[i
].typ
= type
[i
];
1412 cards
[i
].protocol
= protocol
[i
];
1416 cards
[0].para
[0] = pcm_irq
;
1417 cards
[0].para
[1] = (int)pcm_iob
;
1418 cards
[0].protocol
= prot
;
1425 strcpy(HiSaxID
, "HiSax");
1426 for (i
= 0; i
< HISAX_MAX_CARDS
; i
++)
1427 if (cards
[i
].typ
> 0)
1429 printk(KERN_DEBUG
"HiSax: Total %d card%s defined\n",
1430 nrcards
, (nrcards
> 1) ? "s" : "");
1437 HiSax_inithardware(busy_flag
);
1438 printk(KERN_NOTICE
"HiSax: module installed\n");
1444 #ifdef CONFIG_HISAX_SEDLBAUER
1445 int sedl_init_pcmcia(void *pcm_iob
, int pcm_irq
, int *busy_flag
, int prot
)
1453 if (id
) /* If id= string used */
1455 /* Initialize all 8 structs, even though we only accept
1458 for (i
= 0; i
< HISAX_MAX_CARDS
; i
++) {
1459 cards
[i
].para
[0] = irq
[i
];
1460 cards
[i
].para
[1] = io
[i
];
1461 cards
[i
].typ
= type
[i
];
1463 cards
[i
].protocol
= protocol
[i
];
1467 cards
[0].para
[0] = pcm_irq
;
1468 cards
[0].para
[1] = (int)pcm_iob
;
1469 cards
[0].protocol
= prot
;
1470 cards
[0].typ
= ISDN_CTYPE_SEDLBAUER_PCMCIA
;
1476 strcpy(HiSaxID
, "HiSax");
1477 for (i
= 0; i
< HISAX_MAX_CARDS
; i
++)
1478 if (cards
[i
].typ
> 0)
1480 printk(KERN_DEBUG
"HiSax: Total %d card%s defined\n",
1481 nrcards
, (nrcards
> 1) ? "s" : "");
1488 HiSax_inithardware(busy_flag
);
1489 printk(KERN_NOTICE
"HiSax: module installed\n");
1495 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
1496 int avm_a1_init_pcmcia(void *pcm_iob
, int pcm_irq
, int *busy_flag
, int prot
)
1504 if (id
) /* If id= string used */
1506 /* Initialize all 16 structs, even though we only accept
1509 for (i
= 0; i
< 16; i
++) {
1510 cards
[i
].para
[0] = irq
[i
];
1511 cards
[i
].para
[1] = io
[i
];
1512 cards
[i
].typ
= type
[i
];
1514 cards
[i
].protocol
= protocol
[i
];
1518 cards
[0].para
[0] = pcm_irq
;
1519 cards
[0].para
[1] = (int)pcm_iob
;
1520 cards
[0].protocol
= prot
;
1521 cards
[0].typ
= ISDN_CTYPE_A1_PCMCIA
;
1527 strcpy(HiSaxID
, "HiSax");
1528 for (i
= 0; i
< HISAX_MAX_CARDS
; i
++)
1529 if (cards
[i
].typ
> 0)
1531 printk(KERN_DEBUG
"HiSax: Total %d card%s defined\n",
1532 nrcards
, (nrcards
> 1) ? "s" : "");
1539 HiSax_inithardware(busy_flag
);
1540 printk(KERN_NOTICE
"HiSax: module installed\n");