diff options
28 files changed, 284 insertions, 454 deletions
diff --git a/sys/arch/mvme88k/include/board.h b/sys/arch/mvme88k/include/board.h index 23c754c0082..f0f55c4039d 100644 --- a/sys/arch/mvme88k/include/board.h +++ b/sys/arch/mvme88k/include/board.h @@ -1,4 +1,4 @@ -/* $OpenBSD: board.h,v 1.10 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: board.h,v 1.11 2001/08/26 14:31:07 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -53,13 +53,11 @@ * it'll be unsigned in both ANSI and traditional. */ #if defined(_LOCORE) -# define U(num) num +#define U(num) num +#elif defined(__STDC__) +#define U(num) num ## U #else -# if defined(__STDC__) -# define U(num) num ## U -# else -# define U(num) num/**/U -# endif +#define U(num) num/**/U #endif #define UDEFINED diff --git a/sys/arch/mvme88k/include/bug.h b/sys/arch/mvme88k/include/bug.h index fe99ff8a49c..ecc1a77212e 100644 --- a/sys/arch/mvme88k/include/bug.h +++ b/sys/arch/mvme88k/include/bug.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bug.h,v 1.6 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: bug.h,v 1.7 2001/08/26 14:31:07 miod Exp $ */ #ifndef __MACHINE_BUG_H__ #define __MACHINE_BUG_H__ #include <machine/bugio.h> @@ -8,7 +8,7 @@ struct bugenv { int dlun; int ipl; int ctlr; - int (*entry)(); + int (*entry) __P((void)); int cfgblk; char *argstart; char *argend; diff --git a/sys/arch/mvme88k/include/cmmu.h b/sys/arch/mvme88k/include/cmmu.h index 580a0106c40..8b07f9418c0 100644 --- a/sys/arch/mvme88k/include/cmmu.h +++ b/sys/arch/mvme88k/include/cmmu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmmu.h,v 1.4 2001/08/11 01:55:52 miod Exp $ */ +/* $OpenBSD: cmmu.h,v 1.5 2001/08/26 14:31:07 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -76,7 +76,7 @@ void show_apr(unsigned value); void show_sctr(unsigned value); #endif -#if DDB +#ifdef DDB void cmmu_show_translation(unsigned, unsigned, unsigned, int); void cmmu_cache_state(unsigned, unsigned); void show_cmmu_info(unsigned); @@ -87,17 +87,11 @@ void show_cmmu_info(unsigned); */ unsigned cmmu_cpu_number(void); -#if !DDB -static -#endif /* !DDB */ unsigned cmmu_remote_get(unsigned cpu, unsigned r, unsigned data); unsigned cmmu_get_idr(unsigned data); void cmmu_init(void); void cmmu_shutdown_now(void); void cmmu_parity_enable(void); -#if !DDB -static -#endif /* !DDB */ void setup_board_config(void); void setup_cmmu_config(void); void cmmu_dump_config(void); diff --git a/sys/arch/mvme88k/include/cpu_number.h b/sys/arch/mvme88k/include/cpu_number.h index 0410fef2390..6069dcaba1d 100644 --- a/sys/arch/mvme88k/include/cpu_number.h +++ b/sys/arch/mvme88k/include/cpu_number.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu_number.h,v 1.5 2001/07/04 08:09:23 niklas Exp $ */ +/* $OpenBSD: cpu_number.h,v 1.6 2001/08/26 14:31:07 miod Exp $ */ /* * Mach Operating System @@ -39,7 +39,7 @@ static unsigned cpu_number __P((void)); static __inline__ unsigned cpu_number(void) { register unsigned cpu; - extern int cputyp; + if (cputyp != CPU_188 || number_cpus == 1) return 0; __asm__ ("ldcr %0, cr18" : "=r" (cpu)); return (cpu & 3); diff --git a/sys/arch/mvme88k/include/db_machdep.h b/sys/arch/mvme88k/include/db_machdep.h index ba07441446e..ba53fc7d9c6 100644 --- a/sys/arch/mvme88k/include/db_machdep.h +++ b/sys/arch/mvme88k/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.11 2001/08/12 21:34:48 miod Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.12 2001/08/26 14:31:07 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -42,9 +42,9 @@ #include <vm/vm_param.h> -#define BKPT_SIZE (4) /* number of bytes in bkpt inst. */ -#define BKPT_INST (0xF000D082U) /* tb0, 0,r0, vector 132 */ -#define BKPT_SET(inst) (BKPT_INST) +#define BKPT_SIZE (4) /* number of bytes in bkpt inst. */ +#define BKPT_INST (0xF000D082U) /* tb0, 0,r0, vector 132 */ +#define BKPT_SET(inst) (BKPT_INST) /* Entry trap for the debugger - used for inline assembly breaks*/ #define ENTRY_ASM "tb0 0, r0, 132" diff --git a/sys/arch/mvme88k/include/disklabel.h b/sys/arch/mvme88k/include/disklabel.h index 60930ba691c..e484bf5e44f 100644 --- a/sys/arch/mvme88k/include/disklabel.h +++ b/sys/arch/mvme88k/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.8 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: disklabel.h,v 1.9 2001/08/26 14:31:07 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1995 Dale Rahn. @@ -120,4 +120,5 @@ struct cpu_disklabel { u_long magic2; u_char cfg_4[192]; }; + #endif /* __MACHINE_DISKLABEL_H__ */ diff --git a/sys/arch/mvme88k/include/exception_vectors.h b/sys/arch/mvme88k/include/exception_vectors.h index bda2211ee13..1b38329beb8 100644 --- a/sys/arch/mvme88k/include/exception_vectors.h +++ b/sys/arch/mvme88k/include/exception_vectors.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exception_vectors.h,v 1.8 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: exception_vectors.h,v 1.9 2001/08/26 14:31:07 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1991, 1992 Carnegie Mellon University @@ -165,7 +165,7 @@ /* vector 0x82 (#130) */ word break /* vector 0x83 (#131) */ word trace /* vector 0x84 (#132) */ word _entry -#if defined(RAW_PRINTF) && RAW_PRINTF +#if defined(RAW_PRINTF) /* vector 0x85 (#133) */ word user_raw_putstr /* for USER raw_printf() */ /* vector 0x85 (#134) */ word user_raw_xpr /* for USER raw_xpr() */ #endif diff --git a/sys/arch/mvme88k/include/intr.h b/sys/arch/mvme88k/include/intr.h index 4559c6be83f..3479240c8cd 100644 --- a/sys/arch/mvme88k/include/intr.h +++ b/sys/arch/mvme88k/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.2 2001/03/16 00:05:24 miod Exp $ */ +/* $OpenBSD: intr.h,v 1.3 2001/08/26 14:31:07 miod Exp $ */ /* * Copyright (C) 2000 Steve Murphree, Jr. * All rights reserved. @@ -84,7 +84,7 @@ extern int intrcnt[M88K_NIRQ]; #ifdef _KERNEL #ifndef _LOCORE unsigned setipl __P((unsigned level)); -#if DDB +#ifdef DDB unsigned db_setipl __P((unsigned level)); #endif int spl0 __P((void)); @@ -121,7 +121,7 @@ above... #define splx(x) ((x) ? setipl((x)) : spl0()) -#if DDB +#ifdef DDB #define db_splx(x) db_setipl((x)) #define db_splhigh() db_setipl(IPL_HIGH) #endif /* DDB */ diff --git a/sys/arch/mvme88k/include/locore.h b/sys/arch/mvme88k/include/locore.h index 13688c4295a..8ba4b5ccfce 100644 --- a/sys/arch/mvme88k/include/locore.h +++ b/sys/arch/mvme88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.9 2001/03/18 01:47:53 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.10 2001/08/26 14:31:07 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -37,6 +37,9 @@ void set_cpu_number __P((unsigned number)); void doboot __P((void)); int db_are_interrupts_disabled __P((void)); +void fubail __P((void)); +void subail __P((void)); + #if defined(MVME187) || defined(MVME188) int guarded_access __P((volatile unsigned char *address, unsigned len, u_char *vec)); @@ -51,8 +54,10 @@ void data_access_emulation __P((unsigned *eframe)); #endif #ifdef MVME188 unsigned int safe_level __P((unsigned mask, unsigned curlevel)); +#if 0 void block_obio_interrupt __P((unsigned mask)); void unblock_obio_interrupt __P((unsigned mask)); +#endif #endif unsigned spl __P((void)); unsigned getipl __P((void)); @@ -86,6 +91,8 @@ void sbc_ext_int __P((u_int v, struct m88100_saved_state *eframe)); /* eh.S */ +struct proc; +void proc_do_uret __P((struct proc *)); #if defined(MVME187) || defined(MVME188) void sigsys __P((void)); void sigtrap __P((void)); @@ -101,4 +108,8 @@ void m197_userbpt __P((void)); void m197_syscall_handler __P((void)); #endif +/* process.S */ +void savectx __P((struct pcb *)); +void switch_exit __P((struct proc *)); + #endif /* _MACHINE_LOCORE_H_ */ diff --git a/sys/arch/mvme88k/include/m88110.h b/sys/arch/mvme88k/include/m88110.h index 391b3aa2813..98403a34eeb 100644 --- a/sys/arch/mvme88k/include/m88110.h +++ b/sys/arch/mvme88k/include/m88110.h @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110.h,v 1.5 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: m88110.h,v 1.6 2001/08/26 14:31:07 miod Exp $ */ #ifndef __MACHINE_M88110_H__ #define __MACHINE_M88110_H__ @@ -115,23 +115,23 @@ * Prototypes from "mvme88k/mvme88k/m197_cmmu.c" */ +#ifdef DDB +void m197_cmmu_show_translation(unsigned, unsigned, unsigned, int); +void m197_cmmu_cache_state(unsigned, unsigned); +void m197_show_cmmu_info(unsigned); +#endif + #ifdef CMMU_DEBUG - void m197_show_apr(unsigned value); - void m197_show_sctr(unsigned value); +void m197_show_apr(unsigned value); +void m197_show_sctr(unsigned value); #endif unsigned m197_cmmu_cpu_number(void); -#if !DDB -static -#endif /* !DDB */ unsigned m197_cmmu_remote_get(unsigned cpu, unsigned r, unsigned data); unsigned m197_cmmu_get_idr(unsigned data); void m197_cmmu_init(void); void m197_cmmu_shutdown_now(void); void m197_cmmu_parity_enable(void); -#if !DDB -static -#endif /* !DDB */ void m197_setup_board_config(void); void m197_setup_cmmu_config(void); void m197_cmmu_dump_config(void); diff --git a/sys/arch/mvme88k/include/m882xx.h b/sys/arch/mvme88k/include/m882xx.h index 188d1403324..0bfc832e338 100644 --- a/sys/arch/mvme88k/include/m882xx.h +++ b/sys/arch/mvme88k/include/m882xx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: m882xx.h,v 1.7 2001/03/09 05:44:40 smurph Exp $ */ +/* $OpenBSD: m882xx.h,v 1.8 2001/08/26 14:31:07 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -135,30 +135,23 @@ /* * Prototypes from "mvme88k/mvme88k/m18x_cmmu.c" */ -#if DDB +#ifdef DDB void m18x_cmmu_show_translation(unsigned, unsigned, unsigned, int); void m18x_cmmu_cache_state(unsigned, unsigned); void m18x_show_cmmu_info(unsigned); #endif #ifdef CMMU_DEBUG - void m18x_show_apr(unsigned value); - void m18x_show_sctr(unsigned value); +void m18x_show_apr(unsigned value); +void m18x_show_sctr(unsigned value); #endif unsigned m18x_cmmu_cpu_number(void); -#if !DDB -static -#endif /* !DDB */ unsigned m18x_cmmu_remote_get(unsigned cpu, unsigned r, unsigned data); unsigned m18x_cmmu_get_idr(unsigned data); void m18x_cmmu_init(void); void m18x_cmmu_shutdown_now(void); void m18x_cmmu_parity_enable(void); -#if !DDB -static -#endif /* !DDB */ -int m18x_cmmu_alive(int mmu); void m18x_setup_board_config(void); void m18x_setup_cmmu_config(void); void m18x_cmmu_dump_config(void); diff --git a/sys/arch/mvme88k/include/mvme188.h b/sys/arch/mvme88k/include/mvme188.h index 5f8c06b0de2..4fd421e8b0b 100644 --- a/sys/arch/mvme88k/include/mvme188.h +++ b/sys/arch/mvme88k/include/mvme188.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mvme188.h,v 1.6 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: mvme188.h,v 1.7 2001/08/26 14:31:07 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * All rights reserved. @@ -52,13 +52,13 @@ */ #ifndef UDEFINED #if defined(_LOCORE) -# define U(num) num +#define U(num) num #else -# if defined(__STDC__) -# define U(num) num ## U -# else -# define U(num) num/**/U -# endif +#if defined(__STDC__) +#define U(num) num ## U +#else +#define U(num) num/**/U +#endif #endif #endif diff --git a/sys/arch/mvme88k/include/mvme1x7.h b/sys/arch/mvme88k/include/mvme1x7.h index 619bf8f9020..330520895f1 100644 --- a/sys/arch/mvme88k/include/mvme1x7.h +++ b/sys/arch/mvme88k/include/mvme1x7.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mvme1x7.h,v 1.5 2001/08/12 12:03:02 heko Exp $ */ +/* $OpenBSD: mvme1x7.h,v 1.6 2001/08/26 14:31:07 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1999 Steve Murphree, Jr. @@ -55,13 +55,13 @@ */ #ifndef UDEFINED #if defined(_LOCORE) -# define U(num) num +#define U(num) num #else -# if defined(__STDC__) -# define U(num) num ## U -# else -# define U(num) num/**/U -# endif +#if defined(__STDC__) +#define U(num) num ## U +#else +#define U(num) num/**/U +#endif #endif #endif diff --git a/sys/arch/mvme88k/include/stdarg.h b/sys/arch/mvme88k/include/stdarg.h index 0ab410d0d5a..2ee76471685 100644 --- a/sys/arch/mvme88k/include/stdarg.h +++ b/sys/arch/mvme88k/include/stdarg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdarg.h,v 1.4 2001/07/04 08:09:23 niklas Exp $ */ +/* $OpenBSD: stdarg.h,v 1.5 2001/08/26 14:31:07 miod Exp $ */ /* This file has local changes by MOTOROLA Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific) @@ -24,85 +24,7 @@ Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific) This is relevant only when building GCC with some other compiler. */ #include <stdarg.h> #else -#ifdef __clipper__ -#include <va-clipper.h> -#else -#ifdef __m88k__ #include <machine/va-m88k.h> -#else -#ifdef __i860__ -#include <va-i860.h> -#else -#ifdef __hppa__ -#include <va-pa.h> -#else -#ifdef __mips__ -#include <va-mips.h> -#else -#ifdef __sparc__ -#include <va-sparc.h> -#else -#ifdef __i960__ -#include <va-i960.h> -#else -#ifdef __alpha__ -#include <va-alpha.h> -#else - -/* Define __gnuc_va_list. */ - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST -#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) -typedef char *__gnuc_va_list; -#else -typedef void *__gnuc_va_list; -#endif -#endif - -/* Define the standard macros for the user, - if this invocation was from the user program. */ -#ifdef _STDARG_H - -/* Amount of space required in an argument list for an arg of type TYPE. - TYPE may alternatively be an expression whose type is used. */ - -#define __va_rounded_size(TYPE) \ - (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) - -#define va_start(AP, LASTARG) \ - (AP = ((__gnuc_va_list) __builtin_next_arg ())) - -#undef va_end -void va_end (__gnuc_va_list); /* Defined in libgcc.a */ -#define va_end(AP) - -/* We cast to void * and then to TYPE * because this avoids - a warning about increasing the alignment requirement. */ - -#if defined (__arm__) || defined (__i386__) || defined (__ns32000__) || defined (__vax__) -/* This is for little-endian machines; small args are padded upward. */ -#define va_arg(AP, TYPE) \ - (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ - *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) -#else /* big-endian */ -/* This is for big-endian machines; small args are padded downward. */ -#define va_arg(AP, TYPE) \ - (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ - *((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4 \ - ? sizeof (TYPE) \ - : __va_rounded_size (TYPE)))))) -#endif /* big-endian */ -#endif /* _STDARG_H */ - -#endif /* not alpha */ -#endif /* not i960 */ -#endif /* not sparc */ -#endif /* not mips */ -#endif /* not hppa */ -#endif /* not i860 */ -#endif /* not m88k */ -#endif /* not clipper */ #ifdef _STDARG_H /* Define va_list, if desired, from __gnuc_va_list. */ @@ -112,66 +34,16 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ but must not use that name. It should use the name __gnuc_va_list, which is safe because it is reserved for the implementation. */ -#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ -#undef _VA_LIST -#endif - #ifdef _BSD_VA_LIST_ #undef _BSD_VA_LIST_ #define _BSD_VA_LIST_ __gnuc_va_list #endif /* _BSD_VA_LIST_ */ -#ifdef __svr4__ -/* SVR4.2 uses _VA_LIST for an internal alias for va_list, - so we must avoid testing it and setting it here. - SVR4 uses _VA_LIST as a flag in stdarg.h, but we should - have no conflict with that. */ -#ifndef _VA_LIST_ -#define _VA_LIST_ -#ifdef __i860__ -#ifndef _VA_LIST -#define _VA_LIST va_list -#endif -#endif /* __i860__ */ -typedef __gnuc_va_list va_list; -#endif /* _VA_LIST_ */ -#else /* not __svr4__ */ - -/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. - But on BSD NET2 we must not test or define or undef it. - (Note that the comments in NET 2's ansi.h - are incorrect for _VA_LIST_--see stdio.h!) */ -#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) -/* The macro _VA_LIST is used in SCO Unix 3.2. */ -#ifndef _VA_LIST -/* The macro _VA_LIST_T_H is used in the Bull dpx2 */ -#ifndef _VA_LIST_T_H -#define _VA_LIST_T_H -#if !(defined (__BSD_NET2__) || defined (____386BSD____)) +#if !defined (_VA_LIST_) #define _VA_LIST_ -#endif -#define _VA_LIST typedef __gnuc_va_list va_list; -#endif /* not _VA_LIST_T_H */ -#endif /* not _VA_LIST */ #endif /* not _VA_LIST_ */ -#endif /* not __svr4__ */ - -#if defined(__cplusplus) && !defined(__GNUG__) - -/* This is added to work with AT&T C++. */ -extern "C" { - char *__builtin_next_arg(void); - __gnuc_va_list *__builtin_saveregs(void); - void *__builtin_saveregs2(int); - int *__builtin_argptr(void); - int __builtin_argsize(void); - int __builtin_classify_type(...); - int __alignof__(...); -} -#endif - #endif /* _STDARG_H */ #endif /* __GNUC__ */ diff --git a/sys/arch/mvme88k/include/va-m88k.h b/sys/arch/mvme88k/include/va-m88k.h index af08e572cfc..8033d9ebcf8 100644 --- a/sys/arch/mvme88k/include/va-m88k.h +++ b/sys/arch/mvme88k/include/va-m88k.h @@ -1,4 +1,4 @@ -/* $OpenBSD: va-m88k.h,v 1.4 2001/07/04 08:09:23 niklas Exp $ */ +/* $OpenBSD: va-m88k.h,v 1.5 2001/08/26 14:31:07 miod Exp $ */ /* This file has local changes by MOTOROLA Thu Sep 9 09:06:29 CDT 1993 Dale Rahn (drahn@pacific) @@ -27,25 +27,11 @@ typedef struct #ifdef _STDARG_H /* stdarg.h support */ -#if __GNUC__ > 1 /* GCC 2.0 and beyond */ #define va_start(AP,LASTARG) ((AP) = *(__gnuc_va_list *)__builtin_saveregs()) -#else -#define va_start(AP,LASTARG) \ - ( (AP).__va_reg = (int *) __builtin_saveregs2(0), \ - (AP).__va_stk = (int *) __builtin_argptr(), \ - (AP).__va_arg = (int) (__builtin_argsize() + 3) / 4 ) -#endif #else /* varargs.h support */ -#if __GNUC__ > 1 /* GCC 2.0 and beyond */ #define va_start(AP) ((AP) = *(__gnuc_va_list *)__builtin_saveregs()) -#else -#define va_start(AP) \ - ( (AP).__va_reg = (int *) __builtin_saveregs2(1), \ - (AP).__va_stk = (int *) __builtin_argptr(), \ - (AP).__va_arg = (int) (__builtin_argsize() - 4 + 3) / 4 ) -#endif #define va_alist __va_1st_arg #define va_dcl register int va_alist; diff --git a/sys/arch/mvme88k/mvme88k/cmmu.c b/sys/arch/mvme88k/mvme88k/cmmu.c index 8c95a41cf21..215cd3d62c4 100644 --- a/sys/arch/mvme88k/mvme88k/cmmu.c +++ b/sys/arch/mvme88k/mvme88k/cmmu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmmu.c,v 1.11 2001/05/21 22:19:50 miod Exp $ */ +/* $OpenBSD: cmmu.c,v 1.12 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -60,10 +60,11 @@ #include <sys/param.h> #include <sys/types.h> #include <sys/simplelock.h> + #include <machine/board.h> +#include <machine/cmmu.h> #include <machine/cpus.h> #include <machine/cpu_number.h> -#include <machine/cmmu.h> #if defined(MVME187) || defined(MVME188) #include <machine/m882xx.h> #endif /* defined(MVME187) || defined(MVME188) */ @@ -86,7 +87,6 @@ unsigned cache_policy = /*CACHE_INH*/ 0; unsigned cpu_sets[MAX_CPUS]; unsigned number_cpus = 0; unsigned master_cpu = 0; -int vme188_config; int max_cpus, max_cmmus; int cpu_cmmu_ratio; diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index 06f356ff519..fdbcb092ecb 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.15 2001/04/14 00:11:45 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.16 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -325,7 +325,7 @@ setdisklabel(olp, nlp, openmask, clp) int writedisklabel(dev, strat, lp, clp) dev_t dev; - void (*strat)(); + void (*strat) __P((struct buf *)); register struct disklabel *lp; struct cpu_disklabel *clp; { diff --git a/sys/arch/mvme88k/mvme88k/dkbad.c b/sys/arch/mvme88k/mvme88k/dkbad.c index 69b357fd8f3..2a41900c4d0 100644 --- a/sys/arch/mvme88k/mvme88k/dkbad.c +++ b/sys/arch/mvme88k/mvme88k/dkbad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dkbad.c,v 1.4 2001/03/08 00:03:30 miod Exp $ */ +/* $OpenBSD: dkbad.c,v 1.5 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -40,6 +40,8 @@ #include <sys/buf.h> #include <sys/dkbad.h> +int isbad __P((struct dkbad *, int, int, int)); + /* * Search the bad sector table looking for * the specified sector. Return index if found. diff --git a/sys/arch/mvme88k/mvme88k/locore_c_routines.c b/sys/arch/mvme88k/mvme88k/locore_c_routines.c index a64e663238d..a26ad4e8a5a 100644 --- a/sys/arch/mvme88k/mvme88k/locore_c_routines.c +++ b/sys/arch/mvme88k/mvme88k/locore_c_routines.c @@ -1,4 +1,4 @@ -/* $OpenBSD: locore_c_routines.c,v 1.12 2001/08/07 22:18:07 miod Exp $ */ +/* $OpenBSD: locore_c_routines.c,v 1.13 2001/08/26 14:31:12 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -25,37 +25,33 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ -/* - * HISTORY - *****************************************************************RCS**/ -/* This file created by Omron Corporation, 1990. */ #include "assym.h" #include <sys/types.h> #include <sys/systm.h> -#include <machine/param.h> -#include <machine/cpu_number.h> /* cpu_number() */ -#include <machine/board.h> /* m188 bit defines */ -#include <machine/m88100.h> /* DMT_VALID */ #include <machine/asm.h> /* END_OF_VECTOR_LIST, etc. */ #include <machine/asm_macro.h> /* enable/disable interrupts */ +#include <machine/board.h> /* m188 bit defines */ +#include <machine/cmmu.h> +#include <machine/cpu_number.h> /* cpu_number() */ #include <machine/locore.h> +#include <machine/m88100.h> /* DMT_VALID */ +#include <machine/param.h> + #ifdef DDB - #include <ddb/db_output.h> /* db_printf() */ +#include <ddb/db_output.h> /* db_printf() */ #endif /* DDB */ - #if defined(DDB) && defined(JEFF_DEBUG) - #define DATA_DEBUG 1 +#define DATA_DEBUG #endif - #if DDB - #define DEBUG_MSG db_printf +#define DEBUG_MSG db_printf #else - #define DEBUG_MSG printf +#define DEBUG_MSG printf #endif /* DDB */ /* @@ -65,22 +61,19 @@ #define DMT_HALF 2 #define DMT_WORD 4 -extern volatile unsigned int * int_mask_reg[MAX_CPUS]; /* in machdep.c */ -extern volatile u_char *int_mask_level; /* in machdep.c */ -extern unsigned master_cpu; /* in cmmu.c */ +extern volatile u_char *int_mask_level; /* machdep.c */ static struct { unsigned char offset; unsigned char size; -} dmt_en_info[16] = -{ +} dmt_en_info[16] = { {0, 0}, {3, DMT_BYTE}, {2, DMT_BYTE}, {2, DMT_HALF}, {1, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, {0, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, {0, DMT_HALF}, {0, 0}, {0, 0}, {0, DMT_WORD} }; -#if DATA_DEBUG +#ifdef DATA_DEBUG int data_access_emulation_debug = 0; static char *bytes[] = { @@ -89,10 +82,15 @@ static char *bytes[] = "x___", "x__x", "x_x_", "x_xx", "xx__", "xx_x", "xxx_", "xxxx", }; - #define DAE_DEBUG(stuff) { \ +#define DAE_DEBUG(stuff) { \ if (data_access_emulation_debug != 0) { stuff ;} } #else - #define DAE_DEBUG(stuff) +#define DAE_DEBUG(stuff) +#endif + +void setlevel __P((int)); +#ifdef DDB +void db_setlevel __P((int)); #endif #if defined(MVME187) || defined(MVME188) @@ -137,8 +135,10 @@ dae_print(unsigned *eframe) } } +#endif /* defined(MVME187) || defined(MVME188) */ -void data_access_emulation(unsigned *eframe) +void +data_access_emulation(unsigned *eframe) { register int x; register struct dmt_reg *dmtx; @@ -280,7 +280,6 @@ void data_access_emulation(unsigned *eframe) } eframe[EF_DMT0] = 0; } -#endif /* defined(MVME187) || defined(MVME188) */ /* *********************************************************************** @@ -297,21 +296,14 @@ typedef struct { word_two; } m88k_exception_vector_area; +void vector_init __P((m88k_exception_vector_area *, unsigned *)); + #define BRANCH(FROM, TO) (EMPTY_BR | ((unsigned)(TO) - (unsigned)(FROM)) >> 2) -#if 0 - #define SET_VECTOR(NUM, to, VALUE) { \ - unsigned _NUM = (unsigned)(NUM); \ - unsigned _VALUE = (unsigned)(VALUE); \ - vector[_NUM].word_one = NO_OP; \ - vector[_NUM].word_two = BRANCH(&vector[_NUM].word_two, _VALUE); \ -} -#else - #define SET_VECTOR(NUM, to, VALUE) { \ +#define SET_VECTOR(NUM, to, VALUE) { \ vector[NUM].word_one = NO_OP; \ vector[NUM].word_two = BRANCH(&vector[NUM].word_two, VALUE); \ } -#endif /* * vector_init(vector, vector_init_list) * @@ -325,22 +317,14 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) { unsigned num; unsigned vec; -#if defined(MVME187) || defined(MVME188) - extern void sigsys(), sigtrap(), stepbpt(), userbpt(); - extern void syscall_handler(); -#endif /* defined(MVME187) || defined(MVME188) */ -#ifdef MVME197 - extern void m197_sigsys(), m197_sigtrap(), m197_stepbpt(), m197_userbpt(); - extern void m197_syscall_handler(); -#endif /* MVME197 */ for (num = 0; (vec = vector_init_list[num]) != END_OF_VECTOR_LIST; num++) { if (vec != PREDEFINED_BY_ROM) SET_VECTOR(num, to, vec); - asm ("or r0, r0, r0"); - asm ("or r0, r0, r0"); - asm ("or r0, r0, r0"); - asm ("or r0, r0, r0"); + __asm__ ("or r0, r0, r0"); + __asm__ ("or r0, r0, r0"); + __asm__ ("or r0, r0, r0"); + __asm__ ("or r0, r0, r0"); } switch (cputyp) { @@ -388,9 +372,11 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) } #ifdef MVME188 +#if 0 unsigned int int_mask_shadow[MAX_CPUS] = {0,0,0,0}; -unsigned int m188_curspl[MAX_CPUS] = {0,0,0,0}; unsigned int blocked_interrupts_mask; +#endif +unsigned int m188_curspl[MAX_CPUS] = {0,0,0,0}; unsigned int int_mask_val[INT_LEVEL] = { MASK_LVL_0, @@ -419,6 +405,7 @@ safe_level(mask, curlevel) printf("safe_level: no safe level for mask 0x%08x level %d found\n", mask, curlevel); panic("safe_level"); + /* NOTREACHED */ } void @@ -473,6 +460,7 @@ db_setlevel(int level) } #endif /* DDB */ +#if 0 void block_obio_interrupt(unsigned mask) { @@ -484,6 +472,7 @@ unblock_obio_interrupt(unsigned mask) { blocked_interrupts_mask |= ~mask; } +#endif #endif /* MVME188 */ unsigned @@ -492,7 +481,7 @@ spl(void) unsigned curspl; m88k_psr_type psr; /* proccessor status register */ #ifdef MVME188 - int cpu = 0; + int cpu = 0; /* prevent warning */ #endif psr = disable_interrupts_return_psr(); switch (cputyp) { @@ -508,8 +497,6 @@ spl(void) curspl = *int_mask_level; break; #endif /* defined(MVME187) || defined(MVME197) */ - default: - panic("spl: Can't determine cpu type!"); } set_psr(psr); return curspl; @@ -522,25 +509,23 @@ db_spl(void) unsigned curspl; m88k_psr_type psr; /* proccessor status register */ #ifdef MVME188 - int cpu = 0; + int cpu = 0; /* prevent warning */ #endif psr = disable_interrupts_return_psr(); switch (cputyp) { - #ifdef MVME188 +#ifdef MVME188 case CPU_188: cpu = cpu_number(); curspl = m188_curspl[cpu]; break; - #endif /* MVME188 */ - #if defined(MVME187) || defined(MVME197) +#endif /* MVME188 */ +#if defined(MVME187) || defined(MVME197) case CPU_187: case CPU_197: curspl = *int_mask_level; break; - #endif /* defined(MVME187) || defined(MVME197) */ - default: - panic("db_spl: Can't determine cpu type!"); +#endif /* defined(MVME187) || defined(MVME197) */ } set_psr(psr); return curspl; @@ -567,10 +552,10 @@ setipl(unsigned level) unsigned curspl; m88k_psr_type psr; /* proccessor status register */ #ifdef MVME188 - int cpu = 0; + int cpu = 0; /* prevent warning */ #endif if (level > 7) { - level = 0; /* assume this for the time being */ + level = 0; /* XXX assume this for the time being */ } psr = disable_interrupts_return_psr(); @@ -589,8 +574,6 @@ setipl(unsigned level) *int_mask_level = level; break; #endif /* defined(MVME187) || defined(MVME197) */ - default: - panic("setipl: Can't determine cpu type!"); } flush_pipeline(); @@ -610,7 +593,7 @@ db_setipl(unsigned level) unsigned curspl; m88k_psr_type psr; /* proccessor status register */ #ifdef MVME188 - int cpu = 0; + int cpu = 0; /* prevent warning */ #endif psr = disable_interrupts_return_psr(); @@ -629,8 +612,6 @@ db_setipl(unsigned level) *int_mask_level = level; break; #endif /* defined(MVME187) || defined(MVME197) */ - default: - panic("db_setipl: Can't determine cpu type!"); } flush_pipeline(); @@ -670,4 +651,3 @@ test_and_set(lock) #endif } #endif - diff --git a/sys/arch/mvme88k/mvme88k/m18x_cmmu.c b/sys/arch/mvme88k/mvme88k/m18x_cmmu.c index 7979da2cf00..b15f2e440e9 100644 --- a/sys/arch/mvme88k/mvme88k/m18x_cmmu.c +++ b/sys/arch/mvme88k/mvme88k/m18x_cmmu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m18x_cmmu.c,v 1.12 2001/08/24 22:48:26 miod Exp $ */ +/* $OpenBSD: m18x_cmmu.c,v 1.13 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -187,6 +187,8 @@ void m18x_cmmu_set __P((int reg, unsigned val, int flags, int num, void m18x_cmmu_sync_cache __P((vm_offset_t physaddr, int size)); void m18x_cmmu_sync_inval_cache __P((vm_offset_t physaddr, int size)); void m18x_cmmu_inval_cache __P((vm_offset_t physaddr, int size)); +int m18x_cmmu_alive __P((int)); +void m18x_cmmu_store __P((int, int, unsigned)); #ifdef CMMU_DEBUG void @@ -283,8 +285,7 @@ struct board_config { int supported; int ncpus; int ncmmus; -} bd_config[] = -{ +} bd_config[] = { /* sup, CPU MMU */ { 1, 4, 8}, /* 4P128 - 4P512 */ { 1, 2, 8}, /* 2P128 - 2P512 */ @@ -308,8 +309,7 @@ struct board_config { * Structure for accessing MMUS properly. */ -struct cmmu cmmu[MAX_CMMUS] = -{ +struct cmmu cmmu[MAX_CMMUS] = { /* addr cpu mode access alive addr mask */ {(void *)VME_CMMU_I0, -1, INST_CMMU, CMMU_ACS_BOTH, @@ -368,8 +368,6 @@ m18x_setup_board_config() max_cmmus = bd_config[vme188_config].ncmmus; break; #endif /* MVME188 */ - default: - panic("m18x_setup_board_config: Unknown CPU type."); } cpu_cmmu_ratio = max_cmmus / max_cpus; switch (bd_config[vme188_config].supported) { @@ -649,18 +647,16 @@ m18x_cmmu_dump_config() cmmu[cmmu_num].cmmu_addr_match ? "TRUE" : "FALSE"); } #endif /* MVME188 */ - default: - DEBUG_MSG("Unknown CPU\n\n"); } } /* To be implemented as a macro for speedup - XXX-em */ -static void +void m18x_cmmu_store(mmu, reg, val) int mmu, reg; unsigned val; { - *(volatile unsigned *)(reg + (char*)(cmmu[mmu].cmmu_regs)) = val; + *(volatile unsigned *)(reg + (char *)(cmmu[mmu].cmmu_regs)) = val; } int diff --git a/sys/arch/mvme88k/mvme88k/m197_cmmu.c b/sys/arch/mvme88k/mvme88k/m197_cmmu.c index 86cc47ed97e..c31863394cc 100644 --- a/sys/arch/mvme88k/mvme88k/m197_cmmu.c +++ b/sys/arch/mvme88k/mvme88k/m197_cmmu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m197_cmmu.c,v 1.7 2001/08/24 22:49:18 miod Exp $ */ +/* $OpenBSD: m197_cmmu.c,v 1.8 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -60,20 +60,27 @@ #include <sys/param.h> #include <sys/types.h> #include <sys/simplelock.h> + #include <machine/board.h> #include <machine/cpus.h> #include <machine/cpu_number.h> +#include <machine/locore.h> #include <machine/m88110.h> +#ifdef DDB +#include <ddb/db_output.h> +#endif + #define CMMU_DEBUG 1 #ifdef DEBUG - #define DB_CMMU 0x4000 /* MMU debug */ +#define DB_CMMU 0x4000 /* MMU debug */ unsigned int debuglevel = 0; - #define dprintf(_L_,_X_) { if (debuglevel & (_L_)) { unsigned int psr = disable_interrupts_return_psr(); printf("%d: ", cpu_number()); printf _X_; set_psr(psr); } } +#define dprintf(_L_,_X_) { if (debuglevel & (_L_)) { unsigned int psr = disable_interrupts_return_psr(); printf("%d: ", cpu_number()); printf _X_; set_psr(psr); } } #else - #define dprintf(_L_,_X_) +#define dprintf(_L_,_X_) #endif + #undef SHADOW_BATC /* don't use BATCs for now XXX nivas */ /* @@ -84,6 +91,25 @@ unsigned int debuglevel = 0; #define CMMU(cpu, data) cpu_cmmu[(cpu)].pair[(data)?DATA_CMMU:INST_CMMU] #define REGS(cpu, data) (*CMMU(cpu, data)->cmmu_regs) +/* prototypes */ +#ifdef CMMU_DEBUG +void m197_show_apr __P((unsigned)); +void m197_show_sctr __P((unsigned)); +#endif +void m197_cmmu_store __P((int, int, unsigned)); +void m197_setup_cmmu_config __P((void)); +void m197_setup_board_config __P((void)); +int m197_cmmu_alive __P((int)); +unsigned m197_cmmu_get __P((int, int)); +void m197_cmmu_set __P((int, unsigned, int, int, int, int, vm_offset_t)); +int probe_mmu __P((vm_offset_t, int)); +void m197_cmmu_sync_cache __P((vm_offset_t, int)); +void m197_cmmu_sync_inval_cache __P((vm_offset_t, int)); +void m197_cmmu_inval_cache __P((vm_offset_t, int)); +void m197_cmmu_show_translation __P((unsigned, unsigned, unsigned, int)); +void m197_show_cmmu_info __P((unsigned)); +void m197_cmmu_cache_state __P((unsigned, unsigned)); + /* * This lock protects the cmmu SAR and SCR's; other ports * can be accessed without locking it @@ -91,10 +117,6 @@ unsigned int debuglevel = 0; * May be used from "db_interface.c". */ -/* FORWARDS */ -void m197_setup_cmmu_config(void); -void m197_setup_board_config(void); - #ifdef CMMU_DEBUG void m197_show_apr(unsigned value) @@ -154,8 +176,7 @@ void m197_cmmu_dump_config(void) return; } -/* To be implemented as a macro for speedup - XXX-smurph */ -static void +void m197_cmmu_store(int mmu, int reg, unsigned val) { } @@ -169,8 +190,7 @@ m197_cmmu_alive(int mmu) unsigned m197_cmmu_get(int mmu, int reg) { - unsigned val; - return val; + return 0; } /* @@ -205,7 +225,7 @@ m197_cpu_configuration_print(int master) int pid = read_processor_identification_register(); int proctype = (pid & 0xff00) >> 8; int procvers = (pid & 0xe) >> 1; - int mmu, cpu = cpu_number(); + int cpu = cpu_number(); struct simplelock print_lock; if (master) @@ -236,7 +256,6 @@ m197_cmmu_init(void) unsigned tmp; extern void *kernel_sdt; unsigned lba, pba, value; - init_done = 0; /* clear BATCs */ for (i=0; i<8; i++) { @@ -288,9 +307,6 @@ m197_cmmu_init(void) void m197_cmmu_shutdown_now(void) { - unsigned tmp; - unsigned cmmu_num; - } /* @@ -459,7 +475,7 @@ m197_cmmu_set_pair_batc_entry(unsigned cpu, unsigned entry_no, unsigned value) void m197_cmmu_flush_remote_tlb(unsigned cpu, unsigned kernel, vm_offset_t vaddr, int size) { - register s = splhigh(); + register int s = splhigh(); if (kernel) { set_icmd(CMMU_ICMD_INV_SATC); set_dcmd(CMMU_DCMD_INV_SATC); @@ -493,7 +509,7 @@ m197_cmmu_pmap_activate( batc_template_t i_batc[BATC_MAX], batc_template_t d_batc[BATC_MAX]) { - int entry_no; + /* int entry_no;*/ m197_cmmu_set_uapr(uapr); @@ -531,7 +547,7 @@ m197_cmmu_pmap_activate( void m197_cmmu_flush_remote_cache(int cpu, vm_offset_t physaddr, int size) { - register s = splhigh(); + register int s = splhigh(); set_icmd(CMMU_ICMD_INV_ITIC); set_dcmd(CMMU_DCMD_FLUSH_ALL_INV); splx(s); @@ -553,7 +569,7 @@ m197_cmmu_flush_cache(vm_offset_t physaddr, int size) void m197_cmmu_flush_remote_inst_cache(int cpu, vm_offset_t physaddr, int size) { - register s = splhigh(); + register int s = splhigh(); set_icmd(CMMU_ICMD_INV_ITIC); @@ -577,7 +593,7 @@ m197_cmmu_flush_inst_cache(vm_offset_t physaddr, int size) void m197_cmmu_flush_remote_data_cache(int cpu, vm_offset_t physaddr, int size) { - register s = splhigh(); + register int s = splhigh(); set_dcmd(CMMU_DCMD_FLUSH_ALL_INV); splx(s); } @@ -599,7 +615,7 @@ m197_cmmu_flush_data_cache(vm_offset_t physaddr, int size) void m197_cmmu_sync_cache(vm_offset_t physaddr, int size) { - register s = splhigh(); + register int s = splhigh(); int cpu; cpu = cpu_number(); /* set_mmureg(CMMU_ICTL, CMMU_ICMD_INV_TIC); */ @@ -611,7 +627,7 @@ m197_cmmu_sync_cache(vm_offset_t physaddr, int size) void m197_cmmu_sync_inval_cache(vm_offset_t physaddr, int size) { - register s = splhigh(); + register int s = splhigh(); int cpu; cpu = cpu_number(); @@ -622,7 +638,7 @@ m197_cmmu_sync_inval_cache(vm_offset_t physaddr, int size) void m197_cmmu_inval_cache(vm_offset_t physaddr, int size) { - register s = splhigh(); + register int s = splhigh(); int cpu; cpu = cpu_number(); set_icmd(CMMU_ICMD_INV_ITIC); @@ -633,7 +649,6 @@ m197_cmmu_inval_cache(vm_offset_t physaddr, int size) void m197_dma_cachectl(vm_offset_t va, int size, int op) { - int count; if (op == DMA_CACHE_SYNC) m197_cmmu_sync_cache(kvtop(va), size); else if (op == DMA_CACHE_SYNC_INVAL) @@ -679,6 +694,7 @@ m197_cmmu_show_translation(unsigned address, * indicies into tables (segment and page), and one is an offset into * a page of memory. */ + /* union { unsigned bits; struct { @@ -687,26 +703,27 @@ m197_cmmu_show_translation(unsigned address, page_offset:12; } field; } virtual_address; - unsigned value; + */ +#ifdef DDB if (verbose_flag) db_printf("-------------------------------------------\n"); - +#endif } void m197_cmmu_cache_state(unsigned addr, unsigned supervisor_flag) { + /* static char *vv_name[4] = {"exclu-unmod", "exclu-mod", "shared-unmod", "invalid"}; - int cmmu_num; + */ } void m197_show_cmmu_info(unsigned addr) { - int cmmu_num; m197_cmmu_cache_state(addr, 1); } #endif /* end if DDB */ @@ -742,8 +759,8 @@ m197_table_search(pmap_t map, vm_offset_t virt, int write, int kernel, int data) { sdt_entry_t *sdt; pt_entry_t *pte; - unsigned lpa, pfa, i; - static entry_num = 0; + unsigned lpa, i; + static int entry_num = 0; if (map == (pmap_t)0) panic("m197_table_search: pmap is NULL"); diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 6fdd9a457de..f75e5e8fc65 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.55 2001/08/24 22:54:51 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.56 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -80,17 +80,18 @@ #include <net/netisr.h> -#include <machine/locore.h> -#include <machine/cpu.h> -#include <machine/cpu_number.h> #include <machine/asm_macro.h> /* enable/disable interrupts */ -#include <machine/reg.h> -#include <machine/trap.h> #include <machine/bug.h> -#include <machine/prom.h> +#include <machine/cmmu.h> +#include <machine/cpu.h> +#include <machine/cpu_number.h> +#include <machine/kcore.h> +#include <machine/locore.h> #include <machine/m88100.h> /* DMT_VALID */ #include <machine/m882xx.h> /* CMMU stuff */ -#include <machine/kcore.h> +#include <machine/prom.h> +#include <machine/reg.h> +#include <machine/trap.h> #include <dev/cons.h> @@ -110,9 +111,9 @@ #endif /* DDB */ #if DDB - #define DEBUG_MSG db_printf +#define DEBUG_MSG db_printf #else - #define DEBUG_MSG printf +#define DEBUG_MSG printf #endif /* DDB */ static int waittime = -1; @@ -122,7 +123,7 @@ vm_offset_t interrupt_stack[MAX_CPUS] = {0}; /* machine dependant function pointers. */ struct funcp mdfp; -/* forwards */ +/* prototypes */ void m88100_Xfp_precise __P((void)); void m88110_Xfp_precise __P((void)); void setupiackvectors __P((void)); @@ -130,6 +131,13 @@ void regdump __P((struct trapframe *f)); void dumpsys __P((void)); void consinit __P((void)); void kdb_init __P((void)); +vm_offset_t size_memory __P((void)); +int getcpuspeed __P((void)); +int getscsiid __P((void)); +void identifycpu __P((void)); +void save_u_area __P((struct proc *, vm_offset_t)); +void load_u_area __P((struct proc *)); +void dumpconf __P((void)); volatile unsigned char *ivec[] = { (unsigned char *)0xFFFE0003, /* not used, no such thing as int 0 */ @@ -161,24 +169,23 @@ u_char *int_mask_level = (u_char *)INT_MASK_LEVEL; u_char *int_pri_level = (u_char *)INT_PRI_LEVEL; #endif /* defined(MVME187) || defined(MVME197) */ -u_char *iackaddr; +#if defined(MVME187) || defined(MVME197) volatile u_char *pcc2intr_mask; volatile u_char *pcc2intr_ipl; volatile vm_offset_t bugromva; -volatile vm_offset_t kernelva; -volatile vm_offset_t utilva; volatile vm_offset_t sramva; volatile vm_offset_t obiova; +#endif /* defined(MVME187) || defined(MVME197) */ +#ifdef MVME188 +volatile vm_offset_t utilva; +#endif int ssir; int want_ast; int want_resched; int physmem; /* available physical memory, in pages */ -vm_offset_t avail_end, avail_start, avail_next; -int foodebug = 0; /* for size_memory() */ int longformat = 1; /* for regdump() */ -int BugWorks = 0; /* * safepri is a safe priority for sleep to set for a spin-wait * during autoconfiguration or after a panic. @@ -204,7 +211,6 @@ vm_map_t iomap_map; /* * Declare these as initialized data so we can patch them. */ -int nswbuf = 0; #ifdef NBUF int nbuf = NBUF; #else @@ -215,18 +221,18 @@ int bufpages = BUFPAGES; #else int bufpages = 0; #endif -int *nofault; caddr_t allocsys __P((caddr_t)); /* * Info for CTL_HW */ -char machine[] = "mvme88k"; /* cpu "architecture" */ +char machine[] = MACHINE; /* cpu "architecture" */ char cpu_model[120]; extern unsigned master_cpu; struct bugenv bugargs; + struct kernel { void *entry; void *symtab; @@ -247,25 +253,12 @@ int bootdev; /* read in locore.S */ int cputyp; int cpuspeed = 25; /* 25 MHZ XXX should be read from NVRAM */ -#ifndef roundup - #define roundup(value, stride) (((unsigned)(value) + (stride) - 1) & ~((stride)-1)) -#endif /* roundup */ - -vm_size_t mem_size; -vm_size_t rawmem_size; vm_offset_t first_addr = 0; vm_offset_t last_addr = 0; -vm_offset_t avail_start, avail_next, avail_end; +vm_offset_t avail_start, avail_end; vm_offset_t virtual_avail, virtual_end; -vm_offset_t pcc2consvaddr, clconsvaddr; -vm_offset_t miniroot; - -void *end_loaded; -int bootdev; -int no_symbols = 1; -struct proc *lastproc; pcb_t curpcb; extern struct user *proc0paddr; @@ -285,7 +278,7 @@ static struct consdev bootcons = { bootcngetc, (void (*))bootcnputc, bootcnpollc, NULL, makedev(14,0), 1}; -void cmmu_init(void); + /* * Console initialization: called early on from main, * before vm init or startup. Do enough configuration @@ -315,7 +308,7 @@ consinit() * until we find non-memory. */ vm_offset_t -size_memory(void) +size_memory() { volatile unsigned int *look; unsigned int *max; @@ -332,8 +325,7 @@ size_memory(void) unsigned save; /* if can't access, we've reached the end */ - if (foodebug) printf("%x\n", look); - if (badwordaddr((void*)look)) { + if (badwordaddr((vaddr_t)look)) { #if defined(DEBUG) printf("%x\n", look); #endif @@ -362,7 +354,7 @@ size_memory(void) } int -getcpuspeed(void) +getcpuspeed() { struct bugbrdid brdid; int speed = 0; @@ -379,7 +371,7 @@ getcpuspeed(void) } int -getscsiid(void) +getscsiid() { struct bugbrdid brdid; int scsiid = 0; @@ -436,7 +428,7 @@ load_u_area(struct proc *p) * These function pointers are set in dev/clock.c and dev/sclock.c */ void -cpu_initclocks(void) +cpu_initclocks() { #ifdef DEBUG printf("cpu_initclocks(): "); @@ -590,8 +582,6 @@ cpu_startup() } break; #endif - default: - panic("startup: unknown cpu type."); } /* @@ -668,7 +658,7 @@ cpu_startup() } iomap_extent = extent_create("iomap", iomapbase, iomapbase + IOMAP_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); - if (iomap_extent == 0) + if (iomap_extent == NULL) panic("unable to allocate extent for iomap"); mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr, @@ -678,37 +668,20 @@ cpu_startup() printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * PAGE_SIZE); -#if 0 /* #ifdef MFS */ - /* - * Check to see if a mini-root was loaded into memory. It resides - * at the start of the next page just after the end of BSS. - */ - { - extern void *smini; - - if (miniroot && (boothowto & RB_MINIROOT)) { - boothowto |= RB_DFLTROOT; - mfs_initminiroot(miniroot); - } - } -#endif - /* * Set up buffers, so they can be used to read disk labels. */ bufinit(); /* - * Configure the system. - */ - nofault = NULL; - - /* * zero out intr_handlers */ bzero((void *)intr_handlers, 256 * sizeof(struct intrhand *)); setupiackvectors(); + /* + * Configure the system. + */ if (boothowto & RB_CONFIG) { #ifdef BOOT_CONFIG user_config(); @@ -783,11 +756,6 @@ allocsys(v) if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) bufpages = nbuf * MAXBSIZE / PAGE_SIZE; - if (nswbuf == 0) { - nswbuf = (nbuf / 2) &~ 1; /* force even */ - if (nswbuf > 256) - nswbuf = 256; /* sanity */ - } valloc(buf, struct buf, nbuf); return v; @@ -1107,22 +1075,29 @@ register_t *retval; return (EJUSTRETURN); } -void +__dead void _doboot() { cmmu_shutdown_now(); bugreturn(); + /*NOTREACHED*/ + for (;;); /* appease gcc */ } -void +__dead void boot(howto) register int howto; { + /* If system is cold, just halt. */ + if (cold) { + howto |= RB_HALT; + goto haltsys; + } + /* take a snap shot before clobbering any registers */ -#if 0 if (curproc && curproc->p_addr) savectx(curpcb); -#endif + boothowto = howto; if ((howto & RB_NOSYNC) == 0 && waittime < 0) { extern struct proc proc0; @@ -1144,24 +1119,26 @@ boot(howto) /* Disable interrupts. */ splhigh(); + /* If rebooting and a dump is requested, do it. */ + if (howto & RB_DUMP) + dumpsys(); + +haltsys: + /* Run any shutdown hooks. */ + doshutdownhooks(); + if (howto & RB_HALT) { printf("halted\n\n"); } else { - /* If rebooting and a dump is requested, do it. */ - if (howto & RB_DUMP) - dumpsys(); - - /* Run any shutdown hooks. */ - doshutdownhooks(); + doboot(); } - doboot(); - /*NOTREACHED*/ for (;;); /* to keep compiler happy, and me from going crazy */ + /*NOTREACHED*/ } #ifdef MVME188 void -m188_reset(void) +m188_reset() { volatile int cnt; @@ -1348,7 +1325,7 @@ void setupiackvectors() { register u_char *vaddr; -#undef MAP_VEC /* Swicthing to new virtual addresses XXX smurph */ +#undef MAP_VEC /* Switching to new virtual addresses XXX smurph */ #ifdef MAP_VEC extern vm_offset_t iomap_mapin(vm_offset_t, vm_size_t, boolean_t); #endif @@ -1394,8 +1371,6 @@ setupiackvectors() #endif break; #endif /* MVME197 */ - default: - panic("setupiackvectors: unknow cpu"); } #ifdef DEBUG printf("interrupt ACK address mapped at 0x%x\n", vaddr); @@ -1417,7 +1392,7 @@ setupiackvectors() /* gets an interrupt stack for slave processors */ vm_offset_t -get_slave_stack(void) +get_slave_stack() { vm_offset_t addr = 0; addr = (vm_offset_t)uvm_km_zalloc(kernel_map, INTSTACK_SIZE + 4096); @@ -1439,7 +1414,7 @@ get_slave_stack(void) * * Called from "mvme88k/locore.S" */ -void slave_pre_main(void) +void slave_pre_main() { set_cpu_number(cmmu_cpu_number()); /* Determine cpu number by CMMU */ splhigh(); @@ -1448,7 +1423,7 @@ void slave_pre_main(void) /* dummy main routine for slave processors */ int -slave_main(void) +slave_main() { printf("slave CPU%d started\n", cpu_number()); while (-1); /* spin forever */ @@ -1618,7 +1593,7 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) /* find the first bit set in the current mask */ intbit = ff1(cur_mask); if (OBIO_INTERRUPT_MASK & (1 << intbit)) { - if (guarded_access(ivec[level], 4, &vec) == EFAULT) { + if (guarded_access(ivec[level], 4, (u_char *)&vec) == EFAULT) { printf("Unable to get vector for this vmebus interrupt (level %x)\n", level); goto out_m188; } @@ -1638,7 +1613,7 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) panic("m188_ext_int"); } } else if (VME_INTERRUPT_MASK & (1 << intbit)) { - if (guarded_access(ivec[level], 4, &vec) == EFAULT) { + if (guarded_access(ivec[level], 4, (u_char *)&vec) == EFAULT) { printf("Unable to get vector for this vmebus interrupt (level %x)\n", level); goto out_m188; } @@ -2068,7 +2043,7 @@ dosoftint() } int -spl0(void) +spl0() { int x; x = splsoftclock(); @@ -2206,11 +2181,12 @@ regdump(struct trapframe *f) */ void -mvme_bootstrap(void) +mvme_bootstrap() { extern int kernelstart; - extern vm_offset_t size_memory(void); extern struct consdev *cn_tab; + extern void set_tcfp __P((void)); + struct bugbrdid brdid; cold = 1; /* we are still booting */ diff --git a/sys/arch/mvme88k/mvme88k/mem.c b/sys/arch/mvme88k/mvme88k/mem.c index 9a403ac4db9..522f5bb0b12 100644 --- a/sys/arch/mvme88k/mvme88k/mem.c +++ b/sys/arch/mvme88k/mvme88k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.10 2001/07/25 13:25:32 art Exp $ */ +/* $OpenBSD: mem.c,v 1.11 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -58,6 +58,12 @@ caddr_t zeropage; +int mmopen __P((dev_t, int, int)); +int mmclose __P((dev_t, int, int)); +int mmrw __P((dev_t, struct uio *, int)); +int mmmmap __P((dev_t, int, int)); +int mmioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); + /*ARGSUSED*/ int mmopen(dev, flag, mode) diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c index 580820d3a7f..759e56a449c 100644 --- a/sys/arch/mvme88k/mvme88k/pmap.c +++ b/sys/arch/mvme88k/mvme88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.39 2001/08/12 19:28:38 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.40 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -66,6 +66,7 @@ #include <machine/cpu_number.h> #include <machine/m882xx.h> /* CMMU stuff */ #include <machine/pmap_table.h> +#include <machine/pte.h> #include <mvme88k/dev/pcctworeg.h> #include <mvme88k/dev/clreg.h> @@ -73,7 +74,7 @@ /* * VM externals */ -extern vm_offset_t avail_start, avail_next, avail_end; +extern vm_offset_t avail_start, avail_end; extern vm_offset_t virtual_avail, virtual_end; /* @@ -330,6 +331,15 @@ extern vm_offset_t bugromva; extern vm_offset_t sramva; extern vm_offset_t obiova; +void flush_atc_entry __P((long, vm_offset_t, int)); +unsigned int m88k_protection __P((pmap_t, vm_prot_t)); +pt_entry_t *pmap_expand_kmap __P((vm_offset_t, vm_prot_t)); +void pmap_free_tables __P((pmap_t)); +void pmap_remove_range __P((pmap_t, vm_offset_t, vm_offset_t)); +void pmap_copy_on_write __P((vm_offset_t)); +void pmap_expand __P((pmap_t, vm_offset_t)); +void cache_flush_loop __P((int, vm_offset_t, int)); + /* * Rooutine: FLUSH_ATC_ENTRY * @@ -548,7 +558,7 @@ pmap_map(vm_offset_t virt, vm_offset_t start, vm_offset_t end, vm_prot_t prot) pt_entry_t *pte; pte_template_t template; #ifdef MVME197 - static m197_atc_initialized = FALSE; + static int m197_atc_initialized = FALSE; #endif /* * cache mode is passed in the top 16 bits. @@ -624,7 +634,6 @@ pmap_map(vm_offset_t virt, vm_offset_t start, vm_offset_t end, vm_prot_t prot) * Calls: * m88k_protection * BATC_BLK_ALIGNED - * cmmu_store * pmap_pte * pmap_expand_kmap * @@ -1268,7 +1277,6 @@ pmap_bootstrap(vm_offset_t load_start, printf("running virtual - avail_next 0x%x\n", *phys_start); } #endif - avail_next = *phys_start; } /* pmap_bootstrap() */ diff --git a/sys/arch/mvme88k/mvme88k/pmap_table.c b/sys/arch/mvme88k/mvme88k/pmap_table.c index 203549ec04f..c5d881d342a 100644 --- a/sys/arch/mvme88k/mvme88k/pmap_table.c +++ b/sys/arch/mvme88k/mvme88k/pmap_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_table.c,v 1.6 2001/07/04 08:09:24 niklas Exp $ */ +/* $OpenBSD: pmap_table.c,v 1.7 2001/08/26 14:31:12 miod Exp $ */ /* * Mach Operating System @@ -93,9 +93,6 @@ pmap_table_build(endoftext) bt = m197_board_table; break; #endif - default: - panic("pmap_table_build: Unknown CPU type."); - /* NOT REACHED */ } /* round off all entries to nearest segment */ diff --git a/sys/arch/mvme88k/mvme88k/process.S b/sys/arch/mvme88k/mvme88k/process.S index af62e54be45..f6cb91ea6c8 100644 --- a/sys/arch/mvme88k/mvme88k/process.S +++ b/sys/arch/mvme88k/mvme88k/process.S @@ -1,4 +1,4 @@ -/* $OpenBSD: process.S,v 1.10 2001/08/24 22:53:15 miod Exp $ */ +/* $OpenBSD: process.S,v 1.11 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -141,9 +141,6 @@ ENTRY(cpu_switch) or.u r11, r0, hi16(_curproc) ld r11,r11, lo16(_curproc) - or.u r12, r0, hi16(_lastproc) - st r11, r12, lo16(_lastproc)/* lastproc = curproc */ - or.u r11, r0, hi16(_curproc) st r0, r11, lo16(_curproc) /* curproc = NULL */ @@ -235,11 +232,6 @@ Lsw2: or.u r11, r0, hi16(_curproc) st r9, r11,lo16(_curproc) /* curproc = p */ -#ifdef notyet - or.u r2, r0, hi16(_lastproc) - ld r2, r2, lo16(_lastproc) -#endif /* notyet */ - /* huh??? */ or.u r10, r0, hi16(_curpcb) ld r10,r10, lo16(_curpcb) diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c index 8886d354e78..c6a9db52f65 100644 --- a/sys/arch/mvme88k/mvme88k/trap.c +++ b/sys/arch/mvme88k/mvme88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.18 2001/08/24 22:52:22 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.19 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -101,7 +101,7 @@ unsigned traptrace = 0; #define SYSTEMMODE(PSR) (((struct psr*)&(PSR))->psr_mode != 0) /* sigh */ -extern int procfs_domem __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); +extern int procfs_domem __P((struct proc *, struct proc *, void *, struct uio *)); extern void regdump __P((struct trapframe *f)); diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index 20b4b50db2b..079e064dec0 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.31 2001/08/11 23:21:14 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.32 2001/08/26 14:31:12 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -61,15 +61,24 @@ #include <uvm/uvm_extern.h> +#include <machine/cmmu.h> #include <machine/cpu.h> #include <machine/cpu_number.h> #include <machine/locore.h> -#include <machine/cmmu.h> #include <machine/pte.h> +#include <machine/trap.h> extern struct extent *iomap_extent; extern vm_map_t iomap_map; +vm_offset_t iomap_mapin __P((vm_offset_t, vm_size_t, boolean_t)); +void iomap_mapout __P((vm_offset_t, vm_size_t)); +void *mapiodev __P((void *, int)); +void unmapiodev __P((void *, int)); +vm_offset_t mapiospace __P((caddr_t, int)); +void unmapiospace __P((vm_offset_t)); +int badpaddr __P((caddr_t, int)); + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the kernel stack and pcb, making the child @@ -90,10 +99,8 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize) void *proc; } *ksfp; extern struct pcb *curpcb; - extern void proc_do_uret(), child_return(); - extern void proc_trampoline(); - extern void savectx(); - extern void save_u_area(); + extern void proc_trampoline __P((void)); + extern void save_u_area __P((struct proc *, vm_offset_t)); cpu = cpu_number(); /* @@ -108,7 +115,7 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize) p2->p_md.md_tf = USER_REGS(p2); /*XXX these may not be necessary nivas */ - save_u_area(p2, p2->p_addr); + save_u_area(p2, (vm_offset_t)p2->p_addr); #ifdef notneeded pmap_activate(p2); #endif /* notneeded */ @@ -143,8 +150,6 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize) p2->p_addr->u_pcb.kernel_state.pcb_sp = (u_int)ksfp; p2->p_addr->u_pcb.kernel_state.pcb_pc = (u_int)proc_trampoline; - - return; } void @@ -176,8 +181,6 @@ cpu_set_kpc(struct proc *p, void (*func)(void *), void *arg) void cpu_exit(struct proc *p) { - extern volatile void switch_exit(); - (void) splimp(); uvmexp.swtch++; @@ -188,7 +191,6 @@ cpu_exit(struct proc *p) int cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred, struct core *corep) { - return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, ctob(UPAGES), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL, p)); } @@ -202,7 +204,8 @@ cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred, struct core * void cpu_swapin(struct proc *p) { - extern void save_u_area(); + extern void save_u_area __P((struct proc *, vm_offset_t)); + save_u_area(p, (vm_offset_t)p->p_addr); } @@ -457,8 +460,6 @@ badvaddr(vm_offset_t va, int size) case 4: x = *(volatile unsigned long *)va; break; - default: - break; } return(x); } @@ -470,7 +471,7 @@ badpaddr(caddr_t pa, int size) int val; /* - * Do not allow crossing the page boundary. + * Do not allow crossing a page boundary. */ if (((int)pa & PGOFSET) + size > NBPG) { return -1; |