summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-11-09 12:01:20 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-11-09 12:01:20 +0000
commit47db0f7b2d3819322b8d8427de20961346cd590b (patch)
treefa4ed4f6107e951ecb7a0dcd20887cba347e22a4 /sys
parente351cf3763d798f6dadc5523086021fc381bee33 (diff)
Split {get,set,raise}ipl() into per-board implementations.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme88k/include/cpu.h6
-rw-r--r--sys/arch/mvme88k/mvme88k/m187_machdep.c38
-rw-r--r--sys/arch/mvme88k/mvme88k/m188_machdep.c44
-rw-r--r--sys/arch/mvme88k/mvme88k/m197_machdep.c39
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c67
5 files changed, 125 insertions, 69 deletions
diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h
index 680ccb073c8..34394f553d2 100644
--- a/sys/arch/mvme88k/include/cpu.h
+++ b/sys/arch/mvme88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.31 2004/11/08 16:39:31 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.32 2004/11/09 12:01:16 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -46,9 +46,11 @@
#ifdef _KERNEL
/* board dependent pointers */
-extern volatile u_int8_t *md_intr_mask;
extern void (*md_interrupt_func_ptr)(u_int, struct trapframe *);
#define md_interrupt_func (*md_interrupt_func_ptr)
+extern u_int (*md_getipl)(void);
+extern u_int (*md_setipl)(u_int);
+extern u_int (*md_raiseipl)(u_int);
extern void (*md_init_clocks)(void);
struct intrhand {
diff --git a/sys/arch/mvme88k/mvme88k/m187_machdep.c b/sys/arch/mvme88k/mvme88k/m187_machdep.c
index e915dc87017..916f9ad275c 100644
--- a/sys/arch/mvme88k/mvme88k/m187_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m187_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m187_machdep.c,v 1.2 2004/11/08 16:39:31 miod Exp $ */
+/* $OpenBSD: m187_machdep.c,v 1.3 2004/11/09 12:01:19 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -64,7 +64,10 @@
void m187_bootstrap(void);
void m187_ext_int(u_int, struct trapframe *);
+u_int m187_getipl(void);
vaddr_t m187_memsize(void);
+u_int m187_raiseipl(u_int);
+u_int m187_setipl(u_int);
void m187_setupiackvectors(void);
void m187_startup(void);
@@ -157,7 +160,7 @@ m187_ext_int(u_int v, struct trapframe *eframe)
u_char vec;
/* get level and mask */
- mask = *md_intr_mask & 0x07;
+ mask = *(u_int8_t *)M187_IMASK & 0x07;
level = *(u_int8_t *)M187_ILEVEL & 0x07;
#ifdef DIAGNOSTIC
@@ -254,6 +257,33 @@ m187_ext_int(u_int v, struct trapframe *eframe)
setipl(mask);
}
+u_int
+m187_getipl(void)
+{
+ return *(u_int8_t *)M187_IMASK & 0x07;
+}
+
+u_int
+m187_setipl(u_int level)
+{
+ unsigned curspl;
+
+ curspl = *(u_int8_t *)M187_IMASK & 0x07;
+ *(u_int8_t *)M187_IMASK = level;
+ return curspl;
+}
+
+u_int
+m187_raiseipl(u_int level)
+{
+ unsigned curspl;
+
+ curspl = *(u_int8_t *)M187_IMASK & 0x07;
+ if (curspl < level)
+ *(u_int8_t *)M187_IMASK = level;
+ return curspl;
+}
+
void
m187_bootstrap()
{
@@ -261,5 +291,7 @@ m187_bootstrap()
cmmu = &cmmu8820x;
md_interrupt_func_ptr = &m187_ext_int;
- md_intr_mask = (u_int8_t *)M187_IMASK;
+ md_getipl = &m187_getipl;
+ md_setipl = &m187_setipl;
+ md_raiseipl = &m187_raiseipl;
}
diff --git a/sys/arch/mvme88k/mvme88k/m188_machdep.c b/sys/arch/mvme88k/mvme88k/m188_machdep.c
index 55759d3f14a..40ff1a5704f 100644
--- a/sys/arch/mvme88k/mvme88k/m188_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m188_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m188_machdep.c,v 1.2 2004/11/08 16:39:31 miod Exp $ */
+/* $OpenBSD: m188_machdep.c,v 1.3 2004/11/09 12:01:19 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -66,11 +66,13 @@
void m188_reset(void);
u_int safe_level(u_int mask, u_int curlevel);
-void setlevel(unsigned int);
void m188_bootstrap(void);
void m188_ext_int(u_int, struct trapframe *);
+u_int m188_getipl(void);
vaddr_t m188_memsize(void);
+u_int m188_raiseipl(u_int);
+u_int m188_setipl(u_int);
void m188_setupiackvectors(void);
void m188_startup(void);
@@ -151,6 +153,9 @@ m188_bootstrap()
cmmu = &cmmu8820x;
md_interrupt_func_ptr = &m188_ext_int;
+ md_getipl = &m188_getipl;
+ md_setipl = &m188_setipl;
+ md_raiseipl = &m188_raiseipl;
/* clear and disable all interrupts */
*int_mask_reg[0] = 0;
@@ -222,19 +227,46 @@ safe_level(u_int mask, u_int curlevel)
/* NOTREACHED */
}
-void
-setlevel(unsigned int level)
+u_int
+m188_getipl(void)
{
- unsigned int mask;
+ return m188_curspl[cpu_number()];
+}
+
+u_int
+m188_setipl(u_int level)
+{
+ u_int mask, curspl;
int cpu = cpu_number();
- mask = int_mask_val[level];
+ curspl = m188_curspl[cpu];
+ mask = int_mask_val[level];
if (cpu != master_cpu)
mask &= SLAVE_MASK;
*int_mask_reg[cpu] = mask;
m188_curspl[cpu] = level;
+
+ return curspl;
+}
+
+u_int
+m188_raiseipl(u_int level)
+{
+ u_int mask, curspl;
+ int cpu = cpu_number();
+
+ curspl = m188_curspl[cpu];
+ if (curspl < level) {
+ mask = int_mask_val[level];
+ if (cpu != master_cpu)
+ mask &= SLAVE_MASK;
+
+ *int_mask_reg[cpu] = mask;
+ m188_curspl[cpu] = level;
+ }
+ return curspl;
}
/*
diff --git a/sys/arch/mvme88k/mvme88k/m197_machdep.c b/sys/arch/mvme88k/mvme88k/m197_machdep.c
index a39f23d5ce3..30c887d85bc 100644
--- a/sys/arch/mvme88k/mvme88k/m197_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m197_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m197_machdep.c,v 1.2 2004/11/08 16:39:31 miod Exp $ */
+/* $OpenBSD: m197_machdep.c,v 1.3 2004/11/09 12:01:19 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -63,7 +63,10 @@
void m197_bootstrap(void);
void m197_ext_int(u_int, struct trapframe *);
+u_int m197_getipl(void);
vaddr_t m197_memsize(void);
+u_int m197_raiseipl(u_int);
+u_int m197_setipl(u_int);
void m197_setupiackvectors(void);
void m197_startup(void);
@@ -173,7 +176,7 @@ m197_ext_int(u_int v, struct trapframe *eframe)
u_char vec;
/* get src and mask */
- mask = *md_intr_mask & 0x07;
+ mask = *(u_int8_t *)M197_IMASK & 0x07;
src = *(u_int8_t *)M197_ISRC;
if (v == T_NON_MASK) {
@@ -268,6 +271,33 @@ m197_ext_int(u_int v, struct trapframe *eframe)
}
}
+u_int
+m197_getipl(void)
+{
+ return *(u_int8_t *)M197_IMASK & 0x07;
+}
+
+u_int
+m197_setipl(u_int level)
+{
+ u_int curspl;
+
+ curspl = *(u_int8_t *)M197_IMASK & 0x07;
+ *(u_int8_t *)M197_IMASK = level;
+ return curspl;
+}
+
+u_int
+m197_raiseipl(u_int level)
+{
+ u_int curspl;
+
+ curspl = *(u_int8_t *)M197_IMASK & 0x07;
+ if (curspl < level)
+ *(u_int8_t *)M197_IMASK = level;
+ return curspl;
+}
+
void
m197_bootstrap()
{
@@ -276,6 +306,9 @@ m197_bootstrap()
cmmu = &cmmu88110;
md_interrupt_func_ptr = &m197_ext_int;
- md_intr_mask = (u_char *)M197_IMASK;
+ md_getipl = &m197_getipl;
+ md_setipl = &m197_setipl;
+ md_raiseipl = &m197_raiseipl;
+
set_tcfp(); /* Set Time Critical Floating Point Mode */
}
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index 7e7a06acaec..17be696f5a6 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.160 2004/11/08 16:39:31 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.161 2004/11/09 12:01:19 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -140,9 +140,11 @@ intrhand_t intr_handlers[NVMEINTR];
vaddr_t interrupt_stack[MAX_CPUS];
/* board dependent pointers */
-volatile u_int8_t *md_intr_mask;
void (*md_interrupt_func_ptr)(u_int, struct trapframe *);
void (*md_init_clocks)(void);
+u_int (*md_getipl)(void);
+u_int (*md_setipl)(u_int);
+u_int (*md_raiseipl)(u_int);
volatile u_int8_t *ivec[8];
@@ -1325,24 +1327,11 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list)
unsigned
getipl(void)
{
- unsigned curspl;
+ u_int curspl;
m88k_psr_type psr;
psr = disable_interrupts_return_psr();
- switch (brdtyp) {
-#ifdef MVME188
- case BRD_188:
- curspl = m188_curspl[cpu_number()];
- break;
-#endif /* MVME188 */
-#if defined(MVME187) || defined(MVME197)
- case BRD_187:
- case BRD_8120:
- case BRD_197:
- curspl = *md_intr_mask & 0x07;
- break;
-#endif /* defined(MVME187) || defined(MVME197) */
- }
+ curspl = (*md_getipl)();
set_psr(psr);
return curspl;
}
@@ -1350,29 +1339,14 @@ getipl(void)
unsigned
setipl(unsigned level)
{
- unsigned curspl;
+ u_int curspl;
m88k_psr_type psr;
psr = disable_interrupts_return_psr();
- switch (brdtyp) {
-#ifdef MVME188
- case BRD_188:
- curspl = m188_curspl[cpu_number()];
- setlevel(level);
- break;
-#endif /* MVME188 */
-#if defined(MVME187) || defined(MVME197)
- case BRD_187:
- case BRD_8120:
- case BRD_197:
- curspl = *md_intr_mask & 0x07;
- *md_intr_mask = level;
- break;
-#endif /* defined(MVME187) || defined(MVME197) */
- }
+ curspl = (*md_setipl)(level);
/*
- * The flush pipeline is required to make sure the above write gets
+ * The flush pipeline is required to make sure the above change gets
* through the data pipe and to the hardware; otherwise, the next
* bunch of instructions could execute at the wrong spl protection.
*/
@@ -1385,31 +1359,14 @@ setipl(unsigned level)
unsigned
raiseipl(unsigned level)
{
- unsigned curspl;
+ u_int curspl;
m88k_psr_type psr;
psr = disable_interrupts_return_psr();
- switch (brdtyp) {
-#ifdef MVME188
- case BRD_188:
- curspl = m188_curspl[cpu_number()];
- if (curspl < level)
- setlevel(level);
- break;
-#endif /* MVME188 */
-#if defined(MVME187) || defined(MVME197)
- case BRD_187:
- case BRD_8120:
- case BRD_197:
- curspl = *md_intr_mask & 0x07;
- if (curspl < level)
- *md_intr_mask = level;
- break;
-#endif /* defined(MVME187) || defined(MVME197) */
- }
+ curspl = (*md_raiseipl)(level);
/*
- * The flush pipeline is required to make sure the above write gets
+ * The flush pipeline is required to make sure the above change gets
* through the data pipe and to the hardware; otherwise, the next
* bunch of instructions could execute at the wrong spl protection.
*/