diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-07-13 07:21:56 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-07-13 07:21:56 +0000 |
commit | d7ffaecd740c32cef0ebbbaea5593643078aba02 (patch) | |
tree | 27cb45830a154edb57affcc84c535e25d5138e8a /sys/arch/hp300/stand | |
parent | 49b0ac5cb535a1d7ce8d971defd3a1f7800a0d20 (diff) |
APCI support and new CPU configuration from NetBSD.
Fix all of the include refs.
Bump version number to 2.1.
Diffstat (limited to 'sys/arch/hp300/stand')
26 files changed, 402 insertions, 207 deletions
diff --git a/sys/arch/hp300/stand/Makefile b/sys/arch/hp300/stand/Makefile index e1577c7f2c2..d20ea626bf6 100644 --- a/sys/arch/hp300/stand/Makefile +++ b/sys/arch/hp300/stand/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 1997/04/21 07:37:36 downsj Exp $ +# $OpenBSD: Makefile,v 1.11 1997/07/13 07:21:43 downsj Exp $ # $NetBSD: Makefile,v 1.22 1996/10/18 06:03:25 thorpej Exp $ # @(#)Makefile 8.1 (Berkeley) 6/10/93 @@ -10,14 +10,14 @@ NOMAN= noman # RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long RELOC= FFF00000 -CONS= -DDCACONSOLE -DITECONSOLE -DDCMCONSOLE +CONS= -DDCACONSOLE -DITECONSOLE -DDCMCONSOLE -DAPCICONSOLE CONS+= -DHIL_KEYBOARD -DUK_KEYBOARD -DDOMAIN_KEYBOARD -DEFS= -DSTANDALONE -DCOMPAT_NOLABEL ${CONS} -Dhp300 # -DROMPRF +DEFS= -DSTANDALONE ${CONS} -Dhp300 #DEFS+= -DNETIF_DEBUG -DRPC_DEBUG -DNFS_DEBUG -DRARP_DEBUG -DNET_DEBUG #DEFS+= -DLE_DEBUG -CFLAGS= -O3 ${INCPATH} ${DEFS} +CFLAGS= -O3 -msoft-float ${INCPATH} ${DEFS} -SRCS= autoconf.c cons.c ct.c dca.c dcm.c devopen.c dnkbd.c fhpib.c \ +SRCS= apci.c autoconf.c cons.c ct.c dca.c dcm.c devopen.c dnkbd.c fhpib.c \ hd.c hil.c hpib.c if_le.c ite.c ite_dv.c ite_gb.c ite_rb.c \ ite_subr.c ite_tc.c ite_hy.c kbd.c kbdconf.c kbdvar.h machdep.c \ nhpib.c prf.c scsi.c sd.c version.c @@ -51,11 +51,9 @@ all: ${ALL} ${BOOTS}: ${LIBS} -# depend on DEFS +# depend on CFLAGS -devopen.o machdep.o srt0.o: Makefile -cons.o dca.o hil.o: Makefile -ite.o ite_subr.o ite_dv.o ite_gb.o ite_hy.o ite_rb.o ite_tc.o: Makefile +${OBJS}: Makefile # startups diff --git a/sys/arch/hp300/stand/apci.c b/sys/arch/hp300/stand/apci.c new file mode 100644 index 00000000000..5de5a32b831 --- /dev/null +++ b/sys/arch/hp300/stand/apci.c @@ -0,0 +1,166 @@ +/* $OpenBSD: apci.c,v 1.1 1997/07/13 07:21:44 downsj Exp $ */ +/* $NetBSD: apci.c,v 1.1 1997/05/12 07:41:55 thorpej Exp $ */ + +/* + * Copyright (c) 1997 Jason R. Thorpe. All rights reserved. + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)dca.c 8.1 (Berkeley) 6/10/93 + */ + +#ifdef APCICONSOLE +#include <sys/param.h> +#include <dev/cons.h> + +#include <hp300/dev/frodoreg.h> /* for APCI offsets */ +#include <hp300/dev/apcireg.h> /* for register map */ +#include <hp300/dev/dcareg.h> /* for register bits */ + +#include <hp300/stand/consdefs.h> +#include <hp300/stand/samachdep.h> + +struct apciregs *apcicnaddr = 0; + +void +apciprobe(cp) + struct consdev *cp; +{ + struct apciregs *apci = apcicnaddr = + (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1)); + struct dcadevice *dca = (struct dcadevice *)sctoaddr(9); + + cp->cn_pri = CN_DEAD; + + /* Only 400-series machines can have this. */ + switch (machineid) { + case HP_400: + case HP_425: + case HP_433: + break; + default: + return; + } + + /* Make sure there's not a DCA in the way. */ + if (badaddr((caddr_t)dca) == 0) { + switch (dca->dca_id) { + case DCAID0: + case DCAID1: + case DCAREMID0: + case DCAREMID1: + return; + } + } + +#ifdef FORCEAPCICONSOLE + cp->cn_pri = CN_REMOTE; +#else + cp->cn_pri = CN_NORMAL; +#endif + curcons_scode = -2; +} + +void +apciinit(cp) + struct consdev *cp; +{ + struct apciregs *apci = (struct apciregs *)apcicnaddr; + + /* + * The only system on which this will happen is a 425e, + * which does not currently have a framebuffer console + * driver. We use the ROM's output method to let the + * operator know we're switching to the APCI. + */ + userom = 1; + printf("Switching to APCI console.\n"); + userom = 0; + + apci->ap_cfcr = CFCR_DLAB; + apci->ap_data = APCIBRD(9600) & 0xff; + apci->ap_ier = (APCIBRD(9600) >> 8) & 0xff; + apci->ap_cfcr = CFCR_8BITS; + apci->ap_fifo = + FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1; + apci->ap_mcr = MCR_DTR | MCR_RTS; +} + +/* ARGSUSED */ +#ifndef SMALL +int +apcigetchar(dev) + dev_t dev; +{ + register struct apciregs *apci = apcicnaddr; + short stat; + int c; + + if (((stat = apci->ap_lsr) & LSR_RXRDY) == 0) + return (0); + c = apci->ap_data; + return (c); +} +#else +int +apcigetchar(dev) + dev_t dev; +{ + return (0); +} +#endif + +/* ARGSUSED */ +void +apciputchar(dev, c) + dev_t dev; + int c; +{ + struct apciregs *apci = apcicnaddr; + int timo; + short stat; + + /* wait a reasonable time for the transmitter to come ready */ + timo = 50000; + while (((stat = apci->ap_lsr) & LSR_TXRDY) == 0 && --timo) + ; + apci->ap_data = c; + /* wait for this transmission to complete */ + timo = 1000000; + while (((stat = apci->ap_lsr) & LSR_TXRDY) == 0 && --timo) + ; +} +#endif diff --git a/sys/arch/hp300/stand/clock.c b/sys/arch/hp300/stand/clock.c index d987f920cf6..2be64952c9b 100644 --- a/sys/arch/hp300/stand/clock.c +++ b/sys/arch/hp300/stand/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.2 1997/01/17 08:32:39 downsj Exp $ */ +/* $OpenBSD: clock.c,v 1.3 1997/07/13 07:21:44 downsj Exp $ */ /* $NetBSD: clock.c,v 1.3 1995/02/20 00:12:09 mycroft Exp $ */ /* @@ -44,7 +44,9 @@ */ #include <sys/param.h> -#include "samachdep.h" + +#include <hp300/stand/samachdep.h> + #include <hp300/dev/hilreg.h> #include <hp300/hp300/clockreg.h> diff --git a/sys/arch/hp300/stand/conf.c b/sys/arch/hp300/stand/conf.c index e7d9a194787..e34b4351e51 100644 --- a/sys/arch/hp300/stand/conf.c +++ b/sys/arch/hp300/stand/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.3 1997/02/03 07:19:03 downsj Exp $ */ +/* $OpenBSD: conf.c,v 1.4 1997/07/13 07:21:45 downsj Exp $ */ /* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */ /* @@ -38,8 +38,9 @@ #include <sys/param.h> -#include "stand.h" -#include "samachdep.h" +#include <lib/libsa/stand.h> + +#include <hp300/stand/samachdep.h> #include <sys/socket.h> #include <net/if.h> @@ -47,9 +48,9 @@ #include <netinet/if_ether.h> #include <netinet/in_systm.h> -#include "nfs.h" -#include "rawfs.h" -#include "ufs.h" +#include <lib/libsa/nfs.h> +#include <hp300/stand/rawfs.h> +#include <lib/libsa/ufs.h> int debug = 0; /* XXX */ diff --git a/sys/arch/hp300/stand/cons.c b/sys/arch/hp300/stand/cons.c index ba5de8b79fd..20b0d32232f 100644 --- a/sys/arch/hp300/stand/cons.c +++ b/sys/arch/hp300/stand/cons.c @@ -1,5 +1,5 @@ -/* $OpenBSD: cons.c,v 1.2 1997/01/17 08:32:40 downsj Exp $ */ -/* $NetBSD: cons.c,v 1.9 1995/10/04 06:54:42 thorpej Exp $ */ +/* $OpenBSD: cons.c,v 1.3 1997/07/13 07:21:45 downsj Exp $ */ +/* $NetBSD: cons.c,v 1.2 1997/05/12 07:44:53 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -56,6 +56,9 @@ struct consdev constab[] = { #ifdef DCACONSOLE { dcaprobe, dcainit, dcagetchar, dcaputchar }, #endif +#ifdef APCICONSOLE + { apciprobe, apciinit, apcigetchar, apciputchar }, +#endif #ifdef DCMCONSOLE { dcmprobe, dcminit, dcmgetchar, dcmputchar }, #endif @@ -89,10 +92,16 @@ cninit() noconsole = 0; #if 0 printf("console: "); - if (cons_scode == -1) + switch (cons_scode) { + case -2: + printf("apci\n"); + break; + case -1: printf("internal grf\n"); - else + break; + default: printf("scode %d\n", cons_scode); + } #endif } } @@ -113,14 +122,9 @@ cnputc(c) { /* Note: the dev_t arguments are not used! */ -#ifdef ROMPRF - extern int userom; - if (userom) romputchar(c); - else -#endif - if (cn_tab) + else if (cn_tab) (*cn_tab->cn_putc)(0, c); return (0); diff --git a/sys/arch/hp300/stand/consdefs.h b/sys/arch/hp300/stand/consdefs.h index a1c7912afe3..1fc385cdadd 100644 --- a/sys/arch/hp300/stand/consdefs.h +++ b/sys/arch/hp300/stand/consdefs.h @@ -1,5 +1,5 @@ -/* $OpenBSD: consdefs.h,v 1.2 1997/01/17 08:32:41 downsj Exp $ */ -/* $NetBSD: consdefs.h,v 1.3 1995/10/04 06:54:43 thorpej Exp $ */ +/* $OpenBSD: consdefs.h,v 1.3 1997/07/13 07:21:46 downsj Exp $ */ +/* $NetBSD: consdefs.h,v 1.2 1997/05/12 07:45:41 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -55,6 +55,12 @@ void dcainit __P((struct consdev *)); int dcagetchar __P((dev_t)); void dcaputchar __P((dev_t, int)); #endif +#ifdef APCICONSOLE +void apciprobe __P((struct consdev *)); +void apciinit __P((struct consdev *)); +int apcigetchar __P((dev_t)); +void apciputchar __P((dev_t, int)); +#endif #ifdef DCMCONSOLE void dcmprobe __P((struct consdev *)); void dcminit __P((struct consdev *)); diff --git a/sys/arch/hp300/stand/ct.c b/sys/arch/hp300/stand/ct.c index 9bf0b1ab763..b8b5acf9dd7 100644 --- a/sys/arch/hp300/stand/ct.c +++ b/sys/arch/hp300/stand/ct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct.c,v 1.2 1997/01/17 08:32:42 downsj Exp $ */ +/* $OpenBSD: ct.c,v 1.3 1997/07/13 07:21:46 downsj Exp $ */ /* $NetBSD: ct.c,v 1.9 1996/10/14 07:29:57 thorpej Exp $ */ /* @@ -43,8 +43,9 @@ #include <hp300/dev/ctreg.h> -#include "stand.h" -#include "samachdep.h" +#include <lib/libsa/stand.h> + +#include <hp300/stand/samachdep.h> struct ct_iocmd ct_ioc; struct ct_rscmd ct_rsc; diff --git a/sys/arch/hp300/stand/devopen.c b/sys/arch/hp300/stand/devopen.c index 6902bf511cb..e0b406c2397 100644 --- a/sys/arch/hp300/stand/devopen.c +++ b/sys/arch/hp300/stand/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.3 1997/02/03 07:19:04 downsj Exp $ */ +/* $OpenBSD: devopen.c,v 1.4 1997/07/13 07:21:47 downsj Exp $ */ /* $NetBSD: devopen.c,v 1.7 1996/10/14 07:31:47 thorpej Exp $ */ /*- @@ -33,8 +33,9 @@ #include <sys/param.h> #include <sys/reboot.h> -#include "stand.h" -#include "samachdep.h" +#include <lib/libsa/stand.h> + +#include <hp300/stand/samachdep.h> u_int opendev; diff --git a/sys/arch/hp300/stand/dnkbd.c b/sys/arch/hp300/stand/dnkbd.c index ebba27d2499..054a848ebf2 100644 --- a/sys/arch/hp300/stand/dnkbd.c +++ b/sys/arch/hp300/stand/dnkbd.c @@ -1,5 +1,5 @@ -/* $OpenBSD: dnkbd.c,v 1.1 1997/04/16 11:56:37 downsj Exp $ */ -/* $NetBSD: dnkbd.c,v 1.1 1997/04/14 19:03:13 thorpej Exp $ */ +/* $OpenBSD: dnkbd.c,v 1.2 1997/07/13 07:21:47 downsj Exp $ */ +/* $NetBSD: dnkbd.c,v 1.3 1997/05/12 07:47:03 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -45,11 +45,12 @@ #include <sys/param.h> +#include <hp300/dev/frodoreg.h> /* for apci offsets */ #include <hp300/dev/dcareg.h> /* for the register bit defintions */ #include <hp300/dev/apcireg.h> /* for the apci registers */ -#include "samachdep.h" -#include "kbdvar.h" +#include <hp300/stand/samachdep.h> +#include <hp300/stand/kbdvar.h> #ifndef SMALL @@ -100,7 +101,8 @@ int dnkbd_ignore; /* for ignoring mouse packets */ int dnkbd_getc() { - struct apciregs *apci = (struct apciregs *)0x41c000; /* XXX */ + struct apciregs *apci = + (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(0)); int c; /* default to `no key' */ @@ -158,12 +160,22 @@ dnkbd_init() { /* + * 400, 425, and 433 models can have a Domain keyboard. + */ + switch (machineid) { + case HP_400: + case HP_425: + case HP_433: + break; + default: + return (0); + } + + /* * Look for a Frodo utility chip. If we find one, assume there * is a Domain keyboard attached. - * - * XXX This could be improved. */ - if (badaddr(0x41c000)) + if (badaddr((caddr_t)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(0)))) return (0); /* diff --git a/sys/arch/hp300/stand/hd.c b/sys/arch/hp300/stand/hd.c index 25461390084..22f76c9c192 100644 --- a/sys/arch/hp300/stand/hd.c +++ b/sys/arch/hp300/stand/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hd.c,v 1.1 1997/02/03 07:19:06 downsj Exp $ */ +/* $OpenBSD: hd.c,v 1.2 1997/07/13 07:21:47 downsj Exp $ */ /* $NetBSD: rd.c,v 1.11 1996/12/21 21:34:40 thorpej Exp $ */ /* @@ -48,9 +48,10 @@ */ #include <sys/param.h> #include <sys/disklabel.h> -#include "stand.h" -#include "samachdep.h" +#include <lib/libsa/stand.h> + +#include <hp300/stand/samachdep.h> #include <hp300/dev/hdreg.h> struct hd_iocmd hd_ioc; @@ -196,53 +197,6 @@ hdident(ctlr, unit) return(id); } -#ifdef COMPAT_NOLABEL -int hdcyloff[][8] = { - { 1, 143, 0, 143, 0, 0, 323, 503, }, /* 7945A */ - { 1, 167, 0, 0, 0, 0, 0, 0, }, /* 9134D */ - { 0, 0, 0, 0, 0, 0, 0, 0, }, /* 9122S */ - { 0, 71, 0, 221, 292, 542, 221, 0, }, /* 7912P */ - { 1, 72, 0, 72, 362, 802, 252, 362, }, /* 7914P */ - { 1, 28, 0, 140, 167, 444, 140, 721, }, /* 7933H */ - { 1, 200, 0, 200, 0, 0, 450, 600, }, /* 9134L */ - { 1, 105, 0, 105, 380, 736, 265, 380, }, /* 7957A */ - { 1, 65, 0, 65, 257, 657, 193, 257, }, /* 7958A */ - { 1, 128, 0, 128, 518, 918, 388, 518, }, /* 7957B */ - { 1, 44, 0, 44, 174, 496, 131, 174, }, /* 7958B */ - { 1, 44, 0, 44, 218, 1022,174, 218, }, /* 7959B */ - { 1, 37, 0, 37, 183, 857, 147, 183, }, /* 2200A */ - { 1, 19, 0, 94, 112, 450, 94, 788, }, /* 2203A */ - { 1, 20, 0, 98, 117, 256, 98, 397, }, /* 7936H */ - { 1, 11, 0, 53, 63, 217, 53, 371, }, /* 7937H */ -}; - -struct hdcompatinfo { - int nbpc; - int *cyloff; -} hdcompatinfo[] = { - NHD7945ABPT*NHD7945ATRK, hdcyloff[0], - NHD9134DBPT*NHD9134DTRK, hdcyloff[1], - NHD9122SBPT*NHD9122STRK, hdcyloff[2], - NHD7912PBPT*NHD7912PTRK, hdcyloff[3], - NHD7914PBPT*NHD7914PTRK, hdcyloff[4], - NHD7958ABPT*NHD7958ATRK, hdcyloff[8], - NHD7957ABPT*NHD7957ATRK, hdcyloff[7], - NHD7933HBPT*NHD7933HTRK, hdcyloff[5], - NHD9134LBPT*NHD9134LTRK, hdcyloff[6], - NHD7936HBPT*NHD7936HTRK, hdcyloff[14], - NHD7937HBPT*NHD7937HTRK, hdcyloff[15], - NHD7914PBPT*NHD7914PTRK, hdcyloff[4], - NHD7945ABPT*NHD7945ATRK, hdcyloff[0], - NHD9122SBPT*NHD9122STRK, hdcyloff[2], - NHD7957BBPT*NHD7957BTRK, hdcyloff[9], - NHD7958BBPT*NHD7958BTRK, hdcyloff[10], - NHD7959BBPT*NHD7959BTRK, hdcyloff[11], - NHD2200ABPT*NHD2200ATRK, hdcyloff[12], - NHD2203ABPT*NHD2203ATRK, hdcyloff[13], -}; -int nhdcompatinfo = sizeof(hdcompatinfo) / sizeof(hdcompatinfo[0]); -#endif - char io_buf[MAXBSIZE]; hdgetinfo(rs) @@ -273,22 +227,10 @@ hdgetinfo(rs) if (msg) { printf("hd(%d,%d,%d): WARNING: %s, ", rs->sc_ctlr, rs->sc_unit, rs->sc_part, msg); -#ifdef COMPAT_NOLABEL - { - register struct hdcompatinfo *ci; - - printf("using old default partitioning\n"); - ci = &hdcompatinfo[rs->sc_type]; - pi->npart = 8; - for (i = 0; i < pi->npart; i++) - pi->offset[i] = ci->cyloff[i] * ci->nbpc; - } -#else printf("defining `c' partition as entire disk\n"); pi->npart = 3; pi->offset[0] = pi->offset[1] = -1; pi->offset[2] = 0; -#endif } else { pi->npart = lp->d_npartitions; for (i = 0; i < pi->npart; i++) diff --git a/sys/arch/hp300/stand/hil.c b/sys/arch/hp300/stand/hil.c index fc1383f5f2b..51338ca57fa 100644 --- a/sys/arch/hp300/stand/hil.c +++ b/sys/arch/hp300/stand/hil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hil.c,v 1.4 1997/04/16 11:56:38 downsj Exp $ */ +/* $OpenBSD: hil.c,v 1.5 1997/07/13 07:21:48 downsj Exp $ */ /* $NetBSD: hil.c,v 1.2 1997/04/14 19:00:10 thorpej Exp $ */ /* @@ -56,8 +56,8 @@ #include <hp300/dev/kbdmap.h> #include <hp300/dev/itevar.h> -#include "samachdep.h" -#include "kbdvar.h" +#include <hp300/stand/samachdep.h> +#include <hp300/stand/kbdvar.h> #ifndef SMALL diff --git a/sys/arch/hp300/stand/hpib.c b/sys/arch/hp300/stand/hpib.c index 3210482c5eb..bc916952226 100644 --- a/sys/arch/hp300/stand/hpib.c +++ b/sys/arch/hp300/stand/hpib.c @@ -1,5 +1,5 @@ -/* $OpenBSD: hpib.c,v 1.3 1997/02/03 04:48:04 downsj Exp $ */ -/* $NetBSD: hpib.c,v 1.5 1997/01/30 10:32:53 thorpej Exp $ */ +/* $OpenBSD: hpib.c,v 1.4 1997/07/13 07:21:48 downsj Exp $ */ +/* $NetBSD: hpib.c,v 1.2 1997/05/12 07:48:23 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -42,13 +42,16 @@ #include <sys/param.h> #include <sys/reboot.h> +#include <lib/libsa/stand.h> + #include <hp300/stand/device.h> #include <hp300/stand/hpibvar.h> -#include "stand.h" -#include "samachdep.h" +#include <hp300/stand/samachdep.h> + +#include <hp300/dev/dioreg.h> -int internalhpib = IIOV(0x478000); +int internalhpib = IIOV(DIO_IHPIBADDR); int fhpibppoll(), nhpibppoll(); struct hpib_softc hpib_softc[NHPIB]; diff --git a/sys/arch/hp300/stand/if_le.c b/sys/arch/hp300/stand/if_le.c index ccb5a017443..55e0e8ce427 100644 --- a/sys/arch/hp300/stand/if_le.c +++ b/sys/arch/hp300/stand/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.6 1997/02/03 04:48:05 downsj Exp $ */ +/* $OpenBSD: if_le.c,v 1.7 1997/07/13 07:21:49 downsj Exp $ */ /* $NetBSD: if_le.c,v 1.9 1997/01/30 10:32:54 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ #include <hp300/stand/device.h> #include <hp300/stand/if_lereg.h> -#include "samachdep.h" +#include <hp300/stand/samachdep.h> #ifndef NLE #define NLE 1 diff --git a/sys/arch/hp300/stand/kbd.c b/sys/arch/hp300/stand/kbd.c index 5dd8fccf18e..7c3a1061533 100644 --- a/sys/arch/hp300/stand/kbd.c +++ b/sys/arch/hp300/stand/kbd.c @@ -1,5 +1,5 @@ -/* $OpenBSD: kbd.c,v 1.1 1997/04/16 11:56:38 downsj Exp $ */ -/* $NetBSD: kbd.c,v 1.1 1997/04/14 19:00:11 thorpej Exp $ */ +/* $OpenBSD: kbd.c,v 1.2 1997/07/13 07:21:49 downsj Exp $ */ +/* $NetBSD: kbd.c,v 1.2 1997/05/12 07:51:32 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -45,8 +45,8 @@ #include <sys/param.h> -#include "samachdep.h" -#include "kbdvar.h" +#include <hp300/stand/samachdep.h> +#include <hp300/stand/kbdvar.h> #ifndef SMALL @@ -68,7 +68,16 @@ kbdnmi() if (selected_kbd != NULL) (*selected_kbd->k_nmi)(); - printf("\nboot interrupted\n"); + + /* + * This is the only reasonable thing to do, unfortunately. + * Simply restarting the boot block by frobbing the stack and + * jumping to begin: doesn't properly reset variables that + * are in the data segment. + */ + printf("\nboot interrupted, resetting...\n"); + DELAY(1000000); + call_req_reboot(); } void diff --git a/sys/arch/hp300/stand/kbdconf.c b/sys/arch/hp300/stand/kbdconf.c index 31d0531a315..f80871eaf89 100644 --- a/sys/arch/hp300/stand/kbdconf.c +++ b/sys/arch/hp300/stand/kbdconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kbdconf.c,v 1.1 1997/04/16 11:56:39 downsj Exp $ */ +/* $OpenBSD: kbdconf.c,v 1.2 1997/07/13 07:21:50 downsj Exp $ */ /* $NetBSD: kbdconf.c,v 1.1 1997/04/14 19:00:12 thorpej Exp $ */ /*- @@ -45,8 +45,8 @@ #include <sys/param.h> -#include "samachdep.h" -#include "kbdvar.h" +#include <hp300/stand/samachdep.h> +#include <hp300/stand/kbdvar.h> #ifndef SMALL diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile index a819b609bf2..865b582138b 100644 --- a/sys/arch/hp300/stand/libsa/Makefile +++ b/sys/arch/hp300/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 1997/02/18 01:07:19 downsj Exp $ +# $OpenBSD: Makefile,v 1.9 1997/07/13 07:21:55 downsj Exp $ # $NetBSD: Makefile,v 1.5 1996/06/26 17:44:42 thorpej Exp $ LIB= sa @@ -13,6 +13,7 @@ LIB= sa CFLAGS+=-Dhp300 -DSTANDALONE -DCOMPAT_UFS -DNO_LSEEK CFLAGS+=-D__INTERNAL_LIBSA_CREAD -DHEAP_LIMIT="0xffffdfff" CFLAGS+=${DEBUGFLAGS} -I${.CURDIR}/.. +CFLAGS+=-I${.CURDIR}/../.. -I${.CURDIR}/../../.. CFLAGS+=-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libsa # stand routines diff --git a/sys/arch/hp300/stand/machdep.c b/sys/arch/hp300/stand/machdep.c index f232974dcfe..2dbf83e01d0 100644 --- a/sys/arch/hp300/stand/machdep.c +++ b/sys/arch/hp300/stand/machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: machdep.c,v 1.5 1997/04/16 11:26:36 downsj Exp $ */ -/* $NetBSD: machdep.c,v 1.6 1996/10/14 07:33:46 thorpej Exp $ */ +/* $OpenBSD: machdep.c,v 1.6 1997/07/13 07:21:50 downsj Exp $ */ +/* $NetBSD: machdep.c,v 1.4 1997/06/28 07:20:25 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -44,7 +44,7 @@ */ #include <sys/param.h> -#include "samachdep.h" +#include <hp300/stand/samachdep.h> char * getmachineid() @@ -59,6 +59,8 @@ getmachineid() cp = "318/319/330"; break; case HP_340: cp = "340"; break; + case HP_345: + cp = "345"; break; case HP_350: cp = "350"; break; case HP_360: @@ -66,9 +68,13 @@ getmachineid() case HP_370: cp = "370"; break; case HP_375: - cp = "345/375/400"; break; + cp = "375"; break; case HP_380: - cp = "380/425"; break; + cp = "380"; break; + case HP_400: + cp = "400"; break; + case HP_425: + cp = "425"; break; case HP_433: cp = "433"; break; default: @@ -77,9 +83,7 @@ getmachineid() return(cp); } -#ifdef ROMPRF int userom; -#endif struct trapframe { int dregs[8]; @@ -98,9 +102,11 @@ trap(fp) if (intrap) return(0); intrap = 1; -#ifdef ROMPRF + +#if 0 userom = 1; #endif + printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n", (fp->frame>>12)&0xF, fp->frame&0xFFF, fp->sr, fp->pc); printf("dregs: %x %x %x %x %x %x %x %x\n", @@ -109,23 +115,25 @@ trap(fp) printf("aregs: %x %x %x %x %x %x %x %x\n", fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3], fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]); -#ifdef ROMPRF + +#if 0 userom = 0; #endif + intrap = 0; return(0); } -#ifdef ROMPRF -#define ROWS 46 -#define COLS 128 +#define ROWS 24 +#define COLS 80 +void romputchar(c) - register int c; + int c; { static char buf[COLS]; static int col = 0, row = 0; - register int i; + int i; switch (c) { case '\0': @@ -155,7 +163,6 @@ romputchar(c) break; } } -#endif void machdep_start(entry, howto, loadaddr, ssym, esym) @@ -170,10 +177,10 @@ machdep_start(entry, howto, loadaddr, ssym, esym) esym = (char *)round_to_size(esym - (char *)loadaddr); #undef round_to_size - asm("movl %0,d7" : : "m" (howto)); - asm("movl %0,d6" : : "m" (opendev)); - asm("movl %0,d5" : : "m" (cons_scode)); - asm("movl %0,a5" : : "a" (loadaddr)); - asm("movl %0,a4" : : "a" (esym)); + __asm __volatile ("movl %0,d7" : : "m" (howto)); + __asm __volatile ("movl %0,d6" : : "m" (opendev)); + __asm __volatile ("movl %0,d5" : : "m" (cons_scode)); + __asm __volatile ("movl %0,a5" : : "a" (loadaddr)); + __asm __volatile ("movl %0,a4" : : "a" (esym)); (*((int (*)())entry))(); } diff --git a/sys/arch/hp300/stand/mkboot.c b/sys/arch/hp300/stand/mkboot.c index d6ce986c915..90db7714824 100644 --- a/sys/arch/hp300/stand/mkboot.c +++ b/sys/arch/hp300/stand/mkboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkboot.c,v 1.2 1997/01/17 08:32:53 downsj Exp $ */ +/* $OpenBSD: mkboot.c,v 1.3 1997/07/13 07:21:50 downsj Exp $ */ /* * Copyright (c) 1990, 1993 @@ -46,14 +46,14 @@ static char copyright[] = static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90"; static char rcsid[] = "$NetBSD: mkboot.c,v 1.5 1994/10/26 07:27:45 cgd Exp $"; #endif -static char rcsid[] = "$OpenBSD: mkboot.c,v 1.2 1997/01/17 08:32:53 downsj Exp $"; +static char rcsid[] = "$OpenBSD: mkboot.c,v 1.3 1997/07/13 07:21:50 downsj Exp $"; #endif /* not lint */ #include <sys/param.h> #include <sys/file.h> #include <a.out.h> -#include "volhdr.h" +#include <hp300/stand/volhdr.h> #include <stdio.h> #include <ctype.h> diff --git a/sys/arch/hp300/stand/netio.c b/sys/arch/hp300/stand/netio.c index 14670bc2477..cb7639efae8 100644 --- a/sys/arch/hp300/stand/netio.c +++ b/sys/arch/hp300/stand/netio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netio.c,v 1.3 1997/02/03 04:48:06 downsj Exp $ */ +/* $OpenBSD: netio.c,v 1.4 1997/07/13 07:21:51 downsj Exp $ */ /* $NetBSD: netio.c,v 1.5 1997/01/30 10:32:56 thorpej Exp $ */ /* @@ -57,12 +57,12 @@ #include <netinet/if_ether.h> #include <netinet/in_systm.h> -#include "stand.h" -#include "samachdep.h" -#include "net.h" -#include "netif.h" -#include "bootparam.h" -#include "nfs.h" +#include <lib/libsa/stand.h> +#include <hp300/stand/samachdep.h> +#include <lib/libsa/net.h> +#include <lib/libsa/netif.h> +#include <lib/libsa/bootparam.h> +#include <lib/libsa/nfs.h> extern int nfs_root_node[]; /* XXX - get from nfs_mount() */ diff --git a/sys/arch/hp300/stand/rawfs.c b/sys/arch/hp300/stand/rawfs.c index 769b1fc84c2..1cde8d63d34 100644 --- a/sys/arch/hp300/stand/rawfs.c +++ b/sys/arch/hp300/stand/rawfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rawfs.c,v 1.1 1997/01/17 08:36:52 downsj Exp $ */ +/* $OpenBSD: rawfs.c,v 1.2 1997/07/13 07:21:51 downsj Exp $ */ /* $NetBSD: rawfs.c,v 1.2 1996/10/06 19:07:53 thorpej Exp $ */ /* @@ -40,8 +40,9 @@ */ #include <sys/param.h> -#include <stand.h> -#include <rawfs.h> + +#include <lib/libsa/stand.h> +#include <hp300/stand/rawfs.h> extern int debug; diff --git a/sys/arch/hp300/stand/samachdep.h b/sys/arch/hp300/stand/samachdep.h index 123278d1779..d348e0b6fc7 100644 --- a/sys/arch/hp300/stand/samachdep.h +++ b/sys/arch/hp300/stand/samachdep.h @@ -1,5 +1,5 @@ -/* $OpenBSD: samachdep.h,v 1.3 1997/02/03 07:19:09 downsj Exp $ */ -/* $NetBSD: samachdep.h,v 1.7 1996/10/14 07:34:48 thorpej Exp $ */ +/* $OpenBSD: samachdep.h,v 1.4 1997/07/13 07:21:52 downsj Exp $ */ +/* $NetBSD: samachdep.h,v 1.3 1997/05/12 07:54:45 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -37,6 +37,7 @@ */ #include <sys/types.h> +#include <machine/hp300spu.h> #define NHPIB 4 #define NSCSI 2 @@ -47,22 +48,13 @@ #define NITE 4 /* from cpu.h */ +#define INTIOBASE (0x00400000) #define IIOV(x) (x) #define DIOBASE (0x600000) #define DIOCSIZE (0x10000) #define DIOIIBASE (0x01000000) #define DIOIICSIZE (0x00400000) -#define HP_320 0 /* 16Mhz 68020+HP MMU+16K external cache */ -#define HP_330 1 /* 16Mhz 68020+68851 MMU */ -#define HP_350 2 /* 25Mhz 68020+HP MMU+32K external cache */ -#define HP_360 3 /* 25Mhz 68030 */ -#define HP_370 4 /* 33Mhz 68030+64K external cache */ -#define HP_340 5 /* 16Mhz 68030 */ -#define HP_375 6 /* 50Mhz 68030+32K external cache */ -#define HP_380 7 /* 25Mhz 68040 */ -#define HP_433 8 /* 33Mhz 68040 */ - #define MHZ_8 1 #define MHZ_16 2 #define MHZ_25 3 @@ -76,6 +68,9 @@ extern u_int opendev; extern u_int bootdev; extern char *getmachineid(); +extern int userom; +extern void romputchar __P((int)); + #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } /* bogon grfinfo structure to keep grf_softc happy */ diff --git a/sys/arch/hp300/stand/scsi.c b/sys/arch/hp300/stand/scsi.c index 72e937cb6c9..7366e73c3ac 100644 --- a/sys/arch/hp300/stand/scsi.c +++ b/sys/arch/hp300/stand/scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi.c,v 1.3 1997/02/03 04:48:07 downsj Exp $ */ +/* $OpenBSD: scsi.c,v 1.4 1997/07/13 07:21:52 downsj Exp $ */ /* $NetBSD: scsi.c,v 1.7 1997/01/30 10:32:57 thorpej Exp $ */ /* @@ -62,8 +62,9 @@ #include <hp300/stand/device.h> #include <hp300/stand/scsivar.h> -#include "stand.h" -#include "samachdep.h" +#include <lib/libsa/stand.h> + +#include <hp300/stand/samachdep.h> struct scsi_softc scsi_softc[NSCSI]; diff --git a/sys/arch/hp300/stand/sd.c b/sys/arch/hp300/stand/sd.c index e8edb1542a8..a6379338010 100644 --- a/sys/arch/hp300/stand/sd.c +++ b/sys/arch/hp300/stand/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.2 1997/01/17 08:32:59 downsj Exp $ */ +/* $OpenBSD: sd.c,v 1.3 1997/07/13 07:21:53 downsj Exp $ */ /* $NetBSD: sd.c,v 1.9 1996/12/21 21:34:41 thorpej Exp $ */ /* @@ -49,8 +49,10 @@ #include <sys/param.h> #include <sys/disklabel.h> -#include "stand.h" -#include "samachdep.h" + +#include <lib/libsa/stand.h> + +#include <hp300/stand/samachdep.h> #define _IOCTL_ #include <hp300/dev/scsireg.h> @@ -115,13 +117,6 @@ sdreset(ctlr, unit) { } -#ifdef COMPAT_NOLABEL -struct sdminilabel defaultpinfo = { - 8, - { 1024, 17408, 0, 17408, 115712, 218112, 82944, 115712 } -}; -#endif - char io_buf[MAXBSIZE]; sdgetinfo(ss) @@ -152,15 +147,10 @@ sdgetinfo(ss) if (msg) { printf("sd(%d,%d,%d): WARNING: %s, ", ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg); -#ifdef COMPAT_NOLABEL - printf("using old default partitioning\n"); - *pi = defaultpinfo; -#else printf("defining `c' partition as entire disk\n"); pi->npart = 3; pi->offset[0] = pi->offset[1] = -1; pi->offset[2] = 0; -#endif } else { pi->npart = lp->d_npartitions; for (i = 0; i < pi->npart; i++) diff --git a/sys/arch/hp300/stand/srt0.s b/sys/arch/hp300/stand/srt0.s index 54dee11a41d..d3ca9dd3e8a 100644 --- a/sys/arch/hp300/stand/srt0.s +++ b/sys/arch/hp300/stand/srt0.s @@ -1,4 +1,4 @@ -/* $OpenBSD: srt0.s,v 1.3 1997/03/21 07:16:21 downsj Exp $ */ +/* $OpenBSD: srt0.s,v 1.4 1997/07/13 07:21:53 downsj Exp $ */ /* $NetBSD: srt0.s,v 1.2 1997/03/10 08:00:47 thorpej Exp $ */ /* @@ -90,8 +90,7 @@ vecloop: movl #NMIRESET,a0 | NMI keyboard reset addr movl #nmi,a0@ | catch in reset routine /* - * Determine our CPU type and look for internal HP-IB - * (really only care about detecting 320 (no DIO-II) right now). + * Determine our SPU type and look for internal HP-IB */ lea _machineid,a0 movl #0x808,d0 @@ -101,9 +100,14 @@ vecloop: movc cacr,d0 | read it back tstl d0 | zero? jeq not68030 | yes, we have 68020/68040 + movl #0x808,d0 movc d0,cacr | clear data freeze bit again + /* + * 68030 models + */ + movl #0x80,MMUCMD | set magic cookie movl MMUCMD,d0 | read it back btst #7,d0 | cookie still on? @@ -115,14 +119,32 @@ vecloop: jeq ihpibcheck | no, a 370 movl #5,a0@ | yes, must be a 340 jra ihpibcheck + not370: movl #3,a0@ | type is at least a 360 movl #0,MMUCMD | clear magic cookie2 movl MMUCMD,d0 | read it back btst #16,d0 | still on? jeq ihpibcheck | no, a 360 - movl #6,a0@ | yes, must be a 345/375/400 + lsrl #8,d0 | save MMU ID + andl #0xff,d0 + cmpb #1,d0 | are we a 345? + jeq isa345 + cmpb #3,d0 | how about a 375? + jeq isa375 + movl #8,a0@ | must be a 400 + jra ihpibcheck +isa345: + movl #6,a0@ + jra ihpibcheck +isa375: + movl #7,a0@ jra ihpibcheck + + /* + * End of 68030 section + */ + not68030: bset #31,d0 | data cache enable bit movc d0,cacr | only exists on 68040 @@ -131,20 +153,45 @@ not68030: beq is68020 | yes, we have 68020 moveq #0,d0 | now turn it back off movec d0,cacr | before we access any data + .long 0x4e7b0004 | movc d0,itt0 .long 0x4e7b0005 | movc d0,itt1 .long 0x4e7b0006 | movc d0,dtt0 .long 0x4e7b0007 | movc d0,dtt1 .word 0xf4d8 | cinva bc + + /* + * 68040 models + */ + movl MMUCMD,d0 | get MMU register - lsrl #8,d0 | get apparent ID - cmpb #6,d0 | id == 6? - jeq is33mhz | yes, we have a 433s - movl #7,a0@ | no, we have a 380/425t + lsrl #8,d0 + andl #0xff,d0 + cmpb #5,d0 | are we a 425t? + jeq isa425 + cmpb #7,d0 | how about 425s? + jeq isa425 + cmpb #4,d0 | or a 433t? + jeq isa433 + cmpb #6,d0 | last chance... + jeq isa433 + movl #9,a0@ | guess we're a 380 jra ihpibcheck -is33mhz: - movl #8,a0@ | 433s (XXX 425s returns same ID, ugh!) +isa425: + movl #10,a0@ jra ihpibcheck +isa433: + movl #11,a0@ + jra ihpibcheck + + /* + * End 68040 section + */ + + /* + * 68020 models + */ + is68020: movl #1,a0@ | consider a 330 for now movl #1,MMUCMD | a 68020, write HP MMU location @@ -157,6 +204,11 @@ is68020: btst #7,d0 | cookie still on? jeq ihpibcheck | no, just a 320 movl #2,a0@ | yes, a 350 + + /* + * End 68020 section + */ + ihpibcheck: movl #0,MMUCMD | make sure MMU is off btst #5,SYSFLAG | do we have an internal HP-IB? @@ -250,19 +302,18 @@ Lstop: nmi: movw #18,BOOTTYPE | mark as system switch - jsr _kbdnmi | clear the interrupt - jra begin | start over + jsr _kbdnmi | clear the interrupt, and + | reset the system + stop #0 | SCREEEECH! .globl _call_req_reboot _call_req_reboot: jmp 0x1A4 | call ROM reboot function rts | XXX: just in case? -#ifdef ROMPRF .globl _romout _romout: movl sp@(4),d0 | line number movl sp@(8),a0 | string jsr 0x150 | do it rts -#endif diff --git a/sys/arch/hp300/stand/uboot.c b/sys/arch/hp300/stand/uboot.c index def37448c71..e7c60a1be6c 100644 --- a/sys/arch/hp300/stand/uboot.c +++ b/sys/arch/hp300/stand/uboot.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uboot.c,v 1.7 1997/04/16 12:38:23 downsj Exp $ */ -/* $NetBSD: uboot.c,v 1.2 1996/10/14 07:33:45 thorpej Exp $ */ +/* $OpenBSD: uboot.c,v 1.8 1997/07/13 07:21:54 downsj Exp $ */ +/* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993 @@ -40,8 +40,10 @@ #include <sys/reboot.h> #include <machine/exec.h> #include <a.out.h> -#include "stand.h" -#include "samachdep.h" + +#include <lib/libsa/stand.h> + +#include <hp300/stand/samachdep.h> /* * Boot program... bits in `howto' determine whether boot stops to diff --git a/sys/arch/hp300/stand/version.c b/sys/arch/hp300/stand/version.c index afb4723d69b..20220cc5934 100644 --- a/sys/arch/hp300/stand/version.c +++ b/sys/arch/hp300/stand/version.c @@ -1,4 +1,4 @@ -/* $OpenBSD: version.c,v 1.1 1997/04/16 12:38:23 downsj Exp $ */ +/* $OpenBSD: version.c,v 1.2 1997/07/13 07:21:54 downsj Exp $ */ /* * Record major changes in the boot code here, and increment the version @@ -7,6 +7,8 @@ /* * 2.0 INITIAL REVISION + * + * 2.1 APCI support, config changes from NetBSD. */ -const char version[] = "2.0"; +const char version[] = "2.1"; |