diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-11-18 22:53:12 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-11-18 22:53:12 +0000 |
commit | 6edf1a7eaa74b5c92be3add1eac9be0e4ea36476 (patch) | |
tree | 846db130ce812efd29b8766bdffa0a8e66eb7d7d /sys | |
parent | 93b36526335612f21cd26108ef85345caae50e9e (diff) |
Rework the PFSR register analysis code on mvme88k: split it into four
independent subfunctions, turn PFSR_SAVE into a couple of NOP, and replace
them early at runtime with a branch to the selected routine, which will
return to pfsr_save.
This is really better for 188 systems.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/m88k/m88k/eh_common.S | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/mvme187.h | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/mvme188.h | 8 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/eh.S | 80 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m8820x.c | 47 |
5 files changed, 68 insertions, 77 deletions
diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S index 64660c92e1e..eceaaacbcd0 100644 --- a/sys/arch/m88k/m88k/eh_common.S +++ b/sys/arch/m88k/m88k/eh_common.S @@ -1,4 +1,4 @@ -/* $OpenBSD: eh_common.S,v 1.19 2006/05/14 08:37:39 miod Exp $ */ +/* $OpenBSD: eh_common.S,v 1.20 2006/11/18 22:53:07 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -1076,7 +1076,7 @@ ASLOCAL(m88100_have_pcb) * Save Pbus fault status register from data and inst CMMU. * We can afford calling a function since r1 is safe to use here. */ -ASLOCAL(pfsr_save) +GLOBAL(pfsr_save) PFSR_SAVE ASLOCAL(pfsr_done) diff --git a/sys/arch/mvme88k/include/mvme187.h b/sys/arch/mvme88k/include/mvme187.h index 3e3c6f7f12a..f6e3e031bff 100644 --- a/sys/arch/mvme88k/include/mvme187.h +++ b/sys/arch/mvme88k/include/mvme187.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mvme187.h,v 1.8 2006/04/27 20:21:19 miod Exp $ */ +/* $OpenBSD: mvme187.h,v 1.9 2006/11/18 22:53:11 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1999 Steve Murphree, Jr. @@ -63,4 +63,8 @@ #define MEM_CTLR 0xfff43000 /* MEMC040 mem controller */ +#if defined(_KERNEL) && !defined(_LOCORE) +extern u_int32_t pfsr_save_187[]; +#endif + #endif /* __MACHINE_MVME187_H__ */ diff --git a/sys/arch/mvme88k/include/mvme188.h b/sys/arch/mvme88k/include/mvme188.h index 6920d30d8ca..3f06ba62e3e 100644 --- a/sys/arch/mvme88k/include/mvme188.h +++ b/sys/arch/mvme88k/include/mvme188.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mvme188.h,v 1.27 2006/06/11 13:30:44 miod Exp $ */ +/* $OpenBSD: mvme188.h,v 1.28 2006/11/18 22:53:11 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * All rights reserved. @@ -286,4 +286,10 @@ #define VME_CMMU_D2 0xfff3f000 #define VME_CMMU_D3 0xfff7f000 +#if defined(_KERNEL) && !defined(_LOCORE) +extern u_int32_t pfsr_save_188_straight[]; +extern u_int32_t pfsr_save_188_double[]; +extern u_int32_t pfsr_save_188_quad[]; +#endif + #endif /* __MACHINE_MVME188_H__ */ diff --git a/sys/arch/mvme88k/mvme88k/eh.S b/sys/arch/mvme88k/mvme88k/eh.S index 02b0a1fa3c4..a307e71a4be 100644 --- a/sys/arch/mvme88k/mvme88k/eh.S +++ b/sys/arch/mvme88k/mvme88k/eh.S @@ -1,4 +1,4 @@ -/* $OpenBSD: eh.S,v 1.64 2006/04/17 16:08:01 miod Exp $ */ +/* $OpenBSD: eh.S,v 1.65 2006/11/18 22:53:11 miod Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat * @@ -29,73 +29,41 @@ /* * Save Pbus fault status register from data and inst CMMU. * - * PFSR_SAVE is invoked with TMP, TMP2 and TMP3 available, and TMP contains + * Handlers are invoked with TMP, TMP2 and TMP3 available, and TMP contains * curcpu(). */ -/* - * Single-processor SBC version (MVME187, MVME8120) - */ +#define PFSR_SAVE \ + NOP; /* will be changed to br.n pfsr_handler + 4*/ \ + NOP /* will be changed to first instruction of pfsr_handler */ -#ifdef MVME187 -#include <machine/mvme187.h> -#define PFSR_SAVE_187 \ - ld TMP2, TMP, CI_PFSR_I0; \ - ld TMP3, TMP2, r0; \ - st TMP3, r31, REG_OFF(EF_IPFSR); \ - ld TMP2, TMP, CI_PFSR_D0; \ - ld TMP3, TMP2, r0; \ - st TMP3, r31, REG_OFF(EF_DPFSR); -#else -#define PFSR_SAVE_187 -#endif +#include <m88k/m88k/eh_common.S> +#ifdef MVME187 /* - * MVME188 version (see pfsr188 below) + * Single-processor SBC version (MVME187, MVME8120) */ -#ifdef MVME188 -#define PFSR_SAVE_188 \ - br _ASM_LABEL(pfsr188); -#else -#define PFSR_SAVE_188 -#endif +#include <machine/mvme187.h> -#if defined(MVME187) && defined(MVME188) -#define PFSR_SAVE \ - /* check if it's a mvme188 */ \ - or.u TMP3, r0, hi16(_C_LABEL(brdtyp)); \ - ld TMP2, TMP3, lo16(_C_LABEL(brdtyp)); \ - cmp TMP3, TMP2, BRD_188; \ - bb1 eq, TMP3, _ASM_LABEL(pfsr188); \ - PFSR_SAVE_187 -#else -#define PFSR_SAVE \ - PFSR_SAVE_188 \ - PFSR_SAVE_187 +ENTRY(pfsr_save_187) + ld TMP2, TMP, CI_PFSR_I0 + ld TMP3, TMP2, r0 + st TMP3, r31, REG_OFF(EF_IPFSR) + ld TMP2, TMP, CI_PFSR_D0 + ld TMP3, TMP2, r0 + br.n _ASM_LABEL(pfsr_done) + st TMP3, r31, REG_OFF(EF_DPFSR) #endif -#include <m88k/m88k/eh_common.S> - #ifdef MVME188 -#include <machine/mvme188.h> /* - * Handling faults can be very tricky, as it is necessary to check all - * the CMMUs of the faulting processor. - * - * This implementation tries to favor, speedwise, simple (2 CMMUs per CPU) - * configurations over any other configuration. + * MVME188 versions */ - text -ASLOCAL(pfsr188) - or.u TMP2, r0, hi16(_C_LABEL(cmmu_shift)) - ld TMP2, TMP2, lo16(_C_LABEL(cmmu_shift)) - cmp TMP3, TMP2, 2 - bb1 lt, TMP3, _ASM_LABEL(pfsr188_straight) - bb1 eq, TMP2, _ASM_LABEL(pfsr188_double) +#include <machine/mvme188.h> -ASLOCAL(pfsr188_quad) +ENTRY(pfsr_save_188_quad) /* * We're in configuration 2 (1 CPU, 8 CMMU). * @@ -157,7 +125,7 @@ ASLOCAL(pfsr188_quad) br.n _ASM_LABEL(pfsr_done) st TMP2, r31, REG_OFF(EF_DPFSR) -ASLOCAL(pfsr188_double) +ENTRY(pfsr_save_188_double) /* * 4 CMMUs per CPU. Almost as simple as the 2 CMMUs per CPU * situation... @@ -166,7 +134,6 @@ ASLOCAL(pfsr188_double) * exceptions, we have to reset the fault status registers * after reading them. */ - ld TMP2, TMP, CI_PFSR_I0 ld TMP2, TMP2, r0 extu TMP3, TMP2, 3<16> @@ -190,7 +157,7 @@ ASLOCAL(pfsr188_double) br.n _ASM_LABEL(pfsr_done) st TMP2, r31, REG_OFF(EF_DPFSR) -ASLOCAL(pfsr188_straight) +ENTRY(pfsr_save_188_straight) /* * We have the simple 2 CMMUs per CPU mapping. Pick our couple; * no need to reset fault status registers in this case. @@ -203,4 +170,5 @@ ASLOCAL(pfsr188_straight) ld TMP3, TMP2, r0 br.n _ASM_LABEL(pfsr_done) st TMP3, r31, REG_OFF(EF_DPFSR) -#endif + +#endif /* MVME188 */ diff --git a/sys/arch/mvme88k/mvme88k/m8820x.c b/sys/arch/mvme88k/mvme88k/m8820x.c index 76fdbfab95b..6c743d98ada 100644 --- a/sys/arch/mvme88k/mvme88k/m8820x.c +++ b/sys/arch/mvme88k/mvme88k/m8820x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x.c,v 1.46 2006/05/08 14:36:10 miod Exp $ */ +/* $OpenBSD: m8820x.c,v 1.47 2006/11/18 22:53:11 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -55,23 +55,24 @@ const struct board_config { int ncpus; int ncmmus; + u_int32_t *pfsr; } bd_config[16] = { - { 4, 8 }, /* 4P128 - 4P512 */ - { 2, 8 }, /* 2P128 - 2P512 */ - { 1, 8 }, /* 1P128 - 1P512 */ - { 0, 0 }, - { 0, 0 }, - { 2, 4 }, /* 2P64 - 2P256 */ - { 1, 4 }, /* 1P64 - 1P256 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 1, 2 }, /* 1P32 - 1P128 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } + { 4, 8, pfsr_save_188_straight }, /* 4P128 - 4P512 */ + { 2, 8, pfsr_save_188_double }, /* 2P128 - 2P512 */ + { 1, 8, pfsr_save_188_quad }, /* 1P128 - 1P512 */ + { 0, 0, NULL }, + { 0, 0, NULL }, + { 2, 4, pfsr_save_188_straight }, /* 2P64 - 2P256 */ + { 1, 4, pfsr_save_188_double }, /* 1P64 - 1P256 */ + { 0, 0, NULL }, + { 0, 0, NULL }, + { 0, 0, NULL }, + { 1, 2, pfsr_save_188_straight }, /* 1P32 - 1P128 */ + { 0, 0, NULL }, + { 0, 0, NULL }, + { 0, 0, NULL }, + { 0, 0, NULL }, + { 0, 0, NULL } }; #endif @@ -81,9 +82,11 @@ const struct board_config { void m8820x_setup_board_config() { + extern u_int32_t pfsr_save[]; struct m8820x_cmmu *cmmu; int num, cmmu_num; int vme188_config; + u_int32_t *m8820x_pfsr; #ifdef MVME188 u_int32_t whoami; #endif @@ -99,6 +102,7 @@ m8820x_setup_board_config() max_cpus = 1; max_cmmus = 2; cmmu_shift = 1; + m8820x_pfsr = pfsr_save_187; break; #endif /* MVME187 */ #ifdef MVME188 @@ -115,6 +119,7 @@ m8820x_setup_board_config() m8820x_cmmu[7].cmmu_regs = (void *)VME_CMMU_D3; max_cpus = bd_config[vme188_config].ncpus; max_cmmus = bd_config[vme188_config].ncmmus; + m8820x_pfsr = bd_config[vme188_config].pfsr; cmmu_shift = ff1(max_cmmus / max_cpus); break; #endif /* MVME188 */ @@ -134,6 +139,14 @@ m8820x_setup_board_config() } #endif + /* + * Patch the exception handling code to invoke the correct pfsr + * analysis chunk. + */ + pfsr_save[0] = 0xc4000000 | + (((vaddr_t)m8820x_pfsr + 4 - (vaddr_t)pfsr_save) >> 2); + pfsr_save[1] = m8820x_pfsr[0]; + #ifdef DEBUG /* * Check CMMU type |