From 654051453f74fb72c1ff79c625e7651ea6ad5ae8 Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 4 Aug 1999 16:01:47 +0000 Subject: [PATCH] Use an array for PSL values, rather than individual shortwords, like the hp300 port. --- sys/arch/mac68k/include/intr.h | 57 ++++++++++++++------------ sys/arch/mac68k/mac68k/intr.c | 75 +++++++++++++++++----------------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/sys/arch/mac68k/include/intr.h b/sys/arch/mac68k/include/intr.h index c0dc66817511..6b8b6f5cb64b 100644 --- a/sys/arch/mac68k/include/intr.h +++ b/sys/arch/mac68k/include/intr.h @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.14 1999/06/15 15:26:34 kleink Exp $ */ +/* $NetBSD: intr.h,v 1.15 1999/08/04 16:01:48 thorpej Exp $ */ /* * Copyright (C) 1997 Scott Reynolds @@ -74,23 +74,28 @@ #define spl6() _spl(PSL_S|PSL_IPL6) #define spl7() _spl(PSL_S|PSL_IPL7) +/* + * This array contains the appropriate PSL_S|PSL_IPL? values + * to raise interrupt priority to the requested level. + */ +extern unsigned short mac68k_ipls[]; + +#define MAC68K_IPL_SOFT 0 +#define MAC68K_IPL_BIO 1 +#define MAC68K_IPL_NET 2 +#define MAC68K_IPL_TTY 3 +#define MAC68K_IPL_IMP 4 +#define MAC68K_IPL_AUDIO 5 +#define MAC68K_IPL_SERIAL 6 +#define MAC68K_IPL_CLOCK 7 +#define MAC68K_IPL_STATCLOCK 8 +#define MAC68K_IPL_SCHED 9 +#define MAC68K_IPL_HIGH 10 +#define MAC68K_NIPLS 11 + /* These spl calls are _not_ to be used by machine-independent code. */ #define spladb() splhigh() #define splzs() splserial() -#define splsoft() spl1() - -/* - * splnet must block hardware network interrupts - * splimp must be > spltty - */ -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: @@ -101,17 +106,17 @@ extern u_short mac68k_schedipl; * everything at spl2, and everything but the panic switch and * power at spl4. */ -#define splsoftclock() splsoft() -#define splsoftnet() splsoft() -#define spltty() _splraise(mac68k_ttyipl) -#define splbio() _splraise(mac68k_bioipl) -#define splnet() _splraise(mac68k_netipl) -#define splimp() _splraise(mac68k_impipl) -#define splaudio() _splraise(mac68k_audioipl) -#define splclock() _splraise(mac68k_clockipl) -#define splstatclock() _splraise(mac68k_statclockipl) -#define splsched() _splraise(mac68k_schedipl) -#define splserial() spl4() +#define splsoftclock() spl1() +#define splsoftnet() _splraise(mac68k_ipls[MAC68K_IPL_SOFT]) +#define spltty() _splraise(mac68k_ipls[MAC68K_IPL_TTY]) +#define splbio() _splraise(mac68k_ipls[MAC68K_IPL_BIO]) +#define splnet() _splraise(mac68k_ipls[MAC68K_IPL_NET]) +#define splimp() _splraise(mac68k_ipls[MAC68K_IPL_IMP]) +#define splaudio() _splraise(mac68k_ipls[MAC68K_IPL_AUDIO]) +#define splclock() _splraise(mac68k_ipls[MAC68K_IPL_CLOCK]) +#define splstatclock() _splraise(mac68k_ipls[MAC68K_IPL_STATCLOCK]) +#define splsched() _splraise(mac68k_ipls[MAC68K_IPL_SCHED]) +#define splserial() _splraise(mac68k_ipls[MAC68K_IPL_SERIAL]) #define splhigh() spl7() /* watch out for side effects */ diff --git a/sys/arch/mac68k/mac68k/intr.c b/sys/arch/mac68k/mac68k/intr.c index b35b864f06e0..cd829f489fa1 100644 --- a/sys/arch/mac68k/mac68k/intr.c +++ b/sys/arch/mac68k/mac68k/intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.6 1999/06/28 08:20:44 itojun Exp $ */ +/* $NetBSD: intr.c,v 1.7 1999/08/04 16:01:47 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -95,14 +95,7 @@ int intr_debug = 0; * IIfx/Q700/900/950/etc. 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; +u_short mac68k_ipls[MAC68K_NIPLS]; extern int intrcnt[]; /* from locore.s */ @@ -122,41 +115,46 @@ intr_init() extern long intrnames; char *inames, *g_inames; + mac68k_ipls[MAC68K_IPL_SOFT] = PSL_S|PSL_IPL1; + mac68k_ipls[MAC68K_IPL_SERIAL] = PSL_S|PSL_IPL4; + mac68k_ipls[MAC68K_IPL_HIGH] = PSL_S|PSL_IPL7; + g_inames = (char *) &intrnames; if (mac68k_machine.aux_interrupts) { inames = AUX_INAMES; /* Standard spl(9) interrupt priorities */ - mac68k_ttyipl = (PSL_S | PSL_IPL1); - mac68k_bioipl = (PSL_S | PSL_IPL2); - mac68k_netipl = (PSL_S | PSL_IPL3); - mac68k_impipl = (PSL_S | PSL_IPL6); - mac68k_statclockipl = (PSL_S | PSL_IPL6); - mac68k_clockipl = (PSL_S | PSL_IPL6); - mac68k_schedipl = (PSL_S | PSL_IPL4); + mac68k_ipls[MAC68K_IPL_TTY] = (PSL_S | PSL_IPL1); + mac68k_ipls[MAC68K_IPL_BIO] = (PSL_S | PSL_IPL2); + mac68k_ipls[MAC68K_IPL_NET] = (PSL_S | PSL_IPL3); + mac68k_ipls[MAC68K_IPL_IMP] = (PSL_S | PSL_IPL6); + mac68k_ipls[MAC68K_IPL_STATCLOCK] = (PSL_S | PSL_IPL6); + mac68k_ipls[MAC68K_IPL_CLOCK] = (PSL_S | PSL_IPL6); + mac68k_ipls[MAC68K_IPL_SCHED] = (PSL_S | PSL_IPL4); /* Non-standard interrupt priority */ - mac68k_audioipl = (PSL_S | PSL_IPL5); + mac68k_ipls[MAC68K_IPL_AUDIO] = (PSL_S | PSL_IPL5); } else { inames = STD_INAMES; /* 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); + mac68k_ipls[MAC68K_IPL_TTY] = (PSL_S | PSL_IPL1); + mac68k_ipls[MAC68K_IPL_BIO] = (PSL_S | PSL_IPL2); + mac68k_ipls[MAC68K_IPL_NET] = (PSL_S | PSL_IPL2); + mac68k_ipls[MAC68K_IPL_IMP] = (PSL_S | PSL_IPL2); + mac68k_ipls[MAC68K_IPL_STATCLOCK] = (PSL_S | PSL_IPL2); + mac68k_ipls[MAC68K_IPL_CLOCK] = (PSL_S | PSL_IPL2); + mac68k_ipls[MAC68K_IPL_SCHED] = (PSL_S | PSL_IPL3); /* Non-standard interrupt priority */ - mac68k_audioipl = (PSL_S | PSL_IPL2); + mac68k_ipls[MAC68K_IPL_AUDIO] = (PSL_S | PSL_IPL2); if (current_mac_model->class == MACH_CLASSAV) { inames = AV_INAMES; - mac68k_bioipl = mac68k_netipl = (PSL_S | PSL_IPL4); + mac68k_ipls[MAC68K_IPL_BIO] = + mac68k_ipls[MAC68K_IPL_NET] = (PSL_S | PSL_IPL4); } } @@ -177,23 +175,24 @@ 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_ipls[MAC68K_IPL_BIO] > mac68k_ipls[MAC68K_IPL_NET]) + mac68k_ipls[MAC68K_IPL_NET] = mac68k_ipls[MAC68K_IPL_BIO]; - if (mac68k_netipl > mac68k_ttyipl) - mac68k_ttyipl = mac68k_netipl; + if (mac68k_ipls[MAC68K_IPL_NET] > mac68k_ipls[MAC68K_IPL_TTY]) + mac68k_ipls[MAC68K_IPL_TTY] = mac68k_ipls[MAC68K_IPL_NET]; - if (mac68k_ttyipl > mac68k_impipl) - mac68k_impipl = mac68k_ttyipl; + if (mac68k_ipls[MAC68K_IPL_TTY] > mac68k_ipls[MAC68K_IPL_IMP]) + mac68k_ipls[MAC68K_IPL_IMP] = mac68k_ipls[MAC68K_IPL_TTY]; - if (mac68k_impipl > mac68k_statclockipl) - mac68k_statclockipl = mac68k_impipl; + if (mac68k_ipls[MAC68K_IPL_IMP] > mac68k_ipls[MAC68K_IPL_STATCLOCK]) + mac68k_ipls[MAC68K_IPL_STATCLOCK] = mac68k_ipls[MAC68K_IPL_IMP]; - if (mac68k_statclockipl > mac68k_clockipl) - mac68k_clockipl = mac68k_statclockipl; + if (mac68k_ipls[MAC68K_IPL_STATCLOCK] > mac68k_ipls[MAC68K_IPL_CLOCK]) + mac68k_ipls[MAC68K_IPL_CLOCK] = + mac68k_ipls[MAC68K_IPL_STATCLOCK]; - if (mac68k_clockipl > mac68k_schedipl) - mac68k_schedipl = mac68k_clockipl; + if (mac68k_ipls[MAC68K_IPL_CLOCK] > mac68k_ipls[MAC68K_IPL_SCHED]) + mac68k_ipls[MAC68K_IPL_SCHED] = mac68k_ipls[MAC68K_IPL_CLOCK]; } /*