diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-23 11:47:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-23 11:47:23 +0000 |
commit | aa059f11062a2b1212b0f332778781f2e673fd0b (patch) | |
tree | 291dcd4ce92b7767e0a17a3a60c3be3bce4e7773 | |
parent | cb993b71672e8d5d7a680fe314f872b0f18c42b2 (diff) |
sync to 0622
32 files changed, 296 insertions, 366 deletions
diff --git a/sys/arch/hp300/conf/DUALITY b/sys/arch/hp300/conf/DUALITY index 7cf20a396a5..ae12322cb3a 100644 --- a/sys/arch/hp300/conf/DUALITY +++ b/sys/arch/hp300/conf/DUALITY @@ -1,4 +1,4 @@ -# $NetBSD: DUALITY,v 1.18 1995/05/12 12:49:54 mycroft Exp $ +# $NetBSD: DUALITY,v 1.19 1996/05/20 18:16:42 mrg Exp $ # # DUALITY (mycroft's hp370 test machine) # @@ -45,12 +45,13 @@ options FDESC options FIFO options KERNFS #options NULLFS -#options PORTAL +#options PORTAL # portal filesystem (still experimental) options PROCFS #options UMAPFS options UNION # GNU uses setuid scripts +options SETUIDSCRIPTS options GATEWAY options INET diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC index b0c61cc733d..47138c043a0 100644 --- a/sys/arch/hp300/conf/GENERIC +++ b/sys/arch/hp300/conf/GENERIC @@ -26,6 +26,7 @@ options "COMPAT_43" # compatibility with 4.3BSD interfaces options "COMPAT_44" # compatibility with 4.4BSD binaries options "COMPAT_09" # compatibility with NetBSD 0.9 options "COMPAT_10" # compatibility with NetBSD 1.0 +options "COMPAT_M68K4K" options SYSVSHM # System V-style shared memory options SYSVSEM # System V-style semaphores options SYSVMSG # System V-style message queues diff --git a/sys/arch/hp300/conf/Makefile.hp300 b/sys/arch/hp300/conf/Makefile.hp300 index 36cfc3ce640..4456e890319 100644 --- a/sys/arch/hp300/conf/Makefile.hp300 +++ b/sys/arch/hp300/conf/Makefile.hp300 @@ -1,5 +1,4 @@ -# $OpenBSD: Makefile.hp300,v 1.6 1996/04/25 06:36:20 mickey Exp $ -# $NetBSD: Makefile.hp300,v 1.38 1996/03/01 17:03:17 scottr Exp $ +# $NetBSD: Makefile.hp300,v 1.39 1996/05/11 16:12:02 mycroft Exp $ # Makefile for NetBSD # @@ -150,7 +149,7 @@ links: SRCS= ${HP300}/hp300/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} -depend: .depend +depend:: .depend .depend: ${SRCS} assym.h param.c mkdep ${AFLAGS} ${CPPFLAGS} ${HP300}/hp300/locore.s mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} @@ -164,9 +163,7 @@ depend: .depend autoconf.o conf.o: Makefile # depend on network or filesystem configuration -uipc_domain.o uipc_proto.o vfs_conf.o: Makefile -if_tun.o if_loop.o if_ethersubr.o: Makefile -in_proto.o: Makefile +uipc_proto.o vfs_conf.o: Makefile # depend on maxusers genassym.o machdep.o: Makefile diff --git a/sys/arch/hp300/conf/files.hp300.oldconf b/sys/arch/hp300/conf/files.hp300.oldconf index a393f505edd..e2d1f5f1a27 100644 --- a/sys/arch/hp300/conf/files.hp300.oldconf +++ b/sys/arch/hp300/conf/files.hp300.oldconf @@ -1,4 +1,4 @@ -# $NetBSD: files.hp300.oldconf,v 1.25 1996/02/24 00:54:55 thorpej Exp $ +# $NetBSD: files.hp300.oldconf,v 1.26.4.1 1996/06/10 06:51:58 thorpej Exp $ # arch/hp300/hp300/autoconf.c standard arch/hp300/hp300/clock.c standard @@ -24,6 +24,7 @@ arch/hp300/dev/grf_rb.c optional grf needs-count # XXX? d-d? arch/hp300/dev/grf_tc.c optional grf needs-count # XXX? d-d? arch/hp300/dev/dcm.c optional dcm device-driver arch/hp300/dev/if_le.c optional le device-driver +dev/ic/am7990.c optional le device-driver arch/hp300/dev/dma.c standard arch/hp300/dev/hpib.c optional hpib arch/hp300/dev/fhpib.c optional hpib device-driver @@ -34,7 +35,7 @@ arch/hp300/dev/ppi.c optional ppi device-driver arch/hp300/dev/rd.c optional rd needs-count # XXX? d-d? arch/hp300/dev/rd_compat.c optional rd compat_nolabel arch/hp300/dev/scsi.c optional scsi device-driver -arch/hp300/dev/ac.c optional ac +arch/hp300/dev/ac.c optional ac needs-count # XXX? d-d? arch/hp300/dev/sd.c optional sd needs-count # XXX? d-d? arch/hp300/dev/sd_compat.c optional sd compat_nolabel arch/hp300/dev/st.c optional st needs-count # XXX? d-d? diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c index 1eeaf465165..f81f6a60d58 100644 --- a/sys/arch/hp300/dev/dca.c +++ b/sys/arch/hp300/dev/dca.c @@ -1,4 +1,4 @@ -/* $NetBSD: dca.c,v 1.23 1996/03/03 16:48:52 thorpej Exp $ */ +/* $NetBSD: dca.c,v 1.23.4.1 1996/06/06 15:39:09 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved. @@ -267,9 +267,10 @@ dcaopen(dev, flag, mode, p) dca = sc->sc_dca; - if (sc->sc_tty == NULL) + if (sc->sc_tty == NULL) { tp = sc->sc_tty = ttymalloc(); - else + tty_attach(tp); + } else tp = sc->sc_tty; tp->t_oproc = dcastart; tp->t_param = dcaparam; @@ -375,6 +376,7 @@ dcaclose(dev, flag, mode, p) splx(s); ttyclose(tp); #if 0 + tty_detach(tp); ttyfree(tp); sc->sc_tty = NULL; #endif diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c index b435a80ccb5..a124effeb8f 100644 --- a/sys/arch/hp300/dev/dcm.c +++ b/sys/arch/hp300/dev/dcm.c @@ -1,4 +1,4 @@ -/* $NetBSD: dcm.c,v 1.26 1996/03/03 16:48:54 thorpej Exp $ */ +/* $NetBSD: dcm.c,v 1.27.4.1 1996/06/06 15:39:11 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Jason R. Thorpe. All rights reserved. @@ -284,11 +284,11 @@ dcmmatch(hd) while ((dcm->dcm_ic & IC_IR) == 0) if (++timo == 20000) return (0); - DELAY(50000) /* XXX why is this needed ???? */ + DELAY(50000); /* XXX why is this needed ???? */ while ((dcm->dcm_iir & IIR_SELFT) == 0) if (++timo == 400000) return (0); - DELAY(50000) /* XXX why is this needed ???? */ + DELAY(50000); /* XXX why is this needed ???? */ if (dcm->dcm_stcon != ST_OK) { if (hd->hp_args->hw_sc != conscode) printf("dcm%d: self test failed: %x\n", @@ -418,9 +418,10 @@ dcmopen(dev, flag, mode, p) if ((sc->sc_flags & DCM_ACTIVE) == 0) return (ENXIO); - if (sc->sc_tty[port] == NULL) + if (sc->sc_tty[port] == NULL) { tp = sc->sc_tty[port] = ttymalloc(); - else + tty_attach(tp); + } else tp = sc->sc_tty[port]; tp->t_oproc = dcmstart; @@ -530,6 +531,7 @@ dcmclose(dev, flag, mode, p) splx(s); ttyclose(tp); #if 0 + tty_detach(tp); ttyfree(tp); sc->sc_tty[port] == NULL; #endif diff --git a/sys/arch/hp300/dev/fhpib.c b/sys/arch/hp300/dev/fhpib.c index a4a08f84984..1a73c0462a5 100644 --- a/sys/arch/hp300/dev/fhpib.c +++ b/sys/arch/hp300/dev/fhpib.c @@ -1,4 +1,4 @@ -/* $NetBSD: fhpib.c,v 1.9 1996/02/14 02:44:20 thorpej Exp $ */ +/* $NetBSD: fhpib.c,v 1.11 1996/05/18 23:56:59 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 diff --git a/sys/arch/hp300/dev/hil.c b/sys/arch/hp300/dev/hil.c index bf93d1eec0a..3b41473254b 100644 --- a/sys/arch/hp300/dev/hil.c +++ b/sys/arch/hp300/dev/hil.c @@ -246,7 +246,7 @@ hilclose(dev, flags, mode, p) u_char device = HILUNIT(dev); char mask, lpctrl; int s; - extern struct emul emul_native; + extern struct emul emul_netbsd; #ifdef DEBUG if (hildebug & HDB_FOLLOW) @@ -257,7 +257,7 @@ hilclose(dev, flags, mode, p) if (device && (dptr->hd_flags & HIL_PSEUDO)) return (0); - if (p && p->p_emul == &emul_native) { + if (p && p->p_emul == &emul_netbsd) { /* * If this is the loop device, * free up all queues belonging to this process. diff --git a/sys/arch/hp300/dev/hpib.c b/sys/arch/hp300/dev/hpib.c index d6da6ed7293..4d39539f24f 100644 --- a/sys/arch/hp300/dev/hpib.c +++ b/sys/arch/hp300/dev/hpib.c @@ -1,4 +1,4 @@ -/* $NetBSD: hpib.c,v 1.8 1996/02/14 02:44:28 thorpej Exp $ */ +/* $NetBSD: hpib.c,v 1.9 1996/05/17 15:09:39 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -187,7 +187,7 @@ hpibid(unit, slave) * take forever on slow CPUs. */ ohpibtimeout = hpibtimeout; - hpibtimeout = hpibidtimeout * cpuspeed; + hpibtimeout = hpibidtimeout * (cpuspeed / 8); if (hpibrecv(unit, 31, slave, &id, 2) != 2) id = 0; hpibtimeout = ohpibtimeout; diff --git a/sys/arch/hp300/dev/if_le.c b/sys/arch/hp300/dev/if_le.c index a4978ec7d8e..7c17d759f20 100644 --- a/sys/arch/hp300/dev/if_le.c +++ b/sys/arch/hp300/dev/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.29 1996/04/22 02:30:45 christos Exp $ */ +/* $NetBSD: if_le.c,v 1.31 1996/05/09 21:11:47 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -65,22 +65,19 @@ #endif #include <hp300/dev/device.h> -#include <hp300/dev/if_lereg.h> -#include <hp300/dev/if_levar.h> + #include <dev/ic/am7990reg.h> -#define LE_NEED_BUF_CONTIG #include <dev/ic/am7990var.h> +#include <hp300/dev/if_lereg.h> +#include <hp300/dev/if_levar.h> + #include "le.h" struct le_softc le_softc[NLE]; -#define LE_SOFTC(unit) &le_softc[unit] -#define LE_DELAY(x) DELAY(x) - int lematch __P((struct hp_device *)); void leattach __P((struct hp_device *)); int leintr __P((void *)); -static int hp300_leintr __P((void *)); /* machine-dependent wrapper */ struct driver ledriver = { lematch, leattach, "le", @@ -89,19 +86,16 @@ struct driver ledriver = { /* offsets for: ID, REGS, MEM, NVRAM */ int lestd[] = { 0, 0x4000, 0x8000, 0xC008 }; -integrate void -lehwinit(sc) - struct le_softc *sc; -{ -} +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)); -integrate void +hide void lewrcsr(sc, port, val) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port, val; { - register struct lereg0 *ler0 = sc->sc_r0; - register struct lereg1 *ler1 = sc->sc_r1; + register struct lereg0 *ler0 = ((struct le_softc *)sc)->sc_r0; + register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; do { ler1->ler1_rap = port; @@ -111,13 +105,13 @@ lewrcsr(sc, port, val) } while ((ler0->ler0_status & LE_ACK) == 0); } -integrate u_int16_t +hide u_int16_t lerdcsr(sc, port) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port; { - register struct lereg0 *ler0 = sc->sc_r0; - register struct lereg1 *ler1 = sc->sc_r1; + register struct lereg0 *ler0 = ((struct le_softc *)sc)->sc_r0; + register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; u_int16_t val; do { @@ -134,14 +128,14 @@ lematch(hd) struct hp_device *hd; { register struct lereg0 *ler0; - struct le_softc *sc = LE_SOFTC(hd->hp_unit); + struct le_softc *lesc = &le_softc[hd->hp_unit]; ler0 = (struct lereg0 *)(lestd[0] + (int)hd->hp_addr); if (ler0->ler0_id != LEID) return (0); hd->hp_ipl = LE_IPL(ler0->ler0_status); - sc->sc_hd = hd; + lesc->sc_hd = hd; return (1); } @@ -156,19 +150,20 @@ leattach(hd) struct hp_device *hd; { register struct lereg0 *ler0; - struct le_softc *sc = LE_SOFTC(hd->hp_unit); + struct le_softc *lesc = &le_softc[hd->hp_unit]; + struct am7990_softc *sc = &lesc->sc_am7990; char *cp; int i; - ler0 = sc->sc_r0 = (struct lereg0 *)(lestd[0] + (int)hd->hp_addr); + ler0 = lesc->sc_r0 = (struct lereg0 *)(lestd[0] + (int)hd->hp_addr); ler0->ler0_id = 0xFF; DELAY(100); /* XXXX kluge for now */ sc->sc_dev.dv_unit = hd->hp_unit; - sprintf(sc->sc_dev.dv_xname, "%s%d", ledriver.d_name, hd->hp_unit); + sprintf(sc->sc_dev.dv_xname, "%s%d", le_cd.cd_name, hd->hp_unit); - sc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)hd->hp_addr); + lesc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)hd->hp_addr); sc->sc_mem = (void *)(lestd[2] + (int)hd->hp_addr); sc->sc_conf3 = LE_C3_BSWP; sc->sc_addr = 0; @@ -191,19 +186,22 @@ leattach(hd) sc->sc_copyfrombuf = am7990_copyfrombuf_contig; sc->sc_zerobuf = am7990_zerobuf_contig; - sc->sc_arpcom.ac_if.if_name = ledriver.d_name; - leconfig(sc); + sc->sc_rdcsr = lerdcsr; + sc->sc_wrcsr = lewrcsr; + sc->sc_hwinit = NULL; + + am7990_config(sc); /* Establish the interrupt handler. */ - isrlink(hp300_leintr, sc, hd->hp_ipl, ISRPRI_NET); + isrlink(leintr, sc, hd->hp_ipl, ISRPRI_NET); ler0->ler0_status = LE_IE; } -static int -hp300_leintr(arg) +int +leintr(arg) void *arg; { - struct le_softc *sc = arg; + struct am7990_softc *sc = arg; u_int16_t isr; #ifdef USELEDS @@ -221,7 +219,5 @@ hp300_leintr(arg) ledcontrol(0, 0, LED_LANXMT); #endif /* USELEDS */ - return (leintr(sc)); + return (am7990_intr(sc)); } - -#include <dev/ic/am7990.c> diff --git a/sys/arch/hp300/dev/if_levar.h b/sys/arch/hp300/dev/if_levar.h index fd77b37ebc3..40d64ab8e1f 100644 --- a/sys/arch/hp300/dev/if_levar.h +++ b/sys/arch/hp300/dev/if_levar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_levar.h,v 1.1 1995/12/10 00:49:37 mycroft Exp $ */ +/* $NetBSD: if_levar.h,v 1.4 1996/05/07 00:58:00 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -47,36 +47,7 @@ * This structure contains the output queue for the interface, its address, ... */ struct le_softc { - struct device sc_dev; /* base structure */ - struct arpcom sc_arpcom; /* Ethernet common part */ - - void (*sc_copytodesc)(); /* Copy to descriptor */ - void (*sc_copyfromdesc)(); /* Copy from descriptor */ - - void (*sc_copytobuf)(); /* Copy to buffer */ - void (*sc_copyfrombuf)(); /* Copy from buffer */ - void (*sc_zerobuf)(); /* and Zero bytes in buffer */ - - u_int16_t sc_conf3; /* CSR3 value */ - - void *sc_mem; /* base address of RAM -- CPU's view */ - u_long sc_addr; /* base address of RAM -- LANCE's view */ - u_long sc_memsize; /* size of RAM */ - - int sc_nrbuf; /* number of receive buffers */ - int sc_ntbuf; /* number of transmit buffers */ - int sc_last_rd; - int sc_first_td, sc_last_td, sc_no_td; - - int sc_initaddr; - int sc_rmdaddr; - int sc_tmdaddr; - int sc_rbufaddr; - int sc_tbufaddr; - -#ifdef LEDEBUG - int sc_debug; -#endif + struct am7990_softc sc_am7990; /* glue to MI code */ struct hp_device *sc_hd; struct isr sc_isr; diff --git a/sys/arch/hp300/dev/ite.c b/sys/arch/hp300/dev/ite.c index 150ea8dccc0..a2416c6d8ca 100644 --- a/sys/arch/hp300/dev/ite.c +++ b/sys/arch/hp300/dev/ite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.29 1996/02/24 00:55:20 thorpej Exp $ */ +/* $NetBSD: ite.c,v 1.29.4.1 1996/06/06 15:39:12 thorpej Exp $ */ /* * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. @@ -295,9 +295,10 @@ iteopen(dev, mode, devtype, p) int error; int first = 0; - if (ip->tty == NULL) - tp = ip->tty = ttymalloc(); - else + if (ip->tty == NULL) { + tp = ip->tty = ttymalloc(); + tty_attach(tp); + } else tp = ip->tty; if ((tp->t_state&(TS_ISOPEN|TS_XCLUDE)) == (TS_ISOPEN|TS_XCLUDE) && p->p_ucred->cr_uid != 0) @@ -345,6 +346,7 @@ iteclose(dev, flag, mode, p) ttyclose(tp); iteoff(ip, 0); #if 0 + tty_detach(tp); ttyfree(tp); ip->tty = (struct tty *)0; #endif diff --git a/sys/arch/hp300/dev/nhpib.c b/sys/arch/hp300/dev/nhpib.c index 481419347fa..e1e7f7c9c70 100644 --- a/sys/arch/hp300/dev/nhpib.c +++ b/sys/arch/hp300/dev/nhpib.c @@ -1,4 +1,4 @@ -/* $NetBSD: nhpib.c,v 1.9 1996/02/14 02:44:45 thorpej Exp $ */ +/* $NetBSD: nhpib.c,v 1.11 1996/05/18 23:57:01 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 diff --git a/sys/arch/hp300/dev/rd.c b/sys/arch/hp300/dev/rd.c index 74dce8628c0..8e42519d2f5 100644 --- a/sys/arch/hp300/dev/rd.c +++ b/sys/arch/hp300/dev/rd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.20 1996/02/14 02:44:54 thorpej Exp $ */ +/* $NetBSD: rd.c,v 1.20.4.1 1996/06/06 16:22:01 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -52,7 +52,6 @@ #include <sys/systm.h> #include <sys/buf.h> #include <sys/stat.h> -#include <sys/dkstat.h> /* XXX */ #include <sys/disklabel.h> #include <sys/disk.h> #include <sys/ioctl.h> @@ -333,9 +332,6 @@ rdident(rs, hd, verbose) name[i] = (n & 0xf) + '0'; n >>= 4; } - /* use drive characteristics to calculate xfer rate */ - rs->sc_wpms = 1000000 * (desc->d_sectsize/2) / - desc->d_blocktime; } #ifdef DEBUG if (rddebug & RDB_IDENT) { @@ -514,15 +510,6 @@ rdopen(dev, flags, mode, p) if (error) return(error); } - if (rs->sc_hd->hp_dk >= 0) { - /* guess at xfer rate based on 3600 rpm (60 rps) */ - if (rs->sc_wpms == 0) - rs->sc_wpms = 60 * rs->sc_dkdev.dk_label->d_nsectors - * DEV_BSIZE / 2; - - /* XXX Support old-style instrumentation for now. */ - dk_wpms[rs->sc_hd->hp_dk] = rs->sc_wpms; - } mask = 1 << rdpart(dev); if (mode == S_IFCHR) @@ -711,12 +698,6 @@ again: if (hpibsend(hp->hp_ctlr, hp->hp_slave, C_CMD, &rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2) == sizeof(rs->sc_ioc)-2) { - /* XXX Support old-style instrumentation for now. */ - if (hp->hp_dk >= 0) { - dk_busy |= 1 << hp->hp_dk; - dk_seek[hp->hp_dk]++; - } - /* Instrumentation. */ disk_busy(&rs->sc_dkdev); rs->sc_dkdev.dk_seek++; @@ -769,13 +750,6 @@ rdgo(unit) rw = bp->b_flags & B_READ; - /* XXX Support old-style instrumentation for now. */ - if (hp->hp_dk >= 0) { - dk_busy |= 1 << hp->hp_dk; - dk_xfer[hp->hp_dk]++; - dk_wds[hp->hp_dk] += rs->sc_resid >> 6; - } - /* Instrumentation. */ disk_busy(&rs->sc_dkdev); @@ -806,10 +780,6 @@ rdintr(arg) return; } #endif - /* XXX Support old-style instrumentation for now. */ - if (hp->hp_dk >= 0) - dk_busy &= ~(1 << hp->hp_dk); - disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid)); if (rs->sc_flags & RDF_SEEK) { @@ -827,10 +797,6 @@ rdintr(arg) rdstats[unit].rdpollwaits++; #endif - /* XXX Support old-style instrumentation for now. */ - if (hp->hp_dk >= 0) - dk_busy |= 1 << hp->hp_dk; - /* Instrumentation. */ disk_busy(&rs->sc_dkdev); rs->sc_flags |= RDF_SWAIT; diff --git a/sys/arch/hp300/dev/rdvar.h b/sys/arch/hp300/dev/rdvar.h index 97c21aa9b35..d7bd8637184 100644 --- a/sys/arch/hp300/dev/rdvar.h +++ b/sys/arch/hp300/dev/rdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: rdvar.h,v 1.4 1996/01/07 22:02:16 thorpej Exp $ */ +/* $NetBSD: rdvar.h,v 1.4.4.1 1996/06/06 16:22:03 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -61,7 +61,6 @@ struct rd_softc { short sc_punit; char *sc_addr; int sc_resid; - u_int sc_wpms; struct rd_describe sc_rddesc; struct devqueue sc_dq; struct rd_iocmd sc_ioc; diff --git a/sys/arch/hp300/dev/scsi.c b/sys/arch/hp300/dev/scsi.c index 8f21b3b9846..942e4a51fe6 100644 --- a/sys/arch/hp300/dev/scsi.c +++ b/sys/arch/hp300/dev/scsi.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi.c,v 1.8 1996/02/14 02:44:59 thorpej Exp $ */ +/* $NetBSD: scsi.c,v 1.10 1996/05/18 23:57:03 thorpej Exp $ */ /* * Copyright (c) 1990, 1993 @@ -64,8 +64,8 @@ * SCSI delays * In u-seconds, primarily for state changes on the SPC. */ -#define SCSI_CMD_WAIT 1000 /* wait per step of 'immediate' cmds */ -#define SCSI_DATA_WAIT 1000 /* wait per data in/out step */ +#define SCSI_CMD_WAIT 10000 /* wait per step of 'immediate' cmds */ +#define SCSI_DATA_WAIT 10000 /* wait per data in/out step */ #define SCSI_INIT_WAIT 50000 /* wait per step (both) during init */ extern void isrlink(); @@ -112,7 +112,8 @@ u_int sgo_wait[MAXWAIT+2]; #define b_cylin b_resid static void -scsiabort(hs, hd, where) +scsiabort(target, hs, hd, where) + int target; register struct scsi_softc *hs; volatile register struct scsidevice *hd; char *where; @@ -122,9 +123,11 @@ scsiabort(hs, hd, where) int startlen; /* XXX - kludge till I understand whats *supposed* to happen */ u_char junk; - printf("%s: abort from %s: phase=0x%x, ssts=0x%x, ints=0x%x\n", - hs->sc_hc->hp_xname, where, hd->scsi_psns, hd->scsi_ssts, - hd->scsi_ints); + printf("%s: ", hs->sc_hc->hp_xname); + if (target != -1) + printf("targ %d ", target); + printf("abort from %s: phase=0x%x, ssts=0x%x, ints=0x%x\n", + where, hd->scsi_psns, hd->scsi_ssts, hd->scsi_ints); hd->scsi_ints = hd->scsi_ints; hd->scsi_csr = 0; @@ -183,7 +186,7 @@ out: if (! ((junk = hd->scsi_ints) & INTS_RESEL)) { hd->scsi_sctl |= SCTL_CTRLRST; - DELAY(1); + DELAY(2); hd->scsi_sctl &=~ SCTL_CTRLRST; hd->scsi_hconf = 0; hd->scsi_ints = hd->scsi_ints; @@ -301,7 +304,7 @@ scsiattach(hc) * XXX scale initialization wait according to CPU speed. * Should we do this for all wait? Should we do this at all? */ - scsi_init_wait *= cpuspeed; + scsi_init_wait *= (cpuspeed / 8); } void @@ -314,7 +317,7 @@ scsireset(unit) u_int i; if (hs->sc_flags & SCSI_ALIVE) - scsiabort(hs, hd, "reset"); + scsiabort(-1, hs, hd, "reset"); hd->scsi_id = 0xFF; DELAY(100); @@ -740,7 +743,7 @@ scsiicmd(hs, target, cbuf, clen, buf, len, xferphase) } } abort: - scsiabort(hs, hd, "icmd"); + scsiabort(target, hs, hd, "icmd"); out: return (hs->sc_stat[0]); } @@ -786,7 +789,7 @@ finishxfer(hs, hd, target) } hd->scsi_scmd |= SCMD_PROG_XFR; hd->scsi_sctl |= SCTL_CTRLRST; - DELAY(1); + DELAY(2); hd->scsi_sctl &=~ SCTL_CTRLRST; hd->scsi_hconf = 0; /* @@ -838,7 +841,7 @@ finishxfer(hs, hd, target) return; } abort: - scsiabort(hs, hd, "finishxfer"); + scsiabort(target, hs, hd, "finishxfer"); hs->sc_stat[0] = 0xfe; } @@ -1135,7 +1138,7 @@ out: hs->sc_flags |= SCSI_IO; return (0); abort: - scsiabort(hs, hd, "go"); + scsiabort(slave, hs, hd, "go"); hs->sc_flags &=~ SCSI_HAVEDMA; dmafree(&hs->sc_dq); return (1); @@ -1194,7 +1197,7 @@ scsiintr(arg) hd->scsi_ints = ints; hd->scsi_csr = 0; scsierror(hs, hd, ints); - scsiabort(hs, hd, "intr"); + scsiabort(dq->dq_slave, hs, hd, "intr"); if (hs->sc_flags & SCSI_IO) { hs->sc_flags &=~ (SCSI_IO|SCSI_HAVEDMA); dmafree(&hs->sc_dq); diff --git a/sys/arch/hp300/dev/sd.c b/sys/arch/hp300/dev/sd.c index 6260683c6be..75121b1b6dc 100644 --- a/sys/arch/hp300/dev/sd.c +++ b/sys/arch/hp300/dev/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.22 1996/02/14 02:45:05 thorpej Exp $ */ +/* $NetBSD: sd.c,v 1.22.4.1 1996/06/06 16:22:04 thorpej Exp $ */ /* * Copyright (c) 1990, 1993 @@ -48,7 +48,6 @@ #include <sys/systm.h> #include <sys/buf.h> #include <sys/stat.h> -#include <sys/dkstat.h> /* XXX */ #include <sys/disklabel.h> #include <sys/disk.h> #include <sys/malloc.h> @@ -313,7 +312,6 @@ sdident(sc, hd, verbose) printf("drive empty\n"); } - sc->sc_wpms = 32 * (60 * DEV_BSIZE / 2); /* XXX */ scsi_delay(0); return(inqbuf.type); failed: @@ -606,10 +604,6 @@ sdopen(dev, flags, mode, p) return(error); } - /* XXX Support old-style instrumentation for now. */ - if (sc->sc_hd->hp_dk >= 0) - dk_wpms[sc->sc_hd->hp_dk] = sc->sc_wpms; - mask = 1 << sdpart(dev); if (mode == S_IFCHR) sc->sc_dkdev.dk_copenmask |= mask; @@ -999,14 +993,6 @@ sdgo(unit) #endif if (scsigo(hp->hp_ctlr, hp->hp_slave, sc->sc_punit, bp, cmd, pad) == 0) { - /* XXX Support old-style instrumentation for now. */ - if (hp->hp_dk >= 0) { - dk_busy |= 1 << hp->hp_dk; - ++dk_seek[hp->hp_dk]; - ++dk_xfer[hp->hp_dk]; - dk_wds[hp->hp_dk] += bp->b_bcount >> 6; - } - /* Instrumentation. */ disk_busy(&sc->sc_dkdev); sc->sc_dkdev.dk_seek++; /* XXX */ @@ -1041,10 +1027,6 @@ sdintr(arg, stat) return; } - /* XXX Support old-style instrumentation for now. */ - if (hp->hp_dk >= 0) - dk_busy &=~ (1 << hp->hp_dk); - disk_unbusy(&sc->sc_dkdev, (bp->b_bcount - bp->b_resid)); if (stat) { diff --git a/sys/arch/hp300/dev/sdvar.h b/sys/arch/hp300/dev/sdvar.h index e5933f53a8d..fbdf0025bb7 100644 --- a/sys/arch/hp300/dev/sdvar.h +++ b/sys/arch/hp300/dev/sdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sdvar.h,v 1.4 1996/01/07 22:02:21 thorpej Exp $ */ +/* $NetBSD: sdvar.h,v 1.4.4.1 1996/06/06 16:22:06 thorpej Exp $ */ /* * Copyright (c) 1990, 1993 @@ -52,7 +52,6 @@ struct sd_softc { int sc_blksize; /* device block size in bytes */ u_int sc_heads; /* number of heads (tracks) */ u_int sc_cyls; /* number of cylinders */ - u_int sc_wpms; /* average xfer rate in 16 bit wds/sec. */ }; /* sc_flags values */ diff --git a/sys/arch/hp300/dev/st.c b/sys/arch/hp300/dev/st.c index cf38400ab1e..f73e4c886dc 100644 --- a/sys/arch/hp300/dev/st.c +++ b/sys/arch/hp300/dev/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.14 1996/02/14 02:45:12 thorpej Exp $ */ +/* $NetBSD: st.c,v 1.14.4.1 1996/06/10 06:45:33 thorpej Exp $ */ /* * Copyright (c) 1990 University of Utah. @@ -353,7 +353,8 @@ st_inqbuf.inqbuf.qual, st_inqbuf.inqbuf.version); sc->sc_datalen[CMD_INQUIRY] = 36; sc->sc_datalen[CMD_MODE_SELECT] = 12; sc->sc_datalen[CMD_MODE_SENSE] = 12; - } else if (bcmp("Python 25501", product, 12) == 0) { + } else if (bcmp("Python 25501", product, 12) == 0 || + bcmp("Python 28849", product, 12) == 0) { sc->sc_tapeid = MT_ISPYTHON; sc->sc_datalen[CMD_REQUEST_SENSE] = 14; sc->sc_datalen[CMD_INQUIRY] = 36; diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c index e63e8d14670..2c063e27e86 100644 --- a/sys/arch/hp300/hp300/autoconf.c +++ b/sys/arch/hp300/hp300/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.18 1996/04/07 18:21:08 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.20 1996/05/18 01:39:57 thorpej Exp $ */ /* * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. @@ -59,6 +59,7 @@ #include <sys/conf.h> #include <sys/dmap.h> #include <sys/reboot.h> +#include <sys/device.h> #include <dev/cons.h> @@ -79,7 +80,6 @@ * the machine. */ int cold; /* if 1, still working on cold-start */ -int cpuspeed = 0; /* relative cpu speed -- can be patched */ struct hp_hw sc_table[MAXCTLRS]; /* XXX must be allocated statically because of early console init */ @@ -92,6 +92,11 @@ extern char *extiobase; int acdebug = 0; #endif +#ifndef NEWCONFIG /* XXX */ +struct devicelist alldevs; +struct evcntlist allevents; +#endif + /* * Determine mass storage and memory configuration for a machine. */ @@ -1195,6 +1200,8 @@ setroot() void config_init() { - /* Stub, so kernel will link. */ + + TAILQ_INIT(&alldevs); + TAILQ_INIT(&allevents); } #endif diff --git a/sys/arch/hp300/hp300/clock.c b/sys/arch/hp300/hp300/clock.c index 5de1834f2d1..09615a6e7a7 100644 --- a/sys/arch/hp300/hp300/clock.c +++ b/sys/arch/hp300/hp300/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.13 1994/12/29 03:48:38 mycroft Exp $ */ +/* $NetBSD: clock.c,v 1.14 1996/05/18 23:30:12 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -52,12 +52,13 @@ #include <sys/param.h> #include <sys/kernel.h> -#include <hp300/dev/hilreg.h> -#include <hp300/hp300/clockreg.h> #include <machine/psl.h> #include <machine/cpu.h> +#include <hp300/dev/hilreg.h> +#include <hp300/hp300/clockreg.h> + #ifdef GPROF #include <sys/gmon.h> #endif @@ -87,6 +88,8 @@ u_char bbc_registers[13]; u_char write_bbc_reg(), read_bbc_reg(); struct hil_dev *bbcaddr = NULL; +void hp300_calibrate_delay __P((void)); + /* * Machine-dependent clock routines. * @@ -101,9 +104,80 @@ struct hil_dev *bbcaddr = NULL; #define COUNTS_PER_SEC (1000000 / CLK_RESOLUTION) /* + * Calibrate the delay constant, based on Chuck Cranor's + * mvme68k delay calibration algorithm. + */ +void +hp300_calibrate_delay() +{ + extern int delay_divisor; + volatile struct clkreg *clk; + volatile u_char csr; + int intvl; + + clkstd[0] = IIOV(0x5F8000); /* XXX yuck */ + clk = (volatile struct clkreg *)clkstd[0]; + + /* + * Calibrate delay() using the 4 usec counter. + * We adjust delay_divisor until we get the result we want. + * We assume we've been called at splhigh(). + */ + for (delay_divisor = 140; delay_divisor > 1; delay_divisor--) { + /* Reset clock chip */ + clk->clk_cr2 = CLK_CR1; + clk->clk_cr1 = CLK_RESET; + + /* + * Prime the timer. We're looking for + * 10,000 usec (10ms). See interval comment + * above. + */ + intvl = (10000 / CLK_RESOLUTION) - 1; + asm volatile(" movpw %0,%1@(5)" : : "d" (intvl), "a" (clk)); + + /* Enable the timer */ + clk->clk_cr2 = CLK_CR1; + clk->clk_cr1 = CLK_IENAB; + + delay(10000); + + /* Timer1 interrupt flag high? */ + csr = clk->clk_sr; + if (csr & CLK_INT1) { + /* + * Got it. Clear interrupt and get outta here. + */ + asm volatile(" movpw %0@(5),%1" : : + "a" (clk), "d" (intvl)); + break; + } + + /* + * Nope. Poll for completion of the interval, + * clear interrupt, and try again. + */ + do { + csr = clk->clk_sr; + } while ((csr & CLK_INT1) == 0); + + asm volatile(" movpw %0@(5),%1" : : "a" (clk), "d" (intvl)); + } + + /* + * Sanity check the delay_divisor value. If we totally lost, + * assume a 50MHz CPU; + */ + if (delay_divisor == 0) + delay_divisor = 2048 / 50; + + /* Calculate CPU speed. */ + cpuspeed = 2048 / delay_divisor; +} + +/* * Set up the real-time and statistics clocks. Leave stathz 0 only if * no alternative timer is available. - * */ cpu_initclocks() { diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c index 162a4d46c84..0485a2de7a4 100644 --- a/sys/arch/hp300/hp300/conf.c +++ b/sys/arch/hp300/hp300/conf.c @@ -45,6 +45,12 @@ int ttselect __P((dev_t, int, struct proc *)); +#ifndef LKM +#define lkmenodev enodev +#else +int lkmenodev(); +#endif + #include "ct.h" bdev_decl(ct); #include "mt.h" @@ -146,14 +152,6 @@ cdev_decl(tun); #endif cdev_decl(lkm); -/* open, close, read, ioctl */ -cdev_decl(ipl); -#ifdef IPFILTER -#define NIPF 1 -#else -#define NIPF 0 -#endif - struct cdevsw cdevsw[] = { cdev_cn_init(1,cn), /* 0: virtual console */ @@ -187,7 +185,6 @@ struct cdevsw cdevsw[] = cdev_lkm_dummy(), /* 28 */ cdev_lkm_dummy(), /* 29 */ cdev_lkm_dummy(), /* 30 */ - cdev_gen_ipf(NIPF,ipl), /* 31: IP filter log */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/arch/hp300/hp300/genassym.c b/sys/arch/hp300/hp300/genassym.c index 5cd135a972e..123869881cf 100644 --- a/sys/arch/hp300/hp300/genassym.c +++ b/sys/arch/hp300/hp300/genassym.c @@ -1,4 +1,4 @@ -/* $NetBSD: genassym.c,v 1.18 1996/02/02 23:53:20 mycroft Exp $ */ +/* $NetBSD: genassym.c,v 1.19 1996/05/17 15:20:55 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -119,6 +119,22 @@ main() def("MMU_HP", MMU_HP); def("MMU_68851", MMU_68851); + /* values for machineid */ + def("HP_320", HP_320); + def("HP_330", HP_330); + def("HP_350", HP_350); + def("HP_360", HP_360); + def("HP_370", HP_370); + def("HP_340", HP_340); + def("HP_375", HP_375); + def("HP_380", HP_380); + def("HP_433", HP_433); + + /* values for ectype */ + def("EC_PHYS", EC_PHYS); + def("EC_NONE", EC_NONE); + def("EC_VIRT", EC_VIRT); + /* general constants */ def("UPAGES", UPAGES); def("USPACE", USPACE); diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s index 7b936b40c06..b6017a15ba0 100644 --- a/sys/arch/hp300/hp300/locore.s +++ b/sys/arch/hp300/hp300/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.50 1996/02/14 02:56:56 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.53 1996/05/17 16:32:28 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -42,13 +42,20 @@ * @(#)locore.s 8.6 (Berkeley) 5/27/94 */ -#include "assym.s" -#include <hp300/hp300/vectors.s> +#include "assym.h" #define MMUADDR(ar) movl _MMUbase,ar #define CLKADDR(ar) movl _CLKbase,ar /* + * This is for kvm_mkdb, and should be the address of the beginning + * of the kernel text segment (not necessarily the same as kernbase). + */ + .text + .globl _kernel_text +_kernel_text: + +/* * Temporary stack for a variety of purposes. * Try and make this the first thing is the data segment so it * is page aligned. Note that if we overflow here, we run into @@ -58,6 +65,8 @@ .space NBPG tmpstk: +#include <hp300/hp300/vectors.s> + .text /* * This is where we wind up if the kernel jumps to location 0. @@ -476,42 +485,8 @@ _trace: moveq #T_TRACE,d0 jra fault -/* - * The sigreturn() syscall comes here. It requires special handling - * because we must open a hole in the stack to fill in the (possibly much - * larger) original stack frame. - */ -sigreturn: - lea sp@(-84),sp | leave enough space for largest frame - movl sp@(84),sp@ | move up current 8 byte frame - movl sp@(88),sp@(4) - movl #84,sp@- | default: adjust by 84 bytes - moveml #0xFFFF,sp@- | save user registers - movl usp,a0 | save the user SP - movl a0,sp@(FR_SP) | in the savearea - movl #SYS_sigreturn,sp@- | push syscall number - jbsr _syscall | handle it - addql #4,sp | pop syscall# - movl sp@(FR_SP),a0 | grab and restore - movl a0,usp | user SP - lea sp@(FR_HW),a1 | pointer to HW frame - movw sp@(FR_ADJ),d0 | do we need to adjust the stack? - jeq Lsigr1 | no, just continue - moveq #92,d1 | total size - subw d0,d1 | - hole size = frame size - lea a1@(92),a0 | destination - addw d1,a1 | source - lsrw #1,d1 | convert to word count - subqw #1,d1 | minus 1 for dbf -Lsigrlp: - movw a1@-,a0@- | copy a word - dbf d1,Lsigrlp | continue - movl a0,a1 | new HW frame base -Lsigr1: - movl a1,sp@(FR_SP) | new SP value - moveml sp@+,#0x7FFF | restore user registers - movl sp@,sp | and our SP - jra rei | all done +/* Use common m68k sigreturn */ +#include <m68k/m68k/sigreturn.s> /* * Interrupt handlers. @@ -767,21 +742,21 @@ start: movl a1@(MMUCMD),d0 | read it back btst #7,d0 | still on? jeq Lisa370 | no, must be a 370 - movl #5,a0@ | yes, must be a 340 + movl #HP_340,a0@ | yes, must be a 340 jra Lstart1 Lnot370: - movl #3,a0@ | type is at least a 360 + movl #HP_360,a0@ | type is at least a 360 movl #0,a1@(MMUCMD) | clear magic cookie2 movl a1@(MMUCMD),d0 | read it back btst #16,d0 | still on? jeq Lstart1 | no, must be a 360 - movl #6,a0@ | yes, must be a 345/375 + movl #HP_375,a0@ | yes, must be a 345/375 jra Lhaspac Lisa370: - movl #4,a0@ | set to 370 + movl #HP_370,a0@ | set to 370 Lhaspac: RELOC(_ectype, a0) - movl #-1,a0@ | also has a physical address cache + movl #EC_PHYS,a0@ | also has a physical address cache jra Lstart1 Lnot68030: bset #31,d0 | data cache enable bit @@ -794,16 +769,16 @@ Lnot68030: RELOC(_mmutype, a0) movl #MMU_68040,a0@ | with a 68040 MMU RELOC(_ectype, a0) - movl #0,a0@ | and no cache (for now XXX) + movl #EC_NONE,a0@ | and no cache (for now XXX) RELOC(_machineid, a0) movl a1@(MMUCMD),d0 | read MMU register lsrl #8,d0 | get apparent ID cmpb #6,d0 | id == 6? jeq Lis33mhz | yes, we have a 433s - movl #7,a0@ | no, we have a 380/425t + movl #HP_380,a0@ | no, we have a 380/425t jra Lstart1 Lis33mhz: - movl #8,a0@ | 433s (XXX 425s returns same ID, ugh!) + movl #HP_433,a0@ | 433s (XXX 425s returns same ID, ugh!) jra Lstart1 Lis68020: movl #1,a1@(MMUCMD) | a 68020, write HP MMU location @@ -813,17 +788,21 @@ Lis68020: RELOC(_mmutype, a0) movl #MMU_68851,a0@ | no, we have PMMU RELOC(_machineid, a0) - movl #1,a0@ | and 330 CPU + movl #HP_330,a0@ | and 330 CPU jra Lstart1 Lishpmmu: RELOC(_ectype, a0) | 320 or 350 - movl #1,a0@ | both have a virtual address cache + movl #EC_VIRT,a0@ | both have a virtual address cache movl #0x80,a1@(MMUCMD) | set magic cookie movl a1@(MMUCMD),d0 | read it back btst #7,d0 | cookie still on? - jeq Lstart1 | no, just a 320 + jeq Lis320 | no, just a 320 RELOC(_machineid, a0) - movl #2,a0@ | yes, a 350 + movl #HP_350,a0@ | yes, a 350 + jra Lstart1 +Lis320: + RELOC(_machineid, a0) + movl #HP_320,a0@ Lstart1: movl #0,a1@(MMUCMD) | clear out MMU again @@ -971,7 +950,10 @@ Lfinish: orl #MMU_CEN,a0@(MMUCMD) | turn on external cache Lnocache0: /* final setup for C code */ + movl #_vectab,d0 | set Vector Base Register + movc d0,vbr jbsr _isrinit | be ready for stray ints + jbsr _hp300_calibrate_delay | calibrate delay movw #PSL_LOWIPL,sr | lower SPL movl d7,_boothowto | save reboot flags movl d6,_bootdev | and boot device @@ -1848,6 +1830,24 @@ ENTRY(_remque) movw d0,sr rts +/* + * _delay(u_int N) + * + * Delay for at least (N/256) microsecends. + * This routine depends on the variable: delay_divisor + * which should be set based on the CPU clock rate. + */ + .globl __delay +__delay: + | d0 = arg = (usecs << 8) + movl sp@(4),d0 + | d1 = delay_divisor + movl _delay_divisor,d1 +L_delay: + subl d1,d0 + jgt L_delay + rts + #ifdef FPCOPROC /* * Save and restore 68881 state. diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 216486eeafb..81ca8c003dd 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.62 1996/03/13 23:42:45 scottr Exp $ */ +/* $NetBSD: machdep.c,v 1.66 1996/05/18 23:30:09 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -134,10 +134,20 @@ int convasize; /* size of mapped console device */ int conforced; /* console has been forced */ /* + * Note that the value of delay_divisor is roughly + * 2048 / cpuspeed (where cpuspeed is in MHz) on 68020 + * and 68030 systems. See clock.c for the delay + * calibration algorithm. + */ +int cpuspeed; /* relative cpu speed; XXX skewed on 68040 */ +int delay_divisor; /* delay constant */ + +/* * Console initialization: called early on from main, * before vm init or startup. Do enough configuration * to choose and initialize a console. */ +void consinit() { extern struct map extiomap[]; @@ -151,38 +161,6 @@ consinit() conscode = 1024; /* invalid */ /* - * Set cpuspeed immediately since hp300_cninit() called routines - * might use delay. Note that we only set it if a custom value - * has not already been specified. - */ - if (cpuspeed == 0) { - switch (machineid) { - case HP_320: - case HP_330: - case HP_340: - cpuspeed = MHZ_16; - break; - case HP_350: - case HP_360: - case HP_380: - cpuspeed = MHZ_25; - break; - case HP_370: - case HP_433: - cpuspeed = MHZ_33; - break; - case HP_375: - cpuspeed = MHZ_50; - break; - default: /* assume the fastest */ - cpuspeed = MHZ_50; - break; - } - if (mmutype == MMU_68040) - cpuspeed *= 2; /* XXX */ - } - - /* * Initialize the DIO resource map. */ rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16); @@ -593,6 +571,7 @@ identifycpu() } strcat(cpu_model, ")"); printf("%s\n", cpu_model); + printf("delay constant for this cpu: %d\n", delay_divisor); /* * Now that we have told the user what they have, * let them know if that machine type isn't configured. @@ -1141,10 +1120,6 @@ boot(howto) boothowto = howto; if ((howto & RB_NOSYNC) == 0 && waittime < 0) { - extern struct proc proc0; - /* make panic at reboot go away */ - if (curproc == NULL) - curproc = &proc0; waittime = 0; vfs_shutdown(); /* @@ -1661,12 +1636,12 @@ cpu_exec_aout_makecmds(p, epp) switch (midmag) { #ifdef COMPAT_NOMID case (MID_ZERO << 16) | ZMAGIC: - error = cpu_exec_aout_prep_oldzmagic(p, epp); + error = exec_aout_prep_oldzmagic(p, epp); break; #endif #ifdef COMPAT_44 case (MID_HP300 << 16) | ZMAGIC: - error = cpu_exec_aout_prep_oldzmagic(p, epp); + error = exec_aout_prep_oldzmagic(p, epp); break; #endif default: @@ -1678,59 +1653,3 @@ cpu_exec_aout_makecmds(p, epp) return ENOEXEC; #endif } - -#if defined(COMPAT_NOMID) || defined(COMPAT_44) -/* - * cpu_exec_aout_prep_oldzmagic(): - * Prepare the vmcmds to build a vmspace for an old - * (i.e. USRTEXT == 0) binary. - * - * Cloned from exec_aout_prep_zmagic() in kern/exec_aout.c; a more verbose - * description of operation is there. - */ -int -cpu_exec_aout_prep_oldzmagic(p, epp) - struct proc *p; - struct exec_package *epp; -{ - struct exec *execp = epp->ep_hdr; - - epp->ep_taddr = 0; - epp->ep_tsize = execp->a_text; - epp->ep_daddr = epp->ep_taddr + execp->a_text; - epp->ep_dsize = execp->a_data + execp->a_bss; - epp->ep_entry = execp->a_entry; - - /* - * check if vnode is in open for writing, because we want to * demand-page out of it. if it is, don't do it, for various - * reasons - */ - if ((execp->a_text != 0 || execp->a_data != 0) && - epp->ep_vp->v_writecount != 0) { -#ifdef DIAGNOSTIC - if (epp->ep_vp->v_flag & VTEXT) - panic("exec: a VTEXT vnode has writecount != 0\n"); -#endif - return ETXTBSY; - } - epp->ep_vp->v_flag |= VTEXT; - - /* set up command for text segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_text, - epp->ep_taddr, epp->ep_vp, NBPG, /* XXX - should NBPG be CLBYTES? */ - VM_PROT_READ|VM_PROT_EXECUTE); - - /* set up command for data segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_data, - epp->ep_daddr, epp->ep_vp, - execp->a_text + NBPG, /* XXX - should NBPG be CLBYTES? */ - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - /* set up command for bss segment */ - NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss, - epp->ep_daddr + execp->a_data, NULLVP, 0, - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); - - return exec_aout_setup_stack(p, epp); -} -#endif /* COMPAT_NOMID */ diff --git a/sys/arch/hp300/hp300/vectors.s b/sys/arch/hp300/hp300/vectors.s index cc0dd5f2f3b..d3fb0afed70 100644 --- a/sys/arch/hp300/hp300/vectors.s +++ b/sys/arch/hp300/hp300/vectors.s @@ -1,4 +1,4 @@ -| $NetBSD: vectors.s,v 1.7 1996/02/14 02:57:07 thorpej Exp $ +| $NetBSD: vectors.s,v 1.9 1996/05/18 00:52:53 thorpej Exp $ | Copyright (c) 1988 University of Utah | Copyright (c) 1990, 1993 @@ -45,7 +45,8 @@ .globl _fpfline, _fpunsupp .globl _trap12 -Lvectab: + .globl _vectab +_vectab: .long 0x4ef80400 /* 0: jmp 0x400:w (unused reset SSP) */ .long 0 /* 1: NOT USED (reset PC) */ .long _buserr /* 2: bus error */ diff --git a/sys/arch/hp300/hp300/vm_machdep.c b/sys/arch/hp300/hp300/vm_machdep.c index 25000809270..38efee9b6bf 100644 --- a/sys/arch/hp300/hp300/vm_machdep.c +++ b/sys/arch/hp300/hp300/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.28 1996/02/09 16:58:40 scottr Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.30 1996/05/09 21:26:08 scottr Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -103,10 +103,10 @@ cpu_fork(p1, p2) void cpu_set_kpc(p, pc) struct proc *p; - void (*pc)(struct proc *); + void (*pc) __P((struct proc *)); { - p->p_addr->u_pcb.pcb_regs[6] = (u_long)pc; /* A2 */ + p->p_addr->u_pcb.pcb_regs[6] = (int) pc; /* A2 */ } /* diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h index d9b674e5407..0fa81ad6fdd 100644 --- a/sys/arch/hp300/include/cpu.h +++ b/sys/arch/hp300/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.16 1995/12/21 05:01:57 mycroft Exp $ */ +/* $NetBSD: cpu.h,v 1.19 1996/05/17 15:37:07 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -207,16 +207,17 @@ extern unsigned char ssir; #define EC_NONE 0 /* no external cache */ #define EC_VIRT 1 /* external virtual address cache */ -/* values for cpuspeed (not really related to clock speed due to caches) */ -#define MHZ_8 1 -#define MHZ_16 2 -#define MHZ_25 3 -#define MHZ_33 4 -#define MHZ_50 6 - #ifdef _KERNEL -extern int machineid, mmutype, ectype; +extern int machineid; /* CPU model */ +extern int mmutype; /* MMU on this host */ +extern int ectype; /* External cache type */ +extern int cpuspeed; /* CPU speed, in MHz */ + extern char *intiobase, *intiolimit; +extern void (*vectab[]) __P((void)); + +void doboot __P((void)) + __attribute__((__noreturn__)); /* what is this supposed to do? i.e. how is it different than startrtclock? */ #define enablertclock() diff --git a/sys/arch/hp300/include/exec.h b/sys/arch/hp300/include/exec.h index a82cc42dea7..5e068296ea5 100644 --- a/sys/arch/hp300/include/exec.h +++ b/sys/arch/hp300/include/exec.h @@ -46,11 +46,4 @@ struct relocation_info_m68k { }; #define relocation_info relocation_info_m68k -#define ELF_TARG_CLASS ELFCLASS32 -#define ELF_TARG_DATA ELFDATA2MSB -#define ELF_TARG_MACH EM_68K - -#define DO_AOUT /* support a.out */ -#define DO_ELF /* support ELF */ - #endif /* _MACHINE_EXEC_H_ */ diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h index b068e77e409..11d963389d1 100644 --- a/sys/arch/hp300/include/param.h +++ b/sys/arch/hp300/include/param.h @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.25 1996/03/04 05:04:23 cgd Exp $ */ +/* $NetBSD: param.h,v 1.26 1996/05/17 15:38:08 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -178,12 +178,11 @@ /* watch out for side effects */ #define splx(s) (s & PSL_IPL ? _spl(s) : spl0()) -#ifdef _KERNEL -#ifndef LOCORE -int cpuspeed; -#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } -#endif -#endif +#if defined(_KERNEL) && !defined(_LOCORE) +extern void _delay __P((u_int)); +#define delay(us) _delay((us) << 8) +#define DELAY(us) delay(us) +#endif /* _KERNEL && !_LOCORE */ #ifdef COMPAT_HPUX /* diff --git a/sys/arch/hp300/stand/itevar.h b/sys/arch/hp300/stand/itevar.h index cebbb2ec6cd..1d6fbb4c205 100644 --- a/sys/arch/hp300/stand/itevar.h +++ b/sys/arch/hp300/stand/itevar.h @@ -218,6 +218,7 @@ void rbox_putc __P((struct ite_data *, int, int, int, int)); void rbox_cursor __P((struct ite_data *, int)); void rbox_scroll __P((struct ite_data *, int, int, int, int)); +void dvbox_init __P((struct ite_data *)); void dvbox_clear __P((struct ite_data *, int, int, int, int)); void dvbox_putc __P((struct ite_data *, int, int, int, int)); void dvbox_cursor __P((struct ite_data *, int)); @@ -228,4 +229,3 @@ void hyper_clear __P((struct ite_data *, int, int, int, int)); void hyper_putc __P((struct ite_data *, int, int, int, int)); void hyper_cursor __P((struct ite_data *, int)); void hyper_scroll __P((struct ite_data *, int, int, int, int)); - diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile index 749a869c1ff..8ba5d23934c 100644 --- a/sys/arch/hp300/stand/libsa/Makefile +++ b/sys/arch/hp300/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 1995/09/02 05:04:25 thorpej Exp $ +# $NetBSD: Makefile,v 1.4 1996/01/30 19:47:32 thorpej Exp $ LIB= sa @@ -12,11 +12,11 @@ CFLAGS+=-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libsa # stand routines SRCS= alloc.c bcopy.c exit.c exec.c getfile.c gets.c globals.c \ - printf.c strerror.c + memcpy.c printf.c strerror.c # io routines -SRCS+= close.c dev.c disklabel.c ioctl.c lseek.c open.c read.c \ - stat.c write.c +SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ + open.c read.c stat.c write.c # network routines SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c |