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/skbuff.h>
16 #include <linux/delay.h>
18 #include <linux/interrupt.h>
19 #include <linux/ioport.h>
20 #include <linux/capi.h>
21 #include <linux/kernelcapi.h>
23 #include <linux/init.h>
24 #include <asm/uaccess.h>
25 #include <linux/netdevice.h>
26 #include <linux/isdn/capilli.h>
28 #include <linux/isdn/capicmd.h>
29 #include <linux/isdn/capiutil.h>
31 static char *revision
= "$Revision: 1.1.2.2 $";
33 /* ------------------------------------------------------------- */
35 MODULE_DESCRIPTION("CAPI4Linux: Common support for active AVM cards");
36 MODULE_AUTHOR("Carsten Paeth");
37 MODULE_LICENSE("GPL");
39 /* ------------------------------------------------------------- */
41 int b1_irq_table
[16] =
60 /* ------------------------------------------------------------- */
62 avmcard
*b1_alloc_card(int nr_controllers
)
68 card
= kzalloc(sizeof(*card
), GFP_KERNEL
);
72 cinfo
= kzalloc(sizeof(*cinfo
) * nr_controllers
, GFP_KERNEL
);
78 card
->ctrlinfo
= cinfo
;
79 for (i
= 0; i
< nr_controllers
; i
++) {
80 INIT_LIST_HEAD(&cinfo
[i
].ncci_head
);
83 spin_lock_init(&card
->lock
);
84 card
->nr_controllers
= nr_controllers
;
89 /* ------------------------------------------------------------- */
91 void b1_free_card(avmcard
*card
)
93 kfree(card
->ctrlinfo
);
97 /* ------------------------------------------------------------- */
99 int b1_detect(unsigned int base
, enum avmcardtype cardtype
)
104 * Statusregister 0000 00xx
106 if ((inb(base
+ B1_INSTAT
) & 0xfc)
107 || (inb(base
+ B1_OUTSTAT
) & 0xfc))
110 * Statusregister 0000 001x
112 b1outp(base
, B1_INSTAT
, 0x2); /* enable irq */
113 /* b1outp(base, B1_OUTSTAT, 0x2); */
114 if ((inb(base
+ B1_INSTAT
) & 0xfe) != 0x2
115 /* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */)
118 * Statusregister 0000 000x
120 b1outp(base
, B1_INSTAT
, 0x0); /* disable irq */
121 b1outp(base
, B1_OUTSTAT
, 0x0);
122 if ((inb(base
+ B1_INSTAT
) & 0xfe)
123 || (inb(base
+ B1_OUTSTAT
) & 0xfe))
126 for (onoff
= !0, i
= 0; i
< 10 ; i
++) {
127 b1_set_test_bit(base
, cardtype
, onoff
);
128 if (b1_get_test_bit(base
, cardtype
) != onoff
)
133 if (cardtype
== avm_m1
)
136 if ((b1_rd_reg(base
, B1_STAT1(cardtype
)) & 0x0f) != 0x01)
142 void b1_getrevision(avmcard
*card
)
144 card
->class = inb(card
->port
+ B1_ANALYSE
);
145 card
->revision
= inb(card
->port
+ B1_REVISION
);
148 #define FWBUF_SIZE 256
149 int b1_load_t4file(avmcard
*card
, capiloaddatapart
* t4file
)
151 unsigned char buf
[FWBUF_SIZE
];
154 unsigned int base
= card
->port
;
158 while (left
> FWBUF_SIZE
) {
160 if (copy_from_user(buf
, dp
, FWBUF_SIZE
))
163 memcpy(buf
, dp
, FWBUF_SIZE
);
165 for (i
= 0; i
< FWBUF_SIZE
; i
++)
166 if (b1_save_put_byte(base
, buf
[i
]) < 0) {
167 printk(KERN_ERR
"%s: corrupted firmware file ?\n",
176 if (copy_from_user(buf
, dp
, left
))
179 memcpy(buf
, dp
, left
);
181 for (i
= 0; i
< left
; i
++)
182 if (b1_save_put_byte(base
, buf
[i
]) < 0) {
183 printk(KERN_ERR
"%s: corrupted firmware file ?\n",
191 int b1_load_config(avmcard
*card
, capiloaddatapart
* config
)
193 unsigned char buf
[FWBUF_SIZE
];
195 unsigned int base
= card
->port
;
201 b1_put_byte(base
, SEND_CONFIG
);
202 b1_put_word(base
, 1);
203 b1_put_byte(base
, SEND_CONFIG
);
204 b1_put_word(base
, left
);
206 while (left
> FWBUF_SIZE
) {
208 if (copy_from_user(buf
, dp
, FWBUF_SIZE
))
211 memcpy(buf
, dp
, FWBUF_SIZE
);
213 for (i
= 0; i
< FWBUF_SIZE
; ) {
214 b1_put_byte(base
, SEND_CONFIG
);
215 for (j
=0; j
< 4; j
++) {
216 b1_put_byte(base
, buf
[i
++]);
224 if (copy_from_user(buf
, dp
, left
))
227 memcpy(buf
, dp
, left
);
229 for (i
= 0; i
< left
; ) {
230 b1_put_byte(base
, SEND_CONFIG
);
231 for (j
=0; j
< 4; j
++) {
233 b1_put_byte(base
, buf
[i
++]);
235 b1_put_byte(base
, 0);
242 int b1_loaded(avmcard
*card
)
244 unsigned int base
= card
->port
;
247 unsigned long tout
= 2;
249 for (stop
= jiffies
+ tout
* HZ
; time_before(jiffies
, stop
);) {
250 if (b1_tx_empty(base
))
253 if (!b1_tx_empty(base
)) {
254 printk(KERN_ERR
"%s: b1_loaded: tx err, corrupted t4 file ?\n",
258 b1_put_byte(base
, SEND_POLL
);
259 for (stop
= jiffies
+ tout
* HZ
; time_before(jiffies
, stop
);) {
260 if (b1_rx_full(base
)) {
261 if ((ans
= b1_get_byte(base
)) == RECEIVE_POLL
) {
264 printk(KERN_ERR
"%s: b1_loaded: got 0x%x, firmware not running\n",
269 printk(KERN_ERR
"%s: b1_loaded: firmware not running\n", card
->name
);
273 /* ------------------------------------------------------------- */
275 int b1_load_firmware(struct capi_ctr
*ctrl
, capiloaddata
*data
)
277 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
278 avmcard
*card
= cinfo
->card
;
279 unsigned int port
= card
->port
;
285 if ((retval
= b1_load_t4file(card
, &data
->firmware
))) {
287 printk(KERN_ERR
"%s: failed to load t4file!!\n",
292 b1_disable_irq(port
);
294 if (data
->configuration
.len
> 0 && data
->configuration
.data
) {
295 if ((retval
= b1_load_config(card
, &data
->configuration
))) {
297 printk(KERN_ERR
"%s: failed to load config!!\n",
303 if (!b1_loaded(card
)) {
304 printk(KERN_ERR
"%s: failed to load t4file.\n", card
->name
);
308 spin_lock_irqsave(&card
->lock
, flags
);
309 b1_setinterrupt(port
, card
->irq
, card
->cardtype
);
310 b1_put_byte(port
, SEND_INIT
);
311 b1_put_word(port
, CAPI_MAXAPPL
);
312 b1_put_word(port
, AVM_NCCI_PER_CHANNEL
*2);
313 b1_put_word(port
, ctrl
->cnr
- 1);
314 spin_unlock_irqrestore(&card
->lock
, flags
);
319 void b1_reset_ctr(struct capi_ctr
*ctrl
)
321 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
322 avmcard
*card
= cinfo
->card
;
323 unsigned int port
= card
->port
;
329 memset(cinfo
->version
, 0, sizeof(cinfo
->version
));
330 spin_lock_irqsave(&card
->lock
, flags
);
331 capilib_release(&cinfo
->ncci_head
);
332 spin_unlock_irqrestore(&card
->lock
, flags
);
333 capi_ctr_reseted(ctrl
);
336 void b1_register_appl(struct capi_ctr
*ctrl
,
338 capi_register_params
*rp
)
340 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
341 avmcard
*card
= cinfo
->card
;
342 unsigned int port
= card
->port
;
344 int nconn
, want
= rp
->level3cnt
;
346 if (want
> 0) nconn
= want
;
347 else nconn
= ctrl
->profile
.nbchannel
* -want
;
348 if (nconn
== 0) nconn
= ctrl
->profile
.nbchannel
;
350 spin_lock_irqsave(&card
->lock
, flags
);
351 b1_put_byte(port
, SEND_REGISTER
);
352 b1_put_word(port
, appl
);
353 b1_put_word(port
, 1024 * (nconn
+1));
354 b1_put_word(port
, nconn
);
355 b1_put_word(port
, rp
->datablkcnt
);
356 b1_put_word(port
, rp
->datablklen
);
357 spin_unlock_irqrestore(&card
->lock
, flags
);
360 void b1_release_appl(struct capi_ctr
*ctrl
, u16 appl
)
362 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
363 avmcard
*card
= cinfo
->card
;
364 unsigned int port
= card
->port
;
367 spin_lock_irqsave(&card
->lock
, flags
);
368 capilib_release_appl(&cinfo
->ncci_head
, appl
);
369 b1_put_byte(port
, SEND_RELEASE
);
370 b1_put_word(port
, appl
);
371 spin_unlock_irqrestore(&card
->lock
, flags
);
374 u16
b1_send_message(struct capi_ctr
*ctrl
, struct sk_buff
*skb
)
376 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
377 avmcard
*card
= cinfo
->card
;
378 unsigned int port
= card
->port
;
380 u16 len
= CAPIMSG_LEN(skb
->data
);
381 u8 cmd
= CAPIMSG_COMMAND(skb
->data
);
382 u8 subcmd
= CAPIMSG_SUBCOMMAND(skb
->data
);
385 spin_lock_irqsave(&card
->lock
, flags
);
386 if (CAPICMD(cmd
, subcmd
) == CAPI_DATA_B3_REQ
) {
387 retval
= capilib_data_b3_req(&cinfo
->ncci_head
,
388 CAPIMSG_APPID(skb
->data
),
389 CAPIMSG_NCCI(skb
->data
),
390 CAPIMSG_MSGID(skb
->data
));
391 if (retval
!= CAPI_NOERROR
) {
392 spin_unlock_irqrestore(&card
->lock
, flags
);
396 dlen
= CAPIMSG_DATALEN(skb
->data
);
398 b1_put_byte(port
, SEND_DATA_B3_REQ
);
399 b1_put_slice(port
, skb
->data
, len
);
400 b1_put_slice(port
, skb
->data
+ len
, dlen
);
402 b1_put_byte(port
, SEND_MESSAGE
);
403 b1_put_slice(port
, skb
->data
, len
);
405 spin_unlock_irqrestore(&card
->lock
, flags
);
407 dev_kfree_skb_any(skb
);
411 /* ------------------------------------------------------------- */
413 void b1_parse_version(avmctrl_info
*cinfo
)
415 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
416 avmcard
*card
= cinfo
->card
;
422 for (j
= 0; j
< AVM_MAXVERSION
; j
++)
423 cinfo
->version
[j
] = "\0\0" + 1;
425 j
< AVM_MAXVERSION
&& i
< cinfo
->versionlen
;
426 j
++, i
+= cinfo
->versionbuf
[i
] + 1)
427 cinfo
->version
[j
] = &cinfo
->versionbuf
[i
+ 1];
429 strlcpy(ctrl
->serial
, cinfo
->version
[VER_SERIAL
], sizeof(ctrl
->serial
));
430 memcpy(&ctrl
->profile
, cinfo
->version
[VER_PROFILE
],sizeof(capi_profile
));
431 strlcpy(ctrl
->manu
, "AVM GmbH", sizeof(ctrl
->manu
));
432 dversion
= cinfo
->version
[VER_DRIVER
];
433 ctrl
->version
.majorversion
= 2;
434 ctrl
->version
.minorversion
= 0;
435 ctrl
->version
.majormanuversion
= (((dversion
[0] - '0') & 0xf) << 4);
436 ctrl
->version
.majormanuversion
|= ((dversion
[2] - '0') & 0xf);
437 ctrl
->version
.minormanuversion
= (dversion
[3] - '0') << 4;
438 ctrl
->version
.minormanuversion
|=
439 (dversion
[5] - '0') * 10 + ((dversion
[6] - '0') & 0xf);
441 profp
= &ctrl
->profile
;
443 flag
= ((u8
*)(profp
->manu
))[1];
445 case 0: if (cinfo
->version
[VER_CARDTYPE
])
446 strcpy(cinfo
->cardname
, cinfo
->version
[VER_CARDTYPE
]);
447 else strcpy(cinfo
->cardname
, "B1");
449 case 3: strcpy(cinfo
->cardname
,"PCMCIA B"); break;
450 case 4: strcpy(cinfo
->cardname
,"PCMCIA M1"); break;
451 case 5: strcpy(cinfo
->cardname
,"PCMCIA M2"); break;
452 case 6: strcpy(cinfo
->cardname
,"B1 V3.0"); break;
453 case 7: strcpy(cinfo
->cardname
,"B1 PCI"); break;
454 default: sprintf(cinfo
->cardname
, "AVM?%u", (unsigned int)flag
); break;
456 printk(KERN_NOTICE
"%s: card %d \"%s\" ready.\n",
457 card
->name
, ctrl
->cnr
, cinfo
->cardname
);
459 flag
= ((u8
*)(profp
->manu
))[3];
461 printk(KERN_NOTICE
"%s: card %d Protocol:%s%s%s%s%s%s%s\n",
464 (flag
& 0x01) ? " DSS1" : "",
465 (flag
& 0x02) ? " CT1" : "",
466 (flag
& 0x04) ? " VN3" : "",
467 (flag
& 0x08) ? " NI1" : "",
468 (flag
& 0x10) ? " AUSTEL" : "",
469 (flag
& 0x20) ? " ESS" : "",
470 (flag
& 0x40) ? " 1TR6" : ""
473 flag
= ((u8
*)(profp
->manu
))[5];
475 printk(KERN_NOTICE
"%s: card %d Linetype:%s%s%s%s\n",
478 (flag
& 0x01) ? " point to point" : "",
479 (flag
& 0x02) ? " point to multipoint" : "",
480 (flag
& 0x08) ? " leased line without D-channel" : "",
481 (flag
& 0x04) ? " leased line with D-channel" : ""
485 /* ------------------------------------------------------------- */
487 irqreturn_t
b1_interrupt(int interrupt
, void *devptr
)
489 avmcard
*card
= devptr
;
490 avmctrl_info
*cinfo
= &card
->ctrlinfo
[0];
491 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
502 spin_lock_irqsave(&card
->lock
, flags
);
504 if (!b1_rx_full(card
->port
)) {
505 spin_unlock_irqrestore(&card
->lock
, flags
);
509 b1cmd
= b1_get_byte(card
->port
);
513 case RECEIVE_DATA_B3_IND
:
515 ApplId
= (unsigned) b1_get_word(card
->port
);
516 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
517 DataB3Len
= b1_get_slice(card
->port
, card
->databuf
);
518 spin_unlock_irqrestore(&card
->lock
, flags
);
520 if (MsgLen
< 30) { /* not CAPI 64Bit */
521 memset(card
->msgbuf
+MsgLen
, 0, 30-MsgLen
);
523 CAPIMSG_SETLEN(card
->msgbuf
, 30);
525 if (!(skb
= alloc_skb(DataB3Len
+ MsgLen
, GFP_ATOMIC
))) {
526 printk(KERN_ERR
"%s: incoming packet dropped\n",
529 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
530 memcpy(skb_put(skb
, DataB3Len
), card
->databuf
, DataB3Len
);
531 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
535 case RECEIVE_MESSAGE
:
537 ApplId
= (unsigned) b1_get_word(card
->port
);
538 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
539 if (!(skb
= alloc_skb(MsgLen
, GFP_ATOMIC
))) {
540 printk(KERN_ERR
"%s: incoming packet dropped\n",
542 spin_unlock_irqrestore(&card
->lock
, flags
);
544 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
545 if (CAPIMSG_CMD(skb
->data
) == CAPI_DATA_B3_CONF
)
546 capilib_data_b3_conf(&cinfo
->ncci_head
, ApplId
,
547 CAPIMSG_NCCI(skb
->data
),
548 CAPIMSG_MSGID(skb
->data
));
549 spin_unlock_irqrestore(&card
->lock
, flags
);
550 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
554 case RECEIVE_NEW_NCCI
:
556 ApplId
= b1_get_word(card
->port
);
557 NCCI
= b1_get_word(card
->port
);
558 WindowSize
= b1_get_word(card
->port
);
559 capilib_new_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
, WindowSize
);
560 spin_unlock_irqrestore(&card
->lock
, flags
);
563 case RECEIVE_FREE_NCCI
:
565 ApplId
= b1_get_word(card
->port
);
566 NCCI
= b1_get_word(card
->port
);
567 if (NCCI
!= 0xffffffff)
568 capilib_free_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
);
569 spin_unlock_irqrestore(&card
->lock
, flags
);
573 /* b1_put_byte(card->port, SEND_POLLACK); */
574 spin_unlock_irqrestore(&card
->lock
, flags
);
575 capi_ctr_resume_output(ctrl
);
579 spin_unlock_irqrestore(&card
->lock
, flags
);
580 capi_ctr_suspend_output(ctrl
);
585 cinfo
->versionlen
= b1_get_slice(card
->port
, cinfo
->versionbuf
);
586 spin_unlock_irqrestore(&card
->lock
, flags
);
587 b1_parse_version(cinfo
);
588 printk(KERN_INFO
"%s: %s-card (%s) now active\n",
590 cinfo
->version
[VER_CARDTYPE
],
591 cinfo
->version
[VER_DRIVER
]);
592 capi_ctr_ready(ctrl
);
595 case RECEIVE_TASK_READY
:
596 ApplId
= (unsigned) b1_get_word(card
->port
);
597 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
598 spin_unlock_irqrestore(&card
->lock
, flags
);
599 card
->msgbuf
[MsgLen
] = 0;
601 && ( card
->msgbuf
[MsgLen
-1] == '\n'
602 || card
->msgbuf
[MsgLen
-1] == '\r')) {
603 card
->msgbuf
[MsgLen
-1] = 0;
606 printk(KERN_INFO
"%s: task %d \"%s\" ready.\n",
607 card
->name
, ApplId
, card
->msgbuf
);
610 case RECEIVE_DEBUGMSG
:
611 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
612 spin_unlock_irqrestore(&card
->lock
, flags
);
613 card
->msgbuf
[MsgLen
] = 0;
615 && ( card
->msgbuf
[MsgLen
-1] == '\n'
616 || card
->msgbuf
[MsgLen
-1] == '\r')) {
617 card
->msgbuf
[MsgLen
-1] = 0;
620 printk(KERN_INFO
"%s: DEBUG: %s\n", card
->name
, card
->msgbuf
);
624 spin_unlock_irqrestore(&card
->lock
, flags
);
625 printk(KERN_ERR
"%s: card removed ?\n", card
->name
);
628 spin_unlock_irqrestore(&card
->lock
, flags
);
629 printk(KERN_ERR
"%s: b1_interrupt: 0x%x ???\n",
636 /* ------------------------------------------------------------- */
637 int b1ctl_read_proc(char *page
, char **start
, off_t off
,
638 int count
, int *eof
, struct capi_ctr
*ctrl
)
640 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
641 avmcard
*card
= cinfo
->card
;
646 len
+= sprintf(page
+len
, "%-16s %s\n", "name", card
->name
);
647 len
+= sprintf(page
+len
, "%-16s 0x%x\n", "io", card
->port
);
648 len
+= sprintf(page
+len
, "%-16s %d\n", "irq", card
->irq
);
649 switch (card
->cardtype
) {
650 case avm_b1isa
: s
= "B1 ISA"; break;
651 case avm_b1pci
: s
= "B1 PCI"; break;
652 case avm_b1pcmcia
: s
= "B1 PCMCIA"; break;
653 case avm_m1
: s
= "M1"; break;
654 case avm_m2
: s
= "M2"; break;
655 case avm_t1isa
: s
= "T1 ISA (HEMA)"; break;
656 case avm_t1pci
: s
= "T1 PCI"; break;
657 case avm_c4
: s
= "C4"; break;
658 case avm_c2
: s
= "C2"; break;
659 default: s
= "???"; break;
661 len
+= sprintf(page
+len
, "%-16s %s\n", "type", s
);
662 if (card
->cardtype
== avm_t1isa
)
663 len
+= sprintf(page
+len
, "%-16s %d\n", "cardnr", card
->cardnr
);
664 if ((s
= cinfo
->version
[VER_DRIVER
]) != 0)
665 len
+= sprintf(page
+len
, "%-16s %s\n", "ver_driver", s
);
666 if ((s
= cinfo
->version
[VER_CARDTYPE
]) != 0)
667 len
+= sprintf(page
+len
, "%-16s %s\n", "ver_cardtype", s
);
668 if ((s
= cinfo
->version
[VER_SERIAL
]) != 0)
669 len
+= sprintf(page
+len
, "%-16s %s\n", "ver_serial", s
);
671 if (card
->cardtype
!= avm_m1
) {
672 flag
= ((u8
*)(ctrl
->profile
.manu
))[3];
674 len
+= sprintf(page
+len
, "%-16s%s%s%s%s%s%s%s\n",
676 (flag
& 0x01) ? " DSS1" : "",
677 (flag
& 0x02) ? " CT1" : "",
678 (flag
& 0x04) ? " VN3" : "",
679 (flag
& 0x08) ? " NI1" : "",
680 (flag
& 0x10) ? " AUSTEL" : "",
681 (flag
& 0x20) ? " ESS" : "",
682 (flag
& 0x40) ? " 1TR6" : ""
685 if (card
->cardtype
!= avm_m1
) {
686 flag
= ((u8
*)(ctrl
->profile
.manu
))[5];
688 len
+= sprintf(page
+len
, "%-16s%s%s%s%s\n",
690 (flag
& 0x01) ? " point to point" : "",
691 (flag
& 0x02) ? " point to multipoint" : "",
692 (flag
& 0x08) ? " leased line without D-channel" : "",
693 (flag
& 0x04) ? " leased line with D-channel" : ""
696 len
+= sprintf(page
+len
, "%-16s %s\n", "cardname", cinfo
->cardname
);
698 if (off
+count
>= len
)
703 return ((count
< len
-off
) ? count
: len
-off
);
706 /* ------------------------------------------------------------- */
711 avmcard_dma_alloc(char *name
, struct pci_dev
*pdev
, long rsize
, long ssize
)
716 p
= kzalloc(sizeof(avmcard_dmainfo
), GFP_KERNEL
);
718 printk(KERN_WARNING
"%s: no memory.\n", name
);
722 p
->recvbuf
.size
= rsize
;
723 buf
= pci_alloc_consistent(pdev
, rsize
, &p
->recvbuf
.dmaaddr
);
725 printk(KERN_WARNING
"%s: allocation of receive dma buffer failed.\n", name
);
728 p
->recvbuf
.dmabuf
= buf
;
730 p
->sendbuf
.size
= ssize
;
731 buf
= pci_alloc_consistent(pdev
, ssize
, &p
->sendbuf
.dmaaddr
);
733 printk(KERN_WARNING
"%s: allocation of send dma buffer failed.\n", name
);
734 goto err_free_consistent
;
737 p
->sendbuf
.dmabuf
= buf
;
738 skb_queue_head_init(&p
->send_queue
);
743 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
744 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
751 void avmcard_dma_free(avmcard_dmainfo
*p
)
753 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
754 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
755 pci_free_consistent(p
->pcidev
, p
->sendbuf
.size
,
756 p
->sendbuf
.dmabuf
, p
->sendbuf
.dmaaddr
);
757 skb_queue_purge(&p
->send_queue
);
761 EXPORT_SYMBOL(avmcard_dma_alloc
);
762 EXPORT_SYMBOL(avmcard_dma_free
);
766 EXPORT_SYMBOL(b1_irq_table
);
768 EXPORT_SYMBOL(b1_alloc_card
);
769 EXPORT_SYMBOL(b1_free_card
);
770 EXPORT_SYMBOL(b1_detect
);
771 EXPORT_SYMBOL(b1_getrevision
);
772 EXPORT_SYMBOL(b1_load_t4file
);
773 EXPORT_SYMBOL(b1_load_config
);
774 EXPORT_SYMBOL(b1_loaded
);
775 EXPORT_SYMBOL(b1_load_firmware
);
776 EXPORT_SYMBOL(b1_reset_ctr
);
777 EXPORT_SYMBOL(b1_register_appl
);
778 EXPORT_SYMBOL(b1_release_appl
);
779 EXPORT_SYMBOL(b1_send_message
);
781 EXPORT_SYMBOL(b1_parse_version
);
782 EXPORT_SYMBOL(b1_interrupt
);
784 EXPORT_SYMBOL(b1ctl_read_proc
);
786 static int __init
b1_init(void)
791 if ((p
= strchr(revision
, ':')) != 0 && p
[1]) {
792 strlcpy(rev
, p
+ 2, 32);
793 if ((p
= strchr(rev
, '$')) != 0 && p
> rev
)
798 printk(KERN_INFO
"b1: revision %s\n", rev
);
803 static void __exit
b1_exit(void)
807 module_init(b1_init
);
808 module_exit(b1_exit
);