Unify splraiseipl(9) implementation among m68k ports as per

suggestion from isaki@ on port-m68k.

For sun68k (sun2, sun3 and sun3x):
- export ipl2psl_table[] and make it uint16_t
- make makeiplcookie(9) inline
- put PSL_S bit into ipl2psl_table[] rather than adding it in makeiplcookie(9)
This commit is contained in:
tsutsui 2008-06-15 07:23:26 +00:00
parent 7ff875bed5
commit 43a0e8e404
2 changed files with 20 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.18 2008/01/26 14:02:54 tsutsui Exp $ */
/* $NetBSD: intr.h,v 1.19 2008/06/15 07:23:26 tsutsui Exp $ */
/*
* Copyright (c) 2001 Matt Fredette.
@ -47,6 +47,7 @@
#define IPL_VM 5
#define IPL_SCHED 6
#define IPL_HIGH 7
#define NIPL 8
#define _IPL_SOFT_LEVEL1 1
#define _IPL_SOFT_LEVEL2 2
@ -57,13 +58,19 @@
#ifdef _KERNEL
extern int idepth;
extern const uint16_t ipl2psl_table[NIPL];
typedef int ipl_t;
typedef struct {
uint16_t _psl;
} ipl_cookie_t;
ipl_cookie_t makeiplcookie(ipl_t ipl);
static inline ipl_cookie_t
makeiplcookie(ipl_t ipl)
{
return (ipl_cookie_t){._psl = ipl2psl_table[ipl]};
}
static inline int
splraiseipl(ipl_cookie_t icookie)

View File

@ -1,4 +1,4 @@
/* $NetBSD: isr.c,v 1.21 2008/04/28 20:23:39 martin Exp $ */
/* $NetBSD: isr.c,v 1.22 2008/06/15 07:23:26 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.21 2008/04/28 20:23:39 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.22 2008/06/15 07:23:26 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -258,20 +258,13 @@ get_vector_entry(int entry)
return (void *)vector_table[entry];
}
static const int ipl2psl_table[] = {
[IPL_NONE] = PSL_IPL0,
[IPL_SOFTBIO] = PSL_IPL1,
[IPL_SOFTCLOCK] = PSL_IPL1,
[IPL_SOFTNET] = PSL_IPL1,
[IPL_SOFTSERIAL] = PSL_IPL3,
[IPL_VM] = PSL_IPL4,
[IPL_SCHED] = PSL_IPL6,
[IPL_HIGH] = PSL_IPL7,
const uint16_t ipl2psl_table[NIPL] = {
[IPL_NONE] = PSL_S | PSL_IPL0,
[IPL_SOFTBIO] = PSL_S | PSL_IPL1,
[IPL_SOFTCLOCK] = PSL_S | PSL_IPL1,
[IPL_SOFTNET] = PSL_S | PSL_IPL1,
[IPL_SOFTSERIAL] = PSL_S | PSL_IPL3,
[IPL_VM] = PSL_S | PSL_IPL4,
[IPL_SCHED] = PSL_S | PSL_IPL6,
[IPL_HIGH] = PSL_S | PSL_IPL7,
};
ipl_cookie_t
makeiplcookie(ipl_t ipl)
{
return (ipl_cookie_t){._psl = ipl2psl_table[ipl] | PSL_S};
}