1 /* $Id: config.c,v 2.84.2.5 2004/02/11 13:21:33 keil Exp $
4 * Copyright by Karsten Keil <keil@isdn4linux.de>
5 * by Kai Germaschewski <kai.germaschewski@gmx.de>
7 * This software may be used and distributed according to the terms
8 * of the GNU General Public License, incorporated herein by reference.
10 * For changes and modifications please read
11 * Documentation/isdn/HiSax.cert
13 * based on the teles driver from Jan den Ouden
17 #include <linux/types.h>
18 #include <linux/stddef.h>
19 #include <linux/timer.h>
20 #include <linux/config.h>
21 #include <linux/init.h>
23 #include <linux/module.h>
24 #include <linux/kernel_stat.h>
25 #include <linux/workqueue.h>
26 #include <linux/interrupt.h>
27 #define HISAX_STATUS_BUFSIZE 4096
28 #define INCLUDE_INLINE_FUNCS
31 * This structure array contains one entry per card. An entry looks
34 * { type, protocol, p0, p1, p2, NULL }
37 * 1 Teles 16.0 p0=irq p1=membase p2=iobase
38 * 2 Teles 8.0 p0=irq p1=membase
39 * 3 Teles 16.3 p0=irq p1=iobase
40 * 4 Creatix PNP p0=irq p1=IO0 (ISAC) p2=IO1 (HSCX)
41 * 5 AVM A1 (Fritz) p0=irq p1=iobase
42 * 6 ELSA PC [p0=iobase] or nothing (autodetect)
43 * 7 ELSA Quickstep p0=irq p1=iobase
44 * 8 Teles PCMCIA p0=irq p1=iobase
45 * 9 ITK ix1-micro p0=irq p1=iobase
46 * 10 ELSA PCMCIA p0=irq p1=iobase
47 * 11 Eicon.Diehl Diva p0=irq p1=iobase
48 * 12 Asuscom ISDNLink p0=irq p1=iobase
49 * 13 Teleint p0=irq p1=iobase
50 * 14 Teles 16.3c p0=irq p1=iobase
51 * 15 Sedlbauer speed p0=irq p1=iobase
52 * 15 Sedlbauer PC/104 p0=irq p1=iobase
53 * 15 Sedlbauer speed pci no parameter
54 * 16 USR Sportster internal p0=irq p1=iobase
55 * 17 MIC card p0=irq p1=iobase
56 * 18 ELSA Quickstep 1000PCI no parameter
57 * 19 Compaq ISDN S0 ISA card p0=irq p1=IO0 (HSCX) p2=IO1 (ISAC) p3=IO2
58 * 20 Travers Technologies NETjet-S PCI card
59 * 21 TELES PCI no parameter
60 * 22 Sedlbauer Speed Star p0=irq p1=iobase
62 * 24 Dr Neuhaus Niccy PnP/PCI card p0=irq p1=IO0 p2=IO1 (PnP only)
63 * 25 Teles S0Box p0=irq p1=iobase (from isapnp setup)
64 * 26 AVM A1 PCMCIA (Fritz) p0=irq p1=iobase
65 * 27 AVM PnP/PCI p0=irq p1=iobase (PCI no parameter)
66 * 28 Sedlbauer Speed Fax+ p0=irq p1=iobase (from isapnp setup)
67 * 29 Siemens I-Surf p0=irq p1=iobase p2=memory (from isapnp setup)
68 * 30 ACER P10 p0=irq p1=iobase (from isapnp setup)
69 * 31 HST Saphir p0=irq p1=iobase
71 * 33 Scitel Quadro p0=subcontroller (4*S0, subctrl 1...4)
73 * 35 HFC 2BDS0 PCI none
74 * 36 Winbond 6692 PCI none
75 * 37 HFC 2BDS0 S+/SP p0=irq p1=iobase
76 * 38 Travers Technologies NETspider-U PCI card
77 * 39 HFC 2BDS0-SP PCMCIA p0=irq p1=iobase
78 * 40 hotplug interface
79 * 41 Formula-n enter:now ISDN PCI a/b none
81 * protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6 or ISDN_PTYPE_NI1
86 const char *CardType[] = {
87 "No Card", "Teles 16.0", "Teles 8.0", "Teles 16.3",
88 "Creatix/Teles PnP", "AVM A1", "Elsa ML", "Elsa Quickstep",
89 "Teles PCMCIA", "ITK ix1-micro Rev.2", "Elsa PCMCIA",
90 "Eicon.Diehl Diva", "ISDNLink", "TeleInt", "Teles 16.3c",
91 "Sedlbauer Speed Card", "USR Sportster", "ith mic Linux",
92 "Elsa PCI", "Compaq ISA", "NETjet-S", "Teles PCI",
93 "Sedlbauer Speed Star (PCMCIA)", "AMD 7930", "NICCY", "S0Box",
94 "AVM A1 (PCMCIA)", "AVM Fritz PnP/PCI", "Sedlbauer Speed Fax +",
95 "Siemens I-Surf", "Acer P10", "HST Saphir", "Telekom A4T",
96 "Scitel Quadro", "Gazel", "HFC 2BDS0 PCI", "Winbond 6692",
97 "HFC 2BDS0 SX", "NETspider-U", "HFC-2BDS0-SP PCMCIA",
98 "Hotplug", "Formula-n enter:now PCI a/b",
101 #ifdef CONFIG_HISAX_ELSA
102 #define DEFAULT_CARD ISDN_CTYPE_ELSA
103 #define DEFAULT_CFG {0,0,0,0}
106 #ifdef CONFIG_HISAX_AVM_A1
109 #define DEFAULT_CARD ISDN_CTYPE_A1
110 #define DEFAULT_CFG {10,0x340,0,0}
113 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
116 #define DEFAULT_CARD ISDN_CTYPE_A1_PCMCIA
117 #define DEFAULT_CFG {11,0x170,0,0}
120 #ifdef CONFIG_HISAX_FRITZPCI
123 #define DEFAULT_CARD ISDN_CTYPE_FRITZPCI
124 #define DEFAULT_CFG {0,0,0,0}
127 #ifdef CONFIG_HISAX_16_3
130 #define DEFAULT_CARD ISDN_CTYPE_16_3
131 #define DEFAULT_CFG {15,0x180,0,0}
134 #ifdef CONFIG_HISAX_S0BOX
137 #define DEFAULT_CARD ISDN_CTYPE_S0BOX
138 #define DEFAULT_CFG {7,0x378,0,0}
141 #ifdef CONFIG_HISAX_16_0
144 #define DEFAULT_CARD ISDN_CTYPE_16_0
145 #define DEFAULT_CFG {15,0xd0000,0xd80,0}
148 #ifdef CONFIG_HISAX_TELESPCI
151 #define DEFAULT_CARD ISDN_CTYPE_TELESPCI
152 #define DEFAULT_CFG {0,0,0,0}
155 #ifdef CONFIG_HISAX_IX1MICROR2
158 #define DEFAULT_CARD ISDN_CTYPE_IX1MICROR2
159 #define DEFAULT_CFG {5,0x390,0,0}
162 #ifdef CONFIG_HISAX_DIEHLDIVA
165 #define DEFAULT_CARD ISDN_CTYPE_DIEHLDIVA
166 #define DEFAULT_CFG {0,0x0,0,0}
169 #ifdef CONFIG_HISAX_ASUSCOM
172 #define DEFAULT_CARD ISDN_CTYPE_ASUSCOM
173 #define DEFAULT_CFG {5,0x200,0,0}
176 #ifdef CONFIG_HISAX_TELEINT
179 #define DEFAULT_CARD ISDN_CTYPE_TELEINT
180 #define DEFAULT_CFG {5,0x300,0,0}
183 #ifdef CONFIG_HISAX_SEDLBAUER
186 #define DEFAULT_CARD ISDN_CTYPE_SEDLBAUER
187 #define DEFAULT_CFG {11,0x270,0,0}
190 #ifdef CONFIG_HISAX_SPORTSTER
193 #define DEFAULT_CARD ISDN_CTYPE_SPORTSTER
194 #define DEFAULT_CFG {7,0x268,0,0}
197 #ifdef CONFIG_HISAX_MIC
200 #define DEFAULT_CARD ISDN_CTYPE_MIC
201 #define DEFAULT_CFG {12,0x3e0,0,0}
204 #ifdef CONFIG_HISAX_NETJET
207 #define DEFAULT_CARD ISDN_CTYPE_NETJET_S
208 #define DEFAULT_CFG {0,0,0,0}
211 #ifdef CONFIG_HISAX_HFCS
214 #define DEFAULT_CARD ISDN_CTYPE_TELES3C
215 #define DEFAULT_CFG {5,0x500,0,0}
218 #ifdef CONFIG_HISAX_HFC_PCI
221 #define DEFAULT_CARD ISDN_CTYPE_HFC_PCI
222 #define DEFAULT_CFG {0,0,0,0}
225 #ifdef CONFIG_HISAX_HFC_SX
228 #define DEFAULT_CARD ISDN_CTYPE_HFC_SX
229 #define DEFAULT_CFG {5,0x2E0,0,0}
233 #ifdef CONFIG_HISAX_AMD7930
236 #define DEFAULT_CARD ISDN_CTYPE_AMD7930
237 #define DEFAULT_CFG {12,0x3e0,0,0}
240 #ifdef CONFIG_HISAX_NICCY
243 #define DEFAULT_CARD ISDN_CTYPE_NICCY
244 #define DEFAULT_CFG {0,0x0,0,0}
247 #ifdef CONFIG_HISAX_ISURF
250 #define DEFAULT_CARD ISDN_CTYPE_ISURF
251 #define DEFAULT_CFG {5,0x100,0xc8000,0}
254 #ifdef CONFIG_HISAX_HSTSAPHIR
257 #define DEFAULT_CARD ISDN_CTYPE_HSTSAPHIR
258 #define DEFAULT_CFG {5,0x250,0,0}
261 #ifdef CONFIG_HISAX_BKM_A4T
264 #define DEFAULT_CARD ISDN_CTYPE_BKM_A4T
265 #define DEFAULT_CFG {0,0x0,0,0}
268 #ifdef CONFIG_HISAX_SCT_QUADRO
271 #define DEFAULT_CARD ISDN_CTYPE_SCT_QUADRO
272 #define DEFAULT_CFG {1,0x0,0,0}
275 #ifdef CONFIG_HISAX_GAZEL
278 #define DEFAULT_CARD ISDN_CTYPE_GAZEL
279 #define DEFAULT_CFG {15,0x180,0,0}
282 #ifdef CONFIG_HISAX_W6692
285 #define DEFAULT_CARD ISDN_CTYPE_W6692
286 #define DEFAULT_CFG {0,0,0,0}
289 #ifdef CONFIG_HISAX_NETJET_U
292 #define DEFAULT_CARD ISDN_CTYPE_NETJET_U
293 #define DEFAULT_CFG {0,0,0,0}
296 #ifdef CONFIG_HISAX_1TR6
297 #define DEFAULT_PROTO ISDN_PTYPE_1TR6
298 #define DEFAULT_PROTO_NAME "1TR6"
300 #ifdef CONFIG_HISAX_NI1
302 #define DEFAULT_PROTO ISDN_PTYPE_NI1
303 #undef DEFAULT_PROTO_NAME
304 #define DEFAULT_PROTO_NAME "NI1"
306 #ifdef CONFIG_HISAX_EURO
308 #define DEFAULT_PROTO ISDN_PTYPE_EURO
309 #undef DEFAULT_PROTO_NAME
310 #define DEFAULT_PROTO_NAME "EURO"
312 #ifndef DEFAULT_PROTO
313 #define DEFAULT_PROTO ISDN_PTYPE_UNKNOWN
314 #define DEFAULT_PROTO_NAME "UNKNOWN"
317 #define DEFAULT_CARD 0
318 #define DEFAULT_CFG {0,0,0,0}
321 #define FIRST_CARD { \
328 struct IsdnCard cards[HISAX_MAX_CARDS] = {
332 #define HISAX_IDSIZE (HISAX_MAX_CARDS*8)
333 static char HiSaxID[HISAX_IDSIZE] = { 0, };
335 char *HiSax_id = HiSaxID;
337 /* Variables for insmod */
338 static int type[HISAX_MAX_CARDS] = { 0, };
339 static int protocol[HISAX_MAX_CARDS] = { 0, };
340 static int io[HISAX_MAX_CARDS] = { 0, };
342 #ifdef CONFIG_HISAX_16_3
345 #ifdef CONFIG_HISAX_NICCY
350 static int io0[HISAX_MAX_CARDS] __devinitdata = { 0, };
351 static int io1[HISAX_MAX_CARDS] __devinitdata = { 0, };
353 static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, };
354 static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, };
355 static char *id = HiSaxID;
357 MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards");
358 MODULE_AUTHOR("Karsten Keil");
359 MODULE_LICENSE("GPL");
360 module_param_array(type, int, NULL, 0);
361 module_param_array(protocol, int, NULL, 0);
362 module_param_array(io, int, NULL, 0);
363 module_param_array(irq, int, NULL, 0);
364 module_param_array(mem, int, NULL, 0);
365 module_param(id, charp, 0);
367 module_param_array(io0, int, NULL, 0);
368 module_param_array(io1, int, NULL, 0);
374 extern char *l1_revision;
375 extern char *l2_revision;
376 extern char *l3_revision;
377 extern char *lli_revision;
378 extern char *tei_revision;
380 char *HiSax_getrev(const char *revision)
385 if ((p = strchr(revision, ':'))) {
387 p = strchr(rev, '$');
394 void __init HiSaxVersion(void)
398 printk(KERN_INFO "HiSax: Linux Driver for passive ISDN cards\n");
400 printk(KERN_INFO "HiSax: Version 3.5 (module)\n");
402 printk(KERN_INFO "HiSax: Version 3.5 (kernel)\n");
404 strcpy(tmp, l1_revision);
405 printk(KERN_INFO "HiSax: Layer1 Revision %s\n", HiSax_getrev(tmp));
406 strcpy(tmp, l2_revision);
407 printk(KERN_INFO "HiSax: Layer2 Revision %s\n", HiSax_getrev(tmp));
408 strcpy(tmp, tei_revision);
409 printk(KERN_INFO "HiSax: TeiMgr Revision %s\n", HiSax_getrev(tmp));
410 strcpy(tmp, l3_revision);
411 printk(KERN_INFO "HiSax: Layer3 Revision %s\n", HiSax_getrev(tmp));
412 strcpy(tmp, lli_revision);
413 printk(KERN_INFO "HiSax: LinkLayer Revision %s\n",
418 #define MAX_ARG (HISAX_MAX_CARDS*5)
419 static int __init HiSax_setup(char *line)
422 int ints[MAX_ARG + 1];
425 str = get_options(line, MAX_ARG, ints);
427 printk(KERN_DEBUG "HiSax_setup: argc(%d) str(%s)\n", argc, str);
430 while (argc && (i < HISAX_MAX_CARDS)) {
431 cards[i].protocol = DEFAULT_PROTO;
433 cards[i].typ = ints[j];
438 cards[i].protocol = ints[j];
443 cards[i].para[0] = ints[j];
448 cards[i].para[1] = ints[j];
453 cards[i].para[2] = ints[j];
460 if (strlen(str) < HISAX_IDSIZE)
461 strcpy(HiSaxID, str);
463 printk(KERN_WARNING "HiSax: ID too long!");
465 strcpy(HiSaxID, "HiSax");
471 __setup("hisax=", HiSax_setup);
475 extern int setup_teles0(struct IsdnCard *card);
479 extern int setup_teles3(struct IsdnCard *card);
483 extern int setup_s0box(struct IsdnCard *card);
487 extern int setup_telespci(struct IsdnCard *card);
491 extern int setup_avm_a1(struct IsdnCard *card);
494 #if CARD_AVM_A1_PCMCIA
495 extern int setup_avm_a1_pcmcia(struct IsdnCard *card);
499 extern int setup_avm_pcipnp(struct IsdnCard *card);
503 extern int setup_elsa(struct IsdnCard *card);
507 extern int setup_ix1micro(struct IsdnCard *card);
511 extern int setup_diva(struct IsdnCard *card);
515 extern int setup_asuscom(struct IsdnCard *card);
519 extern int setup_TeleInt(struct IsdnCard *card);
523 extern int setup_sedlbauer(struct IsdnCard *card);
527 extern int setup_sportster(struct IsdnCard *card);
531 extern int setup_mic(struct IsdnCard *card);
535 extern int setup_netjet_s(struct IsdnCard *card);
539 extern int setup_hfcs(struct IsdnCard *card);
543 extern int setup_hfcpci(struct IsdnCard *card);
547 extern int setup_hfcsx(struct IsdnCard *card);
551 extern int setup_amd7930(struct IsdnCard *card);
555 extern int setup_niccy(struct IsdnCard *card);
559 extern int setup_isurf(struct IsdnCard *card);
563 extern int setup_saphir(struct IsdnCard *card);
567 extern int setup_testemu(struct IsdnCard *card);
571 extern int setup_bkm_a4t(struct IsdnCard *card);
575 extern int setup_sct_quadro(struct IsdnCard *card);
579 extern int setup_gazel(struct IsdnCard *card);
583 extern int setup_w6692(struct IsdnCard *card);
587 extern int setup_netjet_u(struct IsdnCard *card);
590 #if CARD_FN_ENTERNOW_PCI
591 extern int setup_enternow_pci(struct IsdnCard *card);
595 * Find card with given driverId
597 static inline struct IsdnCardState *hisax_findcard(int driverid)
601 for (i = 0; i < nrcards; i++)
603 if (cards[i].cs->myid == driverid)
609 * Find card with given card number
611 struct IsdnCardState *hisax_get_card(int cardnr)
613 if ((cardnr <= nrcards) && (cardnr > 0))
614 if (cards[cardnr - 1].cs)
615 return cards[cardnr - 1].cs;
619 int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
622 u_char __user *p = buf;
623 struct IsdnCardState *cs = hisax_findcard(id);
626 if (len > HISAX_STATUS_BUFSIZE) {
628 "HiSax: status overflow readstat %d/%d\n",
629 len, HISAX_STATUS_BUFSIZE);
631 count = cs->status_end - cs->status_read + 1;
634 copy_to_user(p, cs->status_read, count);
635 cs->status_read += count;
636 if (cs->status_read > cs->status_end)
637 cs->status_read = cs->status_buf;
641 if (count > HISAX_STATUS_BUFSIZE)
642 cnt = HISAX_STATUS_BUFSIZE;
645 copy_to_user(p, cs->status_read, cnt);
647 cs->status_read += cnt % HISAX_STATUS_BUFSIZE;
653 "HiSax: if_readstatus called with invalid driverId!\n");
658 int jiftime(char *s, long mark)
663 *s-- = mark % 10 + '0';
665 *s-- = mark % 10 + '0';
668 *s-- = mark % 10 + '0';
670 *s-- = mark % 6 + '0';
673 *s-- = mark % 10 + '0';
675 *s-- = mark % 10 + '0';
679 static u_char tmpbuf[HISAX_STATUS_BUFSIZE];
681 void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt,
684 /* if head == NULL the fmt contains the full info */
693 printk(KERN_WARNING "HiSax: No CardStatus for message");
696 spin_lock_irqsave(&cs->statlock, flags);
699 p += jiftime(p, jiffies);
700 p += sprintf(p, " %s", head);
701 p += vsprintf(p, fmt, args);
710 if (len > HISAX_STATUS_BUFSIZE) {
711 spin_unlock_irqrestore(&cs->statlock, flags);
712 printk(KERN_WARNING "HiSax: status overflow %d/%d\n",
713 len, HISAX_STATUS_BUFSIZE);
717 i = cs->status_end - cs->status_write + 1;
721 memcpy(cs->status_write, p, i);
722 cs->status_write += i;
723 if (cs->status_write > cs->status_end)
724 cs->status_write = cs->status_buf;
727 memcpy(cs->status_write, p, len);
728 cs->status_write += len;
730 #ifdef KERNELSTACK_DEBUG
731 i = (ulong) & len - current->kernel_stack_page;
732 sprintf(tmpbuf, "kstack %s %lx use %ld\n", current->comm,
733 current->kernel_stack_page, i);
734 len = strlen(tmpbuf);
735 for (p = tmpbuf, i = len; i > 0; i--, p++) {
736 *cs->status_write++ = *p;
737 if (cs->status_write > cs->status_end)
738 cs->status_write = cs->status_buf;
742 spin_unlock_irqrestore(&cs->statlock, flags);
744 ic.command = ISDN_STAT_STAVAIL;
745 ic.driver = cs->myid;
747 cs->iif.statcallb(&ic);
751 void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...)
756 VHiSax_putstatus(cs, head, fmt, args);
760 int ll_run(struct IsdnCardState *cs, int addfeatures)
764 ic.driver = cs->myid;
765 ic.command = ISDN_STAT_RUN;
766 cs->iif.features |= addfeatures;
767 cs->iif.statcallb(&ic);
771 void ll_stop(struct IsdnCardState *cs)
775 ic.command = ISDN_STAT_STOP;
776 ic.driver = cs->myid;
777 cs->iif.statcallb(&ic);
778 // CallcFreeChan(cs);
781 static void ll_unload(struct IsdnCardState *cs)
785 ic.command = ISDN_STAT_UNLOAD;
786 ic.driver = cs->myid;
787 cs->iif.statcallb(&ic);
789 kfree(cs->status_buf);
790 cs->status_read = NULL;
791 cs->status_write = NULL;
792 cs->status_end = NULL;
797 static void closecard(int cardnr)
799 struct IsdnCardState *csta = cards[cardnr].cs;
801 if (csta->bcs->BC_Close != NULL) {
802 csta->bcs->BC_Close(csta->bcs + 1);
803 csta->bcs->BC_Close(csta->bcs);
806 skb_queue_purge(&csta->rq);
807 skb_queue_purge(&csta->sq);
813 dev_kfree_skb(csta->tx_skb);
816 if (csta->DC_Close != NULL) {
817 csta->DC_Close(csta);
820 csta->cardmsg(csta, CARD_RELEASE, NULL);
821 if (csta->dbusytimer.function != NULL) // FIXME?
822 del_timer(&csta->dbusytimer);
826 static int init_card(struct IsdnCardState *cs)
828 int irq_cnt, cnt = 3, ret;
831 ret = cs->cardmsg(cs, CARD_INIT, NULL);
834 irq_cnt = kstat_irqs(cs->irq);
835 printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
837 if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) {
838 printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n",
843 cs->cardmsg(cs, CARD_INIT, NULL);
846 printk(KERN_INFO "%s: IRQ %d count %d\n",
847 CardType[cs->typ], cs->irq, kstat_irqs(cs->irq));
848 if (kstat_irqs(cs->irq) == irq_cnt) {
850 "%s: IRQ(%d) getting no interrupts during init %d\n",
851 CardType[cs->typ], cs->irq, 4 - cnt);
853 free_irq(cs->irq, cs);
856 cs->cardmsg(cs, CARD_RESET, NULL);
860 cs->cardmsg(cs, CARD_TEST, NULL);
867 static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)
870 struct IsdnCard *card = cards + cardnr;
871 struct IsdnCardState *cs;
873 cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
876 "HiSax: No memory for IsdnCardState(card %d)\n",
880 memset(cs, 0, sizeof(struct IsdnCardState));
882 spin_lock_init(&cs->statlock);
883 spin_lock_init(&cs->lock);
884 cs->chanlimit = 2; /* maximum B-channel number */
885 cs->logecho = 0; /* No echo logging */
887 cs->debug = L1_DEB_WARN;
889 cs->busy_flag = busy_flag;
890 cs->irq_flags = I4L_IRQ_FLAG;
892 if (card->protocol == ISDN_PTYPE_NI1)
893 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
895 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
897 cs->protocol = card->protocol;
899 if (card->typ <= 0 || card->typ > ISDN_CTYPE_COUNT) {
901 "HiSax: Card Type %d out of range\n", card->typ);
904 if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
906 "HiSax: No memory for dlog(card %d)\n", cardnr + 1);
909 if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
911 "HiSax: No memory for status_buf(card %d)\n",
916 cs->status_read = cs->status_buf;
917 cs->status_write = cs->status_buf;
918 cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
921 cs->iif.owner = lockowner;
923 strcpy(cs->iif.id, id);
924 cs->iif.channels = 2;
925 cs->iif.maxbufsize = MAX_DATA_SIZE;
926 cs->iif.hl_hdrlen = MAX_HEADER_LEN;
928 ISDN_FEATURE_L2_X75I |
929 ISDN_FEATURE_L2_HDLC |
930 ISDN_FEATURE_L2_HDLC_56K |
931 ISDN_FEATURE_L2_TRANS |
932 ISDN_FEATURE_L3_TRANS |
933 #ifdef CONFIG_HISAX_1TR6
934 ISDN_FEATURE_P_1TR6 |
936 #ifdef CONFIG_HISAX_EURO
937 ISDN_FEATURE_P_EURO |
939 #ifdef CONFIG_HISAX_NI1
944 cs->iif.command = HiSax_command;
945 cs->iif.writecmd = NULL;
946 cs->iif.writebuf_skb = HiSax_writebuf_skb;
947 cs->iif.readstat = HiSax_readstatus;
948 register_isdn(&cs->iif);
949 cs->myid = cs->iif.channels;
951 "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
952 (card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
953 (card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
954 (card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
955 (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
956 "NONE", cs->iif.id, cs->myid);
959 case ISDN_CTYPE_16_0:
961 ret = setup_teles0(card);
965 case ISDN_CTYPE_16_3:
967 case ISDN_CTYPE_TELESPCMCIA:
968 case ISDN_CTYPE_COMPAQ_ISA:
969 ret = setup_teles3(card);
973 case ISDN_CTYPE_S0BOX:
974 ret = setup_s0box(card);
978 case ISDN_CTYPE_TELESPCI:
979 ret = setup_telespci(card);
984 ret = setup_avm_a1(card);
987 #if CARD_AVM_A1_PCMCIA
988 case ISDN_CTYPE_A1_PCMCIA:
989 ret = setup_avm_a1_pcmcia(card);
993 case ISDN_CTYPE_FRITZPCI:
994 ret = setup_avm_pcipnp(card);
998 case ISDN_CTYPE_ELSA:
999 case ISDN_CTYPE_ELSA_PNP:
1000 case ISDN_CTYPE_ELSA_PCMCIA:
1001 case ISDN_CTYPE_ELSA_PCI:
1002 ret = setup_elsa(card);
1006 case ISDN_CTYPE_IX1MICROR2:
1007 ret = setup_ix1micro(card);
1011 case ISDN_CTYPE_DIEHLDIVA:
1012 ret = setup_diva(card);
1016 case ISDN_CTYPE_ASUSCOM:
1017 ret = setup_asuscom(card);
1021 case ISDN_CTYPE_TELEINT:
1022 ret = setup_TeleInt(card);
1026 case ISDN_CTYPE_SEDLBAUER:
1027 case ISDN_CTYPE_SEDLBAUER_PCMCIA:
1028 case ISDN_CTYPE_SEDLBAUER_FAX:
1029 ret = setup_sedlbauer(card);
1033 case ISDN_CTYPE_SPORTSTER:
1034 ret = setup_sportster(card);
1038 case ISDN_CTYPE_MIC:
1039 ret = setup_mic(card);
1043 case ISDN_CTYPE_NETJET_S:
1044 ret = setup_netjet_s(card);
1048 case ISDN_CTYPE_TELES3C:
1049 case ISDN_CTYPE_ACERP10:
1050 ret = setup_hfcs(card);
1054 case ISDN_CTYPE_HFC_PCI:
1055 ret = setup_hfcpci(card);
1059 case ISDN_CTYPE_HFC_SX:
1060 ret = setup_hfcsx(card);
1064 case ISDN_CTYPE_NICCY:
1065 ret = setup_niccy(card);
1069 case ISDN_CTYPE_AMD7930:
1070 ret = setup_amd7930(card);
1074 case ISDN_CTYPE_ISURF:
1075 ret = setup_isurf(card);
1079 case ISDN_CTYPE_HSTSAPHIR:
1080 ret = setup_saphir(card);
1084 case ISDN_CTYPE_TESTEMU:
1085 ret = setup_testemu(card);
1089 case ISDN_CTYPE_BKM_A4T:
1090 ret = setup_bkm_a4t(card);
1094 case ISDN_CTYPE_SCT_QUADRO:
1095 ret = setup_sct_quadro(card);
1099 case ISDN_CTYPE_GAZEL:
1100 ret = setup_gazel(card);
1104 case ISDN_CTYPE_W6692:
1105 ret = setup_w6692(card);
1109 case ISDN_CTYPE_NETJET_U:
1110 ret = setup_netjet_u(card);
1113 #if CARD_FN_ENTERNOW_PCI
1114 case ISDN_CTYPE_ENTERNOW:
1115 ret = setup_enternow_pci(card);
1118 case ISDN_CTYPE_DYNAMIC:
1123 "HiSax: Support for %s Card not selected\n",
1124 CardType[card->typ]);
1132 if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
1133 printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n");
1141 cs->tqueue.data = cs;
1143 skb_queue_head_init(&cs->rq);
1144 skb_queue_head_init(&cs->sq);
1146 init_bcstate(cs, 0);
1147 init_bcstate(cs, 1);
1149 /* init_card only handles interrupts which are not */
1150 /* used here for the loadable driver */
1151 switch (card->typ) {
1152 case ISDN_CTYPE_DYNAMIC:
1156 ret = init_card(cs);
1164 init_tei(cs, cs->protocol);
1165 ret = CallcNewChan(cs);
1171 /* ISAR needs firmware download first */
1172 if (!test_bit(HW_ISAR, &cs->HW_Flags))
1187 void HiSax_shiftcards(int idx)
1191 for (i = idx; i < (HISAX_MAX_CARDS - 1); i++)
1192 memcpy(&cards[i], &cards[i + 1], sizeof(cards[i]));
1195 int HiSax_inithardware(int *busy_flag)
1202 char *next_id = HiSax_id;
1205 if (strchr(HiSax_id, ','))
1207 else if (strchr(HiSax_id, '%'))
1210 while (i < nrcards) {
1211 if (cards[i].typ < 1)
1214 if ((next_id = strchr(id, t))) {
1223 sprintf(ids, "%s%d", id, i);
1225 if (checkcard(i, ids, busy_flag, THIS_MODULE)) {
1229 /* make sure we don't oops the module */
1230 if (cards[i].typ > 0 && cards[i].typ <= ISDN_CTYPE_COUNT) {
1232 "HiSax: Card %s not installed !\n",
1233 CardType[cards[i].typ]);
1235 HiSax_shiftcards(i);
1242 void HiSax_closecard(int cardnr)
1244 int i, last = nrcards - 1;
1246 if (cardnr > last || cardnr < 0)
1248 if (cards[cardnr].cs) {
1249 ll_stop(cards[cardnr].cs);
1250 release_tei(cards[cardnr].cs);
1251 CallcFreeChan(cards[cardnr].cs);
1254 if (cards[cardnr].cs->irq)
1255 free_irq(cards[cardnr].cs->irq, cards[cardnr].cs);
1256 kfree((void *) cards[cardnr].cs);
1257 cards[cardnr].cs = NULL;
1261 cards[i] = cards[i + 1];
1267 void HiSax_reportcard(int cardnr, int sel)
1269 struct IsdnCardState *cs = cards[cardnr].cs;
1271 printk(KERN_DEBUG "HiSax: reportcard No %d\n", cardnr + 1);
1272 printk(KERN_DEBUG "HiSax: Type %s\n", CardType[cs->typ]);
1273 printk(KERN_DEBUG "HiSax: debuglevel %x\n", cs->debug);
1274 printk(KERN_DEBUG "HiSax: HiSax_reportcard address 0x%lX\n",
1275 (ulong) & HiSax_reportcard);
1276 printk(KERN_DEBUG "HiSax: cs 0x%lX\n", (ulong) cs);
1277 printk(KERN_DEBUG "HiSax: HW_Flags %lx bc0 flg %lx bc1 flg %lx\n",
1278 cs->HW_Flags, cs->bcs[0].Flag, cs->bcs[1].Flag);
1279 printk(KERN_DEBUG "HiSax: bcs 0 mode %d ch%d\n",
1280 cs->bcs[0].mode, cs->bcs[0].channel);
1281 printk(KERN_DEBUG "HiSax: bcs 1 mode %d ch%d\n",
1282 cs->bcs[1].mode, cs->bcs[1].channel);
1283 #ifdef ERROR_STATISTIC
1284 printk(KERN_DEBUG "HiSax: dc errors(rx,crc,tx) %d,%d,%d\n",
1285 cs->err_rx, cs->err_crc, cs->err_tx);
1287 "HiSax: bc0 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n",
1288 cs->bcs[0].err_inv, cs->bcs[0].err_rdo, cs->bcs[0].err_crc,
1291 "HiSax: bc1 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n",
1292 cs->bcs[1].err_inv, cs->bcs[1].err_rdo, cs->bcs[1].err_crc,
1298 cs->bcs[0].err_inv = 0;
1299 cs->bcs[0].err_rdo = 0;
1300 cs->bcs[0].err_crc = 0;
1301 cs->bcs[0].err_tx = 0;
1302 cs->bcs[1].err_inv = 0;
1303 cs->bcs[1].err_rdo = 0;
1304 cs->bcs[1].err_crc = 0;
1305 cs->bcs[1].err_tx = 0;
1310 static int __init HiSax_init(void)
1319 retval = CallcNew();
1322 retval = Isdnl3New();
1325 retval = Isdnl2New();
1331 retval = Isdnl1New();
1337 /* We 'll register drivers later, but init basic functions */
1338 for (i = 0; i < HISAX_MAX_CARDS; i++)
1342 #ifdef CONFIG_HISAX_ELSA
1343 if (type[0] == ISDN_CTYPE_ELSA_PCMCIA) {
1344 /* we have exported and return in this case */
1348 #ifdef CONFIG_HISAX_SEDLBAUER
1349 if (type[0] == ISDN_CTYPE_SEDLBAUER_PCMCIA) {
1350 /* we have to export and return in this case */
1354 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
1355 if (type[0] == ISDN_CTYPE_A1_PCMCIA) {
1356 /* we have to export and return in this case */
1360 #ifdef CONFIG_HISAX_HFC_SX
1361 if (type[0] == ISDN_CTYPE_HFC_SP_PCMCIA) {
1362 /* we have to export and return in this case */
1369 if (id) /* If id= string used */
1371 for (i = j = 0; j < HISAX_MAX_CARDS; i++) {
1372 cards[j].typ = type[i];
1374 cards[j].protocol = protocol[i];
1377 cards[j].protocol = DEFAULT_PROTO;
1380 case ISDN_CTYPE_16_0:
1381 cards[j].para[0] = irq[i];
1382 cards[j].para[1] = mem[i];
1383 cards[j].para[2] = io[i];
1386 case ISDN_CTYPE_8_0:
1387 cards[j].para[0] = irq[i];
1388 cards[j].para[1] = mem[i];
1392 case ISDN_CTYPE_PNP:
1393 case ISDN_CTYPE_NICCY:
1394 cards[j].para[0] = irq[i];
1395 cards[j].para[1] = io0[i];
1396 cards[j].para[2] = io1[i];
1398 case ISDN_CTYPE_COMPAQ_ISA:
1399 cards[j].para[0] = irq[i];
1400 cards[j].para[1] = io0[i];
1401 cards[j].para[2] = io1[i];
1402 cards[j].para[3] = io[i];
1405 case ISDN_CTYPE_ELSA:
1406 case ISDN_CTYPE_HFC_PCI:
1407 cards[j].para[0] = io[i];
1409 case ISDN_CTYPE_16_3:
1410 case ISDN_CTYPE_TELESPCMCIA:
1412 case ISDN_CTYPE_A1_PCMCIA:
1413 case ISDN_CTYPE_ELSA_PNP:
1414 case ISDN_CTYPE_ELSA_PCMCIA:
1415 case ISDN_CTYPE_IX1MICROR2:
1416 case ISDN_CTYPE_DIEHLDIVA:
1417 case ISDN_CTYPE_ASUSCOM:
1418 case ISDN_CTYPE_TELEINT:
1419 case ISDN_CTYPE_SEDLBAUER:
1420 case ISDN_CTYPE_SEDLBAUER_PCMCIA:
1421 case ISDN_CTYPE_SEDLBAUER_FAX:
1422 case ISDN_CTYPE_SPORTSTER:
1423 case ISDN_CTYPE_MIC:
1424 case ISDN_CTYPE_TELES3C:
1425 case ISDN_CTYPE_ACERP10:
1426 case ISDN_CTYPE_S0BOX:
1427 case ISDN_CTYPE_FRITZPCI:
1428 case ISDN_CTYPE_HSTSAPHIR:
1429 case ISDN_CTYPE_GAZEL:
1430 case ISDN_CTYPE_HFC_SX:
1431 case ISDN_CTYPE_HFC_SP_PCMCIA:
1432 cards[j].para[0] = irq[i];
1433 cards[j].para[1] = io[i];
1435 case ISDN_CTYPE_ISURF:
1436 cards[j].para[0] = irq[i];
1437 cards[j].para[1] = io[i];
1438 cards[j].para[2] = mem[i];
1440 case ISDN_CTYPE_ELSA_PCI:
1441 case ISDN_CTYPE_NETJET_S:
1442 case ISDN_CTYPE_AMD7930:
1443 case ISDN_CTYPE_TELESPCI:
1444 case ISDN_CTYPE_W6692:
1445 case ISDN_CTYPE_NETJET_U:
1447 case ISDN_CTYPE_BKM_A4T:
1449 case ISDN_CTYPE_SCT_QUADRO:
1451 cards[j].para[0] = irq[i];
1453 /* QUADRO is a 4 BRI card */
1454 cards[j++].para[0] = 1;
1455 /* we need to check if further cards can be added */
1456 if (j < HISAX_MAX_CARDS) {
1457 cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
1458 cards[j].protocol = protocol[i];
1459 cards[j++].para[0] = 2;
1461 if (j < HISAX_MAX_CARDS) {
1462 cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
1463 cards[j].protocol = protocol[i];
1464 cards[j++].para[0] = 3;
1466 if (j < HISAX_MAX_CARDS) {
1467 cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
1468 cards[j].protocol = protocol[i];
1469 cards[j].para[0] = 4;
1478 "HiSax: Warning - no protocol specified\n");
1479 printk(KERN_WARNING "HiSax: using protocol %s\n",
1480 DEFAULT_PROTO_NAME);
1486 strcpy(HiSaxID, "HiSax");
1487 for (i = 0; i < HISAX_MAX_CARDS; i++)
1488 if (cards[i].typ > 0)
1490 printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
1491 nrcards, (nrcards > 1) ? "s" : "");
1493 /* Install only, if at least one card found */
1494 if (!HiSax_inithardware(NULL))
1510 static void __exit HiSax_exit(void)
1512 int cardnr = nrcards - 1;
1515 HiSax_closecard(cardnr--);
1521 printk(KERN_INFO "HiSax module removed\n");
1524 int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
1529 cards[nrcards] = *card;
1531 sprintf(ids, "HiSax%d", nrcards);
1533 sprintf(ids, "HiSax");
1534 if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE))
1543 EXPORT_SYMBOL(hisax_init_pcmcia);
1544 EXPORT_SYMBOL(HiSax_closecard);
1546 #include "hisax_if.h"
1548 EXPORT_SYMBOL(hisax_register);
1549 EXPORT_SYMBOL(hisax_unregister);
1551 static void hisax_d_l1l2(struct hisax_if *ifc, int pr, void *arg);
1552 static void hisax_b_l1l2(struct hisax_if *ifc, int pr, void *arg);
1553 static void hisax_d_l2l1(struct PStack *st, int pr, void *arg);
1554 static void hisax_b_l2l1(struct PStack *st, int pr, void *arg);
1555 static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg);
1556 static int hisax_bc_setstack(struct PStack *st, struct BCState *bcs);
1557 static void hisax_bc_close(struct BCState *bcs);
1558 static void hisax_bh(struct IsdnCardState *cs);
1559 static void EChannel_proc_rcv(struct hisax_d_if *d_if);
1561 int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
1562 char *name, int protocol)
1566 struct IsdnCardState *cs;
1568 for (i = 0; i < HISAX_MAX_CARDS; i++) {
1573 if (i >= HISAX_MAX_CARDS)
1576 cards[i].typ = ISDN_CTYPE_DYNAMIC;
1577 cards[i].protocol = protocol;
1578 sprintf(id, "%s%d", name, i);
1580 retval = checkcard(i, id, NULL, hisax_d_if->owner);
1581 if (retval == 0) { // yuck
1587 hisax_d_if->cs = cs;
1588 cs->hw.hisax_d_if = hisax_d_if;
1589 cs->cardmsg = hisax_cardmsg;
1590 INIT_WORK(&cs->tqueue, (void *)(void *)hisax_bh, cs);
1591 cs->channel[0].d_st->l2.l2l1 = hisax_d_l2l1;
1592 for (i = 0; i < 2; i++) {
1593 cs->bcs[i].BC_SetStack = hisax_bc_setstack;
1594 cs->bcs[i].BC_Close = hisax_bc_close;
1596 b_if[i]->ifc.l1l2 = hisax_b_l1l2;
1598 hisax_d_if->b_if[i] = b_if[i];
1600 hisax_d_if->ifc.l1l2 = hisax_d_l1l2;
1601 skb_queue_head_init(&hisax_d_if->erq);
1602 clear_bit(0, &hisax_d_if->ph_state);
1607 void hisax_unregister(struct hisax_d_if *hisax_d_if)
1609 cards[hisax_d_if->cs->cardnr].typ = 0;
1610 HiSax_closecard(hisax_d_if->cs->cardnr);
1611 skb_queue_purge(&hisax_d_if->erq);
1616 static void hisax_sched_event(struct IsdnCardState *cs, int event)
1618 test_and_set_bit(event, &cs->event);
1619 schedule_work(&cs->tqueue);
1622 static void hisax_bh(struct IsdnCardState *cs)
1627 if (test_and_clear_bit(D_RCVBUFREADY, &cs->event))
1628 DChannel_proc_rcv(cs);
1629 if (test_and_clear_bit(E_RCVBUFREADY, &cs->event))
1630 EChannel_proc_rcv(cs->hw.hisax_d_if);
1631 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
1632 if (test_bit(0, &cs->hw.hisax_d_if->ph_state))
1633 pr = PH_ACTIVATE | INDICATION;
1635 pr = PH_DEACTIVATE | INDICATION;
1636 for (st = cs->stlist; st; st = st->next)
1637 st->l1.l1l2(st, pr, NULL);
1642 static void hisax_b_sched_event(struct BCState *bcs, int event)
1644 test_and_set_bit(event, &bcs->event);
1645 schedule_work(&bcs->tqueue);
1648 static inline void D_L2L1(struct hisax_d_if *d_if, int pr, void *arg)
1650 struct hisax_if *ifc = (struct hisax_if *) d_if;
1651 ifc->l2l1(ifc, pr, arg);
1654 static inline void B_L2L1(struct hisax_b_if *b_if, int pr, void *arg)
1656 struct hisax_if *ifc = (struct hisax_if *) b_if;
1657 ifc->l2l1(ifc, pr, arg);
1660 static void hisax_d_l1l2(struct hisax_if *ifc, int pr, void *arg)
1662 struct hisax_d_if *d_if = (struct hisax_d_if *) ifc;
1663 struct IsdnCardState *cs = d_if->cs;
1665 struct sk_buff *skb;
1668 case PH_ACTIVATE | INDICATION:
1669 set_bit(0, &d_if->ph_state);
1670 hisax_sched_event(cs, D_L1STATECHANGE);
1672 case PH_DEACTIVATE | INDICATION:
1673 clear_bit(0, &d_if->ph_state);
1674 hisax_sched_event(cs, D_L1STATECHANGE);
1676 case PH_DATA | INDICATION:
1677 skb_queue_tail(&cs->rq, arg);
1678 hisax_sched_event(cs, D_RCVBUFREADY);
1680 case PH_DATA | CONFIRM:
1681 skb = skb_dequeue(&cs->sq);
1683 D_L2L1(d_if, PH_DATA | REQUEST, skb);
1686 clear_bit(FLG_L1_DBUSY, &cs->HW_Flags);
1687 for (st = cs->stlist; st; st = st->next) {
1688 if (test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags)) {
1689 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1694 case PH_DATA_E | INDICATION:
1695 skb_queue_tail(&d_if->erq, arg);
1696 hisax_sched_event(cs, E_RCVBUFREADY);
1699 printk("pr %#x\n", pr);
1704 static void hisax_b_l1l2(struct hisax_if *ifc, int pr, void *arg)
1706 struct hisax_b_if *b_if = (struct hisax_b_if *) ifc;
1707 struct BCState *bcs = b_if->bcs;
1708 struct PStack *st = bcs->st;
1709 struct sk_buff *skb;
1711 // FIXME use isdnl1?
1713 case PH_ACTIVATE | INDICATION:
1714 st->l1.l1l2(st, pr, NULL);
1716 case PH_DEACTIVATE | INDICATION:
1717 st->l1.l1l2(st, pr, NULL);
1718 clear_bit(BC_FLG_BUSY, &bcs->Flag);
1719 skb_queue_purge(&bcs->squeue);
1720 bcs->hw.b_if = NULL;
1722 case PH_DATA | INDICATION:
1723 skb_queue_tail(&bcs->rqueue, arg);
1724 hisax_b_sched_event(bcs, B_RCVBUFREADY);
1726 case PH_DATA | CONFIRM:
1727 bcs->tx_cnt -= (int) arg;
1728 if (test_bit(FLG_LLI_L1WAKEUP,&bcs->st->lli.flag)) {
1730 spin_lock_irqsave(&bcs->aclock, flags);
1731 bcs->ackcnt += (int) arg;
1732 spin_unlock_irqrestore(&bcs->aclock, flags);
1733 schedule_event(bcs, B_ACKPENDING);
1735 skb = skb_dequeue(&bcs->squeue);
1737 B_L2L1(b_if, PH_DATA | REQUEST, skb);
1740 clear_bit(BC_FLG_BUSY, &bcs->Flag);
1741 if (test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags)) {
1742 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1746 printk("hisax_b_l1l2 pr %#x\n", pr);
1751 static void hisax_d_l2l1(struct PStack *st, int pr, void *arg)
1753 struct IsdnCardState *cs = st->l1.hardware;
1754 struct hisax_d_if *hisax_d_if = cs->hw.hisax_d_if;
1755 struct sk_buff *skb = arg;
1758 case PH_DATA | REQUEST:
1759 case PH_PULL | INDICATION:
1760 if (cs->debug & DEB_DLOG_HEX)
1761 LogFrame(cs, skb->data, skb->len);
1762 if (cs->debug & DEB_DLOG_VERBOSE)
1763 dlogframe(cs, skb, 0);
1764 Logl2Frame(cs, skb, "PH_DATA_REQ", 0);
1766 if (!test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags))
1767 D_L2L1(hisax_d_if, PH_DATA | REQUEST, skb);
1769 skb_queue_tail(&cs->sq, skb);
1771 case PH_PULL | REQUEST:
1772 if (!test_bit(FLG_L1_DBUSY, &cs->HW_Flags))
1773 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1775 set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
1778 D_L2L1(hisax_d_if, pr, arg);
1783 static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg)
1788 static void hisax_b_l2l1(struct PStack *st, int pr, void *arg)
1790 struct BCState *bcs = st->l1.bcs;
1791 struct hisax_b_if *b_if = bcs->hw.b_if;
1794 case PH_ACTIVATE | REQUEST:
1795 B_L2L1(b_if, pr, (void *) st->l1.mode);
1797 case PH_DATA | REQUEST:
1798 case PH_PULL | INDICATION:
1800 if (!test_and_set_bit(BC_FLG_BUSY, &bcs->Flag)) {
1801 B_L2L1(b_if, PH_DATA | REQUEST, arg);
1803 skb_queue_tail(&bcs->squeue, arg);
1806 case PH_PULL | REQUEST:
1807 if (!test_bit(BC_FLG_BUSY, &bcs->Flag))
1808 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1810 set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
1812 case PH_DEACTIVATE | REQUEST:
1813 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
1814 skb_queue_purge(&bcs->squeue);
1816 B_L2L1(b_if, pr, arg);
1821 static int hisax_bc_setstack(struct PStack *st, struct BCState *bcs)
1823 struct IsdnCardState *cs = st->l1.hardware;
1824 struct hisax_d_if *hisax_d_if = cs->hw.hisax_d_if;
1826 bcs->channel = st->l1.bc;
1828 bcs->hw.b_if = hisax_d_if->b_if[st->l1.bc];
1829 hisax_d_if->b_if[st->l1.bc]->bcs = bcs;
1832 st->l2.l2l1 = hisax_b_l2l1;
1833 setstack_manager(st);
1836 skb_queue_head_init(&bcs->rqueue);
1837 skb_queue_head_init(&bcs->squeue);
1841 static void hisax_bc_close(struct BCState *bcs)
1843 struct hisax_b_if *b_if = bcs->hw.b_if;
1846 B_L2L1(b_if, PH_DEACTIVATE | REQUEST, NULL);
1849 static void EChannel_proc_rcv(struct hisax_d_if *d_if)
1851 struct IsdnCardState *cs = d_if->cs;
1853 struct sk_buff *skb;
1855 while ((skb = skb_dequeue(&d_if->erq)) != NULL) {
1856 if (cs->debug & DEB_DLOG_HEX) {
1858 if ((skb->len) < MAX_DLOG_SPACE / 3 - 10) {
1864 ptr += QuickHex(ptr, skb->data, skb->len);
1868 HiSax_putstatus(cs, NULL, cs->dlog);
1870 HiSax_putstatus(cs, "LogEcho: ",
1871 "warning Frame too big (%d)",
1874 dev_kfree_skb_any(skb);
1879 #include <linux/pci.h>
1881 static struct pci_device_id hisax_pci_tbl[] __initdata = {
1882 #ifdef CONFIG_HISAX_FRITZPCI
1883 {PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID},
1885 #ifdef CONFIG_HISAX_DIEHLDIVA
1886 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20, PCI_ANY_ID, PCI_ANY_ID},
1887 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20_U, PCI_ANY_ID, PCI_ANY_ID},
1888 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA201, PCI_ANY_ID, PCI_ANY_ID},
1889 //#########################################################################################
1890 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA202, PCI_ANY_ID, PCI_ANY_ID},
1891 //#########################################################################################
1893 #ifdef CONFIG_HISAX_ELSA
1894 {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_MICROLINK, PCI_ANY_ID, PCI_ANY_ID},
1895 {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_QS3000, PCI_ANY_ID, PCI_ANY_ID},
1897 #ifdef CONFIG_HISAX_GAZEL
1898 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R685, PCI_ANY_ID, PCI_ANY_ID},
1899 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, PCI_ANY_ID, PCI_ANY_ID},
1900 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, PCI_ANY_ID, PCI_ANY_ID},
1902 #ifdef CONFIG_HISAX_QUADRO
1903 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_ANY_ID, PCI_ANY_ID},
1905 #ifdef CONFIG_HISAX_NICCY
1906 {PCI_VENDOR_ID_SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY, PCI_ANY_ID,PCI_ANY_ID},
1908 #ifdef CONFIG_HISAX_SEDLBAUER
1909 {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, PCI_ANY_ID,PCI_ANY_ID},
1911 #if defined(CONFIG_HISAX_NETJET) || defined(CONFIG_HISAX_NETJET_U)
1912 {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, PCI_ANY_ID,PCI_ANY_ID},
1914 #if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO)
1915 {PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, PCI_ANY_ID,PCI_ANY_ID},
1917 #ifdef CONFIG_HISAX_W6692
1918 {PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, PCI_ANY_ID,PCI_ANY_ID},
1919 {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, PCI_ANY_ID,PCI_ANY_ID},
1921 #ifdef CONFIG_HISAX_HFC_PCI
1922 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, PCI_ANY_ID, PCI_ANY_ID},
1923 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, PCI_ANY_ID, PCI_ANY_ID},
1924 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, PCI_ANY_ID, PCI_ANY_ID},
1925 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, PCI_ANY_ID, PCI_ANY_ID},
1926 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, PCI_ANY_ID, PCI_ANY_ID},
1927 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, PCI_ANY_ID, PCI_ANY_ID},
1928 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, PCI_ANY_ID, PCI_ANY_ID},
1929 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, PCI_ANY_ID, PCI_ANY_ID},
1930 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, PCI_ANY_ID, PCI_ANY_ID},
1931 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, PCI_ANY_ID, PCI_ANY_ID},
1932 {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, PCI_ANY_ID, PCI_ANY_ID},
1933 {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, PCI_ANY_ID, PCI_ANY_ID},
1934 {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, PCI_ANY_ID, PCI_ANY_ID},
1935 {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, PCI_ANY_ID, PCI_ANY_ID},
1936 {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, PCI_ANY_ID, PCI_ANY_ID},
1937 {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, PCI_ANY_ID, PCI_ANY_ID},
1938 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E, PCI_ANY_ID, PCI_ANY_ID},
1939 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E, PCI_ANY_ID, PCI_ANY_ID},
1940 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A, PCI_ANY_ID, PCI_ANY_ID},
1941 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A, PCI_ANY_ID, PCI_ANY_ID},
1943 { } /* Terminating entry */
1946 MODULE_DEVICE_TABLE(pci, hisax_pci_tbl);
1947 #endif /* CONFIG_PCI */
1949 module_init(HiSax_init);
1950 module_exit(HiSax_exit);
1952 EXPORT_SYMBOL(FsmNew);
1953 EXPORT_SYMBOL(FsmFree);
1954 EXPORT_SYMBOL(FsmEvent);
1955 EXPORT_SYMBOL(FsmChangeState);
1956 EXPORT_SYMBOL(FsmInitTimer);
1957 EXPORT_SYMBOL(FsmDelTimer);
1958 EXPORT_SYMBOL(FsmRestartTimer);