Commit c36878ed authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.37pre7

parent dabc5efe
......@@ -145,6 +145,7 @@ CONFIG_SCSI_CONSTANTS=y
# CONFIG_SCSI_QLOGIC_FAS is not set
CONFIG_SCSI_QLOGIC_ISP=y
# CONFIG_SCSI_SEAGATE is not set
# CONFIG_SCSI_DC390T is not set
# CONFIG_SCSI_T128 is not set
# CONFIG_SCSI_U14_34F is not set
# CONFIG_SCSI_ULTRASTOR is not set
......
......@@ -390,16 +390,8 @@ static inline void check_smp_invalidate(int cpu)
static unsigned long previous_irqholder;
#undef INIT_STUCK
#define INIT_STUCK 100000000
#undef STUCK
#define STUCK \
if (!--stuck) {printk("wait_on_irq CPU#%d stuck at %08lx, waiting for %08lx (local=%d, global=%d)\n", cpu, where, previous_irqholder, local_count, atomic_read(&global_irq_count)); stuck = INIT_STUCK; }
static inline void wait_on_irq(int cpu, unsigned long where)
{
int stuck = INIT_STUCK;
int local_count = local_irq_count[cpu];
/* Are we the only one in an interrupt context? */
......@@ -418,13 +410,12 @@ static inline void wait_on_irq(int cpu, unsigned long where)
* their things before trying to get the lock again.
*/
for (;;) {
STUCK;
check_smp_invalidate(cpu);
if (atomic_read(&global_irq_count))
continue;
if (global_irq_lock)
continue;
if (!set_bit(0,&global_irq_lock))
if (!test_and_set_bit(0,&global_irq_lock))
break;
}
atomic_add(local_count, &global_irq_count);
......@@ -453,28 +444,18 @@ void synchronize_irq(void)
}
}
#undef INIT_STUCK
#define INIT_STUCK 10000000
#undef STUCK
#define STUCK \
if (!--stuck) {printk("get_irqlock stuck at %08lx, waiting for %08lx\n", where, previous_irqholder); stuck = INIT_STUCK;}
static inline void get_irqlock(int cpu, unsigned long where)
{
int stuck = INIT_STUCK;
if (set_bit(0,&global_irq_lock)) {
if (test_and_set_bit(0,&global_irq_lock)) {
/* do we already hold the lock? */
if ((unsigned char) cpu == global_irq_holder)
return;
/* Uhhuh.. Somebody else got it. Wait.. */
do {
do {
STUCK;
check_smp_invalidate(cpu);
} while (test_bit(0,&global_irq_lock));
} while (set_bit(0,&global_irq_lock));
} while (test_and_set_bit(0,&global_irq_lock));
}
/*
* Ok, we got the lock bit.
......
......@@ -150,7 +150,7 @@ int cpu_idle(void *unused)
current->priority = -100;
while(1)
{
if(cpu_data[hard_smp_processor_id()].hlt_works_ok &&
if(cpu_data[smp_processor_id()].hlt_works_ok &&
!hlt_counter && !need_resched)
__asm("hlt");
/*
......
......@@ -655,7 +655,7 @@ __initfunc(int start_secondary(void *unused))
smp_callin();
while (!smp_commenced)
barrier();
cpu_idle(NULL);
return cpu_idle(NULL);
}
/*
......@@ -1082,7 +1082,7 @@ void smp_message_pass(int target, int msg, unsigned long data, int wait)
unsigned long flags;
unsigned long cfg;
unsigned long target_map;
int p=hard_smp_processor_id();
int p=smp_processor_id();
int irq;
int ct=0;
......@@ -1250,8 +1250,8 @@ void smp_message_pass(int target, int msg, unsigned long data, int wait)
void smp_flush_tlb(void)
{
unsigned long flags;
if(smp_activated && hard_smp_processor_id()!=active_kernel_processor) {
printk("CPU #%d:Attempted flush tlb IPI when not AKP(=%d)\n",hard_smp_processor_id(),active_kernel_processor);
if(smp_activated && smp_processor_id()!=active_kernel_processor) {
printk("CPU #%d:Attempted flush tlb IPI when not AKP(=%d)\n",smp_processor_id(),active_kernel_processor);
*(char *)0=0;
}
/* printk("SMI-");*/
......@@ -1304,7 +1304,7 @@ unsigned int prof_counter[NR_CPUS];
void smp_local_timer_interrupt(struct pt_regs * regs)
{
int cpu = hard_smp_processor_id();
int cpu = smp_processor_id();
/*
* The profiling function is SMP safe. (nothing can mess
......@@ -1400,7 +1400,7 @@ void smp_apic_timer_interrupt(struct pt_regs * regs)
*/
asmlinkage void smp_reschedule_interrupt(void)
{
int cpu = hard_smp_processor_id();
int cpu = smp_processor_id();
ack_APIC_irq();
/*
......@@ -1417,7 +1417,7 @@ asmlinkage void smp_reschedule_interrupt(void)
*/
asmlinkage void smp_invalidate_interrupt(void)
{
if (clear_bit(hard_smp_processor_id(), &smp_invalidate_needed))
if (test_and_clear_bit(smp_processor_id(), &smp_invalidate_needed))
local_flush_tlb();
ack_APIC_irq ();
......@@ -1428,7 +1428,7 @@ asmlinkage void smp_invalidate_interrupt(void)
*/
asmlinkage void smp_stop_cpu_interrupt(void)
{
if (cpu_data[hard_smp_processor_id()].hlt_works_ok)
if (cpu_data[smp_processor_id()].hlt_works_ok)
for(;;) __asm__("hlt");
for (;;) ;
}
......@@ -1613,7 +1613,7 @@ static unsigned int calibration_result;
__initfunc(void setup_APIC_clock (void))
{
int cpu = hard_smp_processor_id();
int cpu = smp_processor_id();
unsigned long flags;
static volatile int calibration_lock;
......@@ -1628,7 +1628,7 @@ __initfunc(void setup_APIC_clock (void))
* to do this part of the setup only once ... and it fits
* here best ]
*/
if (!set_bit(0,&calibration_lock)) {
if (!test_and_set_bit(0,&calibration_lock)) {
calibration_result=calibrate_APIC_clock();
/*
......@@ -1668,7 +1668,7 @@ __initfunc(void setup_APIC_clock (void))
*/
int setup_profiling_timer (unsigned int multiplier)
{
int cpu = hard_smp_processor_id();
int cpu = smp_processor_id();
unsigned long flags;
/*
......
......@@ -23,6 +23,7 @@
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/system.h>
#include <asm/uaccess.h>
......@@ -240,34 +241,45 @@ asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
unlock_kernel();
}
void enable_NMI(void)
static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
{
printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n");
printk("You probably have a hardware problem with your RAM chips\n");
}
static void io_check_error(unsigned char reason, struct pt_regs * regs)
{
unsigned char reason;
unsigned long i;
reason = inb(0x61);
printk("NMI reason = %02x\n", reason);
printk("NMI: IOCK error (debug interrupt?)\n");
show_registers(regs);
/* Re-enable theIOCK line, wait for a few seconds */
reason |= 8;
outb(reason, 0x61);
i = 400000000;
while (--i) ;
i = 2000;
while (--i) udelay(1000);
reason &= ~8;
outb(reason, 0x61);
}
static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
{
printk("Uhhuh. NMI received for unknown reason %02x.\n", reason);
printk("Dazed and confused, but trying to continue\n");
printk("Do you have a strange power saving mode enabled?\n");
}
asmlinkage void do_nmi(struct pt_regs * regs, long error_code)
{
show_registers(regs);
#ifdef CONFIG_SMP_NMI_INVAL
smp_flush_tlb_rcv();
#else
#ifndef CONFIG_IGNORE_NMI
printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n");
printk("You probably have a hardware problem with your RAM chips or a\n");
printk("power saving mode enabled.\n");
#endif
#endif
enable_NMI();
unsigned char reason = inb(0x61);
if (reason & 0x80)
mem_parity_error(reason, regs);
if (reason & 0x40)
io_check_error(reason, regs);
if (!(reason & 0xc0))
unknown_nmi_error(reason, regs);
}
asmlinkage void do_debug(struct pt_regs * regs, long error_code)
......
......@@ -758,16 +758,16 @@ do_softint(void *private_)
if (!tty)
return;
if (clear_bit(Cy_EVENT_HANGUP, &info->event)) {
if (test_and_clear_bit(Cy_EVENT_HANGUP, &info->event)) {
tty_hangup(info->tty);
wake_up_interruptible(&info->open_wait);
info->flags &= ~(ASYNC_NORMAL_ACTIVE|
ASYNC_CALLOUT_ACTIVE);
}
if (clear_bit(Cy_EVENT_OPEN_WAKEUP, &info->event)) {
if (test_and_clear_bit(Cy_EVENT_OPEN_WAKEUP, &info->event)) {
wake_up_interruptible(&info->open_wait);
}
if (clear_bit(Cy_EVENT_WRITE_WAKEUP, &info->event)) {
if (test_and_clear_bit(Cy_EVENT_WRITE_WAKEUP, &info->event)) {
if((tty->flags & (1<< TTY_DO_WRITE_WAKEUP))
&& tty->ldisc.write_wakeup){
(tty->ldisc.write_wakeup)(tty);
......
......@@ -3491,7 +3491,7 @@ static void do_softint(void *private_)
if (tty && tty->driver_data)
{
if (clear_bit(EPCA_EVENT_HANGUP, &ch->event))
if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event))
{ /* Begin if clear_bit */
tty_hangup(tty);
......
......@@ -689,7 +689,7 @@ static void do_softint(void *private_)
if (!tty)
return;
if (clear_bit(ESP_EVENT_WRITE_WAKEUP, &info->event)) {
if (test_and_clear_bit(ESP_EVENT_WRITE_WAKEUP, &info->event)) {
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup)(tty);
......
......@@ -1005,7 +1005,7 @@ static int stli_initopen(stlibrd_t *brdp, stliport_t *portp)
set_bit(ST_GETSIGS, &portp->state);
if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, sizeof(asysigs_t), 1)) < 0)
return(rc);
if (clear_bit(ST_GETSIGS, &portp->state))
if (test_and_clear_bit(ST_GETSIGS, &portp->state))
portp->sigs = stli_mktiocm(portp->asig.sigvalue);
stli_mkasysigs(&portp->asig, 1, 1);
if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, sizeof(asysigs_t), 0)) < 0)
......
......@@ -205,7 +205,7 @@ void process_keycode (int keycode)
keycode &= 0x7f;
if (up_flag) {
rep = 0;
if(!clear_bit(keycode, key_down)) {
if(!test_and_clear_bit(keycode, key_down)) {
/* unexpected, but this can happen:
maybe this was a key release for a FOCUS 9000
PF key; if we want to see it, we have to clear
......
......@@ -501,7 +501,7 @@ static void handle_scancode(unsigned char scancode)
if (up_flag) {
rep = 0;
if(!clear_bit(keycode, key_down)) {
if(!test_and_clear_bit(keycode, key_down)) {
/* unexpected, but this can happen:
maybe this was a key release for a FOCUS 9000
PF key; if we want to see it, we have to clear
......@@ -510,7 +510,7 @@ static void handle_scancode(unsigned char scancode)
up_flag = 0;
}
} else
rep = set_bit(keycode, key_down);
rep = test_and_set_bit(keycode, key_down);
if (kbd->kbdmode == VC_MEDIUMRAW) {
/* soon keycodes will require more than one byte */
......
......@@ -78,7 +78,7 @@ void n_tty_flush_buffer(struct tty_struct * tty)
return;
if (tty->driver.unthrottle &&
clear_bit(TTY_THROTTLED, &tty->flags))
test_and_clear_bit(TTY_THROTTLED, &tty->flags))
tty->driver.unthrottle(tty);
if (tty->link->packet) {
tty->ctrl_status |= TIOCPKT_FLUSHREAD;
......@@ -598,7 +598,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
if ((tty->read_cnt >= TTY_THRESHOLD_THROTTLE) &&
tty->driver.throttle &&
!set_bit(TTY_THROTTLED, &tty->flags))
!test_and_set_bit(TTY_THROTTLED, &tty->flags))
tty->driver.throttle(tty);
}
......@@ -874,7 +874,7 @@ static int read_chan(struct tty_struct *tty, struct file *file,
if (!tty->read_cnt) {
break;
}
eol = clear_bit(tty->read_tail,
eol = test_and_clear_bit(tty->read_tail,
&tty->read_flags);
c = tty->read_buf[tty->read_tail];
tty->read_tail = ((tty->read_tail+1) &
......@@ -904,7 +904,7 @@ static int read_chan(struct tty_struct *tty, struct file *file,
low-level driver know. */
if (tty->driver.unthrottle &&
(tty->read_cnt <= TTY_THRESHOLD_UNTHROTTLE)
&& clear_bit(TTY_THROTTLED, &tty->flags))
&& test_and_clear_bit(TTY_THROTTLED, &tty->flags))
tty->driver.unthrottle(tty);
if (b - buf >= minimum || !nr)
......@@ -923,7 +923,7 @@ static int read_chan(struct tty_struct *tty, struct file *file,
size = b - buf;
if (size && nr)
clear_bit(TTY_PUSH, &tty->flags);
if (!size && clear_bit(TTY_PUSH, &tty->flags))
if (!size && test_and_clear_bit(TTY_PUSH, &tty->flags))
goto do_it_again;
if (!size && !retval)
clear_bit(TTY_PUSH, &tty->flags);
......
......@@ -2358,7 +2358,7 @@ static void do_softint(void *private_)
if(info && info->magic == PCXX_MAGIC) {
struct tty_struct *tty = info->tty;
if (tty && tty->driver_data) {
if(clear_bit(PCXE_EVENT_HANGUP, &info->event)) {
if(test_and_clear_bit(PCXE_EVENT_HANGUP, &info->event)) {
tty_hangup(tty);
wake_up_interruptible(&info->open_wait);
info->asyncflags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
......
......@@ -1711,7 +1711,7 @@ static void do_softint(void *private_)
if(!(tty = port->tty))
return;
if (clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) {
if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) {
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup)(tty);
......
......@@ -899,7 +899,7 @@ static void do_softint(void *private_)
if (!tty)
return;
if (clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup)(tty);
......
......@@ -11,7 +11,6 @@ fi
bool 'Support audio via ISDN' CONFIG_ISDN_AUDIO
dep_tristate 'ICN 2B and 4B support' CONFIG_ISDN_DRV_ICN $CONFIG_ISDN
dep_tristate 'PCBIT-D support' CONFIG_ISDN_DRV_PCBIT $CONFIG_ISDN
dep_tristate 'Teles/NICCY1016PC/Creatix support' CONFIG_ISDN_DRV_TELES $CONFIG_ISDN
dep_tristate 'HiSax SiemensChipSet driver support' CONFIG_ISDN_DRV_HISAX $CONFIG_ISDN
if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then
bool 'HiSax Support for Teles 16.0/8.0' CONFIG_HISAX_16_0
......
SUB_DIRS :=
MOD_SUB_DIRS :=
ALL_SUB_DIRS := icn teles pcbit hisax
ALL_SUB_DIRS := icn pcbit hisax
L_OBJS :=
LX_OBJS :=
......@@ -36,16 +36,6 @@ else
endif
endif
ifeq ($(CONFIG_ISDN_DRV_TELES),y)
L_OBJS += teles/teles.o
SUB_DIRS += teles
MOD_SUB_DIRS += teles
else
ifeq ($(CONFIG_ISDN_DRV_TELES),m)
MOD_SUB_DIRS += teles
endif
endif
ifeq ($(CONFIG_ISDN_DRV_HISAX),y)
L_OBJS += hisax/hisax.o
SUB_DIRS += hisax
......
L_OBJS :=
M_OBJS :=
O_OBJS := mod.o card.o config.o buffers.o tei.o isdnl2.o isdnl3.o \
llglue.o q931.o callc.o fsm.o
O_TARGET :=
ifeq ($(CONFIG_ISDN_DRV_TELES),y)
O_TARGET += teles.o
else
ifeq ($(CONFIG_ISDN_DRV_TELES),m)
O_TARGET += teles.o
M_OBJS += teles.o
endif
endif
include $(TOPDIR)/Rules.make
/* $Id: buffers.c,v 1.3 1996/05/31 00:56:53 fritz Exp $
*
* $Log: buffers.c,v $
* Revision 1.3 1996/05/31 00:56:53 fritz
* removed cli() from BufPoolAdd, since it is called
* with interrupts off anyway.
*
* Revision 1.2 1996/04/29 22:48:14 fritz
* Removed compatibility-macros. No longer needed.
*
* Revision 1.1 1996/04/13 10:19:28 fritz
* Initial revision
*
*
*/
#define __NO_VERSION__
#include "teles.h"
#include <linux/mm.h>
#include <linux/malloc.h>
void
BufPoolInit(struct BufPool *bp, int order, int bpps,
int maxpages)
{
#ifdef DEBUG_MAGIC
generateerror
bp->magic = 010167;
#endif
#if 0
printk(KERN_DEBUG "BufPoolInit bp %x\n", bp);
#endif
bp->freelist = NULL;
bp->pageslist = NULL;
bp->pageorder = order;
bp->pagescount = 0;
bp->bpps = bpps;
bp->bufsize = BUFFER_SIZE(order, bpps);
bp->maxpages = maxpages;
}
int
BufPoolAdd(struct BufPool *bp, int priority)
{
struct Pages *ptr;
byte *bptr;
int i;
struct BufHeader *bh = NULL, *prev, *first;
#if 0
printk(KERN_DEBUG "BufPoolAdd bp %x\n", bp);
#endif
ptr = (struct Pages *) __get_free_pages(priority, bp->pageorder, 0);
if (!ptr) {
printk(KERN_WARNING "BufPoolAdd couldn't get pages!\n");
return (-1);
}
#if 0
printk(KERN_DEBUG "Order %d pages allocated at %x\n", bp->pageorder, ptr);
#endif
ptr->next = bp->pageslist;
bp->pageslist = ptr;
bp->pagescount++;
bptr = (byte *) ptr + sizeof(struct Pages *);
i = bp->bpps;
first = (struct BufHeader *) bptr;
prev = NULL;
while (i--) {
bh = (struct BufHeader *) bptr;
#ifdef DEBUG_MAGIC
bh->magic = 020167;
#endif
bh->next = prev;
prev = bh;
bh->bp = bp;
bptr += PART_SIZE(bp->pageorder, bp->bpps);
}
first->next = bp->freelist;
bp->freelist = bh;
return (0);
}
void
BufPoolFree(struct BufPool *bp)
{
struct Pages *p;
#if 0
printk(KERN_DEBUG "BufPoolFree bp %x\n", bp);
#endif
while (bp->pagescount--) {
p = bp->pageslist->next;
free_pages((unsigned long) bp->pageslist, bp->pageorder);
#if 0
printk(KERN_DEBUG "Free pages %x order %d\n", bp->pageslist, bp->pageorder);
#endif
bp->pageslist = p;
}
}
int
BufPoolGet(struct BufHeader **bh,
struct BufPool *bp, int priority, void *heldby, int where)
{
long flags;
int i;
#ifdef DEBUG_MAGIC
if (bp->magic != 010167) {
printk(KERN_DEBUG "BufPoolGet: not a BufHeader\n");
return (-1);
}
#endif
save_flags(flags);
cli();
i = 0;
while (!0) {
if (bp->freelist) {
*bh = bp->freelist;
bp->freelist = bp->freelist->next;
(*bh)->heldby = heldby;
(*bh)->where = where;
restore_flags(flags);
return (0);
}
if ((i == 0) && (bp->pagescount < bp->maxpages)) {
if (BufPoolAdd(bp, priority)) {
restore_flags(flags);
return -1;
}
i++;
} else {
*bh = NULL;
restore_flags(flags);
return (-1);
}
}
}
void
BufPoolRelease(struct BufHeader *bh)
{
struct BufPool *bp;
long flags;
#ifdef DEBUG_MAGIC
if (bh->magic != 020167) {
printk(KERN_DEBUG "BufPoolRelease: not a BufHeader\n");
printk(KERN_DEBUG "called from %x\n", __builtin_return_address(0));
return;
}
#endif
bp = bh->bp;
#ifdef DEBUG_MAGIC
if (bp->magic != 010167) {
printk(KERN_DEBUG "BufPoolRelease: not a BufPool\n");
return;
}
#endif
save_flags(flags);
cli();
bh->next = bp->freelist;
bp->freelist = bh;
restore_flags(flags);
}
void
BufQueueLink(struct BufQueue *bq,
struct BufHeader *bh)
{
unsigned long flags;
save_flags(flags);
cli();
if (!bq->head)
bq->head = bh;
if (bq->tail)
bq->tail->next = bh;
bq->tail = bh;
bh->next = NULL;
restore_flags(flags);
}
void
BufQueueLinkFront(struct BufQueue *bq,
struct BufHeader *bh)
{
unsigned long flags;
save_flags(flags);
cli();
bh->next = bq->head;
bq->head = bh;
if (!bq->tail)
bq->tail = bh;
restore_flags(flags);
}
int
BufQueueUnlink(struct BufHeader **bh, struct BufQueue *bq)
{
long flags;
save_flags(flags);
cli();
if (bq->head) {
if (bq->tail == bq->head)
bq->tail = NULL;
*bh = bq->head;
bq->head = (*bh)->next;
restore_flags(flags);
return (0);
} else {
restore_flags(flags);
return (-1);
}
}
void
BufQueueInit(struct BufQueue *bq)
{
#ifdef DEBUG_MAGIC
bq->magic = 030167;
#endif
bq->head = NULL;
bq->tail = NULL;
}
void
BufQueueRelease(struct BufQueue *bq)
{
struct BufHeader *bh;
while (bq->head) {
BufQueueUnlink(&bh, bq);
BufPoolRelease(bh);
}
}
int
BufQueueLength(struct BufQueue *bq)
{
int i = 0;
struct BufHeader *bh;
bh = bq->head;
while (bh) {
i++;
bh = bh->next;
}
return (i);
}
void
BufQueueDiscard(struct BufQueue *q, int pr, void *heldby,
int releasetoo)
{
long flags;
struct BufHeader *sp;
save_flags(flags);
cli();
while (!0) {
sp = q->head;
if (!sp)
break;
if ((sp->primitive == pr) && (sp->heldby == heldby)) {
q->head = sp->next;
if (q->tail == sp)
q->tail = NULL;
if (releasetoo)
BufPoolRelease(sp);
} else
break;
}
sp = q->head;
if (sp)
while (sp->next) {
if ((sp->next->primitive == pr) && (sp->next->heldby == heldby)) {
if (q->tail == sp->next)
q->tail = sp;
if (releasetoo)
BufPoolRelease(sp->next);
sp->next = sp->next->next;
} else
sp = sp->next;
}
restore_flags(flags);
}
void
Sfree(byte * ptr)
{
#if 0
printk(KERN_DEBUG "Sfree %x\n", ptr);
#endif
kfree(ptr);
}
byte *
Smalloc(int size, int pr, char *why)
{
byte *p;
p = (byte *) kmalloc(size, pr);
#if 0
printk(KERN_DEBUG "Smalloc %s size %d res %x\n", why, size, p);
#endif
return (p);
}
This diff is collapsed.
This diff is collapsed.
/* $Id: config.c,v 1.1 1996/04/13 10:23:11 fritz Exp $
*
* $Log: config.c,v $
* Revision 1.1 1996/04/13 10:23:11 fritz
* Initial revision
*
*
*/
#define __NO_VERSION__
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/timer.h>
#include "teles.h"
/*
* This structure array contains one entry per card. An entry looks
* like this:
*
* { membase,irq,portbase,protocol,NULL }
*
* protocol can be either ISDN_PTYPE_EURO or ISDN_PTYPE_1TR6
*
* Cards which don't have an io port (Teles 8 bit cards for
* example) can be entered with io port 0x0
*
* For the Teles 16.3, membase has to be set to 0.
*
*/
struct IsdnCard cards[] =
{
{(byte *) 0xd0000, 15, 0xd80, ISDN_PTYPE_EURO, NULL}, /* example */
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
{NULL, 0, 0, 0, NULL},
};
/* $Id: fsm.c,v 1.3 1997/02/16 01:04:12 fritz Exp $
*
* $Log: fsm.c,v $
* Revision 1.3 1997/02/16 01:04:12 fritz
* Bugfix: Changed timer handling caused hang with 2.1.X
*
* Revision 1.2 1996/04/29 22:49:57 fritz
* Removed compatibility-macros.
*
* Revision 1.1 1996/04/13 10:23:41 fritz
* Initial revision
*
*
*/
#define __NO_VERSION__
#include "teles.h"
void
FsmNew(struct Fsm *fsm,
struct FsmNode *fnlist, int fncount)
{
int i;
fsm->jumpmatrix = (int *) Smalloc(4L * fsm->state_count * fsm->event_count,
GFP_KERNEL, "Fsm jumpmatrix");
memset(fsm->jumpmatrix, 0, 4L * fsm->state_count * fsm->event_count);
for (i = 0; i < fncount; i++)
fsm->jumpmatrix[fsm->state_count * fnlist[i].event +
fnlist[i].state] = (int) fnlist[i].routine;
}
void
FsmFree(struct Fsm *fsm)
{
Sfree((void *) fsm->jumpmatrix);
}
int
FsmEvent(struct FsmInst *fi, int event, void *arg)
{
void (*r) (struct FsmInst *, int, void *);
char str[80];
r = (void (*)) fi->fsm->jumpmatrix[fi->fsm->state_count * event + fi->state];
if (r) {
if (fi->debug) {
sprintf(str, "State %s Event %s",
fi->fsm->strState[fi->state],
fi->fsm->strEvent[event]);
fi->printdebug(fi, str);
}
r(fi, event, arg);
return (0);
} else {
if (fi->debug) {
sprintf(str, "State %s Event %s no routine",
fi->fsm->strState[fi->state],
fi->fsm->strEvent[event]);
fi->printdebug(fi, str);
}
return (!0);
}
}
void
FsmChangeState(struct FsmInst *fi, int newstate)
{
char str[80];
fi->state = newstate;
if (fi->debug) {
sprintf(str, "ChangeState %s",
fi->fsm->strState[newstate]);
fi->printdebug(fi, str);
}
}
static void
FsmExpireTimer(struct FsmTimer *ft)
{
FsmEvent(ft->fi, ft->event, ft->arg);
}
void
FsmInitTimer(struct FsmInst *fi, struct FsmTimer *ft)
{
ft->fi = fi;
ft->tl.function = (void *) FsmExpireTimer;
ft->tl.data = (long) ft;
init_timer(&ft->tl);
}
void
FsmDelTimer(struct FsmTimer *ft, int where)
{
#if 0
if (ft->fi->debug) {
sprintf(str, "FsmDelTimer %lx %d", ft, where);
ft->fi->printdebug(ft->fi, str);
}
#endif
del_timer(&ft->tl);
}
int
FsmAddTimer(struct FsmTimer *ft,
int millisec, int event, void *arg, int where)
{
#if 0
if (ft->fi->debug) {
sprintf(str, "FsmAddTimer %lx %d %d", ft, millisec, where);
ft->fi->printdebug(ft->fi, str);
}
#endif
if (ft->tl.next || ft->tl.prev) {
printk(KERN_WARNING "FsmAddTimer: timer already active!\n");
return -1;
}
init_timer(&ft->tl);
ft->event = event;
ft->arg = arg;
ft->tl.expires = jiffies + (millisec * HZ) / 1000;
add_timer(&ft->tl);
return 0;
}
int
FsmTimerRunning(struct FsmTimer *ft)
{
return (ft->tl.next != NULL);
}
void
jiftime(char *s, long mark)
{
s += 8;
*s-- = '\0';
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = '.';
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = mark % 6 + '0';
mark /= 6;
*s-- = ':';
*s-- = mark % 10 + '0';
mark /= 10;
*s-- = mark % 10 + '0';
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $Id: proto.h,v 1.1 1996/09/23 01:53:52 fritz Exp $
*
* not much now - just the l3 proto discriminator
*
* $Log: proto.h,v $
* Revision 1.1 1996/09/23 01:53:52 fritz
* Bugfix: discard unknown frames (non-EDSS1 and non-1TR6).
*
*/
#ifndef PROTO_H
#define PROTO_H
#define PROTO_EURO 0x08
#define PROTO_DIS_N0 0x40
#define PROTO_DIS_N1 0x41
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -413,7 +413,7 @@ static int el_start_xmit(struct sk_buff *skb, struct device *dev)
* Avoid timer-based retransmission conflicts.
*/
if (set_bit(0, (void*)&dev->tbusy) != 0)
if (test_and_set_bit(0, (void*)&dev->tbusy) != 0)
{
restore_flags(flags);
printk("%s: Transmitter access conflict.\n", dev->name);
......
This diff is collapsed.
......@@ -479,7 +479,7 @@ static int el16_send_packet(struct sk_buff *skb, struct device *dev)
}
/* Block a timer-based transmit from overlapping. */
if (set_bit(0, (void*)&dev->tbusy) != 0)
if (test_and_set_bit(0, (void*)&dev->tbusy) != 0)
printk("%s: Transmitter access conflict.\n", dev->name);
else
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment