1 /* $Id: b1.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
3 * Common module for AVM B1 cards.
5 * Copyright 1999 by Carsten Paeth <calle@calle.de>
7 * This software may be used and distributed according to the terms
8 * of the GNU General Public License, incorporated herein by reference.
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/pci.h>
15 #include <linux/proc_fs.h>
16 #include <linux/seq_file.h>
17 #include <linux/skbuff.h>
18 #include <linux/delay.h>
20 #include <linux/interrupt.h>
21 #include <linux/ioport.h>
22 #include <linux/capi.h>
23 #include <linux/kernelcapi.h>
24 #include <linux/slab.h>
26 #include <linux/init.h>
27 #include <asm/uaccess.h>
28 #include <linux/netdevice.h>
29 #include <linux/isdn/capilli.h>
31 #include <linux/isdn/capicmd.h>
32 #include <linux/isdn/capiutil.h>
34 static char *revision
= "$Revision: 1.1.2.2 $";
36 /* ------------------------------------------------------------- */
38 MODULE_DESCRIPTION("CAPI4Linux: Common support for active AVM cards");
39 MODULE_AUTHOR("Carsten Paeth");
40 MODULE_LICENSE("GPL");
42 /* ------------------------------------------------------------- */
44 int b1_irq_table
[16] =
63 /* ------------------------------------------------------------- */
65 avmcard
*b1_alloc_card(int nr_controllers
)
71 card
= kzalloc(sizeof(*card
), GFP_KERNEL
);
75 cinfo
= kzalloc(sizeof(*cinfo
) * nr_controllers
, GFP_KERNEL
);
81 card
->ctrlinfo
= cinfo
;
82 for (i
= 0; i
< nr_controllers
; i
++) {
83 INIT_LIST_HEAD(&cinfo
[i
].ncci_head
);
86 spin_lock_init(&card
->lock
);
87 card
->nr_controllers
= nr_controllers
;
92 /* ------------------------------------------------------------- */
94 void b1_free_card(avmcard
*card
)
96 kfree(card
->ctrlinfo
);
100 /* ------------------------------------------------------------- */
102 int b1_detect(unsigned int base
, enum avmcardtype cardtype
)
107 * Statusregister 0000 00xx
109 if ((inb(base
+ B1_INSTAT
) & 0xfc)
110 || (inb(base
+ B1_OUTSTAT
) & 0xfc))
113 * Statusregister 0000 001x
115 b1outp(base
, B1_INSTAT
, 0x2); /* enable irq */
116 /* b1outp(base, B1_OUTSTAT, 0x2); */
117 if ((inb(base
+ B1_INSTAT
) & 0xfe) != 0x2
118 /* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */)
121 * Statusregister 0000 000x
123 b1outp(base
, B1_INSTAT
, 0x0); /* disable irq */
124 b1outp(base
, B1_OUTSTAT
, 0x0);
125 if ((inb(base
+ B1_INSTAT
) & 0xfe)
126 || (inb(base
+ B1_OUTSTAT
) & 0xfe))
129 for (onoff
= !0, i
= 0; i
< 10 ; i
++) {
130 b1_set_test_bit(base
, cardtype
, onoff
);
131 if (b1_get_test_bit(base
, cardtype
) != onoff
)
136 if (cardtype
== avm_m1
)
139 if ((b1_rd_reg(base
, B1_STAT1(cardtype
)) & 0x0f) != 0x01)
145 void b1_getrevision(avmcard
*card
)
147 card
->class = inb(card
->port
+ B1_ANALYSE
);
148 card
->revision
= inb(card
->port
+ B1_REVISION
);
151 #define FWBUF_SIZE 256
152 int b1_load_t4file(avmcard
*card
, capiloaddatapart
* t4file
)
154 unsigned char buf
[FWBUF_SIZE
];
157 unsigned int base
= card
->port
;
161 while (left
> FWBUF_SIZE
) {
163 if (copy_from_user(buf
, dp
, FWBUF_SIZE
))
166 memcpy(buf
, dp
, FWBUF_SIZE
);
168 for (i
= 0; i
< FWBUF_SIZE
; i
++)
169 if (b1_save_put_byte(base
, buf
[i
]) < 0) {
170 printk(KERN_ERR
"%s: corrupted firmware file ?\n",
179 if (copy_from_user(buf
, dp
, left
))
182 memcpy(buf
, dp
, left
);
184 for (i
= 0; i
< left
; i
++)
185 if (b1_save_put_byte(base
, buf
[i
]) < 0) {
186 printk(KERN_ERR
"%s: corrupted firmware file ?\n",
194 int b1_load_config(avmcard
*card
, capiloaddatapart
* config
)
196 unsigned char buf
[FWBUF_SIZE
];
198 unsigned int base
= card
->port
;
204 b1_put_byte(base
, SEND_CONFIG
);
205 b1_put_word(base
, 1);
206 b1_put_byte(base
, SEND_CONFIG
);
207 b1_put_word(base
, left
);
209 while (left
> FWBUF_SIZE
) {
211 if (copy_from_user(buf
, dp
, FWBUF_SIZE
))
214 memcpy(buf
, dp
, FWBUF_SIZE
);
216 for (i
= 0; i
< FWBUF_SIZE
; ) {
217 b1_put_byte(base
, SEND_CONFIG
);
218 for (j
=0; j
< 4; j
++) {
219 b1_put_byte(base
, buf
[i
++]);
227 if (copy_from_user(buf
, dp
, left
))
230 memcpy(buf
, dp
, left
);
232 for (i
= 0; i
< left
; ) {
233 b1_put_byte(base
, SEND_CONFIG
);
234 for (j
=0; j
< 4; j
++) {
236 b1_put_byte(base
, buf
[i
++]);
238 b1_put_byte(base
, 0);
245 int b1_loaded(avmcard
*card
)
247 unsigned int base
= card
->port
;
250 unsigned long tout
= 2;
252 for (stop
= jiffies
+ tout
* HZ
; time_before(jiffies
, stop
);) {
253 if (b1_tx_empty(base
))
256 if (!b1_tx_empty(base
)) {
257 printk(KERN_ERR
"%s: b1_loaded: tx err, corrupted t4 file ?\n",
261 b1_put_byte(base
, SEND_POLL
);
262 for (stop
= jiffies
+ tout
* HZ
; time_before(jiffies
, stop
);) {
263 if (b1_rx_full(base
)) {
264 if ((ans
= b1_get_byte(base
)) == RECEIVE_POLL
) {
267 printk(KERN_ERR
"%s: b1_loaded: got 0x%x, firmware not running\n",
272 printk(KERN_ERR
"%s: b1_loaded: firmware not running\n", card
->name
);
276 /* ------------------------------------------------------------- */
278 int b1_load_firmware(struct capi_ctr
*ctrl
, capiloaddata
*data
)
280 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
281 avmcard
*card
= cinfo
->card
;
282 unsigned int port
= card
->port
;
288 if ((retval
= b1_load_t4file(card
, &data
->firmware
))) {
290 printk(KERN_ERR
"%s: failed to load t4file!!\n",
295 b1_disable_irq(port
);
297 if (data
->configuration
.len
> 0 && data
->configuration
.data
) {
298 if ((retval
= b1_load_config(card
, &data
->configuration
))) {
300 printk(KERN_ERR
"%s: failed to load config!!\n",
306 if (!b1_loaded(card
)) {
307 printk(KERN_ERR
"%s: failed to load t4file.\n", card
->name
);
311 spin_lock_irqsave(&card
->lock
, flags
);
312 b1_setinterrupt(port
, card
->irq
, card
->cardtype
);
313 b1_put_byte(port
, SEND_INIT
);
314 b1_put_word(port
, CAPI_MAXAPPL
);
315 b1_put_word(port
, AVM_NCCI_PER_CHANNEL
*2);
316 b1_put_word(port
, ctrl
->cnr
- 1);
317 spin_unlock_irqrestore(&card
->lock
, flags
);
322 void b1_reset_ctr(struct capi_ctr
*ctrl
)
324 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
325 avmcard
*card
= cinfo
->card
;
326 unsigned int port
= card
->port
;
332 memset(cinfo
->version
, 0, sizeof(cinfo
->version
));
333 spin_lock_irqsave(&card
->lock
, flags
);
334 capilib_release(&cinfo
->ncci_head
);
335 spin_unlock_irqrestore(&card
->lock
, flags
);
339 void b1_register_appl(struct capi_ctr
*ctrl
,
341 capi_register_params
*rp
)
343 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
344 avmcard
*card
= cinfo
->card
;
345 unsigned int port
= card
->port
;
347 int nconn
, want
= rp
->level3cnt
;
349 if (want
> 0) nconn
= want
;
350 else nconn
= ctrl
->profile
.nbchannel
* -want
;
351 if (nconn
== 0) nconn
= ctrl
->profile
.nbchannel
;
353 spin_lock_irqsave(&card
->lock
, flags
);
354 b1_put_byte(port
, SEND_REGISTER
);
355 b1_put_word(port
, appl
);
356 b1_put_word(port
, 1024 * (nconn
+1));
357 b1_put_word(port
, nconn
);
358 b1_put_word(port
, rp
->datablkcnt
);
359 b1_put_word(port
, rp
->datablklen
);
360 spin_unlock_irqrestore(&card
->lock
, flags
);
363 void b1_release_appl(struct capi_ctr
*ctrl
, u16 appl
)
365 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
366 avmcard
*card
= cinfo
->card
;
367 unsigned int port
= card
->port
;
370 spin_lock_irqsave(&card
->lock
, flags
);
371 capilib_release_appl(&cinfo
->ncci_head
, appl
);
372 b1_put_byte(port
, SEND_RELEASE
);
373 b1_put_word(port
, appl
);
374 spin_unlock_irqrestore(&card
->lock
, flags
);
377 u16
b1_send_message(struct capi_ctr
*ctrl
, struct sk_buff
*skb
)
379 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
380 avmcard
*card
= cinfo
->card
;
381 unsigned int port
= card
->port
;
383 u16 len
= CAPIMSG_LEN(skb
->data
);
384 u8 cmd
= CAPIMSG_COMMAND(skb
->data
);
385 u8 subcmd
= CAPIMSG_SUBCOMMAND(skb
->data
);
388 spin_lock_irqsave(&card
->lock
, flags
);
389 if (CAPICMD(cmd
, subcmd
) == CAPI_DATA_B3_REQ
) {
390 retval
= capilib_data_b3_req(&cinfo
->ncci_head
,
391 CAPIMSG_APPID(skb
->data
),
392 CAPIMSG_NCCI(skb
->data
),
393 CAPIMSG_MSGID(skb
->data
));
394 if (retval
!= CAPI_NOERROR
) {
395 spin_unlock_irqrestore(&card
->lock
, flags
);
399 dlen
= CAPIMSG_DATALEN(skb
->data
);
401 b1_put_byte(port
, SEND_DATA_B3_REQ
);
402 b1_put_slice(port
, skb
->data
, len
);
403 b1_put_slice(port
, skb
->data
+ len
, dlen
);
405 b1_put_byte(port
, SEND_MESSAGE
);
406 b1_put_slice(port
, skb
->data
, len
);
408 spin_unlock_irqrestore(&card
->lock
, flags
);
410 dev_kfree_skb_any(skb
);
414 /* ------------------------------------------------------------- */
416 void b1_parse_version(avmctrl_info
*cinfo
)
418 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
419 avmcard
*card
= cinfo
->card
;
425 for (j
= 0; j
< AVM_MAXVERSION
; j
++)
426 cinfo
->version
[j
] = "\0\0" + 1;
428 j
< AVM_MAXVERSION
&& i
< cinfo
->versionlen
;
429 j
++, i
+= cinfo
->versionbuf
[i
] + 1)
430 cinfo
->version
[j
] = &cinfo
->versionbuf
[i
+ 1];
432 strlcpy(ctrl
->serial
, cinfo
->version
[VER_SERIAL
], sizeof(ctrl
->serial
));
433 memcpy(&ctrl
->profile
, cinfo
->version
[VER_PROFILE
],sizeof(capi_profile
));
434 strlcpy(ctrl
->manu
, "AVM GmbH", sizeof(ctrl
->manu
));
435 dversion
= cinfo
->version
[VER_DRIVER
];
436 ctrl
->version
.majorversion
= 2;
437 ctrl
->version
.minorversion
= 0;
438 ctrl
->version
.majormanuversion
= (((dversion
[0] - '0') & 0xf) << 4);
439 ctrl
->version
.majormanuversion
|= ((dversion
[2] - '0') & 0xf);
440 ctrl
->version
.minormanuversion
= (dversion
[3] - '0') << 4;
441 ctrl
->version
.minormanuversion
|=
442 (dversion
[5] - '0') * 10 + ((dversion
[6] - '0') & 0xf);
444 profp
= &ctrl
->profile
;
446 flag
= ((u8
*)(profp
->manu
))[1];
448 case 0: if (cinfo
->version
[VER_CARDTYPE
])
449 strcpy(cinfo
->cardname
, cinfo
->version
[VER_CARDTYPE
]);
450 else strcpy(cinfo
->cardname
, "B1");
452 case 3: strcpy(cinfo
->cardname
,"PCMCIA B"); break;
453 case 4: strcpy(cinfo
->cardname
,"PCMCIA M1"); break;
454 case 5: strcpy(cinfo
->cardname
,"PCMCIA M2"); break;
455 case 6: strcpy(cinfo
->cardname
,"B1 V3.0"); break;
456 case 7: strcpy(cinfo
->cardname
,"B1 PCI"); break;
457 default: sprintf(cinfo
->cardname
, "AVM?%u", (unsigned int)flag
); break;
459 printk(KERN_NOTICE
"%s: card %d \"%s\" ready.\n",
460 card
->name
, ctrl
->cnr
, cinfo
->cardname
);
462 flag
= ((u8
*)(profp
->manu
))[3];
464 printk(KERN_NOTICE
"%s: card %d Protocol:%s%s%s%s%s%s%s\n",
467 (flag
& 0x01) ? " DSS1" : "",
468 (flag
& 0x02) ? " CT1" : "",
469 (flag
& 0x04) ? " VN3" : "",
470 (flag
& 0x08) ? " NI1" : "",
471 (flag
& 0x10) ? " AUSTEL" : "",
472 (flag
& 0x20) ? " ESS" : "",
473 (flag
& 0x40) ? " 1TR6" : ""
476 flag
= ((u8
*)(profp
->manu
))[5];
478 printk(KERN_NOTICE
"%s: card %d Linetype:%s%s%s%s\n",
481 (flag
& 0x01) ? " point to point" : "",
482 (flag
& 0x02) ? " point to multipoint" : "",
483 (flag
& 0x08) ? " leased line without D-channel" : "",
484 (flag
& 0x04) ? " leased line with D-channel" : ""
488 /* ------------------------------------------------------------- */
490 irqreturn_t
b1_interrupt(int interrupt
, void *devptr
)
492 avmcard
*card
= devptr
;
493 avmctrl_info
*cinfo
= &card
->ctrlinfo
[0];
494 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
505 spin_lock_irqsave(&card
->lock
, flags
);
507 if (!b1_rx_full(card
->port
)) {
508 spin_unlock_irqrestore(&card
->lock
, flags
);
512 b1cmd
= b1_get_byte(card
->port
);
516 case RECEIVE_DATA_B3_IND
:
518 ApplId
= (unsigned) b1_get_word(card
->port
);
519 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
520 DataB3Len
= b1_get_slice(card
->port
, card
->databuf
);
521 spin_unlock_irqrestore(&card
->lock
, flags
);
523 if (MsgLen
< 30) { /* not CAPI 64Bit */
524 memset(card
->msgbuf
+MsgLen
, 0, 30-MsgLen
);
526 CAPIMSG_SETLEN(card
->msgbuf
, 30);
528 if (!(skb
= alloc_skb(DataB3Len
+ MsgLen
, GFP_ATOMIC
))) {
529 printk(KERN_ERR
"%s: incoming packet dropped\n",
532 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
533 memcpy(skb_put(skb
, DataB3Len
), card
->databuf
, DataB3Len
);
534 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
538 case RECEIVE_MESSAGE
:
540 ApplId
= (unsigned) b1_get_word(card
->port
);
541 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
542 if (!(skb
= alloc_skb(MsgLen
, GFP_ATOMIC
))) {
543 printk(KERN_ERR
"%s: incoming packet dropped\n",
545 spin_unlock_irqrestore(&card
->lock
, flags
);
547 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
548 if (CAPIMSG_CMD(skb
->data
) == CAPI_DATA_B3_CONF
)
549 capilib_data_b3_conf(&cinfo
->ncci_head
, ApplId
,
550 CAPIMSG_NCCI(skb
->data
),
551 CAPIMSG_MSGID(skb
->data
));
552 spin_unlock_irqrestore(&card
->lock
, flags
);
553 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
557 case RECEIVE_NEW_NCCI
:
559 ApplId
= b1_get_word(card
->port
);
560 NCCI
= b1_get_word(card
->port
);
561 WindowSize
= b1_get_word(card
->port
);
562 capilib_new_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
, WindowSize
);
563 spin_unlock_irqrestore(&card
->lock
, flags
);
566 case RECEIVE_FREE_NCCI
:
568 ApplId
= b1_get_word(card
->port
);
569 NCCI
= b1_get_word(card
->port
);
570 if (NCCI
!= 0xffffffff)
571 capilib_free_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
);
572 spin_unlock_irqrestore(&card
->lock
, flags
);
576 /* b1_put_byte(card->port, SEND_POLLACK); */
577 spin_unlock_irqrestore(&card
->lock
, flags
);
578 capi_ctr_resume_output(ctrl
);
582 spin_unlock_irqrestore(&card
->lock
, flags
);
583 capi_ctr_suspend_output(ctrl
);
588 cinfo
->versionlen
= b1_get_slice(card
->port
, cinfo
->versionbuf
);
589 spin_unlock_irqrestore(&card
->lock
, flags
);
590 b1_parse_version(cinfo
);
591 printk(KERN_INFO
"%s: %s-card (%s) now active\n",
593 cinfo
->version
[VER_CARDTYPE
],
594 cinfo
->version
[VER_DRIVER
]);
595 capi_ctr_ready(ctrl
);
598 case RECEIVE_TASK_READY
:
599 ApplId
= (unsigned) b1_get_word(card
->port
);
600 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
601 spin_unlock_irqrestore(&card
->lock
, flags
);
602 card
->msgbuf
[MsgLen
] = 0;
604 && ( card
->msgbuf
[MsgLen
-1] == '\n'
605 || card
->msgbuf
[MsgLen
-1] == '\r')) {
606 card
->msgbuf
[MsgLen
-1] = 0;
609 printk(KERN_INFO
"%s: task %d \"%s\" ready.\n",
610 card
->name
, ApplId
, card
->msgbuf
);
613 case RECEIVE_DEBUGMSG
:
614 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
615 spin_unlock_irqrestore(&card
->lock
, flags
);
616 card
->msgbuf
[MsgLen
] = 0;
618 && ( card
->msgbuf
[MsgLen
-1] == '\n'
619 || card
->msgbuf
[MsgLen
-1] == '\r')) {
620 card
->msgbuf
[MsgLen
-1] = 0;
623 printk(KERN_INFO
"%s: DEBUG: %s\n", card
->name
, card
->msgbuf
);
627 spin_unlock_irqrestore(&card
->lock
, flags
);
628 printk(KERN_ERR
"%s: card removed ?\n", card
->name
);
631 spin_unlock_irqrestore(&card
->lock
, flags
);
632 printk(KERN_ERR
"%s: b1_interrupt: 0x%x ???\n",
639 /* ------------------------------------------------------------- */
640 static int b1ctl_proc_show(struct seq_file
*m
, void *v
)
642 struct capi_ctr
*ctrl
= m
->private;
643 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
644 avmcard
*card
= cinfo
->card
;
648 seq_printf(m
, "%-16s %s\n", "name", card
->name
);
649 seq_printf(m
, "%-16s 0x%x\n", "io", card
->port
);
650 seq_printf(m
, "%-16s %d\n", "irq", card
->irq
);
651 switch (card
->cardtype
) {
652 case avm_b1isa
: s
= "B1 ISA"; break;
653 case avm_b1pci
: s
= "B1 PCI"; break;
654 case avm_b1pcmcia
: s
= "B1 PCMCIA"; break;
655 case avm_m1
: s
= "M1"; break;
656 case avm_m2
: s
= "M2"; break;
657 case avm_t1isa
: s
= "T1 ISA (HEMA)"; break;
658 case avm_t1pci
: s
= "T1 PCI"; break;
659 case avm_c4
: s
= "C4"; break;
660 case avm_c2
: s
= "C2"; break;
661 default: s
= "???"; break;
663 seq_printf(m
, "%-16s %s\n", "type", s
);
664 if (card
->cardtype
== avm_t1isa
)
665 seq_printf(m
, "%-16s %d\n", "cardnr", card
->cardnr
);
666 if ((s
= cinfo
->version
[VER_DRIVER
]) != NULL
)
667 seq_printf(m
, "%-16s %s\n", "ver_driver", s
);
668 if ((s
= cinfo
->version
[VER_CARDTYPE
]) != NULL
)
669 seq_printf(m
, "%-16s %s\n", "ver_cardtype", s
);
670 if ((s
= cinfo
->version
[VER_SERIAL
]) != NULL
)
671 seq_printf(m
, "%-16s %s\n", "ver_serial", s
);
673 if (card
->cardtype
!= avm_m1
) {
674 flag
= ((u8
*)(ctrl
->profile
.manu
))[3];
676 seq_printf(m
, "%-16s%s%s%s%s%s%s%s\n",
678 (flag
& 0x01) ? " DSS1" : "",
679 (flag
& 0x02) ? " CT1" : "",
680 (flag
& 0x04) ? " VN3" : "",
681 (flag
& 0x08) ? " NI1" : "",
682 (flag
& 0x10) ? " AUSTEL" : "",
683 (flag
& 0x20) ? " ESS" : "",
684 (flag
& 0x40) ? " 1TR6" : ""
687 if (card
->cardtype
!= avm_m1
) {
688 flag
= ((u8
*)(ctrl
->profile
.manu
))[5];
690 seq_printf(m
, "%-16s%s%s%s%s\n",
692 (flag
& 0x01) ? " point to point" : "",
693 (flag
& 0x02) ? " point to multipoint" : "",
694 (flag
& 0x08) ? " leased line without D-channel" : "",
695 (flag
& 0x04) ? " leased line with D-channel" : ""
698 seq_printf(m
, "%-16s %s\n", "cardname", cinfo
->cardname
);
703 static int b1ctl_proc_open(struct inode
*inode
, struct file
*file
)
705 return single_open(file
, b1ctl_proc_show
, PDE(inode
)->data
);
708 const struct file_operations b1ctl_proc_fops
= {
709 .owner
= THIS_MODULE
,
710 .open
= b1ctl_proc_open
,
713 .release
= single_release
,
715 EXPORT_SYMBOL(b1ctl_proc_fops
);
717 /* ------------------------------------------------------------- */
722 avmcard_dma_alloc(char *name
, struct pci_dev
*pdev
, long rsize
, long ssize
)
727 p
= kzalloc(sizeof(avmcard_dmainfo
), GFP_KERNEL
);
729 printk(KERN_WARNING
"%s: no memory.\n", name
);
733 p
->recvbuf
.size
= rsize
;
734 buf
= pci_alloc_consistent(pdev
, rsize
, &p
->recvbuf
.dmaaddr
);
736 printk(KERN_WARNING
"%s: allocation of receive dma buffer failed.\n", name
);
739 p
->recvbuf
.dmabuf
= buf
;
741 p
->sendbuf
.size
= ssize
;
742 buf
= pci_alloc_consistent(pdev
, ssize
, &p
->sendbuf
.dmaaddr
);
744 printk(KERN_WARNING
"%s: allocation of send dma buffer failed.\n", name
);
745 goto err_free_consistent
;
748 p
->sendbuf
.dmabuf
= buf
;
749 skb_queue_head_init(&p
->send_queue
);
754 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
755 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
762 void avmcard_dma_free(avmcard_dmainfo
*p
)
764 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
765 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
766 pci_free_consistent(p
->pcidev
, p
->sendbuf
.size
,
767 p
->sendbuf
.dmabuf
, p
->sendbuf
.dmaaddr
);
768 skb_queue_purge(&p
->send_queue
);
772 EXPORT_SYMBOL(avmcard_dma_alloc
);
773 EXPORT_SYMBOL(avmcard_dma_free
);
777 EXPORT_SYMBOL(b1_irq_table
);
779 EXPORT_SYMBOL(b1_alloc_card
);
780 EXPORT_SYMBOL(b1_free_card
);
781 EXPORT_SYMBOL(b1_detect
);
782 EXPORT_SYMBOL(b1_getrevision
);
783 EXPORT_SYMBOL(b1_load_t4file
);
784 EXPORT_SYMBOL(b1_load_config
);
785 EXPORT_SYMBOL(b1_loaded
);
786 EXPORT_SYMBOL(b1_load_firmware
);
787 EXPORT_SYMBOL(b1_reset_ctr
);
788 EXPORT_SYMBOL(b1_register_appl
);
789 EXPORT_SYMBOL(b1_release_appl
);
790 EXPORT_SYMBOL(b1_send_message
);
792 EXPORT_SYMBOL(b1_parse_version
);
793 EXPORT_SYMBOL(b1_interrupt
);
795 static int __init
b1_init(void)
800 if ((p
= strchr(revision
, ':')) != NULL
&& p
[1]) {
801 strlcpy(rev
, p
+ 2, 32);
802 if ((p
= strchr(rev
, '$')) != NULL
&& p
> rev
)
807 printk(KERN_INFO
"b1: revision %s\n", rev
);
812 static void __exit
b1_exit(void)
816 module_init(b1_init
);
817 module_exit(b1_exit
);