-/* $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
*/
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/mman.h>
-#include <sys/proc.h>
#include <sys/tty.h>
#include <vm/vm.h>
-#include <machine/autoconf.h>
-#include <machine/control.h>
#include <machine/cpu.h>
#include <machine/fbio.h>
-#include <machine/idprom.h>
+#include <machine/autoconf.h>
#include <machine/pmap.h>
+#include <machine/control.h>
#include "fbvar.h"
#include "bw2reg.h"
-cdev_decl(bw2);
+extern unsigned char cpu_machine_id;
/* per-display variables */
struct bw2_softc {
/* 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)
struct fbdevice *fb = &sc->sc_fb;
struct confargs *ca = args;
struct fbtype *fbt;
+ int ramsize;
sc->sc_phys = ca->ca_paddr;
}
/* 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();
}
/* 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();
-/* $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
*/
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/mman.h>
-#include <sys/proc.h>
#include <sys/tty.h>
#include <vm/vm.h>
#include "fbvar.h"
-cdev_decl(cg2);
-
#define CMSIZE 256
/* offset to and size of mapped part of frame buffer */
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*));
/*
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;
int off, prot;
{
struct cg2_softc *sc = cgtwo_cd.cd_devs[minor(dev)];
+ int realoff;
if (off & PGOFSET)
panic("cg2mmap");
*/
/* 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? */
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
-/* $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
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/malloc.h>
#include <sys/mman.h>
-#include <sys/proc.h>
#include <sys/tty.h>
#include <vm/vm.h>
-#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/fbio.h>
-#include <machine/idprom.h>
+#include <machine/autoconf.h>
#include <machine/pmap.h>
#include "fbvar.h"
#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;
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));
*/
/* 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? */
}
/* 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;
}
/* 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;
* 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;
* 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;
-/* $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:
* 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.
*/
/*
* 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 <sys/param.h>
#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/malloc.h>
-#include <sys/proc.h>
#include <machine/autoconf.h>
#include <machine/obio.h>
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 = {
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)
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) {
return error;
}
-/* Give the lock. */
-static void
-ee_give __P((void))
+static void ee_give() /* Give the lock. */
{
ee_busy = 0;
if (ee_want) {
}
}
-/*
- * 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 */
/*
* 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;
-/* $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
*/
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include "fbvar.h"
-cdev_decl(fb);
-
static struct fbdevice *devfb;
static int fbpriority;
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
*/
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:
}
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;
-}
-
-/* $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
* following in order to participate.
*/
-struct fbcmap;
-
struct fbdevice {
struct fbtype fb_fbtype; /* see fbio.h */
struct fbdriver *fb_driver; /* pointer to driver */
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();
-/* $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.
* 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 */
-/* $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.
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/kernel.h>
#include <machine/autoconf.h>
#include <machine/control.h>
#include <machine/idprom.h>
#include <machine/mon.h>
+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;
-/* $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.
#include <vm/vm.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-
/*
* 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 <machine/autoconf.h>
+#include <machine/cpu.h>
+#include <machine/pmap.h>
#include "i82586.h"
#include "if_iereg.h"
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 *));
*/
static inline void
ie_setup_config(cmd, promiscuous, manchester)
- struct ie_config_cmd *cmd;
+ volatile struct ie_config_cmd *cmd;
int promiscuous, manchester;
{
{
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);
}
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;
}
}
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;
}
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;
* 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;
{
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;
/*
* 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
* 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;
}
/*
* 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;
* .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
if ((cc->ie_cmd_status & mask) || timedout)
break;
- untimeout(chan_attn_timeout, (void *)&timedout);
+ untimeout(chan_attn_timeout, (caddr_t)&timedout);
return timedout;
} else {
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
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
(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 */
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;
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);
{
volatile struct ie_sys_ctl_block *scb = sc->scb;
void *ptr;
+ int n;
ptr = sc->buf_area;
* 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);
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);
* 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);
(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);
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);
struct ie_softc *sc;
{
- cmd_and_wait(sc, IE_RU_DISABLE, 0, 0);
+ command_and_wait(sc, IE_RU_DISABLE, 0, 0);
}
int
-/* $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.
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/dvma.h>
+#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/idprom.h>
#include <machine/vmparam.h>
void *args;
{
struct ie_softc *sc = (void *) self;
+ struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = args;
sc->hard_type = IE_OBIO;
-/* $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.
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/dvma.h>
+#include <machine/isr.h>
#include <machine/idprom.h>
#include <machine/vmparam.h>
* 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
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) {
-/* $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.
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));
-/* $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.
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/dvma.h>
+#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/idprom.h>
{
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 *)
-/* $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
#include <sys/device.h>
#include <machine/autoconf.h>
-#include <machine/control.h>
#include <machine/cpu.h>
-#include <machine/idprom.h>
#include <machine/obio.h>
#include <machine/pte.h>
/* 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 *));
struct device *parent;
void *vcf, *args;
{
- struct cfdata *cf = vcf;
+ struct cfdata *cf = vcf;
struct confargs *ca = args;
/* This driver only supports one unit. */
{
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;
-/* $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.
#include <sys/device.h>
#include <machine/autoconf.h>
-#include <machine/control.h>
#include <machine/pte.h>
#include <machine/mon.h>
+#include <machine/isr.h>
#include <machine/obio.h>
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
};
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;
* 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;
panic("obio_submatch: no match function for: %s\n",
cf->cf_driver->cd_name);
- return ((*submatch)(parent, cf, aux));
+ return ((*submatch)(parent, vcf, aux));
}
*/
#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;
{
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
(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)) {
/*
- * 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;
-/* $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.
};
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;
static void
obmem_attach(parent, self, args)
- struct device *parent, *self;
+ struct device *parent;
+ struct device *self;
void *args;
{
printf("\n");
-/* $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.
#include <scsi/scsiconf.h>
#include <machine/autoconf.h>
+#include <machine/isr.h>
+#include <machine/obio.h>
#include <machine/dvma.h>
#define DEBUG XXX
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)
/*
* 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;
#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
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
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;
{
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;
-/* $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.
#include <scsi/scsiconf.h>
#include <machine/autoconf.h>
+#include <machine/isr.h>
#include <machine/obio.h>
#include <machine/dvma.h>
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
*/
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... */
#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
#ifdef DEBUG
if (si_debug & 2) {
- printf("si_dma_start: sr=%p\n", sr);
+ printf("si_dma_start: sr=0x%x\n", sr);
}
#endif
-/* $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.
#include <scsi/scsiconf.h>
#include <machine/autoconf.h>
+#include <machine/isr.h>
+#include <machine/obio.h>
#include <machine/dvma.h>
#define DEBUG XXX
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;
#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
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;
-/* $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.
/*
* Autoconfiguration information.
- * (machdep parts of driver/kernel interface)
*/
/* These are the "bus" types: */
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));
-/* $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.
/* 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);
-/* $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.
#include <sys/types.h>
-/* 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));
-/* $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
* 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
* 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];
#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 <m68k/sysctl.h>
+/*
+ * 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_ */
-/* $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 <m68k/db_machdep.h>
/* 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));
-/* $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.
#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);
-/* $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.
#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
--- /dev/null
+/* $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));
-/* $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.
* 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.
* 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 <sun/fbio.h>
* 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;
/*
*
* getChar -- Return the next character from the input source
*
- * u_char getChar()
+ * unsigned char getChar()
*
* putChar -- Write the given character to the output source.
*
* 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
*
* 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.
*
-/* $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.
#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 */
-/* $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.
#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)
-/* $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
* 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
*/
/*
-/* $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.
#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 */
-/* $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 <m68k/types.h>
*/
#define ZSTTY_MAJOR 12 /* XXX */
#define ZSTTY_DEF_CFLAG (CREAD | CS8 | HUPCL)
-
-/* Zilog Serial hardware interrupts (hard-wired at 6) */
-#define splzs() spl6()
-/* $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.
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/conf.h>
#include <sys/device.h>
#include <sys/map.h>
+#include <sys/buf.h>
#include <sys/dkstat.h>
+#include <sys/conf.h>
#include <sys/dmap.h>
#include <sys/reboot.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
-#include <machine/control.h>
+#include <machine/isr.h>
#include <machine/pte.h>
#include <machine/pmap.h>
-#include "machdep.h"
+extern int soft1intr();
+
+void swapgeneric();
+void swapconf(), dumpconf();
int cold;
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 &&
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
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)
#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);
-}
+}
-/* $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.
#include <machine/control.h>
#include <machine/vmparam.h>
-#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;
-/* $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
#include <sys/device.h>
#include <machine/autoconf.h>
-#include <machine/control.h>
+#include <machine/psl.h>
#include <machine/cpu.h>
+
#include <machine/mon.h>
#include <machine/obio.h>
+#include <machine/control.h>
#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)
#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 = {
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)
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.
*/
}
* 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;
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);
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.
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;
* 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
time.tv_sec = clk_time;
}
-/*
+/*
* Resettodr restores the time of day hardware after a time change.
*/
void resettodr()
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)
-/* $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
#include <machine/conf.h>
+int ttselect __P((dev_t, int, struct proc *));
+
#include "bpfilter.h"
#include "ccd.h"
#include "cd.h"
/*
* Returns true if dev is /dev/mem or /dev/kmem.
*/
-int
iskmemdev(dev)
dev_t dev;
{
/*
* Returns true if dev is /dev/zero.
*/
-int
iszerodev(dev)
dev_t dev;
{
/*
* Convert a character device number to a block device number.
*/
-int
chrtoblk(dev)
dev_t dev;
{
-/* $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.
#include <vm/vm.h>
-#include <machine/control.h>
#include <machine/db_machdep.h>
#include <ddb/db_command.h>
-#include <ddb/db_output.h>
#include <machine/pte.h>
-#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;
}
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;
* 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, }
};
-/* $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.
*/
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/proc.h>
#include <vm/vm.h>
-#include <machine/control.h>
#include <machine/pte.h>
#include <machine/db_machdep.h>
#include <ddb/db_access.h>
-#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.
* 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;
#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;
/*
* Write bytes to kernel address space for debugger.
*/
+extern char kernel_text[], etext[];
void
db_write_bytes(addr, size, data)
vm_offset_t addr;
-/* $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.
#include <machine/autoconf.h>
#include <machine/cpu.h>
-#include <machine/control.h>
#include <machine/reg.h>
#include <machine/pte.h>
#include <machine/pmap.h>
#include <machine/dvma.h>
-#include "machdep.h"
+#include "cache.h"
/* Resource map used by dvma_mapin/dvma_mapout */
#define NUM_DVMA_SEGS 10
/* 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;
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);
-/* $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.
#include <machine/control.h>
#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
"mc68882", /* 2 */
"?" };
-void
-initfpu()
+void initfpu()
{
char *descr;
int enab_reg;
}
}
-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);
}
-/* $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
#include <machine/vmparam.h>
#include <machine/dvma.h>
+#include "intersil7170.h"
+#include "interreg.h"
#include "buserr.h"
-#include "machdep.h"
#if 1 /* XXX - Temporary hack... */
/*
#define def1(name) def("name", name)
#endif
-extern void printf __P((char *fmt, ...));
-extern void exit __P((int));
-
void
def(what, val)
char *what;
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);
def1(ENAMETOOLONG);
/* trap types: locore.s includes trap.h */
-
+
/*
* unix structure-isms
*/
-/* $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.
#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);
-/* $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.
/*
* 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
*/
};
/* 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
-/* $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.
#include <machine/cpu.h>
#include <machine/mon.h>
#include <machine/obio.h>
+#include <machine/isr.h>
#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
/* called early (by internal_configure) */
-void
-intreg_init()
+void intreg_init()
{
interrupt_reg = obio_find_mapping(OBIO_INTERREG, 1);
if (!interrupt_reg)
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)
void *args;
{
struct intreg_softc *sc = (void *)self;
+ struct cfdata *cf = self->dv_cfdata;
printf("\n");
* 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;
-/* $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.
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/vmmeter.h>
#include <net/netisr.h>
-#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/mon.h>
#include <machine/obio.h>
+#include <machine/isr.h>
-#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;
ccittintr();
}
#endif
+#include "ppp.h"
#if NPPP > 0
if (n & (1 << NETISR_PPP)) {
pppintr();
* 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;
* Called by driver attach functions.
*/
void isr_add_autovect(handler, arg, level)
- isr_func_t handler;
+ int (*handler)();
void *arg;
int 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];
* 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;
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;
}
* 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;
{
}
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];
}
-/* $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
#include <machine/trap.h>
#include <sun3/sun3/kgdb_proto.h>
-#include <machine/db_machdep.h>
#include <machine/remote-sl.h>
+/* 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
* Translate a trap number into a unix compatible signal value.
* (gdb only understands unix signal numbers).
*/
-static int
+static int
computeSignal(type)
int type;
{
-/* $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
* 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
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:
/*
* 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
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
/*
* 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 \
#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
.data
.globl _Idle_count
_Idle_count:
- .long 0
+ .long 0
.text
.globl Idle
stop #PSL_LOWIPL
Idle:
movw #PSL_HIGHIPL,sr
- addql #1, _Idle_count
+ addql #1, _Idle_count
tstl _whichqs
jeq Lidle
movw #PSL_LOWIPL,sr
/*
* 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
*/
/*
* 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
-/* $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
#include <sys/shm.h>
#endif
-#include <vm/vm.h>
-#include <vm/vm_map.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <dev/cons.h>
-
#include <machine/cpu.h>
#include <machine/reg.h>
#include <machine/psl.h>
#include <machine/pte.h>
-#include <machine/mon.h>
-#include <machine/dvma.h>
+#include <machine/mon.h>
+#include <machine/isr.h>
#include <machine/kcore.h>
-#include <machine/db_machdep.h>
-#include "machdep.h"
+#include <dev/cons.h>
+
+#include <vm/vm.h>
+#include <vm/vm_map.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_page.h>
+
+#include <net/netisr.h>
+
+#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
#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,
*/
void consinit()
{
- cninit();
+ extern void cninit();
+ cninit();
#ifdef KGDB
/* XXX - Ask on console for kgdb_dev? */
ddb_init();
if (boothowto & RB_KDB)
Debugger();
-#endif DDB
+#endif
}
/*
*/
#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;
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)
{
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}.
*/
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... */
}
/*
* machine dependent system variables.
*/
-int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
size_t newlen;
struct proc *p;
{
- int error;
dev_t consdev;
/* all sysctl names at this level are terminal */
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
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)
return;
}
kfp = (struct sigframe *)malloc((u_long)fsize, M_TEMP, M_WAITOK);
- /*
+ /*
* Build the argument list for the signal handler.
*/
kfp->sf_signum = sig;
*/
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)
* 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;
/*
* 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;
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.
{
int nblks; /* size of dump area */
int maj;
- int (*getsize)__P((dev_t));
+ int (*getsize)();
if (dumpdev == NODEV)
return;
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);
* 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;
if (dumppage_va == 0)
return;
- /*
+ /*
* For dumps during autoconfiguration,
* if dump device has already configured...
*/
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;
printf(" dump error=%d\n", error);
}
-static void
initcpu()
{
/* XXX: Enable RAM parity/ECC checking? */
#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;
static int doingdump = 0;
register int i;
int s;
+ extern char *hexstr();
if (doingdump)
return;
#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)
printf("\n");
}
-static char *
+char *
hexstr(val, len)
register int val;
int 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;
-/* $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.
*/
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
+#include <sys/buf.h>
+#include <sys/systm.h>
#include <sys/uio.h>
+#include <sys/malloc.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <vm/vm_map.h>
#include <machine/cpu.h>
-#include <machine/eeprom.h>
#include <machine/pte.h>
#include <machine/pmap.h>
-#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);
/*ARGSUSED*/
int
-mmclose(dev, flag, mode, p)
+mmclose(dev, flag, mode)
dev_t dev;
int flag, mode;
- struct proc *p;
{
return (0);
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;
}
-/* $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.
* 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.
#include <machine/dvma.h>
#include <machine/pmap.h>
-#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 */
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;
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;
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));
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));
#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__); \
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
}
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
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
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();
}
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.
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.
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);
}
#ifdef PMAP_DEBUG
-/* call from debugger */
-void
+static void
pv_print(pa)
vm_offset_t 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;
}
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
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
#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
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);
void
pmap_bootstrap()
{
+ extern void vm_set_page_size();
/*
* Reserve a segment for the kernel to use to access a pmeg
pmap_page_index(pa)
vm_offset_t pa;
{
- int idx;
+ u_long idx;
#ifdef DIAGNOSTIC
if (pa < avail_start || pa >= avail_end)
}
#endif
- idx = sun3_btop(pa);
- return (idx);
+ return (sun3_btop(pa));
}
#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!");
pmap_t pmap;
vm_offset_t sva, eva;
{
+ int old_ctx, i;
pmeg_t pmegp;
vm_offset_t va;
int pte, sme;
#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. */
}
#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
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 */
#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. */
}
#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
pmap_t pmap;
vm_offset_t sva, eva;
{
- int s, sme;
+ int c, s, sme;
int old_ctx;
boolean_t in_ctx;
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;
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;
}
}
#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
*/
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
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;
}
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
}
#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
#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
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;
rv = 1;
}
}
-
+
PMAP_UNLOCK();
return (0);
}
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
}
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);
}
}
{
#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... */
}
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
/*
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. */
int pte, sme, ptenum, segnum;
vm_offset_t va;
pmeg_t pmegp;
+ int nflags;
/* Interrupt level handled by caller. */
CHECK_SPL();
pmap_t pmap;
vm_offset_t sva, eva;
{
- int s, sme;
+ int c, s, sme;
int old_ctx;
boolean_t in_ctx;
#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))
#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)
* 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 {
* 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;
-/* $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.
#include <vm/vm.h>
#include <machine/control.h>
+#include <machine/cpufunc.h>
#include <machine/cpu.h>
-#include <machine/db_machdep.h>
#include <machine/dvma.h>
#include <machine/mon.h>
#include <machine/pte.h>
#include "vector.h"
#include "interreg.h"
-#include "machdep.h"
/* This is defined in locore.s */
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 */
/*
* 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;
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) */
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;
/*
* 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? */
/*
* 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);
}
* 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! */
* 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;
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) {
/*
* Preserve DDB symbols and strings by setting esym.
*/
-static void
sun3_save_symtab(kehp)
struct exec *kehp; /* kernel exec header */
{
* 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;
/*
* 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;
}
*/
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;
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;
* 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':
/*
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);
* argv[1] = options (i.e. "-ds" or NULL)
* argv[2] = NULL
*/
-static void
-sun3_monitor_hooks()
+void sun3_monitor_hooks()
{
MachMonBootParam *bpp;
char **argp;
#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().
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 */
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. */
}
-/* $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:
* 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.
*/
/*
#include <sys/systm.h>
#include <sys/reboot.h>
-#include <dev/cons.h>
-
#include <machine/mon.h>
-#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;
/*
* 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;
return (target * 2 + lun);
}
-static int
-xx_mkunit(ctlr, unit)
+static int xx_mkunit(ctlr, unit)
int ctlr, unit;
{
return (ctlr * 2 + 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 *
return NULL;
}
-static void
-gc_print_all __P((void))
+static void gc_print_all()
{
struct genconf *gc;
}
printf("\n");
}
-
+
struct devspec {
int major;
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;
{
* 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;
* 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;
* 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);
}
}
-static dev_t
-ds_todev(ds)
+static dev_t ds_todev(ds)
struct devspec *ds;
{
int minor;
* 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];
}
/* XXX - Isn't this in some common file? */
-static void
gets(cp)
char *cp;
{
-/* $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
#include <sys/buf.h>
#include <sys/trace.h>
#include <sys/mount.h>
-#include <sys/syscallargs.h>
#include <vm/vm.h>
-#include <machine/cpu.h>
-#include "machdep.h"
+
+#include <sys/syscallargs.h>
#ifdef TRACE
int nvualarm;
}
#endif
+#include <machine/cpu.h>
+#include "cache.h"
/* XXX should be in an include file somewhere */
#define CC_PURGE 1
/* XXX end should be */
/*ARGSUSED1*/
-int
cachectl(req, addr, len)
int req;
caddr_t addr;
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;
}
-/* $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.
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
#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 */
-/* $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.
#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[])();
-/* $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.
#include <machine/pte.h>
#include <machine/pmap.h>
-#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.
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
* 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));
*/
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
void (*func)(struct proc *);
{
struct pcb *pcbp;
+ struct switchframe *sf;
+ extern void proc_trampoline();
struct ksigframe {
struct switchframe sf;
void (*func)(struct proc *);
*/
}
-/*
- * 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
struct md_core md_core;
struct coreseg cseg;
int error;
+ register i;
/* XXX: Make sure savectx() was done? */