Store computed PSL values in an array indexed by abstract interrupt

level, rather than individual shortwords.
This commit is contained in:
thorpej 1999-08-01 21:50:17 +00:00
parent 6489500f0a
commit 868dfcb228
3 changed files with 56 additions and 41 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dma.c,v 1.23 1998/08/20 08:33:41 kleink Exp $ */
/* $NetBSD: dma.c,v 1.24 1999/08/01 21:50:17 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -239,7 +239,7 @@ dmacomputeipl()
* Our interrupt level must be as high as the highest
* device using DMA (i.e. splbio).
*/
sc->sc_ipl = PSLTOIPL(hp300_bioipl);
sc->sc_ipl = PSLTOIPL(hp300_ipls[HP300_IPL_BIO]);
sc->sc_ih = intr_establish(dmaintr, sc, sc->sc_ipl, IPL_BIO);
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: intr.c,v 1.13 1999/06/28 08:20:43 itojun Exp $ */
/* $NetBSD: intr.c,v 1.14 1999/08/01 21:50:17 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -65,7 +65,7 @@
typedef LIST_HEAD(, isr) isr_list_t;
isr_list_t isr_list[NISR];
u_short hp300_bioipl, hp300_netipl, hp300_ttyipl, hp300_impipl;
u_short hp300_ipls[HP300_NIPLS];
extern int intrcnt[]; /* from locore.s */
@ -81,8 +81,13 @@ intr_init()
LIST_INIT(&isr_list[i]);
/* Default interrupt priorities. */
hp300_bioipl = hp300_netipl = hp300_ttyipl = hp300_impipl =
(PSL_S|PSL_IPL3);
hp300_ipls[HP300_IPL_SOFT] = PSL_S|PSL_IPL1;
hp300_ipls[HP300_IPL_BIO] = PSL_S|PSL_IPL3;
hp300_ipls[HP300_IPL_NET] = PSL_S|PSL_IPL3;
hp300_ipls[HP300_IPL_TTY] = PSL_S|PSL_IPL3;
hp300_ipls[HP300_IPL_IMP] = PSL_S|PSL_IPL3;
hp300_ipls[HP300_IPL_CLOCK] = PSL_S|PSL_IPL6;
hp300_ipls[HP300_IPL_HIGH] = PSL_S|PSL_IPL7;
}
/*
@ -96,8 +101,10 @@ intr_computeipl()
int ipl;
/* Start with low values. */
hp300_bioipl = hp300_netipl = hp300_ttyipl = hp300_impipl =
(PSL_S|PSL_IPL3);
hp300_ipls[HP300_IPL_BIO] =
hp300_ipls[HP300_IPL_NET] =
hp300_ipls[HP300_IPL_TTY] =
hp300_ipls[HP300_IPL_IMP] = PSL_S|PSL_IPL3;
for (ipl = 0; ipl < NISR; ipl++) {
for (isr = isr_list[ipl].lh_first; isr != NULL;
@ -108,19 +115,22 @@ intr_computeipl()
*/
switch (isr->isr_priority) {
case IPL_BIO:
if (ipl > PSLTOIPL(hp300_bioipl))
hp300_bioipl = IPLTOPSL(ipl);
if (ipl > PSLTOIPL(hp300_ipls[HP300_IPL_BIO]))
hp300_ipls[HP300_IPL_BIO] =
IPLTOPSL(ipl);
break;
case IPL_NET:
if (ipl > PSLTOIPL(hp300_netipl))
hp300_netipl = IPLTOPSL(ipl);
if (ipl > PSLTOIPL(hp300_ipls[HP300_IPL_NET]))
hp300_ipls[HP300_IPL_NET] =
IPLTOPSL(ipl);
break;
case IPL_TTY:
case IPL_TTYNOBUF:
if (ipl > PSLTOIPL(hp300_ttyipl))
hp300_ttyipl = IPLTOPSL(ipl);
if (ipl > PSLTOIPL(hp300_ipls[HP300_IPL_TTY]))
hp300_ipls[HP300_IPL_TTY] =
IPLTOPSL(ipl);
break;
default:
@ -134,14 +144,14 @@ intr_computeipl()
* Enforce `bio <= net <= tty <= imp'
*/
if (hp300_netipl < hp300_bioipl)
hp300_netipl = hp300_bioipl;
if (hp300_ipls[HP300_IPL_NET] < hp300_ipls[HP300_IPL_BIO])
hp300_ipls[HP300_IPL_NET] = hp300_ipls[HP300_IPL_BIO];
if (hp300_ttyipl < hp300_netipl)
hp300_ttyipl = hp300_netipl;
if (hp300_ipls[HP300_IPL_TTY] < hp300_ipls[HP300_IPL_NET])
hp300_ipls[HP300_IPL_TTY] = hp300_ipls[HP300_IPL_NET];
if (hp300_impipl < hp300_ttyipl)
hp300_impipl = hp300_ttyipl;
if (hp300_ipls[HP300_IPL_IMP] < hp300_ipls[HP300_IPL_TTY])
hp300_ipls[HP300_IPL_IMP] = hp300_ipls[HP300_IPL_TTY];
}
void
@ -150,12 +160,14 @@ intr_printlevels()
#ifdef DEBUG
printf("psl: bio = 0x%x, net = 0x%x, tty = 0x%x, imp = 0x%x\n",
hp300_bioipl, hp300_netipl, hp300_ttyipl, hp300_impipl);
hp300_ipls[HP300_IPL_BIO], hp300_ipls[HP300_IPL_NET],
hp300_ipls[HP300_IPL_TTY], hp300_ipls[HP300_IPL_IMP]);
#endif
printf("interrupt levels: bio = %d, net = %d, tty = %d\n",
PSLTOIPL(hp300_bioipl), PSLTOIPL(hp300_netipl),
PSLTOIPL(hp300_ttyipl));
PSLTOIPL(hp300_ipls[HP300_IPL_BIO]),
PSLTOIPL(hp300_ipls[HP300_IPL_NET]),
PSLTOIPL(hp300_ipls[HP300_IPL_TTY]));
}
/*

View File

@ -1,7 +1,7 @@
/* $NetBSD: intr.h,v 1.5 1999/06/15 15:26:34 kleink Exp $ */
/* $NetBSD: intr.h,v 1.6 1999/08/01 21:50:17 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -127,31 +127,34 @@ struct isr {
#define spl7() _spl(PSL_S|PSL_IPL7)
/*
* These four globals contain the appropriate PSL_S|PSL_IPL? values
* This array contains the appropriate PSL_S|PSL_IPL? values
* to raise interrupt priority to the requested level.
*/
extern unsigned short hp300_bioipl;
extern unsigned short hp300_netipl;
extern unsigned short hp300_ttyipl;
extern unsigned short hp300_impipl;
extern unsigned short hp300_ipls[];
#define HP300_IPL_SOFT 0
#define HP300_IPL_BIO 1
#define HP300_IPL_NET 2
#define HP300_IPL_TTY 3
#define HP300_IPL_IMP 4
#define HP300_IPL_CLOCK 5
#define HP300_IPL_HIGH 6
#define HP300_NIPLS 7
/* These spl calls are _not_ to be used by machine-independent code. */
#define splhil() _splraise(PSL_S|PSL_IPL1)
#define splkbd() splhil()
#define splsoft() spl1()
/* These spl calls are used by machine-independent code. */
#define splsoftclock() splsoft()
#define splsoftnet() splsoft()
#define splbio() _splraise(hp300_bioipl)
#define splnet() _splraise(hp300_netipl)
#define spltty() _splraise(hp300_ttyipl)
#define splimp() _splraise(hp300_impipl)
#define splsoftclock() spl1() /* will lower interrupt level */
#define splsoftnet() _splraise(PSL_S|PSL_IPL1)
#define splbio() _splraise(hp300_ipls[HP300_IPL_BIO])
#define splnet() _splraise(hp300_ipls[HP300_IPL_NET])
#define spltty() _splraise(hp300_ipls[HP300_IPL_TTY])
#define splimp() _splraise(hp300_ipls[HP300_IPL_IMP])
#define splclock() spl6()
#define splstatclock() spl6()
#define splvm() spl6()
#define splstatclock() splclock()
#define splhigh() spl7()
#define splsched() spl7()
/* watch out for side effects */
#define splx(s) ((s) & PSL_IPL ? _spl((s)) : spl0())