diff options
Diffstat (limited to 'sys/arch')
84 files changed, 1198 insertions, 942 deletions
diff --git a/sys/arch/sun3/conf/Makefile.sun3 b/sys/arch/sun3/conf/Makefile.sun3 index ae4def43679..5a4a80f0b77 100644 --- a/sys/arch/sun3/conf/Makefile.sun3 +++ b/sys/arch/sun3/conf/Makefile.sun3 @@ -37,8 +37,8 @@ INCLUDES= -I. -I$S/arch -I$S -nostdinc XDEFS= -undef -D__OpenBSD__ -Dm68k -Dmc68000 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ -Dmc68020 -Dsun3 ${XDEFS} -CWARNFLAGS= -Werror # -Wall -Wstrict-prototypes -Wmissing-prototypes -CFLAGS= ${DEBUG} ${CWARNFLAGS} -O2 -msoft-float +CWARNFLAGS= -Werror -# Wall -Wstrict-prototypes -Wmissing-prototypes +CFLAGS= ${DEBUG} ${CWARNFLAGS} -O2 -msoft-float -pipe AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -N -Ttext 0E004000 -e start STRIPFLAGS= -d @@ -105,11 +105,14 @@ LINKFLAGS+= -S assym.h: genassym ./genassym >assym.h -genassym: genassym.o - ${CC} -o $@ genassym.o - -genassym.o: ${SUN3}/sun3/genassym.c - ${HOSTED_C} +# Doing a cross-build of this is very tricky, and very dependent +# on compatibility of things like structure member alignment in +# the compiler used as HOSTED_CC (must match the native compiler). +# Often this is not possible at all, and you just have to build +# the assym.h file by hand on some other machine. -gwr +genassym: ${SUN3}/sun3/genassym.c + ${CC} ${CPPFLAGS} -E $< > $@.i + ${HOSTED_CC} -o $@ $@.i param.c: $S/conf/param.c rm -f param.c diff --git a/sys/arch/sun3/dev/am9516.h b/sys/arch/sun3/dev/am9516.h index 1f6dda3d31b..4dfaf835382 100644 --- a/sys/arch/sun3/dev/am9516.h +++ b/sys/arch/sun3/dev/am9516.h @@ -1,3 +1,4 @@ +/* $OpenBSD: am9516.h,v 1.2 1997/01/16 04:03:41 kstailey Exp $ */ /* $NetBSD: am9516.h,v 1.1 1995/10/29 21:19:06 gwr Exp $ */ /* @@ -33,8 +34,8 @@ #define UDC_ADR_CMR_LOW 0x52 /* channel mode reg, low word */ #define UDC_ADR_COUNT 0x32 /* number of words to transfer */ -/* - * For a dma transfer, the appropriate udc registers are loaded from a +/* + * For a dma transfer, the appropriate udc registers are loaded from a * table in memory pointed to by the chain address register. */ struct udc_table { diff --git a/sys/arch/sun3/dev/bt_subr.c b/sys/arch/sun3/dev/bt_subr.c index a7d6507286e..d51468ad11e 100644 --- a/sys/arch/sun3/dev/bt_subr.c +++ b/sys/arch/sun3/dev/bt_subr.c @@ -1,3 +1,4 @@ +/* $OpenBSD: bt_subr.c,v 1.2 1997/01/16 04:03:42 kstailey Exp $ */ /* $NetBSD: bt_subr.c,v 1.2 1995/04/10 22:12:48 gwr Exp $ */ /* diff --git a/sys/arch/sun3/dev/bw2.c b/sys/arch/sun3/dev/bw2.c index 3ce58a1061b..08ee1f252a6 100644 --- a/sys/arch/sun3/dev/bw2.c +++ b/sys/arch/sun3/dev/bw2.c @@ -1,3 +1,4 @@ +/* $OpenBSD: bw2.c,v 1.8 1997/01/16 04:03:42 kstailey Exp $ */ /* $NetBSD: bw2.c,v 1.8 1996/10/13 03:47:25 christos Exp $ */ /* @@ -51,14 +52,17 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/device.h> #include <sys/ioctl.h> #include <sys/malloc.h> #include <sys/mman.h> #include <sys/tty.h> +#include <sys/conf.h> #include <vm/vm.h> +#include <machine/conf.h> #include <machine/cpu.h> #include <machine/fbio.h> #include <machine/autoconf.h> @@ -91,24 +95,24 @@ struct cfdriver bwtwo_cd = { /* XXX we do not handle frame buffer interrupts */ -/* frame buffer generic driver */ -int bw2open(), bw2close(), bw2ioctl(), bw2mmap(); - -static int bw2gvideo __P((struct fbdevice *, int *)); +static int bw2gvideo __P((struct fbdevice *, int *)); static int bw2svideo __P((struct fbdevice *, int *)); static struct fbdriver bw2fbdriver = { bw2open, bw2close, bw2mmap, - enoioctl, /* gattr */ + (void *)enoioctl, /* gattr */ bw2gvideo, bw2svideo, - enoioctl, enoioctl }; + (void *)enoioctl, (void *)enoioctl /* getcmap, putcmap */ +}; static int bw2match(parent, vcf, args) struct device *parent; void *vcf, *args; { +#if 0 struct cfdata *cf = vcf; +#endif struct confargs *ca = args; int x; @@ -145,7 +149,6 @@ bw2attach(parent, self, args) struct fbdevice *fb = &sc->sc_fb; struct confargs *ca = args; struct fbtype *fbt; - int ramsize; sc->sc_phys = ca->ca_paddr; diff --git a/sys/arch/sun3/dev/cg2.c b/sys/arch/sun3/dev/cg2.c index 0567eed2b29..aaed1f3412d 100644 --- a/sys/arch/sun3/dev/cg2.c +++ b/sys/arch/sun3/dev/cg2.c @@ -1,3 +1,4 @@ +/* $OpenBSD: cg2.c,v 1.6 1997/01/16 04:03:43 kstailey Exp $ */ /* $NetBSD: cg2.c,v 1.7 1996/10/13 03:47:26 christos Exp $ */ /* @@ -53,14 +54,17 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/device.h> #include <sys/ioctl.h> #include <sys/malloc.h> #include <sys/mman.h> #include <sys/tty.h> +#include <sys/conf.h> #include <vm/vm.h> +#include <machine/conf.h> #include <machine/fbio.h> #include <machine/autoconf.h> #include <machine/pmap.h> @@ -102,11 +106,8 @@ struct cfdriver cgtwo_cd = { NULL, "cgtwo", DV_DULL }; -/* 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 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 *)); @@ -114,10 +115,10 @@ static int cg2putcmap __P((struct fbdevice *, struct fbcmap *)); static struct fbdriver cg2fbdriver = { cg2open, cg2close, cg2mmap, cg2gattr, cg2gvideo, cg2svideo, - cg2getcmap, cg2putcmap }; + cg2getcmap, cg2putcmap +}; -static void cg2loadcmap __P((struct cg2_softc *, int, int)); -static int cg2intr __P((void*)); +static int cg2intr __P((void*)); /* * Match a cg2. @@ -158,7 +159,6 @@ cg2attach(parent, self, args) struct fbdevice *fb = &sc->sc_fb; struct confargs *ca = args; struct fbtype *fbt; - int i, ramsize, pa; sc->sc_phys = ca->ca_paddr; sc->sc_pmtype = PMAP_NC | PMAP_VME16; @@ -238,7 +238,6 @@ cg2mmap(dev, off, prot) int off, prot; { struct cg2_softc *sc = cgtwo_cd.cd_devs[minor(dev)]; - int realoff; if (off & PGOFSET) panic("cg2mmap"); @@ -258,7 +257,8 @@ cg2mmap(dev, off, prot) */ /* FBIOGATTR: */ -static int cg2gattr(fb, fba) +static int +cg2gattr(fb, fba) struct fbdevice *fb; struct fbgattr *fba; { @@ -275,7 +275,8 @@ static int cg2gattr(fb, fba) } /* FBIOGVIDEO: */ -static int cg2gvideo(fb, on) +static int +cg2gvideo(fb, on) struct fbdevice *fb; int *on; { @@ -298,7 +299,8 @@ static int cg2svideo(fb, on) } /* FBIOGETCMAP: */ -static int cg2getcmap(fb, cmap) +static int +cg2getcmap(fb, cmap) struct fbdevice *fb; struct fbcmap *cmap; { @@ -339,7 +341,8 @@ static int cg2getcmap(fb, cmap) } /* FBIOPUTCMAP: */ -static int cg2putcmap(fb, cmap) +static int +cg2putcmap(fb, cmap) struct fbdevice *fb; struct fbcmap *cmap; { diff --git a/sys/arch/sun3/dev/cg4.c b/sys/arch/sun3/dev/cg4.c index 960e7bdb0fe..27221fe73e5 100644 --- a/sys/arch/sun3/dev/cg4.c +++ b/sys/arch/sun3/dev/cg4.c @@ -1,3 +1,4 @@ +/* $OpenBSD: cg4.c,v 1.8 1997/01/16 04:03:43 kstailey Exp $ */ /* $NetBSD: cg4.c,v 1.11 1996/10/29 19:54:19 gwr Exp $ */ /* @@ -65,9 +66,11 @@ #include <sys/malloc.h> #include <sys/mman.h> #include <sys/tty.h> +#include <sys/conf.h> #include <vm/vm.h> +#include <machine/conf.h> #include <machine/cpu.h> #include <machine/fbio.h> #include <machine/autoconf.h> @@ -117,7 +120,6 @@ struct cfdriver cgfour_cd = { }; /* frame buffer generic driver */ -int cg4open(), cg4close(), cg4mmap(); static int cg4gattr __P((struct fbdevice *, struct fbgattr *)); static int cg4gvideo __P((struct fbdevice *, int *)); @@ -136,7 +138,8 @@ static void cg4b_ldcmap __P((struct cg4_softc *)); static struct fbdriver cg4_fbdriver = { cg4open, cg4close, cg4mmap, cg4gattr, cg4gvideo, cg4svideo, - cg4getcmap, cg4putcmap }; + cg4getcmap, cg4putcmap +}; /* * Match a cg4. @@ -230,7 +233,7 @@ cg4attach(parent, self, args) sc->sc_btcm = NULL; cg4a_init(sc); break; - + case CG4_TYPE_B: /* Sun3/60 */ default: sc->sc_va_cmap = (struct bt_regs *) @@ -292,7 +295,7 @@ cg4ioctl(dev, cmd, data, flags, p) * 128k overlay data memory * 128k overlay enable bitmap * 1024k color memory - * + * * The hardware really looks like this (starting at ca_paddr) * 4 bytes Brooktree DAC registers * 2MB-4 gap @@ -343,7 +346,8 @@ cg4mmap(dev, off, prot) */ /* FBIOGATTR: */ -static int cg4gattr(fb, fba) +static int +cg4gattr(fb, fba) struct fbdevice *fb; struct fbgattr *fba; { @@ -360,7 +364,8 @@ static int cg4gattr(fb, fba) } /* FBIOGVIDEO: */ -static int cg4gvideo(fb, on) +static int +cg4gvideo(fb, on) struct fbdevice *fb; int *on; { @@ -371,7 +376,8 @@ static int cg4gvideo(fb, on) } /* FBIOSVIDEO: */ -static int cg4svideo(fb, on) +static int +cg4svideo(fb, on) struct fbdevice *fb; int *on; { @@ -390,7 +396,8 @@ static int cg4svideo(fb, on) * FBIOGETCMAP: * Copy current colormap out to user space. */ -static int cg4getcmap(fb, fbcm) +static int +cg4getcmap(fb, fbcm) struct fbdevice *fb; struct fbcmap *fbcm; { @@ -420,7 +427,8 @@ static int cg4getcmap(fb, fbcm) * FBIOPUTCMAP: * Copy new colormap from user space and load. */ -static int cg4putcmap(fb, fbcm) +static int +cg4putcmap(fb, fbcm) struct fbdevice *fb; struct fbcmap *fbcm; { diff --git a/sys/arch/sun3/dev/eeprom.c b/sys/arch/sun3/dev/eeprom.c index 4277845016f..1cf24fe517a 100644 --- a/sys/arch/sun3/dev/eeprom.c +++ b/sys/arch/sun3/dev/eeprom.c @@ -1,3 +1,4 @@ +/* $OpenBSD: eeprom.c,v 1.6 1997/01/16 04:03:44 kstailey Exp $ */ /* $NetBSD: eeprom.c,v 1.8 1996/03/26 15:16:06 gwr Exp $ */ /* @@ -36,27 +37,28 @@ */ #include <sys/param.h> +#include <sys/kernel.h> #include <sys/systm.h> #include <sys/device.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> #include <machine/eeprom.h> -#define HZ 100 /* XXX */ - int ee_console; /* for convenience of drivers */ -static int ee_update(caddr_t buf, int off, int cnt); - static char *eeprom_va; static int ee_busy, ee_want; static int eeprom_match __P((struct device *, void *vcf, void *args)); static void eeprom_attach __P((struct device *, struct device *, void *)); +static int ee_update __P((caddr_t, int, int)); +static int ee_take __P((void)); +static void ee_give __P((void)); struct cfattach eeprom_ca = { sizeof(struct device), eeprom_match, eeprom_attach @@ -75,10 +77,10 @@ void eeprom_init() static int eeprom_match(parent, vcf, args) - struct device *parent; - void *vcf, *args; + struct device *parent; + void *vcf, *args; { - struct cfdata *cf = vcf; + struct cfdata *cf = vcf; struct confargs *ca = args; int pa; @@ -109,15 +111,16 @@ eeprom_attach(parent, self, args) struct device *self; void *args; { - struct confargs *ca = args; printf("\n"); } -static int ee_take() /* Take the lock. */ +static int +ee_take() /* Take the lock. */ { int error = 0; + while (ee_busy) { ee_want = 1; error = tsleep(&ee_busy, PZERO | PCATCH, "eeprom", 0); @@ -130,8 +133,10 @@ static int ee_take() /* Take the lock. */ return error; } -static void ee_give() /* Give the lock. */ +static void +ee_give() /* Give the lock. */ { + ee_busy = 0; if (ee_want) { ee_want = 0; @@ -139,7 +144,8 @@ static void ee_give() /* Give the lock. */ } } -int eeprom_uio(struct uio *uio) +int +eeprom_uio(struct uio *uio) { int error; int off; /* NOT off_t */ @@ -190,7 +196,8 @@ int eeprom_uio(struct uio *uio) /* * Update the EEPROM from the passed buf. */ -static int ee_update(char *buf, int off, int cnt) +static int +ee_update(char *buf, int off, int cnt) { volatile char *ep; char *bp; @@ -215,7 +222,7 @@ static int ee_update(char *buf, int off, int cnt) * holding the lock to prevent all access to * the EEPROM while it recovers. */ - (void)tsleep(eeprom_va, PZERO-1, "eeprom", HZ/50); + (void)tsleep(eeprom_va, PZERO-1, "eeprom", hz/50); } /* Make sure the write worked. */ if (*ep != *bp) @@ -232,7 +239,8 @@ static int ee_update(char *buf, int off, int cnt) * things like the zs driver very early to find out * which device should be used as the console. */ -int ee_get_byte(int off, int canwait) +int +ee_get_byte(int off, int canwait) { int c = -1; if ((off < 0) || (off >= OBIO_EEPROM_SIZE)) diff --git a/sys/arch/sun3/dev/fb.c b/sys/arch/sun3/dev/fb.c index dea031c9798..c7178e11a18 100644 --- a/sys/arch/sun3/dev/fb.c +++ b/sys/arch/sun3/dev/fb.c @@ -1,3 +1,4 @@ +/* $OpenBSD: fb.c,v 1.4 1997/01/16 04:03:45 kstailey Exp $ */ /* $NetBSD: fb.c,v 1.3 1995/04/10 05:45:56 mycroft Exp $ */ /* @@ -54,7 +55,9 @@ #include <sys/ioctl.h> #include <sys/proc.h> +#include <machine/conf.h> #include <machine/fbio.h> +#include <machine/machdep.h> #include "fbvar.h" diff --git a/sys/arch/sun3/dev/fbvar.h b/sys/arch/sun3/dev/fbvar.h index aae60c99151..e9a9a541553 100644 --- a/sys/arch/sun3/dev/fbvar.h +++ b/sys/arch/sun3/dev/fbvar.h @@ -1,3 +1,4 @@ +/* $OpenBSD: fbvar.h,v 1.5 1997/01/16 04:03:45 kstailey Exp $ */ /* $NetBSD: fbvar.h,v 1.3 1996/10/29 19:27:37 gwr Exp $ */ /* @@ -80,4 +81,3 @@ struct fbdriver { void fb_attach __P((struct fbdevice *, int)); int fbioctlfb __P((struct fbdevice *, u_long, caddr_t)); -extern int enoioctl(); diff --git a/sys/arch/sun3/dev/idprom.c b/sys/arch/sun3/dev/idprom.c index 70c9d2f2892..f0939215305 100644 --- a/sys/arch/sun3/dev/idprom.c +++ b/sys/arch/sun3/dev/idprom.c @@ -1,3 +1,4 @@ +/* $OpenBSD: idprom.c,v 1.6 1997/01/16 04:03:46 kstailey Exp $ */ /* $NetBSD: idprom.c,v 1.13 1996/11/20 18:56:50 gwr Exp $ */ /*- @@ -42,9 +43,11 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/conf.h> #include <sys/device.h> #include <machine/autoconf.h> +#include <machine/conf.h> #include <machine/control.h> #include <machine/idprom.h> #include <machine/mon.h> @@ -57,7 +60,8 @@ extern long hostid; /* in kern_sysctl.c */ */ struct idprom identity_prom; -int idpromopen(dev, oflags, devtype, p) +int +idpromopen(dev, oflags, devtype, p) dev_t dev; int oflags; int devtype; @@ -66,7 +70,8 @@ int idpromopen(dev, oflags, devtype, p) return 0; } -int idpromclose(dev, fflag, devtype, p) +int +idpromclose(dev, fflag, devtype, p) dev_t dev; int fflag; int devtype; @@ -75,12 +80,13 @@ int idpromclose(dev, fflag, devtype, p) return 0; } +int idpromread(dev, uio, ioflag) dev_t dev; struct uio *uio; int ioflag; { - int error, unit, length; + int error, length; error = 0; while (uio->uio_resid > 0 && error == 0) { @@ -97,7 +103,8 @@ idpromread(dev, uio, ioflag) * 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; @@ -141,7 +148,8 @@ int idprom_init() return 0; } -void idprom_etheraddr(eaddrp) +void +idprom_etheraddr(eaddrp) u_char *eaddrp; { u_char *src, *dst; diff --git a/sys/arch/sun3/dev/if_ie.c b/sys/arch/sun3/dev/if_ie.c index 32f52c05e8f..0bbe7729481 100644 --- a/sys/arch/sun3/dev/if_ie.c +++ b/sys/arch/sun3/dev/if_ie.c @@ -1,3 +1,4 @@ +/* $OpenBSD: if_ie.c,v 1.9 1997/01/16 04:03:46 kstailey Exp $ */ /* $NetBSD: if_ie.c,v 1.15 1996/10/30 00:24:33 gwr Exp $ */ /*- @@ -174,13 +175,28 @@ void iestart __P((struct ifnet *)); void iereset __P((struct ie_softc *)); static void ie_readframe __P((struct ie_softc *, 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 int command_and_wait __P((struct ie_softc *, int, void volatile *, int)); +static __inline__ void ie_setup_config __P((volatile struct ie_config_cmd *, + int, int)); static void ierint __P((struct ie_softc *)); static void ietint __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 int ie_setupram __P((struct ie_softc *)); +static __inline__ caddr_t Align __P((caddr_t)); +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 *, + int *)); +static __inline__ int ie_buflen __P((struct ie_softc *, int)); +static __inline__ int ie_packet_len __P((struct ie_softc *)); +static __inline__ void iexmit __P((struct ie_softc *)); +static __inline__ int ieget __P((struct ie_softc *, struct mbuf **, + struct ether_header *, int *)); +static void chan_attn_timeout __P((void *)); +static void run_tdr __P((struct ie_softc *, struct ie_tdr_cmd *)); +static void iestop __P((struct ie_softc *)); #ifdef IEDEBUG void print_rbd __P((volatile struct ie_recv_buf_desc *)); @@ -213,7 +229,7 @@ struct cfdriver ie_cd = { * but since we have the inline facility, it makes sense to use that * instead. */ -static inline void +static __inline__ void ie_setup_config(cmd, promiscuous, manchester) volatile struct ie_config_cmd *cmd; int promiscuous, manchester; @@ -236,7 +252,7 @@ ie_setup_config(cmd, promiscuous, manchester) cmd->ie_junk = 0xff; } -static inline caddr_t +static __inline__ caddr_t Align(ptr) caddr_t ptr; { @@ -246,7 +262,7 @@ Align(ptr) return (caddr_t)l; } -static inline void +static __inline__ void ie_ack(sc, mask) struct ie_softc *sc; u_int mask; @@ -349,8 +365,8 @@ ie_intr(v) volatile struct ievme *iev = (volatile struct ievme *)sc->sc_reg; if (iev->status & IEVME_PERR) { printf("%s: parity error (ctrl %x @ %02x%04x)\n", - iev->pectrl, iev->pectrl & IEVME_HADDR, - iev->peaddr); + sc->sc_dev.dv_xname, + iev->pectrl, iev->pectrl & IEVME_HADDR, iev->peaddr); iev->pectrl = iev->pectrl | IEVME_PARACK; } } @@ -455,7 +471,6 @@ ietint(sc) struct ie_softc *sc; { int status; - int i; sc->sc_arpcom.ac_if.if_timer = 0; sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE; @@ -467,7 +482,7 @@ ietint(sc) if (status & IE_STAT_OK) { sc->sc_arpcom.ac_if.if_opackets++; - sc->sc_arpcom.ac_if.if_collisions += + sc->sc_arpcom.ac_if.if_collisions += SWAP(status & IE_XS_MAXCOLL); } else if (status & IE_STAT_ABORT) { printf("%s: send aborted\n", sc->sc_dev.dv_xname); @@ -513,7 +528,7 @@ ietint(sc) * This expands to 10 short m68k instructions! -gwr * Note: use this like bcmp() */ -static inline u_short +static __inline__ u_short ether_cmp(one, two) u_char *one, *two; { @@ -541,7 +556,7 @@ ether_cmp(one, two) * only client which will fiddle with IFF_PROMISC is BPF. This is * probably a good assumption, but we do not make it here. (Yet.) */ -static inline int +static __inline__ int check_eh(sc, eh, to_bpf) struct ie_softc *sc; struct ether_header *eh; @@ -648,7 +663,7 @@ check_eh(sc, eh, to_bpf) * IE_RBUF_SIZE is an even power of two. If somehow the act_len exceeds * the size of the buffer, then we are screwed anyway. */ -static inline int +static __inline__ int ie_buflen(sc, head) struct ie_softc *sc; int head; @@ -658,7 +673,7 @@ ie_buflen(sc, head) & (IE_RBUF_SIZE | (IE_RBUF_SIZE - 1))); } -static inline int +static __inline__ int ie_packet_len(sc) struct ie_softc *sc; { @@ -691,7 +706,7 @@ ie_packet_len(sc) * command to the chip to be executed. On the way, if we have a BPF listener * also give him a copy. */ -inline static void +static __inline__ void iexmit(sc) struct ie_softc *sc; { @@ -720,7 +735,7 @@ iexmit(sc) sc->xmit_cmds[sc->xctail]->ie_xmit_desc = MK_16(sc->sc_maddr, sc->xmit_buffs[sc->xctail]); - sc->scb->ie_command_list = + sc->scb->ie_command_list = MK_16(sc->sc_maddr, sc->xmit_cmds[sc->xctail]); command_and_wait(sc, IE_CU_START, 0, 0); @@ -738,7 +753,7 @@ iexmit(sc) * chain of partially-full mbufs. This should help to speed up the * operation considerably. (Provided that it works, of course.) */ -static inline int +static __inline__ int ieget(sc, mp, ehp, to_bpf) struct ie_softc *sc; struct mbuf **mp; @@ -1091,7 +1106,7 @@ iestart(ifp) /* * set up IE's ram space */ -int +static int ie_setupram(sc) struct ie_softc *sc; { @@ -1125,7 +1140,7 @@ ie_setupram(sc) if (iscp->ie_busy) { splx(s); - return 0; + return (0); } /* * Acknowledge any interrupts we may have caused... @@ -1133,7 +1148,7 @@ ie_setupram(sc) ie_ack(sc, IE_ST_WHENCE); splx(s); - return 1; + return (1); } void @@ -1172,10 +1187,10 @@ iereset(sc) * This is called if we time out. */ static void -chan_attn_timeout(rock) - caddr_t rock; +chan_attn_timeout(arg) + void *arg; { - *(int *) rock = 1; + *((int *) arg) = 1; } /* @@ -1302,13 +1317,11 @@ run_tdr(sc, cmd) * note: this function was written to be easy to understand, rather than * highly efficient (it isn't in the critical path). */ -static void +static void setup_bufs(sc) struct ie_softc *sc; { caddr_t ptr = sc->buf_area; /* memory pool */ - volatile struct ie_recv_frame_desc *rfd = (void *) ptr; - volatile struct ie_recv_buf_desc *rbd; int n, r; /* @@ -1318,14 +1331,15 @@ setup_bufs(sc) (sc->sc_bzero)(ptr, sc->buf_area_sz); ptr = Align(ptr); /* set alignment and stick with it */ - n = (int)Align(sizeof(struct ie_xmit_cmd)) + - (int)Align(sizeof(struct ie_xmit_buf)) + IE_TBUF_SIZE; + n = (int)Align((caddr_t)sizeof(struct ie_xmit_cmd)) + + (int)Align((caddr_t)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 = (int)Align(sizeof(struct ie_recv_frame_desc)) + - (((int)Align(sizeof(struct ie_recv_buf_desc)) + IE_RBUF_SIZE) * B_PER_F); + r = (int)Align((caddr_t)sizeof(struct ie_recv_frame_desc)) + + (((int)Align((caddr_t)sizeof(struct ie_recv_buf_desc)) + + IE_RBUF_SIZE) * B_PER_F); /* r = size of one R frame */ @@ -1471,7 +1485,6 @@ ieinit(sc) { volatile struct ie_sys_ctl_block *scb = sc->scb; void *ptr; - int n; ptr = sc->buf_area; diff --git a/sys/arch/sun3/dev/if_ie_obio.c b/sys/arch/sun3/dev/if_ie_obio.c index 76307fa0c92..e0e46ad5564 100644 --- a/sys/arch/sun3/dev/if_ie_obio.c +++ b/sys/arch/sun3/dev/if_ie_obio.c @@ -1,3 +1,4 @@ +/* $OpenBSD: if_ie_obio.c,v 1.5 1997/01/16 04:03:47 kstailey Exp $ */ /* $NetBSD: if_ie_obio.c,v 1.6 1996/11/20 18:56:51 gwr Exp $ */ /*- @@ -58,7 +59,6 @@ #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> @@ -88,7 +88,6 @@ ie_obio_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; /* Make sure there is something there... */ @@ -109,7 +108,6 @@ ie_obio_attach(parent, self, args) void *args; { struct ie_softc *sc = (void *) self; - struct cfdata *cf = self->dv_cfdata; struct confargs *ca = args; sc->hard_type = IE_OBIO; diff --git a/sys/arch/sun3/dev/if_ie_vmes.c b/sys/arch/sun3/dev/if_ie_vmes.c index 02dcc88e697..aeb0ba84862 100644 --- a/sys/arch/sun3/dev/if_ie_vmes.c +++ b/sys/arch/sun3/dev/if_ie_vmes.c @@ -1,3 +1,4 @@ +/* $OpenBSD: if_ie_vmes.c,v 1.5 1997/01/16 04:03:48 kstailey Exp $ */ /* $NetBSD: if_ie_vmes.c,v 1.5 1996/11/20 18:56:51 gwr Exp $ */ /*- @@ -58,7 +59,6 @@ #include <machine/autoconf.h> #include <machine/cpu.h> #include <machine/dvma.h> -#include <machine/isr.h> #include <machine/idprom.h> #include <machine/vmparam.h> @@ -74,7 +74,8 @@ static void ie_vmerun __P((struct ie_softc *)); * zero/copy functions: OBIO can use the normal functions, but VME * must do only byte or half-word (16 bit) accesses... */ -static void wcopy(), wzero(); +static void wcopy __P((const void *, void *, u_int)); +static void wzero __P((void *, u_int)); /* * New-style autoconfig attachment @@ -94,7 +95,7 @@ ie_vmes_match(parent, vcf, args) void *vcf, *args; { struct confargs *ca = args; - int x, sz; + int x; #ifdef DIAGNOSTIC if (ca->ca_bustype != BUS_VME16) { @@ -205,7 +206,7 @@ ie_vmes_attach(parent, self, args) /* * MULTIBUS/VME support */ -void +void ie_vmereset(sc) struct ie_softc *sc; { @@ -215,7 +216,7 @@ ie_vmereset(sc) iev->status = 0; } -void +void ie_vmeattend(sc) struct ie_softc *sc; { @@ -225,7 +226,7 @@ ie_vmeattend(sc) iev->status &= ~IEVME_ATTEN; /* down. */ } -void +void ie_vmerun(sc) struct ie_softc *sc; { diff --git a/sys/arch/sun3/dev/if_ievar.h b/sys/arch/sun3/dev/if_ievar.h index a68c5142d00..259673c60eb 100644 --- a/sys/arch/sun3/dev/if_ievar.h +++ b/sys/arch/sun3/dev/if_ievar.h @@ -1,10 +1,11 @@ +/* $OpenBSD: if_ievar.h,v 1.4 1997/01/16 04:03:48 kstailey 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. */ -#define B_PER_F 3 /* number of buffers to allocate per frame */ +#define B_PER_F 3 /* number of buffers to allocate per frame */ #define MXFRAMES 256 /* max number of frames to allow for receive */ #define MXRXBUF (MXFRAMES*B_PER_F) /* max number of buffers to allocate */ #define IE_RBUF_SIZE 256 /* size of each buffer, MUST BE POWER OF TWO */ @@ -29,9 +30,9 @@ enum ie_hardware { * * the chip uses two types of pointers: 16 bit and 24 bit * 16 bit pointers are offsets from sc_maddr/ie_base - * KVA(16 bit offset) = offset + sc_maddr + * KVA(16 bit offset) = offset + sc_maddr * 24 bit pointers are offset from sc_iobase in KVA - * KVA(24 bit address) = address + sc_iobase + * KVA(24 bit address) = address + sc_iobase * * on the vme/multibus we have the page map to control where ram appears * in the address space. we choose to have RAM start at 0 in the @@ -43,13 +44,13 @@ enum ie_hardware { * For example: * if the register is @ 0xffe88000, then the top 12 bits are 0xffe00000. * to get the 4 bits from the the status word just do status & IEVME_HADDR. - * suppose the value is "4". Then just shift it left 16 bits to get - * it into bits 17-20 (e.g. 0x40000). Then or it to get the + * suppose the value is "4". Then just shift it left 16 bits to get + * it into bits 17-20 (e.g. 0x40000). Then or it to get the * address of RAM (in our example: 0xffe40000). see the attach routine! * * In the onboard ie interface, the 24 bit address space is hardwired * to be 0xff000000 -> 0xffffffff of KVA. this means that sc_iobase - * will be 0xff000000. sc_maddr will be where ever we allocate RAM + * will be 0xff000000. sc_maddr will be where ever we allocate RAM * in KVA. note that since the SCP is at a fixed address it means * that we have to use some memory at a fixed KVA for the SCP. * The Sun PROM leaves a page for us at the end of KVA space. @@ -58,23 +59,23 @@ struct ie_softc { struct device sc_dev; /* device structure */ struct arpcom sc_arpcom;/* system arpcom structure */ -#define sc_if sc_arpcom.ac_if /* network-visible interface */ +#define sc_if sc_arpcom.ac_if /* network-visible interface */ #define sc_addr sc_arpcom.ac_enaddr /* hardware Ethernet address */ caddr_t sc_iobase; /* KVA of base of 24bit addr space */ caddr_t sc_maddr; /* KVA of base of chip's RAM */ - u_int sc_msize; /* how much RAM we have/use */ + u_int sc_msize; /* how much RAM we have/use */ caddr_t sc_reg; /* KVA of card's register */ - enum ie_hardware hard_type; /* card type */ - 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)); + enum ie_hardware hard_type; /* card type */ + void (*reset_586) __P((struct ie_softc *)); /* three card */ + void (*chan_attn) __P((struct ie_softc *)); /* dependant */ + void (*run_586) __P((struct ie_softc *)); /* functions */ + void (*sc_bcopy) __P((const void *, void *, u_int)); + void (*sc_bzero) __P((void *, u_int)); - int want_mcsetup; /* flag for multicast setup */ - int promisc; /* are we in promisc mode? */ + int want_mcsetup; /* flag for multicast setup */ + int promisc; /* are we in promisc mode? */ /* * pointers to the 3 major control structures @@ -88,7 +89,7 @@ struct ie_softc { * are to be allocated from */ caddr_t buf_area; - int buf_area_sz; + int buf_area_sz; /* * the actual buffers (recv and xmit) @@ -96,7 +97,7 @@ struct ie_softc { volatile struct ie_recv_frame_desc *rframes[MXFRAMES]; volatile struct ie_recv_buf_desc *rbuffs[MXRXBUF]; volatile char *cbuffs[MXRXBUF]; - int rfhead, rftail, rbhead, rbtail; + int rfhead, rftail, rbhead, rbtail; volatile struct ie_xmit_cmd *xmit_cmds[NTXBUF]; volatile struct ie_xmit_buf *xmit_buffs[NTXBUF]; @@ -106,16 +107,16 @@ struct ie_softc { int xchead, xctail; struct ie_en_addr mcast_addrs[MAXMCAST + 1]; - int mcast_count; + int mcast_count; - int nframes; /* number of frames in use */ - int nrxbuf; /* number of recv buffs in use */ + int nframes; /* number of frames in use */ + int nrxbuf; /* number of recv buffs in use */ #ifdef IEDEBUG - int sc_debug; + int sc_debug; #endif }; -extern void ie_attach __P((struct ie_softc *)); +extern void ie_attach __P((struct ie_softc *)); extern int ie_intr __P((void *)); diff --git a/sys/arch/sun3/dev/if_le.c b/sys/arch/sun3/dev/if_le.c index c4ae12b0394..f44e1b37896 100644 --- a/sys/arch/sun3/dev/if_le.c +++ b/sys/arch/sun3/dev/if_le.c @@ -1,3 +1,4 @@ +/* $OpenBSD: if_le.c,v 1.9 1997/01/16 04:03:49 kstailey Exp $ */ /* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */ /*- @@ -55,7 +56,6 @@ #include <machine/autoconf.h> #include <machine/cpu.h> #include <machine/dvma.h> -#include <machine/isr.h> #include <machine/obio.h> #include <machine/idprom.h> @@ -89,7 +89,7 @@ struct cfattach le_ca = { }; hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t)); -hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t)); +hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t)); hide void lewrcsr(sc, port, val) @@ -113,14 +113,13 @@ lerdcsr(sc, port) ler1->ler1_rap = port; val = ler1->ler1_rdp; return (val); -} +} int le_match(parent, vcf, aux) struct device *parent; void *vcf, *aux; { - struct cfdata *cf = vcf; struct confargs *ca = aux; /* Make sure there is something there... */ @@ -141,7 +140,6 @@ le_attach(parent, self, aux) { struct le_softc *lesc = (struct le_softc *)self; struct am7990_softc *sc = &lesc->sc_am7990; - struct cfdata *cf = self->dv_cfdata; struct confargs *ca = aux; lesc->sc_r1 = (struct lereg1 *) diff --git a/sys/arch/sun3/dev/kd.c b/sys/arch/sun3/dev/kd.c index dee1cb64a30..dfcf5ea36f8 100644 --- a/sys/arch/sun3/dev/kd.c +++ b/sys/arch/sun3/dev/kd.c @@ -1,3 +1,4 @@ +/* $OpenBSD: kd.c,v 1.7 1997/01/16 04:03:49 kstailey Exp $ */ /* $NetBSD: kd.c,v 1.21 1996/11/20 18:56:55 gwr Exp $ */ /*- @@ -55,12 +56,16 @@ #include <sys/device.h> #include <machine/autoconf.h> +#include <machine/conf.h> +#include <machine/machdep.h> #include <machine/mon.h> #include <machine/psl.h> #include <dev/cons.h> #include <dev/sun/kbd_xlate.h> +#include "zs_cons.h" + #define KDMAJOR 1 #define PUT_WSIZE 64 @@ -81,7 +86,7 @@ static void kdstart(struct tty *); int kd_is_console; /* - * This is called by kbd_attach() + * This is called by kbd_attach() * XXX - Make this a proper child of kbd? */ void @@ -125,7 +130,7 @@ kdopen(dev, flag, mode, p) struct kd_softc *kd; int error, s, unit; struct tty *tp; - + unit = minor(dev); if (unit != 0) return ENXIO; @@ -259,16 +264,16 @@ kdparam(tp, t) tp->t_ispeed = t->c_ispeed; tp->t_ospeed = t->c_ospeed; tp->t_cflag = t->c_cflag; - return 0; + return (0); } -void +int kdstop(tp, flag) struct tty *tp; int flag; { - + return (0); } static void kd_later(void*); @@ -389,13 +394,12 @@ kd_input(c) ****************************************************************/ extern void *zs_conschan; -extern int zs_getc(); -extern void nullcnprobe(); -cons_decl(kd); /* The debugger gets its own key translation state. */ static struct kbd_state kdcn_state; +cons_decl(kd); + void kdcninit(cn) struct consdev *cn; @@ -462,7 +466,6 @@ kdcnputc(dev, c) (romVectorPtr->fbWriteChar)(c & 0x7f); } -extern void fb_unblank(); void kdcnpollc(dev, on) dev_t dev; int on; diff --git a/sys/arch/sun3/dev/memerr.c b/sys/arch/sun3/dev/memerr.c index 0aafc273181..37de3dbb300 100644 --- a/sys/arch/sun3/dev/memerr.c +++ b/sys/arch/sun3/dev/memerr.c @@ -1,3 +1,4 @@ +/* $OpenBSD: memerr.c,v 1.8 1997/01/16 04:03:50 kstailey Exp $ */ /* $NetBSD: memerr.c,v 1.6 1996/11/13 07:05:14 thorpej Exp $ */ /* @@ -49,6 +50,7 @@ #include <sys/device.h> #include <machine/autoconf.h> +#include <machine/control.h> #include <machine/cpu.h> #include <machine/obio.h> #include <machine/pte.h> @@ -170,7 +172,7 @@ memerr_interrupt(arg) { struct memerr_softc *sc = arg; volatile struct memerr *me = sc->sc_reg; - u_char csr, ctx, err; + u_char csr, ctx; u_int pa, va; int pte; diff --git a/sys/arch/sun3/dev/obctl.c b/sys/arch/sun3/dev/obctl.c index 391494e4ee5..b7af2ab8a1e 100644 --- a/sys/arch/sun3/dev/obctl.c +++ b/sys/arch/sun3/dev/obctl.c @@ -1,3 +1,4 @@ +/* $OpenBSD: obctl.c,v 1.4 1997/01/16 04:03:50 kstailey Exp $ */ /* $NetBSD: obctl.c,v 1.11 1996/11/20 18:56:55 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/dev/obio.c b/sys/arch/sun3/dev/obio.c index c015d61116c..a6b6bc4120b 100644 --- a/sys/arch/sun3/dev/obio.c +++ b/sys/arch/sun3/dev/obio.c @@ -1,3 +1,4 @@ +/* $OpenBSD: obio.c,v 1.6 1997/01/16 04:03:51 kstailey Exp $ */ /* $NetBSD: obio.c,v 1.23 1996/11/20 18:56:56 gwr Exp $ */ /*- @@ -41,15 +42,18 @@ #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 *)); + +static void save_prom_mappings __P((void)); +static void make_required_mappings __P((void)); struct cfattach obio_ca = { sizeof(struct device), obio_match, obio_attach @@ -190,14 +194,14 @@ caddr_t obio_find_mapping(int pa, int size) */ #define PGBITS (PG_VALID|PG_WRITE|PG_SYSTEM) -static void save_prom_mappings() +static void +save_prom_mappings() { - vm_offset_t pa; - caddr_t segva, pgva; + vm_offset_t pa, segva, pgva; int pte, sme, i; - - segva = (caddr_t)MONSTART; - while (segva < (caddr_t)MONEND) { + + segva = (vm_offset_t)MONSTART; + while (segva < (vm_offset_t)MONEND) { sme = get_segmap(segva); if (sme == SEGINV) { segva += NBSG; @@ -222,7 +226,7 @@ static void save_prom_mappings() { i = pa >> SAVE_SHIFT; if (prom_mappings[i] == NULL) { - prom_mappings[i] = pgva; + prom_mappings[i] = (caddr_t)pgva; #ifdef DEBUG mon_printf("obio: found pa=0x%x\n", pa); #endif @@ -257,11 +261,11 @@ static vm_offset_t required_mappings[] = { (vm_offset_t)-1, /* end marker */ }; -static void make_required_mappings() +static void +make_required_mappings() { - vm_offset_t pa, *rmp; - int idx; - + vm_offset_t *rmp; + rmp = required_mappings; while (*rmp != (vm_offset_t)-1) { if (!obio_find_mapping(*rmp, NBPG)) { @@ -284,13 +288,15 @@ static void make_required_mappings() * accessible before the mainline OBIO autoconfiguration as part of * configure(). */ -void obio_init() +void +obio_init() { save_prom_mappings(); make_required_mappings(); } -caddr_t obio_alloc(obio_addr, obio_size) +caddr_t +obio_alloc(obio_addr, obio_size) int obio_addr, obio_size; { caddr_t cp; diff --git a/sys/arch/sun3/dev/obmem.c b/sys/arch/sun3/dev/obmem.c index c5a0632bce0..72b3bb15870 100644 --- a/sys/arch/sun3/dev/obmem.c +++ b/sys/arch/sun3/dev/obmem.c @@ -1,3 +1,4 @@ +/* $OpenBSD: obmem.c,v 1.6 1997/01/16 04:03:51 kstailey Exp $ */ /* $NetBSD: obmem.c,v 1.11 1996/11/20 18:56:57 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/dev/rd_root.c b/sys/arch/sun3/dev/rd_root.c index bb0c0560ae0..355be413d2d 100644 --- a/sys/arch/sun3/dev/rd_root.c +++ b/sys/arch/sun3/dev/rd_root.c @@ -1,3 +1,4 @@ +/* $OpenBSD: rd_root.c,v 1.6 1997/01/16 04:03:52 kstailey Exp $ */ /* $NetBSD: rd_root.c,v 1.7 1996/11/20 18:56:58 gwr Exp $ */ /*- @@ -37,6 +38,7 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/reboot.h> #include <dev/ramdisk.h> diff --git a/sys/arch/sun3/dev/si.c b/sys/arch/sun3/dev/si.c index 3047596157e..ba23aa879e5 100644 --- a/sys/arch/sun3/dev/si.c +++ b/sys/arch/sun3/dev/si.c @@ -1,3 +1,4 @@ +/* $OpenBSD: si.c,v 1.7 1997/01/16 04:03:52 kstailey Exp $ */ /* $NetBSD: si.c,v 1.31 1996/11/20 18:56:59 gwr Exp $ */ /*- @@ -91,7 +92,6 @@ #include <scsi/scsiconf.h> #include <machine/autoconf.h> -#include <machine/isr.h> #include <machine/obio.h> #include <machine/dvma.h> @@ -135,6 +135,9 @@ static struct scsi_device si_dev = { NULL, /* Use default "done" routine. */ }; + +static int siprint __P((void *, const char *)); + /* * New-style autoconfig attachment. The cfattach * structures are in si_obio.c and si_vme.c @@ -172,7 +175,9 @@ 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; @@ -180,7 +185,7 @@ si_attach(sc) #ifdef DEBUG if (si_debug) - printf("si: Set TheSoftC=%x TheRegs=%x\n", sc, regs); + printf("si: Set TheSoftC=%p TheRegs=%p\n", sc, regs); ncr_sc->sc_link.flags |= si_link_flags; #endif @@ -213,7 +218,7 @@ si_attach(sc) si_reset_adapter(ncr_sc); ncr5380_init(ncr_sc); ncr5380_reset_scsibus(ncr_sc); - config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), scsiprint); + config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), siprint); } static void @@ -222,7 +227,7 @@ si_minphys(struct buf *bp) if (bp->b_bcount > MAX_DMA_LEN) { #ifdef DEBUG if (si_debug) { - printf("si_minphys len = 0x%x.\n", bp->b_bcount); + printf("si_minphys len = 0x%lx.\n", bp->b_bcount); Debugger(); } #endif @@ -402,7 +407,7 @@ found: dh->dh_dvma = (u_long) dvma_mapin((char *)addr, xlen); if (!dh->dh_dvma) { /* Can't remap segment */ - printf("si_dma_alloc: can't remap %x/%x\n", + printf("si_dma_alloc: can't remap %p/%x\n", dh->dh_addr, dh->dh_maplen); dh->dh_flags = 0; return; @@ -457,7 +462,6 @@ si_dma_poll(ncr_sc) { struct si_softc *sc = (struct si_softc *)ncr_sc; struct sci_req *sr = ncr_sc->sc_current; - struct si_dma_handle *dh = sr->sr_dma_hand; volatile struct si_regs *si = sc->sc_regs; int tmo; @@ -494,3 +498,13 @@ si_dma_poll(ncr_sc) #endif } +static int +siprint(aux, name) + void *aux; + const char *name; +{ + + if (name != NULL) + printf("%s: scsibus ", name); + return UNCONF; +} diff --git a/sys/arch/sun3/dev/si_obio.c b/sys/arch/sun3/dev/si_obio.c index 793c0a3b26c..4d129ea41a2 100644 --- a/sys/arch/sun3/dev/si_obio.c +++ b/sys/arch/sun3/dev/si_obio.c @@ -1,3 +1,4 @@ +/* $OpenBSD: si_obio.c,v 1.6 1997/01/16 04:03:53 kstailey Exp $ */ /* $NetBSD: si_obio.c,v 1.7 1996/11/20 18:57:00 gwr Exp $ */ /*- @@ -95,7 +96,6 @@ #include <scsi/scsiconf.h> #include <machine/autoconf.h> -#include <machine/isr.h> #include <machine/obio.h> #include <machine/dvma.h> @@ -118,6 +118,10 @@ void si_obio_dma_start __P((struct ncr5380_softc *)); void si_obio_dma_eop __P((struct ncr5380_softc *)); void si_obio_dma_stop __P((struct ncr5380_softc *)); +static __inline__ int si_obio_udc_read __P((volatile struct si_regs *, int)); +static __inline__ void si_obio_udc_write __P((volatile struct si_regs *, + int, int)); + /* * New-style autoconfig attachment */ @@ -139,7 +143,6 @@ si_obio_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; /* Make sure there is something there... */ @@ -258,7 +261,7 @@ si_obio_dma_setup(ncr_sc) #ifdef DEBUG if (si_debug & 2) { - printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n", + printf("si_dma_setup: dh=%p, pa=0x%lx, xlen=%d\n", dh, data_pa, xlen); } #endif @@ -348,7 +351,7 @@ si_obio_dma_start(ncr_sc) #ifdef DEBUG if (si_debug & 2) { - printf("si_dma_start: sr=0x%x\n", sr); + printf("si_dma_start: sr=%p\n", sr); } #endif diff --git a/sys/arch/sun3/dev/si_vme.c b/sys/arch/sun3/dev/si_vme.c index 3b94011b255..4505e66c825 100644 --- a/sys/arch/sun3/dev/si_vme.c +++ b/sys/arch/sun3/dev/si_vme.c @@ -1,3 +1,4 @@ +/* $OpenBSD: si_vme.c,v 1.6 1997/01/16 04:03:54 kstailey Exp $ */ /* $NetBSD: si_vme.c,v 1.7 1996/11/20 18:57:01 gwr Exp $ */ /*- @@ -95,7 +96,6 @@ #include <scsi/scsiconf.h> #include <machine/autoconf.h> -#include <machine/isr.h> #include <machine/obio.h> #include <machine/dvma.h> @@ -135,7 +135,6 @@ si_vmes_match(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; int probe_addr; @@ -247,7 +246,7 @@ si_vme_intr_on(ncr_sc) /* Clear the count so nothing happens. */ si->dma_counth = 0; si->dma_countl = 0; - + /* Clear the start address too. (paranoid?) */ si->dma_addrh = 0; si->dma_addrl = 0; @@ -306,7 +305,7 @@ si_vme_dma_setup(ncr_sc) #ifdef DEBUG if (si_debug & 2) { - printf("si_dma_setup: dh=0x%x, pa=0x%x, xlen=%d\n", + printf("si_dma_setup: dh=%p, pa=0x%lx, xlen=%d\n", dh, data_pa, xlen); } #endif @@ -341,7 +340,7 @@ si_vme_dma_setup(ncr_sc) #if 0 /* Clear FIFO counter. (also hits dma_count) */ si->fifo_cnt_hi = 0; - si->fifo_count = 0; + si->fifo_count = 0; #endif } @@ -354,7 +353,6 @@ si_vme_dma_start(ncr_sc) struct sci_req *sr = ncr_sc->sc_current; struct si_dma_handle *dh = sr->sr_dma_hand; volatile struct si_regs *si = sc->sc_regs; - long data_pa; int s, xlen; xlen = sc->sc_reqlen; diff --git a/sys/arch/sun3/dev/sireg.h b/sys/arch/sun3/dev/sireg.h index 2cf847f69c2..031018874ca 100644 --- a/sys/arch/sun3/dev/sireg.h +++ b/sys/arch/sun3/dev/sireg.h @@ -1,3 +1,4 @@ +/* $OpenBSD: sireg.h,v 1.2 1997/01/16 04:03:54 kstailey Exp $ */ /* $NetBSD: sireg.h,v 1.1 1996/03/26 15:01:14 gwr Exp $ */ /* @@ -12,12 +13,12 @@ /* * Some of these registers apply to only one interface and some - * apply to both. The registers which apply to the Sun3/50 onboard + * apply to both. The registers which apply to the Sun3/50 onboard * version only are udc_rdata and udc_raddr. The registers which * apply to the Sun3 vme version only are dma_addr, dma_count, bpr, - * iv_am, and bcrh. Thus, the sbc registers, fifo_data, bcr, and csr + * iv_am, and bcrh. Thus, the sbc registers, fifo_data, bcr, and csr * apply to both interfaces. - * One other feature of the vme interface: a write to the dma count + * One other feature of the vme interface: a write to the dma count * register also causes a write to the fifo byte count register and * vis versa. */ @@ -53,13 +54,13 @@ struct si_regs { u_short fifo_data; /* fifo data register */ /* holds extra byte on odd */ /* byte dma read */ - u_short fifo_count; /* fifo byte count */ + u_short fifo_count; /* fifo byte count */ u_short si_csr; /* control/status register */ /* The rest of these are on the VME interface only: */ - u_short si_bprh; /* byte pack, high (VME only) */ - u_short si_bprl; /* byte pack, low (VME only) */ - u_short si_iv_am; /* bits 0-7: intr vector */ + u_short si_bprh; /* byte pack, high (VME only) */ + u_short si_bprl; /* byte pack, low (VME only) */ + u_short si_iv_am; /* bits 0-7: intr vector */ /* bits 8-13: addr modifier (VME only) */ /* bits 14-15: unused */ u_short fifo_cnt_hi; /* high part of fifo_count (VME only) */ diff --git a/sys/arch/sun3/dev/vme.c b/sys/arch/sun3/dev/vme.c index 3d75519d20c..b188762dc39 100644 --- a/sys/arch/sun3/dev/vme.c +++ b/sys/arch/sun3/dev/vme.c @@ -1,3 +1,4 @@ +/* $OpenBSD: vme.c,v 1.4 1997/01/16 04:03:55 kstailey Exp $ */ /* $NetBSD: vme.c,v 1.6 1996/11/20 18:57:02 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index 103e714239f..a581866f049 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -1,3 +1,4 @@ +/* $OpenBSD: xd.c,v 1.10 1997/01/16 04:03:55 kstailey Exp $ */ /* $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $ */ /* @@ -214,11 +215,11 @@ inline void xdc_rqinit __P((struct xd_iorq *, struct xdc_softc *, struct xd_softc *, int, u_long, int, caddr_t, struct buf *)); void xdc_rqtopb __P((struct xd_iorq *, struct xd_iopb *, int, int)); -int xdc_start __P((struct xdc_softc *, int)); +void xdc_start __P((struct xdc_softc *, int)); int xdc_startbuf __P((struct xdc_softc *, struct xd_softc *, struct buf *)); int xdc_submit_iorq __P((struct xdc_softc *, int, int)); void xdc_tick __P((void *)); -int xdc_xdreset __P((struct xdc_softc *, struct xd_softc *)); +void xdc_xdreset __P((struct xdc_softc *, struct xd_softc *)); /* machine interrupt hook */ int xdcintr __P((void *)); @@ -354,7 +355,6 @@ int xdcmatch(parent, match, aux) struct device *parent; void *match, *aux; { - struct cfdata *cf = match; struct confargs *ca = aux; int x; @@ -384,7 +384,7 @@ xdcattach(parent, self, aux) struct xdc_softc *xdc = (void *) self; struct confargs *ca = aux; struct xdc_attach_args xa; - int lcv, rqno, err, pri; + int lcv, rqno, err; struct xd_iopb_ctrl *ctl; /* get addressing and intr level stuff from autoconfig and load it @@ -503,7 +503,6 @@ xdmatch(parent, match, aux) void *match, *aux; { - struct xdc_softc *xdc = (void *) parent; struct cfdata *cf = match; struct xdc_attach_args *xa = aux; @@ -529,10 +528,9 @@ xdattach(parent, self, aux) struct xd_softc *xd = (void *) self; struct xdc_softc *xdc = (void *) parent; struct xdc_attach_args *xa = aux; - int rqno, err, spt, mb, blk, lcv, fmode, s, newstate; + int rqno, err, spt = 0, mb, blk, lcv, fmode, s = -1, newstate; struct xd_iopb_drive *driopb; struct dkbad *dkb; - struct bootpath *bp; /* * Always re-initialize the disk structure. We want statistics @@ -964,7 +962,7 @@ xdsize(dev) { struct xd_softc *xdsc; - int unit, part, size; + int part, size; /* valid unit? try an open */ @@ -1103,8 +1101,6 @@ xdcintr(v) { struct xdc_softc *xdcsc = v; - struct xd_softc *xd; - struct buf *bp; /* kick the event counter */ @@ -1286,7 +1282,6 @@ xdc_cmd(xdcsc, cmd, subfn, unit, block, scnt, dptr, fullmode) { int rqno, submode = XD_STATE(fullmode), retry; - u_long dp; struct xd_iorq *iorq; struct xd_iopb *iopb; @@ -1355,7 +1350,7 @@ xdc_startbuf(xdcsc, xdsc, bp) struct xd_iorq *iorq; struct xd_iopb *iopb; struct buf *wq; - u_long block, dp; + u_long block; caddr_t dbuf; if (!xdcsc->nfree) @@ -1631,7 +1626,7 @@ xdc_piodriver(xdcsc, iorqno, freeone) * xdc_reset: reset one drive. NOTE: assumes xdc was just reset. * we steal iopb[0] for this, but we put it back when we are done. */ -int +void xdc_xdreset(xdcsc, xdsc) struct xdc_softc *xdcsc; struct xd_softc *xdsc; @@ -1640,6 +1635,7 @@ xdc_xdreset(xdcsc, xdsc) struct xd_iopb tmpiopb; u_long addr; int del; + bcopy(xdcsc->iopbase, &tmpiopb, sizeof(tmpiopb)); bzero(xdcsc->iopbase, sizeof(tmpiopb)); xdcsc->iopbase->comm = XDCMD_RST; @@ -1672,7 +1668,7 @@ xdc_reset(xdcsc, quiet, blastmode, error, xdsc) struct xd_softc *xdsc; { - int del = 0, lcv, poll = -1, retval = XD_ERR_AOK; + int del = 0, lcv, retval = XD_ERR_AOK; int oldfree = xdcsc->nfree; struct xd_iorq *iorq; @@ -1761,13 +1757,14 @@ xdc_reset(xdcsc, quiet, blastmode, error, xdsc) * xdc_start: start all waiting buffers */ -int +void xdc_start(xdcsc, maxio) struct xdc_softc *xdcsc; int maxio; { int rqno; + while (maxio && xdcsc->nwait && (xdcsc->xdc->xdc_csr & XDC_ADDING) == 0) { XDC_GET_WAITER(xdcsc, rqno); /* note: rqno is an "out" @@ -1777,6 +1774,7 @@ xdc_start(xdcsc, maxio) maxio--; } } + /* * xdc_remove_iorq: remove "done" IOPB's. */ @@ -1788,7 +1786,6 @@ xdc_remove_iorq(xdcsc) { int errno, rqno, comm, errs; struct xdc *xdc = xdcsc->xdc; - u_long addr; struct xd_iopb *iopb; struct xd_iorq *iorq; struct buf *bp; @@ -2063,7 +2060,7 @@ xdc_tick(arg) struct xdc_softc *xdcsc = arg; int lcv, s, reset = 0; #ifdef XDC_DIAG - int wait, run, free, done, whd; + int wait, run, free, done, whd = 0; u_char fqc[XDC_MAXIOPB], wqc[XDC_MAXIOPB], mark[XDC_MAXIOPB]; s = splbio(); wait = xdcsc->nwait; @@ -2093,7 +2090,7 @@ xdc_tick(arg) printf("\n"); for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) { if (mark[lcv] == 0) - printf("MARK: running %d: mode %d done %d errs %d errno 0x%x ttl %d buf %x\n", + printf("MARK: running %d: mode %d done %d errs %d errno 0x%x ttl %d buf %p\n", lcv, xdcsc->reqs[lcv].mode, xdcsc->iopbase[lcv].done, xdcsc->iopbase[lcv].errs, @@ -2241,7 +2238,7 @@ xdc_ioctlcmd(xd, dev, xio) if (xio->dlen) { dvmabuf = dvma_malloc(xio->dlen); if (xio->cmd == XDCMD_WR || xio->cmd == XDCMD_XWR) { - if (err = copyin(xio->dptr, dvmabuf, xio->dlen)) { + if ((err = copyin(xio->dptr, dvmabuf, xio->dlen))) { dvma_free(dvmabuf, xio->dlen); return (err); } diff --git a/sys/arch/sun3/dev/xdreg.h b/sys/arch/sun3/dev/xdreg.h index 6272098ae02..514a85b6d5b 100644 --- a/sys/arch/sun3/dev/xdreg.h +++ b/sys/arch/sun3/dev/xdreg.h @@ -1,3 +1,4 @@ +/* $OpenBSD: xdreg.h,v 1.3 1997/01/16 04:03:56 kstailey Exp $ */ /* $NetBSD: xdreg.h,v 1.2 1996/02/22 06:55:32 thorpej Exp $ */ /* @@ -203,9 +204,9 @@ struct xd_iopb { /* * some commands overload bytes 6 to 0x13 of the iopb with different meanings. - * these commands include: + * these commands include: * section 4.2: controller parameters - * section 4.3: drive parameters + * section 4.3: drive parameters * sectino 4.4: format parameters * * note that the commands that overload the iopb are not part of the @@ -287,7 +288,7 @@ struct xd_iopb_ctrl { #define XDC_DELAY_SPARC 0 /* - * drive parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, e + * drive parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, e */ struct xd_iopb_drive { @@ -311,7 +312,7 @@ struct xd_iopb_drive { }; /* - * format parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, 0x10, 0x11 + * format parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, 0x10, 0x11 */ struct xd_iopb_format { diff --git a/sys/arch/sun3/dev/xdvar.h b/sys/arch/sun3/dev/xdvar.h index 35509803a97..64f2e569d8f 100644 --- a/sys/arch/sun3/dev/xdvar.h +++ b/sys/arch/sun3/dev/xdvar.h @@ -1,3 +1,4 @@ +/* $OpenBSD: xdvar.h,v 1.4 1997/01/16 04:03:57 kstailey Exp $ */ /* $NetBSD: xdvar.h,v 1.3 1996/02/22 06:55:33 thorpej Exp $ */ /* @@ -32,9 +33,9 @@ */ /* - * x d v a r . h + * x d v a r . h * - * this file defines the software structure we use to control the + * this file defines the software structure we use to control the * 753/7053. * * author: Chuck Cranor <chuck@ccrc.wustl.edu> @@ -67,7 +68,7 @@ struct xd_iorq { #define XD_SUB_MASK 0xf0 /* mask bits for state */ #define XD_SUB_FREE 0x00 /* free */ #define XD_SUB_NORM 0x10 /* normal I/O request */ -#define XD_SUB_WAIT 0x20 /* normal I/O request in the +#define XD_SUB_WAIT 0x20 /* normal I/O request in the context of a process */ #define XD_SUB_POLL 0x30 /* polled mode */ #define XD_SUB_DONE 0x40 /* not active, but can't be free'd yet */ @@ -151,12 +152,12 @@ struct xdc_softc { struct buf sc_wq; /* queue'd IOPBs for this controller */ char freereq[XDC_MAXIOPB]; /* free list (stack) */ char waitq[XDC_MAXIOPB]; /* wait queue */ - char nfree; /* number of iopbs free */ + int nfree; /* number of iopbs free */ char nrun; /* number running */ char nwait; /* number of waiting iopbs */ char ndone; /* number of done IORQs */ - char waithead; /* head of queue */ - char waitend; /* end of queue */ + int waithead; /* head of queue */ + int waitend; /* end of queue */ }; /* diff --git a/sys/arch/sun3/dev/xio.h b/sys/arch/sun3/dev/xio.h index d1f03a25e52..df79a32a464 100644 --- a/sys/arch/sun3/dev/xio.h +++ b/sys/arch/sun3/dev/xio.h @@ -1,3 +1,4 @@ +/* $OpenBSD: xio.h,v 1.2 1997/01/16 04:03:57 kstailey Exp $ */ /* $NetBSD: xio.h,v 1.1 1995/10/30 20:58:20 gwr Exp $ */ /* @@ -32,9 +33,9 @@ */ /* - * x i o . h + * x i o . h * - * this file defines the software structure we use to ioctl the + * this file defines the software structure we use to ioctl the * 753/7053. this interface isn't set in stone and may (or may not) * need adjustment. * @@ -46,14 +47,14 @@ */ struct xd_iocmd { - u_char cmd; /* in: command number */ - u_char subfn; /* in: subfunction number */ - u_char errno; /* out: error number */ - u_char tries; /* out: number of tries */ - u_short sectcnt; /* in,out: sector count (hw_spt on read drive param) */ - u_short dlen; /* in: length of data buffer (good sanity check) */ - u_long block; /* in: block number */ - caddr_t dptr; /* in: data buffer to do I/O from */ + u_char cmd; /* in: command number */ + u_char subfn; /* in: subfunction number */ + u_char errno; /* out: error number */ + u_char tries; /* out: number of tries */ + u_short sectcnt; /* in,out: sector count (hw_spt on read drive param) */ + u_short dlen; /* in: length of data buffer (good sanity check) */ + u_long block; /* in: block number */ + caddr_t dptr; /* in: data buffer to do I/O from */ }; #ifndef DIOSXDCMD diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c index d0e62df1219..a7df9924e20 100644 --- a/sys/arch/sun3/dev/xy.c +++ b/sys/arch/sun3/dev/xy.c @@ -1,3 +1,4 @@ +/* $OpenBSD: xy.c,v 1.9 1997/01/16 04:03:58 kstailey Exp $ */ /* $NetBSD: xy.c,v 1.11 1996/10/13 03:47:40 christos Exp $ */ /* @@ -112,7 +113,7 @@ (SC)->ciorq->mode = XY_SUB_FREE; \ wakeup((SC)->ciorq); \ } \ - } +} /* * XYC_ADVANCE: advance iorq's pointers by a number of sectors @@ -155,12 +156,12 @@ inline void xyc_rqinit __P((struct xy_iorq *, struct xyc_softc *, struct xy_softc *, int, u_long, int, caddr_t, struct buf *)); void xyc_rqtopb __P((struct xy_iorq *, struct xy_iopb *, int, int)); -int xyc_start __P((struct xyc_softc *, struct xy_iorq *)); +void xyc_start __P((struct xyc_softc *, struct xy_iorq *)); int xyc_startbuf __P((struct xyc_softc *, struct xy_softc *, struct buf *)); int xyc_submit_iorq __P((struct xyc_softc *, struct xy_iorq *, int)); void xyc_tick __P((void *)); int xyc_unbusy __P((struct xyc *, int)); -int xyc_xyreset __P((struct xyc_softc *, struct xy_softc *)); +void xyc_xyreset __P((struct xyc_softc *, struct xy_softc *)); /* machine interrupt hook */ int xycintr __P((void *)); @@ -296,7 +297,6 @@ int xycmatch(parent, match, aux) struct device *parent; void *match, *aux; { - struct cfdata *cf = match; struct confargs *ca = aux; int x; @@ -326,7 +326,7 @@ xycattach(parent, self, aux) struct xyc_softc *xyc = (void *) self; struct confargs *ca = aux; struct xyc_attach_args xa; - int lcv, err, pri, res, pbsz; + int lcv, err, res, pbsz; void *tmp, *tmp2; u_long ultmp; @@ -450,7 +450,6 @@ xymatch(parent, match, aux) void *match, *aux; { - struct xyc_softc *xyc = (void *) parent; struct cfdata *cf = match; struct xyc_attach_args *xa = aux; @@ -476,9 +475,8 @@ xyattach(parent, self, aux) struct xy_softc *xy = (void *) self, *oxy; struct xyc_softc *xyc = (void *) parent; struct xyc_attach_args *xa = aux; - int res, err, spt, mb, blk, lcv, fmode, s, newstate; + int err, spt, mb, blk, lcv, fmode, s = -1, newstate; struct dkbad *dkb; - struct bootpath *bp; /* * Always re-initialize the disk structure. We want statistics @@ -670,6 +668,8 @@ done: xy->state = newstate; if (!xa->booting) { wakeup(&xy->state); + if (s == -1) + panic("xy: spl/splx mismatch"); splx(s); } } @@ -926,7 +926,7 @@ xysize(dev) { struct xy_softc *xysc; - int unit, part, size; + int part, size; /* valid unit? try an open */ @@ -956,8 +956,6 @@ xystrategy(bp) { struct xy_softc *xy; - struct xyc_softc *parent; - struct buf *wq; int s, unit; struct xyc_attach_args xa; @@ -1044,8 +1042,6 @@ xycintr(v) { struct xyc_softc *xycsc = v; - struct xy_softc *xy; - struct buf *bp; /* kick the event counter */ @@ -1177,8 +1173,7 @@ xyc_cmd(xycsc, cmd, subfn, unit, block, scnt, dptr, fullmode) int fullmode; { - int submode = XY_STATE(fullmode), retry; - u_long dp; + int submode = XY_STATE(fullmode); struct xy_iorq *iorq = xycsc->ciorq; struct xy_iopb *iopb = xycsc->ciopb; @@ -1227,10 +1222,10 @@ xyc_startbuf(xycsc, xysc, bp) struct buf *bp; { + u_long block; int partno; struct xy_iorq *iorq; struct xy_iopb *iopb; - u_long block, dp; caddr_t dbuf; iorq = xysc->xyrq; @@ -1484,7 +1479,6 @@ xyc_piodriver(xycsc, iorq) int nreset = 0; int retval = 0; u_long res; - struct xyc *xyc = xycsc->xyc; #ifdef XYC_DEBUG printf("xyc_piodriver(%s, 0x%x)\n", xycsc->sc_dev.dv_xname, iorq); #endif @@ -1537,7 +1531,7 @@ xyc_piodriver(xycsc, iorq) * xyc_xyreset: reset one drive. NOTE: assumes xyc was just reset. * we steal iopb[XYC_CTLIOPB] for this, but we put it back when we are done. */ -int +void xyc_xyreset(xycsc, xysc) struct xyc_softc *xycsc; struct xy_softc *xysc; @@ -1587,7 +1581,7 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc) struct xy_softc *xysc; { - int del = 0, lcv, poll = -1, retval = XY_ERR_AOK; + int del = 0, lcv, retval = XY_ERR_AOK; struct xy_iorq *iorq; /* soft reset hardware */ @@ -1663,7 +1657,7 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc) * xyc_start: start waiting buffers */ -int +void xyc_start(xycsc, iorq) struct xyc_softc *xycsc; struct xy_iorq *iorq; @@ -1980,7 +1974,7 @@ xyc_ioctlcmd(xy, dev, xio) struct xd_iocmd *xio; { - int s, err, rqno, dummy; + int s, err, rqno, dummy = 0; caddr_t dvmabuf = NULL; struct xyc_softc *xycsc; @@ -2015,7 +2009,7 @@ xyc_ioctlcmd(xy, dev, xio) if (xio->dlen) { dvmabuf = dvma_malloc(xio->dlen); if (xio->cmd == XYCMD_WR) { - if (err = copyin(xio->dptr, dvmabuf, xio->dlen)) { + if ((err = copyin(xio->dptr, dvmabuf, xio->dlen))) { dvma_free(dvmabuf, xio->dlen); return (err); } diff --git a/sys/arch/sun3/dev/xyreg.h b/sys/arch/sun3/dev/xyreg.h index b6591e51a37..0b8145ddd13 100644 --- a/sys/arch/sun3/dev/xyreg.h +++ b/sys/arch/sun3/dev/xyreg.h @@ -1,3 +1,4 @@ +/* $OpenBSD: xyreg.h,v 1.2 1997/01/16 04:03:59 kstailey Exp $ */ /* $NetBSD: xyreg.h,v 1.1 1995/10/30 20:58:22 gwr Exp $ */ /* @@ -90,9 +91,9 @@ struct xyc { * add iopb to the chain, and clear AREQ to resume I/O * * when the controller is done with a command it may interrupt (if you - * ask it to) and it will set the XYC_IPND bit in the csr. clear + * ask it to) and it will set the XYC_IPND bit in the csr. clear * the interrupt by writing one to this bit. - * + * * the format of the iopb is described in section 2.4 of the manual. * note that it is byte-swapped on the sun. */ diff --git a/sys/arch/sun3/dev/xyvar.h b/sys/arch/sun3/dev/xyvar.h index e54175d02e7..da0e1e7967d 100644 --- a/sys/arch/sun3/dev/xyvar.h +++ b/sys/arch/sun3/dev/xyvar.h @@ -1,3 +1,4 @@ +/* $OpenBSD: xyvar.h,v 1.3 1997/01/16 04:04:00 kstailey Exp $ */ /* $NetBSD: xyvar.h,v 1.2 1996/01/07 22:03:22 thorpej Exp $ */ /* @@ -32,9 +33,9 @@ */ /* - * x y v a r . h + * x y v a r . h * - * this file defines the software structure we use to control the + * this file defines the software structure we use to control the * 450/451. * * author: Chuck Cranor <chuck@ccrc.wustl.edu> @@ -67,7 +68,7 @@ struct xy_iorq { #define XY_SUB_MASK 0xf0 /* mask bits for state */ #define XY_SUB_FREE 0x00 /* free */ #define XY_SUB_NORM 0x10 /* normal I/O request */ -#define XY_SUB_WAIT 0x20 /* normal I/O request in the +#define XY_SUB_WAIT 0x20 /* normal I/O request in the context of a process */ #define XY_SUB_POLL 0x30 /* polled mode */ #define XY_SUB_DONE 0x40 /* not active, but can't be free'd yet */ diff --git a/sys/arch/sun3/dev/zs.c b/sys/arch/sun3/dev/zs.c index 33739b038ba..df440c4df75 100644 --- a/sys/arch/sun3/dev/zs.c +++ b/sys/arch/sun3/dev/zs.c @@ -1,3 +1,4 @@ +/* $OpenBSD: zs.c,v 1.7 1997/01/16 04:04:00 kstailey Exp $ */ /* $NetBSD: zs.c,v 1.42 1996/11/20 18:57:03 gwr Exp $ */ /*- @@ -71,7 +72,9 @@ #define NZS 2 /* XXX */ -/* The Sun3 provides a 4.9152 MHz clock to the ZS chips. */ +/* + * The Sun3 provides a 4.9152 MHz clock to the ZS chips. + */ #define PCLK (9600 * 512) /* PCLK pin input clock rate */ /* @@ -82,13 +85,16 @@ #define ZS_DELAY() delay(2) -/* The layout of this is hardware-dependent (padding, order). */ +/* + * The layout of this is hardware-dependent (padding, order). + */ struct zschan { volatile u_char zc_csr; /* ctrl,status, and indirect access */ u_char zc_xxx0; volatile u_char zc_data; /* data */ u_char zc_xxx1; }; + struct zsdevice { /* Yes, they are backwards. */ struct zschan zs_chan_b; @@ -98,10 +104,13 @@ struct zsdevice { /* Default OBIO addresses. */ static int zs_physaddr[NZS] = { OBIO_KEYBD_MS, OBIO_ZS }; + /* Saved PROM mappings */ static struct zsdevice *zsaddr[NZS]; /* See zs_init() */ + /* Flags from cninit() */ static int zs_hwflags[NZS][2]; + /* Default speed for each channel */ static int zs_defspeed[NZS][2] = { { 1200, /* keyboard */ @@ -111,6 +120,15 @@ static int zs_defspeed[NZS][2] = { }; +static struct zschan *zs_get_chan_addr __P((int, int)); +int zs_getc __P((volatile void *)); +static void zs_putc __P((volatile void *, int)); + +int zscngetc __P((dev_t)); +void zscnputc __P((dev_t, int)); +void nullcnprobe __P((struct consdev *)); +void zscninit __P((struct consdev *)); + /* Find PROM mappings (for console support). */ void zs_init() { @@ -120,10 +138,10 @@ void zs_init() zsaddr[i] = (struct zsdevice *) obio_find_mapping(zs_physaddr[i], OBIO_ZS_SIZE); } -} +} -struct zschan * +static struct zschan * zs_get_chan_addr(zsc_unit, channel) int zsc_unit, channel; { @@ -243,7 +261,6 @@ zsc_attach(parent, self, aux) { struct zsc_softc *zsc = (void *) self; struct cfdata *cf = self->dv_cfdata; - struct confargs *ca = aux; struct zsc_attach_args zsc_args; volatile struct zschan *zc; struct zs_chanstate *cs; @@ -352,7 +369,7 @@ zshard(arg) { struct zsc_softc *zsc; int unit, rval; - + /* Do ttya/ttyb first, because they go faster. */ rval = 0; unit = zsc_cd.cd_ndevs; @@ -370,7 +387,7 @@ int zssoftpending; void zsc_req_softint(zsc) struct zsc_softc *zsc; -{ +{ if (zssoftpending == 0) { /* We are at splzs here, so no need to lock. */ zssoftpending = ZSSOFT_PRI; @@ -439,7 +456,8 @@ zs_write_reg(cs, reg, val) ZS_DELAY(); } -u_char zs_read_csr(cs) +u_char +zs_read_csr(cs) struct zs_chanstate *cs; { register u_char v; @@ -449,7 +467,8 @@ u_char zs_read_csr(cs) return v; } -u_char zs_read_data(cs) +u_char +zs_read_data(cs) struct zs_chanstate *cs; { register u_char v; @@ -467,7 +486,8 @@ void zs_write_csr(cs, val) ZS_DELAY(); } -void zs_write_data(cs, val) +void +zs_write_data(cs, val) struct zs_chanstate *cs; u_char val; { @@ -484,7 +504,7 @@ void zs_write_data(cs, val) */ int zs_getc(arg) - void *arg; + volatile void *arg; { register volatile struct zschan *zc = arg; register int s, c, rr0; @@ -510,9 +530,9 @@ zs_getc(arg) /* * Polled output char. */ -void +static void zs_putc(arg, c) - void *arg; + volatile void *arg; int c; { register volatile struct zschan *zc = arg; @@ -533,7 +553,6 @@ zs_putc(arg, c) extern struct consdev consdev_kd; /* keyboard/display */ extern struct consdev consdev_tty; extern struct consdev *cn_tab; /* physical console device info */ -extern void nullcnpollc(); void *zs_conschan; diff --git a/sys/arch/sun3/dev/zs_cons.h b/sys/arch/sun3/dev/zs_cons.h new file mode 100644 index 00000000000..e8afb5faca7 --- /dev/null +++ b/sys/arch/sun3/dev/zs_cons.h @@ -0,0 +1,9 @@ +/* $OpenBSD: zs_cons.h,v 1.1 1997/01/16 04:04:01 kstailey Exp $ */ + +extern void *zs_conschan; + +extern void nullcnprobe __P((struct consdev *)); + +extern int zs_getc __P((void *arg)); +extern void zs_putc __P((void *arg, int c)); + diff --git a/sys/arch/sun3/dev/zs_kgdb.c b/sys/arch/sun3/dev/zs_kgdb.c index 6401cfbb0b4..0700f3d2441 100644 --- a/sys/arch/sun3/dev/zs_kgdb.c +++ b/sys/arch/sun3/dev/zs_kgdb.c @@ -1,3 +1,4 @@ +/* $OpenBSD: zs_kgdb.c,v 1.5 1997/01/16 04:04:01 kstailey Exp $ */ /* $NetBSD: zs_kgdb.c,v 1.9 1996/11/20 18:57:04 gwr Exp $ */ /*- @@ -179,7 +180,6 @@ zs_check_kgdb(cs, dev) struct zs_chanstate *cs; int dev; { - int tconst; if (dev != kgdb_dev) return (0); @@ -203,6 +203,7 @@ zs_check_kgdb(cs, dev) * KGDB framing character received: enter kernel debugger. This probably * should time out after a few seconds to avoid hanging on spurious input. */ +void zskgdb() { int unit = minor(kgdb_dev); diff --git a/sys/arch/sun3/include/autoconf.h b/sys/arch/sun3/include/autoconf.h index e1322fc8f12..bb03f2fc41f 100644 --- a/sys/arch/sun3/include/autoconf.h +++ b/sys/arch/sun3/include/autoconf.h @@ -1,3 +1,4 @@ +/* $OpenBSD: autoconf.h,v 1.7 1997/01/16 04:04:04 kstailey Exp $ */ /* $NetBSD: autoconf.h,v 1.12 1996/11/20 18:57:05 gwr Exp $ */ /*- @@ -66,3 +67,14 @@ int bus_print __P((void *, const char *)); int bus_peek __P((int, int, int)); char * bus_mapin __P((int, int, int)); +typedef int (*isr_func_t) __P((void *)); +void isr_add_custom __P((int, 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_soft_request __P((int level)); +void isr_soft_clear __P((int level)); + +/* Bus-error tolerant access to mapped address. */ +int peek_byte __P((caddr_t)); +int peek_word __P((caddr_t)); diff --git a/sys/arch/sun3/include/conf.h b/sys/arch/sun3/include/conf.h index b510287fa31..0e9edaf8da1 100644 --- a/sys/arch/sun3/include/conf.h +++ b/sys/arch/sun3/include/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.4 1997/01/07 23:36:15 kstailey Exp $ */ +/* $OpenBSD: conf.h,v 1.5 1997/01/16 04:04:05 kstailey Exp $ */ /*- * Copyright (c) 1996 Kenneth Stailey. All rights reserved. @@ -55,6 +55,8 @@ cdev_decl(fd); dev_decl(filedesc,open); +cdev_decl(idprom); + #define mmread mmrw #define mmwrite mmrw cdev_decl(mm); diff --git a/sys/arch/sun3/include/cpu.h b/sys/arch/sun3/include/cpu.h index dfd987164cf..1a512e62670 100644 --- a/sys/arch/sun3/include/cpu.h +++ b/sys/arch/sun3/include/cpu.h @@ -111,6 +111,7 @@ extern int want_resched; /* resched() was called */ * isr_soft_request() so this scheme just multiplexes four * software interrupt `sources' on the level one handler. */ +extern void isr_soft_request __P((int level)); union sun3sir { int sir_any; char sir_which[4]; diff --git a/sys/arch/sun3/include/db_machdep.h b/sys/arch/sun3/include/db_machdep.h index 543f101428a..fcf395331a2 100644 --- a/sys/arch/sun3/include/db_machdep.h +++ b/sys/arch/sun3/include/db_machdep.h @@ -1,3 +1,4 @@ +/* $OpenBSD: db_machdep.h,v 1.4 1997/01/16 04:04:06 kstailey Exp $ */ /* $NetBSD: db_machdep.h,v 1.7 1995/02/07 04:34:45 gwr Exp $ */ #include <m68k/db_machdep.h> @@ -5,3 +6,9 @@ /* This enables some code in db_command.c */ #define DB_MACHINE_COMMANDS +void db_machine_init __P((void)); +void ddb_init __P((void)); + +/* These are in db_memrw.c */ +extern void db_read_bytes __P((vm_offset_t addr, size_t size, char *data)); +extern void db_write_bytes __P((vm_offset_t addr, size_t size, char *data)); diff --git a/sys/arch/sun3/include/dvma.h b/sys/arch/sun3/include/dvma.h index 796042aebac..9ebbdbe3bc8 100644 --- a/sys/arch/sun3/include/dvma.h +++ b/sys/arch/sun3/include/dvma.h @@ -1,3 +1,4 @@ +/* $OpenBSD: dvma.h,v 1.6 1997/01/16 04:04:06 kstailey Exp $ */ /* $NetBSD: dvma.h,v 1.4 1996/11/20 18:57:08 gwr Exp $ */ /*- @@ -75,6 +76,8 @@ #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(size_t bytes); void dvma_free(caddr_t addr, size_t bytes); diff --git a/sys/arch/sun3/include/idprom.h b/sys/arch/sun3/include/idprom.h index 42c30ce4ed1..50cd844a2d5 100644 --- a/sys/arch/sun3/include/idprom.h +++ b/sys/arch/sun3/include/idprom.h @@ -1,3 +1,4 @@ +/* $OpenBSD: idprom.h,v 1.5 1997/01/16 04:04:07 kstailey Exp $ */ /* $NetBSD: idprom.h,v 1.12 1996/11/20 18:57:10 gwr Exp $ */ /*- @@ -54,7 +55,10 @@ struct idprom { #define IDPROM_SIZE (sizeof(struct idprom)) #ifdef _KERNEL + extern struct idprom identity_prom; -int idprom_init(); + +int idprom_init __P((void)); void idprom_etheraddr __P((u_char *)); + #endif diff --git a/sys/arch/sun3/include/isr.h b/sys/arch/sun3/include/isr.h deleted file mode 100644 index 228708ea082..00000000000 --- a/sys/arch/sun3/include/isr.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: isr.h,v 1.10 1996/11/20 18:57:11 gwr Exp $ */ - -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Adam Glass and Gordon W. Ross. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -void isr_init __P((void)); -void isr_config __P((void)); - -void isr_add_custom __P((int, void (*handler)())); -void isr_add_autovect __P((int (*handler)(), void *arg, int level)); -void isr_add_vectored __P((int (*handler)(), void *arg, int pri, int vec)); - -void isr_soft_request __P((int level)); -void isr_soft_clear __P((int level)); diff --git a/sys/arch/sun3/sun3/machdep.h b/sys/arch/sun3/include/machdep.h index e6fa956d367..4519392539f 100644 --- a/sys/arch/sun3/sun3/machdep.h +++ b/sys/arch/sun3/include/machdep.h @@ -1,4 +1,4 @@ - +/* $OpenBSD: machdep.h,v 1.1 1997/01/16 04:04:08 kstailey Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1993 Adam Glass @@ -113,6 +113,8 @@ void cninit __P((void)); void dumpconf __P((void)); void dumpsys __P((void)); +void fb_unblank __P((void)); + int fpu_emulate __P((struct frame *, struct fpframe *)); int getdfc __P((void)); @@ -124,6 +126,8 @@ vm_offset_t high_segment_alloc __P((int npages)); void initfpu __P((void)); +void intreg_init __P((void)); + void isr_init __P((void)); void isr_config __P((void)); @@ -131,6 +135,8 @@ void m68881_save __P((struct fpframe *)); void m68881_restore __P((struct fpframe *)); void netintr __P((void)); + +void proc_do_uret __P((void)); void proc_trampoline __P((void)); void pmap_bootstrap __P((void)); @@ -138,6 +144,8 @@ int pmap_fault_reload __P((struct pmap *, vm_offset_t, int)); void pmap_get_ksegmap __P((u_char *)); void pmap_get_pagemap __P((int *pt, int off)); +int reboot2 __P((int, char *)); + void regdump __P((struct frame *, int)); void savectx __P((struct pcb *)); diff --git a/sys/arch/sun3/include/mon.h b/sys/arch/sun3/include/mon.h index 447e1629524..d142f001e57 100644 --- a/sys/arch/sun3/include/mon.h +++ b/sys/arch/sun3/include/mon.h @@ -1,3 +1,4 @@ +/* $OpenBSD: mon.h,v 1.5 1997/01/16 04:04:08 kstailey Exp $ */ /* $NetBSD: mon.h,v 1.19 1996/11/20 18:57:12 gwr Exp $ */ /*- @@ -103,41 +104,41 @@ typedef struct bootparam { * translate these structs into Sprite format. */ typedef struct { - char *initSp; /* Initial system stack ptr - * for hardware */ - int (*startMon)(); /* Initial PC for hardware */ + char *initSp; /* Initial system stack ptr + * for hardware */ + int (*startMon)__P((void)); /* 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 */ - unsigned *memorySize; /* Usable memory in bytes */ + struct bootparam **bootParam; /* Info for bootstrapped pgm */ + u_int *memorySize; /* Usable memory in bytes */ - /* - * Single-character input and output + /* + * Single-character input and output */ - unsigned char (*getChar)(); /* Get char from input source */ - int (*putChar)(); /* Put char to output sink */ - int (*mayGet)(); /* Maybe get char, or -1 */ - int (*mayPut)(); /* Maybe put char, or -1 */ - unsigned char *echo; /* Should getchar echo? */ - unsigned char *inSource; /* Input source selector */ - unsigned char *outSink; /* Output sink selector */ + 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 */ - /* - * Keyboard input (scanned by monitor nmi routine) + /* + * Keyboard input (scanned by monitor nmi routine) */ - int (*getKey)(); /* Get next key if one exists */ - int (*initGetKey)(); /* Initialize get key */ - unsigned int *translation; /* Kbd translation selector - (see keyboard.h in sun + 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) */ - unsigned char *keyBid; /* Keyboard ID byte */ + 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 */ @@ -146,86 +147,88 @@ typedef struct { * Monitor revision level. */ - char *monId; + char *monId; - /* - * Frame buffer output and terminal emulation + /* + * Frame buffer output and terminal emulation */ - int (*fbWriteChar)(); /* Write a character to FB */ - int *fbAddr; /* Address of frame buffer */ - char **font; /* Font table for FB */ - int (*fbWriteStr)(); /* Quickly write string to FB */ + 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)); - /* - * Reboot interface routine -- resets and reboots system. No return. + /* + * Reboot interface routine -- resets and reboots system. No return. + * XXX should this be declared volatile? */ - int (*reBoot)(); /* e.g. reBoot("xy()vmunix") */ + int (*reBoot)__P((char *)); /* e.g. reBoot("sd()bsd") */ - /* - * Line input and parsing + /* + * Line input and parsing */ - unsigned char *lineBuf; /* The line input buffer */ - unsigned char **linePtr; /* Cur pointer into linebuf */ - int *lineSize; /* length of line in linebuf */ - int (*getLine)(); /* Get line from user */ - unsigned char (*getNextChar)(); /* Get next char from linebuf */ - unsigned char (*peekNextChar)(); /* Peek at next char */ - int *fbThere; /* =1 if frame buffer there */ - int (*getNum)(); /* Grab hex num from line */ - - /* - * Print formatted output to current output sink + 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 */ + int *fbThere; /* =1 if frame buffer there */ + int (*getNum)__P((void)); /* Grab hex num from line */ + + /* + * Print formatted output to current output sink */ - int (*printf)(); /* Similar to "Kernel printf" */ - int (*printHex)(); /* Format N digits in hex */ + int (*printf)__P((char *, ...)); /* Similar to "Kernel printf" */ + int (*printHex)__P((int,int)); /* Format N digits in hex */ /* - * Led stuff + * Led stuff */ - unsigned char *leds; /* RAM copy of LED register */ - int (*setLeds)(); /* Sets LED's and RAM copy */ + u_char *leds; /* RAM copy of LED register */ + int (*setLeds)__P((int)); /* Sets LED's and RAM copy */ - /* + /* * Non-maskable interrupt (nmi) information - */ + */ - int (*nmiAddr)(); /* Addr for level 7 vector */ - int (*abortEntry)(); /* Entry for keyboard abort */ - int *nmiClock; /* Counts up in msec */ + int (*nmiAddr)__P((void*)); /* Addr for level 7 vector */ + int (*abortEntry)__P((void*)); /* Entry for keyboard abort */ + int *nmiClock; /* Counts up in msec */ /* - * Frame buffer type: see <sun/fbio.h> + * Frame buffer type: see <machine/fbio.h> */ - int *fbType; + int *fbType; - /* - * Assorted other things + /* + * Assorted other things */ - unsigned romvecVersion; /* Version # of Romvec */ + 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 */ - 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 */ + 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)(); /* 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; + int (*exitToMon)__P((void)); /* Exit from user program */ + u_char **memorybitmap; /* V1: &{0 or &bits} */ + void (*setcxsegmap)__P((int,int,int)); /* Set seg in any context */ + void (**vector_cmd)__P((int, char*)); /* V2: Handler for 'v' cmd */ + int dummy1z; + int dummy2z; + int dummy3z; + int dummy4z; } MachMonRomVector; /* @@ -239,13 +242,13 @@ typedef struct { * putChar -- Write the given character to the output source. * * void putChar(ch) - * char ch; + * char ch; * - * mayGet -- Maybe get a character from the current input source. Return -1 + * mayGet -- Maybe get a character from the current input source. Return -1 * if don't return a character. * * int mayGet() - * + * * mayPut -- Maybe put a character to the current output source. Return -1 * if no character output. * @@ -257,7 +260,7 @@ typedef struct { * NOKEY (if no key has been hit). * * int getKey() - * + * * initGetKey -- Initialize things for get key. * * void initGetKey() @@ -327,9 +330,9 @@ typedef struct { /* * MONSTART and MONEND denote the range of the damn monitor. - * + * * supposedly you can steal pmegs within this range that do not contain - * valid pages. + * valid pages. */ #define MONSTART 0x0FE00000 #define MONEND 0x0FF00000 @@ -346,8 +349,8 @@ typedef struct { * */ -#define MONSHORTPAGE 0x0FFFE000 -#define MONSHORTSEG 0x0FFE0000 +#define MONSHORTPAGE 0x0FFFE000 +#define MONSHORTSEG 0x0FFE0000 #endif /* _MACHMON */ -#endif /* MACHINE_MON_H */ +#endif /* MACHINE_MON_H */ diff --git a/sys/arch/sun3/include/obio.h b/sys/arch/sun3/include/obio.h index e687a5a4206..fad8ddcb560 100644 --- a/sys/arch/sun3/include/obio.h +++ b/sys/arch/sun3/include/obio.h @@ -1,3 +1,4 @@ +/* $OpenBSD: obio.h,v 1.6 1997/01/16 04:04:09 kstailey Exp $ */ /* $NetBSD: obio.h,v 1.16 1996/11/20 18:57:14 gwr Exp $ */ /*- @@ -82,4 +83,11 @@ caddr_t obio_alloc __P((int, int)); caddr_t obio_vm_alloc __P((int)); caddr_t obio_find_mapping __P((int pa, int size)); +/* routines called during earily startup */ +void obio_init __P((void)); +void zs_init __P((void)); +void eeprom_init __P((void)); +void intreg_init __P((void)); +void clock_init __P((void)); + #endif /* _KERNEL */ diff --git a/sys/arch/sun3/include/pmap.h b/sys/arch/sun3/include/pmap.h index 6f9c9ecb03c..c05f69142e3 100644 --- a/sys/arch/sun3/include/pmap.h +++ b/sys/arch/sun3/include/pmap.h @@ -1,3 +1,4 @@ +/* $OpenBSD: pmap.h,v 1.6 1997/01/16 04:04:09 kstailey Exp $ */ /* $NetBSD: pmap.h,v 1.15 1996/11/20 18:57:16 gwr Exp $ */ /*- @@ -56,6 +57,9 @@ typedef struct pmap *pmap_t; #ifdef _KERNEL struct pmap kernel_pmap_store; +struct pcb; +void pmap_activate __P((pmap_t pmap, struct pcb *pcbp)); +void pmap_deactivate __P((pmap_t pmap, struct pcb *pcbp)); #define pmap_kernel() (&kernel_pmap_store) diff --git a/sys/arch/sun3/include/psl.h b/sys/arch/sun3/include/psl.h index 4fe2914b7d0..d3daa930e6c 100644 --- a/sys/arch/sun3/include/psl.h +++ b/sys/arch/sun3/include/psl.h @@ -1,3 +1,4 @@ +/* $OpenBSD: psl.h,v 1.6 1997/01/16 04:04:10 kstailey Exp $ */ /* $NetBSD: psl.h,v 1.10 1996/11/20 18:57:17 gwr Exp $ */ /*- @@ -108,5 +109,8 @@ extern __inline__ int _spl(int new) #define splhigh() spl7() #define splsched() spl7() +/* Get current sr value (debug, etc.) */ +extern int getsr __P((void)); + #endif /* KERNEL && !_LOCORE */ #endif /* PSL_C */ diff --git a/sys/arch/sun3/include/z8530var.h b/sys/arch/sun3/include/z8530var.h index 1164ad3f7f7..87729496caf 100644 --- a/sys/arch/sun3/include/z8530var.h +++ b/sys/arch/sun3/include/z8530var.h @@ -71,7 +71,7 @@ void zs_write_data __P((struct zs_chanstate *cs, u_char val)); void zsc_req_softint __P((struct zsc_softc *zsc)); /* Handle user request to enter kernel debugger. */ -void zs_abort(); +void zs_abort __P((void)); /* * Some warts needed by z8530tty.c - diff --git a/sys/arch/sun3/sun3/autoconf.c b/sys/arch/sun3/sun3/autoconf.c index 144fa399c65..d65d17684c7 100644 --- a/sys/arch/sun3/sun3/autoconf.c +++ b/sys/arch/sun3/sun3/autoconf.c @@ -1,3 +1,4 @@ +/* $OpenBSD: autoconf.c,v 1.6 1997/01/16 04:04:11 kstailey Exp $ */ /* $NetBSD: autoconf.c,v 1.37 1996/11/20 18:57:22 gwr Exp $ */ /*- @@ -59,19 +60,16 @@ #include <vm/vm_map.h> #include <machine/autoconf.h> +#include <machine/control.h> #include <machine/cpu.h> -#include <machine/isr.h> +#include <machine/machdep.h> #include <machine/pte.h> #include <machine/pmap.h> -extern int soft1intr(); - -void swapgeneric(); -void swapconf(), dumpconf(); - int cold; -void configure() +void +configure() { struct device *mainbus; @@ -96,13 +94,13 @@ swapconf() struct swdevt *swp; u_int maj; int nblks; - + for (swp = swdevt; swp->sw_dev != NODEV; swp++) { maj = major(swp->sw_dev); if (maj > nblkdev) /* paranoid? */ break; - + if (bdevsw[maj].d_psize) { nblks = (*bdevsw[maj].d_psize)(swp->sw_dev); if (nblks > 0 && @@ -130,7 +128,8 @@ swapconf() * bus_print: * Just prints out the final (non-default) locators. */ -int bus_scan(parent, child, aux) +int +bus_scan(parent, child, aux) struct device *parent; void *child, *aux; { @@ -151,8 +150,7 @@ int bus_scan(parent, child, aux) ca->ca_intvec = -1; if ((ca->ca_bustype == BUS_VME16) || - (ca->ca_bustype == BUS_VME32)) - { + (ca->ca_bustype == BUS_VME32)) { ca->ca_intvec = cf->cf_loc[2]; } @@ -263,7 +261,7 @@ char * bus_mapin(bustype, paddr, sz) int bustype, paddr, sz; { - int off, pa, pgs, pmt; + int off, pa, pmt; vm_offset_t va, retval; if (bustype & ~3) @@ -296,4 +294,40 @@ bus_mapin(bustype, paddr, sz) #endif return ((char*)retval); -} +} + +/* from hp300: badaddr() */ +int +peek_word(addr) + register caddr_t addr; +{ + label_t faultbuf; + register int x; + + nofault = &faultbuf; + if (setjmp(&faultbuf)) { + nofault = NULL; + return(-1); + } + x = *(volatile u_short *)addr; + nofault = NULL; + return(x); +} + +/* from hp300: badbaddr() */ +int +peek_byte(addr) + register caddr_t addr; +{ + label_t faultbuf; + register int x; + + nofault = &faultbuf; + if (setjmp(&faultbuf)) { + nofault = NULL; + return(-1); + } + x = *(volatile u_char *)addr; + nofault = NULL; + return(x); +} diff --git a/sys/arch/sun3/sun3/buserr.h b/sys/arch/sun3/sun3/buserr.h index 337a7599763..42a3d7da9a3 100644 --- a/sys/arch/sun3/sun3/buserr.h +++ b/sys/arch/sun3/sun3/buserr.h @@ -1,3 +1,4 @@ +/* $OpenBSD: buserr.h,v 1.3 1997/01/16 04:04:12 kstailey Exp $ */ /* $NetBSD: buserr.h,v 1.6 1996/11/20 18:57:23 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/sun3/cache.c b/sys/arch/sun3/sun3/cache.c index 3ffce849895..ee439a9f1fa 100644 --- a/sys/arch/sun3/sun3/cache.c +++ b/sys/arch/sun3/sun3/cache.c @@ -1,3 +1,4 @@ +/* $OpenBSD: cache.c,v 1.5 1997/01/16 04:04:13 kstailey Exp $ */ /* $NetBSD: cache.c,v 1.5 1996/11/20 18:57:24 gwr Exp $ */ /*- @@ -55,14 +56,15 @@ #include <machine/cpu.h> #include <machine/pte.h> #include <machine/control.h> +#include <machine/machdep.h> #include <machine/vmparam.h> -#include "cache.h" - #define CACHE_LINE 16 /* bytes */ #define VAC_FLUSH_INCR 512 /* bytes */ #define VADDR_MASK 0xfFFffFF /* 28 bits */ +static void cache_clear_tags __P((void)); + void cache_flush_page(pgva) vm_offset_t pgva; diff --git a/sys/arch/sun3/sun3/cache.h b/sys/arch/sun3/sun3/cache.h deleted file mode 100644 index 7289c8902af..00000000000 --- a/sys/arch/sun3/sun3/cache.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: cache.h,v 1.2 1996/11/20 18:57:25 gwr Exp $ */ - -/*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. - * 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: - * 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. - */ - -/* - * All sun3 cache implementations are write-back. - * Flushes must be done before removing translations - * from the MMU because the cache uses the MMU. - */ - -extern int cache_size; - -void cache_flush_page(vm_offset_t pgva); -void cache_flush_segment(vm_offset_t sgva); -void cache_flush_context(void); - diff --git a/sys/arch/sun3/sun3/clock.c b/sys/arch/sun3/sun3/clock.c index 0e06fb0b7b7..f9bd5d07303 100644 --- a/sys/arch/sun3/sun3/clock.c +++ b/sys/arch/sun3/sun3/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.6 1997/01/13 00:29:23 kstailey Exp $ */ +/* $OpenBSD: clock.c,v 1.7 1997/01/16 04:04:14 kstailey Exp $ */ /* $NetBSD: clock.c,v 1.31 1996/10/30 00:24:42 gwr Exp $ */ /* @@ -56,12 +56,11 @@ #include <sys/device.h> #include <machine/autoconf.h> -#include <machine/psl.h> +#include <machine/control.h> #include <machine/cpu.h> - +#include <machine/machdep.h> #include <machine/mon.h> #include <machine/obio.h> -#include <machine/control.h> #include "intersil7170.h" #include "interreg.h" @@ -69,6 +68,10 @@ #define CLOCK_PRI 5 +void cpu_initclocks __P((void)); +void clock_intr __P((struct clockframe *)); + + extern volatile u_char *interrupt_reg; volatile char *clock_va; @@ -93,12 +96,11 @@ struct cfdriver clock_cd = { static int clock_match(parent, vcf, args) - struct device *parent; - void *vcf, *args; + struct device *parent; + void *vcf, *args; { - struct cfdata *cf = vcf; + struct cfdata *cf = vcf; struct confargs *ca = args; - int pa; /* This driver only supports one unit. */ if (cf->cf_unit != 0) @@ -121,8 +123,6 @@ clock_attach(parent, self, args) struct device *self; void *args; { - struct cfdata *cf = self->dv_cfdata; - struct confargs *ca = args; printf("\n"); @@ -137,6 +137,7 @@ clock_attach(parent, self, args) * register. We have to be extremely careful that we do it * in such a manner that we don't get ourselves lost. */ +void set_clk_mode(on, off, enable) u_char on, off; int enable; @@ -152,7 +153,7 @@ set_clk_mode(on, off, enable) panic("set_clk_mode: map"); /* - * make sure that we are only playing w/ + * make sure that we are only playing w/ * clock interrupt register bits */ on &= (IREG_CLOCK_ENAB_7 | IREG_CLOCK_ENAB_5); @@ -221,7 +222,7 @@ void cpu_initclocks(void) { int s; - extern void _isr_clock(); + extern void _isr_clock __P((void)); /* in locore.s */ if (!intersil_clock) panic("cpu_initclocks"); @@ -371,7 +372,7 @@ void inittodr(fs_time) if (diff < 0) diff = -diff; if (diff >= (SECDAY*2)) { - printf("WARNING: clock %s %d days", + printf("WARNING: clock %s %ld days", (clk_time < fs_time) ? "lost" : "gained", diff / SECDAY); clk_bad = 1; @@ -382,10 +383,11 @@ void inittodr(fs_time) time.tv_sec = clk_time; } -/* +/* * Resettodr restores the time of day hardware after a time change. */ -void resettodr() +void +resettodr() { clk_set_secs(time.tv_sec); } @@ -402,7 +404,8 @@ void resettodr() * The clock registers have to be read or written * in sequential order (or so it appears). -gwr */ -static void clk_get_dt(struct date_time *dt) +static void +clk_get_dt(struct date_time *dt) { int s; register volatile char *src, *dst; @@ -424,7 +427,8 @@ static void clk_get_dt(struct date_time *dt) splx(s); } -static void clk_set_dt(struct date_time *dt) +static void +clk_set_dt(struct date_time *dt) { int s; register volatile char *src, *dst; @@ -469,7 +473,8 @@ static int month_days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -void gmt_to_dt(long *tp, struct date_time *dt) +void +gmt_to_dt(long *tp, struct date_time *dt) { register int i; register long days, secs; @@ -504,10 +509,11 @@ void gmt_to_dt(long *tp, struct date_time *dt) dt->dt_month = i; /* Days are what is left over (+1) from all that. */ - dt->dt_day = days + 1; + dt->dt_day = days + 1; } -void dt_to_gmt(struct date_time *dt, long *tp) +void +dt_to_gmt(struct date_time *dt, long *tp) { register int i; register long tmp; @@ -556,7 +562,8 @@ void dt_to_gmt(struct date_time *dt, long *tp) * Now routines to get and set clock as POSIX time. */ -static long clk_get_secs() +static long +clk_get_secs() { struct date_time dt; long gmt; @@ -566,7 +573,8 @@ static long clk_get_secs() return (gmt); } -static void clk_set_secs(long secs) +static void +clk_set_secs(long secs) { struct date_time dt; long gmt; @@ -579,7 +587,8 @@ static void clk_set_secs(long secs) #ifdef DEBUG /* Call this from DDB or whatever... */ -int clkdebug() +int +clkdebug() { struct date_time dt; long gmt; diff --git a/sys/arch/sun3/sun3/conf.c b/sys/arch/sun3/sun3/conf.c index c95f1100f90..cfc11ff90ea 100644 --- a/sys/arch/sun3/sun3/conf.c +++ b/sys/arch/sun3/sun3/conf.c @@ -1,3 +1,4 @@ +/* $OpenBSD: conf.c,v 1.18 1997/01/16 04:04:14 kstailey Exp $ */ /* $NetBSD: conf.c,v 1.51 1996/11/04 16:16:09 gwr Exp $ */ /*- @@ -97,7 +98,7 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); struct cdevsw cdevsw[] = { cdev_cn_init(1,cn), /* 0: virtual console */ - cdev_tty_init(NKBD,kd), /* 1: Sun keyboard/display */ + cdev_tty_init(NKBD,kd), /* 1: Sun keyboard/display */ cdev_ctty_init(1,ctty), /* 2: controlling terminal */ cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */ cdev_notdef(), /* 4: was PROM console */ @@ -190,6 +191,7 @@ dev_t swapdev = makedev(4, 0); /* * Returns true if dev is /dev/mem or /dev/kmem. */ +int iskmemdev(dev) dev_t dev; { @@ -200,6 +202,7 @@ iskmemdev(dev) /* * Returns true if dev is /dev/zero. */ +int iszerodev(dev) dev_t dev; { @@ -287,6 +290,7 @@ static int chrtoblktbl[] = { /* * Convert a character device number to a block device number. */ +int chrtoblk(dev) dev_t dev; { diff --git a/sys/arch/sun3/sun3/control.c b/sys/arch/sun3/sun3/control.c index 0fc1cbc2fed..20b0a112c69 100644 --- a/sys/arch/sun3/sun3/control.c +++ b/sys/arch/sun3/sun3/control.c @@ -1,3 +1,4 @@ +/* $OpenBSD: control.c,v 1.5 1997/01/16 04:04:15 kstailey Exp $ */ /* $NetBSD: control.c,v 1.14 1996/11/20 18:57:25 gwr Exp $ */ /*- @@ -45,7 +46,8 @@ #define CONTROL_ALIGN(x) (x & CONTROL_ADDR_MASK) #define CONTROL_ADDR_BUILD(space, va) (CONTROL_ALIGN(va)|space) -int get_context() +int +get_context() { int c; @@ -53,35 +55,45 @@ int get_context() return (c & CONTEXT_MASK); } -void set_context(int c) +void +set_context(int c) { + set_control_byte((char *) CONTEXT_REG, c & CONTEXT_MASK); } -vm_offset_t get_pte(va) +vm_offset_t +get_pte(va) vm_offset_t va; { + return (vm_offset_t) get_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va)); } -void set_pte(va, pte) +void +set_pte(va, pte) vm_offset_t va, pte; { + set_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va), (unsigned int) pte); } -unsigned char get_segmap(va) +unsigned +char get_segmap(va) vm_offset_t va; { + return get_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va)); } -void set_segmap(va, sme) +void +set_segmap(va, sme) vm_offset_t va; unsigned char sme; { + set_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va), sme); } @@ -91,7 +103,8 @@ void set_segmap(va, sme) * XXX - Should optimize: "(get|set)_control_(word|byte)" * calls so this does save/restore of sfc/dfc only once! */ -void set_segmap_allctx(va, sme) +void +set_segmap_allctx(va, sme) vm_offset_t va; unsigned char sme; /* segmap entry */ { @@ -105,7 +118,8 @@ void set_segmap_allctx(va, sme) /* Inlined set_context() */ set_control_byte((char *) CONTEXT_REG, ctx); /* Inlined set_segmap() */ - set_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va), sme); + set_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va), + sme); } /* Inlined set_context(ctx); */ diff --git a/sys/arch/sun3/sun3/ctrlsp.S b/sys/arch/sun3/sun3/ctrlsp.S index fb1eeee42b0..7557d71a011 100644 --- a/sys/arch/sun3/sun3/ctrlsp.S +++ b/sys/arch/sun3/sun3/ctrlsp.S @@ -1,3 +1,4 @@ +/* $OpenBSD: ctrlsp.S,v 1.3 1997/01/16 04:04:16 kstailey Exp $ */ /* $NetBSD: ctrlsp.S,v 1.3 1996/11/20 18:57:26 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/sun3/db_machdep.c b/sys/arch/sun3/sun3/db_machdep.c index 5e35d0a7e93..15859331f52 100644 --- a/sys/arch/sun3/sun3/db_machdep.c +++ b/sys/arch/sun3/sun3/db_machdep.c @@ -1,3 +1,4 @@ +/* $OpenBSD: db_machdep.c,v 1.8 1997/01/16 04:04:16 kstailey Exp $ */ /* $NetBSD: db_machdep.c,v 1.8 1996/11/20 18:57:27 gwr Exp $ */ /*- @@ -45,16 +46,26 @@ #include <vm/vm.h> +#include <machine/control.h> #include <machine/db_machdep.h> +#include <machine/machdep.h> +#include <machine/pte.h> + #include <ddb/db_command.h> +#include <ddb/db_output.h> -#include <machine/pte.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" }; -void pte_print(pte) +void +pte_print(pte) int pte; { int t; @@ -80,8 +91,11 @@ void pte_print(pte) } static void -db_pagemap(addr) - db_expr_t addr; +db_mach_pagemap(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; { int pte, sme; @@ -102,20 +116,44 @@ db_pagemap(addr) * pgmap: Given addr, Print addr, segmap, pagemap, pte */ -extern void sun3_mon_abort(); -extern void sun3_mon_halt(); +static void +db_mach_abort(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; +{ -void -db_mon_reboot() + 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(); +} + +static void +db_mach_reboot(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; { - sun3_mon_reboot(""); + + sun3_mon_reboot(""); } struct db_command db_machine_cmds[] = { - { "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 }, + { "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 }, { (char *)0, } }; @@ -126,5 +164,6 @@ struct db_command db_machine_cmds[] = { void db_machine_init() { + db_machine_commands_install(db_machine_cmds); } diff --git a/sys/arch/sun3/sun3/db_memrw.c b/sys/arch/sun3/sun3/db_memrw.c index 072cc1f5611..2213dd4bfab 100644 --- a/sys/arch/sun3/sun3/db_memrw.c +++ b/sys/arch/sun3/sun3/db_memrw.c @@ -1,3 +1,4 @@ +/* $OpenBSD: db_memrw.c,v 1.6 1997/01/16 04:04:17 kstailey Exp $ */ /* $NetBSD: db_memrw.c,v 1.13 1996/11/20 18:57:28 gwr Exp $ */ /*- @@ -53,16 +54,20 @@ */ #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 <machine/machdep.h> #include <ddb/db_access.h> -#include "cache.h" + +static void db_write_text __P((vm_offset_t, size_t size, char *)); /* * Read bytes from kernel address space for debugger. @@ -103,9 +108,9 @@ db_write_text(addr, size, data) register size_t size; register char *data; { - register char *dst; - int ch, oldpte, tmppte; - vm_offset_t pgva, prevpg; + register char *dst; + int oldpte, tmppte; + vm_offset_t pgva, prevpg; /* Prevent restoring a garbage PTE. */ if (size <= 0) @@ -141,7 +146,7 @@ db_write_text(addr, size, data) #endif oldpte = get_pte(pgva); if ((oldpte & PG_VALID) == 0) { - printf(" address 0x%x not a valid page\n", dst); + printf(" address %p not a valid page\n", dst); return; } tmppte = oldpte | PG_WRITE | PG_NC; @@ -165,7 +170,9 @@ db_write_text(addr, size, data) /* * Write bytes to kernel address space for debugger. */ + extern char kernel_text[], etext[]; + void db_write_bytes(addr, size, data) vm_offset_t addr; @@ -176,7 +183,7 @@ db_write_bytes(addr, size, data) /* If any part is in kernel text, use db_write_text() */ if ((dst < etext) && ((dst + size) > kernel_text)) { - db_write_text(dst, size, data); + db_write_text((vm_offset_t)dst, size, data); return; } diff --git a/sys/arch/sun3/sun3/disksubr.c b/sys/arch/sun3/sun3/disksubr.c index 6bd75f2917f..25415c74ac1 100644 --- a/sys/arch/sun3/sun3/disksubr.c +++ b/sys/arch/sun3/sun3/disksubr.c @@ -1,3 +1,4 @@ +/* $OpenBSD: disksubr.c,v 1.8 1997/01/16 04:04:18 kstailey Exp $ */ /* $NetBSD: disksubr.c,v 1.14 1996/09/26 18:10:21 gwr Exp $ */ /* @@ -80,7 +81,7 @@ static int disklabel_bsd_to_sun(struct disklabel *, char *); char * readdisklabel(dev, strat, lp, clp) dev_t dev; - void (*strat)(); + void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *clp; { @@ -142,6 +143,7 @@ readdisklabel(dev, strat, lp, clp) * Check new disk label for sensibility * before setting it. */ +int setdisklabel(olp, nlp, openmask, clp) struct disklabel *olp, *nlp; u_long openmask; @@ -188,9 +190,10 @@ setdisklabel(olp, nlp, openmask, clp) * Write disk label back to device after modification. * Current label is already in clp->cd_block[] */ +int writedisklabel(dev, strat, lp, clp) dev_t dev; - void (*strat)(); + void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *clp; { @@ -446,6 +449,7 @@ disklabel_bsd_to_sun(lp, cp) return(0); } +#if 0 /* XXX used by xy.c and xd.c */ /* * Search the bad sector table looking for the specified sector. * Return index if found. @@ -469,3 +473,4 @@ isbad(bt, cyl, trk, sec) } return (-1); } +#endif diff --git a/sys/arch/sun3/sun3/dvma.c b/sys/arch/sun3/sun3/dvma.c index 64c736e8103..7c35db8b28e 100644 --- a/sys/arch/sun3/sun3/dvma.c +++ b/sys/arch/sun3/sun3/dvma.c @@ -1,3 +1,4 @@ +/* $OpenBSD: dvma.c,v 1.6 1997/01/16 04:04:19 kstailey Exp $ */ /* $NetBSD: dvma.c,v 1.5 1996/11/20 18:57:29 gwr Exp $ */ /*- @@ -54,12 +55,13 @@ #include <machine/autoconf.h> #include <machine/cpu.h> -#include <machine/reg.h> +#include <machine/control.h> +#include <machine/dvma.h> +#include <machine/machdep.h> #include <machine/pte.h> #include <machine/pmap.h> -#include <machine/dvma.h> +#include <machine/reg.h> -#include "cache.h" /* Resource map used by dvma_mapin/dvma_mapout */ #define NUM_DVMA_SEGS 10 @@ -71,7 +73,8 @@ vm_size_t dvma_segmap_size = 6 * NBSG; /* Using phys_map to manage DVMA scratch-memory pages. */ /* Note: Could use separate pagemap for obio if needed. */ -void dvma_init() +void +dvma_init() { vm_offset_t segmap_addr; @@ -106,7 +109,8 @@ void dvma_init() * Allocate actual memory pages in DVMA space. * (idea for implementation borrowed from Chris Torek.) */ -caddr_t dvma_malloc(bytes) +caddr_t +dvma_malloc(bytes) size_t bytes; { caddr_t new_mem; @@ -125,7 +129,8 @@ caddr_t dvma_malloc(bytes) /* * Free pages from dvma_malloc() */ -void dvma_free(addr, size) +void +dvma_free(addr, size) caddr_t addr; size_t size; { @@ -139,7 +144,8 @@ void dvma_free(addr, size) * would be used by some OTHER bus-master besides the CPU. * (Examples: on-board ie/le, VME xy board). */ -long dvma_kvtopa(kva, bustype) +long +dvma_kvtopa(kva, bustype) long kva; int bustype; { @@ -169,7 +175,10 @@ long dvma_kvtopa(kva, bustype) * This IS safe to call at interrupt time. * (Typically called at SPLBIO) */ -caddr_t dvma_mapin(char *kva, int len) +caddr_t +dvma_mapin(kva, len) + char *kva; + int len; { vm_offset_t seg_kva, seg_dma, seg_len, seg_off; register vm_offset_t v, x; @@ -228,7 +237,10 @@ caddr_t dvma_mapin(char *kva, int len) * This IS safe to call at interrupt time. * (Typically called at SPLBIO) */ -void dvma_mapout(char *dma, int len) +void +dvma_mapout(dma, len) + char *dma; + int len; { vm_offset_t seg_dma, seg_len, seg_off; register vm_offset_t v, x; diff --git a/sys/arch/sun3/sun3/fpu.c b/sys/arch/sun3/sun3/fpu.c index 1d56a0a9ed2..ecc408b1d36 100644 --- a/sys/arch/sun3/sun3/fpu.c +++ b/sys/arch/sun3/sun3/fpu.c @@ -1,3 +1,4 @@ +/* $OpenBSD: fpu.c,v 1.6 1997/01/16 04:04:20 kstailey Exp $ */ /* $NetBSD: fpu.c,v 1.9 1996/11/20 18:57:29 gwr Exp $ */ /*- @@ -47,19 +48,15 @@ #include <sys/kernel.h> #include <sys/device.h> -#include <machine/psl.h> +#include <machine/control.h> #include <machine/cpu.h> #include <machine/frame.h> +#include <machine/machdep.h> #include <machine/mon.h> -#include <machine/control.h> +#include <machine/psl.h> #include "interreg.h" -extern int fpu_type; -extern long *nofault; - -int fpu_probe(); - static char *fpu_descr[] = { #ifdef FPU_EMULATE "emulator", /* 0 */ @@ -70,7 +67,10 @@ static char *fpu_descr[] = { "mc68882", /* 2 */ "?" }; -void initfpu() +static int fpu_probe __P((void)); + +void +initfpu() { char *descr; int enab_reg; @@ -96,19 +96,19 @@ void initfpu() } } -int fpu_probe() +static int +fpu_probe() { label_t faultbuf; - int null_fpframe[2]; + struct fpframe null_fpframe; - nofault = (long *) &faultbuf; + nofault = &faultbuf; if (setjmp(&faultbuf)) { nofault = NULL; return(0); } - null_fpframe[0] = 0; - null_fpframe[1] = 0; - m68881_restore(null_fpframe); + bzero(&null_fpframe, sizeof(null_fpframe)); + m68881_restore(&null_fpframe); nofault = NULL; return(1); } diff --git a/sys/arch/sun3/sun3/genassym.c b/sys/arch/sun3/sun3/genassym.c index dcbee10994d..fb4707d8381 100644 --- a/sys/arch/sun3/sun3/genassym.c +++ b/sys/arch/sun3/sun3/genassym.c @@ -1,3 +1,4 @@ +/* $OpenBSD: genassym.c,v 1.6 1997/01/16 04:04:21 kstailey Exp $ */ /* $NetBSD: genassym.c,v 1.32 1996/10/23 16:39:27 gwr Exp $ */ /* @@ -47,14 +48,15 @@ #include <vm/vm.h> +#include <machine/control.h> #include <machine/cpu.h> +#include <machine/dvma.h> #include <machine/pcb.h> #include <machine/psl.h> #include <machine/pte.h> -#include <machine/control.h> +#include <machine/machdep.h> #include <machine/mon.h> #include <machine/vmparam.h> -#include <machine/dvma.h> #include "intersil7170.h" #include "interreg.h" @@ -84,6 +86,9 @@ struct mytrapframe { #define def1(name) def("name", name) #endif +extern void printf __P((char *fmt, ...)); +extern void exit __P((int)); + void def(what, val) char *what; @@ -94,6 +99,7 @@ def(what, val) printf(((val > 999) ? "0x%x\n" : "%d\n"), val); } +int main() { struct pcb *pcb = (struct pcb *) 0; @@ -150,7 +156,7 @@ main() def1(ENAMETOOLONG); /* trap types: locore.s includes trap.h */ - + /* * unix structure-isms */ diff --git a/sys/arch/sun3/sun3/interreg.h b/sys/arch/sun3/sun3/interreg.h index 6fe6c3896b3..fdd95ce51d6 100644 --- a/sys/arch/sun3/sun3/interreg.h +++ b/sys/arch/sun3/sun3/interreg.h @@ -1,3 +1,4 @@ +/* $OpenBSD: interreg.h,v 1.5 1997/01/16 04:04:22 kstailey Exp $ */ /* $NetBSD: interreg.h,v 1.7 1996/11/20 18:57:30 gwr Exp $ */ /*- @@ -47,4 +48,4 @@ #define IREG_BITS "\20\8CLK7\7RSV6\6CLK5\5VIDEO\4SOFT3\3SOFT2\2SOFT1\1ALL\n" -int set_clk_mode(u_char on, u_char off, int enable); +void set_clk_mode __P((u_char on, u_char off, int enable)); diff --git a/sys/arch/sun3/sun3/intersil7170.h b/sys/arch/sun3/sun3/intersil7170.h index 848765bbfe4..d0aeb96956e 100644 --- a/sys/arch/sun3/sun3/intersil7170.h +++ b/sys/arch/sun3/sun3/intersil7170.h @@ -1,3 +1,4 @@ +/* $OpenBSD: intersil7170.h,v 1.5 1997/01/16 04:04:23 kstailey Exp $ */ /* $NetBSD: intersil7170.h,v 1.9 1996/11/20 18:57:31 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/sun3/intreg.c b/sys/arch/sun3/sun3/intreg.c index fd10cd7ac43..740e49e85ab 100644 --- a/sys/arch/sun3/sun3/intreg.c +++ b/sys/arch/sun3/sun3/intreg.c @@ -1,3 +1,4 @@ +/* $OpenBSD: intreg.c,v 1.5 1997/01/16 04:04:23 kstailey Exp $ */ /* $NetBSD: intreg.c,v 1.5 1996/11/20 18:57:32 gwr Exp $ */ /*- @@ -48,9 +49,9 @@ #include <machine/autoconf.h> #include <machine/cpu.h> +#include <machine/machdep.h> #include <machine/mon.h> #include <machine/obio.h> -#include <machine/isr.h> #include "interreg.h" @@ -61,7 +62,7 @@ struct intreg_softc { static int intreg_match __P((struct device *, void *vcf, void *args)); static void intreg_attach __P((struct device *, struct device *, void *)); -static int soft1intr(); +static int soft1intr __P((void *)); struct cfattach intreg_ca = { sizeof(struct intreg_softc), intreg_match, intreg_attach @@ -75,7 +76,8 @@ volatile u_char *interrupt_reg; /* called early (by internal_configure) */ -void intreg_init() +void +intreg_init() { interrupt_reg = obio_find_mapping(OBIO_INTERREG, 1); if (!interrupt_reg) @@ -87,12 +89,11 @@ void intreg_init() static int intreg_match(parent, vcf, args) - struct device *parent; - void *vcf, *args; + struct device *parent; + void *vcf, *args; { - struct cfdata *cf = vcf; + struct cfdata *cf = vcf; struct confargs *ca = args; - int pa; /* This driver only supports one unit. */ if (cf->cf_unit != 0) @@ -113,7 +114,6 @@ intreg_attach(parent, self, args) void *args; { struct intreg_softc *sc = (void *)self; - struct cfdata *cf = self->dv_cfdata; printf("\n"); @@ -130,11 +130,12 @@ intreg_attach(parent, self, args) * Network software interrupt * Soft clock interrupt */ -int soft1intr(arg) +static int +soft1intr(arg) void *arg; { union sun3sir sir; - int n, s; + int s; s = splhigh(); sir.sir_any = sun3sir.sir_any; @@ -165,9 +166,10 @@ int soft1intr(arg) return(0); } - static int isr_soft_pending; -void isr_soft_request(level) + +void +isr_soft_request(level) int level; { u_char bit, reg_val; @@ -192,7 +194,8 @@ void isr_soft_request(level) splx(s); } -void isr_soft_clear(level) +void +isr_soft_clear(level) int level; { u_char bit, reg_val; diff --git a/sys/arch/sun3/sun3/isr.c b/sys/arch/sun3/sun3/isr.c index f2ddb867afc..3ed655c7aee 100644 --- a/sys/arch/sun3/sun3/isr.c +++ b/sys/arch/sun3/sun3/isr.c @@ -1,3 +1,4 @@ +/* $OpenBSD: isr.c,v 1.6 1997/01/16 04:04:24 kstailey Exp $ */ /* $NetBSD: isr.c,v 1.25 1996/11/20 18:57:32 gwr Exp $ */ /*- @@ -43,37 +44,44 @@ #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/machdep.h> #include <machine/mon.h> #include <machine/obio.h> -#include <machine/isr.h> #include "vector.h" #include "ether.h" /* for NETHER */ +#include "ppp.h" /* for NPPP */ extern int intrcnt[]; /* statistics */ #define NUM_LEVELS 8 struct isr { - struct isr *isr_next; - int (*isr_intr)(); - void *isr_arg; - int isr_ipl; + struct isr *isr_next; + isr_func_t isr_intr; + void *isr_arg; + int isr_ipl; }; -void set_vector_entry __P((int, void (*handler)())); +void set_vector_entry __P((int, void (*handler) __P((void)))); unsigned int get_vector_entry __P((int)); -void isr_add_custom(level, handler) +void isr_autovec __P((int)); +void isr_vectored __P((int)); + +void +isr_add_custom(level, handler) int level; - void (*handler)(); + void *handler; { set_vector_entry(AUTOVEC_BASE + level, handler); } @@ -84,7 +92,21 @@ void isr_add_custom(level, handler) * Also, should use an array of chars instead of * a bitmask to avoid atomicity locking issues. */ -void netintr() + +/* + * 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; @@ -114,7 +136,6 @@ void netintr() ccittintr(); } #endif -#include "ppp.h" #if NPPP > 0 if (n & (1 << NETISR_PPP)) { pppintr(); @@ -129,7 +150,8 @@ static struct isr *isr_autovec_list[NUM_LEVELS]; * This is called by the assembly routines * for handling auto-vectored interupts. */ -void isr_autovec(evec) +void +isr_autovec(evec) int evec; /* format | vector offset */ { struct isr *isr; @@ -165,8 +187,9 @@ void isr_autovec(evec) * Establish an interrupt handler. * Called by driver attach functions. */ -void isr_add_autovect(handler, arg, level) - int (*handler)(); +void +isr_add_autovect(handler, arg, level) + isr_func_t handler; void *arg; int level; { @@ -186,9 +209,8 @@ void isr_add_autovect(handler, arg, level) isr_autovec_list[level] = new_isr; } -extern void badtrap(); struct vector_handler { - int (*func)(); + isr_func_t func; void *arg; }; static struct vector_handler isr_vector_handlers[192]; @@ -231,9 +253,12 @@ isr_vectored(evec) * Establish an interrupt handler. * Called by driver attach functions. */ -extern void _isr_vectored(); -void isr_add_vectored(func, arg, level, vec) - int (*func)(); + +extern void _isr_vectored __P((void)); + +void +isr_add_vectored(func, arg, level, vec) + isr_func_t func; void *arg; int level, vec; { @@ -256,18 +281,21 @@ void isr_add_vectored(func, arg, level, vec) /* * XXX - could just kill these... */ -void set_vector_entry(entry, handler) +void +set_vector_entry(entry, handler) int entry; - void (*handler)(); + void (*handler) __P((void)); { if ((entry <0) || (entry >= NVECTORS)) - panic("set_vector_entry: setting vector too high or low\n"); + panic("set_vector_entry: setting vector too high or low\n"); vector_table[entry] = handler; } -unsigned int 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"); + panic("get_vector_entry: setting vector too high or low\n"); return (unsigned int) vector_table[entry]; } diff --git a/sys/arch/sun3/sun3/kgdb_proto.h b/sys/arch/sun3/sun3/kgdb_proto.h index 3f8cfb20968..4e249229975 100644 --- a/sys/arch/sun3/sun3/kgdb_proto.h +++ b/sys/arch/sun3/sun3/kgdb_proto.h @@ -1,3 +1,4 @@ +/* $OpenBSD: kgdb_proto.h,v 1.3 1997/01/16 04:04:25 kstailey Exp $ */ /* $NetBSD: kgdb_proto.h,v 1.2 1996/11/20 18:57:33 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/sun3/kgdb_stub.c b/sys/arch/sun3/sun3/kgdb_stub.c index ce3ed8f4703..289c12ddeaa 100644 --- a/sys/arch/sun3/sun3/kgdb_stub.c +++ b/sys/arch/sun3/sun3/kgdb_stub.c @@ -1,3 +1,4 @@ +/* $OpenBSD: kgdb_stub.c,v 1.5 1997/01/16 04:04:25 kstailey Exp $ */ /* $NetBSD: kgdb_stub.c,v 1.6 1996/10/23 16:30:48 gwr Exp $ */ /* @@ -57,17 +58,16 @@ #include <machine/control.h> #include <machine/cpu.h> #include <machine/frame.h> +#include <machine/machdep.h> #include <machine/psl.h> #include <machine/pte.h> #include <machine/reg.h> #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 @@ -338,6 +338,7 @@ kgdb_copy(vsrc, vdst, len) *dst++ = *src++; } +#if 0 /* ditto for bzero */ static void kgdb_zero(vptr, len) @@ -349,6 +350,7 @@ kgdb_zero(vptr, len) while (--len >= 0) *ptr++ = (char) 0; } +#endif /* * Translate the values stored in the kernel regs struct to the format @@ -599,6 +601,7 @@ out: * XXX: Should we just use the PTE bits? Why not? * XXX: Better yet, setup a fault handler? */ +int kgdb_acc(addr, len) caddr_t addr; int len; diff --git a/sys/arch/sun3/sun3/leds.c b/sys/arch/sun3/sun3/leds.c index 39bcc3da6c6..82c42b37160 100644 --- a/sys/arch/sun3/sun3/leds.c +++ b/sys/arch/sun3/sun3/leds.c @@ -1,9 +1,10 @@ -/* $OpenBSD: leds.c,v 1.3 1997/01/13 21:28:24 kstailey Exp $ */ +/* $OpenBSD: leds.c,v 1.4 1997/01/16 04:04:26 kstailey Exp $ */ #include <sys/types.h> -#include <sys/uio.h> #include <sys/systm.h> #include <sys/errno.h> +#include <sys/uio.h> + #include <machine/psl.h> #include "ledsvar.h" @@ -24,7 +25,7 @@ volatile unsigned int led_px = 0; int ledrw(uio) - struct uio *uio; + struct uio *uio; { unsigned int v[2]; int s; @@ -40,7 +41,8 @@ ledrw(uio) o = uio->uio_offset; if (o < sizeof(v)) { err = uiomove(((caddr_t)&v[0])+o, sizeof(v)-o, uio); - if (err) return(err); + if (err) + return(err); o = sizeof(v); if (uio->uio_rw == UIO_WRITE) { if ((v[0] > MAXCDOWN) || @@ -59,7 +61,8 @@ ledrw(uio) return(0); if (uio->uio_resid > 0) { err = uiomove((caddr_t)&pattern[o], v[1]-o, uio); - if (err) return(err); + if (err) + return(err); } return(0); } diff --git a/sys/arch/sun3/sun3/ledsvar.h b/sys/arch/sun3/sun3/ledsvar.h index 4a96c435567..91c80eef6f4 100644 --- a/sys/arch/sun3/sun3/ledsvar.h +++ b/sys/arch/sun3/sun3/ledsvar.h @@ -1,7 +1,9 @@ -/* $OpenBSD: ledsvar.h,v 1.1 1997/01/13 00:29:25 kstailey Exp $ */ +/* $OpenBSD: ledsvar.h,v 1.2 1997/01/16 04:04:26 kstailey Exp $ */ extern volatile unsigned int led_n_patterns; extern volatile unsigned int led_countmax; extern volatile const unsigned char * volatile led_patterns; extern volatile unsigned int led_countdown; extern volatile unsigned int led_px; + +extern int ledrw __P((struct uio *)); diff --git a/sys/arch/sun3/sun3/locore.s b/sys/arch/sun3/sun3/locore.s index 15794d5362f..21ec47eaa7d 100644 --- a/sys/arch/sun3/sun3/locore.s +++ b/sys/arch/sun3/sun3/locore.s @@ -1,3 +1,4 @@ +/* $OpenBSD: locore.s,v 1.8 1997/01/16 04:04:27 kstailey Exp $ */ /* $NetBSD: locore.s,v 1.40 1996/11/06 20:19:54 cgd Exp $ */ /* @@ -246,12 +247,12 @@ Lbe10: /* * the sun3 specific code - * + * * our mission: figure out whether what we are looking at is * bus error in the UNIX sense, or * a memory error i.e a page fault * - * [this code replaces similarly mmu specific code in the hp300 code] + * [this code replaces similarly mmu specific code in the hp300 code] */ sun3_mmu_specific: clrl d0 | make sure top bits are cleard too @@ -571,7 +572,7 @@ Lbrkpt2: jne Lbrkpt3 | yes, done #endif #ifdef DDB - | Let DDB handle it. + | Let DDB handle it. movl a2,sp@- | push frame ptr movl d2,sp@- | push trap type jbsr _kdb_trap | handle the trap @@ -972,7 +973,7 @@ Lbadsw: /* * cpu_switch() - * Hacked for sun3 + * Hacked for sun3 * XXX - Arg 1 is a proc pointer (curproc) but this doesn't use it. * XXX - Sould we use p->p_addr instead of curpcb? -gwr */ diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index 70ddac1f9d4..4d2329f52da 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -1,3 +1,4 @@ +/* $OpenBSD: machdep.c,v 1.11 1997/01/16 04:04:28 kstailey Exp $ */ /* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */ /* @@ -78,34 +79,33 @@ #include <sys/shm.h> #endif -#include <machine/cpu.h> -#include <machine/reg.h> -#include <machine/psl.h> -#include <machine/pte.h> -#include <machine/mon.h> -#include <machine/isr.h> -#include <machine/kcore.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 <dev/cons.h> -#include "cache.h" +#include <machine/cpu.h> +#include <machine/db_machdep.h> +#include <machine/dvma.h> +#include <machine/kcore.h> +#include <machine/machdep.h> +#include <machine/mon.h> +#include <machine/psl.h> +#include <machine/pte.h> +#include <machine/reg.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; +label_t *nofault; +vm_offset_t vmmap; /* * safepri is a safe priority for sleep to set for a spin-wait @@ -127,19 +127,27 @@ int bufpages = BUFPAGES; #else int bufpages = 0; #endif -long *nofault; -void identifycpu(); +static caddr_t allocsys __P((caddr_t)); +static void identifycpu __P((void)); +static void initcpu __P((void)); +static void dumpmem __P((int *, int, int)); +static char *hexstr __P((int, int)); +static void reboot_sync __P((void)); +int reboot2 __P((int, char *)); /* share with sunos_misc.c */ + +void straytrap __P((struct trapframe)); /* called from locore.s */ /* * Console initialization: called early on from main, * before vm init or startup. Do enough configuration * to choose and initialize a console. */ -void consinit() +void +consinit() { - extern void cninit(); - cninit(); + + cninit(); #ifdef KGDB /* XXX - Ask on console for kgdb_dev? */ @@ -168,8 +176,10 @@ void consinit() * allocate that much and fill it with zeroes, and then call * allocsys() again with the correct base virtual address. */ + #define valloc(name, type, num) \ v = (caddr_t)(((name) = (type *)v) + (num)) + static caddr_t allocsys(v) register caddr_t v; @@ -330,7 +340,7 @@ cpu_startup() callout[i-1].c_next = &callout[i]; callout[i-1].c_next = NULL; - printf("avail mem = %d\n", ptoa(cnt.v_free_count)); + printf("avail mem = %ld\n", ptoa(cnt.v_free_count)); printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * CLBYTES); @@ -402,7 +412,7 @@ char machine[] = "sun3"; /* cpu "architecture" */ char cpu_model[120]; extern long hostid; -void +static void identifycpu() { /* @@ -415,12 +425,13 @@ identifycpu() /* should eventually include whether it has a VAC, mc6888x version, etc */ strcat(cpu_model, cpu_string); - printf("Model: %s (hostid %x)\n", cpu_model, hostid); + printf("Model: %s (hostid %lx)\n", cpu_model, hostid); } /* * machine dependent system variables. */ +int cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int *name; u_int namelen; @@ -770,11 +781,10 @@ sys_sigreturn(p, v, retval) * XXX - Put waittime checks in there too? */ int waittime = -1; /* XXX - Who else looks at this? -gwr */ -static void reboot_sync() +static void +reboot_sync() { extern struct proc proc0; - struct buf *bp; - int iter, nbusy; /* Check waittime here to localize its use to this function. */ if (waittime >= 0) @@ -789,7 +799,8 @@ static void reboot_sync() /* * Common part of the BSD and SunOS reboot system calls. */ -int reboot2(howto, user_boot_string) +int +reboot2(howto, user_boot_string) int howto; char *user_boot_string; { @@ -868,7 +879,8 @@ int reboot2(howto, user_boot_string) * that specifies a machine-dependent boot string that * is passed to the boot program if RB_STRING is set. */ -void boot(howto) +void +boot(howto) int howto; { (void) reboot2(howto, NULL); @@ -901,7 +913,7 @@ dumpconf() { int nblks; /* size of dump area */ int maj; - int (*getsize)(); + int (*getsize) __P((dev_t)); if (dumpdev == NODEV) return; @@ -940,6 +952,7 @@ extern vm_offset_t avail_start; * pagemap (2*NBPG) * physical memory... */ +void dumpsys() { struct bdevsw *dsw; @@ -974,14 +987,14 @@ dumpsys() return; } - printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo); + printf("\ndumping to dev %x, offset %ld\n", dumpdev, dumplo); /* * Write the dump header, including MMU state. */ blkno = dumplo; todo = dumpsize - DUMP_EXTRA; /* pages */ - vaddr = (char*)dumppage_va; + vaddr = (char *)dumppage_va; bzero(vaddr, NBPG); /* kcore header */ @@ -998,14 +1011,14 @@ dumpsys() blkno += btodb(NBPG); /* translation RAM (page zero) */ - pmap_get_pagemap(vaddr, 0); + pmap_get_pagemap((int *)vaddr, 0); error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); if (error) goto fail; blkno += btodb(NBPG); /* translation RAM (page one) */ - pmap_get_pagemap(vaddr, NBPG); + pmap_get_pagemap((int *)vaddr, NBPG); error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); if (error) goto fail; @@ -1060,6 +1073,7 @@ fail: printf(" dump error=%d\n", error); } +void initcpu() { /* XXX: Enable RAM parity/ECC checking? */ @@ -1072,57 +1086,24 @@ initcpu() #endif } +void straytrap(frame) - struct frame frame; + struct trapframe frame; { printf("unexpected trap; vector offset 0x%x from 0x%x\n", - frame.f_vector, frame.f_pc); + frame.tf_vector, frame.tf_pc); #ifdef DDB - kdb_trap(-1, &frame); + /* XXX - Yuck! Make DDB use "struct trapframe" instead! */ + kdb_trap(-1, (struct mc68020_saved_state *) &frame); #endif } -/* from hp300: badaddr() */ -int -peek_word(addr) - register caddr_t addr; -{ - label_t faultbuf; - register int x; - - nofault = (long*)&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 = (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; @@ -1130,7 +1111,6 @@ regdump(fp, sbytes) static int doingdump = 0; register int i; int s; - extern char *hexstr(); if (doingdump) return; @@ -1166,12 +1146,12 @@ regdump(fp, sbytes) #define KSADDR ((int *)((u_int)curproc->p_addr + USPACE - NBPG)) +static void dumpmem(ptr, sz, ustack) register int *ptr; int sz, ustack; { register int i, val; - extern char *hexstr(); for (i = 0; i < sz; i++) { if ((i & 7) == 0) @@ -1219,6 +1199,7 @@ hexstr(val, len) * Determine if the given exec package refers to something which we * understand and, if so, set up the vmcmds for it. */ +int cpu_exec_aout_makecmds(p, epp) struct proc *p; struct exec_package *epp; diff --git a/sys/arch/sun3/sun3/mainbus.c b/sys/arch/sun3/sun3/mainbus.c index 71734a9c694..369460f5419 100644 --- a/sys/arch/sun3/sun3/mainbus.c +++ b/sys/arch/sun3/sun3/mainbus.c @@ -1,3 +1,4 @@ +/* $OpenBSD: mainbus.c,v 1.4 1997/01/16 04:04:29 kstailey Exp $ */ /* $NetBSD: mainbus.c,v 1.5 1996/12/17 21:11:35 gwr Exp $ */ /*- diff --git a/sys/arch/sun3/sun3/mem.c b/sys/arch/sun3/sun3/mem.c index 9469d1316c9..83f1dedcf7b 100644 --- a/sys/arch/sun3/sun3/mem.c +++ b/sys/arch/sun3/sun3/mem.c @@ -1,3 +1,4 @@ +/* $OpenBSD: mem.c,v 1.5 1997/01/16 04:04:30 kstailey Exp $ */ /* $NetBSD: mem.c,v 1.19 1995/08/08 21:09:01 gwr Exp $ */ /* @@ -47,34 +48,34 @@ */ #include <sys/param.h> -#include <sys/conf.h> -#include <sys/buf.h> #include <sys/systm.h> -#include <sys/uio.h> +#include <sys/buf.h> +#include <sys/conf.h> #include <sys/malloc.h> +#include <sys/proc.h> +#include <sys/uio.h> #include <vm/vm.h> #include <vm/vm_kern.h> #include <vm/vm_map.h> +#include <machine/conf.h> #include <machine/cpu.h> +#include <machine/eeprom.h> +#include <machine/machdep.h> #include <machine/pte.h> #include <machine/pmap.h> -extern int eeprom_uio(); -extern vm_offset_t avail_start, avail_end; +extern int ledrw __P((struct uio *)); -vm_offset_t vmmap; /* XXX - poor name... - * It is a virtual page, not a map. - */ caddr_t zeropage; - /*ARGSUSED*/ int -mmopen(dev, flag, mode) +mmopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -82,9 +83,10 @@ mmopen(dev, flag, mode) /*ARGSUSED*/ int -mmclose(dev, flag, mode) +mmclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index 01f3a4eadd0..f052dd84b6b 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -1,3 +1,4 @@ +/* $OpenBSD: pmap.c,v 1.7 1997/01/16 04:04:31 kstailey Exp $ */ /* $NetBSD: pmap.c,v 1.64 1996/11/20 18:57:35 gwr Exp $ */ /*- @@ -78,12 +79,11 @@ #include <machine/control.h> #include <machine/cpu.h> -#include <machine/mon.h> -#include <machine/vmparam.h> #include <machine/dvma.h> +#include <machine/machdep.h> +#include <machine/mon.h> #include <machine/pmap.h> - -#include "cache.h" +#include <machine/vmparam.h> #if (PMAP_OBIO << PG_MOD_SHIFT) != PGT_OBIO #error "PMAP_XXX definitions don't match pte.h!" @@ -164,7 +164,7 @@ static vm_offset_t temp_seg_va; { \ result = (headp)->tqh_first; \ if (result) TAILQ_REMOVE(headp, result, entries); \ - } +} /* * pv support, i.e stuff that maps from physical pages to virtual addresses @@ -179,15 +179,17 @@ int pv_initialized = 0; struct pv_entry { struct pv_entry *pv_next; - pmap_t pv_pmap; - vm_offset_t pv_va; + pmap_t pv_pmap; + vm_offset_t pv_va; /* XXX - put flags in low byte of pv_va */ - unsigned int pv_flags; + unsigned int pv_flags; }; typedef struct pv_entry *pv_entry_t; pv_entry_t pv_head_table = NULL; + #ifdef DIAGNOSTIC +static struct pv_entry * pa_to_pvp __P((vm_offset_t pa)); static struct pv_entry * pa_to_pvp(pa) vm_offset_t pa; @@ -200,7 +202,7 @@ pa_to_pvp(pa) return pvp; } #else -#define pa_to_pvp(pa) &pv_head_table[PA_PGNUM(pa)] +# define pa_to_pvp(pa) &pv_head_table[PA_PGNUM(pa)] #endif /* These are as in the MMU but shifted by PV_SHIFT. */ @@ -268,8 +270,8 @@ save_modref_bits(int pte) #define PM_UPDATE_CACHE 1 -static int pmap_version = 1; -struct pmap kernel_pmap_store; +static int pmap_version = 1; +struct pmap kernel_pmap_store; #define kernel_pmap (&kernel_pmap_store) /* protection conversion */ @@ -310,6 +312,13 @@ struct pmeg_tailq pmeg_free_queue, pmeg_inactive_queue, static struct pmeg_state pmeg_array[NPMEG]; #ifdef PMAP_DEBUG +void pmap_print __P((pmap_t pmap)); +void pv_print __P((vm_offset_t pa)); + +static pmeg_t pmeg_p __P((int sme)); +static void pmeg_verify_empty __P((vm_offset_t va)); +static void pmeg_print __P((pmeg_t pmegp)); + static pmeg_t pmeg_p(sme) int sme; @@ -319,7 +328,7 @@ pmeg_p(sme) return &pmeg_array[sme]; } #else -#define pmeg_p(x) &pmeg_array[x] +# define pmeg_p(x) &pmeg_array[x] #endif #define is_pmeg_wired(pmegp) (pmegp->pmeg_wired != 0) @@ -354,14 +363,12 @@ static void context_allocate __P((pmap_t pmap)); static void context_free __P((pmap_t pmap)); static void context_init __P((void)); -static void pmeg_flush __P((pmeg_t pmegp)); static pmeg_t pmeg_allocate __P((pmap_t pmap, vm_offset_t va)); static void pmeg_release __P((pmeg_t pmegp)); static void pmeg_free __P((pmeg_t pmegp, int segnum)); static pmeg_t pmeg_cache __P((pmap_t pmap, vm_offset_t va)); static void pmeg_set_wiring __P((pmeg_t pmegp, vm_offset_t va, int)); -static int pv_compute_cache __P((pv_entry_t head)); static int pv_link __P((pmap_t pmap, vm_offset_t, vm_offset_t, u_int)); static void pv_unlink __P((pmap_t, vm_offset_t, vm_offset_t)); static void pv_remove_all __P(( vm_offset_t pa)); @@ -369,9 +376,10 @@ static void pv_changepte __P((pv_entry_t, int, int)); static void pv_syncflags __P((pv_entry_t head)); static void pv_init __P((void)); -void sun3_pmeg_init __P((void)); -void sun3_reserve_pmeg __P((int pmeg_num)); -void sun3_protection_init __P((void)); +static void pmeg_clean __P((pmeg_t pmegp)); +static void pmeg_clean_free __P((void)); + +static void sun3_protection_init __P((void)); static void pmap_common_init __P((pmap_t pmap)); @@ -417,7 +425,6 @@ int pmap_db_watchpmeg = -1; #endif /* PMAP_DEBUG */ #ifdef PMAP_DEBUG /* XXX */ -extern int getsr(); #define CHECK_SPL() do { \ if ((getsr() & PSL_IPL) < PSL_IPL3) \ panic("pmap: bad spl, line %d", __LINE__); \ @@ -436,21 +443,23 @@ context_allocate(pmap) PMAP_LOCK(); #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_allocate: for pmap %x\n", pmap); + printf("context_allocate: for pmap %p\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"); - 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); + 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); #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_allocate: pmap %x, take context %x num %d\n", - pmap, context, context->context_num); + printf("context_allocate: pmap %p, take context %p num %d\n", + pmap, context, context->context_num); #endif } TAILQ_REMOVE_FIRST(context, &context_free_queue, context_link); @@ -461,7 +470,7 @@ context_allocate(pmap) context->context_upmap = pmap; #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_allocate: pmap %x given context %x num %d\n", + printf("context_allocate: pmap %p given context %p num %d\n", pmap, context, context->context_num); #endif @@ -489,7 +498,7 @@ context_free(pmap) /* :) */ ctxnum = pmap->pm_ctxnum; #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_free: freeing context num %d of pmap 0x%x\n", + printf("context_free: freeing context num %d of pmap %p\n", ctxnum, pmap); #endif @@ -536,7 +545,7 @@ context_free(pmap) /* :) */ pmap->pm_ctxnum = CTXINVAL; #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_free: pmap %x context removed\n", pmap); + printf("context_free: pmap %p context removed\n", pmap); #endif PMAP_UNLOCK(); } @@ -556,7 +565,7 @@ context_init() context_link); #ifdef PMAP_DEBUG if (pmap_debug & PMD_CONTEXT) - printf("context_init: context num %d is %x\n", + printf("context_init: context num %d is %p\n", i, &context_array[i]); #endif } @@ -568,7 +577,7 @@ void pmap_print(pmap) { printf(" pm_ctxnum=%d\n", pmap->pm_ctxnum); printf(" pm_version=0x%x\n", pmap->pm_version); - printf(" pm_segmap=0x%x\n", pmap->pm_segmap); + printf(" pm_segmap=%p\n", pmap->pm_segmap); } #endif @@ -664,13 +673,13 @@ static void pmeg_print(pmegp) pmeg_t pmegp; { - printf("link_next=0x%x link_prev=0x%x\n", + printf("link_next=%p link_prev=%p\n", pmegp->pmeg_link.tqe_next, pmegp->pmeg_link.tqe_prev); - printf("index=0x%x owner=0x%x own_vers=0x%x\n", + printf("index=0x%x owner=%p 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", + printf("va=0x%lx 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); @@ -760,7 +769,7 @@ pmeg_allocate(pmap, va) pmegp->pmeg_qstate = PMEGQ_ACTIVE; #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pm_segmap: pmap=%x i=%x old=%x new=%x (pget)\n", + printf("pm_segmap: pmap=%p i=%x old=%x new=%x (pget)\n", pmap, VA_SEGNUM(va), pmap->pm_segmap[VA_SEGNUM(va)], pmegp->pmeg_index); @@ -963,7 +972,8 @@ sun3_pmeg_init() } #ifdef PMAP_DEBUG -static void +/* call from debugger */ +void pv_print(pa) vm_offset_t pa; { @@ -973,9 +983,9 @@ pv_print(pa) return; pv = pa_to_pvp(pa); - printf("pv_list for pa %x: flags=%x\n", pa, pv->pv_flags); + printf("pv_list for pa %lx: flags=%x\n", pa, pv->pv_flags); while (pv) { - printf("pv_entry %x pmap %x va %x next %x\n", + printf("pv_entry %p pmap %p va %lx next %p\n", pv, pv->pv_pmap, pv->pv_va, pv->pv_next); pv = pv->pv_next; } @@ -1017,6 +1027,8 @@ pv_changepte(head, set_bits, clear_bits) for (pv = head; pv != NULL; pv = pv->pv_next) { pmap = pv->pv_pmap; va = pv->pv_va; + sme = SEGINV; + #ifdef DIAGNOSTIC /* * Only the head may have a null pmap, and @@ -1117,6 +1129,8 @@ pv_syncflags(head) for (pv = head; pv != NULL; pv = pv->pv_next) { pmap = pv->pv_pmap; va = pv->pv_va; + sme = SEGINV; + #ifdef DIAGNOSTIC /* * Only the head may have a null pmap, and @@ -1202,7 +1216,7 @@ pv_remove_all(pa) #ifdef PMAP_DEBUG if (pmap_debug & PMD_REMOVE) - printf("pv_remove_all(%x)\n", pa); + printf("pv_remove_all(%lx)\n", pa); #endif if (!pv_initialized) return; @@ -1217,7 +1231,7 @@ pv_remove_all(pa) /* Make sure it went away. */ if ((pv->pv_pmap == pmap) && (pv->pv_va == va)) { - printf("pv_remove_all: head unchanged for pa=0x%x\n", pa); + printf("pv_remove_all: head unchanged for pa=0x%lx\n", pa); Debugger(); } #endif @@ -1244,7 +1258,7 @@ pv_link(pmap, pa, va, flags) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_LINK) || (va == pmap_db_watchva)) { - printf("pv_link(%x, %x, %x, %x)\n", pmap, pa, va, flags); + printf("pv_link(%p, %lx, %lx, %x)\n", pmap, pa, va, flags); /* pv_print(pa); */ } #endif @@ -1323,7 +1337,7 @@ pv_unlink(pmap, pa, va) if ((pmap_debug & PMD_UNLINK) || (va == pmap_db_watchva)) { - printf("pv_unlink(%x, %x, %x)\n", pmap, pa, va); + printf("pv_unlink(%p, %lx, %lx)\n", pmap, pa, va); } #endif head = pa_to_pvp(pa); @@ -1355,7 +1369,7 @@ pv_unlink(pmap, pa, va) for (prev = head;; prev = npv, npv = npv->pv_next) { pmap_stats.ps_unlink_pvsearch++; if (npv == NULL) { - printf("pv_unlink: not on list (pa=%x,va=%x)\n", + printf("pv_unlink: not on list (pa=%lx,va=%lx)\n", pa, va); Debugger(); /* XXX */ return; @@ -1397,7 +1411,7 @@ pv_init() pv_initialized++; } -void +static void sun3_protection_init() { unsigned int *kp, prot; @@ -1444,7 +1458,6 @@ pmap_common_init(pmap) void pmap_bootstrap() { - extern void vm_set_page_size(); /* * Reserve a segment for the kernel to use to access a pmeg @@ -1558,7 +1571,6 @@ int pmap_page_index(pa) vm_offset_t pa; { - u_long idx; #ifdef DIAGNOSTIC if (pa < avail_start || pa >= avail_end) @@ -1682,7 +1694,7 @@ pmap_destroy(pmap) #ifdef PMAP_DEBUG if (pmap_debug & PMD_CREATE) - printf("pmap_destroy(%x)\n", pmap); + printf("pmap_destroy(%p)\n", pmap); #endif if (pmap == kernel_pmap) panic("pmap_destroy: kernel_pmap!"); @@ -1711,7 +1723,7 @@ pmap_page_protect(pa, prot) #ifdef PMAP_DEBUG if (pmap_debug & PMD_PROTECT) - printf("pmap_page_protect(%x, %x)\n", pa, prot); + printf("pmap_page_protect(%lx, %x)\n", pa, prot); #endif switch (prot) { case VM_PROT_ALL: @@ -1757,16 +1769,17 @@ pmap_remove_range_mmu(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { - int old_ctx, i; pmeg_t pmegp; vm_offset_t va; int pte, sme; +#ifdef HAVECACHE int flush_by_page = 0; +#endif #ifdef PMAP_DEBUG if ((pmap_debug & PMD_REMOVE) || ((sva <= pmap_db_watchva && eva > pmap_db_watchva))) - printf("pmap_remove_range_mmu(%x, %x, %x)\n", pmap, sva, eva); + printf("pmap_remove_range_mmu(%p, %lx, %lx)\n", pmap, sva, eva); #endif /* Interrupt level handled by caller. */ @@ -1841,7 +1854,7 @@ pmap_remove_range_mmu(pmap, sva, eva) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (rrmmu)\n", + printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (rrmmu)\n", pmap, va, pte, PG_INVAL); } #endif @@ -1855,7 +1868,7 @@ pmap_remove_range_mmu(pmap, sva, eva) if (is_pmeg_wired(pmegp)) { #ifdef PMAP_DEBUG if (pmap_debug & PMD_WIRING) { - printf("pmap: removing wired pmeg: 0x%x\n", pmegp); + printf("pmap: removing wired pmeg: 0x%p\n", pmegp); Debugger(); /* XXX */ } #endif /* PMAP_DEBUG */ @@ -1894,7 +1907,7 @@ pmap_remove_range_noctx(pmap, sva, eva) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_REMOVE) || ((sva <= pmap_db_watchva && eva > pmap_db_watchva))) - printf("pmap_remove_range_noctx(%x, %x, %x)\n", pmap, sva, eva); + printf("pmap_remove_range_noctx(%p, %lx, %lx)\n", pmap, sva, eva); #endif /* Interrupt level handled by caller. */ @@ -1922,7 +1935,7 @@ pmap_remove_range_noctx(pmap, sva, eva) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (rrncx)\n", + printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (rrncx)\n", pmap, va, pte, PG_INVAL); } #endif @@ -1947,7 +1960,7 @@ pmap_remove_range(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { - int c, s, sme; + int s, sme; int old_ctx; boolean_t in_ctx; @@ -2026,7 +2039,7 @@ pmap_remove(pmap, sva, eva) sva = VM_MIN_KERNEL_ADDRESS; if (eva > DVMA_SPACE_END) { #ifdef PMAP_DEBUG - printf("pmap_remove: eva=0x%x\n", eva); + printf("pmap_remove: eva=0x%lx\n", eva); Debugger(); #endif eva = DVMA_SPACE_END; @@ -2054,7 +2067,7 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte) boolean_t wired; int new_pte; { - int s, i, c; + int s; int sme, old_pte; int nflags, do_pv; vm_offset_t seg_va; @@ -2084,7 +2097,7 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte) #ifdef PMAP_DEBUG if (va < virtual_avail) { - printf("pmap_enter_kernel: va=0x%x < virtual_avail\n", va); + printf("pmap_enter_kernel: va=0x%lx < virtual_avail\n", va); Debugger(); } #endif @@ -2112,12 +2125,13 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte) set_segmap_allctx(va, sme); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pmap: set_segmap pmap=%x va=%x sme=%x (ek1)\n", + printf("pmap: set_segmap pmap=%p va=%lx 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; } @@ -2190,7 +2204,7 @@ pmap_enter_kernel(va, pa, prot, wired, new_pte) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (ek)\n", + printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (ek)\n", kernel_pmap, va, old_pte, new_pte); } #endif @@ -2228,7 +2242,7 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) */ if (wired && (pmap_debug & PMD_WIRING)) { printf("pmap_enter_user: attempt to wire user page, ignored\n"); - printf("pmap=0x%x va=0x%x pa=0x%x\n", pmap, va, pa); + printf("pmap=%p va=0x%lx pa=0x%lx\n", pmap, va, pa); } #endif #ifdef DIAGNOSTIC @@ -2289,12 +2303,13 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) set_segmap(va, sme); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pmap: set_segmap pmap=%x va=%x sme=%x (eu1)\n", + printf("pmap: set_segmap pmap=%p va=%lx 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; } @@ -2318,7 +2333,7 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) set_segmap(va, sme); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SEGMAP) { - printf("pmap: set_segmap pmap=%x va=%x sme=%x (eu2)\n", + printf("pmap: set_segmap pmap=%p va=%lx sme=%x (eu2)\n", pmap, seg_va, sme); } #endif @@ -2386,7 +2401,7 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) } #ifdef PMAP_DEBUG if ((pmap_debug & PMD_SETPTE) || (va == pmap_db_watchva)) { - printf("pmap: set_pte pmap=%x va=%x old=%x new=%x (eu)\n", + printf("pmap: set_pte pmap=%p va=%lx old=%x new=%x (eu)\n", pmap, va, old_pte, new_pte); } #endif @@ -2431,7 +2446,7 @@ pmap_enter(pmap, va, pa, prot, wired) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_ENTER) || (va == pmap_db_watchva)) - printf("pmap_enter(%x, %x, %x, %x, %x)\n", + printf("pmap_enter(%p, %lx, %lx, %x, %x)\n", pmap, va, pa, prot, wired); #endif @@ -2478,7 +2493,7 @@ int pmap_fault_reload(pmap, va, ftype) vm_offset_t va; vm_prot_t ftype; { - int rv, s, pte, chkpte, sme, segnum, ctx; + int rv, s, pte, chkpte, sme, ctx; vm_offset_t seg_va; pmeg_t pmegp; @@ -2628,7 +2643,7 @@ pmap_activate(pmap, pcbp) context_allocate(pmap); #ifdef PMAP_DEBUG if (pmap_debug & PMD_SWITCH) - printf("pmap_activate(%x) takes context %d\n", + printf("pmap_activate(%p) takes context %d\n", pmap, pmap->pm_ctxnum); #endif } @@ -2637,7 +2652,7 @@ pmap_activate(pmap, pcbp) if (pmap_debug & PMD_SWITCH) { int old_ctx = get_context(); if (old_ctx != pmap->pm_ctxnum) { - printf("pmap_activate(%x) old_ctx=%d new_ctx=%d\n", + printf("pmap_activate(%p) old_ctx=%d new_ctx=%d\n", pmap, old_ctx, pmap->pm_ctxnum); } } @@ -2653,7 +2668,7 @@ pmap_deactivate(pmap, pcbp) { #ifdef PMAP_DEBUG if (pmap_debug & PMD_SWITCH) - printf("pmap_deactivate(%x, %x)\n", pmap, pcbp); + printf("pmap_deactivate(%p, %p)\n", pmap, pcbp); #endif /* Nothing to do really, and not called anyway... */ } @@ -2679,7 +2694,7 @@ pmap_change_wiring(pmap, va, wired) return; #ifdef PMAP_DEBUG if (pmap_debug & PMD_WIRING) - printf("pmap_change_wiring(pmap=0x%x, va=0x%x, wire=%d)\n", + printf("pmap_change_wiring(pmap=%p, va=0x%lx, wire=%d)\n", pmap, va, wired); #endif /* @@ -2759,7 +2774,7 @@ pmap_extract(pmap, va) } PMAP_UNLOCK(); if ((pte & PG_VALID) == 0) { - printf("pmap_extract: invalid va=0x%x\n", va); + printf("pmap_extract: invalid va=0x%lx\n", va); Debugger(); pte = 0; } @@ -2829,12 +2844,12 @@ pmap_protect_range_mmu(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { - int old_ctx, i; pmeg_t pmegp; vm_offset_t va; int pte, sme; - int nflags; +#ifdef HAVECACHE int flush_by_page = 0; +#endif /* Interrupt level handled by caller. */ CHECK_SPL(); @@ -2923,7 +2938,6 @@ pmap_protect_range_noctx(pmap, sva, eva) int pte, sme, ptenum, segnum; vm_offset_t va; pmeg_t pmegp; - int nflags; /* Interrupt level handled by caller. */ CHECK_SPL(); @@ -2964,7 +2978,7 @@ pmap_protect_range(pmap, sva, eva) pmap_t pmap; vm_offset_t sva, eva; { - int c, s, sme; + int s, sme; int old_ctx; boolean_t in_ctx; @@ -2973,7 +2987,7 @@ pmap_protect_range(pmap, sva, eva) #ifdef PMAP_DEBUG if ((pmap_debug & PMD_PROTECT) || ((sva <= pmap_db_watchva && eva > pmap_db_watchva))) - printf("pmap_protect_range(%x, %x, %x)\n", pmap, sva, eva); + printf("pmap_protect_range(%p, %lx, %lx)\n", pmap, sva, eva); #endif #ifdef DIAGNOSTIC if (sun3_trunc_seg(sva) != sun3_trunc_seg(eva-NBPG)) @@ -3034,7 +3048,7 @@ pmap_protect(pmap, sva, eva, prot) #ifdef PMAP_DEBUG if (pmap_debug & PMD_PROTECT) - printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot); + printf("pmap_protect(%p, %lx, %lx, %x)\n", pmap, sva, eva, prot); #endif if (pmap == NULL) @@ -3056,7 +3070,7 @@ pmap_protect(pmap, sva, eva, prot) sva = VM_MIN_KERNEL_ADDRESS; if (eva > DVMA_SPACE_END) { #ifdef PMAP_DEBUG - printf("pmap_protect: eva=0x%x\n", eva); + printf("pmap_protect: eva=0x%lx\n", eva); Debugger(); #endif eva = DVMA_SPACE_END; @@ -3131,7 +3145,7 @@ pmap_copy_page(src, dst) #ifdef PMAP_DEBUG if (pmap_debug & PMD_COW) - printf("pmap_copy_page: %x -> %x\n", src, dst); + printf("pmap_copy_page: %lx -> %lx\n", src, dst); #endif PMAP_LOCK(); @@ -3168,7 +3182,7 @@ pmap_zero_page(pa) #ifdef PMAP_DEBUG if (pmap_debug & PMD_COW) - printf("pmap_zero_page: %x\n", pa); + printf("pmap_zero_page: %lx\n", pa); #endif PMAP_LOCK(); @@ -3225,11 +3239,10 @@ pmap_prefer(fo, va) * Copy the kernel segmap into the passed buffer (256 bytes). */ void -pmap_get_ksegmap(vaddr) - vm_offset_t vaddr; +pmap_get_ksegmap(cp) + u_char *cp; { vm_offset_t va; - u_char *cp = (u_char*)vaddr; va = KERNBASE; do { @@ -3244,29 +3257,27 @@ pmap_get_ksegmap(vaddr) * starting at OFF in the pagemap RAM. */ void -pmap_get_pagemap(vaddr, off) - vm_offset_t vaddr; - int off; +pmap_get_pagemap(pt, off) + int *pt; + int off; { - vm_offset_t va, va_end; - int sme, sme_end; /* SegMap Entry numbers */ - int *pt; + vm_offset_t va, va_end; + int sme, sme_end; /* SegMap Entry numbers */ - pt = (int*)vaddr; /* destination */ - sme = (off >> 6); /* PMEG to start on */ - sme_end = sme + 128; /* where to stop */ - va_end = temp_seg_va + NBSG; + sme = (off >> 6); /* PMEG to start on */ + sme_end = sme + 128; /* where to stop */ + va_end = temp_seg_va + NBSG; - do { - set_segmap(temp_seg_va, sme); - va = temp_seg_va; do { - *pt++ = get_pte(va); - va += NBPG; - } while (va < va_end); - sme++; - } while (sme < sme_end); - set_segmap(temp_seg_va, SEGINV); + set_segmap(temp_seg_va, sme); + va = temp_seg_va; + do { + *pt++ = get_pte(va); + va += NBPG; + } while (va < va_end); + sme++; + } while (sme < sme_end); + set_segmap(temp_seg_va, SEGINV); } @@ -3315,9 +3326,3 @@ set_pte_pmeg(int pmeg_num, int page_num, int pte) temp_seg_inuse--; } - -/* - * Local Variables: - * tab-width: 4 - * End: - */ diff --git a/sys/arch/sun3/sun3/stub.c b/sys/arch/sun3/sun3/stub.c index bc56bc63bfc..be39f76319b 100644 --- a/sys/arch/sun3/sun3/stub.c +++ b/sys/arch/sun3/sun3/stub.c @@ -1,3 +1,4 @@ +/* $OpenBSD: stub.c,v 1.5 1997/01/16 04:04:32 kstailey Exp $ */ /* $NetBSD: stub.c,v 1.13 1996/11/20 18:57:37 gwr Exp $ */ /*- @@ -41,6 +42,10 @@ */ +#include <sys/param.h> + +#include <machine/machdep.h> + /* Called by autoconf.c */ #ifndef GENERIC void swapgeneric() {} diff --git a/sys/arch/sun3/sun3/sun3_startup.c b/sys/arch/sun3/sun3/sun3_startup.c index 08cd20db1c2..8cc867be464 100644 --- a/sys/arch/sun3/sun3/sun3_startup.c +++ b/sys/arch/sun3/sun3/sun3_startup.c @@ -1,3 +1,4 @@ +/* $OpenBSD: sun3_startup.c,v 1.8 1997/01/16 04:04:33 kstailey Exp $ */ /* $NetBSD: sun3_startup.c,v 1.55 1996/11/20 18:57:38 gwr Exp $ */ /*- @@ -46,15 +47,15 @@ #include <vm/vm.h> #include <machine/control.h> -#include <machine/cpufunc.h> #include <machine/cpu.h> #include <machine/dvma.h> -#include <machine/mon.h> -#include <machine/pte.h> -#include <machine/pmap.h> #include <machine/idprom.h> +#include <machine/machdep.h> +#include <machine/mon.h> #include <machine/obio.h> #include <machine/obmem.h> +#include <machine/pmap.h> +#include <machine/pte.h> #include "vector.h" #include "interreg.h" @@ -69,7 +70,7 @@ char *esym; /* DDB */ /* * 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 */ @@ -79,7 +80,7 @@ int cache_size; /* * Now our own stuff. */ -unsigned int *old_vector_table; +void **old_vector_table; unsigned char cpu_machine_id = 0; char *cpu_string = NULL; @@ -101,25 +102,31 @@ extern struct pcb *curpcb; extern vm_offset_t dumppage_pa; extern vm_offset_t dumppage_va; -/* - * Switch to our own interrupt vector table. - */ -static void initialize_vector_table() -{ - old_vector_table = getvbr(); - setvbr((unsigned int *) vector_table); -} +void sun3_bootstrap __P((struct exec)); + +static void sun3_mode_monitor __P((void)); +static void sun3_mode_normal __P((void)); +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_context_equiv __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)); -vm_offset_t high_segment_alloc(npages) +static void internal_configure __P((void)); + +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; @@ -142,11 +149,12 @@ static void sun3_mode_monitor() /* * Prepare for running the kernel */ -static void sun3_mode_normal() +static void +sun3_mode_normal() { /* Install our vector table and disable the NMI clock. */ set_clk_mode(0, IREG_CLOCK_ENAB_7, 0); - setvbr((unsigned int *) vector_table); + setvbr((void **) vector_table); set_clk_mode(IREG_CLOCK_ENAB_5, 0, 1); } @@ -158,7 +166,8 @@ static void sun3_mode_normal() * also put our hardware state back into place after * the PROM "c" (continue) command is given. */ -void sun3_mon_abort() +void +sun3_mon_abort() { int s = splhigh(); @@ -173,7 +182,7 @@ void sun3_mon_abort() * stuff it into the PROM interrupt vector for trap zero * and then do a trap. Needs PROM vector table in RAM. */ - old_vector_table[32] = (int)romp->abortEntry; + old_vector_table[32] = (void *)romp->abortEntry; asm(" trap #0 ; _sun3_mon_continued: nop"); /* We have continued from a PROM abort! */ @@ -182,7 +191,8 @@ void sun3_mon_abort() splx(s); } -void sun3_mon_halt() +void +sun3_mon_halt() { (void) splhigh(); sun3_mode_monitor(); @@ -190,7 +200,8 @@ void sun3_mon_halt() /*NOTREACHED*/ } -void sun3_mon_reboot(bootstring) +void +sun3_mon_reboot(bootstring) char *bootstring; { (void) splhigh(); @@ -208,9 +219,10 @@ void sun3_mon_reboot(bootstring) * is identically mapped in all contexts. The PROM can * do the job using hardware-dependent tricks... */ -void sun3_context_equiv() +static void +sun3_context_equiv() { - unsigned int i, sme; + unsigned int sme; int x; vm_offset_t va; @@ -241,9 +253,9 @@ 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) { @@ -273,6 +285,7 @@ int keep; /* true: steal, false: clear */ /* * Preserve DDB symbols and strings by setting esym. */ +void sun3_save_symtab(kehp) struct exec *kehp; /* kernel exec header */ { @@ -347,10 +360,11 @@ sun3_save_symtab(kehp) * between [ KERNBASE .. virtual_avail ] and this is * checked in trap.c for kernel-mode MMU faults. */ -void sun3_vm_init(kehp) +void +sun3_vm_init(kehp) struct exec *kehp; /* kernel exec header */ { - vm_offset_t va, eva, sva, pte, temp_seg; + vm_offset_t va, eva, pte; unsigned int sme; /* @@ -489,7 +503,7 @@ void sun3_vm_init(kehp) * segmap entries in the MMU unless pmeg_array records them. */ va = virtual_avail; - while (va < virtual_end) { + while (va < virtual_end) { set_segmap(va, SEGINV); va += NBSG; } @@ -607,7 +621,8 @@ void sun3_vm_init(kehp) */ int delay_divisor = 82; /* assume the fastest (3/260) */ -void sun3_verify_hardware() +void +sun3_verify_hardware() { unsigned char machtype; int cpu_match = 0; @@ -686,8 +701,9 @@ struct funcall_frame { int fr_arg[1]; }; /*VARARGS0*/ +void tracedump(x1) - caddr_t x1; + int x1; { struct funcall_frame *fp = (struct funcall_frame *)(&x1 - 2); u_int stackpage = ((u_int)fp) & ~PGOFSET; @@ -716,7 +732,7 @@ v_handler(addr, str) int addr; char *str; { - + switch (*str) { case '\0': /* @@ -729,36 +745,37 @@ char *str; sun3_mode_normal(); panic("zero"); /*NOTREACHED*/ - + case 4: /* old g4 */ - tracedump(); + goto do_trace; 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(); + tracedump(addr); 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); @@ -774,7 +791,8 @@ char *str; * argv[1] = options (i.e. "-ds" or NULL) * argv[2] = NULL */ -void sun3_monitor_hooks() +void +sun3_monitor_hooks() { MachMonBootParam *bpp; char **argp; @@ -829,9 +847,10 @@ void sun3_monitor_hooks() * 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() +static void +internal_configure() { - obio_init(); /* find and record PROM mappings in OBIO space */ + obio_init(); /* find and record PROM mappings in OBIO space */ /* Drivers that use those OBIO mappings from the PROM */ zs_init(); eeprom_init(); @@ -847,7 +866,6 @@ void sun3_bootstrap(keh) struct exec keh; /* kernel exec header */ { - int i; extern int cold; /* First, Clear BSS. */ @@ -871,7 +889,8 @@ sun3_bootstrap(keh) * the interrupt register and disables the NMI clock so * it will not cause "spurrious level 7" complaints. */ - initialize_vector_table(); + old_vector_table = getvbr(); + setvbr((void **) vector_table); /* Interrupts are enabled in locore.s just after this return. */ } diff --git a/sys/arch/sun3/sun3/swapgeneric.c b/sys/arch/sun3/sun3/swapgeneric.c index c1f373ec184..a7bc52873f2 100644 --- a/sys/arch/sun3/sun3/swapgeneric.c +++ b/sys/arch/sun3/sun3/swapgeneric.c @@ -1,3 +1,4 @@ +/* $OpenBSD: swapgeneric.c,v 1.5 1997/01/16 04:04:33 kstailey Exp $ */ /* $NetBSD: swapgeneric.c,v 1.14 1995/04/26 23:30:08 gwr Exp $ */ /* @@ -44,11 +45,14 @@ #include <sys/systm.h> #include <sys/reboot.h> +#include <dev/cons.h> + +#include <machine/machdep.h> #include <machine/mon.h> - + #ifdef NFSCLIENT extern char *nfsbootdevname; /* nfs_boot.c */ -#else /* NFSCLIENT */ +#endif /* NFSCLIENT */ int (*mountroot) __P((void)) = NULL; @@ -60,20 +64,60 @@ struct swdevt swdevt[] = { { NODEV, 0, 0 }, }; + +struct devspec { + int major; + int unit; + int part; + char name[4]; +}; + #define NAMESZ 16 char boot_ifname[NAMESZ]; + +static int net_mkunit __P((int, int)); +static int sd_mkunit __P((int, int)); +static int xx_mkunit __P((int, int)); +static struct genconf *gc_lookup __P((char *)); +static void gc_print_all __P((void)); +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 *)); + +/* + * Devices which MIGHT be available. + * If gc_root is NODEV, use NFS root. + */ +static struct genconf { + char gc_name[4]; + int gc_major; + int (*gc_mkunit)__P((int, int)); +} genconf[] = { + { {"ie"}, -1, net_mkunit }, + { {"le"}, -1, net_mkunit }, + { {"sd"}, 7, sd_mkunit }, + { {"xy"}, 3, xx_mkunit }, + { {"xd"}, 10, xx_mkunit }, + { {0}, }, +}; + /* * 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; @@ -84,29 +128,14 @@ static int sd_mkunit(ctlr, unit) return (target * 2 + lun); } -static int xx_mkunit(ctlr, unit) +static int +xx_mkunit(ctlr, unit) int ctlr, unit; { + return (ctlr * 2 + unit); } -/* - * Devices which MIGHT be available. - * If gc_root is NODEV, use NFS root. - */ -static struct genconf { - char gc_name[4]; - int gc_major; - 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 }, -}; - static struct genconf * gc_lookup(name) char *name; @@ -123,7 +152,8 @@ gc_lookup(name) return NULL; } -static void gc_print_all() +static void +gc_print_all() { struct genconf *gc; @@ -137,20 +167,13 @@ static void gc_print_all() } printf("\n"); } - - -struct devspec { - int major; - int unit; - int part; - char name[4]; -}; /* * 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; { @@ -194,11 +217,11 @@ static int ds_parse(ds, str) * Format a devspec into a string like: "sd0a" * Returns length of string. */ -static int ds_tostr(ds, str) +static int +ds_tostr(ds, str) struct devspec *ds; char *str; { - struct genconf *gc; int unit, part; char *p; @@ -230,7 +253,8 @@ static int ds_tostr(ds, str) * Set the devspec to the device we booted from. * (Just converts PROM boot parameters.) */ -static void ds_from_boot(ds) +static void +ds_from_boot(ds) struct devspec *ds; { MachMonBootParam *bpp; @@ -262,20 +286,19 @@ static void ds_from_boot(ds) * Fill in the devspec by asking the operator. * The ds passed may hold a default value. */ -static void ds_query(ds, what) +static void +ds_query(ds, what) struct devspec *ds; char *what; { - struct genconf *gc; - char *p; - int len, minor; + int len; char buf[64]; for (;;) { len = ds_tostr(ds, buf); printf("%s device? [%s] ", what, buf); - gets(buf); + getsn(buf, 64); if (buf[0] == '\0') return; @@ -288,7 +311,8 @@ static void ds_query(ds, what) } } -static dev_t ds_todev(ds) +static dev_t +ds_todev(ds) struct devspec *ds; { int minor; @@ -302,11 +326,9 @@ static dev_t ds_todev(ds) * Choose the root and swap device, either by asking, * (if RB_ASKNAME) or from the PROM boot parameters. */ +void swapgeneric() { - struct genconf *gc; - dev_t root, swap, dump; - int minor; struct devspec ds; char buf[NAMESZ]; @@ -363,47 +385,3 @@ swapgeneric() } dumpdev = ds_todev(&ds); } - -/* XXX - Isn't this in some common file? */ -gets(cp) - char *cp; -{ - register char *lp; - register c; - - top: - lp = cp; - for (;;) { - c = cngetc(); - switch (c) { - - case '\n': - case '\r': - cnputc('\n'); - *lp++ = '\0'; - return; - - case '\b': - case '\177': - if (lp > cp) { - lp--; - printf("\b \b"); - } - continue; - - case ('U'&037): - cnputc('\n'); - goto top; - - default: - if (c < ' ') { - cnputc('^'); - *lp++ = '^'; - c |= 0100; - } - cnputc(c); - *lp++ = c; - break; - } - } -} diff --git a/sys/arch/sun3/sun3/sys_machdep.c b/sys/arch/sun3/sun3/sys_machdep.c index 23a3ea0c7db..2b20241ca40 100644 --- a/sys/arch/sun3/sun3/sys_machdep.c +++ b/sys/arch/sun3/sun3/sys_machdep.c @@ -1,3 +1,4 @@ +/* $OpenBSD: sys_machdep.c,v 1.6 1997/01/16 04:04:34 kstailey Exp $ */ /* $NetBSD: sys_machdep.c,v 1.3 1995/10/27 15:58:23 gwr Exp $ */ /* @@ -52,9 +53,13 @@ #include <sys/syscallargs.h> +#include <machine/cpu.h> +#include <machine/machdep.h> + #ifdef TRACE int nvualarm; +int sys_vtrace(p, v, retval) struct proc *p; void *v; @@ -97,6 +102,7 @@ sys_vtrace(p, v, retval) return (0); } +void vdoualarm(arg) void *arg; { @@ -110,9 +116,6 @@ vdoualarm(arg) } #endif -#include <machine/cpu.h> -#include "cache.h" - /* XXX should be in an include file somewhere */ #define CC_PURGE 1 #define CC_FLUSH 2 @@ -121,6 +124,7 @@ vdoualarm(arg) /* XXX end should be */ /*ARGSUSED1*/ +int cachectl(req, addr, len) int req; caddr_t addr; @@ -156,10 +160,12 @@ sys_sysarch(p, v, retval) void *v; register_t *retval; { +#if 0 struct sys_sysarch_args /* { - syscallarg(int) op; + syscallarg(int) op; syscallarg(char *) parms; } */ *uap = v; +#endif - return ENOSYS; + return (ENOSYS); } diff --git a/sys/arch/sun3/sun3/trap.c b/sys/arch/sun3/sun3/trap.c index ef1f8f869df..8de38c36249 100644 --- a/sys/arch/sun3/sun3/trap.c +++ b/sys/arch/sun3/sun3/trap.c @@ -1,3 +1,4 @@ +/* $OpenBSD: trap.c,v 1.8 1997/01/16 04:04:34 kstailey Exp $ */ /* $NetBSD: trap.c,v 1.62 1996/12/17 21:35:31 gwr Exp $ */ /* @@ -63,11 +64,10 @@ #include <machine/cpu.h> #include <machine/db_machdep.h> #include <machine/endian.h> +#include <machine/machdep.h> #include <machine/psl.h> -#include <machine/trap.h> #include <machine/reg.h> - -#include "machdep.h" +#include <machine/trap.h> #ifdef COMPAT_SUNOS #include <compat/sunos/sunos_syscall.h> @@ -531,7 +531,7 @@ trap(type, code, v, frame) #endif goto copyfault; } - printf("vm_fault(%p, %x, %x, 0) -> %x\n", + printf("vm_fault(%p, %lx, %x, 0) -> %x\n", map, va, ftype, rv); goto dopanic; } diff --git a/sys/arch/sun3/sun3/vector.c b/sys/arch/sun3/sun3/vector.c index d074cc1747b..7ade6cc3f0b 100644 --- a/sys/arch/sun3/sun3/vector.c +++ b/sys/arch/sun3/sun3/vector.c @@ -1,3 +1,4 @@ +/* $OpenBSD: vector.c,v 1.6 1997/01/16 04:04:35 kstailey Exp $ */ /* $NetBSD: vector.c,v 1.15 1996/11/20 18:57:40 gwr Exp $ */ /*- @@ -50,11 +51,27 @@ 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 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)); -void _isr_autovec(); +void _isr_autovec __P((void)); #define fpbsun fpfault #define fpdz fpfault @@ -64,7 +81,7 @@ void _isr_autovec(); #define fpsnan fpfault #define fpunfl fpfault -void (*vector_table[NVECTORS])() = { +void (*vector_table[NVECTORS]) __P((void)) = { (void*)0xfffe000, /* 0: NOT USED (reset SP) */ (void*)0xfef0000, /* 1: NOT USED (reset PC) */ buserr, /* 2: bus error */ diff --git a/sys/arch/sun3/sun3/vector.h b/sys/arch/sun3/sun3/vector.h index b8e83c4bf31..8370e66e2b3 100644 --- a/sys/arch/sun3/sun3/vector.h +++ b/sys/arch/sun3/sun3/vector.h @@ -1,3 +1,4 @@ +/* $OpenBSD: vector.h,v 1.5 1997/01/16 04:04:36 kstailey Exp $ */ /* $NetBSD: vector.h,v 1.10 1996/11/20 18:57:40 gwr Exp $ */ /*- @@ -40,4 +41,6 @@ #define AUTOVEC_BASE 0x18 -extern void (*vector_table[])(); +extern void (*vector_table[]) __P((void)); + +void badtrap __P((void)); diff --git a/sys/arch/sun3/sun3/vm_machdep.c b/sys/arch/sun3/sun3/vm_machdep.c index b6d2fcbdc2f..94823f93e91 100644 --- a/sys/arch/sun3/sun3/vm_machdep.c +++ b/sys/arch/sun3/sun3/vm_machdep.c @@ -1,8 +1,9 @@ +/* $OpenBSD: vm_machdep.c,v 1.6 1997/01/16 04:04:36 kstailey 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. @@ -46,6 +47,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> +#include <sys/ptrace.h> #include <sys/malloc.h> #include <sys/buf.h> #include <sys/vnode.h> @@ -58,13 +60,10 @@ /* #include <vm/vm_map.h> */ #include <machine/cpu.h> -#include <machine/reg.h> -#include <machine/pte.h> +#include <machine/machdep.h> #include <machine/pmap.h> - -#include "cache.h" - -extern int fpu_type; +#include <machine/pte.h> +#include <machine/reg.h> /* @@ -77,25 +76,26 @@ void cpu_fork(p1, p2) register struct proc *p1, *p2; { - register struct pcb *pcb2 = &p2->p_addr->u_pcb; + register struct pcb *p1pcb = &p1->p_addr->u_pcb; + register struct pcb *p2pcb = &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) */ - savectx(curproc->p_addr); + if (p1 == curproc) + savectx(p1pcb); /* 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(&p1->p_addr->u_pcb, pcb2, sizeof(*pcb2)); + bcopy(p1pcb, p2pcb, sizeof(*p2pcb)); /* Child can start with low IPL (XXX - right?) */ - pcb2->pcb_ps = PSL_LOWIPL; + p2pcb->pcb_ps = PSL_LOWIPL; /* * Our cpu_switch MUST always call PMAP_ACTIVATE on a @@ -121,7 +121,7 @@ cpu_fork(p1, p2) */ p2sf = (struct switchframe *)p2tf - 1; p2sf->sf_pc = (u_int)proc_do_uret; - pcb2->pcb_regs[11] = (int)p2sf; /* SSP */ + p2pcb->pcb_regs[11] = (int)p2sf; /* SSP */ /* * This will "push a call" to an arbitrary kernel function @@ -158,8 +158,6 @@ cpu_set_kpc(proc, func) void (*func)(struct proc *); { struct pcb *pcbp; - struct switchframe *sf; - extern void proc_trampoline(); struct ksigframe { struct switchframe sf; void (*func)(struct proc *); @@ -235,7 +233,6 @@ cpu_coredump(p, vp, cred, chdr) struct md_core md_core; struct coreseg cseg; int error; - register i; /* XXX: Make sure savectx() was done? */ |