From 376a19a1bb2ddf48be6898f5aedc727f37b23bb4 Mon Sep 17 00:00:00 2001 From: bjc Date: Wed, 26 Apr 2000 03:08:40 +0000 Subject: [PATCH] vax resurrection, part 1: sync with early-april netbsd many changes here, notable: uvm, ansi.h, more (and cleaner) vsbus support --- sys/arch/vax/include/ansi.h | 52 ++--- sys/arch/vax/include/asm.h | 35 +++- sys/arch/vax/include/clock.h | 12 +- sys/arch/vax/include/cpu.h | 48 +++-- sys/arch/vax/include/db_machdep.h | 13 +- sys/arch/vax/include/endian.h | 4 +- sys/arch/vax/include/exec.h | 4 +- sys/arch/vax/include/float.h | 75 ++++--- sys/arch/vax/include/ioa.h | 8 +- sys/arch/vax/include/ka410.h | 20 +- sys/arch/vax/include/ka420.h | 36 +++- sys/arch/vax/include/ka43.h | 10 +- sys/arch/vax/include/ka630.h | 16 +- sys/arch/vax/include/ka650.h | 13 +- sys/arch/vax/include/ka750.h | 8 +- sys/arch/vax/include/ka820.h | 17 +- sys/arch/vax/include/limits.h | 11 +- sys/arch/vax/include/macros.h | 316 ++++++++++++++++++------------ sys/arch/vax/include/mtpr.h | 21 +- sys/arch/vax/include/nexus.h | 31 ++- sys/arch/vax/include/param.h | 123 +++++++----- sys/arch/vax/include/pmap.h | 125 +++++++----- sys/arch/vax/include/proc.h | 4 +- sys/arch/vax/include/profile.h | 4 +- sys/arch/vax/include/psl.h | 4 +- sys/arch/vax/include/pte.h | 25 +-- sys/arch/vax/include/rpb.h | 10 +- sys/arch/vax/include/scb.h | 19 +- sys/arch/vax/include/setjmp.h | 4 +- sys/arch/vax/include/sid.h | 11 +- sys/arch/vax/include/stdarg.h | 14 +- sys/arch/vax/include/trap.h | 26 ++- sys/arch/vax/include/types.h | 28 +-- sys/arch/vax/include/uvax.h | 80 +++----- sys/arch/vax/include/vmparam.h | 88 ++++----- sys/arch/vax/include/vsbus.h | 128 ++++++++---- 36 files changed, 811 insertions(+), 632 deletions(-) diff --git a/sys/arch/vax/include/ansi.h b/sys/arch/vax/include/ansi.h index 5a5f0c64bfb..446757e7c9f 100644 --- a/sys/arch/vax/include/ansi.h +++ b/sys/arch/vax/include/ansi.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ansi.h,v 1.7 2000/02/22 17:29:14 millert Exp $ */ -/* $NetBSD: ansi.h,v 1.5 1996/11/15 22:39:01 jtc Exp $ */ +/* $OpenBSD: ansi.h,v 1.8 2000/04/26 03:08:40 bjc Exp $ */ +/* $NetBSD: ansi.h,v 1.7 1998/04/27 17:39:11 kleink Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -47,38 +47,24 @@ * typedef _SIZE_T_ size_t; * #undef _SIZE_T_ * #endif + * + * Thanks, ANSI! */ -#define _BSD_CLOCK_T_ unsigned long /* clock() */ -#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ -#define _BSD_SIZE_T_ unsigned int /* sizeof() */ -#define _BSD_SSIZE_T_ int /* byte count or error */ -#define _BSD_TIME_T_ int /* time() */ -#define _BSD_VA_LIST_ char * /* va_list */ -#define _BSD_CLOCKID_T_ int -#define _BSD_TIMER_T_ int - -/* - * Runes (wchar_t) is declared to be an ``int'' instead of the more natural - * ``unsigned long'' or ``long''. Two things are happening here. It is not - * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, - * it looks like 10646 will be a 31 bit standard. This means that if your - * ints cannot hold 32 bits, you will be in trouble. The reason an int was - * chosen over a long is that the is*() and to*() routines take ints (says - * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you - * lose a bit of ANSI conformance, but your programs will still work. - * - * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t - * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains - * defined for ctype.h. - */ -#define _BSD_WCHAR_T_ int /* wchar_t */ -#define _BSD_WINT_T_ int /* wint_t */ -#define _BSD_RUNE_T_ int /* rune_t */ +#define _BSD_CLOCK_T_ unsigned long /* clock() */ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ int /* time() */ +#define _BSD_VA_LIST_ char * /* va_list */ +#define _BSD_WCHAR_T_ int /* wchar_t */ +#define _BSD_WINT_T_ int /* wint_t */ +#define _BSD_CLOCKID_T_ int /* clockid_t */ +#define _BSD_TIMER_T_ int /* timer_t */ +#define _BSD_SUSECONDS_T_ int /* suseconds_t */ +#define _BSD_USECONDS_T_ unsigned int /* useconds_t */ +#define _BSD_INTPTR_T_ int /* intptr_t */ +#define _BSD_UINTPTR_T_ unsigned int /* uintptr_t */ -/* - * We describe off_t here so its declaration can be visible to - * stdio without pulling in all of , thus appeasing ANSI. - */ -#define _BSD_OFF_T_ long long /* file offset */ +#define _BSD_OFF_T_ long long /* off_t */ #endif /* _ANSI_H_ */ diff --git a/sys/arch/vax/include/asm.h b/sys/arch/vax/include/asm.h index 6a0000328f1..73ad088e599 100644 --- a/sys/arch/vax/include/asm.h +++ b/sys/arch/vax/include/asm.h @@ -1,5 +1,5 @@ -/* $OpenBSD: asm.h,v 1.4 1997/05/29 00:04:35 niklas Exp $ */ -/* $NetBSD: asm.h,v 1.5 1996/11/30 02:49:06 jtc Exp $ */ +/* $OpenBSD: asm.h,v 1.5 2000/04/26 03:08:40 bjc Exp $ */ +/* $NetBSD: asm.h,v 1.9 1999/01/15 13:31:28 bouyer Exp $ */ /* * Copyright (c) 1982, 1993 * The Regents of the University of California. All rights reserved. @@ -54,31 +54,46 @@ #ifdef __STDC__ #ifdef GPROF #define ENTRY(x, regs) \ - .globl _ ## x ## ; .align 2; _ ## x ## : .word regs; \ + .globl _ ## x; .type _ ## x,@function ; .align 2; _ ## x: .word regs; \ .data; 1:; .long 0; .text; moval 1b,r0; jsb mcount #define ASENTRY(x, regs) \ - .globl x; .align 2; x ## : .word regs; \ + .globl x; .type x,@function; .align 2; x: .word regs; \ .data; 1:; .long 0; .text; moval 1b,r0; jsb mcount #else #define ENTRY(x, regs) \ - .globl _ ## x; .align 2; _ ## x ## : .word regs + .globl _ ## x; .type _ ## x,@function; \ + .align 2; _ ## x : .word regs #define ASENTRY(x, regs) \ - .globl x; .align 2; x ## : .word regs + .globl x; .type x,@function; .align 2; x: .word regs #endif +#define ALTENTRY(x) .globl _ ## x; _ ## x: # else #ifdef GPROF #define ENTRY(x, regs) \ - .globl _/**/x; .align 2; _/**/x: .word regs; \ + .globl _/**/x; .type _/**/x,@function; .align 2; _/**/x: .word regs; \ .data; 1:; .long 0; .text; moval 1b,r0; jsb mcount #define ASENTRY(x, regs) \ - .globl x; .align 2; x: .word regs; \ + .globl x; .type x,@function; .align 2; x: .word regs; \ .data; 1:; .long 0; .text; moval 1b,r0; jsb mcount #else #define ENTRY(x, regs) \ - .globl _/**/x; .align 2; _/**/x: .word regs + .globl _/**/x; .type _/**/x,@function; .align 2; _/**/x: .word regs #define ASENTRY(x, regs) \ - .globl x; .align 2; x: .word regs + .globl x; .type x,@function; .align 2; x: .word regs #endif +#define ALTENTRY(x) .globl _/**/x; _/**/x: #endif +#ifdef __STDC__ +#define __STRING(x) #x +#define WARN_REFERENCES(sym,msg) \ + .stabs msg ## ,30,0,0,0 ; \ + .stabs __STRING(_ ## sym) ## ,1,0,0,0 +#else +#define __STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs __STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ + #endif diff --git a/sys/arch/vax/include/clock.h b/sys/arch/vax/include/clock.h index cd496e6bdd5..e5f7d9c833e 100644 --- a/sys/arch/vax/include/clock.h +++ b/sys/arch/vax/include/clock.h @@ -1,5 +1,5 @@ -/* $OpenBSD: clock.h,v 1.3 1997/09/10 11:47:04 maja Exp $ */ -/* $NetBSD: clock.h,v 1.2 1997/05/04 19:13:33 ragge Exp $ */ +/* $OpenBSD: clock.h,v 1.4 2000/04/26 03:08:40 bjc Exp $ */ +/* $NetBSD: clock.h,v 1.4 1999/09/06 19:52:53 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -46,7 +46,7 @@ #define CLKREAD_BAD -1 #define CLKREAD_WARN -2 -#define TODRBASE (1 << 28) /* Rumours says it comes from VMS */ +#define TODRBASE (1 << 28) /* Rumours say it comes from VMS */ #define SEC_OFF 0 #define MIN_OFF 2 @@ -65,9 +65,11 @@ #define CSRB_DM 0004 #define CSRD_VRT 0200 +/* Var's used when dealing with clock chip */ +extern volatile short *clk_page; +extern int clk_adrshift, clk_tweak; + /* Prototypes */ -void generic_clock __P((void)); -void no_nicr_clock __P((void)); int generic_clkread __P((time_t)); void generic_clkwrite __P((void)); int chip_clkread __P((time_t)); diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h index 7462a4a397f..1b56bab35ce 100644 --- a/sys/arch/vax/include/cpu.h +++ b/sys/arch/vax/include/cpu.h @@ -1,5 +1,5 @@ -/* $OpenBSD: cpu.h,v 1.9 1999/01/10 13:34:20 niklas Exp $ */ -/* $NetBSD: cpu.h,v 1.24 1997/07/26 10:12:40 ragge Exp $ */ +/* $OpenBSD: cpu.h,v 1.10 2000/04/26 03:08:40 bjc Exp $ */ +/* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden @@ -31,16 +31,24 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _VAX_CPU_H_ +#define _VAX_CPU_H_ +#ifdef _KERNEL + #include #include #include #include #include +#include #define enablertclock() #define cpu_wait(p) #define cpu_swapout(p) +#define cpu_number() 0 + +void configure __P((void)); /* * All cpu-dependent info is kept in this struct. Pointer to the @@ -48,20 +56,18 @@ */ struct cpu_dep { void (*cpu_steal_pages) __P((void)); /* pmap init before mm is on */ - void (*cpu_clock) __P((void)); /* CPU dep RT clock start */ int (*cpu_mchk) __P((caddr_t)); /* Machine check handling */ void (*cpu_memerr) __P((void)); /* Memory subsystem errors */ /* Autoconfiguration */ - void (*cpu_conf) __P((struct device *, struct device *, void *)); + void (*cpu_conf) __P((void)); int (*cpu_clkread) __P((time_t)); /* Read cpu clock time */ void (*cpu_clkwrite) __P((void)); /* Write system time to cpu */ - int cpu_vups; /* speed of cpu */ - u_char *cpu_intreq; /* Used on some VAXstations */ - u_char *cpu_intclr; /* Used on some VAXstations */ - u_char *cpu_intmsk; /* Used on some VAXstations */ - struct uc_map *cpu_map; /* Map containing important addresses */ + short cpu_vups; /* speed of cpu */ + short cpu_scbsz; /* (estimated) size of system control block */ void (*cpu_halt) __P((void)); /* Cpu dependent halt call */ void (*cpu_reboot) __P((int)); /* Cpu dependent reboot call */ + void (*cpu_clrf) __P((void)); /* Clear cold/warm start flags */ + void (*cpu_subconf) __P((struct device *));/*config cpu dep. devs */ }; extern struct cpu_dep *dep_call; /* Holds pointer to current CPU struct. */ @@ -72,7 +78,6 @@ struct clockframe { }; extern struct device *booted_from; -extern int cold; extern int mastercpu; extern int bootdev; @@ -105,17 +110,32 @@ extern int want_resched; /* resched() was called */ */ #define need_proftick(p) {(p)->p_flag |= P_OWEUPC; mtpr(AST_OK,PR_ASTLVL); } +/* + * This defines the I/O device register space size in pages. + */ +#define IOSPSZ ((64*1024) / VAX_NBPG) /* 64k == 128 pages */ + +struct device; + /* Some low-level prototypes */ int badaddr __P((caddr_t, int)); void cpu_swapin __P((struct proc *)); -int hp_getdev __P((int, int, char **)); +int hp_getdev __P((int, int, struct device **)); +int sd_getdev __P((int, int, int, int, char **)); int ra_getdev __P((int, int, int, char **)); -void configure __P((void)); +int bdevtomaj __P((int)); void dumpconf __P((void)); void dumpsys __P((void)); -void setroot __P((void)); -void setconf __P((void)); void swapconf __P((void)); +void disk_printtype __P((int, int)); +void disk_reallymapin __P((struct buf *, struct pte *, int, int)); +vaddr_t vax_map_physmem __P((paddr_t, int)); +void vax_unmap_physmem __P((vaddr_t, int)); +void ioaccess __P((vaddr_t, paddr_t, int)); +void iounaccess __P((vaddr_t, int)); +void findcpu __P((void)); #ifdef DDB int kdbrint __P((int)); #endif +#endif /* _KERNEL */ +#endif /* _VAX_CPU_H_ */ diff --git a/sys/arch/vax/include/db_machdep.h b/sys/arch/vax/include/db_machdep.h index edce4e8527d..9cdb4d5ecf6 100644 --- a/sys/arch/vax/include/db_machdep.h +++ b/sys/arch/vax/include/db_machdep.h @@ -1,5 +1,5 @@ -/* $OpenBSD: db_machdep.h,v 1.6 1997/09/12 09:21:19 maja Exp $ */ -/* $NetBSD: db_machdep.h,v 1.4 1997/06/26 01:27:01 thorpej Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.7 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: db_machdep.h,v 1.6 1998/08/10 14:33:33 ragge Exp $ */ /* * Mach Operating System @@ -38,9 +38,10 @@ #include #include #include +#include typedef vm_offset_t db_addr_t; /* address - unsigned */ -typedef int db_expr_t; /* expression - signed */ +typedef long db_expr_t; /* expression - signed */ typedef struct trapframe db_regs_t; db_regs_t ddb_regs; /* register state */ @@ -73,4 +74,10 @@ db_regs_t ddb_regs; /* register state */ /* Prototypes */ void kdb_trap __P((struct trapframe *)); + +/* + * We use a.out symbols in DDB. + */ +#define DB_AOUT_SYMBOLS + #endif /* _VAX_DB_MACHDEP_H_ */ diff --git a/sys/arch/vax/include/endian.h b/sys/arch/vax/include/endian.h index 7f87596c6ef..820860ad8a4 100644 --- a/sys/arch/vax/include/endian.h +++ b/sys/arch/vax/include/endian.h @@ -1,4 +1,4 @@ -/* $OpenBSD: endian.h,v 1.9 1999/05/10 16:02:15 espie Exp $ */ +/* $OpenBSD: endian.h,v 1.10 2000/04/26 03:08:41 bjc Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -53,7 +53,9 @@ }) /* Tell sys/endian.h we have MD variants of the swap macros. */ +#ifdef notyet #define MD_SWAP +#endif #endif /* __GNUC__ */ diff --git a/sys/arch/vax/include/exec.h b/sys/arch/vax/include/exec.h index f9f949bc3ce..df88191b9a5 100644 --- a/sys/arch/vax/include/exec.h +++ b/sys/arch/vax/include/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.5 1997/05/29 00:04:38 niklas Exp $ */ +/* $OpenBSD: exec.h,v 1.6 2000/04/26 03:08:41 bjc Exp $ */ /* $NetBSD: exec.h,v 1.4 1995/09/23 14:57:40 ragge Exp $ */ /* @@ -31,7 +31,7 @@ #ifndef _VAX_EXEC_H_ #define _VAX_EXEC_H_ -#define __LDPGSZ 1024 +#define __LDPGSZ 4096 /* Relocation format. */ struct relocation_info_vax { diff --git a/sys/arch/vax/include/float.h b/sys/arch/vax/include/float.h index 2d704f0e1af..96a43897c20 100644 --- a/sys/arch/vax/include/float.h +++ b/sys/arch/vax/include/float.h @@ -1,5 +1,5 @@ -/* $OpenBSD: float.h,v 1.3 1997/08/01 21:35:35 deraadt Exp $ */ -/* $NetBSD: float.h,v 1.2 1994/10/26 08:02:08 cgd Exp $ */ +/* $OpenBSD: float.h,v 1.4 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: float.h,v 1.5 1998/10/10 02:13:55 matt Exp $ */ /* * Copyright (c) 1989 Regents of the University of California. @@ -15,8 +15,8 @@ * documentation and/or other materials provided with the distribution. * 3. 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, Berkeley and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. 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. @@ -33,44 +33,43 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)float.h 7.2 (Berkeley) 6/28/90 + * @(#)float.h 7.2 (Berkeley) 6/28/90 */ -#include +#ifndef _VAX_FLOAT_H_ +#define _VAX_FLOAT_H_ -__BEGIN_DECLS -int __flt_rounds __P((void)); -__END_DECLS +#define FLT_RADIX 2 /* b */ +#define FLT_ROUNDS 1 /* FP addition rounds to nearest */ -#define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#define FLT_MANT_DIG 24 /* p */ +#define FLT_EPSILON 1.19209290E-7F /* b**(1-p) */ +#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ +#define FLT_MIN_EXP (-127) /* emin */ +#define FLT_MIN 2.93873588E-39F /* b**(emin-1) */ +#define FLT_MIN_10_EXP (-38) /* ceil(log10(b**(emin-1))) */ +#define FLT_MAX_EXP 127 /* emax */ +#define FLT_MAX 1.70141173E+38F /* (1-b**(-p))*b**emax */ +#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ -#define FLT_MANT_DIG 24 /* p */ -#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ -#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ -#define FLT_MIN_EXP -127 /* emin */ -#define FLT_MIN 2.93873588E-39F /* b**(emin-1) */ -#define FLT_MIN_10_EXP -38 /* ceil(log10(b**(emin-1))) */ -#define FLT_MAX_EXP 127 /* emax */ -#define FLT_MAX 1.70141173E+38F /* (1-b**(-p))*b**emax */ -#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ +#define DBL_MANT_DIG 56 +#define DBL_EPSILON 2.77555756156289135E-17 +#define DBL_DIG 16 +#define DBL_MIN_EXP (-127) +#define DBL_MIN 2.938735877055718770E-39 +#define DBL_MIN_10_EXP (-38) +#define DBL_MAX_EXP 127 +#define DBL_MAX 1.701411834604692294E+38 +#define DBL_MAX_10_EXP 38 -#define DBL_MANT_DIG 56 -#define DBL_EPSILON 2.775557561562891351E-17 -#define DBL_DIG 16 -#define DBL_MIN_EXP -127 -#define DBL_MIN 2.938735877055718770E-39 -#define DBL_MIN_10_EXP -38 -#define DBL_MAX_EXP 127 -#define DBL_MAX 1.701411834604692294E+38 -#define DBL_MAX_10_EXP 38 +#define LDBL_MANT_DIG DBL_MANT_DIG +#define LDBL_EPSILON DBL_EPSILON +#define LDBL_DIG DBL_DIG +#define LDBL_MIN_EXP DBL_MIN_EXP +#define LDBL_MIN DBL_MIN +#define LDBL_MIN_10_EXP DBL_MIN_10_EXP +#define LDBL_MAX_EXP DBL_MAX_EXP +#define LDBL_MAX DBL_MAX +#define LDBL_MAX_10_EXP DBL_MAX_10_EXP -#define LDBL_MANT_DIG DBL_MANT_DIG -#define LDBL_EPSILON DBL_EPSILON -#define LDBL_DIG DBL_DIG -#define LDBL_MIN_EXP DBL_MIN_EXP -#define LDBL_MIN DBL_MIN -#define LDBL_MIN_10_EXP DBL_MIN_10_EXP -#define LDBL_MAX_EXP DBL_MAX_EXP -#define LDBL_MAX DBL_MAX -#define LDBL_MAX_10_EXP DBL_MAX_10_EXP +#endif /* _VAX_FLOAT_H_ */ diff --git a/sys/arch/vax/include/ioa.h b/sys/arch/vax/include/ioa.h index 2302e9df850..6c3f333c713 100644 --- a/sys/arch/vax/include/ioa.h +++ b/sys/arch/vax/include/ioa.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ioa.h,v 1.4 1997/05/29 00:04:40 niklas Exp $ */ -/* $NetBSD: ioa.h,v 1.4 1996/03/07 23:23:58 ragge Exp $ */ +/* $OpenBSD: ioa.h,v 1.5 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: ioa.h,v 1.5 1999/04/12 20:57:52 pk Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. * All rights reserved. @@ -53,8 +53,8 @@ * * * If the Regents of the University of California or its * * licensees modify the software in a manner creating * - * diriviative copyright rights, appropriate copyright * - * legends may be placed on the drivative work in addition * + * derivative copyright rights, appropriate copyright * + * legends may be placed on the derivative work in addition * * to that set forth above. * * * ****************************************************************/ diff --git a/sys/arch/vax/include/ka410.h b/sys/arch/vax/include/ka410.h index 68686573936..3d0095bf5c2 100644 --- a/sys/arch/vax/include/ka410.h +++ b/sys/arch/vax/include/ka410.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ka410.h,v 1.3 1997/09/10 11:47:06 maja Exp $ */ +/* $OpenBSD: ka410.h,v 1.4 2000/04/26 03:08:41 bjc Exp $ */ /* $NetBSD: ka410.h,v 1.2 1997/02/19 10:06:05 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -147,19 +147,6 @@ extern volatile unsigned char *ka410_intmsk; #define INTR_SC (1<<1) /* SCSI controller */ #define INTR_DC (1<<0) /* Disk controller */ -/* - * interrupt vector numbers - */ -#define IVEC_BASE 0x20040020 -#define IVEC_SR 0x000002C0 -#define IVEC_ST 0x000002C4 -#define IVEC_NP 0x00000250 -#define IVEC_NS 0x00000254 -#define IVEC_VF 0x00000244 -#define IVEC_VS 0x00000248 -#define IVEC_SC 0x000003F8 -#define IVEC_DC 0x000003FC - /* * Clock-Chip data in NVRAM */ @@ -206,8 +193,3 @@ struct ka410_clock { u_long :2; u_long csr3 :8; u_long :22; u_long :2; u_long cpmbx :8; u_long :22; }; - -/* Prototypes */ -int ka410_setup __P((struct uvax_calls *p, int flags)); -static int ka410_clkread __P((time_t)); -static void ka410_clkwrite __P((void)); diff --git a/sys/arch/vax/include/ka420.h b/sys/arch/vax/include/ka420.h index 3ad4175efa4..ad782ec926d 100644 --- a/sys/arch/vax/include/ka420.h +++ b/sys/arch/vax/include/ka420.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ka420.h,v 1.2 1997/05/29 00:04:41 niklas Exp $ */ -/* $NetBSD: ka420.h,v 1.1 1996/07/20 17:58:15 ragge Exp $ */ +/* $OpenBSD: ka420.h,v 1.3 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: ka420.h,v 1.2 1998/06/07 18:34:09 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -72,6 +72,8 @@ #define KA420_INTREQ 0x2008000F /* Interrupt Request register */ #define KA420_INTCLR 0x2008000F /* Interrupt Request clear register */ +#define KA420_CACR 0x20084000 /* L2 cache ctrl reg */ + /* * Other fixed addresses which should be mapped */ @@ -139,3 +141,33 @@ #define KA420_SCSIPORT 0x200B00BC /* Tape Controller Port Data */ #define KA420_RESERVED 0x200B00C0 /* Reserved (16 bytes) */ +/* Used bits in the CFGTST (20020000) register */ +#define KA420_CFG_STCMSK 0xc000 /* Storage controller mask */ +#define KA420_CFG_RB 0x0000 /* RB (ST506/SCSI) present */ +#define KA420_CFG_RD 0x4000 /* RD (SCSI/SCSI) present */ +#define KA420_CFG_NONE 0xc000 /* No storage ctlr present */ +#define KA420_CFG_MULTU 0x80 /* MicroVAX or VAXstation */ +#define KA420_CFG_CACHPR 0x40 /* Secondary cache present */ +#define KA420_CFG_L3CON 0x20 /* Console on line #3 of dc */ +#define KA420_CFG_CURTEST 0x10 /* Cursor Test (monochrom) */ +#define KA420_CFG_VIDOPT 0x08 /* Video option present */ + +/* Primary cache bits (CADR, IPR 37) */ +#define KA420_CADR_S2E 0x80 /* set 2 enable */ +#define KA420_CADR_S1E 0x40 /* set 1 enable */ +#define KA420_CADR_ISE 0x20 /* insn caching enable */ +#define KA420_CADR_DSE 0x10 /* data caching enable */ +#define KA420_CADR_WWP 0x02 /* write wrong parity */ +#define KA420_CADR_DIA 0x01 /* diagnostic mode */ + +/* Secondary cache bits (CACR, 20084000) */ +#define KA420_CACR_CP3 0x80000000 /* last parity read */ +#define KA420_CACR_CP2 0x40000000 /* last parity read */ +#define KA420_CACR_CP1 0x20000000 /* last parity read */ +#define KA420_CACR_CP0 0x10000000 /* last parity read */ +#define KA420_CACR_TPP 0x00100000 /* tag predicted parity */ +#define KA420_CACR_TGP 0x00080000 /* tag parity read */ +#define KA420_CACR_TGV 0x00040000 /* valid flag */ +#define KA420_CACR_TPE 0x00000020 /* tag parity error */ +#define KA420_CACR_CEN 0x00000010 /* cache enable */ + diff --git a/sys/arch/vax/include/ka43.h b/sys/arch/vax/include/ka43.h index 323015b1d8a..dd9e70af928 100644 --- a/sys/arch/vax/include/ka43.h +++ b/sys/arch/vax/include/ka43.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ka43.h,v 1.3 1997/09/10 11:47:07 maja Exp $ */ +/* $OpenBSD: ka43.h,v 1.4 2000/04/26 03:08:41 bjc Exp $ */ /* $NetBSD: ka43.h,v 1.2 1997/04/18 18:53:40 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -65,8 +65,8 @@ #define KA43_IVN_SIZE 0x20 #define KA43_HLTCOD 0x20080000 /* Halt Code Register */ -/* #define KA43_MSER 0x20080004 /* Memory System Error register */ -/* #define KA43_MEAR 0x20080008 /* Memory Error Address register */ +/* #define KA43_MSER 0x20080004 */ /* Memory System Error register */ +/* #define KA43_MEAR 0x20080008 */ /* Memory Error Address register */ #define KA43_INTMSK 0x2008000C /* Interrupt Mask register */ #define KA43_VDCORG 0x2008000D /* Video Controller Origin Register */ #define KA43_VDCSEL 0x2008000E /* Video Controller Select Register */ @@ -245,7 +245,3 @@ struct ka43_clock { u_long :2; u_long csr3 :8; u_long :22; u_long :2; u_long cpmbx :8; u_long :22; }; - -int ka43_setup __P((struct uvax_calls *p, int flags)); -static int ka43_clkread __P((time_t)); -static void ka43_clkwrite __P((void)); diff --git a/sys/arch/vax/include/ka630.h b/sys/arch/vax/include/ka630.h index 755376fc8c7..79391ab5c8a 100644 --- a/sys/arch/vax/include/ka630.h +++ b/sys/arch/vax/include/ka630.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ka630.h,v 1.3 1997/09/12 09:21:20 maja Exp $ */ -/* $NetBSD: ka630.h,v 1.2 1997/07/26 10:12:41 ragge Exp $ */ +/* $OpenBSD: ka630.h,v 1.4 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: ka630.h,v 1.4 2000/01/24 02:40:32 matt Exp $ */ /*- * Copyright (c) 1986, 1988 The Regents of the University of California. * All rights reserved. @@ -35,7 +35,9 @@ * @(#)uvaxII.h 7.4 (Berkeley) 5/9/91 */ -#if VAX630 || VAX410 +#ifndef _VAX_INCLUDE_KA630_H_ +#define _VAX_INCLUDE_KA630_H_ + #define UVAXIISID ((u_long *)0x20040004) #define UVAXIICPU ((struct uvaxIIcpu *)0x20080000) @@ -62,13 +64,11 @@ struct uvaxIIcpu { /* Mem. error address regs. */ #define UVAXIICEAR_PG 0x00007fff #define UVAXIIDEAR_PG 0x00007fff -#endif /* * Definitions specific to the ka630 MicroVAXII Q22 bus cpu card. Includes the * tod clock chip and the cpu registers. */ -#if VAX630 #define KA630CLK ((struct ka630clock *)0x200b8000) /* Bdr register bits */ @@ -119,9 +119,7 @@ struct ka630clock { u_short csr3; u_short cpmbx; /* CPMBX is used by the boot rom. see ka630-ug-3.3.3 */ }; - #endif -static int ka630_clkread __P((time_t)); -static void ka630_clkwrite __P((void)); -#endif +#endif /* _VAX_INCLUDE_KA630_H_ */ + diff --git a/sys/arch/vax/include/ka650.h b/sys/arch/vax/include/ka650.h index 90b5544ff0e..84a59ccd90d 100644 --- a/sys/arch/vax/include/ka650.h +++ b/sys/arch/vax/include/ka650.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ka650.h,v 1.7 1997/09/12 09:21:21 maja Exp $ */ +/* $OpenBSD: ka650.h,v 1.8 2000/04/26 03:08:41 bjc Exp $ */ /* $NetBSD: ka650.h,v 1.6 1997/07/26 10:12:43 ragge Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -243,14 +243,3 @@ struct ka650_ipcr { #define GETSYSSUBT(x) ((x >> 8) & 0xff) #define GETFRMREV(x) ((x >> 16) & 0xff) #define GETCODREV(x) (x & 0xff) - -/* prototypes */ -struct sbi_attach_args; - -void uvaxIII_conf __P((struct device *, struct device *, void *)); -int uvaxIII_clock __P((void)); -void uvaxIII_memenable __P((struct sbi_attach_args *, struct device *)); -void uvaxIII_memerr __P((void)); -int uvaxIII_mchk __P((caddr_t)); -void uvaxIII_steal_pages __P((void)); - diff --git a/sys/arch/vax/include/ka750.h b/sys/arch/vax/include/ka750.h index b0567b0dc5f..e796295b6d8 100644 --- a/sys/arch/vax/include/ka750.h +++ b/sys/arch/vax/include/ka750.h @@ -1,5 +1,5 @@ /* $NetBSD: ka750.h,v 1.8 1997/02/12 17:58:56 ragge Exp $ */ -/* $OpenBSD: ka750.h,v 1.7 1997/09/10 11:47:08 maja Exp $ */ +/* $OpenBSD: ka750.h,v 1.8 2000/04/26 03:08:41 bjc Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -42,9 +42,3 @@ /* 11/750 specific pages needed to be stolen when bootstrapping */ #define V750PGS 4 - -/* 11/750 specific prototypes */ -void ka750_conf __P((struct device *, struct device *, void *)); -void ka750_memerr __P((void)); -int ka750_mchk __P((caddr_t)); -void ka750_steal_pages __P((void)); diff --git a/sys/arch/vax/include/ka820.h b/sys/arch/vax/include/ka820.h index 618006995c3..3eaa3a73920 100644 --- a/sys/arch/vax/include/ka820.h +++ b/sys/arch/vax/include/ka820.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ka820.h,v 1.2 1997/05/29 00:04:43 niklas Exp $ */ -/* $NetBSD: ka820.h,v 1.1 1996/07/20 17:33:09 ragge Exp $ */ +/* $OpenBSD: ka820.h,v 1.3 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: ka820.h,v 1.3 2000/01/24 02:40:32 matt Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -91,6 +91,9 @@ #define KA820PORT_CRDCLR 0x00000002 /* clear CRD interrupt */ #define KA820PORT_CRDINTR 0x00000001 /* CRD interrupt request */ +/* interrupt vectors unique for this CPU */ +#define KA820_INT_RXCD 0x58 + /* what the heck */ #define KA820PORT_BITS \ "\20\40RSTHALT\37LCONS\36LCONSEN\35BIRESET\34BISTF\33ENBAPT\32STPASS\31RUN\ @@ -137,13 +140,5 @@ struct ka820clock { u_short csr3; }; -/* - * Prototypes. - */ -void ka820_conf __P((struct device *, struct device *, void *)); -void ka820_memerr __P((void)); -int ka820_mchk __P((caddr_t)); -void ka820_steal_pages __P((void)); -int ka820_clkread __P((time_t)); -void ka820_clkwrite __P((void)); +void crxintr __P((void *arg)); #endif diff --git a/sys/arch/vax/include/limits.h b/sys/arch/vax/include/limits.h index 17e16070968..2566351b37c 100644 --- a/sys/arch/vax/include/limits.h +++ b/sys/arch/vax/include/limits.h @@ -1,5 +1,5 @@ -/* $OpenBSD: limits.h,v 1.5 1998/03/22 21:15:26 millert Exp $ */ -/* $NetBSD: limits.h,v 1.6 1995/12/31 15:05:19 ragge Exp $ */ +/* $OpenBSD: limits.h,v 1.6 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: limits.h,v 1.9 2000/03/07 19:33:01 kleink Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -64,6 +64,13 @@ #if !defined(_ANSI_SOURCE) #define SSIZE_MAX INT_MAX /* max value for a ssize_t */ +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) || \ + defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L +#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */ +#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */ +#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */ +#endif + #if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) #define SIZE_T_MAX UINT_MAX /* max value for a size_t */ diff --git a/sys/arch/vax/include/macros.h b/sys/arch/vax/include/macros.h index 4422e6d540e..d17c437903a 100644 --- a/sys/arch/vax/include/macros.h +++ b/sys/arch/vax/include/macros.h @@ -1,8 +1,8 @@ -/* $OpenBSD: macros.h,v 1.7 1997/09/10 11:47:08 maja Exp $ */ -/* $NetBSD: macros.h,v 1.11 1997/03/15 15:08:23 ragge Exp $ */ +/* $OpenBSD: macros.h,v 1.8 2000/04/26 03:08:41 bjc Exp $ */ +/* $NetBSD: macros.h,v 1.17 1998/11/07 17:22:58 ragge Exp $ */ /* - * Copyright (c) 1994 Ludd, University of Lule}, Sweden. + * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,96 +33,214 @@ /* All bugs are subject to removal without further notice */ -#if !defined(_VAX_MACROS_H_) && !defined(STANDALONE) && \ - (!defined(_LOCORE) && defined(_VAX_INLINE_)) -#define _VAX_MACROS_H_ +#if !defined(_VAX_MACROS_H_) && !defined(lint) +#define _VAX_MACROS_H_ /* Here general macros are supposed to be stored */ -static __inline__ int ffs(int reg){ +static __inline__ int +ffs(int reg) +{ register int val; - asm __volatile ("ffs $0,$32,%1,%0 + __asm__ __volatile ("ffs $0,$32,%1,%0 bneq 1f mnegl $1,%0 - 1: incl %0" - : "&=r" (val) + 1: incl %0" + : "=&r" (val) : "r" (reg) ); return val; } -static __inline__ void _remque(void*p){ - asm __volatile ("remque (%0),%0;clrl 4(%0)" +static __inline__ void +_remque(void *p) +{ + __asm__ __volatile ("remque (%0),%0;clrl 4(%0)" : : "r" (p) : "memory" ); } -static __inline__ void _insque(void*p, void*q) { - asm __volatile ("insque (%0), (%1)" - : - : "r" (p),"r" (q) - : "memory" ); -} - -#define bitset(bitnr,var) \ -({ asm __volatile ("bbss %0,%1,1f;1:;" \ - : \ - : "g" (bitnr), "g" (var)); \ -}) - -#define bitclear(bitnr,var) \ -({ asm __volatile ("bbsc %0,%1,1f;1:;" \ - : \ - : "g" (bitnr), "g" (var)); \ -}) - -#define bitisset(bitnr,var) \ -({ \ - register int val; \ - asm __volatile ("clrl %0;bbc %1,%2,1f;incl %0;1:;" \ - : "=g" (val) \ - : "g" (bitnr), "g" (var)); \ - val; \ -}) - -#define bitisclear(bitnr,var) \ -({ \ - register int val; \ - asm __volatile ("clrl %0;bbs %1,%2,1f;incl %0;1:;" \ - : "=g" (val) \ - : "g" (bitnr), "g" (var)); \ - val; \ -}) -static __inline__ void bcopy(const void*from, void*toe, u_int len) { - asm __volatile ("movc3 %0,(%1),(%2)" +static __inline__ void +_insque(void *p, void *q) +{ + __asm__ __volatile ("insque (%0), (%1)" + : + : "r" (p),"r" (q) + : "memory" ); +} + +static __inline__ void * +memcpy(void *toe, const void *from, u_int len) +{ + __asm__ __volatile ("movc3 %0,(%1),(%2)" + : + : "r" (len),"r" (from),"r"(toe) + :"r0","r1","r2","r3","r4","r5","memory","cc"); + return toe; +} +static __inline__ void * +memmove(void *toe, const void *from, u_int len) +{ + __asm__ __volatile ("movc3 %0,(%1),(%2)" + : + : "r" (len),"r" (from),"r"(toe) + :"r0","r1","r2","r3","r4","r5","memory","cc"); + return toe; +} + +#ifdef notnow +static __inline__ void +bcopy(const void *from, void *toe, u_int len) +{ + __asm__ __volatile ("movc3 %0,(%1),(%2)" : : "r" (len),"r" (from),"r"(toe) - :"r0","r1","r2","r3","r4","r5"); + :"r0","r1","r2","r3","r4","r5","memory","cc"); } +#endif -static __inline__ void bzero(void*block, u_int len){ - asm __volatile ("movc5 $0,(%0),$0,%1,(%0)" +void blkclr __P((void *, u_int)); + +static __inline__ void * +memset(void *block, int c, size_t len) +{ + if (len > 65535) + blkclr(block, len); + else { + __asm__ __volatile ("movc5 $0,(%0),%2,%1,(%0)" + : + : "r" (block), "r" (len), "r"(c) + :"r0","r1","r2","r3","r4","r5","memory","cc"); + } + return block; +} + +static __inline__ void +bzero(void *block, u_int len) +{ + if (len > 65535) + blkclr(block, len); + else { + __asm__ __volatile ("movc5 $0,(%0),$0,%1,(%0)" : : "r" (block), "r" (len) - :"r0","r1","r2","r3","r4","r5"); + :"r0","r1","r2","r3","r4","r5","memory","cc"); + } } -static __inline__ int bcmp(const void *b1, const void *b2, size_t len){ - register ret; +/* XXX - the return syntax of memcmp is wrong */ +static __inline__ int +memcmp(const void *b1, const void *b2, size_t len) +{ + register int ret; - asm __volatile("cmpc3 %3,(%1),(%2);movl r0,%0" + __asm__ __volatile("cmpc3 %3,(%1),(%2);movl r0,%0" : "=r" (ret) : "r" (b1), "r" (b2), "r" (len) : "r0","r1","r2","r3" ); return ret; } +static __inline__ int +bcmp(const void *b1, const void *b2, size_t len) +{ + register int ret; + + __asm__ __volatile("cmpc3 %3,(%1),(%2);movl r0,%0" + : "=r" (ret) + : "r" (b1), "r" (b2), "r" (len) + : "r0","r1","r2","r3" ); + return ret; +} + +/* Begin nya */ +static __inline__ size_t +strlen(const char *cp) +{ + register size_t ret; + + __asm__ __volatile("locc $0,$65535,(%1);subl3 r0,$65535,%0" + : "=r" (ret) + : "r" (cp) + : "r0","r1","cc" ); + return ret; +} + +static __inline__ char * +strcat(char *cp, const char *c2) +{ + __asm__ __volatile("locc $0,$65535,(%1);subl3 r0,$65535,r2;incl r2; + locc $0,$65535,(%0);movc3 r2,(%1),(r1)" + : + : "r" (cp), "r" (c2) + : "r0","r1","r2","r3","r4","r5","memory","cc"); + return cp; +} + +static __inline__ char * +strncat(char *cp, const char *c2, size_t count) +{ + __asm__ __volatile("locc $0,%2,(%1);subl3 r0,%2,r2; + locc $0,$65535,(%0);movc3 r2,(%1),(r1);movb $0,(r3)" + : + : "r" (cp), "r" (c2), "g"(count) + : "r0","r1","r2","r3","r4","r5","memory","cc"); + return cp; +} + +static __inline__ char * +strcpy(char *cp, const char *c2) +{ + __asm__ __volatile("locc $0,$65535,(%1);subl3 r0,$65535,r2; + movc3 r2,(%1),(%0);movb $0,(r3)" + : + : "r" (cp), "r" (c2) + : "r0","r1","r2","r3","r4","r5","memory","cc"); + return cp; +} + +static __inline__ char * +strncpy(char *cp, const char *c2, size_t len) +{ + __asm__ __volatile("movl %2,r2;locc $0,r2,(%1);beql 1f;subl3 r0,%2,r2; + clrb (%0)[r2];1:;movc3 r2,(%1),(%0)" + : + : "r" (cp), "r" (c2), "g"(len) + : "r0","r1","r2","r3","r4","r5","memory","cc"); + return cp; +} + +static __inline__ void * +memchr(const void *cp, int c, size_t len) +{ + void *ret; + __asm__ __volatile("locc %2,%3,(%1);bneq 1f;clrl r1;1:movl r1,%0" + : "=g"(ret) + : "r" (cp), "r" (c), "g"(len) + : "r0","r1","cc"); + return ret; +} + +static __inline__ int +strcmp(const char *cp, const char *c2) +{ + register int ret; + __asm__ __volatile("locc $0,$65535,(%1);subl3 r0,$65535,r0;incl r0; + cmpc3 r0,(%1),(%2);beql 1f;movl $1,r2; + cmpb (r1),(r3);bcc 1f;movl $-1,r2;1:movl r2,%0" + : "=g"(ret) + : "r" (cp), "r" (c2) + : "r0","r1","r2","r3","cc"); + return ret; +} +/* End nya */ + #if 0 /* unused, but no point in deleting it since it _is_ an instruction */ static __inline__ int locc(int mask, char *cp,u_int size){ register ret; - asm __volatile("locc %1,%2,(%3);movl r0,%0" + __asm__ __volatile("locc %1,%2,(%3);movl r0,%0" : "=r" (ret) : "r" (mask),"r"(size),"r"(cp) : "r0","r1" ); @@ -131,86 +249,36 @@ static __inline__ int locc(int mask, char *cp,u_int size){ #endif static __inline__ int -scanc(u_int size, const u_char *cp, const u_char *table, int mask){ - register ret; +scanc(u_int size, const u_char *cp, const u_char *table, int mask) +{ + register int ret; - asm __volatile("scanc %1,(%2),(%3),%4;movl r0,%0" + __asm__ __volatile("scanc %1,(%2),(%3),%4;movl r0,%0" : "=g"(ret) : "r"(size),"r"(cp),"r"(table),"r"(mask) : "r0","r1","r2","r3" ); return ret; } -static __inline__ int skpc(int mask, size_t size, u_char *cp){ - register ret; +static __inline__ int +skpc(int mask, size_t size, u_char *cp) +{ + register int ret; - asm __volatile("skpc %1,%2,(%3);movl r0,%0" + __asm__ __volatile("skpc %1,%2,(%3);movl r0,%0" : "=g"(ret) : "r"(mask),"r"(size),"r"(cp) : "r0","r1" ); return ret; } -#if 0 -static __inline__ int imin(int a, int b){ - asm __volatile("cmpl %0,%2;bleq 1f;movl %2,%0;1:" - : "=r"(a) - : "r"(a),"r"(b) ); - return a; -} -static __inline__ int imax(int a, int b){ - asm __volatile("cmpl %0,%2;bgeq 1f;movl %2,%0;1:" - : "=r"(a) - : "r"(a),"r"(b) ); - return a; -} +#define setrunqueue(p) \ + __asm__ __volatile("movl %0,r0;jsb Setrq":: "g"(p):"r0","r1","r2"); -static __inline__ int min(int a, int b){ - asm __volatile("cmpl %0,%2;bleq 1f;movl %2,%0;1:" - : "=r"(a) - : "r"(a),"r"(b) ); - return a; -} - -static __inline__ int max(int a, int b){ - asm __volatile("cmpl %0,%2;bgeq 1f;movl %2,%0;1:" - : "=r"(a) - : "r"(a),"r"(b) ); - return a; -} -#endif - -static __inline__ void blkcpy(const void*from, void*to, u_int len) { - asm __volatile(" - movl %0,r1 - movl %1,r3 - movl %2,r6 - jbr 2f - 1: subl2 r0,r6 - movc3 r0,(r1),(r3) - 2: movzwl $65535,r0 - cmpl r6,r0 - jgtr 1b - movc3 r6,(r1),(r3)" - : - : "g" (from), "g" (to), "g" (len) - : "r0","r1","r2","r3","r4","r5", "r6" ); -} - -static __inline__ void blkclr(void *blk, int len) { - asm __volatile(" - movl %0, r3 - movl %1, r6 - jbr 2f - 1: subl2 r0, r6 - movc5 $0,(r3),$0,r0,(r3) - 2: movzwl $65535,r0 - cmpl r6, r0 - jgtr 1b - movc5 $0,(r3),$0,r6,(r3)" - : - : "g" (blk), "g" (len) - : "r0","r1","r2","r3","r4","r5", "r6" ); -} +#define remrunqueue(p) \ + __asm__ __volatile("movl %0,r0;jsb Remrq":: "g"(p):"r0","r1","r2"); +#define cpu_switch(p) \ + __asm__ __volatile("movl %0,r0;movpsl -(sp);jsb Swtch" \ + ::"g"(p):"r0","r1","r2","r3"); #endif /* _VAX_MACROS_H_ */ diff --git a/sys/arch/vax/include/mtpr.h b/sys/arch/vax/include/mtpr.h index 62d6e5e0418..f41e3474b38 100644 --- a/sys/arch/vax/include/mtpr.h +++ b/sys/arch/vax/include/mtpr.h @@ -1,5 +1,5 @@ -/* $OpenBSD: mtpr.h,v 1.4 1997/05/29 00:04:44 niklas Exp $ */ -/* $NetBSD: mtpr.h,v 1.9 1996/07/20 17:58:18 ragge Exp $ */ +/* $OpenBSD: mtpr.h,v 1.5 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: mtpr.h,v 1.12 1999/06/06 19:06:29 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -36,8 +36,6 @@ #ifndef _VAX_MTPR_H_ #define _VAX_MTPR_H_ -#include - /****************************************************************************** Processor register numbers in the VAX /IC @@ -137,6 +135,17 @@ #define PR_BINID 94 /* VAXBI node ID Register (KA820) */ #define PR_BISTOP 95 /* VAXBI Stop Register (KA820) */ +#define PR_BCBTS 113 /* Backup Cache Tag Store (KA670) */ +#define PR_BCP1TS 114 /* Primary Tag Store 1st half (KA670) */ +#define PR_BCP2TS 115 /* Primary Tag Store 2st half (KA670) */ +#define PR_BCRFR 116 /* Refresh Register (KA670) */ +#define PR_BCIDX 117 /* Index Register (KA670) */ +#define PR_BCSTS 118 /* Status (KA670) */ +#define PR_BCCTL 119 /* Control Register (KA670) */ +#define PR_BCERR 120 /* Error Address (KA670) */ +#define PR_BCFBTS 121 /* Flush backup tag store (KA670) */ +#define PR_BCFPTS 122 /* Flush primary tag store (KA670) */ + #define PR_VINTSR 123 /* vector i/f error status (KA43/KA46) */ #define PR_PCTAG 124 /* primary cache tag store (KA43/KA46) */ #define PR_PCIDX 125 /* primary cache index (KA43/KA46) */ @@ -151,7 +160,7 @@ #define mtpr(val,reg) \ { \ - asm __volatile ("mtpr %0,%1" \ + __asm__ __volatile ("mtpr %0,%1" \ : /* No output */ \ : "g" (val), "g" (reg)); \ } @@ -159,7 +168,7 @@ #define mfpr(reg) \ ({ \ register int val; \ - asm __volatile ("mfpr %1,%0" \ + __asm__ __volatile ("mfpr %1,%0" \ : "=g" (val) \ : "g" (reg)); \ val; \ diff --git a/sys/arch/vax/include/nexus.h b/sys/arch/vax/include/nexus.h index 191b950ba7d..7c50f1e1fec 100644 --- a/sys/arch/vax/include/nexus.h +++ b/sys/arch/vax/include/nexus.h @@ -1,5 +1,5 @@ -/* $OpenBSD: nexus.h,v 1.7 1997/05/29 00:04:45 niklas Exp $ */ -/* $NetBSD: nexus.h,v 1.12 1996/08/20 14:19:43 ragge Exp $ */ +/* $OpenBSD: nexus.h,v 1.8 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: nexus.h,v 1.15 1999/08/07 10:36:46 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -41,14 +41,17 @@ /* * Different definitions for nicer autoconf probing. */ -#define VAX_SBIBUS 1 /* SBI parent; 780/790 */ -#define VAX_CPUBUS 2 /* Has backplane CPU */ -#define VAX_MEMBUS 4 /* Has backplane memory */ -#define VAX_UNIBUS 8 /* Directly attached (630/650) */ -#define VAX_VSBUS 16 /* VAXstation board */ -#define VAX_BIBUS 32 /* BI bus expansions: 8200/8800 */ -#define VAX_CMIBUS 64 /* CMI backplane (750) */ - +enum bustypes { + VAX_SBIBUS, /* SBI parent (780) */ + VAX_CMIBUS, /* CMI backplane (750) */ + VAX_UNIBUS, /* Direct backplane (730) */ + VAX_ABUS, /* SBI placeholder (8600) */ + VAX_BIBUS, /* BI bus (8200) */ + VAX_NBIBUS, /* NBI backplane (8800) */ + VAX_VSBUS, /* Virtual vaxstation bus */ + VAX_IBUS, /* Internal Microvax bus */ + VAX_XMIBUS, /* XMI master bus (6000) */ +}; /* * Information about nexus's. * @@ -83,9 +86,7 @@ #define MAXNNEXUS NNEXSBI #endif -#ifndef _LOCORE - -#include +#ifdef _KERNEL struct nexus { union nexcsr { @@ -189,8 +190,4 @@ extern caddr_t *nex_vec; #define MCHK_PANIC -1 #define MCHK_RECOVERED 0 -#ifndef _LOCORE -struct nexus *nexus; -#endif - #endif /* _VAX_NEXUS_H_ */ diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h index 5c58e8b270c..511da1a26e9 100644 --- a/sys/arch/vax/include/param.h +++ b/sys/arch/vax/include/param.h @@ -1,5 +1,5 @@ -/* $OpenBSD: param.h,v 1.11 1997/10/02 22:55:43 niklas Exp $ */ -/* $NetBSD: param.h,v 1.24 1997/08/05 13:28:51 ragge Exp $ */ +/* $OpenBSD: param.h,v 1.12 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: param.h,v 1.39 1999/10/22 21:14:34 ragge Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -41,9 +41,6 @@ #ifndef _VAX_PARAM_H_ #define _VAX_PARAM_H_ -#include -#include - /* * Machine dependent constants for VAX. */ @@ -66,37 +63,41 @@ * */ -#define ALIGNBYTES (sizeof (int) - 1) -#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) -#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof (t) - 1)) == 0) +#define ALIGNBYTES (sizeof(int) - 1) +#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) +#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) -#define PGSHIFT 9 /* log2(NBPG) */ -#define NBPG (1 << PGSHIFT) /* (1 << PGSHIFT) bytes/page */ -#define PGOFSET (NBPG - 1) /* byte offset into page */ -#define NPTEPG (NBPG / (sizeof (struct pte))) +#define PGSHIFT 12 /* LOG2(NBPG) */ +#define NBPG (1 << PGSHIFT) /* (1 << PGSHIFT) bytes/page */ +#define PGOFSET (NBPG - 1) /* byte offset into page */ + +#define VAX_PGSHIFT 9 +#define VAX_NBPG (1 << VAX_PGSHIFT) +#define VAX_PGOFSET (VAX_NBPG - 1) #define KERNBASE 0x80000000 /* start of kernel virtual */ -#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #define DEV_BSIZE (1 << DEV_BSHIFT) -#define BLKDEV_IOSIZE 2048 -#define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ +#define MAXBSIZE 0x4000 /* max FS block size - XXX */ -#define CLSIZELOG2 1 -#define CLSIZE 2 +#define CLSIZELOG2 0 +#define CLSIZE 1 -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ -#define SSIZE 4 /* initial stack size/NBPG */ -#define SINCR 4 /* increment of stack/NBPG */ +#define UPAGES 2 /* pages of u-area */ +#define USPACE (NBPG*UPAGES) +#define REDZONEADDR (VAX_NBPG*3) /* Must be > sizeof(struct user) */ -#define UPAGES 16 /* pages of u-area */ -#define USPACE (NBPG * UPAGES) +#ifndef MSGBUFSIZE +#define MSGBUFSIZE 8192 /* default message buffer size */ +#endif /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than NBPG (the software page size), and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -107,12 +108,13 @@ #endif /* MSIZE */ #ifndef MCLSHIFT -#define MCLSHIFT 10 /* convert bytes to m_buf clusters */ +#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ #endif /* MCLSHIFT */ #define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */ #define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */ #ifndef NMBCLUSTERS + #ifdef GATEWAY #define NMBCLUSTERS 512 /* map size, max cluster allocation */ #else @@ -121,11 +123,11 @@ #endif /* NMBCLUSTERS */ /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in NBPG-sized logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (2048 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (4096*1024/NBPG) #endif /* @@ -138,13 +140,17 @@ /* clicks to bytes */ #define ctob(x) ((x) << PGSHIFT) -#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) +#define btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT) #define btop(x) (((unsigned)(x)) >> PGSHIFT) /* bytes to disk blocks */ #define btodb(x) ((x) >> DEV_BSHIFT) #define dbtob(x) ((x) << DEV_BSHIFT) +/* MD conversion macros */ +#define vax_btoc(x) (((unsigned)(x) + VAX_PGOFSET) >> VAX_PGSHIFT) +#define vax_btop(x) (((unsigned)(x)) >> VAX_PGSHIFT) + /* * Map a ``block device block'' to a file system block. * This should be device dependent, and will be if we @@ -152,28 +158,48 @@ * For now though just use DEV_BSIZE. */ -#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE)) +#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) + +#define ovbcopy(x,y,z) bcopy(x, y, z) -#define splx(reg) \ -({ \ - int val; \ - \ - asm __volatile ("mfpr $0x12,%0; mtpr %1,$0x12" \ - : "&=g" (val) : "g" (reg)); \ - val; \ +#ifdef _KERNEL +#define pmap_pageable(a,b,c,d) /* Dont do anything */ +#ifndef lint +#define splx(reg) \ +({ \ + register int val; \ + __asm __volatile ("mfpr $0x12,%0;mtpr %1,$0x12" \ + : "=&g" (val) \ + : "g" (reg)); \ + val; \ }) +#define _splraise(reg) \ +({ \ + register int val; \ + __asm __volatile ("mfpr $0x12,%0" \ + : "=&g" (val) \ + : ); \ + if ((reg) > val) { \ + __asm __volatile ("mtpr %0,$0x12" \ + : \ + : "g" (reg)); \ + } \ + val; \ +}) +#endif #define spl0() splx(0) /* IPL0 */ -#define splsoftclock() splx(8) /* IPL08 */ -#define splsoftnet() splx(0xc) /* IPL0C */ -#define splddb() splx(0xf) /* IPL0F */ -#define splbio() splx(0x15) /* IPL15 */ -#define splnet() splx(0x15) /* IPL15 */ -#define spltty() splx(0x15) /* IPL15 */ -#define splimp() splx(0x17) /* IPL17 */ -#define splclock() splx(0x18) /* IPL18 */ -#define splhigh() splx(0x1f) /* IPL1F */ +#define spllowersoftclock() splx(8) /* IPL08 */ +#define splsoftclock() _splraise(8) /* IPL08 */ +#define splsoftnet() _splraise(0xc) /* IPL0C */ +#define splddb() _splraise(0xf) /* IPL0F */ +#define splbio() _splraise(0x15) /* IPL15 */ +#define splnet() _splraise(0x15) /* IPL15 */ +#define spltty() _splraise(0x15) /* IPL15 */ +#define splimp() _splraise(0x17) /* IPL17 */ +#define splclock() _splraise(0x18) /* IPL18 */ +#define splhigh() _splraise(0x1f) /* IPL1F */ #define splstatclock() splclock() /* These are better to use when playing with VAX buses */ @@ -182,17 +208,14 @@ #define spl6() splx(0x16) #define spl7() splx(0x17) -#define ovbcopy(x,y,z) bcopy(x, y, z) - -#if !defined(VAX410) && !defined(VAX43) #define vmapbuf(p,q) #define vunmapbuf(p,q) -#endif -#ifdef _KERNEL /* Prototype needed for delay() */ #ifndef _LOCORE void delay __P((int)); +/* inline macros used inside kernel */ +#include #endif #define DELAY(x) delay(x) diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index 3022c97e207..412aefaff0f 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,5 +1,5 @@ -/* $OpenBSD: pmap.h,v 1.8 1998/03/01 12:09:02 maja Exp $ */ -/* $NetBSD: pmap.h,v 1.19 1997/07/06 22:38:29 ragge Exp $ */ +/* $OpenBSD: pmap.h,v 1.9 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -44,28 +44,37 @@ */ -#ifndef PMAP_H -#define PMAP_H +#ifndef PMAP_H +#define PMAP_H +#include +#include #include +#include - -#define VAX_PAGE_SIZE NBPG -#define VAX_SEG_SIZE NBSEG +/* + * Some constants to make life easier. + */ +#define LTOHPS (PGSHIFT - VAX_PGSHIFT) +#define LTOHPN (1 << LTOHPS) +#define USRPTSIZE ((MAXTSIZ + MAXDSIZ + MAXSSIZ + MMAPSPACE) / VAX_NBPG) +#define NPTEPGS (USRPTSIZE / (sizeof(struct pte) * LTOHPN)) /* - * Pmap structure - * - * p0br == PR_P0BR in user struct, p0br is also == SBR in pmap_kernel() - * p1br is the same for stack space, stack is base of alloced pte mem + * Pmap structure + * pm_stack holds lowest allocated memory for the process stack. */ typedef struct pmap { - vm_offset_t pm_stack; /* Base of alloced p1 pte space */ - struct pcb *pm_pcb; /* Pointer to PCB for this pmap */ - int ref_count; /* reference count */ - struct pmap_statistics stats; /* statistics */ - simple_lock_data_t pm_lock; /* lock on pmap */ + vaddr_t pm_stack; /* Base of alloced p1 pte space */ + int ref_count; /* reference count */ + struct pte *pm_p0br; /* page 0 base register */ + long pm_p0lr; /* page 0 length register */ + struct pte *pm_p1br; /* page 1 base register */ + long pm_p1lr; /* page 1 length register */ + int pm_lock; /* Lock entry in MP environment */ + struct pmap_statistics pm_stats; /* Some statistics */ + u_char pm_refcnt[NPTEPGS]; /* Refcount per pte page */ } *pmap_t; /* @@ -73,55 +82,71 @@ typedef struct pmap { * mappings of that page. An entry is a pv_entry_t, the list is pv_table. */ -typedef struct pv_entry { - struct pv_entry *pv_next; /* next pv_entry */ - struct pmap *pv_pmap;/* if not NULL, pmap where mapping lies */ - vm_offset_t pv_va; /* virtual address for mapping */ - int pv_flags; /* flags */ -} *pv_entry_t; - -#define PV_REF 0x00000001 /* Simulated phys ref bit */ - -#define PHYS_TO_PV(phys_page) (&pv_table[((phys_page)>>PAGE_SHIFT)]) +struct pv_entry { + struct pv_entry *pv_next; /* next pv_entry */ + struct pte *pv_pte; /* pte for this physical page */ + struct pmap *pv_pmap; /* pmap this entry belongs to */ + int pv_attr; /* write/modified bits */ +}; /* ROUND_PAGE used before vm system is initialized */ -#define ROUND_PAGE(x) (((uint)(x) + PAGE_SIZE-1)& ~(PAGE_SIZE - 1)) -#define TRUNC_PAGE(x) ((uint)(x) & ~(PAGE_SIZE - 1)) +#define ROUND_PAGE(x) (((uint)(x) + PGOFSET) & ~PGOFSET) +#define TRUNC_PAGE(x) ((uint)(x) & ~PGOFSET) /* Mapping macros used when allocating SPT */ -#define MAPVIRT(ptr, count) \ +#define MAPVIRT(ptr, count) \ (vm_offset_t)ptr = virtual_avail; \ - virtual_avail += (count) * NBPG; + virtual_avail += (count) * VAX_NBPG; -#define MAPPHYS(ptr, count, perm) \ - pmap_map(virtual_avail, avail_start, avail_start + \ - (count) * NBPG, perm); \ - (vm_offset_t)ptr = virtual_avail; \ - virtual_avail += (count) * NBPG; \ - avail_start += (count) * NBPG; +#define MAPPHYS(ptr, count, perm) \ + (vm_offset_t)ptr = avail_start + KERNBASE; \ + avail_start += (count) * VAX_NBPG; #ifdef _KERNEL -#define pa_index(pa) atop(pa) -#define pa_to_pvh(pa) (&pv_table[atop(pa)]) extern struct pmap kernel_pmap_store; -#define pmap_kernel() (&kernel_pmap_store) +#define pmap_kernel() (&kernel_pmap_store) -#endif /* _KERNEL */ +/* + * Real nice (fast) routines to get the virtual address of a physical page + * (and vice versa). + */ +#define PMAP_MAP_POOLPAGE(pa) ((pa) | KERNBASE) +#define PMAP_UNMAP_POOLPAGE(va) ((va) & ~KERNBASE) + +#define PMAP_STEAL_MEMORY + +/* + * This is the by far most used pmap routine. Make it inline. + */ /* Routines that are best to define as macros */ -#define pmap_copy(a,b,c,d,e) /* Dont do anything */ -#define pmap_update() mtpr(0,PR_TBIA) /* Update buffes */ -#define pmap_pageable(a,b,c,d) /* Dont do anything */ -#define pmap_collect(pmap) /* No need so far */ -#define pmap_reference(pmap) if(pmap) (pmap)->ref_count++ -#define pmap_pinit(pmap) (pmap)->ref_count=1; -#define pmap_phys_address(phys) ((u_int)(phys)<pm_stats.resident_count) +#define pmap_deactivate(p) /* Dont do anything */ +#define pmap_reference(pmap) (pmap)->ref_count++ + +/* These can be done as efficient inline macros */ +#define pmap_copy_page(src, dst) \ + __asm__("addl3 $0x80000000,%0,r0;addl3 $0x80000000,%1,r1; \ + movc3 $4096,(r0),(r1)" \ + :: "r"(src),"r"(dst):"r0","r1","r2","r3","r4","r5"); + +#define pmap_zero_page(phys) \ + __asm__("addl3 $0x80000000,%0,r0;movc5 $0,(r0),$0,$4096,(r0)" \ + :: "r"(phys): "r0","r1","r2","r3","r4","r5"); /* Prototypes */ void pmap_bootstrap __P((void)); -vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int)); -void pmap_expandp0 __P((struct pmap *, int)); -void pmap_expandp1 __P((struct pmap *)); +vaddr_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int)); +void pmap_pinit __P((pmap_t)); + +#endif /* _KERNEL */ + #endif PMAP_H diff --git a/sys/arch/vax/include/proc.h b/sys/arch/vax/include/proc.h index e31407a9a9b..af982fb0532 100644 --- a/sys/arch/vax/include/proc.h +++ b/sys/arch/vax/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.2 1997/05/29 00:04:46 niklas Exp $ */ +/* $OpenBSD: proc.h,v 1.3 2000/04/26 03:08:42 bjc Exp $ */ /* $NetBSD: proc.h,v 1.2 1994/10/26 08:02:21 cgd Exp $ */ /* @@ -37,7 +37,7 @@ */ /* - * Machine-dependent part of the proc structure for hp300. + * Machine-dependent part of the proc structure for vax. */ struct mdproc { int md_flags; /* machine-dependent flags */ diff --git a/sys/arch/vax/include/profile.h b/sys/arch/vax/include/profile.h index 06b5ba737dc..e25e03966a1 100644 --- a/sys/arch/vax/include/profile.h +++ b/sys/arch/vax/include/profile.h @@ -1,4 +1,4 @@ -/* $OpenBSD: profile.h,v 1.5 1997/05/29 00:04:47 niklas Exp $ */ +/* $OpenBSD: profile.h,v 1.6 2000/04/26 03:08:42 bjc Exp $ */ /* $NetBSD: profile.h,v 1.5 1995/12/31 12:15:58 ragge Exp $ */ /* * Copyright (c) 1992 The Regents of the University of California. @@ -47,7 +47,7 @@ * to __mcount, so that our return address won't get popped from stack. */ #define MCOUNT \ -asm(".text; .globl mcount; mcount: pushl 16(fp); calls $1,__mcount; rsb"); +__asm__(".text; .globl mcount; mcount: pushl 16(fp); calls $1,__mcount; rsb"); #ifdef _KERNEL /* diff --git a/sys/arch/vax/include/psl.h b/sys/arch/vax/include/psl.h index f7c099858d9..958bf1c9e44 100644 --- a/sys/arch/vax/include/psl.h +++ b/sys/arch/vax/include/psl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: psl.h,v 1.4 1997/09/12 09:21:23 maja Exp $ */ +/* $OpenBSD: psl.h,v 1.5 2000/04/26 03:08:42 bjc Exp $ */ /* $NetBSD: psl.h,v 1.6 1997/06/07 12:15:28 ragge Exp $ */ /* @@ -84,7 +84,7 @@ #define PSL_PREVU 0x00c00000 /* Previous user mode */ #define PSL_K 0x00000000 /* kernel mode */ #define PSL_E 0x01000000 /* executive mode */ -#define PSL_S 0x02000000 /* executive mode */ +#define PSL_S 0x02000000 /* supervisor mode */ #define PSL_U 0x03000000 /* user mode */ #define PSL_IS 0x04000000 /* interrupt stack select */ #define PSL_FPD 0x08000000 /* first part done flag */ diff --git a/sys/arch/vax/include/pte.h b/sys/arch/vax/include/pte.h index 65a2b892cf5..072f83de975 100644 --- a/sys/arch/vax/include/pte.h +++ b/sys/arch/vax/include/pte.h @@ -1,5 +1,5 @@ -/* $OpenBSD: pte.h,v 1.5 1997/05/29 00:04:48 niklas Exp $ */ -/* $NetBSD: pte.h,v 1.10 1996/02/23 17:54:33 ragge Exp $ */ +/* $OpenBSD: pte.h,v 1.6 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: pte.h,v 1.13 1999/08/03 19:53:23 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -31,10 +31,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#ifndef _VAX_PTE_H_ +#define _VAX_PTE_H_ #ifndef _LOCORE - /* * VAX page table entries */ @@ -72,7 +72,7 @@ typedef struct pte pt_entry_t; /* Mach page table entry */ #define PG_W 0x00400000 #define PG_U 0x00200000 #define PG_FRAME 0x001fffff -#define PG_PFNUM(x) ((x) >> PGSHIFT) +#define PG_PFNUM(x) (((unsigned long)(x) & 0x3ffffe00) >> VAX_PGSHIFT) #ifndef _LOCORE extern pt_entry_t *Sysmap; @@ -81,13 +81,14 @@ extern pt_entry_t *Sysmap; */ #endif -#define kvtopte(va) \ - (&Sysmap[((unsigned)(va) & ~KERNBASE) >> PGSHIFT]) +#define kvtopte(va) (&Sysmap[PG_PFNUM(va)]) #define ptetokv(pt) \ - ((((pt_entry_t *)(pt) - Sysmap) << PGSHIFT) + 0x80000000) + ((((pt_entry_t *)(pt) - Sysmap) << VAX_PGSHIFT) + 0x80000000) #define kvtophys(va) \ - (((kvtopte(va))->pg_pfn << PGSHIFT) | ((int)(va) & PGOFSET)) + (((kvtopte(va))->pg_pfn << VAX_PGSHIFT) | ((int)(va) & VAX_PGOFSET)) #define uvtopte(va, pcb) \ - (((unsigned)va < 0x40000000) || ((unsigned)va > 0x80000000) ? \ - &((pcb->P0BR)[(unsigned)va >> PGSHIFT]) : \ - &((pcb->P1BR)[((unsigned)va & 0x3fffffff) >> PGSHIFT])) + (((unsigned)va < 0x40000000) ? \ + &((pcb->P0BR)[PG_PFNUM(va)]) : \ + &((pcb->P1BR)[PG_PFNUM(va)])) + +#endif diff --git a/sys/arch/vax/include/rpb.h b/sys/arch/vax/include/rpb.h index d46f8951a90..4ac82087cd8 100644 --- a/sys/arch/vax/include/rpb.h +++ b/sys/arch/vax/include/rpb.h @@ -1,5 +1,5 @@ -/* $OpenBSD: rpb.h,v 1.5 1997/09/12 09:21:24 maja Exp $ */ -/* $NetBSD: rpb.h,v 1.4 1997/06/13 08:24:09 ragge Exp $ */ +/* $OpenBSD: rpb.h,v 1.6 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: rpb.h,v 1.6 1998/07/01 09:37:11 ragge Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -40,7 +40,8 @@ struct rpb { /* size description */ struct rpb *rpb_base; /* 4 physical base address of block */ - void (*rpb_restart)();/* 4 physical address of restart routine */ + void (*rpb_restart)/* 4 physical address of restart routine */ + __P((void)); long rpb_chksum;/* 4 checksum of first 31 longwords of restart */ long rpb_rstflg; /* 4 Restart in progress flag */ long rpb_haltpc; /* 4 PC at HALT/restart */ @@ -119,6 +120,9 @@ struct rpb { /* size description */ #define BDEV_DE 97 #define BDEV_NI 98 #define BDEV_LE 99 +#define BDEV_ZE 100 + +#define BDEV_NET BDEV_QE /* first network BDEV */ #ifdef _KERNEL extern struct rpb rpb; diff --git a/sys/arch/vax/include/scb.h b/sys/arch/vax/include/scb.h index 0671719bb82..745c2a372aa 100644 --- a/sys/arch/vax/include/scb.h +++ b/sys/arch/vax/include/scb.h @@ -1,5 +1,5 @@ -/* $OpenBSD: scb.h,v 1.4 1997/05/29 00:04:50 niklas Exp $ */ -/* $NetBSD: scb.h,v 1.4 1995/12/13 18:54:56 ragge Exp $ */ +/* $OpenBSD: scb.h,v 1.5 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: scb.h,v 1.6 2000/01/24 02:40:32 matt Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -30,7 +30,8 @@ * (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 _VAX_SCB_H +#define _VAX_SCB_H /* * Definition of the System Control Block. More about it can be @@ -104,6 +105,16 @@ struct scb { struct ivec_dsp *scb_nexvec[4][16]; /* Nexus interrupt vectors */ }; +#define SCB_KSTACK 0 +#define SCB_ISTACK 1 + #ifdef _KERNEL extern struct scb *scb; -#endif + +extern paddr_t scb_init __P((paddr_t)); +extern int scb_vecref __P((int *, int *)); +extern void scb_fake __P((int, int)); +extern void scb_vecalloc __P((int, void(*)(void *), void *, int)); +#endif /* _KERNEL */ + +#endif /* _VAX_SCB_H */ diff --git a/sys/arch/vax/include/setjmp.h b/sys/arch/vax/include/setjmp.h index a16cf580648..f35f7d86e91 100644 --- a/sys/arch/vax/include/setjmp.h +++ b/sys/arch/vax/include/setjmp.h @@ -1,8 +1,8 @@ -/* $OpenBSD: setjmp.h,v 1.2 1997/05/29 00:04:51 niklas Exp $ */ +/* $OpenBSD: setjmp.h,v 1.3 2000/04/26 03:08:42 bjc Exp $ */ /* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:18 cgd Exp $ */ /* * machine/setjmp.h: machine dependent setjmp-related information. */ -#define _JBLEN 10 /* size, in longs, of a jmp_buf */ +#define _JBLEN 14 /* size, in longs, of a jmp_buf */ diff --git a/sys/arch/vax/include/sid.h b/sys/arch/vax/include/sid.h index 0cdd8a586a7..0193a9e4fc2 100644 --- a/sys/arch/vax/include/sid.h +++ b/sys/arch/vax/include/sid.h @@ -1,5 +1,5 @@ -/* $OpenBSD: sid.h,v 1.5 1997/09/10 11:47:10 maja Exp $ */ -/* $NetBSD: sid.h,v 1.9 1997/02/12 17:50:38 ragge Exp $ */ +/* $OpenBSD: sid.h,v 1.6 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: sid.h,v 1.12 1999/12/11 17:55:13 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -79,7 +79,7 @@ #define VAX_TYP_UV1 7 /* MicroVAX I, VAXstation I */ /* VAX_TYP_610 7 */ -#define VAX_BTYP_610 0x70000000 /* generic MicroVAX-I */ +#define VAX_BTYP_610 0x07000000 /* generic MicroVAX-I */ /* * MicroVAX II series (1985) @@ -104,6 +104,7 @@ #define VAX_BTYP_9CC 0x0A000002 /* VAX 6000 model 210/310 */ #define VAX_BTYP_60 0x0A000003 /* VAXstation 3520, 3540 */ #define VAX_BTYP_420 0x0A000004 /* VAXstation 3100 models 10 - 48 */ +#define VAX_BTYP_IS1 0x0A000006 /* Infoserver 1000 */ #define VAX_BTYP_510 0x0A000007 /* VAXft model 110 */ /* VAX_BTYP_520 0x0A000007 VAXft model 310 */ @@ -168,7 +169,7 @@ #define VAX_TYP_V14 20 #define VAX_BTYP_660 0x14000001 /* VAX 4000 model 200 */ -#define VAX_BTYP_440 0x14000004 /* VS 4000/30, 3100/30, 3100/40 */ +#define VAX_BTYP_48 0x14000004 /* VAXstation 4000 VLC */ #define VAX_BTYP_550 0x14000007 /* VAXft model 410, 610 */ /* @@ -180,7 +181,7 @@ #define VAX_BTYP_1701 0x17000001 /* - * Highest Number supported by NetBSD/VAX + * Highest Number supported by OpenBSD/VAX */ #define VAX_TYP_MAX VAX_TYP_RIGEL diff --git a/sys/arch/vax/include/stdarg.h b/sys/arch/vax/include/stdarg.h index 676ad682bc3..97d3cdce40f 100644 --- a/sys/arch/vax/include/stdarg.h +++ b/sys/arch/vax/include/stdarg.h @@ -1,5 +1,5 @@ -/* $OpenBSD: stdarg.h,v 1.3 1997/05/29 00:04:53 niklas Exp $ */ -/* $NetBSD: stdarg.h,v 1.8 1995/12/25 23:15:37 mycroft Exp $ */ +/* $OpenBSD: stdarg.h,v 1.4 2000/04/26 03:08:42 bjc Exp $ */ +/* $NetBSD: stdarg.h,v 1.11 1999/05/03 16:30:34 christos Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -43,15 +43,19 @@ typedef _BSD_VA_LIST_ va_list; +#ifdef __lint__ +#define __builtin_next_arg(t) ((t) ? 0 : 0) +#endif + #define __va_size(type) \ (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) #define va_start(ap, last) \ - ((ap) = (va_list)&(last) + __va_size(last)) + ((ap) = (va_list)__builtin_next_arg(last)) #define va_arg(ap, type) \ - (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) + (*(type *)(void *)((ap) += __va_size(type), (ap) - __va_size(type))) -#define va_end(ap) ((void)0) +#define va_end(ap) #endif /* !_VAX_STDARG_H_ */ diff --git a/sys/arch/vax/include/trap.h b/sys/arch/vax/include/trap.h index 860ea3fd6fb..5b19bbb71e3 100644 --- a/sys/arch/vax/include/trap.h +++ b/sys/arch/vax/include/trap.h @@ -1,5 +1,5 @@ -/* $OpenBSD: trap.h,v 1.9 1997/09/12 09:21:25 maja Exp $ */ -/* $NetBSD: trap.h,v 1.16 1997/07/28 21:48:36 ragge Exp $ */ +/* $OpenBSD: trap.h,v 1.10 2000/04/26 03:08:43 bjc Exp $ */ +/* $NetBSD: trap.h,v 1.17 2000/01/24 02:40:32 matt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -100,20 +100,18 @@ struct trapframe { */ struct ivec_dsp { char pushr; /* pushr */ - char pushrarg; /* $3f */ - char pushl; /* pushl */ - char pushlarg; /* $? */ - char nop; /* nop, for foolish gcc */ - char calls[3]; /* calls $1,? */ - void (*hoppaddr) __P((int)); /* jump for calls */ - char popr; /* popr $0x3f */ - char poprarg; - char rei; /* rei */ - char pad; /* sizeof(struct ivec_dsp) == 16 */ + char pushrarg; /* $0x3f */ + char jsb; + char mode; + long displacement; + void (*hoppaddr) __P((void *)); + void *pushlarg; }; -extern struct ivec_dsp idsptch; +#ifdef _KERNEL +extern const struct ivec_dsp idsptch; +#endif #endif /* _LOCORE */ -#endif _VAX_TRAP_H_ +#endif /* _VAX_TRAP_H_ */ diff --git a/sys/arch/vax/include/types.h b/sys/arch/vax/include/types.h index 703cc497aed..f539c447eb7 100644 --- a/sys/arch/vax/include/types.h +++ b/sys/arch/vax/include/types.h @@ -1,5 +1,5 @@ -/* $OpenBSD: types.h,v 1.9 1999/01/08 03:04:09 millert Exp $ */ -/* $NetBSD: types.h,v 1.10 1996/12/05 00:14:00 cgd Exp $ */ +/* $OpenBSD: types.h,v 1.10 2000/04/26 03:08:43 bjc Exp $ */ +/* $NetBSD: types.h,v 1.14 1998/08/13 02:10:49 eeh Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -41,12 +41,7 @@ #include -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -typedef struct _physadr { - int r[1]; -} *physadr; - - +#if defined(_KERNEL) typedef struct label_t { int val[6]; } label_t; @@ -55,26 +50,31 @@ typedef struct label_t { typedef unsigned long vm_offset_t; typedef unsigned long vm_size_t; +typedef vm_offset_t paddr_t; +typedef vm_size_t psize_t; +typedef vm_offset_t vaddr_t; +typedef vm_size_t vsize_t; + /* * Basic integral types. Omit the typedef if * not possible for a machine/compiler combination. */ #define __BIT_TYPES_DEFINED__ typedef __signed char int8_t; +typedef unsigned char uint8_t; typedef unsigned char u_int8_t; -typedef unsigned char uint8_t; typedef short int16_t; +typedef unsigned short uint16_t; typedef unsigned short u_int16_t; -typedef unsigned short uint16_t; typedef int int32_t; +typedef unsigned int uint32_t; typedef unsigned int u_int32_t; -typedef unsigned int uint32_t; +/* LONGLONG */ typedef long long int64_t; -typedef unsigned long long u_int64_t; +/* LONGLONG */ typedef unsigned long long uint64_t; +typedef unsigned long long u_int64_t; typedef int32_t register_t; -#define __BROKEN_INDIRECT_CONFIG - #endif /* _MACHTYPES_H_ */ diff --git a/sys/arch/vax/include/uvax.h b/sys/arch/vax/include/uvax.h index 31f493098b1..28e40c331cc 100644 --- a/sys/arch/vax/include/uvax.h +++ b/sys/arch/vax/include/uvax.h @@ -1,5 +1,5 @@ -/* $OpenBSD: uvax.h,v 1.3 1997/09/10 11:47:11 maja Exp $ */ -/* $NetBSD: uvax.h,v 1.2 1997/02/19 10:06:07 ragge Exp $ */ +/* $OpenBSD: uvax.h,v 1.4 2000/04/26 03:08:43 bjc Exp $ */ +/* $NetBSD: uvax.h,v 1.5 1999/02/02 18:37:22 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -36,51 +36,6 @@ #ifndef _VAX_UVAX_H_ #define _VAX_UVAX_H_ -/* - * generic(?) MicroVAX and VAXstation support - * - * There are similarities to struct cpu_calls[] in autoconf.c - */ - -/* - * Prototypes for autoconf.c - */ -struct device; -void uvax_conf __P((struct device*, struct device*, void*)); -int uvax_clock __P((void)); -void uvax_memerr __P((void)); -int uvax_mchk __P((caddr_t)); -void uvax_steal_pages __P((void)); - -int uvax_setup __P((int mapen)); - -struct uvax_calls { - u_long (*uc_memsize) __P((void)); - - char *uc_name; - - void *le_iomem; /* base addr of RAM -- CPU's view */ - u_long *le_ioaddr; /* base addr of RAM -- LANCE's view */ - int *le_memsize; /* size of RAM reserved for LANCE */ - - void *uc_physmap; - int uc_vups; /* used by delay() */ - - int uv_flags; - int vs_flags; -}; - -extern struct uvax_calls guc; /* Generic uVAX Calls */ -extern struct uvax_calls *ucp; - -struct uc_map { - u_long um_base; - u_long um_end; - u_long um_size; - u_long um_virt; -}; -extern struct uc_map *uc_physmap; - /* * Generic definitions common on all MicroVAXen clock chip. */ @@ -103,9 +58,30 @@ extern struct uc_map *uc_physmap; #define uVAX_CLKRSTRT 010 #define uVAX_CLKLANG 0360 -/* Prototypes */ -int uvax_clkread __P((time_t)); -void uvax_clkwrite __P((void)); -void uvax_fillmap __P((void)); -u_long uvax_phys2virt __P((u_long)); +/* + * Miscellaneous registers common on most VAXststions. + */ +struct vs_cpu { + u_long vc_hltcod; /* Halt Code Register */ + u_long vc_410mser; /* VS2K */ + u_long vc_410cear; /* VS2K */ + u_char vc_intmsk; /* Interrupt mask register */ + u_char vc_vdcorg; /* Mono display origin */ + u_char vc_vdcsel; /* Video interrupt select */ + u_char vc_intreq; /* Interrupt request register */ +#define vc_intclr vc_intreq + u_short vc_diagdsp; /* Diagnostic display register */ + u_short pad4; + u_long vc_parctl; /* Parity Control Register */ +#define vc_bwf0 vc_parctl + u_short pad5; + u_short pad6; + u_short vc_diagtimu; /* usecond timer KA46 */ + u_short vc_diagtme; /* Diagnostic time register */ +#define vc_diagtimm vc_diagtme /* msecond time KA46 */ +}; +#define PARCTL_DMA 0x1000000 +#define PARCTL_CPEN 2 +#define PARCTL_DPEN 1 + #endif diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h index ad2e6b212c6..b59ec18740d 100644 --- a/sys/arch/vax/include/vmparam.h +++ b/sys/arch/vax/include/vmparam.h @@ -1,5 +1,5 @@ -/* $OpenBSD: vmparam.h,v 1.8 1997/09/12 09:21:25 maja Exp $ */ -/* $NetBSD: vmparam.h,v 1.15 1997/07/12 16:20:38 perry Exp $ */ +/* $OpenBSD: vmparam.h,v 1.9 2000/04/26 03:08:43 bjc Exp $ */ +/* $NetBSD: vmparam.h,v 1.27 1999/10/22 21:14:35 ragge Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -40,45 +40,41 @@ * * @(#)vmparam.h 5.9 (Berkeley) 5/12/91 */ -#ifndef _LOCORE -#include -#endif +#ifndef _VMPARAM_H_ +#define _VMPARAM_H_ /* * Machine dependent constants for VAX. */ /* - * Virtual address space arrangement. On 386, both user and kernel - * share the address space, not unlike the vax. * USRTEXT is the start of the user text/data space, while USRSTACK * is the top (end) of the user stack. Immediately above the user stack - * resides the user structure, which is UPAGES long and contains the - * kernel stack. + * resides kernel. * */ -#define USRTEXT 0x400 -#define USRSTACK 0x7fffe000 /* XXX */ +#define USRTEXT NBPG +#define USRSTACK KERNBASE /* * Virtual memory related constants, all in bytes */ #ifndef MAXTSIZ -#define MAXTSIZ (8*1024*1024) /* max text size */ +#define MAXTSIZ (8*1024*1024) /* max text size */ #endif #ifndef MAXDSIZ -#define MAXDSIZ (24*1024*1024) /* max data size */ +#define MAXDSIZ (24*1024*1024) /* max data size */ #endif -#ifndef MAXSSIZ -#define MAXSSIZ (8*1024*1024) /* max stack size */ +#ifndef MAXSSIZ +#define MAXSSIZ (8*1024*1024) /* max stack size */ #endif #ifndef DFLDSIZ -#define DFLDSIZ (16*1024*1024) /* initial data size limit */ +#define DFLDSIZ (16*1024*1024) /* initial data size limit */ #endif -#ifndef DFLSSIZ -#define DFLSSIZ (512*1024) /* initial stack size limit */ +#ifndef DFLSSIZ +#define DFLSSIZ (512*1024) /* initial stack size limit */ #endif /* @@ -87,17 +83,7 @@ * Note: This is just a hint, if we mmap() more than this the page * table will be expanded. (at the cost of speed). */ -#define MMAPSPACE (24*1024*1024) - -/* - * Default sizes of swap allocation chunks (see dmap.h). - * The actual values may be changed in vminit() based on MAXDSIZ. - * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. - */ - -#define DMMIN 32 /* smallest swap allocation */ -#define DMMAX 4096 /* largest potential swap allocation */ -#define DMTEXT 1024 /* swap allocation for text */ +#define MMAPSPACE (8*1024*1024) /* * Size of shared memory map @@ -107,22 +93,17 @@ #define SHMMAXPGS 64 /* XXXX should be 1024 */ #endif -/* - * Size of User Raw I/O map - */ -#define USRIOSIZE 300 - /* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; + * amount of real time. You probably shouldn't change this; * it is used in subtle ways (fractions and multiples of it are, that is, like * half of a ``long time'', almost a long time, etc.) * It is related to human patience and other factors which don't really * change over time. */ -#define MAXSLP 20 +#define MAXSLP 20 /* * A swapped in process is given a small amount of core without being bothered @@ -136,17 +117,28 @@ * so we loan each swapped in process memory worth 100$, or just admit * that we don't consider it worthwhile and swap it out to disk which costs * $30/mb or about $0.75. - * Update: memory prices have changed recently (9/96). At the current + * Update: memory prices have changed recently (9/96). At the current * value of $6 per megabyte, we lend each swapped in process memory worth * $0.15, or just admit that we don't consider it worthwhile and swap it out * to disk which costs $0.20/MB, or just under half a cent. */ -#define SAFERSS 8 /* nominal ``small'' resident set size +#define SAFERSS 8 /* nominal ``small'' resident set size protected against replacement */ +#define VM_PHYSSEG_MAX 1 +#define VM_PHYSSEG_NOADD +#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH /* XXX */ + +#define VM_NFREELIST 1 +#define VM_FREELIST_DEFAULT 0 -#define mapin(pte, v, pfnum, prot) \ - {(*(int *)(pte) = ((pfnum)<p_addr) +#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) +#define PMAP_NEW +#define MACHINE_NEW_NONCONTIG 1 +#endif diff --git a/sys/arch/vax/include/vsbus.h b/sys/arch/vax/include/vsbus.h index 0827eb3e1c2..384038f9014 100644 --- a/sys/arch/vax/include/vsbus.h +++ b/sys/arch/vax/include/vsbus.h @@ -1,5 +1,5 @@ -/* $OpenBSD: vsbus.h,v 1.2 1997/05/29 00:04:57 niklas Exp $ */ -/* $NetBSD: vsbus.h,v 1.1 1996/07/20 17:58:28 ragge Exp $ */ +/* $OpenBSD: vsbus.h,v 1.3 2000/04/26 03:08:43 bjc Exp $ */ +/* $NetBSD: vsbus.h,v 1.9 1999/10/22 21:10:13 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -37,51 +37,97 @@ * Generic definitions for the (virtual) vsbus. contains common info * used by all VAXstations. */ + +#ifndef _VAX_VSBUS_H_ +#define _VAX_VSBUS_H_ + +#include + +struct vsbus_softc { + struct device sc_dev; +#if 0 + volatile struct vs_cpu *sc_cpu; +#endif + u_char *sc_intmsk; /* Mask register */ + u_char *sc_intclr; /* Clear interrupt register */ + u_char *sc_intreq; /* Interrupt request register */ + u_char sc_mask; /* Interrupts to enable after autoconf */ +}; + struct confargs { - char ca_name[16]; /* device name */ - int ca_intslot; /* device interrupt-slot */ - int ca_intpri; /* device interrupt "priority" */ - int ca_intvec; /* interrup-vector offset */ - int ca_intbit; /* bit in interrupt-register */ - int ca_ioaddr; /* device hardware I/O address */ + char ca_name[16]; /* device name */ + int ca_intslot; /* device interrupt-slot */ + int ca_intpri; /* device interrupt "priority" */ + int ca_intvec; /* interrup-vector offset */ + int ca_intbit; /* bit in interrupt-register */ + int ca_ioaddr; /* device hardware I/O address */ - int ca_aux1; /* additional info (DMA, etc.) */ - int ca_aux2; - int ca_aux3; - int ca_aux4; - int ca_aux5; - int ca_aux6; - int ca_aux7; - int ca_aux8; + int ca_aux1; /* additional info (DMA, etc.) */ + int ca_aux2; + int ca_aux3; + int ca_aux4; + int ca_aux5; + int ca_aux6; + int ca_aux7; + int ca_aux8; -#define ca_recvslot ca_intslot /* DC/DZ: Receiver configuration */ -#define ca_recvpri ca_intpri -#define ca_recvvec ca_intvec -#define ca_recvbit ca_intbit -#define ca_xmitslot ca_aux1 /* DC/DZ: transmitter configuration */ -#define ca_xmitpri ca_aux2 /* DC/DZ: */ -#define ca_xmitvec ca_aux3 -#define ca_xmitbit ca_aux4 -#define ca_dcflags ca_aux5 +#define ca_recvslot ca_intslot /* DC/DZ: Receiver configuration */ +#define ca_recvpri ca_intpri +#define ca_recvvec ca_intvec +#define ca_recvbit ca_intbit +#define ca_xmitslot ca_aux1 /* DC/DZ: transmitter configuration */ +#define ca_xmitpri ca_aux2 /* DC/DZ: */ +#define ca_xmitvec ca_aux3 +#define ca_xmitbit ca_aux4 +#define ca_dcflags ca_aux5 -#define ca_dareg ca_aux1 /* SCSI: DMA address register */ -#define ca_dcreg ca_aux2 /* SCSI: DMA byte count register */ -#define ca_ddreg ca_aux3 /* SCSI: DMA transfer direction */ -#define ca_dbase ca_aux4 /* SCSI: DMA buffer address */ -#define ca_dsize ca_aux5 /* SCSI: DMA buffer size */ -#define ca_dflag ca_aux6 /* SCSI: DMA flags (eg. shared) */ -#define ca_idval ca_aux7 /* SCSI: host-ID to use/set */ -#define ca_idreg ca_aux8 /* SCSI: host-ID port register */ +#define ca_dareg ca_aux1 /* SCSI: DMA address register */ +#define ca_dcreg ca_aux2 /* SCSI: DMA byte count register */ +#define ca_ddreg ca_aux3 /* SCSI: DMA transfer direction */ +#define ca_dbase ca_aux4 /* SCSI: DMA buffer address */ +#define ca_dsize ca_aux5 /* SCSI: DMA buffer size */ +#define ca_dflag ca_aux6 /* SCSI: DMA flags (eg. shared) */ +#define ca_idval ca_aux7 /* SCSI: host-ID to use/set */ +#define ca_idreg ca_aux8 /* SCSI: host-ID port register */ -#define ca_enaddr ca_aux1 /* LANCE: Ethernet address in ROM */ -#define ca_leflags ca_aux2 +#define ca_enaddr ca_aux1 /* LANCE: Ethernet address in ROM */ +#define ca_leflags ca_aux2 }; -int vsbus_intr_register __P((struct confargs *, int(*)(void*), void*)); -int vsbus_intr_enable __P((struct confargs *)); -int vsbus_intr_disable __P((struct confargs *)); -int vsbus_intr_unregister __P((struct confargs *)); +struct vsbus_attach_args { + vaddr_t va_addr; /* virtual CSR address */ + paddr_t va_paddr; /* physical CSR address */ + + void (*va_ivec) __P((void *)); /* Interrupt routine */ + void *va_vecarg; /* Interrupt routine argument */ -int vsbus_lockDMA __P((struct confargs *)); -int vsbus_unlockDMA __P((struct confargs *)); + short va_br; /* Interrupt level */ + short va_cvec; /* Interrupt vector address */ + u_char va_maskno; /* Interrupt vector in mask */ + bus_dma_tag_t va_dmat; + struct confargs *confargs; +}; + +/* + * Some chip addresses and constants, same on all VAXstations. + */ +#define VS_CFGTST 0x20020000 /* config register */ +#define VS_REGS 0x20080000 /* Misc cpu internal regs */ +#define NI_ADDR 0x20090000 /* Ethernet address */ +#define DZ_CSR 0x200a0000 /* DZ11-compatible chip csr */ +#define VS_CLOCK 0x200b0000 /* clock chip address */ +#define SCA_REGS 0x200c0000 /* disk device addresses */ +#define NI_BASE 0x200e0000 /* LANCE CSRs */ +#define NI_IOSIZE (128 * VAX_NBPG) /* IO address size */ + +/* + * Small monochrome graphics framebuffer, present on all machines. + */ +#define SMADDR 0x30000000 +#define SMSIZE 0x20000 /* Actually 256k, only 128k used */ +u_char vsbus_setmask __P((unsigned char)); +void vsbus_clrintr __P((unsigned char)); +void vsbus_copytoproc(struct proc *, caddr_t, caddr_t, int); +void vsbus_copyfromproc(struct proc *, caddr_t, caddr_t, int); +#endif /* _VAX_VSBUS_H_ */ -- 2.20.1