From f74ef87d0cad5eaee4ffa45aa6604e703ce8248b Mon Sep 17 00:00:00 2001 From: kstailey Date: Tue, 7 Jan 1997 23:36:03 +0000 Subject: [PATCH] backed out prev. netbsd merge except for smaller proc table --- sys/arch/sun3/dev/bw2.c | 34 +++--- sys/arch/sun3/dev/cg2.c | 48 ++++---- sys/arch/sun3/dev/cg4.c | 47 ++++---- sys/arch/sun3/dev/eeprom.c | 77 +++++------- sys/arch/sun3/dev/fb.c | 52 +++----- sys/arch/sun3/dev/fbvar.h | 21 ++-- sys/arch/sun3/dev/i82586.h | 4 +- sys/arch/sun3/dev/idprom.c | 44 ++++++- sys/arch/sun3/dev/if_ie.c | 106 +++++++---------- sys/arch/sun3/dev/if_ie_obio.c | 4 +- sys/arch/sun3/dev/if_ie_vmes.c | 10 +- sys/arch/sun3/dev/if_ievar.h | 10 +- sys/arch/sun3/dev/if_le.c | 4 +- sys/arch/sun3/dev/memerr.c | 10 +- sys/arch/sun3/dev/obio.c | 58 ++++----- sys/arch/sun3/dev/obmem.c | 9 +- sys/arch/sun3/dev/si.c | 30 +---- sys/arch/sun3/dev/si_obio.c | 16 +-- sys/arch/sun3/dev/si_vme.c | 10 +- sys/arch/sun3/include/autoconf.h | 16 +-- sys/arch/sun3/include/conf.h | 5 +- sys/arch/sun3/include/control.h | 8 +- sys/arch/sun3/include/cpu.h | 99 ++++++++++++---- sys/arch/sun3/include/db_machdep.h | 9 +- sys/arch/sun3/include/dvma.h | 12 +- sys/arch/sun3/include/idprom.h | 22 +--- sys/arch/sun3/include/isr.h | 47 ++++++++ sys/arch/sun3/include/mon.h | 135 ++++++++++----------- sys/arch/sun3/include/obio.h | 36 +++--- sys/arch/sun3/include/pmap.h | 5 +- sys/arch/sun3/include/proc.h | 10 +- sys/arch/sun3/include/psl.h | 8 +- sys/arch/sun3/include/types.h | 2 +- sys/arch/sun3/include/z8530var.h | 3 - sys/arch/sun3/sun3/autoconf.c | 57 +++------ sys/arch/sun3/sun3/cache.c | 6 +- sys/arch/sun3/sun3/clock.c | 89 +++++++------- sys/arch/sun3/sun3/conf.c | 7 +- sys/arch/sun3/sun3/db_machdep.c | 56 ++------- sys/arch/sun3/sun3/db_memrw.c | 23 ++-- sys/arch/sun3/sun3/dvma.c | 10 +- sys/arch/sun3/sun3/fpu.c | 24 ++-- sys/arch/sun3/sun3/genassym.c | 16 ++- sys/arch/sun3/sun3/interreg.h | 6 +- sys/arch/sun3/sun3/intersil7170.h | 6 +- sys/arch/sun3/sun3/intreg.c | 20 ++-- sys/arch/sun3/sun3/isr.c | 88 +++++--------- sys/arch/sun3/sun3/kgdb_stub.c | 9 +- sys/arch/sun3/sun3/locore.s | 63 ++++++---- sys/arch/sun3/sun3/machdep.c | 162 ++++++++++++------------- sys/arch/sun3/sun3/mem.c | 30 +++-- sys/arch/sun3/sun3/pmap.c | 183 ++++++++++++++--------------- sys/arch/sun3/sun3/sun3_startup.c | 141 +++++++++++----------- sys/arch/sun3/sun3/swapgeneric.c | 116 +++++++----------- sys/arch/sun3/sun3/sys_machdep.c | 13 +- sys/arch/sun3/sun3/vector.c | 10 +- sys/arch/sun3/sun3/vector.h | 26 +--- sys/arch/sun3/sun3/vm_machdep.c | 41 +++---- 58 files changed, 1018 insertions(+), 1195 deletions(-) create mode 100644 sys/arch/sun3/include/isr.h diff --git a/sys/arch/sun3/dev/bw2.c b/sys/arch/sun3/dev/bw2.c index 63f28bc5bbc..3ce58a1061b 100644 --- a/sys/arch/sun3/dev/bw2.c +++ b/sys/arch/sun3/dev/bw2.c @@ -1,4 +1,4 @@ -/* $NetBSD: bw2.c,v 1.9 1996/12/17 21:10:37 gwr Exp $ */ +/* $NetBSD: bw2.c,v 1.8 1996/10/13 03:47:25 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -51,28 +51,24 @@ */ #include -#include -#include #include #include #include #include -#include #include #include -#include -#include #include #include -#include +#include #include +#include #include "fbvar.h" #include "bw2reg.h" -cdev_decl(bw2); +extern unsigned char cpu_machine_id; /* per-display variables */ struct bw2_softc { @@ -95,14 +91,17 @@ struct cfdriver bwtwo_cd = { /* XXX we do not handle frame buffer interrupts */ -static int bw2gvideo __P((struct fbdevice *, void *)); -static int bw2svideo __P((struct fbdevice *, void *)); +/* frame buffer generic driver */ +int bw2open(), bw2close(), bw2ioctl(), bw2mmap(); + +static int bw2gvideo __P((struct fbdevice *, int *)); +static int bw2svideo __P((struct fbdevice *, int *)); static struct fbdriver bw2fbdriver = { bw2open, bw2close, bw2mmap, - fb_noioctl, + enoioctl, /* gattr */ bw2gvideo, bw2svideo, - fb_noioctl, fb_noioctl, }; + enoioctl, enoioctl }; static int bw2match(parent, vcf, args) @@ -146,6 +145,7 @@ bw2attach(parent, self, args) struct fbdevice *fb = &sc->sc_fb; struct confargs *ca = args; struct fbtype *fbt; + int ramsize; sc->sc_phys = ca->ca_paddr; @@ -239,11 +239,10 @@ bw2mmap(dev, off, prot) } /* FBIOGVIDEO: */ -static int bw2gvideo(fb, data) +static int bw2gvideo(fb, on) struct fbdevice *fb; - void *data; + int *on; { - int *on = data; int s, ena; s = splhigh(); @@ -255,11 +254,10 @@ static int bw2gvideo(fb, data) } /* FBIOSVIDEO */ -static int bw2svideo(fb, data) +static int bw2svideo(fb, on) struct fbdevice *fb; - void *data; + int *on; { - int *on = data; int s, ena; s = splhigh(); diff --git a/sys/arch/sun3/dev/cg2.c b/sys/arch/sun3/dev/cg2.c index 369e9283dd9..0567eed2b29 100644 --- a/sys/arch/sun3/dev/cg2.c +++ b/sys/arch/sun3/dev/cg2.c @@ -1,4 +1,4 @@ -/* $NetBSD: cg2.c,v 1.8 1996/12/17 21:10:38 gwr Exp $ */ +/* $NetBSD: cg2.c,v 1.7 1996/10/13 03:47:26 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -53,13 +53,10 @@ */ #include -#include -#include #include #include #include #include -#include #include #include @@ -71,8 +68,6 @@ #include "fbvar.h" -cdev_decl(cg2); - #define CMSIZE 256 /* offset to and size of mapped part of frame buffer */ @@ -107,17 +102,21 @@ struct cfdriver cgtwo_cd = { NULL, "cgtwo", DV_DULL }; -static int cg2gattr __P((struct fbdevice *, void *)); -static int cg2gvideo __P((struct fbdevice *, void *)); -static int cg2svideo __P((struct fbdevice *, void *)); -static int cg2getcmap __P((struct fbdevice *, void *)); -static int cg2putcmap __P((struct fbdevice *, void *)); +/* frame buffer generic driver */ +int cg2open(), cg2close(), cg2mmap(); + +static int cg2gattr __P((struct fbdevice *, struct fbgattr *)); +static int cg2gvideo __P((struct fbdevice *, int *)); +static int cg2svideo __P((struct fbdevice *, int *)); +static int cg2getcmap __P((struct fbdevice *, struct fbcmap *)); +static int cg2putcmap __P((struct fbdevice *, struct fbcmap *)); static struct fbdriver cg2fbdriver = { cg2open, cg2close, cg2mmap, cg2gattr, cg2gvideo, cg2svideo, cg2getcmap, cg2putcmap }; +static void cg2loadcmap __P((struct cg2_softc *, int, int)); static int cg2intr __P((void*)); /* @@ -159,6 +158,7 @@ cg2attach(parent, self, args) struct fbdevice *fb = &sc->sc_fb; struct confargs *ca = args; struct fbtype *fbt; + int i, ramsize, pa; sc->sc_phys = ca->ca_paddr; sc->sc_pmtype = PMAP_NC | PMAP_VME16; @@ -238,6 +238,7 @@ cg2mmap(dev, off, prot) int off, prot; { struct cg2_softc *sc = cgtwo_cd.cd_devs[minor(dev)]; + int realoff; if (off & PGOFSET) panic("cg2mmap"); @@ -257,11 +258,10 @@ cg2mmap(dev, off, prot) */ /* FBIOGATTR: */ -static int cg2gattr(fb, data) +static int cg2gattr(fb, fba) struct fbdevice *fb; - void *data; + struct fbgattr *fba; { - struct fbgattr *fba = data; fba->real_type = fb->fb_fbtype.fb_type; fba->owner = 0; /* XXX - TIOCCONS stuff? */ @@ -275,11 +275,10 @@ static int cg2gattr(fb, data) } /* FBIOGVIDEO: */ -static int cg2gvideo(fb, data) +static int cg2gvideo(fb, on) struct fbdevice *fb; - void *data; + int *on; { - int *on = data; struct cg2_softc *sc = fb->fb_private; *on = sc->sc_ctlreg->status.reg.video_enab; @@ -287,11 +286,10 @@ static int cg2gvideo(fb, data) } /* FBIOSVIDEO: */ -static int cg2svideo(fb, data) +static int cg2svideo(fb, on) struct fbdevice *fb; - void *data; + int *on; { - int *on = data; struct cg2_softc *sc = fb->fb_private; sc->sc_ctlreg->status.reg.video_enab = (*on) & 1; @@ -300,11 +298,10 @@ static int cg2svideo(fb, data) } /* FBIOGETCMAP: */ -static int cg2getcmap(fb, data) +static int cg2getcmap(fb, cmap) struct fbdevice *fb; - void *data; + struct fbcmap *cmap; { - struct fbcmap *cmap = data; struct cg2_softc *sc = fb->fb_private; u_char red[CMSIZE], green[CMSIZE], blue[CMSIZE]; int error, start, count, ecount; @@ -342,11 +339,10 @@ static int cg2getcmap(fb, data) } /* FBIOPUTCMAP: */ -static int cg2putcmap(fb, data) +static int cg2putcmap(fb, cmap) struct fbdevice *fb; - void *data; + struct fbcmap *cmap; { - struct fbcmap *cmap = data; struct cg2_softc *sc = fb->fb_private; u_char red[CMSIZE], green[CMSIZE], blue[CMSIZE]; int error, start, count, ecount; diff --git a/sys/arch/sun3/dev/cg4.c b/sys/arch/sun3/dev/cg4.c index 170621cab8f..960e7bdb0fe 100644 --- a/sys/arch/sun3/dev/cg4.c +++ b/sys/arch/sun3/dev/cg4.c @@ -1,4 +1,4 @@ -/* $NetBSD: cg4.c,v 1.12 1996/12/17 21:10:39 gwr Exp $ */ +/* $NetBSD: cg4.c,v 1.11 1996/10/29 19:54:19 gwr Exp $ */ /* * Copyright (c) 1992, 1993 @@ -60,20 +60,17 @@ #include #include -#include #include #include #include #include -#include #include #include -#include #include #include -#include +#include #include #include "fbvar.h" @@ -81,8 +78,6 @@ #include "btvar.h" #include "cg4reg.h" -cdev_decl(cg4); - #define CG4_MMAP_SIZE (CG4_OVERLAY_SIZE + CG4_ENABLE_SIZE + CG4_PIXMAP_SIZE) extern unsigned char cpu_machine_id; @@ -121,11 +116,14 @@ struct cfdriver cgfour_cd = { NULL, "cgfour", DV_DULL }; -static int cg4gattr __P((struct fbdevice *, void *)); -static int cg4gvideo __P((struct fbdevice *, void *)); -static int cg4svideo __P((struct fbdevice *, void *)); -static int cg4getcmap __P((struct fbdevice *, void *)); -static int cg4putcmap __P((struct fbdevice *, void *)); +/* frame buffer generic driver */ +int cg4open(), cg4close(), cg4mmap(); + +static int cg4gattr __P((struct fbdevice *, struct fbgattr *)); +static int cg4gvideo __P((struct fbdevice *, int *)); +static int cg4svideo __P((struct fbdevice *, int *)); +static int cg4getcmap __P((struct fbdevice *, struct fbcmap *)); +static int cg4putcmap __P((struct fbdevice *, struct fbcmap *)); static void cg4a_init __P((struct cg4_softc *)); static void cg4a_svideo __P((struct cg4_softc *, int)); @@ -345,11 +343,10 @@ cg4mmap(dev, off, prot) */ /* FBIOGATTR: */ -static int cg4gattr(fb, data) +static int cg4gattr(fb, fba) struct fbdevice *fb; - void *data; + struct fbgattr *fba; { - struct fbgattr *fba = data; fba->real_type = fb->fb_fbtype.fb_type; fba->owner = 0; /* XXX - TIOCCONS stuff? */ @@ -363,11 +360,10 @@ static int cg4gattr(fb, data) } /* FBIOGVIDEO: */ -static int cg4gvideo(fb, data) +static int cg4gvideo(fb, on) struct fbdevice *fb; - void *data; + int *on; { - int *on = data; struct cg4_softc *sc = fb->fb_private; *on = !sc->sc_blanked; @@ -375,11 +371,10 @@ static int cg4gvideo(fb, data) } /* FBIOSVIDEO: */ -static int cg4svideo(fb, data) +static int cg4svideo(fb, on) struct fbdevice *fb; - void *data; + int *on; { - int *on = data; struct cg4_softc *sc = fb->fb_private; int state; @@ -395,11 +390,10 @@ static int cg4svideo(fb, data) * FBIOGETCMAP: * Copy current colormap out to user space. */ -static int cg4getcmap(fb, data) +static int cg4getcmap(fb, fbcm) struct fbdevice *fb; - void *data; + struct fbcmap *fbcm; { - struct fbcmap *fbcm = data; struct cg4_softc *sc = fb->fb_private; struct soft_cmap *cm = &sc->sc_cmap; int error, start, count; @@ -426,11 +420,10 @@ static int cg4getcmap(fb, data) * FBIOPUTCMAP: * Copy new colormap from user space and load. */ -static int cg4putcmap(fb, data) +static int cg4putcmap(fb, fbcm) struct fbdevice *fb; - void *data; + struct fbcmap *fbcm; { - struct fbcmap *fbcm = data; struct cg4_softc *sc = fb->fb_private; struct soft_cmap *cm = &sc->sc_cmap; int error, start, count; diff --git a/sys/arch/sun3/dev/eeprom.c b/sys/arch/sun3/dev/eeprom.c index f5c94b506b7..4277845016f 100644 --- a/sys/arch/sun3/dev/eeprom.c +++ b/sys/arch/sun3/dev/eeprom.c @@ -1,12 +1,9 @@ -/* $NetBSD: eeprom.c,v 1.13 1996/12/17 21:10:40 gwr Exp $ */ +/* $NetBSD: eeprom.c,v 1.8 1996/03/26 15:16:06 gwr Exp $ */ -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. +/* + * Copyright (c) 1994 Gordon W. Ross * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by Gordon W. Ross. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,25 +12,19 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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. */ /* @@ -42,9 +33,6 @@ * handle the painful task of updating the EEPROM contents. * After a write, it must not be touched for 10 milliseconds. * (See the Sun-3 Architecture Manual sec. 5.9) - * - * XXX: Should just keep a copy of the EEPROM contents in RAM - * (read it once at init time) to avoid the eeprom_uio hair. */ #include @@ -53,7 +41,6 @@ #include #include #include -#include #include #include @@ -68,7 +55,7 @@ static int ee_update(caddr_t buf, int off, int cnt); static char *eeprom_va; static int ee_busy, ee_want; -static int eeprom_match __P((struct device *, void *, void *)); +static int eeprom_match __P((struct device *, void *vcf, void *args)); static void eeprom_attach __P((struct device *, struct device *, void *)); struct cfattach eeprom_ca = { @@ -91,15 +78,23 @@ eeprom_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; + struct cfdata *cf = vcf; struct confargs *ca = args; + int pa; /* This driver only supports one unit. */ if (cf->cf_unit != 0) return (0); - /* Validate the given address. */ - if (ca->ca_paddr != OBIO_EEPROM) + if ((pa = cf->cf_paddr) == -1) { + /* Use our default PA. */ + pa = OBIO_EEPROM; + } else { + /* Validate the given PA. */ + if (pa != OBIO_EEPROM) + return (0); + } + if (pa != ca->ca_paddr) return (0); if (eeprom_va == NULL) @@ -114,14 +109,13 @@ eeprom_attach(parent, self, args) struct device *self; void *args; { + struct confargs *ca = args; printf("\n"); } -/* Take the lock. */ -static int -ee_take __P((void)) +static int ee_take() /* Take the lock. */ { int error = 0; while (ee_busy) { @@ -136,9 +130,7 @@ ee_take __P((void)) return error; } -/* Give the lock. */ -static void -ee_give __P((void)) +static void ee_give() /* Give the lock. */ { ee_busy = 0; if (ee_want) { @@ -147,11 +139,7 @@ ee_give __P((void)) } } -/* - * XXX - Just keep a soft copy of the eeprom? - */ -int -eeprom_uio(struct uio *uio) +int eeprom_uio(struct uio *uio) { int error; int off; /* NOT off_t */ @@ -202,8 +190,7 @@ eeprom_uio(struct uio *uio) /* * Update the EEPROM from the passed buf. */ -static int -ee_update(char *buf, int off, int cnt) +static int ee_update(char *buf, int off, int cnt) { volatile char *ep; char *bp; diff --git a/sys/arch/sun3/dev/fb.c b/sys/arch/sun3/dev/fb.c index afa12f78f52..dea031c9798 100644 --- a/sys/arch/sun3/dev/fb.c +++ b/sys/arch/sun3/dev/fb.c @@ -1,4 +1,4 @@ -/* $NetBSD: fb.c,v 1.4 1996/12/17 21:10:41 gwr Exp $ */ +/* $NetBSD: fb.c,v 1.3 1995/04/10 05:45:56 mycroft Exp $ */ /* * Copyright (c) 1992, 1993 @@ -49,7 +49,6 @@ */ #include -#include #include #include #include @@ -59,8 +58,6 @@ #include "fbvar.h" -cdev_decl(fb); - static struct fbdevice *devfb; static int fbpriority; @@ -120,6 +117,16 @@ fbmmap(dev, off, prot) return ((*devfb->fb_driver->fbd_mmap)(dev, off, prot)); } +void +fb_unblank() +{ + int on = 1; + + if (devfb) { + (void) fbioctlfb(devfb, FBIOSVIDEO, (caddr_t)&on); + } +} + /* * Common fb ioctl function */ @@ -130,34 +137,33 @@ fbioctlfb(fb, cmd, data) caddr_t data; { struct fbdriver *fbd = fb->fb_driver; - void *vp = (void *)data; int error; switch (cmd) { case FBIOGTYPE: - *(struct fbtype *)vp = fb->fb_fbtype; + *(struct fbtype *)data = fb->fb_fbtype; error = 0; break; case FBIOGATTR: - error = (*fbd->fbd_gattr)(fb, vp); + error = (*fbd->fbd_gattr)(fb, (struct fbgattr *)data); break; case FBIOGVIDEO: - error = (*fbd->fbd_gvideo)(fb, vp); + error = (*fbd->fbd_gvideo)(fb, (int *)data); break; case FBIOSVIDEO: - error = (*fbd->fbd_svideo)(fb, vp); + error = (*fbd->fbd_svideo)(fb, (int *)data); break; case FBIOGETCMAP: - error = (*fbd->fbd_getcmap)(fb, vp); + error = (*fbd->fbd_getcmap)(fb, (struct fbcmap *)data); break; case FBIOPUTCMAP: - error = (*fbd->fbd_putcmap)(fb, vp); + error = (*fbd->fbd_putcmap)(fb, (struct fbcmap *)data); break; default: @@ -165,27 +171,3 @@ fbioctlfb(fb, cmd, data) } return (error); } - -void -fb_unblank() -{ - int on = 1; - - if (devfb == NULL) - return; - - (*devfb->fb_driver->fbd_svideo)(devfb, (void *)&on); -} - -/* - * Default ioctl function to put in struct fbdriver - * for functions that are not supported. - */ -int -fb_noioctl(fbd, vp) - struct fbdevice *fbd; - void *vp; -{ - return ENOTTY; -} - diff --git a/sys/arch/sun3/dev/fbvar.h b/sys/arch/sun3/dev/fbvar.h index 6a8b64e2bb4..aae60c99151 100644 --- a/sys/arch/sun3/dev/fbvar.h +++ b/sys/arch/sun3/dev/fbvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: fbvar.h,v 1.4 1996/12/17 21:10:42 gwr Exp $ */ +/* $NetBSD: fbvar.h,v 1.3 1996/10/29 19:27:37 gwr Exp $ */ /* * Copyright (c) 1992, 1993 @@ -49,8 +49,6 @@ * following in order to participate. */ -struct fbcmap; - struct fbdevice { struct fbtype fb_fbtype; /* see fbio.h */ struct fbdriver *fb_driver; /* pointer to driver */ @@ -73,16 +71,13 @@ struct fbdriver { int (*fbd_close) __P((dev_t, int, int, struct proc *)); int (*fbd_mmap) __P((dev_t, int, int)); /* These are the internal ioctl functions */ - int (*fbd_gattr) __P((struct fbdevice *, void *)); - int (*fbd_gvideo) __P((struct fbdevice *, void *)); - int (*fbd_svideo) __P((struct fbdevice *, void *)); - int (*fbd_getcmap) __P((struct fbdevice *, void *)); - int (*fbd_putcmap) __P((struct fbdevice *, void *)); + int (*fbd_gattr) __P((struct fbdevice *, struct fbgattr *)); + int (*fbd_gvideo) __P((struct fbdevice *, int *)); + int (*fbd_svideo) __P((struct fbdevice *, int *)); + int (*fbd_getcmap) __P((struct fbdevice *, struct fbcmap *)); + int (*fbd_putcmap) __P((struct fbdevice *, struct fbcmap *)); }; -int fbioctlfb __P((struct fbdevice *, u_long, caddr_t)); - void fb_attach __P((struct fbdevice *, int)); -int fb_noioctl __P((struct fbdevice *, void *)); -void fb_unblank __P((void)); - +int fbioctlfb __P((struct fbdevice *, u_long, caddr_t)); +extern int enoioctl(); diff --git a/sys/arch/sun3/dev/i82586.h b/sys/arch/sun3/dev/i82586.h index 7eb5fa190aa..748ab762647 100644 --- a/sys/arch/sun3/dev/i82586.h +++ b/sys/arch/sun3/dev/i82586.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82586.h,v 1.4 1996/12/13 19:54:08 gwr Exp $ */ +/* $NetBSD: i82586.h,v 1.3 1995/10/08 23:41:36 gwr Exp $ */ /*- * Copyright (c) 1992, University of Vermont and State Agricultural College. @@ -236,7 +236,7 @@ struct ie_xmit_buf { * Multicast setup command. */ -#define MAXMCAST 250 /* must fit in transmit buffer */ +#define MAXMCAST 50 /* must fit in transmit buffer */ struct ie_mcast_cmd { struct ie_cmd_common com; /* common part */ diff --git a/sys/arch/sun3/dev/idprom.c b/sys/arch/sun3/dev/idprom.c index ead8f65c081..70c9d2f2892 100644 --- a/sys/arch/sun3/dev/idprom.c +++ b/sys/arch/sun3/dev/idprom.c @@ -1,4 +1,4 @@ -/* $NetBSD: idprom.c,v 1.15 1996/12/17 21:10:43 gwr Exp $ */ +/* $NetBSD: idprom.c,v 1.13 1996/11/20 18:56:50 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -43,25 +43,61 @@ #include #include #include -#include #include #include #include #include +extern long hostid; /* in kern_sysctl.c */ + /* * This structure is what this driver is all about. * It is copied from control space early in startup. */ struct idprom identity_prom; +int idpromopen(dev, oflags, devtype, p) + dev_t dev; + int oflags; + int devtype; + struct proc *p; +{ + return 0; +} + +int idpromclose(dev, fflag, devtype, p) + dev_t dev; + int fflag; + int devtype; + struct proc *p; +{ + return 0; +} + +idpromread(dev, uio, ioflag) + dev_t dev; + struct uio *uio; + int ioflag; +{ + int error, unit, length; + + error = 0; + while (uio->uio_resid > 0 && error == 0) { + if (uio->uio_offset >= IDPROM_SIZE) + break; /* past or at end */ + length = min(uio->uio_resid, + (IDPROM_SIZE - (int)uio->uio_offset)); + error = uiomove((caddr_t) &identity_prom, length, uio); + } + return error; +} + /* * This is called very early during startup to * get a copy of the idprom from control space. */ -int -idprom_init() +int idprom_init() { struct idprom *idp; char *src, *dst; diff --git a/sys/arch/sun3/dev/if_ie.c b/sys/arch/sun3/dev/if_ie.c index 3486a1fa4c9..32f52c05e8f 100644 --- a/sys/arch/sun3/dev/if_ie.c +++ b/sys/arch/sun3/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie.c,v 1.16 1996/12/17 21:10:44 gwr Exp $ */ +/* $NetBSD: if_ie.c,v 1.15 1996/10/30 00:24:33 gwr Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -135,16 +135,16 @@ #include -#include -#include -#include - /* * ugly byte-order hack for SUNs */ -#define XSWAP(y) ( ((y) >> 8) | ((y) << 8) ) #define SWAP(x) ((u_short)(XSWAP((u_short)(x)))) +#define XSWAP(y) ( ((y) >> 8) | ((y) << 8) ) + +#include +#include +#include #include "i82586.h" #include "if_iereg.h" @@ -172,35 +172,15 @@ int ieinit __P((struct ie_softc *)); int ieioctl __P((struct ifnet *, u_long, caddr_t)); void iestart __P((struct ifnet *)); void iereset __P((struct ie_softc *)); -int ie_setupram __P((struct ie_softc *sc)); - -static void chan_attn_timeout __P((void *arg)); -static int cmd_and_wait __P((struct ie_softc *, int, void *, int)); - -static void ie_drop_packet_buffer __P((struct ie_softc *)); static void ie_readframe __P((struct ie_softc *, int)); -static void ie_setup_config __P((struct ie_config_cmd *, int, int)); - +static void ie_drop_packet_buffer __P((struct ie_softc *)); +static int command_and_wait __P((struct ie_softc *, int, + void volatile *, int)); static void ierint __P((struct ie_softc *)); -static void iestop __P((struct ie_softc *)); static void ietint __P((struct ie_softc *)); -static void iexmit __P((struct ie_softc *)); - +static void setup_bufs __P((struct ie_softc *)); static int mc_setup __P((struct ie_softc *, void *)); static void mc_reset __P((struct ie_softc *)); -static void run_tdr __P((struct ie_softc *, struct ie_tdr_cmd *)); -static void setup_bufs __P((struct ie_softc *)); - -static inline caddr_t Align __P((caddr_t ptr)); -static inline void ie_ack __P((struct ie_softc *, u_int)); -static inline u_short ether_cmp __P((u_char *, u_char *)); -static inline int check_eh __P((struct ie_softc *, - struct ether_header *eh, int *)); -static inline int ie_buflen __P((struct ie_softc *, int)); -static inline int ie_packet_len __P((struct ie_softc *)); -static inline int ieget __P((struct ie_softc *sc, - struct mbuf **mp, struct ether_header *ehp, int *to_bpf)); - #ifdef IEDEBUG void print_rbd __P((volatile struct ie_recv_buf_desc *)); @@ -235,7 +215,7 @@ struct cfdriver ie_cd = { */ static inline void ie_setup_config(cmd, promiscuous, manchester) - struct ie_config_cmd *cmd; + volatile struct ie_config_cmd *cmd; int promiscuous, manchester; { @@ -273,7 +253,7 @@ ie_ack(sc, mask) { volatile struct ie_sys_ctl_block *scb = sc->scb; - cmd_and_wait(sc, scb->ie_status & mask, 0, 0); + command_and_wait(sc, scb->ie_status & mask, 0, 0); } @@ -369,8 +349,8 @@ ie_intr(v) volatile struct ievme *iev = (volatile struct ievme *)sc->sc_reg; if (iev->status & IEVME_PERR) { printf("%s: parity error (ctrl %x @ %02x%04x)\n", - sc->sc_dev.dv_xname, iev->pectrl, - iev->pectrl & IEVME_HADDR, iev->peaddr); + iev->pectrl, iev->pectrl & IEVME_HADDR, + iev->peaddr); iev->pectrl = iev->pectrl | IEVME_PARACK; } } @@ -457,7 +437,7 @@ ierint(sc) MK_16(sc->sc_maddr, sc->rbuffs[0]); scb->ie_recv_list = MK_16(sc->sc_maddr, sc->rframes[0]); - cmd_and_wait(sc, IE_RU_START, 0, 0); + command_and_wait(sc, IE_RU_START, 0, 0); } break; } @@ -475,6 +455,7 @@ ietint(sc) struct ie_softc *sc; { int status; + int i; sc->sc_arpcom.ac_if.if_timer = 0; sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; @@ -710,7 +691,7 @@ ie_packet_len(sc) * command to the chip to be executed. On the way, if we have a BPF listener * also give him a copy. */ -static void +inline static void iexmit(sc) struct ie_softc *sc; { @@ -741,7 +722,7 @@ iexmit(sc) sc->scb->ie_command_list = MK_16(sc->sc_maddr, sc->xmit_cmds[sc->xctail]); - cmd_and_wait(sc, IE_CU_START, 0, 0); + command_and_wait(sc, IE_CU_START, 0, 0); sc->xmit_busy = 1; sc->sc_arpcom.ac_if.if_timer = 5; @@ -1170,10 +1151,10 @@ iereset(sc) /* * Stop i82586 dead in its tracks. */ - if (cmd_and_wait(sc, IE_RU_ABORT | IE_CU_ABORT, 0, 0)) + if (command_and_wait(sc, IE_RU_ABORT | IE_CU_ABORT, 0, 0)) printf("%s: abort commands timed out\n", sc->sc_dev.dv_xname); - if (cmd_and_wait(sc, IE_RU_DISABLE | IE_CU_STOP, 0, 0)) + if (command_and_wait(sc, IE_RU_DISABLE | IE_CU_STOP, 0, 0)) printf("%s: disable commands timed out\n", sc->sc_dev.dv_xname); #ifdef notdef @@ -1191,10 +1172,10 @@ iereset(sc) * This is called if we time out. */ static void -chan_attn_timeout(arg) - void *arg; +chan_attn_timeout(rock) + caddr_t rock; { - *((int *)arg) = 1; + *(int *) rock = 1; } /* @@ -1207,10 +1188,10 @@ chan_attn_timeout(arg) * to become true. */ static int -cmd_and_wait(sc, cmd, pcmd, mask) +command_and_wait(sc, cmd, pcmd, mask) struct ie_softc *sc; int cmd; - void * pcmd; + volatile void *pcmd; int mask; { volatile struct ie_cmd_common *cc = pcmd; @@ -1235,7 +1216,7 @@ cmd_and_wait(sc, cmd, pcmd, mask) * .369 seconds, which we round up to .4. */ - timeout(chan_attn_timeout, (void *)&timedout, 2 * hz / 5); + timeout(chan_attn_timeout, (caddr_t)&timedout, 2 * hz / 5); /* * Now spin-lock waiting for status. This is not a very nice @@ -1248,7 +1229,7 @@ cmd_and_wait(sc, cmd, pcmd, mask) if ((cc->ie_cmd_status & mask) || timedout) break; - untimeout(chan_attn_timeout, (void *)&timedout); + untimeout(chan_attn_timeout, (caddr_t)&timedout); return timedout; } else { @@ -1281,7 +1262,7 @@ run_tdr(sc, cmd) sc->scb->ie_command_list = MK_16(sc->sc_maddr, cmd); cmd->ie_tdr_time = SWAP(0); - if (cmd_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || + if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || !(cmd->com.ie_cmd_status & IE_STAT_OK)) result = 0x10000; /* XXX */ else @@ -1326,7 +1307,9 @@ setup_bufs(sc) struct ie_softc *sc; { caddr_t ptr = sc->buf_area; /* memory pool */ - u_int n, r; + volatile struct ie_recv_frame_desc *rfd = (void *) ptr; + volatile struct ie_recv_buf_desc *rbd; + int n, r; /* * step 0: zero memory and figure out how many recv buffers and @@ -1335,16 +1318,14 @@ setup_bufs(sc) (sc->sc_bzero)(ptr, sc->buf_area_sz); ptr = Align(ptr); /* set alignment and stick with it */ - n = ALIGN(sizeof(struct ie_xmit_cmd)) + - ALIGN(sizeof(struct ie_xmit_buf)) + - IE_TBUF_SIZE; + n = (int)Align(sizeof(struct ie_xmit_cmd)) + + (int)Align(sizeof(struct ie_xmit_buf)) + IE_TBUF_SIZE; n *= NTXBUF; /* n = total size of xmit area */ n = sc->buf_area_sz - n;/* n = free space for recv stuff */ - r = ALIGN(sizeof(struct ie_recv_frame_desc)) + - ((ALIGN(sizeof(struct ie_recv_buf_desc)) + - IE_RBUF_SIZE) * B_PER_F); + r = (int)Align(sizeof(struct ie_recv_frame_desc)) + + (((int)Align(sizeof(struct ie_recv_buf_desc)) + IE_RBUF_SIZE) * B_PER_F); /* r = size of one R frame */ @@ -1455,7 +1436,7 @@ mc_setup(sc, ptr) struct ie_softc *sc; void *ptr; { - struct ie_mcast_cmd *cmd = ptr; + volatile struct ie_mcast_cmd *cmd = ptr; cmd->com.ie_cmd_status = SWAP(0); cmd->com.ie_cmd_cmd = IE_CMD_MCAST | IE_CMD_LAST; @@ -1468,7 +1449,7 @@ mc_setup(sc, ptr) SWAP(sc->mcast_count * ETHER_ADDR_LEN); /* grrr... */ sc->scb->ie_command_list = MK_16(sc->sc_maddr, cmd); - if (cmd_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || + if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || !(cmd->com.ie_cmd_status & IE_STAT_OK)) { printf("%s: multicast address setup command failed\n", sc->sc_dev.dv_xname); @@ -1490,6 +1471,7 @@ ieinit(sc) { volatile struct ie_sys_ctl_block *scb = sc->scb; void *ptr; + int n; ptr = sc->buf_area; @@ -1497,7 +1479,7 @@ ieinit(sc) * Send the configure command first. */ { - struct ie_config_cmd *cmd = ptr; + volatile struct ie_config_cmd *cmd = ptr; scb->ie_command_list = MK_16(sc->sc_maddr, cmd); cmd->com.ie_cmd_status = SWAP(0); @@ -1506,7 +1488,7 @@ ieinit(sc) ie_setup_config(cmd, sc->promisc, 0); - if (cmd_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || + if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || !(cmd->com.ie_cmd_status & IE_STAT_OK)) { printf("%s: configure command failed\n", sc->sc_dev.dv_xname); @@ -1518,7 +1500,7 @@ ieinit(sc) * Now send the Individual Address Setup command. */ { - struct ie_iasetup_cmd *cmd = ptr; + volatile struct ie_iasetup_cmd *cmd = ptr; scb->ie_command_list = MK_16(sc->sc_maddr, cmd); cmd->com.ie_cmd_status = SWAP(0); @@ -1528,7 +1510,7 @@ ieinit(sc) (sc->sc_bcopy)(sc->sc_arpcom.ac_enaddr, (caddr_t)&cmd->ie_address, sizeof cmd->ie_address); - if (cmd_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || + if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || !(cmd->com.ie_cmd_status & IE_STAT_OK)) { printf("%s: individual address setup command failed\n", sc->sc_dev.dv_xname); @@ -1555,7 +1537,7 @@ ieinit(sc) sc->sc_arpcom.ac_if.if_flags |= IFF_RUNNING; sc->scb->ie_recv_list = MK_16(sc->sc_maddr, sc->rframes[0]); - cmd_and_wait(sc, IE_RU_START, 0, 0); + command_and_wait(sc, IE_RU_START, 0, 0); ie_ack(sc, IE_ST_WHENCE); @@ -1570,7 +1552,7 @@ iestop(sc) struct ie_softc *sc; { - cmd_and_wait(sc, IE_RU_DISABLE, 0, 0); + command_and_wait(sc, IE_RU_DISABLE, 0, 0); } int diff --git a/sys/arch/sun3/dev/if_ie_obio.c b/sys/arch/sun3/dev/if_ie_obio.c index 773519e8d4a..76307fa0c92 100644 --- a/sys/arch/sun3/dev/if_ie_obio.c +++ b/sys/arch/sun3/dev/if_ie_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie_obio.c,v 1.7 1996/12/17 21:10:45 gwr Exp $ */ +/* $NetBSD: if_ie_obio.c,v 1.6 1996/11/20 18:56:51 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -108,6 +109,7 @@ ie_obio_attach(parent, self, args) void *args; { struct ie_softc *sc = (void *) self; + struct cfdata *cf = self->dv_cfdata; struct confargs *ca = args; sc->hard_type = IE_OBIO; diff --git a/sys/arch/sun3/dev/if_ie_vmes.c b/sys/arch/sun3/dev/if_ie_vmes.c index 31403913eac..02dcc88e697 100644 --- a/sys/arch/sun3/dev/if_ie_vmes.c +++ b/sys/arch/sun3/dev/if_ie_vmes.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie_vmes.c,v 1.6 1996/12/17 21:10:46 gwr Exp $ */ +/* $NetBSD: if_ie_vmes.c,v 1.5 1996/11/20 18:56:51 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -73,9 +74,7 @@ static void ie_vmerun __P((struct ie_softc *)); * zero/copy functions: OBIO can use the normal functions, but VME * must do only byte or half-word (16 bit) accesses... */ -static void wcopy __P((const void *vb1, void *vb2, u_int l)); -static void wzero __P((void *vb, u_int l)); - +static void wcopy(), wzero(); /* * New-style autoconfig attachment @@ -94,9 +93,8 @@ ie_vmes_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; - int x; + int x, sz; #ifdef DIAGNOSTIC if (ca->ca_bustype != BUS_VME16) { diff --git a/sys/arch/sun3/dev/if_ievar.h b/sys/arch/sun3/dev/if_ievar.h index 2923d0a21cd..a68c5142d00 100644 --- a/sys/arch/sun3/dev/if_ievar.h +++ b/sys/arch/sun3/dev/if_ievar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_ievar.h,v 1.7 1996/12/17 21:10:47 gwr Exp $ */ +/* $NetBSD: if_ievar.h,v 1.6 1996/03/26 14:38:33 gwr Exp $ */ /* * Machine-dependent glue for the Intel Ethernet (ie) driver. @@ -67,11 +67,9 @@ struct ie_softc { caddr_t sc_reg; /* KVA of card's register */ enum ie_hardware hard_type; /* card type */ - - /* card dependent functions: */ - void (*reset_586) __P((struct ie_softc *)); - void (*chan_attn) __P((struct ie_softc *)); - void (*run_586) __P((struct ie_softc *)); + void (*reset_586)(); /* card dependent reset function */ + void (*chan_attn)(); /* card dependent attn function */ + void (*run_586)(); /* card dependent "go on-line" function */ void (*sc_bcopy) __P((const void *, void *, u_int)); void (*sc_bzero) __P((void *, u_int)); diff --git a/sys/arch/sun3/dev/if_le.c b/sys/arch/sun3/dev/if_le.c index b6085939fc8..c4ae12b0394 100644 --- a/sys/arch/sun3/dev/if_le.c +++ b/sys/arch/sun3/dev/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.34 1996/12/17 21:10:48 gwr Exp $ */ +/* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -140,6 +141,7 @@ le_attach(parent, self, aux) { struct le_softc *lesc = (struct le_softc *)self; struct am7990_softc *sc = &lesc->sc_am7990; + struct cfdata *cf = self->dv_cfdata; struct confargs *ca = aux; lesc->sc_r1 = (struct lereg1 *) diff --git a/sys/arch/sun3/dev/memerr.c b/sys/arch/sun3/dev/memerr.c index d5e8f4a1b61..0aafc273181 100644 --- a/sys/arch/sun3/dev/memerr.c +++ b/sys/arch/sun3/dev/memerr.c @@ -1,4 +1,4 @@ -/* $NetBSD: memerr.c,v 1.7 1996/12/17 21:10:50 gwr Exp $ */ +/* $NetBSD: memerr.c,v 1.6 1996/11/13 07:05:14 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -49,9 +49,7 @@ #include #include -#include #include -#include #include #include @@ -73,7 +71,7 @@ struct memerr_softc { /* XXX: counters? */ }; -static int memerr_match __P((struct device *, void *, void *)); +static int memerr_match __P((struct device *, void *vcf, void *args)); static void memerr_attach __P((struct device *, struct device *, void *)); static int memerr_interrupt __P((void *)); static void memerr_correctable __P((struct memerr_softc *)); @@ -92,7 +90,7 @@ memerr_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; + struct cfdata *cf = vcf; struct confargs *ca = args; /* This driver only supports one unit. */ @@ -172,7 +170,7 @@ memerr_interrupt(arg) { struct memerr_softc *sc = arg; volatile struct memerr *me = sc->sc_reg; - u_char csr, ctx; + u_char csr, ctx, err; u_int pa, va; int pte; diff --git a/sys/arch/sun3/dev/obio.c b/sys/arch/sun3/dev/obio.c index e46e1db1389..c015d61116c 100644 --- a/sys/arch/sun3/dev/obio.c +++ b/sys/arch/sun3/dev/obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: obio.c,v 1.25 1996/12/17 21:21:13 gwr Exp $ */ +/* $NetBSD: obio.c,v 1.23 1996/11/20 18:56:56 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -41,15 +41,15 @@ #include #include -#include #include #include +#include #include static int obio_match __P((struct device *, void *, void *)); static void obio_attach __P((struct device *, struct device *, void *)); static int obio_print __P((void *, const char *parentname)); -static int obio_submatch __P((struct device *, void *, void *)); +static int obio_submatch __P((struct device *, void *, void *)); struct cfattach obio_ca = { sizeof(struct device), obio_match, obio_attach @@ -60,9 +60,9 @@ struct cfdriver obio_cd = { }; static int -obio_match(parent, cf, aux) +obio_match(parent, vcf, aux) struct device *parent; - void *cf, *aux; + void *vcf, *aux; { struct confargs *ca = aux; @@ -134,11 +134,6 @@ obio_submatch(parent, vcf, aux) * The address assignments are fixed for all time, * so our config files might as well reflect that. */ -#ifdef DIAGNOSTIC - if (cf->cf_paddr == -1) - panic("obio_submatch: invalid address for: %s%d\n", - cf->cf_driver->cd_name, cf->cf_unit); -#endif if (cf->cf_paddr != ca->ca_paddr) return 0; @@ -148,7 +143,7 @@ obio_submatch(parent, vcf, aux) panic("obio_submatch: no match function for: %s\n", cf->cf_driver->cd_name); - return ((*submatch)(parent, cf, aux)); + return ((*submatch)(parent, vcf, aux)); } @@ -195,14 +190,14 @@ caddr_t obio_find_mapping(int pa, int size) */ #define PGBITS (PG_VALID|PG_WRITE|PG_SYSTEM) -static void -save_prom_mappings __P((void)) +static void save_prom_mappings() { - vm_offset_t pa, segva, pgva; + vm_offset_t pa; + caddr_t segva, pgva; int pte, sme, i; - - segva = (vm_offset_t)MONSTART; - while (segva < (vm_offset_t)MONEND) { + + segva = (caddr_t)MONSTART; + while (segva < (caddr_t)MONEND) { sme = get_segmap(segva); if (sme == SEGINV) { segva += NBSG; @@ -227,7 +222,7 @@ save_prom_mappings __P((void)) { i = pa >> SAVE_SHIFT; if (prom_mappings[i] == NULL) { - prom_mappings[i] = (caddr_t)pgva; + prom_mappings[i] = pgva; #ifdef DEBUG mon_printf("obio: found pa=0x%x\n", pa); #endif @@ -262,11 +257,11 @@ static vm_offset_t required_mappings[] = { (vm_offset_t)-1, /* end marker */ }; -static void -make_required_mappings __P((void)) +static void make_required_mappings() { - vm_offset_t *rmp; - + vm_offset_t pa, *rmp; + int idx; + rmp = required_mappings; while (*rmp != (vm_offset_t)-1) { if (!obio_find_mapping(*rmp, NBPG)) { @@ -285,26 +280,17 @@ make_required_mappings __P((void)) /* - * Find mappings for devices that are needed before autoconfiguration. - * We first look for and record any useful PROM mappings, then call - * the "init" functions for drivers that we need to use before the - * normal autoconfiguration calls configure(). + * this routine "configures" any internal OBIO devices which must be + * accessible before the mainline OBIO autoconfiguration as part of + * configure(). */ -void -obio_init() +void obio_init() { save_prom_mappings(); make_required_mappings(); - - /* Init drivers that use the required OBIO mappings. */ - zs_init(); - eeprom_init(); - intreg_init(); - clock_init(); } -caddr_t -obio_alloc(obio_addr, obio_size) +caddr_t obio_alloc(obio_addr, obio_size) int obio_addr, obio_size; { caddr_t cp; diff --git a/sys/arch/sun3/dev/obmem.c b/sys/arch/sun3/dev/obmem.c index 90bdbc81970..c5a0632bce0 100644 --- a/sys/arch/sun3/dev/obmem.c +++ b/sys/arch/sun3/dev/obmem.c @@ -1,4 +1,4 @@ -/* $NetBSD: obmem.c,v 1.12 1996/12/17 21:10:52 gwr Exp $ */ +/* $NetBSD: obmem.c,v 1.11 1996/11/20 18:56:57 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -60,9 +60,9 @@ struct cfdriver obmem_cd = { }; static int -obmem_match(parent, cf, aux) +obmem_match(parent, vcf, aux) struct device *parent; - void *cf, *aux; + void *vcf, *aux; { struct confargs *ca = aux; @@ -73,7 +73,8 @@ obmem_match(parent, cf, aux) static void obmem_attach(parent, self, args) - struct device *parent, *self; + struct device *parent; + struct device *self; void *args; { printf("\n"); diff --git a/sys/arch/sun3/dev/si.c b/sys/arch/sun3/dev/si.c index 7baf362159c..3047596157e 100644 --- a/sys/arch/sun3/dev/si.c +++ b/sys/arch/sun3/dev/si.c @@ -1,4 +1,4 @@ -/* $NetBSD: si.c,v 1.32 1996/12/17 21:10:53 gwr Exp $ */ +/* $NetBSD: si.c,v 1.31 1996/11/20 18:56:59 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -91,6 +91,8 @@ #include #include +#include +#include #include #define DEBUG XXX @@ -142,21 +144,6 @@ struct cfdriver si_cd = { NULL, "si", DV_DULL }; -#ifdef __OpenBSD__ -int ncrprint __P((void *, const char *)); - -int -ncrprint(aux, name) - void *aux; - const char *name; -{ - - if (name != NULL) - printf("%s: scsibus ", name); - return UNCONF; -} -#endif - void si_attach(sc) @@ -185,9 +172,7 @@ si_attach(sc) /* * Fill in the prototype scsi_link. */ -#ifndef __OpenBSD__ ncr_sc->sc_link.channel = SCSI_CHANNEL_ONLY_ONE; -#endif ncr_sc->sc_link.adapter_softc = sc; ncr_sc->sc_link.adapter_target = 7; ncr_sc->sc_link.adapter = &si_ops; @@ -195,7 +180,7 @@ si_attach(sc) #ifdef DEBUG if (si_debug) - printf("si: Set TheSoftC=%p TheRegs=%p\n", sc, regs); + printf("si: Set TheSoftC=%x TheRegs=%x\n", sc, regs); ncr_sc->sc_link.flags |= si_link_flags; #endif @@ -228,11 +213,7 @@ si_attach(sc) si_reset_adapter(ncr_sc); ncr5380_init(ncr_sc); ncr5380_reset_scsibus(ncr_sc); -#ifdef __OpenBSD__ - config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), ncrprint); -#else config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), scsiprint); -#endif } static void @@ -421,7 +402,7 @@ found: dh->dh_dvma = (u_long) dvma_mapin((char *)addr, xlen); if (!dh->dh_dvma) { /* Can't remap segment */ - printf("si_dma_alloc: can't remap %p/0x%x\n", + printf("si_dma_alloc: can't remap %x/%x\n", dh->dh_addr, dh->dh_maplen); dh->dh_flags = 0; return; @@ -476,6 +457,7 @@ si_dma_poll(ncr_sc) { struct si_softc *sc = (struct si_softc *)ncr_sc; struct sci_req *sr = ncr_sc->sc_current; + struct si_dma_handle *dh = sr->sr_dma_hand; volatile struct si_regs *si = sc->sc_regs; int tmo; diff --git a/sys/arch/sun3/dev/si_obio.c b/sys/arch/sun3/dev/si_obio.c index 7ab276ffba9..793c0a3b26c 100644 --- a/sys/arch/sun3/dev/si_obio.c +++ b/sys/arch/sun3/dev/si_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: si_obio.c,v 1.8 1996/12/17 21:10:54 gwr Exp $ */ +/* $NetBSD: si_obio.c,v 1.7 1996/11/20 18:57:00 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -95,6 +95,7 @@ #include #include +#include #include #include @@ -117,12 +118,6 @@ void si_obio_dma_start __P((struct ncr5380_softc *)); void si_obio_dma_eop __P((struct ncr5380_softc *)); void si_obio_dma_stop __P((struct ncr5380_softc *)); -static __inline__ void si_obio_udc_write - __P((volatile struct si_regs *si, int regnum, int value)); -static __inline__ int si_obio_udc_read - __P((volatile struct si_regs *si, int regnum)); - - /* * New-style autoconfig attachment */ @@ -142,8 +137,9 @@ int si_obio_options = 1; /* XXX */ static int si_obio_match(parent, vcf, args) struct device *parent; - void *vcf, *args; + void *vcf, *args; { + struct cfdata *cf = vcf; struct confargs *ca = args; /* Make sure there is something there... */ @@ -262,7 +258,7 @@ si_obio_dma_setup(ncr_sc) #ifdef DEBUG if (si_debug & 2) { - printf("si_dma_setup: dh=%p, pa=0x%x, xlen=0x%x\n", + printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n", dh, data_pa, xlen); } #endif @@ -352,7 +348,7 @@ si_obio_dma_start(ncr_sc) #ifdef DEBUG if (si_debug & 2) { - printf("si_dma_start: sr=%p\n", sr); + printf("si_dma_start: sr=0x%x\n", sr); } #endif diff --git a/sys/arch/sun3/dev/si_vme.c b/sys/arch/sun3/dev/si_vme.c index 1e61083dbb1..3b94011b255 100644 --- a/sys/arch/sun3/dev/si_vme.c +++ b/sys/arch/sun3/dev/si_vme.c @@ -1,4 +1,4 @@ -/* $NetBSD: si_vme.c,v 1.8 1996/12/17 21:10:55 gwr Exp $ */ +/* $NetBSD: si_vme.c,v 1.7 1996/11/20 18:57:01 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -95,6 +95,8 @@ #include #include +#include +#include #include #define DEBUG XXX @@ -131,8 +133,9 @@ int si_vme_options = 3; static int si_vmes_match(parent, vcf, args) struct device *parent; - void *vcf, *args; + void *vcf, *args; { + struct cfdata *cf = vcf; struct confargs *ca = args; int probe_addr; @@ -303,7 +306,7 @@ si_vme_dma_setup(ncr_sc) #ifdef DEBUG if (si_debug & 2) { - printf("si_dma_setup: dh=%p, pa=0x%x, xlen=0x%x\n", + printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n", dh, data_pa, xlen); } #endif @@ -351,6 +354,7 @@ si_vme_dma_start(ncr_sc) struct sci_req *sr = ncr_sc->sc_current; struct si_dma_handle *dh = sr->sr_dma_hand; volatile struct si_regs *si = sc->sc_regs; + long data_pa; int s, xlen; xlen = sc->sc_reqlen; diff --git a/sys/arch/sun3/include/autoconf.h b/sys/arch/sun3/include/autoconf.h index aecad6ea546..e1322fc8f12 100644 --- a/sys/arch/sun3/include/autoconf.h +++ b/sys/arch/sun3/include/autoconf.h @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.h,v 1.13 1996/12/17 21:11:01 gwr Exp $ */ +/* $NetBSD: autoconf.h,v 1.12 1996/11/20 18:57:05 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -38,7 +38,6 @@ /* * Autoconfiguration information. - * (machdep parts of driver/kernel interface) */ /* These are the "bus" types: */ @@ -67,16 +66,3 @@ int bus_print __P((void *, const char *)); int bus_peek __P((int, int, int)); char * bus_mapin __P((int, int, int)); -/* These are how drivers connect interrupt handlers. */ -typedef int (*isr_func_t) __P((void *)); -void isr_add_autovect __P((isr_func_t, void *arg, int level)); -void isr_add_vectored __P((isr_func_t, void *arg, int pri, int vec)); -void isr_add_custom __P((int, void *)); - -/* These control the software interrupt register. */ -void isr_soft_request __P((int level)); -void isr_soft_clear __P((int level)); - -/* Bus-error tolerant access to mapped address. */ -int peek_byte __P((caddr_t)); -int peek_word __P((caddr_t)); diff --git a/sys/arch/sun3/include/conf.h b/sys/arch/sun3/include/conf.h index 69670cd4da5..b510287fa31 100644 --- a/sys/arch/sun3/include/conf.h +++ b/sys/arch/sun3/include/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.3 1996/12/31 06:13:05 kstailey Exp $ */ +/* $OpenBSD: conf.h,v 1.4 1997/01/07 23:36:15 kstailey Exp $ */ /*- * Copyright (c) 1996 Kenneth Stailey. All rights reserved. @@ -67,11 +67,8 @@ cdev_decl(kd); /* frame-buffer devices */ cdev_decl(fb); #include "bwtwo.h" -#define bw2poll seltrue cdev_decl(bw2); #include "cgtwo.h" -#define cg2poll seltrue cdev_decl(cg2); #include "cgfour.h" -#define cg4poll seltrue cdev_decl(cg4); diff --git a/sys/arch/sun3/include/control.h b/sys/arch/sun3/include/control.h index bbd940478b6..56c7d26bd67 100644 --- a/sys/arch/sun3/include/control.h +++ b/sys/arch/sun3/include/control.h @@ -1,4 +1,4 @@ -/* $NetBSD: control.h,v 1.15 1996/12/17 21:11:02 gwr Exp $ */ +/* $NetBSD: control.h,v 1.14 1996/11/20 18:57:06 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -84,19 +84,17 @@ #include -/* ctrlsp.S */ unsigned char get_control_byte __P((char *)); unsigned int get_control_word __P((char *)); void set_control_byte __P((char *, unsigned char)); void set_control_word __P((char *, unsigned int)); -/* control.c */ int get_context __P((void)); void set_context __P((int)); - + vm_offset_t get_pte __P((vm_offset_t va)); void set_pte __P((vm_offset_t, vm_offset_t)); - + unsigned char get_segmap __P((vm_offset_t)); void set_segmap __P((vm_offset_t va, unsigned char)); void set_segmap_allctx __P((vm_offset_t va, unsigned char)); diff --git a/sys/arch/sun3/include/cpu.h b/sys/arch/sun3/include/cpu.h index 38cce484065..dfd987164cf 100644 --- a/sys/arch/sun3/include/cpu.h +++ b/sys/arch/sun3/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.21 1996/12/17 21:11:03 gwr Exp $ */ +/* $NetBSD: cpu.h,v 1.20 1995/12/21 05:02:10 mycroft Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -44,58 +44,53 @@ * cpu.h,v 1.2 1993/05/22 07:58:17 cgd Exp */ +#ifndef _SUN3_CPU_H_ +#define _SUN3_CPU_H_ + #ifdef _KERNEL /* - * External definitions unique to sun3/68k cpu support. - * These are the "public" declarations - those needed in - * machine-independent source code. The "priviate" ones - * are in machdep.h (used only inside sys/arch/sun3). - * - * Note that the name of this file is NOT meant to imply - * that it has anything to do with mc68020 CPU stuff. - * The name "cpu" is historical, and used in the common - * code to identify machine-dependent functions, etc. + * Exported definitions unique to sun3/68k cpu support. */ /* * definitions of cpu-dependent requirements * referenced in generic code */ +#define cpu_swapin(p) /* nothing */ #define cpu_wait(p) /* nothing */ /* * Arguments to hardclock and gatherstats encapsulate the previous * machine state in an opaque clockframe. One the sun3, we use - * what the locore.s glue puts on the stack before calling C-code. + * what the hardware pushes on an interrupt (frame format 0). */ struct clockframe { - u_int cf_regs[4]; /* d0,d1,a0,a1 */ - u_short cf_sr; /* sr at time of interrupt */ - u_long cf_pc; /* pc at time of interrupt */ - u_short cf_vo; /* vector offset (4-word frame) */ + u_short sr; /* sr at time of interrupt */ + u_long pc; /* pc at time of interrupt */ + u_short vo; /* vector offset (4-word frame) */ }; -#define CLKF_USERMODE(framep) (((framep)->cf_sr & PSL_S) == 0) -#define CLKF_BASEPRI(framep) (((framep)->cf_sr & PSL_IPL) == 0) -#define CLKF_PC(framep) ((framep)->cf_pc) +#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0) +#define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0) +#define CLKF_PC(framep) ((framep)->pc) #if 0 /* We would like to do it this way... */ -#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0) +#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0) #else /* but until we start using PSL_M, we have to do this instead */ #define CLKF_INTR(framep) (0) /* XXX */ #endif extern int astpending; /* need to trap before returning to user mode */ -#define aston() (astpending = 1) +#define aston() (astpending++) /* * Preempt the current process if in interrupt from user mode, * or after the current trap/syscall if in system mode. */ extern int want_resched; /* resched() was called */ -#define need_resched() { want_resched = 1; aston(); } +#define need_resched() { want_resched++; aston(); } /* * Give a profiling tick to the current process when the user profiling @@ -116,7 +111,6 @@ extern int want_resched; /* resched() was called */ * isr_soft_request() so this scheme just multiplexes four * software interrupt `sources' on the level one handler. */ -extern void isr_soft_request __P((int level)); union sun3sir { int sir_any; char sir_which[4]; @@ -127,10 +121,63 @@ union sun3sir { #define SIR_SPARE2 2 #define SIR_SPARE3 3 -#define setsoftint(x) isr_soft_request(x) -#define setsoftnet() (sun3sir.sir_which[SIR_NET] = 1, setsoftint(1)) -#define setsoftclock() (sun3sir.sir_which[SIR_CLOCK] = 1, setsoftint(1)) +#define setsoftint() isr_soft_request(1) +#define setsoftnet() (sun3sir.sir_which[SIR_NET] = 1, setsoftint()) +#define setsoftclock() (sun3sir.sir_which[SIR_CLOCK] = 1, setsoftint()) + + +/* + * CTL_MACHDEP definitions. + */ +#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_MAXID 2 /* number of valid machdep ids */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "console_device", CTLTYPE_STRUCT }, \ +} + +/* values for cpu_machine_id */ + +#define CPU_ARCH_MASK 0xf0 +#define SUN3_ARCH 0x10 +#define SUN3_IMPL_MASK 0x0f +#define SUN3_MACH_160 0x01 +#define SUN3_MACH_50 0x02 +#define SUN3_MACH_260 0x03 +#define SUN3_MACH_110 0x04 +#define SUN3_MACH_60 0x07 +#define SUN3_MACH_E 0x08 + +extern unsigned char cpu_machine_id; + +/* 680X0 function codes */ +#define FC_USERD 1 /* user data space */ +#define FC_USERP 2 /* user program space */ +#define FC_CONTROL 3 /* sun control space */ +#define FC_SUPERD 5 /* supervisor data space */ +#define FC_SUPERP 6 /* supervisor program space */ +#define FC_CPU 7 /* CPU space */ + +/* fields in the 68020 cache control register */ +#define IC_ENABLE 0x0001 /* enable instruction cache */ +#define IC_FREEZE 0x0002 /* freeze instruction cache */ +#define IC_CE 0x0004 /* clear instruction cache entry */ +#define IC_CLR 0x0008 /* clear entire instruction cache */ + +#define IC_CLEAR (IC_CLR|IC_ENABLE) #endif /* _KERNEL */ -#include +/* + * CTL_MACHDEP definitions. + */ +#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_MAXID 2 /* number of valid machdep ids */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "console_device", CTLTYPE_STRUCT }, \ +} + +#endif /* !_SUN3_CPU_H_ */ diff --git a/sys/arch/sun3/include/db_machdep.h b/sys/arch/sun3/include/db_machdep.h index ef71424516b..543f101428a 100644 --- a/sys/arch/sun3/include/db_machdep.h +++ b/sys/arch/sun3/include/db_machdep.h @@ -1,14 +1,7 @@ -/* $NetBSD: db_machdep.h,v 1.8 1996/12/17 21:11:05 gwr Exp $ */ +/* $NetBSD: db_machdep.h,v 1.7 1995/02/07 04:34:45 gwr Exp $ */ #include /* This enables some code in db_command.c */ #define DB_MACHINE_COMMANDS -extern char *esym; /* end of symbols */ -void ddb_init __P((void)); -void db_machine_init __P((void)); - -/* These are in db_memrw.c */ -extern void db_read_bytes __P((vm_offset_t addr, size_t size, char *data)); -extern void db_write_bytes __P((vm_offset_t addr, size_t size, char *data)); diff --git a/sys/arch/sun3/include/dvma.h b/sys/arch/sun3/include/dvma.h index 9d6abdeb560..796042aebac 100644 --- a/sys/arch/sun3/include/dvma.h +++ b/sys/arch/sun3/include/dvma.h @@ -1,4 +1,4 @@ -/* $NetBSD: dvma.h,v 1.5 1996/12/17 21:11:05 gwr Exp $ */ +/* $NetBSD: dvma.h,v 1.4 1996/11/20 18:57:08 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -75,16 +75,14 @@ #define DVMA_SPACE_START 0x0FF00000 #define DVMA_SPACE_END 0x0FFFE000 -void dvma_init __P((void)); - /* Allocate/free actual pages of DVMA space. */ -caddr_t dvma_malloc __P((size_t bytes)); +caddr_t dvma_malloc(size_t bytes); void dvma_free(caddr_t addr, size_t bytes); /* Remap/unmap kernel memory in DVMA space. */ -caddr_t dvma_mapin __P((char *kva, int len)); -void dvma_mapout __P((caddr_t dvma_addr, int len)); +caddr_t dvma_mapin(char *kva, int len); +void dvma_mapout(caddr_t dvma_addr, int len); /* Convert a kernel DVMA pointer to a slave address. */ -long dvma_kvtopa __P((long kva, int bus)); +long dvma_kvtopa(long kva, int bus); diff --git a/sys/arch/sun3/include/idprom.h b/sys/arch/sun3/include/idprom.h index 2b8b682d18b..42c30ce4ed1 100644 --- a/sys/arch/sun3/include/idprom.h +++ b/sys/arch/sun3/include/idprom.h @@ -1,4 +1,4 @@ -/* $NetBSD: idprom.h,v 1.13 1996/12/17 21:11:07 gwr Exp $ */ +/* $NetBSD: idprom.h,v 1.12 1996/11/20 18:57:10 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -53,24 +53,8 @@ struct idprom { #define IDPROM_VERSION 1 #define IDPROM_SIZE (sizeof(struct idprom)) -/* values for cpu_machine_id */ - -#define CPU_ARCH_MASK 0xf0 -#define SUN3_ARCH 0x10 -#define SUN3_IMPL_MASK 0x0f -#define SUN3_MACH_160 0x01 -#define SUN3_MACH_50 0x02 -#define SUN3_MACH_260 0x03 -#define SUN3_MACH_110 0x04 -#define SUN3_MACH_60 0x07 -#define SUN3_MACH_E 0x08 - #ifdef _KERNEL - extern struct idprom identity_prom; -extern u_char cpu_machine_id; - -int idprom_init __P((void)); +int idprom_init(); void idprom_etheraddr __P((u_char *)); - -#endif /* _KERNEL */ +#endif diff --git a/sys/arch/sun3/include/isr.h b/sys/arch/sun3/include/isr.h new file mode 100644 index 00000000000..228708ea082 --- /dev/null +++ b/sys/arch/sun3/include/isr.h @@ -0,0 +1,47 @@ +/* $NetBSD: isr.h,v 1.10 1996/11/20 18:57:11 gwr Exp $ */ + +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Adam Glass and Gordon W. Ross. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +void isr_init __P((void)); +void isr_config __P((void)); + +void isr_add_custom __P((int, void (*handler)())); +void isr_add_autovect __P((int (*handler)(), void *arg, int level)); +void isr_add_vectored __P((int (*handler)(), void *arg, int pri, int vec)); + +void isr_soft_request __P((int level)); +void isr_soft_clear __P((int level)); diff --git a/sys/arch/sun3/include/mon.h b/sys/arch/sun3/include/mon.h index fcf37ddfa84..447e1629524 100644 --- a/sys/arch/sun3/include/mon.h +++ b/sys/arch/sun3/include/mon.h @@ -1,4 +1,4 @@ -/* $NetBSD: mon.h,v 1.20 1996/12/17 21:11:08 gwr Exp $ */ +/* $NetBSD: mon.h,v 1.19 1996/11/20 18:57:12 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -103,44 +103,44 @@ typedef struct bootparam { * translate these structs into Sprite format. */ typedef struct { - char *initSp; /* Initial system stack ptr - * for hardware */ - int (*startMon)__P((void)); /* Initial PC for hardware */ + char *initSp; /* Initial system stack ptr + * for hardware */ + int (*startMon)(); /* Initial PC for hardware */ - int *diagberr; /* Bus err handler for diags */ + int *diagberr; /* Bus err handler for diags */ /* * Monitor and hardware revision and identification */ - struct bootparam **bootParam; /* Info for bootstrapped pgm */ - u_int *memorySize; /* Usable memory in bytes */ + struct bootparam **bootParam; /* Info for bootstrapped pgm */ + unsigned *memorySize; /* Usable memory in bytes */ /* * Single-character input and output */ - u_char (*getChar)__P((void)); /* Get char from input source */ - int (*putChar)__P((int)); /* Put char to output sink */ - int (*mayGet)__P((void)); /* Maybe get char, or -1 */ - int (*mayPut)__P((int)); /* Maybe put char, or -1 */ - u_char *echo; /* Should getchar echo? */ - u_char *inSource; /* Input source selector */ - u_char *outSink; /* Output sink selector */ + unsigned char (*getChar)(); /* Get char from input source */ + int (*putChar)(); /* Put char to output sink */ + int (*mayGet)(); /* Maybe get char, or -1 */ + int (*mayPut)(); /* Maybe put char, or -1 */ + unsigned char *echo; /* Should getchar echo? */ + unsigned char *inSource; /* Input source selector */ + unsigned char *outSink; /* Output sink selector */ /* * Keyboard input (scanned by monitor nmi routine) */ - int (*getKey)__P((void)); /* Get next key if one exists */ - int (*initGetKey)__P((void*)); /* Initialize get key */ - u_int *translation; /* Kbd translation selector - (see keyboard.h in sun - monitor code) */ - u_char *keyBid; /* Keyboard ID byte */ - int *screen_x; /* V2: Screen x pos (R/O) */ - int *screen_y; /* V2: Screen y pos (R/O) */ - struct keybuf *keyBuf; /* Up/down keycode buffer */ + int (*getKey)(); /* Get next key if one exists */ + int (*initGetKey)(); /* Initialize get key */ + unsigned int *translation; /* Kbd translation selector + (see keyboard.h in sun + monitor code) */ + unsigned char *keyBid; /* Keyboard ID byte */ + int *screen_x; /* V2: Screen x pos (R/O) */ + int *screen_y; /* V2: Screen y pos (R/O) */ + struct keybuf *keyBuf; /* Up/down keycode buffer */ /* * Monitor revision level. @@ -152,52 +152,51 @@ typedef struct { * Frame buffer output and terminal emulation */ - int (*fbWriteChar)__P((int)); /* Write a character to FB */ - int *fbAddr; /* Address of frame buffer */ - char **font; /* Font table for FB */ - /* Quickly write string to FB */ - int (*fbWriteStr)__P((char *buf, int len)); + int (*fbWriteChar)(); /* Write a character to FB */ + int *fbAddr; /* Address of frame buffer */ + char **font; /* Font table for FB */ + int (*fbWriteStr)(); /* Quickly write string to FB */ /* * Reboot interface routine -- resets and reboots system. No return. */ - int (*reBoot)__P((char *)); /* e.g. reBoot("xy()vmunix") */ + int (*reBoot)(); /* e.g. reBoot("xy()vmunix") */ /* * Line input and parsing */ - u_char *lineBuf; /* The line input buffer */ - u_char **linePtr; /* Cur pointer into linebuf */ - int *lineSize; /* length of line in linebuf */ - int (*getLine)__P((int)); /* Get line from user */ - u_char (*getNextChar)__P((void)); /* Get next char from linebuf */ - u_char (*peekNextChar)__P((void)); /* Peek at next char */ + unsigned char *lineBuf; /* The line input buffer */ + unsigned char **linePtr; /* Cur pointer into linebuf */ + int *lineSize; /* length of line in linebuf */ + int (*getLine)(); /* Get line from user */ + unsigned char (*getNextChar)(); /* Get next char from linebuf */ + unsigned char (*peekNextChar)(); /* Peek at next char */ int *fbThere; /* =1 if frame buffer there */ - int (*getNum)__P((void)); /* Grab hex num from line */ + int (*getNum)(); /* Grab hex num from line */ /* * Print formatted output to current output sink */ - int (*printf)__P((char *, ...)); /* Like kernel printf */ - int (*printHex)__P((int,int)); /* Format N digits in hex */ + int (*printf)(); /* Similar to "Kernel printf" */ + int (*printHex)(); /* Format N digits in hex */ /* * Led stuff */ - u_char *leds; /* RAM copy of LED register */ - int (*setLeds)__P((int)); /* Sets LED's and RAM copy */ + unsigned char *leds; /* RAM copy of LED register */ + int (*setLeds)(); /* Sets LED's and RAM copy */ /* * Non-maskable interrupt (nmi) information */ - int (*nmiAddr)__P((void*)); /* Addr for level 7 vector */ - int (*abortEntry)__P((void*)); /* Entry for keyboard abort */ - int *nmiClock; /* Counts up in msec */ + int (*nmiAddr)(); /* Addr for level 7 vector */ + int (*abortEntry)(); /* Entry for keyboard abort */ + int *nmiClock; /* Counts up in msec */ /* * Frame buffer type: see @@ -209,28 +208,24 @@ typedef struct { * Assorted other things */ - u_int romvecVersion; /* Version # of Romvec */ - struct globram *globRam; /* monitor global variables */ - caddr_t kbdZscc; /* Addr of keyboard in use */ - - int *keyrInit; /* ms before kbd repeat */ - u_char *keyrTick; /* ms between repetitions */ - u_int *memoryAvail; /* V1: Main mem usable size */ - long *resetAddr; /* where to jump on a reset */ - long *resetMap; /* pgmap entry for resetaddr */ - /* Really struct pgmapent * */ - int (*exitToMon)__P((void)); /* Exit from user program */ - u_char **memorybitmap; /* V1: &{0 or &bits} */ - - /* Set seg in all contexts */ - void (*setcxsegmap)__P((int,int,int)); - - /* V2: Handler for 'v' cmd */ - void (**vector_cmd)__P((int, char*)); - int dummy1z; - int dummy2z; - int dummy3z; - int dummy4z; + unsigned romvecVersion; /* Version # of Romvec */ + struct globram *globRam; /* monitor global variables */ + caddr_t kbdZscc; /* Addr of keyboard in use */ + + int *keyrInit; /* ms before kbd repeat */ + unsigned char *keyrTick; /* ms between repetitions */ + unsigned *memoryAvail; /* V1: Main mem usable size */ + long *resetAddr; /* where to jump on a reset */ + long *resetMap; /* pgmap entry for resetaddr */ + /* Really struct pgmapent * */ + int (*exitToMon)(); /* Exit from user program */ + unsigned char **memorybitmap; /* V1: &{0 or &bits} */ + void (*setcxsegmap)(); /* Set seg in any context */ + void (**vector_cmd)(); /* V2: Handler for 'v' cmd */ + int dummy1z; + int dummy2z; + int dummy3z; + int dummy4z; } MachMonRomVector; /* @@ -239,7 +234,7 @@ typedef struct { * * getChar -- Return the next character from the input source * - * u_char getChar() + * unsigned char getChar() * * putChar -- Write the given character to the output source. * @@ -270,12 +265,12 @@ typedef struct { * fbWriteChar -- Write a character to the frame buffer * * void fwritechar(ch) - * u_char ch; + * unsigned char ch; * * fbWriteStr -- Write a string to the frame buffer. * * void fwritestr(addr,len) - * register u_char *addr; / * String to be written * / + * register unsigned char *addr; / * String to be written * / * register short len; / * Length of string * / * * getLine -- read the next input line into a global buffer @@ -285,11 +280,11 @@ typedef struct { * * getNextChar -- return the next character from the global line buffer. * - * u_char getNextChar() + * unsigned char getNextChar() * * peekNextChar -- look at the next character in the global line buffer. * - * u_char peekNextChar() + * unsigned char peekNextChar() * * getNum -- Grab hex num from the global line buffer. * diff --git a/sys/arch/sun3/include/obio.h b/sys/arch/sun3/include/obio.h index 2d2b118f320..e687a5a4206 100644 --- a/sys/arch/sun3/include/obio.h +++ b/sys/arch/sun3/include/obio.h @@ -1,4 +1,4 @@ -/* $NetBSD: obio.h,v 1.17 1996/12/17 21:11:09 gwr Exp $ */ +/* $NetBSD: obio.h,v 1.16 1996/11/20 18:57:14 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -65,29 +65,21 @@ #define OBIO_ZS_SIZE 0x00008 #define OBIO_EEPROM_SIZE 0x00800 #define OBIO_CLOCK_SIZE 0x00020 -#define OBIO_MEMERR_SIZE 0x00008 -#define OBIO_INTERREG_SIZE 0x00001 -#define OBIO_INTEL_ETHER_SIZE 0x00001 -#define OBIO_COLOR_MAP_SIZE 0x00400 -#define OBIO_EPROM_SIZE 0x10000 -#define OBIO_AMD_ETHER_SIZE 0x00004 -#define OBIO_NCR_SCSI_SIZE 0x00020 -#define OBIO_DES_SIZE 0x00004 -#define OBIO_ECCREG_SIZE 0x00100 +#define OBIO_MEMERR_SIZE 0x00008 +#define OBIO_INTERREG_SIZE 0x00001 +#define OBIO_INTEL_ETHER_SIZE 0x00001 +#define OBIO_COLOR_MAP_SIZE 0x00400 +#define OBIO_EPROM_SIZE 0x10000 +#define OBIO_AMD_ETHER_SIZE 0x00004 +#define OBIO_NCR_SCSI_SIZE 0x00020 +#define OBIO_IO_BUS_SIZE 0x1000000 +#define OBIO_DES_SIZE 0x00004 +#define OBIO_ECCREG_SIZE 0x00100 #ifdef _KERNEL -caddr_t obio_alloc __P((int, int)); -void obio_init __P((void)); -caddr_t obio_find_mapping __P((int pa, int size)); -caddr_t obio_vm_alloc __P((int)); - -/* - * These are some OBIO devices that need early init calls. - */ -void zs_init __P((void)); -void eeprom_init __P((void)); -void intreg_init __P((void)); -void clock_init __P((void)); +caddr_t obio_alloc __P((int, int)); +caddr_t obio_vm_alloc __P((int)); +caddr_t obio_find_mapping __P((int pa, int size)); #endif /* _KERNEL */ diff --git a/sys/arch/sun3/include/pmap.h b/sys/arch/sun3/include/pmap.h index 0c4c3b274f9..6f9c9ecb03c 100644 --- a/sys/arch/sun3/include/pmap.h +++ b/sys/arch/sun3/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.16 1996/12/17 21:11:10 gwr Exp $ */ +/* $NetBSD: pmap.h,v 1.15 1996/11/20 18:57:16 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -56,9 +56,6 @@ typedef struct pmap *pmap_t; #ifdef _KERNEL struct pmap kernel_pmap_store; -struct pcb; -void pmap_activate __P((pmap_t pmap, struct pcb *pcbp)); -void pmap_deactivate __P((pmap_t pmap, struct pcb *pcbp)); #define pmap_kernel() (&kernel_pmap_store) diff --git a/sys/arch/sun3/include/proc.h b/sys/arch/sun3/include/proc.h index 9247a10294c..941e467d811 100644 --- a/sys/arch/sun3/include/proc.h +++ b/sys/arch/sun3/include/proc.h @@ -1,8 +1,9 @@ -/* $NetBSD: proc.h,v 1.8 1996/11/25 22:09:11 gwr Exp $ */ +/* $NetBSD: proc.h,v 1.7 1994/11/21 21:34:06 gwr Exp $ */ /* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1994 Gordon W. Ross + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +33,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: proc.h 8.1 (Berkeley) 6/10/93 + * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 + * proc.h,v 1.2 1993/05/22 07:58:30 cgd Exp */ /* diff --git a/sys/arch/sun3/include/psl.h b/sys/arch/sun3/include/psl.h index aee1c2c7d33..4fe2914b7d0 100644 --- a/sys/arch/sun3/include/psl.h +++ b/sys/arch/sun3/include/psl.h @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.11 1996/12/17 21:11:11 gwr Exp $ */ +/* $NetBSD: psl.h,v 1.10 1996/11/20 18:57:17 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -101,12 +101,12 @@ extern __inline__ int _spl(int new) #define splclock() spl5() #define splstatclock() splclock() +/* Zilog Serial hardware interrupts (hard-wired at 6) */ +#define splzs() spl6() + /* Block out all interrupts (except NMI of course). */ #define splhigh() spl7() #define splsched() spl7() -/* Get current sr value (debug, etc.) */ -extern int getsr __P((void)); - #endif /* KERNEL && !_LOCORE */ #endif /* PSL_C */ diff --git a/sys/arch/sun3/include/types.h b/sys/arch/sun3/include/types.h index 10346b657af..db77cff88b8 100644 --- a/sys/arch/sun3/include/types.h +++ b/sys/arch/sun3/include/types.h @@ -1,3 +1,3 @@ -/* $NetBSD: types.h,v 1.10 1996/12/17 21:11:12 gwr Exp $ */ +/* $NetBSD: types.h,v 1.8 1996/11/20 18:57:21 gwr Exp $ */ #include diff --git a/sys/arch/sun3/include/z8530var.h b/sys/arch/sun3/include/z8530var.h index 55bcf558709..1164ad3f7f7 100644 --- a/sys/arch/sun3/include/z8530var.h +++ b/sys/arch/sun3/include/z8530var.h @@ -80,6 +80,3 @@ void zs_abort(); */ #define ZSTTY_MAJOR 12 /* XXX */ #define ZSTTY_DEF_CFLAG (CREAD | CS8 | HUPCL) - -/* Zilog Serial hardware interrupts (hard-wired at 6) */ -#define splzs() spl6() diff --git a/sys/arch/sun3/sun3/autoconf.c b/sys/arch/sun3/sun3/autoconf.c index a373748e8d4..144fa399c65 100644 --- a/sys/arch/sun3/sun3/autoconf.c +++ b/sys/arch/sun3/sun3/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.38 1996/12/17 21:11:14 gwr Exp $ */ +/* $NetBSD: autoconf.c,v 1.37 1996/11/20 18:57:22 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -46,10 +46,11 @@ #include #include -#include #include #include +#include #include +#include #include #include @@ -59,11 +60,14 @@ #include #include -#include +#include #include #include -#include "machdep.h" +extern int soft1intr(); + +void swapgeneric(); +void swapconf(), dumpconf(); int cold; @@ -92,13 +96,13 @@ swapconf() struct swdevt *swp; u_int maj; int nblks; - + for (swp = swdevt; swp->sw_dev != NODEV; swp++) { maj = major(swp->sw_dev); if (maj > nblkdev) /* paranoid? */ break; - + if (bdevsw[maj].d_psize) { nblks = (*bdevsw[maj].d_psize)(swp->sw_dev); if (nblks > 0 && @@ -135,6 +139,8 @@ int bus_scan(parent, child, aux) cfmatch_t mf; #ifdef DIAGNOSTIC + if (parent->dv_cfdata->cf_driver->cd_indirect) + panic("bus_scan: indirect?"); if (cf->cf_fstate == FSTATE_STAR) panic("bus_scan: FSTATE_STAR"); #endif @@ -257,7 +263,7 @@ char * bus_mapin(bustype, paddr, sz) int bustype, paddr, sz; { - int off, pa, pmt; + int off, pa, pgs, pmt; vm_offset_t va, retval; if (bustype & ~3) @@ -290,39 +296,4 @@ bus_mapin(bustype, paddr, sz) #endif return ((char*)retval); -} - -int -peek_word(addr) - register caddr_t addr; -{ - label_t faultbuf; - register int x; - - nofault = &faultbuf; - if (setjmp(&faultbuf)) { - nofault = NULL; - return(-1); - } - x = *(volatile u_short *)addr; - nofault = NULL; - return(x); -} - -/* from hp300: badbaddr() */ -int -peek_byte(addr) - register caddr_t addr; -{ - label_t faultbuf; - register int x; - - nofault = &faultbuf; - if (setjmp(&faultbuf)) { - nofault = NULL; - return(-1); - } - x = *(volatile u_char *)addr; - nofault = NULL; - return(x); -} +} diff --git a/sys/arch/sun3/sun3/cache.c b/sys/arch/sun3/sun3/cache.c index 08c093b76dd..3ffce849895 100644 --- a/sys/arch/sun3/sun3/cache.c +++ b/sys/arch/sun3/sun3/cache.c @@ -1,4 +1,4 @@ -/* $NetBSD: cache.c,v 1.6 1996/12/17 21:11:16 gwr Exp $ */ +/* $NetBSD: cache.c,v 1.5 1996/11/20 18:57:24 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -57,14 +57,12 @@ #include #include -#include "machdep.h" +#include "cache.h" #define CACHE_LINE 16 /* bytes */ #define VAC_FLUSH_INCR 512 /* bytes */ #define VADDR_MASK 0xfFFffFF /* 28 bits */ -static void cache_clear_tags __P((void)); - void cache_flush_page(pgva) vm_offset_t pgva; diff --git a/sys/arch/sun3/sun3/clock.c b/sys/arch/sun3/sun3/clock.c index 17555eb5ec4..6517f3bf051 100644 --- a/sys/arch/sun3/sun3/clock.c +++ b/sys/arch/sun3/sun3/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.32 1996/12/17 21:11:17 gwr Exp $ */ +/* $NetBSD: clock.c,v 1.31 1996/10/30 00:24:42 gwr Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -55,23 +55,20 @@ #include #include -#include +#include #include + #include #include +#include #include "intersil7170.h" #include "interreg.h" -#include "machdep.h" #define CLOCK_PRI 5 -void _isr_clock __P((void)); /* in locore.s */ -void clock_intr __P((struct clockframe)); -static void frob_leds __P((struct clockframe *)); - -/* Note: this is used by locore.s:__isr_clock */ -static volatile char *clock_va; +extern volatile u_char *interrupt_reg; +volatile char *clock_va; #define intersil_clock ((volatile struct intersil7170 *) clock_va) @@ -81,7 +78,7 @@ static volatile char *clock_va; #define intersil_clear() (void)intersil_clock->clk_intr_reg -static int clock_match __P((struct device *, void *, void *)); +static int clock_match __P((struct device *, void *vcf, void *args)); static void clock_attach __P((struct device *, struct device *, void *)); struct cfattach clock_ca = { @@ -97,8 +94,9 @@ clock_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; + struct cfdata *cf = vcf; struct confargs *ca = args; + int pa; /* This driver only supports one unit. */ if (cf->cf_unit != 0) @@ -121,14 +119,14 @@ clock_attach(parent, self, args) struct device *self; void *args; { + struct cfdata *cf = self->dv_cfdata; + struct confargs *ca = args; printf("\n"); /* - * Can not hook up the ISR until cpu_initclocks() + * Can not hook up the ISR until cpu_initclock() * because hardclock is not ready until then. - * For now, the handler is _isr_autovec(), which - * will complain if it gets clock interrupts. */ } @@ -137,7 +135,6 @@ clock_attach(parent, self, args) * register. We have to be extremely careful that we do it * in such a manner that we don't get ourselves lost. */ -void set_clk_mode(on, off, enable) u_char on, off; int enable; @@ -153,7 +150,7 @@ set_clk_mode(on, off, enable) panic("set_clk_mode: map"); /* - * make sure that we are only playing w/ + * make sure that we are only playing w/ * clock interrupt register bits */ on &= (IREG_CLOCK_ENAB_7 | IREG_CLOCK_ENAB_5); @@ -209,6 +206,10 @@ void clock_init() intersil_clear(); } +#ifdef DIAGNOSTIC +static int clk_intr_ready; +#endif + /* * Set up the real-time clock (enable clock interrupts). * Leave stathz 0 since there is no secondary clock available. @@ -218,13 +219,16 @@ void cpu_initclocks(void) { int s; + extern void _isr_clock(); if (!intersil_clock) panic("cpu_initclocks"); s = splhigh(); - /* Install isr (in locore.s) that calls clock_intr(). */ - isr_add_custom(5, (void*)_isr_clock); + isr_add_custom(5, _isr_clock); +#ifdef DIAGNOSTIC + clk_intr_ready = 1; +#endif /* Set the clock to interrupt 100 time per second. */ intersil_clock->clk_intr_reg = INTERSIL_INTER_CSECONDS; @@ -251,40 +255,29 @@ setstatclockrate(newhz) * This is is called by the "custom" interrupt handler * after it has reset the pending bit in the clock. */ -void -clock_intr(cf) - struct clockframe cf; -{ - register volatile struct intersil7170 *clk = intersil_clock; - extern int ticks; - - /* Read the clock interrupt register. */ - (void) clk->clk_intr_reg; - /* Pulse the clock intr. enable low. */ - *interrupt_reg &= ~IREG_CLOCK_ENAB_5; - *interrupt_reg |= IREG_CLOCK_ENAB_5; - /* Read the clock intr. reg AGAIN! */ - (void) clk->clk_intr_reg; - - hardclock(&cf); - - if ((ticks & 7) == 0) - frob_leds(&cf); -} - -static void -frob_leds(cf) - struct clockframe *cf; +int clock_count = 0; +void clock_intr(frame) + struct clockframe *frame; { static unsigned char led_pattern = 0xFE; +#ifdef DIAGNOSTIC + if (!clk_intr_ready) + panic("clock_intr"); +#endif + /* XXX - Move this LED frobbing to the idle loop? */ - led_pattern = (led_pattern << 1) | 1; - if (led_pattern == 0xFF) - led_pattern = 0xFE; - set_control_byte((char *) DIAG_REG, led_pattern); + clock_count++; + if ((clock_count & 7) == 0) { + led_pattern = (led_pattern << 1) | 1; + if (led_pattern == 0xFF) + led_pattern = 0xFE; + set_control_byte((char *) DIAG_REG, led_pattern); + } + hardclock(frame); } + /* * Return the best possible estimate of the time in the timeval * to which tvp points. We do this by returning the current time @@ -385,7 +378,7 @@ void inittodr(fs_time) time.tv_sec = clk_time; } -/* +/* * Resettodr restores the time of day hardware after a time change. */ void resettodr() @@ -507,7 +500,7 @@ void gmt_to_dt(long *tp, struct date_time *dt) dt->dt_month = i; /* Days are what is left over (+1) from all that. */ - dt->dt_day = days + 1; + dt->dt_day = days + 1; } void dt_to_gmt(struct date_time *dt, long *tp) diff --git a/sys/arch/sun3/sun3/conf.c b/sys/arch/sun3/sun3/conf.c index 7c95a5e51dd..c95f1100f90 100644 --- a/sys/arch/sun3/sun3/conf.c +++ b/sys/arch/sun3/sun3/conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.52 1996/12/17 21:11:18 gwr Exp $ */ +/* $NetBSD: conf.c,v 1.51 1996/11/04 16:16:09 gwr Exp $ */ /*- * Copyright (c) 1994 Adam Glass, Gordon W. Ross @@ -46,6 +46,8 @@ #include +int ttselect __P((dev_t, int, struct proc *)); + #include "bpfilter.h" #include "ccd.h" #include "cd.h" @@ -188,7 +190,6 @@ dev_t swapdev = makedev(4, 0); /* * Returns true if dev is /dev/mem or /dev/kmem. */ -int iskmemdev(dev) dev_t dev; { @@ -199,7 +200,6 @@ iskmemdev(dev) /* * Returns true if dev is /dev/zero. */ -int iszerodev(dev) dev_t dev; { @@ -287,7 +287,6 @@ static int chrtoblktbl[] = { /* * Convert a character device number to a block device number. */ -int chrtoblk(dev) dev_t dev; { diff --git a/sys/arch/sun3/sun3/db_machdep.c b/sys/arch/sun3/sun3/db_machdep.c index e179c2f4322..5e35d0a7e93 100644 --- a/sys/arch/sun3/sun3/db_machdep.c +++ b/sys/arch/sun3/sun3/db_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.9 1996/12/17 21:11:19 gwr Exp $ */ +/* $NetBSD: db_machdep.c,v 1.8 1996/11/20 18:57:27 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -45,26 +45,16 @@ #include -#include #include #include -#include #include -#include "machdep.h" -static void db_mach_pagemap __P((db_expr_t, int, db_expr_t, char *)); -static void db_mach_abort __P((db_expr_t, int, db_expr_t, char *)); -static void db_mach_halt __P((db_expr_t, int, db_expr_t, char *)); -static void db_mach_reboot __P((db_expr_t, int, db_expr_t, char *)); - -static void pte_print __P((int)); static char *pgt_names[] = { "MEM", "OBIO", "VMES", "VMEL" }; -static void -pte_print(pte) +void pte_print(pte) int pte; { int t; @@ -90,11 +80,8 @@ pte_print(pte) } static void -db_mach_pagemap(addr, have_addr, count, modif) +db_pagemap(addr) db_expr_t addr; - int have_addr; - db_expr_t count; - char * modif; { int pte, sme; @@ -115,41 +102,20 @@ db_mach_pagemap(addr, have_addr, count, modif) * pgmap: Given addr, Print addr, segmap, pagemap, pte */ -static void -db_mach_abort(addr, have_addr, count, modif) - db_expr_t addr; - int have_addr; - db_expr_t count; - char * modif; -{ - sun3_mon_abort(); -} - -static void -db_mach_halt(addr, have_addr, count, modif) - db_expr_t addr; - int have_addr; - db_expr_t count; - char * modif; -{ - sun3_mon_halt(); -} +extern void sun3_mon_abort(); +extern void sun3_mon_halt(); -static void -db_mach_reboot(addr, have_addr, count, modif) - db_expr_t addr; - int have_addr; - db_expr_t count; - char * modif; +void +db_mon_reboot() { sun3_mon_reboot(""); } struct db_command db_machine_cmds[] = { - { "abort", db_mach_abort, 0, 0 }, - { "halt", db_mach_halt, 0, 0 }, - { "reboot", db_mach_reboot, 0, 0 }, - { "pgmap", db_mach_pagemap, CS_SET_DOT, 0 }, + { "abort", sun3_mon_abort, 0, 0 }, + { "halt", sun3_mon_halt, 0, 0 }, + { "reboot", db_mon_reboot, 0, 0 }, + { "pgmap", db_pagemap, CS_SET_DOT, 0 }, { (char *)0, } }; diff --git a/sys/arch/sun3/sun3/db_memrw.c b/sys/arch/sun3/sun3/db_memrw.c index 5b071d14412..072cc1f5611 100644 --- a/sys/arch/sun3/sun3/db_memrw.c +++ b/sys/arch/sun3/sun3/db_memrw.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_memrw.c,v 1.14 1996/12/17 21:11:20 gwr Exp $ */ +/* $NetBSD: db_memrw.c,v 1.13 1996/11/20 18:57:28 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -53,24 +53,16 @@ */ #include -#include #include #include -#include #include #include #include -#include "machdep.h" - -extern char etext[]; /* defined by the linker */ -extern char kernel_text[]; /* locore.s */ - -static void db_write_text __P((char *, size_t size, char *)); - +#include "cache.h" /* * Read bytes from kernel address space for debugger. @@ -106,18 +98,20 @@ db_read_bytes(addr, size, data) * Makes text page writable temporarily. */ static void -db_write_text(dst, size, data) - register char *dst; +db_write_text(addr, size, data) + vm_offset_t addr; register size_t size; register char *data; { - int oldpte, tmppte; + register char *dst; + int ch, oldpte, tmppte; vm_offset_t pgva, prevpg; /* Prevent restoring a garbage PTE. */ if (size <= 0) return; + dst = (char*)addr; pgva = sun3_trunc_page((long)dst); goto firstpage; @@ -147,7 +141,7 @@ db_write_text(dst, size, data) #endif oldpte = get_pte(pgva); if ((oldpte & PG_VALID) == 0) { - printf(" address %p not a valid page\n", dst); + printf(" address 0x%x not a valid page\n", dst); return; } tmppte = oldpte | PG_WRITE | PG_NC; @@ -171,6 +165,7 @@ db_write_text(dst, size, data) /* * Write bytes to kernel address space for debugger. */ +extern char kernel_text[], etext[]; void db_write_bytes(addr, size, data) vm_offset_t addr; diff --git a/sys/arch/sun3/sun3/dvma.c b/sys/arch/sun3/sun3/dvma.c index 7ec7ada5083..64c736e8103 100644 --- a/sys/arch/sun3/sun3/dvma.c +++ b/sys/arch/sun3/sun3/dvma.c @@ -1,4 +1,4 @@ -/* $NetBSD: dvma.c,v 1.6 1996/12/17 21:11:23 gwr Exp $ */ +/* $NetBSD: dvma.c,v 1.5 1996/11/20 18:57:29 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -54,13 +54,12 @@ #include #include -#include #include #include #include #include -#include "machdep.h" +#include "cache.h" /* Resource map used by dvma_mapin/dvma_mapout */ #define NUM_DVMA_SEGS 10 @@ -72,8 +71,7 @@ vm_size_t dvma_segmap_size = 6 * NBSG; /* Using phys_map to manage DVMA scratch-memory pages. */ /* Note: Could use separate pagemap for obio if needed. */ -void -dvma_init() +void dvma_init() { vm_offset_t segmap_addr; @@ -145,7 +143,7 @@ long dvma_kvtopa(kva, bustype) long kva; int bustype; { - long mask = 0; + long mask; if (kva < DVMA_SPACE_START || kva >= DVMA_SPACE_END) panic("dvma_kvtopa: bad dmva addr=0x%x\n", kva); diff --git a/sys/arch/sun3/sun3/fpu.c b/sys/arch/sun3/sun3/fpu.c index adb7d8656ac..1d56a0a9ed2 100644 --- a/sys/arch/sun3/sun3/fpu.c +++ b/sys/arch/sun3/sun3/fpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: fpu.c,v 1.10 1996/12/17 21:11:23 gwr Exp $ */ +/* $NetBSD: fpu.c,v 1.9 1996/11/20 18:57:29 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -54,9 +54,11 @@ #include #include "interreg.h" -#include "machdep.h" -static int fpu_probe __P((void)); +extern int fpu_type; +extern long *nofault; + +int fpu_probe(); static char *fpu_descr[] = { #ifdef FPU_EMULATE @@ -68,8 +70,7 @@ static char *fpu_descr[] = { "mc68882", /* 2 */ "?" }; -void -initfpu() +void initfpu() { char *descr; int enab_reg; @@ -95,20 +96,19 @@ initfpu() } } -static int -fpu_probe() +int fpu_probe() { label_t faultbuf; - struct fpframe null_fpf; + int null_fpframe[2]; - nofault = &faultbuf; + nofault = (long *) &faultbuf; if (setjmp(&faultbuf)) { nofault = NULL; return(0); } - bzero(&null_fpf, sizeof(null_fpf)); - /* This will trap if there is no FPU present. */ - m68881_restore(&null_fpf); + null_fpframe[0] = 0; + null_fpframe[1] = 0; + m68881_restore(null_fpframe); nofault = NULL; return(1); } diff --git a/sys/arch/sun3/sun3/genassym.c b/sys/arch/sun3/sun3/genassym.c index 9b2eb8da0f8..dcbee10994d 100644 --- a/sys/arch/sun3/sun3/genassym.c +++ b/sys/arch/sun3/sun3/genassym.c @@ -1,4 +1,4 @@ -/* $NetBSD: genassym.c,v 1.33 1996/12/17 21:11:25 gwr Exp $ */ +/* $NetBSD: genassym.c,v 1.32 1996/10/23 16:39:27 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -56,8 +56,9 @@ #include #include +#include "intersil7170.h" +#include "interreg.h" #include "buserr.h" -#include "machdep.h" #if 1 /* XXX - Temporary hack... */ /* @@ -83,9 +84,6 @@ struct mytrapframe { #define def1(name) def("name", name) #endif -extern void printf __P((char *fmt, ...)); -extern void exit __P((int)); - void def(what, val) char *what; @@ -101,9 +99,15 @@ main() struct pcb *pcb = (struct pcb *) 0; struct proc *p = (struct proc *) 0; struct vmspace *vms = (struct vmspace *) 0; + struct intersil7170 *intersil_addr = (struct intersil7170 *) 0; struct trapframe *tf = (struct trapframe *) 0; struct fpframe *fpf = (struct fpframe *) 0; + /* intersil clock internals */ + def("IREG_CLOCK_ENAB_5", IREG_CLOCK_ENAB_5); + def("INTERSIL_INTR_OFFSET", &intersil_addr->clk_intr_reg); + def1(INTERSIL_INTER_CSECONDS); + /* bus error stuff */ def1(BUSERR_REG); def1(BUSERR_MMU); @@ -146,7 +150,7 @@ main() def1(ENAMETOOLONG); /* trap types: locore.s includes trap.h */ - + /* * unix structure-isms */ diff --git a/sys/arch/sun3/sun3/interreg.h b/sys/arch/sun3/sun3/interreg.h index fc5ba82cc56..6fe6c3896b3 100644 --- a/sys/arch/sun3/sun3/interreg.h +++ b/sys/arch/sun3/sun3/interreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: interreg.h,v 1.8 1996/12/17 21:11:26 gwr Exp $ */ +/* $NetBSD: interreg.h,v 1.7 1996/11/20 18:57:30 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -47,6 +47,4 @@ #define IREG_BITS "\20\8CLK7\7RSV6\6CLK5\5VIDEO\4SOFT3\3SOFT2\2SOFT1\1ALL\n" -extern volatile u_char *interrupt_reg; - -void set_clk_mode __P((u_char on, u_char off, int enable)); +int set_clk_mode(u_char on, u_char off, int enable); diff --git a/sys/arch/sun3/sun3/intersil7170.h b/sys/arch/sun3/sun3/intersil7170.h index 5ad4634fb4e..848765bbfe4 100644 --- a/sys/arch/sun3/sun3/intersil7170.h +++ b/sys/arch/sun3/sun3/intersil7170.h @@ -1,4 +1,4 @@ -/* $NetBSD: intersil7170.h,v 1.10 1996/12/17 21:11:27 gwr Exp $ */ +/* $NetBSD: intersil7170.h,v 1.9 1996/11/20 18:57:31 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ /* * Driver support for the intersil7170 used in sun[34]s to provide * real time clock and time-of-day support. - * + * * Derived from: datasheet "ICM7170 a uP-Compatible Real-Time Clock" * document #301680-005, Dec 85 */ @@ -63,7 +63,7 @@ struct intersil7170 { }; /* bit assignments for command register, p. 6 of 10, write-only */ -#define INTERSIL_CMD_FREQ_32K 0x0 +#define INTERSIL_CMD_FREQ_32K 0x0 #define INTERSIL_CMD_FREQ_1M 0x1 #define INTERSIL_CMD_FREQ_2M 0x2 #define INTERSIL_CMD_FREQ_4M 0x3 diff --git a/sys/arch/sun3/sun3/intreg.c b/sys/arch/sun3/sun3/intreg.c index 40d6c243680..fd10cd7ac43 100644 --- a/sys/arch/sun3/sun3/intreg.c +++ b/sys/arch/sun3/sun3/intreg.c @@ -1,4 +1,4 @@ -/* $NetBSD: intreg.c,v 1.6 1996/12/17 21:11:28 gwr Exp $ */ +/* $NetBSD: intreg.c,v 1.5 1996/11/20 18:57:32 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -50,18 +50,18 @@ #include #include #include +#include #include "interreg.h" -#include "machdep.h" struct intreg_softc { struct device sc_dev; volatile u_char *sc_reg; }; -static int intreg_match __P((struct device *, void *, void *)); +static int intreg_match __P((struct device *, void *vcf, void *args)); static void intreg_attach __P((struct device *, struct device *, void *)); -static int soft1intr __P((void *)); +static int soft1intr(); struct cfattach intreg_ca = { sizeof(struct intreg_softc), intreg_match, intreg_attach @@ -75,8 +75,7 @@ volatile u_char *interrupt_reg; /* called early (by internal_configure) */ -void -intreg_init() +void intreg_init() { interrupt_reg = obio_find_mapping(OBIO_INTERREG, 1); if (!interrupt_reg) @@ -91,8 +90,9 @@ intreg_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; + struct cfdata *cf = vcf; struct confargs *ca = args; + int pa; /* This driver only supports one unit. */ if (cf->cf_unit != 0) @@ -113,6 +113,7 @@ intreg_attach(parent, self, args) void *args; { struct intreg_softc *sc = (void *)self; + struct cfdata *cf = self->dv_cfdata; printf("\n"); @@ -129,12 +130,11 @@ intreg_attach(parent, self, args) * Network software interrupt * Soft clock interrupt */ -static int -soft1intr(arg) +int soft1intr(arg) void *arg; { union sun3sir sir; - int s; + int n, s; s = splhigh(); sir.sir_any = sun3sir.sir_any; diff --git a/sys/arch/sun3/sun3/isr.c b/sys/arch/sun3/sun3/isr.c index 3fe28d94776..f2ddb867afc 100644 --- a/sys/arch/sun3/sun3/isr.c +++ b/sys/arch/sun3/sun3/isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: isr.c,v 1.26 1996/12/17 21:11:29 gwr Exp $ */ +/* $NetBSD: isr.c,v 1.25 1996/11/20 18:57:32 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -43,75 +43,47 @@ #include #include -#include #include #include #include -#include #include #include #include +#include -#include "machdep.h" #include "vector.h" +#include "ether.h" /* for NETHER */ + extern int intrcnt[]; /* statistics */ #define NUM_LEVELS 8 struct isr { struct isr *isr_next; - isr_func_t isr_intr; + int (*isr_intr)(); void *isr_arg; int isr_ipl; }; -void set_vector_entry __P((int, void *)); -void * get_vector_entry __P((int)); - -/* - * These are called from locore. The "struct clockframe" arg - * is really just the normal H/W interrupt frame format. - * (kern_clock really wants it to be named that...) - */ -void isr_autovec __P((struct clockframe)); -void isr_vectored __P((struct clockframe)); - +void set_vector_entry __P((int, void (*handler)())); +unsigned int get_vector_entry __P((int)); -void -isr_add_custom(level, handler) +void isr_add_custom(level, handler) int level; - void *handler; + void (*handler)(); { set_vector_entry(AUTOVEC_BASE + level, handler); } - /* - * netisr junk... * XXX - This really belongs in some common file, * i.e. src/sys/net/netisr.c * Also, should use an array of chars instead of * a bitmask to avoid atomicity locking issues. */ - -#include "ether.h" /* for NETHER */ -#include "ppp.h" - -/* - * Declarations for the netisr functions... - * They are in the header files, but that's not - * really a good reason to drag all those in. - */ -void arpintr __P((void)); -void ipintr __P((void)); -void nsintr __P((void)); -void clnlintr __P((void)); -void ccittintr __P((void)); -void pppintr __P((void)); - void netintr() { int n, s; @@ -142,6 +114,7 @@ void netintr() ccittintr(); } #endif +#include "ppp.h" #if NPPP > 0 if (n & (1 << NETISR_PPP)) { pppintr(); @@ -156,13 +129,13 @@ static struct isr *isr_autovec_list[NUM_LEVELS]; * This is called by the assembly routines * for handling auto-vectored interupts. */ -void isr_autovec(cf) - struct clockframe cf; +void isr_autovec(evec) + int evec; /* format | vector offset */ { struct isr *isr; register int n, ipl, vec; - vec = (cf.cf_vo & 0xFFF) >> 2; + vec = (evec & 0xFFF) >> 2; if ((vec < AUTOVEC_BASE) || (vec >= (AUTOVEC_BASE+8))) panic("isr_autovec: bad vec"); ipl = vec - 0x18; @@ -193,7 +166,7 @@ void isr_autovec(cf) * Called by driver attach functions. */ void isr_add_autovect(handler, arg, level) - isr_func_t handler; + int (*handler)(); void *arg; int level; { @@ -213,8 +186,9 @@ void isr_add_autovect(handler, arg, level) isr_autovec_list[level] = new_isr; } +extern void badtrap(); struct vector_handler { - isr_func_t func; + int (*func)(); void *arg; }; static struct vector_handler isr_vector_handlers[192]; @@ -224,13 +198,13 @@ static struct vector_handler isr_vector_handlers[192]; * for handling vectored interupts. */ void -isr_vectored(cf) - struct clockframe cf; +isr_vectored(evec) + int evec; /* format | vector offset */ { struct vector_handler *vh; register int ipl, vec; - vec = (cf.cf_vo & 0xFFF) >> 2; + vec = (evec & 0xFFF) >> 2; ipl = getsr(); ipl = (ipl >> 8) & 7; @@ -244,7 +218,7 @@ isr_vectored(cf) vh = &isr_vector_handlers[vec - 64]; if (vh->func == NULL) { printf("isr_vectored: vector=0x%x (nul func)\n", vec); - set_vector_entry(vec, (void *)badtrap); + set_vector_entry(vec, badtrap); return; } @@ -257,10 +231,9 @@ isr_vectored(cf) * Establish an interrupt handler. * Called by driver attach functions. */ -extern void _isr_vectored __P((void)); -void -isr_add_vectored(func, arg, level, vec) - isr_func_t func; +extern void _isr_vectored(); +void isr_add_vectored(func, arg, level, vec) + int (*func)(); void *arg; int level, vec; { @@ -277,27 +250,24 @@ isr_add_vectored(func, arg, level, vec) } vh->func = func; vh->arg = arg; - set_vector_entry(vec, (void *)_isr_vectored); + set_vector_entry(vec, _isr_vectored); } /* * XXX - could just kill these... */ -void -set_vector_entry(entry, handler) +void set_vector_entry(entry, handler) int entry; - void *handler; + void (*handler)(); { if ((entry <0) || (entry >= NVECTORS)) panic("set_vector_entry: setting vector too high or low\n"); - vector_table[entry] = handler; + vector_table[entry] = handler; } - -void * -get_vector_entry(entry) +unsigned int get_vector_entry(entry) int entry; { if ((entry <0) || (entry >= NVECTORS)) panic("get_vector_entry: setting vector too high or low\n"); - return ((void *) vector_table[entry]); + return (unsigned int) vector_table[entry]; } diff --git a/sys/arch/sun3/sun3/kgdb_stub.c b/sys/arch/sun3/sun3/kgdb_stub.c index 12621266985..ce3ed8f4703 100644 --- a/sys/arch/sun3/sun3/kgdb_stub.c +++ b/sys/arch/sun3/sun3/kgdb_stub.c @@ -1,4 +1,4 @@ -/* $NetBSD: kgdb_stub.c,v 1.7 1996/12/17 21:11:30 gwr Exp $ */ +/* $NetBSD: kgdb_stub.c,v 1.6 1996/10/23 16:30:48 gwr Exp $ */ /* * Copyright (c) 1990, 1993 @@ -63,9 +63,12 @@ #include #include -#include #include +/* These are in db_memrw.c */ +extern void db_read_bytes __P((vm_offset_t addr, size_t size, char *data)); +extern void db_write_bytes __P((vm_offset_t addr, size_t size, char *data)); + #ifndef KGDBDEV #define KGDBDEV -1 #endif @@ -216,7 +219,7 @@ restart: * Translate a trap number into a unix compatible signal value. * (gdb only understands unix signal numbers). */ -static int +static int computeSignal(type) int type; { diff --git a/sys/arch/sun3/sun3/locore.s b/sys/arch/sun3/sun3/locore.s index b029428f68e..15794d5362f 100644 --- a/sys/arch/sun3/sun3/locore.s +++ b/sys/arch/sun3/sun3/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.41 1996/12/17 21:11:31 gwr Exp $ */ +/* $NetBSD: locore.s,v 1.40 1996/11/06 20:19:54 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -134,9 +134,9 @@ L_high_code: * cpu_set_kpc() to arrange for a call to a kernel function * before the new process does its rte out to user mode. */ - clrw sp@- | vector offset/frame type + clrw sp@- | vector offset/frame type clrl sp@- | PC - filled in by "execve" - movw #PSL_USER,sp@- | in user mode + movw #PSL_USER,sp@- | in user mode clrl sp@- | stack adjust count and padding lea sp@(-64),sp | construct space for D0-D7/A0-A7 lea _proc0,a0 | proc0 in a0 @@ -154,7 +154,7 @@ _proc_do_uret: movl a0,usp | user SP moveml sp@+,#0x7FFF | load most registers (all but SSP) addql #8,sp | pop SSP and stack adjust count - rte + rte /* * proc_trampoline: @@ -246,12 +246,12 @@ Lbe10: /* * the sun3 specific code - * + * * our mission: figure out whether what we are looking at is * bus error in the UNIX sense, or * a memory error i.e a page fault * - * [this code replaces similarly mmu specific code in the hp300 code] + * [this code replaces similarly mmu specific code in the hp300 code] */ sun3_mmu_specific: clrl d0 | make sure top bits are cleard too @@ -571,7 +571,7 @@ Lbrkpt2: jne Lbrkpt3 | yes, done #endif #ifdef DDB - | Let DDB handle it. + | Let DDB handle it. movl a2,sp@- | push frame ptr movl d2,sp@- | push trap type jbsr _kdb_trap | handle the trap @@ -616,8 +616,6 @@ _trap12: /* * Interrupt handlers. Most are auto-vectored, * and hard-wired the same way on all sun3 models. - * Format in the stack is: - * d0,d1,a0,a1, sr, pc, vo */ #define INTERRUPT_SAVEREG \ @@ -626,36 +624,53 @@ _trap12: #define INTERRUPT_RESTORE \ moveml sp@+,#0x0303 +.align 4 /* * This is the common auto-vector interrupt handler, * for which the CPU provides the vector=0x18+level. * These are installed in the interrupt vector table. */ - .align 2 - .globl __isr_autovec, _isr_autovec + .globl __isr_autovec __isr_autovec: INTERRUPT_SAVEREG - jbsr _isr_autovec + movw sp@(22),sp@- | push exception vector info + clrw sp@- + jbsr _isr_autovec | C dispatcher + addql #4,sp INTERRUPT_RESTORE - jra rei + jra rei /* XXX - Just do rte here? */ /* clock: see clock.c */ - .align 2 - .globl __isr_clock, _clock_intr +.globl __isr_clock, _interrupt_reg, _clock_intr, _clock_va +.align 4 __isr_clock: - INTERRUPT_SAVEREG + INTERRUPT_SAVEREG | save a0, a1, d0, d1 + movl _clock_va, a0 + movl _interrupt_reg, a1 + tstb a0@(INTERSIL_INTR_OFFSET) + andb #~IREG_CLOCK_ENAB_5, a1@ + orb #IREG_CLOCK_ENAB_5, a1@ + tstb a0@(INTERSIL_INTR_OFFSET) +| used to have "timebomb" check here... + lea sp@(16),a1 | a1 = &clockframe + movl a1,sp@- jbsr _clock_intr + addql #4,sp INTERRUPT_RESTORE jra rei | Handler for all vectored interrupts (i.e. VME interrupts) - .align 2 - .globl __isr_vectored, _isr_vectored + .globl _isr_vectored + .globl __isr_vectored __isr_vectored: INTERRUPT_SAVEREG - jbsr _isr_vectored + movw sp@(22),sp@- | push exception vector info + clrw sp@- + jbsr _isr_vectored | C dispatcher + addql #4,sp | INTERRUPT_RESTORE - jra rei + jra rei | all done + #undef INTERRUPT_SAVEREG #undef INTERRUPT_RESTORE @@ -936,7 +951,7 @@ ENTRY(switch_exit) .data .globl _Idle_count _Idle_count: - .long 0 + .long 0 .text .globl Idle @@ -944,7 +959,7 @@ Lidle: stop #PSL_LOWIPL Idle: movw #PSL_HIGHIPL,sr - addql #1, _Idle_count + addql #1, _Idle_count tstl _whichqs jeq Lidle movw #PSL_LOWIPL,sr @@ -957,7 +972,7 @@ Lbadsw: /* * cpu_switch() - * Hacked for sun3 + * Hacked for sun3 * XXX - Arg 1 is a proc pointer (curproc) but this doesn't use it. * XXX - Sould we use p->p_addr instead of curpcb? -gwr */ @@ -1219,6 +1234,8 @@ ENTRY(_remque) /* * Save and restore 68881 state. + * Pretty awful looking since our assembler does not + * recognize FP mnemonics. */ ENTRY(m68881_save) movl sp@(4),a0 | save area pointer diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index 2340df63410..70ddac1f9d4 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.79 1996/12/17 21:35:30 gwr Exp $ */ +/* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -78,33 +78,34 @@ #include #endif -#include -#include -#include -#include - -#include - #include #include #include #include -#include -#include +#include +#include #include -#include -#include "machdep.h" +#include + +#include +#include +#include +#include + +#include + +#include "cache.h" extern char *cpu_string; extern char version[]; extern short exframesize[]; +extern vm_offset_t vmmap; /* XXX - poor name. See mem.c */ +extern int cold; -int physmem; -int fpu_type; -int msgbufmapped; - -vm_offset_t vmmap; +int physmem; +int fpu_type; +int msgbufmapped; /* * safepri is a safe priority for sleep to set for a spin-wait @@ -126,10 +127,9 @@ int bufpages = BUFPAGES; #else int bufpages = 0; #endif -label_t *nofault; +long *nofault; -static void identifycpu __P((void)); -static void initcpu __P((void)); +void identifycpu(); /* * Console initialization: called early on from main, @@ -138,7 +138,8 @@ static void initcpu __P((void)); */ void consinit() { - cninit(); + extern void cninit(); + cninit(); #ifdef KGDB /* XXX - Ask on console for kgdb_dev? */ @@ -153,7 +154,7 @@ void consinit() ddb_init(); if (boothowto & RB_KDB) Debugger(); -#endif DDB +#endif } /* @@ -169,7 +170,6 @@ void consinit() */ #define valloc(name, type, num) \ v = (caddr_t)(((name) = (type *)v) + (num)) -static caddr_t allocsys __P((caddr_t)); static caddr_t allocsys(v) register caddr_t v; @@ -212,8 +212,6 @@ allocsys(v) if (nbuf < 16) nbuf = 16; } - if (nbuf > 200) /* XXX Sorry, our kvm space is too small */ - nbuf = 200; if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; /* force even */ if (nswbuf > 256) @@ -238,15 +236,15 @@ cpu_startup() { caddr_t v; int sz, i; - vm_size_t size; + vm_size_t size; int base, residual; vm_offset_t minaddr, maxaddr; - + /* * The msgbuf was set up earlier (in sun3_startup.c) * just because it was more convenient to do there. */ - + /* * Good {morning,afternoon,evening,night}. */ @@ -394,7 +392,6 @@ setregs(p, pack, stack, retval) if (fpu_type) { m68881_restore(&p->p_addr->u_pcb.pcb_fpregs); } - p->p_md.md_flags = 0; /* XXX - HPUX sigcode hack would go here... */ } @@ -424,7 +421,6 @@ identifycpu() /* * machine dependent system variables. */ -int cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int *name; u_int namelen; @@ -434,7 +430,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) size_t newlen; struct proc *p; { - int error; dev_t consdev; /* all sysctl names at this level are terminal */ @@ -447,24 +442,12 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) consdev = cn_tab->cn_dev; else consdev = NODEV; - error = sysctl_rdstruct(oldp, oldlenp, newp, - &consdev, sizeof consdev); - break; - -#if 0 /* XXX - Not yet... */ - case CPU_ROOT_DEVICE: - error = sysctl_rdstring(oldp, oldlenp, newp, root_device); - break; - - case CPU_BOOTED_KERNEL: - error = sysctl_rdstring(oldp, oldlenp, newp, booted_kernel); - break; -#endif - + return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev, + sizeof consdev)); default: - error = EOPNOTSUPP; + return (EOPNOTSUPP); } - return (error); + /* NOTREACHED */ } #define SS_RTEFRAME 1 @@ -534,7 +517,7 @@ sendsig(catcher, sig, mask, code) psp->ps_sigstk.ss_flags |= SS_ONSTACK; } else fp = (struct sigframe *)(frame->f_regs[SP] - fsize); - if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) + if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) (void)grow(p, (unsigned)fp); #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) @@ -560,7 +543,7 @@ sendsig(catcher, sig, mask, code) return; } kfp = (struct sigframe *)malloc((u_long)fsize, M_TEMP, M_WAITOK); - /* + /* * Build the argument list for the signal handler. */ kfp->sf_signum = sig; @@ -746,7 +729,7 @@ sys_sigreturn(p, v, retval) */ if (flags & SS_RTEFRAME) { register int sz; - + /* grab frame type and validate */ sz = tstate.ss_frame.f_format; if (sz > 15 || (sz = exframesize[sz]) < 0) @@ -787,8 +770,7 @@ sys_sigreturn(p, v, retval) * XXX - Put waittime checks in there too? */ int waittime = -1; /* XXX - Who else looks at this? -gwr */ -static void -reboot_sync __P((void)) +static void reboot_sync() { extern struct proc proc0; struct buf *bp; @@ -806,7 +788,6 @@ reboot_sync __P((void)) /* * Common part of the BSD and SunOS reboot system calls. - * Warning: OpenBSD doesn't use a second arg to boot() */ int reboot2(howto, user_boot_string) int howto; @@ -906,7 +887,7 @@ long dumplo = 0; /* blocks */ vm_offset_t dumppage_va; vm_offset_t dumppage_pa; -#define DUMP_EXTRA 3 /* CPU-dependent extra pages */ +#define DUMP_EXTRA 3 /* CPU-dependent extra pages */ /* * This is called by cpu_startup to set dumplo, dumpsize. @@ -920,7 +901,7 @@ dumpconf() { int nblks; /* size of dump area */ int maj; - int (*getsize)__P((dev_t)); + int (*getsize)(); if (dumpdev == NODEV) return; @@ -936,7 +917,7 @@ dumpconf() return; /* Position dump image near end of space, page aligned. */ - dumpsize = physmem + DUMP_EXTRA; /* pages */ + dumpsize = physmem + DUMP_EXTRA; /* pages */ dumplo = nblks - ctod(dumpsize); dumplo &= ~(ctod(1)-1); @@ -959,12 +940,11 @@ extern vm_offset_t avail_start; * pagemap (2*NBPG) * physical memory... */ -void dumpsys() { struct bdevsw *dsw; kcore_seg_t *kseg_p; - cpu_kcore_hdr_t *chdr_p; + cpu_kcore_hdr_t *chdr_p; char *vaddr; vm_offset_t paddr; int psize, todo, chunk; @@ -977,7 +957,7 @@ dumpsys() if (dumppage_va == 0) return; - /* + /* * For dumps during autoconfiguration, * if dump device has already configured... */ @@ -1018,14 +998,14 @@ dumpsys() blkno += btodb(NBPG); /* translation RAM (page zero) */ - pmap_get_pagemap((int*)vaddr, 0); + pmap_get_pagemap(vaddr, 0); error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); if (error) goto fail; blkno += btodb(NBPG); /* translation RAM (page one) */ - pmap_get_pagemap((int*)vaddr, NBPG); + pmap_get_pagemap(vaddr, NBPG); error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); if (error) goto fail; @@ -1080,7 +1060,6 @@ fail: printf(" dump error=%d\n", error); } -static void initcpu() { /* XXX: Enable RAM parity/ECC checking? */ @@ -1093,32 +1072,57 @@ initcpu() #endif } -/* called from locore.s */ -void straytrap __P((struct trapframe)); -void straytrap(frame) - struct trapframe frame; + struct frame frame; { - printf("unexpected trap; vector=0x%x at pc=0x%x\n", - frame.tf_vector, frame.tf_pc); + printf("unexpected trap; vector offset 0x%x from 0x%x\n", + frame.f_vector, frame.f_pc); #ifdef DDB - /* XXX - Yuck! Make DDB use "struct trapframe" instead! */ - kdb_trap(-1, (struct mc68020_saved_state *) &frame); + kdb_trap(-1, &frame); #endif } /* from hp300: badaddr() */ -/* peek_byte(), peek_word() moved to autoconf.c */ +int +peek_word(addr) + register caddr_t addr; +{ + label_t faultbuf; + register int x; -/* XXX: parityenable() ? */ + nofault = (long*)&faultbuf; + if (setjmp(&faultbuf)) { + nofault = NULL; + return(-1); + } + x = *(volatile u_short *)addr; + nofault = NULL; + return(x); +} -static void dumpmem __P((int *, int, int)); -static char *hexstr __P((int, int)); +/* from hp300: badbaddr() */ +int +peek_byte(addr) + register caddr_t addr; +{ + label_t faultbuf; + register int x; + + nofault = (long*)&faultbuf; + if (setjmp(&faultbuf)) { + nofault = NULL; + return(-1); + } + x = *(volatile u_char *)addr; + nofault = NULL; + return(x); +} + +/* XXX: parityenable() ? */ /* * Print a register and stack dump. */ -void regdump(fp, sbytes) struct frame *fp; /* must not be register */ int sbytes; @@ -1126,6 +1130,7 @@ regdump(fp, sbytes) static int doingdump = 0; register int i; int s; + extern char *hexstr(); if (doingdump) return; @@ -1161,12 +1166,12 @@ regdump(fp, sbytes) #define KSADDR ((int *)((u_int)curproc->p_addr + USPACE - NBPG)) -static void dumpmem(ptr, sz, ustack) register int *ptr; int sz, ustack; { register int i, val; + extern char *hexstr(); for (i = 0; i < sz; i++) { if ((i & 7) == 0) @@ -1187,7 +1192,7 @@ dumpmem(ptr, sz, ustack) printf("\n"); } -static char * +char * hexstr(val, len) register int val; int len; @@ -1210,11 +1215,10 @@ hexstr(val, len) /* * cpu_exec_aout_makecmds(): * cpu-dependent a.out format hook for execve(). - * + * * Determine if the given exec package refers to something which we * understand and, if so, set up the vmcmds for it. */ -int cpu_exec_aout_makecmds(p, epp) struct proc *p; struct exec_package *epp; diff --git a/sys/arch/sun3/sun3/mem.c b/sys/arch/sun3/sun3/mem.c index 33ff44d0708..ab82bf26877 100644 --- a/sys/arch/sun3/sun3/mem.c +++ b/sys/arch/sun3/sun3/mem.c @@ -1,8 +1,8 @@ -/* $NetBSD: mem.c,v 1.20 1996/12/17 21:11:36 gwr Exp $ */ +/* $NetBSD: mem.c,v 1.19 1995/08/08 21:09:01 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross - * Copyright (c) 1993 Adam Glass + * Copyright (c) 1993 Adam Glass * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -47,35 +47,34 @@ */ #include -#include -#include #include -#include -#include +#include +#include #include +#include #include #include #include #include -#include #include #include -#include "machdep.h" +extern int eeprom_uio(); +extern vm_offset_t avail_start, avail_end; -#define mmread mmrw -cdev_decl(mm); +vm_offset_t vmmap; /* XXX - poor name... + * It is a virtual page, not a map. + */ +caddr_t zeropage; -static caddr_t zeropage; /*ARGSUSED*/ int -mmopen(dev, flag, mode, p) +mmopen(dev, flag, mode) dev_t dev; int flag, mode; - struct proc *p; { return (0); @@ -83,10 +82,9 @@ mmopen(dev, flag, mode, p) /*ARGSUSED*/ int -mmclose(dev, flag, mode, p) +mmclose(dev, flag, mode) dev_t dev; int flag, mode; - struct proc *p; { return (0); @@ -133,7 +131,7 @@ mmrw(dev, uio, flags) case 0: v = uio->uio_offset; /* allow reads only in RAM */ - if (v >= avail_end) { + if (v < 0 || v >= avail_end) { error = EFAULT; goto unlock; } diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index dad84c28933..01f3a4eadd0 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.65 1996/12/17 21:11:38 gwr Exp $ */ +/* $NetBSD: pmap.c,v 1.64 1996/11/20 18:57:35 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -56,13 +56,6 @@ * pmap's virtual space will be fought over by the other pmaps. */ -/* - * Cache management: - * All sun3 cache implementations are write-back. - * Flushes must be done before removing translations - * from the MMU because the cache uses the MMU. - */ - /* * wanted attributes: * pmegs that aren't needed by a pmap remain in the MMU. @@ -90,13 +83,26 @@ #include #include -#include "machdep.h" - +#include "cache.h" #if (PMAP_OBIO << PG_MOD_SHIFT) != PGT_OBIO #error "PMAP_XXX definitions don't match pte.h!" #endif +/* + * Globals shared between here and sun3_startup: + * For simplicity, this interface retains the variables + * that were used in the old interface (without NONCONTIG). + * These are set in pmap_bootstrap() and used + * in pmap_next_page(). + */ +/* Kernel virtual address space available: */ +extern vm_offset_t virtual_avail, virtual_end; +/* Physical address space available: */ +extern vm_offset_t avail_start, avail_end; +/* The "hole" (used to skip the Sun3/50 video RAM) */ +extern vm_offset_t hole_start, hole_size; + /* statistics... */ struct pmap_stats { int ps_enter_firstpv; /* pv heads entered */ @@ -182,7 +188,6 @@ typedef struct pv_entry *pv_entry_t; pv_entry_t pv_head_table = NULL; #ifdef DIAGNOSTIC -static struct pv_entry * pa_to_pvp __P((vm_offset_t pa)); static struct pv_entry * pa_to_pvp(pa) vm_offset_t pa; @@ -305,13 +310,6 @@ struct pmeg_tailq pmeg_free_queue, pmeg_inactive_queue, static struct pmeg_state pmeg_array[NPMEG]; #ifdef PMAP_DEBUG -void pmap_print __P((pmap_t pmap)); -void pv_print __P((vm_offset_t pa)); - -static pmeg_t pmeg_p __P((int sme)); -static void pmeg_verify_empty __P((vm_offset_t va)); -static void pmeg_print __P((pmeg_t pmegp)); - static pmeg_t pmeg_p(sme) int sme; @@ -356,12 +354,14 @@ static void context_allocate __P((pmap_t pmap)); static void context_free __P((pmap_t pmap)); static void context_init __P((void)); +static void pmeg_flush __P((pmeg_t pmegp)); static pmeg_t pmeg_allocate __P((pmap_t pmap, vm_offset_t va)); static void pmeg_release __P((pmeg_t pmegp)); static void pmeg_free __P((pmeg_t pmegp, int segnum)); static pmeg_t pmeg_cache __P((pmap_t pmap, vm_offset_t va)); static void pmeg_set_wiring __P((pmeg_t pmegp, vm_offset_t va, int)); +static int pv_compute_cache __P((pv_entry_t head)); static int pv_link __P((pmap_t pmap, vm_offset_t, vm_offset_t, u_int)); static void pv_unlink __P((pmap_t, vm_offset_t, vm_offset_t)); static void pv_remove_all __P(( vm_offset_t pa)); @@ -369,9 +369,8 @@ static void pv_changepte __P((pv_entry_t, int, int)); static void pv_syncflags __P((pv_entry_t head)); static void pv_init __P((void)); -static void pmeg_clean __P((pmeg_t pmegp)); -static void pmeg_clean_free __P((void)); - +void sun3_pmeg_init __P((void)); +void sun3_reserve_pmeg __P((int pmeg_num)); void sun3_protection_init __P((void)); static void pmap_common_init __P((pmap_t pmap)); @@ -418,6 +417,7 @@ int pmap_db_watchpmeg = -1; #endif /* PMAP_DEBUG */ #ifdef PMAP_DEBUG /* XXX */ +extern int getsr(); #define CHECK_SPL() do { \ if ((getsr() & PSL_IPL) < PSL_IPL3) \ panic("pmap: bad spl, line %d", __LINE__); \ @@ -436,22 +436,20 @@ context_allocate(pmap) PMAP_LOCK(); #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_allocate: for pmap %p\n", pmap); + printf("context_allocate: for pmap %x\n", pmap); #endif if (pmap == kernel_pmap) panic("context_allocate: kernel_pmap"); if (has_context(pmap)) panic("pmap: pmap already has context allocated to it"); - context = (&context_free_queue)->tqh_first; - if (context == NULL) { - /* Steal the head of the active queue. */ - context = (&context_active_queue)->tqh_first; - if (context == NULL) - panic("pmap: no contexts left?"); - context_free(context->context_upmap); + if (TAILQ_EMPTY(&context_free_queue)) { + /* Steal one from the active queue. */ + if (TAILQ_EMPTY(&context_active_queue)) + panic("pmap: no contexts to be found"); + context_free((&context_active_queue)->tqh_first->context_upmap); #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_allocate: pmap %p, take context %p num %d\n", + printf("context_allocate: pmap %x, take context %x num %d\n", pmap, context, context->context_num); #endif } @@ -463,7 +461,7 @@ context_allocate(pmap) context->context_upmap = pmap; #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_allocate: pmap %p given context %p num %d\n", + printf("context_allocate: pmap %x given context %x num %d\n", pmap, context, context->context_num); #endif @@ -491,7 +489,7 @@ context_free(pmap) /* :) */ ctxnum = pmap->pm_ctxnum; #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_free: freeing context num %d of pmap %p\n", + printf("context_free: freeing context num %d of pmap 0x%x\n", ctxnum, pmap); #endif @@ -538,7 +536,7 @@ context_free(pmap) /* :) */ pmap->pm_ctxnum = CTXINVAL; #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_free: pmap %p context removed\n", pmap); + printf("context_free: pmap %x context removed\n", pmap); #endif PMAP_UNLOCK(); } @@ -558,22 +556,21 @@ context_init() context_link); #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_init: context num %d is %p\n", + printf("context_init: context num %d is %x\n", i, &context_array[i]); #endif } } #ifdef PMAP_DEBUG -void -pmap_print(pmap) +void pmap_print(pmap) pmap_t pmap; { printf(" pm_ctxnum=%d\n", pmap->pm_ctxnum); printf(" pm_version=0x%x\n", pmap->pm_version); - printf(" pm_segmap=%p\n", pmap->pm_segmap); + printf(" pm_segmap=0x%x\n", pmap->pm_segmap); } -#endif /* PMAP_DEBUG */ +#endif /* * Reserve a pmeg (forever) for use by PROM, etc. @@ -662,24 +659,23 @@ pmeg_verify_empty(va) panic("pmeg_verify_empty"); } } -#endif /* PMAP_DEBUG */ -#ifdef PMAP_DEBUG -void +static void pmeg_print(pmegp) pmeg_t pmegp; { - printf("link_next=%p link_prev=%p\n", - pmegp->pmeg_link.tqe_next, - pmegp->pmeg_link.tqe_prev); - printf("index=0x%x owner=%p own_vers=0x%x\n", - pmegp->pmeg_index, pmegp->pmeg_owner, pmegp->pmeg_version); + printf("link_next=0x%x link_prev=0x%x\n", + pmegp->pmeg_link.tqe_next, + pmegp->pmeg_link.tqe_prev); + printf("index=0x%x owner=0x%x own_vers=0x%x\n", + pmegp->pmeg_index, pmegp->pmeg_owner, + pmegp->pmeg_version); printf("va=0x%x wired=0x%x reserved=0x%x vpgs=0x%x qstate=0x%x\n", - pmegp->pmeg_va, pmegp->pmeg_wired, - pmegp->pmeg_reserved, pmegp->pmeg_vpages, - pmegp->pmeg_qstate); + pmegp->pmeg_va, pmegp->pmeg_wired, + pmegp->pmeg_reserved, pmegp->pmeg_vpages, + pmegp->pmeg_qstate); } -#endif /* PMAP_DEBUG */ +#endif /* * Allocate a PMEG by whatever means necessary. @@ -764,7 +760,7 @@ pmeg_allocate(pmap, va) pmegp->pmeg_qstate = PMEGQ_ACTIVE; #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pm_segmap: pmap=%p i=%x old=%x new=%x (pget)\n", + printf("pm_segmap: pmap=%x i=%x old=%x new=%x (pget)\n", pmap, VA_SEGNUM(va), pmap->pm_segmap[VA_SEGNUM(va)], pmegp->pmeg_index); @@ -967,8 +963,7 @@ sun3_pmeg_init() } #ifdef PMAP_DEBUG -/* call from debugger */ -void +static void pv_print(pa) vm_offset_t pa; { @@ -980,7 +975,7 @@ pv_print(pa) pv = pa_to_pvp(pa); printf("pv_list for pa %x: flags=%x\n", pa, pv->pv_flags); while (pv) { - printf("pv_entry %p pmap %p va %x next %p\n", + printf("pv_entry %x pmap %x va %x next %x\n", pv, pv->pv_pmap, pv->pv_va, pv->pv_next); pv = pv->pv_next; } @@ -1022,8 +1017,6 @@ pv_changepte(head, set_bits, clear_bits) for (pv = head; pv != NULL; pv = pv->pv_next) { pmap = pv->pv_pmap; va = pv->pv_va; - sme = SEGINV; /* kill warning */ - #ifdef DIAGNOSTIC /* * Only the head may have a null pmap, and @@ -1124,8 +1117,6 @@ pv_syncflags(head) for (pv = head; pv != NULL; pv = pv->pv_next) { pmap = pv->pv_pmap; va = pv->pv_va; - sme = SEGINV; /* kill warning */ - #ifdef DIAGNOSTIC /* * Only the head may have a null pmap, and @@ -1253,7 +1244,7 @@ pv_link(pmap, pa, va, flags) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_LINK) || (va == pmap_db_watchva)) { - printf("pv_link(%p, %x, %x, %x)\n", pmap, pa, va, flags); + printf("pv_link(%x, %x, %x, %x)\n", pmap, pa, va, flags); /* pv_print(pa); */ } #endif @@ -1332,7 +1323,7 @@ pv_unlink(pmap, pa, va) if ((pmap_debug & PMD_UNLINK) || (va == pmap_db_watchva)) { - printf("pv_unlink(%p, %x, %x)\n", pmap, pa, va); + printf("pv_unlink(%x, %x, %x)\n", pmap, pa, va); } #endif head = pa_to_pvp(pa); @@ -1453,6 +1444,7 @@ pmap_common_init(pmap) void pmap_bootstrap() { + extern void vm_set_page_size(); /* * Reserve a segment for the kernel to use to access a pmeg @@ -1566,7 +1558,7 @@ int pmap_page_index(pa) vm_offset_t pa; { - int idx; + u_long idx; #ifdef DIAGNOSTIC if (pa < avail_start || pa >= avail_end) @@ -1578,8 +1570,7 @@ pmap_page_index(pa) } #endif - idx = sun3_btop(pa); - return (idx); + return (sun3_btop(pa)); } @@ -1691,7 +1682,7 @@ pmap_destroy(pmap) #ifdef PMAP_DEBUG if (pmap_debug & PMD_CREATE) - printf("pmap_destroy(%p)\n", pmap); + printf("pmap_destroy(%x)\n", pmap); #endif if (pmap == kernel_pmap) panic("pmap_destroy: kernel_pmap!"); @@ -1766,6 +1757,7 @@ pmap_remove_range_mmu(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { + int old_ctx, i; pmeg_t pmegp; vm_offset_t va; int pte, sme; @@ -1774,7 +1766,7 @@ pmap_remove_range_mmu(pmap, sva, eva) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_REMOVE) || ((sva <= pmap_db_watchva && eva > pmap_db_watchva))) - printf("pmap_remove_range_mmu(%p, %x, %x)\n", pmap, sva, eva); + printf("pmap_remove_range_mmu(%x, %x, %x)\n", pmap, sva, eva); #endif /* Interrupt level handled by caller. */ @@ -1849,7 +1841,7 @@ pmap_remove_range_mmu(pmap, sva, eva) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%p va=%x old=%x new=%x (rrmmu)\n", + printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (rrmmu)\n", pmap, va, pte, PG_INVAL); } #endif @@ -1863,7 +1855,7 @@ pmap_remove_range_mmu(pmap, sva, eva) if (is_pmeg_wired(pmegp)) { #ifdef PMAP_DEBUG if (pmap_debug & PMD_WIRING) { - printf("pmap: removing wired pmeg: %p\n", pmegp); + printf("pmap: removing wired pmeg: 0x%x\n", pmegp); Debugger(); /* XXX */ } #endif /* PMAP_DEBUG */ @@ -1902,7 +1894,7 @@ pmap_remove_range_noctx(pmap, sva, eva) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_REMOVE) || ((sva <= pmap_db_watchva && eva > pmap_db_watchva))) - printf("pmap_remove_range_noctx(%p, %x, %x)\n", pmap, sva, eva); + printf("pmap_remove_range_noctx(%x, %x, %x)\n", pmap, sva, eva); #endif /* Interrupt level handled by caller. */ @@ -1930,7 +1922,7 @@ pmap_remove_range_noctx(pmap, sva, eva) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%p va=%x old=%x new=%x (rrncx)\n", + printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (rrncx)\n", pmap, va, pte, PG_INVAL); } #endif @@ -1955,7 +1947,7 @@ pmap_remove_range(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { - int s, sme; + int c, s, sme; int old_ctx; boolean_t in_ctx; @@ -2062,7 +2054,8 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte) boolean_t wired; int new_pte; { - int s, sme, old_pte; + int s, i, c; + int sme, old_pte; int nflags, do_pv; vm_offset_t seg_va; pmeg_t pmegp; @@ -2119,13 +2112,12 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte) set_segmap_allctx(va, sme); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pmap: set_segmap pmap=%p va=%x sme=%x (ek1)\n", + printf("pmap: set_segmap pmap=%x va=%x sme=%x (ek1)\n", kernel_pmap, seg_va, sme); } pmeg_verify_empty(sun3_trunc_seg(va)); #endif /* There are no existing mappings to deal with. */ - old_pte = 0; goto add_pte; } @@ -2198,7 +2190,7 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%p va=%x old=%x new=%x (ek)\n", + printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (ek)\n", kernel_pmap, va, old_pte, new_pte); } #endif @@ -2236,7 +2228,7 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) */ if (wired && (pmap_debug & PMD_WIRING)) { printf("pmap_enter_user: attempt to wire user page, ignored\n"); - printf("pmap=%p va=0x%x pa=0x%x\n", pmap, va, pa); + printf("pmap=0x%x va=0x%x pa=0x%x\n", pmap, va, pa); } #endif #ifdef DIAGNOSTIC @@ -2297,13 +2289,12 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) set_segmap(va, sme); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pmap: set_segmap pmap=%p va=%x sme=%x (eu1)\n", + printf("pmap: set_segmap pmap=%x va=%x sme=%x (eu1)\n", pmap, seg_va, sme); } pmeg_verify_empty(seg_va); #endif /* There are no existing mappings to deal with. */ - old_pte = 0; goto add_pte; } @@ -2327,7 +2318,7 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) set_segmap(va, sme); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pmap: set_segmap pmap=%p va=%x sme=%x (eu2)\n", + printf("pmap: set_segmap pmap=%x va=%x sme=%x (eu2)\n", pmap, seg_va, sme); } #endif @@ -2395,7 +2386,7 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%p va=%x old=%x new=%x (eu)\n", + printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (eu)\n", pmap, va, old_pte, new_pte); } #endif @@ -2440,7 +2431,7 @@ pmap_enter(pmap, va, pa, prot, wired) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_ENTER) || (va == pmap_db_watchva)) - printf("pmap_enter(%p, %x, %x, %x, %x)\n", + printf("pmap_enter(%x, %x, %x, %x, %x)\n", pmap, va, pa, prot, wired); #endif @@ -2487,7 +2478,7 @@ int pmap_fault_reload(pmap, va, ftype) vm_offset_t va; vm_prot_t ftype; { - int rv, s, pte, chkpte, sme, ctx; + int rv, s, pte, chkpte, sme, segnum, ctx; vm_offset_t seg_va; pmeg_t pmegp; @@ -2538,7 +2529,7 @@ int pmap_fault_reload(pmap, va, ftype) rv = 1; } } - + PMAP_UNLOCK(); return (0); } @@ -2637,7 +2628,7 @@ pmap_activate(pmap, pcbp) context_allocate(pmap); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SWITCH) - printf("pmap_activate(%p) takes context %d\n", + printf("pmap_activate(%x) takes context %d\n", pmap, pmap->pm_ctxnum); #endif } @@ -2646,7 +2637,7 @@ pmap_activate(pmap, pcbp) if (pmap_debug & PMD_SWITCH) { int old_ctx = get_context(); if (old_ctx != pmap->pm_ctxnum) { - printf("pmap_activate(%p) old_ctx=%d new_ctx=%d\n", + printf("pmap_activate(%x) old_ctx=%d new_ctx=%d\n", pmap, old_ctx, pmap->pm_ctxnum); } } @@ -2662,7 +2653,7 @@ pmap_deactivate(pmap, pcbp) { #ifdef PMAP_DEBUG if (pmap_debug & PMD_SWITCH) - printf("pmap_deactivate(%p, %p)\n", pmap, pcbp); + printf("pmap_deactivate(%x, %x)\n", pmap, pcbp); #endif /* Nothing to do really, and not called anyway... */ } @@ -2688,7 +2679,7 @@ pmap_change_wiring(pmap, va, wired) return; #ifdef PMAP_DEBUG if (pmap_debug & PMD_WIRING) - printf("pmap_change_wiring(pmap=%p, va=0x%x, wire=%d)\n", + printf("pmap_change_wiring(pmap=0x%x, va=0x%x, wire=%d)\n", pmap, va, wired); #endif /* @@ -2838,9 +2829,11 @@ pmap_protect_range_mmu(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { + int old_ctx, i; pmeg_t pmegp; vm_offset_t va; int pte, sme; + int nflags; int flush_by_page = 0; /* Interrupt level handled by caller. */ @@ -2930,6 +2923,7 @@ pmap_protect_range_noctx(pmap, sva, eva) int pte, sme, ptenum, segnum; vm_offset_t va; pmeg_t pmegp; + int nflags; /* Interrupt level handled by caller. */ CHECK_SPL(); @@ -2970,7 +2964,7 @@ pmap_protect_range(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { - int s, sme; + int c, s, sme; int old_ctx; boolean_t in_ctx; @@ -2979,7 +2973,7 @@ pmap_protect_range(pmap, sva, eva) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_PROTECT) || ((sva <= pmap_db_watchva && eva > pmap_db_watchva))) - printf("pmap_protect_range(%p, %x, %x)\n", pmap, sva, eva); + printf("pmap_protect_range(%x, %x, %x)\n", pmap, sva, eva); #endif #ifdef DIAGNOSTIC if (sun3_trunc_seg(sva) != sun3_trunc_seg(eva-NBPG)) @@ -3040,7 +3034,7 @@ pmap_protect(pmap, sva, eva, prot) #ifdef PMAP_DEBUG if (pmap_debug & PMD_PROTECT) - printf("pmap_protect(%p, %x, %x, %x)\n", pmap, sva, eva, prot); + printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot); #endif if (pmap == NULL) @@ -3231,10 +3225,11 @@ pmap_prefer(fo, va) * Copy the kernel segmap into the passed buffer (256 bytes). */ void -pmap_get_ksegmap(cp) - u_char *cp; +pmap_get_ksegmap(vaddr) + vm_offset_t vaddr; { vm_offset_t va; + u_char *cp = (u_char*)vaddr; va = KERNBASE; do { @@ -3249,13 +3244,15 @@ pmap_get_ksegmap(cp) * starting at OFF in the pagemap RAM. */ void -pmap_get_pagemap(pt, off) - int *pt; +pmap_get_pagemap(vaddr, off) + vm_offset_t vaddr; int off; { vm_offset_t va, va_end; int sme, sme_end; /* SegMap Entry numbers */ + int *pt; + pt = (int*)vaddr; /* destination */ sme = (off >> 6); /* PMEG to start on */ sme_end = sme + 128; /* where to stop */ va_end = temp_seg_va + NBSG; diff --git a/sys/arch/sun3/sun3/sun3_startup.c b/sys/arch/sun3/sun3/sun3_startup.c index e689176c781..08cd20db1c2 100644 --- a/sys/arch/sun3/sun3/sun3_startup.c +++ b/sys/arch/sun3/sun3/sun3_startup.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun3_startup.c,v 1.56 1996/12/17 21:11:39 gwr Exp $ */ +/* $NetBSD: sun3_startup.c,v 1.55 1996/11/20 18:57:38 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -46,8 +46,8 @@ #include #include +#include #include -#include #include #include #include @@ -58,7 +58,6 @@ #include "vector.h" #include "interreg.h" -#include "machdep.h" /* This is defined in locore.s */ extern char kernel_text[]; @@ -67,12 +66,10 @@ extern char kernel_text[]; extern char etext[], edata[], end[]; char *esym; /* DDB */ - /* - * Globals shared between pmap.c and sun3_startup.c (sigh). - * For simplicity, this interface retains the variables - * that were used in the old interface (without NONCONTIG). - */ + * Globals shared with the pmap code. + * XXX - should reexamine this... + */ vm_offset_t virtual_avail, virtual_end; vm_offset_t avail_start, avail_end; /* used to skip the Sun3/50 video RAM */ @@ -82,8 +79,7 @@ int cache_size; /* * Now our own stuff. */ -int cold = 1; -void **old_vector_table; +unsigned int *old_vector_table; unsigned char cpu_machine_id = 0; char *cpu_string = NULL; @@ -96,6 +92,7 @@ int msgbufmapped = 0; struct msgbuf *msgbufp = NULL; extern vm_offset_t tmp_vpages[]; extern int physmem; +unsigned char *interrupt_reg; vm_offset_t proc0_user_pa; struct user *proc0paddr; /* proc[0] pcb address (u-area VA) */ @@ -104,27 +101,25 @@ extern struct pcb *curpcb; extern vm_offset_t dumppage_pa; extern vm_offset_t dumppage_va; -void sun3_bootstrap __P((struct exec)); - -static void sun3_mon_init __P((vm_offset_t sva, vm_offset_t eva, int keep)); -static void sun3_monitor_hooks __P((void)); -static void sun3_save_symtab __P((struct exec *kehp)); -static void sun3_verify_hardware __P((void)); -static void sun3_vm_init __P((struct exec *kehp)); -static void tracedump __P((int)); -static void v_handler __P((int addr, char *str)); - +/* + * Switch to our own interrupt vector table. + */ +static void initialize_vector_table() +{ + old_vector_table = getvbr(); + setvbr((unsigned int *) vector_table); +} -vm_offset_t -high_segment_alloc(npages) +vm_offset_t high_segment_alloc(npages) int npages; { + int i; vm_offset_t va, tmp; - + if (npages == 0) mon_panic("panic: request for high segment allocation of 0 pages"); if (high_segment_free_start == high_segment_free_end) return NULL; - + va = high_segment_free_start + (npages*NBPG); if (va > high_segment_free_end) return NULL; tmp = high_segment_free_start; @@ -135,8 +130,7 @@ high_segment_alloc(npages) /* * Prepare for running the PROM monitor */ -static void -sun3_mode_monitor __P((void)) +static void sun3_mode_monitor() { /* Install PROM vector table and enable NMI clock. */ /* XXX - Disable watchdog action? */ @@ -148,12 +142,11 @@ sun3_mode_monitor __P((void)) /* * Prepare for running the kernel */ -static void -sun3_mode_normal __P((void)) +static void sun3_mode_normal() { /* Install our vector table and disable the NMI clock. */ set_clk_mode(0, IREG_CLOCK_ENAB_7, 0); - setvbr((void**)vector_table); + setvbr((unsigned int *) vector_table); set_clk_mode(IREG_CLOCK_ENAB_5, 0, 1); } @@ -180,7 +173,7 @@ void sun3_mon_abort() * stuff it into the PROM interrupt vector for trap zero * and then do a trap. Needs PROM vector table in RAM. */ - old_vector_table[32] = (void*) romp->abortEntry; + old_vector_table[32] = (int)romp->abortEntry; asm(" trap #0 ; _sun3_mon_continued: nop"); /* We have continued from a PROM abort! */ @@ -215,10 +208,9 @@ void sun3_mon_reboot(bootstring) * is identically mapped in all contexts. The PROM can * do the job using hardware-dependent tricks... */ -void -sun3_context_equiv __P((void)) +void sun3_context_equiv() { - unsigned int sme; + unsigned int i, sme; int x; vm_offset_t va; @@ -243,15 +235,15 @@ sun3_context_equiv __P((void)) static void sun3_mon_init(sva, eva, keep) - vm_offset_t sva, eva; - int keep; /* true: steal, false: clear */ +vm_offset_t sva, eva; +int keep; /* true: steal, false: clear */ { vm_offset_t pgva, endseg; int pte, valid; unsigned char sme; - + sva &= ~(NBSG-1); - + while (sva < eva) { sme = get_segmap(sva); if (sme != SEGINV) { @@ -281,7 +273,6 @@ sun3_mon_init(sva, eva, keep) /* * Preserve DDB symbols and strings by setting esym. */ -static void sun3_save_symtab(kehp) struct exec *kehp; /* kernel exec header */ { @@ -356,11 +347,10 @@ sun3_save_symtab(kehp) * between [ KERNBASE .. virtual_avail ] and this is * checked in trap.c for kernel-mode MMU faults. */ -static void -sun3_vm_init(kehp) +void sun3_vm_init(kehp) struct exec *kehp; /* kernel exec header */ { - vm_offset_t va, eva, pte; + vm_offset_t va, eva, sva, pte, temp_seg; unsigned int sme; /* @@ -499,7 +489,7 @@ sun3_vm_init(kehp) * segmap entries in the MMU unless pmeg_array records them. */ va = virtual_avail; - while (va < virtual_end) { + while (va < virtual_end) { set_segmap(va, SEGINV); va += NBSG; } @@ -617,8 +607,7 @@ sun3_vm_init(kehp) */ int delay_divisor = 82; /* assume the fastest (3/260) */ -static void -sun3_verify_hardware() +void sun3_verify_hardware() { unsigned char machtype; int cpu_match = 0; @@ -697,9 +686,8 @@ struct funcall_frame { int fr_arg[1]; }; /*VARARGS0*/ -static void tracedump(x1) - int x1; + caddr_t x1; { struct funcall_frame *fp = (struct funcall_frame *)(&x1 - 2); u_int stackpage = ((u_int)fp) & ~PGOFSET; @@ -723,12 +711,12 @@ tracedump(x1) * For now we just implement the old "g0" and "g4" * commands and a printf hack. [lifted from freed cmu mach3 sun3 port] */ -static void +void v_handler(addr, str) - int addr; - char *str; +int addr; +char *str; { - + switch (*str) { case '\0': /* @@ -741,36 +729,36 @@ v_handler(addr, str) sun3_mode_normal(); panic("zero"); /*NOTREACHED*/ - + case 4: /* old g4 */ - goto do_trace; - + tracedump(); + break; + default: goto err; } break; - + case 'p': /* 'p'rint string command */ case 'P': mon_printf("%s\n", (char *)addr); break; - + case '%': /* p'%'int anything a la printf */ mon_printf(str, addr); mon_printf("\n"); break; - - do_trace: + case 't': /* 't'race kernel stack */ case 'T': - tracedump(addr); + tracedump(); break; - + case 'u': /* d'u'mp hack ('d' look like hex) */ case 'U': goto err; break; - + default: err: mon_printf("Don't understand 0x%x '%s'\n", addr, str); @@ -786,8 +774,7 @@ v_handler(addr, str) * argv[1] = options (i.e. "-ds" or NULL) * argv[2] = NULL */ -static void -sun3_monitor_hooks() +void sun3_monitor_hooks() { MachMonBootParam *bpp; char **argp; @@ -837,6 +824,21 @@ sun3_monitor_hooks() #endif } +/* + * Find mappings for devices that are needed before autoconfiguration. + * First the obio module finds and records useful PROM mappings, then + * the necessary drivers are given a chance to use those recorded. + */ +void internal_configure() +{ + obio_init(); /* find and record PROM mappings in OBIO space */ + /* Drivers that use those OBIO mappings from the PROM */ + zs_init(); + eeprom_init(); + intreg_init(); + clock_init(); +} + /* * This is called from locore.s just after the kernel is remapped * to its proper address, but before the call to main(). @@ -845,11 +847,13 @@ void sun3_bootstrap(keh) struct exec keh; /* kernel exec header */ { + int i; + extern int cold; /* First, Clear BSS. */ bzero(edata, end - edata); - /* cold = 1; (now at compile time) */ + cold = 1; sun3_monitor_hooks(); /* set v_handler, get boothowto */ @@ -859,18 +863,15 @@ sun3_bootstrap(keh) pmap_bootstrap(); /* bootstrap pmap module */ - obio_init(); /* stuff that can't wait for configure() */ + internal_configure(); /* stuff that can't wait for configure() */ /* - * Point interrupts/exceptions to our vector table. - * (Until now, we use the one setup by the PROM.) - * - * This is done after obio_init() / intreg_init() finds + * Point interrupts/exceptions to our table. + * This is done after internal_configure/isr_init finds * the interrupt register and disables the NMI clock so * it will not cause "spurrious level 7" complaints. */ - old_vector_table = getvbr(); - setvbr((void **)vector_table); + initialize_vector_table(); /* Interrupts are enabled in locore.s just after this return. */ } diff --git a/sys/arch/sun3/sun3/swapgeneric.c b/sys/arch/sun3/sun3/swapgeneric.c index 0ede3626a82..c1f373ec184 100644 --- a/sys/arch/sun3/sun3/swapgeneric.c +++ b/sys/arch/sun3/sun3/swapgeneric.c @@ -1,12 +1,9 @@ -/* $NetBSD: swapgeneric.c,v 1.19 1996/12/17 21:11:41 gwr Exp $ */ +/* $NetBSD: swapgeneric.c,v 1.14 1995/04/26 23:30:08 gwr Exp $ */ -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. +/* + * Copyright (c) 1994 Gordon W. Ross * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by Gordon W. Ross. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,25 +12,22 @@ * 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 + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * 4. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 by Gordon W. Ross * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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. */ /* @@ -50,20 +44,11 @@ #include #include -#include - #include -#include "machdep.h" - -static int net_mkunit __P((int ctlr, int unit)); -static int sd_mkunit __P((int ctlr, int unit)); -static int xx_mkunit __P((int ctlr, int unit)); -static struct genconf * gc_lookup __P((char *)); - - + #ifdef NFSCLIENT -extern char *nfsbootdevname; /* nfs_boot.c */ -#endif /* NFSCLIENT */ +extern char *nfsbootdevname; /* nfs_boot.c */ +#else /* NFSCLIENT */ int (*mountroot) __P((void)) = NULL; @@ -81,16 +66,14 @@ char boot_ifname[NAMESZ]; /* * Functions to convert PROM ctlr/unit into our unit numbers */ -static int -net_mkunit(ctlr, unit) +static int net_mkunit(ctlr, unit) int ctlr, unit; { /* XXX - Not sure which is set. */ return (ctlr + unit); } -static int -sd_mkunit(ctlr, unit) +static int sd_mkunit(ctlr, unit) int ctlr, unit; { int target, lun; @@ -101,8 +84,7 @@ sd_mkunit(ctlr, unit) return (target * 2 + lun); } -static int -xx_mkunit(ctlr, unit) +static int xx_mkunit(ctlr, unit) int ctlr, unit; { return (ctlr * 2 + unit); @@ -115,14 +97,14 @@ xx_mkunit(ctlr, unit) static struct genconf { char gc_name[4]; int gc_major; - int (*gc_mkunit) __P((int, int)); + int (*gc_mkunit)(); } genconf[] = { - { {"ie"}, -1, net_mkunit }, - { {"le"}, -1, net_mkunit }, - { {"sd"}, 7, sd_mkunit }, - { {"xy"}, 3, xx_mkunit }, - { {"xd"}, 10, xx_mkunit }, - { {0}, 0, 0 }, + { "ie", -1, net_mkunit }, + { "le", -1, net_mkunit }, + { "sd", 7, sd_mkunit }, + { "xy", 3, xx_mkunit }, + { "xd", 10, xx_mkunit }, + { 0 }, }; static struct genconf * @@ -141,8 +123,7 @@ gc_lookup(name) return NULL; } -static void -gc_print_all __P((void)) +static void gc_print_all() { struct genconf *gc; @@ -156,7 +137,7 @@ gc_print_all __P((void)) } printf("\n"); } - + struct devspec { int major; @@ -165,20 +146,11 @@ struct devspec { char name[4]; }; -static int ds_parse __P((struct devspec *, char *)); -static int ds_tostr __P((struct devspec *, char *)); -static void ds_from_boot __P((struct devspec *)); -static void ds_query __P((struct devspec *, char *)); -static dev_t ds_todev __P((struct devspec *)); -static void gets __P((char *cp)); - - /* * Set devspec from a string like: "sd0a" * Return length of recognized part. */ -static int -ds_parse(ds, str) +static int ds_parse(ds, str) struct devspec *ds; char *str; { @@ -222,11 +194,11 @@ ds_parse(ds, str) * Format a devspec into a string like: "sd0a" * Returns length of string. */ -static int -ds_tostr(ds, str) +static int ds_tostr(ds, str) struct devspec *ds; char *str; { + struct genconf *gc; int unit, part; char *p; @@ -258,8 +230,7 @@ ds_tostr(ds, str) * Set the devspec to the device we booted from. * (Just converts PROM boot parameters.) */ -static void -ds_from_boot(ds) +static void ds_from_boot(ds) struct devspec *ds; { MachMonBootParam *bpp; @@ -291,13 +262,14 @@ ds_from_boot(ds) * Fill in the devspec by asking the operator. * The ds passed may hold a default value. */ -static void -ds_query(ds, what) +static void ds_query(ds, what) struct devspec *ds; char *what; { + struct genconf *gc; + char *p; + int len, minor; char buf[64]; - int len; for (;;) { len = ds_tostr(ds, buf); @@ -316,8 +288,7 @@ ds_query(ds, what) } } -static dev_t -ds_todev(ds) +static dev_t ds_todev(ds) struct devspec *ds; { int minor; @@ -331,9 +302,11 @@ ds_todev(ds) * Choose the root and swap device, either by asking, * (if RB_ASKNAME) or from the PROM boot parameters. */ -void swapgeneric() { + struct genconf *gc; + dev_t root, swap, dump; + int minor; struct devspec ds; char buf[NAMESZ]; @@ -392,7 +365,6 @@ swapgeneric() } /* XXX - Isn't this in some common file? */ -static void gets(cp) char *cp; { diff --git a/sys/arch/sun3/sun3/sys_machdep.c b/sys/arch/sun3/sun3/sys_machdep.c index 3881d412af8..23a3ea0c7db 100644 --- a/sys/arch/sun3/sun3/sys_machdep.c +++ b/sys/arch/sun3/sun3/sys_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.4 1996/12/17 21:11:41 gwr Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.3 1995/10/27 15:58:23 gwr Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -47,11 +47,10 @@ #include #include #include -#include #include -#include -#include "machdep.h" + +#include #ifdef TRACE int nvualarm; @@ -111,6 +110,8 @@ vdoualarm(arg) } #endif +#include +#include "cache.h" /* XXX should be in an include file somewhere */ #define CC_PURGE 1 @@ -120,7 +121,6 @@ vdoualarm(arg) /* XXX end should be */ /*ARGSUSED1*/ -int cachectl(req, addr, len) int req; caddr_t addr; @@ -157,10 +157,9 @@ sys_sysarch(p, v, retval) register_t *retval; { struct sys_sysarch_args /* { - syscallarg(int) op; + syscallarg(int) op; syscallarg(char *) parms; } */ *uap = v; - (void)uap->op; /* kill warning */ return ENOSYS; } diff --git a/sys/arch/sun3/sun3/vector.c b/sys/arch/sun3/sun3/vector.c index d0eeb43edc7..d074cc1747b 100644 --- a/sys/arch/sun3/sun3/vector.c +++ b/sys/arch/sun3/sun3/vector.c @@ -1,4 +1,4 @@ -/* $NetBSD: vector.c,v 1.16 1996/12/17 21:11:43 gwr Exp $ */ +/* $NetBSD: vector.c,v 1.15 1996/11/20 18:57:40 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -50,6 +50,12 @@ badtrap, badtrap, badtrap, badtrap, \ badtrap, badtrap, badtrap, badtrap +void addrerr(), badtrap(), buserr(), chkinst(), coperr(), fmterr(), + fpfline(), fpunsupp(), illinst(), privinst(), trace(), trap0(), + trap1(), trap12(), trap15(), trap2(), trapvinst(), zerodiv(), fpfault(); + +void _isr_autovec(); + #define fpbsun fpfault #define fpdz fpfault #define fpinex fpfault @@ -58,7 +64,7 @@ #define fpsnan fpfault #define fpunfl fpfault -void *vector_table[NVECTORS] = { +void (*vector_table[NVECTORS])() = { (void*)0xfffe000, /* 0: NOT USED (reset SP) */ (void*)0xfef0000, /* 1: NOT USED (reset PC) */ buserr, /* 2: bus error */ diff --git a/sys/arch/sun3/sun3/vector.h b/sys/arch/sun3/sun3/vector.h index 32f9bf76604..b8e83c4bf31 100644 --- a/sys/arch/sun3/sun3/vector.h +++ b/sys/arch/sun3/sun3/vector.h @@ -1,4 +1,4 @@ -/* $NetBSD: vector.h,v 1.11 1996/12/17 21:11:44 gwr Exp $ */ +/* $NetBSD: vector.h,v 1.10 1996/11/20 18:57:40 gwr Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -40,26 +40,4 @@ #define AUTOVEC_BASE 0x18 -extern void *vector_table[]; - -void _isr_autovec __P((void)); - -void addrerr __P((void)); -void badtrap __P((void)); -void buserr __P((void)); -void chkinst __P((void)); -void coperr __P((void)); -void fmterr __P((void)); -void fpfline __P((void)); -void fpunsupp __P((void)); -void illinst __P((void)); -void privinst __P((void)); -void trace __P((void)); -void trap0 __P((void)); -void trap1 __P((void)); -void trap12 __P((void)); -void trap15 __P((void)); -void trap2 __P((void)); -void trapvinst __P((void)); -void zerodiv __P((void)); -void fpfault __P((void)); +extern void (*vector_table[])(); diff --git a/sys/arch/sun3/sun3/vm_machdep.c b/sys/arch/sun3/sun3/vm_machdep.c index fa3af3b6ebf..b6d2fcbdc2f 100644 --- a/sys/arch/sun3/sun3/vm_machdep.c +++ b/sys/arch/sun3/sun3/vm_machdep.c @@ -1,8 +1,8 @@ -/* $NetBSD: vm_machdep.c,v 1.36 1996/12/17 21:11:45 gwr Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.35 1996/04/26 18:38:06 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross - * Copyright (c) 1993 Adam Glass + * Copyright (c) 1993 Adam Glass * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -62,12 +62,10 @@ #include #include -#include "machdep.h" +#include "cache.h" extern int fpu_type; -extern void proc_do_uret __P((void)); -extern void proc_trampoline __P((void)); /* * Finish a fork operation, with process p2 nearly set up. @@ -79,26 +77,25 @@ void cpu_fork(p1, p2) register struct proc *p1, *p2; { - register struct pcb *p1pcb = &p1->p_addr->u_pcb; - register struct pcb *p2pcb = &p2->p_addr->u_pcb; + register struct pcb *pcb2 = &p2->p_addr->u_pcb; register struct trapframe *p2tf; register struct switchframe *p2sf; + extern void proc_do_uret(), child_return(); /* * Before copying the PCB from the current process, * make sure it is up-to-date. (p1 == curproc) */ - if (p1 == curproc) - savectx(p1pcb); + savectx(curproc->p_addr); /* copy over the machdep part of struct proc */ p2->p_md.md_flags = p1->p_md.md_flags; /* Copy pcb from proc p1 to p2. */ - bcopy(p1pcb, p2pcb, sizeof(*p2pcb)); + bcopy(&p1->p_addr->u_pcb, pcb2, sizeof(*pcb2)); /* Child can start with low IPL (XXX - right?) */ - p2pcb->pcb_ps = PSL_LOWIPL; + pcb2->pcb_ps = PSL_LOWIPL; /* * Our cpu_switch MUST always call PMAP_ACTIVATE on a @@ -112,9 +109,9 @@ cpu_fork(p1, p2) * copy trapframe from parent so return to user mode * will be to right address, with correct registers. * Leave one word unused at the end of the kernel stack - * so the system stack pointer stays within the page. + * so the system stack pointer stays within its stack. */ - p2tf = (struct trapframe *)((char*)p2pcb + USPACE-4) - 1; + p2tf = (struct trapframe *)((char*)p2->p_addr + USPACE-4) - 1; p2->p_md.md_regs = (int *)p2tf; bcopy(p1->p_md.md_regs, p2tf, sizeof(*p2tf)); @@ -124,7 +121,7 @@ cpu_fork(p1, p2) */ p2sf = (struct switchframe *)p2tf - 1; p2sf->sf_pc = (u_int)proc_do_uret; - p2pcb->pcb_regs[11] = (int)p2sf; /* SSP */ + pcb2->pcb_regs[11] = (int)p2sf; /* SSP */ /* * This will "push a call" to an arbitrary kernel function @@ -161,6 +158,8 @@ cpu_set_kpc(proc, func) void (*func)(struct proc *); { struct pcb *pcbp; + struct switchframe *sf; + extern void proc_trampoline(); struct ksigframe { struct switchframe sf; void (*func)(struct proc *); @@ -215,19 +214,6 @@ cpu_swapout(p) */ } -/* - * Do any additional state-restoration after swapin. - */ -void -cpu_swapin(p) - register struct proc *p; -{ - - /* - * XXX - Just for debugging... (later). - */ -} - /* * Dump the machine specific segment at the start of a core dump. * This means the CPU and FPU registers. The format used here is @@ -249,6 +235,7 @@ cpu_coredump(p, vp, cred, chdr) struct md_core md_core; struct coreseg cseg; int error; + register i; /* XXX: Make sure savectx() was done? */ -- 2.20.1