Start using the new SWI registration system instead of hardwiring everything.
This commit is contained in:
parent
75b8dc0791
commit
955fc8ee3e
@ -23,11 +23,12 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ipl_funcs.c,v 1.6 1998/09/16 08:21:12 dfr Exp $
|
||||
* $Id: ipl_funcs.c,v 1.7 1998/09/19 09:29:40 dfr Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <net/netisr.h>
|
||||
@ -38,17 +39,28 @@ unsigned int bio_imask; /* XXX */
|
||||
unsigned int cam_imask; /* XXX */
|
||||
unsigned int net_imask; /* XXX */
|
||||
|
||||
static void swi_net(void);
|
||||
extern void swi_camnet(void);
|
||||
extern void swi_cambio(void);
|
||||
|
||||
void (*netisrs[32]) __P((void));
|
||||
swihand_t *ihandlers[32] = { /* software interrupts */
|
||||
swi_null, swi_net, swi_camnet, swi_cambio,
|
||||
swi_null, softclock, swi_null, swi_null,
|
||||
swi_null, swi_null, swi_null, swi_null,
|
||||
swi_null, swi_null, swi_null, swi_null,
|
||||
swi_null, swi_null, swi_null, swi_null,
|
||||
swi_null, swi_null, swi_null, swi_null,
|
||||
swi_null, swi_null, swi_null, swi_null,
|
||||
swi_null, swi_null, swi_null, swi_null,
|
||||
};
|
||||
|
||||
u_int32_t netisr;
|
||||
u_int32_t ipending;
|
||||
u_int32_t idelayed;
|
||||
|
||||
#define getcpl() (alpha_pal_rdps() & ALPHA_PSL_IPL_MASK)
|
||||
|
||||
static void swi_tty(void);
|
||||
static void swi_net(void);
|
||||
extern void swi_camnet(void);
|
||||
extern void swi_cambio(void);
|
||||
|
||||
static void atomic_setbit(u_int32_t* p, u_int32_t bit)
|
||||
{
|
||||
@ -84,12 +96,17 @@ static u_int32_t atomic_readandclear(u_int32_t* p)
|
||||
return v;
|
||||
}
|
||||
|
||||
static void
|
||||
swi_tty()
|
||||
void
|
||||
swi_null()
|
||||
{
|
||||
#if NSIO > 0
|
||||
siopoll();
|
||||
#endif
|
||||
/* No interrupt registered, do nothing */
|
||||
}
|
||||
|
||||
void
|
||||
swi_generic()
|
||||
{
|
||||
/* Just a placeholder, we call swi_dispatcher directly */
|
||||
panic("swi_generic() called");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -109,23 +126,22 @@ void
|
||||
do_sir()
|
||||
{
|
||||
u_int32_t pend;
|
||||
int i;
|
||||
|
||||
splsoft();
|
||||
while (pend = atomic_readandclear(&ipending)) {
|
||||
if (pend & (1 << SWI_TTY))
|
||||
swi_tty();
|
||||
if (pend & (1 << SWI_NET))
|
||||
swi_net();
|
||||
if (pend & (1 << SWI_CAMNET))
|
||||
swi_camnet();
|
||||
if (pend & (1 << SWI_CAMBIO))
|
||||
swi_cambio();
|
||||
if (pend & (1 << SWI_CLOCK))
|
||||
softclock();
|
||||
for (i = 0; pend && i < 32; i++) {
|
||||
if (pend & (1 << i)) {
|
||||
if (ihandlers[i] == swi_generic)
|
||||
swi_dispatcher(i);
|
||||
else
|
||||
ihandlers[i]();
|
||||
pend &= ~(1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define GENSET(name, ptr, bit) \
|
||||
\
|
||||
void name(void) \
|
||||
@ -202,4 +218,3 @@ splx(int s)
|
||||
else
|
||||
spl0();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ipl.h,v 1.5 1998/09/16 08:23:21 dfr Exp $
|
||||
* $Id: ipl.h,v 1.6 1998/09/19 09:29:40 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_IPL_H_
|
||||
@ -38,6 +38,8 @@
|
||||
#define SWI_CAMBIO 3
|
||||
#define SWI_VM 4
|
||||
#define SWI_CLOCK 5
|
||||
#define NSWI 32
|
||||
#define NHWI 0
|
||||
|
||||
extern int splsoft(void);
|
||||
extern int splsoftclock(void);
|
||||
|
@ -23,16 +23,10 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_intr.c,v 1.18 1998/07/15 02:32:08 bde Exp $
|
||||
* $Id: kern_intr.c,v 1.19 1998/08/11 15:08:13 bde Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
/*
|
||||
* This file is pretty i386 specific. I might be able to make it more
|
||||
* portable in the future but for now turn it off for non-i386 ports.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -44,13 +38,17 @@
|
||||
|
||||
#include <machine/ipl.h>
|
||||
|
||||
#ifdef __i386__
|
||||
#include <i386/isa/icu.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#endif
|
||||
|
||||
#include <sys/interrupt.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
typedef struct intrec {
|
||||
intrmask_t mask;
|
||||
inthand2_t *handler;
|
||||
@ -62,14 +60,19 @@ typedef struct intrec {
|
||||
int flags;
|
||||
} intrec;
|
||||
|
||||
static intrec *intreclist_head[NHWI];
|
||||
|
||||
#endif
|
||||
|
||||
struct swilist {
|
||||
swihand_t *sl_handler;
|
||||
struct swilist *sl_next;
|
||||
};
|
||||
|
||||
static intrec *intreclist_head[NHWI];
|
||||
static struct swilist swilists[NSWI];
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
/*
|
||||
* The interrupt multiplexer calls each of the handlers in turn,
|
||||
* and applies the associated interrupt mask to "cpl", which is
|
||||
@ -443,6 +446,8 @@ unregister_intr(int intr, inthand2_t handler)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
void
|
||||
register_swi(intr, handler)
|
||||
int intr;
|
||||
@ -528,4 +533,3 @@ unregister_swi(intr, handler)
|
||||
splx(s);
|
||||
}
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
Loading…
Reference in New Issue
Block a user