rebase on mainstream patchset 2.6.11

This commit is contained in:
Karsten Keil 2006-06-28 11:57:51 +00:00
parent ce088588fc
commit aa19ea2c54
55 changed files with 186 additions and 1796 deletions

View File

@ -40,10 +40,10 @@ MODULE_PARM_DESC(act_bus, "BusType of first card, 1=ISA, 2=MCA, 3=PCMCIA, curren
MODULE_PARM_DESC(membase, "Base port address of first card"); MODULE_PARM_DESC(membase, "Base port address of first card");
MODULE_PARM_DESC(act_irq, "IRQ of first card"); MODULE_PARM_DESC(act_irq, "IRQ of first card");
MODULE_PARM_DESC(act_id, "ID-String of first card"); MODULE_PARM_DESC(act_id, "ID-String of first card");
MODULE_PARM(act_bus, "i"); module_param(act_bus, int, 0);
MODULE_PARM(act_port, "i"); module_param(act_port, int, 0);
MODULE_PARM(act_irq, "i"); module_param(act_irq, int, 0);
MODULE_PARM(act_id, "s"); module_param(act_id, charp, 0);
static int act2000_addcard(int, int, int, char *); static int act2000_addcard(int, int, int, char *);

View File

@ -143,11 +143,11 @@ struct capidev {
/* -------- global variables ---------------------------------------- */ /* -------- global variables ---------------------------------------- */
static rwlock_t capidev_list_lock = RW_LOCK_UNLOCKED; static DEFINE_RWLOCK(capidev_list_lock);
static LIST_HEAD(capidev_list); static LIST_HEAD(capidev_list);
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
static rwlock_t capiminor_list_lock = RW_LOCK_UNLOCKED; static DEFINE_RWLOCK(capiminor_list_lock);
static LIST_HEAD(capiminor_list); static LIST_HEAD(capiminor_list);
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */

View File

@ -140,7 +140,7 @@ typedef struct capidrv_bchan capidrv_bchan;
/* -------- data definitions ----------------------------------------- */ /* -------- data definitions ----------------------------------------- */
static capidrv_data global; static capidrv_data global;
static spinlock_t global_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(global_lock);
static void handle_dtrace_data(capidrv_contr *card, static void handle_dtrace_data(capidrv_contr *card,
int send, int level2, u8 *data, u16 len); int send, int level2, u8 *data, u16 len);

View File

@ -93,6 +93,7 @@ capifs_fill_super(struct super_block *s, void *data, int silent)
s->s_blocksize_bits = 10; s->s_blocksize_bits = 10;
s->s_magic = CAPIFS_SUPER_MAGIC; s->s_magic = CAPIFS_SUPER_MAGIC;
s->s_op = &capifs_sops; s->s_op = &capifs_sops;
s->s_time_gran = 1;
inode = new_inode(s); inode = new_inode(s);
if (!inode) if (!inode)

View File

@ -63,9 +63,9 @@ 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);
rwlock_t capi_drivers_list_lock = RW_LOCK_UNLOCKED; DEFINE_RWLOCK(capi_drivers_list_lock);
static rwlock_t application_lock = RW_LOCK_UNLOCKED; static DEFINE_RWLOCK(application_lock);
static DECLARE_MUTEX(controller_sem); static DECLARE_MUTEX(controller_sem);
struct capi20_appl *capi_applications[CAPI_MAXAPPL]; struct capi20_appl *capi_applications[CAPI_MAXAPPL];

View File

@ -29,7 +29,7 @@
ulong if_used = 0; /* number of interface users */ ulong if_used = 0; /* number of interface users */
static struct divert_info *divert_info_head = NULL; /* head of queue */ static struct divert_info *divert_info_head = NULL; /* head of queue */
static struct divert_info *divert_info_tail = NULL; /* pointer to last entry */ static struct divert_info *divert_info_tail = NULL; /* pointer to last entry */
static spinlock_t divert_info_lock = SPIN_LOCK_UNLOCKED;/* lock for queue */ static DEFINE_SPINLOCK(divert_info_lock);/* lock for queue */
static wait_queue_head_t rd_queue; static wait_queue_head_t rd_queue;
/*********************************/ /*********************************/

View File

@ -48,7 +48,7 @@ static struct deflect_struc *table_head = NULL;
static struct deflect_struc *table_tail = NULL; static struct deflect_struc *table_tail = NULL;
static unsigned char extern_wait_max = 4; /* maximum wait in s for external process */ static unsigned char extern_wait_max = 4; /* maximum wait in s for external process */
spinlock_t divert_lock = SPIN_LOCK_UNLOCKED; DEFINE_SPINLOCK(divert_lock);
/***************************/ /***************************/
/* timer callback function */ /* timer callback function */

View File

@ -43,16 +43,6 @@ MODULE_LICENSE("GPL");
/*====================================================================*/ /*====================================================================*/
/* Parameters that can be set with 'insmod' */
/* This means pick from 15, 12, 11, 10, 9, 7, 5, 4, and 3 */
static int default_irq_list[10] = { 15, 12, 11, 10, 9, 7, 5, 4, 3, -1 };
static int irq_list[10] = { -1 };
MODULE_PARM(irq_list, "1-10i");
/*====================================================================*/
/* /*
The event() function is this driver's Card Services event handler. The event() function is this driver's Card Services event handler.
It will be called by Card Services when an appropriate card status It will be called by Card Services when an appropriate card status
@ -134,7 +124,7 @@ static dev_link_t *avmcs_attach(void)
client_reg_t client_reg; client_reg_t client_reg;
dev_link_t *link; dev_link_t *link;
local_info_t *local; local_info_t *local;
int ret, i; int ret;
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
@ -151,14 +141,7 @@ static dev_link_t *avmcs_attach(void)
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; link->irq.IRQInfo1 = IRQ_LEVEL_ID;
if (irq_list[0] != -1) {
for (i = 0; i < 10 && irq_list[i] > 0; i++)
link->irq.IRQInfo2 |= 1 << irq_list[i];
} else {
for (i = 0; i < 10 && default_irq_list[i] > 0; i++)
link->irq.IRQInfo2 |= 1 << default_irq_list[i];
}
/* General socket configuration */ /* General socket configuration */
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
@ -178,7 +161,6 @@ static dev_link_t *avmcs_attach(void)
link->next = dev_list; link->next = dev_list;
dev_list = link; dev_list = link;
client_reg.dev_info = &dev_info; client_reg.dev_info = &dev_info;
client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
client_reg.EventMask = client_reg.EventMask =
CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
@ -521,13 +503,7 @@ static int __init avmcs_init(void)
static void __exit avmcs_exit(void) static void __exit avmcs_exit(void)
{ {
pcmcia_unregister_driver(&avmcs_driver); pcmcia_unregister_driver(&avmcs_driver);
BUG_ON(dev_list != NULL);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
avmcs_release(dev_list);
avmcs_detach(dev_list);
}
} }
module_init(avmcs_init); module_init(avmcs_init);

View File

@ -89,7 +89,7 @@ typedef struct avmcard {
char msgbuf[128]; /* capimsg msg part */ char msgbuf[128]; /* capimsg msg part */
char databuf[2048]; /* capimsg data part */ char databuf[2048]; /* capimsg data part */
void *mbase; void __iomem *mbase;
volatile u32 csr; volatile u32 csr;
avmcard_dmainfo *dma; avmcard_dmainfo *dma;

View File

@ -200,7 +200,6 @@ static int __init b1pcmcia_init(void)
{ {
char *p; char *p;
char rev[32]; char rev[32];
int err;
if ((p = strchr(revision, ':')) != 0 && p[1]) { if ((p = strchr(revision, ':')) != 0 && p[1]) {
strlcpy(rev, p + 2, 32); strlcpy(rev, p + 2, 32);

View File

@ -64,7 +64,7 @@ extern void DIVA_DIDD_Read(DESCRIPTOR *, int);
*/ */
static void no_printf(unsigned char *, ...); static void no_printf(unsigned char *, ...);
#include "debuglib.c" #include "debuglib.c"
void xlog(char *x, ...) static void xlog(char *x, ...)
{ {
#ifndef DIVA_NO_DEBUGLIB #ifndef DIVA_NO_DEBUGLIB
va_list ap; va_list ap;
@ -157,7 +157,7 @@ static int find_free_id(void)
while (num < MAX_DESCRIPTORS) { while (num < MAX_DESCRIPTORS) {
a = &adapter[num]; a = &adapter[num];
if (!a->Id) if (!a->Id)
break; break;
num++; num++;
} }
return(num + 1); return(num + 1);
@ -353,7 +353,7 @@ static void clean_adapter(int id, struct list_head *free_mem_q)
if (k == 0) { if (k == 0) {
if (li_config_table) { if (li_config_table) {
list_add((struct list_head *)li_config_table, free_mem_q); list_add((struct list_head *)li_config_table, free_mem_q);
li_config_table = NULL; li_config_table = NULL;
} }
} else { } else {
if (a->li_base < k) { if (a->li_base < k) {
@ -1212,7 +1212,7 @@ int DIVA_INIT_FUNCTION init_capifunc(void)
void DIVA_EXIT_FUNCTION finit_capifunc(void) void DIVA_EXIT_FUNCTION finit_capifunc(void)
{ {
do_api_remove_start(); do_api_remove_start();
divacapi_disconnect_didd(); divacapi_disconnect_didd();
divacapi_remove_cards(); divacapi_remove_cards();
remove_main_structs(); remove_main_structs();
diva_os_destroy_spin_lock(&api_lock, "capifunc"); diva_os_destroy_spin_lock(&api_lock, "capifunc");

View File

@ -106,7 +106,7 @@ void diva_didd_load_time_finit (void) {
return adapter handle (> 0) on success return adapter handle (> 0) on success
return -1 adapter array overflow return -1 adapter array overflow
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
int diva_didd_add_descriptor (DESCRIPTOR* d) { static int diva_didd_add_descriptor (DESCRIPTOR* d) {
diva_os_spin_lock_magic_t irql; diva_os_spin_lock_magic_t irql;
int i; int i;
if (d->type == IDI_DIMAINT) { if (d->type == IDI_DIMAINT) {
@ -143,7 +143,7 @@ int diva_didd_add_descriptor (DESCRIPTOR* d) {
return adapter handle (> 0) on success return adapter handle (> 0) on success
return 0 on success return 0 on success
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
int diva_didd_remove_descriptor (IDI_CALL request) { static int diva_didd_remove_descriptor (IDI_CALL request) {
diva_os_spin_lock_magic_t irql; diva_os_spin_lock_magic_t irql;
int i; int i;
if (request == MAdapter.request) { if (request == MAdapter.request) {
@ -171,7 +171,7 @@ int diva_didd_remove_descriptor (IDI_CALL request) {
Read adapter array Read adapter array
return 1 if not enough space to save all available adapters return 1 if not enough space to save all available adapters
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
int diva_didd_read_adapter_array (DESCRIPTOR* buffer, int length) { static int diva_didd_read_adapter_array (DESCRIPTOR* buffer, int length) {
diva_os_spin_lock_magic_t irql; diva_os_spin_lock_magic_t irql;
int src, dst; int src, dst;
memset (buffer, 0x00, length); memset (buffer, 0x00, length);

View File

@ -25,11 +25,10 @@
*/ */
#ifndef __DIVA_DIDD_DADAPTER_INC__ #ifndef __DIVA_DIDD_DADAPTER_INC__
#define __DIVA_DIDD_DADAPTER_INC__ #define __DIVA_DIDD_DADAPTER_INC__
void diva_didd_load_time_init (void); void diva_didd_load_time_init (void);
void diva_didd_load_time_finit (void); void diva_didd_load_time_finit (void);
int diva_didd_add_descriptor (DESCRIPTOR* d);
int diva_didd_remove_descriptor (IDI_CALL request);
int diva_didd_read_adapter_array (DESCRIPTOR* buffer, int length);
#define OLD_MAX_DESCRIPTORS 16
#define NEW_MAX_DESCRIPTORS 64 #define NEW_MAX_DESCRIPTORS 64
#endif #endif

View File

@ -42,10 +42,7 @@
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void pr_out(ADAPTER * a); void pr_out(ADAPTER * a);
byte pr_dpc(ADAPTER * a); byte pr_dpc(ADAPTER * a);
void scom_out(ADAPTER * a);
byte scom_dpc(ADAPTER * a);
static byte pr_ready(ADAPTER * a); static byte pr_ready(ADAPTER * a);
static byte scom_ready(ADAPTER * a);
static byte isdn_rc(ADAPTER *, byte, byte, byte, word, dword, dword); static byte isdn_rc(ADAPTER *, byte, byte, byte, word, dword, dword);
static byte isdn_ind(ADAPTER *, byte, byte, byte, PBUFFER *, byte, word); static byte isdn_ind(ADAPTER *, byte, byte, byte, PBUFFER *, byte, word);
/* ----------------------------------------------------------------- /* -----------------------------------------------------------------
@ -59,11 +56,11 @@ static byte isdn_ind(ADAPTER *, byte, byte, byte, PBUFFER *, byte, word);
----------------------------------------------------------------- */ ----------------------------------------------------------------- */
#if defined(XDI_USE_XLOG) #if defined(XDI_USE_XLOG)
#define XDI_A_NR(_x_) ((byte)(((ISDN_ADAPTER *)(_x_->io))->ANum)) #define XDI_A_NR(_x_) ((byte)(((ISDN_ADAPTER *)(_x_->io))->ANum))
static void xdi_xlog (byte *msg, word code, int length);
static byte xdi_xlog_sec = 0;
#else #else
#define XDI_A_NR(_x_) ((byte)0) #define XDI_A_NR(_x_) ((byte)0)
#endif #endif
byte xdi_xlog_sec = 0;
void xdi_xlog (byte *msg, word code, int length);
static void xdi_xlog_rc_event (byte Adapter, static void xdi_xlog_rc_event (byte Adapter,
byte Id, byte Ch, byte Rc, byte cb, byte type); byte Id, byte Ch, byte Rc, byte cb, byte type);
static void xdi_xlog_request (byte Adapter, byte Id, static void xdi_xlog_request (byte Adapter, byte Id,
@ -345,192 +342,6 @@ byte pr_dpc(ADAPTER * a)
} }
return FALSE; return FALSE;
} }
byte pr_test_int(ADAPTER * a)
{
return a->ram_in(a,(void *)0x3ffc);
}
void pr_clear_int(ADAPTER * a)
{
a->ram_out(a,(void *)0x3ffc,0);
}
/*------------------------------------------------------------------*/
/* output function */
/*------------------------------------------------------------------*/
void scom_out(ADAPTER * a)
{
byte e_no;
ENTITY * this;
BUFFERS * X;
word length;
word i;
word clength;
byte more;
byte Id;
dtrc(dprintf("scom_out"));
/* check if the adapter is ready to accept an request: */
e_no = look_req(a);
if(!e_no)
{
dtrc(dprintf("no_req"));
return;
}
if(!scom_ready(a))
{
dtrc(dprintf("not_ready"));
return;
}
this = entity_ptr(a,e_no);
dtrc(dprintf("out:Req=%x,Id=%x,Ch=%x",this->Req,this->Id,this->ReqCh));
next_req(a);
/* now copy the data from the current data buffer into the */
/* adapters request buffer */
length = 0;
i = this->XCurrent;
X = PTR_X(a, this);
while(i<this->XNum && length<270) {
clength = MIN((word)(270-length),X[i].PLength-this->XOffset);
a->ram_out_buffer(a,
&RAM->XBuffer.P[length],
PTR_P(a,this,&X[i].P[this->XOffset]),
clength);
length +=clength;
this->XOffset +=clength;
if(this->XOffset==X[i].PLength) {
this->XCurrent = (byte)++i;
this->XOffset = 0;
}
}
a->ram_outw(a, &RAM->XBuffer.length, length);
a->ram_out(a, &RAM->ReqId, this->Id);
a->ram_out(a, &RAM->ReqCh, this->ReqCh);
/* if it's a specific request (no ASSIGN) ... */
if(this->Id &0x1f) {
/* if buffers are left in the list of data buffers do */
/* chaining (LL_MDATA, N_MDATA) */
this->More++;
if(i<this->XNum && this->MInd) {
a->ram_out(a, &RAM->Req, this->MInd);
more = TRUE;
}
else {
this->More |=XMOREF;
a->ram_out(a, &RAM->Req, this->Req);
more = FALSE;
if (a->FlowControlIdTable[this->ReqCh] == this->Id)
a->FlowControlSkipTable[this->ReqCh] = TRUE;
/*
Note that remove request was sent to the card
*/
if (this->Req == REMOVE) {
a->misc_flags_table[e_no] |= DIVA_MISC_FLAGS_REMOVE_PENDING;
}
}
if(more) {
req_queue(a,this->No);
}
}
/* else it's a ASSIGN */
else {
/* save the request code used for buffer chaining */
this->MInd = 0;
if (this->Id==BLLC_ID) this->MInd = LL_MDATA;
if (this->Id==NL_ID ||
this->Id==TASK_ID ||
this->Id==MAN_ID
) this->MInd = N_MDATA;
/* send the ASSIGN */
this->More |=XMOREF;
a->ram_out(a, &RAM->Req, this->Req);
/* save the reference of the ASSIGN */
assign_queue(a, this->No, 0);
}
/* if it is a 'unreturncoded' UREMOVE request, remove the */
/* Id from our table after sending the request */
if(this->Req==UREMOVE && this->Id) {
Id = this->Id;
e_no = a->IdTable[Id];
free_entity(a, e_no);
for (i = 0; i < 256; i++)
{
if (a->FlowControlIdTable[i] == Id)
a->FlowControlIdTable[i] = 0;
}
a->IdTable[Id] = 0;
this->Id = 0;
}
}
static byte scom_ready(ADAPTER * a)
{
if(a->ram_in(a, &RAM->Req)) {
if(!a->ReadyInt) {
a->ram_inc(a, &RAM->ReadyInt);
a->ReadyInt++;
}
return 0;
}
return 1;
}
/*------------------------------------------------------------------*/
/* isdn interrupt handler */
/*------------------------------------------------------------------*/
byte scom_dpc(ADAPTER * a)
{
byte c;
/* if a return code is available ... */
if(a->ram_in(a, &RAM->Rc)) {
/* call return code handler, if it is not our return code */
/* the handler returns 2, if it's the return code to an */
/* ASSIGN the handler returns 1 */
c = isdn_rc(a,
a->ram_in(a, &RAM->Rc),
a->ram_in(a, &RAM->RcId),
a->ram_in(a, &RAM->RcCh),
0,
/*
Scom Card does not provide extended information
*/
0, 0);
switch(c) {
case 0:
a->ram_out(a, &RAM->Rc, 0);
break;
case 1:
a->ram_out(a, &RAM->Req, 0);
a->ram_out(a, &RAM->Rc, 0);
break;
case 2:
return TRUE;
}
/* call output function */
scom_out(a);
}
else {
/* if an indications is available ... */
if(a->ram_in(a, &RAM->Ind)) {
/* call indication handler, a return value of 2 means chain */
/* a return value of 1 means RNR */
c = isdn_ind(a,
a->ram_in(a, &RAM->Ind),
a->ram_in(a, &RAM->IndId),
a->ram_in(a, &RAM->IndCh),
&RAM->RBuffer,
a->ram_in(a, &RAM->MInd),
a->ram_inw(a, &RAM->MLength));
switch(c) {
case 0:
a->ram_out(a, &RAM->Ind, 0);
break;
case 1:
dtrc(dprintf("RNR"));
a->ram_out(a, &RAM->RNR, TRUE);
break;
case 2:
return TRUE;
}
}
}
return FALSE;
}
byte scom_test_int(ADAPTER * a) byte scom_test_int(ADAPTER * a)
{ {
return a->ram_in(a,(void *)0x3fe); return a->ram_in(a,(void *)0x3fe);
@ -539,11 +350,6 @@ void scom_clear_int(ADAPTER * a)
{ {
a->ram_out(a,(void *)0x3fe,0); a->ram_out(a,(void *)0x3fe,0);
} }
void quadro_clear_int(ADAPTER * a)
{
a->ram_out(a,(void *)0x3fe,0);
a->ram_out(a,(void *)0x401,0);
}
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* return code handler */ /* return code handler */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -914,15 +720,15 @@ byte isdn_ind(ADAPTER * a,
} }
return 2; return 2;
} }
#if defined(XDI_USE_XLOG)
/* ----------------------------------------------------------- /* -----------------------------------------------------------
This function works in the same way as xlog on the This function works in the same way as xlog on the
active board active board
----------------------------------------------------------- */ ----------------------------------------------------------- */
void xdi_xlog (byte *msg, word code, int length) { static void xdi_xlog (byte *msg, word code, int length) {
#if defined(XDI_USE_XLOG)
xdi_dbg_xlog ("\x00\x02", msg, code, length); xdi_dbg_xlog ("\x00\x02", msg, code, length);
#endif
} }
#endif
/* ----------------------------------------------------------- /* -----------------------------------------------------------
This function writes the information about the Return Code This function writes the information about the Return Code
processing in the trace buffer. Trace ID is 221. processing in the trace buffer. Trace ID is 221.

View File

@ -81,13 +81,8 @@ struct adapter_s {
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void pr_out(ADAPTER * a); void pr_out(ADAPTER * a);
byte pr_dpc(ADAPTER * a); byte pr_dpc(ADAPTER * a);
byte pr_test_int(ADAPTER * a);
void pr_clear_int(ADAPTER * a);
void scom_out(ADAPTER * a);
byte scom_dpc(ADAPTER * a);
byte scom_test_int(ADAPTER * a); byte scom_test_int(ADAPTER * a);
void scom_clear_int(ADAPTER * a); void scom_clear_int(ADAPTER * a);
void quadro_clear_int(ADAPTER * a);
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* OS specific functions used by IDI common code */ /* OS specific functions used by IDI common code */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/

View File

@ -140,7 +140,7 @@ static int DIVA_INIT_FUNCTION divadidd_init(void)
return (ret); return (ret);
} }
void DIVA_EXIT_FUNCTION divadidd_exit(void) static void DIVA_EXIT_FUNCTION divadidd_exit(void)
{ {
diddfunc_finit(); diddfunc_finit();
remove_proc(); remove_proc();

View File

@ -18,6 +18,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h>
#include "platform.h" #include "platform.h"
#include "di_defs.h" #include "di_defs.h"
@ -33,10 +34,10 @@ MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver"); MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
int buffer_length = 128; static int buffer_length = 128;
MODULE_PARM(buffer_length, "i"); module_param(buffer_length, int, 0);
unsigned long diva_dbg_mem = 0; static unsigned long diva_dbg_mem = 0;
MODULE_PARM(diva_dbg_mem, "l"); module_param(diva_dbg_mem, ulong, 0);
static char *DRIVERNAME = static char *DRIVERNAME =
"Eicon DIVA - MAINT module (http://www.melware.net)"; "Eicon DIVA - MAINT module (http://www.melware.net)";

View File

@ -20,6 +20,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h>
#include "platform.h" #include "platform.h"
#include "di_defs.h" #include "di_defs.h"

View File

@ -51,7 +51,7 @@ MODULE_DESCRIPTION("Kernel driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks"); MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(dbgmask, "i"); module_param(dbgmask, int, 0);
MODULE_PARM_DESC(dbgmask, "initial debug mask"); MODULE_PARM_DESC(dbgmask, "initial debug mask");
static char *DRIVERNAME = static char *DRIVERNAME =
@ -823,7 +823,7 @@ static int DIVA_INIT_FUNCTION divas_init(void)
goto out; goto out;
} }
if ((ret = pci_module_init(&diva_pci_driver))) { if ((ret = pci_register_driver(&diva_pci_driver))) {
#ifdef MODULE #ifdef MODULE
remove_divas_proc(); remove_divas_proc();
divas_unregister_chrdev(); divas_unregister_chrdev();

View File

@ -16,6 +16,7 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/list.h> #include <linux/list.h>
#include <asm/uaccess.h>
#include "platform.h" #include "platform.h"
#include "debuglib.h" #include "debuglib.h"

View File

@ -36,7 +36,7 @@
extern ADAPTER * adapter[MAX_ADAPTER]; extern ADAPTER * adapter[MAX_ADAPTER];
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER]; extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
void request (PISDN_ADAPTER, ENTITY *); void request (PISDN_ADAPTER, ENTITY *);
void pcm_req (PISDN_ADAPTER, ENTITY *); static void pcm_req (PISDN_ADAPTER, ENTITY *);
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
local functions local functions
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
@ -118,7 +118,8 @@ dump_xlog_buffer (PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc)
&IoAdapter->Name[0])) &IoAdapter->Name[0]))
} }
/*****************************************************************************/ /*****************************************************************************/
char *(ExceptionCauseTable[]) = #if defined(XDI_USE_XLOG)
static char *(ExceptionCauseTable[]) =
{ {
"Interrupt", "Interrupt",
"TLB mod /IBOUND", "TLB mod /IBOUND",
@ -153,6 +154,7 @@ char *(ExceptionCauseTable[]) =
"Reserved 30", "Reserved 30",
"VCED" "VCED"
} ; } ;
#endif
void void
dump_trap_frame (PISDN_ADAPTER IoAdapter, byte __iomem *exceptionFrame) dump_trap_frame (PISDN_ADAPTER IoAdapter, byte __iomem *exceptionFrame)
{ {
@ -227,10 +229,6 @@ void request(PISDN_ADAPTER IoAdapter, ENTITY * e)
if (pI->descriptor_number >= 0) { if (pI->descriptor_number >= 0) {
dword dma_magic; dword dma_magic;
void* local_addr; void* local_addr;
#if 0
DBG_TRC(("A(%d) dma_alloc(%d)",
IoAdapter->ANum, pI->descriptor_number))
#endif
diva_get_dma_map_entry (\ diva_get_dma_map_entry (\
(struct _diva_dma_map_entry*)IoAdapter->dma_map, (struct _diva_dma_map_entry*)IoAdapter->dma_map,
pI->descriptor_number, pI->descriptor_number,
@ -243,9 +241,6 @@ void request(PISDN_ADAPTER IoAdapter, ENTITY * e)
} }
} else if ((pI->operation == IDI_SYNC_REQ_DMA_DESCRIPTOR_FREE) && } else if ((pI->operation == IDI_SYNC_REQ_DMA_DESCRIPTOR_FREE) &&
(pI->descriptor_number >= 0)) { (pI->descriptor_number >= 0)) {
#if 0
DBG_TRC(("A(%d) dma_free(%d)", IoAdapter->ANum, pI->descriptor_number))
#endif
diva_free_dma_map_entry((struct _diva_dma_map_entry*)IoAdapter->dma_map, diva_free_dma_map_entry((struct _diva_dma_map_entry*)IoAdapter->dma_map,
pI->descriptor_number); pI->descriptor_number);
pI->descriptor_number = -1; pI->descriptor_number = -1;
@ -369,9 +364,6 @@ void request(PISDN_ADAPTER IoAdapter, ENTITY * e)
} }
if ( IoAdapter ) if ( IoAdapter )
{ {
#if 0
DBG_FTL(("xdi: unknown Req 0 / Rc %d !", e->Rc))
#endif
return ; return ;
} }
} }
@ -506,7 +498,7 @@ void DIDpcRoutine (struct _diva_os_soft_isr* psoft_isr, void* Context) {
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
XLOG interface XLOG interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
void static void
pcm_req (PISDN_ADAPTER IoAdapter, ENTITY *e) pcm_req (PISDN_ADAPTER IoAdapter, ENTITY *e)
{ {
diva_os_spin_lock_magic_t OldIrql ; diva_os_spin_lock_magic_t OldIrql ;
@ -858,26 +850,3 @@ void CALLBACK(ADAPTER * a, ENTITY * e)
if ( e && e->callback ) if ( e && e->callback )
e->callback (e) ; e->callback (e) ;
} }
/* --------------------------------------------------------------------------
routines for aligned reading and writing on RISC
-------------------------------------------------------------------------- */
void outp_words_from_buffer (word __iomem * adr, byte* P, dword len)
{
dword i = 0;
word w;
while (i < (len & 0xfffffffe)) {
w = P[i++];
w += (P[i++])<<8;
outppw (adr, w);
}
}
void inp_words_to_buffer (word __iomem * adr, byte* P, dword len)
{
dword i = 0;
word w;
while (i < (len & 0xfffffffe)) {
w = inppw (adr);
P[i++] = (byte)(w);
P[i++] = (byte)(w>>8);
}
}

View File

@ -251,11 +251,6 @@ struct s_load {
}; };
#define PR_RAM ((struct pr_ram *)0) #define PR_RAM ((struct pr_ram *)0)
#define RAM ((struct dual *)0) #define RAM ((struct dual *)0)
/* ---------------------------------------------------------------------
Functions for port io
--------------------------------------------------------------------- */
void outp_words_from_buffer (word __iomem * adr, byte* P, dword len);
void inp_words_to_buffer (word __iomem * adr, byte* P, dword len);
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
platform specific conversions platform specific conversions
--------------------------------------------------------------------- */ --------------------------------------------------------------------- */

View File

@ -55,7 +55,7 @@
/* and it is not necessary to save it separate for every adapter */ /* and it is not necessary to save it separate for every adapter */
/* Macrose defined here have only local meaning */ /* Macrose defined here have only local meaning */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
dword diva_xdi_extended_features = 0; static dword diva_xdi_extended_features = 0;
#define DIVA_CAPI_USE_CMA 0x00000001 #define DIVA_CAPI_USE_CMA 0x00000001
#define DIVA_CAPI_XDI_PROVIDES_SDRAM_BAR 0x00000002 #define DIVA_CAPI_XDI_PROVIDES_SDRAM_BAR 0x00000002
@ -72,11 +72,10 @@ dword diva_xdi_extended_features = 0;
/* local function prototypes */ /* local function prototypes */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void group_optimization(DIVA_CAPI_ADAPTER * a, PLCI * plci); static void group_optimization(DIVA_CAPI_ADAPTER * a, PLCI * plci);
void set_group_ind_mask (PLCI *plci); static void set_group_ind_mask (PLCI *plci);
void set_group_ind_mask_bit (PLCI *plci, word b); static void clear_group_ind_mask_bit (PLCI *plci, word b);
void clear_group_ind_mask_bit (PLCI *plci, word b); static byte test_group_ind_mask_bit (PLCI *plci, word b);
byte test_group_ind_mask_bit (PLCI *plci, word b);
void AutomaticLaw(DIVA_CAPI_ADAPTER *); void AutomaticLaw(DIVA_CAPI_ADAPTER *);
word CapiRelease(word); word CapiRelease(word);
word CapiRegister(word); word CapiRegister(word);
@ -88,7 +87,7 @@ static void api_load_msg(API_SAVE *in, API_PARSE *out);
word api_remove_start(void); word api_remove_start(void);
void api_remove_complete(void); void api_remove_complete(void);
void plci_remove(PLCI *); static void plci_remove(PLCI *);
static void diva_get_extended_adapter_features (DIVA_CAPI_ADAPTER * a); static void diva_get_extended_adapter_features (DIVA_CAPI_ADAPTER * a);
static void diva_ask_for_xdi_sdram_bar (DIVA_CAPI_ADAPTER *, IDI_SYNC_REQ *); static void diva_ask_for_xdi_sdram_bar (DIVA_CAPI_ADAPTER *, IDI_SYNC_REQ *);
@ -100,9 +99,9 @@ static void data_ack(PLCI *, byte);
static void sig_ind(PLCI *); static void sig_ind(PLCI *);
static void SendInfo(PLCI *, dword, byte * *, byte); static void SendInfo(PLCI *, dword, byte * *, byte);
static void SendSetupInfo(APPL *, PLCI *, dword, byte * *, byte); static void SendSetupInfo(APPL *, PLCI *, dword, byte * *, byte);
void SendSSExtInd(APPL *, PLCI * plci, dword Id, byte * * parms); static void SendSSExtInd(APPL *, PLCI * plci, dword Id, byte * * parms);
void VSwitchReqInd(PLCI *plci, dword Id, byte **parms); static void VSwitchReqInd(PLCI *plci, dword Id, byte **parms);
static void nl_ind(PLCI *); static void nl_ind(PLCI *);
@ -254,11 +253,11 @@ extern APPL * application;
byte remove_started = FALSE; static byte remove_started = FALSE;
PLCI dummy_plci; static PLCI dummy_plci;
struct _ftable { static struct _ftable {
word command; word command;
byte * format; byte * format;
byte (* function)(dword, word, DIVA_CAPI_ADAPTER *, PLCI *, APPL *, API_PARSE *); byte (* function)(dword, word, DIVA_CAPI_ADAPTER *, PLCI *, APPL *, API_PARSE *);
@ -291,7 +290,7 @@ struct _ftable {
{_MANUFACTURER_I|RESPONSE, "", manufacturer_res} {_MANUFACTURER_I|RESPONSE, "", manufacturer_res}
}; };
byte * cip_bc[29][2] = { static byte * cip_bc[29][2] = {
{ "", "" }, /* 0 */ { "", "" }, /* 0 */
{ "\x03\x80\x90\xa3", "\x03\x80\x90\xa2" }, /* 1 */ { "\x03\x80\x90\xa3", "\x03\x80\x90\xa2" }, /* 1 */
{ "\x02\x88\x90", "\x02\x88\x90" }, /* 2 */ { "\x02\x88\x90", "\x02\x88\x90" }, /* 2 */
@ -324,7 +323,7 @@ byte * cip_bc[29][2] = {
{ "\x02\x88\x90", "\x02\x88\x90" } /* 28 */ { "\x02\x88\x90", "\x02\x88\x90" } /* 28 */
}; };
byte * cip_hlc[29] = { static byte * cip_hlc[29] = {
"", /* 0 */ "", /* 0 */
"", /* 1 */ "", /* 1 */
"", /* 2 */ "", /* 2 */
@ -716,7 +715,7 @@ word api_remove_start(void)
/* internal command queue */ /* internal command queue */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void init_internal_command_queue (PLCI *plci) static void init_internal_command_queue (PLCI *plci)
{ {
word i; word i;
@ -729,7 +728,7 @@ void init_internal_command_queue (PLCI *plci)
} }
void start_internal_command (dword Id, PLCI *plci, t_std_internal_command command_function) static void start_internal_command (dword Id, PLCI *plci, t_std_internal_command command_function)
{ {
word i; word i;
@ -751,7 +750,7 @@ void start_internal_command (dword Id, PLCI *plci, t_std_internal_command comm
} }
void next_internal_command (dword Id, PLCI *plci) static void next_internal_command (dword Id, PLCI *plci)
{ {
word i; word i;
@ -1048,7 +1047,7 @@ static void plci_free_msg_in_queue (PLCI *plci)
} }
void plci_remove(PLCI * plci) static void plci_remove(PLCI * plci)
{ {
if(!plci) { if(!plci) {
@ -1094,7 +1093,7 @@ void plci_remove(PLCI * plci)
/* Application Group function helpers */ /* Application Group function helpers */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void set_group_ind_mask (PLCI *plci) static void set_group_ind_mask (PLCI *plci)
{ {
word i; word i;
@ -1102,17 +1101,12 @@ void set_group_ind_mask (PLCI *plci)
plci->group_optimization_mask_table[i] = 0xffffffffL; plci->group_optimization_mask_table[i] = 0xffffffffL;
} }
void set_group_ind_mask_bit (PLCI *plci, word b) static void clear_group_ind_mask_bit (PLCI *plci, word b)
{
plci->group_optimization_mask_table[b >> 5] |= (1L << (b & 0x1f));
}
void clear_group_ind_mask_bit (PLCI *plci, word b)
{ {
plci->group_optimization_mask_table[b >> 5] &= ~(1L << (b & 0x1f)); plci->group_optimization_mask_table[b >> 5] &= ~(1L << (b & 0x1f));
} }
byte test_group_ind_mask_bit (PLCI *plci, word b) static byte test_group_ind_mask_bit (PLCI *plci, word b)
{ {
return ((plci->group_optimization_mask_table[b >> 5] & (1L << (b & 0x1f))) != 0); return ((plci->group_optimization_mask_table[b >> 5] & (1L << (b & 0x1f))) != 0);
} }
@ -1121,7 +1115,7 @@ byte test_group_ind_mask_bit (PLCI *plci, word b)
/* c_ind_mask operations for arbitrary MAX_APPL */ /* c_ind_mask operations for arbitrary MAX_APPL */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void clear_c_ind_mask (PLCI *plci) static void clear_c_ind_mask (PLCI *plci)
{ {
word i; word i;
@ -1129,7 +1123,7 @@ void clear_c_ind_mask (PLCI *plci)
plci->c_ind_mask_table[i] = 0; plci->c_ind_mask_table[i] = 0;
} }
byte c_ind_mask_empty (PLCI *plci) static byte c_ind_mask_empty (PLCI *plci)
{ {
word i; word i;
@ -1139,22 +1133,22 @@ byte c_ind_mask_empty (PLCI *plci)
return (i == C_IND_MASK_DWORDS); return (i == C_IND_MASK_DWORDS);
} }
void set_c_ind_mask_bit (PLCI *plci, word b) static void set_c_ind_mask_bit (PLCI *plci, word b)
{ {
plci->c_ind_mask_table[b >> 5] |= (1L << (b & 0x1f)); plci->c_ind_mask_table[b >> 5] |= (1L << (b & 0x1f));
} }
void clear_c_ind_mask_bit (PLCI *plci, word b) static void clear_c_ind_mask_bit (PLCI *plci, word b)
{ {
plci->c_ind_mask_table[b >> 5] &= ~(1L << (b & 0x1f)); plci->c_ind_mask_table[b >> 5] &= ~(1L << (b & 0x1f));
} }
byte test_c_ind_mask_bit (PLCI *plci, word b) static byte test_c_ind_mask_bit (PLCI *plci, word b)
{ {
return ((plci->c_ind_mask_table[b >> 5] & (1L << (b & 0x1f))) != 0); return ((plci->c_ind_mask_table[b >> 5] & (1L << (b & 0x1f))) != 0);
} }
void dump_c_ind_mask (PLCI *plci) static void dump_c_ind_mask (PLCI *plci)
{ {
static char hex_digit_table[0x10] = static char hex_digit_table[0x10] =
{'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
@ -6426,7 +6420,7 @@ byte SendMultiIE(PLCI * plci, dword Id, byte * * parms, byte ie_type, dword
return iesent; return iesent;
} }
void SendSSExtInd(APPL * appl, PLCI * plci, dword Id, byte * * parms) static void SendSSExtInd(APPL * appl, PLCI * plci, dword Id, byte * * parms)
{ {
word i; word i;
/* Format of multi_ssext_parms[i][]: /* Format of multi_ssext_parms[i][]:
@ -14720,71 +14714,6 @@ static int channel_can_xon (PLCI * plci, byte ch) {
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* to be completed */
void disable_adapter(byte adapter_number)
{
word j, ncci;
DIVA_CAPI_ADAPTER *a;
PLCI *plci;
dword Id;
if ((adapter_number == 0) || (adapter_number > max_adapter) || !adapter[adapter_number-1].request)
{
dbug(1,dprintf("disable adapter: number %d invalid",adapter_number));
return;
}
dbug(1,dprintf("disable adapter number %d",adapter_number));
/* Capi20 starts with Nr. 1, internal field starts with 0 */
a = &adapter[adapter_number-1];
a->adapter_disabled = TRUE;
for(j=0;j<a->max_plci;j++)
{
if(a->plci[j].Id) /* disconnect logical links */
{
plci = &a->plci[j];
if(plci->channels)
{
for(ncci=1;ncci<MAX_NCCI+1 && plci->channels;ncci++)
{
if(a->ncci_plci[ncci]==plci->Id)
{
Id = (((dword)ncci)<<16)|((word)plci->Id<<8)|a->Id;
sendf(plci->appl,_DISCONNECT_B3_I,Id,0,"ws",0,"");
plci->channels--;
}
}
}
if(plci->State!=LISTENING) /* disconnect physical links */
{
Id = ((word)plci->Id<<8)|a->Id;
sendf(plci->appl, _DISCONNECT_I, Id, 0, "w", _L1_ERROR);
plci_remove(plci);
plci->Sig.Id = 0;
plci->NL.Id = 0;
plci_remove(plci);
}
}
}
}
void enable_adapter(byte adapter_number)
{
DIVA_CAPI_ADAPTER *a;
if ((adapter_number == 0) || (adapter_number > max_adapter) || !adapter[adapter_number-1].request)
{
dbug(1,dprintf("enable adapter: number %d invalid",adapter_number));
return;
}
dbug(1,dprintf("enable adapter number %d",adapter_number));
/* Capi20 starts with Nr. 1, internal field starts with 0 */
a = &adapter[adapter_number-1];
a->adapter_disabled = FALSE;
listen_check(a);
}
static word CPN_filter_ok(byte *cpn,DIVA_CAPI_ADAPTER * a,word offset) static word CPN_filter_ok(byte *cpn,DIVA_CAPI_ADAPTER * a,word offset)
{ {
return 1; return 1;
@ -14800,7 +14729,7 @@ static word CPN_filter_ok(byte *cpn,DIVA_CAPI_ADAPTER * a,word offset)
/* function must be enabled by setting "a->group_optimization_enabled" from the */ /* function must be enabled by setting "a->group_optimization_enabled" from the */
/* OS specific part (per adapter). */ /* OS specific part (per adapter). */
/**********************************************************************************/ /**********************************************************************************/
void group_optimization(DIVA_CAPI_ADAPTER * a, PLCI * plci) static void group_optimization(DIVA_CAPI_ADAPTER * a, PLCI * plci)
{ {
word i,j,k,busy,group_found; word i,j,k,busy,group_found;
dword info_mask_group[MAX_CIP_TYPES]; dword info_mask_group[MAX_CIP_TYPES];
@ -14967,7 +14896,7 @@ word CapiRegister(word id)
/* Functions for virtual Switching e.g. Transfer by join, Conference */ /* Functions for virtual Switching e.g. Transfer by join, Conference */
void VSwitchReqInd(PLCI *plci, dword Id, byte **parms) static void VSwitchReqInd(PLCI *plci, dword Id, byte **parms)
{ {
word i; word i;
/* Format of vswitch_t: /* Format of vswitch_t:

View File

@ -187,7 +187,7 @@ int maint_read_write(void __user *buf, int count)
if (!mask) { if (!mask) {
ret = diva_set_trace_filter (1, "*"); ret = diva_set_trace_filter (1, "*");
} else if (mask < sizeof(data)) { } else if (mask < sizeof(data)) {
if (copy_from_user(data, (char __user *)buf+12, mask)) { if (diva_os_copy_from_user(NULL, data, (char __user *)buf+12, mask)) {
ret = -EFAULT; ret = -EFAULT;
} else { } else {
ret = diva_set_trace_filter ((int)mask, data); ret = diva_set_trace_filter ((int)mask, data);
@ -199,7 +199,7 @@ int maint_read_write(void __user *buf, int count)
case DITRACE_READ_SELECTIVE_TRACE_FILTER: case DITRACE_READ_SELECTIVE_TRACE_FILTER:
if ((ret = diva_get_trace_filter (sizeof(data), data)) > 0) { if ((ret = diva_get_trace_filter (sizeof(data), data)) > 0) {
if (copy_to_user (buf, data, ret)) if (diva_os_copy_to_user (NULL, buf, data, ret))
ret = -EFAULT; ret = -EFAULT;
} else { } else {
ret = -ENODEV; ret = -ENODEV;

View File

@ -17,8 +17,8 @@
#include "mi_pc.h" #include "mi_pc.h"
#include "dsrv4bri.h" #include "dsrv4bri.h"
void *diva_xdiLoadFileFile = NULL; static void *diva_xdiLoadFileFile = NULL;
dword diva_xdiLoadFileLength = 0; static dword diva_xdiLoadFileLength = 0;
/* /*
** IMPORTS ** IMPORTS
@ -416,8 +416,8 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
if (i) { if (i) {
Slave->serialNo = ((dword) (Slave->ControllerNumber << 24)) | Slave->serialNo = ((dword) (Slave->ControllerNumber << 24)) |
a->xdi_adapter.serialNo; a->xdi_adapter.serialNo;
Slave->cardType = a->xdi_adapter.cardType; Slave->cardType = a->xdi_adapter.cardType;
} }
} }
/* /*

View File

@ -195,9 +195,7 @@ static __inline__ void* diva_os_malloc (unsigned long flags, unsigned long size)
} }
static __inline__ void diva_os_free (unsigned long flags, void* ptr) static __inline__ void diva_os_free (unsigned long flags, void* ptr)
{ {
if (ptr) { vfree(ptr);
vfree(ptr);
}
} }
/* /*

View File

@ -359,506 +359,9 @@ int qBri_FPGA_download (PISDN_ADAPTER IoAdapter) {
return (1) ; return (1) ;
} }
#if !defined(DIVA_USER_MODE_CARD_CONFIG) /* { */
/* --------------------------------------------------------------------------
Download protocol code to the adapter
-------------------------------------------------------------------------- */
static int qBri_protocol_load (PISDN_ADAPTER BaseIoAdapter, PISDN_ADAPTER IoAdapter) {
PISDN_ADAPTER HighIoAdapter;
byte *p;
dword FileLength ;
dword *sharedRam, *File;
dword Addr, ProtOffset, SharedRamOffset, i;
dword tasks = BaseIoAdapter->tasks ;
int factor = (tasks == 1) ? 1 : 2;
if (!(File = (dword *)xdiLoadArchive (IoAdapter, &FileLength, 0))) {
return (0) ;
}
IoAdapter->features = diva_get_protocol_file_features ((byte*)File,
OFFS_PROTOCOL_ID_STRING,
IoAdapter->ProtocolIdString,
sizeof(IoAdapter->ProtocolIdString)) ;
IoAdapter->a.protocol_capabilities = IoAdapter->features ;
DBG_LOG(("Loading %s", IoAdapter->ProtocolIdString))
ProtOffset = IoAdapter->ControllerNumber * (IoAdapter->MemorySize >> factor);
SharedRamOffset = (IoAdapter->MemorySize >> factor) - MQ_SHARED_RAM_SIZE;
Addr = ((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR]))
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 1])) << 8)
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 2])) << 16)
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 3])) << 24) ;
if ( Addr != 0 )
{
IoAdapter->DspCodeBaseAddr = (Addr + 3) & (~3) ;
IoAdapter->MaxDspCodeSize = (MQ_UNCACHED_ADDR (ProtOffset + SharedRamOffset) -
IoAdapter->DspCodeBaseAddr) & ((IoAdapter->MemorySize >> factor) - 1);
i = 0 ;
while ( BaseIoAdapter->QuadroList->QuadroAdapter[i]->ControllerNumber != tasks - 1 )
i++ ;
HighIoAdapter = BaseIoAdapter->QuadroList->QuadroAdapter[i] ;
Addr = HighIoAdapter->DspCodeBaseAddr ;
if (tasks == 1) {
((byte *) File)[OFFS_DIVA_INIT_TASK_COUNT] =(byte)1;
((byte *) File)[OFFS_DIVA_INIT_TASK_COUNT+1] = (byte)BaseIoAdapter->cardType;
}
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR] = (byte) Addr ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 1] = (byte)(Addr >> 8) ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 2] = (byte)(Addr >> 16) ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 3] = (byte)(Addr >> 24) ;
IoAdapter->InitialDspInfo = 0x80 ;
}
else
{
if ( IoAdapter->features & PROTCAP_VOIP )
{
IoAdapter->DspCodeBaseAddr = MQ_CACHED_ADDR (ProtOffset + SharedRamOffset - MQ_VOIP_MAX_DSP_CODE_SIZE) ;
IoAdapter->MaxDspCodeSize = MQ_VOIP_MAX_DSP_CODE_SIZE ;
}
else if ( IoAdapter->features & PROTCAP_V90D )
{
IoAdapter->DspCodeBaseAddr = MQ_CACHED_ADDR (ProtOffset + SharedRamOffset - MQ_V90D_MAX_DSP_CODE_SIZE) ;
IoAdapter->MaxDspCodeSize = (IoAdapter->ControllerNumber == tasks - 1) ? MQ_V90D_MAX_DSP_CODE_SIZE : 0 ;
}
else
{
IoAdapter->DspCodeBaseAddr = MQ_CACHED_ADDR (ProtOffset + SharedRamOffset - MQ_ORG_MAX_DSP_CODE_SIZE) ;
IoAdapter->MaxDspCodeSize = (IoAdapter->ControllerNumber == tasks - 1) ? MQ_ORG_MAX_DSP_CODE_SIZE : 0 ;
}
IoAdapter->InitialDspInfo = (MQ_CACHED_ADDR (ProtOffset + SharedRamOffset -
MQ_ORG_MAX_DSP_CODE_SIZE) - IoAdapter->DspCodeBaseAddr) >> 14 ;
}
DBG_LOG(("%d: DSP code base 0x%08lx, max size 0x%08lx (%08lx,%02x)",
IoAdapter->ControllerNumber,
IoAdapter->DspCodeBaseAddr, IoAdapter->MaxDspCodeSize,
Addr, IoAdapter->InitialDspInfo))
if (FileLength > ((IoAdapter->DspCodeBaseAddr - MQ_CACHED_ADDR (ProtOffset)) & (IoAdapter->MemorySize - 1)) )
{
xdiFreeFile (File) ;
DBG_FTL(("Protocol code '%s' too long (%ld)",
&IoAdapter->Protocol[0], FileLength))
return (0) ;
}
IoAdapter->downloadAddr = 0 ;
p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
sharedRam = (dword *)&p[IoAdapter->downloadAddr & (IoAdapter->MemorySize - 1)];
memcpy (sharedRam, File, FileLength) ;
DBG_TRC(("Download addr 0x%08x len %ld - virtual 0x%08x",
IoAdapter->downloadAddr, FileLength, sharedRam))
if ( memcmp (sharedRam, File, FileLength) )
{
DBG_FTL(("%s: Memory test failed!", IoAdapter->Properties.Name))
DBG_FTL(("File=0x%x, sharedRam=0x%x", File, sharedRam))
DBG_BLK(( (char *)File, 256))
DBG_BLK(( (char *)sharedRam, 256))
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
xdiFreeFile (File) ;
return (0) ;
}
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
xdiFreeFile (File) ;
return (1) ;
}
/* --------------------------------------------------------------------------
DSP Code download
-------------------------------------------------------------------------- */
static long qBri_download_buffer (OsFileHandle *fp, long length, void **addr) {
PISDN_ADAPTER BaseIoAdapter = (PISDN_ADAPTER)fp->sysLoadDesc ;
PISDN_ADAPTER IoAdapter;
word i ;
dword *sharedRam ;
byte *p;
i = 0 ;
do
{
IoAdapter = BaseIoAdapter->QuadroList->QuadroAdapter[i++] ;
} while ( (i < BaseIoAdapter->tasks)
&& (((dword) length) > IoAdapter->DspCodeBaseAddr +
IoAdapter->MaxDspCodeSize - IoAdapter->downloadAddr) );
*addr = (void *)IoAdapter->downloadAddr ;
if ( ((dword) length) > IoAdapter->DspCodeBaseAddr +
IoAdapter->MaxDspCodeSize - IoAdapter->downloadAddr )
{
DBG_FTL(("%s: out of card memory during DSP download (0x%X)",
IoAdapter->Properties.Name,
IoAdapter->downloadAddr + length))
return (-1) ;
}
p = DIVA_OS_MEM_ATTACH_RAM(BaseIoAdapter);
sharedRam = (dword*)&p[IoAdapter->downloadAddr & (IoAdapter->MemorySize - 1)];
if ( fp->sysFileRead (fp, sharedRam, length) != length ) {
DIVA_OS_MEM_DETACH_RAM(BaseIoAdapter, p);
return (-1) ;
}
DIVA_OS_MEM_DETACH_RAM(BaseIoAdapter, p);
IoAdapter->downloadAddr += length ;
IoAdapter->downloadAddr = (IoAdapter->downloadAddr + 3) & (~3) ;
return (0) ;
}
/******************************************************************************/
static dword qBri_telindus_load (PISDN_ADAPTER BaseIoAdapter) {
PISDN_ADAPTER IoAdapter = 0;
PISDN_ADAPTER HighIoAdapter = NULL ;
char *error ;
OsFileHandle *fp ;
t_dsp_portable_desc download_table[DSP_MAX_DOWNLOAD_COUNT] ;
word download_count, i ;
dword *sharedRam ;
dword FileLength ;
byte *p;
if ( !(fp = OsOpenFile (DSP_TELINDUS_FILE)) ) {
DBG_FTL(("qBri_telindus_load: %s not found!", DSP_TELINDUS_FILE))
return (0) ;
}
for ( i = 0 ; i < BaseIoAdapter->tasks ; ++i )
{
IoAdapter = BaseIoAdapter->QuadroList->QuadroAdapter[i] ;
IoAdapter->downloadAddr = IoAdapter->DspCodeBaseAddr ;
if ( IoAdapter->ControllerNumber == BaseIoAdapter->tasks - 1 )
{
HighIoAdapter = IoAdapter ;
HighIoAdapter->downloadAddr = (HighIoAdapter->downloadAddr
+ sizeof(dword) + sizeof(download_table) + 3) & (~3) ;
}
}
FileLength = fp->sysFileSize ;
fp->sysLoadDesc = (void *)BaseIoAdapter ;
fp->sysCardLoad = qBri_download_buffer ;
download_count = DSP_MAX_DOWNLOAD_COUNT ;
memset (&download_table[0], '\0', sizeof(download_table)) ;
/*
* set start address for download
*/
error = dsp_read_file (fp, (word)(IoAdapter->cardType),
&download_count, NULL, &download_table[0]) ;
if ( error )
{
DBG_FTL(("download file error: %s", error))
OsCloseFile (fp) ;
return (0) ;
}
OsCloseFile (fp) ;
/*
* store # of download files extracted from the archive and download table
*/
HighIoAdapter->downloadAddr = HighIoAdapter->DspCodeBaseAddr ;
p = DIVA_OS_MEM_ATTACH_RAM(BaseIoAdapter);
sharedRam = (dword *)&p[HighIoAdapter->downloadAddr & (IoAdapter->MemorySize - 1)];
WRITE_DWORD(&(sharedRam[0]), (dword)download_count);
memcpy (&sharedRam[1], &download_table[0], sizeof(download_table)) ;
/* memory check */
if ( memcmp (&sharedRam[1], &download_table, download_count) ) {
DBG_FTL(("%s: Dsp Memory test failed!", IoAdapter->Properties.Name))
}
DIVA_OS_MEM_DETACH_RAM(BaseIoAdapter, p);
return (FileLength) ;
}
/*
Load SDP tasks to the card
Return start address of image on succesful load
Return zero in case of problem
INPUT:
task -> name of the image containing this task
link_addr -> pointer to start of previous task
*/
static byte* qBri_sdp_load (PISDN_ADAPTER BaseIoAdapter,
char* task,
byte* link_addr) {
OsFileHandle *fp;
dword FileLength;
byte tmp[sizeof(dword)];
dword gp_addr;
dword entry_addr;
dword start_addr = 0;
dword phys_start_addr;
dword end_addr;
byte* sharedRam = 0;
byte *p;
if (task) {
if (!(fp = OsOpenFile (task))) {
DBG_ERR(("Can't open [%s] image", task))
return (0);
}
if ((FileLength = fp->sysFileSize) < DIVA_MIPS_TASK_IMAGE_ID_STRING_OFFS) {
OsCloseFile (fp) ;
DBG_ERR(("Image [%s] too short", task))
return (0);
}
fp->sysFileSeek (fp, DIVA_MIPS_TASK_IMAGE_GP_OFFS, OS_SEEK_SET);
if (fp->sysFileRead (fp, tmp, sizeof(dword)) != sizeof(dword)) {
OsCloseFile (fp) ;
DBG_ERR(("Can't read image [%s]", task))
return (0);
}
gp_addr = ((dword)tmp[0]) |
(((dword)tmp[1]) << 8) |
(((dword)tmp[2]) << 16) |
(((dword)tmp[3]) << 24);
DBG_TRC(("Image [%s] GP = %08lx", task, gp_addr))
fp->sysFileSeek (fp, DIVA_MIPS_TASK_IMAGE_ENTRY_OFFS, OS_SEEK_SET);
if (fp->sysFileRead (fp, tmp, sizeof(dword)) != sizeof(dword)) {
OsCloseFile (fp) ;
DBG_ERR(("Can't read image [%s]", task))
return (0);
}
entry_addr = ((dword)tmp[0]) |
(((dword)tmp[1]) << 8) |
(((dword)tmp[2]) << 16) |
(((dword)tmp[3]) << 24);
DBG_TRC(("Image [%s] entry = %08lx", task, entry_addr))
fp->sysFileSeek (fp, DIVA_MIPS_TASK_IMAGE_LOAD_ADDR_OFFS, OS_SEEK_SET);
if (fp->sysFileRead (fp, tmp, sizeof(dword)) != sizeof(dword)) {
OsCloseFile (fp) ;
DBG_ERR(("Can't read image [%s]", task))
return (0);
}
start_addr = ((dword)tmp[0]) |
(((dword)tmp[1]) << 8) |
(((dword)tmp[2]) << 16) |
(((dword)tmp[3]) << 24);
DBG_TRC(("Image [%s] start = %08lx", task, start_addr))
fp->sysFileSeek (fp, DIVA_MIPS_TASK_IMAGE_END_ADDR_OFFS, OS_SEEK_SET);
if (fp->sysFileRead (fp, tmp, sizeof(dword)) != sizeof(dword)) {
OsCloseFile (fp) ;
DBG_ERR(("Can't read image [%s]", task))
return (0);
}
end_addr = ((dword)tmp[0]) |
(((dword)tmp[1]) << 8) |
(((dword)tmp[2]) << 16) |
(((dword)tmp[3]) << 24);
DBG_TRC(("Image [%s] end = %08lx", task, end_addr))
phys_start_addr = start_addr & 0x1fffffff;
if ((phys_start_addr + FileLength) >= BaseIoAdapter->MemorySize) {
OsCloseFile (fp) ;
DBG_ERR(("Image [%s] too long", task))
return (0);
}
fp->sysFileSeek (fp, 0, OS_SEEK_SET);
p = DIVA_OS_MEM_ATTACH_RAM(BaseIoAdapter);
sharedRam = &p[phys_start_addr];
if ((dword)fp->sysFileRead (fp, sharedRam, FileLength) != FileLength) {
DIVA_OS_MEM_DETACH_RAM(BaseIoAdapter, p);
OsCloseFile (fp) ;
DBG_ERR(("Can't read image [%s]", task))
return (0);
}
DIVA_OS_MEM_DETACH_RAM(BaseIoAdapter, p);
OsCloseFile (fp) ;
}
p = DIVA_OS_MEM_ATTACH_RAM(BaseIoAdapter);
if (!link_addr) {
link_addr = &p[OFFS_DSP_CODE_BASE_ADDR];
}
DBG_TRC(("Write task [%s] link %08lx at %08lx",
task ? task : "none",
start_addr,
link_addr - (byte*)&BaseIoAdapter->ram[0]))
link_addr[0] = (byte)(start_addr & 0xff);
link_addr[1] = (byte)((start_addr >> 8) & 0xff);
link_addr[2] = (byte)((start_addr >> 16) & 0xff);
link_addr[3] = (byte)((start_addr >> 24) & 0xff);
DIVA_OS_MEM_DETACH_RAM(BaseIoAdapter, p);
return (task ? &sharedRam[DIVA_MIPS_TASK_IMAGE_LINK_OFFS] : 0);
}
/* --------------------------------------------------------------------------
Load Card
-------------------------------------------------------------------------- */
static int load_qBri_hardware (PISDN_ADAPTER IoAdapter) {
dword i, offset, controller ;
word *signature ;
int factor = (IoAdapter->tasks == 1) ? 1 : 2;
byte *p;
PISDN_ADAPTER Slave ;
if (
!IoAdapter->QuadroList
|| ( (IoAdapter->cardType != CARDTYPE_DIVASRV_Q_8M_PCI)
&& (IoAdapter->cardType != CARDTYPE_DIVASRV_VOICE_Q_8M_PCI)
&& (IoAdapter->cardType != CARDTYPE_DIVASRV_Q_8M_V2_PCI)
&& (IoAdapter->cardType != CARDTYPE_DIVASRV_VOICE_Q_8M_V2_PCI)
&& (IoAdapter->cardType != CARDTYPE_DIVASRV_B_2M_V2_PCI)
&& (IoAdapter->cardType != CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI)
&& (IoAdapter->cardType != CARDTYPE_DIVASRV_B_2F_PCI) ) )
{
return (0) ;
}
/*
* Check for first instance
*/
if ( IoAdapter->ControllerNumber > 0 )
return (1) ;
/*
* first initialize the onboard FPGA
*/
if ( !qBri_FPGA_download (IoAdapter) )
return (0) ;
for ( i = 0; i < IoAdapter->tasks; i++ )
{
Slave = IoAdapter->QuadroList->QuadroAdapter[i] ;
Slave->fpga_features = IoAdapter->fpga_features ;
}
/*
* download protocol code for all instances
*/
controller = IoAdapter->tasks;
do
{
controller-- ;
i = 0 ;
while ( IoAdapter->QuadroList->QuadroAdapter[i]->ControllerNumber != controller )
i++ ;
/*
* calculate base address for instance
*/
Slave = IoAdapter->QuadroList->QuadroAdapter[i] ;
offset = Slave->ControllerNumber * (IoAdapter->MemorySize >> factor) ;
Slave->Address = &IoAdapter->Address[offset] ;
Slave->ram = &IoAdapter->ram[offset] ;
Slave->reset = IoAdapter->reset ;
Slave->ctlReg = IoAdapter->ctlReg ;
Slave->prom = IoAdapter->prom ;
Slave->Config = IoAdapter->Config ;
Slave->Control = IoAdapter->Control ;
if ( !qBri_protocol_load (IoAdapter, Slave) )
return (0) ;
} while (controller != 0) ;
/*
* download only one copy of the DSP code
*/
if (IoAdapter->cardType != CARDTYPE_DIVASRV_B_2F_PCI) {
if ( !qBri_telindus_load (IoAdapter) )
return (0) ;
} else {
byte* link_addr = 0;
link_addr = qBri_sdp_load (IoAdapter, DIVA_BRI2F_SDP_1_NAME, link_addr);
link_addr = qBri_sdp_load (IoAdapter, DIVA_BRI2F_SDP_2_NAME, link_addr);
if (!link_addr) {
qBri_sdp_load (IoAdapter, 0, link_addr);
}
}
/*
* copy configuration parameters
*/
for ( i = 0 ; i < IoAdapter->tasks ; ++i )
{
Slave = IoAdapter->QuadroList->QuadroAdapter[i] ;
Slave->ram += (IoAdapter->MemorySize >> factor) - MQ_SHARED_RAM_SIZE ;
p = DIVA_OS_MEM_ATTACH_RAM(Slave);
DBG_TRC(("Configure instance %d shared memory @ 0x%08lx",
Slave->ControllerNumber, p))
memset (p, '\0', 256) ;
DIVA_OS_MEM_DETACH_RAM(Slave, p);
diva_configure_protocol (Slave);
}
/*
* start adapter
*/
start_qBri_hardware (IoAdapter) ;
p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
signature = (word *)(&p[0x1E]) ;
/*
* wait for signature in shared memory (max. 3 seconds)
*/
for ( i = 0 ; i < 300 ; ++i )
{
diva_os_wait (10) ;
if ( signature[0] == 0x4447 )
{
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
DBG_TRC(("Protocol startup time %d.%02d seconds",
(i / 100), (i % 100) ))
return (1) ;
}
}
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
DBG_FTL(("%s: Adapter selftest failed (0x%04X)!",
IoAdapter->Properties.Name, signature[0] >> 16))
qBri_cpu_trapped (IoAdapter) ;
return (FALSE) ;
}
#else /* } { */
static int load_qBri_hardware (PISDN_ADAPTER IoAdapter) { static int load_qBri_hardware (PISDN_ADAPTER IoAdapter) {
return (0); return (0);
} }
#endif /* } */
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Card ISR Card ISR

View File

@ -119,356 +119,9 @@ static void stop_bri_hardware (PISDN_ADAPTER IoAdapter) {
outpp (p, 0x00) ; /* clear int, halt cpu */ outpp (p, 0x00) ; /* clear int, halt cpu */
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p); DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
} }
#if !defined(DIVA_USER_MODE_CARD_CONFIG) /* { */
/* ---------------------------------------------------------------------
Load protocol on the card
--------------------------------------------------------------------- */
static dword bri_protocol_load (PISDN_ADAPTER IoAdapter) {
dword FileLength ;
word test, *File = NULL ;
byte* addrHi, *addrLo, *ioaddr ;
char *FileName = &IoAdapter->Protocol[0] ;
dword Addr, i ;
byte *Port;
/* -------------------------------------------------------------------
Try to load protocol code. 'File' points to memory location
that does contain entire protocol code
------------------------------------------------------------------- */
if ( !(File = (word *)xdiLoadArchive (IoAdapter, &FileLength, 0)) )
return (0) ;
/* -------------------------------------------------------------------
Get protocol features and calculate load addresses
------------------------------------------------------------------- */
IoAdapter->features = diva_get_protocol_file_features ((byte*)File,
OFFS_PROTOCOL_ID_STRING,
IoAdapter->ProtocolIdString,
sizeof(IoAdapter->ProtocolIdString));
IoAdapter->a.protocol_capabilities = IoAdapter->features ;
DBG_LOG(("Loading %s", IoAdapter->ProtocolIdString))
Addr = ((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR]))
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 1])) << 8)
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 2])) << 16)
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 3])) << 24) ;
if ( Addr != 0 )
{
IoAdapter->DspCodeBaseAddr = (Addr + 3) & (~3) ;
IoAdapter->MaxDspCodeSize = (BRI_UNCACHED_ADDR (IoAdapter->MemoryBase + IoAdapter->MemorySize -
BRI_SHARED_RAM_SIZE)
- IoAdapter->DspCodeBaseAddr) & (IoAdapter->MemorySize - 1) ;
Addr = IoAdapter->DspCodeBaseAddr ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR] = (byte) Addr ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 1] = (byte)(Addr >> 8) ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 2] = (byte)(Addr >> 16) ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 3] = (byte)(Addr >> 24) ;
IoAdapter->InitialDspInfo = 0x80 ;
}
else
{
if ( IoAdapter->features & PROTCAP_V90D )
IoAdapter->MaxDspCodeSize = BRI_V90D_MAX_DSP_CODE_SIZE ;
else
IoAdapter->MaxDspCodeSize = BRI_ORG_MAX_DSP_CODE_SIZE ;
IoAdapter->DspCodeBaseAddr = BRI_CACHED_ADDR (IoAdapter->MemoryBase + IoAdapter->MemorySize -
BRI_SHARED_RAM_SIZE - IoAdapter->MaxDspCodeSize);
IoAdapter->InitialDspInfo = (IoAdapter->MaxDspCodeSize - BRI_ORG_MAX_DSP_CODE_SIZE) >> 14 ;
}
DBG_LOG(("DSP code base 0x%08lx, max size 0x%08lx (%08lx,%02x)",
IoAdapter->DspCodeBaseAddr, IoAdapter->MaxDspCodeSize,
Addr, IoAdapter->InitialDspInfo))
if ( FileLength > ((IoAdapter->DspCodeBaseAddr -
BRI_CACHED_ADDR (IoAdapter->MemoryBase)) & (IoAdapter->MemorySize - 1)) )
{
xdiFreeFile (File);
DBG_FTL(("Protocol code '%s' too big (%ld)", FileName, FileLength))
return (0) ;
}
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port + ((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH) ;
addrLo = Port + ADDR ;
ioaddr = Port + DATA ;
/*
* set start address for download (use autoincrement mode !)
*/
outpp (addrHi, 0) ;
outppw (addrLo, 0) ;
for ( i = 0 ; i < FileLength ; i += 2 )
{
if ( (i & 0x0000FFFF) == 0 )
{
outpp (addrHi, (byte)(i >> 16)) ;
}
outppw (ioaddr, File[i/2]) ;
}
/*
* memory test without second load of file
*/
outpp (addrHi, 0) ;
outppw (addrLo, 0) ;
for ( i = 0 ; i < FileLength ; i += 2 )
{
if ( (i & 0x0000FFFF) == 0 )
{
outpp (addrHi, (byte)(i >> 16)) ;
}
test = inppw (ioaddr) ;
if ( test != File[i/2] )
{
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
DBG_FTL(("%s: Memory test failed! (%d - 0x%04X/0x%04X)",
IoAdapter->Properties.Name, i, test, File[i/2]))
xdiFreeFile (File);
return (0) ;
}
}
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
xdiFreeFile (File);
return (FileLength) ;
}
/******************************************************************************/
typedef struct
{
PISDN_ADAPTER IoAdapter ;
byte* AddrLo ;
byte* AddrHi ;
word* Data ;
dword DownloadPos ;
} bri_download_info ;
static long bri_download_buffer (OsFileHandle *fp, long length, void **addr) {
int buffer_size = 2048*sizeof(word);
word *buffer = (word*)diva_os_malloc (0, buffer_size);
bri_download_info *info ;
word test ;
long i, len, page ;
if (!buffer) {
DBG_ERR(("A: out of memory, s_bri at %d", __LINE__))
return (-1);
}
info = (bri_download_info *)fp->sysLoadDesc ;
*addr = (void *)info->DownloadPos ;
if ( ((dword) length) > info->IoAdapter->DspCodeBaseAddr +
info->IoAdapter->MaxDspCodeSize - info->DownloadPos )
{
DBG_FTL(("%s: out of card memory during DSP download (0x%X)",
info->IoAdapter->Properties.Name,
info->DownloadPos + length))
diva_os_free (0, buffer);
return (-1) ;
}
for ( len = 0 ; length > 0 ; length -= len )
{
len = (length > buffer_size ? buffer_size : length) ;
page = ((long)(info->DownloadPos) + len) & 0xFFFF0000 ;
if ( page != (long)(info->DownloadPos & 0xFFFF0000) )
{
len = 0x00010000 - (((long)info->DownloadPos) & 0x0000FFFF) ;
}
if ( fp->sysFileRead (fp, &buffer[0], len) != len ) {
diva_os_free (0, buffer);
return (-1) ;
}
outpp (info->AddrHi, (byte)(info->DownloadPos >> 16)) ;
outppw (info->AddrLo, (word)info->DownloadPos) ;
outppw_buffer (info->Data, &buffer[0], (len + 1)) ;
/*
* memory test without second load of file
*/
outpp (info->AddrHi, (byte)(info->DownloadPos >> 16)) ;
outppw (info->AddrLo, (word)info->DownloadPos) ;
for ( i = 0 ; i < len ; i += 2 )
{
if ( (test = inppw (info->Data)) != buffer[i/2] )
{
DBG_FTL(("%s: Memory test failed! (0x%lX - 0x%04X/0x%04X)",
info->IoAdapter->Properties.Name,
info->DownloadPos + i, test, buffer[i/2]))
diva_os_free (0, buffer);
return (-2) ;
}
}
info->DownloadPos += len ;
}
info->DownloadPos = (info->DownloadPos + 3) & (~3) ;
diva_os_free (0, buffer);
return (0) ;
}
/******************************************************************************/
static dword bri_telindus_load (PISDN_ADAPTER IoAdapter, char *DspTelindusFile)
{
bri_download_info *pinfo =\
(bri_download_info*)diva_os_malloc(0, sizeof(*pinfo));
char *error ;
OsFileHandle *fp ;
t_dsp_portable_desc download_table[DSP_MAX_DOWNLOAD_COUNT] ;
word download_count ;
dword FileLength ;
byte *Port;
if (!pinfo) {
DBG_ERR (("A: out of memory s_bri at %d", __LINE__))
return (0);
}
if (!(fp = OsOpenFile (DspTelindusFile))) {
diva_os_free (0, pinfo);
return (0) ;
}
FileLength = fp->sysFileSize ;
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
pinfo->IoAdapter = IoAdapter ;
pinfo->AddrLo = Port + ADDR ;
pinfo->AddrHi = Port + (IoAdapter->Properties.Bus == BUS_PCI ? M_PCI_ADDRH : ADDRH);
pinfo->Data = (word*)(Port + DATA) ;
pinfo->DownloadPos = (IoAdapter->DspCodeBaseAddr +\
sizeof(dword) + sizeof(download_table) + 3) & (~3) ;
fp->sysLoadDesc = (void *)pinfo;
fp->sysCardLoad = bri_download_buffer ;
download_count = DSP_MAX_DOWNLOAD_COUNT ;
memset (&download_table[0], '\0', sizeof(download_table)) ;
/*
* set start address for download (use autoincrement mode !)
*/
error = dsp_read_file (fp, (word)(IoAdapter->cardType),
&download_count, NULL, &download_table[0]) ;
if ( error )
{
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
DBG_FTL(("download file error: %s", error))
OsCloseFile (fp) ;
diva_os_free (0, pinfo);
return (0) ;
}
OsCloseFile (fp) ;
/*
* store # of separate download files extracted from archive
*/
pinfo->DownloadPos = IoAdapter->DspCodeBaseAddr ;
outpp (pinfo->AddrHi, (byte)(pinfo->DownloadPos >> 16)) ;
outppw (pinfo->AddrLo, (word)pinfo->DownloadPos) ;
outppw (pinfo->Data, (word)download_count) ;
outppw (pinfo->Data, (word)0) ;
/*
* copy download table to board
*/
outppw_buffer (pinfo->Data, &download_table[0], sizeof(download_table)) ;
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
diva_os_free (0, pinfo);
return (FileLength) ;
}
/******************************************************************************/
static int load_bri_hardware (PISDN_ADAPTER IoAdapter) {
dword i ;
byte* addrHi, *addrLo, *ioaddr, *p ;
dword test ;
byte *Port;
if ( IoAdapter->Properties.Card != CARD_MAE )
{
return (FALSE) ;
}
reset_bri_hardware (IoAdapter) ;
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port + ((IoAdapter->Properties.Bus==BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR ;
ioaddr = Port + DATA ;
diva_os_wait (100);
/*
* recover
*/
outpp (addrHi, (byte) 0) ;
outppw (addrLo, (word) 0) ;
outppw (ioaddr, (word) 0) ;
/*
* clear shared memory
*/
outpp (addrHi, (byte)((BRI_UNCACHED_ADDR (IoAdapter->MemoryBase + \
IoAdapter->MemorySize - BRI_SHARED_RAM_SIZE)) >> 16)) ;
outppw (addrLo, 0) ;
for ( i = 0 ; i < 0x8000 ; outppw (ioaddr, 0), ++i ) ;
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
diva_os_wait (100) ;
/*
* download protocol and dsp files
*/
switch ( IoAdapter->protocol_id ) {
default:
if ( !xdiSetProtocol (IoAdapter, IoAdapter->ProtocolSuffix) )
return (FALSE) ;
if ( !bri_protocol_load (IoAdapter) )
return (FALSE) ;
if ( !bri_telindus_load (IoAdapter, DSP_TELINDUS_FILE) )
return (FALSE) ;
break ;
case PROTTYPE_QSIG:
case PROTTYPE_CORNETN:
if ( !xdiSetProtocol (IoAdapter, IoAdapter->ProtocolSuffix) )
return (FALSE) ;
if (IoAdapter->ProtocolSuffix && *IoAdapter->ProtocolSuffix) {
sprintf (&IoAdapter->Protocol[0],
"TE_QSIG.%s", IoAdapter->ProtocolSuffix) ;
}
DBG_TRC(("xdiSetProtocol: %s firmware '%s' archive '%s'",
IoAdapter->Properties.Name,
&IoAdapter->Protocol[0], &IoAdapter->Archive[0]))
if ( !bri_protocol_load (IoAdapter) )
return (FALSE) ;
if ( !bri_telindus_load (IoAdapter, DSP_QSIG_TELINDUS_FILE) )
return (FALSE) ;
break ;
}
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port + ((IoAdapter->Properties.Bus==BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR ;
ioaddr = Port + DATA ;
/*
* clear signature
*/
outpp (addrHi, (byte)((BRI_UNCACHED_ADDR (IoAdapter->MemoryBase + \
IoAdapter->MemorySize - BRI_SHARED_RAM_SIZE)) >> 16)) ;
outppw (addrLo, 0x1e) ;
outpp (ioaddr, 0) ;
outpp (ioaddr, 0) ;
/*
* copy parameters
*/
diva_configure_protocol (IoAdapter);
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
/*
* start the protocol code
*/
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
outpp (p, 0x08) ;
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
/*
* wait for signature (max. 3 seconds)
*/
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port + ((IoAdapter->Properties.Bus==BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR ;
ioaddr = Port + DATA ;
for ( i = 0 ; i < 300 ; ++i )
{
diva_os_wait (10) ;
outpp (addrHi, (byte)((BRI_UNCACHED_ADDR (IoAdapter->MemoryBase + \
IoAdapter->MemorySize - BRI_SHARED_RAM_SIZE)) >> 16)) ;
outppw (addrLo, 0x1e) ;
test = (dword)inppw (ioaddr) ;
if ( test == 0x4447 )
{
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
DBG_TRC(("Protocol startup time %d.%02d seconds",
(i / 100), (i % 100) ))
return (TRUE) ;
}
}
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
DBG_FTL(("%s: Adapter selftest failed (0x%04X)!",
IoAdapter->Properties.Name, test))
bri_cpu_trapped (IoAdapter) ;
return (FALSE) ;
}
#else /* } { */
static int load_bri_hardware (PISDN_ADAPTER IoAdapter) { static int load_bri_hardware (PISDN_ADAPTER IoAdapter) {
return (0); return (0);
} }
#endif /* } */
/******************************************************************************/ /******************************************************************************/
static int bri_ISR (struct _ISDN_ADAPTER* IoAdapter) { static int bri_ISR (struct _ISDN_ADAPTER* IoAdapter) {
byte __iomem *p; byte __iomem *p;

View File

@ -122,371 +122,9 @@ static void stop_pri_hardware (PISDN_ADAPTER IoAdapter) {
WRITE_BYTE(p, _MP_RISC_RESET | _MP_LED1 | _MP_LED2); WRITE_BYTE(p, _MP_RISC_RESET | _MP_LED1 | _MP_LED2);
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p); DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
} }
#if !defined(DIVA_USER_MODE_CARD_CONFIG) /* { */
/* -------------------------------------------------------------------------
Load protocol code to the PRI Card
------------------------------------------------------------------------- */
#define DOWNLOAD_ADDR(IoAdapter) (IoAdapter->downloadAddr & (IoAdapter->MemorySize - 1))
static int pri_protocol_load (PISDN_ADAPTER IoAdapter) {
dword FileLength ;
dword *File ;
dword *sharedRam ;
dword Addr ;
byte *p;
if (!(File = (dword *)xdiLoadArchive (IoAdapter, &FileLength, 0))) {
return (0) ;
}
IoAdapter->features = diva_get_protocol_file_features ((byte*)File,
OFFS_PROTOCOL_ID_STRING,
IoAdapter->ProtocolIdString,
sizeof(IoAdapter->ProtocolIdString)) ;
IoAdapter->a.protocol_capabilities = IoAdapter->features ;
DBG_LOG(("Loading %s", IoAdapter->ProtocolIdString))
Addr = ((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR]))
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 1])) << 8)
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 2])) << 16)
| (((dword)(((byte *) File)[OFFS_PROTOCOL_END_ADDR + 3])) << 24) ;
if ( Addr != 0 )
{
IoAdapter->DspCodeBaseAddr = (Addr + 3) & (~3) ;
IoAdapter->MaxDspCodeSize = (MP_UNCACHED_ADDR (IoAdapter->MemorySize)
- IoAdapter->DspCodeBaseAddr) & (IoAdapter->MemorySize - 1) ;
Addr = IoAdapter->DspCodeBaseAddr ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR] = (byte) Addr ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 1] = (byte)(Addr >> 8) ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 2] = (byte)(Addr >> 16) ;
((byte *) File)[OFFS_DSP_CODE_BASE_ADDR + 3] = (byte)(Addr >> 24) ;
IoAdapter->InitialDspInfo = 0x80 ;
}
else
{
if ( IoAdapter->features & PROTCAP_VOIP )
IoAdapter->MaxDspCodeSize = MP_VOIP_MAX_DSP_CODE_SIZE ;
else if ( IoAdapter->features & PROTCAP_V90D )
IoAdapter->MaxDspCodeSize = MP_V90D_MAX_DSP_CODE_SIZE ;
else
IoAdapter->MaxDspCodeSize = MP_ORG_MAX_DSP_CODE_SIZE ;
IoAdapter->DspCodeBaseAddr = MP_CACHED_ADDR (IoAdapter->MemorySize -
IoAdapter->MaxDspCodeSize) ;
IoAdapter->InitialDspInfo = (IoAdapter->MaxDspCodeSize
- MP_ORG_MAX_DSP_CODE_SIZE) >> 14 ;
}
DBG_LOG(("DSP code base 0x%08lx, max size 0x%08lx (%08lx,%02x)",
IoAdapter->DspCodeBaseAddr, IoAdapter->MaxDspCodeSize,
Addr, IoAdapter->InitialDspInfo))
if ( FileLength > ((IoAdapter->DspCodeBaseAddr -
MP_CACHED_ADDR (MP_PROTOCOL_OFFSET)) & (IoAdapter->MemorySize - 1)) )
{
xdiFreeFile (File);
DBG_FTL(("Protocol code '%s' too long (%ld)",
&IoAdapter->Protocol[0], FileLength))
return (0) ;
}
IoAdapter->downloadAddr = MP_UNCACHED_ADDR (MP_PROTOCOL_OFFSET) ;
p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
sharedRam = (dword *)(&p[DOWNLOAD_ADDR(IoAdapter)]);
memcpy (sharedRam, File, FileLength) ;
if ( memcmp (sharedRam, File, FileLength) )
{
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
DBG_FTL(("%s: Memory test failed!", IoAdapter->Properties.Name))
xdiFreeFile (File);
return (0) ;
}
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
xdiFreeFile (File);
return (1) ;
}
/******************************************************************************/
/*------------------------------------------------------------------
Dsp related definitions
------------------------------------------------------------------ */
#define DSP_SIGNATURE_PROBE_WORD 0x5a5a
/*
** Checks presence of DSP on board
*/
static int
dsp_check_presence (volatile byte* addr, volatile byte* data, int dsp)
{
word pattern;
*(volatile word*)addr = 0x4000;
*(volatile word*)data = DSP_SIGNATURE_PROBE_WORD;
*(volatile word*)addr = 0x4000;
pattern = *(volatile word*)data;
if (pattern != DSP_SIGNATURE_PROBE_WORD) {
DBG_TRC(("W: DSP[%d] %04x(is) != %04x(should)",
dsp, pattern, DSP_SIGNATURE_PROBE_WORD))
return (-1);
}
*(volatile word*)addr = 0x4000;
*(volatile word*)data = ~DSP_SIGNATURE_PROBE_WORD;
*(volatile word*)addr = 0x4000;
pattern = *(volatile word*)data;
if (pattern != (word)~DSP_SIGNATURE_PROBE_WORD) {
DBG_ERR(("A: DSP[%d] %04x(is) != %04x(should)",
dsp, pattern, (word)~DSP_SIGNATURE_PROBE_WORD))
return (-2);
}
DBG_TRC (("DSP[%d] present", dsp))
return (0);
}
/*
** Check if DSP's are present and operating
** Information about detected DSP's is returned as bit mask
** Bit 0 - DSP1
** ...
** ...
** ...
** Bit 29 - DSP30
*/
static dword
diva_pri_detect_dsps (PISDN_ADAPTER IoAdapter)
{
byte* base;
byte* p;
dword ret = 0, DspCount = 0 ;
dword row_offset[] = {
0x00000000,
0x00000800, /* 1 - ROW 1 */
0x00000840, /* 2 - ROW 2 */
0x00001000, /* 3 - ROW 3 */
0x00001040, /* 4 - ROW 4 */
0x00000000 /* 5 - ROW 0 */
};
byte *dsp_addr_port, *dsp_data_port, row_state;
int dsp_row = 0, dsp_index, dsp_num;
IoAdapter->InitialDspInfo &= 0xffff ;
p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
if (!p)
{
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
return (0);
}
*(volatile byte*)(p) = _MP_RISC_RESET | _MP_DSP_RESET;
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
diva_os_wait (5) ;
base = DIVA_OS_MEM_ATTACH_CONTROL(IoAdapter);
for (dsp_num = 0; dsp_num < 30; dsp_num++) {
dsp_row = dsp_num / 7 + 1;
dsp_index = dsp_num % 7;
dsp_data_port = base;
dsp_addr_port = base;
dsp_data_port += row_offset[dsp_row];
dsp_addr_port += row_offset[dsp_row];
dsp_data_port += (dsp_index * 8);
dsp_addr_port += (dsp_index * 8) + 0x80;
if (!dsp_check_presence (dsp_addr_port, dsp_data_port, dsp_num+1)) {
ret |= (1 << dsp_num);
DspCount++ ;
}
}
DIVA_OS_MEM_DETACH_CONTROL(IoAdapter, base);
p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
*(volatile byte*)(p) = _MP_RISC_RESET | _MP_LED1 | _MP_LED2;
diva_os_wait (50) ;
/*
Verify modules
*/
for (dsp_row = 0; dsp_row < 4; dsp_row++) {
row_state = (byte)((ret >> (dsp_row*7)) & 0x7F);
if (row_state && (row_state != 0x7F)) {
for (dsp_index = 0; dsp_index < 7; dsp_index++) {
if (!(row_state & (1 << dsp_index))) {
DBG_ERR (("A: MODULE[%d]-DSP[%d] failed", dsp_row+1, dsp_index+1))
}
}
}
}
if (!(ret & 0x10000000)) {
DBG_ERR (("A: ON BOARD-DSP[1] failed"))
}
if (!(ret & 0x20000000)) {
DBG_ERR (("A: ON BOARD-DSP[2] failed"))
}
/*
Print module population now
*/
DBG_LOG(("+-----------------------+"))
DBG_LOG(("| DSP MODULE POPULATION |"))
DBG_LOG(("+-----------------------+"))
DBG_LOG(("| 1 | 2 | 3 | 4 |"))
DBG_LOG(("+-----------------------+"))
DBG_LOG(("| %s | %s | %s | %s |",
((ret >> (0*7)) & 0x7F) ? "Y" : "N",
((ret >> (1*7)) & 0x7F) ? "Y" : "N",
((ret >> (2*7)) & 0x7F) ? "Y" : "N",
((ret >> (3*7)) & 0x7F) ? "Y" : "N"))
DBG_LOG(("+-----------------------+"))
DBG_LOG(("DSP's(present-absent):%08x-%08x", ret, ~ret & 0x3fffffff))
*(volatile byte*)(p) = 0 ;
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
diva_os_wait (50) ;
IoAdapter->InitialDspInfo |= DspCount << 16 ;
return (ret);
}
/* -------------------------------------------------------------------------
helper used to download dsp code toi PRI Card
------------------------------------------------------------------------- */
static long pri_download_buffer (OsFileHandle *fp, long length, void **addr) {
PISDN_ADAPTER IoAdapter = (PISDN_ADAPTER)fp->sysLoadDesc ;
dword *sharedRam ;
byte *p;
*addr = (void *)IoAdapter->downloadAddr ;
if ( ((dword) length) > IoAdapter->DspCodeBaseAddr +
IoAdapter->MaxDspCodeSize - IoAdapter->downloadAddr )
{
DBG_FTL(("%s: out of card memory during DSP download (0x%X)",
IoAdapter->Properties.Name,
IoAdapter->downloadAddr + length))
return (-1) ;
}
p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
sharedRam = (dword *)(&p[DOWNLOAD_ADDR(IoAdapter)]);
if ( fp->sysFileRead (fp, sharedRam, length) != length ) {
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
return (-1) ;
}
IoAdapter->downloadAddr += length ;
IoAdapter->downloadAddr = (IoAdapter->downloadAddr + 3) & (~3) ;
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
return (0) ;
}
/* -------------------------------------------------------------------------
Download DSP code to PRI Card
------------------------------------------------------------------------- */
static dword pri_telindus_load (PISDN_ADAPTER IoAdapter) {
char *error ;
OsFileHandle *fp ;
t_dsp_portable_desc download_table[DSP_MAX_DOWNLOAD_COUNT] ;
word download_count ;
dword *sharedRam ;
dword FileLength ;
byte *p;
if ( !(fp = OsOpenFile (DSP_TELINDUS_FILE)) )
return (0) ;
IoAdapter->downloadAddr = (IoAdapter->DspCodeBaseAddr
+ sizeof(dword) + sizeof(download_table) + 3) & (~3) ;
FileLength = fp->sysFileSize ;
fp->sysLoadDesc = (void *)IoAdapter ;
fp->sysCardLoad = pri_download_buffer ;
download_count = DSP_MAX_DOWNLOAD_COUNT ;
memset (&download_table[0], '\0', sizeof(download_table)) ;
/*
* set start address for download (use autoincrement mode !)
*/
error = dsp_read_file (fp, (word)(IoAdapter->cardType),
&download_count, NULL, &download_table[0]) ;
if ( error )
{
DBG_FTL(("download file error: %s", error))
OsCloseFile (fp) ;
return (0) ;
}
OsCloseFile (fp) ;
/*
* store # of separate download files extracted from archive
*/
IoAdapter->downloadAddr = IoAdapter->DspCodeBaseAddr ;
p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
sharedRam = (dword *)(&p[DOWNLOAD_ADDR(IoAdapter)]);
WRITE_DWORD(&(sharedRam[0]), (dword)download_count);
memcpy (&sharedRam[1], &download_table[0], sizeof(download_table)) ;
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
return (FileLength) ;
}
/* -------------------------------------------------------------------------
Download PRI Card
------------------------------------------------------------------------- */
#define MIN_DSPS 0x30000000
static int load_pri_hardware (PISDN_ADAPTER IoAdapter) {
dword i ;
struct mp_load *boot = (struct mp_load *)DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
if ( IoAdapter->Properties.Card != CARD_MAEP ) {
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
return (0) ;
}
boot->err = 0 ;
#if 0
IoAdapter->rstFnc (IoAdapter) ;
#else
if ( MIN_DSPS != (MIN_DSPS & diva_pri_detect_dsps(IoAdapter)) ) { /* makes reset */
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
DBG_FTL(("%s: DSP error!", IoAdapter->Properties.Name))
return (0) ;
}
#endif
/*
* check if CPU is alive
*/
diva_os_wait (10) ;
i = boot->live ;
diva_os_wait (10) ;
if ( i == boot->live )
{
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
DBG_FTL(("%s: CPU is not alive!", IoAdapter->Properties.Name))
return (0) ;
}
if ( boot->err )
{
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
DBG_FTL(("%s: Board Selftest failed!", IoAdapter->Properties.Name))
return (0) ;
}
/*
* download protocol and dsp files
*/
if ( !xdiSetProtocol (IoAdapter, IoAdapter->ProtocolSuffix) ) {
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
return (0) ;
}
if ( !pri_protocol_load (IoAdapter) ) {
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
return (0) ;
}
if ( !pri_telindus_load (IoAdapter) ) {
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
return (0) ;
}
/*
* copy configuration parameters
*/
IoAdapter->ram += MP_SHARED_RAM_OFFSET ;
memset (boot + MP_SHARED_RAM_OFFSET, '\0', 256) ;
diva_configure_protocol (IoAdapter);
/*
* start adapter
*/
boot->addr = MP_UNCACHED_ADDR (MP_PROTOCOL_OFFSET) ;
boot->cmd = 3 ;
/*
* wait for signature in shared memory (max. 3 seconds)
*/
for ( i = 0 ; i < 300 ; ++i )
{
diva_os_wait (10) ;
if ( (boot->signature >> 16) == 0x4447 )
{
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
DBG_TRC(("Protocol startup time %d.%02d seconds",
(i / 100), (i % 100) ))
return (1) ;
}
}
DIVA_OS_MEM_DETACH_RAM(IoAdapter, boot);
DBG_FTL(("%s: Adapter selftest failed (0x%04X)!",
IoAdapter->Properties.Name, boot->signature >> 16))
pri_cpu_trapped (IoAdapter) ;
return (0) ;
}
#else /* } { */
static int load_pri_hardware (PISDN_ADAPTER IoAdapter) { static int load_pri_hardware (PISDN_ADAPTER IoAdapter) {
return (0); return (0);
} }
#endif /* } */
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
PRI Adapter interrupt Service Routine PRI Adapter interrupt Service Routine
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */

View File

@ -1,26 +1,26 @@
/* /*
* *
Copyright (c) Eicon Networks, 2002. Copyright (c) Eicon Networks, 2002.
* *
This source file is supplied for the use with This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters. Eicon Networks range of DIVA Server Adapters.
* *
Eicon File Revision : 2.1 Eicon File Revision : 2.1
* *
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option) the Free Software Foundation; either version 2, or (at your option)
any later version. any later version.
* *
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
* *
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
*/ */
static char diva_xdi_common_code_build[] = "102-52"; static char diva_xdi_common_code_build[] = "102-52";

View File

@ -231,7 +231,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
cs->irq = card->para[0]; cs->irq = card->para[0];
outb(cs->hw.avm.cfg_reg+ASL1_OFFSET, ASL1_W_ENABLE_S0); byteout(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);

View File

@ -41,7 +41,7 @@ MODULE_LICENSE("GPL");
*/ */
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG; static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i"); module_param(pc_debug, int, 0);
#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 =
"avma1_cs.c 1.00 1998/01/23 10:00:00 (Carsten Paeth)"; "avma1_cs.c 1.00 1998/01/23 10:00:00 (Carsten Paeth)";
@ -53,12 +53,9 @@ static char *version =
/* Parameters that can be set with 'insmod' */ /* Parameters that can be set with 'insmod' */
static int default_irq_list[11] = { 15, 13, 12, 11, 10, 9, 7, 5, 4, 3, -1 };
static int irq_list[11] = { -1 };
static int isdnprot = 2; static int isdnprot = 2;
MODULE_PARM(irq_list, "1-11i"); module_param(isdnprot, int, 0);
MODULE_PARM(isdnprot, "1-4i");
/*====================================================================*/ /*====================================================================*/
@ -143,7 +140,7 @@ static dev_link_t *avma1cs_attach(void)
client_reg_t client_reg; client_reg_t client_reg;
dev_link_t *link; dev_link_t *link;
local_info_t *local; local_info_t *local;
int ret, i; int ret;
DEBUG(0, "avma1cs_attach()\n"); DEBUG(0, "avma1cs_attach()\n");
@ -173,15 +170,8 @@ static dev_link_t *avma1cs_attach(void)
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; link->irq.IRQInfo1 = IRQ_LEVEL_ID;
if (irq_list[0] != -1) {
for (i = 0; i < 10 && irq_list[i] > 0; i++)
link->irq.IRQInfo2 |= 1 << irq_list[i];
} else {
for (i = 0; i < 10 && default_irq_list[i] > 0; i++)
link->irq.IRQInfo2 |= 1 << default_irq_list[i];
}
/* General socket configuration */ /* General socket configuration */
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.Vcc = 50; link->conf.Vcc = 50;
@ -193,7 +183,6 @@ static dev_link_t *avma1cs_attach(void)
link->next = dev_list; link->next = dev_list;
dev_list = link; dev_list = link;
client_reg.dev_info = &dev_info; client_reg.dev_info = &dev_info;
client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
client_reg.EventMask = client_reg.EventMask =
CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
@ -531,13 +520,7 @@ static int __init init_avma1_cs(void)
static void __exit exit_avma1_cs(void) static void __exit exit_avma1_cs(void)
{ {
pcmcia_unregister_driver(&avma1cs_driver); pcmcia_unregister_driver(&avma1cs_driver);
BUG_ON(dev_list != NULL);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
avma1cs_release(dev_list);
avma1cs_detach(dev_list);
}
} }
module_init(init_avma1_cs); module_init(init_avma1_cs);

View File

@ -354,20 +354,18 @@ static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, };
static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, }; static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, };
static char *id = HiSaxID; static char *id = HiSaxID;
#define PARM_PARA "1-" __MODULE_STRING(HISAX_MAX_CARDS) "i"
MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards"); MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards");
MODULE_AUTHOR("Karsten Keil"); MODULE_AUTHOR("Karsten Keil");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(type, PARM_PARA); module_param_array(type, int, NULL, 0);
MODULE_PARM(protocol, PARM_PARA); module_param_array(protocol, int, NULL, 0);
MODULE_PARM(io, PARM_PARA); module_param_array(io, int, NULL, 0);
MODULE_PARM(irq, PARM_PARA); module_param_array(irq, int, NULL, 0);
MODULE_PARM(mem, PARM_PARA); module_param_array(mem, int, NULL, 0);
MODULE_PARM(id, "s"); module_param(id, charp, 0);
#ifdef IO0_IO1 #ifdef IO0_IO1
MODULE_PARM(io0, PARM_PARA); module_param_array(io0, int, NULL, 0);
MODULE_PARM(io1, PARM_PARA); module_param_array(io1, int, NULL, 0);
#endif #endif
#endif /* MODULE */ #endif /* MODULE */

View File

@ -69,7 +69,7 @@ MODULE_LICENSE("Dual MPL/GPL");
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG; static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i"); module_param(pc_debug, int, 0);
#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$ $Date$ (K.Lichtenwalder)"; "elsa_cs.c $Revision$ $Date$ (K.Lichtenwalder)";
@ -81,18 +81,8 @@ static char *version =
/* Parameters that can be set with 'insmod' */ /* Parameters that can be set with 'insmod' */
/* Bit map of interrupts to choose from, the old way */
/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, 3 */
static u_long irq_mask = 0xdeb8;
/* Newer, simpler way of listing specific interrupts */
static int irq_list[4] = { -1 };
MODULE_PARM(irq_mask, "i");
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_param(protocol, int, 0);
/*====================================================================*/ /*====================================================================*/
@ -187,7 +177,7 @@ static dev_link_t *elsa_cs_attach(void)
client_reg_t client_reg; client_reg_t client_reg;
dev_link_t *link; dev_link_t *link;
local_info_t *local; local_info_t *local;
int ret, i; int ret;
DEBUG(0, "elsa_cs_attach()\n"); DEBUG(0, "elsa_cs_attach()\n");
@ -200,12 +190,7 @@ static dev_link_t *elsa_cs_attach(void)
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID|IRQ_SHARE_ID; link->irq.IRQInfo1 = IRQ_LEVEL_ID|IRQ_SHARE_ID;
if (irq_list[0] == -1)
link->irq.IRQInfo2 = irq_mask;
else
for (i = 0; i < 4; i++)
link->irq.IRQInfo2 |= 1 << irq_list[i];
link->irq.Handler = NULL; link->irq.Handler = NULL;
/* /*
@ -227,7 +212,6 @@ static dev_link_t *elsa_cs_attach(void)
link->next = dev_list; link->next = dev_list;
dev_list = link; dev_list = link;
client_reg.dev_info = &dev_info; client_reg.dev_info = &dev_info;
client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
client_reg.EventMask = client_reg.EventMask =
CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
@ -541,10 +525,7 @@ static int __init init_elsa_cs(void)
static void __exit exit_elsa_cs(void) static void __exit exit_elsa_cs(void)
{ {
pcmcia_unregister_driver(&elsa_cs_driver); pcmcia_unregister_driver(&elsa_cs_driver);
BUG_ON(dev_list != NULL);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
elsa_cs_detach(dev_list);
} }
module_init(init_elsa_cs); module_init(init_elsa_cs);

View File

@ -45,8 +45,8 @@
#ifdef CONFIG_HISAX_DEBUG #ifdef CONFIG_HISAX_DEBUG
static int debug = 0; static int debug = 0;
/* static int hdlcfifosize = 32; */ /* static int hdlcfifosize = 32; */
MODULE_PARM(debug, "i"); module_param(debug, int, 0);
/* MODULE_PARM(hdlcfifosize, "i"); */ /* module_param(hdlcfifosize, int, 0); */
#endif #endif
MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>"); MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
@ -81,7 +81,7 @@ MODULE_DEVICE_TABLE(isapnp, fcpnp_ids);
#endif #endif
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i"); module_param(protocol, int, 0);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------

View File

@ -32,7 +32,7 @@
#ifdef CONFIG_HISAX_DEBUG #ifdef CONFIG_HISAX_DEBUG
static int debug = 1; static int debug = 1;
MODULE_PARM(debug, "i"); module_param(debug, int, 0);
static char *ISACVer[] = { static char *ISACVer[] = {
"2086/2186 V1.1", "2086/2186 V1.1",

View File

@ -27,7 +27,7 @@
static char *ICCVer[] __initdata = static char *ICCVer[] __initdata =
{"2070 A1/A3", "2070 B1", "2070 B2/B3", "2070 V2.4"}; {"2070 A1/A3", "2070 B1", "2070 B2/B3", "2070 V2.4"};
void void __init
ICCVersion(struct IsdnCardState *cs, char *s) ICCVersion(struct IsdnCardState *cs, char *s)
{ {
int val; int val;

View File

@ -65,7 +65,7 @@
#define ICC_IND_AIL 0xE #define ICC_IND_AIL 0xE
#define ICC_IND_DC 0xF #define ICC_IND_DC 0xF
extern void ICCVersion(struct IsdnCardState *cs, char *s); extern void __init ICCVersion(struct IsdnCardState *cs, char *s);
extern void initicc(struct IsdnCardState *cs); extern void initicc(struct IsdnCardState *cs);
extern void icc_interrupt(struct IsdnCardState *cs, u_char val); extern void icc_interrupt(struct IsdnCardState *cs, u_char val);
extern void clear_pending_icc_ints(struct IsdnCardState *cs); extern void clear_pending_icc_ints(struct IsdnCardState *cs);

View File

@ -308,7 +308,7 @@ int isdnhdlc_decode (struct isdnhdlc_vars *hdlc, const unsigned char *src,
hdlc->crc = crc_ccitt_byte(hdlc->crc, hdlc->shift_reg); hdlc->crc = crc_ccitt_byte(hdlc->crc, hdlc->shift_reg);
// good byte received // good byte received
if (dsize--) { if (hdlc->dstpos < dsize) {
dst[hdlc->dstpos++] = hdlc->shift_reg; dst[hdlc->dstpos++] = hdlc->shift_reg;
} else { } else {
// frame too long // frame too long

View File

@ -69,7 +69,7 @@ MODULE_LICENSE("Dual MPL/GPL");
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG; static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i"); module_param(pc_debug, int, 0);
#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 =
"sedlbauer_cs.c 1.1a 2001/01/28 15:04:04 (M.Niemann)"; "sedlbauer_cs.c 1.1a 2001/01/28 15:04:04 (M.Niemann)";
@ -82,17 +82,8 @@ static char *version =
/* Parameters that can be set with 'insmod' */ /* Parameters that can be set with 'insmod' */
/* The old way: bit map of interrupts to choose from */
/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */
static u_int irq_mask = 0xdeb8;
/* Newer, simpler way of listing specific interrupts */
static int irq_list[4] = { -1 };
MODULE_PARM(irq_mask, "i");
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_param(protocol, int, 0);
/*====================================================================*/ /*====================================================================*/
@ -195,7 +186,7 @@ static dev_link_t *sedlbauer_attach(void)
local_info_t *local; local_info_t *local;
dev_link_t *link; dev_link_t *link;
client_reg_t client_reg; client_reg_t client_reg;
int ret, i; int ret;
DEBUG(0, "sedlbauer_attach()\n"); DEBUG(0, "sedlbauer_attach()\n");
@ -208,14 +199,9 @@ static dev_link_t *sedlbauer_attach(void)
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; link->irq.IRQInfo1 = IRQ_LEVEL_ID;
if (irq_list[0] == -1)
link->irq.IRQInfo2 = irq_mask;
else
for (i = 0; i < 4; i++)
link->irq.IRQInfo2 |= 1 << irq_list[i];
link->irq.Handler = NULL; link->irq.Handler = NULL;
/* /*
General socket configuration defaults can go here. In this General socket configuration defaults can go here. In this
client, we assume very little, and rely on the CIS for almost client, we assume very little, and rely on the CIS for almost
@ -240,7 +226,6 @@ static dev_link_t *sedlbauer_attach(void)
link->next = dev_list; link->next = dev_list;
dev_list = link; dev_list = link;
client_reg.dev_info = &dev_info; client_reg.dev_info = &dev_info;
client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
client_reg.EventMask = client_reg.EventMask =
CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
@ -648,13 +633,7 @@ static int __init init_sedlbauer_cs(void)
static void __exit exit_sedlbauer_cs(void) static void __exit exit_sedlbauer_cs(void)
{ {
pcmcia_unregister_driver(&sedlbauer_driver); pcmcia_unregister_driver(&sedlbauer_driver);
BUG_ON(dev_list != NULL);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
sedlbauer_release(dev_list);
sedlbauer_detach(dev_list);
}
} }
module_init(init_sedlbauer_cs); module_init(init_sedlbauer_cs);

View File

@ -274,7 +274,7 @@ static int st5481_setup_b_out(struct st5481_bcs *bcs)
endpoint = &altsetting->endpoint[EP_B1_OUT - 1 + bcs->channel * 2]; endpoint = &altsetting->endpoint[EP_B1_OUT - 1 + bcs->channel * 2];
DBG(4,"endpoint address=%02x,packet size=%d", DBG(4,"endpoint address=%02x,packet size=%d",
endpoint->desc.bEndpointAddress, endpoint->desc.wMaxPacketSize); endpoint->desc.bEndpointAddress, le16_to_cpu(endpoint->desc.wMaxPacketSize));
// Allocate memory for 8000bytes/sec + extra bytes if underrun // Allocate memory for 8000bytes/sec + extra bytes if underrun
return st5481_setup_isocpipes(b_out->urb, dev, return st5481_setup_isocpipes(b_out->urb, dev,

View File

@ -669,7 +669,7 @@ static int st5481_setup_d_out(struct st5481_adapter *adapter)
endpoint = &altsetting->endpoint[EP_D_OUT-1]; endpoint = &altsetting->endpoint[EP_D_OUT-1];
DBG(2,"endpoint address=%02x,packet size=%d", DBG(2,"endpoint address=%02x,packet size=%d",
endpoint->desc.bEndpointAddress, endpoint->desc.wMaxPacketSize); endpoint->desc.bEndpointAddress, le16_to_cpu(endpoint->desc.wMaxPacketSize));
return st5481_setup_isocpipes(d_out->urb, dev, return st5481_setup_isocpipes(d_out->urb, dev,
usb_sndisocpipe(dev, endpoint->desc.bEndpointAddress), usb_sndisocpipe(dev, endpoint->desc.bEndpointAddress),

View File

@ -37,14 +37,14 @@ MODULE_AUTHOR("Frode Isaksen");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i"); module_param(protocol, int, 0);
static int number_of_leds = 2; /* 2 LEDs on the adpater default */ static int number_of_leds = 2; /* 2 LEDs on the adpater default */
MODULE_PARM(number_of_leds, "i"); module_param(number_of_leds, int, 0);
#ifdef CONFIG_HISAX_DEBUG #ifdef CONFIG_HISAX_DEBUG
static int debug = 0x1; static int debug = 0x1;
MODULE_PARM(debug, "i"); module_param(debug, int, 0);
int st5481_debug; int st5481_debug;
#endif #endif
@ -67,7 +67,8 @@ static int probe_st5481(struct usb_interface *intf,
int retval, i; int retval, i;
printk(KERN_INFO "st541: found adapter VendorId %04x, ProductId %04x, LEDs %d\n", printk(KERN_INFO "st541: found adapter VendorId %04x, ProductId %04x, LEDs %d\n",
dev->descriptor.idVendor, dev->descriptor.idProduct, le16_to_cpu(dev->descriptor.idVendor),
le16_to_cpu(dev->descriptor.idProduct),
number_of_leds); number_of_leds);
adapter = kmalloc(sizeof(struct st5481_adapter), GFP_KERNEL); adapter = kmalloc(sizeof(struct st5481_adapter), GFP_KERNEL);

View File

@ -268,8 +268,8 @@ int st5481_setup_usb(struct st5481_adapter *adapter)
} }
// The descriptor is wrong for some early samples of the ST5481 chip // The descriptor is wrong for some early samples of the ST5481 chip
altsetting->endpoint[3].desc.wMaxPacketSize = 32; altsetting->endpoint[3].desc.wMaxPacketSize = __constant_cpu_to_le16(32);
altsetting->endpoint[4].desc.wMaxPacketSize = 32; altsetting->endpoint[4].desc.wMaxPacketSize = __constant_cpu_to_le16(32);
// Use alternative setting 3 on interface 0 to have 2B+D // Use alternative setting 3 on interface 0 to have 2B+D
if ((status = usb_set_interface (dev, 0, 3)) < 0) { if ((status = usb_set_interface (dev, 0, 3)) < 0) {

View File

@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG; static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i"); module_param(pc_debug, int, 0);
#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 =
"teles_cs.c 2.10 2002/07/30 22:23:34 kkeil"; "teles_cs.c 2.10 2002/07/30 22:23:34 kkeil";
@ -62,18 +62,8 @@ static char *version =
/* Parameters that can be set with 'insmod' */ /* Parameters that can be set with 'insmod' */
/* Bit map of interrupts to choose from, the old way */
/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, 3 */
static u_long irq_mask = 0xdeb8;
/* Newer, simpler way of listing specific interrupts */
static int irq_list[4] = { -1 };
MODULE_PARM(irq_mask, "i");
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_param(protocol, int, 0);
/*====================================================================*/ /*====================================================================*/
@ -168,7 +158,7 @@ static dev_link_t *teles_attach(void)
client_reg_t client_reg; client_reg_t client_reg;
dev_link_t *link; dev_link_t *link;
local_info_t *local; local_info_t *local;
int ret, i; int ret;
DEBUG(0, "teles_attach()\n"); DEBUG(0, "teles_attach()\n");
@ -181,12 +171,7 @@ static dev_link_t *teles_attach(void)
/* Interrupt setup */ /* Interrupt setup */
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID|IRQ_SHARE_ID; link->irq.IRQInfo1 = IRQ_LEVEL_ID|IRQ_SHARE_ID;
if (irq_list[0] == -1)
link->irq.IRQInfo2 = irq_mask;
else
for (i = 0; i < 4; i++)
link->irq.IRQInfo2 |= 1 << irq_list[i];
link->irq.Handler = NULL; link->irq.Handler = NULL;
/* /*
@ -208,7 +193,6 @@ static dev_link_t *teles_attach(void)
link->next = dev_list; link->next = dev_list;
dev_list = link; dev_list = link;
client_reg.dev_info = &dev_info; client_reg.dev_info = &dev_info;
client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
client_reg.EventMask = client_reg.EventMask =
CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
@ -522,10 +506,7 @@ static int __init init_teles_cs(void)
static void __exit exit_teles_cs(void) static void __exit exit_teles_cs(void)
{ {
pcmcia_unregister_driver(&teles_cs_driver); pcmcia_unregister_driver(&teles_cs_driver);
BUG_ON(dev_list != NULL);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
teles_detach(dev_list);
} }
module_init(init_teles_cs); module_init(init_teles_cs);

View File

@ -58,7 +58,7 @@ config ISDN_AUDIO
help help
If you say Y here, the modem-emulator will support a subset of the If you say Y here, the modem-emulator will support a subset of the
EIA Class 8 Voice commands. Using a getty with voice-support EIA Class 8 Voice commands. Using a getty with voice-support
(mgetty+sendfax by gert@greenie.muc.de with an extension, available (mgetty+sendfax by <gert@greenie.muc.de> with an extension, available
with the ISDN utility package for example), you will be able to use with the ISDN utility package for example), you will be able to use
your Linux box as an ISDN-answering machine. Of course, this must be your Linux box as an ISDN-answering machine. Of course, this must be
supported by the lowlevel driver also. Currently, the HiSax driver supported by the lowlevel driver also. Currently, the HiSax driver

View File

@ -78,18 +78,19 @@ static __inline__ isdn_net_local * isdn_net_get_locked_lp(isdn_net_dev *nd)
spin_lock_irqsave(&nd->queue_lock, flags); spin_lock_irqsave(&nd->queue_lock, flags);
lp = nd->queue; /* get lp on top of queue */ lp = nd->queue; /* get lp on top of queue */
spin_lock_bh(&nd->queue->xmit_lock); spin_lock(&nd->queue->xmit_lock);
while (isdn_net_lp_busy(nd->queue)) { while (isdn_net_lp_busy(nd->queue)) {
spin_unlock_bh(&nd->queue->xmit_lock); spin_unlock(&nd->queue->xmit_lock);
nd->queue = nd->queue->next; nd->queue = nd->queue->next;
if (nd->queue == lp) { /* not found -- should never happen */ if (nd->queue == lp) { /* not found -- should never happen */
lp = NULL; lp = NULL;
goto errout; goto errout;
} }
spin_lock_bh(&nd->queue->xmit_lock); spin_lock(&nd->queue->xmit_lock);
} }
lp = nd->queue; lp = nd->queue;
nd->queue = nd->queue->next; nd->queue = nd->queue->next;
local_bh_disable();
errout: errout:
spin_unlock_irqrestore(&nd->queue_lock, flags); spin_unlock_irqrestore(&nd->queue_lock, flags);
return lp; return lp;

View File

@ -21,13 +21,13 @@ static char *icn_id2 = "\0";
MODULE_DESCRIPTION("ISDN4Linux: Driver for ICN active ISDN card"); MODULE_DESCRIPTION("ISDN4Linux: Driver for ICN active ISDN card");
MODULE_AUTHOR("Fritz Elfert"); MODULE_AUTHOR("Fritz Elfert");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(portbase, "i"); module_param(portbase, int, 0);
MODULE_PARM_DESC(portbase, "Port address of first card"); MODULE_PARM_DESC(portbase, "Port address of first card");
MODULE_PARM(membase, "l"); module_param(membase, ulong, 0);
MODULE_PARM_DESC(membase, "Shared memory address of all cards"); MODULE_PARM_DESC(membase, "Shared memory address of all cards");
MODULE_PARM(icn_id, "s"); module_param(icn_id, charp, 0);
MODULE_PARM_DESC(icn_id, "ID-String of first card"); MODULE_PARM_DESC(icn_id, "ID-String of first card");
MODULE_PARM(icn_id2, "s"); module_param(icn_id2, charp, 0);
MODULE_PARM_DESC(icn_id2, "ID-String of first card, second S0 (4B only)"); MODULE_PARM_DESC(icn_id2, "ID-String of first card, second S0 (4B only)");
/* /*

View File

@ -174,7 +174,7 @@ typedef struct icn_card {
typedef struct icn_dev { typedef struct icn_dev {
spinlock_t devlock; /* spinlock to protect this struct */ spinlock_t devlock; /* spinlock to protect this struct */
unsigned long memaddr; /* Address of memory mapped buffers */ unsigned long memaddr; /* Address of memory mapped buffers */
icn_shmem *shmem; /* Pointer to memory-mapped-buffers */ icn_shmem __iomem *shmem; /* Pointer to memory-mapped-buffers */
int mvalid; /* IO-shmem has been requested */ int mvalid; /* IO-shmem has been requested */
int channel; /* Currently mapped channel */ int channel; /* Currently mapped channel */
struct icn_card *mcard; /* Currently mapped card */ struct icn_card *mcard; /* Currently mapped card */

View File

@ -96,7 +96,7 @@ int pcbit_init_dev(int board, int mem_base, int irq)
dev_pcbit[board] = NULL; dev_pcbit[board] = NULL;
return -EACCES; return -EACCES;
} }
dev->sh_mem = (unsigned char*)ioremap(dev->ph_mem, 4096); dev->sh_mem = ioremap(dev->ph_mem, 4096);
} }
else else
{ {
@ -109,7 +109,7 @@ int pcbit_init_dev(int board, int mem_base, int irq)
dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL); dev->b1 = kmalloc(sizeof(struct pcbit_chan), GFP_KERNEL);
if (!dev->b1) { if (!dev->b1) {
printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
iounmap((unsigned char*)dev->sh_mem); iounmap(dev->sh_mem);
release_mem_region(dev->ph_mem, 4096); release_mem_region(dev->ph_mem, 4096);
kfree(dev); kfree(dev);
return -ENOMEM; return -ENOMEM;
@ -119,7 +119,7 @@ int pcbit_init_dev(int board, int mem_base, int irq)
if (!dev->b2) { if (!dev->b2) {
printk("pcbit_init: couldn't malloc pcbit_chan struct\n"); printk("pcbit_init: couldn't malloc pcbit_chan struct\n");
kfree(dev->b1); kfree(dev->b1);
iounmap((unsigned char*)dev->sh_mem); iounmap(dev->sh_mem);
release_mem_region(dev->ph_mem, 4096); release_mem_region(dev->ph_mem, 4096);
kfree(dev); kfree(dev);
return -ENOMEM; return -ENOMEM;
@ -139,7 +139,7 @@ int pcbit_init_dev(int board, int mem_base, int irq)
{ {
kfree(dev->b1); kfree(dev->b1);
kfree(dev->b2); kfree(dev->b2);
iounmap((unsigned char*)dev->sh_mem); iounmap(dev->sh_mem);
release_mem_region(dev->ph_mem, 4096); release_mem_region(dev->ph_mem, 4096);
kfree(dev); kfree(dev);
dev_pcbit[board] = NULL; dev_pcbit[board] = NULL;
@ -161,7 +161,7 @@ int pcbit_init_dev(int board, int mem_base, int irq)
free_irq(irq, dev); free_irq(irq, dev);
kfree(dev->b1); kfree(dev->b1);
kfree(dev->b2); kfree(dev->b2);
iounmap((unsigned char*)dev->sh_mem); iounmap(dev->sh_mem);
release_mem_region(dev->ph_mem, 4096); release_mem_region(dev->ph_mem, 4096);
kfree(dev); kfree(dev);
dev_pcbit[board] = NULL; dev_pcbit[board] = NULL;
@ -193,7 +193,7 @@ int pcbit_init_dev(int board, int mem_base, int irq)
free_irq(irq, dev); free_irq(irq, dev);
kfree(dev->b1); kfree(dev->b1);
kfree(dev->b2); kfree(dev->b2);
iounmap((unsigned char*)dev->sh_mem); iounmap(dev->sh_mem);
release_mem_region(dev->ph_mem, 4096); release_mem_region(dev->ph_mem, 4096);
kfree(dev); kfree(dev);
dev_pcbit[board] = NULL; dev_pcbit[board] = NULL;
@ -231,7 +231,7 @@ void pcbit_terminate(int board)
del_timer(&dev->b2->fsm_timer); del_timer(&dev->b2->fsm_timer);
kfree(dev->b1); kfree(dev->b1);
kfree(dev->b2); kfree(dev->b2);
iounmap((unsigned char*)dev->sh_mem); iounmap(dev->sh_mem);
release_mem_region(dev->ph_mem, 4096); release_mem_region(dev->ph_mem, 4096);
kfree(dev); kfree(dev);
} }

View File

@ -22,12 +22,13 @@
MODULE_DESCRIPTION("ISDN4Linux: Driver for PCBIT-T card"); MODULE_DESCRIPTION("ISDN4Linux: Driver for PCBIT-T card");
MODULE_AUTHOR("Pedro Roque Marques"); MODULE_AUTHOR("Pedro Roque Marques");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i");
static int mem[MAX_PCBIT_CARDS]; static int mem[MAX_PCBIT_CARDS];
static int irq[MAX_PCBIT_CARDS]; static int irq[MAX_PCBIT_CARDS];
module_param_array(mem, int, NULL, 0);
module_param_array(irq, int, NULL, 0);
static int num_boards; static int num_boards;
struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS]; struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS];

View File

@ -45,7 +45,7 @@ struct msn_entry {
struct pcbit_dev { struct pcbit_dev {
/* board */ /* board */
volatile unsigned char* sh_mem; /* RDP address */ volatile unsigned char __iomem *sh_mem; /* RDP address */
unsigned long ph_mem; unsigned long ph_mem;
unsigned int irq; unsigned int irq;
unsigned int id; unsigned int id;
@ -79,8 +79,8 @@ struct pcbit_dev {
u_char w_busy; u_char w_busy;
u_char r_busy; u_char r_busy;
volatile unsigned char *readptr; volatile unsigned char __iomem *readptr;
volatile unsigned char *writeptr; volatile unsigned char __iomem *writeptr;
ushort loadptr; ushort loadptr;

View File

@ -15,10 +15,6 @@
MODULE_DESCRIPTION("ISDN4Linux: Driver for Spellcaster card"); MODULE_DESCRIPTION("ISDN4Linux: Driver for Spellcaster card");
MODULE_AUTHOR("Spellcaster Telecommunications Inc."); MODULE_AUTHOR("Spellcaster Telecommunications Inc.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM( io, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(ram, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(do_reset, "i");
board *sc_adapter[MAX_CARDS]; board *sc_adapter[MAX_CARDS];
int cinst; int cinst;
@ -34,6 +30,11 @@ static unsigned char irq[] = {0,0,0,0};
static unsigned long ram[] = {0,0,0,0}; static unsigned long ram[] = {0,0,0,0};
static int do_reset = 0; static int do_reset = 0;
module_param_array(io, int, NULL, 0);
module_param_array(irq, int, NULL, 0);
module_param_array(ram, int, NULL, 0);
module_param(do_reset, bool, 0);
static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 }; static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 };
#define MAX_IRQS 10 #define MAX_IRQS 10

View File

@ -11,5 +11,5 @@ config ISDN_DRV_TPAM
to be downloaded into the card using a utility which is distributed to be downloaded into the card using a utility which is distributed
separately from the Auvertech's web site: <http://www.auvertech.fr/>. separately from the Auvertech's web site: <http://www.auvertech.fr/>.
Please redirect all support questions to support@auvertech.fr. Please redirect all support questions to <support@auvertech.fr>.

View File

@ -39,7 +39,7 @@ MODULE_DESCRIPTION("ISDN4Linux: Driver for TurboPAM ISDN cards");
MODULE_AUTHOR("Stelian Pop"); MODULE_AUTHOR("Stelian Pop");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM_DESC(id,"ID-String of the driver"); MODULE_PARM_DESC(id,"ID-String of the driver");
MODULE_PARM(id,"s"); module_param(id, charp, 0);
/* /*
* Finds a board by its driver ID. * Finds a board by its driver ID.
@ -105,7 +105,7 @@ static int __devinit tpam_probe(struct pci_dev *dev, const struct pci_device_id
memset((char *)card, 0, sizeof(tpam_card)); memset((char *)card, 0, sizeof(tpam_card));
card->irq = dev->irq; card->irq = dev->irq;
card->lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&card->lock);
sprintf(card->interface.id, "%s%d", id, cards_num); sprintf(card->interface.id, "%s%d", id, cards_num);
/* request interrupt */ /* request interrupt */