X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fchar%2Frio%2Friointr.c;h=e42e7b50bf6bf50184ca1e16e4588b442ea2add5;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=f43499e0226ff5e0a246d274e02319fce0aa85a0;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index f43499e02..e42e7b50b 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c @@ -84,83 +84,10 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; #include "rioioctl.h" +static void RIOReceive(struct rio_info *, struct Port *); -/* -** riopoll is called every clock tick. Once the /dev/rio device has been -** opened, and polldistributed( ) has been called, this routine is called -** every clock tick *by every cpu*. The 'interesting' piece of code that -** manipulates 'RIONumCpus' and 'RIOCpuCountdown' is used to fair-share -** the work between the CPUs. If there are 'N' cpus, then each poll time -** we increment a counter, modulo 'N-1'. When this counter is 0, we call -** the interrupt handler. This has the effect that polls are serviced -** by processor 'N', 'N-1', 'N-2', ... '0', round and round. Neat. -*/ -void -riopoll(p) -struct rio_info * p; -{ - int host; - - /* - ** Here's the deal. We try to fair share as much as possible amongst - ** all the processors that are available. Since each processor - ** should generate HZ ticks per second and since we only need HZ ticks - ** in total for proper operation we simply attempt to cycle round each - ** processor in turn, using RIOCpuCountdown to decide whether to call - ** the interrupt routine. ( In fact the count zeroes when it reaches - ** one less than the total number of processors - so e.g. on a two - ** processor system RIOService will get called 2*HZ times per second. ) - ** this_cpu (cur_cpu()) tells us the number of the current processor - ** as follows: - ** - ** 0 - default CPU - ** 1 - first extra CPU - ** 2 - second extra CPU - ** etc. - */ - - /* - ** okay, we've got a cpu that hasn't had a go recently - ** - lets check to see what needs doing. - */ - for ( host=0; hostRIONumHosts; host++ ) { - struct Host *HostP = &p->RIOHosts[host]; - - rio_spin_lock( &HostP->HostLock ); - - if ( ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) || - HostP->InIntr ) { - rio_spin_unlock (&HostP->HostLock); - continue; - } - - if ( RWORD( HostP->ParmMapP->rup_intr ) || - RWORD( HostP->ParmMapP->rx_intr ) || - RWORD( HostP->ParmMapP->tx_intr ) ) { - HostP->InIntr = 1; - -#ifdef FUTURE_RELEASE - if( HostP->Type == RIO_EISA ) - INBZ( HostP->Slot, EISA_INTERRUPT_RESET ); - else -#endif - WBYTE( HostP->ResetInt , 0xff ); - - rio_spin_lock(&HostP->HostLock); - - p->_RIO_Polled++; - RIOServiceHost(p, HostP, 'p' ); - rio_spin_lock( &HostP->HostLock); - HostP->InIntr = 0; - rio_spin_unlock (&HostP->HostLock); - } - } - rio_spin_unlock (&p->RIOIntrSem); -} - - -char *firstchars (char *p, int nch) +static char *firstchars (char *p, int nch) { static char buf[2][128]; static int t=0; @@ -257,93 +184,6 @@ char * en; } -/* -** When a real-life interrupt comes in here, we try to find out -** which host card it belongs to, and then service only that host -** Notice the cunning way that, once we've found a candidate, we -** continue just in case we are sharing interrupts. -*/ -void -riointr(p) -struct rio_info * p; -{ - int host; - - for ( host=0; hostRIONumHosts; host++ ) { - struct Host *HostP = &p->RIOHosts[host]; - - rio_dprintk (RIO_DEBUG_INTR, "riointr() doing host %d type %d\n", host, HostP->Type); - - switch( HostP->Type ) { - case RIO_AT: - case RIO_MCA: - case RIO_PCI: - rio_spin_lock(&HostP->HostLock); - WBYTE(HostP->ResetInt , 0xff); - if ( !HostP->InIntr ) { - HostP->InIntr = 1; - rio_spin_unlock (&HostP->HostLock); - p->_RIO_Interrupted++; - RIOServiceHost(p, HostP, 'i'); - rio_spin_lock(&HostP->HostLock); - HostP->InIntr = 0; - } - rio_spin_unlock(&HostP->HostLock); - break; -#ifdef FUTURE_RELEASE - case RIO_EISA: - if ( ivec == HostP->Ivec ) - { - OldSpl = LOCKB( &HostP->HostLock ); - INBZ( HostP->Slot, EISA_INTERRUPT_RESET ); - if ( !HostP->InIntr ) - { - HostP->InIntr = 1; - UNLOCKB( &HostP->HostLock, OldSpl ); - if ( this_cpu < RIO_CPU_LIMIT ) - { - int intrSpl = LOCKB( &RIOIntrLock ); - UNLOCKB( &RIOIntrLock, intrSpl ); - } - p->_RIO_Interrupted++; - RIOServiceHost( HostP, 'i' ); - OldSpl = LOCKB( &HostP->HostLock ); - HostP->InIntr = 0; - } - UNLOCKB( &HostP->HostLock, OldSpl ); - done++; - } - break; -#endif - } - - HostP->IntSrvDone++; - } - -#ifdef FUTURE_RELEASE - if ( !done ) - { - cmn_err( CE_WARN, "RIO: Interrupt received with vector 0x%x\n", ivec ); - cmn_err( CE_CONT, " Valid vectors are:\n"); - for ( host=0; host