summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-07-24 15:05:08 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-07-24 15:05:08 +0000
commitbc48413b8f891fc175285b6c385daca9e5e6ca18 (patch)
tree14f262fffcc4024ec695b43f73f57a82ed4e6e1a
parent777ec9519bb2d45f9a64117772bf1636f5a90a20 (diff)
intr_establish() and related defines are mvme88k-only, so move them back from
<m88k/cpu.h>, and simplify the return values while there.
-rw-r--r--sys/arch/m88k/include/cpu.h35
-rw-r--r--sys/arch/mvme88k/include/cpu.h64
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c24
3 files changed, 74 insertions, 49 deletions
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index 992d11f0cb5..fafb2ea1cff 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.2 2004/06/13 21:49:17 niklas Exp $ */
+/* $OpenBSD: cpu.h,v 1.3 2004/07/24 15:05:05 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -38,8 +38,8 @@
* SUCH DAMAGE.
*/
-#ifndef __MACHINE_CPU_H__
-#define __MACHINE_CPU_H__
+#ifndef __M88K_CPU_H__
+#define __M88K_CPU_H__
/*
* CTL_MACHDEP definitinos.
@@ -118,33 +118,6 @@ extern int want_resched; /* resched() was called */
*/
#define signotify(p) (want_ast = 1)
-struct intrhand {
- int (*ih_fn)(void *);
- void *ih_arg;
- int ih_ipl;
- int ih_wantframe;
- struct intrhand *ih_next;
-};
-
-int intr_establish(int vec, struct intrhand *);
-
-/*
- * return values for intr_establish()
- */
-
-#define INTR_EST_SUCC 0
-#define INTR_EST_BADVEC 1
-#define INTR_EST_BADIPL 2
-
-
-/*
- * There are 256 possible vectors on a MVME1x7 platform (including
- * onboard and VME vectors. Use intr_establish() to register a
- * handler for the given vector. vector number is used to index
- * into the intr_handlers[] table.
- */
-extern struct intrhand *intr_handlers[256];
-
/*
* switchframe - should be double word aligned.
*/
@@ -171,4 +144,4 @@ int badvaddr(vaddr_t, int);
void nmihand(void *);
#endif /* _KERNEL */
-#endif /* __MACHINE_CPU_H__ */
+#endif /* __M88K_CPU_H__ */
diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h
index b653013e02a..fa413df93ea 100644
--- a/sys/arch/mvme88k/include/cpu.h
+++ b/sys/arch/mvme88k/include/cpu.h
@@ -1,3 +1,63 @@
-/* $OpenBSD: cpu.h,v 1.27 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
+/* $OpenBSD: cpu.h,v 1.28 2004/07/24 15:05:07 miod Exp $ */
+/*
+ * Copyright (c) 1996 Nivas Madhur
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _MVME88K_CPU_H_
+#define _MVME88K_CPU_H_
+
#include <m88k/cpu.h>
+
+struct intrhand {
+ int (*ih_fn)(void *);
+ void *ih_arg;
+ int ih_ipl;
+ int ih_wantframe;
+ struct intrhand *ih_next;
+};
+
+int intr_establish(int vec, struct intrhand *);
+
+/*
+ * There are 256 possible vectors on a mvme88k platform (including
+ * onboard and VME vectors. Use intr_establish() to register a
+ * handler for the given vector. vector number is used to index
+ * into the intr_handlers[] table.
+ */
+extern struct intrhand *intr_handlers[256];
+
+#endif
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index af335572b2a..4350fe0cca7 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.145 2004/07/23 22:19:09 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.146 2004/07/24 15:05:07 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -1415,9 +1415,7 @@ intr_findvec(int start, int end, int skip)
}
/*
- * Insert ihand in the list of handlers at vector vec.
- * Return return different error codes for the different
- * errors and let the caller decide what to do.
+ * Try to insert ihand in the list of handlers for vector vec.
*/
int
intr_establish(int vec, struct intrhand *ihand)
@@ -1429,9 +1427,11 @@ intr_establish(int vec, struct intrhand *ihand)
panic("intr_establish: vec (0x%x) not between 0x00 and 0xff",
vec);
#endif /* DIAGNOSTIC */
- return (INTR_EST_BADVEC);
+ return (EINVAL);
}
+ ihand->ih_next = NULL;
+
if ((intr = intr_handlers[vec]) != NULL) {
if (intr->ih_ipl != ihand->ih_ipl) {
#if DIAGNOSTIC
@@ -1439,24 +1439,16 @@ intr_establish(int vec, struct intrhand *ihand)
"vec (0x%x) at ipl %x, but you want it at %x",
intr->ih_ipl, vec, ihand->ih_ipl);
#endif /* DIAGNOSTIC */
- return (INTR_EST_BADIPL);
+ return (EINVAL);
}
- /*
- * Go to the end of the chain
- */
while (intr->ih_next)
intr = intr->ih_next;
- }
-
- ihand->ih_next = 0;
-
- if (intr)
intr->ih_next = ihand;
- else
+ } else
intr_handlers[vec] = ihand;
- return (INTR_EST_SUCC);
+ return (0);
}
#ifdef MVME188