[PATCH] Represent laptop_mode as jiffies internally
[linux-2.6/verdex.git] / drivers / isdn / hisax / config.c
blob27332506f9f7911ba105c9a4d9e1b7e1423a022f
1 /* $Id: config.c,v 2.84.2.5 2004/02/11 13:21:33 keil Exp $
3 * Author Karsten Keil
4 * Copyright by Karsten Keil <keil@isdn4linux.de>
5 * by Kai Germaschewski <kai.germaschewski@gmx.de>
6 *
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>
22 #include "hisax.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
30 * This structure array contains one entry per card. An entry looks
31 * like this:
33 * { type, protocol, p0, p1, p2, NULL }
35 * type
36 * 1 Teles 16.0 p0=irq p1=membase p2=iobase
37 * 2 Teles 8.0 p0=irq p1=membase
38 * 3 Teles 16.3 p0=irq p1=iobase
39 * 4 Creatix PNP p0=irq p1=IO0 (ISAC) p2=IO1 (HSCX)
40 * 5 AVM A1 (Fritz) p0=irq p1=iobase
41 * 6 ELSA PC [p0=iobase] or nothing (autodetect)
42 * 7 ELSA Quickstep p0=irq p1=iobase
43 * 8 Teles PCMCIA p0=irq p1=iobase
44 * 9 ITK ix1-micro p0=irq p1=iobase
45 * 10 ELSA PCMCIA p0=irq p1=iobase
46 * 11 Eicon.Diehl Diva p0=irq p1=iobase
47 * 12 Asuscom ISDNLink p0=irq p1=iobase
48 * 13 Teleint p0=irq p1=iobase
49 * 14 Teles 16.3c p0=irq p1=iobase
50 * 15 Sedlbauer speed p0=irq p1=iobase
51 * 15 Sedlbauer PC/104 p0=irq p1=iobase
52 * 15 Sedlbauer speed pci no parameter
53 * 16 USR Sportster internal p0=irq p1=iobase
54 * 17 MIC card p0=irq p1=iobase
55 * 18 ELSA Quickstep 1000PCI no parameter
56 * 19 Compaq ISDN S0 ISA card p0=irq p1=IO0 (HSCX) p2=IO1 (ISAC) p3=IO2
57 * 20 Travers Technologies NETjet-S PCI card
58 * 21 TELES PCI no parameter
59 * 22 Sedlbauer Speed Star p0=irq p1=iobase
60 * 23 reserved
61 * 24 Dr Neuhaus Niccy PnP/PCI card p0=irq p1=IO0 p2=IO1 (PnP only)
62 * 25 Teles S0Box p0=irq p1=iobase (from isapnp setup)
63 * 26 AVM A1 PCMCIA (Fritz) p0=irq p1=iobase
64 * 27 AVM PnP/PCI p0=irq p1=iobase (PCI no parameter)
65 * 28 Sedlbauer Speed Fax+ p0=irq p1=iobase (from isapnp setup)
66 * 29 Siemens I-Surf p0=irq p1=iobase p2=memory (from isapnp setup)
67 * 30 ACER P10 p0=irq p1=iobase (from isapnp setup)
68 * 31 HST Saphir p0=irq p1=iobase
69 * 32 Telekom A4T none
70 * 33 Scitel Quadro p0=subcontroller (4*S0, subctrl 1...4)
71 * 34 Gazel ISDN cards
72 * 35 HFC 2BDS0 PCI none
73 * 36 Winbond 6692 PCI none
74 * 37 HFC 2BDS0 S+/SP p0=irq p1=iobase
75 * 38 Travers Technologies NETspider-U PCI card
76 * 39 HFC 2BDS0-SP PCMCIA p0=irq p1=iobase
77 * 40 hotplug interface
78 * 41 Formula-n enter:now ISDN PCI a/b none
80 * protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6 or ISDN_PTYPE_NI1
85 const char *CardType[] = {
86 "No Card", "Teles 16.0", "Teles 8.0", "Teles 16.3",
87 "Creatix/Teles PnP", "AVM A1", "Elsa ML", "Elsa Quickstep",
88 "Teles PCMCIA", "ITK ix1-micro Rev.2", "Elsa PCMCIA",
89 "Eicon.Diehl Diva", "ISDNLink", "TeleInt", "Teles 16.3c",
90 "Sedlbauer Speed Card", "USR Sportster", "ith mic Linux",
91 "Elsa PCI", "Compaq ISA", "NETjet-S", "Teles PCI",
92 "Sedlbauer Speed Star (PCMCIA)", "AMD 7930", "NICCY", "S0Box",
93 "AVM A1 (PCMCIA)", "AVM Fritz PnP/PCI", "Sedlbauer Speed Fax +",
94 "Siemens I-Surf", "Acer P10", "HST Saphir", "Telekom A4T",
95 "Scitel Quadro", "Gazel", "HFC 2BDS0 PCI", "Winbond 6692",
96 "HFC 2BDS0 SX", "NETspider-U", "HFC-2BDS0-SP PCMCIA",
97 "Hotplug", "Formula-n enter:now PCI a/b",
100 #ifdef CONFIG_HISAX_ELSA
101 #define DEFAULT_CARD ISDN_CTYPE_ELSA
102 #define DEFAULT_CFG {0,0,0,0}
103 #endif
105 #ifdef CONFIG_HISAX_AVM_A1
106 #undef DEFAULT_CARD
107 #undef DEFAULT_CFG
108 #define DEFAULT_CARD ISDN_CTYPE_A1
109 #define DEFAULT_CFG {10,0x340,0,0}
110 #endif
112 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
113 #undef DEFAULT_CARD
114 #undef DEFAULT_CFG
115 #define DEFAULT_CARD ISDN_CTYPE_A1_PCMCIA
116 #define DEFAULT_CFG {11,0x170,0,0}
117 #endif
119 #ifdef CONFIG_HISAX_FRITZPCI
120 #undef DEFAULT_CARD
121 #undef DEFAULT_CFG
122 #define DEFAULT_CARD ISDN_CTYPE_FRITZPCI
123 #define DEFAULT_CFG {0,0,0,0}
124 #endif
126 #ifdef CONFIG_HISAX_16_3
127 #undef DEFAULT_CARD
128 #undef DEFAULT_CFG
129 #define DEFAULT_CARD ISDN_CTYPE_16_3
130 #define DEFAULT_CFG {15,0x180,0,0}
131 #endif
133 #ifdef CONFIG_HISAX_S0BOX
134 #undef DEFAULT_CARD
135 #undef DEFAULT_CFG
136 #define DEFAULT_CARD ISDN_CTYPE_S0BOX
137 #define DEFAULT_CFG {7,0x378,0,0}
138 #endif
140 #ifdef CONFIG_HISAX_16_0
141 #undef DEFAULT_CARD
142 #undef DEFAULT_CFG
143 #define DEFAULT_CARD ISDN_CTYPE_16_0
144 #define DEFAULT_CFG {15,0xd0000,0xd80,0}
145 #endif
147 #ifdef CONFIG_HISAX_TELESPCI
148 #undef DEFAULT_CARD
149 #undef DEFAULT_CFG
150 #define DEFAULT_CARD ISDN_CTYPE_TELESPCI
151 #define DEFAULT_CFG {0,0,0,0}
152 #endif
154 #ifdef CONFIG_HISAX_IX1MICROR2
155 #undef DEFAULT_CARD
156 #undef DEFAULT_CFG
157 #define DEFAULT_CARD ISDN_CTYPE_IX1MICROR2
158 #define DEFAULT_CFG {5,0x390,0,0}
159 #endif
161 #ifdef CONFIG_HISAX_DIEHLDIVA
162 #undef DEFAULT_CARD
163 #undef DEFAULT_CFG
164 #define DEFAULT_CARD ISDN_CTYPE_DIEHLDIVA
165 #define DEFAULT_CFG {0,0x0,0,0}
166 #endif
168 #ifdef CONFIG_HISAX_ASUSCOM
169 #undef DEFAULT_CARD
170 #undef DEFAULT_CFG
171 #define DEFAULT_CARD ISDN_CTYPE_ASUSCOM
172 #define DEFAULT_CFG {5,0x200,0,0}
173 #endif
175 #ifdef CONFIG_HISAX_TELEINT
176 #undef DEFAULT_CARD
177 #undef DEFAULT_CFG
178 #define DEFAULT_CARD ISDN_CTYPE_TELEINT
179 #define DEFAULT_CFG {5,0x300,0,0}
180 #endif
182 #ifdef CONFIG_HISAX_SEDLBAUER
183 #undef DEFAULT_CARD
184 #undef DEFAULT_CFG
185 #define DEFAULT_CARD ISDN_CTYPE_SEDLBAUER
186 #define DEFAULT_CFG {11,0x270,0,0}
187 #endif
189 #ifdef CONFIG_HISAX_SPORTSTER
190 #undef DEFAULT_CARD
191 #undef DEFAULT_CFG
192 #define DEFAULT_CARD ISDN_CTYPE_SPORTSTER
193 #define DEFAULT_CFG {7,0x268,0,0}
194 #endif
196 #ifdef CONFIG_HISAX_MIC
197 #undef DEFAULT_CARD
198 #undef DEFAULT_CFG
199 #define DEFAULT_CARD ISDN_CTYPE_MIC
200 #define DEFAULT_CFG {12,0x3e0,0,0}
201 #endif
203 #ifdef CONFIG_HISAX_NETJET
204 #undef DEFAULT_CARD
205 #undef DEFAULT_CFG
206 #define DEFAULT_CARD ISDN_CTYPE_NETJET_S
207 #define DEFAULT_CFG {0,0,0,0}
208 #endif
210 #ifdef CONFIG_HISAX_HFCS
211 #undef DEFAULT_CARD
212 #undef DEFAULT_CFG
213 #define DEFAULT_CARD ISDN_CTYPE_TELES3C
214 #define DEFAULT_CFG {5,0x500,0,0}
215 #endif
217 #ifdef CONFIG_HISAX_HFC_PCI
218 #undef DEFAULT_CARD
219 #undef DEFAULT_CFG
220 #define DEFAULT_CARD ISDN_CTYPE_HFC_PCI
221 #define DEFAULT_CFG {0,0,0,0}
222 #endif
224 #ifdef CONFIG_HISAX_HFC_SX
225 #undef DEFAULT_CARD
226 #undef DEFAULT_CFG
227 #define DEFAULT_CARD ISDN_CTYPE_HFC_SX
228 #define DEFAULT_CFG {5,0x2E0,0,0}
229 #endif
232 #ifdef CONFIG_HISAX_AMD7930
233 #undef DEFAULT_CARD
234 #undef DEFAULT_CFG
235 #define DEFAULT_CARD ISDN_CTYPE_AMD7930
236 #define DEFAULT_CFG {12,0x3e0,0,0}
237 #endif
239 #ifdef CONFIG_HISAX_NICCY
240 #undef DEFAULT_CARD
241 #undef DEFAULT_CFG
242 #define DEFAULT_CARD ISDN_CTYPE_NICCY
243 #define DEFAULT_CFG {0,0x0,0,0}
244 #endif
246 #ifdef CONFIG_HISAX_ISURF
247 #undef DEFAULT_CARD
248 #undef DEFAULT_CFG
249 #define DEFAULT_CARD ISDN_CTYPE_ISURF
250 #define DEFAULT_CFG {5,0x100,0xc8000,0}
251 #endif
253 #ifdef CONFIG_HISAX_HSTSAPHIR
254 #undef DEFAULT_CARD
255 #undef DEFAULT_CFG
256 #define DEFAULT_CARD ISDN_CTYPE_HSTSAPHIR
257 #define DEFAULT_CFG {5,0x250,0,0}
258 #endif
260 #ifdef CONFIG_HISAX_BKM_A4T
261 #undef DEFAULT_CARD
262 #undef DEFAULT_CFG
263 #define DEFAULT_CARD ISDN_CTYPE_BKM_A4T
264 #define DEFAULT_CFG {0,0x0,0,0}
265 #endif
267 #ifdef CONFIG_HISAX_SCT_QUADRO
268 #undef DEFAULT_CARD
269 #undef DEFAULT_CFG
270 #define DEFAULT_CARD ISDN_CTYPE_SCT_QUADRO
271 #define DEFAULT_CFG {1,0x0,0,0}
272 #endif
274 #ifdef CONFIG_HISAX_GAZEL
275 #undef DEFAULT_CARD
276 #undef DEFAULT_CFG
277 #define DEFAULT_CARD ISDN_CTYPE_GAZEL
278 #define DEFAULT_CFG {15,0x180,0,0}
279 #endif
281 #ifdef CONFIG_HISAX_W6692
282 #undef DEFAULT_CARD
283 #undef DEFAULT_CFG
284 #define DEFAULT_CARD ISDN_CTYPE_W6692
285 #define DEFAULT_CFG {0,0,0,0}
286 #endif
288 #ifdef CONFIG_HISAX_NETJET_U
289 #undef DEFAULT_CARD
290 #undef DEFAULT_CFG
291 #define DEFAULT_CARD ISDN_CTYPE_NETJET_U
292 #define DEFAULT_CFG {0,0,0,0}
293 #endif
295 #ifdef CONFIG_HISAX_1TR6
296 #define DEFAULT_PROTO ISDN_PTYPE_1TR6
297 #define DEFAULT_PROTO_NAME "1TR6"
298 #endif
299 #ifdef CONFIG_HISAX_NI1
300 #undef DEFAULT_PROTO
301 #define DEFAULT_PROTO ISDN_PTYPE_NI1
302 #undef DEFAULT_PROTO_NAME
303 #define DEFAULT_PROTO_NAME "NI1"
304 #endif
305 #ifdef CONFIG_HISAX_EURO
306 #undef DEFAULT_PROTO
307 #define DEFAULT_PROTO ISDN_PTYPE_EURO
308 #undef DEFAULT_PROTO_NAME
309 #define DEFAULT_PROTO_NAME "EURO"
310 #endif
311 #ifndef DEFAULT_PROTO
312 #define DEFAULT_PROTO ISDN_PTYPE_UNKNOWN
313 #define DEFAULT_PROTO_NAME "UNKNOWN"
314 #endif
315 #ifndef DEFAULT_CARD
316 #define DEFAULT_CARD 0
317 #define DEFAULT_CFG {0,0,0,0}
318 #endif
320 #define FIRST_CARD { \
321 DEFAULT_CARD, \
322 DEFAULT_PROTO, \
323 DEFAULT_CFG, \
324 NULL, \
327 struct IsdnCard cards[HISAX_MAX_CARDS] = {
328 FIRST_CARD,
331 #define HISAX_IDSIZE (HISAX_MAX_CARDS*8)
332 static char HiSaxID[HISAX_IDSIZE] = { 0, };
334 static char *HiSax_id = HiSaxID;
335 #ifdef MODULE
336 /* Variables for insmod */
337 static int type[HISAX_MAX_CARDS] = { 0, };
338 static int protocol[HISAX_MAX_CARDS] = { 0, };
339 static int io[HISAX_MAX_CARDS] = { 0, };
340 #undef IO0_IO1
341 #ifdef CONFIG_HISAX_16_3
342 #define IO0_IO1
343 #endif
344 #ifdef CONFIG_HISAX_NICCY
345 #undef IO0_IO1
346 #define IO0_IO1
347 #endif
348 #ifdef IO0_IO1
349 static int io0[HISAX_MAX_CARDS] __devinitdata = { 0, };
350 static int io1[HISAX_MAX_CARDS] __devinitdata = { 0, };
351 #endif
352 static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, };
353 static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, };
354 static char *id = HiSaxID;
356 MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards");
357 MODULE_AUTHOR("Karsten Keil");
358 MODULE_LICENSE("GPL");
359 module_param_array(type, int, NULL, 0);
360 module_param_array(protocol, int, NULL, 0);
361 module_param_array(io, int, NULL, 0);
362 module_param_array(irq, int, NULL, 0);
363 module_param_array(mem, int, NULL, 0);
364 module_param(id, charp, 0);
365 #ifdef IO0_IO1
366 module_param_array(io0, int, NULL, 0);
367 module_param_array(io1, int, NULL, 0);
368 #endif
369 #endif /* MODULE */
371 int nrcards;
373 extern char *l1_revision;
374 extern char *l2_revision;
375 extern char *l3_revision;
376 extern char *lli_revision;
377 extern char *tei_revision;
379 char *HiSax_getrev(const char *revision)
381 char *rev;
382 char *p;
384 if ((p = strchr(revision, ':'))) {
385 rev = p + 2;
386 p = strchr(rev, '$');
387 *--p = 0;
388 } else
389 rev = "???";
390 return rev;
393 static void __init HiSaxVersion(void)
395 char tmp[64];
397 printk(KERN_INFO "HiSax: Linux Driver for passive ISDN cards\n");
398 #ifdef MODULE
399 printk(KERN_INFO "HiSax: Version 3.5 (module)\n");
400 #else
401 printk(KERN_INFO "HiSax: Version 3.5 (kernel)\n");
402 #endif
403 strcpy(tmp, l1_revision);
404 printk(KERN_INFO "HiSax: Layer1 Revision %s\n", HiSax_getrev(tmp));
405 strcpy(tmp, l2_revision);
406 printk(KERN_INFO "HiSax: Layer2 Revision %s\n", HiSax_getrev(tmp));
407 strcpy(tmp, tei_revision);
408 printk(KERN_INFO "HiSax: TeiMgr Revision %s\n", HiSax_getrev(tmp));
409 strcpy(tmp, l3_revision);
410 printk(KERN_INFO "HiSax: Layer3 Revision %s\n", HiSax_getrev(tmp));
411 strcpy(tmp, lli_revision);
412 printk(KERN_INFO "HiSax: LinkLayer Revision %s\n",
413 HiSax_getrev(tmp));
416 #ifndef MODULE
417 #define MAX_ARG (HISAX_MAX_CARDS*5)
418 static int __init HiSax_setup(char *line)
420 int i, j, argc;
421 int ints[MAX_ARG + 1];
422 char *str;
424 str = get_options(line, MAX_ARG, ints);
425 argc = ints[0];
426 printk(KERN_DEBUG "HiSax_setup: argc(%d) str(%s)\n", argc, str);
427 i = 0;
428 j = 1;
429 while (argc && (i < HISAX_MAX_CARDS)) {
430 cards[i].protocol = DEFAULT_PROTO;
431 if (argc) {
432 cards[i].typ = ints[j];
433 j++;
434 argc--;
436 if (argc) {
437 cards[i].protocol = ints[j];
438 j++;
439 argc--;
441 if (argc) {
442 cards[i].para[0] = ints[j];
443 j++;
444 argc--;
446 if (argc) {
447 cards[i].para[1] = ints[j];
448 j++;
449 argc--;
451 if (argc) {
452 cards[i].para[2] = ints[j];
453 j++;
454 argc--;
456 i++;
458 if (str && *str) {
459 if (strlen(str) < HISAX_IDSIZE)
460 strcpy(HiSaxID, str);
461 else
462 printk(KERN_WARNING "HiSax: ID too long!");
463 } else
464 strcpy(HiSaxID, "HiSax");
466 HiSax_id = HiSaxID;
467 return 1;
470 __setup("hisax=", HiSax_setup);
471 #endif /* MODULES */
473 #if CARD_TELES0
474 extern int setup_teles0(struct IsdnCard *card);
475 #endif
477 #if CARD_TELES3
478 extern int setup_teles3(struct IsdnCard *card);
479 #endif
481 #if CARD_S0BOX
482 extern int setup_s0box(struct IsdnCard *card);
483 #endif
485 #if CARD_TELESPCI
486 extern int setup_telespci(struct IsdnCard *card);
487 #endif
489 #if CARD_AVM_A1
490 extern int setup_avm_a1(struct IsdnCard *card);
491 #endif
493 #if CARD_AVM_A1_PCMCIA
494 extern int setup_avm_a1_pcmcia(struct IsdnCard *card);
495 #endif
497 #if CARD_FRITZPCI
498 extern int setup_avm_pcipnp(struct IsdnCard *card);
499 #endif
501 #if CARD_ELSA
502 extern int setup_elsa(struct IsdnCard *card);
503 #endif
505 #if CARD_IX1MICROR2
506 extern int setup_ix1micro(struct IsdnCard *card);
507 #endif
509 #if CARD_DIEHLDIVA
510 extern int setup_diva(struct IsdnCard *card);
511 #endif
513 #if CARD_ASUSCOM
514 extern int setup_asuscom(struct IsdnCard *card);
515 #endif
517 #if CARD_TELEINT
518 extern int setup_TeleInt(struct IsdnCard *card);
519 #endif
521 #if CARD_SEDLBAUER
522 extern int setup_sedlbauer(struct IsdnCard *card);
523 #endif
525 #if CARD_SPORTSTER
526 extern int setup_sportster(struct IsdnCard *card);
527 #endif
529 #if CARD_MIC
530 extern int setup_mic(struct IsdnCard *card);
531 #endif
533 #if CARD_NETJET_S
534 extern int setup_netjet_s(struct IsdnCard *card);
535 #endif
537 #if CARD_HFCS
538 extern int setup_hfcs(struct IsdnCard *card);
539 #endif
541 #if CARD_HFC_PCI
542 extern int setup_hfcpci(struct IsdnCard *card);
543 #endif
545 #if CARD_HFC_SX
546 extern int setup_hfcsx(struct IsdnCard *card);
547 #endif
549 #if CARD_AMD7930
550 extern int setup_amd7930(struct IsdnCard *card);
551 #endif
553 #if CARD_NICCY
554 extern int setup_niccy(struct IsdnCard *card);
555 #endif
557 #if CARD_ISURF
558 extern int setup_isurf(struct IsdnCard *card);
559 #endif
561 #if CARD_HSTSAPHIR
562 extern int setup_saphir(struct IsdnCard *card);
563 #endif
565 #if CARD_TESTEMU
566 extern int setup_testemu(struct IsdnCard *card);
567 #endif
569 #if CARD_BKM_A4T
570 extern int setup_bkm_a4t(struct IsdnCard *card);
571 #endif
573 #if CARD_SCT_QUADRO
574 extern int setup_sct_quadro(struct IsdnCard *card);
575 #endif
577 #if CARD_GAZEL
578 extern int setup_gazel(struct IsdnCard *card);
579 #endif
581 #if CARD_W6692
582 extern int setup_w6692(struct IsdnCard *card);
583 #endif
585 #if CARD_NETJET_U
586 extern int setup_netjet_u(struct IsdnCard *card);
587 #endif
589 #if CARD_FN_ENTERNOW_PCI
590 extern int setup_enternow_pci(struct IsdnCard *card);
591 #endif
594 * Find card with given driverId
596 static inline struct IsdnCardState *hisax_findcard(int driverid)
598 int i;
600 for (i = 0; i < nrcards; i++)
601 if (cards[i].cs)
602 if (cards[i].cs->myid == driverid)
603 return cards[i].cs;
604 return NULL;
608 * Find card with given card number
610 #if 0
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;
616 return NULL;
618 #endif /* 0 */
620 static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
622 int count, cnt;
623 u_char __user *p = buf;
624 struct IsdnCardState *cs = hisax_findcard(id);
626 if (cs) {
627 if (len > HISAX_STATUS_BUFSIZE) {
628 printk(KERN_WARNING
629 "HiSax: status overflow readstat %d/%d\n",
630 len, HISAX_STATUS_BUFSIZE);
632 count = cs->status_end - cs->status_read + 1;
633 if (count >= len)
634 count = len;
635 copy_to_user(p, cs->status_read, count);
636 cs->status_read += count;
637 if (cs->status_read > cs->status_end)
638 cs->status_read = cs->status_buf;
639 p += count;
640 count = len - count;
641 while (count) {
642 if (count > HISAX_STATUS_BUFSIZE)
643 cnt = HISAX_STATUS_BUFSIZE;
644 else
645 cnt = count;
646 copy_to_user(p, cs->status_read, cnt);
647 p += cnt;
648 cs->status_read += cnt % HISAX_STATUS_BUFSIZE;
649 count -= cnt;
651 return len;
652 } else {
653 printk(KERN_ERR
654 "HiSax: if_readstatus called with invalid driverId!\n");
655 return -ENODEV;
659 int jiftime(char *s, long mark)
661 s += 8;
663 *s-- = '\0';
664 *s-- = mark % 10 + '0';
665 mark /= 10;
666 *s-- = mark % 10 + '0';
667 mark /= 10;
668 *s-- = '.';
669 *s-- = mark % 10 + '0';
670 mark /= 10;
671 *s-- = mark % 6 + '0';
672 mark /= 6;
673 *s-- = ':';
674 *s-- = mark % 10 + '0';
675 mark /= 10;
676 *s-- = mark % 10 + '0';
677 return 8;
680 static u_char tmpbuf[HISAX_STATUS_BUFSIZE];
682 void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt,
683 va_list args)
685 /* if head == NULL the fmt contains the full info */
687 u_long flags;
688 int count, i;
689 u_char *p;
690 isdn_ctrl ic;
691 int len;
693 if (!cs) {
694 printk(KERN_WARNING "HiSax: No CardStatus for message");
695 return;
697 spin_lock_irqsave(&cs->statlock, flags);
698 p = tmpbuf;
699 if (head) {
700 p += jiftime(p, jiffies);
701 p += sprintf(p, " %s", head);
702 p += vsprintf(p, fmt, args);
703 *p++ = '\n';
704 *p = 0;
705 len = p - tmpbuf;
706 p = tmpbuf;
707 } else {
708 p = fmt;
709 len = strlen(fmt);
711 if (len > HISAX_STATUS_BUFSIZE) {
712 spin_unlock_irqrestore(&cs->statlock, flags);
713 printk(KERN_WARNING "HiSax: status overflow %d/%d\n",
714 len, HISAX_STATUS_BUFSIZE);
715 return;
717 count = len;
718 i = cs->status_end - cs->status_write + 1;
719 if (i >= len)
720 i = len;
721 len -= i;
722 memcpy(cs->status_write, p, i);
723 cs->status_write += i;
724 if (cs->status_write > cs->status_end)
725 cs->status_write = cs->status_buf;
726 p += i;
727 if (len) {
728 memcpy(cs->status_write, p, len);
729 cs->status_write += len;
731 #ifdef KERNELSTACK_DEBUG
732 i = (ulong) & len - current->kernel_stack_page;
733 sprintf(tmpbuf, "kstack %s %lx use %ld\n", current->comm,
734 current->kernel_stack_page, i);
735 len = strlen(tmpbuf);
736 for (p = tmpbuf, i = len; i > 0; i--, p++) {
737 *cs->status_write++ = *p;
738 if (cs->status_write > cs->status_end)
739 cs->status_write = cs->status_buf;
740 count++;
742 #endif
743 spin_unlock_irqrestore(&cs->statlock, flags);
744 if (count) {
745 ic.command = ISDN_STAT_STAVAIL;
746 ic.driver = cs->myid;
747 ic.arg = count;
748 cs->iif.statcallb(&ic);
752 void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...)
754 va_list args;
756 va_start(args, fmt);
757 VHiSax_putstatus(cs, head, fmt, args);
758 va_end(args);
761 int ll_run(struct IsdnCardState *cs, int addfeatures)
763 isdn_ctrl ic;
765 ic.driver = cs->myid;
766 ic.command = ISDN_STAT_RUN;
767 cs->iif.features |= addfeatures;
768 cs->iif.statcallb(&ic);
769 return 0;
772 static void ll_stop(struct IsdnCardState *cs)
774 isdn_ctrl ic;
776 ic.command = ISDN_STAT_STOP;
777 ic.driver = cs->myid;
778 cs->iif.statcallb(&ic);
779 // CallcFreeChan(cs);
782 static void ll_unload(struct IsdnCardState *cs)
784 isdn_ctrl ic;
786 ic.command = ISDN_STAT_UNLOAD;
787 ic.driver = cs->myid;
788 cs->iif.statcallb(&ic);
789 kfree(cs->status_buf);
790 cs->status_read = NULL;
791 cs->status_write = NULL;
792 cs->status_end = NULL;
793 kfree(cs->dlog);
794 cs->dlog = 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);
808 kfree(csta->rcvbuf);
809 csta->rcvbuf = NULL;
810 if (csta->tx_skb) {
811 dev_kfree_skb(csta->tx_skb);
812 csta->tx_skb = NULL;
814 if (csta->DC_Close != NULL) {
815 csta->DC_Close(csta);
817 if (csta->cardmsg)
818 csta->cardmsg(csta, CARD_RELEASE, NULL);
819 if (csta->dbusytimer.function != NULL) // FIXME?
820 del_timer(&csta->dbusytimer);
821 ll_unload(csta);
824 static int init_card(struct IsdnCardState *cs)
826 int irq_cnt, cnt = 3, ret;
828 if (!cs->irq) {
829 ret = cs->cardmsg(cs, CARD_INIT, NULL);
830 return(ret);
832 irq_cnt = kstat_irqs(cs->irq);
833 printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
834 cs->irq, irq_cnt);
835 if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) {
836 printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n",
837 cs->irq);
838 return 1;
840 while (cnt) {
841 cs->cardmsg(cs, CARD_INIT, NULL);
842 /* Timeout 10ms */
843 msleep(10);
844 printk(KERN_INFO "%s: IRQ %d count %d\n",
845 CardType[cs->typ], cs->irq, kstat_irqs(cs->irq));
846 if (kstat_irqs(cs->irq) == irq_cnt) {
847 printk(KERN_WARNING
848 "%s: IRQ(%d) getting no interrupts during init %d\n",
849 CardType[cs->typ], cs->irq, 4 - cnt);
850 if (cnt == 1) {
851 free_irq(cs->irq, cs);
852 return 2;
853 } else {
854 cs->cardmsg(cs, CARD_RESET, NULL);
855 cnt--;
857 } else {
858 cs->cardmsg(cs, CARD_TEST, NULL);
859 return 0;
862 return 3;
865 static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)
867 int ret = 0;
868 struct IsdnCard *card = cards + cardnr;
869 struct IsdnCardState *cs;
871 cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
872 if (!cs) {
873 printk(KERN_WARNING
874 "HiSax: No memory for IsdnCardState(card %d)\n",
875 cardnr + 1);
876 goto out;
878 memset(cs, 0, sizeof(struct IsdnCardState));
879 card->cs = cs;
880 spin_lock_init(&cs->statlock);
881 spin_lock_init(&cs->lock);
882 cs->chanlimit = 2; /* maximum B-channel number */
883 cs->logecho = 0; /* No echo logging */
884 cs->cardnr = cardnr;
885 cs->debug = L1_DEB_WARN;
886 cs->HW_Flags = 0;
887 cs->busy_flag = busy_flag;
888 cs->irq_flags = I4L_IRQ_FLAG;
889 #if TEI_PER_CARD
890 if (card->protocol == ISDN_PTYPE_NI1)
891 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
892 #else
893 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags);
894 #endif
895 cs->protocol = card->protocol;
897 if (card->typ <= 0 || card->typ > ISDN_CTYPE_COUNT) {
898 printk(KERN_WARNING
899 "HiSax: Card Type %d out of range\n", card->typ);
900 goto outf_cs;
902 if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
903 printk(KERN_WARNING
904 "HiSax: No memory for dlog(card %d)\n", cardnr + 1);
905 goto outf_cs;
907 if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
908 printk(KERN_WARNING
909 "HiSax: No memory for status_buf(card %d)\n",
910 cardnr + 1);
911 goto outf_dlog;
913 cs->stlist = NULL;
914 cs->status_read = cs->status_buf;
915 cs->status_write = cs->status_buf;
916 cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
917 cs->typ = card->typ;
918 #ifdef MODULE
919 cs->iif.owner = lockowner;
920 #endif
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;
925 cs->iif.features =
926 ISDN_FEATURE_L2_X75I |
927 ISDN_FEATURE_L2_HDLC |
928 ISDN_FEATURE_L2_HDLC_56K |
929 ISDN_FEATURE_L2_TRANS |
930 ISDN_FEATURE_L3_TRANS |
931 #ifdef CONFIG_HISAX_1TR6
932 ISDN_FEATURE_P_1TR6 |
933 #endif
934 #ifdef CONFIG_HISAX_EURO
935 ISDN_FEATURE_P_EURO |
936 #endif
937 #ifdef CONFIG_HISAX_NI1
938 ISDN_FEATURE_P_NI1 |
939 #endif
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;
948 printk(KERN_INFO
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);
955 switch (card->typ) {
956 #if CARD_TELES0
957 case ISDN_CTYPE_16_0:
958 case ISDN_CTYPE_8_0:
959 ret = setup_teles0(card);
960 break;
961 #endif
962 #if CARD_TELES3
963 case ISDN_CTYPE_16_3:
964 case ISDN_CTYPE_PNP:
965 case ISDN_CTYPE_TELESPCMCIA:
966 case ISDN_CTYPE_COMPAQ_ISA:
967 ret = setup_teles3(card);
968 break;
969 #endif
970 #if CARD_S0BOX
971 case ISDN_CTYPE_S0BOX:
972 ret = setup_s0box(card);
973 break;
974 #endif
975 #if CARD_TELESPCI
976 case ISDN_CTYPE_TELESPCI:
977 ret = setup_telespci(card);
978 break;
979 #endif
980 #if CARD_AVM_A1
981 case ISDN_CTYPE_A1:
982 ret = setup_avm_a1(card);
983 break;
984 #endif
985 #if CARD_AVM_A1_PCMCIA
986 case ISDN_CTYPE_A1_PCMCIA:
987 ret = setup_avm_a1_pcmcia(card);
988 break;
989 #endif
990 #if CARD_FRITZPCI
991 case ISDN_CTYPE_FRITZPCI:
992 ret = setup_avm_pcipnp(card);
993 break;
994 #endif
995 #if CARD_ELSA
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);
1001 break;
1002 #endif
1003 #if CARD_IX1MICROR2
1004 case ISDN_CTYPE_IX1MICROR2:
1005 ret = setup_ix1micro(card);
1006 break;
1007 #endif
1008 #if CARD_DIEHLDIVA
1009 case ISDN_CTYPE_DIEHLDIVA:
1010 ret = setup_diva(card);
1011 break;
1012 #endif
1013 #if CARD_ASUSCOM
1014 case ISDN_CTYPE_ASUSCOM:
1015 ret = setup_asuscom(card);
1016 break;
1017 #endif
1018 #if CARD_TELEINT
1019 case ISDN_CTYPE_TELEINT:
1020 ret = setup_TeleInt(card);
1021 break;
1022 #endif
1023 #if CARD_SEDLBAUER
1024 case ISDN_CTYPE_SEDLBAUER:
1025 case ISDN_CTYPE_SEDLBAUER_PCMCIA:
1026 case ISDN_CTYPE_SEDLBAUER_FAX:
1027 ret = setup_sedlbauer(card);
1028 break;
1029 #endif
1030 #if CARD_SPORTSTER
1031 case ISDN_CTYPE_SPORTSTER:
1032 ret = setup_sportster(card);
1033 break;
1034 #endif
1035 #if CARD_MIC
1036 case ISDN_CTYPE_MIC:
1037 ret = setup_mic(card);
1038 break;
1039 #endif
1040 #if CARD_NETJET_S
1041 case ISDN_CTYPE_NETJET_S:
1042 ret = setup_netjet_s(card);
1043 break;
1044 #endif
1045 #if CARD_HFCS
1046 case ISDN_CTYPE_TELES3C:
1047 case ISDN_CTYPE_ACERP10:
1048 ret = setup_hfcs(card);
1049 break;
1050 #endif
1051 #if CARD_HFC_PCI
1052 case ISDN_CTYPE_HFC_PCI:
1053 ret = setup_hfcpci(card);
1054 break;
1055 #endif
1056 #if CARD_HFC_SX
1057 case ISDN_CTYPE_HFC_SX:
1058 ret = setup_hfcsx(card);
1059 break;
1060 #endif
1061 #if CARD_NICCY
1062 case ISDN_CTYPE_NICCY:
1063 ret = setup_niccy(card);
1064 break;
1065 #endif
1066 #if CARD_AMD7930
1067 case ISDN_CTYPE_AMD7930:
1068 ret = setup_amd7930(card);
1069 break;
1070 #endif
1071 #if CARD_ISURF
1072 case ISDN_CTYPE_ISURF:
1073 ret = setup_isurf(card);
1074 break;
1075 #endif
1076 #if CARD_HSTSAPHIR
1077 case ISDN_CTYPE_HSTSAPHIR:
1078 ret = setup_saphir(card);
1079 break;
1080 #endif
1081 #if CARD_TESTEMU
1082 case ISDN_CTYPE_TESTEMU:
1083 ret = setup_testemu(card);
1084 break;
1085 #endif
1086 #if CARD_BKM_A4T
1087 case ISDN_CTYPE_BKM_A4T:
1088 ret = setup_bkm_a4t(card);
1089 break;
1090 #endif
1091 #if CARD_SCT_QUADRO
1092 case ISDN_CTYPE_SCT_QUADRO:
1093 ret = setup_sct_quadro(card);
1094 break;
1095 #endif
1096 #if CARD_GAZEL
1097 case ISDN_CTYPE_GAZEL:
1098 ret = setup_gazel(card);
1099 break;
1100 #endif
1101 #if CARD_W6692
1102 case ISDN_CTYPE_W6692:
1103 ret = setup_w6692(card);
1104 break;
1105 #endif
1106 #if CARD_NETJET_U
1107 case ISDN_CTYPE_NETJET_U:
1108 ret = setup_netjet_u(card);
1109 break;
1110 #endif
1111 #if CARD_FN_ENTERNOW_PCI
1112 case ISDN_CTYPE_ENTERNOW:
1113 ret = setup_enternow_pci(card);
1114 break;
1115 #endif
1116 case ISDN_CTYPE_DYNAMIC:
1117 ret = 2;
1118 break;
1119 default:
1120 printk(KERN_WARNING
1121 "HiSax: Support for %s Card not selected\n",
1122 CardType[card->typ]);
1123 ll_unload(cs);
1124 goto outf_cs;
1126 if (!ret) {
1127 ll_unload(cs);
1128 goto outf_cs;
1130 if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
1131 printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n");
1132 ll_unload(cs);
1133 goto outf_cs;
1135 cs->rcvidx = 0;
1136 cs->tx_skb = NULL;
1137 cs->tx_cnt = 0;
1138 cs->event = 0;
1139 cs->tqueue.data = cs;
1141 skb_queue_head_init(&cs->rq);
1142 skb_queue_head_init(&cs->sq);
1144 init_bcstate(cs, 0);
1145 init_bcstate(cs, 1);
1147 /* init_card only handles interrupts which are not */
1148 /* used here for the loadable driver */
1149 switch (card->typ) {
1150 case ISDN_CTYPE_DYNAMIC:
1151 ret = 0;
1152 break;
1153 default:
1154 ret = init_card(cs);
1155 break;
1157 if (ret) {
1158 closecard(cardnr);
1159 ret = 0;
1160 goto outf_cs;
1162 init_tei(cs, cs->protocol);
1163 ret = CallcNewChan(cs);
1164 if (ret) {
1165 closecard(cardnr);
1166 ret = 0;
1167 goto outf_cs;
1169 /* ISAR needs firmware download first */
1170 if (!test_bit(HW_ISAR, &cs->HW_Flags))
1171 ll_run(cs, 0);
1173 ret = 1;
1174 goto out;
1176 outf_dlog:
1177 kfree(cs->dlog);
1178 outf_cs:
1179 kfree(cs);
1180 card->cs = NULL;
1181 out:
1182 return ret;
1185 static void HiSax_shiftcards(int idx)
1187 int i;
1189 for (i = idx; i < (HISAX_MAX_CARDS - 1); i++)
1190 memcpy(&cards[i], &cards[i + 1], sizeof(cards[i]));
1193 static int HiSax_inithardware(int *busy_flag)
1195 int foundcards = 0;
1196 int i = 0;
1197 int t = ',';
1198 int flg = 0;
1199 char *id;
1200 char *next_id = HiSax_id;
1201 char ids[20];
1203 if (strchr(HiSax_id, ','))
1204 t = ',';
1205 else if (strchr(HiSax_id, '%'))
1206 t = '%';
1208 while (i < nrcards) {
1209 if (cards[i].typ < 1)
1210 break;
1211 id = next_id;
1212 if ((next_id = strchr(id, t))) {
1213 *next_id++ = 0;
1214 strcpy(ids, id);
1215 flg = i + 1;
1216 } else {
1217 next_id = id;
1218 if (flg >= i)
1219 strcpy(ids, id);
1220 else
1221 sprintf(ids, "%s%d", id, i);
1223 if (checkcard(i, ids, busy_flag, THIS_MODULE)) {
1224 foundcards++;
1225 i++;
1226 } else {
1227 /* make sure we don't oops the module */
1228 if (cards[i].typ > 0 && cards[i].typ <= ISDN_CTYPE_COUNT) {
1229 printk(KERN_WARNING
1230 "HiSax: Card %s not installed !\n",
1231 CardType[cards[i].typ]);
1233 HiSax_shiftcards(i);
1234 nrcards--;
1237 return foundcards;
1240 void HiSax_closecard(int cardnr)
1242 int i, last = nrcards - 1;
1244 if (cardnr > last || cardnr < 0)
1245 return;
1246 if (cards[cardnr].cs) {
1247 ll_stop(cards[cardnr].cs);
1248 release_tei(cards[cardnr].cs);
1249 CallcFreeChan(cards[cardnr].cs);
1251 closecard(cardnr);
1252 if (cards[cardnr].cs->irq)
1253 free_irq(cards[cardnr].cs->irq, cards[cardnr].cs);
1254 kfree((void *) cards[cardnr].cs);
1255 cards[cardnr].cs = NULL;
1257 i = cardnr;
1258 while (i <= last) {
1259 cards[i] = cards[i + 1];
1260 i++;
1262 nrcards--;
1265 void HiSax_reportcard(int cardnr, int sel)
1267 struct IsdnCardState *cs = cards[cardnr].cs;
1269 printk(KERN_DEBUG "HiSax: reportcard No %d\n", cardnr + 1);
1270 printk(KERN_DEBUG "HiSax: Type %s\n", CardType[cs->typ]);
1271 printk(KERN_DEBUG "HiSax: debuglevel %x\n", cs->debug);
1272 printk(KERN_DEBUG "HiSax: HiSax_reportcard address 0x%lX\n",
1273 (ulong) & HiSax_reportcard);
1274 printk(KERN_DEBUG "HiSax: cs 0x%lX\n", (ulong) cs);
1275 printk(KERN_DEBUG "HiSax: HW_Flags %lx bc0 flg %lx bc1 flg %lx\n",
1276 cs->HW_Flags, cs->bcs[0].Flag, cs->bcs[1].Flag);
1277 printk(KERN_DEBUG "HiSax: bcs 0 mode %d ch%d\n",
1278 cs->bcs[0].mode, cs->bcs[0].channel);
1279 printk(KERN_DEBUG "HiSax: bcs 1 mode %d ch%d\n",
1280 cs->bcs[1].mode, cs->bcs[1].channel);
1281 #ifdef ERROR_STATISTIC
1282 printk(KERN_DEBUG "HiSax: dc errors(rx,crc,tx) %d,%d,%d\n",
1283 cs->err_rx, cs->err_crc, cs->err_tx);
1284 printk(KERN_DEBUG
1285 "HiSax: bc0 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n",
1286 cs->bcs[0].err_inv, cs->bcs[0].err_rdo, cs->bcs[0].err_crc,
1287 cs->bcs[0].err_tx);
1288 printk(KERN_DEBUG
1289 "HiSax: bc1 errors(inv,rdo,crc,tx) %d,%d,%d,%d\n",
1290 cs->bcs[1].err_inv, cs->bcs[1].err_rdo, cs->bcs[1].err_crc,
1291 cs->bcs[1].err_tx);
1292 if (sel == 99) {
1293 cs->err_rx = 0;
1294 cs->err_crc = 0;
1295 cs->err_tx = 0;
1296 cs->bcs[0].err_inv = 0;
1297 cs->bcs[0].err_rdo = 0;
1298 cs->bcs[0].err_crc = 0;
1299 cs->bcs[0].err_tx = 0;
1300 cs->bcs[1].err_inv = 0;
1301 cs->bcs[1].err_rdo = 0;
1302 cs->bcs[1].err_crc = 0;
1303 cs->bcs[1].err_tx = 0;
1305 #endif
1308 static int __init HiSax_init(void)
1310 int i, retval;
1311 #ifdef MODULE
1312 int j;
1313 int nzproto = 0;
1314 #endif
1316 HiSaxVersion();
1317 retval = CallcNew();
1318 if (retval)
1319 goto out;
1320 retval = Isdnl3New();
1321 if (retval)
1322 goto out_callc;
1323 retval = Isdnl2New();
1324 if (retval)
1325 goto out_isdnl3;
1326 retval = TeiNew();
1327 if (retval)
1328 goto out_isdnl2;
1329 retval = Isdnl1New();
1330 if (retval)
1331 goto out_tei;
1333 #ifdef MODULE
1334 if (!type[0]) {
1335 /* We 'll register drivers later, but init basic functions */
1336 for (i = 0; i < HISAX_MAX_CARDS; i++)
1337 cards[i].typ = 0;
1338 return 0;
1340 #ifdef CONFIG_HISAX_ELSA
1341 if (type[0] == ISDN_CTYPE_ELSA_PCMCIA) {
1342 /* we have exported and return in this case */
1343 return 0;
1345 #endif
1346 #ifdef CONFIG_HISAX_SEDLBAUER
1347 if (type[0] == ISDN_CTYPE_SEDLBAUER_PCMCIA) {
1348 /* we have to export and return in this case */
1349 return 0;
1351 #endif
1352 #ifdef CONFIG_HISAX_AVM_A1_PCMCIA
1353 if (type[0] == ISDN_CTYPE_A1_PCMCIA) {
1354 /* we have to export and return in this case */
1355 return 0;
1357 #endif
1358 #ifdef CONFIG_HISAX_HFC_SX
1359 if (type[0] == ISDN_CTYPE_HFC_SP_PCMCIA) {
1360 /* we have to export and return in this case */
1361 return 0;
1363 #endif
1364 #endif
1365 nrcards = 0;
1366 #ifdef MODULE
1367 if (id) /* If id= string used */
1368 HiSax_id = id;
1369 for (i = j = 0; j < HISAX_MAX_CARDS; i++) {
1370 cards[j].typ = type[i];
1371 if (protocol[i]) {
1372 cards[j].protocol = protocol[i];
1373 nzproto++;
1374 } else {
1375 cards[j].protocol = DEFAULT_PROTO;
1377 switch (type[i]) {
1378 case ISDN_CTYPE_16_0:
1379 cards[j].para[0] = irq[i];
1380 cards[j].para[1] = mem[i];
1381 cards[j].para[2] = io[i];
1382 break;
1384 case ISDN_CTYPE_8_0:
1385 cards[j].para[0] = irq[i];
1386 cards[j].para[1] = mem[i];
1387 break;
1389 #ifdef IO0_IO1
1390 case ISDN_CTYPE_PNP:
1391 case ISDN_CTYPE_NICCY:
1392 cards[j].para[0] = irq[i];
1393 cards[j].para[1] = io0[i];
1394 cards[j].para[2] = io1[i];
1395 break;
1396 case ISDN_CTYPE_COMPAQ_ISA:
1397 cards[j].para[0] = irq[i];
1398 cards[j].para[1] = io0[i];
1399 cards[j].para[2] = io1[i];
1400 cards[j].para[3] = io[i];
1401 break;
1402 #endif
1403 case ISDN_CTYPE_ELSA:
1404 case ISDN_CTYPE_HFC_PCI:
1405 cards[j].para[0] = io[i];
1406 break;
1407 case ISDN_CTYPE_16_3:
1408 case ISDN_CTYPE_TELESPCMCIA:
1409 case ISDN_CTYPE_A1:
1410 case ISDN_CTYPE_A1_PCMCIA:
1411 case ISDN_CTYPE_ELSA_PNP:
1412 case ISDN_CTYPE_ELSA_PCMCIA:
1413 case ISDN_CTYPE_IX1MICROR2:
1414 case ISDN_CTYPE_DIEHLDIVA:
1415 case ISDN_CTYPE_ASUSCOM:
1416 case ISDN_CTYPE_TELEINT:
1417 case ISDN_CTYPE_SEDLBAUER:
1418 case ISDN_CTYPE_SEDLBAUER_PCMCIA:
1419 case ISDN_CTYPE_SEDLBAUER_FAX:
1420 case ISDN_CTYPE_SPORTSTER:
1421 case ISDN_CTYPE_MIC:
1422 case ISDN_CTYPE_TELES3C:
1423 case ISDN_CTYPE_ACERP10:
1424 case ISDN_CTYPE_S0BOX:
1425 case ISDN_CTYPE_FRITZPCI:
1426 case ISDN_CTYPE_HSTSAPHIR:
1427 case ISDN_CTYPE_GAZEL:
1428 case ISDN_CTYPE_HFC_SX:
1429 case ISDN_CTYPE_HFC_SP_PCMCIA:
1430 cards[j].para[0] = irq[i];
1431 cards[j].para[1] = io[i];
1432 break;
1433 case ISDN_CTYPE_ISURF:
1434 cards[j].para[0] = irq[i];
1435 cards[j].para[1] = io[i];
1436 cards[j].para[2] = mem[i];
1437 break;
1438 case ISDN_CTYPE_ELSA_PCI:
1439 case ISDN_CTYPE_NETJET_S:
1440 case ISDN_CTYPE_AMD7930:
1441 case ISDN_CTYPE_TELESPCI:
1442 case ISDN_CTYPE_W6692:
1443 case ISDN_CTYPE_NETJET_U:
1444 break;
1445 case ISDN_CTYPE_BKM_A4T:
1446 break;
1447 case ISDN_CTYPE_SCT_QUADRO:
1448 if (irq[i]) {
1449 cards[j].para[0] = irq[i];
1450 } else {
1451 /* QUADRO is a 4 BRI card */
1452 cards[j++].para[0] = 1;
1453 /* we need to check if further cards can be added */
1454 if (j < HISAX_MAX_CARDS) {
1455 cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
1456 cards[j].protocol = protocol[i];
1457 cards[j++].para[0] = 2;
1459 if (j < HISAX_MAX_CARDS) {
1460 cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
1461 cards[j].protocol = protocol[i];
1462 cards[j++].para[0] = 3;
1464 if (j < HISAX_MAX_CARDS) {
1465 cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
1466 cards[j].protocol = protocol[i];
1467 cards[j].para[0] = 4;
1470 break;
1472 j++;
1474 if (!nzproto) {
1475 printk(KERN_WARNING
1476 "HiSax: Warning - no protocol specified\n");
1477 printk(KERN_WARNING "HiSax: using protocol %s\n",
1478 DEFAULT_PROTO_NAME);
1480 #endif
1481 if (!HiSax_id)
1482 HiSax_id = HiSaxID;
1483 if (!HiSaxID[0])
1484 strcpy(HiSaxID, "HiSax");
1485 for (i = 0; i < HISAX_MAX_CARDS; i++)
1486 if (cards[i].typ > 0)
1487 nrcards++;
1488 printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
1489 nrcards, (nrcards > 1) ? "s" : "");
1491 /* Install only, if at least one card found */
1492 if (!HiSax_inithardware(NULL))
1493 return -ENODEV;
1494 return 0;
1496 out_tei:
1497 TeiFree();
1498 out_isdnl2:
1499 Isdnl2Free();
1500 out_isdnl3:
1501 Isdnl3Free();
1502 out_callc:
1503 CallcFree();
1504 out:
1505 return retval;
1508 static void __exit HiSax_exit(void)
1510 int cardnr = nrcards - 1;
1512 while (cardnr >= 0)
1513 HiSax_closecard(cardnr--);
1514 Isdnl1Free();
1515 TeiFree();
1516 Isdnl2Free();
1517 Isdnl3Free();
1518 CallcFree();
1519 printk(KERN_INFO "HiSax module removed\n");
1522 int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
1524 u_char ids[16];
1525 int ret = -1;
1527 cards[nrcards] = *card;
1528 if (nrcards)
1529 sprintf(ids, "HiSax%d", nrcards);
1530 else
1531 sprintf(ids, "HiSax");
1532 if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE))
1533 goto error;
1535 ret = nrcards;
1536 nrcards++;
1537 error:
1538 return ret;
1541 EXPORT_SYMBOL(hisax_init_pcmcia);
1542 EXPORT_SYMBOL(HiSax_closecard);
1544 #include "hisax_if.h"
1546 EXPORT_SYMBOL(hisax_register);
1547 EXPORT_SYMBOL(hisax_unregister);
1549 static void hisax_d_l1l2(struct hisax_if *ifc, int pr, void *arg);
1550 static void hisax_b_l1l2(struct hisax_if *ifc, int pr, void *arg);
1551 static void hisax_d_l2l1(struct PStack *st, int pr, void *arg);
1552 static void hisax_b_l2l1(struct PStack *st, int pr, void *arg);
1553 static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg);
1554 static int hisax_bc_setstack(struct PStack *st, struct BCState *bcs);
1555 static void hisax_bc_close(struct BCState *bcs);
1556 static void hisax_bh(struct IsdnCardState *cs);
1557 static void EChannel_proc_rcv(struct hisax_d_if *d_if);
1559 int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
1560 char *name, int protocol)
1562 int i, retval;
1563 char id[20];
1564 struct IsdnCardState *cs;
1566 for (i = 0; i < HISAX_MAX_CARDS; i++) {
1567 if (!cards[i].typ)
1568 break;
1571 if (i >= HISAX_MAX_CARDS)
1572 return -EBUSY;
1574 cards[i].typ = ISDN_CTYPE_DYNAMIC;
1575 cards[i].protocol = protocol;
1576 sprintf(id, "%s%d", name, i);
1577 nrcards++;
1578 retval = checkcard(i, id, NULL, hisax_d_if->owner);
1579 if (retval == 0) { // yuck
1580 cards[i].typ = 0;
1581 nrcards--;
1582 return retval;
1584 cs = cards[i].cs;
1585 hisax_d_if->cs = cs;
1586 cs->hw.hisax_d_if = hisax_d_if;
1587 cs->cardmsg = hisax_cardmsg;
1588 INIT_WORK(&cs->tqueue, (void *)(void *)hisax_bh, cs);
1589 cs->channel[0].d_st->l2.l2l1 = hisax_d_l2l1;
1590 for (i = 0; i < 2; i++) {
1591 cs->bcs[i].BC_SetStack = hisax_bc_setstack;
1592 cs->bcs[i].BC_Close = hisax_bc_close;
1594 b_if[i]->ifc.l1l2 = hisax_b_l1l2;
1596 hisax_d_if->b_if[i] = b_if[i];
1598 hisax_d_if->ifc.l1l2 = hisax_d_l1l2;
1599 skb_queue_head_init(&hisax_d_if->erq);
1600 clear_bit(0, &hisax_d_if->ph_state);
1602 return 0;
1605 void hisax_unregister(struct hisax_d_if *hisax_d_if)
1607 cards[hisax_d_if->cs->cardnr].typ = 0;
1608 HiSax_closecard(hisax_d_if->cs->cardnr);
1609 skb_queue_purge(&hisax_d_if->erq);
1612 #include "isdnl1.h"
1614 static void hisax_sched_event(struct IsdnCardState *cs, int event)
1616 test_and_set_bit(event, &cs->event);
1617 schedule_work(&cs->tqueue);
1620 static void hisax_bh(struct IsdnCardState *cs)
1622 struct PStack *st;
1623 int pr;
1625 if (test_and_clear_bit(D_RCVBUFREADY, &cs->event))
1626 DChannel_proc_rcv(cs);
1627 if (test_and_clear_bit(E_RCVBUFREADY, &cs->event))
1628 EChannel_proc_rcv(cs->hw.hisax_d_if);
1629 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) {
1630 if (test_bit(0, &cs->hw.hisax_d_if->ph_state))
1631 pr = PH_ACTIVATE | INDICATION;
1632 else
1633 pr = PH_DEACTIVATE | INDICATION;
1634 for (st = cs->stlist; st; st = st->next)
1635 st->l1.l1l2(st, pr, NULL);
1640 static void hisax_b_sched_event(struct BCState *bcs, int event)
1642 test_and_set_bit(event, &bcs->event);
1643 schedule_work(&bcs->tqueue);
1646 static inline void D_L2L1(struct hisax_d_if *d_if, int pr, void *arg)
1648 struct hisax_if *ifc = (struct hisax_if *) d_if;
1649 ifc->l2l1(ifc, pr, arg);
1652 static inline void B_L2L1(struct hisax_b_if *b_if, int pr, void *arg)
1654 struct hisax_if *ifc = (struct hisax_if *) b_if;
1655 ifc->l2l1(ifc, pr, arg);
1658 static void hisax_d_l1l2(struct hisax_if *ifc, int pr, void *arg)
1660 struct hisax_d_if *d_if = (struct hisax_d_if *) ifc;
1661 struct IsdnCardState *cs = d_if->cs;
1662 struct PStack *st;
1663 struct sk_buff *skb;
1665 switch (pr) {
1666 case PH_ACTIVATE | INDICATION:
1667 set_bit(0, &d_if->ph_state);
1668 hisax_sched_event(cs, D_L1STATECHANGE);
1669 break;
1670 case PH_DEACTIVATE | INDICATION:
1671 clear_bit(0, &d_if->ph_state);
1672 hisax_sched_event(cs, D_L1STATECHANGE);
1673 break;
1674 case PH_DATA | INDICATION:
1675 skb_queue_tail(&cs->rq, arg);
1676 hisax_sched_event(cs, D_RCVBUFREADY);
1677 break;
1678 case PH_DATA | CONFIRM:
1679 skb = skb_dequeue(&cs->sq);
1680 if (skb) {
1681 D_L2L1(d_if, PH_DATA | REQUEST, skb);
1682 break;
1684 clear_bit(FLG_L1_DBUSY, &cs->HW_Flags);
1685 for (st = cs->stlist; st; st = st->next) {
1686 if (test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags)) {
1687 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1688 break;
1691 break;
1692 case PH_DATA_E | INDICATION:
1693 skb_queue_tail(&d_if->erq, arg);
1694 hisax_sched_event(cs, E_RCVBUFREADY);
1695 break;
1696 default:
1697 printk("pr %#x\n", pr);
1698 break;
1702 static void hisax_b_l1l2(struct hisax_if *ifc, int pr, void *arg)
1704 struct hisax_b_if *b_if = (struct hisax_b_if *) ifc;
1705 struct BCState *bcs = b_if->bcs;
1706 struct PStack *st = bcs->st;
1707 struct sk_buff *skb;
1709 // FIXME use isdnl1?
1710 switch (pr) {
1711 case PH_ACTIVATE | INDICATION:
1712 st->l1.l1l2(st, pr, NULL);
1713 break;
1714 case PH_DEACTIVATE | INDICATION:
1715 st->l1.l1l2(st, pr, NULL);
1716 clear_bit(BC_FLG_BUSY, &bcs->Flag);
1717 skb_queue_purge(&bcs->squeue);
1718 bcs->hw.b_if = NULL;
1719 break;
1720 case PH_DATA | INDICATION:
1721 skb_queue_tail(&bcs->rqueue, arg);
1722 hisax_b_sched_event(bcs, B_RCVBUFREADY);
1723 break;
1724 case PH_DATA | CONFIRM:
1725 bcs->tx_cnt -= (int) arg;
1726 if (test_bit(FLG_LLI_L1WAKEUP,&bcs->st->lli.flag)) {
1727 u_long flags;
1728 spin_lock_irqsave(&bcs->aclock, flags);
1729 bcs->ackcnt += (int) arg;
1730 spin_unlock_irqrestore(&bcs->aclock, flags);
1731 schedule_event(bcs, B_ACKPENDING);
1733 skb = skb_dequeue(&bcs->squeue);
1734 if (skb) {
1735 B_L2L1(b_if, PH_DATA | REQUEST, skb);
1736 break;
1738 clear_bit(BC_FLG_BUSY, &bcs->Flag);
1739 if (test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags)) {
1740 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1742 break;
1743 default:
1744 printk("hisax_b_l1l2 pr %#x\n", pr);
1745 break;
1749 static void hisax_d_l2l1(struct PStack *st, int pr, void *arg)
1751 struct IsdnCardState *cs = st->l1.hardware;
1752 struct hisax_d_if *hisax_d_if = cs->hw.hisax_d_if;
1753 struct sk_buff *skb = arg;
1755 switch (pr) {
1756 case PH_DATA | REQUEST:
1757 case PH_PULL | INDICATION:
1758 if (cs->debug & DEB_DLOG_HEX)
1759 LogFrame(cs, skb->data, skb->len);
1760 if (cs->debug & DEB_DLOG_VERBOSE)
1761 dlogframe(cs, skb, 0);
1762 Logl2Frame(cs, skb, "PH_DATA_REQ", 0);
1763 // FIXME lock?
1764 if (!test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags))
1765 D_L2L1(hisax_d_if, PH_DATA | REQUEST, skb);
1766 else
1767 skb_queue_tail(&cs->sq, skb);
1768 break;
1769 case PH_PULL | REQUEST:
1770 if (!test_bit(FLG_L1_DBUSY, &cs->HW_Flags))
1771 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1772 else
1773 set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
1774 break;
1775 default:
1776 D_L2L1(hisax_d_if, pr, arg);
1777 break;
1781 static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg)
1783 return 0;
1786 static void hisax_b_l2l1(struct PStack *st, int pr, void *arg)
1788 struct BCState *bcs = st->l1.bcs;
1789 struct hisax_b_if *b_if = bcs->hw.b_if;
1791 switch (pr) {
1792 case PH_ACTIVATE | REQUEST:
1793 B_L2L1(b_if, pr, (void *) st->l1.mode);
1794 break;
1795 case PH_DATA | REQUEST:
1796 case PH_PULL | INDICATION:
1797 // FIXME lock?
1798 if (!test_and_set_bit(BC_FLG_BUSY, &bcs->Flag)) {
1799 B_L2L1(b_if, PH_DATA | REQUEST, arg);
1800 } else {
1801 skb_queue_tail(&bcs->squeue, arg);
1803 break;
1804 case PH_PULL | REQUEST:
1805 if (!test_bit(BC_FLG_BUSY, &bcs->Flag))
1806 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1807 else
1808 set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
1809 break;
1810 case PH_DEACTIVATE | REQUEST:
1811 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
1812 skb_queue_purge(&bcs->squeue);
1813 default:
1814 B_L2L1(b_if, pr, arg);
1815 break;
1819 static int hisax_bc_setstack(struct PStack *st, struct BCState *bcs)
1821 struct IsdnCardState *cs = st->l1.hardware;
1822 struct hisax_d_if *hisax_d_if = cs->hw.hisax_d_if;
1824 bcs->channel = st->l1.bc;
1826 bcs->hw.b_if = hisax_d_if->b_if[st->l1.bc];
1827 hisax_d_if->b_if[st->l1.bc]->bcs = bcs;
1829 st->l1.bcs = bcs;
1830 st->l2.l2l1 = hisax_b_l2l1;
1831 setstack_manager(st);
1832 bcs->st = st;
1833 setstack_l1_B(st);
1834 skb_queue_head_init(&bcs->rqueue);
1835 skb_queue_head_init(&bcs->squeue);
1836 return 0;
1839 static void hisax_bc_close(struct BCState *bcs)
1841 struct hisax_b_if *b_if = bcs->hw.b_if;
1843 if (b_if)
1844 B_L2L1(b_if, PH_DEACTIVATE | REQUEST, NULL);
1847 static void EChannel_proc_rcv(struct hisax_d_if *d_if)
1849 struct IsdnCardState *cs = d_if->cs;
1850 u_char *ptr;
1851 struct sk_buff *skb;
1853 while ((skb = skb_dequeue(&d_if->erq)) != NULL) {
1854 if (cs->debug & DEB_DLOG_HEX) {
1855 ptr = cs->dlog;
1856 if ((skb->len) < MAX_DLOG_SPACE / 3 - 10) {
1857 *ptr++ = 'E';
1858 *ptr++ = 'C';
1859 *ptr++ = 'H';
1860 *ptr++ = 'O';
1861 *ptr++ = ':';
1862 ptr += QuickHex(ptr, skb->data, skb->len);
1863 ptr--;
1864 *ptr++ = '\n';
1865 *ptr = 0;
1866 HiSax_putstatus(cs, NULL, cs->dlog);
1867 } else
1868 HiSax_putstatus(cs, "LogEcho: ",
1869 "warning Frame too big (%d)",
1870 skb->len);
1872 dev_kfree_skb_any(skb);
1876 #ifdef CONFIG_PCI
1877 #include <linux/pci.h>
1879 static struct pci_device_id hisax_pci_tbl[] __initdata = {
1880 #ifdef CONFIG_HISAX_FRITZPCI
1881 {PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID},
1882 #endif
1883 #ifdef CONFIG_HISAX_DIEHLDIVA
1884 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20, PCI_ANY_ID, PCI_ANY_ID},
1885 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA20_U, PCI_ANY_ID, PCI_ANY_ID},
1886 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA201, PCI_ANY_ID, PCI_ANY_ID},
1887 //#########################################################################################
1888 {PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_DIVA202, PCI_ANY_ID, PCI_ANY_ID},
1889 //#########################################################################################
1890 #endif
1891 #ifdef CONFIG_HISAX_ELSA
1892 {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_MICROLINK, PCI_ANY_ID, PCI_ANY_ID},
1893 {PCI_VENDOR_ID_ELSA, PCI_DEVICE_ID_ELSA_QS3000, PCI_ANY_ID, PCI_ANY_ID},
1894 #endif
1895 #ifdef CONFIG_HISAX_GAZEL
1896 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R685, PCI_ANY_ID, PCI_ANY_ID},
1897 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, PCI_ANY_ID, PCI_ANY_ID},
1898 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, PCI_ANY_ID, PCI_ANY_ID},
1899 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_OLITEC, PCI_ANY_ID, PCI_ANY_ID},
1900 #endif
1901 #ifdef CONFIG_HISAX_QUADRO
1902 {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_ANY_ID, PCI_ANY_ID},
1903 #endif
1904 #ifdef CONFIG_HISAX_NICCY
1905 {PCI_VENDOR_ID_SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY, PCI_ANY_ID,PCI_ANY_ID},
1906 #endif
1907 #ifdef CONFIG_HISAX_SEDLBAUER
1908 {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, PCI_ANY_ID,PCI_ANY_ID},
1909 #endif
1910 #if defined(CONFIG_HISAX_NETJET) || defined(CONFIG_HISAX_NETJET_U)
1911 {PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, PCI_ANY_ID,PCI_ANY_ID},
1912 #endif
1913 #if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO)
1914 {PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, PCI_ANY_ID,PCI_ANY_ID},
1915 #endif
1916 #ifdef CONFIG_HISAX_W6692
1917 {PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, PCI_ANY_ID,PCI_ANY_ID},
1918 {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, PCI_ANY_ID,PCI_ANY_ID},
1919 #endif
1920 #ifdef CONFIG_HISAX_HFC_PCI
1921 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, PCI_ANY_ID, PCI_ANY_ID},
1922 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, PCI_ANY_ID, PCI_ANY_ID},
1923 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, PCI_ANY_ID, PCI_ANY_ID},
1924 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, PCI_ANY_ID, PCI_ANY_ID},
1925 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, PCI_ANY_ID, PCI_ANY_ID},
1926 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, PCI_ANY_ID, PCI_ANY_ID},
1927 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, PCI_ANY_ID, PCI_ANY_ID},
1928 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, PCI_ANY_ID, PCI_ANY_ID},
1929 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, PCI_ANY_ID, PCI_ANY_ID},
1930 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, PCI_ANY_ID, PCI_ANY_ID},
1931 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B700, PCI_ANY_ID, PCI_ANY_ID},
1932 {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B701, PCI_ANY_ID, PCI_ANY_ID},
1933 {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, PCI_ANY_ID, PCI_ANY_ID},
1934 {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, PCI_ANY_ID, PCI_ANY_ID},
1935 {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, PCI_ANY_ID, PCI_ANY_ID},
1936 {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, PCI_ANY_ID, PCI_ANY_ID},
1937 {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, PCI_ANY_ID, PCI_ANY_ID},
1938 {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, PCI_ANY_ID, PCI_ANY_ID},
1939 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E, PCI_ANY_ID, PCI_ANY_ID},
1940 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E, PCI_ANY_ID, PCI_ANY_ID},
1941 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A, PCI_ANY_ID, PCI_ANY_ID},
1942 {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A, PCI_ANY_ID, PCI_ANY_ID},
1943 #endif
1944 { } /* Terminating entry */
1947 MODULE_DEVICE_TABLE(pci, hisax_pci_tbl);
1948 #endif /* CONFIG_PCI */
1950 module_init(HiSax_init);
1951 module_exit(HiSax_exit);
1953 EXPORT_SYMBOL(FsmNew);
1954 EXPORT_SYMBOL(FsmFree);
1955 EXPORT_SYMBOL(FsmEvent);
1956 EXPORT_SYMBOL(FsmChangeState);
1957 EXPORT_SYMBOL(FsmInitTimer);
1958 EXPORT_SYMBOL(FsmDelTimer);
1959 EXPORT_SYMBOL(FsmRestartTimer);