diff options
Diffstat (limited to 'sys/arch/sun3/dev')
35 files changed, 351 insertions, 248 deletions
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); |