-/* $Id: diddfunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
+/* $Id: diddfunc.c,v 1.14 2003/08/25 10:06:37 schindler Exp $
*
* DIDD Interface module for Eicon active cards.
*
* Functions are in dadapter.c
*
- * Copyright 2002 by Armin Schindler (mac@melware.de)
- * Copyright 2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2002-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2002-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
extern void DIVA_DIDD_Read(void *, int);
-extern char *DRIVERRELEASE;
+extern char *DRIVERRELEASE_DIDD;
static dword notify_handle;
static DESCRIPTOR _DAdapter;
if (removal) {
DbgDeregister();
} else {
- DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
+ DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
return (NULL);
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
- req.didd_notify.info.callback = didd_callback;
+ req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
_DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
- DbgRegister("DIDD", DRIVERRELEASE, DBG_DEFAULT);
+ DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
return (dadapter);
-/* $Id: diva.c,v 1.1.2.5 2001/02/14 21:10:19 armin Exp $ */
+/* $Id: diva.c,v 1.17 2003/09/09 06:52:01 schindler Exp $ */
#define CARDTYPE_H_WANT_DATA 1
#define CARDTYPE_H_WANT_IDI_DATA 0
#include "platform.h"
#include "debuglib.h"
-#include "diva_pci.h"
#include "cardtype.h"
#include "dlist.h"
#include "pc.h"
#include "di.h"
#include "io.h"
#include "pc_maint.h"
-
#include "xdi_msg.h"
#include "xdi_adapter.h"
+#include "diva_pci.h"
#include "diva.h"
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
#include "os_pri.h"
#endif
-#ifdef CONFIG_ISDN_DIVAS_4BRIPCI
-#include "os_4bri.h"
-#endif
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
#include "os_bri.h"
+#include "os_4bri.h"
#endif
PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
struct pt_regs;
+/*
+ * include queue functions
+ */
+#include "dlist.c"
+
/*
** LOCALS
*/
*/
{CARDTYPE_DIVASRV_VOICE_P_30M_V2_PCI, diva_pri_init_card},
#endif
-#ifdef CONFIG_ISDN_DIVAS_4BRIPCI
+#ifdef CONFIG_ISDN_DIVAS_BRIPCI
/*
4BRI Rev 1 Cards
*/
{CARDTYPE_DIVASRV_B_2M_V2_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_B_2F_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI, diva_4bri_init_card},
-#endif
-#ifdef CONFIG_ISDN_DIVAS_BRIPCI
/*
BRI
*/
pdiva->controller = i + 1;
pdiva->xdi_adapter.ANum = pdiva->controller;
IoAdapters[i] = &pdiva->xdi_adapter;
+ diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
create_adapter_proc(pdiva); /* add adapter to proc file system */
DBG_LOG(("add %s:%d",
[CardOrdinal].Name,
pdiva->controller))
+ diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
pa = pdiva;
for (j = 1; j < nr; j++) { /* slave adapters, if any */
pa = (diva_os_xdi_adapter_t *) diva_q_get_next(&pa->link);
pa->controller = i + 1 + j;
pa->xdi_adapter.ANum = pa->controller;
IoAdapters[i + j] = &pa->xdi_adapter;
+ diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
DBG_LOG(("add slave adapter (%d)",
- pa->controller)) create_adapter_proc(pa); /* add adapter to proc file system */
+ pa->controller))
+ create_adapter_proc(pa); /* add adapter to proc file system */
+ diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
} else {
DBG_ERR(("slave adapter problem"))
break;
}
} else {
DBG_ERR(("A: A(%d) write error (%d)", a->controller,
- length))}
+ length))
+ }
diva_os_free(0, data);
Requests[31] = DivaIdiRequest31;
}
-/* card: 1-based card number */
void diva_xdi_display_adapter_features(int card)
{
dword features;
-/* $Id: diva_didd.c,v 1.1.2.6 2001/05/01 15:48:05 armin Exp $
+/* $Id: diva_didd.c,v 1.13 2003/08/27 10:11:21 schindler Exp $
*
* DIDD Interface module for Eicon active cards.
*
* Functions are in dadapter.c
*
- * Copyright 2002 by Armin Schindler (mac@melware.de)
- * Copyright 2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2002-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2002-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#include "divasync.h"
#include "did_vers.h"
-static char *main_revision = "$Revision: 1.1.2.6 $";
+static char *main_revision = "$Revision: 1.13 $";
static char *DRIVERNAME =
"Eicon DIVA - DIDD table (http://www.melware.net)";
static char *DRIVERLNAME = "divadidd";
-char *DRIVERRELEASE = "2.0";
+char *DRIVERRELEASE_DIDD = "2.0";
-static char *dir_in_proc_net = "isdn";
static char *main_proc_dir = "eicon";
MODULE_DESCRIPTION("DIDD table driver for diva drivers");
extern void DIVA_DIDD_Read(void *, int);
-static struct proc_dir_entry *proc_net_isdn;
static struct proc_dir_entry *proc_didd;
-struct proc_dir_entry *proc_net_isdn_eicon = NULL;
+struct proc_dir_entry *proc_net_eicon = NULL;
EXPORT_SYMBOL_NOVERS(DIVA_DIDD_Read);
-EXPORT_SYMBOL_NOVERS(proc_net_isdn_eicon);
+EXPORT_SYMBOL_NOVERS(proc_net_eicon);
static char *getrev(const char *revision)
{
strcpy(tmprev, main_revision);
len += sprintf(page + len, "%s\n", DRIVERNAME);
len += sprintf(page + len, "name : %s\n", DRIVERLNAME);
- len += sprintf(page + len, "release : %s\n", DRIVERRELEASE);
+ len += sprintf(page + len, "release : %s\n", DRIVERRELEASE_DIDD);
len += sprintf(page + len, "build : %s(%s)\n",
diva_didd_common_code_build, DIVA_BUILD);
len += sprintf(page + len, "revision : %s\n", getrev(tmprev));
static int DIVA_INIT_FUNCTION create_proc(void)
{
- struct proc_dir_entry *pe;
+ proc_net_eicon = create_proc_entry(main_proc_dir, S_IFDIR, proc_net);
- for (pe = proc_net->subdir; pe; pe = pe->next) {
- if (!memcmp(dir_in_proc_net, pe->name, pe->namelen)) {
- proc_net_isdn = pe;
- break;
- }
- }
- if (!proc_net_isdn) {
- proc_net_isdn =
- create_proc_entry(dir_in_proc_net, S_IFDIR, proc_net);
- }
- proc_net_isdn_eicon =
- create_proc_entry(main_proc_dir, S_IFDIR, proc_net_isdn);
-
- if (proc_net_isdn_eicon) {
- if (
- (proc_didd =
+ if (proc_net_eicon) {
+ if ((proc_didd =
create_proc_entry(DRIVERLNAME, S_IFREG | S_IRUGO,
- proc_net_isdn_eicon))) {
+ proc_net_eicon))) {
proc_didd->read_proc = proc_read;
}
return (1);
return (0);
}
-static void remove_proc(void)
+static void DIVA_EXIT_FUNCTION remove_proc(void)
{
- remove_proc_entry(DRIVERLNAME, proc_net_isdn_eicon);
- remove_proc_entry(main_proc_dir, proc_net_isdn);
-
- if ((proc_net_isdn) && (!proc_net_isdn->subdir)) {
- remove_proc_entry(dir_in_proc_net, proc_net);
- }
+ remove_proc_entry(DRIVERLNAME, proc_net_eicon);
+ remove_proc_entry(main_proc_dir, proc_net);
}
static int DIVA_INIT_FUNCTION divadidd_init(void)
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
- printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
+ printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_DIDD);
strcpy(tmprev, main_revision);
printk("%s Build:%s(%s)\n", getrev(tmprev),
diva_didd_common_code_build, DIVA_BUILD);
if (!diddfunc_init()) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
+#ifdef MODULE
remove_proc();
+#endif
ret = -EIO;
goto out;
}
-/* $Id: diva_pci.h,v 1.1.2.2 2001/02/12 20:23:46 armin Exp $ */
+/* $Id: diva_pci.h,v 1.6 2003/01/04 15:29:45 schindler Exp $ */
#ifndef __DIVA_PCI_INTERFACE_H__
#define __DIVA_PCI_INTERFACE_H__
-void *divasa_remap_pci_bar(unsigned long bar, unsigned long area_length);
+void *divasa_remap_pci_bar(diva_os_xdi_adapter_t *a,
+ int id,
+ unsigned long bar,
+ unsigned long area_length);
void divasa_unmap_pci_bar(void *bar);
unsigned long divasa_get_pci_irq(unsigned char bus,
unsigned char func, void *pci_dev_handle);
-/* $Id: divamnt.c,v 1.1.2.4 2001/05/01 15:48:05 armin Exp $
+/* $Id: divamnt.c,v 1.27 2003/09/09 06:46:29 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* Maint module
*
- * Copyright 2000-2002 by Armin Schindler (mac@melware.de)
- * Copyright 2000-2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
-#include <linux/vmalloc.h>
#include <linux/devfs_fs_kernel.h>
#include "platform.h"
#include "di_defs.h"
#include "debug_if.h"
-static char *main_revision = "$Revision: 1.1.2.4 $";
+static char *main_revision = "$Revision: 1.27 $";
-static int major = 241;
+static int major;
MODULE_DESCRIPTION("Maint driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(major, "i");
-MODULE_PARM_DESC(major, "Major number for /dev/DivasMAINT");
int buffer_length = 128;
MODULE_PARM(buffer_length, "i");
static char *DRIVERNAME =
"Eicon DIVA - MAINT module (http://www.melware.net)";
static char *DRIVERLNAME = "diva_mnt";
-char *DRIVERRELEASE = "2.0";
+static char *DEVNAME = "DivasMAINT";
+char *DRIVERRELEASE_MNT = "2.0";
static wait_queue_head_t msgwaitq;
static DECLARE_MUTEX(opened_sem);
}
/*
- * memory alloc
+ * buffer alloc
*/
-void *diva_os_malloc(unsigned long flags, unsigned long size)
-{
- return (vmalloc(size));
-}
-void diva_os_free(unsigned long flags, void *ptr)
-{
- if (ptr) {
- vfree(ptr);
- }
-}
void *diva_os_malloc_tbuffer(unsigned long flags, unsigned long size)
{
return (kmalloc(size, GFP_KERNEL));
}
}
-/*
- * sleep msec
- */
-void diva_os_sleep(dword mSec)
-{
- unsigned long timeout = HZ * mSec / 1000 + 1;
-
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(timeout);
-}
-
/*
* kernel/user space copy functions
*/
* /proc entries
*/
-extern struct proc_dir_entry *proc_net_isdn_eicon;
+extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *maint_proc_entry = NULL;
/*
{
maint_proc_entry =
create_proc_entry("maint", S_IFREG | S_IRUGO | S_IWUSR,
- proc_net_isdn_eicon);
+ proc_net_eicon);
if (!maint_proc_entry)
return (0);
static void remove_maint_proc(void)
{
if (maint_proc_entry) {
- remove_proc_entry("maint", proc_net_isdn_eicon);
+ remove_proc_entry("maint", proc_net_eicon);
maint_proc_entry = NULL;
}
}
static void divas_maint_unregister_chrdev(void)
{
- devfs_remove("DivasMAINT");
- unregister_chrdev(major, "DivasMAINT");
+ devfs_remove(DEVNAME);
+ unregister_chrdev(major, DEVNAME);
}
static int DIVA_INIT_FUNCTION divas_maint_register_chrdev(void)
{
- if (register_chrdev(major, "DivasMAINT", &divas_maint_fops))
+ if ((major = register_chrdev(0, DEVNAME, &divas_maint_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
+ devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
- devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "DivasMAINT");
return (1);
}
init_waitqueue_head(&msgwaitq);
printk(KERN_INFO "%s\n", DRIVERNAME);
- printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
+ printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_MNT);
strcpy(tmprev, main_revision);
- printk("%s Build: %s Major: %d\n", getrev(tmprev), DIVA_BUILD,
- major);
+ printk("%s Build: %s \n", getrev(tmprev), DIVA_BUILD);
if (!divas_maint_register_chrdev()) {
ret = -EIO;
goto out;
}
- printk(KERN_INFO "%s: trace buffer = %p - %d kBytes, %s \n",
- DRIVERLNAME, buffer, buffer_length,
- (diva_dbg_mem == 0) ? "internal" : "external");
+ printk(KERN_INFO "%s: trace buffer = %p - %d kBytes, %s (Major: %d)\n",
+ DRIVERLNAME, buffer, (buffer_length / 1024),
+ (diva_dbg_mem == 0) ? "internal" : "external", major);
out:
return (ret);
-/* $Id: divasfunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
+/* $Id: divasfunc.c,v 1.22 2003/09/09 06:46:29 schindler Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
*
- * Copyright 2000-2002 by Armin Schindler (mac@melware.de)
- * Copyright 2000-2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
+static int debugmask;
+
extern void DIVA_DIDD_Read(void *, int);
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
#define MAX_DESCRIPTORS 32
extern void diva_run_trap_script(PISDN_ADAPTER IoAdapter, dword ANum);
-extern char *DRIVERRELEASE;
+extern char *DRIVERRELEASE_DIVAS;
static dword notify_handle;
static DESCRIPTOR DAdapter;
/* dummy debug function */
}
-DIVA_DI_PRINTF dprintf = no_printf;
-
#include "debuglib.c"
/*
*/
static void start_dbg(void)
{
- DbgRegister("DIVAS", DRIVERRELEASE, DBG_DEFAULT);
+ DbgRegister("DIVAS", DRIVERRELEASE_DIVAS, (debugmask) ? debugmask : DBG_DEFAULT);
DBG_LOG(("DIVA ISDNXDI BUILD (%s[%s]-%s-%s)",
DIVA_BUILD, diva_xdi_common_code_build, __DATE__,
- __TIME__))}
+ __TIME__))
+}
/*
* stop debug
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
- req.didd_notify.info.callback = didd_callback;
+ req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff) {
/*
* init
*/
-int DIVA_INIT_FUNCTION divasfunc_init(void)
+int DIVA_INIT_FUNCTION divasfunc_init(int dbgmask)
{
+ char *version;
+
+ debugmask = dbgmask;
+
if (!connect_didd()) {
DBG_ERR(("divasfunc: failed to connect to DIDD."))
return (0);
}
+ version = diva_xdi_common_code_build;
+
divasa_xdi_driver_entry();
return (1);
-/* $Id: divasi.c,v 1.1.2.7 2001/05/01 15:48:05 armin Exp $
+/* $Id: divasi.c,v 1.25 2003/09/09 06:46:29 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* User Mode IDI Interface
*
- * Copyright 2000-2002 by Armin Schindler (mac@melware.de)
- * Copyright 2000-2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
-#include <linux/vmalloc.h>
#include <linux/devfs_fs_kernel.h>
#include "platform.h"
#include "um_xdi.h"
#include "um_idi.h"
-static char *main_revision = "$Revision: 1.1.2.7 $";
+static char *main_revision = "$Revision: 1.25 $";
-static int major = 242;
+static int major;
MODULE_DESCRIPTION("User IDI Interface for Eicon ISDN cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(major, "i");
-MODULE_PARM_DESC(major, "Major number for /dev/DivasIDI");
typedef struct _diva_um_idi_os_context {
wait_queue_head_t read_wait;
wait_queue_head_t close_wait;
struct timer_list diva_timer_id;
int aborted;
+ int adapter_nr;
} diva_um_idi_os_context_t;
static char *DRIVERNAME = "Eicon DIVA - User IDI (http://www.melware.net)";
static char *DRIVERLNAME = "diva_idi";
-char *DRIVERRELEASE = "2.0";
+static char *DEVNAME = "DivasIDI";
+char *DRIVERRELEASE_IDI = "2.0";
extern int idifunc_init(void);
extern void idifunc_finit(void);
static int remove_entity(void *entity);
static void diva_um_timer_function(unsigned long data);
-/*
- * malloc
- */
-void *diva_os_malloc(unsigned long flags, unsigned long size)
-{
- void *ret = NULL;
-
- if (size) {
- ret = (void *) vmalloc((unsigned int) size);
- }
- return (ret);
-}
-
-/*
- * free
- */
-void diva_os_free(unsigned long unused, void *ptr)
-{
- if (ptr) {
- vfree(ptr);
- }
-}
-
/*
* proc entry
*/
-extern struct proc_dir_entry *proc_net_isdn_eicon;
+extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *um_idi_proc_entry = NULL;
static int
len += sprintf(page + len, "%s\n", DRIVERNAME);
len += sprintf(page + len, "name : %s\n", DRIVERLNAME);
- len += sprintf(page + len, "release : %s\n", DRIVERRELEASE);
+ len += sprintf(page + len, "release : %s\n", DRIVERRELEASE_IDI);
strcpy(tmprev, main_revision);
len += sprintf(page + len, "revision : %s\n", getrev(tmprev));
len += sprintf(page + len, "build : %s\n", DIVA_BUILD);
+ len += sprintf(page + len, "major : %d\n", major);
if (off + count >= len)
*eof = 1;
{
um_idi_proc_entry = create_proc_entry(DRIVERLNAME,
S_IFREG | S_IRUGO | S_IWUSR,
- proc_net_isdn_eicon);
+ proc_net_eicon);
if (!um_idi_proc_entry)
return (0);
static void remove_um_idi_proc(void)
{
if (um_idi_proc_entry) {
- remove_proc_entry(DRIVERLNAME, proc_net_isdn_eicon);
+ remove_proc_entry(DRIVERLNAME, proc_net_eicon);
um_idi_proc_entry = NULL;
}
}
static void divas_idi_unregister_chrdev(void)
{
- devfs_remove("DivasIDI");
- unregister_chrdev(major, "DivasIDI");
+ devfs_remove(DEVNAME);
+ unregister_chrdev(major, DEVNAME);
}
static int DIVA_INIT_FUNCTION divas_idi_register_chrdev(void)
{
- if (register_chrdev(major, "DivasIDI", &divas_idi_fops))
+ if ((major = register_chrdev(0, DEVNAME, &divas_idi_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
+ devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
- devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "DivasIDI");
return (1);
}
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
- printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
+ printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_IDI);
strcpy(tmprev, main_revision);
- printk("%s Build: %s Major: %d\n", getrev(tmprev), DIVA_BUILD,
- major);
+ printk("%s Build: %s\n", getrev(tmprev), DIVA_BUILD);
if (!divas_idi_register_chrdev()) {
ret = -EIO;
ret = -EIO;
goto out;
}
+ printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
return (ret);
p_os->diva_timer_id.function = (void *) diva_um_timer_function;
p_os->diva_timer_id.data = (unsigned long) p_os;
p_os->aborted = 0;
+ p_os->adapter_nr = adapter_nr;
return (1);
}
static int um_idi_release(struct inode *inode, struct file *file)
{
- unsigned int adapter_nr = iminor(inode);
+ diva_um_idi_os_context_t *p_os;
+ unsigned int adapter_nr;
int ret = 0;
if (!(file->private_data)) {
goto out;
}
+ if (!(p_os =
+ (diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->private_data))) {
+ ret = -ENODEV;
+ goto out;
+ }
+
+ adapter_nr = p_os->adapter_nr;
+
if ((ret = remove_entity(file->private_data))) {
goto out;
}
-/* $Id: divasmain.c,v 1.1.2.8 2001/05/01 15:48:05 armin Exp $
+/* $Id: divasmain.c,v 1.39 2003/09/09 07:42:05 schindler Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
*
- * Copyright 2000-2002 by Armin Schindler (mac@melware.de)
- * Copyright 2000-2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/unistd.h>
-#include <linux/vmalloc.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/ioport.h>
#include <linux/workqueue.h>
#include <linux/pci.h>
-#include <linux/delay.h>
#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/poll.h>
#include "di_defs.h"
#include "divasync.h"
#include "diva.h"
-#include "diva_pci.h"
#include "di.h"
#include "io.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "xdi_vers.h"
#include "diva_dma.h"
+#include "diva_pci.h"
-static char *main_revision = "$Revision: 1.1.2.8 $";
+static char *main_revision = "$Revision: 1.39 $";
int errno = 0;
-static int major = 240;
+static int major;
+
+static int dbgmask;
MODULE_DESCRIPTION("Kernel driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_LICENSE("GPL");
-MODULE_PARM(major, "i");
-MODULE_PARM_DESC(major, "Major number for /dev/Divas");
+
+MODULE_PARM(dbgmask, "i");
+MODULE_PARM_DESC(dbgmask, "initial debug mask");
static char *DRIVERNAME =
"Eicon DIVA Server driver (http://www.melware.net)";
static char *DRIVERLNAME = "divas";
-char *DRIVERRELEASE = "2.0";
+static char *DEVNAME = "Divas";
+char *DRIVERRELEASE_DIVAS = "2.0";
extern irqreturn_t diva_os_irq_wrapper(int irq, void *context,
struct pt_regs *regs);
extern int create_divas_proc(void);
extern void remove_divas_proc(void);
extern void diva_get_vserial_number(PISDN_ADAPTER IoAdapter, char *buf);
-extern int divasfunc_init(void);
+extern int divasfunc_init(int dbgmask);
extern void divasfunc_exit(void);
+static devfs_handle_t devfs_handle;
+
typedef struct _diva_os_thread_dpc {
struct tasklet_struct divas_task;
struct work_struct trap_script_task;
/*
This table should be sorted by PCI device ID
*/
-static struct pci_device_id divas_pci_tbl[] = {
+static struct pci_device_id divas_pci_tbl[] __devinitdata = {
/* Diva Server BRI-2M PCI 0xE010 */
{PCI_VENDOR_ID_EICON, PCI_DEVICE_ID_EICON_MAESTRA,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, CARDTYPE_MAESTRA_PCI},
return rev;
}
-void diva_os_sleep(dword mSec)
-{
- unsigned long timeout = HZ * mSec / 1000 + 1;
-
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(timeout);
-}
-
-void diva_os_wait(dword mSec)
-{
- mdelay(mSec);
-}
-
void diva_log_info(unsigned char *format, ...)
{
va_list args;
char tmprev[32];
strcpy(tmprev, main_revision);
- sprintf(p, "%s: %s(%s) %s(%s)\n", DRIVERLNAME, DRIVERRELEASE,
- getrev(tmprev), diva_xdi_common_code_build, DIVA_BUILD);
-}
-
-/*********************************************************
- ** malloc / free
- *********************************************************/
-
-void *diva_os_malloc(unsigned long flags, unsigned long size)
-{
- void *ret = NULL;
-
- if (size) {
- ret = (void *) vmalloc((unsigned int) size);
- }
- return (ret);
-}
-
-void diva_os_free(unsigned long unused, void *ptr)
-{
- if (ptr) {
- vfree(ptr);
- }
+ sprintf(p, "%s: %s(%s) %s(%s) major=%d\n", DRIVERLNAME, DRIVERRELEASE_DIVAS,
+ getrev(tmprev), diva_xdi_common_code_build, DIVA_BUILD, major);
}
/* --------------------------------------------------------------------------
(diva_os_thread_dpc_t *) psoft_isr->object;
if (context && !context->card_failed) {
+ printk(KERN_ERR "%s: adapter %d trapped !\n", DRIVERLNAME, ANum + 1);
context->card_failed = ANum + 1;
schedule_work(&context->trap_script_task);
}
*********************************************************/
int
-diva_os_register_io_port(int on, unsigned long port, unsigned long length,
- const char *name)
+diva_os_register_io_port(void *adapter, int on, unsigned long port,
+ unsigned long length, const char *name, int id)
{
if (on) {
if (!request_region(port, length, name)) {
return (0);
}
-void *divasa_remap_pci_bar(unsigned long bar, unsigned long area_length)
+void *divasa_remap_pci_bar(diva_os_xdi_adapter_t *a, int id, unsigned long bar, unsigned long area_length)
{
void *ret;
static void divas_unregister_chrdev(void)
{
- devfs_remove("Divas");
- unregister_chrdev(major, "Divas");
+ devfs_remove(DEVNAME);
+ unregister_chrdev(major, DEVNAME);
}
static int DIVA_INIT_FUNCTION divas_register_chrdev(void)
{
- if (register_chrdev(major, "Divas", &divas_fops))
+ if ((major = register_chrdev(0, DEVNAME, &divas_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
+ devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
- devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, "Divas");
return (1);
}
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
- printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE);
+ printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_DIVAS);
strcpy(tmprev, main_revision);
- printk("%s Build: %s(%s) Major: %d\n", getrev(tmprev),
- diva_xdi_common_code_build, DIVA_BUILD, major);
+ printk("%s Build: %s(%s)\n", getrev(tmprev),
+ diva_xdi_common_code_build, DIVA_BUILD);
printk(KERN_INFO "%s: support for: ", DRIVERLNAME);
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
printk("BRI/PCI ");
#endif
-#ifdef CONFIG_ISDN_DIVAS_4BRIPCI
- printk("4BRI/PCI ");
-#endif
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
printk("PRI/PCI ");
#endif
- printk("\n");
+ printk("adapters\n");
- if (!divasfunc_init()) {
+ if (!divasfunc_init(dbgmask)) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
ret = -EIO;
}
if (!divas_register_chrdev()) {
+#ifdef MODULE
divasfunc_exit();
+#endif
ret = -EIO;
goto out;
}
if (!create_divas_proc()) {
+#ifdef MODULE
remove_divas_proc();
divas_unregister_chrdev();
divasfunc_exit();
+#endif
printk(KERN_ERR "%s: failed to create proc entry.\n",
DRIVERLNAME);
ret = -EIO;
}
if ((ret = pci_module_init(&diva_pci_driver))) {
+#ifdef MODULE
remove_divas_proc();
divas_unregister_chrdev();
divasfunc_exit();
+#endif
printk(KERN_ERR "%s: failed to init pci driver.\n",
DRIVERLNAME);
goto out;
}
+ printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
return (ret);
-/* $Id: divasproc.c,v 1.1.2.4 2001/02/16 08:40:36 armin Exp $
+/* $Id: divasproc.c,v 1.18 2003/09/09 06:46:29 schindler Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
* /proc functions
*
- * Copyright 2000-2002 by Armin Schindler (mac@melware.de)
- * Copyright 2000-2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
-#include <linux/interrupt.h>
#include "platform.h"
#include "debuglib.h"
#undef ID_MASK
#undef N_DATA
#include "pc.h"
-#include "diva_pci.h"
#include "di_defs.h"
#include "divasync.h"
#include "di.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "diva.h"
+#include "diva_pci.h"
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
** "divas" entry
*/
-extern struct proc_dir_entry *proc_net_isdn_eicon;
+extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *divas_proc_entry = NULL;
static ssize_t
{
divas_proc_entry = create_proc_entry(divas_proc_name,
S_IFREG | S_IRUGO,
- proc_net_isdn_eicon);
+ proc_net_eicon);
if (!divas_proc_entry)
return (0);
void remove_divas_proc(void)
{
if (divas_proc_entry) {
- remove_proc_entry(divas_proc_name, proc_net_isdn_eicon);
+ remove_proc_entry(divas_proc_name, proc_net_eicon);
divas_proc_entry = NULL;
}
}
}
}
if ((!a->xdi_adapter.port) &&
- ((!a->xdi_adapter.ram) || (!a->xdi_adapter.reset)
+ ((!a->xdi_adapter.ram) ||
+ (!a->xdi_adapter.reset)
|| (!a->xdi_adapter.cfg))) {
if (!IoAdapter->irq_info.irq_nr) {
p = "slave";
struct proc_dir_entry *de, *pe;
char tmp[16];
- if (in_interrupt()) {
- printk(KERN_ERR
- "divasproc: create_proc in_interrupt, not creating\n");
- return (1);
- }
-
sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
- if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_isdn_eicon)))
+ if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_eicon)))
return (0);
a->proc_adapter_dir = (void *) de;
if (!(pe =
- create_proc_entry(info_proc_name, S_IFREG | S_IRUGO | S_IWUSR,
- de))) return (0);
+ create_proc_entry(info_proc_name, S_IFREG | S_IRUGO | S_IWUSR, de)))
+ return (0);
a->proc_info = (void *) pe;
pe->write_proc = info_write;
pe->read_proc = info_read;
(struct proc_dir_entry *) a->proc_adapter_dir);
}
sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
- remove_proc_entry(tmp, proc_net_isdn_eicon);
+ remove_proc_entry(tmp, proc_net_eicon);
DBG_TRC(("proc entry %s%d removed", adapter_dir_name,
a->controller));
}
-/* $Id: idifunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
+/* $Id: idifunc.c,v 1.13 2003/08/25 14:49:53 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* User Mode IDI Interface
*
- * Copyright 2000-2002 by Armin Schindler (mac@melware.de)
- * Copyright 2000-2002 Cytronics & Melware (info@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
-extern char *DRIVERRELEASE;
+extern char *DRIVERRELEASE_IDI;
extern void DIVA_DIDD_Read(void *, int);
extern int diva_user_mode_idi_create_adapter(const DESCRIPTOR *, int);
/* dummy debug function */
}
-DIVA_DI_PRINTF dprintf = no_printf;
-
#include "debuglib.c"
/*
} else {
memcpy(&MAdapter, adapter, sizeof(MAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
- DbgRegister("User IDI", DRIVERRELEASE, DBG_DEFAULT);
+ DbgRegister("User IDI", DRIVERRELEASE_IDI, DBG_DEFAULT);
}
} else if ((adapter->type > 0) && (adapter->type < 16)) { /* IDI Adapter */
if (removal) {
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
- req.didd_notify.info.callback = didd_callback;
+ req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff) {
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
memcpy(&MAdapter, &DIDD_Table[x], sizeof(DAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
- DbgRegister("User IDI", DRIVERRELEASE, DBG_DEFAULT);
+ DbgRegister("User IDI", DRIVERRELEASE_IDI, DBG_DEFAULT);
} else if ((DIDD_Table[x].type > 0)
&& (DIDD_Table[x].type < 16)) { /* IDI Adapter found */
um_new_card(&DIDD_Table[x]);
-/* $Id: mntfunc.c,v 1.1.2.2 2002/10/02 14:38:37 armin Exp $
+/* $Id: mntfunc.c,v 1.15 2003/08/25 14:49:53 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* Maint module
*
- * Copyright 2000,2001 by Armin Schindler (mac@melware.de)
- * Copyright 2000,2001 Cytronics & Melware (info@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
#include "di_defs.h"
#include "debug_if.h"
-extern char *DRIVERRELEASE;
+extern char *DRIVERRELEASE_MNT;
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
/* dummy debug function */
}
-DIVA_DI_PRINTF dprintf = no_printf;
-
#include "debuglib.c"
/*
} else {
memcpy(&MAdapter, adapter, sizeof(MAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
- DbgRegister("MAINT", DRIVERRELEASE, DBG_DEFAULT);
+ DbgRegister("MAINT", DRIVERRELEASE_MNT, DBG_DEFAULT);
}
} else if ((adapter->type > 0) && (adapter->type < 16)) {
if (removal) {
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
- req.didd_notify.info.callback = didd_callback;
+ req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = 0;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff)
-/* $Id: platform.h,v 1.1.2.6 2001/05/01 15:48:05 armin Exp $
+/* $Id: platform.h,v 1.31 2003/09/08 15:15:22 schindler Exp $
*
* platform.h
*
*
- * Copyright 2000-2002 by Armin Schindler (mac@melware.de)
+ * Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000 Eicon Networks
*
* This software may be used and distributed according to the terms
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/sched.h>
#include <linux/skbuff.h>
+#include <linux/vmalloc.h>
#include <linux/proc_fs.h>
#include <linux/interrupt.h>
#include <linux/smp_lock.h>
+#include <linux/delay.h>
#include <asm/types.h>
#include <asm/io.h>
#include "cardtype.h"
+/* activate debuglib for modules only */
+#ifndef MODULE
+#define DIVA_NO_DEBUGLIB
+#endif
+
#define DIVA_INIT_FUNCTION __init
#define DIVA_EXIT_FUNCTION __exit
#define DIVA_USER_MODE_CARD_CONFIG 1
-#define XDI_USE_XLOG 1
#define USE_EXTENDED_DEBUGS 1
#define MAX_ADAPTER 32
#define MEMORY_SPACE_TYPE 0
#define PORT_SPACE_TYPE 1
-#include "debuglib.h"
-
-#define dtrc(p) DBG_PRV0(p)
-#define dbug(a,p) DBG_PRV1(p)
-
#include <linux/string.h>
typedef struct _ISDN_ADAPTER* PISDN_ADAPTER;
typedef void (* DIVA_DI_PRINTF) (unsigned char *, ...);
-extern DIVA_DI_PRINTF dprintf;
+#include "debuglib.h"
+
+#define dtrc(p) DBG_PRV0(p)
+#define dbug(a,p) DBG_PRV1(p)
+
typedef struct e_info_s E_INFO ;
/*
** memory allocation
*/
-void* diva_os_malloc (unsigned long flags, unsigned long size);
-void diva_os_free (unsigned long flags, void* ptr);
+static __inline__ void* diva_os_malloc (unsigned long flags, unsigned long size)
+{
+ void *ret = NULL;
+
+ if (size) {
+ ret = (void *) vmalloc((unsigned int) size);
+ }
+ return (ret);
+}
+static __inline__ void diva_os_free (unsigned long flags, void* ptr)
+{
+ if (ptr) {
+ vfree(ptr);
+ }
+}
/*
** use skbuffs for message buffer
/*
** mSeconds waiting
*/
-void diva_os_sleep(dword mSec);
-void diva_os_wait(dword mSec);
+static __inline__ void diva_os_sleep(dword mSec)
+{
+ unsigned long timeout = HZ * mSec / 1000 + 1;
+
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(timeout);
+}
+static __inline__ void diva_os_wait(dword mSec)
+{
+ mdelay(mSec);
+}
/*
** PCI Configuration space access
/*
** I/O Port utilities
*/
-int diva_os_register_io_port (int register, unsigned long port, unsigned long length, const char* name);
-
+int diva_os_register_io_port (void *adapter, int register, unsigned long port,
+ unsigned long length, const char* name, int id);
/*
** I/O port access abstraction
*/
#define diva_os_in_irq() in_irq()
-/*
-** module locking
-*/
-/*
-#define DIVA_LOCK_MODULE MOD_INC_USE_COUNT
-#define DIVA_UNLOCK_MODULE MOD_DEC_USE_COUNT
-*/
-
/*
** Spin Lock framework
*/
-/* $Id: xdi_adapter.h,v 1.1.2.3 2001/02/16 08:40:36 armin Exp $ */
+/* $Id: xdi_adapter.h,v 1.5 2003/06/21 17:06:08 schindler Exp $ */
#ifndef __DIVA_OS_XDI_ADAPTER_H__
#define __DIVA_OS_XDI_ADAPTER_H__
dword bar[8]; /* contains context of appropriate BAR Register */
void *addr[8]; /* same bar, but mapped into memory */
dword length[8]; /* bar length */
-
+ int mem_type_id[10];
+ unsigned int qoffset;
byte irq;
} divas_pci_card_resources_t;