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/mac68k/include |
initial import of NetBSD tree
Diffstat (limited to 'sys/arch/mac68k/include')
35 files changed, 2376 insertions, 0 deletions
diff --git a/sys/arch/mac68k/include/adbsys.h b/sys/arch/mac68k/include/adbsys.h new file mode 100644 index 00000000000..ecb9a549e62 --- /dev/null +++ b/sys/arch/mac68k/include/adbsys.h @@ -0,0 +1,126 @@ +/* $NetBSD: adbsys.h,v 1.3 1994/12/03 23:34:28 briggs Exp $ */ + +/*- + * Copyright (C) 1993, 1994 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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. + */ + + +#include <sys/time.h> /* timeval stuff */ +#include <sys/ioctl.h> /* ioctls */ + + +/* Handy visual constants */ +#define ADB_MAX_HANDLERS 256 +#define ADB_MAX_DEVS 16 + + +/* Different ADB system types */ +enum adb_system_e { + MacIIADB, + MacIIsiADB, + MacPBADB}; +extern enum adb_system_e adb_system_type; + + +/* an ADB event */ +typedef struct adb_event_s { + int addr; /* device address */ + int hand_id; /* handler id */ + int def_addr; /* default address */ + int byte_count; /* number of bytes */ + unsigned char bytes[8]; /* bytes from register 0 */ + struct timeval timestamp; /* time event was acquired */ + union { + struct adb_keydata_s{ + int key; /* ADB key code */ + } k; + struct adb_mousedata_s{ + int dx; /* mouse delta x */ + int dy; /* mouse delta y */ + int buttons; /* buttons (down << (buttonnum)) */ + } m; + } u; /* courtesy interpretation */ +} adb_event_t; + + +/* a device on the ADB */ +typedef struct adb_dev_s{ + int addr; /* current address */ + int default_addr; /* startup address */ + int handler_id; /* handler ID */ +} adb_dev_t; + + + /* Interesting default addresses */ +#define ADBADDR_MAP 2 +#define ADBADDR_REL 3 +#define ADBADDR_ABS 4 +#define ADBADDR_KBD ADBADDR_MAP +#define ADBADDR_MS ADBADDR_REL +#define ADBADDR_TABLET ADBADDR_ABS + + + /* Interesting handler IDs */ +#define ADB_STDKBD 1 +#define ADB_EXTKBD 2 +#define ADBMS_100DPI 1 +#define ADBMS_200DPI 2 + + + /* Get device info from ADB system */ +typedef struct adb_devinfo_s{ + adb_dev_t dev[ADB_MAX_DEVS]; + /* [addr].addr == -1 if none */ +} adb_devinfo_t; +#define ADBIOC_DEVSINFO _IOR('A', 128, adb_devinfo_t) + + + /* Event auto-repeat */ +typedef struct adb_rptinfo_s{ + int delay_ticks; /* ticks before repeat */ + int interval_ticks; /* ticks between repeats */ +} adb_rptinfo_t; +#define ADBIOC_GETREPEAT _IOR('A', 130, adb_rptinfo_t) +#define ADBIOC_SETREPEAT _IOW('A', 131, adb_rptinfo_t) + + + /* Reset and reinitialize */ +#define ADBIOC_RESET _IO('A', 132) + + +typedef struct adb_listencmd_s{ + int address; /* device address */ + int reg; /* register to which to send bytes */ + int bytecnt; /* number of bytes */ + u_char bytes[8]; /* bytes */ +} adb_listencmd_t; +#define ADBIOC_LISTENCMD _IOW('A', 133, adb_listencmd_t) diff --git a/sys/arch/mac68k/include/ansi.h b/sys/arch/mac68k/include/ansi.h new file mode 100644 index 00000000000..074262aa9d8 --- /dev/null +++ b/sys/arch/mac68k/include/ansi.h @@ -0,0 +1,3 @@ +/* $NetBSD: ansi.h,v 1.4 1994/10/26 08:46:24 cgd Exp $ */ + +#include <m68k/ansi.h> diff --git a/sys/arch/mac68k/include/asm.h b/sys/arch/mac68k/include/asm.h new file mode 100644 index 00000000000..c97b1db0038 --- /dev/null +++ b/sys/arch/mac68k/include/asm.h @@ -0,0 +1,3 @@ +/* $NetBSD: asm.h,v 1.2 1994/10/26 08:46:25 cgd Exp $ */ + +#include <m68k/asm.h> diff --git a/sys/arch/mac68k/include/cdefs.h b/sys/arch/mac68k/include/cdefs.h new file mode 100644 index 00000000000..e9324975a62 --- /dev/null +++ b/sys/arch/mac68k/include/cdefs.h @@ -0,0 +1,8 @@ +/* $NetBSD: cdefs.h,v 1.1 1995/01/19 01:42:13 jtc Exp $ */ + +#ifndef _MACHINE_CDEFS_H_ +#define _MACHINE_CDEFS_H_ + +#include <m68k/cdefs.h> + +#endif diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h new file mode 100644 index 00000000000..f8fbc4d45c9 --- /dev/null +++ b/sys/arch/mac68k/include/cpu.h @@ -0,0 +1,351 @@ +/* $NetBSD: cpu.h,v 1.25 1995/09/14 02:48:09 briggs Exp $ */ + +/* + * 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. + */ + +/* + * Copyright (c) 1992, 1993 BCDL Labs. All rights reserved. + * Allen Briggs, Chris Caputo, Michael Finch, Brad Grantham, Lawrence Kesteloot + + * Redistribution of this source code or any part thereof is permitted, + * provided that the following conditions are met: + * 1) Utilized source contains the copyright message above, this list + * of conditions, and the following disclaimer. + * 2) Binary objects containing compiled source reproduce the + * copyright notice above on startup. + * + * CAVEAT: This source code is provided "as-is" by BCDL Labs, and any + * warranties of ANY kind are disclaimed. We don't even claim that it + * won't crash your hard disk. Basically, we want a little credit if + * it works, but we don't want to get mail-bombed if it doesn't. + */ + +/* + * from: Utah $Hdr: cpu.h 1.16 91/03/25$ + * + * @(#)cpu.h 7.7 (Berkeley) 6/27/91 + */ + +/* + ALICE + BG -- Sat May 23 23:58:23 EDT 1992 + Exported defines and stuff unique to mac68k. + A lot of this stuff is really specific to the m68k, not just the macs, + but there isn't time to do anything about that right now... + */ + +#ifndef _MACHINE_CPU_H_ +#define _MACHINE_CPU_H_ 1 + +/* + * 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 +#define cpu_swapout(p) + +/* + * Arguments to hardclock, softclock and gatherstats + * encapsulate the previous machine state in an opaque + * clockframe; for hp300, use just what the hardware + * leaves on the stack. + */ + +struct clockframe { + u_short sr; + u_long pc; + u_short vo; +}; + +#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0) +#define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0) +#define CLKF_PC(framep) ((framep)->pc) +#define CLKF_INTR(framep) (0) /* XXX should use PSL_M (see hp300) */ + +/* + * Preempt the current process if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ +#define need_resched() { want_resched++; aston(); } + +/* + * Give a profiling tick to the current process from the softclock + * interrupt. 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() + +#define aston() (astpending++) + +int astpending; /* need to trap before returning to user mode */ +int want_resched; /* resched() was called */ + +/* + * simulated software interrupt register + */ +extern unsigned char ssir; + +#define SIR_NET 0x1 +#define SIR_CLOCK 0x2 +#define SIR_SERIAL 0x4 + +#define siroff(x) ssir &= ~(x) +#define setsoftnet() ssir |= SIR_NET +#define setsoftclock() ssir |= SIR_CLOCK +#define setsoftserial() ssir |= SIR_SERIAL + +#define CPU_CONSDEV 1 +#define CPU_MAXID 2 + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "console_device", CTLTYPE_STRUCT }, \ +} + +/* values for machineid -- + * These are equivalent to the MacOS Gestalt values. */ +#define MACH_MACII 6 +#define MACH_MACIIX 7 +#define MACH_MACIICX 8 +#define MACH_MACSE30 9 +#define MACH_MACIICI 11 +#define MACH_MACIIFX 13 +#define MACH_MACIISI 18 +#define MACH_MACQ900 20 +#define MACH_MACPB170 21 +#define MACH_MACQ700 22 +#define MACH_MACCLASSICII 23 +#define MACH_MACPB100 24 +#define MACH_MACPB140 25 +#define MACH_MACQ950 26 +#define MACH_MACLCIII 27 +#define MACH_MACPB210 29 +#define MACH_MACC650 30 +#define MACH_MACPB230 32 +#define MACH_MACPB180 33 +#define MACH_MACPB160 34 +#define MACH_MACQ800 35 +#define MACH_MACQ650 36 +#define MACH_MACLCII 37 +#define MACH_MACPB250 38 +#define MACH_MACIIVI 44 +#define MACH_MACP600 45 +#define MACH_MACIIVX 48 +#define MACH_MACCCLASSIC 49 +#define MACH_MACPB165C 50 +#define MACH_MACC610 52 +#define MACH_MACQ610 53 +#define MACH_MACPB145 54 +#define MACH_MACLC520 56 +#define MACH_MACC660AV 60 +#define MACH_MACP460 62 +#define MACH_MACPB180C 71 +#define MACH_MACPB270 77 +#define MACH_MACQ840AV 78 +#define MACH_MACP550 80 +#define MACH_MACPB165 84 +#define MACH_MACTV 88 +#define MACH_MACLC475 89 +#define MACH_MACLC575 92 +#define MACH_MACQ605 94 + +/* + * Machine classes. These define subsets of the above machines. + */ +#define MACH_CLASSH 0x0000 /* Hopeless cases... */ +#define MACH_CLASSII 0x0001 /* MacII class */ +#define MACH_CLASSIIci 0x0004 /* Have RBV, but no Egret */ +#define MACH_CLASSIIsi 0x0005 /* Similar to IIci -- Have Egret. */ +#define MACH_CLASSIIvx 0x0006 /* Similar to IIsi -- different via2 emul? */ +#define MACH_CLASSLC 0x0007 /* Low-Cost/Performa/Wal-Mart Macs. */ +#define MACH_CLASSPB 0x0008 /* Powerbooks. Power management. */ +#define MACH_CLASSIIfx 0x0080 /* The IIfx is in a class by itself. */ +#define MACH_CLASSQ 0x0100 /* Centris/Quadras. */ + +#define MACH_68020 0 +#define MACH_68030 1 +#define MACH_68040 2 +#define MACH_PENTIUM 3 /* 66 and 99 MHz versions *only* */ + +/* Defines for mmutype */ +#define MMU_68040 -2 +#define MMU_68030 -1 +/* #define MMU_HP 0 Just a reminder as to where this came from. */ +#define MMU_68851 1 + +#ifdef _KERNEL +struct mac68k_machine_S { + int cpu_model_index; + /* + * Misc. info from booter. + */ + int machineid; + int mach_processor; + int mach_memsize; + int booter_version; + /* + * Debugging flags. + */ + int do_graybars; + int serial_boot_echo; + int serial_console; + /* + * Misc. hardware info. + */ + int scsi80; /* Has NCR 5380 */ + int scsi96; /* Has NCR 53C96 */ + int scsi96_2; /* Has 2nd 53C96 */ + int sonic; /* Has SONIC e-net */ + + int sccClkConst; /* "Constant" for SCC bps */ +}; + + /* What kind of model is this */ +struct cpu_model_info { + int machineid; /* MacOS Gestalt value. */ + char *model_major; /* Make this distinction to save a few */ + char *model_minor; /* bytes--might be useful, too. */ + int class; /* Rough class of machine. */ + /* forwarded romvec_s is defined in mac68k/macrom.h */ + struct romvec_s *rom_vectors; /* Pointer to our known rom vectors */ +}; +extern struct cpu_model_info *current_mac_model; + +extern unsigned long IOBase; /* Base address of I/O */ +extern unsigned long NuBusBase; /* Base address of NuBus */ + +extern struct mac68k_machine_S mac68k_machine; +extern int mmutype ; +extern unsigned long load_addr; +#endif /* _KERNEL */ + +/* physical memory sections */ +#define ROMBASE (0x40800000) +#define ROMLEN (0x01000000) /* 16MB should be plenty! */ +#define ROMMAPSIZE btoc(ROMLEN) /* 16k of page tables. */ + +/* This should not be used. Use IOBase, instead. */ +#define INTIOBASE (0x50000000) + +#define INTIOTOP (IOBase+0x01000000) +#define IIOMAPSIZE btoc(0x01000000) + +/* XXX -- Need to do something about superspace. + * Technically, NuBus superspace starts at 0x60000000, but no + * known Macintosh has used any slot lower numbered than 9, and + * the super space is defined as 0xS000 0000 through 0xSFFF FFFF + * where S is the slot number--ranging from 0x9 - 0xE. + */ +#define NBSBASE 0x90000000 +#define NBSTOP 0xF0000000 +#define NBBASE 0xF9000000 /* NUBUS space */ +#define NBTOP 0xFF000000 /* NUBUS space */ +#define NBMAPSIZE btoc(NBTOP-NBBASE) /* ~ 96 megs */ +#define NBMEMSIZE 0x01000000 /* 16 megs per card */ +#define NBROMOFFSET 0x00FF0000 /* Last 64K == ROM */ + +/* + * 68851 and 68030 MMU + */ +#define PMMU_LVLMASK 0x0007 +#define PMMU_INV 0x0400 +#define PMMU_WP 0x0800 +#define PMMU_ALV 0x1000 +#define PMMU_SO 0x2000 +#define PMMU_LV 0x4000 +#define PMMU_BE 0x8000 +#define PMMU_FAULT (PMMU_WP|PMMU_INV) + +/* + * 68040 MMU + */ +#define MMU4_RES 0x001 +#define MMU4_TTR 0x002 +#define MMU4_WP 0x004 +#define MMU4_MOD 0x010 +#define MMU4_CMMASK 0x060 +#define MMU4_SUP 0x080 +#define MMU4_U0 0x100 +#define MMU4_U1 0x200 +#define MMU4_GLB 0x400 +#define MMU4_BE 0x800 + +/* 680X0 function codes */ +#define FC_USERD 1 /* user data space */ +#define FC_USERP 2 /* user program 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 */ + +/* additional fields in the 68030 cache control register */ +#define IC_BE 0x0010 /* instruction burst enable */ +#define DC_ENABLE 0x0100 /* data cache enable */ +#define DC_FREEZE 0x0200 /* data cache freeze */ +#define DC_CE 0x0400 /* clear data cache entry */ +#define DC_CLR 0x0800 /* clear entire data cache */ +#define DC_BE 0x1000 /* data burst enable */ +#define DC_WA 0x2000 /* write allocate */ + +#define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE) +#define CACHE_OFF (DC_CLR|IC_CLR) +#define CACHE_CLR (CACHE_ON) +#define IC_CLEAR (DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE) +#define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE) + +/* 68040 cache control register */ +#define IC4_ENABLE 0x00008000 /* enable instruction cache */ +#define DC4_ENABLE 0x80000000 /* enable data cache */ + +#define CACHE4_ON (IC4_ENABLE|DC4_ENABLE) +#define CACHE4_OFF 0x00000000 + +#endif /* !_MACHINE_CPU_H_ */ diff --git a/sys/arch/mac68k/include/db_machdep.h b/sys/arch/mac68k/include/db_machdep.h new file mode 100644 index 00000000000..d83c8acce3a --- /dev/null +++ b/sys/arch/mac68k/include/db_machdep.h @@ -0,0 +1,3 @@ +/* $NetBSD: db_machdep.h,v 1.3 1994/10/26 08:46:27 cgd Exp $ */ + +#include <m68k/db_machdep.h> diff --git a/sys/arch/mac68k/include/disklabel.h b/sys/arch/mac68k/include/disklabel.h new file mode 100644 index 00000000000..7445c16608b --- /dev/null +++ b/sys/arch/mac68k/include/disklabel.h @@ -0,0 +1,46 @@ +/* $NetBSD: disklabel.h,v 1.1 1994/10/14 18:27:05 cgd 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 { + int cd_dummy; /* must have one element. */ +}; + +#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/mac68k/include/endian.h b/sys/arch/mac68k/include/endian.h new file mode 100644 index 00000000000..73f66f0bd90 --- /dev/null +++ b/sys/arch/mac68k/include/endian.h @@ -0,0 +1,3 @@ +/* $NetBSD: endian.h,v 1.5 1994/10/26 08:46:28 cgd Exp $ */ + +#include <m68k/endian.h> diff --git a/sys/arch/mac68k/include/exec.h b/sys/arch/mac68k/include/exec.h new file mode 100644 index 00000000000..891056552e6 --- /dev/null +++ b/sys/arch/mac68k/include/exec.h @@ -0,0 +1,57 @@ +/* $NetBSD: exec.h,v 1.7 1994/10/26 08:46:29 cgd Exp $ */ + +/*- + * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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_EXEC_H +#define _MACHINE_EXEC_H + +#define __LDPGSZ 8192 + +/* #define cpu_exec_makecmds(p,epp) ENOEXEC */ + +/* Relocation format. */ +struct relocation_info_mac68k { + 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_mac68k + +#endif diff --git a/sys/arch/mac68k/include/float.h b/sys/arch/mac68k/include/float.h new file mode 100644 index 00000000000..b5dce5122e3 --- /dev/null +++ b/sys/arch/mac68k/include/float.h @@ -0,0 +1,8 @@ +/* $NetBSD: float.h,v 1.5 1995/06/20 20:45:44 jtc Exp $ */ + +#ifndef _MACHINE_FLOAT_H_ +#define _MACHINE_FLOAT_H_ + +#include <m68k/float.h> + +#endif diff --git a/sys/arch/mac68k/include/frame.h b/sys/arch/mac68k/include/frame.h new file mode 100644 index 00000000000..97a43ec5b9c --- /dev/null +++ b/sys/arch/mac68k/include/frame.h @@ -0,0 +1,3 @@ +/* $NetBSD: frame.h,v 1.4 1994/10/26 08:46:31 cgd Exp $ */ + +#include <m68k/frame.h> diff --git a/sys/arch/mac68k/include/grfioctl.h b/sys/arch/mac68k/include/grfioctl.h new file mode 100644 index 00000000000..2b743f0600f --- /dev/null +++ b/sys/arch/mac68k/include/grfioctl.h @@ -0,0 +1,99 @@ +/* $NetBSD: grfioctl.h,v 1.5 1995/07/02 05:26:45 briggs Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 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: grfioctl.h 1.1 90/07/09$ + * + * @(#)grfioctl.h 7.2 (Berkeley) 11/4/90 + */ + +struct grfmode { + u_int8_t mode_id; /* Identifier for mode */ + caddr_t fbbase; /* Base of page of frame buffer */ + u_int32_t fbsize; /* Size of frame buffer */ + u_int16_t fboff; /* Offset of frame buffer from base */ + u_int16_t rowbytes; /* Screen rowbytes */ + u_int16_t width; /* Screen width */ + u_int16_t height; /* Screen height */ + u_int16_t hres; /* Horizontal resolution (dpi) */ + u_int16_t vres; /* Vertical resolution (dpi) */ + u_int16_t ptype; /* 0 = indexed, 0x10 = direct */ + u_int16_t psize; /* Screen depth */ + char pad[32]; /* Space for expansion */ +}; + +struct grfmodes { + int nmodes; /* Number of modes in modelist */ + struct grfmode *modelist; /* Pointer to space for modes */ +}; + +/* + * BSD ioctls (first few match HP/UX ioctl()s. In case we want + * compatibility later, start our own at 16). + */ +#define GRFIOCGINFO _IOR('G', 0, struct grfinfo) /* get info on device */ +#define GRFIOCON _IO('G', 1) /* turn graphics on */ +#define GRFIOCOFF _IO('G', 2) /* turn graphics off */ +#define GRFIOCMAP _IOWR('G', 5, int) /* map in regs+framebuffer */ +#define GRFIOCUNMAP _IOW('G', 6, int) /* unmap regs+framebuffer */ + +#define GRFIOCLISTMODES _IOWR('G', 16, struct grfmodes) /* Get list of modes */ +#define GRFIOCGETMODE _IOR('G', 17, int) /* Get list of modes */ +#define GRFIOCSETMODE _IOW('G', 18, int) /* Set to mode_id mode */ +#define GRFIOCGMODE _IOR('G', 19, struct grfmode) /* Get list of modes */ + +/* + * Obsolete structure. + * Only used to return information to older programs that still + * depend on GRFIOCGINFO. + */ +struct grfinfo { + int gd_id; /* HPUX identifier */ + caddr_t gd_regaddr; /* control registers physaddr */ + int gd_regsize; /* control registers size */ + caddr_t gd_fbaddr; /* frame buffer physaddr */ + int gd_fbsize; /* frame buffer size */ + short gd_colors; /* number of colors */ + short gd_planes; /* number of planes */ + int gd_fbwidth; /* frame buffer width */ + int gd_fbheight; /* frame buffer height */ + int gd_fbrowbytes; /* frame buffer rowbytes */ + int gd_dwidth; /* displayed part width */ + int gd_dheight; /* displayed part height */ + int gd_pad[6]; /* for future expansion */ +}; diff --git a/sys/arch/mac68k/include/ieeefp.h b/sys/arch/mac68k/include/ieeefp.h new file mode 100644 index 00000000000..5b361cd9cc1 --- /dev/null +++ b/sys/arch/mac68k/include/ieeefp.h @@ -0,0 +1,4 @@ +/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:07 jtc Exp $ */ + +/* Just use the common m68k definition */ +#include <m68k/ieeefp.h> diff --git a/sys/arch/mac68k/include/iteioctl.h b/sys/arch/mac68k/include/iteioctl.h new file mode 100644 index 00000000000..c2a75657e55 --- /dev/null +++ b/sys/arch/mac68k/include/iteioctl.h @@ -0,0 +1,52 @@ +/* $NetBSD: iteioctl.h,v 1.1 1994/12/03 23:34:31 briggs Exp $ */ + +/*- + * Copyright (C) 1994 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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. + * + * $Id: iteioctl.h,v 1.1 1995/10/18 08:51:05 deraadt Exp $ + * + */ + + +#include <sys/ioctl.h> + + +struct bellparams{ + int freq; /* hertz frequency */ + int len; /* length in clock ticks */ + int vol; /* percentage volume */ +}; + + +#define ITEIOC_GETBELL _IOR('I', 128, struct bellparams) +#define ITEIOC_SETBELL _IOW('I', 129, struct bellparams) +#define ITEIOC_RINGBELL _IO('I', 130) diff --git a/sys/arch/mac68k/include/keyboard.h b/sys/arch/mac68k/include/keyboard.h new file mode 100644 index 00000000000..3b65fd1bc47 --- /dev/null +++ b/sys/arch/mac68k/include/keyboard.h @@ -0,0 +1,208 @@ +/* $NetBSD: keyboard.h,v 1.4 1994/12/03 23:34:32 briggs Exp $ */ + +/*- + * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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. + */ + +#define ADBK_LEFT 0x3B +#define ADBK_RIGHT 0x3C +#define ADBK_UP 0x3E +#define ADBK_DOWN 0x3D +#define ADBK_PGUP 0x74 +#define ADBK_PGDN 0x79 +#define ADBK_HOME 0x73 +#define ADBK_END 0x77 +#define ADBK_CONTROL 0x36 +#define ADBK_FLOWER 0x37 +#define ADBK_SHIFT 0x38 +#define ADBK_CAPSLOCK 0x39 +#define ADBK_OPTION 0x3A +#define ADBK_F 0x03 +#define ADBK_O 0x1F +#define ADBK_P 0x23 +#define ADBK_Q 0x0C +#define ADBK_V 0x09 +#define ADBK_1 0x12 +#define ADBK_2 0x13 +#define ADBK_3 0x14 +#define ADBK_4 0x15 +#define ADBK_5 0x17 +#define ADBK_6 0x16 +#define ADBK_7 0x1A +#define ADBK_8 0x1C +#define ADBK_9 0x19 +#define ADBK_0 0x1D + +#define ADBK_KEYVAL(key) ((key) & 0x7f) +#define ADBK_PRESS(key) (((key) & 0x80) == 0) +#define ADBK_KEYDOWN(key) (key) +#define ADBK_KEYUP(key) ((key) | 0x80) +#define ADBK_MODIFIER(key) ((((key) & 0x7f) == ADBK_SHIFT) || \ + (((key) & 0x7f) == ADBK_CONTROL) || \ + (((key) & 0x7f) == ADBK_FLOWER) || \ + (((key) & 0x7f) == ADBK_OPTION)) + +#ifndef KEYBOARD_ARRAY +extern unsigned char keyboard[128][3]; +#else +unsigned char keyboard[128][3] = { + /* Scan code Normal Shifted Controlled */ + { /* 0x00, */ 'a', 'A', 0x01 }, + { /* 0x01, */ 's', 'S', 0x13 }, + { /* 0x02, */ 'd', 'D', 0x04 }, + { /* 0x03, */ 'f', 'F', 0x06 }, + { /* 0x04, */ 'h', 'H', 0x08 }, + { /* 0x05, */ 'g', 'G', 0x07 }, + { /* 0x06, */ 'z', 'Z', 0x1A }, + { /* 0x07, */ 'x', 'X', 0x18 }, + { /* 0x08, */ 'c', 'C', 0x03 }, + { /* 0x09, */ 'v', 'V', 0x16 }, + { /* 0x0A, */ 0x00, 0x00, 0x00 }, + { /* 0x0B, */ 'b', 'B', 0x02 }, + { /* 0x0C, */ 'q', 'Q', 0x11 }, + { /* 0x0D, */ 'w', 'W', 0x17 }, + { /* 0x0E, */ 'e', 'E', 0x05 }, + { /* 0x0F, */ 'r', 'R', 0x12 }, + { /* 0x10, */ 'y', 'Y', 0x19 }, + { /* 0x11, */ 't', 'T', 0x14 }, + { /* 0x12, */ '1', '!', 0x00 }, + { /* 0x13, */ '2', '@', 0x00 }, + { /* 0x14, */ '3', '#', 0x00 }, + { /* 0x15, */ '4', '$', 0x00 }, + { /* 0x16, */ '6', '^', 0x00 }, + { /* 0x17, */ '5', '%', 0x00 }, + { /* 0x18, */ '=', '+', 0x00 }, + { /* 0x19, */ '9', '(', 0x00 }, + { /* 0x1A, */ '7', '&', 0x00 }, + { /* 0x1B, */ '-', '_', 0x00 }, + { /* 0x1C, */ '8', '*', 0x00 }, + { /* 0x1D, */ '0', ')', 0x00 }, + { /* 0x1E, */ ']', '}', 0x1D }, + { /* 0x1F, */ 'o', 'O', 0x0F }, + { /* 0x20, */ 'u', 'U', 0x15 }, + { /* 0x21, */ '[', '{', 0x1B }, + { /* 0x22, */ 'i', 'I', 0x09 }, + { /* 0x23, */ 'p', 'P', 0x10 }, + { /* 0x24, */ 0x0D, 0x0D, 0x0D }, + { /* 0x25, */ 'l', 'L', 0x0C }, + { /* 0x26, */ 'j', 'J', 0x0A }, + { /* 0x27, */ '\'', '"', 0x00 }, + { /* 0x28, */ 'k', 'K', 0x0B }, + { /* 0x29, */ ';', ':', 0x00 }, + { /* 0x2A, */ '\\', '|', 0x00 }, + { /* 0x2B, */ ',', '<', 0x00 }, + { /* 0x2C, */ '/', '?', 0x1C }, + { /* 0x2D, */ 'n', 'N', 0x0E }, + { /* 0x2E, */ 'm', 'M', 0x0D }, + { /* 0x2F, */ '.', '>', 0x00 }, + { /* 0x30, */ 0x09, 0x09, 0x09 }, + { /* 0x31, */ ' ', ' ', 0x00 }, + { /* 0x32, */ '`', '~', 0x00 }, + { /* 0x33, */ 0x7F, 0x7F, 0x7F }, /* Delete */ + { /* 0x34, */ 0x00, 0x00, 0x00 }, + { /* 0x35, */ 0x1B, 0x1B, 0x1B }, + { /* 0x36, */ 0x00, 0x00, 0x00 }, + { /* 0x37, */ 0x00, 0x00, 0x00 }, + { /* 0x38, */ 0x00, 0x00, 0x00 }, + { /* 0x39, */ 0x00, 0x00, 0x00 }, + { /* 0x3A, */ 0x00, 0x00, 0x00 }, + { /* 0x3B, */ 'h', 0x00, 0x00 }, /* Left */ + { /* 0x3C, */ 'l', 0x00, 0x00 }, /* Right */ + { /* 0x3D, */ 'j', 0x00, 0x00 }, /* Down */ + { /* 0x3E, */ 'k', 0x00, 0x00 }, /* Up */ + { /* 0x3F, */ 0x00, 0x00, 0x00 }, + { /* 0x40, */ 0x00, 0x00, 0x00 }, + { /* 0x41, */ '.', '.', 0x00 }, + { /* 0x42, */ 0x00, 0x00, 0x00 }, + { /* 0x43, */ '*', '*', 0x00 }, + { /* 0x44, */ 0x00, 0x00, 0x00 }, + { /* 0x45, */ '+', '+', 0x00 }, + { /* 0x46, */ 0x00, 0x00, 0x00 }, + { /* 0x47, */ 0x00, 0x00, 0x00 }, + { /* 0x48, */ 0x00, 0x00, 0x00 }, + { /* 0x49, */ 0x00, 0x00, 0x00 }, + { /* 0x4A, */ 0x00, 0x00, 0x00 }, + { /* 0x4B, */ '/', '/', 0x00 }, + { /* 0x4C, */ 0x0D, 0x0D, 0x0D }, + { /* 0x4D, */ 0x00, 0x00, 0x00 }, + { /* 0x4E, */ '-', '-', 0x00 }, + { /* 0x4F, */ 0x00, 0x00, 0x00 }, + { /* 0x50, */ 0x00, 0x00, 0x00 }, + { /* 0x51, */ '=', '=', 0x00 }, + { /* 0x52, */ '0', '0', 0x00 }, + { /* 0x53, */ '1', '1', 0x00 }, + { /* 0x54, */ '2', '2', 0x00 }, + { /* 0x55, */ '3', '3', 0x00 }, + { /* 0x56, */ '4', '4', 0x00 }, + { /* 0x57, */ '5', '5', 0x00 }, + { /* 0x58, */ '6', '6', 0x00 }, + { /* 0x59, */ '7', '7', 0x00 }, + { /* 0x5A, */ 0x00, 0x00, 0x00 }, + { /* 0x5B, */ '8', '8', 0x00 }, + { /* 0x5C, */ '9', '9', 0x00 }, + { /* 0x5D, */ 0x00, 0x00, 0x00 }, + { /* 0x5E, */ 0x00, 0x00, 0x00 }, + { /* 0x5F, */ 0x00, 0x00, 0x00 }, + { /* 0x60, */ 0x00, 0x00, 0x00 }, + { /* 0x61, */ 0x00, 0x00, 0x00 }, + { /* 0x62, */ 0x00, 0x00, 0x00 }, + { /* 0x63, */ 0x00, 0x00, 0x00 }, + { /* 0x64, */ 0x00, 0x00, 0x00 }, + { /* 0x65, */ 0x00, 0x00, 0x00 }, + { /* 0x66, */ 0x00, 0x00, 0x00 }, + { /* 0x67, */ 0x00, 0x00, 0x00 }, + { /* 0x68, */ 0x00, 0x00, 0x00 }, + { /* 0x69, */ 0x00, 0x00, 0x00 }, + { /* 0x6A, */ 0x00, 0x00, 0x00 }, + { /* 0x6B, */ 0x00, 0x00, 0x00 }, + { /* 0x6C, */ 0x00, 0x00, 0x00 }, + { /* 0x6D, */ 0x00, 0x00, 0x00 }, + { /* 0x6E, */ 0x00, 0x00, 0x00 }, + { /* 0x6F, */ 0x00, 0x00, 0x00 }, + { /* 0x70, */ 0x00, 0x00, 0x00 }, + { /* 0x71, */ 0x00, 0x00, 0x00 }, + { /* 0x72, */ 0x00, 0x00, 0x00 }, + { /* 0x73, */ 0x00, 0x00, 0x00 }, + { /* 0x74, */ 0x00, 0x00, 0x00 }, + { /* 0x75, */ 0x00, 0x00, 0x00 }, + { /* 0x76, */ 0x00, 0x00, 0x00 }, + { /* 0x77, */ 0x00, 0x00, 0x00 }, + { /* 0x78, */ 0x00, 0x00, 0x00 }, + { /* 0x79, */ 0x00, 0x00, 0x00 }, + { /* 0x7A, */ 0x00, 0x00, 0x00 }, + { /* 0x7B, */ 0x00, 0x00, 0x00 }, + { /* 0x7C, */ 0x00, 0x00, 0x00 }, + { /* 0x7D, */ 0x00, 0x00, 0x00 }, + { /* 0x7E, */ 0x00, 0x00, 0x00 }, + { /* 0x7F, */ 0x00, 0x00, 0x00 } +}; +#endif /* KEYBOARD_ARRAY */ diff --git a/sys/arch/mac68k/include/limits.h b/sys/arch/mac68k/include/limits.h new file mode 100644 index 00000000000..caba76bfe5d --- /dev/null +++ b/sys/arch/mac68k/include/limits.h @@ -0,0 +1,3 @@ +/* $NetBSD: limits.h,v 1.6 1994/10/26 08:46:34 cgd Exp $ */ + +#include <m68k/limits.h> diff --git a/sys/arch/mac68k/include/param.h b/sys/arch/mac68k/include/param.h new file mode 100644 index 00000000000..a1bef18a754 --- /dev/null +++ b/sys/arch/mac68k/include/param.h @@ -0,0 +1,229 @@ +/* $NetBSD: param.h,v 1.21 1995/08/13 01:52:16 briggs Exp $ */ + +/* + * 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. + */ +/*- + * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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.11 89/08/14$ + * + * @(#)param.h 7.8 (Berkeley) 6/28/91 + */ + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ 1 + +#ifndef PSL_IPL +#include "machine/psl.h" +#endif /* PSL_IPL */ + +/* + * Machine dependent constants for Macintosh II-and-similar series. + */ +#define MACHINE "mac68k" +#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 (sizeof(int) - 1) +#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) + +#define PGSHIFT 12 /* LOG2(NBPG) */ +#define NBPG (1 << PGSHIFT) /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte offset into page */ +#define NPTEPG (NBPG/(sizeof (pt_entry_t))) + +#define SEGSHIFT 22 /* LOG2(NBSEG) */ +#define NBSEG (1 << SEGSHIFT) /* bytes/segment */ +#define SEGOFSET (NBSEG-1) /* byte offset into segment */ + +#define KERNBASE 0x00000000 /* start of kernel virtual */ +#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) + +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define DEV_BSIZE (1 << DEV_BSHIFT) +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ + +#define CLSIZELOG2 0 +#define CLSIZE (1 << CLSIZELOG2) + +/* 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 3 /* pages of u-area */ +#define USPACE (UPAGES * NBPG) /* total size of u-area */ + +/* + * 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 MCLSHIFT 11 /* convert bytes to m_buf clusters */ +#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */ +#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */ + +#ifndef NMBCLUSTERS +#ifdef GATEWAY +#define NMBCLUSTERS 512 /* map size, max cluster allocation */ +#else +#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 mac68k_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET) +#define mac68k_trunc_page(x) ((unsigned)(x) & ~PGOFSET) +#define mac68k_btop(x) ((unsigned)(x) >> PGSHIFT) +#define mac68k_ptob(x) ((unsigned)(x) << PGSHIFT) + +/* + * spl functions; all but spl0 are done in-line + */ + +#define _spl(s) \ +({ \ + register int _spl_r; \ +\ + __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \ + "&=d" (_spl_r) : "di" (s)); \ + _spl_r; \ +}) + +/* spl0 requires checking for software interrupts */ +#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) + +/* These should be used for: + 1) ensuring mutual exclusion (why use processor level?) + 2) allowing faster devices to take priority + + Note that on the mac, most things are masked at spl1, almost + everything at spl2, and everything but the panic switch and + power at spl4. + */ +#define splsoftclock() spl1() /* disallow softclock */ +#define splsoftnet() spl1() /* disallow network */ +#define splclock() spl1() /* disallow clock interrupt */ +#define splbio() spl2() /* disallow block I/O */ +#define splnet() spl2() /* disallow network */ +#define spltty() spl4() /* disallow tty interrupts (serial) */ +#define splimp() spl4() /* disallow imput */ +#define splhigh() spl7() /* disallow everything */ +#define splsched() spl7() /* disallow scheduling */ + +#define splstatclock() spl2() /* This should be splclock... */ + +/* watch out for side effects */ +#define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0()) + +#define DELAY(ms) delay(ms) + +#endif /* _MACHINE_PARAM_H_ */ diff --git a/sys/arch/mac68k/include/pcb.h b/sys/arch/mac68k/include/pcb.h new file mode 100644 index 00000000000..4c8614cff05 --- /dev/null +++ b/sys/arch/mac68k/include/pcb.h @@ -0,0 +1,105 @@ +/* $NetBSD: pcb.h,v 1.6 1995/06/21 03:10:44 briggs Exp $ */ + +/* + * 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. + */ +/*- + * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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.13 89/04/23$ + * + * @(#)pcb.h 7.4 (Berkeley) 5/4/91 + */ + +#include <machine/frame.h> + +/* + * MacII process control block + */ +struct pcb +{ + short pcb_flags; /* misc. process flags (+0) */ + short pcb_ps; /* processor status word (+2) */ + int pcb_ustp; /* user segment table pointer (+4) */ + int pcb_usp; /* user stack pointer (+8) */ + int pcb_regs[12]; /* D2-D7, A2-A7 (+C) */ + caddr_t pcb_onfault; /* for copyin/out faults */ + struct fpframe pcb_fpregs; /* 68881/2 context save area */ + int pcb_exec[16]; /* exec structure for core dumps */ +}; + +/* flags */ + +/* + * The pcb is augmented with machine-dependent additional data for + * core dumps. For the m68k, this includes a header that, for the + * hp300, is used for HP-UX processes' exec header. + */ +struct md_coredump { + int md_exec[16]; /* Exec structure for HP-UX (sic) core dumps */ +}; diff --git a/sys/arch/mac68k/include/pio.h b/sys/arch/mac68k/include/pio.h new file mode 100644 index 00000000000..e9776df3782 --- /dev/null +++ b/sys/arch/mac68k/include/pio.h @@ -0,0 +1,35 @@ +/* $NetBSD: pio.h,v 1.3 1994/10/26 08:46:38 cgd Exp $ */ + +/* + * Mach Operating System + * Copyright (c) 1990 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ + +#define inl(y) \ +({ unsigned long _tmp__; \ + asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ + _tmp__; }) + +#define inw(y) \ +({ unsigned short _tmp__; \ + asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ + _tmp__; }) + +#define inb(y) \ +({ unsigned char _tmp__; \ + asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ + _tmp__; }) + + +#define outl(x, y) \ +{ asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); } + + +#define outw(x, y) \ +{asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); } + + +#define outb(x, y) \ +{ asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); } diff --git a/sys/arch/mac68k/include/pmap.h b/sys/arch/mac68k/include/pmap.h new file mode 100644 index 00000000000..df869cc2703 --- /dev/null +++ b/sys/arch/mac68k/include/pmap.h @@ -0,0 +1,190 @@ +/* $NetBSD: pmap.h,v 1.11 1995/06/24 16:18:50 briggs Exp $ */ + +/* + * Copyright (c) 1987 Carnegie-Mellon University + * Copyright (c) 1991 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. + */ +/*- + * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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. + * + */ + +/* + * @(#)pmap.h 7.6 (Berkeley) 5/10/91 + */ +#ifndef _PMAP_MACHINE_ +#define _PMAP_MACHINE_ + +#include <machine/pte.h> + +#if defined(M68040) +#define MAC_SEG_SIZE (mmutype == MMU_68040 ? 0x40000 : NBSEG) +#else +#define MAC_SEG_SIZE NBSEG +#endif + +#define mac68k_trunc_seg(x) (((unsigned)(x)) & ~(MAC_SEG_SIZE-1)) +#define mac68k_round_seg(x) mac68k_trunc_seg((unsigned)(x)+MAC_SEG_SIZE-1) + +/* + * Pmap stuff + */ +struct pmap { + pt_entry_t *pm_ptab; /* KVA of page table */ + st_entry_t *pm_stab; /* KVA of segment table */ + int pm_stchanged; /* ST changed */ + int pm_stfree; /* 040: free lev2 blocks */ + st_entry_t *pm_stpa; /* 040: ST phys addr */ + short pm_sref; /* segment table ref count */ + short pm_count; /* pmap reference count */ + simple_lock_data_t pm_lock; /* lock on pmap */ + struct pmap_statistics pm_stats; /* pmap statistics */ + long pm_ptpages; /* more stats: PT pages */ +}; + +typedef struct pmap *pmap_t; + +/* + * On the 040, we keep track of which level 2 blocks are already in use + * with the pm_stfree mask. Bits are arranged from LSB (block 0) to MSB + * (block 31). For convenience, the level 1 table is considered to be + * block 0. + * + * MAX[KU]L2SIZE control how many pages of level 2 descriptors are allowed + * for the kernel and users. 8 implies only the initial "segment table" + * page is used. WARNING: don't change MAXUL2SIZE unless you can allocate + * physically contiguous pages for the ST in pmap.c! + */ +#define MAXKL2SIZE 32 +#define MAXUL2SIZE 8 +#define l2tobm(n) (1 << (n)) +#define bmtol2(n) (ffs(n) - 1) + +/* + * Macros for speed + */ +#define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \ + if ((pmapp)->pm_stchanged) { \ + (pcbp)->pcb_ustp = mac68k_btop((vm_offset_t)(pmapp)->pm_stpa); \ + if (iscurproc) \ + loadustp((pcbp)->pcb_ustp); \ + (pmapp)->pm_stchanged = FALSE; \ + } +#define PMAP_DEACTIVATE(pmapp, pcbp) + +/* + * For each vm_page_t, there is a list of all currently valid virtual + * mappings of that page. An entry is a pv_entry_t, the list is pv_table. + */ +typedef struct pv_entry { + struct pv_entry *pv_next; /* next pv_entry */ + struct pmap *pv_pmap; /* pmap where mapping lies */ + vm_offset_t pv_va; /* virtual address for mapping */ + st_entry_t *pv_ptste; /* non-zero if VA maps a PT page */ + struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */ + int pv_flags; /* flags */ +} *pv_entry_t; + +#define PV_CI 0x01 /* all entries must be cache inhibited */ +#define PV_PTPAGE 0x02 /* entry maps a page table page */ + +struct pv_page; + +struct pv_page_info { + TAILQ_ENTRY(pv_page) pgi_list; + struct pv_entry *pgi_freelist; + int pgi_nfree; +}; + +/* + * This is basically: + * ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry)) + */ +#define NPVPPG 170 + +struct pv_page { + struct pv_page_info pvp_pgi; + struct pv_entry pvp_pv[NPVPPG]; +}; + +#ifdef _KERNEL +struct pmap kernel_pmap_store; + +#define pmap_kernel() (&kernel_pmap_store) +#define active_pmap(pm) \ + ((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap) + +extern struct pv_entry *pv_table; /* array of entries, one per page */ + +#define pa_to_pvh(pa) (&pv_table[pmap_page_index(pa)]) + +#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) + +extern pt_entry_t *Sysmap; +extern char *vmmap; /* map for mem, dumps, etc. */ +#endif /* _KERNEL */ + +#endif _PMAP_MACHINE_ diff --git a/sys/arch/mac68k/include/proc.h b/sys/arch/mac68k/include/proc.h new file mode 100644 index 00000000000..c343f3a496c --- /dev/null +++ b/sys/arch/mac68k/include/proc.h @@ -0,0 +1,50 @@ +/* $NetBSD: proc.h,v 1.5 1994/10/26 08:46:40 cgd Exp $ */ + +/* + * 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. + * + * @(#)proc.h 7.1 (Berkeley) 5/15/91 + */ + +/* + * Machine-dependent part of the proc structure for hp300. + */ +struct mdproc { + int md_flags; /* machine-dependent flags */ + int *md_regs; /* registers on current frame */ +}; + +/* md_flags */ +#define MDP_AST 0x0001 /* async trap pending */ +#define MDP_STACKADJ 0x0002 /* Frame SP adjusted, might have to + undo when system call returns + ERESTART. */ diff --git a/sys/arch/mac68k/include/profile.h b/sys/arch/mac68k/include/profile.h new file mode 100644 index 00000000000..2f7fc94a260 --- /dev/null +++ b/sys/arch/mac68k/include/profile.h @@ -0,0 +1,8 @@ +/* $NetBSD: profile.h,v 1.2 1994/10/26 08:46:41 cgd Exp $ */ + +#ifndef _MACHINE_PROFILE_H_ +#define _MACHINE_PROFILE_H_ + +#include <m68k/profile.h> + +#endif diff --git a/sys/arch/mac68k/include/psl.h b/sys/arch/mac68k/include/psl.h new file mode 100644 index 00000000000..327f09514ed --- /dev/null +++ b/sys/arch/mac68k/include/psl.h @@ -0,0 +1,3 @@ +/* $NetBSD: psl.h,v 1.4 1994/10/26 08:46:42 cgd Exp $ */ + +#include <m68k/psl.h> diff --git a/sys/arch/mac68k/include/pte.h b/sys/arch/mac68k/include/pte.h new file mode 100644 index 00000000000..a496e389521 --- /dev/null +++ b/sys/arch/mac68k/include/pte.h @@ -0,0 +1,155 @@ +/* $NetBSD: pte.h,v 1.8 1995/06/21 03:14:11 briggs Exp $ */ + +/* + * 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. + */ +/*- + * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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: pte.h 1.11 89/09/03$ + * + * @(#)pte.h 7.3 (Berkeley) 5/8/91 + */ + +#ifndef _MACHINE_PTE_H_ +#define _MACHINE_PTE_H_ 1 + +/* + * Mac hardware segment/page table entries + */ + +typedef int st_entry_t; /* segment table entry */ +typedef int pt_entry_t; /* Mach page table entry */ + +#define PT_ENTRY_NULL ((pt_entry_t *) 0) +#define ST_ENTRY_NULL ((st_entry_t *) 0) + +#define SG_V 0x00000002 /* segment is valid */ +#define SG_NV 0x00000000 +#define SG_PROT 0x00000004 /* access protection mask */ +#define SG_RO 0x00000004 +#define SG_RW 0x00000000 +#define SG_U 0x00000008 /* modified bit (68040) */ +#define SG_FRAME 0xfffff000 +#define SG_IMASK 0xffc00000 +#define SG_ISHIFT 22 +#define SG_PMASK 0x003ff000 +#define SG_PSHIFT 12 + +/* 68040 additions */ +#define SG4_MASK1 0xfe000000 +#define SG4_SHIFT1 25 +#define SG4_MASK2 0x01fc0000 +#define SG4_SHIFT2 18 +#define SG4_MASK3 0x0003f000 +#define SG4_SHIFT3 12 +#define SG4_ADDR1 0xfffffe00 +#define SG4_ADDR2 0xffffff00 +#define SG4_LEV1SIZE 128 +#define SG4_LEV2SIZE 128 +#define SG4_LEV3SIZE 64 + +#define PG_V 0x00000001 +#define PG_NV 0x00000000 +#define PG_PROT 0x00000004 +#define PG_U 0x00000008 +#define PG_M 0x00000010 +#define PG_W 0x00000100 +#define PG_RO 0x00000004 +#define PG_RW 0x00000000 +#define PG_FRAME 0xfffff000 +#define PG_CI 0x00000040 +#define PG_SHIFT 12 +#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT) + +/* 68040 additions */ +#define PG_CMASK 0x00000060 /* cache mode mask */ +#define PG_CWT 0x00000000 /* writethrough caching */ +#define PG_CCB 0x00000020 /* copyback caching */ +#define PG_CIS 0x00000040 /* cache inhibited serialized */ +#define PG_CIN 0x00000060 /* cache inhibited nonserialized */ +#define PG_SO 0x00000080 /* supervisor only */ + +#define MAC_STSIZE (MAXUL2SIZE*SG4_LEV2SIZE*sizeof(st_entry_t)) + /* user process segment table size */ +#define MAC_MAX_PTSIZE 0x400000 /* max size of UPT */ +#define MAC_MAX_KPTSIZE 0x100000 /* max memory to allocate to KPT */ +#define MAC_PTBASE 0x10000000 /* UPT map base address */ +#define MAC_PTMAXSIZE 0x70000000 /* UPT map maximum size */ + +/* + * Kernel virtual address to page table entry and to physical address. + */ +#define kvtopte(va) \ + (&Sysmap[((unsigned)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT]) +#define ptetokv(pt) \ + ((((pt_entry_t *)(pt) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS) +#define kvtophys(va) \ + ((kvtopte(va)->pg_pfnum << PGSHIFT) | ((int)(va) & PGOFSET)) + +#endif /* _MACHINE_PTE_H_ */ diff --git a/sys/arch/mac68k/include/ptrace.h b/sys/arch/mac68k/include/ptrace.h new file mode 100644 index 00000000000..3dd51254a73 --- /dev/null +++ b/sys/arch/mac68k/include/ptrace.h @@ -0,0 +1,3 @@ +/* $NetBSD: ptrace.h,v 1.2 1994/10/26 08:46:43 cgd Exp $ */ + +#include <m68k/ptrace.h> diff --git a/sys/arch/mac68k/include/reg.h b/sys/arch/mac68k/include/reg.h new file mode 100644 index 00000000000..dd2eb83b9c8 --- /dev/null +++ b/sys/arch/mac68k/include/reg.h @@ -0,0 +1,8 @@ +/* $NetBSD: reg.h,v 1.9 1994/10/26 08:46:44 cgd Exp $ */ + +#ifndef _MACHINE_REG_H_ +#define _MACHINE_REG_H_ + +#include <m68k/reg.h> + +#endif /* _MACHINE_REG_H_ */ diff --git a/sys/arch/mac68k/include/scsi96reg.h b/sys/arch/mac68k/include/scsi96reg.h new file mode 100644 index 00000000000..b9efc1ec8af --- /dev/null +++ b/sys/arch/mac68k/include/scsi96reg.h @@ -0,0 +1,173 @@ +/* $NetBSD: scsi96reg.h,v 1.4 1994/10/26 08:46:45 cgd Exp $ */ + +/* + * Copyright (C) 1994 Allen K. Briggs + * 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 _MACHINE_SCSI96REG_H_ +#define _MACHINE_SCSI96REG_H_ + +typedef volatile unsigned char v_uchar; + +#define PAD(x) u_char x [15]; +struct ncr53c96regs { + v_uchar tcreg_lsb; /* r == ctc, w == stc */ + PAD(pad0); + v_uchar tcreg_msb; /* r == ctc, w == stc */ + PAD(pad1); + v_uchar fifo; /* fifo reg */ + PAD(pad2); + v_uchar cmdreg; /* command reg */ + PAD(pad3); + v_uchar statreg; /* status reg */ +#define sdidreg statreg + PAD(pad4); + v_uchar instreg; /* interrupt status reg */ +#define stimreg instreg + PAD(pad5); + v_uchar isreg; /* internal state reg */ + PAD(pad6); + v_uchar fifostatereg; /* fifo state reg */ + PAD(pad7); + v_uchar ctrlreg1; /* control register 1 */ + PAD(pad8); + v_uchar clkfactorreg; /* clock factor register */ + PAD(pad9); + v_uchar ftmreg; /* forced test mode register */ + PAD(pad10); + v_uchar ctrlreg2; /* control register 2 */ + PAD(pad11); + v_uchar ctrlreg3; /* control register 3 */ + PAD(pad12); + v_uchar unused1; /* unknown */ + PAD(pad13); + v_uchar unused2; /* unknown */ + PAD(pad14); + v_uchar dareg; /* data alignment register */ + PAD(pad15); +}; +#undef PAD + +#define NCR96_CTCREG 0x0 /* Current transfer count. R */ + /* 16 bits, LSB first. */ +#define NCR96_STCREG 0x0 /* Short transfer count. W */ + /* 16 bits, LSB first. */ +#define NCR96_FFREG 0x2 /* FIFO register. R/W */ + +#define NCR96_CMDREG 0x3 /* Command register. R/W */ +#define NCR96_DMA 0x80 /* This flag means to use DMA mode. */ +/* Initiator Commands */ +#define NCR96_CMD_INFOXFER 0x10 /* Information Transfer. */ +#define NCR96_CMD_ICCS 0x11 /* Initiator Cmd Complete steps. */ +#define NCR96_CMD_MSGACC 0x12 /* Message Accepted. */ +#define NCR96_CMD_TPB 0x18 /* Transfer pad bytes. */ +#define NCR96_CMD_SETATN 0x1A /* Set ATN */ +#define NCR96_CMD_RESETATN 0x1B /* Reset ATN */ +/* Target Commands -- skipped. */ +/* Idle State Commands. */ +#define NCR96_CMD_RESEL 0x40 /* Reselect steps */ +#define NCR96_CMD_SEL 0x41 /* Select without ATN steps */ +#define NCR96_CMD_SELATN 0x42 /* Select with ATN steps */ +#define NCR96_CMD_SELATNS 0x43 /* Select with ATN and stop steps */ +#define NCR96_CMD_ENSEL 0x44 /* Enable selection/reselection */ +#define NCR96_CMD_DISSEL 0x45 /* Disable selection/reselection */ +#define NCR96_CMD_SELATN3 0x46 /* Select with ATN3 */ +/* General Commands. */ +#define NCR96_CMD_NOOP 0x00 /* No Operation */ +#define NCR96_CMD_CLRFIFO 0x01 /* Clear FIFO */ +#define NCR96_CMD_RESETDEV 0x02 /* Reset Device */ +#define NCR96_CMD_RESETBUS 0x03 /* Reset SCSI Bus */ + +#define NCR96_STATREG 0x4 /* Status register. R */ +#define NCR96_STAT_INT 0x80 /* Interrupt */ +#define NCR96_STAT_IOE 0x40 /* Illegal Operation Error */ +#define NCR96_STAT_PE 0x20 /* Parity Error */ +#define NCR96_STAT_CTZ 0x10 /* Count To Zero */ +#define NCR96_STAT_GCV 0x08 /* Group Code Valid */ +#define NCR96_STAT_PHASE 0x07 /* Mask for SCSI Phase */ +#define NCR96_STAT_MSG 0x04 /* Message */ +#define NCR96_STAT_CD 0x02 /* Command/Data */ +#define NCR96_STAT_IO 0x01 /* Input/Output */ + +#define NCR96_SDIDREG 0x4 /* SCSI Dest. ID register. W */ +#define NCR96_SDID_MASK 0x07 /* Mask for Dest. ID */ + +#define NCR96_INSTREG 0x5 /* Interrupt status register. R */ +#define NCR96_ISR_SRST 0x80 /* SCSI Reset */ +#define NCR96_ISR_INVAL 0x40 /* Invalid Command */ +#define NCR96_ISR_DISCONN 0x20 /* Disconnected */ +#define NCR96_ISR_SREQ 0x10 /* Service Request */ +#define NCR96_ISR_SO 0x08 /* Successful Operation */ +#define NCR96_ISR_RESEL 0x04 /* Relected */ +#define NCR96_ISR_SELATN 0x02 /* Selected with ATN */ +#define NCR96_ISR_SEL 0x01 /* Selected */ + +#define NCR96_STIMREG 0x5 /* SCSI Timeout register. W */ + +#define NCR96_ISREG 0x6 /* Internal state register. R */ +#define NCR96_IS_MASK 0x0f /* Mask for non-reserved fields. */ + +#define NCR96_STPREG 0x6 /* Synch. Trans. per. register. W */ +#define NCR96_STP_MASK 0x1f /* Mask for non-reserved fields. */ + +#define NCR96_CFISREG 0x7 /* Current FIFO/i.s. register. R */ +#define NCR96_CF_MASK 0x1f /* Mask for current FIFO count. */ + +#define NCR96_SOFREG 0x7 /* Synch. Offset register. W */ +#define NCR96_SOF_MASK 0x0f /* Mask for non-reserved fields. */ + +#define NCR96_CNTLREG1 0x8 /* Control register one. R/W */ +#define NCR96_C1_ETM 0x80 /* Extended Timing mode */ +#define NCR96_C1_DISR 0x40 /* Disable interrupt on SCSI Reset */ +#define NCR96_C1_PTE 0x20 /* Parity Test Enable */ +#define NCR96_C1_PERE 0x10 /* Parity Error Reporting Enable */ +#define NCR96_C1_STE 0x08 /* Self Test Enable */ +#define NCR96_C1_SCSIID_MSK 0x07 /* Chip SCSI ID Mask */ + +#define NCR96_CLKFREG 0x9 /* Clock Factor register. W */ +#define NCR96_CLKF_MASK 0x07 /* Mask for non-reserved fields */ + +#define NCR96_FTMREG 0xA /* Forced Test Mode register. W */ +#define NCR96_FTM_MASK 0x07 /* Mask for non-reserved fields */ + +#define NCR96_CNTLREG2 0xB /* Control register two. R/W */ +#define NCR96_C2_DAE 0x80 /* Data alignment enable */ +#define NCR96_C2_LSP 0x40 /* Latch SCSI Phase */ +#define NCR96_C2_SBO 0x20 /* Select Byte Order */ +#define NCR96_C2_TSDR 0x10 /* Tri-state DMA request */ +#define NCR96_C2_S2FE 0x08 /* SCSI-2 Features Enable */ +#define NCR96_C2_ACDPE 0x04 /* Abort on Cmd/Data parity error */ +#define NCR96_C2_PGRP 0x02 /* Pass through/gen register parity */ +#define NCR96_C2_PGDP 0x01 /* Pass through/gen data parity */ + +#define NCR96_CNTLREG3 0xC /* Control register three. R/W */ +#define NCR96_C3_LBTM 0x04 /* Last byte transfer mode */ +#define NCR96_C3_MDM 0x02 /* Modity DMA mode */ +#define NCR96_C3_BS8 0x01 /* Burst Size 8 */ + +#define NCR96_DALREG 0xF /* Data alignment register. W */ + +#endif /* _MACHINE_SCSI96REG_H_ */ diff --git a/sys/arch/mac68k/include/scsi_5380.h b/sys/arch/mac68k/include/scsi_5380.h new file mode 100644 index 00000000000..02017d6bb42 --- /dev/null +++ b/sys/arch/mac68k/include/scsi_5380.h @@ -0,0 +1,142 @@ +/* $NetBSD: scsi_5380.h,v 1.3 1994/10/26 08:46:46 cgd Exp $ */ + +/* + * Mach Operating System + * Copyright (c) 1991,1990,1989 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ +/* + * File: scsi_5380.h + * Author: Alessandro Forin, Carnegie Mellon University + * Date: 5/91 + * + * Defines for the NCR 5380 (SCSI chip), aka Am5380 + */ + +/* + * Register map + */ + +typedef struct { + volatile unsigned char sci_data; /* r: Current data */ +#define sci_odata sci_data /* w: Out data */ + PAD(pad0); + + volatile unsigned char sci_icmd; /* rw: Initiator command */ + PAD(pad1); + + volatile unsigned char sci_mode; /* rw: Mode */ + PAD(pad2); + + volatile unsigned char sci_tcmd; /* rw: Target command */ + PAD(pad3); + + volatile unsigned char sci_bus_csr; /* r: Bus Status */ +#define sci_sel_enb sci_bus_csr /* w: Select enable */ + PAD(pad4); + + volatile unsigned char sci_csr; /* r: Status */ +#define sci_dma_send sci_csr /* w: Start dma send data */ + PAD(pad5); + + volatile unsigned char sci_idata; /* r: Input data */ +#define sci_trecv sci_idata /* w: Start dma receive, target */ + PAD(pad6); + + volatile unsigned char sci_iack; /* r: Interrupt Acknowledge */ +#define sci_irecv sci_iack /* w: Start dma receive, initiator */ +} sci_regmap_t; + + +/* + * Initiator command register + */ + +#define SCI_ICMD_DATA 0x01 /* rw: Assert data bus */ +#define SCI_ICMD_ATN 0x02 /* rw: Assert ATN signal */ +#define SCI_ICMD_SEL 0x04 /* rw: Assert SEL signal */ +#define SCI_ICMD_BSY 0x08 /* rw: Assert BSY signal */ +#define SCI_ICMD_ACK 0x10 /* rw: Assert ACK signal */ +#define SCI_ICMD_LST 0x20 /* r: Lost arbitration */ +#define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */ +#define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */ +#define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */ +#define SCI_ICMD_RST 0x80 /* rw: Assert RST signal */ + + +/* + * Mode register + */ + +#define SCI_MODE_ARB 0x01 /* rw: Start arbitration */ +#define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */ +#define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */ +#define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */ +#define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */ +#define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */ +#define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */ +#define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake (MBZ) */ + + +/* + * Target command register + */ + +#define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */ +#define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */ +#define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */ +#define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */ +#define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */ +#define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred + * (not on 5380/1) */ + +#define SCI_PHASE(x) SCSI_PHASE(x) + +/* + * Current (SCSI) Bus status + */ + +#define SCI_BUS_DBP 0x01 /* r: Data Bus parity */ +#define SCI_BUS_SEL 0x02 /* r: SEL signal */ +#define SCI_BUS_IO 0x04 /* r: I/O signal */ +#define SCI_BUS_CD 0x08 /* r: C/D signal */ +#define SCI_BUS_MSG 0x10 /* r: MSG signal */ +#define SCI_BUS_REQ 0x20 /* r: REQ signal */ +#define SCI_BUS_BSY 0x40 /* r: BSY signal */ +#define SCI_BUS_RST 0x80 /* r: RST signal */ + +#define SCI_CUR_PHASE(x) SCSI_PHASE((x)>>2) + +/* + * Bus and Status register + */ + +#define SCI_CSR_ACK 0x01 /* r: ACK signal */ +#define SCI_CSR_ATN 0x02 /* r: ATN signal */ +#define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */ +#define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */ +#define SCI_CSR_INT 0x10 /* r: Interrupt request */ +#define SCI_CSR_PERR 0x20 /* r: Parity error */ +#define SCI_CSR_DREQ 0x40 /* r: DMA request */ +#define SCI_CSR_DONE 0x80 /* r: DMA count is zero */ + diff --git a/sys/arch/mac68k/include/setjmp.h b/sys/arch/mac68k/include/setjmp.h new file mode 100644 index 00000000000..7479b60bc39 --- /dev/null +++ b/sys/arch/mac68k/include/setjmp.h @@ -0,0 +1,3 @@ +/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:36:57 cgd Exp $ */ + +#include <m68k/setjmp.h> diff --git a/sys/arch/mac68k/include/signal.h b/sys/arch/mac68k/include/signal.h new file mode 100644 index 00000000000..5982f33996d --- /dev/null +++ b/sys/arch/mac68k/include/signal.h @@ -0,0 +1,3 @@ +/* $NetBSD: signal.h,v 1.3 1994/10/26 08:46:47 cgd Exp $ */ + +#include <m68k/signal.h> diff --git a/sys/arch/mac68k/include/stdarg.h b/sys/arch/mac68k/include/stdarg.h new file mode 100644 index 00000000000..3b0053df762 --- /dev/null +++ b/sys/arch/mac68k/include/stdarg.h @@ -0,0 +1,4 @@ +/* $NetBSD: stdarg.h,v 1.5 1994/10/26 08:46:48 cgd Exp $ */ + +/* Just use the common m68k definition */ +#include <m68k/stdarg.h> diff --git a/sys/arch/mac68k/include/trap.h b/sys/arch/mac68k/include/trap.h new file mode 100644 index 00000000000..17a0743dd1f --- /dev/null +++ b/sys/arch/mac68k/include/trap.h @@ -0,0 +1,3 @@ +/* $NetBSD: trap.h,v 1.5 1994/10/26 08:46:49 cgd Exp $ */ + +#include <m68k/trap.h> diff --git a/sys/arch/mac68k/include/types.h b/sys/arch/mac68k/include/types.h new file mode 100644 index 00000000000..8f42fcea4cc --- /dev/null +++ b/sys/arch/mac68k/include/types.h @@ -0,0 +1,8 @@ +/* $NetBSD: types.h,v 1.7 1995/07/01 18:47:51 briggs Exp $ */ + +#ifndef _MACHINE_TYPES_H_ +#define _MACHINE_TYPES_H_ + +#include <m68k/types.h> + +#endif diff --git a/sys/arch/mac68k/include/varargs.h b/sys/arch/mac68k/include/varargs.h new file mode 100644 index 00000000000..9add41e38b5 --- /dev/null +++ b/sys/arch/mac68k/include/varargs.h @@ -0,0 +1,4 @@ +/* $NetBSD: varargs.h,v 1.2 1994/10/26 08:46:51 cgd Exp $ */ + +/* Just use the common m68k definition */ +#include <m68k/varargs.h> diff --git a/sys/arch/mac68k/include/vmparam.h b/sys/arch/mac68k/include/vmparam.h new file mode 100644 index 00000000000..9ffe8621814 --- /dev/null +++ b/sys/arch/mac68k/include/vmparam.h @@ -0,0 +1,273 @@ +/* $NetBSD: vmparam.h,v 1.7 1995/06/21 03:17:06 briggs Exp $ */ + +/* + * 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. + */ +/*- + * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo, + * Michael L. Finch, Bradley A. Grantham, and + * Lawrence A. Kesteloot + * 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 Alice Group. + * 4. The names of the Alice Group or any of its members may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP 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$ + * + * @(#)vmparam.h 7.3 (Berkeley) 5/7/91 + */ + +/* + * Machine dependent constants for mac68k -- mostly derived from hp300. + */ + +/* + * USRTEXT is the start of the user text/data space, while USRSTACK + * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are + * the number of pages from the beginning of the P0 region to the + * beginning of the text and from the beginning of the P1 region to the + * beginning of the stack respectively. + * + * NOTE: HP300 uses HIGHPAGES == (0x100000/NBPG) for HP/UX compatibility. + * Do we care? Obviously not at the moment. + */ +#define USRTEXT 8192 +#define USRSTACK (-HIGHPAGES*NBPG) /* Start of user stack */ +#define BTOPUSRSTACK (0x100000-HIGHPAGES) /* btop(USRSTACK) */ +#define P1PAGES 0x100000 +#define LOWPAGES 0 +#define HIGHPAGES 3 /* UPAGES */ + +/* + * Virtual memory related constants, all in bytes + */ +#ifndef MAXTSIZ +#define MAXTSIZ (8*1024*1024) /* max text size */ +#endif +#ifndef DFLDSIZ +#define DFLDSIZ (16*1024*1024) /* initial data size limit */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (64*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 */ + +/* + * Sizes of the system and user portions of the system page table. + */ +/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ +#define SYSPTSIZE (2 * NPTEPG) /* 8mb */ +#define USRPTSIZE (1 * NPTEPG) /* 4mb */ + +/* + * PTEs for mapping user space into the kernel for phyio operations. + * One page is enough to handle 4Mb of simultaneous raw IO operations. + */ +#ifndef USRIOSIZE +#define USRIOSIZE (1 * NPTEPG) /* 4mb */ +#endif + +/* + * PTEs for system V style shared memory. + * This is basically slop for kmempt which we actually allocate (malloc) from. + */ +#ifndef SHMMAXPGS +#define SHMMAXPGS 1024 /* 4mb */ +#endif + +/* + * Boundary at which to place first MAPMEM segment if not explicitly + * specified. Should be a power of two. This allows some slop for + * the data segment to grow underneath the first mapped segment. + */ +#define MMSEG 0x200000 + +/* + * The size of the clock loop. + */ +#define LOOPPAGES (maxfree - firstfree) + +/* + * 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 */ + +/* + * DISKRPM is used to estimate the number of paging i/o operations + * which one can expect from a single disk controller. + */ +#define DISKRPM 3600 + +/* + * Klustering constants. Klustering is the gathering + * of pages together for pagein/pageout, while clustering + * is the treatment of hardware page size as though it were + * larger than it really is. + * + * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) + * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. + * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) + * unless you like "big push" panics. + */ + +#define KLMAX (4/CLSIZE) +#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ +#define KLIN (4/CLSIZE) /* default data/stack in klust */ +#define KLTXT (4/CLSIZE) /* default text in klust */ +#define KLOUT (4/CLSIZE) + +/* + * KLSDIST is the advance or retard of the fifo reclaim for sequential + * processes data space. + */ +#define KLSDIST 3 /* klusters advance/retard for seq. fifo */ + +/* + * Paging thresholds (see vm_sched.c). + * Strategy of 1/19/85: + * lotsfree is 512k bytes, but at most 1/4 of memory + * desfree is 200k bytes, but at most 1/8 of memory + * Are these still valid in 1995? + */ +#define LOTSFREE (512 * 1024) +#define LOTSFREEFRACT 4 +#define DESFREE (200 * 1024) +#define DESFREEFRACT 8 + +/* + * There are two clock hands, initially separated by HANDSPREAD bytes + * (but at most all of user memory). The amount of time to reclaim + * a page once the pageout process examines it increases with this + * distance and decreases as the scan rate rises. + */ +#define HANDSPREAD (2 * 1024 * 1024) + +/* + * The number of times per second to recompute the desired paging rate + * and poke the pagedaemon. + */ +#define RATETOSCHEDPAGING 4 + +/* + * Believed threshold (in megabytes) for which interleaved + * swapping area is desirable. + */ +#define LOTSOFMEM 2 + +/* + * Mach derived constants + */ + +/* user/kernel map constants */ +#define VM_MIN_ADDRESS ((vm_offset_t)0) +#define VM_MAXUSER_ADDRESS ((vm_offset_t)(USRSTACK)) +#define VM_MAX_ADDRESS ((vm_offset_t)(0-(UPAGES*NBPG))) +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)(0-NBPG)) + +/* 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) + +/* # of kernel PT pages (initial only, can grow dynamically) */ +#define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */ + +/* pcb base */ +#define pcbb(p) ((u_int)(p)->p_addr) |