Lines 48-53
Link Here
|
48 |
#include "defs.h" |
48 |
#include "defs.h" |
49 |
#include "lib.h" |
49 |
#include "lib.h" |
50 |
#include "driver.h" |
50 |
#include "driver.h" |
|
|
51 |
#include <linux/proc_fs.h> |
52 |
#include <linux/seq_file.h> |
51 |
|
53 |
|
52 |
/*---------------------------------------------------------------------------*\ |
54 |
/*---------------------------------------------------------------------------*\ |
53 |
\*---------------------------------------------------------------------------*/ |
55 |
\*---------------------------------------------------------------------------*/ |
Lines 221-236
static void kill_version (card_t * card)
Link Here
|
221 |
|
223 |
|
222 |
/*---------------------------------------------------------------------------*\ |
224 |
/*---------------------------------------------------------------------------*\ |
223 |
\*---------------------------------------------------------------------------*/ |
225 |
\*---------------------------------------------------------------------------*/ |
224 |
static void pprintf (char * page, int * len, const char * fmt, ...) { |
|
|
225 |
va_list args; |
226 |
|
227 |
va_start (args, fmt); |
228 |
*len += vsprintf (page + *len, fmt, args); |
229 |
va_end (args); |
230 |
} /* pprintf */ |
231 |
|
232 |
/*---------------------------------------------------------------------------*\ |
233 |
\*-C-------------------------------------------------------------------------*/ |
234 |
static inline int in_critical (void) { |
226 |
static inline int in_critical (void) { |
235 |
|
227 |
|
236 |
return (atomic_read (&crit_level) > 0); |
228 |
return (atomic_read (&crit_level) > 0); |
Lines 367-373
static int install_card (card_t * card)
Link Here
|
367 |
return FALSE; |
359 |
return FALSE; |
368 |
} |
360 |
} |
369 |
#endif |
361 |
#endif |
|
|
362 |
#ifdef __LP64__ |
363 |
card->data = (unsigned long) &irq_handler; |
364 |
#else |
370 |
card->data = (unsigned) &irq_handler; |
365 |
card->data = (unsigned) &irq_handler; |
|
|
366 |
#endif |
371 |
tasklet_init (&scheduler_tasklet, scheduler, 0); |
367 |
tasklet_init (&scheduler_tasklet, scheduler, 0); |
372 |
disable_scheduler (); |
368 |
disable_scheduler (); |
373 |
result = request_irq ( |
369 |
result = request_irq ( |
Lines 490-528
static char * __kcapi proc_info (struct
Link Here
|
490 |
|
486 |
|
491 |
/*---------------------------------------------------------------------------*\ |
487 |
/*---------------------------------------------------------------------------*\ |
492 |
\*---------------------------------------------------------------------------*/ |
488 |
\*---------------------------------------------------------------------------*/ |
493 |
static int __kcapi ctr_info ( |
489 |
static int __kcapi ctr_info (struct seq_file *m, void *v |
494 |
char * page, |
|
|
495 |
char ** start, |
496 |
off_t ofs, |
497 |
int count, |
498 |
int * eof, |
499 |
struct capi_ctr * ctrl |
500 |
) { |
490 |
) { |
|
|
491 |
struct capi_ctr *ctrl = m->private; |
501 |
card_t * card; |
492 |
card_t * card; |
502 |
char * temp; |
493 |
char * temp; |
503 |
unsigned char flag; |
494 |
unsigned char flag; |
504 |
int len = 0; |
|
|
505 |
|
495 |
|
506 |
assert (ctrl != NULL); |
496 |
assert (ctrl != NULL); |
507 |
card = (card_t *) ctrl->driverdata; |
497 |
card = (card_t *) ctrl->driverdata; |
508 |
assert (card != NULL); |
498 |
assert (card != NULL); |
509 |
pprintf (page, &len, "%-16s %s\n", "name", SHORT_LOGO); |
499 |
seq_printf (m, "%-16s %s\n", "name", SHORT_LOGO); |
510 |
pprintf (page, &len, "%-16s 0x%04x\n", "io", card->base); |
500 |
seq_printf (m, "%-16s 0x%04x\n", "io", card->base); |
511 |
pprintf (page, &len, "%-16s %d\n", "irq", card->irq); |
501 |
seq_printf (m, "%-16s %d\n", "irq", card->irq); |
512 |
temp = card->version ? card->string[1] : "A1"; |
502 |
temp = card->version ? card->string[1] : "A1"; |
513 |
pprintf (page, &len, "%-16s %s\n", "type", temp); |
503 |
seq_printf (m, "%-16s %s\n", "type", temp); |
514 |
temp = card->version ? card->string[0] : "-"; |
504 |
temp = card->version ? card->string[0] : "-"; |
515 |
#if defined (__fcclassic__) || defined (__fcpcmcia__) |
505 |
#if defined (__fcclassic__) || defined (__fcpcmcia__) |
516 |
pprintf (page, &len, "%-16s 0x%04x\n", "revision", card->info); |
506 |
seq_printf (m, "%-16s 0x%04x\n", "revision", card->info); |
517 |
#elif defined (__fcpci__) |
507 |
#elif defined (__fcpci__) |
518 |
pprintf (page, &len, "%-16s %d\n", "class", card_id); |
508 |
seq_printf (m, "%-16s %d\n", "class", card_id); |
519 |
#endif |
509 |
#endif |
520 |
pprintf (page, &len, "%-16s %s\n", "ver_driver", temp); |
510 |
seq_printf (m, "%-16s %s\n", "ver_driver", temp); |
521 |
pprintf (page, &len, "%-16s %s\n", "ver_cardtype", SHORT_LOGO); |
511 |
seq_printf (m, "%-16s %s\n", "ver_cardtype", SHORT_LOGO); |
522 |
|
512 |
|
523 |
flag = ((unsigned char *) (ctrl->profile.manu))[3]; |
513 |
flag = ((unsigned char *) (ctrl->profile.manu))[3]; |
524 |
if (flag) { |
514 |
if (flag) { |
525 |
pprintf(page, &len, "%-16s%s%s%s%s%s%s%s\n", "protocol", |
515 |
seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", "protocol", |
526 |
(flag & 0x01) ? " DSS1" : "", |
516 |
(flag & 0x01) ? " DSS1" : "", |
527 |
(flag & 0x02) ? " CT1" : "", |
517 |
(flag & 0x02) ? " CT1" : "", |
528 |
(flag & 0x04) ? " VN3" : "", |
518 |
(flag & 0x04) ? " VN3" : "", |
Lines 534-553
static int __kcapi ctr_info (
Link Here
|
534 |
} |
524 |
} |
535 |
flag = ((unsigned char *) (ctrl->profile.manu))[5]; |
525 |
flag = ((unsigned char *) (ctrl->profile.manu))[5]; |
536 |
if (flag) { |
526 |
if (flag) { |
537 |
pprintf(page, &len, "%-16s%s%s%s%s\n", "linetype", |
527 |
seq_printf(m, "%-16s%s%s%s%s\n", "linetype", |
538 |
(flag & 0x01) ? " point to point" : "", |
528 |
(flag & 0x01) ? " point to point" : "", |
539 |
(flag & 0x02) ? " point to multipoint" : "", |
529 |
(flag & 0x02) ? " point to multipoint" : "", |
540 |
(flag & 0x08) ? " leased line without D-channel" : "", |
530 |
(flag & 0x08) ? " leased line without D-channel" : "", |
541 |
(flag & 0x04) ? " leased line with D-channel" : "" |
531 |
(flag & 0x04) ? " leased line with D-channel" : "" |
542 |
); |
532 |
); |
543 |
} |
533 |
} |
544 |
if (len < ofs) { |
534 |
return 0; |
545 |
return 0; |
|
|
546 |
} |
547 |
*eof = 1; |
548 |
*start = page - ofs; |
549 |
return ((count < len - ofs) ? count : len - ofs); |
550 |
} /* ctr_info */ |
535 |
} /* ctr_info */ |
|
|
536 |
static int ctr_proc_open(struct inode *inode, struct file *file) |
537 |
{ |
538 |
return single_open(file, ctr_info, PDE(inode)->data); |
539 |
} |
540 |
|
541 |
const struct file_operations ctr_proc_fops = { |
542 |
.owner = THIS_MODULE, |
543 |
.open = ctr_proc_open, |
544 |
.read = seq_read, |
545 |
.llseek = seq_lseek, |
546 |
.release = single_release, |
547 |
}; |
548 |
|
551 |
|
549 |
|
552 |
/*---------------------------------------------------------------------------*\ |
550 |
/*---------------------------------------------------------------------------*\ |
553 |
\*---------------------------------------------------------------------------*/ |
551 |
\*---------------------------------------------------------------------------*/ |
Lines 569-575
static void __kcapi reset_ctrl (struct c
Link Here
|
569 |
} |
567 |
} |
570 |
} |
568 |
} |
571 |
stop (card); |
569 |
stop (card); |
572 |
capi_ctr_reseted (ctrl); |
570 |
capi_ctr_down (ctrl); |
573 |
#if defined (__fcpnp__) |
571 |
#if defined (__fcpnp__) |
574 |
pnp_disable_dev (card->dev); |
572 |
pnp_disable_dev (card->dev); |
575 |
#endif |
573 |
#endif |
Lines 626-632
int __kcapi add_card (struct capi_driver
Link Here
|
626 |
ctrl->release_appl = release_appl; |
624 |
ctrl->release_appl = release_appl; |
627 |
ctrl->send_message = send_msg; |
625 |
ctrl->send_message = send_msg; |
628 |
ctrl->procinfo = proc_info; |
626 |
ctrl->procinfo = proc_info; |
629 |
ctrl->ctr_read_proc = ctr_info; |
627 |
ctrl->proc_fops = &ctr_proc_fops; |
630 |
if (0 != (res = attach_capi_ctr (ctrl))) { |
628 |
if (0 != (res = attach_capi_ctr (ctrl))) { |
631 |
dec_use_count (); |
629 |
dec_use_count (); |
632 |
stop (card); |
630 |
stop (card); |