diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /sys/arch/sun3/include |
initial import of NetBSD tree
Diffstat (limited to 'sys/arch/sun3/include')
46 files changed, 3095 insertions, 0 deletions
diff --git a/sys/arch/sun3/include/ansi.h b/sys/arch/sun3/include/ansi.h new file mode 100644 index 00000000000..29163b2e37b --- /dev/null +++ b/sys/arch/sun3/include/ansi.h @@ -0,0 +1,3 @@ +/* $NetBSD: ansi.h,v 1.5 1994/11/21 21:33:21 gwr Exp $ */ + +#include <m68k/ansi.h> diff --git a/sys/arch/sun3/include/asm.h b/sys/arch/sun3/include/asm.h new file mode 100644 index 00000000000..56a63d152b1 --- /dev/null +++ b/sys/arch/sun3/include/asm.h @@ -0,0 +1,3 @@ +/* $NetBSD: asm.h,v 1.7 1994/11/21 21:33:24 gwr Exp $ */ + +#include <m68k/asm.h> diff --git a/sys/arch/sun3/include/autoconf.h b/sys/arch/sun3/include/autoconf.h new file mode 100644 index 00000000000..60b7e477c24 --- /dev/null +++ b/sys/arch/sun3/include/autoconf.h @@ -0,0 +1,61 @@ +/* $NetBSD: autoconf.h,v 1.9 1995/01/11 20:38:33 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Autoconfiguration information. + */ + +/* These are the "bus" types: */ +#define BUS_OBMEM 0 /* "obmem" */ +#define BUS_OBIO 1 /* "obio" */ +#define BUS_VME16 2 /* "vmes" */ +#define BUS_VME32 3 /* "vmel" */ +/* These are pseudo buses: */ +#define BUS_OBCTL 4 + +/* + * This is the "args" parameter to the bus match/attach functions. + */ +struct confargs { + int ca_bustype; /* BUS_OBIO, ... */ + int ca_paddr; /* physical address */ + int ca_intpri; /* interrupt priority level */ + int ca_intvec; /* interrupt vector index */ +}; + +int always_match __P((struct device *, void *, void *)); +void bus_scan __P((struct device *, void *, int)); +int bus_print __P((void *, char *)); +int bus_peek __P((int, int, int)); +char * bus_mapin __P((int, int, int)); diff --git a/sys/arch/sun3/include/cdefs.h b/sys/arch/sun3/include/cdefs.h new file mode 100644 index 00000000000..32f47bc045c --- /dev/null +++ b/sys/arch/sun3/include/cdefs.h @@ -0,0 +1,3 @@ +/* $NetBSD: cdefs.h,v 1.2 1995/01/24 05:58:40 gwr Exp $ */ + +#include <m68k/cdefs.h> diff --git a/sys/arch/sun3/include/cg2reg.h b/sys/arch/sun3/include/cg2reg.h new file mode 100644 index 00000000000..2fc9e29f2a8 --- /dev/null +++ b/sys/arch/sun3/include/cg2reg.h @@ -0,0 +1,257 @@ +/* $NetBSD: cg2reg.h,v 1.3 1995/04/07 02:54:43 gwr Exp $ */ + +/* + * Copyright (c) 1994 Dennis Ferguson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* cg2reg.h - CG2 colour frame buffer definitions + * + * The mapped memory looks like: + * + * offset contents + * 0x000000 bit plane map - 1st (of 8) plane used by the X server in -mono mode + * 0x100000 pixel map - used by the X server in color mode + * 0x200000 raster op mode memory map - unused by X server + * 0x300000 random control registers (lots of spaces in between) + * 0x310000 shadow colour map + */ + +/* Frame buffer memory size and depth */ +#define CG2_FBSIZE (1024 * 1024) +#define CG2_N_PLANE 8 + +/* Screen dimensions */ +#define CG2_WIDTH 1152 +#define CG2_HEIGHT 900 + +/* arrangement of bit plane mode memory */ +union bitplane { + u_short word[CG2_HEIGHT][CG2_WIDTH/(CG2_N_PLANE * sizeof(u_short))]; + u_short plane[CG2_FBSIZE/(CG2_N_PLANE * sizeof(u_short))]; +}; + +/* arrangement of pixel mode memory */ +union byteplane { + u_char pixel[CG2_HEIGHT][CG2_WIDTH]; + u_char frame[CG2_FBSIZE]; +}; + + +/* + * Structure describing the first two megabytes of the frame buffer. + * Normal memory maps in bit plane and pixel modes + */ +struct cg2memfb { + union bitplane memplane[CG2_N_PLANE]; /* bit plane map */ + union byteplane pixplane; /* pixel map */ +}; + + +/* + * Control/status register. The X server only appears to use update_cmap + * and video_enab. + */ +struct cg2statusreg { + u_int reserved : 2; /* not used */ + u_int fastread : 1; /* r/o: has some feature I don't understand */ + u_int id : 1; /* r/o: ext status and ID registers exist */ + u_int resolution : 4; /* screen resolution, 0 means 1152x900 */ + u_int retrace : 1; /* r/o: retrace in progress */ + u_int inpend : 1; /* r/o: interrupt request */ + u_int ropmode : 3; /* ?? */ + u_int inten : 1; /* interrupt enable (for end of retrace) */ + u_int update_cmap : 1; /* copy/use shadow colour map */ + u_int video_enab : 1; /* enable video */ +}; + + +/* + * Extended status register. Unused by X server + */ +struct cg2_extstatus { + u_int gpintreq : 1; /* interrupt request */ + u_int gpintdis : 1; /* interrupt disable */ + u_int reserved : 13; /* unused */ + u_int gpbus : 1; /* bus enabled */ +}; + + +/* + * Double buffer control register. It appears that (some of?) the + * cg2 cards support a pair of memory sets, referred to as `A' and + * `B', which can be swapped to allow atomic screen updates. This + * controls them. + */ +struct dblbufreg { + u_int display_b : 1; /* display memory B (set) or A (reset) */ + u_int read_b : 1; /* accesss memory B (set) or A (reset) */ + u_int nowrite_b : 1; /* when set, writes don't update memory B */ + u_int nowrite_a : 1; /* when set, writes don't update memory A */ + u_int read_ecmap : 1; /* copy from(clear)/to(set) shadow colour map */ + u_int fast_read : 1; /* fast reads, but wrong data */ + u_int wait : 1; /* when set, remains so to end up v. retrace */ + u_int update_ecmap : 1; /* copy/use shadow colour map */ + u_int reserved : 8; +}; + + +/* + * Zoom register, apparently present on Sun-2 colour boards only. See + * the Sun documentation, I don't know anyone who still has a Sun-2. + */ +struct cg2_zoom { + union { + u_int short reg; + u_char reg_pad[4096]; + } wordpan; + union { + struct { + u_int unused : 8; + u_int lineoff : 4; + u_int pixzoom : 4; + } reg; + u_short word; + u_char reg_pad[4096]; + } zoom; + union { + struct { + u_int unused : 8; + u_int lorigin : 4; + u_int pixeloff : 4; + } reg; + u_short word; + u_char reg_pad[4096]; + } pixpan; + union { + u_short reg; + u_char reg_pad[4096]; + } varzoom; +}; + + +/* + * Miscellany. On the Sun-3 these registers exist in place of the above. + */ +struct cg2_nozoom { + union { /* double buffer register (see above) */ + struct dblbufreg reg; + u_short word; + u_char reg_pad[4096]; + } dblbuf; + union { /* start of dma window */ + u_short reg; + u_char reg_pad[4096]; + } dmabase; + union { /* dma window size */ + u_short reg; /* actually 8 bits. reg*16 == size */ + u_char reg_pad[4096]; + } dmawidth; + union { /* frame count */ + u_short reg; /* actually 8 bits only. r/o */ + u_char reg_pad[4096]; + } framecnt; +}; + + +/* + * Raster op control registers. X doesn't use this, but documented here + * for future reference. + */ +struct memropc { + u_short mrc_dest; + u_short mrc_source1; + u_short mrc_source2; + u_short mrc_pattern; + u_short mrc_mask1; + u_short mrc_mask2; + u_short mrc_shift; + u_short mrc_op; + u_short mrc_width; + u_short mrc_opcount; + u_short mrc_decoderout; + u_short mrc_x11; + u_short mrc_x12; + u_short mrc_x13; + u_short mrc_x14; + u_short mrc_x15; +}; + + +/* + * Last chunk of the frame buffer (i.e. from offset 0x200000 and above). + * Exists separately from struct cg2memfb apparently because Sun software + * avoids mapping the latter, though X uses it. + */ +struct cg2fb { + +#ifndef _KERNEL /* XXX - Hack! */ + /* XXX - Don't want this permanently in the kernel mapping. */ + union { /* raster op mode frame memory */ + union bitplane ropplane[CG2_N_PLANE]; + union byteplane roppixel; + } ropio; +#endif /* _KERNEL XXX - Hack! */ + + union { /* raster op control unit (1 per plane) */ + struct memropc ropregs; + struct { + u_char pad[2048]; + struct memropc ropregs; + } prime; + u_char reg_pad[4096]; + } ropcontrol[9]; + union { /* status register */ + struct cg2statusreg reg; + u_short word; + u_char reg_pad[4096]; + } status; + union { /* per-plane mask register */ + u_short reg; /* 8 bit mask register - set means plane r/w */ + u_char reg_pad[4096]; + } ppmask; + union { /* miscellaneous registers */ + struct cg2_zoom zoom; + struct cg2_nozoom nozoom; + } misc; + union { /* interrupt vector */ + u_short reg; + u_char reg_pad[32]; + } intrptvec; + union { /* board ID */ + u_short reg; + u_char reg_pad[16]; + } id; + union { /* extended status */ + struct cg2_extstatus reg; + u_short word; + u_char reg_pad[16]; + } extstatus; + union { /* auxiliary raster op mode register (?)*/ + u_short reg; + u_char reg_pad[4032]; + } ropmode; + u_short redmap[256]; /* shadow colour maps */ + u_short greenmap[256]; + u_short bluemap[256]; +}; diff --git a/sys/arch/sun3/include/control.h b/sys/arch/sun3/include/control.h new file mode 100644 index 00000000000..649babd3cc3 --- /dev/null +++ b/sys/arch/sun3/include/control.h @@ -0,0 +1,96 @@ +/* $NetBSD: control.h,v 1.13 1995/10/10 21:29:02 gwr Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * defines for sun3 control space + */ + +#define IDPROM_BASE 0x00000000 +#define PGMAP_BASE 0x10000000 +#define SEGMAP_BASE 0x20000000 +#define CONTEXT_REG 0x30000000 +#define SYSTEM_ENAB 0x40000000 +#define UDVMA_ENAB 0x50000000 +#define BUSERR_REG 0x60000000 +#define DIAG_REG 0x70000000 + +#define CONTROL_ADDR_MASK 0x0FFFFFFC + + +#define NBSEG 0x20000 +#define NPMEG 0x100 + +#define VAC_CACHE_TAGS 0x80000000 +#define VAC_CACHE_DATA 0x90000000 +#define VAC_FLUSH_BASE 0xA0000000 +#define VAC_FLUSH_CONTEXT 0x1 +#define VAC_FLUSH_PAGE 0x2 +#define VAC_FLUSH_SEGMENT 0x3 + +#define CONTEXT_0 0x0 +#define CONTEXT_1 0x1 +#define CONTEXT_2 0x2 +#define CONTEXT_3 0x3 +#define CONTEXT_4 0x4 +#define CONTEXT_5 0x5 +#define CONTEXT_6 0x6 +#define CONTEXT_7 0x7 +#define CONTEXT_NUM 0x8 +#define CONTEXT_MASK 0x7 + +#define SYSTEM_ENAB_DIAG 0x01 +#define SYSTEM_ENAB_FPA 0x02 +#define SYSTEM_ENAB_COPY 0x04 +#define SYSTEM_ENAB_VIDEO 0x08 +#define SYSTEM_ENAB_CACHE 0x10 +#define SYSTEM_ENAB_SVDMA 0x20 +#define SYSTEM_ENAB_FPP 0x40 +#define SYSTEM_ENAB_BOOT 0x80 + +#include <sys/types.h> + +unsigned char get_control_byte __P((char *)); +unsigned int get_control_word __P((char *)); +void set_control_byte __P((char *, unsigned char)); +void set_control_word __P((char *, unsigned int)); + +int get_context __P((void)); +void set_context __P((int)); + +vm_offset_t get_pte __P((vm_offset_t va)); +void set_pte __P((vm_offset_t, vm_offset_t)); + +unsigned char get_segmap __P((vm_offset_t)); +void set_segmap __P((vm_offset_t va, unsigned char)); +void set_segmap_allctx __P((vm_offset_t va, unsigned char)); + diff --git a/sys/arch/sun3/include/cpu.h b/sys/arch/sun3/include/cpu.h new file mode 100644 index 00000000000..e527874a5a6 --- /dev/null +++ b/sys/arch/sun3/include/cpu.h @@ -0,0 +1,168 @@ +/* $NetBSD: cpu.h,v 1.19 1995/06/28 02:56:08 cgd Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: cpu.h 1.16 91/03/25 + * from: @(#)cpu.h 7.7 (Berkeley) 6/27/91 + * cpu.h,v 1.2 1993/05/22 07:58:17 cgd Exp + */ + +#ifdef _KERNEL + +/* + * Exported definitions unique to sun3/68k cpu support. + */ + +/* + * definitions of cpu-dependent requirements + * referenced in generic code + */ +#define cpu_swapin(p) /* nothing */ +#define cpu_wait(p) /* nothing */ +#define cpu_setstack(p, ap) (p)->p_md.md_regs[SP] = ap + +/* + * Arguments to hardclock and gatherstats encapsulate the previous + * machine state in an opaque clockframe. One the sun3, we use + * what the hardware pushes on an interrupt (frame format 0). + */ +struct clockframe { + u_short sr; /* sr at time of interrupt */ + u_long pc; /* pc at time of interrupt */ + u_short vo; /* vector offset (4-word frame) */ +}; + +#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0) +#define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0) +#define CLKF_PC(framep) ((framep)->pc) +#if 0 +/* We would like to do it this way... */ +#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0) +#else +/* but until we start using PSL_M, we have to do this instead */ +#define CLKF_INTR(framep) (0) /* XXX */ +#endif + +extern int astpending; /* need to trap before returning to user mode */ +#define aston() (astpending++) + +/* + * Preempt the current process if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ +extern int want_resched; /* resched() was called */ +#define need_resched() { want_resched++; aston(); } + +/* + * Give a profiling tick to the current process when the user profiling + * buffer pages are invalid. On the sun3, request an ast to send us + * through trap, marking the proc as needing a profiling tick. + */ +#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, aston()) + +/* + * Notify the current process (p) that it has a signal pending, + * process as soon as possible. + */ +#define signotify(p) aston() + +/* + * Software Interrupt Register (SIR) + * The sun3 has a real software interrupt register set by + * isr_soft_request() so this scheme just multiplexes four + * software interrupt `sources' on the level one handler. + */ +union sun3sir { + int sir_any; + char sir_which[4]; +} sun3sir; + +#define SIR_NET 0 +#define SIR_CLOCK 1 +#define SIR_SPARE2 2 +#define SIR_SPARE3 3 + +#define setsoftint() isr_soft_request(1) +#define setsoftnet() (sun3sir.sir_which[SIR_NET] = 1, setsoftint()) +#define setsoftclock() (sun3sir.sir_which[SIR_CLOCK] = 1, setsoftint()) + + +/* + * CTL_MACHDEP definitions. + */ +#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_MAXID 2 /* number of valid machdep ids */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "console_device", CTLTYPE_STRUCT }, \ +} + +/* values for cpu_machine_id */ + +#define CPU_ARCH_MASK 0xf0 +#define SUN3_ARCH 0x10 +#define SUN3_IMPL_MASK 0x0f +#define SUN3_MACH_160 0x01 +#define SUN3_MACH_50 0x02 +#define SUN3_MACH_260 0x03 +#define SUN3_MACH_110 0x04 +#define SUN3_MACH_60 0x07 +#define SUN3_MACH_E 0x08 + +extern unsigned char cpu_machine_id; + +/* 680X0 function codes */ +#define FC_USERD 1 /* user data space */ +#define FC_USERP 2 /* user program space */ +#define FC_CONTROL 3 /* sun control space */ +#define FC_SUPERD 5 /* supervisor data space */ +#define FC_SUPERP 6 /* supervisor program space */ +#define FC_CPU 7 /* CPU space */ + +/* fields in the 68020 cache control register */ +#define IC_ENABLE 0x0001 /* enable instruction cache */ +#define IC_FREEZE 0x0002 /* freeze instruction cache */ +#define IC_CE 0x0004 /* clear instruction cache entry */ +#define IC_CLR 0x0008 /* clear entire instruction cache */ + +#define IC_CLEAR (IC_CLR|IC_ENABLE) + +#endif /* _KERNEL */ diff --git a/sys/arch/sun3/include/cpufunc.h b/sys/arch/sun3/include/cpufunc.h new file mode 100644 index 00000000000..df6403c2f1c --- /dev/null +++ b/sys/arch/sun3/include/cpufunc.h @@ -0,0 +1,39 @@ +/* $NetBSD: cpufunc.h,v 1.5 1994/11/21 21:33:32 gwr Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Functions to provide access to special 68k instructions. + */ + +unsigned int *getvbr __P((void)); +void setvbr __P((unsigned int *)); diff --git a/sys/arch/sun3/include/db_machdep.h b/sys/arch/sun3/include/db_machdep.h new file mode 100644 index 00000000000..543f101428a --- /dev/null +++ b/sys/arch/sun3/include/db_machdep.h @@ -0,0 +1,7 @@ +/* $NetBSD: db_machdep.h,v 1.7 1995/02/07 04:34:45 gwr Exp $ */ + +#include <m68k/db_machdep.h> + +/* This enables some code in db_command.c */ +#define DB_MACHINE_COMMANDS + diff --git a/sys/arch/sun3/include/disklabel.h b/sys/arch/sun3/include/disklabel.h new file mode 100644 index 00000000000..7772ad954b6 --- /dev/null +++ b/sys/arch/sun3/include/disklabel.h @@ -0,0 +1,46 @@ +/* $NetBSD: disklabel.h,v 1.2 1995/05/24 21:00:15 gwr Exp $ */ + +/* + * Copyright (c) 1994 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_DISKLABEL_H_ +#define _MACHINE_DISKLABEL_H_ + +#define LABELSECTOR 0 /* sector containing label */ +#define LABELOFFSET 64 /* offset of label in sector */ +#define MAXPARTITIONS 8 /* number of partitions */ +#define RAW_PART 2 /* raw partition: xx?c */ + +/* Just a dummy */ +struct cpu_disklabel { + char cd_block[512]; +}; + +#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/sun3/include/dvma.h b/sys/arch/sun3/include/dvma.h new file mode 100644 index 00000000000..a48a2a19672 --- /dev/null +++ b/sys/arch/sun3/include/dvma.h @@ -0,0 +1,105 @@ +/* $NetBSD: dvma.h,v 1.1 1995/09/26 04:02:08 gwr Exp $ */ + +/* + * Copyright (c) 1995 Gordon W. Ross + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * 4. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Gordon W. Ross + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * DVMA (Direct Virtual Memory Access - like DMA) + * + * The Sun3 MMU is presented to secondary masters using DVMA. + * Before such devices can access kernel memory, that memory + * must be mapped into the kernel DVMA space. All DVMA space + * is presented as slave-accessible memory for VME and OBIO + * devices, though not at the same address seen by the CPU. + * + * Relevant parts of virtual memory map are: + * + * 0FE0.0000 monitor map (devices) + * 0FF0.0000 DVMA space + * 0FFE.0000 monitor RAM seg. + * 0FFF.E000 monitor RAM page + * + * Note that while the DVMA harware makes the last 1MB visible + * for secondary masters, the PROM "owns" the last page of it. + * Also note that OBIO devices can actually see the last 16MB + * of kernel virtual space. That can be mostly ignored, except + * when calculating the alias address for slave access. + */ + +/* + * This range could be managed as whole MMU segments. + * The last segment is pre-allocated (see below) + */ +#define DVMA_SEGMAP_BASE 0x0FF00000 +#define DVMA_SEGMAP_SIZE 0x000E0000 +#define DVMA_SEGMAP_END (DVMA_SEGMAP_BASE+DVMA_SEGMAP_SIZE) + +/* + * This range is managed as individual pages. + * The last page is owned by the PROM monitor. + */ +#define DVMA_PAGEMAP_BASE 0x0FFE0000 +#define DVMA_PAGEMAP_SIZE 0x0001E000 +#define DVMA_PAGEMAP_END (DVMA_PAGEMAP_BASE+DVMA_PAGEMAP_SIZE) + +/* + * To convert an address in DVMA space to a slave address, + * just use a logical AND with one of the following masks. + * To convert back, use logical OR with DVMA_SEGMAP_BASE. + */ +#define DVMA_OBIO_SLAVE_BASE 0x0F000000 +#define DVMA_OBIO_SLAVE_MASK 0x00FFffff /* 16MB */ + +#define DVMA_VME_SLAVE_BASE 0x0FF00000 /* 1MB */ +#define DVMA_VME_SLAVE_MASK 0x000Fffff /* 1MB */ + + +#if 1 /* XXX - temporary */ +/* + * XXX - For compatibility, until DVMA is re-worked. + * Total DVMA space covers SEGMAP + PAGEMAP + */ +#define DVMA_SPACE_START DVMA_SEGMAP_BASE +#define DVMA_SPACE_END DVMA_PAGEMAP_END +#define DVMA_SPACE_SIZE (DVMA_SPACE_END - DVMA_SPACE_START) +#endif /* XXX */ + +/* + * XXX - These will change! (will be like the sparc) + */ + +caddr_t dvma_malloc(size_t bytes); +void dvma_free(caddr_t addr, size_t bytes); + +caddr_t dvma_mapin(char *kva, int len); +void dvma_mapout(caddr_t dvma_addr, int len); + +long dvma_kvtopa(long kva, int bus); + diff --git a/sys/arch/sun3/include/eeprom.h b/sys/arch/sun3/include/eeprom.h new file mode 100644 index 00000000000..aaf6d62a1c4 --- /dev/null +++ b/sys/arch/sun3/include/eeprom.h @@ -0,0 +1,175 @@ +/* $NetBSD: eeprom.h,v 1.9 1995/05/11 16:53:09 jtc Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Structure/definitions for the Sun3 EEPROM. + * + * This information is published in the Sun document: + * "PROM User's Manual", part number 800-1736010. + */ + + +/* + * Note that most places where the PROM stores a "true/false" flag, + * the true value is 0x12 and false is the usual zero. Such flags + * all take the values EE_TRUE or EE_FALSE so this file does not + * need to define so many value macros. + */ +#define EE_TRUE 0x12 +#define EE_FALSE 0 + +struct eeprom { + + /* 0x00 */ + u_char eeTestArea[4]; /* Factory Defined */ + u_short eeWriteCount[4]; /* || || */ + u_char eeChecksum[4]; /* || || */ + time_t eeLastHwUpdate; /* || || */ + + /* 0x14 */ + u_char eeInstalledMem; /* Megabytes */ + u_char eeMemTestSize; /* || */ + + /* 0x16 */ + u_char eeScreenSize; +#define EE_SCR_1152X900 0x00 +#define EE_SCR_1024X1024 0x12 +#define EE_SCR_1600X1280 0x13 +#define EE_SCR_1440X1440 0x14 + + u_char eeWatchDogDoesReset; /* Watchdog timeout action: + * true: reset/reboot + * false: return to monitor + */ + /* 0x18 */ + u_char eeBootDevStored; /* Is the boot device stored: + * true: use stored device spec. + * false: use default (try all) + */ + /* Stored boot device spec. i.e.: "sd(Ctlr,Unit,Part)" */ + u_char eeBootDevName[2]; /* xy,xd,sd,ie,le,st,xt,mt,... */ + u_char eeBootDevCtlr; + u_char eeBootDevUnit; + u_char eeBootDevPart; + + /* 0x1E */ + u_char eeKeyboardType; /* zero for sun keyboards */ + u_char eeConsole; /* What to use for the console */ +#define EE_CONS_BW 0x00 /* - On-board B&W / keyboard */ +#define EE_CONS_TTYA 0x10 /* - serial port A */ +#define EE_CONS_TTYB 0x11 /* - serial port B */ +#define EE_CONS_COLOR 0x12 /* - Color FB / keyboard */ +#define EE_CONS_P4OPT 0x20 /* - Option board on P4 */ + + /* 0x20 */ + u_char eeCustomBanner; /* Is there a custom banner: + * true: use text at 0x68 + * false: use Sun banner + */ + + u_char eeKeyClick; /* true/false */ + + /* Boot device with "Diag" switch in Diagnostic mode: */ + u_char eeDiagDevName[2]; + u_char eeDiagDevCtlr; + u_char eeDiagDevUnit; + u_char eeDiagDevPart; + + /* Video white-on-black (not implemented) */ + u_char eeWhiteOnBlack; /* true/false */ + + /* 0x28 */ + char eeDiagPath[40]; /* path name of diag program */ + + /* 0x50 */ + u_char eeTtyCols; /* normally 80 */ + u_char eeTtyRows; /* normally 34 */ + u_char ee_x52[6]; /* unused */ + + /* 0x58 */ + /* Default parameters for tty A and tty B: */ + struct eeTtyDef { + u_char eetBaudSet; /* Is the baud rate set? + * true: use values here + * false: use default (9600) + */ + u_char eetBaudHi; /* i.e. 96.. */ + u_char eetBaudLo; /* ..00 */ + u_char eetNoRtsDtr; /* true: disable H/W flow + * false: enable H/W flow */ + u_char eet_pad[4]; + } eeTtyDefA, eeTtyDefB; + + /* 0x68 */ + char eeBannerString[80]; /* see eeCustomBanner above */ + + /* 0xB8 */ + u_short eeTestPattern; /* must be 0xAA55 */ + u_short ee_xBA; /* unused */ + + /* 0xBC */ + /* Configuration data. Hopefully we don't need it. */ + struct eeConf { + u_char eecData[16]; + } eeConf[12+1]; + + /* 0x18c */ + u_char eeAltKeyTable; /* What Key table to use: + * 0x58: EEPROM tables + * else: PROM key tables + */ + u_char eeKeyboardLocale; /* extended keyboard type */ + u_char eeKeyboardID; /* for EEPROM key tables */ + u_char eeCustomLogo; /* true: use eeLogoBitmap */ + + /* 0x190 */ + u_char eeKeymapLC[0x80]; + u_char eeKeymapUC[0x80]; + + /* 0x290 */ + u_char eeLogoBitmap[64][8]; /* 64x64 bit custom logo */ + + /* 0x490 */ + u_char ee_x490[0x500-0x490]; /* unused */ + + /* Other stuff we don't care about... */ + /* 0x500 */ + u_char eeReserved[0x100]; + /* 0x600 */ + u_char eeROM_Area[0x100]; + /* 0x700 */ + u_char eeUnixArea[0x100]; +}; + +#ifdef _KERNEL +/* Value of eeConsole (for convenience of drivers). */ +extern int ee_console; +/* Function to get other bytes. */ +extern int ee_get_byte(int off, int canwait); +#endif /* _KERNEL */ diff --git a/sys/arch/sun3/include/endian.h b/sys/arch/sun3/include/endian.h new file mode 100644 index 00000000000..1ec107a8e6d --- /dev/null +++ b/sys/arch/sun3/include/endian.h @@ -0,0 +1,3 @@ +/* $NetBSD: endian.h,v 1.6 1994/11/21 21:33:37 gwr Exp $ */ + +#include <m68k/endian.h> diff --git a/sys/arch/sun3/include/exec.h b/sys/arch/sun3/include/exec.h new file mode 100644 index 00000000000..b28a4ea597d --- /dev/null +++ b/sys/arch/sun3/include/exec.h @@ -0,0 +1,47 @@ +/* $NetBSD: exec.h,v 1.8 1994/11/21 21:33:39 gwr Exp $ */ + +/* + * Copyright (c) 1993 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __LDPGSZ +#define __LDPGSZ 8192 + +/* Relocation format. */ +struct relocation_info_m68k { + int r_address; /* offset in text or data segment */ + unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ + r_pcrel : 1, /* 1 if value should be pc-relative */ + r_length : 2, /* log base 2 of value's width */ + r_extern : 1, /* 1 if need to add symbol to value */ + r_baserel : 1, /* linkage table relative */ + r_jmptable : 1, /* relocate to jump table */ + r_relative : 1, /* load address relative */ + r_copy : 1; /* run time copy */ +}; +#define relocation_info relocation_info_m68k + +#endif /* _LDPGSZ */ diff --git a/sys/arch/sun3/include/fbio.h b/sys/arch/sun3/include/fbio.h new file mode 100644 index 00000000000..afe75d470cd --- /dev/null +++ b/sys/arch/sun3/include/fbio.h @@ -0,0 +1,185 @@ +/* $NetBSD: fbio.h,v 1.3 1994/11/21 21:33:40 gwr Exp $ */ + +/* + * Copyright (c) 1992 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software developed by the Computer Systems + * Engineering group at Lawrence Berkeley Laboratory under DARPA + * contract BG 91-66 and contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)fbio.h 7.2 (Berkeley) 4/1/92 + */ + +/* + * Frame buffer ioctls (from Sprite, trimmed to essentials for X11). + */ + +/* + * Frame buffer type codes. + */ +#define FBTYPE_SUN1BW 0 /* multibus mono */ +#define FBTYPE_SUN1COLOR 1 /* multibus color */ +#define FBTYPE_SUN2BW 2 /* memory mono */ +#define FBTYPE_SUN2COLOR 3 /* color w/rasterop chips */ +#define FBTYPE_SUN2GP 4 /* GP1/GP2 */ +#define FBTYPE_SUN5COLOR 5 /* RoadRunner accelerator */ +#define FBTYPE_SUN3COLOR 6 /* memory color */ +#define FBTYPE_MEMCOLOR 7 /* memory 24-bit */ +#define FBTYPE_SUN4COLOR 8 /* memory color w/overlay */ + +#define FBTYPE_NOTSUN1 9 /* reserved for customer */ +#define FBTYPE_NOTSUN2 10 /* reserved for customer */ +#define FBTYPE_NOTSUN3 11 /* reserved for customer */ + +#define FBTYPE_SUNFAST_COLOR 12 /* accelerated 8bit */ +#define FBTYPE_SUNROP_COLOR 13 /* MEMCOLOR with rop h/w */ +#define FBTYPE_SUNFB_VIDEO 14 /* Simple video mixing */ +#define FBTYPE_RESERVED5 15 /* reserved, do not use */ +#define FBTYPE_RESERVED4 16 /* reserved, do not use */ +#define FBTYPE_RESERVED3 17 /* reserved, do not use */ +#define FBTYPE_RESERVED2 18 /* reserved, do not use */ +#define FBTYPE_RESERVED1 19 /* reserved, do not use */ + +#define FBTYPE_LASTPLUSONE 20 /* max number of fbs (change as add) */ + +/* + * Frame buffer descriptor as returned by FBIOGTYPE. + */ +struct fbtype { + int fb_type; /* as defined above */ + int fb_height; /* in pixels */ + int fb_width; /* in pixels */ + int fb_depth; /* bits per pixel */ + int fb_cmsize; /* size of color map (entries) */ + int fb_size; /* total size in bytes */ +}; +#define FBIOGTYPE _IOR('F', 0, struct fbtype) + +#ifdef notdef +/* + * General purpose structure for passing info in and out of frame buffers + * (used for gp1) -- unsupported. + */ +struct fbinfo { + int fb_physaddr; /* physical frame buffer address */ + int fb_hwwidth; /* fb board width */ + int fb_hwheight; /* fb board height */ + int fb_addrdelta; /* phys addr diff between boards */ + u_char *fb_ropaddr; /* fb virtual addr */ + int fb_unit; /* minor devnum of fb */ +}; +#define FBIOGINFO _IOR('F', 2, struct fbinfo) +#endif + +/* + * Color map I/O. + */ +struct fbcmap { + int index; /* first element (0 origin) */ + int count; /* number of elements */ + u_char *red; /* red color map elements */ + u_char *green; /* green color map elements */ + u_char *blue; /* blue color map elements */ +}; +#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap) +#define FBIOGETCMAP _IOW('F', 4, struct fbcmap) + +/* + * Set/get attributes. + */ +#define FB_ATTR_NDEVSPECIFIC 8 /* no. of device specific values */ +#define FB_ATTR_NEMUTYPES 4 /* no. of emulation types */ + +struct fbsattr { + int flags; /* flags; see below */ + int emu_type; /* emulation type (-1 if unused) */ + int dev_specific[FB_ATTR_NDEVSPECIFIC]; /* catchall */ +}; +#define FB_ATTR_AUTOINIT 1 /* emulation auto init flag */ +#define FB_ATTR_DEVSPECIFIC 2 /* dev. specific stuff valid flag */ + +struct fbgattr { + int real_type; /* real device type */ + int owner; /* PID of owner, 0 if myself */ + struct fbtype fbtype; /* fbtype info for real device */ + struct fbsattr sattr; /* see above */ + int emu_types[FB_ATTR_NEMUTYPES]; /* possible emulations */ + /* (-1 if unused) */ +}; +/* FBIOSATTR _IOW('F', 5, struct fbsattr) -- unsupported */ +#define FBIOGATTR _IOR('F', 6, struct fbgattr) + +/* + * Video control. + */ +#define FBVIDEO_OFF 0 +#define FBVIDEO_ON 1 + +#define FBIOSVIDEO _IOW('F', 7, int) +#define FBIOGVIDEO _IOR('F', 8, int) + +/* + * hardware cursor control + */ +struct fbcurpos { + short x; + short y; +}; + +#define FB_CUR_SETCUR 0x01 +#define FB_CUR_SETPOS 0x02 +#define FB_CUR_SETHOT 0x04 +#define FB_CUR_SETCMAP 0x08 +#define FB_CUR_SETSHAPE 0x10 +#define FB_CUR_SETALL 0x1F + +struct fbcursor { + short set; /* what to set */ + short enable; /* enable/disable cursor */ + struct fbcurpos pos; /* cursor's position */ + struct fbcurpos hot; /* cursor's hot spot */ + struct fbcmap cmap; /* color map info */ + struct fbcurpos size; /* cursor's bit map size */ + char *image; /* cursor's image bits */ + char *mask; /* cursor's mask bits */ +}; + +/* set/get cursor attributes/shape */ +#define FBIOSCURSOR _IOW('F', 24, struct fbcursor) +#define FBIOGCURSOR _IOWR('F', 25, struct fbcursor) + +/* set/get cursor position */ +#define FBIOSCURPOS _IOW('F', 26, struct fbcurpos) +#define FBIOGCURPOS _IOW('F', 27, struct fbcurpos) + +/* get max cursor size */ +#define FBIOGCURMAX _IOR('F', 28, struct fbcurpos) diff --git a/sys/arch/sun3/include/float.h b/sys/arch/sun3/include/float.h new file mode 100644 index 00000000000..2f63ec177d8 --- /dev/null +++ b/sys/arch/sun3/include/float.h @@ -0,0 +1,8 @@ +/* $NetBSD: float.h,v 1.6 1995/06/20 20:45:55 jtc Exp $ */ + +#ifndef _MACHINE_FLOAT_H_ +#define _MACHINE_FLOAT_H_ + +#include <m68k/float.h> + +#endif diff --git a/sys/arch/sun3/include/frame.h b/sys/arch/sun3/include/frame.h new file mode 100644 index 00000000000..2e547462b00 --- /dev/null +++ b/sys/arch/sun3/include/frame.h @@ -0,0 +1,3 @@ +/* $NetBSD: frame.h,v 1.6 1994/11/21 21:33:44 gwr Exp $ */ + +#include <m68k/frame.h> diff --git a/sys/arch/sun3/include/idprom.h b/sys/arch/sun3/include/idprom.h new file mode 100644 index 00000000000..9ca08cad341 --- /dev/null +++ b/sys/arch/sun3/include/idprom.h @@ -0,0 +1,55 @@ +/* $NetBSD: idprom.h,v 1.11 1995/05/11 16:53:11 jtc Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * structure/definitions for the 32 byte id prom found in sun3s + */ + +struct idprom { + unsigned char idp_format; + unsigned char idp_machtype; + unsigned char idp_etheraddr[6]; + long idp_date; + unsigned char idp_serialnum[3]; + unsigned char idp_checksum; + unsigned char idp_reserved[16]; +}; + +#define IDPROM_VERSION 1 +#define IDPROM_SIZE (sizeof(struct idprom)) + +#ifdef _KERNEL +extern struct idprom identity_prom; +int idprom_init(); +void idprom_etheraddr __P((u_char *)); +#endif diff --git a/sys/arch/sun3/include/ieeefp.h b/sys/arch/sun3/include/ieeefp.h new file mode 100644 index 00000000000..f0fadb000fd --- /dev/null +++ b/sys/arch/sun3/include/ieeefp.h @@ -0,0 +1,4 @@ +/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 01:50:45 gwr Exp $ */ + +/* Just use the common m68k definition */ +#include <m68k/ieeefp.h> diff --git a/sys/arch/sun3/include/isr.h b/sys/arch/sun3/include/isr.h new file mode 100644 index 00000000000..4f01f26d4d0 --- /dev/null +++ b/sys/arch/sun3/include/isr.h @@ -0,0 +1,49 @@ +/* $NetBSD: isr.h,v 1.9 1995/09/26 04:02:09 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1982 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)isr.h 7.1 (Berkeley) 5/8/90 + * isr.h,v 1.2 1993/05/22 07:57:26 cgd Exp + */ + +void isr_init __P((void)); +void isr_config __P((void)); + +void isr_add_custom __P((int, void (*handler)())); +void isr_add_autovect __P((int (*handler)(), void *arg, int level)); +void isr_add_vectored __P((int (*handler)(), void *arg, int pri, int vec)); + +void isr_soft_request __P((int level)); +void isr_soft_clear __P((int level)); diff --git a/sys/arch/sun3/include/kbd.h b/sys/arch/sun3/include/kbd.h new file mode 100644 index 00000000000..dcb5f3773aa --- /dev/null +++ b/sys/arch/sun3/include/kbd.h @@ -0,0 +1,86 @@ +/* $NetBSD: kbd.h,v 1.2 1995/05/24 20:57:00 gwr Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kbd.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * Keyboard `registers'. (This should be called kbd_reg.h but we need to + * be compatible.) + */ + +/* + * Control codes sent from type 2, 3, and 4 keyboards. + * + * Note that KBD_RESET is followed by a keyboard ID, while KBD_IDLE is not. + * KBD_IDLE does not take the place of any `up' transitions (it merely occurs + * after them). + */ +#define KBD_RESET 0xff /* keyboard `reset' response */ +#define KBD_IDLE 0x7f /* keyboard `all keys are up' code */ + +/* Keyboard IDs */ +#define KB_SUN2 2 /* type 2 keyboard */ +#define KB_SUN3 3 /* type 3 keyboard */ +#define KB_SUN4 4 /* type 4 keyboard */ + +/* Key codes are in 0x00..0x7e; KBD_UP is set if the key goes up */ +#define KBD_KEYMASK 0x7f /* keyboard key mask */ +#define KBD_UP 0x80 /* keyboard `up' transition */ + +/* Keyboard codes needed to recognize the L1-A sequence */ +#define KBD_L1 1 /* keyboard code for `L1' key */ +#define KBD_A 77 /* keyboard code for `A' key */ + +/* Control codes sent to the various keyboards */ +#define KBD_CMD_RESET 1 /* reset keyboard */ +#define KBD_CMD_BELL 2 /* turn bell on */ +#define KBD_CMD_NOBELL 3 /* turn bell off */ +#define KBD_CMD_CLICK 10 /* turn keyclick on */ +#define KBD_CMD_NOCLICK 11 /* turn keyclick off */ +#define KBD_CMD_SETLED 14 /* set LED state (type 4 kbd) */ + +#define LED_NUM_LOCK 0x1 +#define LED_COMPOSE 0x2 +#define LED_SCROLL_LOCK 0x4 +#define LED_CAPS_LOCK 0x8 diff --git a/sys/arch/sun3/include/kbio.h b/sys/arch/sun3/include/kbio.h new file mode 100644 index 00000000000..596e78182f4 --- /dev/null +++ b/sys/arch/sun3/include/kbio.h @@ -0,0 +1,114 @@ +/* $NetBSD: kbio.h,v 1.3 1995/08/08 20:57:51 gwr Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kbio.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * The following is a minimal emulation of Sun's `kio' structures + * and related operations necessary to make X11 happy (i.e., make it + * compile, and make old X11 binaries run). + */ + +/* + * The kiockey structure apparently gets and/or sets keyboard mappings. + * It seems to be kind of useless, but X11 uses it (according to the + * comments) to figure out when a Sun 386i has a type-4 keyboard but + * claims to have a type-3 keyboard. We need just enough to cause the + * appropriate ioctl to return the appropriate magic value. + * + * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask + * is for; X sets it before the call, so it is not an output, but we do not + * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send + * keys to the console or to X; we just send them to X whenever the keyboard + * is open at all. (XXX may need to change this later) + * + * Keyboard commands and types are defined in kbd.h as they are actually + * real hardware commands and type numbers. + */ + +struct okiockey { /* Out-dated key translation structure */ + int kio_tablemask; /* whatever */ + u_char kio_station; /* key number */ + u_char kio_entry; /* HOLE if not present */ + char kio_text[10]; /* the silly escape sequences (unsupported) */ +}; + +struct kiockey { + int kio_tablemask; /* whatever */ + u_char kio_station; /* key number */ + u_short kio_entry; /* HOLE if not present */ + char kio_text[10]; /* the silly escape sequences (unsupported) */ +}; + +/* + * Values for kio_tablemask. These determine which table to read/modify + * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift" + * tables. + */ +#define KIOC_NOMASK 0x0 +#define KIOC_CAPSMASK 0x1 +#define KIOC_SHIFTMASK 0xe +#define KIOC_CTRLMASK 0x30 +#define KIOC_ALTGMASK 0x200 +#define KIOC_NUMLMASK 0x800 + +#define HOLE 0x302 /* value for kio_entry to say `really type 3' */ + +#define KIOCTRANS _IOW('k', 0, int) /* set translation mode */ + /* (we only accept TR_UNTRANS_EVENT) */ +#define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */ +#define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */ +#define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */ +#define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */ +#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */ +#define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */ +#define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */ +#define KIOCSLED _IOW('k', 14, char) /* set LED state */ +#define KIOCGLED _IOR('k', 15, char) /* get LED state */ +#define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */ + +#define TR_NONE 0 /* X compat, unsupported */ +#define TR_ASCII 1 /* X compat, unsupported */ +#define TR_EVENT 2 /* X compat, unsupported */ +#define TR_UNTRANS_EVENT 3 diff --git a/sys/arch/sun3/include/limits.h b/sys/arch/sun3/include/limits.h new file mode 100644 index 00000000000..da2f10e97d7 --- /dev/null +++ b/sys/arch/sun3/include/limits.h @@ -0,0 +1,3 @@ +/* $NetBSD: limits.h,v 1.6 1994/11/21 21:33:49 gwr Exp $ */ + +#include <m68k/limits.h> diff --git a/sys/arch/sun3/include/mon.h b/sys/arch/sun3/include/mon.h new file mode 100644 index 00000000000..56bf81d7a95 --- /dev/null +++ b/sys/arch/sun3/include/mon.h @@ -0,0 +1,348 @@ +/* $NetBSD: mon.h,v 1.16 1995/02/07 05:01:05 gwr Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This file derived from kernel/mach/sun3.md/machMon.h from the + * sprite distribution. + * + * In particular, this file came out of the Walnut Creek cdrom collection + * which contained no warnings about any possible copyright infringement. + * It was also indentical to a file in the sprite kernel tar file found on + * allspice.berkeley.edu. + * It also written in the annoying sprite coding style. I've made + * efforts not to heavily edit their file, just ifdef parts out. -- glass + */ + +#ifndef _MACHINE_MON_H +#define _MACHINE_MON_H +/* + * machMon.h -- + * + * Structures, constants and defines for access to the sun monitor. + * These are translated from the sun monitor header file "sunromvec.h". + * + * NOTE: The file keyboard.h in the monitor directory has all sorts of useful + * keyboard stuff defined. I haven't attempted to translate that file + * because I don't need it. If anyone wants to use it, be my guest. + * + * Copyright (C) 1985 Regents of the University of California + * All rights reserved. + * + * + * Header: /cdrom/src/kernel/Cvsroot/kernel/mach/sun3.md/machMon.h,v 9.1 90/10/03 13:52:34 mgbaker Exp SPRITE (Berkeley) + */ + +#ifndef _MACHMON +#define _MACHMON + +/* + * The memory addresses for the PROM, and the EEPROM. + * On the sun2 these addresses are actually 0x00EF??00 + * but only the bottom 24 bits are looked at so these still + * work ok. + */ + +#define PROM_BASE 0x0fef0000 + +/* + * Structure set up by the boot command to pass arguments to the program that + * is booted. + */ +typedef struct bootparam { + char *argPtr[8]; /* String arguments */ + char strings[100]; /* String table for string arguments */ + char devName[2]; /* Device name */ + int ctlrNum; /* Controller number */ + int unitNum; /* Unit number */ + int partNum; /* Partition/file number */ + char *fileName; /* File name, points into strings */ + struct boottab *bootDevice; /* Defined in saio.h */ +} MachMonBootParam; + +/* + * Here is the structure of the vector table which is at the front of the boot + * rom. The functions defined in here are explained below. + * + * NOTE: This struct has references to the structures keybuf and globram which + * I have not translated. If anyone needs to use these they should + * translate these structs into Sprite format. + */ +typedef struct { + char *initSp; /* Initial system stack ptr + * for hardware */ + int (*startMon)(); /* Initial PC for hardware */ + + int *diagberr; /* Bus err handler for diags */ + + /* + * Monitor and hardware revision and identification + */ + + struct bootparam **bootParam; /* Info for bootstrapped pgm */ + unsigned *memorySize; /* Usable memory in bytes */ + + /* + * Single-character input and output + */ + + unsigned char (*getChar)(); /* Get char from input source */ + int (*putChar)(); /* Put char to output sink */ + int (*mayGet)(); /* Maybe get char, or -1 */ + int (*mayPut)(); /* Maybe put char, or -1 */ + unsigned char *echo; /* Should getchar echo? */ + unsigned char *inSource; /* Input source selector */ + unsigned char *outSink; /* Output sink selector */ + + /* + * Keyboard input (scanned by monitor nmi routine) + */ + + int (*getKey)(); /* Get next key if one exists */ + int (*initGetKey)(); /* Initialize get key */ + unsigned int *translation; /* Kbd translation selector + (see keyboard.h in sun + monitor code) */ + unsigned char *keyBid; /* Keyboard ID byte */ + int *screen_x; /* V2: Screen x pos (R/O) */ + int *screen_y; /* V2: Screen y pos (R/O) */ + struct keybuf *keyBuf; /* Up/down keycode buffer */ + + /* + * Monitor revision level. + */ + + char *monId; + + /* + * Frame buffer output and terminal emulation + */ + + int (*fbWriteChar)(); /* Write a character to FB */ + int *fbAddr; /* Address of frame buffer */ + char **font; /* Font table for FB */ + int (*fbWriteStr)(); /* Quickly write string to FB */ + + /* + * Reboot interface routine -- resets and reboots system. No return. + */ + + int (*reBoot)(); /* e.g. reBoot("xy()vmunix") */ + + /* + * Line input and parsing + */ + + unsigned char *lineBuf; /* The line input buffer */ + unsigned char **linePtr; /* Cur pointer into linebuf */ + int *lineSize; /* length of line in linebuf */ + int (*getLine)(); /* Get line from user */ + unsigned char (*getNextChar)(); /* Get next char from linebuf */ + unsigned char (*peekNextChar)(); /* Peek at next char */ + int *fbThere; /* =1 if frame buffer there */ + int (*getNum)(); /* Grab hex num from line */ + + /* + * Print formatted output to current output sink + */ + + int (*printf)(); /* Similar to "Kernel printf" */ + int (*printHex)(); /* Format N digits in hex */ + + /* + * Led stuff + */ + + unsigned char *leds; /* RAM copy of LED register */ + int (*setLeds)(); /* Sets LED's and RAM copy */ + + /* + * Non-maskable interrupt (nmi) information + */ + + int (*nmiAddr)(); /* Addr for level 7 vector */ + int (*abortEntry)(); /* Entry for keyboard abort */ + int *nmiClock; /* Counts up in msec */ + + /* + * Frame buffer type: see <sun/fbio.h> + */ + + int *fbType; + + /* + * Assorted other things + */ + + unsigned romvecVersion; /* Version # of Romvec */ + struct globram *globRam; /* monitor global variables */ + caddr_t kbdZscc; /* Addr of keyboard in use */ + + int *keyrInit; /* ms before kbd repeat */ + unsigned char *keyrTick; /* ms between repetitions */ + unsigned *memoryAvail; /* V1: Main mem usable size */ + long *resetAddr; /* where to jump on a reset */ + long *resetMap; /* pgmap entry for resetaddr */ + /* Really struct pgmapent * */ + int (*exitToMon)(); /* Exit from user program */ + unsigned char **memorybitmap; /* V1: &{0 or &bits} */ + void (*setcxsegmap)(); /* Set seg in any context */ + void (**vector_cmd)(); /* V2: Handler for 'v' cmd */ + int dummy1z; + int dummy2z; + int dummy3z; + int dummy4z; +} MachMonRomVector; + +/* + * Functions defined in the vector: + * + * + * getChar -- Return the next character from the input source + * + * unsigned char getChar() + * + * putChar -- Write the given character to the output source. + * + * void putChar(ch) + * char ch; + * + * mayGet -- Maybe get a character from the current input source. Return -1 + * if don't return a character. + * + * int mayGet() + * + * mayPut -- Maybe put a character to the current output source. Return -1 + * if no character output. + * + * int mayPut(ch) + * char ch; + * + * getKey -- Returns a key code (if up/down codes being returned), + * a byte of ASCII (if that's requested), + * NOKEY (if no key has been hit). + * + * int getKey() + * + * initGetKey -- Initialize things for get key. + * + * void initGetKey() + * + * fbWriteChar -- Write a character to the frame buffer + * + * void fwritechar(ch) + * unsigned char ch; + * + * fbWriteStr -- Write a string to the frame buffer. + * + * void fwritestr(addr,len) + * register unsigned char *addr; / * String to be written * / + * register short len; / * Length of string * / + * + * getLine -- read the next input line into a global buffer + * + * getline(echop) + * int echop; / * 1 if should echo input, 0 if not * / + * + * getNextChar -- return the next character from the global line buffer. + * + * unsigned char getNextChar() + * + * peekNextChar -- look at the next character in the global line buffer. + * + * unsigned char peekNextChar() + * + * getNum -- Grab hex num from the global line buffer. + * + * int getNum() + * + * printf -- Scaled down version of C library printf. Only %d, %x, %s, and %c + * are recognized. + * + * printhex -- prints rightmost <digs> hex digits of <val> + * + * printhex(val,digs) + * register int val; + * register int digs; + * + * abortEntry -- Entry for keyboard abort. + * + * abortEntry() + */ + +/* + * Where the rom vector is defined. + */ + +#define romVectorPtr ((MachMonRomVector *) PROM_BASE) + +/* + * Functions and defines to access the monitor. + */ + +#define mon_printf (romVectorPtr->printf) +#define mon_putchar (romVectorPtr->putChar) +#define mon_may_getchar (romVectorPtr->mayGet) +#define mon_exit_to_mon (romVectorPtr->exitToMon) +#define mon_reboot (romVectorPtr->reBoot) +#define mon_panic(x) { mon_printf(x); mon_exit_to_mon();} + +#define mon_setcxsegmap(context, va, sme) \ + romVectorPtr->setcxsegmap(context, va, sme) +#define romp (romVectorPtr) + +/* + * MONSTART and MONEND denote the range of the damn monitor. + * + * supposedly you can steal pmegs within this range that do not contain + * valid pages. + */ +#define MONSTART 0x0FE00000 +#define MONEND 0x0FF00000 + +/* + * These describe the monitor's short segment which it basically uses to map + * one stupid page that it uses for storage. MONSHORTPAGE is the page, + * and MONSHORTSEG is the segment that it is in. If this sounds dumb to + * you, it is. I can change the pmeg, but not the virtual address. + * Sun defines these with the high nibble set to 0xF. I believe this was + * for the monitor source which accesses this piece of memory with addressing + * limitations or some such crud. I haven't replicated this here, because + * it is confusing, and serves no obvious purpose if you aren't the monitor. + * + */ + +#define MONSHORTPAGE 0x0FFFE000 +#define MONSHORTSEG 0x0FFE0000 + +#endif /* _MACHMON */ +#endif /* MACHINE_MON_H */ diff --git a/sys/arch/sun3/include/obctl.h b/sys/arch/sun3/include/obctl.h new file mode 100644 index 00000000000..3c044ca9245 --- /dev/null +++ b/sys/arch/sun3/include/obctl.h @@ -0,0 +1,34 @@ +/* $NetBSD: obctl.h,v 1.6 1994/12/12 18:59:41 gwr Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* XXX: everything is in control.h -- should this perish? */ diff --git a/sys/arch/sun3/include/obio.h b/sys/arch/sun3/include/obio.h new file mode 100644 index 00000000000..414726fdbcd --- /dev/null +++ b/sys/arch/sun3/include/obio.h @@ -0,0 +1,77 @@ +/* $NetBSD: obio.h,v 1.13 1994/12/12 18:59:42 gwr Exp $ */ + +/* + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This file defines addresses in Type 1 space for various devices + * which can be on the motherboard directly. + * + * Supposedly these values are constant across the entire sun3 architecture. + * + */ + +#define OBIO_KEYBD_MS 0x00000000 +#define OBIO_ZS 0x00020000 +#define OBIO_EEPROM 0x00040000 +#define OBIO_CLOCK 0x00060000 +#define OBIO_MEMERR 0x00080000 +#define OBIO_INTERREG 0x000A0000 +#define OBIO_INTEL_ETHER 0x000C0000 +#define OBIO_COLOR_MAP 0x000E0000 +#define OBIO_EPROM 0x00100000 +#define OBIO_AMD_ETHER 0x00120000 +#define OBIO_NCR_SCSI 0x00140000 +#define OBIO_RESERVED1 0x00160000 +#define OBIO_RESERVED2 0x00180000 +#define OBIO_IOX_BUS 0x001A0000 +#define OBIO_DES 0x001C0000 +#define OBIO_ECCREG 0x001E0000 + +#define OBIO_KEYBD_MS_SIZE 0x00008 +#define OBIO_ZS_SIZE 0x00008 +#define OBIO_EEPROM_SIZE 0x00800 +#define OBIO_CLOCK_SIZE 0x00020 +#define OBIO_MEMERR_SIZE 0x00008 +#define OBIO_INTERREG_SIZE 0x00001 +#define OBIO_INTEL_ETHER_SIZE 0x00001 +#define OBIO_COLOR_MAP_SIZE 0x00400 +#define OBIO_EPROM_SIZE 0x10000 +#define OBIO_AMD_ETHER_SIZE 0x00004 +#define OBIO_NCR_SCSI_SIZE 0x00020 +#define OBIO_IO_BUS_SIZE 0x1000000 +#define OBIO_DES_SIZE 0x00004 +#define OBIO_ECCREG_SIZE 0x00100 + +caddr_t obio_alloc __P((int, int)); +caddr_t obio_vm_alloc __P((int)); +caddr_t obio_find_mapping __P((int pa, int size)); + diff --git a/sys/arch/sun3/include/obmem.h b/sys/arch/sun3/include/obmem.h new file mode 100644 index 00000000000..dff06ab6379 --- /dev/null +++ b/sys/arch/sun3/include/obmem.h @@ -0,0 +1,43 @@ +/* $NetBSD: obmem.h,v 1.6 1994/12/12 18:59:44 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Location of Sun3/50 video ram, right in the way at physical 1MB. */ +#define OBMEM_BW50_ADDR 0x100000 + +#define OBMEM_BW2_ADDR 0xff000000 +#define OBMEM_BW2_SIZE 0x020000 + +#define OBMEM_CG4_ADDR 0xff300000 +#define OBMEM_CG4_SIZE 0x100000 + diff --git a/sys/arch/sun3/include/param.h b/sys/arch/sun3/include/param.h new file mode 100644 index 00000000000..4ae441f76cc --- /dev/null +++ b/sys/arch/sun3/include/param.h @@ -0,0 +1,164 @@ +/* $NetBSD: param.h,v 1.29 1995/06/27 14:37:22 gwr Exp $ */ + +/* + * Copyright (c) 1994, 1995 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: machparam.h 1.16 92/12/20 + * from: @(#)param.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef MACHINE + +/* + * Machine dependent constants for the Sun3 series. + */ +#define MACHINE "sun3" +#define MACHINE_ARCH "m68k" +#define MID_MACHINE MID_M68K + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is u_int and + * must be cast to any desired pointer type. + */ +#define ALIGNBYTES 3 +#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) + +#define NBPG 8192 /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte offset into page */ +#define PGSHIFT 13 /* LOG2(NBPG) */ + +#define NBSG 0x20000 /* bytes/segment */ +#define SEGOFSET (NBSG-1) /* byte offset into segment */ +#define SEGSHIFT 17 /* LOG2(NBSG) */ + +#define KERNBASE 0x0E000000 /* start of kernel virtual */ +#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) + +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ + +#define CLSIZE 1 +#define CLSIZELOG2 0 + +/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ +#define SSIZE 1 /* initial stack size/NBPG */ +#define SINCR 1 /* increment of stack/NBPG */ + +#define UPAGES 2 /* pages of u-area */ +#define USPACE (UPAGES << PGSHIFT) + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than CLBYTES (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. + */ +#define MSIZE 128 /* size of an mbuf */ +#define MCLBYTES 2048 /* large enough for ether MTU */ +#define MCLSHIFT 11 +#define MCLOFSET (MCLBYTES - 1) +#ifndef NMBCLUSTERS +#ifdef GATEWAY +#define NMBCLUSTERS 512 /* map size, max cluster allocation */ +#else +#define NMBCLUSTERS 256 /* map size, max cluster allocation */ +#endif +#endif + +/* + * Size of kernel malloc arena in CLBYTES-sized logical pages + */ +#ifndef NKMEMCLUSTERS +#define NKMEMCLUSTERS (2048*1024/CLBYTES) +#endif + +/* pages ("clicks") to disk blocks */ +#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) +#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) + +/* pages to bytes */ +#define ctob(x) ((x) << PGSHIFT) +#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) + +/* bytes to disk blocks */ +#define btodb(x) ((x) >> DEV_BSHIFT) +#define dbtob(x) ((x) << DEV_BSHIFT) + +/* + * Map a ``block device block'' to a file system block. + * This should be device dependent, and should use the bsize + * field from the disk label. + * For now though just use DEV_BSIZE. + */ +#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) + +/* + * Mach derived conversion macros + */ +#define sun3_round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET) +#define sun3_trunc_seg(x) ((unsigned)(x) & ~SEGOFSET) +#define sun3_btos(x) ((unsigned)(x) >> SEGSHIFT) +#define sun3_stob(x) ((unsigned)(x) << SEGSHIFT) + +#define sun3_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET) +#define sun3_trunc_page(x) ((unsigned)(x) & ~PGOFSET) +#define sun3_btop(x) ((unsigned)(x) >> PGSHIFT) +#define sun3_ptob(x) ((unsigned)(x) << PGSHIFT) + +/* XXX - Does this really belong here? -gwr */ +#include <machine/psl.h> + +#ifdef _KERNEL +#ifndef LOCORE +#define DELAY(n) delay(n) +extern int cpuspeed; +static inline void delay2us() +{ + register int n = cpuspeed; + + __asm __volatile ("0: subql #4,%0; jgt 0b" : "=d" (n) : "0" (n)); +} +#endif /* !LOCORE */ +#endif /* _KERNEL */ + +#endif /* MACHINE */ diff --git a/sys/arch/sun3/include/pcb.h b/sys/arch/sun3/include/pcb.h new file mode 100644 index 00000000000..e94da41a646 --- /dev/null +++ b/sys/arch/sun3/include/pcb.h @@ -0,0 +1,67 @@ +/* $NetBSD: pcb.h,v 1.8 1994/11/21 21:34:02 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah Hdr: pcb.h 1.14 91/03/25 + * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93 + */ + +#include <machine/frame.h> + +/* + * Sun3 process control block + */ +struct pcb +{ + short pcb_flags; /* misc. process flags */ + short pcb_ps; /* processor status word */ + int pcb_usp; /* user stack pointer */ + int pcb_regs[12]; /* D2-D7, A2-A7 */ + caddr_t pcb_onfault; /* for copyin/out faults */ + struct fpframe pcb_fpregs; /* 68881/2 context save area */ +}; + +/* + * The pcb is augmented with machine-dependent additional data for + * core dumps. For the sun3, this includes just an exec header. + */ +struct md_coredump { + int md_exec[16]; /* exec structure for core dumps */ +}; diff --git a/sys/arch/sun3/include/pmap.h b/sys/arch/sun3/include/pmap.h new file mode 100644 index 00000000000..275fdce7255 --- /dev/null +++ b/sys/arch/sun3/include/pmap.h @@ -0,0 +1,82 @@ +/* $NetBSD: pmap.h,v 1.13 1995/04/10 12:42:29 mycroft Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_PMAP_ +#define _MACHINE_PMAP_ + +/* + * Physical map structures exported to the VM code. + */ + +struct pmap { + int pm_refcount; /* pmap reference count */ + simple_lock_data_t pm_lock; /* lock on pmap */ + struct pmap_statistics pm_stats; /* pmap statistics */ + int pm_version; + int pm_ctxnum; + unsigned char *pm_segmap; +}; + +typedef struct pmap *pmap_t; + +#ifdef _KERNEL +struct pmap kernel_pmap_store; + +#define pmap_kernel() (&kernel_pmap_store) + +#define PMAP_ACTIVATE(pmap, pcbp, iscurproc) \ + pmap_activate(pmap, pcbp) +#define PMAP_DEACTIVATE(pmap, pcbp) \ + pmap_deactivate(pmap, pcbp) + +/* XXX - Need a (silly) #define get code in kern_sysctl.c */ +extern segsz_t pmap_resident_pages(pmap_t); +#define pmap_resident_count(pmap) pmap_resident_pages(pmap) + +/* + * Since PTEs also contain type bits, we have to have some way + * to tell pmap_enter `this is an IO page' or `this is not to + * be cached'. Since physical addresses are always aligned, we + * can do this with the low order bits. + * + * The values below must agree with pte.h such that: + * (PMAP_OBIO << PG_MOD_SHIFT) == PGT_OBIO + */ +#define PMAP_OBIO 0x04 /* tells pmap_enter to use PG_OBIO */ +#define PMAP_VME16 0x08 /* etc */ +#define PMAP_VME32 0x0C /* etc */ +#define PMAP_NC 0x10 /* tells pmap_enter to set PG_NC */ +#define PMAP_SPEC 0x1C /* mask to get all above. */ + +#endif /* _KERNEL */ +#endif /* _MACHINE_PMAP_ */ diff --git a/sys/arch/sun3/include/proc.h b/sys/arch/sun3/include/proc.h new file mode 100644 index 00000000000..602aa3cbf65 --- /dev/null +++ b/sys/arch/sun3/include/proc.h @@ -0,0 +1,55 @@ +/* $NetBSD: proc.h,v 1.7 1994/11/21 21:34:06 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 + * proc.h,v 1.2 1993/05/22 07:58:30 cgd Exp + */ + +/* + * Machine-dependent part of the proc structure for sun3. + */ +struct mdproc { + int *md_regs; /* registers on current frame */ + int md_flags; /* machine-dependent flags */ + int md_upte[UPAGES]; /* ptes for mapping u page */ +}; + +/* md_flags */ +#define MDP_FPUSED 0x0001 /* floating point coprocessor used */ +#define MDP_STACKADJ 0x0002 /* frame SP adjusted, might have to + undo when system call returns + ERESTART. */ +#define MDP_HPUXTRACE 0x0004 /* being traced by HP-UX process */ + diff --git a/sys/arch/sun3/include/profile.h b/sys/arch/sun3/include/profile.h new file mode 100644 index 00000000000..a45c00b9331 --- /dev/null +++ b/sys/arch/sun3/include/profile.h @@ -0,0 +1,3 @@ +/* $NetBSD: profile.h,v 1.3 1994/11/21 21:34:07 gwr Exp $ */ + +#include <m68k/profile.h> diff --git a/sys/arch/sun3/include/psl.h b/sys/arch/sun3/include/psl.h new file mode 100644 index 00000000000..d716133399c --- /dev/null +++ b/sys/arch/sun3/include/psl.h @@ -0,0 +1,106 @@ +/* $NetBSD: psl.h,v 1.8 1995/10/10 21:28:00 gwr Exp $ */ + +/* + * Copyright (c) 1995 Gordon W. Ross + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * 4. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Gordon Ross + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PSL_C +#include <m68k/psl.h> + +/* Could define this in the common <m68k/psl.h> instead. */ + +#if defined(_KERNEL) && !defined(LOCORE) + +#ifndef __GNUC__ +/* No inline, use real function in locore.s */ +extern int _spl(int new); +#else /* GNUC */ +/* + * Define an inline function for PSL manipulation. + * This is as close to a macro as one can get. + * If not optimizing, the one in locore.s is used. + * (See the GCC extensions info document.) + */ +extern __inline__ int _spl(int new) +{ + register int old; + + __asm __volatile ( + "clrl %0; movew sr,%0; movew %1,sr" : + "&=d" (old) : "di" (new)); + return (old); +} +#endif /* GNUC */ + +/* + * The rest of this is sun3 specific, because other ports may + * need to do special things in spl0() (i.e. simulate SIR). + * Suns have a REAL interrupt register, so spl0() and splx(s) + * have no need to check for any simulated interrupts, etc. + */ + +#define spl0() _spl(PSL_S|PSL_IPL0) +#define spl1() _spl(PSL_S|PSL_IPL1) +#define spl2() _spl(PSL_S|PSL_IPL2) +#define spl3() _spl(PSL_S|PSL_IPL3) +#define spl4() _spl(PSL_S|PSL_IPL4) +#define spl5() _spl(PSL_S|PSL_IPL5) +#define spl6() _spl(PSL_S|PSL_IPL6) +#define spl7() _spl(PSL_S|PSL_IPL7) +#define splx(x) _spl(x) + +/* IPL used by soft interrupts: netintr(), softclock() */ +#define splsoftclock() spl1() +#define splsoftnet() spl1() + +/* Highest block device (strategy) IPL. */ +#define splbio() spl2() + +/* Highest network interface IPL. */ +#define splnet() spl3() + +/* Highest tty device IPL. */ +#define spltty() spl4() + +/* Requirement: imp >= (highest network, tty, or disk IPL) */ +#define splimp() spl4() + +/* Intersil clock hardware interrupts (hard-wired at 5) */ +#define splclock() spl5() +#define splstatclock() splclock() + +/* Zilog Serial hardware interrupts (hard-wired at 6) */ +#define splzs() spl6() + +/* Block out all interrupts (except NMI of course). */ +#define splhigh() spl7() +#define splsched() spl7() + +#endif /* KERNEL && !LOCORE */ +#endif /* PSL_C */ diff --git a/sys/arch/sun3/include/pte.h b/sys/arch/sun3/include/pte.h new file mode 100644 index 00000000000..f0bee459629 --- /dev/null +++ b/sys/arch/sun3/include/pte.h @@ -0,0 +1,83 @@ +/* $NetBSD: pte.h,v 1.9 1995/03/10 02:28:01 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _MACHINE_PTE_H +#define _MACHINE_PTE_H + +#define NCONTEXT 8 +#define SEGINV 255 +#define NPAGSEG 16 +#define NSEGMAP 2048 + +#define PG_VALID 0x80000000 +#define PG_WRITE 0x40000000 +#define PG_SYSTEM 0x20000000 +#define PG_NC 0x10000000 +#define PG_TYPE 0x0C000000 +#define PG_REF 0x02000000 +#define PG_MOD 0x01000000 + +#define PG_SPECIAL (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC|PG_REF|PG_MOD) +#define PG_PERM (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC) +#define PG_MODREF (PG_REF|PG_MOD) +#define PG_FRAME 0x0007FFFF + +#define PG_MOD_SHIFT 24 +#define PG_PERM_SHIFT 28 + +#define OBMEM 0 +#define OBIO 1 +#define VME_D16 2 +#define VME_D32 3 +#define PG_TYPE_SHIFT 26 + +#define PG_INVAL 0x0 + +#define MAKE_PGTYPE(x) ((x) << PG_TYPE_SHIFT) +#define PG_PGNUM(pte) (pte & PG_FRAME) +#define PG_PA(pte) ((pte & PG_FRAME) <<PGSHIFT) + +#define PGT_MASK MAKE_PGTYPE(3) +#define PGT_OBMEM MAKE_PGTYPE(OBMEM) /* onboard memory */ +#define PGT_OBIO MAKE_PGTYPE(OBIO) /* onboard I/O */ +#define PGT_VME_D16 MAKE_PGTYPE(VME_D16) /* VMEbus 16-bit data */ +#define PGT_VME_D32 MAKE_PGTYPE(VME_D32) /* VMEbus 32-bit data */ + +#define VA_PTE_NUM_SHIFT 13 +#define VA_PTE_NUM_MASK (0xF << VA_PTE_NUM_SHIFT) +#define VA_PTE_NUM(va) ((va & VA_PTE_NUM_MASK) >> VA_PTE_NUM_SHIFT) + +#define PA_PGNUM(pa) ((unsigned)pa >> PGSHIFT) + +#endif /* !_MACHINE_PTE_H*/ diff --git a/sys/arch/sun3/include/ptrace.h b/sys/arch/sun3/include/ptrace.h new file mode 100644 index 00000000000..70c738ac820 --- /dev/null +++ b/sys/arch/sun3/include/ptrace.h @@ -0,0 +1,3 @@ +/* $NetBSD: ptrace.h,v 1.4 1994/11/21 21:34:14 gwr Exp $ */ + +#include <m68k/ptrace.h> diff --git a/sys/arch/sun3/include/reg.h b/sys/arch/sun3/include/reg.h new file mode 100644 index 00000000000..785473c92a8 --- /dev/null +++ b/sys/arch/sun3/include/reg.h @@ -0,0 +1,3 @@ +/* $NetBSD: reg.h,v 1.11 1994/11/21 21:34:16 gwr Exp $ */ + +#include <m68k/reg.h> diff --git a/sys/arch/sun3/include/saio.h b/sys/arch/sun3/include/saio.h new file mode 100644 index 00000000000..751dc6a1718 --- /dev/null +++ b/sys/arch/sun3/include/saio.h @@ -0,0 +1,150 @@ +/* $NetBSD: saio.h,v 1.2 1995/05/24 20:58:05 gwr Exp $ */ + +/* + * Copyright (c) 1995 Gordon W. Ross + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * 4. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Gordon Ross + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file derived from kernel/mach/sun3.md/machMon.h from the + * sprite distribution. + * + * In particular, this file came out of the Walnut Creek cdrom collection + * which contained no warnings about any possible copyright infringement. + */ + +/* + * machMon.h -- + * + * Structures, constants and defines for access to the sun monitor. + * These were translated from the sun monitor header files: + * mon/sunromvec.h + * stand/saio.h + * + * Copyright (C) 1985 Regents of the University of California + * All rights reserved. + * + * Header: /sprite/src/boot/sunprom/sun3.md/RCS/machMon.h,v \ + * 1.1 90/09/17 10:57:28 rab Exp Locker: rab $ SPRITE (Berkeley) + */ + +/* + * The table entry that describes a device. It exists in the PROM; a + * pointer to it is passed in MachMonBootParam. It can be used to locate + * PROM subroutines for opening, reading, and writing the device. + * + * When using this interface, only one device can be open at once. + */ +typedef struct boottab { + char b_dev[2]; /* The name of the device */ + int (*b_probe)(); /* probe() --> -1 or found controller + number */ + int (*b_boot)(); /* boot(bp) --> -1 or start address */ + int (*b_open)(); /* open(iobp) --> -1 or 0 */ + int (*b_close)(); /* close(iobp) --> -1 or 0 */ + int (*b_strategy)(); /* strategy(iobp,rw) --> -1 or 0 */ + char *b_desc; /* Printable string describing dev */ + struct devinfo *b_devinfo; /* Information to configure device */ +} MachMonBootDevice; + +enum MAPTYPES { /* Page map entry types. */ + MAP_MAINMEM, + MAP_OBIO, + MAP_MBMEM, + MAP_MBIO, + MAP_VME16A16D, + MAP_VME16A32D, + MAP_VME24A16D, + MAP_VME24A32D, + MAP_VME32A16D, + MAP_VME32A32D +}; + +/* + * This table gives information about the resources needed by a device. + */ +typedef struct devinfo { + unsigned int d_devbytes; /* Bytes occupied by device in IO space. */ + unsigned int d_dmabytes; /* Bytes needed by device in DMA memory. */ + unsigned int d_localbytes; /* Bytes needed by device for local info. */ + unsigned int d_stdcount; /* How many standard addresses. */ + unsigned long *d_stdaddrs; /* The vector of standard addresses. */ + enum MAPTYPES d_devtype; /* What map space device is in. */ + unsigned int d_maxiobytes; /* Size to break big I/O's into. */ +} MachMonDevInfo; + + +/* + * A "stand alone I/O request", (from SunOS saio.h) + * This is passed as the main argument to the PROM I/O routines + * in the MachMonBootDevice structure. + */ +typedef struct saioreq { + char si_flgs; + struct boottab *si_boottab; /* Points to boottab entry if any */ + char *si_devdata; /* Device-specific data pointer */ + int si_ctlr; /* Controller number or address */ + int si_unit; /* Unit number within controller */ + long si_boff; /* Partition number within unit */ + long si_cyloff; + long si_offset; + long si_bn; /* Block number to R/W */ + char *si_ma; /* Memory address to R/W */ + int si_cc; /* Character count to R/W */ + struct saif *si_sif; /* net if. pointer (set by b_open) */ + char *si_devaddr; /* Points to mapped in device */ + char *si_dmaaddr; /* Points to allocated DMA space */ +} MachMonIORequest; + + +#define SAIO_F_READ 0x01 +#define SAIO_F_WRITE 0x02 +#define SAIO_F_ALLOC 0x04 +#define SAIO_F_FILE 0x08 +#define SAIO_F_EOF 0x10 /* EOF on device */ +#define SAIO_F_AJAR 0x20 /* Descriptor "ajar" (stopped but not closed) */ + + +/* + * Ethernet interface descriptor (from SunOS saio.h) + * First, set: saiop->si_devaddr, saiop->si_dmaaddr, etc. + * Then: saiop->si_boottab->b_open() will set: + * saiop->si_sif; + * saiop->si_devdata; + * The latter is the first arg to the following functions. + * Note that the buffer must be in DVMA space... + */ +struct saif { + /* transmit packet, returns zero on success. */ + int (*sif_xmit)(void *devdata, char *buf, int len); + /* wait for packet, zero if none arrived */ + int (*sif_poll)(void *devdata, char *buf); + /* reset interface, set addresses, etc. */ + int (*sif_reset)(void *devdata, struct saioreq *sip); + /* Later (sun4 only) proms have more stuff here. */ +}; diff --git a/sys/arch/sun3/include/setjmp.h b/sys/arch/sun3/include/setjmp.h new file mode 100644 index 00000000000..56e05b91e3d --- /dev/null +++ b/sys/arch/sun3/include/setjmp.h @@ -0,0 +1,3 @@ +/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:14 cgd Exp $ */ + +#include <m68k/setjmp.h> diff --git a/sys/arch/sun3/include/signal.h b/sys/arch/sun3/include/signal.h new file mode 100644 index 00000000000..fd86a0c0ea4 --- /dev/null +++ b/sys/arch/sun3/include/signal.h @@ -0,0 +1,3 @@ +/* $NetBSD: signal.h,v 1.5 1994/11/21 21:34:17 gwr Exp $ */ + +#include <m68k/signal.h> diff --git a/sys/arch/sun3/include/stdarg.h b/sys/arch/sun3/include/stdarg.h new file mode 100644 index 00000000000..740512b1f45 --- /dev/null +++ b/sys/arch/sun3/include/stdarg.h @@ -0,0 +1,3 @@ +/* $NetBSD: stdarg.h,v 1.5 1994/11/21 21:34:19 gwr Exp $ */ + +#include <m68k/stdarg.h> diff --git a/sys/arch/sun3/include/sun_disklabel.h b/sys/arch/sun3/include/sun_disklabel.h new file mode 100644 index 00000000000..f1ee4fea01c --- /dev/null +++ b/sys/arch/sun3/include/sun_disklabel.h @@ -0,0 +1,78 @@ +/* $NetBSD: sun_disklabel.h,v 1.3 1994/11/21 21:34:20 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sun_disklabel.h 8.1 (Berkeley) 6/11/93 + * from: Header: sun_disklabel.h,v 1.4 92/06/17 07:04:13 torek Exp + * from: sun_disklabel.h,v 1.1 1993/11/14 10:47:13 deraadt Exp + */ + +/* + * SunOS disk label layout (only relevant portions discovered here). + */ + +#define SUN_DKMAGIC 55998 + +/* partition info */ +struct sun_dkpart { + long sdkp_cyloffset; /* starting cylinder */ + long sdkp_nsectors; /* number of sectors */ +}; + +struct sun_disklabel { /* total size = 512 bytes */ + char sl_text[128]; + char sl_xxx1[292]; + u_short sl_rpm; /* rotational speed */ + u_short sl_pcyl; /* physical cylinders */ + u_short sl_sparespercyl; /* spare sectors per cylinder */ + u_short sl_xxx3[2]; + u_short sl_interleave; /* interleave factor */ + u_short sl_ncylinders; /* data cylinders */ + u_short sl_acylinders; /* alternate cylinders */ + u_short sl_ntracks; /* tracks per cylinder */ + u_short sl_nsectors; /* sectors per track */ + u_short sl_xxx4[2]; + struct sun_dkpart sl_part[8]; /* partition layout */ + u_short sl_magic; /* == SUN_DKMAGIC */ + u_short sl_cksum; /* xor checksum of all shorts */ +}; diff --git a/sys/arch/sun3/include/trap.h b/sys/arch/sun3/include/trap.h new file mode 100644 index 00000000000..3474a7b7491 --- /dev/null +++ b/sys/arch/sun3/include/trap.h @@ -0,0 +1,11 @@ +/* $NetBSD: trap.h,v 1.7 1994/11/21 21:34:23 gwr Exp $ */ + +#include <m68k/trap.h> + +/* + * XXX - need documentation. + * probably should be comment, + * for compat code + */ +#define T_BRKPT T_TRAP15 +#define T_WATCHPOINT 16 diff --git a/sys/arch/sun3/include/types.h b/sys/arch/sun3/include/types.h new file mode 100644 index 00000000000..60b9307473d --- /dev/null +++ b/sys/arch/sun3/include/types.h @@ -0,0 +1,8 @@ +/* $NetBSD: types.h,v 1.7 1995/06/27 14:38:22 gwr Exp $ */ + +#ifndef _MACHINE_TYPES_H_ +#define _MACHINE_TYPES_H_ + +#include <m68k/types.h> + +#endif diff --git a/sys/arch/sun3/include/varargs.h b/sys/arch/sun3/include/varargs.h new file mode 100644 index 00000000000..94f8ce2d742 --- /dev/null +++ b/sys/arch/sun3/include/varargs.h @@ -0,0 +1,3 @@ +/* $NetBSD: varargs.h,v 1.5 1994/11/21 21:34:28 gwr Exp $ */ + +#include <m68k/varargs.h> diff --git a/sys/arch/sun3/include/vmparam.h b/sys/arch/sun3/include/vmparam.h new file mode 100644 index 00000000000..1fac8109288 --- /dev/null +++ b/sys/arch/sun3/include/vmparam.h @@ -0,0 +1,161 @@ +/* $NetBSD: vmparam.h,v 1.14 1995/09/26 04:02:10 gwr Exp $ */ + +/* + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah $Hdr: vmparam.h 1.16 91/01/18$ + * from: @(#)vmparam.h 7.3 (Berkeley) 5/7/91 + * vmparam.h,v 1.2 1993/05/22 07:58:38 cgd Exp + */ + +/* + * Machine dependent constants for Sun3 + * + * The Sun3 has limited total kernel virtual space (32MB) and + * can not use main memory for page tables. (All active PTEs + * must be installed in special translation RAM in the MMU). + * Therefore, parameters that would normally configure the + * size of various page tables are irrelevant. Only things + * that consume portions of kernel virtual (KV) space matter, + * and those things should be chosen to conserve KV space. + */ + +/* + * USRTEXT is the start of the user text/data space, while + * USRSTACK is the top (end) of the user stack. + */ +#define USRTEXT NBPG /* Start of user text */ +#define USRSTACK KERNBASE /* High end of user stack */ + +/* + * Virtual memory related constants, all in bytes + */ +#ifndef MAXTSIZ +#define MAXTSIZ (8*1024*1024) /* max text size */ +#endif +#ifndef DFLDSIZ +#define DFLDSIZ (8*1024*1024) /* initial data size limit */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (32*1024*1024) /* max data size */ +#endif +#ifndef DFLSSIZ +#define DFLSSIZ (512*1024) /* initial stack size limit */ +#endif +#ifndef MAXSSIZ +#define MAXSSIZ MAXDSIZ /* max stack size */ +#endif + +/* + * 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. + * DMMIN should be at least ctod(1) so that vtod() works. + * vminit() insures this. + */ +#define DMMIN 32 /* smallest swap allocation */ +#define DMMAX 4096 /* largest potential swap allocation */ + +/* + * PTEs for mapping user space into the kernel for phyio operations. + * The actual limitation for physio requests will be the DVMA space, + * and that is fixed by hardware design at 1MB. We could make the + * physio map larger than that, but it would not buy us much. + */ +#ifndef USRIOSIZE +#define USRIOSIZE 128 /* 1 MB */ +#endif + +/* + * PTEs for system V style shared memory. + * This is basically slop for kmempt which we actually allocate (malloc) from. + */ +#ifndef SHMMAXPGS +#define SHMMAXPGS 512 /* 4 MB */ +#endif + +/* + * 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; + * 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 + +/* + * A swapped in process is given a small amount of core without being bothered + * by the page replacement algorithm. Basically this says that if you are + * swapped in you deserve some resources. We protect the last SAFERSS + * pages against paging and will just swap you out rather than paging you. + * Note that each process has at least UPAGES+CLSIZE pages which are not + * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this + * number just means a swapped in process is given around 25k bytes. + * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), + * 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. + */ +#define SAFERSS 4 /* nominal ``small'' resident set size + protected against replacement */ + +/* + * Mach-derived constants, virtual memory map: + * + * 0000.0000 user space + * 0E00.0000 kernel space + * 0FE0.0000 monitor map (devices) + * 0FF0.0000 DVMA space + * 0FFE.0000 monitor RAM seg. + * 0FFF.E000 monitor RAM page + */ + +/* user/kernel map constants */ +#define VM_MIN_ADDRESS ((vm_offset_t)0) +#define VM_MAX_ADDRESS ((vm_offset_t)KERNBASE) +#define VM_MAXUSER_ADDRESS ((vm_offset_t)KERNBASE) +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNBASE) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0x0FE00000) + +/* virtual sizes (bytes) for various kernel submaps */ +#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) +#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) diff --git a/sys/arch/sun3/include/vuid_event.h b/sys/arch/sun3/include/vuid_event.h new file mode 100644 index 00000000000..cf3e0473570 --- /dev/null +++ b/sys/arch/sun3/include/vuid_event.h @@ -0,0 +1,87 @@ +/* $NetBSD: vuid_event.h,v 1.1 1994/12/01 22:46:48 gwr Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vuid_event.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * The following is a minimal emulation of Sun's `Firm_event' structures + * and related operations necessary to make X11 happy (i.e., make it + * compile, and make old X11 binaries run). + */ +typedef struct firm_event { + u_short id; /* key or MS_* or LOC_[XY]_DELTA */ + u_short pad; /* unused, at least by X11 */ + int value; /* VKEY_{UP,DOWN} or locator delta */ + struct timeval time; +} Firm_event; + +/* + * Special `id' fields. These weird numbers simply match the old binaries. + * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!). + */ +#define MS_LEFT 0x7f20 /* left mouse button */ +#define MS_MIDDLE 0x7f21 /* middle mouse button */ +#define MS_RIGHT 0x7f22 /* right mouse button */ +#define LOC_X_DELTA 0x7f80 /* mouse delta-X */ +#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */ +#define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */ +#define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */ + +/* + * Special `value' fields. These apply to keys and mouse buttons. The + * value of a mouse delta is the delta. Note that positive deltas are + * left and up (not left and down as you might expect). + */ +#define VKEY_UP 0 /* key or button went up */ +#define VKEY_DOWN 1 /* key or button went down */ + +/* + * The following ioctls are clearly intended to take things in and out + * of `firm event' mode. Since we always run in this mode (as far as + * /dev/kbd and /dev/mouse are concerned, anyway), we always claim to + * be in this mode and reject anything else. + */ +#define VUIDSFORMAT _IOW('v', 1, int) +#define VUIDGFORMAT _IOR('v', 2, int) +#define VUID_FIRM_EVENT 1 /* the only format we support */ |