Commit bb257be4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ISDN udpate

From: Karsten Keil <kkeil@suse.de>

- new port of 2.4 I4L core to 2.6

- new port of 2.4 I4L HiSax to 2.6

- fixes for I4L CAPI subsystem to make it stable in 2.6

- fix parameter handling of AVM ISA cards (calle)

- cleanup ISDN config variables

- SMP in act2000 and pcbit driver

- remove check_region in act2000

- mark hysdn, isdnloop and divert as BROKEN_ON_SMP
parent f7d6fe84
...@@ -45,7 +45,7 @@ obj-$(CONFIG_I2C) += i2c/ ...@@ -45,7 +45,7 @@ obj-$(CONFIG_I2C) += i2c/
obj-$(CONFIG_PHONE) += telephony/ obj-$(CONFIG_PHONE) += telephony/
obj-$(CONFIG_MD) += md/ obj-$(CONFIG_MD) += md/
obj-$(CONFIG_BT) += bluetooth/ obj-$(CONFIG_BT) += bluetooth/
obj-$(CONFIG_ISDN_BOOL) += isdn/ obj-$(CONFIG_ISDN) += isdn/
obj-$(CONFIG_MCA) += mca/ obj-$(CONFIG_MCA) += mca/
obj-$(CONFIG_EISA) += eisa/ obj-$(CONFIG_EISA) += eisa/
obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_CPU_FREQ) += cpufreq/
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
menu "ISDN subsystem" menu "ISDN subsystem"
config ISDN_BOOL config ISDN
bool "ISDN support" tristate "ISDN support"
depends on NET depends on NET
---help--- ---help---
ISDN ("Integrated Services Digital Networks", called RNIS in France) ISDN ("Integrated Services Digital Networks", called RNIS in France)
...@@ -22,9 +22,9 @@ config ISDN_BOOL ...@@ -22,9 +22,9 @@ config ISDN_BOOL
menu "Old ISDN4Linux" menu "Old ISDN4Linux"
depends on NET && ISDN_BOOL && BROKEN_ON_SMP depends on NET && ISDN
config ISDN config ISDN_I4L
tristate "Old ISDN4Linux (obsolete)" tristate "Old ISDN4Linux (obsolete)"
---help--- ---help---
This driver allows you to use an ISDN-card for networking This driver allows you to use an ISDN-card for networking
...@@ -41,18 +41,18 @@ config ISDN ...@@ -41,18 +41,18 @@ config ISDN
Therefore the old ISDN4Linux layer is becoming obsolete. It is Therefore the old ISDN4Linux layer is becoming obsolete. It is
still usable, though, if you select this option. still usable, though, if you select this option.
if ISDN if ISDN_I4L
source "drivers/isdn/i4l/Kconfig" source "drivers/isdn/i4l/Kconfig"
endif endif
endmenu endmenu
comment "CAPI subsystem" comment "CAPI subsystem"
depends on NET && ISDN_BOOL depends on NET && ISDN
config ISDN_CAPI config ISDN_CAPI
tristate "CAPI2.0 support" tristate "CAPI2.0 support"
depends on ISDN_BOOL depends on ISDN
help help
This provides the CAPI (Common ISDN Application Programming This provides the CAPI (Common ISDN Application Programming
Interface, a standard making it easy for programs to access ISDN Interface, a standard making it easy for programs to access ISDN
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Object files in subdirectories # Object files in subdirectories
obj-$(CONFIG_ISDN) += i4l/ obj-$(CONFIG_ISDN_I4L) += i4l/
obj-$(CONFIG_ISDN_CAPI) += capi/ obj-$(CONFIG_ISDN_CAPI) += capi/
obj-$(CONFIG_ISDN_CAPI) += hardware/ obj-$(CONFIG_ISDN_CAPI) += hardware/
obj-$(CONFIG_ISDN_DIVERSION) += divert/ obj-$(CONFIG_ISDN_DIVERSION) += divert/
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
config ISDN_DRV_ACT2000 config ISDN_DRV_ACT2000
tristate "IBM Active 2000 support" tristate "IBM Active 2000 support"
depends on ISDN && ISA depends on ISDN_I4L && ISA
help help
Say Y here if you have an IBM Active 2000 ISDN card. In order to use Say Y here if you have an IBM Active 2000 ISDN card. In order to use
this card, additional firmware is necessary, which has to be loaded this card, additional firmware is necessary, which has to be loaded
......
...@@ -152,6 +152,7 @@ typedef struct act2000_card { ...@@ -152,6 +152,7 @@ typedef struct act2000_card {
u_char ptype; /* Protocol type (1TR6 or Euro) */ u_char ptype; /* Protocol type (1TR6 or Euro) */
u_char bus; /* Cardtype (ISA, MCA, PCMCIA) */ u_char bus; /* Cardtype (ISA, MCA, PCMCIA) */
struct act2000_card *next; /* Pointer to next device struct */ struct act2000_card *next; /* Pointer to next device struct */
spinlock_t lock; /* protect critical operations */
int myid; /* Driver-Nr. assigned by linklevel */ int myid; /* Driver-Nr. assigned by linklevel */
unsigned long flags; /* Statusflags */ unsigned long flags; /* Statusflags */
unsigned long ilock; /* Semaphores for IRQ-Routines */ unsigned long ilock; /* Semaphores for IRQ-Routines */
...@@ -166,7 +167,8 @@ typedef struct act2000_card { ...@@ -166,7 +167,8 @@ typedef struct act2000_card {
struct work_struct rcv_tq; /* Task struct for rcv bh */ struct work_struct rcv_tq; /* Task struct for rcv bh */
struct work_struct poll_tq; /* Task struct for polled rcv bh */ struct work_struct poll_tq; /* Task struct for polled rcv bh */
msn_entry *msn_list; msn_entry *msn_list;
unsigned short msgnum; /* Message number fur sending */ unsigned short msgnum; /* Message number for sending */
spinlock_t mnlock; /* lock for msgnum */
act2000_chan bch[ACT2000_BCH]; /* B-Channel status/control */ act2000_chan bch[ACT2000_BCH]; /* B-Channel status/control */
char status_buf[256]; /* Buffer for status messages */ char status_buf[256]; /* Buffer for status messages */
char *status_buf_read; char *status_buf_read;
......
...@@ -21,10 +21,8 @@ static act2000_card *irq2card_map[16]; ...@@ -21,10 +21,8 @@ static act2000_card *irq2card_map[16];
static void static void
act2000_isa_delay(long t) act2000_isa_delay(long t)
{ {
sti();
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(t); schedule_timeout(t);
sti();
} }
/* /*
...@@ -64,8 +62,10 @@ act2000_isa_detect(unsigned short portbase) ...@@ -64,8 +62,10 @@ act2000_isa_detect(unsigned short portbase)
{ {
int ret = 0; int ret = 0;
if (!check_region(portbase, ISA_REGION)) if (request_region(portbase, ACT2000_PORTLEN, "act2000isa")) {
ret = act2000_isa_reset(portbase); ret = act2000_isa_reset(portbase);
release_region(portbase, ISA_REGION);
}
return ret; return ret;
} }
...@@ -177,14 +177,13 @@ act2000_isa_config_port(act2000_card * card, unsigned short portbase) ...@@ -177,14 +177,13 @@ act2000_isa_config_port(act2000_card * card, unsigned short portbase)
release_region(card->port, ISA_REGION); release_region(card->port, ISA_REGION);
card->flags &= ~ACT2000_FLAGS_PVALID; card->flags &= ~ACT2000_FLAGS_PVALID;
} }
if (!check_region(portbase, ISA_REGION)) {
if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL) if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL)
return -EIO; return -EBUSY;
else {
card->port = portbase; card->port = portbase;
card->flags |= ACT2000_FLAGS_PVALID; card->flags |= ACT2000_FLAGS_PVALID;
return 0; return 0;
} }
return -EBUSY;
} }
/* /*
...@@ -195,8 +194,7 @@ act2000_isa_release(act2000_card * card) ...@@ -195,8 +194,7 @@ act2000_isa_release(act2000_card * card)
{ {
unsigned long flags; unsigned long flags;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
if (card->flags & ACT2000_FLAGS_IVALID) { if (card->flags & ACT2000_FLAGS_IVALID) {
free_irq(card->irq, NULL); free_irq(card->irq, NULL);
irq2card_map[card->irq] = NULL; irq2card_map[card->irq] = NULL;
...@@ -205,7 +203,7 @@ act2000_isa_release(act2000_card * card) ...@@ -205,7 +203,7 @@ act2000_isa_release(act2000_card * card)
if (card->flags & ACT2000_FLAGS_PVALID) if (card->flags & ACT2000_FLAGS_PVALID)
release_region(card->port, ISA_REGION); release_region(card->port, ISA_REGION);
card->flags &= ~ACT2000_FLAGS_PVALID; card->flags &= ~ACT2000_FLAGS_PVALID;
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} }
static int static int
...@@ -316,8 +314,7 @@ act2000_isa_send(act2000_card * card) ...@@ -316,8 +314,7 @@ act2000_isa_send(act2000_card * card)
if (test_and_set_bit(ACT2000_LOCK_TX, (void *) &card->ilock) != 0) if (test_and_set_bit(ACT2000_LOCK_TX, (void *) &card->ilock) != 0)
return; return;
while (1) { while (1) {
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
if (!(card->sbuf)) { if (!(card->sbuf)) {
if ((card->sbuf = skb_dequeue(&card->sndq))) { if ((card->sbuf = skb_dequeue(&card->sndq))) {
card->ack_msg = card->sbuf->data; card->ack_msg = card->sbuf->data;
...@@ -330,7 +327,7 @@ act2000_isa_send(act2000_card * card) ...@@ -330,7 +327,7 @@ act2000_isa_send(act2000_card * card)
} }
} }
} }
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
if (!(card->sbuf)) { if (!(card->sbuf)) {
/* No more data to send */ /* No more data to send */
test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock); test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock);
......
...@@ -591,10 +591,9 @@ handle_ack(act2000_card *card, act2000_chan *chan, __u8 blocknr) { ...@@ -591,10 +591,9 @@ handle_ack(act2000_card *card, act2000_chan *chan, __u8 blocknr) {
struct actcapi_msg *m; struct actcapi_msg *m;
int ret = 0; int ret = 0;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
skb = skb_peek(&card->ackq); skb = skb_peek(&card->ackq);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
if (!skb) { if (!skb) {
printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); printk(KERN_WARNING "act2000: handle_ack nothing found!\n");
return 0; return 0;
...@@ -614,10 +613,9 @@ handle_ack(act2000_card *card, act2000_chan *chan, __u8 blocknr) { ...@@ -614,10 +613,9 @@ handle_ack(act2000_card *card, act2000_chan *chan, __u8 blocknr) {
chan->queued = 0; chan->queued = 0;
return ret; return ret;
} }
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
tmp = skb_peek((struct sk_buff_head *)tmp); tmp = skb_peek((struct sk_buff_head *)tmp);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
if ((tmp == skb) || (tmp == NULL)) { if ((tmp == skb) || (tmp == NULL)) {
/* reached end of queue */ /* reached end of queue */
printk(KERN_WARNING "act2000: handle_ack nothing found!\n"); printk(KERN_WARNING "act2000: handle_ack nothing found!\n");
......
...@@ -336,12 +336,11 @@ actcapi_nextsmsg(act2000_card *card) ...@@ -336,12 +336,11 @@ actcapi_nextsmsg(act2000_card *card)
unsigned long flags; unsigned long flags;
unsigned short n; unsigned short n;
save_flags(flags); spin_lock_irqsave(&card->mnlock, flags);
cli();
n = card->msgnum; n = card->msgnum;
card->msgnum++; card->msgnum++;
card->msgnum &= 0x7fff; card->msgnum &= 0x7fff;
restore_flags(flags); spin_unlock_irqrestore(&card->mnlock, flags);
return n; return n;
} }
#define DEBUG_MSG #define DEBUG_MSG
......
...@@ -66,10 +66,9 @@ act2000_clear_msn(act2000_card *card) ...@@ -66,10 +66,9 @@ act2000_clear_msn(act2000_card *card)
struct msn_entry *q; struct msn_entry *q;
unsigned long flags; unsigned long flags;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
card->msn_list = NULL; card->msn_list = NULL;
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
while (p) { while (p) {
q = p->next; q = p->next;
kfree(p); kfree(p);
...@@ -143,13 +142,12 @@ act2000_set_msn(act2000_card *card, char *eazmsn) ...@@ -143,13 +142,12 @@ act2000_set_msn(act2000_card *card, char *eazmsn)
/* Delete a single MSN */ /* Delete a single MSN */
while (p) { while (p) {
if (p->eaz == eazmsn[0]) { if (p->eaz == eazmsn[0]) {
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
if (q) if (q)
q->next = p->next; q->next = p->next;
else else
card->msn_list = p->next; card->msn_list = p->next;
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
kfree(p); kfree(p);
printk(KERN_DEBUG printk(KERN_DEBUG
"Mapping for EAZ %c deleted\n", "Mapping for EAZ %c deleted\n",
...@@ -165,10 +163,9 @@ act2000_set_msn(act2000_card *card, char *eazmsn) ...@@ -165,10 +163,9 @@ act2000_set_msn(act2000_card *card, char *eazmsn)
while (p) { while (p) {
/* Found in list, replace MSN */ /* Found in list, replace MSN */
if (p->eaz == eazmsn[0]) { if (p->eaz == eazmsn[0]) {
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
strcpy(p->msn, &eazmsn[1]); strcpy(p->msn, &eazmsn[1]);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_DEBUG printk(KERN_DEBUG
"Mapping for EAZ %c changed to %s\n", "Mapping for EAZ %c changed to %s\n",
eazmsn[0], eazmsn[0],
...@@ -184,10 +181,9 @@ act2000_set_msn(act2000_card *card, char *eazmsn) ...@@ -184,10 +181,9 @@ act2000_set_msn(act2000_card *card, char *eazmsn)
p->eaz = eazmsn[0]; p->eaz = eazmsn[0];
strcpy(p->msn, &eazmsn[1]); strcpy(p->msn, &eazmsn[1]);
p->next = card->msn_list; p->next = card->msn_list;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
card->msn_list = p; card->msn_list = p;
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_DEBUG printk(KERN_DEBUG
"Mapping %c -> %s added\n", "Mapping %c -> %s added\n",
eazmsn[0], eazmsn[0],
...@@ -232,10 +228,9 @@ act2000_poll(unsigned long data) ...@@ -232,10 +228,9 @@ act2000_poll(unsigned long data)
unsigned long flags; unsigned long flags;
act2000_receive(card); act2000_receive(card);
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
mod_timer(&card->ptimer, jiffies+3); mod_timer(&card->ptimer, jiffies+3);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} }
static int static int
...@@ -311,10 +306,9 @@ act2000_command(act2000_card * card, isdn_ctrl * c) ...@@ -311,10 +306,9 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
return -ENODEV; return -ENODEV;
if (!(chan = find_channel(card, c->arg & 0x0f))) if (!(chan = find_channel(card, c->arg & 0x0f)))
break; break;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
if (chan->fsm_state != ACT2000_STATE_NULL) { if (chan->fsm_state != ACT2000_STATE_NULL) {
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_WARNING "Dial on channel with state %d\n", printk(KERN_WARNING "Dial on channel with state %d\n",
chan->fsm_state); chan->fsm_state);
return -EBUSY; return -EBUSY;
...@@ -325,7 +319,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c) ...@@ -325,7 +319,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
tmp[0] = c->parm.setup.eazmsn[0]; tmp[0] = c->parm.setup.eazmsn[0];
chan->fsm_state = ACT2000_STATE_OCALL; chan->fsm_state = ACT2000_STATE_OCALL;
chan->callref = 0xffff; chan->callref = 0xffff;
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
ret = actcapi_connect_req(card, chan, c->parm.setup.phone, ret = actcapi_connect_req(card, chan, c->parm.setup.phone,
tmp[0], c->parm.setup.si1, tmp[0], c->parm.setup.si1,
c->parm.setup.si2); c->parm.setup.si2);
...@@ -580,6 +574,8 @@ act2000_alloccard(int bus, int port, int irq, char *id) ...@@ -580,6 +574,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
return; return;
} }
memset((char *) card, 0, sizeof(act2000_card)); memset((char *) card, 0, sizeof(act2000_card));
spin_lock_init(&card->lock);
spin_lock_init(&card->mnlock);
skb_queue_head_init(&card->sndq); skb_queue_head_init(&card->sndq);
skb_queue_head_init(&card->rcvq); skb_queue_head_init(&card->rcvq);
skb_queue_head_init(&card->ackq); skb_queue_head_init(&card->ackq);
......
...@@ -44,7 +44,7 @@ config ISDN_CAPI_CAPIFS ...@@ -44,7 +44,7 @@ config ISDN_CAPI_CAPIFS
config ISDN_CAPI_CAPIDRV config ISDN_CAPI_CAPIDRV
tristate "CAPI2.0 capidrv interface support" tristate "CAPI2.0 capidrv interface support"
depends on ISDN_CAPI && ISDN depends on ISDN_CAPI && ISDN_I4L
help help
This option provides the glue code to hook up CAPI driven cards to This option provides the glue code to hook up CAPI driven cards to
the legacy isdn4linux link layer. If you have a card which is the legacy isdn4linux link layer. If you have a card which is
......
/* $Id: capi.c,v 1.1.4.1.2.2 2001/12/21 15:00:17 kai Exp $ /* $Id: capi.c,v 1.1.2.3 2004/01/16 21:09:26 keil Exp $
* *
* CAPI 2.0 Interface for Linux * CAPI 2.0 Interface for Linux
* *
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include "capifs.h" #include "capifs.h"
#endif #endif
static char *revision = "$Revision: 1.1.4.1.2.2 $"; static char *revision = "$Revision: 1.1.2.3 $";
MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface"); MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
...@@ -220,6 +220,10 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) ...@@ -220,6 +220,10 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
skb_queue_head_init(&mp->outqueue); skb_queue_head_init(&mp->outqueue);
write_lock_irqsave(&capiminor_list_lock, flags); write_lock_irqsave(&capiminor_list_lock, flags);
if (list_empty(&capiminor_list)) {
list_add(&mp->list, &capiminor_list);
write_unlock_irqrestore(&capiminor_list_lock, flags);
} else {
list_for_each(l, &capiminor_list) { list_for_each(l, &capiminor_list) {
p = list_entry(l, struct capiminor, list); p = list_entry(l, struct capiminor, list);
if (p->minor > minor) { if (p->minor > minor) {
...@@ -234,6 +238,7 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) ...@@ -234,6 +238,7 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
kfree(mp); kfree(mp);
return NULL; return NULL;
} }
}
return mp; return mp;
} }
...@@ -297,7 +302,7 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci) ...@@ -297,7 +302,7 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
printk(KERN_DEBUG "set mp->nccip\n"); printk(KERN_DEBUG "set mp->nccip\n");
#endif #endif
#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
capifs_new_ncci(0, mp->minor, MKDEV(capi_ttymajor, mp->minor)); capifs_new_ncci(mp->minor, MKDEV(capi_ttymajor, mp->minor));
#endif #endif
} }
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
...@@ -322,8 +327,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci) ...@@ -322,8 +327,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci)
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
if ((mp = np->minorp) != 0) { if ((mp = np->minorp) != 0) {
#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
capifs_free_ncci('r', mp->minor); capifs_free_ncci(mp->minor);
capifs_free_ncci(0, mp->minor);
#endif #endif
if (mp->tty) { if (mp->tty) {
mp->nccip = 0; mp->nccip = 0;
......
/* $Id: capidrv.c,v 1.39.6.7 2001/09/23 22:24:33 kai Exp $ /* $Id: capidrv.c,v 1.1.2.2 2004/01/12 23:17:24 keil Exp $
* *
* ISDN4Linux Driver, using capi20 interface (kernelcapi) * ISDN4Linux Driver, using capi20 interface (kernelcapi)
* *
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <linux/isdn/capicmd.h> #include <linux/isdn/capicmd.h>
#include "capidrv.h" #include "capidrv.h"
static char *revision = "$Revision: 1.39.6.7 $"; static char *revision = "$Revision: 1.1.2.2 $";
static int debugmode = 0; static int debugmode = 0;
MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux"); MODULE_DESCRIPTION("CAPI4Linux: Interface to ISDN4Linux");
...@@ -1263,6 +1263,10 @@ static void handle_ncci(_cmsg * cmsg) ...@@ -1263,6 +1263,10 @@ static void handle_ncci(_cmsg * cmsg)
goto ignored; goto ignored;
case CAPI_DATA_B3_CONF: /* ncci */ case CAPI_DATA_B3_CONF: /* ncci */
if (cmsg->Info) {
printk(KERN_WARNING "CAPI_DATA_B3_CONF: Info %x - %s\n",
cmsg->Info, capi_info2str(cmsg->Info));
}
if (!(nccip = find_ncci(card, cmsg->adr.adrNCCI))) if (!(nccip = find_ncci(card, cmsg->adr.adrNCCI)))
goto notfound; goto notfound;
...@@ -1368,7 +1372,7 @@ static _cmsg s_cmsg; ...@@ -1368,7 +1372,7 @@ static _cmsg s_cmsg;
static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb) static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{ {
capi_message2cmsg(&s_cmsg, skb->data); capi_message2cmsg(&s_cmsg, skb->data);
if (debugmode > 2) if (debugmode > 3)
printk(KERN_DEBUG "capidrv_signal: applid=%d %s\n", printk(KERN_DEBUG "capidrv_signal: applid=%d %s\n",
ap->applid, capi_cmsg2str(&s_cmsg)); ap->applid, capi_cmsg2str(&s_cmsg));
...@@ -1825,7 +1829,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1825,7 +1829,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
id); id);
return 0; return 0;
} }
if (debugmode > 1) if (debugmode > 4)
printk(KERN_DEBUG "capidrv-%d: sendbuf len=%d skb=%p doack=%d\n", printk(KERN_DEBUG "capidrv-%d: sendbuf len=%d skb=%p doack=%d\n",
card->contrnr, len, skb, doack); card->contrnr, len, skb, doack);
bchan = &card->bchans[channel % card->nbchan]; bchan = &card->bchans[channel % card->nbchan];
...@@ -1866,6 +1870,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1866,6 +1870,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
nccip->datahandle++; nccip->datahandle++;
return len; return len;
} }
if (debugmode > 3)
printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n",
card->contrnr, errcode, capi_info2str(errcode));
(void)capidrv_del_ack(nccip, datahandle); (void)capidrv_del_ack(nccip, datahandle);
dev_kfree_skb(nskb); dev_kfree_skb(nskb);
return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; return errcode == CAPI_SENDQUEUEFULL ? 0 : -1;
...@@ -1876,6 +1883,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1876,6 +1883,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
nccip->datahandle++; nccip->datahandle++;
return len; return len;
} }
if (debugmode > 3)
printk(KERN_DEBUG "capidrv-%d: sendbuf putmsg ret(%x) - %s\n",
card->contrnr, errcode, capi_info2str(errcode));
skb_pull(skb, msglen); skb_pull(skb, msglen);
(void)capidrv_del_ack(nccip, datahandle); (void)capidrv_del_ack(nccip, datahandle);
return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; return errcode == CAPI_SENDQUEUEFULL ? 0 : -1;
......
/* $Id: capifs.c,v 1.14.6.8 2001/09/23 22:24:33 kai Exp $ /* $Id: capifs.c,v 1.1.2.3 2004/01/16 21:09:26 keil Exp $
* *
* Copyright 2000 by Carsten Paeth <calle@calle.de> * Copyright 2000 by Carsten Paeth <calle@calle.de>
* *
...@@ -20,99 +20,75 @@ MODULE_DESCRIPTION("CAPI4Linux: /dev/capi/ filesystem"); ...@@ -20,99 +20,75 @@ MODULE_DESCRIPTION("CAPI4Linux: /dev/capi/ filesystem");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static char *revision = "$Revision: 1.14.6.8 $"; /* ------------------------------------------------------------------ */
static char *revision = "$Revision: 1.1.2.3 $";
/* ------------------------------------------------------------------ */
#define CAPIFS_SUPER_MAGIC (('C'<<8)|'N')
static struct vfsmount *capifs_mnt;
static struct dentry *capifs_root;
struct options { static struct {
int setuid; int setuid;
int setgid; int setgid;
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
umode_t mode; umode_t mode;
}; } config = {.mode = 0600};
static struct options options = {.mode = 0600};
#define CAPIFS_SUPER_MAGIC (('C'<<8)|'N')
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static int capifs_remount(struct super_block *s, int *flags, char *data)
static int capifs_parse_options(char *s, struct options *p)
{ {
int setuid = 0; int setuid = 0;
int setgid = 0; int setgid = 0;
uid_t uid = 0; uid_t uid = 0;
gid_t gid = 0; gid_t gid = 0;
umode_t mode = 0600; umode_t mode = 0600;
char *this_char, *value; char *this_char;
if (!s)
return 0;
while ((this_char = strsep(&s, ",")) != NULL) { this_char = NULL;
while ((this_char = strsep(&data, ",")) != NULL) {
int n;
char dummy;
if (!*this_char) if (!*this_char)
continue; continue;
if ((value = strchr(this_char,'=')) != NULL) if (sscanf(this_char, "uid=%i%c", &n, &dummy) == 1) {
*value++ = 0;
if (!strcmp(this_char,"uid")) {
if (!value || !*value)
return 1;
uid = simple_strtoul(value,&value,0);
if (*value)
return 1;
setuid = 1; setuid = 1;
} uid = n;
else if (!strcmp(this_char,"gid")) { } else if (sscanf(this_char, "gid=%i%c", &n, &dummy) == 1) {
if (!value || !*value)
return 1;
gid = simple_strtoul(value,&value,0);
if (*value)
return 1;
setgid = 1; setgid = 1;
} gid = n;
else if (!strcmp(this_char,"mode")) { } else if (sscanf(this_char, "mode=%o%c", &n, &dummy) == 1)
if (!value || !*value) mode = n & ~S_IFMT;
return 1; else {
mode = simple_strtoul(value,&value,8);
if (*value)
return 1;
}
}
p->setuid = setuid;
p->setgid = setgid;
p->uid = uid;
p->gid = gid;
p->mode = mode & ~S_IFMT;
return 0;
}
static int capifs_remount(struct super_block *s, int *flags, char *data)
{
struct options new;
if (capifs_parse_options(data, &new)) {
printk("capifs: called with bogus options\n"); printk("capifs: called with bogus options\n");
return -EINVAL; return -EINVAL;
} }
options = new; }
config.setuid = setuid;
config.setgid = setgid;
config.uid = uid;
config.gid = gid;
config.mode = mode;
return 0; return 0;
} }
static struct super_operations capifs_sops = static struct super_operations capifs_sops =
{ {
.statfs = simple_statfs, .statfs = simple_statfs,
.remount_fs = capifs_remount, .remount_fs = capifs_remount,
}; };
static int capifs_fill_super(struct super_block *s, void *data, int silent)
static int
capifs_fill_super(struct super_block *s, void *data, int silent)
{ {
struct inode * inode; struct inode * inode;
if (capifs_parse_options(data, &options)) {
printk("capifs: called with bogus options\n");
return -EINVAL;
}
s->s_blocksize = 1024; s->s_blocksize = 1024;
s->s_blocksize_bits = 10; s->s_blocksize_bits = 10;
s->s_magic = CAPIFS_SUPER_MAGIC; s->s_magic = CAPIFS_SUPER_MAGIC;
...@@ -120,24 +96,25 @@ static int capifs_fill_super(struct super_block *s, void *data, int silent) ...@@ -120,24 +96,25 @@ static int capifs_fill_super(struct super_block *s, void *data, int silent)
inode = new_inode(s); inode = new_inode(s);
if (!inode) if (!inode)
return -ENOMEM; goto fail;
inode->i_ino = 1;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_blksize = 1024; inode->i_blksize = 1024;
inode->i_uid = inode->i_gid = 0; inode->i_uid = inode->i_gid = 0;
inode->i_ino = 1;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations; inode->i_fop = &simple_dir_operations;
inode->i_nlink = 2; inode->i_nlink = 2;
s->s_root = d_alloc_root(inode);
if (!s->s_root) { capifs_root = s->s_root = d_alloc_root(inode);
if (s->s_root)
return 0;
printk("capifs: get root dentry failed\n"); printk("capifs: get root dentry failed\n");
iput(inode); iput(inode);
fail:
return -ENOMEM; return -ENOMEM;
}
return 0;
} }
static struct super_block *capifs_get_sb(struct file_system_type *fs_type, static struct super_block *capifs_get_sb(struct file_system_type *fs_type,
...@@ -153,78 +130,48 @@ static struct file_system_type capifs_fs_type = { ...@@ -153,78 +130,48 @@ static struct file_system_type capifs_fs_type = {
.kill_sb = kill_anon_super, .kill_sb = kill_anon_super,
}; };
static struct vfsmount *capifs_mnt; static struct dentry *get_node(int num)
static int entry_count;
static int grab_instance(void)
{
return simple_pin_fs("capifs", &capifs_mnt, &entry_count);
}
static void drop_instance(void)
{
return simple_release_fs(&capifs_mnt, &entry_count);
}
static struct dentry *get_node(int type, int num)
{ {
char s[10]; char s[10];
int len; struct dentry *root = capifs_root;
struct dentry *root = capifs_mnt->mnt_root;
if (type)
len = sprintf(s, "%d", num);
else
len = sprintf(s, "%c%d", type, num);
down(&root->d_inode->i_sem); down(&root->d_inode->i_sem);
return lookup_one_len(s, root, len); return lookup_one_len(s, root, sprintf(s, "%d", num));
} }
void capifs_new_ncci(char type, unsigned int num, dev_t device) void capifs_new_ncci(unsigned int number, dev_t device)
{ {
struct super_block *sb;
struct dentry *dentry; struct dentry *dentry;
struct inode *inode; struct inode *inode = new_inode(capifs_mnt->mnt_sb);
if (!inode)
if (grab_instance() < 0)
return; return;
sb = capifs_mnt->mnt_sb; inode->i_ino = number+2;
inode = new_inode(sb);
if (inode) {
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_blocks = 0;
inode->i_blksize = 1024; inode->i_blksize = 1024;
inode->i_uid = options.setuid ? options.uid : current->fsuid; inode->i_uid = config.setuid ? config.uid : current->fsuid;
inode->i_gid = options.setgid ? options.gid : current->fsgid; inode->i_gid = config.setgid ? config.gid : current->fsgid;
inode->i_nlink = 1; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
init_special_inode(inode, S_IFCHR | options.mode, device); init_special_inode(inode, S_IFCHR|config.mode, device);
dentry = get_node(type, num); //inode->i_op = &capifs_file_inode_operations;
if (!IS_ERR(dentry) && !dentry->d_inode) {
grab_instance(); dentry = get_node(number);
if (!IS_ERR(dentry) && !dentry->d_inode)
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
} else up(&capifs_root->d_inode->i_sem);
iput(inode);
up(&sb->s_root->d_inode->i_sem);
}
drop_instance();
} }
void capifs_free_ncci(char type, unsigned int num) void capifs_free_ncci(unsigned int number)
{ {
if (grab_instance() == 0) { struct dentry *dentry = get_node(number);
struct dentry *dentry = get_node(type, num);
if (!IS_ERR(dentry)) { if (!IS_ERR(dentry)) {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
if (inode) { if (inode) {
inode->i_nlink--; inode->i_nlink--;
d_delete(dentry); d_delete(dentry);
dput(dentry); dput(dentry);
drop_instance();
} }
dput(dentry); dput(dentry);
} }
up(&capifs_mnt->mnt_root->d_inode->i_sem); up(&capifs_root->d_inode->i_sem);
drop_instance();
}
} }
static int __init capifs_init(void) static int __init capifs_init(void)
...@@ -241,14 +188,20 @@ static int __init capifs_init(void) ...@@ -241,14 +188,20 @@ static int __init capifs_init(void)
strcpy(rev, "1.0"); strcpy(rev, "1.0");
err = register_filesystem(&capifs_fs_type); err = register_filesystem(&capifs_fs_type);
if (!err) {
capifs_mnt = kern_mount(&capifs_fs_type);
if (IS_ERR(capifs_mnt))
err = PTR_ERR(capifs_mnt);
}
if (!err) if (!err)
printk(KERN_NOTICE "capifs: Rev %s\n", rev); printk(KERN_NOTICE "capifs: Rev %s\n", rev);
return 0; return err;
} }
static void __exit capifs_exit(void) static void __exit capifs_exit(void)
{ {
unregister_filesystem(&capifs_fs_type); unregister_filesystem(&capifs_fs_type);
mntput(capifs_mnt);
} }
EXPORT_SYMBOL(capifs_new_ncci); EXPORT_SYMBOL(capifs_new_ncci);
......
/* $Id: capifs.h,v 1.2.6.2 2001/09/23 22:24:33 kai Exp $ /* $Id: capifs.h,v 1.1.2.2 2004/01/16 21:09:26 keil Exp $
* *
* Copyright 2000 by Carsten Paeth <calle@calle.de> * Copyright 2000 by Carsten Paeth <calle@calle.de>
* *
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
* *
*/ */
void capifs_new_ncci(char type, unsigned int num, dev_t device); void capifs_new_ncci(unsigned int num, dev_t device);
void capifs_free_ncci(char type, unsigned int num); void capifs_free_ncci(unsigned int num);
/* $Id: kcapi.c,v 1.21.6.8 2001/09/23 22:24:33 kai Exp $ /* $Id: kcapi.c,v 1.1.2.4 2004/02/10 01:07:11 keil Exp $
* *
* Kernel CAPI 2.0 Module * Kernel CAPI 2.0 Module
* *
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <linux/b1lli.h> #include <linux/b1lli.h>
#endif #endif
static char *revision = "$Revision: 1.21.6.8 $"; static char *revision = "$Revision: 1.1.2.4 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -61,7 +61,7 @@ static char capi_manufakturer[64] = "AVM Berlin"; ...@@ -61,7 +61,7 @@ static char capi_manufakturer[64] = "AVM Berlin";
#define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f) #define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f)
LIST_HEAD(capi_drivers); LIST_HEAD(capi_drivers);
spinlock_t capi_drivers_lock = SPIN_LOCK_UNLOCKED; rwlock_t capi_drivers_list_lock = RW_LOCK_UNLOCKED;
struct capi20_appl *capi_applications[CAPI_MAXAPPL]; struct capi20_appl *capi_applications[CAPI_MAXAPPL];
struct capi_ctr *capi_cards[CAPI_MAXCONTR]; struct capi_ctr *capi_cards[CAPI_MAXCONTR];
...@@ -309,12 +309,10 @@ static void recv_handler(void *dummy) ...@@ -309,12 +309,10 @@ static void recv_handler(void *dummy)
continue; continue;
} }
if ( CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_IND)
&& CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
ap->nrecvdatapkt++; ap->nrecvdatapkt++;
} else { else
ap->nrecvctlpkt++; ap->nrecvctlpkt++;
}
ap->recv_message(ap, skb); ap->recv_message(ap, skb);
} }
} }
...@@ -498,6 +496,28 @@ int detach_capi_ctr(struct capi_ctr *card) ...@@ -498,6 +496,28 @@ int detach_capi_ctr(struct capi_ctr *card)
EXPORT_SYMBOL(detach_capi_ctr); EXPORT_SYMBOL(detach_capi_ctr);
void register_capi_driver(struct capi_driver *driver)
{
unsigned long flags;
write_lock_irqsave(&capi_drivers_list_lock, flags);
list_add_tail(&driver->list, &capi_drivers);
write_unlock_irqrestore(&capi_drivers_list_lock, flags);
}
EXPORT_SYMBOL(register_capi_driver);
void unregister_capi_driver(struct capi_driver *driver)
{
unsigned long flags;
write_lock_irqsave(&capi_drivers_list_lock, flags);
list_del(&driver->list);
write_unlock_irqrestore(&capi_drivers_list_lock, flags);
}
EXPORT_SYMBOL(unregister_capi_driver);
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* -------- CAPI2.0 Interface ---------------------------------- */ /* -------- CAPI2.0 Interface ---------------------------------- */
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -704,12 +724,68 @@ EXPORT_SYMBOL(capi20_get_profile); ...@@ -704,12 +724,68 @@ EXPORT_SYMBOL(capi20_get_profile);
static int old_capi_manufacturer(unsigned int cmd, void *data) static int old_capi_manufacturer(unsigned int cmd, void *data)
{ {
avmb1_loadandconfigdef ldef; avmb1_loadandconfigdef ldef;
avmb1_extcarddef cdef;
avmb1_resetdef rdef; avmb1_resetdef rdef;
capicardparams cparams;
struct capi_ctr *card; struct capi_ctr *card;
struct capi_driver *driver = 0;
capiloaddata ldata; capiloaddata ldata;
struct list_head *l;
unsigned long flags;
int retval; int retval;
switch (cmd) { switch (cmd) {
case AVMB1_ADDCARD:
case AVMB1_ADDCARD_WITH_TYPE:
if (cmd == AVMB1_ADDCARD) {
if ((retval = copy_from_user((void *) &cdef, data,
sizeof(avmb1_carddef))))
return retval;
cdef.cardtype = AVM_CARDTYPE_B1;
} else {
if ((retval = copy_from_user((void *) &cdef, data,
sizeof(avmb1_extcarddef))))
return retval;
}
cparams.port = cdef.port;
cparams.irq = cdef.irq;
cparams.cardnr = cdef.cardnr;
read_lock_irqsave(&capi_drivers_list_lock, flags);
switch (cdef.cardtype) {
case AVM_CARDTYPE_B1:
list_for_each(l, &capi_drivers) {
driver = list_entry(l, struct capi_driver, list);
if (strcmp(driver->name, "b1isa") == 0)
break;
}
break;
case AVM_CARDTYPE_T1:
list_for_each(l, &capi_drivers) {
driver = list_entry(l, struct capi_driver, list);
if (strcmp(driver->name, "t1isa") == 0)
break;
}
break;
default:
driver = 0;
break;
}
if (!driver) {
read_unlock_irqrestore(&capi_drivers_list_lock, flags);
printk(KERN_ERR "kcapi: driver not loaded.\n");
return -EIO;
}
if (!driver->add_card) {
read_unlock_irqrestore(&capi_drivers_list_lock, flags);
printk(KERN_ERR "kcapi: driver has no add card function.\n");
return -EIO;
}
retval = driver->add_card(driver, &cparams);
read_unlock_irqrestore(&capi_drivers_list_lock, flags);
return retval;
case AVMB1_LOAD: case AVMB1_LOAD:
case AVMB1_LOAD_AND_CONFIG: case AVMB1_LOAD_AND_CONFIG:
...@@ -832,6 +908,43 @@ int capi20_manufacturer(unsigned int cmd, void *data) ...@@ -832,6 +908,43 @@ int capi20_manufacturer(unsigned int cmd, void *data)
card->cnr, card->traceflag); card->cnr, card->traceflag);
return 0; return 0;
} }
case KCAPI_CMD_ADDCARD:
{
struct list_head *l;
struct capi_driver *driver = 0;
capicardparams cparams;
kcapi_carddef cdef;
int retval;
if ((retval = copy_from_user((void *) &cdef, data,
sizeof(cdef))))
return retval;
cparams.port = cdef.port;
cparams.irq = cdef.irq;
cparams.membase = cdef.membase;
cparams.cardnr = cdef.cardnr;
cparams.cardtype = 0;
cdef.driver[sizeof(cdef.driver)-1] = 0;
list_for_each(l, &capi_drivers) {
driver = list_entry(l, struct capi_driver, list);
if (strcmp(driver->name, cdef.driver) == 0)
break;
}
if (driver == 0) {
printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n",
cdef.driver);
return -ESRCH;
}
if (!driver->add_card) {
printk(KERN_ERR "kcapi: driver \"%s\" has no add card function.\n", cdef.driver);
return -EIO;
}
return driver->add_card(driver, &cparams);
}
default: default:
printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n", printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n",
......
...@@ -15,10 +15,13 @@ ...@@ -15,10 +15,13 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/isdn/capilli.h> #include <linux/isdn/capilli.h>
#ifdef KCAPI_DEBUG
#define DBG(format, arg...) do { \ #define DBG(format, arg...) do { \
printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \ printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \
} while (0) } while (0)
#else
#define DBG(format, arg...) /* */
#endif
enum { enum {
CARD_DETECTED = 1, CARD_DETECTED = 1,
...@@ -27,7 +30,7 @@ enum { ...@@ -27,7 +30,7 @@ enum {
}; };
extern struct list_head capi_drivers; extern struct list_head capi_drivers;
extern spinlock_t capi_drivers_lock; extern rwlock_t capi_drivers_list_lock;
extern struct capi20_appl *capi_applications[CAPI_MAXAPPL]; extern struct capi20_appl *capi_applications[CAPI_MAXAPPL];
extern struct capi_ctr *capi_cards[CAPI_MAXCONTR]; extern struct capi_ctr *capi_cards[CAPI_MAXCONTR];
......
...@@ -243,16 +243,84 @@ create_seq_entry(char *name, mode_t mode, struct file_operations *f) ...@@ -243,16 +243,84 @@ create_seq_entry(char *name, mode_t mode, struct file_operations *f)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
static __inline__ struct capi_driver *capi_driver_get_idx(loff_t pos)
{
struct capi_driver *drv = 0;
struct list_head *l;
loff_t i;
i = 0;
list_for_each(l, &capi_drivers) {
drv = list_entry(l, struct capi_driver, list);
if (i++ == pos)
return drv;
}
return 0;
}
static void *capi_driver_start(struct seq_file *seq, loff_t *pos)
{
struct capi_driver *drv;
read_lock(&capi_drivers_list_lock);
drv = capi_driver_get_idx(*pos);
return drv;
}
static void *capi_driver_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct capi_driver *drv = (struct capi_driver *)v;
++*pos;
if (drv->list.next == &capi_drivers) return 0;
return list_entry(drv->list.next, struct capi_driver, list);
}
static void capi_driver_stop(struct seq_file *seq, void *v)
{
read_unlock(&capi_drivers_list_lock);
}
static int capi_driver_show(struct seq_file *seq, void *v)
{
struct capi_driver *drv = (struct capi_driver *)v;
seq_printf(seq, "%-32s %s\n", drv->name, drv->revision);
return 0;
}
struct seq_operations seq_capi_driver_ops = {
.start = capi_driver_start,
.next = capi_driver_next,
.stop = capi_driver_stop,
.show = capi_driver_show,
};
static int
seq_capi_driver_open(struct inode *inode, struct file *file)
{
int err;
err = seq_open(file, &seq_capi_driver_ops);
return err;
}
static struct file_operations proc_driver_ops = {
.open = seq_capi_driver_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
// ---------------------------------------------------------------------------
void __init void __init
kcapi_proc_init(void) kcapi_proc_init(void)
{ {
proc_mkdir("capi", NULL); proc_mkdir("capi", NULL);
proc_mkdir("capi/controllers", NULL); proc_mkdir("capi/controllers", NULL);
proc_mkdir("capi/drivers", NULL);
create_seq_entry("capi/controller", 0, &proc_controller_ops); create_seq_entry("capi/controller", 0, &proc_controller_ops);
create_seq_entry("capi/contrstats", 0, &proc_contrstats_ops); create_seq_entry("capi/contrstats", 0, &proc_contrstats_ops);
create_seq_entry("capi/applications", 0, &proc_applications_ops); create_seq_entry("capi/applications", 0, &proc_applications_ops);
create_seq_entry("capi/applstats", 0, &proc_applstats_ops); create_seq_entry("capi/applstats", 0, &proc_applstats_ops);
create_seq_entry("capi/driver", 0, &proc_driver_ops);
} }
void __exit void __exit
...@@ -263,7 +331,6 @@ kcapi_proc_exit(void) ...@@ -263,7 +331,6 @@ kcapi_proc_exit(void)
remove_proc_entry("capi/contrstats", NULL); remove_proc_entry("capi/contrstats", NULL);
remove_proc_entry("capi/applications", NULL); remove_proc_entry("capi/applications", NULL);
remove_proc_entry("capi/applstats", NULL); remove_proc_entry("capi/applstats", NULL);
remove_proc_entry("capi/drivers", NULL);
remove_proc_entry("capi/controllers", NULL); remove_proc_entry("capi/controllers", NULL);
remove_proc_entry("capi", NULL); remove_proc_entry("capi", NULL);
} }
...@@ -2,32 +2,9 @@ ...@@ -2,32 +2,9 @@
# ISDN hardware drivers # ISDN hardware drivers
# #
comment "CAPI hardware drivers" comment "CAPI hardware drivers"
depends on NET && ISDN_BOOL && ISDN_CAPI depends on NET && ISDN && ISDN_CAPI
source "drivers/isdn/hardware/avm/Kconfig" source "drivers/isdn/hardware/avm/Kconfig"
source "drivers/isdn/hardware/eicon/Kconfig" source "drivers/isdn/hardware/eicon/Kconfig"
comment "ISDN4Linux hardware drivers"
depends on NET && ISDN_BOOL && ISDN
source "drivers/isdn/hisax/Kconfig"
menu "Active cards"
depends on NET && ISDN_BOOL && ISDN!=n
source "drivers/isdn/icn/Kconfig"
source "drivers/isdn/pcbit/Kconfig"
source "drivers/isdn/sc/Kconfig"
source "drivers/isdn/act2000/Kconfig"
source "drivers/isdn/tpam/Kconfig"
source "drivers/isdn/hysdn/Kconfig"
endmenu
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
menu "Active AVM cards" menu "Active AVM cards"
depends on NET && ISDN_BOOL && ISDN_CAPI!=n depends on NET && ISDN && ISDN_CAPI!=n
config CAPI_AVM config CAPI_AVM
bool "Support AVM cards" bool "Support AVM cards"
......
/* $Id: b1.c,v 1.1.4.1.2.1 2001/12/21 15:00:17 kai Exp $ /* $Id: b1.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
* *
* Common module for AVM B1 cards. * Common module for AVM B1 cards.
* *
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <linux/isdn/capicmd.h> #include <linux/isdn/capicmd.h>
#include <linux/isdn/capiutil.h> #include <linux/isdn/capiutil.h>
static char *revision = "$Revision: 1.1.4.1.2.1 $"; static char *revision = "$Revision: 1.1.2.2 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -76,7 +76,7 @@ avmcard *b1_alloc_card(int nr_controllers) ...@@ -76,7 +76,7 @@ avmcard *b1_alloc_card(int nr_controllers)
kfree(card); kfree(card);
return 0; return 0;
} }
memset(cinfo, 0, sizeof(*cinfo)); memset(cinfo, 0, sizeof(*cinfo) * nr_controllers);
card->ctrlinfo = cinfo; card->ctrlinfo = cinfo;
for (i = 0; i < nr_controllers; i++) { for (i = 0; i < nr_controllers; i++) {
...@@ -308,14 +308,13 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) ...@@ -308,14 +308,13 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
return -EIO; return -EIO;
} }
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_setinterrupt(port, card->irq, card->cardtype); b1_setinterrupt(port, card->irq, card->cardtype);
b1_put_byte(port, SEND_INIT); b1_put_byte(port, SEND_INIT);
b1_put_word(port, CAPI_MAXAPPL); b1_put_word(port, CAPI_MAXAPPL);
b1_put_word(port, AVM_NCCI_PER_CHANNEL*2); b1_put_word(port, AVM_NCCI_PER_CHANNEL*2);
b1_put_word(port, ctrl->cnr - 1); b1_put_word(port, ctrl->cnr - 1);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
return 0; return 0;
} }
...@@ -348,15 +347,14 @@ void b1_register_appl(struct capi_ctr *ctrl, ...@@ -348,15 +347,14 @@ void b1_register_appl(struct capi_ctr *ctrl,
else nconn = ctrl->profile.nbchannel * -want; else nconn = ctrl->profile.nbchannel * -want;
if (nconn == 0) nconn = ctrl->profile.nbchannel; if (nconn == 0) nconn = ctrl->profile.nbchannel;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_put_byte(port, SEND_REGISTER); b1_put_byte(port, SEND_REGISTER);
b1_put_word(port, appl); b1_put_word(port, appl);
b1_put_word(port, 1024 * (nconn+1)); b1_put_word(port, 1024 * (nconn+1));
b1_put_word(port, nconn); b1_put_word(port, nconn);
b1_put_word(port, rp->datablkcnt); b1_put_word(port, rp->datablkcnt);
b1_put_word(port, rp->datablklen); b1_put_word(port, rp->datablklen);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} }
void b1_release_appl(struct capi_ctr *ctrl, u16 appl) void b1_release_appl(struct capi_ctr *ctrl, u16 appl)
...@@ -368,11 +366,10 @@ void b1_release_appl(struct capi_ctr *ctrl, u16 appl) ...@@ -368,11 +366,10 @@ void b1_release_appl(struct capi_ctr *ctrl, u16 appl)
capilib_release_appl(&cinfo->ncci_head, appl); capilib_release_appl(&cinfo->ncci_head, appl);
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_put_byte(port, SEND_RELEASE); b1_put_byte(port, SEND_RELEASE);
b1_put_word(port, appl); b1_put_word(port, appl);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} }
u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
...@@ -396,20 +393,18 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) ...@@ -396,20 +393,18 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
dlen = CAPIMSG_DATALEN(skb->data); dlen = CAPIMSG_DATALEN(skb->data);
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_put_byte(port, SEND_DATA_B3_REQ); b1_put_byte(port, SEND_DATA_B3_REQ);
b1_put_slice(port, skb->data, len); b1_put_slice(port, skb->data, len);
b1_put_slice(port, skb->data + len, dlen); b1_put_slice(port, skb->data + len, dlen);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} else { } else {
retval = CAPI_NOERROR; retval = CAPI_NOERROR;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_put_byte(port, SEND_MESSAGE); b1_put_byte(port, SEND_MESSAGE);
b1_put_slice(port, skb->data, len); b1_put_slice(port, skb->data, len);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} }
out: out:
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
...@@ -505,9 +500,14 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -505,9 +500,14 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
unsigned DataB3Len; unsigned DataB3Len;
unsigned NCCI; unsigned NCCI;
unsigned WindowSize; unsigned WindowSize;
unsigned long flags;
spin_lock_irqsave(&card->lock, flags);
if (!b1_rx_full(card->port)) if (!b1_rx_full(card->port)) {
spin_unlock_irqrestore(&card->lock, flags);
return IRQ_NONE; return IRQ_NONE;
}
b1cmd = b1_get_byte(card->port); b1cmd = b1_get_byte(card->port);
...@@ -518,6 +518,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -518,6 +518,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
ApplId = (unsigned) b1_get_word(card->port); ApplId = (unsigned) b1_get_word(card->port);
MsgLen = b1_get_slice(card->port, card->msgbuf); MsgLen = b1_get_slice(card->port, card->msgbuf);
DataB3Len = b1_get_slice(card->port, card->databuf); DataB3Len = b1_get_slice(card->port, card->databuf);
spin_unlock_irqrestore(&card->lock, flags);
if (MsgLen < 30) { /* not CAPI 64Bit */ if (MsgLen < 30) { /* not CAPI 64Bit */
memset(card->msgbuf+MsgLen, 0, 30-MsgLen); memset(card->msgbuf+MsgLen, 0, 30-MsgLen);
...@@ -538,6 +539,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -538,6 +539,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
ApplId = (unsigned) b1_get_word(card->port); ApplId = (unsigned) b1_get_word(card->port);
MsgLen = b1_get_slice(card->port, card->msgbuf); MsgLen = b1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n", printk(KERN_ERR "%s: incoming packet dropped\n",
card->name); card->name);
...@@ -557,6 +559,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -557,6 +559,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
ApplId = b1_get_word(card->port); ApplId = b1_get_word(card->port);
NCCI = b1_get_word(card->port); NCCI = b1_get_word(card->port);
WindowSize = b1_get_word(card->port); WindowSize = b1_get_word(card->port);
spin_unlock_irqrestore(&card->lock, flags);
capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
...@@ -566,6 +569,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -566,6 +569,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
ApplId = b1_get_word(card->port); ApplId = b1_get_word(card->port);
NCCI = b1_get_word(card->port); NCCI = b1_get_word(card->port);
spin_unlock_irqrestore(&card->lock, flags);
if (NCCI != 0xffffffff) if (NCCI != 0xffffffff)
capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
...@@ -574,16 +578,19 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -574,16 +578,19 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
case RECEIVE_START: case RECEIVE_START:
/* b1_put_byte(card->port, SEND_POLLACK); */ /* b1_put_byte(card->port, SEND_POLLACK); */
spin_unlock_irqrestore(&card->lock, flags);
capi_ctr_resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
spin_unlock_irqrestore(&card->lock, flags);
capi_ctr_suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
cinfo->versionlen = b1_get_slice(card->port, cinfo->versionbuf); cinfo->versionlen = b1_get_slice(card->port, cinfo->versionbuf);
spin_unlock_irqrestore(&card->lock, flags);
b1_parse_version(cinfo); b1_parse_version(cinfo);
printk(KERN_INFO "%s: %s-card (%s) now active\n", printk(KERN_INFO "%s: %s-card (%s) now active\n",
card->name, card->name,
...@@ -595,6 +602,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -595,6 +602,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
ApplId = (unsigned) b1_get_word(card->port); ApplId = (unsigned) b1_get_word(card->port);
MsgLen = b1_get_slice(card->port, card->msgbuf); MsgLen = b1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0; card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0 while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n' && ( card->msgbuf[MsgLen-1] == '\n'
...@@ -608,6 +616,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -608,6 +616,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
case RECEIVE_DEBUGMSG: case RECEIVE_DEBUGMSG:
MsgLen = b1_get_slice(card->port, card->msgbuf); MsgLen = b1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0; card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0 while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n' && ( card->msgbuf[MsgLen-1] == '\n'
...@@ -619,9 +628,11 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -619,9 +628,11 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
break; break;
case 0xff: case 0xff:
spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_ERR "%s: card removed ?\n", card->name); printk(KERN_ERR "%s: card removed ?\n", card->name);
return IRQ_NONE; return IRQ_NONE;
default: default:
spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n",
card->name, b1cmd); card->name, b1cmd);
return IRQ_HANDLED; return IRQ_HANDLED;
......
/* $Id: b1dma.c,v 1.1.4.1.2.1 2001/12/21 15:00:17 kai Exp $ /* $Id: b1dma.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $
* *
* Common module for AVM B1 cards that support dma with AMCC * Common module for AVM B1 cards that support dma with AMCC
* *
...@@ -28,11 +28,9 @@ ...@@ -28,11 +28,9 @@
#include <linux/isdn/capicmd.h> #include <linux/isdn/capicmd.h>
#include <linux/isdn/capiutil.h> #include <linux/isdn/capiutil.h>
#if BITS_PER_LONG != 32 static char *revision = "$Revision: 1.1.2.3 $";
#error FIXME: driver requires 32-bit platform
#endif
static char *revision = "$Revision: 1.1.4.1.2.1 $"; #undef CONFIG_B1DMA_DEBUG
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -239,7 +237,7 @@ void b1dma_reset(avmcard *card) ...@@ -239,7 +237,7 @@ void b1dma_reset(avmcard *card)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
int b1dma_detect(avmcard *card) static int b1dma_detect(avmcard *card)
{ {
b1dma_writel(card, 0, AMCC_MCSR); b1dma_writel(card, 0, AMCC_MCSR);
mdelay(10); mdelay(10);
...@@ -578,11 +576,16 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -578,11 +576,16 @@ static void b1dma_handle_rx(avmcard *card)
static void b1dma_handle_interrupt(avmcard *card) static void b1dma_handle_interrupt(avmcard *card)
{ {
u32 status = b1dma_readl(card, AMCC_INTCSR); u32 status;
u32 newcsr; u32 newcsr;
if ((status & ANY_S5933_INT) == 0) spin_lock(&card->lock);
status = b1dma_readl(card, AMCC_INTCSR);
if ((status & ANY_S5933_INT) == 0) {
spin_unlock(&card->lock);
return; return;
}
newcsr = card->csr | (status & ALL_INT); newcsr = card->csr | (status & ALL_INT);
if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT; if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT;
...@@ -593,20 +596,28 @@ static void b1dma_handle_interrupt(avmcard *card) ...@@ -593,20 +596,28 @@ static void b1dma_handle_interrupt(avmcard *card)
struct avmcard_dmainfo *dma = card->dma; struct avmcard_dmainfo *dma = card->dma;
u32 rxlen; u32 rxlen;
if (card->dma->recvlen == 0) { if (card->dma->recvlen == 0) {
rxlen = b1dma_readl(card, AMCC_RXLEN);
if (rxlen == 0) {
dma->recvlen = *((u32 *)dma->recvbuf.dmabuf); dma->recvlen = *((u32 *)dma->recvbuf.dmabuf);
rxlen = (dma->recvlen + 3) & ~3; rxlen = (dma->recvlen + 3) & ~3;
b1dma_writel(card, dma->recvbuf.dmaaddr+4, AMCC_RXPTR); b1dma_writel(card, dma->recvbuf.dmaaddr+4, AMCC_RXPTR);
b1dma_writel(card, rxlen, AMCC_RXLEN); b1dma_writel(card, rxlen, AMCC_RXLEN);
#ifdef CONFIG_B1DMA_DEBUG
} else { } else {
printk(KERN_ERR "%s: rx not complete (%d).\n",
card->name, rxlen);
#endif
}
} else {
spin_unlock(&card->lock);
b1dma_handle_rx(card); b1dma_handle_rx(card);
dma->recvlen = 0; dma->recvlen = 0;
spin_lock(&card->lock);
b1dma_writel(card, dma->recvbuf.dmaaddr, AMCC_RXPTR); b1dma_writel(card, dma->recvbuf.dmaaddr, AMCC_RXPTR);
b1dma_writel(card, 4, AMCC_RXLEN); b1dma_writel(card, 4, AMCC_RXLEN);
} }
} }
spin_lock(&card->lock);
if ((status & TX_TC_INT) != 0) { if ((status & TX_TC_INT) != 0) {
if (skb_queue_empty(&card->dma->send_queue)) if (skb_queue_empty(&card->dma->send_queue))
card->csr &= ~EN_TX_TC_INT; card->csr &= ~EN_TX_TC_INT;
...@@ -736,18 +747,19 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) ...@@ -736,18 +747,19 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl)
{ {
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card; avmcard *card = cinfo->card;
unsigned long flags;
spin_lock_irqsave(&card->lock, flags);
b1dma_reset(card); b1dma_reset(card);
spin_unlock_irqrestore(&card->lock, flags);
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
capi_ctr_reseted(ctrl); capi_ctr_reseted(ctrl);
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
void b1dma_register_appl(struct capi_ctr *ctrl, void b1dma_register_appl(struct capi_ctr *ctrl,
u16 appl, u16 appl,
capi_register_params *rp) capi_register_params *rp)
...@@ -844,6 +856,7 @@ int b1dmactl_read_proc(char *page, char **start, off_t off, ...@@ -844,6 +856,7 @@ int b1dmactl_read_proc(char *page, char **start, off_t off,
int len = 0; int len = 0;
char *s; char *s;
u32 txoff, txlen, rxoff, rxlen, csr; u32 txoff, txlen, rxoff, rxlen, csr;
unsigned long flags;
len += sprintf(page+len, "%-16s %s\n", "name", card->name); len += sprintf(page+len, "%-16s %s\n", "name", card->name);
len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port); len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port);
...@@ -896,6 +909,9 @@ int b1dmactl_read_proc(char *page, char **start, off_t off, ...@@ -896,6 +909,9 @@ int b1dmactl_read_proc(char *page, char **start, off_t off,
} }
len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname);
spin_lock_irqsave(&card->lock, flags);
txoff = (dma_addr_t)b1dma_readl(card, AMCC_TXPTR)-card->dma->sendbuf.dmaaddr; txoff = (dma_addr_t)b1dma_readl(card, AMCC_TXPTR)-card->dma->sendbuf.dmaaddr;
txlen = b1dma_readl(card, AMCC_TXLEN); txlen = b1dma_readl(card, AMCC_TXLEN);
...@@ -904,6 +920,8 @@ int b1dmactl_read_proc(char *page, char **start, off_t off, ...@@ -904,6 +920,8 @@ int b1dmactl_read_proc(char *page, char **start, off_t off,
csr = b1dma_readl(card, AMCC_INTCSR); csr = b1dma_readl(card, AMCC_INTCSR);
spin_unlock_irqrestore(&card->lock, flags);
len += sprintf(page+len, "%-16s 0x%lx\n", len += sprintf(page+len, "%-16s 0x%lx\n",
"csr (cached)", (unsigned long)card->csr); "csr (cached)", (unsigned long)card->csr);
len += sprintf(page+len, "%-16s 0x%lx\n", len += sprintf(page+len, "%-16s 0x%lx\n",
......
/* $Id: b1isa.c,v 1.10.6.6 2001/09/23 22:24:33 kai Exp $ /* $Id: b1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $
* *
* Module for AVM B1 ISA-card. * Module for AVM B1 ISA-card.
* *
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static char *revision = "$Revision: 1.1.2.3 $";
/* ------------------------------------------------------------- */
MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 ISA card"); MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM B1 ISA card");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -56,7 +60,7 @@ static void b1isa_remove(struct pci_dev *pdev) ...@@ -56,7 +60,7 @@ static void b1isa_remove(struct pci_dev *pdev)
static char *b1isa_procinfo(struct capi_ctr *ctrl); static char *b1isa_procinfo(struct capi_ctr *ctrl);
static int __init b1isa_probe(struct pci_dev *pdev) static int b1isa_probe(struct pci_dev *pdev)
{ {
avmctrl_info *cinfo; avmctrl_info *cinfo;
avmcard *card; avmcard *card;
...@@ -108,6 +112,7 @@ static int __init b1isa_probe(struct pci_dev *pdev) ...@@ -108,6 +112,7 @@ static int __init b1isa_probe(struct pci_dev *pdev)
b1_reset(card->port); b1_reset(card->port);
b1_getrevision(card); b1_getrevision(card);
cinfo->capi_ctrl.owner = THIS_MODULE;
cinfo->capi_ctrl.driver_name = "b1isa"; cinfo->capi_ctrl.driver_name = "b1isa";
cinfo->capi_ctrl.driverdata = cinfo; cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl; cinfo->capi_ctrl.register_appl = b1_register_appl;
...@@ -118,7 +123,6 @@ static int __init b1isa_probe(struct pci_dev *pdev) ...@@ -118,7 +123,6 @@ static int __init b1isa_probe(struct pci_dev *pdev)
cinfo->capi_ctrl.procinfo = b1isa_procinfo; cinfo->capi_ctrl.procinfo = b1isa_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name); strcpy(cinfo->capi_ctrl.name, card->name);
cinfo->capi_ctrl.owner = THIS_MODULE;
retval = attach_capi_ctr(&cinfo->capi_ctrl); retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) { if (retval) {
...@@ -170,23 +174,56 @@ MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); ...@@ -170,23 +174,56 @@ MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM_DESC(io, "I/O base address(es)"); MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
static int b1isa_add_card(struct capi_driver *driver, capicardparams *data)
{
int i;
for (i = 0; i < MAX_CARDS; i++) {
if (isa_dev[i].resource[0].start)
continue;
isa_dev[i].resource[0].start = data->port;
isa_dev[i].irq = data->irq;
if (b1isa_probe(&isa_dev[i]) == 0)
return 0;
}
return -ENODEV;
}
static struct capi_driver capi_driver_b1isa = {
.name = "b1isa",
.revision = "1.0",
.add_card = b1isa_add_card,
};
static int __init b1isa_init(void) static int __init b1isa_init(void)
{ {
char *p;
char rev[32];
int i; int i;
int found = 0;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != 0 && p > rev)
*(p-1) = 0;
} else
strcpy(rev, "1.0");
for (i = 0; i < MAX_CARDS; i++) { for (i = 0; i < MAX_CARDS; i++) {
if (!io[i]) if (!io[i])
break; break;
isa_dev[i].resource[0].start = io[i]; isa_dev[i].resource[0].start = io[i];
isa_dev[i].irq_resource[0].start = irq[i]; isa_dev[i].irq = irq[i];
if (b1isa_probe(&isa_dev[i]) == 0) if (b1isa_probe(&isa_dev[i]) != 0)
found++;
}
if (found == 0)
return -ENODEV; return -ENODEV;
}
strlcpy(capi_driver_b1isa.revision, rev, 32);
register_capi_driver(&capi_driver_b1isa);
printk(KERN_INFO "b1isa: revision %s\n", rev);
return 0; return 0;
} }
...@@ -201,6 +238,7 @@ static void __exit b1isa_exit(void) ...@@ -201,6 +238,7 @@ static void __exit b1isa_exit(void)
b1isa_remove(&isa_dev[i]); b1isa_remove(&isa_dev[i]);
} }
unregister_capi_driver(&capi_driver_b1isa);
} }
module_init(b1isa_init); module_init(b1isa_init);
......
/* $Id: b1pci.c,v 1.1.4.1.2.1 2001/12/21 15:00:17 kai Exp $ /* $Id: b1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
* *
* Module for AVM B1 PCI-card. * Module for AVM B1 PCI-card.
* *
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static char *revision = "$Revision: 1.1.2.2 $";
/* ------------------------------------------------------------- */
static struct pci_device_id b1pci_pci_tbl[] = { static struct pci_device_id b1pci_pci_tbl[] = {
{ PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_B1, PCI_ANY_ID, PCI_ANY_ID }, { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_B1, PCI_ANY_ID, PCI_ANY_ID },
{ } /* Terminating entry */ { } /* Terminating entry */
...@@ -362,13 +366,50 @@ static struct pci_driver b1pci_pci_driver = { ...@@ -362,13 +366,50 @@ static struct pci_driver b1pci_pci_driver = {
.remove = __devexit_p(b1pci_pci_remove), .remove = __devexit_p(b1pci_pci_remove),
}; };
static struct capi_driver capi_driver_b1pci = {
.name = "b1pci",
.revision = "1.0",
};
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
static struct capi_driver capi_driver_b1pciv4 = {
.name = "b1pciv4",
.revision = "1.0",
};
#endif
static int __init b1pci_init(void) static int __init b1pci_init(void)
{ {
return pci_module_init(&b1pci_pci_driver); char *p;
char rev[32];
int err;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != 0 && p > rev)
*(p-1) = 0;
} else
strcpy(rev, "1.0");
err = pci_module_init(&b1pci_pci_driver);
if (!err) {
strlcpy(capi_driver_b1pci.revision, rev, 32);
register_capi_driver(&capi_driver_b1pci);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
strlcpy(capi_driver_b1pciv4.revision, rev, 32);
register_capi_driver(&capi_driver_b1pciv4);
#endif
printk(KERN_INFO "b1pci: revision %s\n", rev);
}
return err;
} }
static void __exit b1pci_exit(void) static void __exit b1pci_exit(void)
{ {
unregister_capi_driver(&capi_driver_b1pci);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
unregister_capi_driver(&capi_driver_b1pciv4);
#endif
pci_unregister_driver(&b1pci_pci_driver); pci_unregister_driver(&b1pci_pci_driver);
} }
......
/* $Id: b1pcmcia.c,v 1.12.6.5 2001/09/23 22:24:33 kai Exp $ /* $Id: b1pcmcia.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
* *
* Module for AVM B1/M1/M2 PCMCIA-card. * Module for AVM B1/M1/M2 PCMCIA-card.
* *
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static char *revision = "$Revision: 1.1.2.2 $";
/* ------------------------------------------------------------- */
MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM PCMCIA cards"); MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM PCMCIA cards");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -186,3 +190,36 @@ EXPORT_SYMBOL(b1pcmcia_addcard_b1); ...@@ -186,3 +190,36 @@ EXPORT_SYMBOL(b1pcmcia_addcard_b1);
EXPORT_SYMBOL(b1pcmcia_addcard_m1); EXPORT_SYMBOL(b1pcmcia_addcard_m1);
EXPORT_SYMBOL(b1pcmcia_addcard_m2); EXPORT_SYMBOL(b1pcmcia_addcard_m2);
EXPORT_SYMBOL(b1pcmcia_delcard); EXPORT_SYMBOL(b1pcmcia_delcard);
static struct capi_driver capi_driver_b1pcmcia = {
.name = "b1pcmcia",
.revision = "1.0",
};
static int __init b1pcmcia_init(void)
{
char *p;
char rev[32];
int err;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != 0 && p > rev)
*(p-1) = 0;
} else
strcpy(rev, "1.0");
strlcpy(capi_driver_b1pcmcia.revision, rev, 32);
register_capi_driver(&capi_driver_b1pcmcia);
printk(KERN_INFO "b1pci: revision %s\n", rev);
return 0;
}
static void __exit b1pcmcia_exit(void)
{
unregister_capi_driver(&capi_driver_b1pcmcia);
}
module_init(b1pcmcia_init);
module_exit(b1pcmcia_exit);
/* $Id: c4.c,v 1.1.4.1.2.1 2001/12/21 15:00:17 kai Exp $ /* $Id: c4.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
* *
* Module for AVM C4 & C2 card. * Module for AVM C4 & C2 card.
* *
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static char *revision = "$Revision: 1.1.2.2 $";
/* ------------------------------------------------------------- */
static int suppress_pollack; static int suppress_pollack;
static struct pci_device_id c4_pci_tbl[] = { static struct pci_device_id c4_pci_tbl[] = {
...@@ -404,18 +408,14 @@ static int c4_detect(avmcard *card) ...@@ -404,18 +408,14 @@ static int c4_detect(avmcard *card)
static void c4_dispatch_tx(avmcard *card) static void c4_dispatch_tx(avmcard *card)
{ {
avmcard_dmainfo *dma = card->dma; avmcard_dmainfo *dma = card->dma;
unsigned long flags;
struct sk_buff *skb; struct sk_buff *skb;
u8 cmd, subcmd; u8 cmd, subcmd;
u16 len; u16 len;
u32 txlen; u32 txlen;
void *p; void *p;
save_flags(flags);
cli();
if (card->csr & DBELL_DOWN_ARM) { /* tx busy */ if (card->csr & DBELL_DOWN_ARM) { /* tx busy */
restore_flags(flags);
return; return;
} }
...@@ -424,7 +424,6 @@ static void c4_dispatch_tx(avmcard *card) ...@@ -424,7 +424,6 @@ static void c4_dispatch_tx(avmcard *card)
#ifdef CONFIG_C4_DEBUG #ifdef CONFIG_C4_DEBUG
printk(KERN_DEBUG "%s: tx underrun\n", card->name); printk(KERN_DEBUG "%s: tx underrun\n", card->name);
#endif #endif
restore_flags(flags);
return; return;
} }
...@@ -470,7 +469,6 @@ static void c4_dispatch_tx(avmcard *card) ...@@ -470,7 +469,6 @@ static void c4_dispatch_tx(avmcard *card)
c4outmeml(card->mbase+DOORBELL, DBELL_DOWN_ARM); c4outmeml(card->mbase+DOORBELL, DBELL_DOWN_ARM);
restore_flags(flags);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
...@@ -664,11 +662,15 @@ static void c4_handle_rx(avmcard *card) ...@@ -664,11 +662,15 @@ static void c4_handle_rx(avmcard *card)
static irqreturn_t c4_handle_interrupt(avmcard *card) static irqreturn_t c4_handle_interrupt(avmcard *card)
{ {
u32 status = c4inmeml(card->mbase+DOORBELL); u32 status;
spin_lock(&card->lock);
status = c4inmeml(card->mbase+DOORBELL);
if (status & DBELL_RESET_HOST) { if (status & DBELL_RESET_HOST) {
u_int i; u_int i;
c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c); c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c);
spin_unlock(&card->lock);
if (card->nlogcontr == 0) if (card->nlogcontr == 0)
return IRQ_HANDLED; return IRQ_HANDLED;
printk(KERN_ERR "%s: unexpected reset\n", card->name); printk(KERN_ERR "%s: unexpected reset\n", card->name);
...@@ -683,8 +685,10 @@ static irqreturn_t c4_handle_interrupt(avmcard *card) ...@@ -683,8 +685,10 @@ static irqreturn_t c4_handle_interrupt(avmcard *card)
} }
status &= (DBELL_UP_HOST | DBELL_DOWN_HOST); status &= (DBELL_UP_HOST | DBELL_DOWN_HOST);
if (!status) if (!status) {
spin_unlock(&card->lock);
return IRQ_HANDLED; return IRQ_HANDLED;
}
c4outmeml(card->mbase+DOORBELL, status); c4outmeml(card->mbase+DOORBELL, status);
if ((status & DBELL_UP_HOST) != 0) { if ((status & DBELL_UP_HOST) != 0) {
...@@ -705,6 +709,7 @@ static irqreturn_t c4_handle_interrupt(avmcard *card) ...@@ -705,6 +709,7 @@ static irqreturn_t c4_handle_interrupt(avmcard *card)
c4_dispatch_tx(card); c4_dispatch_tx(card);
} }
} }
spin_unlock(&card->lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -767,6 +772,7 @@ static int queue_sendconfigword(avmcard *card, u32 val) ...@@ -767,6 +772,7 @@ static int queue_sendconfigword(avmcard *card, u32 val)
static int queue_sendconfig(avmcard *card, char cval[4]) static int queue_sendconfig(avmcard *card, char cval[4])
{ {
struct sk_buff *skb; struct sk_buff *skb;
unsigned long flags;
void *p; void *p;
skb = alloc_skb(3+4, GFP_ATOMIC); skb = alloc_skb(3+4, GFP_ATOMIC);
...@@ -786,7 +792,10 @@ static int queue_sendconfig(avmcard *card, char cval[4]) ...@@ -786,7 +792,10 @@ static int queue_sendconfig(avmcard *card, char cval[4])
skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_put(skb, (u8 *)p - (u8 *)skb->data);
skb_queue_tail(&card->dma->send_queue, skb); skb_queue_tail(&card->dma->send_queue, skb);
spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card); c4_dispatch_tx(card);
spin_unlock_irqrestore(&card->lock, flags);
return 0; return 0;
} }
...@@ -835,7 +844,6 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) ...@@ -835,7 +844,6 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
{ {
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card; avmcard *card = cinfo->card;
unsigned long flags;
int retval; int retval;
if ((retval = c4_load_t4file(card, &data->firmware))) { if ((retval = c4_load_t4file(card, &data->firmware))) {
...@@ -845,9 +853,6 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) ...@@ -845,9 +853,6 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
return retval; return retval;
} }
save_flags(flags);
cli();
card->csr = 0; card->csr = 0;
c4outmeml(card->mbase+MBOX_UP_LEN, 0); c4outmeml(card->mbase+MBOX_UP_LEN, 0);
c4outmeml(card->mbase+MBOX_DOWN_LEN, 0); c4outmeml(card->mbase+MBOX_DOWN_LEN, 0);
...@@ -862,7 +867,6 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) ...@@ -862,7 +867,6 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
c4outmeml(card->mbase+MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr); c4outmeml(card->mbase+MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr);
c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size); c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size);
c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM); c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM);
restore_flags(flags);
if (data->configuration.len > 0 && data->configuration.data) { if (data->configuration.len > 0 && data->configuration.data) {
retval = c4_send_config(card, &data->configuration); retval = c4_send_config(card, &data->configuration);
...@@ -885,9 +889,14 @@ void c4_reset_ctr(struct capi_ctr *ctrl) ...@@ -885,9 +889,14 @@ void c4_reset_ctr(struct capi_ctr *ctrl)
avmcard *card = ((avmctrl_info *)(ctrl->driverdata))->card; avmcard *card = ((avmctrl_info *)(ctrl->driverdata))->card;
avmctrl_info *cinfo; avmctrl_info *cinfo;
u_int i; u_int i;
unsigned long flags;
spin_lock_irqsave(&card->lock, flags);
c4_reset(card); c4_reset(card);
spin_unlock_irqrestore(&card->lock, flags);
for (i=0; i < card->nr_controllers; i++) { for (i=0; i < card->nr_controllers; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
...@@ -931,6 +940,7 @@ void c4_register_appl(struct capi_ctr *ctrl, ...@@ -931,6 +940,7 @@ void c4_register_appl(struct capi_ctr *ctrl,
avmcard *card = cinfo->card; avmcard *card = cinfo->card;
struct sk_buff *skb; struct sk_buff *skb;
int want = rp->level3cnt; int want = rp->level3cnt;
unsigned long flags;
int nconn; int nconn;
void *p; void *p;
...@@ -958,7 +968,10 @@ void c4_register_appl(struct capi_ctr *ctrl, ...@@ -958,7 +968,10 @@ void c4_register_appl(struct capi_ctr *ctrl,
skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_put(skb, (u8 *)p - (u8 *)skb->data);
skb_queue_tail(&card->dma->send_queue, skb); skb_queue_tail(&card->dma->send_queue, skb);
spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card); c4_dispatch_tx(card);
spin_unlock_irqrestore(&card->lock, flags);
} }
} }
...@@ -968,6 +981,7 @@ void c4_release_appl(struct capi_ctr *ctrl, u16 appl) ...@@ -968,6 +981,7 @@ void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
{ {
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card; avmcard *card = cinfo->card;
unsigned long flags;
struct sk_buff *skb; struct sk_buff *skb;
void *p; void *p;
...@@ -988,7 +1002,9 @@ void c4_release_appl(struct capi_ctr *ctrl, u16 appl) ...@@ -988,7 +1002,9 @@ void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_put(skb, (u8 *)p - (u8 *)skb->data);
skb_queue_tail(&card->dma->send_queue, skb); skb_queue_tail(&card->dma->send_queue, skb);
spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card); c4_dispatch_tx(card);
spin_unlock_irqrestore(&card->lock, flags);
} }
} }
...@@ -1000,6 +1016,7 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) ...@@ -1000,6 +1016,7 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card; avmcard *card = cinfo->card;
u16 retval = CAPI_NOERROR; u16 retval = CAPI_NOERROR;
unsigned long flags;
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
retval = capilib_data_b3_req(&cinfo->ncci_head, retval = capilib_data_b3_req(&cinfo->ncci_head,
...@@ -1009,7 +1026,9 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) ...@@ -1009,7 +1026,9 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
} }
if (retval == CAPI_NOERROR) { if (retval == CAPI_NOERROR) {
skb_queue_tail(&card->dma->send_queue, skb); skb_queue_tail(&card->dma->send_queue, skb);
spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card); c4_dispatch_tx(card);
spin_unlock_irqrestore(&card->lock, flags);
} else { } else {
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} }
...@@ -1164,6 +1183,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, ...@@ -1164,6 +1183,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
for (i=0; i < nr_controllers ; i++) { for (i=0; i < nr_controllers ; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
cinfo->capi_ctrl.owner = THIS_MODULE;
cinfo->capi_ctrl.driver_name = "c4"; cinfo->capi_ctrl.driver_name = "c4";
cinfo->capi_ctrl.driverdata = cinfo; cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = c4_register_appl; cinfo->capi_ctrl.register_appl = c4_register_appl;
...@@ -1174,7 +1194,6 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, ...@@ -1174,7 +1194,6 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
cinfo->capi_ctrl.procinfo = c4_procinfo; cinfo->capi_ctrl.procinfo = c4_procinfo;
cinfo->capi_ctrl.ctr_read_proc = c4_read_proc; cinfo->capi_ctrl.ctr_read_proc = c4_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name); strcpy(cinfo->capi_ctrl.name, card->name);
cinfo->capi_ctrl.owner = THIS_MODULE;
retval = attach_capi_ctr(&cinfo->capi_ctrl); retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) { if (retval) {
...@@ -1247,13 +1266,44 @@ static struct pci_driver c4_pci_driver = { ...@@ -1247,13 +1266,44 @@ static struct pci_driver c4_pci_driver = {
.remove = c4_remove, .remove = c4_remove,
}; };
static struct capi_driver capi_driver_c2 = {
.name = "c2",
.revision = "1.0",
};
static struct capi_driver capi_driver_c4 = {
.name = "c4",
.revision = "1.0",
};
static int __init c4_init(void) static int __init c4_init(void)
{ {
return pci_module_init(&c4_pci_driver); char *p;
char rev[32];
int err;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != 0 && p > rev)
*(p-1) = 0;
} else
strcpy(rev, "1.0");
err = pci_module_init(&c4_pci_driver);
if (!err) {
strlcpy(capi_driver_c2.revision, rev, 32);
register_capi_driver(&capi_driver_c2);
strlcpy(capi_driver_c4.revision, rev, 32);
register_capi_driver(&capi_driver_c4);
printk(KERN_INFO "c4: revision %s\n", rev);
}
return err;
} }
static void __exit c4_exit(void) static void __exit c4_exit(void)
{ {
unregister_capi_driver(&capi_driver_c2);
unregister_capi_driver(&capi_driver_c4);
pci_unregister_driver(&c4_pci_driver); pci_unregister_driver(&c4_pci_driver);
} }
......
/* $Id: t1isa.c,v 1.16.6.7 2001/09/23 22:24:34 kai Exp $ /* $Id: t1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $
* *
* Module for AVM T1 HEMA-card. * Module for AVM T1 HEMA-card.
* *
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static char *revision = "$Revision: 1.1.2.3 $";
/* ------------------------------------------------------------- */
MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 HEMA ISA card"); MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM T1 HEMA ISA card");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -58,7 +62,6 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr) ...@@ -58,7 +62,6 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr)
{ {
unsigned char cregs[8]; unsigned char cregs[8];
unsigned char reverse_cardnr; unsigned char reverse_cardnr;
unsigned long flags;
unsigned char dummy; unsigned char dummy;
int i; int i;
...@@ -73,8 +76,12 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr) ...@@ -73,8 +76,12 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr)
cregs[6] = 0; cregs[6] = 0;
cregs[7] = 0; cregs[7] = 0;
save_flags(flags); /*
cli(); * no one else should use the ISA bus in this moment,
* but no function there to prevent this :-(
* save_flags(flags); cli();
*/
/* board reset */ /* board reset */
t1outp(base, T1_RESETBOARD, 0xf); t1outp(base, T1_RESETBOARD, 0xf);
mdelay(100); mdelay(100);
...@@ -87,7 +94,7 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr) ...@@ -87,7 +94,7 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr)
t1outp(base, HEMA_PAL_ID >> 4, cregs[0]); t1outp(base, HEMA_PAL_ID >> 4, cregs[0]);
for(i=1;i<7;i++) t1outp(base, 0, cregs[i]); for(i=1;i<7;i++) t1outp(base, 0, cregs[i]);
t1outp(base, ((base >> 4)) & 0x3, cregs[7]); t1outp(base, ((base >> 4)) & 0x3, cregs[7]);
restore_flags(flags); /* restore_flags(flags); */
mdelay(100); mdelay(100);
t1outp(base, T1_FASTLINK+T1_RESETLINK, 0); t1outp(base, T1_FASTLINK+T1_RESETLINK, 0);
...@@ -137,6 +144,9 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -137,6 +144,9 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
unsigned DataB3Len; unsigned DataB3Len;
unsigned NCCI; unsigned NCCI;
unsigned WindowSize; unsigned WindowSize;
unsigned long flags;
spin_lock_irqsave(&card->lock, flags);
while (b1_rx_full(card->port)) { while (b1_rx_full(card->port)) {
...@@ -149,6 +159,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -149,6 +159,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
ApplId = (unsigned) b1_get_word(card->port); ApplId = (unsigned) b1_get_word(card->port);
MsgLen = t1_get_slice(card->port, card->msgbuf); MsgLen = t1_get_slice(card->port, card->msgbuf);
DataB3Len = t1_get_slice(card->port, card->databuf); DataB3Len = t1_get_slice(card->port, card->databuf);
spin_unlock_irqrestore(&card->lock, flags);
if (MsgLen < 30) { /* not CAPI 64Bit */ if (MsgLen < 30) { /* not CAPI 64Bit */
memset(card->msgbuf+MsgLen, 0, 30-MsgLen); memset(card->msgbuf+MsgLen, 0, 30-MsgLen);
...@@ -169,6 +180,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -169,6 +180,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
ApplId = (unsigned) b1_get_word(card->port); ApplId = (unsigned) b1_get_word(card->port);
MsgLen = t1_get_slice(card->port, card->msgbuf); MsgLen = t1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n", printk(KERN_ERR "%s: incoming packet dropped\n",
card->name); card->name);
...@@ -188,6 +200,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -188,6 +200,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
ApplId = b1_get_word(card->port); ApplId = b1_get_word(card->port);
NCCI = b1_get_word(card->port); NCCI = b1_get_word(card->port);
WindowSize = b1_get_word(card->port); WindowSize = b1_get_word(card->port);
spin_unlock_irqrestore(&card->lock, flags);
capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
...@@ -197,6 +210,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -197,6 +210,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
ApplId = b1_get_word(card->port); ApplId = b1_get_word(card->port);
NCCI = b1_get_word(card->port); NCCI = b1_get_word(card->port);
spin_unlock_irqrestore(&card->lock, flags);
if (NCCI != 0xffffffff) if (NCCI != 0xffffffff)
capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
...@@ -205,16 +219,19 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -205,16 +219,19 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
case RECEIVE_START: case RECEIVE_START:
b1_put_byte(card->port, SEND_POLLACK); b1_put_byte(card->port, SEND_POLLACK);
spin_unlock_irqrestore(&card->lock, flags);
capi_ctr_resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
spin_unlock_irqrestore(&card->lock, flags);
capi_ctr_suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
cinfo->versionlen = t1_get_slice(card->port, cinfo->versionbuf); cinfo->versionlen = t1_get_slice(card->port, cinfo->versionbuf);
spin_unlock_irqrestore(&card->lock, flags);
b1_parse_version(cinfo); b1_parse_version(cinfo);
printk(KERN_INFO "%s: %s-card (%s) now active\n", printk(KERN_INFO "%s: %s-card (%s) now active\n",
card->name, card->name,
...@@ -226,6 +243,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -226,6 +243,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
ApplId = (unsigned) b1_get_word(card->port); ApplId = (unsigned) b1_get_word(card->port);
MsgLen = t1_get_slice(card->port, card->msgbuf); MsgLen = t1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0; card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0 while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n' && ( card->msgbuf[MsgLen-1] == '\n'
...@@ -239,6 +257,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -239,6 +257,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
case RECEIVE_DEBUGMSG: case RECEIVE_DEBUGMSG:
MsgLen = t1_get_slice(card->port, card->msgbuf); MsgLen = t1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0; card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0 while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n' && ( card->msgbuf[MsgLen-1] == '\n'
...@@ -251,9 +270,11 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs * ...@@ -251,9 +270,11 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *
case 0xff: case 0xff:
spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_ERR "%s: card reseted ?\n", card->name); printk(KERN_ERR "%s: card reseted ?\n", card->name);
return IRQ_HANDLED; return IRQ_HANDLED;
default: default:
spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n", printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n",
card->name, b1cmd); card->name, b1cmd);
return IRQ_NONE; return IRQ_NONE;
...@@ -296,14 +317,13 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data) ...@@ -296,14 +317,13 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
return -EIO; return -EIO;
} }
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_setinterrupt(port, card->irq, card->cardtype); b1_setinterrupt(port, card->irq, card->cardtype);
b1_put_byte(port, SEND_INIT); b1_put_byte(port, SEND_INIT);
b1_put_word(port, CAPI_MAXAPPL); b1_put_word(port, CAPI_MAXAPPL);
b1_put_word(port, AVM_NCCI_PER_CHANNEL*30); b1_put_word(port, AVM_NCCI_PER_CHANNEL*30);
b1_put_word(port, ctrl->cnr - 1); b1_put_word(port, ctrl->cnr - 1);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
return 0; return 0;
} }
...@@ -349,7 +369,7 @@ static void t1isa_remove(struct pci_dev *pdev) ...@@ -349,7 +369,7 @@ static void t1isa_remove(struct pci_dev *pdev)
static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
static char *t1isa_procinfo(struct capi_ctr *ctrl); static char *t1isa_procinfo(struct capi_ctr *ctrl);
static int __init t1isa_probe(struct pci_dev *pdev, int cardnr) static int t1isa_probe(struct pci_dev *pdev, int cardnr)
{ {
avmctrl_info *cinfo; avmctrl_info *cinfo;
avmcard *card; avmcard *card;
...@@ -401,6 +421,7 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr) ...@@ -401,6 +421,7 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
t1_disable_irq(card->port); t1_disable_irq(card->port);
b1_reset(card->port); b1_reset(card->port);
cinfo->capi_ctrl.owner = THIS_MODULE;
cinfo->capi_ctrl.driver_name = "t1isa"; cinfo->capi_ctrl.driver_name = "t1isa";
cinfo->capi_ctrl.driverdata = cinfo; cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl; cinfo->capi_ctrl.register_appl = b1_register_appl;
...@@ -411,7 +432,6 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr) ...@@ -411,7 +432,6 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
cinfo->capi_ctrl.procinfo = t1isa_procinfo; cinfo->capi_ctrl.procinfo = t1isa_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name); strcpy(cinfo->capi_ctrl.name, card->name);
cinfo->capi_ctrl.owner = THIS_MODULE;
retval = attach_capi_ctr(&cinfo->capi_ctrl); retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) { if (retval) {
...@@ -456,20 +476,18 @@ static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) ...@@ -456,20 +476,18 @@ static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
dlen = CAPIMSG_DATALEN(skb->data); dlen = CAPIMSG_DATALEN(skb->data);
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_put_byte(port, SEND_DATA_B3_REQ); b1_put_byte(port, SEND_DATA_B3_REQ);
t1_put_slice(port, skb->data, len); t1_put_slice(port, skb->data, len);
t1_put_slice(port, skb->data + len, dlen); t1_put_slice(port, skb->data + len, dlen);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} else { } else {
retval = CAPI_NOERROR; retval = CAPI_NOERROR;
save_flags(flags); spin_lock_irqsave(&card->lock, flags);
cli();
b1_put_byte(port, SEND_MESSAGE); b1_put_byte(port, SEND_MESSAGE);
t1_put_slice(port, skb->data, len); t1_put_slice(port, skb->data, len);
restore_flags(flags); spin_unlock_irqrestore(&card->lock, flags);
} }
out: out:
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
...@@ -509,23 +527,56 @@ MODULE_PARM_DESC(io, "I/O base address(es)"); ...@@ -509,23 +527,56 @@ MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)"); MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)");
static int t1isa_add_card(struct capi_driver *driver, capicardparams *data)
{
int i;
for (i = 0; i < MAX_CARDS; i++) {
if (isa_dev[i].resource[0].start)
continue;
isa_dev[i].resource[0].start = data->port;
isa_dev[i].irq = data->irq;
if (t1isa_probe(&isa_dev[i], data->cardnr) == 0)
return 0;
}
return -ENODEV;
}
static struct capi_driver capi_driver_t1isa = {
.name = "t1isa",
.revision = "1.0",
.add_card = t1isa_add_card,
};
static int __init t1isa_init(void) static int __init t1isa_init(void)
{ {
char rev[32];
char *p;
int i; int i;
int found = 0;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != 0 && p > rev)
*(p-1) = 0;
} else
strcpy(rev, "1.0");
for (i = 0; i < MAX_CARDS; i++) { for (i = 0; i < MAX_CARDS; i++) {
if (!io[i]) if (!io[i])
break; break;
isa_dev[i].resource[0].start = io[i]; isa_dev[i].resource[0].start = io[i];
isa_dev[i].irq_resource[0].start = irq[i]; isa_dev[i].irq = irq[i];
if (t1isa_probe(&isa_dev[i], cardnr[i]) == 0) if (t1isa_probe(&isa_dev[i], cardnr[i]) != 0)
found++;
}
if (found == 0)
return -ENODEV; return -ENODEV;
}
strlcpy(capi_driver_t1isa.revision, rev, 32);
register_capi_driver(&capi_driver_t1isa);
printk(KERN_INFO "t1isa: revision %s\n", rev);
return 0; return 0;
} }
......
/* $Id: t1pci.c,v 1.1.4.1.2.1 2001/12/21 15:00:17 kai Exp $ /* $Id: t1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
* *
* Module for AVM T1 PCI-card. * Module for AVM T1 PCI-card.
* *
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#undef CONFIG_T1PCI_DEBUG #undef CONFIG_T1PCI_DEBUG
#undef CONFIG_T1PCI_POLLDEBUG #undef CONFIG_T1PCI_POLLDEBUG
/* ------------------------------------------------------------- */
static char *revision = "$Revision: 1.1.2.2 $";
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct pci_device_id t1pci_pci_tbl[] = { static struct pci_device_id t1pci_pci_tbl[] = {
...@@ -221,13 +223,36 @@ static struct pci_driver t1pci_pci_driver = { ...@@ -221,13 +223,36 @@ static struct pci_driver t1pci_pci_driver = {
.remove = t1pci_remove, .remove = t1pci_remove,
}; };
static struct capi_driver capi_driver_t1pci = {
.name = "t1pci",
.revision = "1.0",
};
static int __init t1pci_init(void) static int __init t1pci_init(void)
{ {
return pci_module_init(&t1pci_pci_driver); char *p;
char rev[32];
int err;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != 0 && p > rev)
*(p-1) = 0;
} else
strcpy(rev, "1.0");
err = pci_module_init(&t1pci_pci_driver);
if (!err) {
strlcpy(capi_driver_t1pci.revision, rev, 32);
register_capi_driver(&capi_driver_t1pci);
printk(KERN_INFO "t1pci: revision %s\n", rev);
}
return err;
} }
static void __exit t1pci_exit(void) static void __exit t1pci_exit(void)
{ {
unregister_capi_driver(&capi_driver_t1pci);
pci_unregister_driver(&t1pci_pci_driver); pci_unregister_driver(&t1pci_pci_driver);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
menu "Active Eicon DIVA Server cards" menu "Active Eicon DIVA Server cards"
depends on NET && ISDN_BOOL && ISDN_CAPI!=n depends on NET && ISDN && ISDN_CAPI!=n
config CAPI_EICON config CAPI_EICON
bool "Support Eicon cards" bool "Support Eicon cards"
......
menu "Passive cards" menu "Passive cards"
depends on ISDN depends on ISDN_I4L
config ISDN_DRV_HISAX config ISDN_DRV_HISAX
tristate "HiSax SiemensChipSet driver support" tristate "HiSax SiemensChipSet driver support"
...@@ -341,8 +341,8 @@ config HISAX_HFC_SX ...@@ -341,8 +341,8 @@ config HISAX_HFC_SX
# bool ' TESTEMULATOR (EXPERIMENTAL)' CONFIG_HISAX_TESTEMU # bool ' TESTEMULATOR (EXPERIMENTAL)' CONFIG_HISAX_TESTEMU
config HISAX_ENTERNOW_PCI config HISAX_ENTERNOW_PCI
bool "Formula-n enter:now PCI card (EXPERIMENTAL)" bool "Formula-n enter:now PCI card"
depends on PCI && EXPERIMENTAL depends on PCI
help help
This enables HiSax support for the Formula-n enter:now PCI This enables HiSax support for the Formula-n enter:now PCI
ISDN card. ISDN card.
...@@ -365,6 +365,8 @@ config HISAX_DEBUG ...@@ -365,6 +365,8 @@ config HISAX_DEBUG
the ST5481 USB driver currently. the ST5481 USB driver currently.
If in doubt, say yes. If in doubt, say yes.
comment "HiSax PCMCIA card service modules"
config HISAX_SEDLBAUER_CS config HISAX_SEDLBAUER_CS
tristate "Sedlbauer PCMCIA cards" tristate "Sedlbauer PCMCIA cards"
depends on PCMCIA && HISAX_SEDLBAUER depends on PCMCIA && HISAX_SEDLBAUER
...@@ -374,18 +376,26 @@ config HISAX_SEDLBAUER_CS ...@@ -374,18 +376,26 @@ config HISAX_SEDLBAUER_CS
config HISAX_ELSA_CS config HISAX_ELSA_CS
tristate "ELSA PCMCIA MicroLink cards" tristate "ELSA PCMCIA MicroLink cards"
depends on PCMCIA depends on PCMCIA && HISAX_ELSA
help help
This enables the PCMCIA client driver for the Elsa PCMCIA MicroLink This enables the PCMCIA client driver for the Elsa PCMCIA MicroLink
card. card.
config HISAX_AVM_A1_CS config HISAX_AVM_A1_CS
tristate "AVM A1 PCMCIA cards" tristate "AVM A1 PCMCIA cards"
depends on PCMCIA depends on PCMCIA && ISDN_DRV_HISAX
help help
This enables the PCMCIA client driver for the AVM A1 / Fritz!Card This enables the PCMCIA client driver for the AVM A1 / Fritz!Card
PCMCIA cards. PCMCIA cards.
config HISAX_TELES_CS
tristate "TELES PCMCIA cards"
depends on PCMCIA && HISAX_16_3
help
This enables the PCMCIA client driver for the Teles PCMCIA cards.
comment "HiSax sub driver modules"
config HISAX_ST5481 config HISAX_ST5481
tristate "ST5481 USB ISDN modem (EXPERIMENTAL)" tristate "ST5481 USB ISDN modem (EXPERIMENTAL)"
depends on USB && EXPERIMENTAL depends on USB && EXPERIMENTAL
...@@ -393,6 +403,12 @@ config HISAX_ST5481 ...@@ -393,6 +403,12 @@ config HISAX_ST5481
This enables the driver for ST5481 based USB ISDN adapters, This enables the driver for ST5481 based USB ISDN adapters,
e.g. the BeWan Gazel 128 USB e.g. the BeWan Gazel 128 USB
config HISAX_HFCUSB
tristate "HFC USB based ISDN modems (EXPERIMENTAL)"
depends on USB && EXPERIMENTAL
help
This enables the driver for HFC USB based ISDN modems.
config HISAX_FRITZ_PCIPNP config HISAX_FRITZ_PCIPNP
tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)" tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)"
depends on EXPERIMENTAL depends on EXPERIMENTAL
...@@ -402,18 +418,15 @@ config HISAX_FRITZ_PCIPNP ...@@ -402,18 +418,15 @@ config HISAX_FRITZ_PCIPNP
(the latter also needs you to select "ISA Plug and Play support" (the latter also needs you to select "ISA Plug and Play support"
from the menu "Plug and Play configuration") from the menu "Plug and Play configuration")
config HISAX_FRITZ_CLASSIC config HISAX_HDLC
tristate "AVM Fritz!Card classic support (EXPERIMENTAL)" bool
depends on ISA && EXPERIMENTAL depends on HISAX_ST5481
help default y
This enables the driver for the AVM Fritz!Card classic, formerly
known as AVM A1.
config HISAX_HFCPCI config HISAX_AVM_A1_PCMCIA
tristate "HFC PCI support (EXPERIMENTAL)" bool
depends on PCI && EXPERIMENTAL depends on HISAX_AVM_A1_CS
help default y
This enables the driver for CCD HFC PCI based cards.
endif endif
......
# Makefile for the hisax ISDN device driver # Makefile for the hisax ISDN device driver
# The target object and module list name.
# Define maximum number of cards # Define maximum number of cards
EXTRA_CFLAGS += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS) EXTRA_CFLAGS += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_DRV_HISAX) += hisax.o obj-$(CONFIG_ISDN_DRV_HISAX) += hisax.o
obj-$(CONFIG_HISAX_SEDLBAUER_CS) += sedlbauer_cs.o obj-$(CONFIG_HISAX_SEDLBAUER_CS) += sedlbauer_cs.o
obj-$(CONFIG_HISAX_ELSA_CS) += elsa_cs.o obj-$(CONFIG_HISAX_ELSA_CS) += elsa_cs.o
obj-$(CONFIG_HISAX_AVM_A1_CS) += avma1_cs.o obj-$(CONFIG_HISAX_AVM_A1_CS) += avma1_cs.o
obj-$(CONFIG_HISAX_TELES_CS) += teles_cs.o
obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o obj-$(CONFIG_HISAX_ST5481) += hisax_st5481.o
obj-$(CONFIG_HISAX_HFCUSB) += hfc_usb.o
obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_isac.o hisax_fcpcipnp.o obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_isac.o hisax_fcpcipnp.o
obj-$(CONFIG_HISAX_FRITZ_CLASSIC) += hisax_isac.o hisax_hscx.o hisax_fcclassic.o
obj-$(CONFIG_HISAX_FRITZ_PCIPNP) += hisax_hfcpci.o ifdef CONFIG_HISAX_HDLC
obj-$(CONFIG_ISDN_DRV_HISAX) += isdnhdlc.o
endif
# Multipart objects. # Multipart objects.
...@@ -21,7 +25,7 @@ hisax_st5481-y := st5481_init.o st5481_usb.o st5481_d.o \ ...@@ -21,7 +25,7 @@ hisax_st5481-y := st5481_init.o st5481_usb.o st5481_d.o \
st5481_b.o st5481_hdlc.o st5481_b.o st5481_hdlc.o
hisax-y := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \ hisax-y := config.o isdnl1.o tei.o isdnl2.o isdnl3.o \
lmgr.o q931.o callc.o fsm.o cert.o lmgr.o q931.o callc.o fsm.o
hisax-$(CONFIG_HISAX_EURO) += l3dss1.o hisax-$(CONFIG_HISAX_EURO) += l3dss1.o
hisax-$(CONFIG_HISAX_NI1) += l3ni1.o hisax-$(CONFIG_HISAX_NI1) += l3ni1.o
hisax-$(CONFIG_HISAX_1TR6) += l3_1tr6.o hisax-$(CONFIG_HISAX_1TR6) += l3_1tr6.o
...@@ -33,12 +37,12 @@ hisax-$(CONFIG_HISAX_S0BOX) += s0box.o isac.o arcofi.o hscx.o ...@@ -33,12 +37,12 @@ hisax-$(CONFIG_HISAX_S0BOX) += s0box.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_AVM_A1) += avm_a1.o isac.o arcofi.o hscx.o hisax-$(CONFIG_HISAX_AVM_A1) += avm_a1.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_AVM_A1_PCMCIA) += avm_a1p.o isac.o arcofi.o hscx.o hisax-$(CONFIG_HISAX_AVM_A1_PCMCIA) += avm_a1p.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_FRITZPCI) += avm_pci.o isac.o arcofi.o hisax-$(CONFIG_HISAX_FRITZPCI) += avm_pci.o isac.o arcofi.o
hisax-$(CONFIG_HISAX_ELSA) += elsa.o isac.o arcofi.o hscx.o ipac.o hisax-$(CONFIG_HISAX_ELSA) += elsa.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_IX1MICROR2) += ix1_micro.o isac.o arcofi.o hscx.o hisax-$(CONFIG_HISAX_IX1MICROR2) += ix1_micro.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o ipac.o ipacx.o hisax-$(CONFIG_HISAX_DIEHLDIVA) += diva.o isac.o arcofi.o hscx.o ipacx.o
hisax-$(CONFIG_HISAX_ASUSCOM) += asuscom.o isac.o arcofi.o hscx.o ipac.o hisax-$(CONFIG_HISAX_ASUSCOM) += asuscom.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_TELEINT) += teleint.o isac.o arcofi.o hfc_2bs0.o hisax-$(CONFIG_HISAX_TELEINT) += teleint.o isac.o arcofi.o hfc_2bs0.o
hisax-$(CONFIG_HISAX_SEDLBAUER) += sedlbauer.o isac.o arcofi.o hscx.o ipac.o \ hisax-$(CONFIG_HISAX_SEDLBAUER) += sedlbauer.o isac.o arcofi.o hscx.o \
isar.o isar.o
hisax-$(CONFIG_HISAX_SPORTSTER) += sportster.o isac.o arcofi.o hscx.o hisax-$(CONFIG_HISAX_SPORTSTER) += sportster.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_MIC) += mic.o isac.o arcofi.o hscx.o hisax-$(CONFIG_HISAX_MIC) += mic.o isac.o arcofi.o hscx.o
...@@ -51,11 +55,9 @@ hisax-$(CONFIG_HISAX_NICCY) += niccy.o isac.o arcofi.o hscx.o ...@@ -51,11 +55,9 @@ hisax-$(CONFIG_HISAX_NICCY) += niccy.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_ISURF) += isurf.o isac.o arcofi.o isar.o hisax-$(CONFIG_HISAX_ISURF) += isurf.o isac.o arcofi.o isar.o
hisax-$(CONFIG_HISAX_HSTSAPHIR) += saphir.o isac.o arcofi.o hscx.o hisax-$(CONFIG_HISAX_HSTSAPHIR) += saphir.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_BKM_A4T) += bkm_a4t.o isac.o arcofi.o jade.o hisax-$(CONFIG_HISAX_BKM_A4T) += bkm_a4t.o isac.o arcofi.o jade.o
hisax-$(CONFIG_HISAX_SCT_QUADRO) += bkm_a8.o isac.o arcofi.o hscx.o ipac.o hisax-$(CONFIG_HISAX_SCT_QUADRO) += bkm_a8.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_GAZEL) += gazel.o isac.o arcofi.o hscx.o ipac.o hisax-$(CONFIG_HISAX_GAZEL) += gazel.o isac.o arcofi.o hscx.o
hisax-$(CONFIG_HISAX_W6692) += w6692.o hisax-$(CONFIG_HISAX_W6692) += w6692.o
hisax-$(CONFIG_HISAX_ENTERNOW_PCI) += enternow_pci.o amd7930_fn.o hisax-$(CONFIG_HISAX_ENTERNOW_PCI) += enternow_pci.o amd7930_fn.o
#hisax-$(CONFIG_HISAX_TESTEMU) += testemu.o #hisax-$(CONFIG_HISAX_TESTEMU) += testemu.o
CERT = $(shell cd $(src); md5sum -c md5sums.asc > /dev/null 2> /dev/null ;echo $$?)
CFLAGS_cert.o = -DCERTIFICATION=$(CERT)
This diff is collapsed.
...@@ -12,13 +12,26 @@ ...@@ -12,13 +12,26 @@
*/ */
#define BYTE unsigned char
#define WORD unsigned int
#define rByteAMD(cs, reg) cs->readisac(cs, reg)
#define wByteAMD(cs, reg, val) cs->writeisac(cs, reg, val)
#define rWordAMD(cs, reg) ReadWordAmd7930(cs, reg)
#define wWordAMD(cs, reg, val) WriteWordAmd7930(cs, reg, val)
#define HIBYTE(w) ((unsigned char)((w & 0xff00) / 256))
#define LOBYTE(w) ((unsigned char)(w & 0x00ff))
#define AmdIrqOff(cs) cs->dc.amd7930.setIrqMask(cs, 0)
#define AmdIrqOn(cs) cs->dc.amd7930.setIrqMask(cs, 1)
#define AMD_CR 0x00 #define AMD_CR 0x00
#define AMD_DR 0x01 #define AMD_DR 0x01
#define DBUSY_TIMER_VALUE 80 #define DBUSY_TIMER_VALUE 80
void Amd7930_interrupt(struct IsdnCardState *cs, unsigned char irflags); extern void Amd7930_interrupt(struct IsdnCardState *, unsigned char);
void Amd7930_init(struct IsdnCardState *cs); extern void Amd7930_init(struct IsdnCardState *);
int amd7930_setup(struct IsdnCardState *cs, struct dc_hw_ops *amd7930_ops, extern void setup_Amd7930(struct IsdnCardState *);
void (*set_irq_mask)(struct IsdnCardState *, u8 val));
/* $Id: arcofi.c,v 1.12.6.2 2001/09/23 22:24:46 kai Exp $ /* $Id: arcofi.c,v 1.14.2.3 2004/01/13 14:31:24 keil Exp $
* *
* Ansteuerung ARCOFI 2165 * Ansteuerung ARCOFI 2165
* *
...@@ -17,19 +17,6 @@ ...@@ -17,19 +17,6 @@
#define ARCOFI_TIMER_VALUE 20 #define ARCOFI_TIMER_VALUE 20
static inline u8
isac_read(struct IsdnCardState *cs, u8 addr)
{
return cs->dc_hw_ops->read_reg(cs, addr);
}
static inline void
isac_write(struct IsdnCardState *cs, u8 addr, u8 val)
{
cs->dc_hw_ops->write_reg(cs, addr, val);
}
static void static void
add_arcofi_timer(struct IsdnCardState *cs) { add_arcofi_timer(struct IsdnCardState *cs) {
if (test_and_set_bit(FLG_ARCOFI_TIMER, &cs->HW_Flags)) { if (test_and_set_bit(FLG_ARCOFI_TIMER, &cs->HW_Flags)) {
...@@ -42,7 +29,7 @@ add_arcofi_timer(struct IsdnCardState *cs) { ...@@ -42,7 +29,7 @@ add_arcofi_timer(struct IsdnCardState *cs) {
static void static void
send_arcofi(struct IsdnCardState *cs) { send_arcofi(struct IsdnCardState *cs) {
u8 val; u_char val;
add_arcofi_timer(cs); add_arcofi_timer(cs);
cs->dc.isac.mon_txp = 0; cs->dc.isac.mon_txp = 0;
...@@ -56,11 +43,11 @@ send_arcofi(struct IsdnCardState *cs) { ...@@ -56,11 +43,11 @@ send_arcofi(struct IsdnCardState *cs) {
} }
cs->dc.isac.mocr &= 0x0f; cs->dc.isac.mocr &= 0x0f;
cs->dc.isac.mocr |= 0xa0; cs->dc.isac.mocr |= 0xa0;
isac_write(cs, ISAC_MOCR, cs->dc.isac.mocr); cs->writeisac(cs, ISAC_MOCR, cs->dc.isac.mocr);
val = isac_read(cs, ISAC_MOSR); val = cs->readisac(cs, ISAC_MOSR);
isac_write(cs, ISAC_MOX1, cs->dc.isac.mon_tx[cs->dc.isac.mon_txp++]); cs->writeisac(cs, ISAC_MOX1, cs->dc.isac.mon_tx[cs->dc.isac.mon_txp++]);
cs->dc.isac.mocr |= 0x10; cs->dc.isac.mocr |= 0x10;
isac_write(cs, ISAC_MOCR, cs->dc.isac.mocr); cs->writeisac(cs, ISAC_MOCR, cs->dc.isac.mocr);
} }
int int
......
This diff is collapsed.
This diff is collapsed.
/* $Id: avm_a1p.c,v 2.7.6.2 2001/09/23 22:24:46 kai Exp $ /* $Id: avm_a1p.c,v 2.9.2.5 2004/01/24 20:47:19 keil Exp $
* *
* low level stuff for the following AVM cards: * low level stuff for the following AVM cards:
* A1 PCMCIA * A1 PCMCIA
...@@ -56,176 +56,182 @@ ...@@ -56,176 +56,182 @@
#define byteout(addr,val) outb(val,addr) #define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr) #define bytein(addr) inb(addr)
static const char *avm_revision = "$Revision: 2.7.6.2 $"; static const char *avm_revision = "$Revision: 2.9.2.5 $";
static spinlock_t avm_a1p_lock = SPIN_LOCK_UNLOCKED;
static inline u8 static inline u_char
readreg(struct IsdnCardState *cs, int offset, u8 adr) ReadISAC(struct IsdnCardState *cs, u_char offset)
{ {
unsigned long flags; u_char ret;
u8 ret;
spin_lock_irqsave(&avm_a1p_lock, flags); offset -= 0x20;
byteout(cs->hw.avm.cfg_reg + ADDRREG_OFFSET, offset + adr - 0x20); byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_REG_OFFSET+offset);
ret = bytein(cs->hw.avm.cfg_reg + DATAREG_OFFSET); ret = bytein(cs->hw.avm.cfg_reg+DATAREG_OFFSET);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
return ret; return ret;
} }
static inline void static inline void
writereg(struct IsdnCardState *cs, int offset, u8 adr, u8 value) WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
{ {
unsigned long flags; offset -= 0x20;
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_REG_OFFSET+offset);
spin_lock_irqsave(&avm_a1p_lock, flags);
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET, offset + adr - 0x20);
byteout(cs->hw.avm.cfg_reg+DATAREG_OFFSET, value); byteout(cs->hw.avm.cfg_reg+DATAREG_OFFSET, value);
spin_unlock_irqrestore(&avm_a1p_lock, flags);
} }
static inline void static inline void
readfifo(struct IsdnCardState *cs, int offset, u8 *data, int size) ReadISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{ {
byteout(cs->hw.avm.cfg_reg + ADDRREG_OFFSET, offset); byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_FIFO_OFFSET);
insb(cs->hw.avm.cfg_reg + DATAREG_OFFSET, data, size); insb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
} }
static inline void static inline void
writefifo(struct IsdnCardState *cs, int offset, u8 *data, int size) WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{ {
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET, offset); byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,ISAC_FIFO_OFFSET);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size); outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
} }
static u8 static inline u_char
isac_read(struct IsdnCardState *cs, u8 adr) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
return readreg(cs, ISAC_REG_OFFSET, adr); u_char ret;
}
static void offset -= 0x20;
isac_write(struct IsdnCardState *cs, u8 adr, u8 value) byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
{ HSCX_REG_OFFSET+hscx*HSCX_CH_DIFF+offset);
writereg(cs, ISAC_REG_OFFSET, adr, value); ret = bytein(cs->hw.avm.cfg_reg+DATAREG_OFFSET);
} return ret;
static void
isac_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
readfifo(cs, ISAC_FIFO_OFFSET, data, size);
} }
static void static inline void
isac_write_fifo(struct IsdnCardState *cs, u8 *data, int size) WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value)
{ {
writefifo(cs, ISAC_FIFO_OFFSET, data, size); offset -= 0x20;
byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_REG_OFFSET+hscx*HSCX_CH_DIFF+offset);
byteout(cs->hw.avm.cfg_reg+DATAREG_OFFSET, value);
} }
static struct dc_hw_ops isac_ops = { static inline void
.read_reg = isac_read, ReadHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
hscx_read(struct IsdnCardState *cs, int hscx, u8 adr)
{ {
return readreg(cs, HSCX_REG_OFFSET + hscx*HSCX_CH_DIFF, adr); byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_FIFO_OFFSET+hscx*HSCX_CH_DIFF);
insb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
} }
static void static inline void
hscx_write(struct IsdnCardState *cs, int hscx, u8 adr, u8 value) WriteHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
{ {
writereg(cs, HSCX_REG_OFFSET + hscx*HSCX_CH_DIFF, adr, value); byteout(cs->hw.avm.cfg_reg+ADDRREG_OFFSET,
HSCX_FIFO_OFFSET+hscx*HSCX_CH_DIFF);
outsb(cs->hw.avm.cfg_reg+DATAREG_OFFSET, data, size);
} }
static void /*
hscx_read_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int size) * fast interrupt HSCX stuff goes here
{ */
return readfifo(cs, HSCX_FIFO_OFFSET + hscx*HSCX_CH_DIFF, data, size);
}
static void #define READHSCX(cs, nr, reg) ReadHSCX(cs, nr, reg)
hscx_write_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int size) #define WRITEHSCX(cs, nr, reg, data) WriteHSCX(cs, nr, reg, data)
{ #define READHSCXFIFO(cs, nr, ptr, cnt) ReadHSCXfifo(cs, nr, ptr, cnt)
writefifo(cs, HSCX_FIFO_OFFSET + hscx*HSCX_CH_DIFF, data, size); #define WRITEHSCXFIFO(cs, nr, ptr, cnt) WriteHSCXfifo(cs, nr, ptr, cnt)
}
static struct bc_hw_ops hscx_ops = { #include "hscx_irq.c"
.read_reg = hscx_read,
.write_reg = hscx_write,
.read_fifo = hscx_read_fifo,
.write_fifo = hscx_write_fifo,
};
static irqreturn_t static irqreturn_t
avm_a1p_interrupt(int intno, void *dev_id, struct pt_regs *regs) avm_a1p_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u8 val, sval; u_char val, sval;
u_long flags;
spin_lock(&cs->lock); spin_lock_irqsave(&cs->lock, flags);
while ((sval = (~bytein(cs->hw.avm.cfg_reg+ASL0_OFFSET) & ASL0_R_IRQPENDING))) { while ((sval = (~bytein(cs->hw.avm.cfg_reg+ASL0_OFFSET) & ASL0_R_IRQPENDING))) {
if (cs->debug & L1_DEB_INTSTAT) if (cs->debug & L1_DEB_INTSTAT)
debugl1(cs, "avm IntStatus %x", sval); debugl1(cs, "avm IntStatus %x", sval);
if (sval & ASL0_R_HSCX) { if (sval & ASL0_R_HSCX) {
val = hscx_read(cs, 1, HSCX_ISTA); val = ReadHSCX(cs, 1, HSCX_ISTA);
if (val) if (val)
hscx_int_main(cs, val); hscx_int_main(cs, val);
} }
if (sval & ASL0_R_ISAC) { if (sval & ASL0_R_ISAC) {
val = isac_read(cs, ISAC_ISTA); val = ReadISAC(cs, ISAC_ISTA);
if (val) if (val)
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
} }
hscx_write(cs, 0, HSCX_MASK, 0xFF); WriteHSCX(cs, 0, HSCX_MASK, 0xff);
hscx_write(cs, 1, HSCX_MASK, 0xFF); WriteHSCX(cs, 1, HSCX_MASK, 0xff);
isac_write(cs, ISAC_MASK, 0xFF); WriteISAC(cs, ISAC_MASK, 0xff);
isac_write(cs, ISAC_MASK, 0x0); WriteISAC(cs, ISAC_MASK, 0x00);
hscx_write(cs, 0, HSCX_MASK, 0x0); WriteHSCX(cs, 0, HSCX_MASK, 0x00);
hscx_write(cs, 1, HSCX_MASK, 0x0); WriteHSCX(cs, 1, HSCX_MASK, 0x00);
spin_unlock(&cs->lock); spin_unlock_irqrestore(&cs->lock, flags);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void
avm_a1p_init(struct IsdnCardState *cs)
{
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,
ASL0_W_TDISABLE|ASL0_W_TRESET|ASL0_W_IRQENABLE);
inithscxisac(cs);
}
static int static int
avm_a1p_reset(struct IsdnCardState *cs) AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
u_long flags;
switch (mt) {
case CARD_RESET:
spin_lock_irqsave(&cs->lock, flags);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00); byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
HZDELAY(HZ / 5 + 1); HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_RESET); byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_RESET);
HZDELAY(HZ / 5 + 1); HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00); byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
spin_unlock_irqrestore(&cs->lock, flags);
return 0;
case CARD_RELEASE:
/* free_irq is done in HiSax_closecard(). */
/* free_irq(cs->irq, cs); */
return 0; return 0;
}
static struct card_ops avm_a1p_ops = { case CARD_INIT:
.init = avm_a1p_init, spin_lock_irqsave(&cs->lock, flags);
.reset = avm_a1p_reset, byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_TDISABLE|ASL0_W_TRESET|ASL0_W_IRQENABLE);
.irq_func = avm_a1p_interrupt, clear_pending_isac_ints(cs);
}; clear_pending_hscx_ints(cs);
inithscxisac(cs, 1);
inithscxisac(cs, 2);
spin_unlock_irqrestore(&cs->lock, flags);
return 0;
static int __init case CARD_TEST:
avm_a1p_probe(struct IsdnCardState *cs, struct IsdnCard *card) /* we really don't need it for the PCMCIA Version */
return 0;
default:
/* all card drivers ignore others, so we do the same */
return 0;
}
return 0;
}
int
setup_avm_a1_pcmcia(struct IsdnCard *card)
{ {
u8 model, vers; u_char model, vers;
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, avm_revision);
printk(KERN_INFO "HiSax: AVM A1 PCMCIA driver Rev. %s\n",
HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_A1_PCMCIA)
return (0);
cs->irq = card->para[0];
cs->hw.avm.cfg_reg = card->para[1]; cs->hw.avm.cfg_reg = card->para[1];
cs->irq = card->para[0];
outb(cs->hw.avm.cfg_reg+ASL1_OFFSET, ASL1_W_ENABLE_S0);
outb(cs->hw.avm.cfg_reg+ASL1_OFFSET, ASL1_W_ENABLE_S0);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00); byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
HZDELAY(HZ / 5 + 1); HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_RESET); byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_RESET);
...@@ -240,24 +246,23 @@ avm_a1p_probe(struct IsdnCardState *cs, struct IsdnCard *card) ...@@ -240,24 +246,23 @@ avm_a1p_probe(struct IsdnCardState *cs, struct IsdnCard *card)
printk(KERN_INFO "AVM A1 PCMCIA: io 0x%x irq %d model %d version %d\n", printk(KERN_INFO "AVM A1 PCMCIA: io 0x%x irq %d model %d version %d\n",
cs->hw.avm.cfg_reg, cs->irq, model, vers); cs->hw.avm.cfg_reg, cs->irq, model, vers);
cs->card_ops = &avm_a1p_ops; setup_isac(cs);
if (hscxisac_setup(cs, &isac_ops, &hscx_ops)) cs->readisac = &ReadISAC;
goto err; cs->writeisac = &WriteISAC;
return 0; cs->readisacfifo = &ReadISACfifo;
err: cs->writeisacfifo = &WriteISACfifo;
hisax_release_resources(cs); cs->BC_Read_Reg = &ReadHSCX;
return -EBUSY; cs->BC_Write_Reg = &WriteHSCX;
} cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &AVM_card_msg;
int __devinit cs->irq_flags = SA_SHIRQ;
setup_avm_a1_pcmcia(struct IsdnCard *card) cs->irq_func = &avm_a1p_interrupt;
{
char tmp[64]; ISACVersion(cs, "AVM A1 PCMCIA:");
if (HscxVersion(cs, "AVM A1 PCMCIA:")) {
strcpy(tmp, avm_revision); printk(KERN_WARNING
printk(KERN_INFO "HiSax: AVM A1 PCMCIA driver Rev. %s\n", "AVM A1 PCMCIA: wrong HSCX versions check IO address\n");
HiSax_getrev(tmp)); return (0);
if (avm_a1p_probe(card->cs, card)) }
return 0; return (1);
return 1;
} }
This diff is collapsed.
...@@ -26,15 +26,12 @@ ...@@ -26,15 +26,12 @@
#include <pcmcia/cs.h> #include <pcmcia/cs.h>
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include "hisax_cfg.h"
MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for AVM A1/Fritz!PCMCIA cards"); MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for AVM A1/Fritz!PCMCIA cards");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
int avm_a1_init_pcmcia(void *pcm_iob, int pcm_irq, int *busy_flag, int prot);
void HiSax_closecard(int cardnr);
/* /*
All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
you do not define PCMCIA_DEBUG at all, all the debug code will be you do not define PCMCIA_DEBUG at all, all the debug code will be
...@@ -156,6 +153,15 @@ static dev_link_t *avma1cs_attach(void) ...@@ -156,6 +153,15 @@ static dev_link_t *avma1cs_attach(void)
return NULL; return NULL;
memset(link, 0, sizeof(struct dev_link_t)); memset(link, 0, sizeof(struct dev_link_t));
/* Allocate space for private device-specific data */
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local) {
kfree(link);
return NULL;
}
memset(local, 0, sizeof(local_info_t));
link->priv = local;
/* The io structure describes IO port mapping */ /* The io structure describes IO port mapping */
link->io.NumPorts1 = 16; link->io.NumPorts1 = 16;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
...@@ -183,15 +189,6 @@ static dev_link_t *avma1cs_attach(void) ...@@ -183,15 +189,6 @@ static dev_link_t *avma1cs_attach(void)
link->conf.ConfigIndex = 1; link->conf.ConfigIndex = 1;
link->conf.Present = PRESENT_OPTION; link->conf.Present = PRESENT_OPTION;
/* Allocate space for private device-specific data */
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local) {
kfree(link);
return NULL;
}
memset(local, 0, sizeof(local_info_t));
link->priv = local;
/* Register with Card Services */ /* Register with Card Services */
link->next = dev_list; link->next = dev_list;
dev_list = link; dev_list = link;
...@@ -303,8 +300,9 @@ static void avma1cs_config(dev_link_t *link) ...@@ -303,8 +300,9 @@ static void avma1cs_config(dev_link_t *link)
cistpl_cftable_entry_t *cf = &parse.cftable_entry; cistpl_cftable_entry_t *cf = &parse.cftable_entry;
local_info_t *dev; local_info_t *dev;
int i; int i;
u8 buf[64]; u_char buf[64];
char devname[128]; char devname[128];
IsdnCard_t icard;
int busy = 0; int busy = 0;
handle = link->handle; handle = link->handle;
...@@ -421,15 +419,17 @@ static void avma1cs_config(dev_link_t *link) ...@@ -421,15 +419,17 @@ static void avma1cs_config(dev_link_t *link)
printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n",
link->io.BasePort1, link->irq.AssignedIRQ); link->io.BasePort1, link->irq.AssignedIRQ);
if (avm_a1_init_pcmcia((void *)(int)link->io.BasePort1, icard.para[0] = link->irq.AssignedIRQ;
link->irq.AssignedIRQ, icard.para[1] = link->io.BasePort1;
&busy, isdnprot) != 0) { icard.protocol = isdnprot;
icard.typ = ISDN_CTYPE_A1_PCMCIA;
i = hisax_init_pcmcia(link, &busy, &icard);
if (i < 0) {
printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 PCMCIA %d at i/o %#x\n", i, link->io.BasePort1); printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 PCMCIA %d at i/o %#x\n", i, link->io.BasePort1);
avma1cs_release(link);
return; return;
} }
i = 0; /* no returncode for cardnr :-( */
dev->node.minor = i; dev->node.minor = i;
} /* avma1cs_config */ } /* avma1cs_config */
...@@ -487,7 +487,6 @@ static int avma1cs_event(event_t event, int priority, ...@@ -487,7 +487,6 @@ static int avma1cs_event(event_t event, int priority,
switch (event) { switch (event) {
case CS_EVENT_CARD_REMOVAL: case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) if (link->state & DEV_CONFIG)
avma1cs_release(link); avma1cs_release(link);
break; break;
...@@ -522,9 +521,11 @@ static struct pcmcia_driver avma1cs_driver = { ...@@ -522,9 +521,11 @@ static struct pcmcia_driver avma1cs_driver = {
.detach = avma1cs_detach, .detach = avma1cs_detach,
}; };
/*====================================================================*/
static int __init init_avma1_cs(void) static int __init init_avma1_cs(void)
{ {
return pcmcia_register_driver(&avma1cs_driver); return(pcmcia_register_driver(&avma1cs_driver));
} }
static void __exit exit_avma1_cs(void) static void __exit exit_avma1_cs(void)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $Id: cert.c,v 2.3.6.3 2001/09/23 22:24:47 kai Exp $
*
* Author Karsten Keil
* Copyright by Karsten Keil <keil@isdn4linux.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
* For changes and modifications please read
* ../../../Documentation/isdn/HiSax.cert
*
*/
#include <linux/kernel.h>
int
certification_check(int output) {
#ifdef CERTIFICATION
#if CERTIFICATION == 0
if (output) {
printk(KERN_INFO "HiSax: Approval certification valid\n");
printk(KERN_INFO "HiSax: Approved with ELSA Microlink PCI cards\n");
printk(KERN_INFO "HiSax: Approved with Eicon Technology Diva 2.01 PCI cards\n");
printk(KERN_INFO "HiSax: Approved with Sedlbauer Speedfax + cards\n");
printk(KERN_INFO "HiSax: Approved with HFC-S PCI A based cards\n");
}
return(0);
#endif
#if CERTIFICATION == 1
if (output) {
printk(KERN_INFO "HiSax: Approval certification failed because of\n");
printk(KERN_INFO "HiSax: unauthorized source code changes\n");
}
return(1);
#endif
#if CERTIFICATION == 127
if (output) {
printk(KERN_INFO "HiSax: Approval certification not possible\n");
printk(KERN_INFO "HiSax: because \"md5sum\" is not available\n");
}
return(2);
#endif
#else
if (output) {
printk(KERN_INFO "HiSax: Certification not verified\n");
}
return(3);
#endif
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <pcmcia/cistpl.h> #include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include "hisax_cfg.h"
MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Elsa PCM cards"); MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Elsa PCM cards");
MODULE_AUTHOR("Klaus Lichtenwalder"); MODULE_AUTHOR("Klaus Lichtenwalder");
...@@ -71,7 +72,7 @@ static int pc_debug = PCMCIA_DEBUG; ...@@ -71,7 +72,7 @@ static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i"); MODULE_PARM(pc_debug, "i");
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
static char *version = static char *version =
"elsa_cs.c $Revision: 1.1.2.2 $ $Date: 2001/09/23 22:24:47 $ (K.Lichtenwalder)"; "elsa_cs.c $Revision: 1.2.2.4 $ $Date: 2004/01/25 15:07:06 $ (K.Lichtenwalder)";
#else #else
#define DEBUG(n, args...) #define DEBUG(n, args...)
#endif #endif
...@@ -93,8 +94,6 @@ MODULE_PARM(irq_list, "1-4i"); ...@@ -93,8 +94,6 @@ MODULE_PARM(irq_list, "1-4i");
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i"); MODULE_PARM(protocol, "i");
extern int elsa_init_pcmcia(int, int, int*, int);
/*====================================================================*/ /*====================================================================*/
/* /*
...@@ -168,6 +167,7 @@ typedef struct local_info_t { ...@@ -168,6 +167,7 @@ typedef struct local_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node; dev_node_t node;
int busy; int busy;
int cardnr;
} local_info_t; } local_info_t;
/*====================================================================== /*======================================================================
...@@ -188,7 +188,6 @@ static dev_link_t *elsa_cs_attach(void) ...@@ -188,7 +188,6 @@ static dev_link_t *elsa_cs_attach(void)
dev_link_t *link; dev_link_t *link;
local_info_t *local; local_info_t *local;
int ret, i; int ret, i;
void elsa_interrupt(int, void *, struct pt_regs *);
DEBUG(0, "elsa_cs_attach()\n"); DEBUG(0, "elsa_cs_attach()\n");
...@@ -196,6 +195,7 @@ static dev_link_t *elsa_cs_attach(void) ...@@ -196,6 +195,7 @@ static dev_link_t *elsa_cs_attach(void)
local = kmalloc(sizeof(local_info_t), GFP_KERNEL); local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local) return NULL; if (!local) return NULL;
memset(local, 0, sizeof(local_info_t)); memset(local, 0, sizeof(local_info_t));
local->cardnr = -1;
link = &local->link; link->priv = local; link = &local->link; link->priv = local;
/* Interrupt setup */ /* Interrupt setup */
...@@ -337,6 +337,7 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -337,6 +337,7 @@ static void elsa_cs_config(dev_link_t *link)
int i, j, last_fn; int i, j, last_fn;
u_short buf[128]; u_short buf[128];
cistpl_cftable_entry_t *cf = &parse.cftable_entry; cistpl_cftable_entry_t *cf = &parse.cftable_entry;
IsdnCard_t icard;
DEBUG(0, "elsa_config(0x%p)\n", link); DEBUG(0, "elsa_config(0x%p)\n", link);
handle = link->handle; handle = link->handle;
...@@ -430,9 +431,19 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -430,9 +431,19 @@ static void elsa_cs_config(dev_link_t *link)
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
elsa_init_pcmcia(link->io.BasePort1, link->irq.AssignedIRQ, icard.para[0] = link->irq.AssignedIRQ;
&(((local_info_t*)link->priv)->busy), icard.para[1] = link->io.BasePort1;
protocol); icard.protocol = protocol;
icard.typ = ISDN_CTYPE_ELSA_PCMCIA;
i = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->busy), &icard);
if (i < 0) {
printk(KERN_ERR "elsa_cs: failed to initialize Elsa PCMCIA %d at i/o %#x\n",
i, link->io.BasePort1);
elsa_cs_release(link);
} else
((local_info_t*)link->priv)->cardnr = i;
return; return;
cs_failed: cs_failed:
cs_error(link->handle, last_fn, i); cs_error(link->handle, last_fn, i);
...@@ -449,9 +460,16 @@ static void elsa_cs_config(dev_link_t *link) ...@@ -449,9 +460,16 @@ static void elsa_cs_config(dev_link_t *link)
static void elsa_cs_release(dev_link_t *link) static void elsa_cs_release(dev_link_t *link)
{ {
local_info_t *local = link->priv;
DEBUG(0, "elsa_cs_release(0x%p)\n", link); DEBUG(0, "elsa_cs_release(0x%p)\n", link);
if (local) {
if (local->cardnr >= 0) {
/* no unregister function with hisax */
HiSax_closecard(local->cardnr);
}
}
/* Unlink the device chain */ /* Unlink the device chain */
link->dev = NULL; link->dev = NULL;
......
This diff is collapsed.
...@@ -40,3 +40,12 @@ ...@@ -40,3 +40,12 @@
* den TigerJet i/o-Raum gemappt * den TigerJet i/o-Raum gemappt
* -> 0x01 des AMD bei hw.njet.base + 0C4 */ * -> 0x01 des AMD bei hw.njet.base + 0C4 */
#define TJ_AMD_PORT 0xC0 #define TJ_AMD_PORT 0xC0
/* ***************************************************************************************** *
* *************************************** Prototypen ************************************** *
* ***************************************************************************************** */
BYTE ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset);
void WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $Id: hfc_2bds0.h,v 1.4.6.2 2001/09/23 22:24:47 kai Exp $ /* $Id: hfc_2bds0.h,v 1.6.2.2 2004/01/12 22:52:26 keil Exp $
* *
* specific defines for CCD's HFC 2BDS0 * specific defines for CCD's HFC 2BDS0
* *
...@@ -124,5 +124,5 @@ ...@@ -124,5 +124,5 @@
extern void main_irq_2bds0(struct BCState *bcs); extern void main_irq_2bds0(struct BCState *bcs);
extern void init2bds0(struct IsdnCardState *cs); extern void init2bds0(struct IsdnCardState *cs);
extern void release2bds0(struct IsdnCardState *cs); extern void release2bds0(struct IsdnCardState *cs);
extern void hfc2bds0_interrupt(struct IsdnCardState *cs, u8 val); extern void hfc2bds0_interrupt(struct IsdnCardState *cs, u_char val);
extern void set_cs_func(struct IsdnCardState *cs); extern void set_cs_func(struct IsdnCardState *cs);
This diff is collapsed.
/* $Id: hfc_2bs0.h,v 1.3.6.2 2001/09/23 22:24:47 kai Exp $ /* $Id: hfc_2bs0.h,v 1.5.2.2 2004/01/12 22:52:26 keil Exp $
* *
* specific defines for CCD's HFC 2BS0 * specific defines for CCD's HFC 2BS0
* *
...@@ -58,4 +58,3 @@ ...@@ -58,4 +58,3 @@
extern void main_irq_hfc(struct BCState *bcs); extern void main_irq_hfc(struct BCState *bcs);
extern void inithfc(struct IsdnCardState *cs); extern void inithfc(struct IsdnCardState *cs);
extern void releasehfc(struct IsdnCardState *cs); extern void releasehfc(struct IsdnCardState *cs);
extern int hfc_setup(struct IsdnCardState *cs, struct bc_hw_ops *hfc_ops);
This diff is collapsed.
/* $Id: hfc_pci.h,v 1.8.6.2 2001/09/23 22:24:48 kai Exp $ /* $Id: hfc_pci.h,v 1.10.2.2 2004/01/12 22:52:26 keil Exp $
* *
* specific defines for CCD's HFC 2BDS0 PCI chips * specific defines for CCD's HFC 2BDS0 PCI chips
* *
...@@ -185,53 +185,51 @@ ...@@ -185,53 +185,51 @@
typedef struct { typedef struct {
unsigned short z1; /* Z1 pointer 16 Bit */ unsigned short z1; /* Z1 pointer 16 Bit */
unsigned short z2; /* Z2 pointer 16 Bit */ unsigned short z2; /* Z2 pointer 16 Bit */
} __attribute__((packed)) z_type; } z_type;
typedef struct { typedef struct {
u8 data[D_FIFO_SIZE]; /* FIFO data space */ u_char data[D_FIFO_SIZE]; /* FIFO data space */
u8 fill1[0x20A0-D_FIFO_SIZE]; /* reserved, do not use */ u_char fill1[0x20A0-D_FIFO_SIZE]; /* reserved, do not use */
u8 f1,f2; /* f pointers */ u_char f1,f2; /* f pointers */
u8 fill2[0x20C0-0x20A2]; /* reserved, do not use */ u_char fill2[0x20C0-0x20A2]; /* reserved, do not use */
z_type za[MAX_D_FRAMES+1]; /* mask index with D_FREG_MASK for access */ z_type za[MAX_D_FRAMES+1]; /* mask index with D_FREG_MASK for access */
u8 fill3[0x4000-0x2100]; /* align 16K */ u_char fill3[0x4000-0x2100]; /* align 16K */
} __attribute__((packed)) dfifo_type; } dfifo_type;
typedef struct { typedef struct {
z_type za[MAX_B_FRAMES+1]; /* only range 0x0..0x1F allowed */ z_type za[MAX_B_FRAMES+1]; /* only range 0x0..0x1F allowed */
u8 f1,f2; /* f pointers */ u_char f1,f2; /* f pointers */
u8 fill[0x2100-0x2082]; /* alignment */ u_char fill[0x2100-0x2082]; /* alignment */
} __attribute__((packed)) bzfifo_type; } bzfifo_type;
typedef union { typedef union {
struct { struct {
dfifo_type d_tx; /* D-send channel */ dfifo_type d_tx; /* D-send channel */
dfifo_type d_rx; /* D-receive channel */ dfifo_type d_rx; /* D-receive channel */
} __attribute__((packed)) d_chan; } d_chan;
struct { struct {
u8 fill1[0x200]; u_char fill1[0x200];
u8 txdat_b1[B_FIFO_SIZE]; u_char txdat_b1[B_FIFO_SIZE];
bzfifo_type txbz_b1; bzfifo_type txbz_b1;
bzfifo_type txbz_b2; bzfifo_type txbz_b2;
u8 txdat_b2[B_FIFO_SIZE]; u_char txdat_b2[B_FIFO_SIZE];
u8 fill2[D_FIFO_SIZE]; u_char fill2[D_FIFO_SIZE];
u8 rxdat_b1[B_FIFO_SIZE]; u_char rxdat_b1[B_FIFO_SIZE];
bzfifo_type rxbz_b1; bzfifo_type rxbz_b1;
bzfifo_type rxbz_b2; bzfifo_type rxbz_b2;
u8 rxdat_b2[B_FIFO_SIZE]; u_char rxdat_b2[B_FIFO_SIZE];
} __attribute__((packed)) b_chans; } b_chans;
u8 fill[32768]; u_char fill[32768];
} __attribute__((packed)) fifo_area; } fifo_area;
//#define Write_hfc(a,b,c) (*(((u8 *)a->hw.hfcpci.pci_io)+b) = c) #define Write_hfc(a,b,c) (*(((u_char *)a->hw.hfcpci.pci_io)+b) = c)
//#define Read_hfc(a,b) (*(((u8 *)a->hw.hfcpci.pci_io)+b)) #define Read_hfc(a,b) (*(((u_char *)a->hw.hfcpci.pci_io)+b))
#define Write_hfc(a,b,c) writeb(c, ((u8 *)a->hw.hfcpci.pci_io)+b)
#define Read_hfc(a,b) readb(((u8 *)a->hw.hfcpci.pci_io)+b)
extern void main_irq_hcpci(struct BCState *bcs); extern void main_irq_hcpci(struct BCState *bcs);
extern void inithfcpci(struct IsdnCardState *cs); extern void inithfcpci(struct IsdnCardState *cs);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $Id: hisax_cfg.h,v 1.1.2.1 2004/01/24 20:47:23 keil Exp $
* define of the basic HiSax configuration structures
* and pcmcia interface
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#define ISDN_CTYPE_16_0 1
#define ISDN_CTYPE_8_0 2
#define ISDN_CTYPE_16_3 3
#define ISDN_CTYPE_PNP 4
#define ISDN_CTYPE_A1 5
#define ISDN_CTYPE_ELSA 6
#define ISDN_CTYPE_ELSA_PNP 7
#define ISDN_CTYPE_TELESPCMCIA 8
#define ISDN_CTYPE_IX1MICROR2 9
#define ISDN_CTYPE_ELSA_PCMCIA 10
#define ISDN_CTYPE_DIEHLDIVA 11
#define ISDN_CTYPE_ASUSCOM 12
#define ISDN_CTYPE_TELEINT 13
#define ISDN_CTYPE_TELES3C 14
#define ISDN_CTYPE_SEDLBAUER 15
#define ISDN_CTYPE_SPORTSTER 16
#define ISDN_CTYPE_MIC 17
#define ISDN_CTYPE_ELSA_PCI 18
#define ISDN_CTYPE_COMPAQ_ISA 19
#define ISDN_CTYPE_NETJET_S 20
#define ISDN_CTYPE_TELESPCI 21
#define ISDN_CTYPE_SEDLBAUER_PCMCIA 22
#define ISDN_CTYPE_AMD7930 23
#define ISDN_CTYPE_NICCY 24
#define ISDN_CTYPE_S0BOX 25
#define ISDN_CTYPE_A1_PCMCIA 26
#define ISDN_CTYPE_FRITZPCI 27
#define ISDN_CTYPE_SEDLBAUER_FAX 28
#define ISDN_CTYPE_ISURF 29
#define ISDN_CTYPE_ACERP10 30
#define ISDN_CTYPE_HSTSAPHIR 31
#define ISDN_CTYPE_BKM_A4T 32
#define ISDN_CTYPE_SCT_QUADRO 33
#define ISDN_CTYPE_GAZEL 34
#define ISDN_CTYPE_HFC_PCI 35
#define ISDN_CTYPE_W6692 36
#define ISDN_CTYPE_HFC_SX 37
#define ISDN_CTYPE_NETJET_U 38
#define ISDN_CTYPE_HFC_SP_PCMCIA 39
#define ISDN_CTYPE_DYNAMIC 40
#define ISDN_CTYPE_ENTERNOW 41
#define ISDN_CTYPE_COUNT 41
typedef struct IsdnCardState IsdnCardState_t;
typedef struct IsdnCard IsdnCard_t;
struct IsdnCard {
int typ;
int protocol; /* EDSS1, 1TR6 or NI1 */
unsigned long para[4];
IsdnCardState_t *cs;
};
extern void HiSax_closecard(int);
extern int hisax_init_pcmcia(void *, int *, IsdnCard_t *);
...@@ -39,7 +39,7 @@ printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \ ...@@ -39,7 +39,7 @@ printk(KERN_DEBUG "%s: " format "\n" , __FUNCTION__ , ## arg); \
static void __attribute__((unused)) static void __attribute__((unused))
dump_packet(const char *name,const u8 *data,int pkt_len) dump_packet(const char *name,const u_char *data,int pkt_len)
{ {
#define DUMP_HDR_SIZE 20 #define DUMP_HDR_SIZE 20
#define DUMP_TLR_SIZE 8 #define DUMP_TLR_SIZE 8
......
This diff is collapsed.
#include "hisax_if.h"
#include "hisax_isac.h"
#include "hisax_hscx.h"
#include <linux/pci.h>
struct fritz_adapter {
unsigned int io;
unsigned int irq;
unsigned int cfg_reg;
unsigned int isac_base;
unsigned int isac_fifo;
unsigned int hscx_base[2];
unsigned int hscx_fifo[2];
struct isac isac;
struct hscx hscx[2];
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment