diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-07 08:51:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-07 08:51:15 +0000 |
commit | 506a9f45b3b4659876b3bd29f6bff4027e18cc16 (patch) | |
tree | 5112bfaf7bce58daff20db3789e6d38592cacffe | |
parent | f94d56a7c698d9fd5de7b39ee39c61289a0e0f77 (diff) |
$Id$ throughout
update many copyrights
129 files changed, 2449 insertions, 1471 deletions
diff --git a/sys/arch/mvme68k/Makefile b/sys/arch/mvme68k/Makefile index 0591b09fa2d..3998a4b4116 100644 --- a/sys/arch/mvme68k/Makefile +++ b/sys/arch/mvme68k/Makefile @@ -1,5 +1,32 @@ -# $NetBSD: Makefile,v 1.1.1.1 1995/07/25 23:11:53 chuck Exp $ +# $Id: Makefile,v 1.2 1995/11/07 08:48:35 deraadt Exp $ -SUBDIR= stand +# from: @(#)Makefile 8.1 (Berkeley) 6/11/93 +# +# Makefile for mvme68k links, tags file -.include <bsd.subdir.mk> +NOPROG= noprog +NOMAN= noman +NOOBJ= noobj + +DIRS= conf dev include mvme68k + +links:: + -for i in ${DIRS}; do \ + (cd $$i && { rm -f tags; ln -s ${SYSTAGS} tags; }) done + +MVME68K=/sys/arch/mvme68k/dev/*.[ch] /sys/arch/mvme68k/include/*.[ch] \ + /sys/arch/mvme68k/rcons/*.[ch] /sys/arch/mvme68k/mvme68k/*.[ch] \ +AMVME68K=/sys/arch/mvme68k/mvme68k/*.s + +tags: + -ctags -wdt ${COMM} ${MVME68K} + egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AMVME68K} | \ + sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ + >> tags + sort -o tags tags + +SUBDIR+=stand + +obj: _SUBDIRUSE + +.include <bsd.prog.mk> diff --git a/sys/arch/mvme68k/dev/bug.c b/sys/arch/mvme68k/dev/bug.c index 808cf6d4413..c074f013fde 100644 --- a/sys/arch/mvme68k/dev/bug.c +++ b/sys/arch/mvme68k/dev/bug.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: bug.c,v 1.2 1995/11/07 08:48:49 deraadt Exp $ */ /* * Copyright (c) 1995 Dale Rahn. @@ -14,7 +14,7 @@ * 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 Dale Rahn. + * This product includes software developed by Dale Rahn. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/bugtty.c b/sys/arch/mvme68k/dev/bugtty.c index 367db8f804b..5b3bb9d96b7 100644 --- a/sys/arch/mvme68k/dev/bugtty.c +++ b/sys/arch/mvme68k/dev/bugtty.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: bugtty.c,v 1.2 1995/11/07 08:48:51 deraadt Exp $ */ /* * Copyright (c) 1995 Dale Rahn. @@ -14,7 +14,7 @@ * 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 Dale Rahn. + * This product includes software developed by Dale Rahn. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c index 738d7d25daa..ae43b4f5851 100644 --- a/sys/arch/mvme68k/dev/cl.c +++ b/sys/arch/mvme68k/dev/cl.c @@ -1,4 +1,5 @@ -/* $NetBSD$ */ +/* $Id: cl.c,v 1.3 1995/11/07 08:48:52 deraadt Exp $ */ + /* * Copyright (c) 1995 Dale Rahn. All rights reserved. * @@ -13,7 +14,7 @@ * 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 Dale Rahn. + * This product includes software developed by Dale Rahn. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/clock.c b/sys/arch/mvme68k/dev/clock.c index e4871cc2db3..69cea3a74a2 100644 --- a/sys/arch/mvme68k/dev/clock.c +++ b/sys/arch/mvme68k/dev/clock.c @@ -1,7 +1,35 @@ -/* $NetBSD$ */ +/* $Id: clock.c,v 1.2 1995/11/07 08:48:53 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/arch/mvme68k/dev/clreg.h b/sys/arch/mvme68k/dev/clreg.h index 4656c7c0007..b54c83fe920 100644 --- a/sys/arch/mvme68k/dev/clreg.h +++ b/sys/arch/mvme68k/dev/clreg.h @@ -1,3 +1,5 @@ +/* $Id: clreg.h,v 1.2 1995/11/07 08:48:54 deraadt Exp $ */ + /* * Copyright (c) 1995 Dale Rahn. All rights reserved. * @@ -11,7 +13,7 @@ * 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 Dale Rahn. + * This product includes software developed by Dale Rahn. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/dmavar.h b/sys/arch/mvme68k/dev/dmavar.h index 99da32b62c1..a47d161eab7 100644 --- a/sys/arch/mvme68k/dev/dmavar.h +++ b/sys/arch/mvme68k/dev/dmavar.h @@ -1,3 +1,5 @@ +/* $Id: dmavar.h,v 1.2 1995/11/07 08:48:54 deraadt Exp $ */ + /* * Copyright (c) 1982, 1990 The Regents of the University of California. * All rights reserved. @@ -31,7 +33,7 @@ * SUCH DAMAGE. * * @(#)dmavar.h 7.2 (Berkeley) 11/4/90 - * $Id: dmavar.h,v 1.1 1995/10/18 10:43:06 deraadt Exp $ + * $Id: dmavar.h,v 1.2 1995/11/07 08:48:54 deraadt Exp $ */ /* dmago flags */ diff --git a/sys/arch/mvme68k/dev/flash.c b/sys/arch/mvme68k/dev/flash.c index 933b2a199a6..13eca110f72 100644 --- a/sys/arch/mvme68k/dev/flash.c +++ b/sys/arch/mvme68k/dev/flash.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: flash.c,v 1.2 1995/11/07 08:48:55 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/flashreg.h b/sys/arch/mvme68k/dev/flashreg.h index d9d82c5e492..327719c6b7a 100644 --- a/sys/arch/mvme68k/dev/flashreg.h +++ b/sys/arch/mvme68k/dev/flashreg.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: flashreg.h,v 1.2 1995/11/07 08:48:56 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/fooip.c b/sys/arch/mvme68k/dev/fooip.c index f0217ba369a..810cdbfde00 100644 --- a/sys/arch/mvme68k/dev/fooip.c +++ b/sys/arch/mvme68k/dev/fooip.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: fooip.c,v 1.2 1995/11/07 08:48:57 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/i82586.h b/sys/arch/mvme68k/dev/i82586.h index cb40672da90..79c72133fed 100644 --- a/sys/arch/mvme68k/dev/i82586.h +++ b/sys/arch/mvme68k/dev/i82586.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82586.h,v 1.3 1995/01/27 09:49:55 pk Exp $ */ +/* $Id: i82586.h,v 1.2 1995/11/07 08:48:58 deraadt Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt @@ -18,6 +18,9 @@ * must display the following acknowledgement: * This product includes software developed by the University of * Vermont and State Agricultural College and Garrett A. Wollman. + * and + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. Neither the name of the University nor the name of the author * may be used to endorse or promote products derived from this software * without specific prior written permission. diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index e24a121d0e9..f39b56090ff 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.c,v 1.15 1995/04/11 09:18:09 pk Exp $ */ +/* $Id: if_ie.c,v 1.2 1995/11/07 08:49:00 deraadt Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt @@ -28,6 +28,9 @@ * University of Vermont and State Agricultural College and Garrett A. * Wollman, by William F. Jolitz, and by the University of California, * Berkeley, Lawrence Berkeley Laboratory, and its contributors. + * and + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. Neither the names of the Universities nor the names of the authors * may be used to endorse or promote products derived from this software * without specific prior written permission. diff --git a/sys/arch/mvme68k/dev/if_ie.h b/sys/arch/mvme68k/dev/if_ie.h index a17de666905..5ee10e33646 100644 --- a/sys/arch/mvme68k/dev/if_ie.h +++ b/sys/arch/mvme68k/dev/if_ie.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: if_ie.h,v 1.2 1995/11/07 08:49:01 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c index cd7fe440304..159be94d94e 100644 --- a/sys/arch/mvme68k/dev/if_le.c +++ b/sys/arch/mvme68k/dev/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.1.1.1 1995/07/25 23:12:09 chuck Exp $ */ +/* $Id: if_le.c,v 1.2 1995/11/07 08:49:02 deraadt Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 @@ -81,9 +81,9 @@ #endif #include <machine/cpu.h> +#include <machine/autoconf.h> #include <machine/pmap.h> -#include <mvme68k/dev/iio.h> #include <mvme68k/dev/if_lereg.h> #include <mvme68k/dev/pccreg.h> @@ -118,6 +118,7 @@ struct le_softc { struct device sc_dev; /* base device */ struct evcnt sc_intrcnt; /* # of interrupts, per le */ struct evcnt sc_errcnt; /* # of errors, per le */ + struct intrhand sc_ih; struct arpcom sc_ac; /* common Ethernet structures */ #define sc_if sc_ac.ac_if /* network-visible interface */ @@ -166,7 +167,7 @@ void leerror(struct le_softc *, int); void lererror(struct le_softc *, char *); void lexerror(struct le_softc *); -void *ledatabuf; /* XXXCDC hack from pmap bootstrap */ +extern void *etherbuf; int lematch(parent, vcf, args) @@ -174,9 +175,9 @@ lematch(parent, vcf, args) void *vcf, *args; { struct cfdata *cf = vcf; - struct iioargs *ia = args; + struct confargs *ca = args; - return !badbaddr((caddr_t) IIO_CFLOC_ADDR(cf)); + return (!badvaddr(ca->ca_vaddr, 2)); } /* @@ -193,24 +194,25 @@ leattach(parent, self, args) register struct le_softc *sc = (struct le_softc *)self; register struct lereg2 *ler2; struct ifnet *ifp = &sc->sc_if; + struct confargs *ca = args; register int a; - int pri = IIO_CFLOC_LEVEL(self->dv_cfdata); + int pri = ca->ca_ipl; /* XXX the following declarations should be elsewhere */ extern void myetheraddr(u_char *); - iio_print(self->dv_cfdata); - /* connect the interrupt */ - pccintr_establish(PCCV_LE, leintr, pri, sc); - - sc->sc_r1 = (struct lereg1 *) IIO_CFLOC_ADDR(self->dv_cfdata); + sc->sc_ih.ih_fn = leintr; + sc->sc_ih.ih_arg = sc; + sc->sc_ih.ih_ipl = pri; + pccintr_establish(PCCV_LE, &sc->sc_ih); + sc->sc_r1 = (struct lereg1 *)ca->ca_vaddr; - ler2 = sc->sc_r2 = (struct lereg2 *) ledatabuf; + ler2 = sc->sc_r2 = (struct lereg2 *) etherbuf; myetheraddr(sc->sc_addr); - printf(" ler2 0x%x address %s\n", ler2, ether_sprintf(sc->sc_addr)); + printf(": address %s\n", ether_sprintf(sc->sc_addr)); /* * Setup for transmit/receive @@ -253,8 +255,8 @@ leattach(parent, self, args) #endif if_attach(ifp); ether_ifattach(ifp); - sys_pcc->le_int = pri | PCC_IENABLE; + ((struct pccreg *)ca->ca_master)->pcc_leirq = pri | PCC_IRQ_IEN; } /* diff --git a/sys/arch/mvme68k/dev/if_lereg.h b/sys/arch/mvme68k/dev/if_lereg.h index 6e802470966..621738369cd 100644 --- a/sys/arch/mvme68k/dev/if_lereg.h +++ b/sys/arch/mvme68k/dev/if_lereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_lereg.h,v 1.1.1.1 1995/07/25 23:12:10 chuck Exp $ */ +/* $Id: if_lereg.h,v 1.2 1995/11/07 08:49:03 deraadt Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 diff --git a/sys/arch/mvme68k/dev/ipic.c b/sys/arch/mvme68k/dev/ipic.c index 400f57b25ba..92b718872ea 100644 --- a/sys/arch/mvme68k/dev/ipic.c +++ b/sys/arch/mvme68k/dev/ipic.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: ipic.c,v 1.2 1995/11/07 08:49:04 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/ipicreg.h b/sys/arch/mvme68k/dev/ipicreg.h index b329a7342f9..b6272429333 100644 --- a/sys/arch/mvme68k/dev/ipicreg.h +++ b/sys/arch/mvme68k/dev/ipicreg.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: ipicreg.h,v 1.2 1995/11/07 08:49:06 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/lp.c b/sys/arch/mvme68k/dev/lp.c index 77f02834c2a..29a3f15ef59 100644 --- a/sys/arch/mvme68k/dev/lp.c +++ b/sys/arch/mvme68k/dev/lp.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: lp.c,v 1.2 1995/11/07 08:49:08 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/mc.c b/sys/arch/mvme68k/dev/mc.c index 1c7dc2889d1..d4d2c358c07 100644 --- a/sys/arch/mvme68k/dev/mc.c +++ b/sys/arch/mvme68k/dev/mc.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: mc.c,v 1.2 1995/11/07 08:49:09 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/mcreg.h b/sys/arch/mvme68k/dev/mcreg.h index ead6d812d0f..dc5b95f6681 100644 --- a/sys/arch/mvme68k/dev/mcreg.h +++ b/sys/arch/mvme68k/dev/mcreg.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: mcreg.h,v 1.2 1995/11/07 08:49:10 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/memc.c b/sys/arch/mvme68k/dev/memc.c index 9a16dd2a393..044da4a2963 100644 --- a/sys/arch/mvme68k/dev/memc.c +++ b/sys/arch/mvme68k/dev/memc.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: memc.c,v 1.2 1995/11/07 08:49:12 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/memcreg.h b/sys/arch/mvme68k/dev/memcreg.h index 6bb7b901dec..ed9ab3a6bcb 100644 --- a/sys/arch/mvme68k/dev/memcreg.h +++ b/sys/arch/mvme68k/dev/memcreg.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: memcreg.h,v 1.2 1995/11/07 08:49:14 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/memdevs.c b/sys/arch/mvme68k/dev/memdevs.c index a966b8778cc..3bb3a26bfc1 100644 --- a/sys/arch/mvme68k/dev/memdevs.c +++ b/sys/arch/mvme68k/dev/memdevs.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: memdevs.c,v 1.2 1995/11/07 08:49:16 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/nvram.c b/sys/arch/mvme68k/dev/nvram.c index 93f484542a6..e383ae32d8e 100644 --- a/sys/arch/mvme68k/dev/nvram.c +++ b/sys/arch/mvme68k/dev/nvram.c @@ -1,19 +1,8 @@ -/* $NetBSD$ */ +/* $Id: nvram.c,v 1.2 1995/11/07 08:49:17 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -24,17 +13,16 @@ * 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 product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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 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 + * 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 diff --git a/sys/arch/mvme68k/dev/nvramreg.h b/sys/arch/mvme68k/dev/nvramreg.h index ec804e1e049..281d44102dc 100644 --- a/sys/arch/mvme68k/dev/nvramreg.h +++ b/sys/arch/mvme68k/dev/nvramreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: clockreg.h,v 1.5 1994/11/20 20:54:07 deraadt Exp $ */ +/* $Id: nvramreg.h,v 1.2 1995/11/07 08:49:19 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 diff --git a/sys/arch/mvme68k/dev/pcc.c b/sys/arch/mvme68k/dev/pcc.c index 8ea641b7501..b01f60a301e 100644 --- a/sys/arch/mvme68k/dev/pcc.c +++ b/sys/arch/mvme68k/dev/pcc.c @@ -1,8 +1,7 @@ -/* $Id: pcc.c,v 1.1 1995/10/18 08:51:10 deraadt Exp $ */ +/* $Id: pcc.c,v 1.2 1995/11/07 08:49:20 deraadt Exp $ */ /* - * - * Copyright (c) 1995 Charles D. Cranor + * Copyright (c) 1995 Theo de Raadt * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -15,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor. + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * @@ -32,9 +32,8 @@ */ /* - * peripheral channel controller + * VME147 peripheral channel controller */ - #include <sys/param.h> #include <sys/conf.h> #include <sys/ioctl.h> @@ -49,40 +48,29 @@ #include <sys/fcntl.h> #include <sys/device.h> #include <machine/cpu.h> +#include <machine/autoconf.h> #include <dev/cons.h> -#include <mvme68k/mvme68k/isr.h> -#include <mvme68k/dev/iio.h> -#include <mvme68k/dev/pccreg.h> -/* - * Autoconfiguration stuff. - */ +#include <mvme68k/dev/pccreg.h> struct pccsoftc { struct device sc_dev; - struct pcc *sc_pcc; + caddr_t sc_vaddr; + caddr_t sc_paddr; + struct pccreg *sc_pcc; + struct intrhand sc_nmiih; }; - void pccattach __P((struct device *, struct device *, void *)); int pccmatch __P((struct device *, void *, void *)); +int pccabort __P((struct frame *)); struct cfdriver pcccd = { NULL, "pcc", pccmatch, pccattach, DV_DULL, sizeof(struct pccsoftc), 0 }; -/* - * globals - */ - -struct pcc *sys_pcc = NULL; - -struct { - int (*pcc_fn)(); - void *arg; - int lvl; -} pcc_vecs[PCC_NVEC]; +struct pccreg *sys_pcc = NULL; int pccmatch(parent, vcf, args) @@ -90,8 +78,60 @@ pccmatch(parent, vcf, args) void *vcf, *args; { struct cfdata *cf = vcf; + struct confargs *ca = args; - return !badbaddr((caddr_t) IIO_CFLOC_ADDR(cf)); + /* the pcc only exist on vme147's */ + if (cputyp != CPU_147) + return (0); + return (!badvaddr(IIOV(ca->ca_paddr) + PCCSPACE_PCCCHIP_OFF, 1)); +} + +int +pcc_print(args, bus) + void *args; + char *bus; +{ + struct confargs *ca = args; + + if (ca->ca_offset != -1) + printf(" offset 0x%x", ca->ca_offset); + if (ca->ca_ipl > 0) + printf(" ipl %d", ca->ca_ipl); + return (UNCONF); +} + +int +pcc_scan(parent, child, args) + struct device *parent; + void *child, *args; +{ + struct cfdata *cf = child; + struct pccsoftc *sc = (struct pccsoftc *)parent; + struct confargs *ca = args; + struct confargs oca; + + if (parent->dv_cfdata->cf_driver->cd_indirect) { + printf(" indirect devices not supported\n"); + return 0; + } + + bzero(&oca, sizeof oca); + oca.ca_offset = cf->cf_loc[0]; + oca.ca_ipl = cf->cf_loc[1]; + if (oca.ca_offset != -1) { + oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset; + oca.ca_paddr = sc->sc_paddr + oca.ca_offset; + } else { + oca.ca_vaddr = (caddr_t)-1; + oca.ca_paddr = (caddr_t)-1; + } + oca.ca_bustype = BUS_PCC; + oca.ca_master = (void *)sc->sc_pcc; + oca.ca_name = cf->cf_driver->cd_name; + if ((*cf->cf_driver->cd_match)(parent, cf, &oca) == 0) + return (0); + config_attach(parent, cf, &oca, pcc_print); + return (1); } void @@ -99,73 +139,111 @@ pccattach(parent, self, args) struct device *parent, *self; void *args; { - struct pccsoftc *pccsc; + struct confargs *ca = args; + struct pccsoftc *sc = (struct pccsoftc *)self; + int i; if (sys_pcc) panic("pcc already attached!"); - iio_print(self->dv_cfdata); - /* - * link into softc and set up interrupt vector base + * since we know ourself to land in intiobase land, + * we must adjust our address */ - pccsc = (struct pccsoftc *) self; - sys_pcc = pccsc->sc_pcc = (struct pcc *)IIO_CFLOC_ADDR(self->dv_cfdata); - pccsc->sc_pcc->int_vectr = PCC_VECBASE; - bzero(pcc_vecs, sizeof(pcc_vecs)); + sc->sc_paddr = ca->ca_paddr; + sc->sc_vaddr = (caddr_t)IIOV(sc->sc_paddr); + sc->sc_pcc = (struct pccreg *)(sc->sc_vaddr + PCCSPACE_PCCCHIP_OFF); + sys_pcc = sc->sc_pcc; - printf(" rev %d intbvr 0x%x\n", pccsc->sc_pcc->pcc_rev, - pccsc->sc_pcc->int_vectr); -} + printf(": rev %d\n", sc->sc_pcc->pcc_chiprev); + sc->sc_nmiih.ih_fn = pccabort; + sc->sc_nmiih.ih_arg = 0; + sc->sc_nmiih.ih_ipl = 7; + sc->sc_nmiih.ih_wantframe = 1; + pccintr_establish(PCCV_ABORT, &sc->sc_nmiih); -/* - * pccintr: called from locore with the PC and evec from the trap frame. - */ -int -pccintr(pc, evec, frame) - int pc; - int evec; - void *frame; -{ - int vec = (evec & 0xfff) >> 2; /* XXX should be m68k macro? */ - extern u_long intrcnt[]; /* XXX from locore */ - - vec = vec & 0xf; /* XXX mask out */ - if (vec >= PCC_NVEC || pcc_vecs[vec].pcc_fn == NULL) - return(straytrap(pc, evec)); - - cnt.v_intr++; - intrcnt[pcc_vecs[vec].lvl]++; - - /* arg override? only timer1 gets access to frame */ - if (vec != PCCV_TIMER1) - frame = pcc_vecs[vec].arg; - return((*pcc_vecs[vec].pcc_fn)(frame)); -} + sc->sc_pcc->pcc_vecbase = PCC_VECBASE; + sc->sc_pcc->pcc_abortirq = PCC_ABORT_IEN | PCC_ABORT_ACK; + sc->sc_pcc->pcc_genctl |= PCC_GENCTL_IEN; + /* XXX further init of PCC chip? */ + + config_search(pcc_scan, self, args); +} /* - * pccintr_establish: establish pcc interrupt + * PCC interrupts land in a PCC_NVEC sized hole starting at PCC_VECBASE */ int -pccintr_establish(vec, hand, lvl, arg) - u_long vec; - int (*hand)(), lvl; - void *arg; +pccintr_establish(vec, ih) + int vec; + struct intrhand *ih; { if (vec >= PCC_NVEC) { printf("pcc: illegal vector: 0x%x\n", vec); panic("pccintr_establish"); } + return (intr_establish(PCC_VECBASE+vec, ih)); +} - if (pcc_vecs[vec].pcc_fn) { - printf("pcc: vector 0x%x in use: (0x%x,0x%x) (0x%x,0x%x)\n", - hand, arg, pcc_vecs[vec].pcc_fn, pcc_vecs[vec].arg); - panic("pccintr_establish"); +int +pccabort(frame) + struct frame *frame; +{ +#if 0 + /* XXX wait for it to debounce -- there is something wrong here */ + while (sys_pcc->pcc_abortirq & PCC_ABORT_ABS) + ; + delay(2); +#endif + sys_pcc->pcc_abortirq = PCC_ABORT_IEN | PCC_ABORT_ACK; + nmihand(frame); + return (1); +} + +int +pccspeed(pcc) + struct pccreg *pcc; +{ + volatile u_short lim = pcc_timer_us2lim(400); + volatile u_short tmp; + volatile int cnt; + int speed; + + /*printf("counting...lim = %d\n", lim);*/ + + pcc->pcc_t1irq = 0; /* just in case */ + pcc->pcc_t1pload = 0; + pcc->pcc_t1ctl = PCC_TIMERCLEAR; + pcc->pcc_t1ctl = PCC_TIMERSTART; + + cnt = 0; + while (1) { + tmp = pcc->pcc_t1count; + if (tmp > lim) + break; + tmp = lim; + cnt++; } - pcc_vecs[vec].pcc_fn = hand; - pcc_vecs[vec].lvl = lvl; - pcc_vecs[vec].arg = arg; + pcc->pcc_t1ctl = PCC_TIMERCLEAR; + printf("pccspeed cnt=%d\n", cnt); + + /* + * Imperically determined. Unfortunately, because of various + * memory board effects and such, it is rather unlikely that + * we will find a nice formula. + */ + if (cnt > 230000) + speed = 50; + else if (cnt > 210000) + speed = 33; + else if (cnt > 190000) + speed = 25; + else if (cnt > 170000) /* 171163, 170335 */ + speed = 20; + else + speed = 16; + return (speed); } diff --git a/sys/arch/mvme68k/dev/pccreg.h b/sys/arch/mvme68k/dev/pccreg.h index 114d42a7dab..58d29508152 100644 --- a/sys/arch/mvme68k/dev/pccreg.h +++ b/sys/arch/mvme68k/dev/pccreg.h @@ -1,8 +1,7 @@ -/* $Id: pccreg.h,v 1.1 1995/10/18 08:51:10 deraadt Exp $ */ +/* $Id: pccreg.h,v 1.2 1995/11/07 08:49:21 deraadt Exp $ */ /* - * - * Copyright (c) 1995 Charles D. Cranor + * Copyright (c) 1995 Theo de Raadt * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -15,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor. + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * @@ -32,99 +32,127 @@ */ /* - * peripheral channel controller (at pa fffe1000) + * MVME147 PCC chip */ - -struct pcc { - volatile u_long dma_taddr; /* dma table address */ - volatile u_long dma_daddr; /* dma data address */ - volatile u_long dma_bcnt; /* dma byte count */ - volatile u_long dma_hold; /* dma data hold register */ - volatile u_short t1_pload; /* timer1 preload */ - volatile u_short t1_count; /* timer1 count */ - volatile u_short t2_pload; /* timer2 preload */ - volatile u_short t2_count; /* timer2 count */ - volatile u_char t1_int; /* timer1 interrupt ctrl */ - volatile u_char t1_cr; /* timer1 ctrl reg */ - volatile u_char t2_int; /* timer2 interrupt ctrl */ - volatile u_char t2_cr; /* timer2 ctrl reg */ - volatile u_char acf_int; /* acfail intr reg */ - volatile u_char dog_int; /* watchdog intr reg */ - volatile u_char pr_int; /* printer intr reg */ - volatile u_char pr_cr; /* printer ctrl */ - volatile u_char dma_int; /* dma interrupt control */ - volatile u_char dma_csr; /* dma csr */ - volatile u_char bus_int; /* bus error interrupt */ - volatile u_char dma_sr; /* dma status register */ - volatile u_char abrt_int; /* abort interrupt control reg */ - volatile u_char ta_fcr; /* table address function code reg */ - volatile u_char zs_int; /* serial interrupt reg */ - volatile u_char gen_cr; /* general control register */ - volatile u_char le_int; /* ethernet interrupt */ - volatile u_char gen_sr; /* general status */ - volatile u_char scsi_int; /* scsi interrupt reg */ - volatile u_char slave_ba; /* slave base addr reg */ - volatile u_char sw1_int; /* software interrupt #1 cr */ - volatile u_char int_vectr; /* interrupt base vector register */ - volatile u_char sw2_int; /* software interrupt #2 cr */ - volatile u_char pcc_rev; /* revision level */ +struct pccreg { + volatile u_long pcc_dmataddr; /* dma table address */ + volatile u_long pcc_dmadaddr; /* dma data address */ + volatile u_long pcc_dmabcnt; /* dma byte count */ + volatile u_long pcc_dmahold; /* dma data hold register */ + volatile u_short pcc_t1pload; /* timer1 preload */ + volatile u_short pcc_t1count; /* timer1 count */ + volatile u_short pcc_t2pload; /* timer2 preload */ + volatile u_short pcc_t2count; /* timer2 count */ + volatile u_char pcc_t1irq; /* timer1 interrupt ctrl */ + volatile u_char pcc_t1ctl; /* timer1 ctrl reg */ + volatile u_char pcc_t2irq; /* timer2 interrupt ctrl */ + volatile u_char pcc_t2ctl; /* timer2 ctrl reg */ + volatile u_char pcc_acfirq; /* acfail intr reg */ + volatile u_char pcc_dogirq; /* watchdog intr reg */ + volatile u_char pcc_lpirq; /* printer intr reg */ + volatile u_char pcc_lpctl; /* printer ctrl */ + volatile u_char pcc_dmairq; /* dma interrupt control */ + volatile u_char pcc_dmacsr; /* dma csr */ + volatile u_char pcc_busirq; /* bus error interrupt */ + volatile u_char pcc_dmasr; /* dma status register */ + volatile u_char pcc_abortirq; /* abort interrupt control reg */ + volatile u_char pcc_tafcr; /* table address function code reg */ + volatile u_char pcc_zsirq; /* serial interrupt reg */ + volatile u_char pcc_genctl; /* general control register */ + volatile u_char pcc_leirq; /* ethernet interrupt */ + volatile u_char pcc_gensr; /* general status */ + volatile u_char pcc_sbicirq; /* sbic interrupt reg */ + volatile u_char pcc_slavebase; /* slave base addr reg */ + volatile u_char pcc_sw1inq; /* software interrupt #1 cr */ + volatile u_char pcc_vecbase; /* interrupt base vector register */ + volatile u_char pcc_sw2irq; /* software interrupt #2 cr */ + volatile u_char pcc_chiprev; /* revision level */ }; - +#define PCCSPACE_PCCCHIP_OFF 0x1000 /* - * points to system's PCC + * points to system's PCC. This is not active until the pcc0 device + * has been attached. */ - -extern struct pcc *sys_pcc; +extern struct pccreg *sys_pcc; /* - * we lock off our interrupt vector at 0x40. if this is changed - * we'll need to change vector.s + * We lock off our interrupt vector at 0x40. */ - -#define PCC_VECBASE 0x40 -#define PCC_NVEC 12 +#define PCC_VECBASE 0x40 +#define PCC_NVEC 12 /* - * vectors we use + * Vectors we use */ - #define PCCV_ACFAIL 0 #define PCCV_BERR 1 #define PCCV_ABORT 2 #define PCCV_ZS 3 #define PCCV_LE 4 -#define PCCV_SCSIP 5 -#define PCCV_SCSID 6 +#define PCCV_SBIC 5 +#define PCCV_DMA 6 #define PCCV_PRINTER 7 #define PCCV_TIMER1 8 #define PCCV_TIMER2 9 #define PCCV_SOFT1 10 #define PCCV_SOFT2 11 -/* - * enable interrupt - */ +#define PCC_DMABCNT_MAKEFC(fcn) ((fcn) << 24) +#define PCC_DMABCNT_FCMASK 0x07000000 +#define PCC_DMABCNT_L 0x80000000 +#define PCC_DMABCNT_CNTMASK 0x00ffffff -#define PCC_IENABLE 0x08 +#define PCC_DMACSR_DONE 0x80 +#define PCC_DMACSR_ERR8BIT 0x40 +#define PCC_DMACSR_TNOT32 0x20 +#define PCC_DMACSR_DMAERRDATA 0x10 +#define PCC_DMACSR_DMAERRTABLE 0x08 +#define PCC_DMACSR_TOSCSI 0x04 +#define PCC_DMACSR_USETABLE 0x02 +#define PCC_DMACSR_DEN 0x01 + +#define PCC_SBIC_RESETIRQ 0x40 +#define PCC_SBIC_RESETABS 0x20 /* - * interrupt mask + * Fairly standard irq register bits. */ +#define PCC_IRQ_IPL 0x07 +#define PCC_IRQ_IEN 0x08 +#define PCC_IRQ_INT 0x80 -#define PCC_IMASK 0x7 +#define PCC_LPIRQ_ACK 0x20 /* * clock/timer */ +#define PCC_TIMERACK 0x80 /* ack intr */ +#define PCC_TIMERCLEAR 0x00 /* reset and clear timer */ +#define PCC_TIMERSTART 0x03 /* start timer */ -#define PCC_TIMERACK 0x80 /* ack intr */ -#define PCC_TIMER100HZ 63936 /* load value for 100Hz */ -#define PCC_TIMERCLEAR 0x0 /* reset and clear timer */ -#define PCC_TIMERSTART 0x3 /* start timer */ +#define pcc_timer_hz2lim(hz) (65536 - (160000/(hz))) +#define pcc_timer_us2lim(us) (65536 - (160000/(1000000/(us)))) /* * serial control */ +#define PCC_ZS_PCCVEC 0x10 /* let PCC supply vector */ + +/* + * abort switch + */ +#define PCC_ABORT_IEN 0x08 /* enable interrupt */ +#define PCC_ABORT_ABS 0x40 /* current state of switch */ +#define PCC_ABORT_ACK 0x80 /* intr active; or write to ack */ + +/* + * for the console we need zs phys addr + */ +#define ZS0_PHYS_147 (INTIOBASE_147 + 0x3000) +#define ZS1_PHYS_147 (INTIOBASE_147 + 0x3800) + +/* XXX */ +int pccintr_establish __P((int vec, struct intrhand *ih)); -#define PCC_ZSEXTERN 0x10 /* let PCC supply vector */ +#define PCC_GENCTL_IEN 0x10 diff --git a/sys/arch/mvme68k/dev/pcctwo.c b/sys/arch/mvme68k/dev/pcctwo.c index 6b694606f3b..c85903a9332 100644 --- a/sys/arch/mvme68k/dev/pcctwo.c +++ b/sys/arch/mvme68k/dev/pcctwo.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: pcctwo.c,v 1.2 1995/11/07 08:49:22 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/pcctworeg.h b/sys/arch/mvme68k/dev/pcctworeg.h index 4c02c246797..99ae019edcd 100644 --- a/sys/arch/mvme68k/dev/pcctworeg.h +++ b/sys/arch/mvme68k/dev/pcctworeg.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: pcctworeg.h,v 1.2 1995/11/07 08:49:23 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/sbic.c b/sys/arch/mvme68k/dev/sbic.c index b871cdd95a2..79849f180f9 100644 --- a/sys/arch/mvme68k/dev/sbic.c +++ b/sys/arch/mvme68k/dev/sbic.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbic.c,v 1.14 1995/08/18 15:28:03 chopps Exp $ */ +/* $Id: sbic.c,v 1.2 1995/11/07 08:49:24 deraadt Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps diff --git a/sys/arch/mvme68k/dev/sbicdma.c b/sys/arch/mvme68k/dev/sbicdma.c index 193cc674efa..c8a9e36ff73 100644 --- a/sys/arch/mvme68k/dev/sbicdma.c +++ b/sys/arch/mvme68k/dev/sbicdma.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: sbicdma.c,v 1.2 1995/11/07 08:49:26 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,10 @@ * 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 Dale Rahn. + * This product includes software developed by Dale Rahn. + * and + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/sbicreg.h b/sys/arch/mvme68k/dev/sbicreg.h index f3844dcd246..1d645cfbaa4 100644 --- a/sys/arch/mvme68k/dev/sbicreg.h +++ b/sys/arch/mvme68k/dev/sbicreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: sbicreg.h,v 1.2 1994/10/26 02:04:40 cgd Exp $ */ +/* $Id: sbicreg.h,v 1.2 1995/11/07 08:49:27 deraadt Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. diff --git a/sys/arch/mvme68k/dev/sbicvar.h b/sys/arch/mvme68k/dev/sbicvar.h index 339d5f73c39..c198db322a3 100644 --- a/sys/arch/mvme68k/dev/sbicvar.h +++ b/sys/arch/mvme68k/dev/sbicvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sbicvar.h,v 1.8 1995/08/18 15:28:05 chopps Exp $ */ +/* $Id: sbicvar.h,v 1.2 1995/11/07 08:49:28 deraadt Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. diff --git a/sys/arch/mvme68k/dev/scc.h b/sys/arch/mvme68k/dev/scc.h index 4d94f6c3fde..2b626de4d8b 100644 --- a/sys/arch/mvme68k/dev/scc.h +++ b/sys/arch/mvme68k/dev/scc.h @@ -1,6 +1,7 @@ -/* $NetBSD: scc.h,v 1.1.1.1 1995/07/25 23:12:07 chuck Exp $ */ +/* $Id: scc.h,v 1.2 1995/11/07 08:49:29 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt * Copyright (c) 1993 Paul Mackerras. * All rights reserved. * @@ -12,8 +13,12 @@ * 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 withough specific prior written permission + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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 @@ -30,25 +35,50 @@ * SCC I/O register definitions */ -#define PCLK_FREQ 8333333 /* XXX */ +#define PCLK_FREQ_147 5000000 +#define PCLK_FREQ_162 10000000 -struct scc { - unsigned char cr; - unsigned char dr; +/* + * physical layout in memory of the SCC chips on the MVME147 + */ +struct scc_147 { + u_char cr; + u_char dr; +}; + +/* + * physical layout in memory of the SCC chips on the MVME162 + * (and possibly the MVME172 as well?) + */ +struct scc_162 { + u_char xx1; + u_char cr; + u_char xx2; + u_char dr; }; struct sccregs { - volatile struct scc *s_adr; - unsigned char s_val[16]; + volatile u_char *s_cr; + volatile u_char *s_dr; + u_char s_val[16]; }; -#define ZREAD0(scc) ((scc)->s_adr->cr) -#define ZREAD(scc, n) ((scc)->s_adr->cr = n, (scc)->s_adr->cr) -#define ZREADD(scc) ((scc)->s_adr->dr) +#define ZREAD0(scc) ((*((scc)->s_cr))) +#define ZREAD(scc, n) ((*((scc)->s_cr)) = n, (*((scc)->s_cr))) +#if 1 +#define ZREADD(scc) (ZWRITE0((scc), 8), ZREAD0((scc))) +#else +#define ZREADD(scc) ((*((scc)->s_dr))) +#endif -#define ZWRITE0(scc, v) ((scc)->s_adr->cr = v) -#define ZWRITE(scc, n, v) (ZWRITE0(scc, n), ZWRITE0(scc, (scc)->s_val[n] = v)) -#define ZWRITED(scc, v) ((scc)->s_adr->dr = v) +#define ZWRITE0(scc, v) ((*((scc)->s_cr)) = (u_char)(v)) +#define ZWRITE(scc, n, v) (ZWRITE0(scc, (u_char)n), \ + ZWRITE0(scc, (scc)->s_val[n] = (u_char)(v))) +#if 1 +#define ZWRITED(scc, v) (ZWRITE0((scc), 8), ZWRITE0((scc), (u_char)(v))) +#else +#define ZWRITED(scc, v) ((*((scc)->s_dr)) = (u_char)(v)) +#endif #define ZBIS(scc, n, v) (ZWRITE(scc, n, (scc)->s_val[n] | (v))) #define ZBIC(scc, n, v) (ZWRITE(scc, n, (scc)->s_val[n] & ~(v))) diff --git a/sys/arch/mvme68k/dev/siop.c b/sys/arch/mvme68k/dev/siop.c index be0b8b32d9f..ae301b515e6 100644 --- a/sys/arch/mvme68k/dev/siop.c +++ b/sys/arch/mvme68k/dev/siop.c @@ -1,4 +1,4 @@ -/* $NetBSD: siop.c,v 1.23 1995/08/18 15:28:08 chopps Exp $ */ +/* $Id: siop.c,v 1.2 1995/11/07 08:49:31 deraadt Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch diff --git a/sys/arch/mvme68k/dev/siop_script.ss b/sys/arch/mvme68k/dev/siop_script.ss index f43c74bfe10..fa9c5f1301b 100644 --- a/sys/arch/mvme68k/dev/siop_script.ss +++ b/sys/arch/mvme68k/dev/siop_script.ss @@ -1,4 +1,4 @@ -; $NetBSD: siop_script.ss,v 1.3 1995/08/18 15:28:11 chopps Exp $ +; $Id: siop_script.ss,v 1.2 1995/11/07 08:49:32 deraadt Exp $ ; ; Copyright (c) 1995 Michael L. Hitch diff --git a/sys/arch/mvme68k/dev/siopdma.c b/sys/arch/mvme68k/dev/siopdma.c index 439c4a9d3ea..be86ae23008 100644 --- a/sys/arch/mvme68k/dev/siopdma.c +++ b/sys/arch/mvme68k/dev/siopdma.c @@ -1,4 +1,4 @@ -/* $NetBSD: afsc.c,v 1.6 1995/02/12 19:19:00 chopps Exp $ */ +/* $Id: siopdma.c,v 1.2 1995/11/07 08:49:32 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt diff --git a/sys/arch/mvme68k/dev/siopreg.h b/sys/arch/mvme68k/dev/siopreg.h index 0fce258fbc5..f83f4ec40b6 100644 --- a/sys/arch/mvme68k/dev/siopreg.h +++ b/sys/arch/mvme68k/dev/siopreg.h @@ -1,6 +1,7 @@ -/* $NetBSD: siopreg.h,v 1.7 1995/08/18 15:28:13 chopps Exp $ */ +/* $Id: siopreg.h,v 1.2 1995/11/07 08:49:33 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/sys/arch/mvme68k/dev/siopvar.h b/sys/arch/mvme68k/dev/siopvar.h index af0b3c2fc22..f028eb65e74 100644 --- a/sys/arch/mvme68k/dev/siopvar.h +++ b/sys/arch/mvme68k/dev/siopvar.h @@ -1,6 +1,7 @@ -/* $NetBSD: siopvar.h,v 1.11 1995/08/18 15:28:14 chopps Exp $ */ +/* $Id: siopvar.h,v 1.2 1995/11/07 08:49:34 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * diff --git a/sys/arch/mvme68k/dev/sram.c b/sys/arch/mvme68k/dev/sram.c index 77299175e89..5eec35bf854 100644 --- a/sys/arch/mvme68k/dev/sram.c +++ b/sys/arch/mvme68k/dev/sram.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: sram.c,v 1.2 1995/11/07 08:49:35 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/vme.c b/sys/arch/mvme68k/dev/vme.c index ddd4099dd63..36d7d974b0d 100644 --- a/sys/arch/mvme68k/dev/vme.c +++ b/sys/arch/mvme68k/dev/vme.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: vme.c,v 1.2 1995/11/07 08:49:36 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/vme.h b/sys/arch/mvme68k/dev/vme.h index b49918247aa..3ec33970e38 100644 --- a/sys/arch/mvme68k/dev/vme.h +++ b/sys/arch/mvme68k/dev/vme.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: vme.h,v 1.2 1995/11/07 08:49:37 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/vmel.c b/sys/arch/mvme68k/dev/vmel.c index 68fdb1cf7f2..dabe78930ef 100644 --- a/sys/arch/mvme68k/dev/vmel.c +++ b/sys/arch/mvme68k/dev/vmel.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: vmel.c,v 1.2 1995/11/07 08:49:37 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/vmes.c b/sys/arch/mvme68k/dev/vmes.c index b4d6ac87725..23818bdad2d 100644 --- a/sys/arch/mvme68k/dev/vmes.c +++ b/sys/arch/mvme68k/dev/vmes.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: vmes.c,v 1.2 1995/11/07 08:49:38 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c index 9a52dbd8f9c..dfc23c6b0a6 100644 --- a/sys/arch/mvme68k/dev/zs.c +++ b/sys/arch/mvme68k/dev/zs.c @@ -1,6 +1,7 @@ -/* $NetBSD: zs.c,v 1.1.1.1 1995/07/25 23:12:07 chuck Exp $ */ +/* $Id: zs.c,v 1.2 1995/11/07 08:49:39 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt * Copyright (c) 1993 Paul Mackerras. * All rights reserved. * @@ -12,7 +13,11 @@ * 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 + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 4. The name of the author may not be used to endorse or promote products * derived from this software withough specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR @@ -43,17 +48,22 @@ #include <sys/fcntl.h> #include <sys/device.h> #include <machine/cpu.h> +#include <machine/autoconf.h> #include <dev/cons.h> -#include <mvme68k/dev/iio.h> #include <mvme68k/dev/scc.h> + +#include "pcc.h" +#include "mc.h" + +#if NPCC > 0 #include <mvme68k/dev/pccreg.h> +#endif +#if NMC > 0 +#include <mvme68k/dev/mcreg.h> +#endif #include "zs.h" -#if NZS > 0 -/*#define PCLK_FREQ 8333333*/ -#undef PCLK_FREQ /* XXXCDC */ -#define PCLK_FREQ 5000000 #define NZSLINE (NZS*2) #define RECV_BUF 512 @@ -64,26 +74,24 @@ #define splzs() spl4() struct zs { - short flags; /* see below */ - char rr0; /* holds previous CTS, DCD state */ - unsigned char imask; /* mask for input chars */ - int nzs_open; /* # opens as /dev/zsn */ - int nkbd_open; /* # opens as a keyboard */ - int gsp_unit; /* unit to send kbd chars to */ - struct tty *tty; /* link to tty structure */ - struct sccregs scc; /* SCC shadow registers */ - u_char *rcv_get; - u_char *rcv_put; - u_char *rcv_end; - volatile int rcv_count; - int rcv_len; - char *send_ptr; - int send_count; - int sent_count; - volatile char modem_state; - volatile char modem_change; - volatile short hflags; - char rcv_buf[RECV_BUF]; + short flags; /* see below */ + char rr0; /* holds previous CTS, DCD state */ + u_char imask; /* mask for input chars */ + int nzs_open; /* # opens as /dev/zsn */ + struct tty *tty; /* link to tty structure */ + struct sccregs scc; /* SCC shadow registers */ + u_char *rcv_get; + u_char *rcv_put; + u_char *rcv_end; + volatile int rcv_count; + int rcv_len; + char *send_ptr; + int send_count; + int sent_count; + volatile char modem_state; + volatile char modem_change; + volatile short hflags; + char rcv_buf[RECV_BUF]; }; /* Bits in flags */ @@ -100,25 +108,37 @@ struct zs { #define ZH_RXOVF 8 /* receiver buffer overflow */ struct zssoftc { - struct device dev; - struct zs zs[2]; + struct device sc_dev; + struct zs sc_zs[2]; + struct evcnt sc_intrcnt; + struct intrhand sc_ih; +#if NPCC > 0 + struct pccreg *sc_pcc; +#endif +#if NMC > 0 + struct mcreg *sc_mc; +#endif + int sc_flags; }; +#define ZSSF_85230 1 struct tty *zs_tty[NZSLINE]; -struct termios zs_cons_termios; -int zs_cons_unit = 0; -int zs_is_console = 0; -struct sccregs *zs_cons_scc; +struct termios zs_cons_termios; +int zs_cons_unit = 0; +int zs_is_console = 0; +struct sccregs *zs_cons_scc; -int zsopen __P((dev_t, int, int, struct proc *)); -void zsstart __P((struct tty *)); -int zsparam __P((struct tty *, struct termios *)); -int zsirq __P((int unit)); -void zs_softint __P((void)); +int zsopen __P((dev_t, int, int, struct proc *)); +void zsstart __P((struct tty *)); +int zsparam __P((struct tty *, struct termios *)); +int zsirq __P((int unit)); +int zsregs __P((caddr_t va, int unit, volatile u_char **crp, + volatile u_char **drp)); +int zspclk __P((void)); -unsigned long sir_zs; -void zs_softint(); +u_long sir_zs; +void zs_softint __P((void)); #define zsunit(dev) (minor(dev) >> 1) #define zsside(dev) (minor(dev) & 1) @@ -126,8 +146,8 @@ void zs_softint(); /* * Autoconfiguration stuff. */ -void zsattach __P((struct device *, struct device *, void *)); -int zsmatch __P((struct device *, void *, void *)); +void zsattach __P((struct device *, struct device *, void *)); +int zsmatch __P((struct device *, void *, void *)); struct cfdriver zscd = { NULL, "zs", zsmatch, zsattach, DV_TTY, sizeof(struct zssoftc), 0 @@ -136,33 +156,59 @@ struct cfdriver zscd = { int zsmatch(parent, vcf, args) struct device *parent; - void *vcf, *args; + void *vcf, *args; { struct cfdata *cf = vcf; + struct confargs *ca = args; - return !badbaddr((caddr_t) IIO_CFLOC_ADDR(cf)); + return (!badvaddr(ca->ca_vaddr, 1)); } void zsattach(parent, self, args) struct device *parent, *self; - void *args; + void *args; { - struct zssoftc *dv; + struct zssoftc *sc; struct zs *zp, *zc; u_char ir; volatile struct scc *scc; - int zs_level = IIO_CFLOC_LEVEL(self->dv_cfdata); - - iio_print(self->dv_cfdata); + volatile u_char *scc_cr, *scc_dr; + struct confargs *ca = args; + int zs_level = ca->ca_ipl; + int size; + static int initirq = 0; /* connect the interrupt */ - dv = (struct zssoftc *) self; - pccintr_establish(PCCV_ZS, zsirq, zs_level, self->dv_unit); - /* XXXCDC: needs some work to handle zs1 */ + sc = (struct zssoftc *) self; + + sc->sc_ih.ih_fn = zsirq; + sc->sc_ih.ih_arg = (void *)self->dv_unit; + sc->sc_ih.ih_ipl = zs_level; + switch (ca->ca_bustype) { +#if NPCC > 0 + case BUS_PCC: + pccintr_establish(PCCV_ZS, &sc->sc_ih); + sc->sc_pcc = (struct pccreg *)ca->ca_master; + break; +#endif +#if NMC > 0 + case BUS_MC: + mcintr_establish(MCV_ZS, &sc->sc_ih); + sc->sc_mc = (struct mcreg *)ca->ca_master; + break; +#endif + } + + zp = &sc->sc_zs[0]; + scc = (volatile struct scc *)ca->ca_vaddr; - zp = &dv->zs[0]; - scc = (volatile struct scc *) IIO_CFLOC_ADDR(self->dv_cfdata); + /* + * the locations of the control and data register move around + * on different MVME models, so we generate independent pointers + * to them. + */ + size = zsregs(ca->ca_vaddr, 0, &scc_cr, &scc_dr); if (zs_is_console && self->dv_unit == zsunit(zs_cons_unit)) { /* SCC is the console - it's already reset */ @@ -172,31 +218,65 @@ zsattach(parent, self, args) zc->flags |= ZS_CONSOLE; } else { /* reset the SCC */ - scc->cr = 0; - scc->cr = 9; - scc->cr = 0xC0; /* hardware reset of SCC, both sides */ + *(scc_cr + size) = 0; + *(scc_cr + size) = 9; + *(scc_cr + size) = 0xC0; /* hardware reset of SCC, both sides */ } /* side A */ - zp->scc.s_adr = scc + 1; + zp->scc.s_cr = scc_cr + size; + zp->scc.s_dr = scc_dr + size; zp->flags |= ZS_SIDEA | ZS_RESET; /* side B */ ++zp; - zp->scc.s_adr = scc; + zp->scc.s_cr = scc_cr; + zp->scc.s_dr = scc_dr; zp->flags |= ZS_RESET; if (sir_zs == 0) sir_zs = allocate_sir(zs_softint, 0); + printf("\n"); - ir = sys_pcc->zs_int; - if ((ir & PCC_IMASK) != 0 && (ir & PCC_IMASK) != zs_level) - panic("zs configured at different IPLs"); - sys_pcc->zs_int = zs_level | PCC_IENABLE | PCC_ZSEXTERN; + /* + * XXX we end up doing this twice... once for + * each ZS chip. We should really not turn interrupts on until + * we have initialized the last of the two chips. But then we + * will need to search the config system to see if we will be + * called for the 2nd chip... otherwise, a config without a zs1 + * would never enable interrupts! + */ + switch (ca->ca_bustype) { +#if NPCC > 0 + case BUS_PCC: + ir = sc->sc_pcc->pcc_zsirq; + if ((ir & PCC_IRQ_IPL) != 0 && (ir & PCC_IRQ_IPL) != zs_level) + panic("zs configured at different IPLs"); + if (initirq) + break; + sc->sc_pcc->pcc_zsirq = zs_level | PCC_IRQ_IEN | PCC_ZS_PCCVEC; + break; +#endif +#if NMC > 0 + case BUS_MC: + ir = sc->sc_mc->mc_zsirq; + if ((ir & MC_IRQ_IPL) != 0 && (ir & MC_IRQ_IPL) != zs_level) + panic("zs configured at different IPLs"); + if (initirq) + break; + sc->sc_mc->mc_zsirq = zs_level | MC_IRQ_IEN; + break; +#endif + } + initirq = 1; + + evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt); } -zs_ttydef(struct zs *zp) +void +zs_ttydef(zp) + struct zs *zp; { struct tty *tp = zp->tty; @@ -223,26 +303,28 @@ struct tty * zstty(dev) dev_t dev; { - if (minor(dev) < NZSLINE) return (zs_tty[minor(dev)]); - return (NULL); } /* ARGSUSED */ -zsopen(dev_t dev, int flag, int mode, struct proc * p) +int +zsopen(dev, flag, mode, p) + dev_t dev; + int flag, mode; + struct proc *p; { register struct tty *tp; int error; struct zs *zp; - struct zssoftc *dv; + struct zssoftc *sc; - if (zsunit(dev) > zscd.cd_ndevs - || (dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL) - return ENODEV; + if (zsunit(dev) >= zscd.cd_ndevs || + (sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL) + return (ENODEV); - zp = &dv->zs[zsside(dev)]; + zp = &sc->sc_zs[zsside(dev)]; if (zp->tty == NULL) { zp->tty = ttymalloc(); zs_ttydef(zp); @@ -257,15 +339,14 @@ zsopen(dev_t dev, int flag, int mode, struct proc * p) zs_init(zp); if ((zp->modem_state & SCC_DCD) != 0) tp->t_state |= TS_CARR_ON; - } else - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) - return (EBUSY); + } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + return (EBUSY); error = ((*linesw[tp->t_line].l_open) (dev, tp)); if (error == 0) ++zp->nzs_open; - return error; + return (error); } int @@ -276,62 +357,63 @@ zsclose(dev, flag, mode, p) { struct zs *zp; struct tty *tp; - struct zssoftc *dv; - int s; + struct zssoftc *sc; + int s; - if (zsunit(dev) > zscd.cd_ndevs - || (dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL) - return ENODEV; - zp = &dv->zs[zsside(dev)]; + if (zsunit(dev) > zscd.cd_ndevs || + (sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL) + return (ENODEV); + zp = &sc->sc_zs[zsside(dev)]; tp = zp->tty; - if (zp->nkbd_open == 0) { - (*linesw[tp->t_line].l_close) (tp, flag); - s = splzs(); - if ((zp->flags & ZS_CONSOLE) == 0 && (tp->t_cflag & HUPCL) != 0) - ZBIC(&zp->scc, 5, 0x82); /* drop DTR, RTS */ - ZBIC(&zp->scc, 3, 1); /* disable receiver */ - splx(s); - ttyclose(tp); - } + (*linesw[tp->t_line].l_close) (tp, flag); + s = splzs(); + if ((zp->flags & ZS_CONSOLE) == 0 && (tp->t_cflag & HUPCL) != 0) + ZBIC(&zp->scc, 5, 0x82); /* drop DTR, RTS */ + ZBIC(&zp->scc, 3, 1); /* disable receiver */ + splx(s); + ttyclose(tp); zp->nzs_open = 0; return (0); } /*ARGSUSED*/ +int zsread(dev, uio, flag) - dev_t dev; + dev_t dev; struct uio *uio; - int flag; + int flag; { - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]; - struct zs *zp = &dv->zs[zsside(dev)]; + struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]; + struct zs *zp = &sc->sc_zs[zsside(dev)]; struct tty *tp = zp->tty; return ((*linesw[tp->t_line].l_read) (tp, uio, flag)); } /*ARGSUSED*/ +int zswrite(dev, uio, flag) dev_t dev; struct uio *uio; int flag; { - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]; - struct zs *zp = &dv->zs[zsside(dev)]; + struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]; + struct zs *zp = &sc->sc_zs[zsside(dev)]; struct tty *tp = zp->tty; return ((*linesw[tp->t_line].l_write) (tp, uio, flag)); } +int zsioctl(dev, cmd, data, flag, p) dev_t dev; caddr_t data; int cmd, flag; struct proc *p; { - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]; - struct zs *zp = &dv->zs[zsside(dev)]; + struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]; + struct zs *zp = &sc->sc_zs[zsside(dev)]; struct tty *tp = zp->tty; register struct sccregs *scc = &zp->scc; register int error, s; @@ -379,15 +461,16 @@ zsioctl(dev, cmd, data, flag, p) error = ENOTTY; } splx(s); - return error; + return (error); } +int zsparam(tp, t) struct tty *tp; struct termios *t; { - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)]; - struct zs *zp = &dv->zs[zsside(tp->t_dev)]; + struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)]; + struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)]; register int s; zs_drain(zp); @@ -398,21 +481,20 @@ zsparam(tp, t) tp->t_cflag = t->c_cflag; if ((tp->t_cflag & CCTS_OFLOW) == 0) zp->hflags &= ~ZH_OBLOCK; - else - if ((zp->modem_state & 0x20) == 0) - zp->hflags |= ZH_OBLOCK; + else if ((zp->modem_state & 0x20) == 0) + zp->hflags |= ZH_OBLOCK; spltty(); zs_unblock(tp); splx(s); - return 0; + return (0); } void zsstart(tp) struct tty *tp; { - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)]; - struct zs *zp = &dv->zs[zsside(tp->t_dev)]; + struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)]; + struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)]; register int s, n; s = spltty(); @@ -432,10 +514,12 @@ zsstart(tp) splx(s); } -zsstop(struct tty * tp, int flag) +zsstop(tp, flag) + struct tty *tp; + int flag; { - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)]; - struct zs *zp = &dv->zs[zsside(tp->t_dev)]; + struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)]; + struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)]; int s, n; s = splzs(); @@ -478,7 +562,10 @@ zscc_init(zp, par) struct sccregs *scc; scc = &zp->scc; - ZWRITE(scc, 2, 0); +#ifdef MVME162 + if (cputyp == CPU_162) + ZWRITE(scc, 2, MC_VECBASE+MCV_ZS); +#endif ZWRITE(scc, 10, 0); ZWRITE(scc, 11, 0x50); /* rx & tx clock = brgen */ ZWRITE(scc, 14, 3); /* brgen enabled, from pclk */ @@ -500,11 +587,11 @@ zscc_params(scc, par) /* disconnect - drop DTR & RTS, disable receiver */ ZBIC(scc, 5, 0x82); ZBIC(scc, 3, 1); - return 0xFF; + return (0xFF); } if ((par->c_cflag & CREAD) == 0) ZBIC(scc, 3, 1);/* disable receiver */ - divisor = (PCLK_FREQ / 32 + (speed >> 1)) / speed - 2; + divisor = (zspclk() / 32 + (speed >> 1)) / speed - 2; ZWRITE(scc, 12, divisor); ZWRITE(scc, 13, divisor >> 8); switch (par->c_cflag & CSIZE) { @@ -537,11 +624,22 @@ zscc_params(scc, par) ints |= SCC_DCD; if ((par->c_cflag & CCTS_OFLOW) != 0) ints |= SCC_CTS; +#if 0 + if (cputyp == CPU_162) { + ZWRITE(scc, 15, ints | 1); + /* + * now.. register 7 has become register 7': disable all + * 82530-only features for now + */ + ZWRITE(scc, 7, 0x20); + } +#endif ZWRITE(scc, 15, ints); - return imask; + return (imask); } -zscc_mget(register struct sccregs * scc) +zscc_mget(scc) + register struct sccregs *scc; { int bits = 0, rr0; @@ -556,10 +654,12 @@ zscc_mget(register struct sccregs * scc) bits |= TIOCM_CTS; if ((rr0 & SCC_DCD) != 0) bits |= TIOCM_CAR; - return bits; + return (bits); } -zscc_mset(register struct sccregs * scc, int bits) +zscc_mset(scc, bits) + register struct sccregs *scc; + int bits; { if ((bits & TIOCM_LE) != 0) ZBIS(scc, 3, SCC_RCVEN); @@ -569,7 +669,9 @@ zscc_mset(register struct sccregs * scc, int bits) ZBIS(scc, 5, SCC_RTS); } -zscc_mclr(register struct sccregs * scc, int bits) +zscc_mclr(scc, bits) + register struct sccregs *scc; + int bits; { if ((bits & TIOCM_LE) != 0) ZBIC(scc, 3, SCC_RCVEN); @@ -579,15 +681,16 @@ zscc_mclr(register struct sccregs * scc, int bits) ZBIC(scc, 5, SCC_RTS); } -zs_drain(register struct zs * zp) +zs_drain(zp) + register struct zs *zp; { register int s; zp->tty->t_state |= TS_DRAIN; /* wait for Tx buffer empty and All sent bits to be set */ s = splzs(); - while ((ZREAD0(&zp->scc) & SCC_TXRDY) == 0 - || (ZREAD(&zp->scc, 1) & 1) == 0) { + while ((ZREAD0(&zp->scc) & SCC_TXRDY) == 0 || + (ZREAD(&zp->scc, 1) & 1) == 0) { splx(s); DELAY(100); s = splzs(); @@ -595,7 +698,8 @@ zs_drain(register struct zs * zp) splx(s); } -zs_unblock(register struct tty * tp) +zs_unblock(tp) + register struct tty *tp; { tp->t_state &= ~TS_DRAIN; if (tp->t_outq.c_cc != 0) @@ -606,36 +710,37 @@ zs_unblock(register struct tty * tp) * Hardware interrupt from an SCC. */ int -zsirq(int unit) +zsirq(unit) + int unit; { - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[unit]; - register struct zs *zp = &dv->zs[0]; + struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[unit]; + register struct zs *zp = &sc->sc_zs[0]; register int ipend, x; - register volatile struct scc *scc; - x = splzs(); - scc = zp->scc.s_adr; - scc->cr = 3; /* read int pending from A side */ - DELAY(5); - ipend = scc->cr; + ipend = ZREAD(&zp->scc, 3); /* read int pending from A side */ + if (ipend == 0) + return (0); if ((ipend & 0x20) != 0) zs_rxint(zp); if ((ipend & 0x10) != 0) zs_txint(zp); if ((ipend & 0x8) != 0) zs_extint(zp); - ++zp; /* now look for B side ints */ + ++zp; /* now look for B side ints */ if ((ipend & 0x4) != 0) zs_rxint(zp); if ((ipend & 0x2) != 0) zs_txint(zp); if ((ipend & 0x1) != 0) zs_extint(zp); - splx(x); - return ipend != 0; + ZWRITE0(&zp->scc, 0x38); /* reset highest IUS */ + + sc->sc_intrcnt.ev_count++; + return (1); } -zs_txint(register struct zs * zp) +zs_txint(zp) + register struct zs *zp; { struct tty *tp = zp->tty; struct sccregs *scc; @@ -661,7 +766,8 @@ zs_txint(register struct zs * zp) } } -zs_rxint(register struct zs * zp) +zs_rxint(zp) + register struct zs *zp; { register int stat, c, n, extra; u_char *put; @@ -707,7 +813,8 @@ zs_rxint(register struct zs * zp) } /* Ext/status interrupt */ -zs_extint(register struct zs * zp) +zs_extint(zp) + register struct zs *zp; { int rr0; struct tty *tp = zp->tty; @@ -742,7 +849,7 @@ zs_softint() for (unit = 0; unit < zscd.cd_ndevs; ++unit) { if (zscd.cd_devs[unit] == NULL) continue; - zp = &((struct zssoftc *) zscd.cd_devs[unit])->zs[0]; + zp = &((struct zssoftc *) zscd.cd_devs[unit])->sc_zs[0]; for (side = 0; side < 2; ++side, ++zp) { if ((zp->hflags & ZH_SIRQ) == 0) continue; @@ -791,10 +898,6 @@ zs_softint() if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0) continue; if (zp->nzs_open == 0) { -#ifdef notdef - if (stat == 0) - kbd_newchar(zp->gsp_unit, c); -#endif } else { if ((stat & 0x10) != 0) c |= TTY_PE; @@ -832,49 +935,6 @@ zs_softint() } /* - * Routines to divert an SCC channel to the input side of /dev/gsp - * for the keyboard. - */ -int -zs_kbdopen(int unit, int gsp_unit, struct termios * tiop, struct proc * p) -{ - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(unit)]; - struct zs *zp = &dv->zs[zsside(unit)]; - int error; - - error = zsopen(unit, 0, 0, p); - if (error != 0) - return error; - ++zp->nkbd_open; - --zp->nzs_open; - zsparam(zp->tty, tiop); - zp->gsp_unit = gsp_unit; - return 0; -} - -void -zs_kbdclose(int unit) -{ - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(unit)]; - struct zs *zp = &dv->zs[zsside(unit)]; - - zp->nkbd_open = 0; - if (zp->nzs_open == 0) - zsclose(unit, 0, 0, 0); -} - -void -zs_kbdput(int unit, int c) -{ - struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(unit)]; - struct zs *zp = &dv->zs[zsside(unit)]; - struct tty *tp = zp->tty; - - putc(c, &tp->t_outq); - zsstart(tp); -} - -/* * Routines for using side A of the first SCC as a console. */ @@ -882,9 +942,16 @@ zs_kbdput(int unit, int c) zscnprobe(cp) struct consdev *cp; { - int maj; - char *prom_cons; - extern char *prom_getvar(); + int maj; + + switch (cputyp) { + case CPU_147: + case CPU_162: + break; + default: + cp->cn_pri = CN_DEAD; + return (0); + } /* locate the major number */ for (maj = 0; maj < nchrdev; maj++) @@ -893,16 +960,16 @@ zscnprobe(cp) /* initialize required fields */ cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_NORMAL; + cp->cn_pri = CN_INTERNAL; /* better than PROM console */ - return 1; + return (1); } /* initialize the keyboard for use as the console */ struct termios zscn_termios = { TTYDEF_IFLAG, TTYDEF_OFLAG, - TTYDEF_CFLAG, + (CREAD | CS8 | HUPCL), TTYDEF_LFLAG, {0}, TTYDEF_SPEED, @@ -912,9 +979,6 @@ struct termios zscn_termios = { struct sccregs zs_cons_sccregs; int zs_cons_imask; -unsigned zs_cons_addrs[] = {ZS0_PHYS, ZS1_PHYS}; - - zscninit() { zs_cnsetup(0, &zscn_termios); @@ -922,12 +986,13 @@ zscninit() /* Polling routine for console input from a serial port. */ int -zscngetc(dev_t dev) +zscngetc(dev) + dev_t dev; { register struct sccregs *scc = zs_cons_scc; int c, s, stat; - s = splzs(); + s = splhigh(); /* XXX was splzs() */ for (;;) { while ((ZREAD0(scc) & SCC_RXFULL) == 0) /* wait for Rx full */ ; @@ -939,39 +1004,56 @@ zscngetc(dev_t dev) ZWRITE0(scc, 0x30); /* reset error */ } splx(s); - return c; + return (c); } -zscnputc(dev_t dev, int c) +zscnputc(dev, c) + dev_t dev; + int c; { register struct sccregs *scc = zs_cons_scc; int s; - s = splzs(); - while ((ZREAD0(scc) & SCC_TXRDY) == 0); + s = splhigh(); /* XXX was splzs() */ + while ((ZREAD0(scc) & SCC_TXRDY) == 0) + ; ZWRITED(scc, c); splx(s); } -zs_cnsetup(int unit, struct termios * tiop) +zs_cnsetup(unit, tiop) + int unit; + struct termios *tiop; { - register volatile struct scc *scc_adr; - register struct sccregs *scc; + volatile u_char *scc_cr, *scc_dr; + struct sccregs *scc; + int size; zs_cons_unit = unit; zs_is_console = 1; zs_cons_scc = scc = &zs_cons_sccregs; - scc_adr = (volatile struct scc *) IIOV(zs_cons_addrs[zsunit(unit)]); - - scc_adr[1].cr = 0; - scc_adr[1].cr = 9; - scc_adr[1].cr = 0xC0; /* hardware reset of SCC, both sides */ - if (!zsside(unit)) - ++scc_adr; + /* + * the locations of the control and data register move around + * on different MVME models, so we generate independent pointers + * to them. + */ + size = zsregs(NULL, unit, &scc_cr, &scc_dr); + + *(scc_cr + size) = 0; + *(scc_cr + size) = 9; + *(scc_cr + size) = 0xC0; /* hardware reset of SCC, both sides */ + if (!zsside(unit)) { + scc_cr += size; + scc_dr += size; + } - scc->s_adr = scc_adr; - ZWRITE(scc, 2, 0); + scc->s_cr = scc_cr; + scc->s_dr = scc_dr; +#ifdef MVME162 + if (cputyp == CPU_162) + ZWRITE(scc, 2, MC_VECBASE+MCV_ZS); +#endif ZWRITE(scc, 10, 0); ZWRITE(scc, 11, 0x50); /* rx & tx clock = brgen */ ZWRITE(scc, 14, 3); /* brgen enabled, from pclk */ @@ -981,16 +1063,74 @@ zs_cnsetup(int unit, struct termios * tiop) zs_cons_termios = *tiop;/* save for later */ } +#ifdef MVME147 +u_long zs_cons_addrs_147[] = { ZS0_PHYS_147, ZS1_PHYS_147 }; +#endif +#ifdef MVME162 +u_long zs_cons_addrs_162[] = { ZS0_PHYS_162, ZS1_PHYS_162 }; +#endif + /* - * Routines for using the keyboard SCC as the input side of - * the 'gsp' console device. + * fills in pointers to the registers and returns how far apart + * the two halves of the chip are. + * + * it vaddr == NULL, it tries to determine the hardware address in + * an intelligent fashion from the unit number. */ +int +zsregs(va, unit, crp, drp) + caddr_t va; + int unit; + volatile u_char **crp, **drp; +{ +#ifdef MVME147 + volatile struct scc_147 *scc_adr_147; +#endif +#ifdef MVME162 + volatile struct scc_162 *scc_adr_162; +#endif + volatile u_char *scc_cr, *scc_dr; + int size; + + switch (cputyp) { +#ifdef MVME147 + case CPU_147: + if (!va) + va = (caddr_t)IIOV(zs_cons_addrs_147[zsunit(unit)]); + scc_adr_147 = (volatile struct scc_147 *)va; + scc_cr = &scc_adr_147->cr; + scc_dr = &scc_adr_147->dr; + size = sizeof(struct scc_147); + break; +#endif +#ifdef MVME162 + case CPU_162: + if (!va) + va = (caddr_t)IIOV(zs_cons_addrs_162[zsunit(unit)]); + scc_adr_162 = (volatile struct scc_162 *)va; + scc_cr = &scc_adr_162->cr; + scc_dr = &scc_adr_162->dr; + size = sizeof(struct scc_162); + break; +#endif + } -/* probe for the keyboard; should check hardware */ -zs_kbdcnprobe(cp, unit) - struct consdev *cp; - int unit; + *crp = scc_cr; + *drp = scc_dr; + return (size); +} + +int +zspclk() { - return (unsigned) unit < NZSLINE; + switch (cputyp) { +#ifdef MVME147 + case CPU_147: + return (PCLK_FREQ_147); +#endif +#ifdef MVME162 + case CPU_162: + return (PCLK_FREQ_162); +#endif + } } -#endif /* NZS */ diff --git a/sys/arch/mvme68k/include/ansi.h b/sys/arch/mvme68k/include/ansi.h index 745f1b30ca2..5243cfacc36 100644 --- a/sys/arch/mvme68k/include/ansi.h +++ b/sys/arch/mvme68k/include/ansi.h @@ -1,4 +1,4 @@ -/* $NetBSD: ansi.h,v 1.1.1.1 1995/07/25 23:12:12 chuck Exp $ */ +/* $Id: ansi.h,v 1.2 1995/11/07 08:49:44 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/ansi.h> diff --git a/sys/arch/mvme68k/include/asm.h b/sys/arch/mvme68k/include/asm.h index e4f75e3949f..32692e40f5c 100644 --- a/sys/arch/mvme68k/include/asm.h +++ b/sys/arch/mvme68k/include/asm.h @@ -1,3 +1,3 @@ -/* $NetBSD: asm.h,v 1.1.1.1 1995/07/25 23:12:13 chuck Exp $ */ +/* $Id: asm.h,v 1.2 1995/11/07 08:49:45 deraadt Exp $ */ #include <m68k/asm.h> diff --git a/sys/arch/mvme68k/include/autoconf.h b/sys/arch/mvme68k/include/autoconf.h index e470530d15d..f1ad108dd57 100644 --- a/sys/arch/mvme68k/include/autoconf.h +++ b/sys/arch/mvme68k/include/autoconf.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: autoconf.h,v 1.2 1995/11/07 08:49:46 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/include/cdefs.h b/sys/arch/mvme68k/include/cdefs.h index 641030e3e30..ffd0e8f2a8d 100644 --- a/sys/arch/mvme68k/include/cdefs.h +++ b/sys/arch/mvme68k/include/cdefs.h @@ -1,4 +1,4 @@ -/* $NetBSD: cdefs.h,v 1.1.1.1 1995/07/25 23:12:19 chuck Exp $ */ +/* $Id: cdefs.h,v 1.2 1995/11/07 08:49:47 deraadt Exp $ */ #ifndef _MACHINE_CDEFS_H_ #define _MACHINE_CDEFS_H_ diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h index aec3e71fbe6..16ea864334c 100644 --- a/sys/arch/mvme68k/include/cpu.h +++ b/sys/arch/mvme68k/include/cpu.h @@ -1,6 +1,35 @@ -/* $NetBSD: cpu.h,v 1.1.1.1 1995/07/25 23:12:13 chuck Exp $ */ +/* $Id: cpu.h,v 1.2 1995/11/07 08:49:47 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -57,7 +86,7 @@ /* * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. One the mvme68k, we use + * machine state in an opaque clockframe. One the m68k, we use * what the hardware pushes on an interrupt (frame format 0). */ struct clockframe { @@ -86,7 +115,7 @@ struct clockframe { /* * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the hp300, request an ast to send us + * buffer pages are invalid. On the m68k, 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(); } @@ -112,11 +141,9 @@ extern unsigned char ssir; #define SIR_CLOCK 0x2 #define setsoftint(x) ssir |= (x) -#define siroff(x) ssir &= ~(x) #define setsoftnet() ssir |= SIR_NET #define setsoftclock() ssir |= SIR_CLOCK - -extern unsigned long allocate_sir(); +u_long allocate_sir __P((void (*proc)(), void *arg)); /* * CTL_MACHDEP definitions. @@ -139,23 +166,25 @@ extern unsigned long allocate_sir(); #define EC_NONE 0 /* no external cache */ #define EC_VIRT 1 /* external virtual address cache */ -#define MHZ_16 2 /* XXX kill */ - - #ifdef _KERNEL extern int mmutype, ectype; -extern int cpuspeed; /* XXX kill */ extern char *intiobase, *intiolimit; +extern char *iiomapbase; +extern int iiomapsize; #endif /* physical memory sections for mvme147 */ -#define INTIOBASE (0xfffe0000) -#define INTIOTOP (0xfffe5000) +#define INTIOBASE_147 (0xfffe0000) +#define INTIOTOP_147 (0xfffe5000) +#define INTIOSIZE_147 ((INTIOTOP_147-INTIOBASE_147)/NBPG) + +/* physical memory sections for mvme16x */ +#define INTIOBASE_162 (0xfff00000) +#define INTIOTOP_162 (0xfffd0000) /* was 0xfff50000 */ +#define INTIOSIZE_162 ((INTIOTOP_162-INTIOBASE_162)/NBPG) /* - * Internal IO space: - * - * Ranges from 0x800000 to 0x1000000 (IIOMAPSIZE). + * Internal IO space (iiomapsize). * * Internal IO space is mapped in the kernel from ``intiobase'' to * ``intiolimit'' (defined in locore.s). Since it is always mapped, @@ -163,10 +192,9 @@ extern char *intiobase, *intiolimit; */ #define ISIIOVA(va) \ ((char *)(va) >= intiobase && (char *)(va) < intiolimit) -#define IIOV(pa) ((int)(pa)-INTIOBASE+(int)intiobase) -#define IIOP(va) ((int)(va)-(int)intiobase+INTIOBASE) -#define IIOPOFF(pa) ((int)(pa)-INTIOBASE) -#define IIOMAPSIZE btoc(INTIOTOP-INTIOBASE) /* 1mb */ +#define IIOV(pa) ((int)(pa)-(int)iiomapbase+(int)intiobase) +#define IIOP(va) ((int)(va)-(int)intiobase+(int)iiomapbase) +#define IIOPOFF(pa) ((int)(pa)-(int)iiomapbase) /* * 68851 and 68030 MMU @@ -223,8 +251,30 @@ extern char *intiobase, *intiolimit; #define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE) /* 68040 cache control register */ -#define IC4_ENABLE 0x8000 /* instruction cache enable bit */ +#define IC4_ENABLE 0x00008000 /* instruction cache enable bit */ #define DC4_ENABLE 0x80000000 /* data cache enable bit */ #define CACHE4_ON (IC4_ENABLE|DC4_ENABLE) #define CACHE4_OFF (0) + +extern int cputyp; +#define CPU_147 0x147 +#define CPU_162 0x162 +#define CPU_166 0x166 +#define CPU_167 0x167 +#define CPU_172 0x172 +#define CPU_177 0x177 + +struct intrhand { + struct intrhand *ih_next; + int (*ih_fn)(); + void *ih_arg; + int ih_ipl; + int ih_wantframe; +}; + +struct haltvec { + struct haltvec *hv_next; + void (*hv_fn) __P((void)); + int hv_pri; +}; diff --git a/sys/arch/mvme68k/include/db_machdep.h b/sys/arch/mvme68k/include/db_machdep.h index a736e228618..4b4f3ad69dd 100644 --- a/sys/arch/mvme68k/include/db_machdep.h +++ b/sys/arch/mvme68k/include/db_machdep.h @@ -1,4 +1,6 @@ -/* $NetBSD: db_machdep.h,v 1.1.1.1 1995/07/25 23:12:14 chuck Exp $ */ +/* $Id: db_machdep.h,v 1.2 1995/11/07 08:49:48 deraadt Exp $ */ + +#define DB_MACHINE_COMMANDS /* Just use the common m68k definition */ #include <m68k/db_machdep.h> diff --git a/sys/arch/mvme68k/include/endian.h b/sys/arch/mvme68k/include/endian.h index 3876563a9f3..42e215473aa 100644 --- a/sys/arch/mvme68k/include/endian.h +++ b/sys/arch/mvme68k/include/endian.h @@ -1,4 +1,4 @@ -/* $NetBSD: endian.h,v 1.1.1.1 1995/07/25 23:12:15 chuck Exp $ */ +/* $Id: endian.h,v 1.2 1995/11/07 08:49:49 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/endian.h> diff --git a/sys/arch/mvme68k/include/exec.h b/sys/arch/mvme68k/include/exec.h index eea9bf11738..26db9171851 100644 --- a/sys/arch/mvme68k/include/exec.h +++ b/sys/arch/mvme68k/include/exec.h @@ -1,4 +1,4 @@ -/* $NetBSD: exec.h,v 1.1.1.1 1995/07/25 23:12:15 chuck Exp $ */ +/* $Id: exec.h,v 1.2 1995/11/07 08:49:50 deraadt Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou diff --git a/sys/arch/mvme68k/include/float.h b/sys/arch/mvme68k/include/float.h index 5eeebfa7f4b..e09bdec1d73 100644 --- a/sys/arch/mvme68k/include/float.h +++ b/sys/arch/mvme68k/include/float.h @@ -1,4 +1,4 @@ -/* $NetBSD: float.h,v 1.1.1.1 1995/07/25 23:12:15 chuck Exp $ */ +/* $Id: float.h,v 1.2 1995/11/07 08:49:50 deraadt Exp $ */ #ifndef _MACHINE_FLOAT_H_ #define _MACHINE_FLOAT_H_ diff --git a/sys/arch/mvme68k/include/frame.h b/sys/arch/mvme68k/include/frame.h index a6b1f3c584b..dc6892d7f1e 100644 --- a/sys/arch/mvme68k/include/frame.h +++ b/sys/arch/mvme68k/include/frame.h @@ -1,3 +1,3 @@ -/* $NetBSD: frame.h,v 1.1.1.1 1995/07/25 23:12:15 chuck Exp $ */ +/* $Id: frame.h,v 1.2 1995/11/07 08:49:51 deraadt Exp $ */ #include <m68k/frame.h> diff --git a/sys/arch/mvme68k/include/ieeefp.h b/sys/arch/mvme68k/include/ieeefp.h index 8d6941e81b5..ddc75724183 100644 --- a/sys/arch/mvme68k/include/ieeefp.h +++ b/sys/arch/mvme68k/include/ieeefp.h @@ -1,4 +1,4 @@ -/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:08 jtc Exp $ */ +/* $Id: ieeefp.h,v 1.2 1995/11/07 08:49:52 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/ieeefp.h> diff --git a/sys/arch/mvme68k/include/limits.h b/sys/arch/mvme68k/include/limits.h index ab36a0f1dc7..38f30a8723e 100644 --- a/sys/arch/mvme68k/include/limits.h +++ b/sys/arch/mvme68k/include/limits.h @@ -1,4 +1,4 @@ -/* $NetBSD: limits.h,v 1.1.1.1 1995/07/25 23:12:16 chuck Exp $ */ +/* $Id: limits.h,v 1.2 1995/11/07 08:49:53 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/limits.h> diff --git a/sys/arch/mvme68k/include/mioctl.h b/sys/arch/mvme68k/include/mioctl.h index ba76d4a441a..0cfe2cdaffb 100644 --- a/sys/arch/mvme68k/include/mioctl.h +++ b/sys/arch/mvme68k/include/mioctl.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: mioctl.h,v 1.2 1995/11/07 08:49:54 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/include/nvram.h b/sys/arch/mvme68k/include/nvram.h index 91690b7ba4d..b5fb692e1c7 100644 --- a/sys/arch/mvme68k/include/nvram.h +++ b/sys/arch/mvme68k/include/nvram.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: nvram.h,v 1.2 1995/11/07 08:49:54 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/include/param.h b/sys/arch/mvme68k/include/param.h index e6140206e68..199771f9aa2 100644 --- a/sys/arch/mvme68k/include/param.h +++ b/sys/arch/mvme68k/include/param.h @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.9 1995/03/28 18:15:38 jtc Exp $ */ +/* $Id: param.h,v 1.3 1995/11/07 08:49:55 deraadt Exp $ */ /* * Copyright (c) 1988 University of Utah. diff --git a/sys/arch/mvme68k/include/pcb.h b/sys/arch/mvme68k/include/pcb.h index 001543c03c4..4edade720df 100644 --- a/sys/arch/mvme68k/include/pcb.h +++ b/sys/arch/mvme68k/include/pcb.h @@ -1,4 +1,4 @@ -/* $NetBSD: pcb.h,v 1.1.1.1 1995/07/25 23:12:16 chuck Exp $ */ +/* $Id: pcb.h,v 1.2 1995/11/07 08:49:56 deraadt Exp $ */ /* * Copyright (c) 1988 University of Utah. diff --git a/sys/arch/mvme68k/include/pmap.h b/sys/arch/mvme68k/include/pmap.h index 323861224dd..8103a94c8f2 100644 --- a/sys/arch/mvme68k/include/pmap.h +++ b/sys/arch/mvme68k/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.1.1.1 1995/07/25 23:12:16 chuck Exp $ */ +/* $Id: pmap.h,v 1.2 1995/11/07 08:49:57 deraadt Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -46,13 +46,13 @@ #include <machine/pte.h> #if defined(M68040) -#define HP_SEG_SIZE (mmutype == MMU_68040 ? 0x40000 : NBSEG) +#define M68K_SEG_SIZE (mmutype == MMU_68040 ? 0x40000 : NBSEG) #else -#define HP_SEG_SIZE NBSEG +#define M68K_SEG_SIZE NBSEG #endif -#define m68k_trunc_seg(x) (((unsigned)(x)) & ~(HP_SEG_SIZE-1)) -#define m68k_round_seg(x) m68k_trunc_seg((unsigned)(x) + HP_SEG_SIZE-1) +#define m68k_trunc_seg(x) (((unsigned)(x)) & ~(M68K_SEG_SIZE-1)) +#define m68k_round_seg(x) m68k_trunc_seg((unsigned)(x) + M68K_SEG_SIZE-1) /* * Pmap stuff @@ -138,7 +138,6 @@ struct pv_page { #ifdef _KERNEL extern struct pmap kernel_pmap_store; -extern vm_offset_t vm_first_phys, vm_num_phys; #define pmap_kernel() (&kernel_pmap_store) #define active_pmap(pm) \ diff --git a/sys/arch/mvme68k/include/proc.h b/sys/arch/mvme68k/include/proc.h index e50f573dea8..2165ed8a821 100644 --- a/sys/arch/mvme68k/include/proc.h +++ b/sys/arch/mvme68k/include/proc.h @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.1.1.1 1995/07/25 23:12:16 chuck Exp $ */ +/* $Id: proc.h,v 1.2 1995/11/07 08:49:58 deraadt Exp $ */ /* * Copyright (c) 1991, 1993 @@ -44,9 +44,7 @@ struct mdproc { }; /* md_flags */ -#define MDP_STACKADJ 0x0002 /* frame SP adjusted, might have to - undo when system call returns - ERESTART. */ +#define MDP_STACKADJ 0x0002 /* frame SP adjusted; undo when syscall does ERESTART */ #define MDP_HPUXTRACE 0x0004 /* being traced by HP-UX process */ #define MDP_HPUXMMAP 0x0008 /* VA space is multiply mapped */ #define MDP_CCBDATA 0x0010 /* copyback caching of data (68040) */ diff --git a/sys/arch/mvme68k/include/profile.h b/sys/arch/mvme68k/include/profile.h index 135774c7a25..95cf0fbc485 100644 --- a/sys/arch/mvme68k/include/profile.h +++ b/sys/arch/mvme68k/include/profile.h @@ -1,3 +1,3 @@ -/* $NetBSD: profile.h,v 1.1.1.1 1995/07/25 23:12:17 chuck Exp $ */ +/* $Id: profile.h,v 1.2 1995/11/07 08:49:58 deraadt Exp $ */ #include <m68k/profile.h> diff --git a/sys/arch/mvme68k/include/prom.h b/sys/arch/mvme68k/include/prom.h index 60514bda0dc..2325b5806cb 100644 --- a/sys/arch/mvme68k/include/prom.h +++ b/sys/arch/mvme68k/include/prom.h @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: prom.h,v 1.2 1995/11/07 08:49:59 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,7 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * diff --git a/sys/arch/mvme68k/include/psl.h b/sys/arch/mvme68k/include/psl.h index e374e95e9bb..5243a91651c 100644 --- a/sys/arch/mvme68k/include/psl.h +++ b/sys/arch/mvme68k/include/psl.h @@ -1,3 +1,3 @@ -/* $NetBSD: psl.h,v 1.1.1.1 1995/07/25 23:12:17 chuck Exp $ */ +/* $Id: psl.h,v 1.2 1995/11/07 08:50:00 deraadt Exp $ */ #include <m68k/psl.h> diff --git a/sys/arch/mvme68k/include/pte.h b/sys/arch/mvme68k/include/pte.h index e7c55296f1e..173c7c4647d 100644 --- a/sys/arch/mvme68k/include/pte.h +++ b/sys/arch/mvme68k/include/pte.h @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.1.1.1 1995/07/25 23:12:17 chuck Exp $ */ +/* $Id: pte.h,v 1.2 1995/11/07 08:50:01 deraadt Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -132,12 +132,12 @@ typedef int pt_entry_t; /* Mach page table entry */ #define PG_CIN 0x00000060 /* cache inhibited nonserialized */ #define PG_SO 0x00000080 /* supervisor only */ -#define HP_STSIZE (MAXUL2SIZE*SG4_LEV2SIZE*sizeof(st_entry_t)) +#define M68K_STSIZE (MAXUL2SIZE*SG4_LEV2SIZE*sizeof(st_entry_t)) /* user process segment table size */ -#define HP_MAX_PTSIZE 0x400000 /* max size of UPT */ -#define HP_MAX_KPTSIZE 0x100000 /* max memory to allocate to KPT */ -#define HP_PTBASE 0x10000000 /* UPT map base address */ -#define HP_PTMAXSIZE 0x70000000 /* UPT map maximum size */ +#define M68K_MAX_PTSIZE 0x400000 /* max size of UPT */ +#define M68K_MAX_KPTSIZE 0x100000 /* max memory to allocate to KPT */ +#define M68K_PTBASE 0x10000000 /* UPT map base address */ +#define M68K_PTMAXSIZE 0x70000000 /* UPT map maximum size */ /* * Kernel virtual address to page table entry and to physical address. diff --git a/sys/arch/mvme68k/include/ptrace.h b/sys/arch/mvme68k/include/ptrace.h index 5a92bbbe410..906da20f4ca 100644 --- a/sys/arch/mvme68k/include/ptrace.h +++ b/sys/arch/mvme68k/include/ptrace.h @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.1.1.1 1995/07/25 23:12:17 chuck Exp $ */ +/* $Id: ptrace.h,v 1.2 1995/11/07 08:50:01 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/ptrace.h> diff --git a/sys/arch/mvme68k/include/reg.h b/sys/arch/mvme68k/include/reg.h index a78c3a7c910..3599a943dd9 100644 --- a/sys/arch/mvme68k/include/reg.h +++ b/sys/arch/mvme68k/include/reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: reg.h,v 1.1.1.1 1995/07/25 23:12:18 chuck Exp $ */ +/* $Id: reg.h,v 1.2 1995/11/07 08:50:02 deraadt Exp $ */ #ifndef _MACHINE_REG_H_ #define _MACHINE_REG_H_ diff --git a/sys/arch/mvme68k/include/setjmp.h b/sys/arch/mvme68k/include/setjmp.h index bccffd9143b..0843a9c3c53 100644 --- a/sys/arch/mvme68k/include/setjmp.h +++ b/sys/arch/mvme68k/include/setjmp.h @@ -1,3 +1,3 @@ -/* $NetBSD: setjmp.h,v 1.1.1.1 1995/07/25 23:12:18 chuck Exp $ */ +/* $Id: setjmp.h,v 1.2 1995/11/07 08:50:03 deraadt Exp $ */ #include <m68k/setjmp.h> diff --git a/sys/arch/mvme68k/include/signal.h b/sys/arch/mvme68k/include/signal.h index a00ca454c06..feac291319b 100644 --- a/sys/arch/mvme68k/include/signal.h +++ b/sys/arch/mvme68k/include/signal.h @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.1.1.1 1995/07/25 23:12:18 chuck Exp $ */ +/* $Id: signal.h,v 1.2 1995/11/07 08:50:04 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/signal.h> diff --git a/sys/arch/mvme68k/include/stdarg.h b/sys/arch/mvme68k/include/stdarg.h index 5018e7e3993..65d252073c7 100644 --- a/sys/arch/mvme68k/include/stdarg.h +++ b/sys/arch/mvme68k/include/stdarg.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdarg.h,v 1.1.1.1 1995/07/25 23:12:18 chuck Exp $ */ +/* $Id: stdarg.h,v 1.2 1995/11/07 08:50:05 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/stdarg.h> diff --git a/sys/arch/mvme68k/include/trap.h b/sys/arch/mvme68k/include/trap.h index 881b0ad8e3a..515baf90403 100644 --- a/sys/arch/mvme68k/include/trap.h +++ b/sys/arch/mvme68k/include/trap.h @@ -1,3 +1,3 @@ -/* $NetBSD: trap.h,v 1.1.1.1 1995/07/25 23:12:19 chuck Exp $ */ +/* $Id: trap.h,v 1.2 1995/11/07 08:50:06 deraadt Exp $ */ #include <m68k/trap.h> diff --git a/sys/arch/mvme68k/include/types.h b/sys/arch/mvme68k/include/types.h index 0a0c7885eec..69ae636bac1 100644 --- a/sys/arch/mvme68k/include/types.h +++ b/sys/arch/mvme68k/include/types.h @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.1.1.1 1995/07/25 23:12:19 chuck Exp $ */ +/* $Id: types.h,v 1.2 1995/11/07 08:50:06 deraadt Exp $ */ #ifndef _MACHINE_TYPES_H_ #define _MACHINE_TYPES_H_ diff --git a/sys/arch/mvme68k/include/varargs.h b/sys/arch/mvme68k/include/varargs.h index 797ad3e7e0c..653572172a3 100644 --- a/sys/arch/mvme68k/include/varargs.h +++ b/sys/arch/mvme68k/include/varargs.h @@ -1,4 +1,4 @@ -/* $NetBSD: varargs.h,v 1.1.1.1 1995/07/25 23:12:19 chuck Exp $ */ +/* $Id: varargs.h,v 1.2 1995/11/07 08:50:07 deraadt Exp $ */ /* Just use the common m68k definition */ #include <m68k/varargs.h> diff --git a/sys/arch/mvme68k/include/vmparam.h b/sys/arch/mvme68k/include/vmparam.h index 7e274b713dc..4b75b1ec4ce 100644 --- a/sys/arch/mvme68k/include/vmparam.h +++ b/sys/arch/mvme68k/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.1.1.1 1995/07/25 23:12:19 chuck Exp $ */ +/* $Id: vmparam.h,v 1.2 1995/11/07 08:50:08 deraadt Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -120,7 +120,7 @@ * External IO space map size. */ #ifndef EIOMAPSIZE -#define EIOMAPSIZE 0 /* nothing */ +#define EIOMAPSIZE 1024 /* in pages */ #endif /* diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c index 02c0758dbc6..5e102891bf8 100644 --- a/sys/arch/mvme68k/mvme68k/autoconf.c +++ b/sys/arch/mvme68k/mvme68k/autoconf.c @@ -1,6 +1,35 @@ -/* $NetBSD: autoconf.c,v 1.1.1.1 1995/07/25 23:11:55 chuck Exp $ */ +/* $Id: autoconf.c,v 1.2 1995/11/07 08:50:15 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -59,32 +88,31 @@ #include <sys/dmap.h> #include <sys/reboot.h> #include <sys/device.h> +#include <sys/disklabel.h> #include <machine/vmparam.h> +#include <machine/autoconf.h> #include <machine/cpu.h> #include <machine/pte.h> -#include <mvme68k/mvme68k/isr.h> /* * The following several variables are related to * the configuration process, and are used in initializing * the machine. */ -int cold; /* if 1, still working on cold-start */ -int dkn; /* number of iostat dk numbers assigned so far */ -int cpuspeed = MHZ_16; /* relative cpu speed */ -struct isr isrqueue[NISR]; +extern int cold; /* if 1, still working on cold-start */ +int dkn; /* number of iostat dk numbers assigned so far */ + +/* XXX must be allocated statically because of early console init */ +struct map extiomap[EIOMAPSIZE/16]; +extern char *extiobase; void mainbus_attach __P((struct device *, struct device *, void *)); int mainbus_match __P((struct device *, void *, void *)); -struct mainbus_softc { - struct device sc_dev; -}; - struct cfdriver mainbuscd = { NULL, "mainbus", mainbus_match, mainbus_attach, - DV_DULL, sizeof(struct mainbus_softc), 0 + DV_DULL, sizeof(struct device), 0 }; int @@ -96,6 +124,38 @@ mainbus_match(parent, cf, args) return (1); } +int +mainbus_print(args, bus) + void *args; + char *bus; +{ + struct confargs *ca = args; + + if (ca->ca_paddr != (void *)-1) + printf(" addr 0x%x", ca->ca_paddr); + return (UNCONF); +} + +int +mainbus_scan(parent, child, args) + struct device *parent; + void *child, *args; +{ + struct cfdata *cf = child; + struct confargs oca; + + bzero(&oca, sizeof oca); + oca.ca_paddr = (caddr_t)cf->cf_loc[0]; + oca.ca_vaddr = (caddr_t)-1; + oca.ca_ipl = -1; + oca.ca_bustype = BUS_MAIN; + oca.ca_name = cf->cf_driver->cd_name; + if ((*cf->cf_driver->cd_match)(parent, cf, &oca) == 0) + return (0); + config_attach(parent, cf, &oca, mainbus_print); + return (1); +} + void mainbus_attach(parent, self, args) struct device *parent, *self; @@ -103,50 +163,77 @@ mainbus_attach(parent, self, args) { printf("\n"); - while (config_found(self, NULL, NULL)) - ; + /* XXX + * should have a please-attach-first list for mainbus, + * to ensure that the pcc/vme2/mcc chips are attached + * first. + */ + + (void)config_search(mainbus_scan, self, args); } + /* * Determine mass storage and memory configuration for a machine. */ configure() { init_sir(); - isrinit(); + + rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16); if (!config_rootfound("mainbus", NULL)) panic("autoconfig failed, no root"); -#if GENERIC - if ((boothowto & RB_ASKNAME) == 0) - setroot(); - setconf(); -#else setroot(); -#endif swapconf(); cold = 0; } -isrinit() +/* + * Allocate/deallocate a cache-inhibited range of kernel virtual address + * space mapping the indicated physical address range [pa - pa+size) + */ +caddr_t +mapiodev(pa, size) + caddr_t pa; + int size; { - register int i; + int ix, npf, offset; + caddr_t kva; - for (i = 0; i < NISR; i++) - isrqueue[i].isr_forw = isrqueue[i].isr_back = &isrqueue[i]; + size = roundup(size, NBPG); + offset = (int)pa & PGOFSET; + pa = (caddr_t)((int)pa & ~PGOFSET); + +#ifdef DEBUG + if (((int)pa & PGOFSET) || (size & PGOFSET)) + panic("mapiodev: unaligned"); +#endif + npf = btoc(size); + ix = rmalloc(extiomap, npf); + if (ix == 0) + return (0); + kva = extiobase + ctob(ix-1); + physaccess(kva, pa, size, PG_RW|PG_CI); + return (kva + offset); } void -isrlink(isr) - register struct isr *isr; +unmapiodev(kva, size) + caddr_t kva; + int size; { - int i = ISRIPL(isr->isr_ipl); + int ix; - if (i < 0 || i >= NISR) { - printf("bad IPL %d\n", i); - panic("configure"); - } - insque(isr, isrqueue[i].isr_back); +#ifdef DEBUG + if (((int)kva & PGOFSET) || (size & PGOFSET)) + panic("unmapiodev: unaligned"); + if (kva < extiobase || kva >= extiobase + ctob(EIOMAPSIZE)) + panic("unmapiodev: bad address"); +#endif + physunaccess(kva, size); + ix = btoc(kva - extiobase) + 1; + rmfree(extiomap, btoc(size), ix); } /* @@ -168,19 +255,30 @@ swapconf() dumpconf(); } -#define DOSWAP /* Change swdevt and dumpdev too */ -u_long bootdev; /* should be dev_t, but not until 32 bits */ +u_long bootdev; + +#define PARTITIONMASK (MAXPARTITIONS-1) -static char devname[][2] = { - 0,0, /* 0 = xx */ - 's','d', /* 1 = sd */ - 'w','d', /* 2 = wd */ - 0,0, /* 3 = sw */ - 'i','d', /* 4 = id */ +struct bdevnam { + char *name; + int maj; +} bdevnam[] = { + { "sd", 4 }, + { "cd", 6 }, + { "xd", 10 }, }; -#define PARTITIONMASK 0x7 -#define PARTITIONSHIFT 3 +char * +blktonam(blk) + int blk; +{ + int i; + + for (i = 0; i < sizeof(bdevnam)/sizeof(bdevnam[0]); i++) + if (bdevnam[i].maj == blk) + return (bdevnam[i].name); + return ("??"); +} /* * Attempt to find the device from which we were booted. @@ -189,63 +287,179 @@ static char devname[][2] = { */ setroot() { - register struct hp_ctlr *hc; - register struct hp_device *hd; - int majdev, mindev, unit, part, controller, adaptor; - dev_t temp, orootdev; - struct swdevt *swp; + int majdev, mindev, nswapdev; + extern int (*mountroot)(); +#if defined(NFSCLIENT) + extern char *nfsbootdevname; + extern int nfs_mountroot(); +#endif +#if defined(FFS) + extern int ffs_mountroot(); +#endif + int boottype = DV_DISK; + int tmp; + +#ifdef DEBUG + printf("bootdev 0x%08x boothowto 0x%08x\n", bootdev, boothowto); +#endif - if (boothowto & RB_DFLTROOT || - (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) - return; - majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK; - if (majdev > sizeof(devname) / sizeof(devname[0])) - return; - adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK; - part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK; - unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK; - /* - * First, find the controller type which supports this device. - * Next, find the controller of that type corresponding to - * the adaptor number. - * Finally, find the device in question attached to that controller. - */ - /* - * Form a new rootdev - */ - mindev = (unit << PARTITIONSHIFT) + part; - orootdev = rootdev; - rootdev = makedev(majdev, mindev); /* - * If the original rootdev is the same as the one - * just calculated, don't need to adjust the swap configuration. + * ignore DFLTROOT in the `swap generic' case. */ - if (rootdev == orootdev) - return; + if (boothowto & RB_DFLTROOT || + (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) + if (mountroot) + return; + + if (boothowto & RB_ASKNAME) { +#if 0 + char *devname; - printf("Changing root device to %c%c%d%c\n", - devname[majdev][0], devname[majdev][1], - mindev >> PARTITIONSHIFT, part + 'a'); - -#ifdef DOSWAP - mindev &= ~PARTITIONMASK; - for (swp = swdevt; swp->sw_dev != NODEV; swp++) { - if (majdev == major(swp->sw_dev) && - mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) { - temp = swdevt[0].sw_dev; - swdevt[0].sw_dev = swp->sw_dev; - swp->sw_dev = temp; - break; + majdev = B_TYPE(bootdev); + mindev = B_UNIT(bootdev); + name = searchname(majdev); + while (mindev == 0 + if (bootdv && bootdv->dv_class == DV_DISK) + printf("root device (default %sa)? ", + name); + else if (bootdv) + printf("root device (default %s)? ", + name); + else + printf("root device ? "); + len = getstr(buf, sizeof(buf)); + if (len == 0) { + if (!bootdv) + continue; + strcpy(buf, bootdv->dv_xname); + len = strlen(buf); + } + if (len > 0 && buf[len - 1] == '*') { + buf[--len] = '\0'; + dv = getdisk(buf, len, 1, &nrootdev); + if (dv != NULL) { + bootdv = dv; + nswapdev = nrootdev; + goto gotswap; + } + } + dv = getdisk(buf, len, 0, &nrootdev); + if (dv != NULL) { + bootdv = dv; + break; + } } - } - if (swp->sw_dev == NODEV) + /*XXXX remember to set boottype if we are a network device!! */ + + /* + * because swap must be on same device as root, for + * network devices this is easy. + * XXX: IS THIS STILL TRUE? + */ + if (bootdv->dv_class == DV_IFNET) { + goto gotswap; + } + for (;;) { + if (bootdv && bootdv->dv_class == DV_DISK) + printf("swap device (default %sb)? ", + bootdv->dv_xname); + else if (bootdv) + printf("swap device (default %s)? ", + bootdv->dv_xname); + else + printf("swap device ? "); + len = getstr(buf, sizeof(buf)); + if (len == 0) { + if (!bootdv) + continue; + switch (bootdv->dv_class) { + case DV_IFNET: + nswapdev = NODEV; + break; + case DV_DISK: + nswapdev = makedev(major(nrootdev), + (minor(nrootdev) & ~ PARTITIONMASK) | 1); + break; + } + break; + } + dv = getdisk(buf, len, 1, &nswapdev); + if (dv) { + if (dv->dv_class == DV_IFNET) + nswapdev = NODEV; + break; + } + } +gotswap: + rootdev = nrootdev; + dumpdev = nswapdev; + swdevt[0].sw_dev = nswapdev; + swdevt[1].sw_dev = NODEV; + /* XXX should ask for devices to boot from */ +#else + panic("RB_ASKNAME not implimented"); +#endif + } else if (mountroot == NULL) { + /* + * `swap generic': Use the device the boot program + * told us to use. This is a bit messy, since the ROM + * doesn't give us a standard dev_t. + * B_TYPE: 0 = disk, 1 = net + * B_ADAPTER: major # of disk device driver XXX + * B_UNIT: disk unit number + */ + if (B_TYPE(bootdev) == 0) { + /* + * Root and swap are on a disk. + * Assume that we are supposed to put root on + * partition a, and swap on partition b. + */ + switch (B_ADAPTOR(bootdev)) { + case 0: + majdev = 4; + break; + } + mindev = B_UNIT(bootdev) << PARTITIONSHIFT; + rootdev = makedev(majdev, mindev); + nswapdev = dumpdev = makedev(major(rootdev), + (minor(rootdev) & ~ PARTITIONMASK) | 1); + } else { + /* + * Root and swap are on a net. + * XXX we don't know which network device... + */ + nswapdev = dumpdev = NODEV; + boottype = DV_IFNET; + } + swdevt[0].sw_dev = nswapdev; + swdevt[1].sw_dev = NODEV; + } else { + /* + * `root DEV swap DEV': honour rootdev/swdevt. + * rootdev/swdevt/mountroot already properly set. + */ return; + } - /* - * If dumpdev was the same as the old primary swap - * device, move it to the new primary swap device. - */ - if (temp == dumpdev) - dumpdev = swdevt[0].sw_dev; + switch (boottype) { +#if defined(NFSCLIENT) + case DV_IFNET: + mountroot = nfs_mountroot; + nfsbootdevname = NULL; /* XXX don't know it */ + break; #endif +#if defined(FFS) + case DV_DISK: + mountroot = ffs_mountroot; + majdev = major(rootdev); + mindev = minor(rootdev); + printf("root on %s%d%c\n", blktonam(majdev), + mindev >> PARTITIONSHIFT, + (mindev & PARTITIONMASK) + 'a'); + break; +#endif + default: + printf("can't figure root, hope your kernel is right\n"); + break; + } } diff --git a/sys/arch/mvme68k/mvme68k/conf.c b/sys/arch/mvme68k/mvme68k/conf.c index 513db413e64..d29add6b706 100644 --- a/sys/arch/mvme68k/mvme68k/conf.c +++ b/sys/arch/mvme68k/mvme68k/conf.c @@ -1,6 +1,35 @@ -/* $NetBSD: conf.c,v 1.2 1995/08/17 17:40:54 thorpej Exp $ */ +/* $Id: conf.c,v 1.2 1995/11/07 08:50:16 deraadt Exp $ */ /*- + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1991 The Regents of the University of California. * All rights reserved. * @@ -45,23 +74,25 @@ int ttselect __P((dev_t, int, struct proc *)); -#ifdef LKM -int lkmenodev(); -#else -#define lkmenodev enodev -#endif - -#include "vnd.h" -bdev_decl(vnd); bdev_decl(sw); +#include "st.h" +bdev_decl(st); #include "sd.h" bdev_decl(sd); #include "cd.h" bdev_decl(cd); -#include "st.h" -bdev_decl(st); -#include "ccd.h" -bdev_decl(ccd); +#include "ch.h" +bdev_decl(ch); +#include "xd.h" +bdev_decl(xd); +#include "vnd.h" +bdev_decl(vnd); + +#ifdef LKM +int lkmenodev(); +#else +#define lkmenodev enodev +#endif struct bdevsw bdevsw[] = { @@ -71,19 +102,21 @@ struct bdevsw bdevsw[] = bdev_swap_init(1,sw), /* 3: swap pseudo-device */ bdev_disk_init(NSD,sd), /* 4: SCSI disk */ bdev_tape_init(NST,st), /* 5: SCSI tape */ - bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */ - bdev_disk_init(NCD,cd), /* 7: SCSI CD-ROM */ - bdev_notdef(), /* 8 */ - bdev_lkm_dummy(), /* 9 */ - bdev_lkm_dummy(), /* 10 */ - bdev_lkm_dummy(), /* 11 */ - bdev_lkm_dummy(), /* 12 */ + bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */ + bdev_notdef(), /* 7 */ + bdev_disk_init(NVND,vnd), /* 8: vnode disk driver */ + bdev_notdef(), /* 9 */ + bdev_disk_init(NXD,xd), /* 10: XD disk */ + bdev_notdef(), /* 11 */ + bdev_notdef(), /* 12 */ bdev_lkm_dummy(), /* 13 */ bdev_lkm_dummy(), /* 14 */ - bdev_disk_init(NCCD,ccd), /* 15: concatenated disk driver */ + bdev_lkm_dummy(), /* 15 */ + bdev_lkm_dummy(), /* 16 */ + bdev_lkm_dummy(), /* 17 */ + bdev_lkm_dummy(), /* 18 */ }; - -int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]); +int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); cdev_decl(cn); cdev_decl(ctty); @@ -92,6 +125,21 @@ cdev_decl(ctty); cdev_decl(mm); cdev_decl(sw); +#include "sram.h" +cdev_decl(sram); + +#include "vmel.h" +cdev_decl(vmel); + +#include "vmes.h" +cdev_decl(vmes); + +#include "nvram.h" +cdev_decl(nvram); + +#include "flash.h" +cdev_decl(flash); + #include "pty.h" #define ptstty ptytty #define ptsioctl ptyioctl @@ -99,29 +147,52 @@ cdev_decl(pts); #define ptctty ptytty #define ptcioctl ptyioctl cdev_decl(ptc); - cdev_decl(log); cdev_decl(fd); #include "zs.h" cdev_decl(zs); +#include "cl.h" +cdev_decl(cl); +#include "bugtty.h" +cdev_decl(bugtty); + +/* open, close, write, ioctl */ +#define cdev_lp_init(c,n) { \ + dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ + dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ + 0, seltrue, (dev_type_mmap((*))) enodev } + +/* open, close, ioctl, mmap, ioctl */ +#define cdev_mdev_init(c,n) { \ + dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ + dev_init(c,n,write), dev_init(c,n,ioctl), \ + (dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \ + dev_init(c,n,mmap) } + +#include "lp.h" +cdev_decl(lp); +#include "lptwo.h" +cdev_decl(lptwo); +cdev_decl(st); cdev_decl(sd); cdev_decl(cd); -cdev_decl(st); +cdev_decl(xd); cdev_decl(vnd); -cdev_decl(ccd); #include "bpfilter.h" cdev_decl(bpf); #include "tun.h" cdev_decl(tun); + #ifdef LKM #define NLKM 1 #else #define NLKM 0 #endif + cdev_decl(lkm); struct cdevsw cdevsw[] = @@ -133,17 +204,17 @@ struct cdevsw cdevsw[] = cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */ cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */ cdev_log_init(1,log), /* 6: /dev/klog */ - cdev_notdef(), /* 7 */ + cdev_mdev_init(NSRAM,sram), /* 7: /dev/sramX */ cdev_disk_init(NSD,sd), /* 8: SCSI disk */ cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */ - cdev_notdef(), /* 10 */ - cdev_notdef(), /* 11: parallel interface */ - cdev_tty_init(NZS,zs), /* 12: SCC serial ports */ - cdev_notdef(), /* 13 */ - cdev_notdef(), /* 14 */ + cdev_mdev_init(NNVRAM,nvram), /* 10: /dev/nvramX */ + cdev_mdev_init(NFLASH,flash), /* 11: /dev/flashX */ + cdev_tty_init(NZS,zs), /* 12: SCC serial (tty[a-d]) */ + cdev_tty_init(NCL,cl), /* 13: CL-CD2400 serial (tty0[0-3]) */ + cdev_tty_init(NBUGTTY,bugtty), /* 14: BUGtty (ttyB) */ cdev_notdef(), /* 15 */ cdev_notdef(), /* 16 */ - cdev_disk_init(NCCD,ccd), /* 17: concatenated disk driver */ + cdev_notdef(), /* 17: concatenated disk */ cdev_notdef(), /* 18 */ cdev_disk_init(NVND,vnd), /* 19: vnode disk */ cdev_tape_init(NST,st), /* 20: SCSI tape */ @@ -151,15 +222,22 @@ struct cdevsw cdevsw[] = cdev_bpftun_init(NBPFILTER,bpf),/* 22: berkeley packet filter */ cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */ cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */ - cdev_lkm_dummy(), /* 25 */ - cdev_lkm_dummy(), /* 26 */ - cdev_lkm_dummy(), /* 27 */ - cdev_lkm_dummy(), /* 28 */ - cdev_lkm_dummy(), /* 29 */ - cdev_lkm_dummy(), /* 30 */ + cdev_notdef(), /* 25 */ + cdev_disk_init(NXD,xd), /* 26: XD disk */ + cdev_notdef(), /* 27 */ + cdev_lp_init(NLP,lp), /* 28: lp */ + cdev_lp_init(NLPTWO,lptwo), /* 29: lptwo */ + cdev_notdef(), /* 30 */ + cdev_mdev_init(NVMEL,vmel), /* 31: /dev/vmelX */ + cdev_mdev_init(NVMES,vmes), /* 32: /dev/vmesX */ + cdev_lkm_dummy(), /* 33 */ + cdev_lkm_dummy(), /* 34 */ + cdev_lkm_dummy(), /* 35 */ + cdev_lkm_dummy(), /* 36 */ + cdev_lkm_dummy(), /* 37 */ + cdev_lkm_dummy(), /* 38 */ }; - -int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]); +int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); int mem_no = 2; /* major device number of memory special file */ @@ -194,33 +272,6 @@ iszerodev(dev) return (major(dev) == mem_no && minor(dev) == 12); } -/* - * Returns true if dev is a disk device. - */ -isdisk(dev, type) - dev_t dev; - int type; -{ - - /* XXXX This needs to be dynamic for LKMs. */ - switch (major(dev)) { - case 1: - case 2: - case 4: - case 6: - case 15: - return (type == VBLK); - case 8: - case 9: - case 10: - case 17: - case 19: - return (type == VCHR); - default: - return (0); - } -} - static int chrtoblktbl[] = { /* XXXX This needs to be dynamic for LKMs. */ /*VCHR*/ /*VBLK*/ @@ -232,8 +283,8 @@ static int chrtoblktbl[] = { /* 5 */ NODEV, /* 6 */ NODEV, /* 7 */ NODEV, - /* 8 */ 4, - /* 9 */ 7, + /* 8 */ 4, /* SCSI disk */ + /* 9 */ 6, /* SCSI CD-ROM */ /* 10 */ NODEV, /* 11 */ NODEV, /* 12 */ NODEV, @@ -241,12 +292,16 @@ static int chrtoblktbl[] = { /* 14 */ NODEV, /* 15 */ NODEV, /* 16 */ NODEV, - /* 17 */ 15, + /* 17 */ NODEV, /* 18 */ NODEV, - /* 19 */ 6, + /* 19 */ 8, /* vnode disk */ /* 20 */ NODEV, /* 21 */ NODEV, /* 22 */ NODEV, + /* 23 */ NODEV, + /* 24 */ NODEV, + /* 25 */ NODEV, + /* 26 */ 10, /* XD disk */ }; /* @@ -257,7 +312,8 @@ chrtoblk(dev) { int blkmaj; - if (major(dev) >= nchrdev) + if (major(dev) >= nchrdev || + major(dev) >= sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0])) return (NODEV); blkmaj = chrtoblktbl[major(dev)]; if (blkmaj == NODEV) @@ -275,10 +331,20 @@ chrtoblk(dev) #define zscnpollc nullcnpollc cons_decl(zs); +#define clcnpollc nullcnpollc +cons_decl(cl); +#define bugttycnpollc nullcnpollc +cons_decl(bugtty); struct consdev constab[] = { #if NZS > 0 cons_init(zs), #endif +#if NCL > 0 + cons_init(cl), +#endif +#if NBUGTTY > 0 + cons_init(bugtty), +#endif { 0 }, }; diff --git a/sys/arch/mvme68k/mvme68k/dkbad.c b/sys/arch/mvme68k/mvme68k/dkbad.c index 686bc109912..dd20c1aca01 100644 --- a/sys/arch/mvme68k/mvme68k/dkbad.c +++ b/sys/arch/mvme68k/mvme68k/dkbad.c @@ -1,4 +1,4 @@ -/* $NetBSD: dkbad.c,v 1.1.1.1 1995/07/25 23:11:57 chuck Exp $ */ +/* $Id: dkbad.c,v 1.2 1995/11/07 08:50:17 deraadt Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 diff --git a/sys/arch/mvme68k/mvme68k/genassym.c b/sys/arch/mvme68k/mvme68k/genassym.c index ab87485ae4b..328f986cde6 100644 --- a/sys/arch/mvme68k/mvme68k/genassym.c +++ b/sys/arch/mvme68k/mvme68k/genassym.c @@ -1,6 +1,35 @@ -/* $NetBSD: genassym.c,v 1.1.1.1 1995/07/25 23:11:57 chuck Exp $ */ +/* $Id: genassym.c,v 1.2 1995/11/07 08:50:18 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1982, 1990, 1993 * The Regents of the University of California. All rights reserved. * @@ -53,9 +82,11 @@ #include <machine/cpu.h> #include <machine/trap.h> #include <machine/psl.h> +#include <machine/nvram.h> #include <machine/reg.h> +#include <machine/autoconf.h> +#include <machine/prom.h> #include <machine/pte.h> -#include <mvme68k/mvme68k/clockreg.h> #include <vm/vm.h> #include <errno.h> @@ -66,6 +97,24 @@ extern int errno; +#if defined(MVME162) || defined(MVME167) +#ifndef M68040 +#error "MVME162/MVME167 requires M68040 support" +#endif +#endif + +#if defined(MVME147) +#ifndef M68030 +#error "MVME147 requires M68030 support" +#endif +#endif + +#if defined(MVME172) || defined(MVME177) +#ifndef M68060 +#error "MVME172/MVME177 requires M68060 support" +#endif +#endif + void def(what, val) char *what; @@ -158,8 +207,6 @@ main() /* magic */ def("FC_USERD", FC_USERD); - def("INTIOBASE", INTIOBASE); - def("IIOMAPSIZE", IIOMAPSIZE); def("EIOMAPSIZE", EIOMAPSIZE); def("CACHE_ON", CACHE_ON); def("CACHE_OFF", CACHE_OFF); @@ -189,6 +236,7 @@ main() off("PCB_ONFAULT", struct pcb, pcb_onfault); off("PCB_FPCTX", struct pcb, pcb_fpregs); def("SIZEOF_PCB", sizeof(struct pcb)); + def("SIZEOF_TRAPFRAME", sizeof(struct trapframe)); /* exception frame offset/sizes */ off("FR_SP", struct frame, f_regs[15]); @@ -204,5 +252,35 @@ main() def("EFAULT", EFAULT); def("ENAMETOOLONG", ENAMETOOLONG); + def("SIZEOF_MVMEPROM_BRDID", sizeof(struct mvmeprom_brdid)); + off("MVMEPROM_BRDID_MODEL", struct mvmeprom_brdid, model); + + off("NVRAM_147_ETHER", struct nvram_147, ether); + off("NVRAM_147_EMEM", struct nvram_147, emem); + + off("NVRAM_16X_ETHER", struct nvram_16x, conf.ether); + + def("INTIOBASE_147", INTIOBASE_147); + def("INTIOBASE_162", INTIOBASE_162); + def("INTIOSIZE_147", INTIOSIZE_147); + def("INTIOSIZE_162", INTIOSIZE_162); + + def("CPU_147", CPU_147); + def("CPU_162", CPU_162); + def("CPU_166", CPU_166); + def("CPU_167", CPU_167); + def("CPU_172", CPU_172); + def("CPU_177", CPU_177); + + def("MMU_68851", MMU_68851); + def("MMU_68030", MMU_68030); + def("MMU_68040", MMU_68040); + + off("NETCTRL_DEV", struct prom_netctrl, dev); + off("NETCTRL_CTRL", struct prom_netctrl, ctrl); + off("NETCTRL_CMD", struct prom_netctrl, cmd); + off("NETCTRL_ADDR", struct prom_netctrl, addr); + off("NETCTRL_LEN", struct prom_netctrl, len); + exit(0); } diff --git a/sys/arch/mvme68k/mvme68k/locore.s b/sys/arch/mvme68k/mvme68k/locore.s index 0686489cb2c..a3a64859e3c 100644 --- a/sys/arch/mvme68k/mvme68k/locore.s +++ b/sys/arch/mvme68k/mvme68k/locore.s @@ -1,7 +1,35 @@ -/* $NetBSD: locore.s,v 1.40 1995/05/12 18:24:46 mycroft Exp $ */ +/* $Id: locore.s,v 1.4 1995/11/07 08:50:19 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1988 University of Utah. * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index 39d78959611..f16899d4486 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,7 +1,35 @@ -/* $NetBSD: machdep.c,v 1.48 1995/05/16 14:34:19 mycroft Exp $ */ +/* $Id: machdep.c,v 1.3 1995/11/07 08:50:20 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. diff --git a/sys/arch/mvme68k/mvme68k/mem.c b/sys/arch/mvme68k/mvme68k/mem.c index 52d8123a24c..4330f7a459f 100644 --- a/sys/arch/mvme68k/mvme68k/mem.c +++ b/sys/arch/mvme68k/mvme68k/mem.c @@ -1,6 +1,35 @@ -/* $NetBSD: mem.c,v 1.1.1.1 1995/07/25 23:11:58 chuck Exp $ */ +/* $Id: mem.c,v 1.2 1995/11/07 08:50:22 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -118,7 +147,7 @@ mmrw(dev, uio, flags) v = uio->uio_offset; #ifndef DEBUG /* allow reads only in RAM (except for DEBUG) */ - if (v >= 0xFFFFFFFC || v < lowram) { + if (v >= 0xFFFFFFFC || v < lowram || v < NBPG) { error = EFAULT; goto unlock; } @@ -216,7 +245,8 @@ mmmmap(dev, off, prot) * XXX could be extended to allow access to IO space but must * be very careful. */ - if ((unsigned)off < lowram || (unsigned)off >= 0xFFFFFFFC) + if ((unsigned)off < lowram || (unsigned)off >= 0xFFFFFFFC || + (unsigned)off < NBPG) return (-1); return (m68k_btop(off)); } diff --git a/sys/arch/mvme68k/mvme68k/pmap.c b/sys/arch/mvme68k/mvme68k/pmap.c index 08f720028f3..c9cb8582760 100644 --- a/sys/arch/mvme68k/mvme68k/pmap.c +++ b/sys/arch/mvme68k/mvme68k/pmap.c @@ -1,6 +1,35 @@ -/* $NetBSD: pmap.c,v 1.1.1.1.2.1 1995/10/12 20:01:16 chuck Exp $ */ +/* $Id: pmap.c,v 1.2 1995/11/07 08:50:23 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * @@ -40,13 +69,12 @@ */ /* - * HP9000/300 series physical map management code. + * m68k series physical map management code. * * Supports: - * 68020 with HP MMU models 320, 350 - * 68020 with 68551 MMU models 318, 319, 330 (all untested) - * 68030 with on-chip MMU models 340, 360, 370, 345, 375, 400 - * 68040 with on-chip MMU models 380, 425, 433 + * XXX 68020 with 68551 MMU + * 68030 with on-chip MMU + * 68040 with on-chip MMU * * Notes: * Don't even pay lip service to multiprocessor support. @@ -176,14 +204,6 @@ int pmapdebug = 0x2000; #define PDB_WIRING 0x4000 #define PDB_PVDUMP 0x8000 -#ifdef HAVEVAC -int pmapvacflush = 0; -#define PVF_ENTER 0x01 -#define PVF_REMOVE 0x02 -#define PVF_PROTECT 0x04 -#define PVF_TOTAL 0x80 -#endif - #if defined(M68040) int dowriteback = 1; /* 68040: enable writeback caching */ int dokwriteback = 1; /* 68040: enable writeback caching of kernel AS */ @@ -281,9 +301,6 @@ char *pmap_attributes; /* reference and modify bits */ TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist; int pv_nfree; -#ifdef HAVEVAC -int pmap_aliasmask; /* seperation at which VA aliasing ok */ -#endif #if defined(M68040) int protostfree; /* prototype (default) free ST map */ #endif @@ -331,7 +348,7 @@ pmap_bootstrap_alloc(size) avail_start + size, VM_PROT_READ|VM_PROT_WRITE); avail_start += size; - bzero ((caddr_t) val, size); + bzero((void *)val, size); return ((void *) val); } @@ -358,13 +375,13 @@ pmap_init(phys_start, phys_end) */ addr = (vm_offset_t) intiobase; (void) vm_map_find(kernel_map, NULL, (vm_offset_t) 0, - &addr, m68k_ptob(IIOMAPSIZE+EIOMAPSIZE), FALSE); + &addr, m68k_ptob(iiomapsize+EIOMAPSIZE), FALSE); if (addr != (vm_offset_t)intiobase) goto bogons; addr = (vm_offset_t) Sysmap; vm_object_reference(kernel_object); (void) vm_map_find(kernel_map, kernel_object, addr, - &addr, HP_MAX_PTSIZE, FALSE); + &addr, M68K_MAX_PTSIZE, FALSE); /* * If this fails it is probably because the static portion of * the kernel page table isn't big enough and we overran the @@ -388,12 +405,12 @@ bogons: * initial segment table, pv_head_table and pmap_attributes. */ npages = atop(phys_end - phys_start); - s = (vm_size_t) (HP_STSIZE + sizeof(struct pv_entry) * npages + npages); + s = (vm_size_t) (M68K_STSIZE + sizeof(struct pv_entry) * npages + npages); s = round_page(s); addr = (vm_offset_t) kmem_alloc(kernel_map, s); Segtabzero = (st_entry_t *) addr; Segtabzeropa = (st_entry_t *) pmap_extract(pmap_kernel(), addr); - addr += HP_STSIZE; + addr += M68K_STSIZE; pv_table = (struct pv_entry *) addr; addr += sizeof(struct pv_entry) * npages; pmap_attributes = (char *) addr; @@ -408,7 +425,7 @@ bogons: * Allocate physical memory for kernel PT pages and their management. * We need 1 PT page per possible task plus some slop. */ - npages = min(atop(HP_MAX_KPTSIZE), maxproc+16); + npages = min(atop(M68K_MAX_KPTSIZE), maxproc+16); s = ptoa(npages) + round_page(npages * sizeof(struct kpt_page)); /* @@ -449,15 +466,15 @@ bogons: /* * Allocate the segment table map */ - s = maxproc * HP_STSIZE; + s = maxproc * M68K_STSIZE; st_map = kmem_suballoc(kernel_map, &addr, &addr2, s, TRUE); /* * Slightly modified version of kmem_suballoc() to get page table * map where we want it. */ - addr = HP_PTBASE; - s = min(HP_PTMAXSIZE, maxproc*HP_MAX_PTSIZE); + addr = M68K_PTBASE; + s = min(M68K_PTMAXSIZE, maxproc*M68K_MAX_PTSIZE); addr2 = addr + s; rv = vm_map_find(kernel_map, NULL, 0, &addr, s, TRUE); if (rv != KERN_SUCCESS) @@ -754,10 +771,10 @@ pmap_release(pmap) if (pmap->pm_ptab) kmem_free_wakeup(pt_map, (vm_offset_t)pmap->pm_ptab, - HP_MAX_PTSIZE); + M68K_MAX_PTSIZE); if (pmap->pm_stab != Segtabzero) kmem_free_wakeup(st_map, (vm_offset_t)pmap->pm_stab, - HP_STSIZE); + M68K_STSIZE); } /* @@ -836,7 +853,7 @@ pmap_remove(pmap, sva, eva) needcflush = FALSE; flags = active_pmap(pmap) ? PRM_TFLUSH : 0; while (sva < eva) { - nssva = m68k_trunc_seg(sva) + HP_SEG_SIZE; + nssva = m68k_trunc_seg(sva) + M68K_SEG_SIZE; if (nssva == 0 || nssva > eva) nssva = eva; /* @@ -853,29 +870,6 @@ pmap_remove(pmap, sva, eva) pte = pmap_pte(pmap, sva); while (sva < nssva) { if (pmap_pte_v(pte)) { -#ifdef HAVEVAC - if (pmap_aliasmask) { - /* - * Purge kernel side of VAC to ensure - * we get the correct state of any - * hardware maintained bits. - */ - if (firstpage) { - DCIS(); -#ifdef PMAPSTATS - remove_stats.sflushes++; -#endif - } - /* - * Remember if we may need to - * flush the VAC due to a non-CI - * mapping. - */ - if (!needcflush && !pmap_pte_ci(pte)) - needcflush = TRUE; - - } -#endif pmap_remove_mapping(pmap, sva, pte, flags); firstpage = FALSE; } @@ -888,42 +882,6 @@ pmap_remove(pmap, sva, eva) */ if (firstpage) return; -#ifdef HAVEVAC - /* - * In a couple of cases, we don't need to worry about flushing - * the VAC: - * 1. if this is a kernel mapping, - * we have already done it - * 2. if it is a user mapping not for the current process, - * it won't be there - */ - if (pmap_aliasmask && - (pmap == pmap_kernel() || pmap != curproc->p_vmspace->vm_map.pmap)) - needcflush = FALSE; -#ifdef DEBUG - if (pmap_aliasmask && (pmapvacflush & PVF_REMOVE)) { - if (pmapvacflush & PVF_TOTAL) - DCIA(); - else if (pmap == pmap_kernel()) - DCIS(); - else - DCIU(); - } else -#endif - if (needcflush) { - if (pmap == pmap_kernel()) { - DCIS(); -#ifdef PMAPSTATS - remove_stats.sflushes++; -#endif - } else { - DCIU(); -#ifdef PMAPSTATS - remove_stats.uflushes++; -#endif - } - } -#endif } /* @@ -1023,7 +981,7 @@ pmap_protect(pmap, sva, eva, prot) needtflush = active_pmap(pmap); firstpage = TRUE; while (sva < eva) { - nssva = m68k_trunc_seg(sva) + HP_SEG_SIZE; + nssva = m68k_trunc_seg(sva) + M68K_SEG_SIZE; if (nssva == 0 || nssva > eva) nssva = eva; /* @@ -1041,18 +999,6 @@ pmap_protect(pmap, sva, eva, prot) pte = pmap_pte(pmap, sva); while (sva < nssva) { if (pmap_pte_v(pte) && pmap_pte_prot_chg(pte, isro)) { -#ifdef HAVEVAC - /* - * Purge kernel side of VAC to ensure we - * get the correct state of any hardware - * maintained bits. - * - * XXX do we need to clear the VAC in - * general to reflect the new protection? - */ - if (firstpage && pmap_aliasmask) - DCIS(); -#endif #if defined(M68040) /* * Clear caches if making RO (see section @@ -1085,16 +1031,6 @@ pmap_protect(pmap, sva, eva, prot) sva += NBPG; } } -#if defined(HAVEVAC) && defined(DEBUG) - if (pmap_aliasmask && (pmapvacflush & PVF_PROTECT)) { - if (pmapvacflush & PVF_TOTAL) - DCIA(); - else if (pmap == pmap_kernel()) - DCIS(); - else - DCIU(); - } -#endif } /* @@ -1142,7 +1078,7 @@ pmap_enter(pmap, va, pa, prot, wired) */ if (pmap->pm_ptab == NULL) pmap->pm_ptab = (pt_entry_t *) - kmem_alloc_wait(pt_map, HP_MAX_PTSIZE); + kmem_alloc_wait(pt_map, M68K_MAX_PTSIZE); /* * Segment table entry not valid, we need a new PT page @@ -1279,56 +1215,6 @@ pmap_enter(pmap, va, pa, prot, wired) if (!npv->pv_next) enter_stats.secondpv++; #endif -#ifdef HAVEVAC - /* - * Since there is another logical mapping for the - * same page we may need to cache-inhibit the - * descriptors on those CPUs with external VACs. - * We don't need to CI if: - * - * - No two mappings belong to the same user pmaps. - * Since the cache is flushed on context switches - * there is no problem between user processes. - * - * - Mappings within a single pmap are a certain - * magic distance apart. VAs at these appropriate - * boundaries map to the same cache entries or - * otherwise don't conflict. - * - * To keep it simple, we only check for these special - * cases if there are only two mappings, otherwise we - * punt and always CI. - * - * Note that there are no aliasing problems with the - * on-chip data-cache when the WA bit is set. - */ - if (pmap_aliasmask) { - if (pv->pv_flags & PV_CI) { -#ifdef DEBUG - if (pmapdebug & PDB_CACHE) - printf("enter: pa %x already CI'ed\n", - pa); -#endif - checkpv = cacheable = FALSE; - } else if (npv->pv_next || - ((pmap == pv->pv_pmap || - pmap == pmap_kernel() || - pv->pv_pmap == pmap_kernel()) && - ((pv->pv_va & pmap_aliasmask) != - (va & pmap_aliasmask)))) { -#ifdef DEBUG - if (pmapdebug & PDB_CACHE) - printf("enter: pa %x CI'ing all\n", - pa); -#endif - cacheable = FALSE; - pv->pv_flags |= PV_CI; -#ifdef PMAPSTATS - enter_stats.ci++; -#endif - } - } -#endif } splx(s); } @@ -1351,14 +1237,6 @@ pmap_enter(pmap, va, pa, prot, wired) pmap->pm_stats.wired_count++; validate: -#ifdef HAVEVAC - /* - * Purge kernel side of VAC to ensure we get correct state - * of HW bits so we don't clobber them. - */ - if (pmap_aliasmask) - DCIS(); -#endif /* * Build the new PTE. */ @@ -1392,37 +1270,6 @@ validate: *pte = npte; if (!wired && active_pmap(pmap)) TBIS(va); -#ifdef HAVEVAC - /* - * The following is executed if we are entering a second - * (or greater) mapping for a physical page and the mappings - * may create an aliasing problem. In this case we must - * cache inhibit the descriptors involved and flush any - * external VAC. - */ - if (checkpv && !cacheable) { - pmap_changebit(pa, PG_CI, TRUE); - DCIA(); -#ifdef PMAPSTATS - enter_stats.flushes++; -#endif -#ifdef DEBUG - if ((pmapdebug & (PDB_CACHE|PDB_PVDUMP)) == - (PDB_CACHE|PDB_PVDUMP)) - pmap_pvdump(pa); -#endif - } -#ifdef DEBUG - else if (pmapvacflush & PVF_ENTER) { - if (pmapvacflush & PVF_TOTAL) - DCIA(); - else if (pmap == pmap_kernel()) - DCIS(); - else - DCIU(); - } -#endif -#endif #ifdef DEBUG if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) pmap_check_wiring("enter", trunc_page(pmap_pte(pmap, va))); @@ -1608,7 +1455,7 @@ pmap_collect(pmap) continue; #ifdef DEBUG if (pv->pv_va < (vm_offset_t)Sysmap || - pv->pv_va >= (vm_offset_t)Sysmap + HP_MAX_PTSIZE) + pv->pv_va >= (vm_offset_t)Sysmap + M68K_MAX_PTSIZE) printf("collect: kernel PT VA out of range\n"); else goto ok; @@ -1973,30 +1820,6 @@ pmap_remove_mapping(pmap, va, pte, flags) if (*pte == PG_NV) return; } -#ifdef HAVEVAC - if (pmap_aliasmask && (flags & PRM_CFLUSH)) { - /* - * Purge kernel side of VAC to ensure we get the correct - * state of any hardware maintained bits. - */ - DCIS(); -#ifdef PMAPSTATS - remove_stats.sflushes++; -#endif - /* - * If this is a non-CI user mapping for the current process, - * flush the VAC. Note that the kernel side was flushed - * above so we don't worry about non-CI kernel mappings. - */ - if (pmap == curproc->p_vmspace->vm_map.pmap && - !pmap_pte_ci(pte)) { - DCIU(); -#ifdef PMAPSTATS - remove_stats.uflushes++; -#endif - } - } -#endif pa = pmap_pte_pa(pte); #ifdef DEBUG opte = *pte; @@ -2087,25 +1910,6 @@ pmap_remove_mapping(pmap, va, pte, flags) pmap_free_pv(npv); pv = pa_to_pvh(pa); } -#ifdef HAVEVAC - /* - * If only one mapping left we no longer need to cache inhibit - */ - if (pmap_aliasmask && - pv->pv_pmap && pv->pv_next == NULL && (pv->pv_flags & PV_CI)) { -#ifdef DEBUG - if (pmapdebug & PDB_CACHE) - printf("remove: clearing CI for pa %x\n", pa); -#endif - pv->pv_flags &= ~PV_CI; - pmap_changebit(pa, PG_CI, FALSE); -#ifdef DEBUG - if ((pmapdebug & (PDB_CACHE|PDB_PVDUMP)) == - (PDB_CACHE|PDB_PVDUMP)) - pmap_pvdump(pa); -#endif - } -#endif /* * If this was a PT page we must also remove the * mapping from the associated segment table. @@ -2153,7 +1957,7 @@ pmap_remove_mapping(pmap, va, pte, flags) #endif kmem_free_wakeup(st_map, (vm_offset_t)ptpmap->pm_stab, - HP_STSIZE); + M68K_STSIZE); ptpmap->pm_stab = Segtabzero; ptpmap->pm_stpa = Segtabzeropa; #if defined(M68040) @@ -2218,13 +2022,6 @@ pmap_testbit(pa, bit) splx(s); return(TRUE); } -#ifdef HAVEVAC - /* - * Flush VAC to get correct state of any hardware maintained bits. - */ - if (pmap_aliasmask && (bit & (PG_U|PG_M))) - DCIS(); -#endif /* * Not found, check current mappings returning * immediately if found. @@ -2305,16 +2102,6 @@ pmap_changebit(pa, bit, setem) } pte = pmap_pte(pv->pv_pmap, va); -#ifdef HAVEVAC - /* - * Flush VAC to ensure we get correct state of HW bits - * so we don't clobber them. - */ - if (firstpage && pmap_aliasmask) { - firstpage = FALSE; - DCIS(); - } -#endif if (setem) npte = *pte | bit; else @@ -2353,16 +2140,6 @@ pmap_changebit(pa, bit, setem) } #endif } -#if defined(HAVEVAC) && defined(DEBUG) - if (setem && bit == PG_RO && (pmapvacflush & PVF_PROTECT)) { - if ((pmapvacflush & PVF_TOTAL) || toflush == 3) - DCIA(); - else if (toflush == 2) - DCIS(); - else - DCIU(); - } -#endif } splx(s); } @@ -2394,7 +2171,7 @@ pmap_enter_ptpage(pmap, va) */ if (pmap->pm_stab == Segtabzero) { pmap->pm_stab = (st_entry_t *) - kmem_alloc(st_map, HP_STSIZE); + kmem_alloc(st_map, M68K_STSIZE); pmap->pm_stpa = (st_entry_t *) pmap_extract(pmap_kernel(), (vm_offset_t)pmap->pm_stab); #if defined(M68040) @@ -2509,6 +2286,11 @@ pmap_enter_ptpage(pmap, va) * letting the VM system allocate a zero-filled page. */ else { + /* + * Count the segment table reference now so that we won't + * lose the segment table when low on memory. + */ + pmap->pm_sref++; #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) printf("enter: about to fault UPT pg at %x\n", va); @@ -2563,8 +2345,21 @@ pmap_enter_ptpage(pmap, va) } while (pv = pv->pv_next); } #ifdef DEBUG - if (pv == NULL) + if (pv == NULL) { + pv = pa_to_pvh(ptpa); + if (pv) { + printf("pv->pv_next = %x\n", pv->pv_next); + do { + printf("pmap %x va %x ptste %x ptpmap %x flags %x\n", + pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap, + pv->pv_flags); + if (pv->pv_pmap == pmap_kernel() && pv->pv_va == va) + break; + } while (pv = pv->pv_next); + } else + printf("pv at ptpa is 0\n"); panic("pmap_enter_ptpage: PT page not entered"); + } #endif pv->pv_ptste = ste; pv->pv_ptpmap = pmap; @@ -2593,7 +2388,6 @@ pmap_enter_ptpage(pmap, va) #endif *ste = (ptpa & SG_FRAME) | SG_RW | SG_V; if (pmap != pmap_kernel()) { - pmap->pm_sref++; #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) printf("enter: stab %x refcnt %d\n", diff --git a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c index bdd0064289a..af5996e3474 100644 --- a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c +++ b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c @@ -1,6 +1,35 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.1.1.1 1995/07/25 23:12:02 chuck Exp $ */ +/* $Id: pmap_bootstrap.c,v 1.2 1995/11/07 08:50:24 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * @@ -42,9 +71,9 @@ #include <sys/param.h> #include <sys/msgbuf.h> #include <machine/pte.h> -#include <mvme68k/mvme68k/clockreg.h> #include <machine/vmparam.h> #include <machine/cpu.h> +#include <machine/autoconf.h> #include <vm/vm.h> @@ -53,6 +82,8 @@ extern char *etext; extern int Sysptsize; extern char *extiobase, *proc0paddr; +char *iiomapbase; +int iiomapsize; extern st_entry_t *Sysseg; extern pt_entry_t *Sysptmap, *Sysmap; @@ -60,9 +91,6 @@ extern int maxmem, physmem; extern vm_offset_t avail_start, avail_end, virtual_avail, virtual_end; extern vm_size_t mem_size; extern int protection_codes[]; -#ifdef HAVEVAC -extern int pmap_aliasmask; -#endif /* * Special purpose kernel virtual addresses, used for mapping @@ -75,7 +103,9 @@ extern int pmap_aliasmask; */ caddr_t CADDR1, CADDR2, vmmap, ledbase; struct msgbuf *msgbufp; -extern void *ledatabuf; /* XXXCDC */ +#define ETHERPAGES 16 +void *etherbuf; +int etherlen; /* * Bootstrap the VM system. @@ -108,12 +138,12 @@ pmap_bootstrap(nextpa, firstpa) * kernel PT pages Sysptsize+ pages * * iiopa internal IO space - * PT pages IIOMAPSIZE pages + * PT pages iiomapsize pages * * eiopa external IO space * PT pages EIOMAPSIZE pages * - * [ Sysptsize is the number of pages of PT, IIOMAPSIZE and + * [ Sysptsize is the number of pages of PT, iiomapsize and * EIOMAPSIZE are the number of PTEs, hence we need to round * the total to a page boundary with IO maps at the end. ] * @@ -134,20 +164,19 @@ pmap_bootstrap(nextpa, firstpa) nextpa += kstsize * NBPG; kptpa = nextpa; nptpages = RELOC(Sysptsize, int) + - (IIOMAPSIZE + EIOMAPSIZE + NPTEPG - 1) / NPTEPG; + (RELOC(iiomapsize, int) + EIOMAPSIZE + NPTEPG - 1) / NPTEPG; nextpa += nptpages * NBPG; eiopa = nextpa - EIOMAPSIZE * sizeof(pt_entry_t); - iiopa = eiopa - IIOMAPSIZE * sizeof(pt_entry_t); + iiopa = eiopa - RELOC(iiomapsize, int) * sizeof(pt_entry_t); kptmpa = nextpa; nextpa += NBPG; lkptpa = nextpa; nextpa += NBPG; p0upa = nextpa; nextpa += USPACE; - { /* XXXCDC */ - ledatabuf = (void *)nextpa; - nextpa += 4 * NBPG; - } /* XXXCDC */ + + RELOC(etherbuf, void *) = (void *)nextpa; + nextpa += ETHERPAGES * NBPG; /* * Initialize segment table and kernel page table map. @@ -244,6 +273,13 @@ pmap_bootstrap(nextpa, firstpa) *pte++ = protopte; protopte += NBPG; } + /* + * Invalidate all but the last remaining entries in both. + */ + epte = &((u_int *)kptmpa)[NPTEPG-1]; + while (pte < epte) { + *pte++ = PG_NV; + } pte = &((u_int *)kptmpa)[NPTEPG-1]; *pte = lkptpa | PG_RW | PG_CI | PG_V; } else { @@ -309,6 +345,8 @@ pmap_bootstrap(nextpa, firstpa) #else protopte = firstpa | PG_RO | PG_V; #endif + *pte++ = firstpa | PG_NV; /* make *NULL fail in the kernel */ + protopte += NBPG; while (pte < epte) { *pte++ = protopte; protopte += NBPG; @@ -329,14 +367,19 @@ pmap_bootstrap(nextpa, firstpa) *pte++ = protopte; protopte += NBPG; } - { /* XXXCDC -- uncache lebuf */ - u_int *lepte = &((u_int *)kptpa)[m68k_btop(ledatabuf)]; - lepte[0] = lepte[0] | PG_CI; - lepte[1] = lepte[1] | PG_CI; - lepte[2] = lepte[2] | PG_CI; - lepte[3] = lepte[3] | PG_CI; - } /* XXXCDC yuck */ + pte = &((u_int *)kptpa)[m68k_btop(etherbuf)]; + epte = pte + ETHERPAGES; + if (RELOC(mmutype, int) == MMU_68040) + while (pte < epte) { + *pte = (*pte & ~PG_CMASK) | PG_CIS; + pte++; + } + else + while (pte < epte) { + *pte++ |= PG_CI; + } + RELOC(etherlen, int) = ETHERPAGES * NBPG; /* * Finally, validate the internal IO space PTEs (RW+CI). @@ -347,7 +390,7 @@ pmap_bootstrap(nextpa, firstpa) */ pte = (u_int *)iiopa; epte = (u_int *)eiopa; - protopte = INTIOBASE | PG_RW | PG_CI | PG_V; + protopte = RELOC(iiomapbase, int) | PG_RW | PG_CI | PG_V; while (pte < epte) { *pte++ = protopte; protopte += NBPG; @@ -374,13 +417,13 @@ pmap_bootstrap(nextpa, firstpa) (pt_entry_t *)m68k_ptob(nptpages * NPTEPG); /* * intiobase, intiolimit: base and end of internal (DIO) IO space. - * IIOMAPSIZE pages prior to external IO space at end of static + * iiomapsize pages prior to external IO space at end of static * kernel page table. */ - RELOC(intiobase, char *) = - (char *)m68k_ptob(nptpages*NPTEPG - (IIOMAPSIZE+EIOMAPSIZE)); - RELOC(intiolimit, char *) = - (char *)m68k_ptob(nptpages*NPTEPG - EIOMAPSIZE); + RELOC(intiobase, char *) = (char *) + m68k_ptob(nptpages*NPTEPG - (RELOC(iiomapsize, int)+EIOMAPSIZE)); + RELOC(intiolimit, char *) = (char *) + m68k_ptob(nptpages*NPTEPG - EIOMAPSIZE); /* * extiobase: base of external (DIO-II) IO space. * EIOMAPSIZE pages at the end of the static kernel page table. @@ -419,17 +462,6 @@ pmap_bootstrap(nextpa, firstpa) VM_MIN_KERNEL_ADDRESS + (nextpa - firstpa); RELOC(virtual_end, vm_offset_t) = VM_MAX_KERNEL_ADDRESS; -#ifdef HAVEVAC - /* - * Determine VA aliasing distance if any - */ - if (RELOC(ectype, int) == EC_VIRT) - if (RELOC(machineid, int) == HP_320) - RELOC(pmap_aliasmask, int) = 0x3fff; /* 16k */ - else if (RELOC(machineid, int) == HP_350) - RELOC(pmap_aliasmask, int) = 0x7fff; /* 32k */ -#endif - /* * Initialize protection array. * XXX don't use a switch statement, it might produce an diff --git a/sys/arch/mvme68k/mvme68k/swapgeneric.c b/sys/arch/mvme68k/mvme68k/swapgeneric.c index a48e0954402..18e5af831d3 100644 --- a/sys/arch/mvme68k/mvme68k/swapgeneric.c +++ b/sys/arch/mvme68k/mvme68k/swapgeneric.c @@ -1,8 +1,8 @@ -/* $NetBSD: swapgeneric.c,v 1.1.1.1 1995/07/25 23:12:00 chuck Exp $ */ +/* $Id: swapgeneric.c,v 1.2 1995/11/07 08:50:25 deraadt Exp $ */ -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. +/*- + * Copyright (c) 1994 + * The 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 @@ -14,8 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -32,139 +32,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)swapgeneric.c 7.5 (Berkeley) 5/7/91 + * @(#)swapgeneric.c 8.2 (Berkeley) 3/21/94 + */ + +/* + * fake swapgeneric.c -- should do this differently. */ #include <sys/param.h> #include <sys/conf.h> -#include <sys/buf.h> -#include <sys/systm.h> -#include <sys/reboot.h> -#include <sys/device.h> -/* - * Generic configuration; all in one - */ +int (*mountroot)() = NULL; /* tells autoconf.c that we are "generic" */ + dev_t rootdev = NODEV; -dev_t argdev = NODEV; dev_t dumpdev = NODEV; -int nswap; -struct swdevt swdevt[] = { - { -1, 1, 0 }, - { 0, 0, 0 }, -}; -int dmmin, dmmax, dmtext; - -extern struct cfdriver sdcd; -extern struct cfdriver wdcd; -extern struct cfdriver idcd; -struct genericconf { - struct cfdriver *gc_driver; - char *gc_name; - dev_t gc_root; -} genericconf[] = { - { &sdcd, "sd", makedev(1, 0), }, - { &wdcd, "wd", makedev(2, 0), }, - { &idcd, "id", makedev(4, 0), }, - { 0 }, +struct swdevt swdevt[] = { + { makedev(7, 1), 0, 0 }, /* sd0b */ + { NODEV, 0, 0 } }; - -extern int ffs_mountroot(); -int (*mountroot)() = ffs_mountroot; - -setconf() -{ - register struct genericconf *gc; - register struct bus_device *device; - register char *cp; - int unit, swaponroot = 0; - - if (rootdev != NODEV) - goto doswap; - unit = 0; - if (boothowto & RB_ASKNAME) { - char name[128]; -retry: - printf("root device? "); - gets(name); - for (gc = genericconf; gc->gc_driver; gc++) - if (gc->gc_name[0] == name[0] && - gc->gc_name[1] == name[1]) - goto gotit; - printf("use one of:"); - for (gc = genericconf; gc->gc_driver; gc++) - printf(" %s%%d", gc->gc_name); - printf("\n"); - goto retry; -gotit: - cp = &name[2]; - if (*cp < '0' || *cp > '9') { - printf("bad/missing unit number\n"); - goto retry; - } - while (*cp >= '0' && *cp <= '9') - unit = 10 * unit + *cp++ - '0'; - if (*cp == '*') - swaponroot++; - goto found; - } - for (gc = genericconf; gc->gc_driver; gc++) { - for (cfp = cfdata; cfp->cf_driver; ++cfp) { - if (cfp->state == FSTATE_FOUND && cfp->unit == 0 - && cfp->cf_driver == gc->gc_driver) { - printf("root on %s0\n", device->name); - goto found; - } - } - } - printf("no suitable root\n"); - asm("stop #0x2700"); -found: - gc->gc_root = makedev(major(gc->gc_root), unit*8); - rootdev = gc->gc_root; -doswap: - swdevt[0].sw_dev = argdev = dumpdev = - makedev(major(rootdev), minor(rootdev)+1); - /* swap size and dumplo set during autoconfigure */ - if (swaponroot) - rootdev = dumpdev; -} - -gets(cp) - char *cp; -{ - register char *lp; - register c; - - lp = cp; - for (;;) { - cnputc(c = cngetc()); - switch (c) { - case '\n': - case '\r': - *lp++ = '\0'; - return; - case '\b': - case '\177': - if (lp > cp) { - lp--; - cnputc(' '); - cnputc('\b'); - } - continue; - case '#': - lp--; - if (lp < cp) - lp = cp; - continue; - case '@': - case 'u'&037: - lp = cp; - cnputc('\n'); - continue; - default: - *lp++ = c; - } - } -} diff --git a/sys/arch/mvme68k/mvme68k/sys_machdep.c b/sys/arch/mvme68k/mvme68k/sys_machdep.c index ccd98b6c677..35ec91d62d5 100644 --- a/sys/arch/mvme68k/mvme68k/sys_machdep.c +++ b/sys/arch/mvme68k/mvme68k/sys_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.8 1995/04/22 20:25:54 christos Exp $ */ +/* $Id: sys_machdep.c,v 1.3 1995/11/07 08:50:26 deraadt Exp $ */ /* * Copyright (c) 1982, 1986, 1993 diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 4ac50ce8d39..28677c440bc 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,7 +1,35 @@ -/* $NetBSD: trap.c,v 1.36 1995/05/12 18:24:53 mycroft Exp $ */ +/* $Id: trap.c,v 1.3 1995/11/07 08:50:27 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. diff --git a/sys/arch/mvme68k/mvme68k/vectors.s b/sys/arch/mvme68k/mvme68k/vectors.s index 4dc7abf7ffa..f1d72da30fc 100644 --- a/sys/arch/mvme68k/mvme68k/vectors.s +++ b/sys/arch/mvme68k/mvme68k/vectors.s @@ -1,5 +1,34 @@ -| $NetBSD: vectors.s,v 1.1.1.1 1995/07/25 23:12:01 chuck Exp $ +/* $Id: vectors.s,v 1.2 1995/11/07 08:50:28 deraadt Exp $ */ +| Copyright (c) 1995 Theo de Raadt +| +| 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 under OpenBSD by +| Theo de Raadt for Willowglen Singapore. +| 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. +| | Copyright (c) 1988 University of Utah | Copyright (c) 1990, 1993 | The Regents of the University of California. All rights reserved. @@ -35,19 +64,18 @@ | @(#)vectors.s 8.2 (Berkeley) 1/21/94 | - .text + .data .globl _buserr,_addrerr .globl _illinst,_zerodiv,_chkinst,_trapvinst,_privinst,_trace .globl _badtrap - .globl _spurintr,_lev1intr,_lev2intr,_lev3intr - .globl _lev4intr,_lev5intr,_lev6intr,_lev7intr - .globl _pcctrap + .globl _spurintr .globl _trap0,_trap1,_trap2,_trap15 .globl _fpfline, _fpunsupp .globl _trap12 -Lvectab: - .long 0x4ef88400 /* 0: jmp 0x8400:w (unused reset SSP) */ + .globl _vectab +_vectab: + .long 0x12345678 /* 0: jmp 0x7400:w (unused reset SSP) */ .long 0 /* 1: NOT USED (reset PC) */ .long _buserr /* 2: bus error */ .long _addrerr /* 3: address error */ @@ -72,13 +100,13 @@ Lvectab: .long _badtrap /* 22: unassigned, reserved */ .long _badtrap /* 23: unassigned, reserved */ .long _spurintr /* 24: spurious interrupt */ - .long _lev1intr /* 25: level 1 interrupt autovector */ - .long _lev2intr /* 26: level 2 interrupt autovector */ - .long _lev3intr /* 27: level 3 interrupt autovector */ - .long _lev4intr /* 28: level 4 interrupt autovector */ - .long _lev5intr /* 29: level 5 interrupt autovector */ - .long _lev6intr /* 30: level 6 interrupt autovector */ - .long _lev7intr /* 31: level 7 interrupt autovector */ + .long _badtrap /* 25: level 1 interrupt autovector */ + .long _badtrap /* 26: level 2 interrupt autovector */ + .long _badtrap /* 27: level 3 interrupt autovector */ + .long _badtrap /* 28: level 4 interrupt autovector */ + .long _badtrap /* 29: level 5 interrupt autovector */ + .long _badtrap /* 30: level 6 interrupt autovector */ + .long _badtrap /* 31: level 7 interrupt autovector */ .long _trap0 /* 32: syscalls */ .long _trap1 /* 33: sigreturn syscall or breakpoint */ .long _trap2 /* 34: breakpoint or sigreturn syscall */ @@ -96,23 +124,23 @@ Lvectab: .long _illinst /* 46: TRAP instruction vector */ .long _trap15 /* 47: TRAP instruction vector */ #ifdef FPSP - .globl bsun, inex, dz, unfl, operr, ovfl, snan - .long bsun /* 48: FPCP branch/set on unordered cond */ - .long inex /* 49: FPCP inexact result */ - .long dz /* 50: FPCP divide by zero */ - .long unfl /* 51: FPCP underflow */ - .long operr /* 52: FPCP operand error */ - .long ovfl /* 53: FPCP overflow */ - .long snan /* 54: FPCP signalling NAN */ + .globl bsun, inex, dz, unfl, operr, ovfl, snan + .long bsun /* 48: FPCP branch/set on unordered cond */ + .long inex /* 49: FPCP inexact result */ + .long dz /* 50: FPCP divide by zero */ + .long unfl /* 51: FPCP underflow */ + .long operr /* 52: FPCP operand error */ + .long ovfl /* 53: FPCP overflow */ + .long snan /* 54: FPCP signalling NAN */ #else - .globl _fpfault - .long _fpfault /* 48: FPCP branch/set on unordered cond */ - .long _fpfault /* 49: FPCP inexact result */ - .long _fpfault /* 50: FPCP divide by zero */ - .long _fpfault /* 51: FPCP underflow */ - .long _fpfault /* 52: FPCP operand error */ - .long _fpfault /* 53: FPCP overflow */ - .long _fpfault /* 54: FPCP signalling NAN */ + .globl _fpfault + .long _fpfault /* 48: FPCP branch/set on unordered cond */ + .long _fpfault /* 49: FPCP inexact result */ + .long _fpfault /* 50: FPCP divide by zero */ + .long _fpfault /* 51: FPCP underflow */ + .long _fpfault /* 52: FPCP operand error */ + .long _fpfault /* 53: FPCP overflow */ + .long _fpfault /* 54: FPCP signalling NAN */ #endif .long _fpunsupp /* 55: FPCP unimplemented data type */ @@ -125,36 +153,20 @@ Lvectab: .long _badtrap /* 62: unassigned, reserved */ .long _badtrap /* 63: unassigned, reserved */ - /* PCC traps (0x40 to start, configured from pccreg.h) */ - .long _pcctrap /* 64: AC fail */ - .long _pcctrap /* 65: BERR */ - .long _pcctrap /* 66: abort */ - .long _pcctrap /* 67: serial port */ - .long _pcctrap /* 68: lance */ - .long _pcctrap /* 69: SCSI port */ - .long _pcctrap /* 70: SCSI dma */ - .long _pcctrap /* 71: printer port */ - .long _pcctrap /* 72: timer #1 */ - .long _pcctrap /* 73: timer #2 */ - .long _pcctrap /* 74: software intr #1 */ - .long _pcctrap /* 75: software intr #2 */ - - .long _badtrap /* 76: unassigned, reserved */ - .long _badtrap /* 77: unassigned, reserved */ - .long _badtrap /* 78: unassigned, reserved */ - .long _badtrap /* 79: unassigned, reserved */ #define BADTRAP16 .long _badtrap,_badtrap,_badtrap,_badtrap,\ _badtrap,_badtrap,_badtrap,_badtrap,\ _badtrap,_badtrap,_badtrap,_badtrap,\ _badtrap,_badtrap,_badtrap,_badtrap - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ - BADTRAP16 /* 64-255: user interrupt vectors */ + + BADTRAP16 /* 64-79: user interrupt vectors */ + BADTRAP16 /* 80-95: user interrupt vectors */ + BADTRAP16 /* 96-111: user interrupt vectors */ + BADTRAP16 /* 112-127: user interrupt vectors */ + BADTRAP16 /* 128-143: user interrupt vectors */ + BADTRAP16 /* 144-159: user interrupt vectors */ + BADTRAP16 /* 160-175: user interrupt vectors */ + BADTRAP16 /* 176-191: user interrupt vectors */ + BADTRAP16 /* 192-207: user interrupt vectors */ + BADTRAP16 /* 208-223: user interrupt vectors */ + BADTRAP16 /* 224-239: user interrupt vectors */ + BADTRAP16 /* 240-255: user interrupt vectors */ diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c index fd9b2229c04..f6aa89705b3 100644 --- a/sys/arch/mvme68k/mvme68k/vm_machdep.c +++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.2 1995/08/10 19:46:45 chuck Exp $ */ +/* $Id: vm_machdep.c,v 1.2 1995/11/07 08:50:29 deraadt Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -49,16 +49,14 @@ #include <sys/buf.h> #include <sys/vnode.h> #include <sys/user.h> -#include <sys/core.h> -#include <sys/exec.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> #include <machine/cpu.h> #include <machine/pte.h> #include <machine/reg.h> +#include <vm/vm.h> +#include <vm/vm_kern.h> + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the kernel stack and pcb, making the child @@ -126,29 +124,28 @@ cpu_exit(p) vmspace_free(p->p_vmspace); - (void) splhigh(); + (void) splimp(); cnt.v_swtch++; switch_exit(p); /* NOTREACHED */ } +void +cpu_cleanup(p) + struct proc *p; +{ + +} + /* * Dump the machine specific header information at the start of a core dump. */ -struct md_core { - struct reg intreg; - struct fpreg freg; -}; int -cpu_coredump(p, vp, cred, chdr) +cpu_coredump(p, vp, cred) struct proc *p; struct vnode *vp; struct ucred *cred; - struct core *chdr; { - struct md_core md_core; - struct coreseg cseg; - int error; #ifdef COMPAT_HPUX extern struct emul emul_hpux; @@ -161,40 +158,9 @@ cpu_coredump(p, vp, cred, chdr) if (p->p_emul == &emul_hpux) return (hpux_dumpu(vp, cred)); #endif - - CORE_SETMAGIC(*chdr, COREMAGIC, MID_M68K, 0); - chdr->c_hdrsize = ALIGN(sizeof(*chdr)); - chdr->c_seghdrsize = ALIGN(sizeof(cseg)); - chdr->c_cpusize = sizeof(md_core); - - /* Save integer registers. */ - error = process_read_regs(p, &md_core.intreg); - if (error) - return error; - - /* Save floating point registers. */ - error = process_read_fpregs(p, &md_core.freg); - if (error) - return error; - - CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_M68K, CORE_CPU); - cseg.c_addr = 0; - cseg.c_size = chdr->c_cpusize; - - error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize, - (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, - (int *)0, p); - if (error) - return error; - - error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core), - (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE, - IO_NODELOCKED|IO_UNIT, cred, (int *)0, p); - if (error) - return error; - - chdr->c_nseg++; - return 0; + return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, USPACE, + (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *) NULL, + p)); } /* diff --git a/sys/arch/mvme68k/stand/Makefile b/sys/arch/mvme68k/stand/Makefile index a52741c8337..2394bf93dd3 100644 --- a/sys/arch/mvme68k/stand/Makefile +++ b/sys/arch/mvme68k/stand/Makefile @@ -1,5 +1,5 @@ -# $NetBSD: Makefile,v 1.1.1.1 1995/07/25 23:12:20 chuck Exp $ +# $Id: Makefile,v 1.2 1995/11/07 08:50:32 deraadt Exp $ -SUBDIR= libsa netboot +SUBDIR= netboot sboot bootsd bootst libsa bugcrt libbug wrtvid .include <bsd.subdir.mk> diff --git a/sys/arch/mvme68k/stand/Makefile.inc b/sys/arch/mvme68k/stand/Makefile.inc index 8f75687d6d2..4b22a25bf4b 100644 --- a/sys/arch/mvme68k/stand/Makefile.inc +++ b/sys/arch/mvme68k/stand/Makefile.inc @@ -1,37 +1,3 @@ -# $NetBSD: Makefile.inc,v 1.1.1.1 1995/07/25 23:12:21 chuck Exp $ +# $Id: Makefile.inc,v 1.2 1995/11/07 08:50:33 deraadt Exp $ -.if defined(SA_PROG) - -# Must have S=/usr/src/sys (or equivalent) -# But note: this is w.r.t. a subdirectory -S= ../../../.. - -RELOC?= 240000 -DEFS?= -DSTANDALONE -INCL?= -I. -I../libsa -I${S}/lib/libsa -I${S} -COPTS?= -msoft-float ${DEFS} ${INCL} - -LIBSA?= ../libsa -SRTOBJ?= ${LIBSA}/SRT0.o ${LIBSA}/SRT1.o -LIBS?= ${LIBSA}/libsa.a MDEC_DIR?=/usr/mdec - -SRCS?= ${SA_PROG}.c -OBJS?= ${SRTOBJ} ${SRCS:S/.c/.o/g} - -${SA_PROG}.bin : ${SA_PROG} - cp ${SA_PROG} a.out ; strip a.out - dd ibs=32 skip=1 if=a.out of=$@ - -rm -f a.out - -${SA_PROG} : ${OBJS} ${LIBS} - ${LD} -N -T ${RELOC} -e start -o $@ ${OBJS} ${LIBS} - @size $@ - -.if !target(clean) -clean: - -rm -f a.out [Ee]rrs mklog core *.core - -rm -f ${SA_PROG} ${SA_PROG}.bin ${OBJS} ${CLEANFILES} -.endif - -.endif diff --git a/sys/arch/mvme68k/stand/bootsd/boot.c b/sys/arch/mvme68k/stand/bootsd/boot.c index 4621fac2888..b9d476e49f2 100644 --- a/sys/arch/mvme68k/stand/bootsd/boot.c +++ b/sys/arch/mvme68k/stand/bootsd/boot.c @@ -1,6 +1,35 @@ -/* $NetBSD$ */ +/* $Id: boot.c,v 1.4 1995/11/07 08:50:34 deraadt Exp $ */ /*- + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/arch/mvme68k/stand/bootsd/bugdev.c b/sys/arch/mvme68k/stand/bootsd/bugdev.c index e9d8f3b5bb5..65b9287ce65 100644 --- a/sys/arch/mvme68k/stand/bootsd/bugdev.c +++ b/sys/arch/mvme68k/stand/bootsd/bugdev.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: bugdev.c,v 1.3 1995/11/07 08:50:35 deraadt Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg diff --git a/sys/arch/mvme68k/stand/bootsd/filesystem.c b/sys/arch/mvme68k/stand/bootsd/filesystem.c index fe2dbe2fb0b..2f821cd81ba 100644 --- a/sys/arch/mvme68k/stand/bootsd/filesystem.c +++ b/sys/arch/mvme68k/stand/bootsd/filesystem.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: filesystem.c,v 1.2 1995/11/07 08:50:37 deraadt Exp $ */ /* * Copyright (c) 1993 Philip A. Nelson. diff --git a/sys/arch/mvme68k/stand/bootsd/version.c b/sys/arch/mvme68k/stand/bootsd/version.c index 4920e8b776f..a24a3e1bf3a 100644 --- a/sys/arch/mvme68k/stand/bootsd/version.c +++ b/sys/arch/mvme68k/stand/bootsd/version.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: version.c,v 1.2 1995/11/07 08:50:37 deraadt Exp $ */ /* * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. @@ -6,4 +6,4 @@ * 1.1 */ -char *version = "$Revision: 1.1 $"; +char *version = "$Revision: 1.2 $"; diff --git a/sys/arch/mvme68k/stand/libsa/Makefile b/sys/arch/mvme68k/stand/libsa/Makefile index 48d9305f58b..e8aa468c5e9 100644 --- a/sys/arch/mvme68k/stand/libsa/Makefile +++ b/sys/arch/mvme68k/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 1995/06/27 15:57:13 gwr Exp $ +# $Id: Makefile,v 1.3 1995/11/07 08:50:40 deraadt Exp $ LIB=sa diff --git a/sys/arch/mvme68k/stand/libsa/SRT0.S b/sys/arch/mvme68k/stand/libsa/SRT0.S index b2114fc3447..376a4597141 100644 --- a/sys/arch/mvme68k/stand/libsa/SRT0.S +++ b/sys/arch/mvme68k/stand/libsa/SRT0.S @@ -1,5 +1,34 @@ -| $NetBSD: SRT0.S,v 1.1.1.1 1995/07/25 23:12:21 chuck Exp $ +# $Id: SRT0.S,v 1.2 1995/11/07 08:50:40 deraadt Exp $ +| Copyright (c) 1995 Theo de Raadt +| +| 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 under OpenBSD by +| Theo de Raadt for Willowglen Singapore. +| 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. +| | Copyright (c) 1995 Gordon W. Ross | All rights reserved. | @@ -29,58 +58,73 @@ | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | SRT0.S - Stand-alone Run-Time startup code, part 0 - .file "SRT0.S" - .text - .globl __estack + .file "SRT0.S" + .text + .globl __estack __estack: - .globl start + .globl start start: | Check to see if the code is located correctly. | This SHOULD do a PC-relative load into a0, but... -| lea start, a0 | current location (0x4000) +| lea start, a0 | current location (0x4000) | XXX - GAS version 1.93 gets the above lea wrong! - .word 0x41fa - .word 0xfffe + .word 0x41fa + .word 0xfffe | Now force a long (not PC-relative) load to a1 and compare. - lea start:l, a1 | desired location (LINKADDR) - cmpl a0, a1 - beqs restart + lea start:l, a1 | desired location (LINKADDR) + cmpl a0, a1 + beqs restart | Relocate the code and data to where they belong. - movl #_edata,d0 | Desired end of program - subl a1,d0 | Calculate length, round up. - lsrl #2,d0 -Lcp: - movl a0@+, a1@+ - dbra d0, Lcp + movl #_edata,d2 | Desired end of program + subl a1,d2 | Calculate length, round up. + lsrl #2,d2 +Lcp: movl a0@+, a1@+ + dbra d2, Lcp | Force a long jump to the relocated code (not pc-relative) - lea restart:l, a0 - jmp a0@ + lea restart:l, a0 + jmp a0@ restart: | now in the relocated code - movl a6@(8), __cmd_buf | get cmd_line from sboot - | Set up stack (just before relocated text) - lea __estack:l, a0 - movl a0, sp - subl a6, a6 + lea __estack:l, a0 + movl a0, sp + subl a6, a6 + + movl d0, _devlun + movl d1, _ctrlun + movl a3, _oparg + movl a4, _opargend | Call the run-time startup C code, which will: | initialize, call main, call exit - jsr __start:l + jsr __start:l | If _start returns, fall into abort. - .globl _abort + .globl _abort _abort: - jsr 0x4000 + trap #0 | If abort returns, fall into reset. - .globl _reset + .globl _reset _reset: - reset - jmp _reset + reset + jmp _reset + +| function to get the vector base register + .globl _getvbr +_getvbr: + movc vbr, d0 + rts | The end. + + .data + .globl _devlun, _ctrlun, _oparg, _opargend +_devlun: .long 0 +_ctrlun: .long 0 +_oparg: .long 0 +_opargend: .long 0 diff --git a/sys/arch/mvme68k/stand/libsa/SRT1.c b/sys/arch/mvme68k/stand/libsa/SRT1.c index 2878cc7f028..7469db57cfb 100644 --- a/sys/arch/mvme68k/stand/libsa/SRT1.c +++ b/sys/arch/mvme68k/stand/libsa/SRT1.c @@ -1,6 +1,35 @@ -/* $NetBSD: SRT1.c,v 1.1.1.1.2.1 1995/10/12 22:47:53 chuck Exp $ */ +/* $Id: SRT1.c,v 1.2 1995/11/07 08:50:41 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1995 Gordon W. Ross * All rights reserved. * @@ -35,22 +64,28 @@ #include <stdarg.h> #include <sys/types.h> +#include "config.h" + extern int edata[], end[]; +extern int * getvbr(); extern volatile void abort(); -extern void main(); -char *_cmd_buf = (char *)0; volatile void exit() { +#if 0 + mon_exit_to_mon(); +#endif abort(); } +struct brdid brdid; +int cputyp; + /* * This is called by SRT0.S * to do final prep for main */ -void _start() { register int *p; @@ -60,12 +95,21 @@ _start() do *p++ = 0; while (p < end); - main(_cmd_buf); +#if 0 + /* Set the vector for trap 0 used by abort. */ + p = getvbr(); + p[32] = (int)romp->abortEntry; +#endif + + asm("clrl sp@-; trap #15; .short 0x70; movl sp@+, %0" : "&=d" (p)); + bcopy(p, &brdid, sizeof brdid); + cputyp = brdid.model; + + main(0); exit(); } /* * Boot programs in C++ ? Not likely! */ -void __main() {} diff --git a/sys/arch/mvme68k/stand/libsa/bug.c b/sys/arch/mvme68k/stand/libsa/bug.c index 9b817b7e7a7..e0ac46017bf 100644 --- a/sys/arch/mvme68k/stand/libsa/bug.c +++ b/sys/arch/mvme68k/stand/libsa/bug.c @@ -1,4 +1,33 @@ /* + * Copyright (c) 1995 Theo de Raadt + * 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 Theo de Raadt + * 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. + * * bug routines -- assumes that the necessary sections of memory * are preserved. */ diff --git a/sys/arch/mvme68k/stand/libsa/clockreg.h b/sys/arch/mvme68k/stand/libsa/clockreg.h index 5ada963e3b9..0d3824186c7 100644 --- a/sys/arch/mvme68k/stand/libsa/clockreg.h +++ b/sys/arch/mvme68k/stand/libsa/clockreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: clockreg.h,v 1.1.1.1 1995/07/25 23:12:24 chuck Exp $ */ +/* $Id: clockreg.h,v 1.2 1995/11/07 08:50:44 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -48,19 +48,18 @@ * Mostek MK48T02 clock. */ struct clockreg { - volatile u_char cl_csr; /* control register */ - volatile u_char cl_sec; /* seconds (0..59; BCD) */ - volatile u_char cl_min; /* minutes (0..59; BCD) */ - volatile u_char cl_hour; /* hour (0..23; BCD) */ - volatile u_char cl_wday; /* weekday (1..7) */ - volatile u_char cl_mday; /* day in month (1..31; BCD) */ - volatile u_char cl_month; /* month (1..12; BCD) */ - volatile u_char cl_year; /* year (0..99; BCD) */ + volatile u_char cl_csr; /* control register */ + volatile u_char cl_sec; /* seconds (0..59; BCD) */ + volatile u_char cl_min; /* minutes (0..59; BCD) */ + volatile u_char cl_hour;/* hour (0..23; BCD) */ + volatile u_char cl_wday;/* weekday (1..7) */ + volatile u_char cl_mday;/* day in month (1..31; BCD) */ + volatile u_char cl_month; /* month (1..12; BCD) */ + volatile u_char cl_year;/* year (0..99; BCD) */ }; - /* bits in cl_csr */ -#define CLK_WRITE 0x80 /* want to write */ -#define CLK_READ 0x40 /* want to read (freeze clock) */ +#define CLK_WRITE 0x80 /* want to write */ +#define CLK_READ 0x40 /* want to read (freeze clock) */ /* * Sun chose the year `68' as their base count, so that @@ -68,4 +67,5 @@ struct clockreg { */ #define YEAR0 68 -#define CLOCK_ADDR (0xfffe07f8) /* VME147 PA of clock */ +#define CLOCK_ADDR_147 (0xfffe07f8) /* PA of clock */ +#define CLOCK_ADDR_16x (0xfffc1ff8) /* PA of clock */ diff --git a/sys/arch/mvme68k/stand/libsa/config.h b/sys/arch/mvme68k/stand/libsa/config.h index 9161fd14efd..d416250b56d 100644 --- a/sys/arch/mvme68k/stand/libsa/config.h +++ b/sys/arch/mvme68k/stand/libsa/config.h @@ -1,10 +1,66 @@ -/* $NetBSD: config.h,v 1.1.1.1 1995/07/25 23:12:24 chuck Exp $ */ +/* $Id: config.h,v 1.2 1995/11/07 08:50:45 deraadt Exp $ */ + +/* + * Copyright (c) 1995 Theo de Raadt + * 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 Theo de Raadt + * 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. + */ /* configuration information for base-line code */ -#define COMMON_ETHERADDR +#define ETHER_ADDR_147 (0xfffe0778) +#define ETHER_ADDR_16X (0xfffc0000+7980) +#define ERAM_ADDR (0xfffe0774) +#define LANCE_REG_ADDR (0xfffe1800) +#define INTEL_REG_ADDR (0xfff46000) + +#define CPU_147 0x147 +#define CPU_162 0x162 +#define CPU_167 0x167 +#define CPU_172 0x172 +#define CPU_177 0x177 -#define CONS_ZS_ADDR (0xfffe3002) -#define ETHER_ADDR (0xfffe0778) -#define ERAM_ADDR (0xfffe0774) -#define LANCE_REG_ADDR (0xfffe1800) +struct brdid { + u_long eye_catcher; + u_char rev; + u_char month; + u_char day; + u_char year; + u_short size; + u_short rsv1; + u_short model; + u_short suffix; + u_short options; + u_char family; + u_char cpu; + u_short ctrlun; + u_short devlun; + u_short devtype; + u_short devnum; + u_long bug; +}; diff --git a/sys/arch/mvme68k/stand/libsa/dev_disk.c b/sys/arch/mvme68k/stand/libsa/dev_disk.c index 8f38c06dab6..fcb7a1a15b1 100644 --- a/sys/arch/mvme68k/stand/libsa/dev_disk.c +++ b/sys/arch/mvme68k/stand/libsa/dev_disk.c @@ -1,4 +1,4 @@ -/* $NetBSD: dev_disk.c,v 1.1.1.1 1995/06/01 20:38:07 gwr Exp $ */ +/* $Id: dev_disk.c,v 1.2 1995/11/07 08:50:46 deraadt Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg diff --git a/sys/arch/mvme68k/stand/libsa/exec_sun.c b/sys/arch/mvme68k/stand/libsa/exec_sun.c index d58c6ce0cde..887330e6715 100644 --- a/sys/arch/mvme68k/stand/libsa/exec_sun.c +++ b/sys/arch/mvme68k/stand/libsa/exec_sun.c @@ -1,6 +1,35 @@ -/* $NetBSD: exec_sun.c,v 1.3 1995/06/09 22:23:01 gwr Exp $ */ +/* $Id: exec_sun.c,v 1.2 1995/11/07 08:50:47 deraadt Exp $ */ /*- + * Copyright (c) 1995 Theo de Raadt + * 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 Theo de Raadt + * 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. + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/arch/mvme68k/stand/libsa/gets.c b/sys/arch/mvme68k/stand/libsa/gets.c index cddf88b7925..455cbcddf85 100644 --- a/sys/arch/mvme68k/stand/libsa/gets.c +++ b/sys/arch/mvme68k/stand/libsa/gets.c @@ -1,6 +1,35 @@ -/* $NetBSD: gets.c,v 1.1.1.1 1995/07/25 23:12:21 chuck Exp $ */ +/* $Id: gets.c,v 1.2 1995/11/07 08:50:48 deraadt Exp $ */ /*- + * Copyright (c) 1995 Theo de Raadt + * 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 Theo de Raadt + * 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. + * * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * @@ -47,7 +76,6 @@ * characters will be followed by a newline, so it doesn't matter. * (Most terminals will not show them anyway.) */ -#define GETS_MUST_ECHO /* Preserved in case someone wants it... */ void gets(buf) @@ -62,9 +90,7 @@ top: for (;;) { c = getchar() & 0177; -#ifdef GETS_MUST_ECHO /* Preserved in case someone wants it... */ putchar(c); -#endif switch (c) { @@ -84,7 +110,6 @@ top: lp--; continue; -#ifdef GETS_REPRINT /* * This is not very useful in a boot program. * (It costs you 52 bytes on m68k, gcc -O3). @@ -96,7 +121,6 @@ top: putchar(*p); continue; } -#endif case '@': case 'u'&037: diff --git a/sys/arch/mvme68k/stand/libsa/netif_sun.c b/sys/arch/mvme68k/stand/libsa/netif_sun.c index db5d203b4fa..28d2b742c26 100644 --- a/sys/arch/mvme68k/stand/libsa/netif_sun.c +++ b/sys/arch/mvme68k/stand/libsa/netif_sun.c @@ -1,4 +1,4 @@ -/* $NetBSD: netif_sun.c,v 1.1 1995/06/09 22:19:26 gwr Exp $ */ +/* $Id: netif_sun.c,v 1.2 1995/11/07 08:50:49 deraadt Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross diff --git a/sys/arch/mvme68k/stand/libsa/promboot.c b/sys/arch/mvme68k/stand/libsa/promboot.c index 157385447e9..2cc28a5b0cf 100644 --- a/sys/arch/mvme68k/stand/libsa/promboot.c +++ b/sys/arch/mvme68k/stand/libsa/promboot.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: promboot.c,v 1.2 1995/11/07 08:50:50 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,20 +14,21 @@ * 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 Theo de Raadt - * 4. The name of the author may not be used to endorse or promote products + * This product includes software developed by Theo de Raadt + * 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. + * 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. */ #include <sys/param.h> diff --git a/sys/arch/mvme68k/stand/libsa/promcons.c b/sys/arch/mvme68k/stand/libsa/promcons.c index ceffe9e6c39..49e790f984d 100644 --- a/sys/arch/mvme68k/stand/libsa/promcons.c +++ b/sys/arch/mvme68k/stand/libsa/promcons.c @@ -1,4 +1,4 @@ -/* $NetBSD$ */ +/* $Id: promcons.c,v 1.2 1995/11/07 08:50:51 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -14,20 +14,21 @@ * 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 Theo de Raadt - * 4. The name of the author may not be used to endorse or promote products + * This product includes software developed by Theo de Raadt + * 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. + * 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. */ #include <stdarg.h> diff --git a/sys/arch/mvme68k/stand/libsa/promdev.c b/sys/arch/mvme68k/stand/libsa/promdev.c index 6f733d6bc81..82c1ce50243 100644 --- a/sys/arch/mvme68k/stand/libsa/promdev.c +++ b/sys/arch/mvme68k/stand/libsa/promdev.c @@ -1,4 +1,4 @@ -/* $NetBSD: promdev.c,v 1.2 1995/06/09 22:23:04 gwr Exp $ */ +/* $Id: promdev.c,v 1.2 1995/11/07 08:50:52 deraadt Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross diff --git a/sys/arch/mvme68k/stand/netboot/Makefile b/sys/arch/mvme68k/stand/netboot/Makefile index 03fbaa7f787..6ecfe3d04b8 100644 --- a/sys/arch/mvme68k/stand/netboot/Makefile +++ b/sys/arch/mvme68k/stand/netboot/Makefile @@ -1,15 +1,31 @@ -# $NetBSD: Makefile,v 1.1.1.1 1995/07/25 23:12:24 chuck Exp $ +# $Id: Makefile,v 1.2 1995/11/07 08:50:55 deraadt Exp $ -SA_PROG= netboot -SRCS= boot.c conf.c version.c dev_net.c +RELOC=0x3F0000 +S= ${.CURDIR}/../../../.. DEFS= -DSTANDALONE -DSUN_BOOTPARAMS +INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${S} -I${S}/lib/libsa +CFLAGS= -O2 ${INCPATH} ${DEFS} ${COPTS} -all: ${SA_PROG}.bin +.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" +.PATH: ${S}/arch/${MACHINE}/stand/libsa +SRTOBJ= SRT0.o SRT1.o -.include <bsd.prog.mk> +SRCS= boot.c conf.c version.c dev_net.c +SRCS+= if_ie.c if_le.c +OBJS= ${SRTOBJ} ${SRCS:S/.c/.o/g} + +all: netboot.bin -install: ${SA_PROG}.bin +netboot: ${OBJS} ${LIBSA} + ${LD} -s -N -T ${RELOC} -e start -o $@ ${OBJS} ${LIBSA} + @size $@ + +netboot.bin: netboot + dd ibs=32 skip=1 if=netboot of=$@ + +install: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${SA_PROG}.bin ${DESTDIR}${MDEC_DIR}/${SA_PROG} + netboot.bin ${DESTDIR}${MDEC_DIR}/netboot +.include <bsd.prog.mk> diff --git a/sys/arch/mvme68k/stand/netboot/boot.c b/sys/arch/mvme68k/stand/netboot/boot.c index a09076af7a4..eedbab78d9e 100644 --- a/sys/arch/mvme68k/stand/netboot/boot.c +++ b/sys/arch/mvme68k/stand/netboot/boot.c @@ -1,7 +1,35 @@ -/* $NetBSD: boot.c,v 1.1.1.1 1995/06/09 22:02:40 gwr Exp $ */ +/* $Id: boot.c,v 1.3 1995/11/07 08:50:57 deraadt Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt + * 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 Theo de Raadt + * 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. + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/arch/mvme68k/stand/netboot/conf.c b/sys/arch/mvme68k/stand/netboot/conf.c index 963fd96ed42..5af003e69f8 100644 --- a/sys/arch/mvme68k/stand/netboot/conf.c +++ b/sys/arch/mvme68k/stand/netboot/conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.1.1.1 1995/06/09 22:02:40 gwr Exp $ */ +/* $Id: conf.c,v 1.3 1995/11/07 08:50:58 deraadt Exp $ */ #include <sys/types.h> #include <netinet/in.h> diff --git a/sys/arch/mvme68k/stand/netboot/dev_net.c b/sys/arch/mvme68k/stand/netboot/dev_net.c index fdcbbb012b3..1562fe6c38b 100644 --- a/sys/arch/mvme68k/stand/netboot/dev_net.c +++ b/sys/arch/mvme68k/stand/netboot/dev_net.c @@ -1,4 +1,4 @@ -/* $NetBSD: dev_net.c,v 1.1.1.1 1995/06/09 22:02:40 gwr Exp $ */ +/* $Id: dev_net.c,v 1.3 1995/11/07 08:50:59 deraadt Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross diff --git a/sys/arch/mvme68k/stand/netboot/i82586.h b/sys/arch/mvme68k/stand/netboot/i82586.h index ca4a11cdea0..9efae561a11 100644 --- a/sys/arch/mvme68k/stand/netboot/i82586.h +++ b/sys/arch/mvme68k/stand/netboot/i82586.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82586.h,v 1.3 1995/01/27 09:49:55 pk Exp $ */ +/* $Id: i82586.h,v 1.2 1995/11/07 08:51:00 deraadt Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt diff --git a/sys/arch/mvme68k/stand/netboot/if_ie.c b/sys/arch/mvme68k/stand/netboot/if_ie.c index 7c0143f8b7b..df5fabc8383 100644 --- a/sys/arch/mvme68k/stand/netboot/if_ie.c +++ b/sys/arch/mvme68k/stand/netboot/if_ie.c @@ -1,9 +1,8 @@ -/* $NetBSD: le_poll.c,v 1.3 1994/10/26 09:11:48 cgd Exp $ */ +/* $Id: if_ie.c,v 1.3 1995/11/07 08:51:00 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt - * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,8 +13,9 @@ * 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 Theo de Raadt - * 4. The name of the Author may not be used to endorse or promote products + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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 diff --git a/sys/arch/mvme68k/stand/netboot/if_iereg.h b/sys/arch/mvme68k/stand/netboot/if_iereg.h index 73d3d47e127..a1ea9c3f228 100644 --- a/sys/arch/mvme68k/stand/netboot/if_iereg.h +++ b/sys/arch/mvme68k/stand/netboot/if_iereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.h,v 1.4 1994/12/16 22:01:11 deraadt Exp $ */ +/* $Id: if_iereg.h,v 1.2 1995/11/07 08:51:01 deraadt Exp $ */ /* * if_sunie.h diff --git a/sys/arch/mvme68k/stand/netboot/if_le.c b/sys/arch/mvme68k/stand/netboot/if_le.c index 3f646f52536..0182852e840 100644 --- a/sys/arch/mvme68k/stand/netboot/if_le.c +++ b/sys/arch/mvme68k/stand/netboot/if_le.c @@ -1,6 +1,35 @@ -/* $NetBSD: le_poll.c,v 1.3 1994/10/26 09:11:48 cgd Exp $ */ +/* $Id: if_le.c,v 1.3 1995/11/07 08:51:02 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1993 Adam Glass * All rights reserved. * diff --git a/sys/arch/mvme68k/stand/netboot/if_lereg.h b/sys/arch/mvme68k/stand/netboot/if_lereg.h index 215ec305fb1..2af99f78c4d 100644 --- a/sys/arch/mvme68k/stand/netboot/if_lereg.h +++ b/sys/arch/mvme68k/stand/netboot/if_lereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_lereg.h,v 1.4 1994/11/20 20:52:22 deraadt Exp $ */ +/* $Id: if_lereg.h,v 1.2 1995/11/07 08:51:03 deraadt Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 diff --git a/sys/arch/mvme68k/stand/netboot/version.c b/sys/arch/mvme68k/stand/netboot/version.c index 47d99c92cab..9d30196a20c 100644 --- a/sys/arch/mvme68k/stand/netboot/version.c +++ b/sys/arch/mvme68k/stand/netboot/version.c @@ -1,4 +1,4 @@ -/* $NetBSD: version.c,v 1.1.1.1 1995/07/25 23:12:26 chuck Exp $ */ +/* $Id: version.c,v 1.2 1995/11/07 08:51:04 deraadt Exp $ */ /* * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. @@ -6,4 +6,4 @@ * 1.1 */ -char *version = "$Revision: 1.1 $"; +char *version = "$Revision: 1.2 $"; diff --git a/sys/arch/mvme68k/stand/sboot/Makefile b/sys/arch/mvme68k/stand/sboot/Makefile index fb80ad4e86f..990d05aeb7c 100644 --- a/sys/arch/mvme68k/stand/sboot/Makefile +++ b/sys/arch/mvme68k/stand/sboot/Makefile @@ -1,19 +1,39 @@ -# $NetBSD: Makefile,v 1.1.1.1 1995/07/25 23:12:28 chuck Exp $ +# $Id: Makefile,v 1.2 1995/11/07 08:51:06 deraadt Exp $ -# -# sboot needs GNU ld because it can generate S-Records -# +S= ${.CURDIR}/../../../.. +INCL?= -I${.CURDIR} -I${.CURDIR}/../libsa -I${S}/lib/libsa -I${S} +COPTS?= ${DEFS} ${INCL} -COMPILE.s= $(AS) $(ASFLAGS) -o $*.o -GNU_LD=/usr/local/bin/ld -LDFLAGS=-oformat srec -x -N -Ttext 0x4000 -e start -NOMAN= -PROG= sboot -SRCS= start.s clock.c console.c etherfun.c le_poll.c libc_sa.c \ - oc_cksum.s sboot.c +.include "${S}/arch/${MACHINE}/stand/libsa/Makefile.inc" -${PROG}: ${OBJS} - ${GNU_LD} ${LDFLAGS} -o ${.TARGET} ${OBJS} +SRCS= sboot.c clock.c etherfun.c if_le.c -.include <bsd.prog.mk> +OBJS= ${SRCS:S/.c/.o/g} +CLEANFILES+=XBUG.o XSRT0.o oc_cksum.o sboot.tmp rboot.tmp srec sboot rboot +MDEC_DIR?=/usr/mdec + +all: sboot rboot + +sboot.tmp: XSRT0.o oc_cksum.o ${OBJS} ${LIBSA} + ld -N -s -static -T 0x4000 XSRT0.o ${OBJS} oc_cksum.o -o sboot.tmp ${LIBSA} + +rboot.tmp: XBUG.o XSRT0.o oc_cksum.o ${OBJS} ${LIBSA} + ld -N -s -static -Ttext 0xffa00000 -Tdata 0x4000 XBUG.o XSRT0.o \ + ${OBJS} oc_cksum.o -o rboot.tmp ${LIBSA} + +srec: srec.c + ${CC} ${.CURDIR}/srec.c -o srec +sboot: sboot.tmp srec + dd ibs=32 skip=1 if=sboot.tmp | ${.OBJDIR}/srec 4 0x4000 sboot > sboot + +rboot: rboot.tmp srec + dd ibs=32 skip=1 if=rboot.tmp | ${.OBJDIR}/srec 4 0x4000 rboot > rboot + +install: + install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + sboot ${DESTDIR}${MDEC_DIR}/sboot + install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + rboot ${DESTDIR}${MDEC_DIR}/rboot + +.include <bsd.prog.mk> diff --git a/sys/arch/mvme68k/stand/sboot/XBUG.S b/sys/arch/mvme68k/stand/sboot/XBUG.S index 8b1e52f76a6..288f1427b21 100644 --- a/sys/arch/mvme68k/stand/sboot/XBUG.S +++ b/sys/arch/mvme68k/stand/sboot/XBUG.S @@ -1,7 +1,6 @@ /* * Copyright (c) 1995 Theo de Raadt - * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,20 +11,22 @@ * 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 Theo de Raadt + * This product includes software developed under OpenBSD by + * Theo de Raadt for Willowglen Singapore. * 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. + * 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. */ /* diff --git a/sys/arch/mvme68k/stand/sboot/XSRT0.S b/sys/arch/mvme68k/stand/sboot/XSRT0.S index 5d14a09a7c0..805528203f2 100644 --- a/sys/arch/mvme68k/stand/sboot/XSRT0.S +++ b/sys/arch/mvme68k/stand/sboot/XSRT0.S @@ -1,4 +1,33 @@ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1995 Charles D. Cranor * All rights reserved. * diff --git a/sys/arch/mvme68k/stand/sboot/clock.c b/sys/arch/mvme68k/stand/sboot/clock.c index f6e344b7b9d..41598b07c0e 100644 --- a/sys/arch/mvme68k/stand/sboot/clock.c +++ b/sys/arch/mvme68k/stand/sboot/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.1.1.1 1995/07/25 23:12:28 chuck Exp $ */ +/* $Id: clock.c,v 1.2 1995/11/07 08:51:08 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -47,11 +47,13 @@ */ /* - * Clock driver. + * Clock driver. */ +#include <sys/cdefs.h> #include "sboot.h" #include "clockreg.h" + static struct clockreg *clockreg = (struct clockreg *) CLOCK_ADDR; /* @@ -69,9 +71,10 @@ static struct clockreg *clockreg = (struct clockreg *) CLOCK_ADDR; * Will Unix still be here then?? */ const short dayyr[12] = - { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; + {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; -static u_long chiptotime(sec, min, hour, day, mon, year) +static u_long +chiptotime(sec, min, hour, day, mon, year) register int sec, min, hour, day, mon, year; { register int days, yr; @@ -82,7 +85,8 @@ static u_long chiptotime(sec, min, hour, day, mon, year) day = FROMBCD(day); mon = FROMBCD(mon); year = FROMBCD(year) + YEAR0; - if (year < 70) year = 70; + if (year < 70) + year = 70; /* simple sanity checks */ if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31) @@ -100,18 +104,19 @@ static u_long chiptotime(sec, min, hour, day, mon, year) /* * Set up the system's time, given a `reasonable' time value. */ -u_long time() +u_long +time() { register struct clockreg *cl = clockreg; - int sec, min, hour, day, mon, year; + int sec, min, hour, day, mon, year; - cl->cl_csr |= CLK_READ; /* enable read (stop time) */ + cl->cl_csr |= CLK_READ; /* enable read (stop time) */ sec = cl->cl_sec; min = cl->cl_min; hour = cl->cl_hour; day = cl->cl_mday; mon = cl->cl_month; year = cl->cl_year; - cl->cl_csr &= ~CLK_READ; /* time wears on */ - return(chiptotime(sec, min, hour, day, mon, year)); + cl->cl_csr &= ~CLK_READ;/* time wears on */ + return (chiptotime(sec, min, hour, day, mon, year)); } diff --git a/sys/arch/mvme68k/stand/sboot/clockreg.h b/sys/arch/mvme68k/stand/sboot/clockreg.h index dbbf313f3d1..e39c1d30d42 100644 --- a/sys/arch/mvme68k/stand/sboot/clockreg.h +++ b/sys/arch/mvme68k/stand/sboot/clockreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: clockreg.h,v 1.1.1.1 1995/07/25 23:12:29 chuck Exp $ */ +/* $Id: clockreg.h,v 1.2 1995/11/07 08:51:09 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 diff --git a/sys/arch/mvme68k/stand/sboot/if_le.c b/sys/arch/mvme68k/stand/sboot/if_le.c index 2f75f839d8c..ea39732ec4b 100644 --- a/sys/arch/mvme68k/stand/sboot/if_le.c +++ b/sys/arch/mvme68k/stand/sboot/if_le.c @@ -1,6 +1,35 @@ -/* $NetBSD: le_poll.c,v 1.3 1994/10/26 09:11:48 cgd Exp $ */ +/* $Id: if_le.c,v 1.2 1995/11/07 08:51:10 deraadt Exp $ */ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. + * * Copyright (c) 1993 Adam Glass * All rights reserved. * diff --git a/sys/arch/mvme68k/stand/sboot/if_lereg.h b/sys/arch/mvme68k/stand/sboot/if_lereg.h index bae9a85fbd5..3c6f534e1e9 100644 --- a/sys/arch/mvme68k/stand/sboot/if_lereg.h +++ b/sys/arch/mvme68k/stand/sboot/if_lereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_lereg.h,v 1.1.1.1 1995/07/25 23:12:31 chuck Exp $ */ +/* $Id: if_lereg.h,v 1.2 1995/11/07 08:51:10 deraadt Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 diff --git a/sys/arch/mvme68k/stand/sboot/oc_cksum.S b/sys/arch/mvme68k/stand/sboot/oc_cksum.S index 2c9d6a63a24..b68af69a5a6 100644 --- a/sys/arch/mvme68k/stand/sboot/oc_cksum.S +++ b/sys/arch/mvme68k/stand/sboot/oc_cksum.S @@ -1,4 +1,4 @@ -| $NetBSD: oc_cksum.s,v 1.4 1994/10/26 07:51:13 cgd Exp $ +| $Id: oc_cksum.S,v 1.2 1995/11/07 08:51:11 deraadt Exp $ | Copyright (c) 1988 Regents of the University of California. | All rights reserved. diff --git a/sys/arch/mvme68k/stand/sboot/sboot.c b/sys/arch/mvme68k/stand/sboot/sboot.c index 70135614b80..5b0f06b1a7e 100644 --- a/sys/arch/mvme68k/stand/sboot/sboot.c +++ b/sys/arch/mvme68k/stand/sboot/sboot.c @@ -1,4 +1,32 @@ /* + * Copyright (c) 1995 Theo de Raadt + * + * 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 under OpenBSD by + * Theo de Raadt for Willowglen Singapore. + * 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. * * Copyright (c) 1995 Charles D. Cranor and Seth Widoff * All rights reserved. diff --git a/sys/arch/mvme68k/stand/sboot/srec.c b/sys/arch/mvme68k/stand/sboot/srec.c index 59ff4368995..164fb4b458c 100644 --- a/sys/arch/mvme68k/stand/sboot/srec.c +++ b/sys/arch/mvme68k/stand/sboot/srec.c @@ -1,4 +1,6 @@ /* + * Public domain, believed to be by Mike Price. + * * convert binary file to Srecord format * XXX srec generates improper checksums for 4-byte dumps */ |