Move all IPL setup to intr.c, and do some sanity checking.

This commit is contained in:
scottr 1999-02-28 04:52:07 +00:00
parent b8ca758af8
commit e640c5d7cc
3 changed files with 83 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.12 1999/02/17 04:46:45 scottr Exp $ */
/* $NetBSD: intr.h,v 1.13 1999/02/28 04:52:07 scottr Exp $ */
/*
* Copyright (C) 1997 Scott Reynolds
@ -83,14 +83,14 @@
* splnet must block hardware network interrupts
* splimp must be > spltty
*/
extern unsigned short mac68k_ttyipl;
extern unsigned short mac68k_bioipl;
extern unsigned short mac68k_netipl;
extern unsigned short mac68k_impipl;
extern unsigned short mac68k_audioipl;
extern unsigned short mac68k_clockipl;
extern unsigned short mac68k_statclockipl;
extern unsigned short mac68k_schedipl;
extern u_short mac68k_ttyipl;
extern u_short mac68k_bioipl;
extern u_short mac68k_netipl;
extern u_short mac68k_impipl;
extern u_short mac68k_audioipl;
extern u_short mac68k_clockipl;
extern u_short mac68k_statclockipl;
extern u_short mac68k_schedipl;
/*
* These should be used for:
@ -140,6 +140,7 @@ extern volatile u_int8_t ssir;
#define setsoftadb() siron(SIR_ADB)
/* intr.c */
void intr_init __P((void));
void intr_establish __P((int (*)(void *), void *, int));
void intr_disestablish __P((int));
void intr_dispatch __P((int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.2 1998/08/25 04:03:56 scottr Exp $ */
/* $NetBSD: intr.c,v 1.3 1999/02/28 04:52:07 scottr Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -92,8 +92,76 @@ static void *intr_arg[NISR] = {
int intr_debug = 0;
#endif
/*
* Some of the below are not used yet, but might be used someday on the
* Q700/900/950 where the interrupt controller may be reprogrammed to
* interrupt on different levels as listed in locore.s
*/
u_short mac68k_ttyipl;
u_short mac68k_bioipl;
u_short mac68k_netipl;
u_short mac68k_impipl;
u_short mac68k_audioipl;
u_short mac68k_clockipl;
u_short mac68k_statclockipl;
u_short mac68k_schedipl;
extern int intrcnt[]; /* from locore.s */
void intr_computeipl __P((void));
void
intr_init()
{
/* Standard spl(9) interrupt priorities */
mac68k_ttyipl = (PSL_S | PSL_IPL1);
mac68k_bioipl = (PSL_S | PSL_IPL2);
mac68k_netipl = (PSL_S | PSL_IPL2);
mac68k_impipl = (PSL_S | PSL_IPL2);
mac68k_statclockipl = (PSL_S | PSL_IPL2);
mac68k_clockipl = (PSL_S | PSL_IPL2);
mac68k_schedipl = (PSL_S | PSL_IPL3);
/* Non-standard interrupt priority */
mac68k_audioipl = (PSL_S | PSL_IPL2);
if (current_mac_model->class == MACH_CLASSAV)
mac68k_bioipl = mac68k_netipl = (PSL_S | PSL_IPL4);
intr_computeipl();
}
/*
* Compute the interrupt levels for the spl*()
* calls. This doesn't have to be fast.
*/
void
intr_computeipl()
{
/*
* Enforce `bio <= net <= tty <= imp <= statclock <= clock <= sched'
* as defined in spl(9)
*/
if (mac68k_bioipl > mac68k_netipl)
mac68k_netipl = mac68k_bioipl;
if (mac68k_netipl > mac68k_ttyipl)
mac68k_ttyipl = mac68k_netipl;
if (mac68k_ttyipl > mac68k_impipl)
mac68k_impipl = mac68k_ttyipl;
if (mac68k_impipl > mac68k_statclockipl)
mac68k_statclockipl = mac68k_impipl;
if (mac68k_statclockipl > mac68k_clockipl)
mac68k_clockipl = mac68k_statclockipl;
if (mac68k_clockipl > mac68k_schedipl)
mac68k_schedipl = mac68k_clockipl;
}
/*
* Establish an autovectored interrupt handler.
* Called by driver attach functions.

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.222 1999/02/27 06:39:36 scottr Exp $ */
/* $NetBSD: machdep.c,v 1.223 1999/02/28 04:52:07 scottr Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -226,19 +226,6 @@ int physmem = MAXMEM; /* max supported memory, changes to actual */
* during autoconfiguration or after a panic.
*/
int safepri = PSL_LOWIPL;
/*
* Some of the below are not used yet, but might be used someday on the
* Q700/900/950 where the interrupt controller may be reprogrammed to
* interrupt on different levels as listed in locore.s
*/
unsigned short mac68k_ttyipl = PSL_S | PSL_IPL1;
unsigned short mac68k_bioipl = PSL_S | PSL_IPL2;
unsigned short mac68k_netipl = PSL_S | PSL_IPL2;
unsigned short mac68k_impipl = PSL_S | PSL_IPL2;
unsigned short mac68k_audioipl = PSL_S | PSL_IPL2;
unsigned short mac68k_clockipl = PSL_S | PSL_IPL2;
unsigned short mac68k_statclockipl = PSL_S | PSL_IPL2;
unsigned short mac68k_schedipl = PSL_S | PSL_IPL3;
/*
* Extent maps to manage all memory space, including I/O ranges. Allocate
@ -306,6 +293,9 @@ mac68k_init()
#endif /* UVM */
}
/* Initialize the interrupt handlers. */
intr_init();
/* Initialize the VIAs */
via_init();
@ -2443,10 +2433,6 @@ mac68k_set_io_offsets(base)
sccA = (volatile u_char *)base + 0x4000;
SCSIBase = base + 0x18000;
PSCBase = (volatile u_char *)base + 0x31000;
mac68k_bioipl = PSL_S | PSL_IPL4;
mac68k_netipl = PSL_S | PSL_IPL4;
mac68k_impipl = PSL_S | PSL_IPL4;
mac68k_statclockipl = PSL_S | PSL_IPL4;
break;
case MACH_CLASSII:
case MACH_CLASSPB: