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
= kmalloc(sizeof(*card
), GFP_KERNEL
);
72 memset(card
, 0, sizeof(*card
));
74 cinfo
= kmalloc(sizeof(*cinfo
) * nr_controllers
, GFP_KERNEL
);
79 memset(cinfo
, 0, sizeof(*cinfo
) * nr_controllers
);
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
;
331 memset(cinfo
->version
, 0, sizeof(cinfo
->version
));
332 capilib_release(&cinfo
->ncci_head
);
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 capilib_release_appl(&cinfo
->ncci_head
, appl
);
369 spin_lock_irqsave(&card
->lock
, flags
);
370 b1_put_byte(port
, SEND_RELEASE
);
371 b1_put_word(port
, appl
);
372 spin_unlock_irqrestore(&card
->lock
, flags
);
375 u16
b1_send_message(struct capi_ctr
*ctrl
, struct sk_buff
*skb
)
377 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
378 avmcard
*card
= cinfo
->card
;
379 unsigned int port
= card
->port
;
381 u16 len
= CAPIMSG_LEN(skb
->data
);
382 u8 cmd
= CAPIMSG_COMMAND(skb
->data
);
383 u8 subcmd
= CAPIMSG_SUBCOMMAND(skb
->data
);
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
)
394 dlen
= CAPIMSG_DATALEN(skb
->data
);
396 spin_lock_irqsave(&card
->lock
, flags
);
397 b1_put_byte(port
, SEND_DATA_B3_REQ
);
398 b1_put_slice(port
, skb
->data
, len
);
399 b1_put_slice(port
, skb
->data
+ len
, dlen
);
400 spin_unlock_irqrestore(&card
->lock
, flags
);
402 spin_lock_irqsave(&card
->lock
, flags
);
403 b1_put_byte(port
, SEND_MESSAGE
);
404 b1_put_slice(port
, skb
->data
, len
);
405 spin_unlock_irqrestore(&card
->lock
, flags
);
408 dev_kfree_skb_any(skb
);
412 /* ------------------------------------------------------------- */
414 void b1_parse_version(avmctrl_info
*cinfo
)
416 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
417 avmcard
*card
= cinfo
->card
;
423 for (j
= 0; j
< AVM_MAXVERSION
; j
++)
424 cinfo
->version
[j
] = "\0\0" + 1;
426 j
< AVM_MAXVERSION
&& i
< cinfo
->versionlen
;
427 j
++, i
+= cinfo
->versionbuf
[i
] + 1)
428 cinfo
->version
[j
] = &cinfo
->versionbuf
[i
+ 1];
430 strlcpy(ctrl
->serial
, cinfo
->version
[VER_SERIAL
], sizeof(ctrl
->serial
));
431 memcpy(&ctrl
->profile
, cinfo
->version
[VER_PROFILE
],sizeof(capi_profile
));
432 strlcpy(ctrl
->manu
, "AVM GmbH", sizeof(ctrl
->manu
));
433 dversion
= cinfo
->version
[VER_DRIVER
];
434 ctrl
->version
.majorversion
= 2;
435 ctrl
->version
.minorversion
= 0;
436 ctrl
->version
.majormanuversion
= (((dversion
[0] - '0') & 0xf) << 4);
437 ctrl
->version
.majormanuversion
|= ((dversion
[2] - '0') & 0xf);
438 ctrl
->version
.minormanuversion
= (dversion
[3] - '0') << 4;
439 ctrl
->version
.minormanuversion
|=
440 (dversion
[5] - '0') * 10 + ((dversion
[6] - '0') & 0xf);
442 profp
= &ctrl
->profile
;
444 flag
= ((u8
*)(profp
->manu
))[1];
446 case 0: if (cinfo
->version
[VER_CARDTYPE
])
447 strcpy(cinfo
->cardname
, cinfo
->version
[VER_CARDTYPE
]);
448 else strcpy(cinfo
->cardname
, "B1");
450 case 3: strcpy(cinfo
->cardname
,"PCMCIA B"); break;
451 case 4: strcpy(cinfo
->cardname
,"PCMCIA M1"); break;
452 case 5: strcpy(cinfo
->cardname
,"PCMCIA M2"); break;
453 case 6: strcpy(cinfo
->cardname
,"B1 V3.0"); break;
454 case 7: strcpy(cinfo
->cardname
,"B1 PCI"); break;
455 default: sprintf(cinfo
->cardname
, "AVM?%u", (unsigned int)flag
); break;
457 printk(KERN_NOTICE
"%s: card %d \"%s\" ready.\n",
458 card
->name
, ctrl
->cnr
, cinfo
->cardname
);
460 flag
= ((u8
*)(profp
->manu
))[3];
462 printk(KERN_NOTICE
"%s: card %d Protocol:%s%s%s%s%s%s%s\n",
465 (flag
& 0x01) ? " DSS1" : "",
466 (flag
& 0x02) ? " CT1" : "",
467 (flag
& 0x04) ? " VN3" : "",
468 (flag
& 0x08) ? " NI1" : "",
469 (flag
& 0x10) ? " AUSTEL" : "",
470 (flag
& 0x20) ? " ESS" : "",
471 (flag
& 0x40) ? " 1TR6" : ""
474 flag
= ((u8
*)(profp
->manu
))[5];
476 printk(KERN_NOTICE
"%s: card %d Linetype:%s%s%s%s\n",
479 (flag
& 0x01) ? " point to point" : "",
480 (flag
& 0x02) ? " point to multipoint" : "",
481 (flag
& 0x08) ? " leased line without D-channel" : "",
482 (flag
& 0x04) ? " leased line with D-channel" : ""
486 /* ------------------------------------------------------------- */
488 irqreturn_t
b1_interrupt(int interrupt
, void *devptr
, struct pt_regs
*regs
)
490 avmcard
*card
= devptr
;
491 avmctrl_info
*cinfo
= &card
->ctrlinfo
[0];
492 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
503 spin_lock_irqsave(&card
->lock
, flags
);
505 if (!b1_rx_full(card
->port
)) {
506 spin_unlock_irqrestore(&card
->lock
, flags
);
510 b1cmd
= b1_get_byte(card
->port
);
514 case RECEIVE_DATA_B3_IND
:
516 ApplId
= (unsigned) b1_get_word(card
->port
);
517 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
518 DataB3Len
= b1_get_slice(card
->port
, card
->databuf
);
519 spin_unlock_irqrestore(&card
->lock
, flags
);
521 if (MsgLen
< 30) { /* not CAPI 64Bit */
522 memset(card
->msgbuf
+MsgLen
, 0, 30-MsgLen
);
524 CAPIMSG_SETLEN(card
->msgbuf
, 30);
526 if (!(skb
= alloc_skb(DataB3Len
+ MsgLen
, GFP_ATOMIC
))) {
527 printk(KERN_ERR
"%s: incoming packet dropped\n",
530 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
531 memcpy(skb_put(skb
, DataB3Len
), card
->databuf
, DataB3Len
);
532 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
536 case RECEIVE_MESSAGE
:
538 ApplId
= (unsigned) b1_get_word(card
->port
);
539 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
540 spin_unlock_irqrestore(&card
->lock
, flags
);
541 if (!(skb
= alloc_skb(MsgLen
, GFP_ATOMIC
))) {
542 printk(KERN_ERR
"%s: incoming packet dropped\n",
545 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
546 if (CAPIMSG_CMD(skb
->data
) == CAPI_DATA_B3_CONF
)
547 capilib_data_b3_conf(&cinfo
->ncci_head
, ApplId
,
548 CAPIMSG_NCCI(skb
->data
),
549 CAPIMSG_MSGID(skb
->data
));
551 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
555 case RECEIVE_NEW_NCCI
:
557 ApplId
= b1_get_word(card
->port
);
558 NCCI
= b1_get_word(card
->port
);
559 WindowSize
= b1_get_word(card
->port
);
560 spin_unlock_irqrestore(&card
->lock
, flags
);
562 capilib_new_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
, WindowSize
);
566 case RECEIVE_FREE_NCCI
:
568 ApplId
= b1_get_word(card
->port
);
569 NCCI
= b1_get_word(card
->port
);
570 spin_unlock_irqrestore(&card
->lock
, flags
);
572 if (NCCI
!= 0xffffffff)
573 capilib_free_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
);
578 /* b1_put_byte(card->port, SEND_POLLACK); */
579 spin_unlock_irqrestore(&card
->lock
, flags
);
580 capi_ctr_resume_output(ctrl
);
584 spin_unlock_irqrestore(&card
->lock
, flags
);
585 capi_ctr_suspend_output(ctrl
);
590 cinfo
->versionlen
= b1_get_slice(card
->port
, cinfo
->versionbuf
);
591 spin_unlock_irqrestore(&card
->lock
, flags
);
592 b1_parse_version(cinfo
);
593 printk(KERN_INFO
"%s: %s-card (%s) now active\n",
595 cinfo
->version
[VER_CARDTYPE
],
596 cinfo
->version
[VER_DRIVER
]);
597 capi_ctr_ready(ctrl
);
600 case RECEIVE_TASK_READY
:
601 ApplId
= (unsigned) b1_get_word(card
->port
);
602 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
603 spin_unlock_irqrestore(&card
->lock
, flags
);
604 card
->msgbuf
[MsgLen
] = 0;
606 && ( card
->msgbuf
[MsgLen
-1] == '\n'
607 || card
->msgbuf
[MsgLen
-1] == '\r')) {
608 card
->msgbuf
[MsgLen
-1] = 0;
611 printk(KERN_INFO
"%s: task %d \"%s\" ready.\n",
612 card
->name
, ApplId
, card
->msgbuf
);
615 case RECEIVE_DEBUGMSG
:
616 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
617 spin_unlock_irqrestore(&card
->lock
, flags
);
618 card
->msgbuf
[MsgLen
] = 0;
620 && ( card
->msgbuf
[MsgLen
-1] == '\n'
621 || card
->msgbuf
[MsgLen
-1] == '\r')) {
622 card
->msgbuf
[MsgLen
-1] = 0;
625 printk(KERN_INFO
"%s: DEBUG: %s\n", card
->name
, card
->msgbuf
);
629 spin_unlock_irqrestore(&card
->lock
, flags
);
630 printk(KERN_ERR
"%s: card removed ?\n", card
->name
);
633 spin_unlock_irqrestore(&card
->lock
, flags
);
634 printk(KERN_ERR
"%s: b1_interrupt: 0x%x ???\n",
641 /* ------------------------------------------------------------- */
642 int b1ctl_read_proc(char *page
, char **start
, off_t off
,
643 int count
, int *eof
, struct capi_ctr
*ctrl
)
645 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
646 avmcard
*card
= cinfo
->card
;
651 len
+= sprintf(page
+len
, "%-16s %s\n", "name", card
->name
);
652 len
+= sprintf(page
+len
, "%-16s 0x%x\n", "io", card
->port
);
653 len
+= sprintf(page
+len
, "%-16s %d\n", "irq", card
->irq
);
654 switch (card
->cardtype
) {
655 case avm_b1isa
: s
= "B1 ISA"; break;
656 case avm_b1pci
: s
= "B1 PCI"; break;
657 case avm_b1pcmcia
: s
= "B1 PCMCIA"; break;
658 case avm_m1
: s
= "M1"; break;
659 case avm_m2
: s
= "M2"; break;
660 case avm_t1isa
: s
= "T1 ISA (HEMA)"; break;
661 case avm_t1pci
: s
= "T1 PCI"; break;
662 case avm_c4
: s
= "C4"; break;
663 case avm_c2
: s
= "C2"; break;
664 default: s
= "???"; break;
666 len
+= sprintf(page
+len
, "%-16s %s\n", "type", s
);
667 if (card
->cardtype
== avm_t1isa
)
668 len
+= sprintf(page
+len
, "%-16s %d\n", "cardnr", card
->cardnr
);
669 if ((s
= cinfo
->version
[VER_DRIVER
]) != 0)
670 len
+= sprintf(page
+len
, "%-16s %s\n", "ver_driver", s
);
671 if ((s
= cinfo
->version
[VER_CARDTYPE
]) != 0)
672 len
+= sprintf(page
+len
, "%-16s %s\n", "ver_cardtype", s
);
673 if ((s
= cinfo
->version
[VER_SERIAL
]) != 0)
674 len
+= sprintf(page
+len
, "%-16s %s\n", "ver_serial", s
);
676 if (card
->cardtype
!= avm_m1
) {
677 flag
= ((u8
*)(ctrl
->profile
.manu
))[3];
679 len
+= sprintf(page
+len
, "%-16s%s%s%s%s%s%s%s\n",
681 (flag
& 0x01) ? " DSS1" : "",
682 (flag
& 0x02) ? " CT1" : "",
683 (flag
& 0x04) ? " VN3" : "",
684 (flag
& 0x08) ? " NI1" : "",
685 (flag
& 0x10) ? " AUSTEL" : "",
686 (flag
& 0x20) ? " ESS" : "",
687 (flag
& 0x40) ? " 1TR6" : ""
690 if (card
->cardtype
!= avm_m1
) {
691 flag
= ((u8
*)(ctrl
->profile
.manu
))[5];
693 len
+= sprintf(page
+len
, "%-16s%s%s%s%s\n",
695 (flag
& 0x01) ? " point to point" : "",
696 (flag
& 0x02) ? " point to multipoint" : "",
697 (flag
& 0x08) ? " leased line without D-channel" : "",
698 (flag
& 0x04) ? " leased line with D-channel" : ""
701 len
+= sprintf(page
+len
, "%-16s %s\n", "cardname", cinfo
->cardname
);
703 if (off
+count
>= len
)
708 return ((count
< len
-off
) ? count
: len
-off
);
711 /* ------------------------------------------------------------- */
716 avmcard_dma_alloc(char *name
, struct pci_dev
*pdev
, long rsize
, long ssize
)
721 p
= kmalloc(sizeof(avmcard_dmainfo
), GFP_KERNEL
);
723 printk(KERN_WARNING
"%s: no memory.\n", name
);
726 memset(p
, 0, sizeof(avmcard_dmainfo
));
728 p
->recvbuf
.size
= rsize
;
729 buf
= pci_alloc_consistent(pdev
, rsize
, &p
->recvbuf
.dmaaddr
);
731 printk(KERN_WARNING
"%s: allocation of receive dma buffer failed.\n", name
);
734 p
->recvbuf
.dmabuf
= buf
;
736 p
->sendbuf
.size
= ssize
;
737 buf
= pci_alloc_consistent(pdev
, ssize
, &p
->sendbuf
.dmaaddr
);
739 printk(KERN_WARNING
"%s: allocation of send dma buffer failed.\n", name
);
740 goto err_free_consistent
;
743 p
->sendbuf
.dmabuf
= buf
;
744 skb_queue_head_init(&p
->send_queue
);
749 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
750 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
757 void avmcard_dma_free(avmcard_dmainfo
*p
)
759 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
760 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
761 pci_free_consistent(p
->pcidev
, p
->sendbuf
.size
,
762 p
->sendbuf
.dmabuf
, p
->sendbuf
.dmaaddr
);
763 skb_queue_purge(&p
->send_queue
);
767 EXPORT_SYMBOL(avmcard_dma_alloc
);
768 EXPORT_SYMBOL(avmcard_dma_free
);
772 EXPORT_SYMBOL(b1_irq_table
);
774 EXPORT_SYMBOL(b1_alloc_card
);
775 EXPORT_SYMBOL(b1_free_card
);
776 EXPORT_SYMBOL(b1_detect
);
777 EXPORT_SYMBOL(b1_getrevision
);
778 EXPORT_SYMBOL(b1_load_t4file
);
779 EXPORT_SYMBOL(b1_load_config
);
780 EXPORT_SYMBOL(b1_loaded
);
781 EXPORT_SYMBOL(b1_load_firmware
);
782 EXPORT_SYMBOL(b1_reset_ctr
);
783 EXPORT_SYMBOL(b1_register_appl
);
784 EXPORT_SYMBOL(b1_release_appl
);
785 EXPORT_SYMBOL(b1_send_message
);
787 EXPORT_SYMBOL(b1_parse_version
);
788 EXPORT_SYMBOL(b1_interrupt
);
790 EXPORT_SYMBOL(b1ctl_read_proc
);
792 static int __init
b1_init(void)
797 if ((p
= strchr(revision
, ':')) != 0 && p
[1]) {
798 strlcpy(rev
, p
+ 2, 32);
799 if ((p
= strchr(rev
, '$')) != 0 && p
> rev
)
804 printk(KERN_INFO
"b1: revision %s\n", rev
);
809 static void __exit
b1_exit(void)
813 module_init(b1_init
);
814 module_exit(b1_exit
);