diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-05-19 15:47:19 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-05-19 15:47:19 +0000 |
commit | 912729879adc44cafe45c930dcbb3a9ffb07ea0e (patch) | |
tree | 3d7c5b8346eda80ec16a5da0730dbc7a4e797d06 /sys/arch | |
parent | 8147b2a17ca7e17fc4ab11db63dabb77b937d360 (diff) |
Implement splassert for armish and zaurus.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/xscale/i80321_intr.c | 19 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_intr.c | 21 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_intr.h | 21 | ||||
-rw-r--r-- | sys/arch/armish/include/armish_intr.h | 19 |
4 files changed, 73 insertions, 7 deletions
diff --git a/sys/arch/arm/xscale/i80321_intr.c b/sys/arch/arm/xscale/i80321_intr.c index 1bedbfdb2b9..0ab42780968 100644 --- a/sys/arch/arm/xscale/i80321_intr.c +++ b/sys/arch/arm/xscale/i80321_intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i80321_intr.c,v 1.10 2007/05/09 19:24:54 miod Exp $ */ +/* $OpenBSD: i80321_intr.c,v 1.11 2007/05/19 15:47:16 miod Exp $ */ /* * Copyright (c) 2006 Dale Rahn <drahn@openbsd.org> @@ -399,3 +399,20 @@ i80321_irq_handler(void *arg) if(softint_pending & i80321intc_smask[current_ipl_level]) i80321intc_do_pending(); } + +#ifdef DIAGNOSTIC +void +i80321_splassert_check(int wantipl, const char *func) +{ + int oldipl = current_ipl_level; + + if (oldipl < wantipl) { + splassert_fail(wantipl, oldipl, func); + /* + * If the splassert_ctl is set to not panic, raise the ipl + * in a feeble attempt to reduce damage. + */ + i80321intc_setipl(wantipl); + } +} +#endif diff --git a/sys/arch/arm/xscale/pxa2x0_intr.c b/sys/arch/arm/xscale/pxa2x0_intr.c index 5e9aafb3c28..31f2609842f 100644 --- a/sys/arch/arm/xscale/pxa2x0_intr.c +++ b/sys/arch/arm/xscale/pxa2x0_intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_intr.c,v 1.14 2006/12/14 05:02:29 niallo Exp $ */ +/* $OpenBSD: pxa2x0_intr.c,v 1.15 2007/05/19 15:47:16 miod Exp $ */ /* $NetBSD: pxa2x0_intr.c,v 1.5 2003/07/15 00:24:55 lukem Exp $ */ /* @@ -728,3 +728,22 @@ pxa2x0_intr_string(void *cookie) return irqstr; } + +#ifdef DIAGNOSTIC +void +pxa2x0_splassert_check(int wantipl, const char *func) +{ + int oldipl = current_spl_level, psw; + + if (oldipl < wantipl) { + splassert_fail(wantipl, oldipl, func); + /* + * If the splassert_ctl is set to not panic, raise the ipl + * in a feeble attempt to reduce damage. + */ + psw = disable_interrupts(I32_bit); + pxa2x0_setipl(wantipl); + restore_interrupts(psw); + } +} +#endif diff --git a/sys/arch/arm/xscale/pxa2x0_intr.h b/sys/arch/arm/xscale/pxa2x0_intr.h index 28285b796b4..589f97763d0 100644 --- a/sys/arch/arm/xscale/pxa2x0_intr.h +++ b/sys/arch/arm/xscale/pxa2x0_intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_intr.h,v 1.10 2007/05/15 05:26:44 miod Exp $ */ +/* $OpenBSD: pxa2x0_intr.h,v 1.11 2007/05/19 15:47:16 miod Exp $ */ /* $NetBSD: pxa2x0_intr.h,v 1.4 2003/07/05 06:53:08 dogcow Exp $ */ /* Derived from i80321_intr.h */ @@ -103,8 +103,23 @@ void *pxa2x0_intr_establish(int irqno, int level, int (*func)(void *), void pxa2x0_intr_disestablish(void *cookie); const char *pxa2x0_intr_string(void *cookie); -#endif /* ! _LOCORE */ +#ifdef DIAGNOSTIC +/* + * Although this function is implemented in MI code, it must be in this MD + * header because we don't want this header to include MI includes. + */ +void splassert_fail(int, int, const char *); +extern int splassert_ctl; +void pxa2x0_splassert_check(int, const char *); +#define splassert(__wantipl) do { \ + if (splassert_ctl > 0) { \ + pxa2x0_splassert_check(__wantipl, __func__); \ + } \ +} while (0) +#else +#define splassert(wantipl) do { /* nothing */ } while (0) +#endif -#define splassert(wantipl) do { /* nada */ } while (0) +#endif /* ! _LOCORE */ #endif /* _PXA2X0_INTR_H_ */ diff --git a/sys/arch/armish/include/armish_intr.h b/sys/arch/armish/include/armish_intr.h index 2bc4f4da2a8..62477bdaf18 100644 --- a/sys/arch/armish/include/armish_intr.h +++ b/sys/arch/armish/include/armish_intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: armish_intr.h,v 1.3 2007/05/15 05:26:44 miod Exp $ */ +/* $OpenBSD: armish_intr.h,v 1.4 2007/05/19 15:47:18 miod Exp $ */ /* $NetBSD: i80321_intr.h,v 1.4 2003/07/05 06:53:08 dogcow Exp $ */ /* @@ -95,7 +95,22 @@ void *i80321_intr_establish(int irqno, int level, int (*func)(void *), void i80321_intr_disestablish(void *cookie); const char *i80321_intr_string(void *cookie); -#define splassert(wantipl) do { /* nada */ } while (0) +#ifdef DIAGNOSTIC +/* + * Although this function is implemented in MI code, it must be in this MD + * header because we don't want this header to include MI includes. + */ +void splassert_fail(int, int, const char *); +extern int splassert_ctl; +void i80321_splassert_check(int, const char *); +#define splassert(__wantipl) do { \ + if (splassert_ctl > 0) { \ + i80321_splassert_check(__wantipl, __func__); \ + } \ +} while (0) +#else +#define splassert(wantipl) do { /* nothing */ } while (0) +#endif #endif /* ! _LOCORE */ |