summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hp300/stand/Makefile144
-rw-r--r--sys/arch/hp300/stand/autoconf.c34
-rw-r--r--sys/arch/hp300/stand/boot.c1
-rw-r--r--sys/arch/hp300/stand/clock.c1
-rw-r--r--sys/arch/hp300/stand/conf.c106
-rw-r--r--sys/arch/hp300/stand/cons.c1
-rw-r--r--sys/arch/hp300/stand/consdefs.h1
-rw-r--r--sys/arch/hp300/stand/ct.c50
-rw-r--r--sys/arch/hp300/stand/dca.c6
-rw-r--r--sys/arch/hp300/stand/dcm.c1
-rw-r--r--sys/arch/hp300/stand/devopen.c89
-rw-r--r--sys/arch/hp300/stand/fhpib.c1
-rw-r--r--sys/arch/hp300/stand/hil.c1
-rw-r--r--sys/arch/hp300/stand/hpib.c1
-rw-r--r--sys/arch/hp300/stand/hpibvar.h1
-rw-r--r--sys/arch/hp300/stand/if_le.c2
-rw-r--r--sys/arch/hp300/stand/if_lereg.h1
-rw-r--r--sys/arch/hp300/stand/installboot.sh1
-rw-r--r--sys/arch/hp300/stand/ite.c1
-rw-r--r--sys/arch/hp300/stand/ite_dv.c1
-rw-r--r--sys/arch/hp300/stand/ite_gb.c1
-rw-r--r--sys/arch/hp300/stand/ite_hy.c1
-rw-r--r--sys/arch/hp300/stand/ite_rb.c1
-rw-r--r--sys/arch/hp300/stand/ite_subr.c1
-rw-r--r--sys/arch/hp300/stand/ite_tc.c1
-rw-r--r--sys/arch/hp300/stand/itevar.h1
-rw-r--r--sys/arch/hp300/stand/libkern/Makefile21
-rw-r--r--sys/arch/hp300/stand/libkern/Makefile.inc23
-rw-r--r--sys/arch/hp300/stand/libsa/Makefile14
-rw-r--r--sys/arch/hp300/stand/libsa/Makefile.inc5
-rw-r--r--sys/arch/hp300/stand/machdep.c19
-rw-r--r--sys/arch/hp300/stand/mkboot.c5
-rw-r--r--sys/arch/hp300/stand/netboot.c162
-rw-r--r--sys/arch/hp300/stand/netio.c111
-rw-r--r--sys/arch/hp300/stand/nhpib.c1
-rw-r--r--sys/arch/hp300/stand/pboot.c161
-rw-r--r--sys/arch/hp300/stand/prf.c1
-rw-r--r--sys/arch/hp300/stand/rd.c37
-rw-r--r--sys/arch/hp300/stand/rominfo.h1
-rw-r--r--sys/arch/hp300/stand/samachdep.h28
-rw-r--r--sys/arch/hp300/stand/scsi.c9
-rw-r--r--sys/arch/hp300/stand/scsivar.h1
-rw-r--r--sys/arch/hp300/stand/sd.c32
-rw-r--r--sys/arch/hp300/stand/srt0.s1
-rw-r--r--sys/arch/hp300/stand/sys_inst.c589
-rw-r--r--sys/arch/hp300/stand/tgets.c1
-rw-r--r--sys/arch/hp300/stand/volhdr.h1
47 files changed, 489 insertions, 1184 deletions
diff --git a/sys/arch/hp300/stand/Makefile b/sys/arch/hp300/stand/Makefile
index ffb7b8b9c13..e653e99f6af 100644
--- a/sys/arch/hp300/stand/Makefile
+++ b/sys/arch/hp300/stand/Makefile
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.19 1996/01/15 01:41:37 thorpej Exp $
-
+# $OpenBSD: Makefile,v 1.4 1997/01/17 08:32:37 downsj Exp $
+# $NetBSD: Makefile,v 1.22 1996/10/18 06:03:25 thorpej Exp $
# @(#)Makefile 8.1 (Berkeley) 6/10/93
NOPROG= noprog
NOMAN= noman
-SUBDIR= libsa
+#SUBDIR= libkern libsa
# RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long
RELOC= FFF00000
@@ -29,17 +29,17 @@ S= ${.CURDIR}/../../..
.PATH: ${S}/stand
INCPATH=-I${.CURDIR} -I${.CURDIR}/../.. -I${S} -I${S}/lib/libsa
-### find out what to use for libkern
-KERNREL=
-.include "$S/lib/libkern/Makefile.inc"
-LIBKERN= ${KERNLIB}
+
+.include "${.CURDIR}/libkern/Makefile.inc"
+LIBKERN= ${KERN_LIB}
.include "${.CURDIR}/libsa/Makefile.inc"
LIBSA= ${SA_LIB}
LIBS= ${OBJS} libdrive.a ${LIBSA} ${LIBKERN}
-BOOTS= pboot netboot sys_inst dboot dcopy tboot tcopy cat #ls
+BOOTS= uboot.lif inst.lif
+BOOTAOUTS=uboot inst
ALL= ${BOOTS} mkboot installboot
all: ${ALL}
@@ -62,76 +62,27 @@ ite.o ite_subr.o ite_dv.o ite_gb.o ite_hy.o ite_rb.o ite_tc.o: Makefile
srt0.o: ${.CURDIR}/srt0.s
${CC} ${INCPATH} ${DEFS} -c ${.CURDIR}/srt0.s
-tpsrt0.o: ${.CURDIR}/srt0.s
- ${CC} ${INCPATH} ${DEFS} -DTP -c ${.CURDIR}/srt0.s -o $@
-
-# new boot
-pboot: srt0.o pboot.o tgets.o conf.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o pboot.o tgets.o conf.o ${LIBS} -o $@
- @size $@
- @echo $@ total size should not exceed 1044480 bytes
-
-ls: srt0.o ls.o conf.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o ls.o conf.o ${LIBS} -o $@
- @size $@
- @echo $@ total size should not exceed 1044480 bytes
-
-cat: srt0.o cat.o conf.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o cat.o conf.o ${LIBS} -o $@
- @size $@
- @echo $@ total size should not exceed 1044480 bytes
+# unified boot program (disk, network, tape)
+uboot.lif: uboot mkboot
+ ./mkboot uboot $@
-# installation
-sys_inst: srt0.o sys_inst.o clock.o instconf.o inst_netio.o tgets.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o sys_inst.o clock.o instconf.o inst_netio.o tgets.o ${LIBS} -o $@
+uboot: srt0.o uboot.o tgets.o netio.o clock.o conf.o ${LIBS}
+ ${LD} -N -T ${RELOC} -e begin srt0.o uboot.o tgets.o netio.o clock.o \
+ conf.o ${LIBS} -o $@
@size $@
@echo $@ total size should not exceed 1044480 bytes
-instconf.o: ${.CURDIR}/conf.c
- ${CC} ${CFLAGS} -DSYS_INST -c ${.CURDIR}/conf.c -o $@
-
-inst_netio.o: ${.CURDIR}/netio.c
- ${CC} ${CFLAGS} -DSYS_INST -c ${.CURDIR}/netio.c -o $@
+# miniroot installation program
+inst.lif: inst mkboot
+ ./mkboot inst $@
-# bootable from network
-
-netboot: srt0.o netboot.o clock.o netconf.o netio.o tgets.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o netboot.o clock.o netconf.o netio.o tgets.o ${LIBS} -o $@
+inst: srt0.o inst.o clock.o conf.o netio.o tgets.o ${LIBS}
+ ${LD} -N -T ${RELOC} -e begin srt0.o inst.o clock.o conf.o netio.o \
+ tgets.o ${LIBS} -o $@
@size $@
@echo $@ total size should not exceed 1044480 bytes
-netconf.o: ${.CURDIR}/conf.c
- ${CC} ${CFLAGS} -DNETBOOT -c ${.CURDIR}/conf.c -o $@
-
-# bootable from tape
-
-tboot: srt0.o tboot.o conf.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o tboot.o conf.o ${LIBS} -o $@
- @size $@
- @echo $@ total size should not exceed 1044480 bytes
-
-tboot.o: ${.CURDIR}/boot.c
- ${CC} ${CFLAGS} -DJUSTASK -c ${.CURDIR}/boot.c -o $@
-
-tcopy: tpsrt0.o copy.o conf.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin tpsrt0.o copy.o conf.o ${LIBS} -o $@
- @size $@
- @echo $@ total size should not exceed 1044480 bytes
-
-# bootable from floppy or real disks
-
-dboot: srt0.o boot.o tapeconf.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o boot.o tapeconf.o ${LIBS} -o $@
- @size $@
- @echo $@ text+data size should not exceed 57344 bytes
- @echo $@ total size should not exceed 1044480 bytes
-
-tapeconf.o: ${.CURDIR}/conf.c
- ${CC} ${CFLAGS} -DTAPEBOOT -c ${.CURDIR}/conf.c -o $@
-
-dcopy: srt0.o copy.o conf.o ${LIBS}
- ${LD} -N -T ${RELOC} -e begin srt0.o copy.o conf.o ${LIBS} -o $@
-
+# helper program ... turns OMAGIC into LIF
mkboot: ${.CURDIR}/mkboot.c
${CC} ${CFLAGS} ${.CURDIR}/mkboot.c -o $@
@@ -142,35 +93,36 @@ installboot: ${.CURDIR}/installboot.sh
# utilities
clean::
- rm -f *.o *.exe *.i errs make.out
- rm -f a.out pboot cat ls tboot tcopy
- rm -f boot[a-z]? boot[a-wyz][a-z].c conf[a-wyz][a-z].c
- rm -f core sboot
- rm -f libdrive.a mkboot dboot dcopy installboot *.lif
-
-install: mkboot installboot ${ALL}
- ./mkboot pboot bsdboot.lif
- ./mkboot netboot netboot.lif
- ./mkboot sys_inst sys_inst.lif
- ./mkboot dboot diskboot.lif
- ./mkboot tboot tcopy tapeboot.lif
- install -c -o ${BINOWN} -g ${BINGRP} -m 555 installboot \
+ rm -f *.o *.i
+ rm -f a.out ${BOOTS} ${BOOTAOUTS}
+ rm -f libdrive.a mkboot installboot
+
+install:
+ ${INSTALL} -d -m 755 -o ${BINOWN} -g ${BINGRP} \
+ ${DESTDIR}/usr/mdec/rbootd
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 installboot \
${DESTDIR}/usr/mdec
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 bsdboot.lif \
- ${DESTDIR}/usr/mdec/rdboot
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 uboot.lif \
+ ${DESTDIR}/usr/mdec
+ rm -f ${DESTDIR}/usr/mdec/rdboot
+ ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/rdboot
rm -f ${DESTDIR}/usr/mdec/bootrd
- ln ${DESTDIR}/usr/mdec/rdboot ${DESTDIR}/usr/mdec/bootrd
+ ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootrd
rm -f ${DESTDIR}/usr/mdec/sdboot
- ln ${DESTDIR}/usr/mdec/rdboot ${DESTDIR}/usr/mdec/sdboot
+ ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/sdboot
rm -f ${DESTDIR}/usr/mdec/bootsd
- ln ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/bootsd
- install -d -m 755 -o ${BINOWN} -g ${BINGRP} ${DESTDIR}/usr/mdec/rbootd
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 netboot.lif \
- ${DESTDIR}/usr/mdec/rbootd/SYS_NBOOT
- install -c -o ${BINOWN} -g ${BINGRP} -m 444 sys_inst.lif \
- ${DESTDIR}/usr/mdec/rbootd/SYS_INST
- install -c -o ${BINOWN} -g ${BINGRP} -m 644 tapeboot.lif \
- ${DESTDIR}/usr/mdec/bootct
+ ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootsd
+ rm -f ${DESTDIR}/usr/mdec/ctboot
+ ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/ctboot
+ rm -f ${DESTDIR}/usr/mdec/bootct
+ ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootct
+ rm -f ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
+ ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 inst.lif \
+ ${DESTDIR}/usr/mdec
+ rm -f ${DESTDIR}/usr/mdec/rbootd/SYS_INST
+ ln ${DESTDIR}/usr/mdec/inst.lif ${DESTDIR}/usr/mdec/rbootd/SYS_INST
+
+#obj: _SUBDIRUSE
.include <bsd.prog.mk>
-.include <bsd.subdir.mk>
diff --git a/sys/arch/hp300/stand/autoconf.c b/sys/arch/hp300/stand/autoconf.c
index 17f3c20107c..38c66dbf394 100644
--- a/sys/arch/hp300/stand/autoconf.c
+++ b/sys/arch/hp300/stand/autoconf.c
@@ -1,4 +1,5 @@
-/* $NetBSD: autoconf.c,v 1.9 1995/08/05 16:47:34 thorpej Exp $ */
+/* $OpenBSD: autoconf.c,v 1.2 1997/01/17 08:32:38 downsj Exp $ */
+/* $NetBSD: autoconf.c,v 1.11 1996/10/14 07:26:06 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -57,7 +58,9 @@
* WARNING: major numbers must match bdevsw indices in hp300/conf.c.
*/
char rom2mdev[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0-13: none */
+ 0, 0, /* 0-1: none */
+ 6, /* 2: network device; special */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3-13: none */
4, /* 14: SCSI disk */
0, /* 15: none */
2, /* 16: CS/80 device on HPIB */
@@ -70,7 +73,7 @@ int cpuspeed;
extern int internalhpib;
-#if 0
+#ifdef PRINTROMINFO
printrominfo()
{
struct rominfo *rp = (struct rominfo *)ROMADDR;
@@ -114,7 +117,7 @@ configure()
}
find_devs();
cninit();
-#if 0
+#ifdef PRINTROMINFO
printrominfo();
#endif
hpibinit();
@@ -138,19 +141,21 @@ msustobdev()
struct rominfo *rp = (struct rominfo *) ROMADDR;
u_long bdev = 0;
register struct hp_hw *hw;
- int sc;
+ int sc, type, ctlr, slave, punit;
sc = (rp->msus >> 8) & 0xFF;
for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++)
if (hw->hw_sc == sc)
break;
- bdev |= rom2mdev[(rp->msus >> 24) & 0x1F] << B_TYPESHIFT;
- bdev |= 0 << B_PARTITIONSHIFT;
- bdev |= ((rp->msus >> 16) & 0xFF) << B_UNITSHIFT;
- bdev |= (rp->msus & 0xFF) << B_CONTROLLERSHIFT;
- bdev |= (int)hw->hw_pa << B_ADAPTORSHIFT;
- bdev |= B_DEVMAGIC;
-#if 0
+
+ type = rom2mdev[(rp->msus >> 24) & 0x1F];
+ ctlr = (int)hw->hw_pa;
+ slave = (rp->msus & 0xFF);
+ punit = ((rp->msus >> 16) & 0xFF);
+
+ bdev = MAKEBOOTDEV(type, ctlr, slave, punit, 0);
+
+#ifdef PRINTROMINFO
printf("msus %x -> bdev %x\n", rp->msus, bdev);
#endif
return (bdev);
@@ -174,7 +179,7 @@ sctoaddr(sc)
* Probe all DIO select codes (0 - 32), the internal display address,
* and DIO-II select codes (132 - 256).
*
- * Note that we only care about displays, SCSIs and HP-IBs.
+ * Note that we only care about displays, LANCEs, SCSIs and HP-IBs.
*/
find_devs()
{
@@ -221,6 +226,9 @@ find_devs()
case 128: /* 98624A */
hw->hw_type = C_HPIB;
break;
+ case 21: /* LANCE */
+ hw->hw_type = D_LAN;
+ break;
case 57: /* Displays */
hw->hw_type = D_BITMAP;
hw->hw_secid = id_reg[0x15];
diff --git a/sys/arch/hp300/stand/boot.c b/sys/arch/hp300/stand/boot.c
index c35b50771d7..35750eac088 100644
--- a/sys/arch/hp300/stand/boot.c
+++ b/sys/arch/hp300/stand/boot.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: boot.c,v 1.3 1997/01/17 08:32:39 downsj Exp $ */
/* $NetBSD: boot.c,v 1.6 1995/02/21 09:06:13 mycroft Exp $ */
/*-
diff --git a/sys/arch/hp300/stand/clock.c b/sys/arch/hp300/stand/clock.c
index f637c66244a..d987f920cf6 100644
--- a/sys/arch/hp300/stand/clock.c
+++ b/sys/arch/hp300/stand/clock.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: clock.c,v 1.2 1997/01/17 08:32:39 downsj Exp $ */
/* $NetBSD: clock.c,v 1.3 1995/02/20 00:12:09 mycroft Exp $ */
/*
diff --git a/sys/arch/hp300/stand/conf.c b/sys/arch/hp300/stand/conf.c
index 6e8fb07a7df..093051b2edc 100644
--- a/sys/arch/hp300/stand/conf.c
+++ b/sys/arch/hp300/stand/conf.c
@@ -1,4 +1,5 @@
-/* $NetBSD: conf.c,v 1.10 1995/09/23 17:28:11 thorpej Exp $ */
+/* $OpenBSD: conf.c,v 1.2 1997/01/17 08:32:40 downsj Exp $ */
+/* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -38,8 +39,8 @@
#include <sys/param.h>
#include "stand.h"
+#include "samachdep.h"
-#if defined(NETBOOT) || defined(SYS_INST)
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -47,38 +48,22 @@
#include <netinet/in_systm.h>
#include "nfs.h"
-
-#endif /* NETBOOT || SYS_INST */
-
-#ifndef NETBOOT
+#include "rawfs.h"
#include "ufs.h"
-#endif /* ! NETBOOT */
int debug = 0; /* XXX */
/*
* Device configuration
*/
-#if defined(NETBOOT) || defined(SYS_INST)
int netstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
int netopen __P((struct open_file *, ...));
int netclose __P((struct open_file *));
#define netioctl noioctl
-#endif /* NETBOOT || SYS_INST */
-#ifndef NETBOOT
-/* XXX: no support for tapes in SYS_INST yet. */
-#ifdef TAPEBOOT
int ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
int ctopen __P((struct open_file *, ...));
int ctclose __P((struct open_file *));
-#else
-#define ctstrategy \
- (int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys
-#define ctopen (int (*) __P((struct open_file *, ...)))nodev
-#define ctclose (int (*) __P((struct open_file *)))nullsys
-#endif /* TAPEBOOT */
-
#define ctioctl noioctl
int rdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
@@ -96,46 +81,77 @@ int sdclose __P((struct open_file *));
#define xxopen (int (*) __P((struct open_file *, ...)))nodev
#define xxclose (int (*) __P((struct open_file *)))nullsys
-#endif /* ! NETBOOT */
-
+/*
+ * Note: "le" isn't a major offset.
+ */
struct devsw devsw[] = {
-#ifdef NETBOOT
- { "le", netstrategy, netopen, netclose, netioctl }, /*0*/
-#else
{ "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
{ "rd", rdstrategy, rdopen, rdclose, rdioctl }, /*2*/
{ "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
{ "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
-#ifdef SYS_INST
- { "le", netstrategy, netopen, netclose, netioctl },
-#endif /* SYS_INST */
-#endif /* NETBOOT */
+ { "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
+ { "le", netstrategy, netopen, netclose, netioctl },/*6*/
+};
+int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
+
+extern struct netif_driver le_driver;
+
+struct netif_driver *netif_drivers[] = {
+ &le_driver,
};
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
+int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
+
+/*
+ * Physical unit/lun detection.
+ */
+int punitzero __P((int, int, int *));
+
+int
+punitzero(ctlr, slave, punit)
+ int ctlr, slave, *punit;
+{
+
+ *punit = 0;
+ return (0);
+}
+
+extern int ctpunit __P((int, int, int *));
+#define xxpunit punitzero
+#define rdpunit punitzero
+#define sdpunit punitzero
+#define lepunit punitzero
+
+struct punitsw punitsw[] = {
+ { ctpunit },
+ { xxpunit },
+ { rdpunit },
+ { xxpunit },
+ { sdpunit },
+ { xxpunit },
+ { lepunit },
+};
+int npunit = (sizeof(punitsw) / sizeof(punitsw[0]));
/*
* Filesystem configuration
*/
-struct fs_ops file_system[] = {
-#ifndef NETBOOT
+struct fs_ops file_system_rawfs[] = {
+ { rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
+ rawfs_stat },
+};
+
+struct fs_ops file_system_ufs[] = {
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
-#endif /* ! NETBOOT */
-#if defined(NETBOOT) || defined(SYS_INST)
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
-#endif /* NETBOOT || SYS_INST */
};
-int nfsys = (sizeof(file_system) / sizeof(file_system[0]));
+struct fs_ops file_system_nfs[] = {
+ { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
+};
-#if defined(NETBOOT) || defined(SYS_INST)
-extern struct netif_driver le_driver;
+struct fs_ops file_system[1];
+int nfsys = 1; /* we always know which one we want */
-struct netif_driver *netif_drivers[] = {
- &le_driver,
-};
-int n_netif_drivers = sizeof(netif_drivers)/sizeof(netif_drivers[0]);
-#endif /* NETBOOT */
/*
* Inititalize controllers
@@ -144,11 +160,7 @@ int n_netif_drivers = sizeof(netif_drivers)/sizeof(netif_drivers[0]);
*/
void ctlrinit()
{
-#if defined(NETBOOT) || defined(SYS_INST)
leinit();
-#endif /* NETBOOT || SYS_INST */
-#ifndef NETBOOT
hpibinit();
scsiinit();
-#endif /* ! NETBOOT */
}
diff --git a/sys/arch/hp300/stand/cons.c b/sys/arch/hp300/stand/cons.c
index f35f1c2f1c4..ba5de8b79fd 100644
--- a/sys/arch/hp300/stand/cons.c
+++ b/sys/arch/hp300/stand/cons.c
@@ -1,3 +1,4 @@
+/* $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 $ */
/*
diff --git a/sys/arch/hp300/stand/consdefs.h b/sys/arch/hp300/stand/consdefs.h
index 8a71e257345..a1c7912afe3 100644
--- a/sys/arch/hp300/stand/consdefs.h
+++ b/sys/arch/hp300/stand/consdefs.h
@@ -1,3 +1,4 @@
+/* $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 $ */
/*
diff --git a/sys/arch/hp300/stand/ct.c b/sys/arch/hp300/stand/ct.c
index ff9a6f3de1c..9bf0b1ab763 100644
--- a/sys/arch/hp300/stand/ct.c
+++ b/sys/arch/hp300/stand/ct.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ct.c,v 1.7 1995/09/23 17:17:03 thorpej Exp $ */
+/* $OpenBSD: ct.c,v 1.2 1997/01/17 08:32:42 downsj Exp $ */
+/* $NetBSD: ct.c,v 1.9 1996/10/14 07:29:57 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -63,6 +64,8 @@ struct ct_softc {
#define MTFSF 10
#define MTREW 11
+char ctio_buf[MAXBSIZE];
+
struct ctinfo {
short hwid;
short punit;
@@ -86,6 +89,7 @@ ctinit(ctlr, unit)
return (0);
if (ctident(ctlr, unit) < 0)
return (0);
+ bzero(&ct_ssmc, sizeof(ct_ssmc));
ct_ssmc.unit = C_SUNIT(rs->sc_punit);
ct_ssmc.cmd = C_SSM;
ct_ssmc.fefm = FEF_MASK;
@@ -148,56 +152,79 @@ ctident(ctlr, unit)
return(id);
}
+int
+ctpunit(ctlr, slave, punit)
+ int ctlr, slave, *punit;
+{
+ register struct ct_softc *rs;
+
+ if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
+ return(EADAPT);
+ if (slave >= NCT)
+ return(ECTLR);
+ rs = &ct_softc[ctlr][slave];
+
+ if (rs->sc_alive == 0)
+ return(ENXIO);
+
+ *punit = rs->sc_punit;
+ return (0);
+}
+
ctopen(f, ctlr, unit, part)
struct open_file *f;
int ctlr, unit, part;
{
register struct ct_softc *rs;
register int skip;
+ size_t resid;
if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
return(EADAPT);
if (unit >= NCT)
return(ECTLR);
rs = &ct_softc[ctlr][unit];
+ rs->sc_blkno = 0;
rs->sc_unit = unit;
rs->sc_ctlr = ctlr;
if (rs->sc_alive == 0)
if (ctinit(ctlr, unit) == 0)
return(ENXIO);
f->f_devdata = (void *)rs;
- ctstrategy(f, MTREW);
+ ctstrategy(f->f_devdata, MTREW, 0, 0, ctio_buf, &resid);
skip = part;
while (skip--)
- ctstrategy(f, MTFSF);
+ ctstrategy(f->f_devdata, MTFSF, 0, 0, ctio_buf, &resid);
return(0);
}
ctclose(f)
struct open_file *f;
{
- ctstrategy(f, MTREW);
-}
+ size_t resid;
-char io_buf[MAXBSIZE];
+ ctstrategy(f->f_devdata, MTREW, 0, 0, ctio_buf, &resid);
+}
-ctstrategy(rs, func, dblk, size, v_buf, rsize)
- register struct ct_softc *rs;
+ctstrategy(devdata, func, dblk, size, v_buf, rsize)
+ void *devdata;
int func;
daddr_t dblk;
size_t size;
void *v_buf;
size_t *rsize;
{
+ struct ct_softc *rs = devdata;
char *buf = v_buf;
- register int ctlr = rs->sc_ctlr;
- register int unit = rs->sc_unit;
+ int ctlr = rs->sc_ctlr;
+ int unit = rs->sc_unit;
char stat;
if (size == 0 && (func == F_READ || func == F_WRITE))
return(0);
rs->sc_retry = 0;
+ bzero(&ct_ioc, sizeof(ct_ioc));
ct_ioc.unit = C_SUNIT(rs->sc_punit);
ct_ioc.saddr = C_SADDR;
ct_ioc.nop2 = C_NOP;
@@ -218,7 +245,6 @@ top:
ct_ioc.cmd = C_READ;
ct_ioc.addr = rs->sc_blkno;
ct_ioc.len = size = MAXBSIZE;
- buf = io_buf;
}
else {
ct_ioc.cmd = C_READ;
@@ -263,6 +289,8 @@ cterror(ctlr, unit)
register struct ct_softc *rs = &ct_softc[ctlr][unit];
char stat;
+ bzero(&ct_rsc, sizeof(ct_rsc));
+ bzero(&ct_stat, sizeof(ct_stat));
ct_rsc.unit = C_SUNIT(rs->sc_punit);
ct_rsc.cmd = C_STATUS;
hpibsend(ctlr, unit, C_CMD, &ct_rsc, sizeof(ct_rsc));
diff --git a/sys/arch/hp300/stand/dca.c b/sys/arch/hp300/stand/dca.c
index 7091886374d..0434fa026ee 100644
--- a/sys/arch/hp300/stand/dca.c
+++ b/sys/arch/hp300/stand/dca.c
@@ -1,4 +1,5 @@
-/* $NetBSD: dca.c,v 1.9 1996/02/26 21:51:25 thorpej Exp $ */
+/* $OpenBSD: dca.c,v 1.3 1997/01/17 08:32:42 downsj Exp $ */
+/* $NetBSD: dca.c,v 1.10 1996/10/06 01:42:48 mycroft Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -104,6 +105,9 @@ dcainit(cp)
dca->dca_data = DCABRD(9600) & 0xFF;
dca->dca_ier = DCABRD(9600) >> 8;
dca->dca_cfcr = CFCR_8BITS;
+ dca->dca_fifo =
+ FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
+ dca->dca_mcr = MCR_DTR | MCR_RTS;
}
/* ARGSUSED */
diff --git a/sys/arch/hp300/stand/dcm.c b/sys/arch/hp300/stand/dcm.c
index 4de3fa555bf..7185e849fcd 100644
--- a/sys/arch/hp300/stand/dcm.c
+++ b/sys/arch/hp300/stand/dcm.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: dcm.c,v 1.3 1997/01/17 08:32:43 downsj Exp $ */
/* $NetBSD: dcm.c,v 1.9 1996/02/27 22:11:44 scottr Exp $ */
/*
diff --git a/sys/arch/hp300/stand/devopen.c b/sys/arch/hp300/stand/devopen.c
index fe22240ed69..4742a44d424 100644
--- a/sys/arch/hp300/stand/devopen.c
+++ b/sys/arch/hp300/stand/devopen.c
@@ -1,6 +1,8 @@
-/* $NetBSD: devopen.c,v 1.5 1995/08/05 16:47:41 thorpej Exp $ */
+/* $OpenBSD: devopen.c,v 1.2 1997/01/17 08:32:43 downsj Exp $ */
+/* $NetBSD: devopen.c,v 1.7 1996/10/14 07:31:47 thorpej Exp $ */
/*-
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1993 John Brezak
* All rights reserved.
*
@@ -61,10 +63,35 @@ devlookup(d, len)
struct devsw *dp = devsw;
int i;
- for (i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0)
+ for (i = 0; i < ndevs; i++, dp++) {
+ if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) {
+ /*
+ * Set the filesystem and startup up according to the device
+ * being opened.
+ */
+ switch (i) {
+ case 0: /* ct */
+ bcopy(file_system_rawfs, file_system, sizeof(struct fs_ops));
+ break;
+
+ case 2: /* rd */
+ case 4: /* sd */
+ bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
+ break;
+
+ case 6: /* le */
+ bcopy(file_system_nfs, file_system, sizeof(struct fs_ops));
+ break;
+
+ default:
+ /* Agh! What happened?! */
+ goto bad;
+ }
return(i);
+ }
+ }
+ bad:
printf("No such device - Configured devices are:\n");
for (dp = devsw, i = 0; i < ndevs; i++, dp++)
if (dp->dv_name)
@@ -88,7 +115,7 @@ devparse(fname, dev, adapt, ctlr, unit, part, file)
{
int *argp, i;
char *s, *args[4];
-
+
/* get device name and make lower case */
for (s = (char *)fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
if (isupper(*s)) *s = tolower(*s);
@@ -132,7 +159,7 @@ devparse(fname, dev, adapt, ctlr, unit, part, file)
/* second form */
else if (*s == ':') {
- int unit;
+ int temp;
/* isolate device */
for (s = (char *)fname; *s != ':' && !isdigit(*s); s++);
@@ -142,10 +169,10 @@ devparse(fname, dev, adapt, ctlr, unit, part, file)
goto baddev;
/* isolate unit */
- if ((unit = atoi(s)) > 255)
+ if ((temp = atoi(s)) > 255)
goto bad;
- *adapt = unit / 8;
- *ctlr = unit % 8;
+ *adapt = temp / 8;
+ *ctlr = temp % 8;
for (; isdigit(*s); s++);
/* translate partition */
@@ -187,24 +214,52 @@ devopen(f, fname, file)
ctlr = B_CONTROLLER(bootdev);
unit = B_UNIT(bootdev);
part = B_PARTITION(bootdev);
-
+
if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
return(error);
-
+
+ /*
+ * Set up filesystem type based on what device we're opening.
+ */
+ switch (dev) {
+ case 0: /* ct */
+ bcopy(file_system_rawfs, file_system, sizeof(struct fs_ops));
+ break;
+
+ case 2: /* rd */
+ case 4: /* sd */
+ bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
+ break;
+
+ case 6: /* le */
+ bcopy(file_system_nfs, file_system, sizeof(struct fs_ops));
+ break;
+
+ default:
+ /* XXX what else should we do here? */
+ printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev);
+ return (EIO);
+ }
+
dp = &devsw[dev];
if (!dp->dv_open)
return(ENODEV);
- opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
-
f->f_dev = dp;
-
- if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0)
- return(0);
-
+
+ if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0) {
+ if ((error =
+ (*punitsw[dev].p_punit)(adapt, ctlr, &unit)) != 0) {
+ goto bad;
+ }
+ opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
+ return(0);
+ }
+
+ bad:
printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
adapt, ctlr, unit, part, strerror(error));
return(error);
-}
+}
diff --git a/sys/arch/hp300/stand/fhpib.c b/sys/arch/hp300/stand/fhpib.c
index c20071c0ceb..1980353969c 100644
--- a/sys/arch/hp300/stand/fhpib.c
+++ b/sys/arch/hp300/stand/fhpib.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: fhpib.c,v 1.2 1997/01/17 08:32:44 downsj Exp $ */
/* $NetBSD: fhpib.c,v 1.5 1995/08/05 16:47:42 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/hil.c b/sys/arch/hp300/stand/hil.c
index f5473c05acd..2495be4e3fa 100644
--- a/sys/arch/hp300/stand/hil.c
+++ b/sys/arch/hp300/stand/hil.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: hil.c,v 1.2 1997/01/17 08:32:44 downsj Exp $ */
/* $NetBSD: hil.c,v 1.5 1994/10/26 07:27:19 cgd Exp $ */
/*
diff --git a/sys/arch/hp300/stand/hpib.c b/sys/arch/hp300/stand/hpib.c
index 451f970f0cf..abb1d34a3ce 100644
--- a/sys/arch/hp300/stand/hpib.c
+++ b/sys/arch/hp300/stand/hpib.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: hpib.c,v 1.2 1997/01/17 08:32:45 downsj Exp $ */
/* $NetBSD: hpib.c,v 1.4 1994/10/26 07:27:21 cgd Exp $ */
/*
diff --git a/sys/arch/hp300/stand/hpibvar.h b/sys/arch/hp300/stand/hpibvar.h
index 3f1f66517dd..7e5ca407c2a 100644
--- a/sys/arch/hp300/stand/hpibvar.h
+++ b/sys/arch/hp300/stand/hpibvar.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: hpibvar.h,v 1.2 1997/01/17 08:32:45 downsj Exp $ */
/* $NetBSD: hpibvar.h,v 1.4 1994/10/26 07:27:24 cgd Exp $ */
/*
diff --git a/sys/arch/hp300/stand/if_le.c b/sys/arch/hp300/stand/if_le.c
index 3ef7a0d32ba..55ec320a311 100644
--- a/sys/arch/hp300/stand/if_le.c
+++ b/sys/arch/hp300/stand/if_le.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: if_le.c,v 1.5 1997/01/17 08:32:46 downsj Exp $ */
/* $NetBSD: if_le.c,v 1.8 1996/01/01 18:10:54 thorpej Exp $ */
/*
@@ -37,6 +38,7 @@
#include <netinet/in.h>
#include <netinet/in_systm.h>
+#include <lib/libsa/stand.h>
#include <lib/libsa/netif.h>
#include <hp300/dev/device.h>
diff --git a/sys/arch/hp300/stand/if_lereg.h b/sys/arch/hp300/stand/if_lereg.h
index 2729556a9f4..6cb23edf1a2 100644
--- a/sys/arch/hp300/stand/if_lereg.h
+++ b/sys/arch/hp300/stand/if_lereg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: if_lereg.h,v 1.2 1997/01/17 08:32:47 downsj Exp $ */
/* $NetBSD: if_lereg.h,v 1.1 1996/01/01 18:10:56 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/installboot.sh b/sys/arch/hp300/stand/installboot.sh
index a5605dfa416..1f18c8805f5 100644
--- a/sys/arch/hp300/stand/installboot.sh
+++ b/sys/arch/hp300/stand/installboot.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+# $OpenBSD: installboot.sh,v 1.2 1997/01/17 08:32:47 downsj Exp $
# $NetBSD: installboot.sh,v 1.2 1994/10/26 07:27:26 cgd Exp $
# compatibility with old installboot program
diff --git a/sys/arch/hp300/stand/ite.c b/sys/arch/hp300/stand/ite.c
index f48d8858427..0d2ae171684 100644
--- a/sys/arch/hp300/stand/ite.c
+++ b/sys/arch/hp300/stand/ite.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: ite.c,v 1.3 1997/01/17 08:32:48 downsj Exp $ */
/* $NetBSD: ite.c,v 1.11 1996/03/03 04:23:33 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/ite_dv.c b/sys/arch/hp300/stand/ite_dv.c
index c7116eba1a4..67fab804395 100644
--- a/sys/arch/hp300/stand/ite_dv.c
+++ b/sys/arch/hp300/stand/ite_dv.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: ite_dv.c,v 1.3 1997/01/17 08:32:48 downsj Exp $ */
/* $NetBSD: ite_dv.c,v 1.8 1996/03/03 04:23:35 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/ite_gb.c b/sys/arch/hp300/stand/ite_gb.c
index ac89d3845aa..ddcf27bb189 100644
--- a/sys/arch/hp300/stand/ite_gb.c
+++ b/sys/arch/hp300/stand/ite_gb.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: ite_gb.c,v 1.3 1997/01/17 08:32:49 downsj Exp $ */
/* $NetBSD: ite_gb.c,v 1.8 1996/03/03 04:23:36 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/ite_hy.c b/sys/arch/hp300/stand/ite_hy.c
index f907cdd5085..aeefc6207ae 100644
--- a/sys/arch/hp300/stand/ite_hy.c
+++ b/sys/arch/hp300/stand/ite_hy.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: ite_hy.c,v 1.3 1997/01/17 08:32:49 downsj Exp $ */
/* $NetBSD: ite_hy.c,v 1.3 1996/03/03 04:23:37 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/ite_rb.c b/sys/arch/hp300/stand/ite_rb.c
index f2053da77f6..196cf522daa 100644
--- a/sys/arch/hp300/stand/ite_rb.c
+++ b/sys/arch/hp300/stand/ite_rb.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: ite_rb.c,v 1.3 1997/01/17 08:32:50 downsj Exp $ */
/* $NetBSD: ite_rb.c,v 1.8 1996/03/03 04:23:38 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/ite_subr.c b/sys/arch/hp300/stand/ite_subr.c
index 5be4068b1a3..049e227ab3a 100644
--- a/sys/arch/hp300/stand/ite_subr.c
+++ b/sys/arch/hp300/stand/ite_subr.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: ite_subr.c,v 1.3 1997/01/17 08:32:51 downsj Exp $ */
/* $NetBSD: ite_subr.c,v 1.8 1996/03/03 04:23:40 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/ite_tc.c b/sys/arch/hp300/stand/ite_tc.c
index 2f0d52a48ff..4dae2081322 100644
--- a/sys/arch/hp300/stand/ite_tc.c
+++ b/sys/arch/hp300/stand/ite_tc.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: ite_tc.c,v 1.3 1997/01/17 08:32:51 downsj Exp $ */
/* $NetBSD: ite_tc.c,v 1.8 1996/03/03 04:23:41 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/itevar.h b/sys/arch/hp300/stand/itevar.h
index 1d6fbb4c205..a557fb46824 100644
--- a/sys/arch/hp300/stand/itevar.h
+++ b/sys/arch/hp300/stand/itevar.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: itevar.h,v 1.3 1997/01/17 08:32:52 downsj Exp $ */
/* $NetBSD: itevar.h,v 1.1 1996/03/03 04:23:42 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/libkern/Makefile b/sys/arch/hp300/stand/libkern/Makefile
new file mode 100644
index 00000000000..7ce3d08eeed
--- /dev/null
+++ b/sys/arch/hp300/stand/libkern/Makefile
@@ -0,0 +1,21 @@
+# $OpenBSD: Makefile,v 1.1 1997/01/17 08:33:05 downsj Exp $
+
+LIB= kern
+
+.PATH: ${.CURDIR}/../../../../lib/libkern
+.PATH: ${.CURDIR}/..
+
+CFLAGS+=${DEBUGFLAGS}
+CFLAGS+=-I${.CURDIR}/..
+CFLAGS+=-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libkern
+
+# kern routines
+SRCS= __main.c ashrdi3.c divdi3.c qdivrem.c strlen.c strcat.c strcmp.c \
+ strcpy.c strncmp.c umoddi3.c
+
+NOPROFILE=
+NOPIC=
+
+install:
+
+.include <bsd.lib.mk>
diff --git a/sys/arch/hp300/stand/libkern/Makefile.inc b/sys/arch/hp300/stand/libkern/Makefile.inc
new file mode 100644
index 00000000000..4dc628fd6a1
--- /dev/null
+++ b/sys/arch/hp300/stand/libkern/Makefile.inc
@@ -0,0 +1,23 @@
+# $OpenBSD: Makefile.inc,v 1.1 1997/01/17 08:33:05 downsj Exp $
+
+# NOTE: $S must correspond to the top of the 'sys' tree
+
+KERN_DIR= $S/arch/hp300/stand/libkern
+
+.if exists($(KERN_DIR)/${__objdir})
+KERN_LIBDIR= $(KERN_DIR)/${__objdir}
+.else
+KERN_LIBDIR= $(KERN_DIR)
+.endif
+
+KERN_LIB= $(KERN_LIBDIR)/libkern.a
+
+$(KERN_LIB): .NOTMAIN __always_make_kern_lib
+ @echo making sure the kernel library is up to date...
+ @(cd $(KERN_DIR) ; make)
+
+clean:: .NOTMAIN __always_make_kern_lib
+ @echo cleaning the kernel library objects
+ @(cd $(KERN_DIR) ; make clean)
+
+__always_make_kern_lib: .NOTMAIN
diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile
index 8ba5d23934c..848198d2efa 100644
--- a/sys/arch/hp300/stand/libsa/Makefile
+++ b/sys/arch/hp300/stand/libsa/Makefile
@@ -1,18 +1,21 @@
-# $NetBSD: Makefile,v 1.4 1996/01/30 19:47:32 thorpej Exp $
+# $OpenBSD: Makefile,v 1.3 1997/01/17 08:33:06 downsj Exp $
+# $NetBSD: Makefile,v 1.5 1996/06/26 17:44:42 thorpej Exp $
LIB= sa
.PATH: ${.CURDIR}/../../../../lib/libsa
+.PATH: ${.CURDIR}/..
# Don't need these now...
# DEBUGFLAGS=-DNETIF_DEBUG -DRPC_DEBUG -DNFS_DEBUG -DRARP_DEBUG -DNET_DEBUG
-CFLAGS+=-DSTANDALONE -DCOMPAT_UFS ${DEBUGFLAGS}
+CFLAGS+=-DSTANDALONE -DCOMPAT_UFS -DNO_LSEEK ${DEBUGFLAGS}
+CFLAGS+=-I${.CURDIR}/..
CFLAGS+=-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libsa
# stand routines
-SRCS= alloc.c bcopy.c exit.c exec.c getfile.c gets.c globals.c \
- memcpy.c printf.c strerror.c
+SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c \
+ memcmp.c memcpy.c memset.c printf.c strerror.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
@@ -25,11 +28,10 @@ SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c
SRCS+= bootp.c bootparam.c rarp.c
# boot filesystems
-SRCS+= ufs.c nfs.c
+SRCS+= ufs.c nfs.c rawfs.o
NOPROFILE=
NOPIC=
-OBJMACHINE=
install:
diff --git a/sys/arch/hp300/stand/libsa/Makefile.inc b/sys/arch/hp300/stand/libsa/Makefile.inc
index 868438109ff..5100e4ad20c 100644
--- a/sys/arch/hp300/stand/libsa/Makefile.inc
+++ b/sys/arch/hp300/stand/libsa/Makefile.inc
@@ -1,11 +1,12 @@
+# $OpenBSD: Makefile.inc,v 1.2 1997/01/17 08:33:07 downsj Exp $
# $NetBSD: Makefile.inc,v 1.1 1995/08/04 07:55:50 thorpej Exp $
# NOTE: $S must correspond to the top of the 'sys' tree
SA_DIR= $S/arch/hp300/stand/libsa
-.if exists($(SA_DIR)/obj.${MACHINE})
-SA_LIBDIR= $(SA_DIR)/obj.${MACHINE}
+.if exists($(SA_DIR)/${__objdir})
+SA_LIBDIR= $(SA_DIR)/${__objdir}
.else
SA_LIBDIR= $(SA_DIR)
.endif
diff --git a/sys/arch/hp300/stand/machdep.c b/sys/arch/hp300/stand/machdep.c
index b7b7efbe921..aed315de64d 100644
--- a/sys/arch/hp300/stand/machdep.c
+++ b/sys/arch/hp300/stand/machdep.c
@@ -1,4 +1,5 @@
-/* $NetBSD: machdep.c,v 1.5 1994/10/26 07:27:43 cgd Exp $ */
+/* $OpenBSD: machdep.c,v 1.2 1997/01/17 08:32:52 downsj Exp $ */
+/* $NetBSD: machdep.c,v 1.6 1996/10/14 07:33:46 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -155,3 +156,19 @@ romputchar(c)
}
}
#endif
+
+void
+machdep_start(entry, howto, loadaddr, ssym, esym)
+ char *entry;
+ int howto;
+ char *loadaddr;
+ char *ssym, *esym;
+{
+
+ 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));
+ (*((int (*)())entry))();
+}
diff --git a/sys/arch/hp300/stand/mkboot.c b/sys/arch/hp300/stand/mkboot.c
index e1258dd1e05..d6ce986c915 100644
--- a/sys/arch/hp300/stand/mkboot.c
+++ b/sys/arch/hp300/stand/mkboot.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: mkboot.c,v 1.2 1997/01/17 08:32:53 downsj Exp $ */
+
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -42,8 +44,9 @@ static char copyright[] =
#ifndef lint
#ifdef notdef
static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90";
-#endif
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 $";
#endif /* not lint */
#include <sys/param.h>
diff --git a/sys/arch/hp300/stand/netboot.c b/sys/arch/hp300/stand/netboot.c
deleted file mode 100644
index 0d973073312..00000000000
--- a/sys/arch/hp300/stand/netboot.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* $NetBSD: netboot.c,v 1.10 1995/10/04 07:24:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * 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.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <a.out.h>
-#include "stand.h"
-#include "samachdep.h"
-
-/*
- * Boot program... bits in `howto' determine whether boot stops to
- * ask for system name. Boot device is derived from ROM provided
- * information.
- */
-
-char line[100];
-
-extern u_int opendev;
-extern char *lowram;
-extern int noconsole;
-extern int cons_scode;
-
-char *name;
-char *names[] = {
- "bsd", "obsd", "bsd.old",
-};
-#define NUMNAMES (sizeof(names)/sizeof(char *))
-
-static int bdev, badapt, bctlr, bunit, bpart;
-
-main()
-{
- int currname = 0;
-
- /*
- * XXX: different versions of the HP boot rom seem to report
- * different things, so we have to compensate.
- */
- bootdev = MAKEBOOTDEV(0, 0, 0, 0, 0);
-
- printf("\n>> NetBSD NETWORK BOOT HP9000/%s CPU\n",
- getmachineid());
- printf(">> $NetBSD: netboot.c,v 1.10 1995/10/04 07:24:32 thorpej Exp $\n");
- printf(">> Enter \"reset\" to reset system.\n");
-
- bdev = B_TYPE(bootdev);
- badapt = B_ADAPTOR(bootdev);
- bctlr = B_CONTROLLER(bootdev);
- bunit = B_UNIT(bootdev);
- bpart = B_PARTITION(bootdev);
-
- for (;;) {
- name = names[currname++];
- if (currname == NUMNAMES)
- currname = 0;
-
- if (!noconsole) {
- howto = 0;
- getbootname(&howto);
- } else
- printf(": %s\n", name);
-
- exec(name, lowram, howto);
- printf("boot: %s\n", strerror(errno));
- }
-}
-
-getbootname(howto)
- int *howto;
-{
- char c, *ptr = line;
-
- printf("Boot: [%s][-s][-a][-d] :- ", name);
-
- if (tgets(line)) {
- if (strcmp(line, "reset") == 0) {
- call_req_reboot(); /* reset machine */
- printf("panic: can't reboot, halting\n");
- asm("stop #0x2700");
- }
-
- while (c = *ptr) {
- while (c == ' ')
- c = *++ptr;
- if (!c)
- return;
- if (c == '-')
- while ((c = *++ptr) && c != ' ')
- switch (c) {
- case 'a':
- *howto |= RB_ASKNAME;
- continue;
- case 's':
- *howto |= RB_SINGLE;
- continue;
- case 'd':
- *howto |= RB_KDB;
- continue;
- case 'b':
- *howto |= RB_HALT;
- continue;
- }
- else {
- name = ptr;
- while ((c = *++ptr) && c != ' ');
- if (c)
- *ptr++ = 0;
- }
- }
- } else
- printf("\n");
-}
-
-void
-machdep_start(entry, howto, loadaddr, ssym, esym)
- char *entry;
- int howto;
- char *loadaddr;
- char *ssym, *esym;
-{
-
- asm("movl %0,d7" : : "m" (howto));
- asm("movl #0,d6"); /* tell setroot we've netbooted */
- asm("movl %0,d5" : : "m" (cons_scode));
- asm("movl %0,a5" : : "a" (loadaddr));
- asm("movl %0,a4" : : "a" (esym));
- (*((int (*)())entry))();
-}
diff --git a/sys/arch/hp300/stand/netio.c b/sys/arch/hp300/stand/netio.c
index f655eeeb1b4..2afdbb9896a 100644
--- a/sys/arch/hp300/stand/netio.c
+++ b/sys/arch/hp300/stand/netio.c
@@ -1,7 +1,8 @@
-/* $NetBSD: netio.c,v 1.2 1995/09/23 17:31:10 thorpej Exp $ */
+/* $OpenBSD: netio.c,v 1.2 1997/01/17 08:32:54 downsj Exp $ */
+/* $NetBSD: netio.c,v 1.4 1996/10/06 19:07:00 thorpej Exp $ */
/*
- * Copyright (c) 1995 Jason R. Thorpe
+ * Copyright (c) 1995, 1996 Jason R. Thorpe
* Copyright (c) 1995 Gordon W. Ross
* All rights reserved.
*
@@ -57,6 +58,7 @@
#include <netinet/in_systm.h>
#include "stand.h"
+#include "samachdep.h"
#include "net.h"
#include "netif.h"
#include "bootparam.h"
@@ -71,9 +73,9 @@ char rootpath[FNAME_SIZE];
int netdev_sock = -1;
static int open_count;
-#ifdef SYS_INST
+int netio_ask = 0; /* default to bootparam, can override */
+
static char input_line[100];
-#endif
/* Why be any different? */
#define SUN_BOOTPARAMS
@@ -114,14 +116,16 @@ netclose(f)
}
int
-netioctl()
+netstrategy(devdata, func, dblk, size, v_buf, rsize)
+ void *devdata;
+ int func;
+ daddr_t dblk;
+ size_t size;
+ void *v_buf;
+ size_t *rsize;
{
- return EIO;
-}
-int
-netstrategy()
-{
+ *rsize = size;
return EIO;
}
@@ -131,64 +135,68 @@ netmountroot(f, devname)
char *devname; /* Device part of file name (or NULL). */
{
int error;
-#ifdef SYS_INST
struct iodesc *d;
-#endif
#ifdef DEBUG
printf("netmountroot: %s\n", devname);
#endif
-#ifdef SYS_INST
+ if (netio_ask) {
get_my_ip:
- printf("My IP address? ");
- bzero(input_line, sizeof(input_line));
- gets(input_line);
- if ((myip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) {
- printf("invalid IP address: %s\n", input_line);
- goto get_my_ip;
- }
+ printf("My IP address? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((myip.s_addr = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid IP address: %s\n", input_line);
+ goto get_my_ip;
+ }
get_my_netmask:
- printf("My netmask? ");
- bzero(input_line, sizeof(input_line));
- gets(input_line);
- if ((netmask = inet_addr(input_line)) == htonl(INADDR_NONE)) {
- printf("invalid netmask: %s\n", input_line);
- goto get_my_netmask;
- }
+ printf("My netmask? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((netmask = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid netmask: %s\n", input_line);
+ goto get_my_netmask;
+ }
get_my_gateway:
- printf("My gateway? ");
- bzero(input_line, sizeof(input_line));
- gets(input_line);
- if ((gateip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) {
- printf("invalid IP address: %s\n", input_line);
- goto get_my_gateway;
- }
+ printf("My gateway? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((gateip.s_addr = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid IP address: %s\n", input_line);
+ goto get_my_gateway;
+ }
get_server_ip:
- printf("Server IP address? ");
- bzero(input_line, sizeof(input_line));
- gets(input_line);
- if ((rootip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) {
- printf("invalid IP address: %s\n", input_line);
- goto get_server_ip;
- }
+ printf("Server IP address? ");
+ bzero(input_line, sizeof(input_line));
+ gets(input_line);
+ if ((rootip.s_addr = inet_addr(input_line)) ==
+ htonl(INADDR_NONE)) {
+ printf("invalid IP address: %s\n", input_line);
+ goto get_server_ip;
+ }
get_server_path:
- printf("Server path? ");
- bzero(rootpath, sizeof(rootpath));
- gets(rootpath);
- if (rootpath[0] == '\0' || rootpath[0] == '\n')
- goto get_server_path;
+ printf("Server path? ");
+ bzero(rootpath, sizeof(rootpath));
+ gets(rootpath);
+ if (rootpath[0] == '\0' || rootpath[0] == '\n')
+ goto get_server_path;
- if ((d = socktodesc(netdev_sock)) == NULL)
- return (EMFILE);
+ if ((d = socktodesc(netdev_sock)) == NULL)
+ return (EMFILE);
- d->myip = myip;
+ d->myip = myip;
+
+ goto do_nfs_mount;
+ }
-#else /* SYS_INST */
/*
* Get info for NFS boot: our IP address, our hostname,
* server IP address, and our root path on the server.
@@ -233,8 +241,7 @@ netmountroot(f, devname)
printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
-#endif /* SYS_INST */
-
+ do_nfs_mount:
/* Get the NFS file handle (mount). */
error = nfs_mount(netdev_sock, rootip, rootpath);
diff --git a/sys/arch/hp300/stand/nhpib.c b/sys/arch/hp300/stand/nhpib.c
index 9b536bb3ce3..24bf2487402 100644
--- a/sys/arch/hp300/stand/nhpib.c
+++ b/sys/arch/hp300/stand/nhpib.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: nhpib.c,v 1.2 1997/01/17 08:32:55 downsj Exp $ */
/* $NetBSD: nhpib.c,v 1.5 1995/08/05 16:47:46 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/pboot.c b/sys/arch/hp300/stand/pboot.c
deleted file mode 100644
index f3e251a6bd6..00000000000
--- a/sys/arch/hp300/stand/pboot.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $NetBSD: pboot.c,v 1.10 1995/10/04 07:24:31 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * 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.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <a.out.h>
-#include "stand.h"
-#include "samachdep.h"
-
-/*
- * Boot program... bits in `howto' determine whether boot stops to
- * ask for system name. Boot device is derived from ROM provided
- * information.
- */
-
-char line[100];
-
-extern u_int opendev;
-extern char *lowram;
-extern int noconsole;
-extern int cons_scode;
-
-char *name;
-char *names[] = {
- "/bsd", "/obsd", "/bsd.old",
-};
-#define NUMNAMES (sizeof(names)/sizeof(char *))
-
-static int bdev, badapt, bctlr, bunit, bpart;
-
-main()
-{
- int currname = 0;
-
- printf("\n>> NetBSD BOOT HP9000/%s CPU\n",
- getmachineid());
- printf(">> $NetBSD: pboot.c,v 1.10 1995/10/04 07:24:31 thorpej Exp $\n");
- printf(">> Enter \"reset\" to reset system.\n");
-
- bdev = B_TYPE(bootdev);
- badapt = B_ADAPTOR(bootdev);
- bctlr = B_CONTROLLER(bootdev);
- bunit = B_UNIT(bootdev);
- bpart = B_PARTITION(bootdev);
-
- for (;;) {
- name = names[currname++];
- if (currname == NUMNAMES)
- currname = 0;
-
- if (!noconsole) {
- howto = 0;
- getbootdev(&howto);
- } else
- printf(": %s\n", name);
-
-#if 0
- printf("Booting %s%d%c:%s @ 0x%x\n",
- devsw[dev].dv_name, ctlr + (8 * adapt), 'a' + part, name, x.a_entry);
-#endif
-
- exec(name, lowram, howto);
- printf("boot: %s\n", strerror(errno));
- }
-}
-
-getbootdev(howto)
- int *howto;
-{
- char c, *ptr = line;
-
- printf("Boot: [[[%s%d%c:]%s][-s][-a][-d]] :- ",
- devsw[bdev].dv_name, bctlr + (8 * badapt), 'a' + bpart, name);
-
- if (tgets(line)) {
- if (strcmp(line, "reset") == 0) {
- call_req_reboot(); /* reset machine */
- printf("panic: can't reboot, halting\n");
- asm("stop #0x2700");
- }
- while (c = *ptr) {
- while (c == ' ')
- c = *++ptr;
- if (!c)
- return;
- if (c == '-')
- while ((c = *++ptr) && c != ' ')
- switch (c) {
- case 'a':
- *howto |= RB_ASKNAME;
- continue;
- case 's':
- *howto |= RB_SINGLE;
- continue;
- case 'd':
- *howto |= RB_KDB;
- continue;
- case 'b':
- *howto |= RB_HALT;
- continue;
- }
- else {
- name = ptr;
- while ((c = *++ptr) && c != ' ');
- if (c)
- *ptr++ = 0;
- }
- }
- } else
- printf("\n");
-}
-
-void
-machdep_start(entry, howto, loadaddr, ssym, esym)
- char *entry;
- int howto;
- char *loadaddr;
- char *ssym, *esym;
-{
-
- 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));
- (*((int (*)())entry))();
-}
diff --git a/sys/arch/hp300/stand/prf.c b/sys/arch/hp300/stand/prf.c
index 21929f78cb2..120018b9c78 100644
--- a/sys/arch/hp300/stand/prf.c
+++ b/sys/arch/hp300/stand/prf.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: prf.c,v 1.2 1997/01/17 08:32:56 downsj Exp $ */
/* $NetBSD: prf.c,v 1.5 1994/10/26 07:27:50 cgd Exp $ */
/*
diff --git a/sys/arch/hp300/stand/rd.c b/sys/arch/hp300/stand/rd.c
index e1680a8ebb5..5931d54c01f 100644
--- a/sys/arch/hp300/stand/rd.c
+++ b/sys/arch/hp300/stand/rd.c
@@ -1,4 +1,5 @@
-/* $NetBSD: rd.c,v 1.10 1995/09/23 17:19:59 thorpej Exp $ */
+/* $OpenBSD: rd.c,v 1.2 1997/01/17 08:32:56 downsj Exp $ */
+/* $NetBSD: rd.c,v 1.11 1996/12/21 21:34:40 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -250,17 +251,22 @@ rdgetinfo(rs)
register struct rdminilabel *pi = &rs->sc_pinfo;
register struct disklabel *lp = &rdlabel;
char *msg, *getdisklabel();
- int rdstrategy(), err;
+ int rdstrategy(), err, savepart;
size_t i;
bzero((caddr_t)lp, sizeof *lp);
lp->d_secsize = DEV_BSIZE;
- if (err = rdstrategy(rs, F_READ,
- LABELSECTOR,
- lp->d_secsize ? lp->d_secsize : DEV_BSIZE,
- io_buf, &i) < 0) {
- printf("rdgetinfo: rdstrategy error %d\n", err);
- return(0);
+
+ /* Disklabel is always from RAW_PART. */
+ savepart = rs->sc_part;
+ rs->sc_part = RAW_PART;
+ err = rdstrategy(rs, F_READ, LABELSECTOR,
+ lp->d_secsize ? lp->d_secsize : DEV_BSIZE, io_buf, &i);
+ rs->sc_part = savepart;
+
+ if (err) {
+ printf("rdgetinfo: rdstrategy error %d\n", err);
+ return(0);
}
msg = getdisklabel(io_buf, lp);
@@ -313,7 +319,8 @@ rdopen(f, ctlr, unit, part)
if (rdgetinfo(rs) == 0)
return (ERDLAB);
}
- if (part >= rs->sc_pinfo.npart || rs->sc_pinfo.offset[part] == -1)
+ if (part != RAW_PART && /* always allow RAW_PART to be opened */
+ (part >= rs->sc_pinfo.npart || rs->sc_pinfo.offset[part] == -1))
return (EPART);
f->f_devdata = (void *)rs;
return (0);
@@ -346,12 +353,18 @@ rdstrategy(devdata, func, dblk, size, v_buf, rsize)
struct rd_softc *rs = devdata;
register int ctlr = rs->sc_ctlr;
register int unit = rs->sc_unit;
- daddr_t blk = (dblk + rs->sc_pinfo.offset[rs->sc_part]);
+ daddr_t blk;
char stat;
if (size == 0)
return(0);
+ /*
+ * Don't do partition translation on the `raw partition'.
+ */
+ blk = (dblk + ((rs->sc_part == RAW_PART) ? 0 :
+ rs->sc_pinfo.offset[rs->sc_part]));
+
rs->sc_retry = 0;
rd_ioc.c_unit = C_SUNIT(0);
rd_ioc.c_volume = C_SVOL(0);
@@ -370,9 +383,9 @@ retry:
hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
if (stat) {
if (rderror(ctlr, unit, rs->sc_part) == 0)
- return(-1);
+ return(EIO);
if (++rs->sc_retry > RDRETRY)
- return(-1);
+ return(EIO);
goto retry;
}
*rsize = size;
diff --git a/sys/arch/hp300/stand/rominfo.h b/sys/arch/hp300/stand/rominfo.h
index 389e8ed2cb7..969f10313a4 100644
--- a/sys/arch/hp300/stand/rominfo.h
+++ b/sys/arch/hp300/stand/rominfo.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: rominfo.h,v 1.2 1997/01/17 08:32:57 downsj Exp $ */
/* $NetBSD: rominfo.h,v 1.5 1994/10/26 07:27:53 cgd Exp $ */
/*
diff --git a/sys/arch/hp300/stand/samachdep.h b/sys/arch/hp300/stand/samachdep.h
index 192d2b4241a..b17698ba0bd 100644
--- a/sys/arch/hp300/stand/samachdep.h
+++ b/sys/arch/hp300/stand/samachdep.h
@@ -1,4 +1,5 @@
-/* $NetBSD: samachdep.h,v 1.5 1995/08/05 16:47:50 thorpej Exp $ */
+/* $OpenBSD: samachdep.h,v 1.2 1997/01/17 08:32:58 downsj Exp $ */
+/* $NetBSD: samachdep.h,v 1.7 1996/10/14 07:34:48 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -35,6 +36,8 @@
* @(#)samachdep.h 8.1 (Berkeley) 6/10/93
*/
+#include <sys/types.h>
+
#define NHPIB 4
#define NSCSI 2
#define NRD 8
@@ -68,7 +71,9 @@
extern int cpuspeed, machineid;
extern int howto;
-extern unsigned int bootdev;
+extern int cons_scode;
+extern u_int opendev;
+extern u_int bootdev;
extern char *getmachineid();
#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
@@ -77,3 +82,22 @@ extern char *getmachineid();
struct grfinfo {
int grf_foo;
};
+
+/*
+ * Switch we use to set punit in devopen.
+ */
+struct punitsw {
+ int (*p_punit) __P((int, int, int *));
+};
+extern struct punitsw punitsw[];
+extern int npunit;
+
+extern struct devsw devsw_net[];
+extern int ndevs_net;
+
+extern struct devsw devsw_general[];
+extern int ndevs_general;
+
+extern struct fs_ops file_system_rawfs[];
+extern struct fs_ops file_system_ufs[];
+extern struct fs_ops file_system_nfs[];
diff --git a/sys/arch/hp300/stand/scsi.c b/sys/arch/hp300/stand/scsi.c
index 0aa7c2e5401..1fcf9330083 100644
--- a/sys/arch/hp300/stand/scsi.c
+++ b/sys/arch/hp300/stand/scsi.c
@@ -1,4 +1,11 @@
-/* $NetBSD: scsi.c,v 1.5 1994/10/26 07:27:56 cgd Exp $ */
+/* $OpenBSD: scsi.c,v 1.2 1997/01/17 08:32:58 downsj Exp $ */
+/* $NetBSD: scsi.c,v 1.6 1996/12/17 09:21:42 thorpej Exp $ */
+
+/*
+ * This is reported to fix some odd failures when disklabeling
+ * SCSI disks in SYS_INST.
+ */
+#define SLOWSCSI
/*
* Copyright (c) 1988 University of Utah.
diff --git a/sys/arch/hp300/stand/scsivar.h b/sys/arch/hp300/stand/scsivar.h
index a80d5b3d4a5..945c0b837a4 100644
--- a/sys/arch/hp300/stand/scsivar.h
+++ b/sys/arch/hp300/stand/scsivar.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: scsivar.h,v 1.2 1997/01/17 08:32:59 downsj Exp $ */
/* $NetBSD: scsivar.h,v 1.4 1994/10/26 07:27:58 cgd Exp $ */
/*
diff --git a/sys/arch/hp300/stand/sd.c b/sys/arch/hp300/stand/sd.c
index 766a16719ce..e8edb1542a8 100644
--- a/sys/arch/hp300/stand/sd.c
+++ b/sys/arch/hp300/stand/sd.c
@@ -1,4 +1,5 @@
-/* $NetBSD: sd.c,v 1.8 1995/09/23 17:19:58 thorpej Exp $ */
+/* $OpenBSD: sd.c,v 1.2 1997/01/17 08:32:59 downsj Exp $ */
+/* $NetBSD: sd.c,v 1.9 1996/12/21 21:34:41 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -129,18 +130,22 @@ sdgetinfo(ss)
register struct sdminilabel *pi = &ss->sc_pinfo;
register struct disklabel *lp = &sdlabel;
char *msg, *getdisklabel();
- int sdstrategy(), err;
+ int sdstrategy(), err, savepart;
size_t i;
bzero((caddr_t)lp, sizeof *lp);
lp->d_secsize = (DEV_BSIZE << ss->sc_blkshift);
- if (err = sdstrategy(ss, F_READ,
- LABELSECTOR,
- lp->d_secsize ? lp->d_secsize : DEV_BSIZE,
- io_buf, &i) < 0) {
- printf("sdgetinfo: sdstrategy error %d\n", err);
- return(0);
+ /* Disklabel is always from RAW_PART. */
+ savepart = ss->sc_part;
+ ss->sc_part = RAW_PART;
+ err = sdstrategy(ss, F_READ, LABELSECTOR,
+ lp->d_secsize ? lp->d_secsize : DEV_BSIZE, io_buf, &i);
+ ss->sc_part = savepart;
+
+ if (err) {
+ printf("sdgetinfo: sdstrategy error %d\n", err);
+ return(0);
}
msg = getdisklabel(io_buf, lp);
@@ -191,7 +196,8 @@ sdopen(f, ctlr, unit, part)
if (sdgetinfo(ss) == 0)
return (ERDLAB);
}
- if (part >= ss->sc_pinfo.npart || ss->sc_pinfo.offset[part] == -1)
+ if (part != RAW_PART && /* always allow RAW_PART to be opened */
+ (part >= ss->sc_pinfo.npart || ss->sc_pinfo.offset[part] == -1))
return (EPART);
f->f_devdata = (void *)ss;
return (0);
@@ -223,13 +229,19 @@ sdstrategy(ss, func, dblk, size, v_buf, rsize)
char *buf = v_buf;
register int ctlr = ss->sc_ctlr;
register int unit = ss->sc_unit;
- daddr_t blk = (dblk + ss->sc_pinfo.offset[ss->sc_part])>> ss->sc_blkshift;
u_int nblk = size >> ss->sc_blkshift;
+ daddr_t blk;
char stat;
if (size == 0)
return(0);
+ /*
+ * Don't do partition translation on the `raw partition'.
+ */
+ blk = (dblk + ((ss->sc_part == RAW_PART) ? 0 :
+ ss->sc_pinfo.offset[ss->sc_part])) >> ss->sc_blkshift;
+
ss->sc_retry = 0;
#ifdef SD_DEBUG
diff --git a/sys/arch/hp300/stand/srt0.s b/sys/arch/hp300/stand/srt0.s
index d5a800eecbf..638f9ed8046 100644
--- a/sys/arch/hp300/stand/srt0.s
+++ b/sys/arch/hp300/stand/srt0.s
@@ -1,3 +1,4 @@
+/* $OpenBSD: srt0.s,v 1.2 1997/01/17 08:33:00 downsj Exp $ */
/* $NetBSD: srt0.s,v 1.3 1995/09/02 05:04:23 thorpej Exp $ */
/*
diff --git a/sys/arch/hp300/stand/sys_inst.c b/sys/arch/hp300/stand/sys_inst.c
deleted file mode 100644
index d1ec6a0f3f0..00000000000
--- a/sys/arch/hp300/stand/sys_inst.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/* $NetBSD: sys_inst.c,v 1.3 1995/10/04 07:24:33 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Jason R. Thorpe.
- * All rights reserved.
- *
- * 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 for the NetBSD Project
- * by Jason R. Thorpe.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * Portions of this program are inspired by (and have borrowed code from)
- * the `editlabel' program that accompanies NetBSD/vax, which carries
- * the following notice:
- *
- * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * 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 at Ludd, University of
- * Lule}, Sweden and its contributors.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define DKTYPENAMES
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <a.out.h>
-#include "stand.h"
-#include "samachdep.h"
-
-char line[100];
-
-extern u_int opendev;
-extern char *lowram;
-extern int noconsole;
-extern int cons_scode;
-
-char *kernel_name = "/bsd";
-
-void dsklabel __P((void));
-void miniroot __P((void));
-void bootmini __P((void));
-void resetsys __P((void));
-void gethelp __P((void));
-int opendisk __P((char *, char *, int, char, int *));
-void disklabel_edit __P((struct disklabel *));
-void disklabel_show __P((struct disklabel *));
-int disklabel_write __P((char *, int, struct open_file *));
-
-struct inst_command {
- char *ic_cmd; /* command name */
- char *ic_desc; /* command description */
- void (*ic_func) __P((void)); /* handling function */
-} inst_commands[] = {
- { "disklabel", "place partition map on disk", dsklabel },
- { "miniroot", "place miniroot on disk", miniroot },
- { "boot", "boot from miniroot", bootmini },
- { "reset", "reset the system", resetsys },
- { "help", "display command list", gethelp },
-};
-#define NCMDS (sizeof(inst_commands) / sizeof(inst_commands[0]))
-
-main()
-{
- int i, currname = 0;
-
- printf("\n>> NetBSD INSTALLATION HP9000/%s CPU\n",
- getmachineid());
- printf(">> $NetBSD: sys_inst.c,v 1.3 1995/10/04 07:24:33 thorpej Exp $\n");
- gethelp();
-
- for (;;) {
- printf("sys_inst> ");
- bzero(line, sizeof(line));
- gets(line);
- if (line[0] == '\n' || line[0] == '\0')
- continue;
-
- for (i = 0; i < NCMDS; ++i)
- if (strcmp(line, inst_commands[i].ic_cmd) == 0) {
- (*inst_commands[i].ic_func)();
- break;
- }
-
-
- if (i == NCMDS)
- printf("unknown command: %s\n", line);
- }
-}
-
-void
-gethelp()
-{
- int i;
-
- printf(">> Available commands:\n");
- for (i = 0; i < NCMDS; ++i)
- printf(">> %s - %s\n", inst_commands[i].ic_cmd,
- inst_commands[i].ic_desc);
-}
-
-/*
- * Do all the steps necessary to place a disklabel on a disk.
- * Note, this assumes 512 byte sectors.
- */
-void
-dsklabel()
-{
- struct disklabel *lp;
- struct open_file *disk_ofp;
- int dfd, error;
- size_t xfersize;
- char block[DEV_BSIZE], diskname[64];
- extern struct open_file files[];
-
- printf("
-You will be asked several questions about your disk, most of which
-require prior knowledge of the disk's geometry. There is no easy way
-for the system to provide this information for you. If you do not have
-this information, please consult your disk's manual or another
-informative source.\n\n");
-
- /* Error message printed by opendisk() */
- if (opendisk("Disk to label?", diskname, sizeof(diskname),
- ('a' + RAW_PART), &dfd))
- return;
-
- disk_ofp = &files[dfd];
-
- bzero(block, sizeof(block));
- if (error = (*disk_ofp->f_dev->dv_strategy)(disk_ofp->f_devdata,
- F_READ, LABELSECTOR, sizeof(block), block, &xfersize)) {
- printf("cannot read disk %s, errno = %d\n", diskname, error);
- return;
- }
-
- printf("Sucessfully read %d bytes from %s\n", xfersize, diskname);
-
- lp = (struct disklabel *)((void *)(&block[LABELOFFSET]));
-
- disklabel_loop:
- bzero(line, sizeof(line));
- printf("(z)ap, (e)dit, (s)how, (w)rite, (d)one > ");
- gets(line);
- if (line[0] == '\n' || line[0] == '\0')
- goto disklabel_loop;
-
- switch (line[0]) {
- case 'z':
- case 'Z': {
- char zap[DEV_BSIZE];
- bzero(zap, sizeof(zap));
- (void)(*disk_ofp->f_dev->dv_strategy)(disk_ofp->f_devdata,
- F_WRITE, LABELSECTOR, sizeof(zap), zap, &xfersize);
- }
- goto out;
- /* NOTREACHED */
-
- case 'e':
- case 'E':
- disklabel_edit(lp);
- break;
-
- case 's':
- case 'S':
- disklabel_show(lp);
- break;
-
- case 'w':
- case 'W':
- /*
- * Error message will be displayed by disklabel_write()
- */
- if (disklabel_write(block, sizeof(block), disk_ofp))
- goto out;
- else
- printf("Sucessfully wrote label to %s\n", diskname);
- break;
-
- case 'd':
- case 'D':
- goto out;
- /* NOTREACHED */
-
- default:
- printf("unkown command: %s\n", line);
- }
-
- goto disklabel_loop;
- /* NOTREACHED */
-
- out:
- /*
- * Close disk. Marks disk `not alive' so that partition
- * information will be reloaded upon next open.
- */
- (void)close(dfd);
-}
-
-#define GETNUM(out, num) \
- printf((out), (num)); \
- bzero(line, sizeof(line)); \
- gets(line); \
- if (line[0]) \
- (num) = atoi(line);
-
-#define GETNUM2(out, num1, num2) \
- printf((out), (num1), (num2)); \
- bzero(line, sizeof(line)); \
- gets(line); \
- if (line[0]) \
- (num2) = atoi(line);
-
-#define GETSTR(out, str) \
- printf((out), (str)); \
- bzero(line, sizeof(line)); \
- gets(line); \
- if (line[0]) \
- strcpy((str), line);
-
-#define FLAGS(out, flag) \
- printf((out), lp->d_flags & (flag) ? 'y' : 'n'); \
- bzero(line, sizeof(line)); \
- gets(line); \
- if (line[0] == 'y' || line[0] == 'Y') \
- lp->d_flags |= (flag); \
- else \
- lp->d_flags &= ~(flag);
-
-void
-disklabel_edit(lp)
- struct disklabel *lp;
-{
- int i;
-
- printf("Select disk type. Valid types:\n");
- for (i = 0; i < DKMAXTYPES; i++)
- printf("%d %s\n", i, dktypenames[i]);
- printf("\n");
-
- GETNUM("Disk type (number)? [%d] ", lp->d_type);
- GETSTR("Disk model name? [%s] ", lp->d_typename);
- GETSTR("Disk pack name? [%s] ", lp->d_packname);
- FLAGS("Bad sectoring? [%c] ", D_BADSECT);
- FLAGS("Ecc? [%c] ", D_ECC);
- FLAGS("Removable? [%c] ", D_REMOVABLE);
-
- printf("\n");
-
- GETNUM("Interleave? [%d] ", lp->d_interleave);
- GETNUM("Rpm? [%d] ", lp->d_rpm);
- GETNUM("Trackskew? [%d] ", lp->d_trackskew);
- GETNUM("Cylinderskew? [%d] ", lp->d_cylskew);
- GETNUM("Headswitch? [%d] ", lp->d_headswitch);
- GETNUM("Track-to-track? [%d] ", lp->d_trkseek);
- GETNUM("Drivedata 0? [%d] ", lp->d_drivedata[0]);
- GETNUM("Drivedata 1? [%d] ", lp->d_drivedata[1]);
- GETNUM("Drivedata 2? [%d] ", lp->d_drivedata[2]);
- GETNUM("Drivedata 3? [%d] ", lp->d_drivedata[3]);
- GETNUM("Drivedata 4? [%d] ", lp->d_drivedata[4]);
-
- printf("\n");
-
- GETNUM("Bytes/sector? [%d] ", lp->d_secsize);
- GETNUM("Sectors/track? [%d] ", lp->d_nsectors);
- GETNUM("Tracks/cylinder? [%d] ", lp->d_ntracks);
- GETNUM("Sectors/cylinder? [%d] ", lp->d_secpercyl);
- GETNUM("Cylinders? [%d] ", lp->d_ncylinders);
-
- printf("
-Enter partition table. Note, sizes and offsets are in sectors.\n\n");
-
- lp->d_npartitions = MAXPARTITIONS;
- for (i = 0; i < lp->d_npartitions; ++i) {
- GETNUM2("%c partition: offset? [%d] ", ('a' + i),
- lp->d_partitions[i].p_offset);
- GETNUM(" size? [%d] ", lp->d_partitions[i].p_size);
- }
-
- /* Perform magic. */
- lp->d_magic = lp->d_magic2 = DISKMAGIC;
-
- /* Calculate disklabel checksum. */
- lp->d_checksum = 0;
- lp->d_checksum = dkcksum(lp);
-}
-
-void
-disklabel_show(lp)
- struct disklabel *lp;
-{
- int i, npart;
- struct partition *pp;
-
- /*
- * Check for valid disklabel.
- */
- if (lp->d_magic != DISKMAGIC || lp->d_magic2 != DISKMAGIC) {
- printf("No disklabel to show.\n");
- return;
- }
-
- if (lp->d_npartitions > MAXPARTITIONS || dkcksum(lp) != 0) {
- printf("Corrupted disklabel.\n");
- return;
- }
-
- printf("\ndisk type %d (%s), %s: %s%s%s\n", lp->d_type,
- lp->d_type < DKMAXTYPES ? dktypenames[lp->d_type] :
- dktypenames[0], lp->d_typename,
- (lp->d_flags & D_REMOVABLE) ? " removable" : "",
- (lp->d_flags & D_ECC) ? " ecc" : "",
- (lp->d_flags & D_BADSECT) ? " badsect" : "");
-
- printf("interleave %d, rpm %d, trackskew %d, cylinderskew %d\n",
- lp->d_interleave, lp->d_rpm, lp->d_trackskew, lp->d_cylskew);
-
- printf("headswitch %d, track-to-track %d, drivedata: %d %d %d %d %d\n",
- lp->d_headswitch, lp->d_trkseek, lp->d_drivedata[0],
- lp->d_drivedata[1], lp->d_drivedata[2], lp->d_drivedata[3],
- lp->d_drivedata[4]);
-
- printf("\nbytes/sector: %d\n", lp->d_secsize);
- printf("sectors/track: %d\n", lp->d_nsectors);
- printf("tracks/cylinder: %d\n", lp->d_ntracks);
- printf("sectors/cylinder: %d\n", lp->d_secpercyl);
- printf("cylinders: %d\n", lp->d_ncylinders);
-
- printf("\n%d partitions:\n", lp->d_npartitions);
- printf(" size offset\n");
- pp = lp->d_partitions;
- for (i = 0; i < lp->d_npartitions; i++) {
- printf("%c: %d, %d\n", 97 + i, lp->d_partitions[i].p_size,
- lp->d_partitions[i].p_offset);
- }
- printf("\n");
-}
-
-int
-disklabel_write(block, len, ofp)
- char *block;
- int len;
- struct open_file *ofp;
-{
- int error = 0;
- size_t xfersize;
-
- if (error = (*ofp->f_dev->dv_strategy)(ofp->f_devdata, F_WRITE,
- LABELSECTOR, len, block, &xfersize))
- printf("cannot write disklabel, errno = %d\n", error);
-
- return (error);
-}
-
-int
-opendisk(question, diskname, len, partition, fdp)
- char *question, *diskname;
- int len;
- char partition;
- int *fdp;
-{
- char fulldiskname[64], *filename;
- int i, error = 0;
-
- getdiskname:
- printf("%s ", question);
- bzero(diskname, len);
- bzero(fulldiskname, sizeof(fulldiskname));
- gets(diskname);
- if (diskname[0] == '\n' || diskname[0] == '\0')
- goto getdiskname;
-
- /*
- * devopen() is picky. Make sure it gets the sort of string it
- * wants.
- */
- bcopy(diskname, fulldiskname,
- len < sizeof(fulldiskname) ? len : sizeof(fulldiskname));
- for (i = 0; fulldiskname[i + 1] != '\0'; ++i)
- /* Nothing. */ ;
- if (fulldiskname[i] < '0' || fulldiskname[i] > '9') {
- printf("invalid disk name %s\n", diskname);
- goto getdiskname;
- }
- fulldiskname[++i] = partition; fulldiskname[++i] = ':';
-
- /*
- * We always open for writing.
- */
- if ((*fdp = open(fulldiskname, 1)) < 0)
- printf("cannot open %s\n", diskname);
-
- return (errno);
-}
-
-/*
- * Copy a miniroot image from an NFS server or tape to the `b' partition
- * of the specified disk. Note, this assumes 512 byte sectors.
- */
-void
-miniroot()
-{
- int sfd, dfd, i, nblks;
- char diskname[64], minirootname[128];
- char block[DEV_BSIZE];
- struct stat st;
- size_t xfersize;
- struct open_file *disk_ofp;
- extern struct open_file files[];
-
- /* Error message printed by opendisk() */
- if (opendisk("Disk for miniroot?", diskname, sizeof(diskname),
- 'b', &dfd))
- return;
-
- disk_ofp = &files[dfd];
-
- /*
- * XXX We only support NFS for now.
- */
- getsource:
- printf("Source? (N)FS, (t)ape, (d)one > ");
- bzero(line, sizeof(line));
- gets(line);
- if (line[0] == '\0')
- goto getsource;
-
- switch (line[0]) {
- case 'n':
- case 'N':
- name_of_miniroot:
- printf("Name of miniroot file? ");
- bzero(line, sizeof(line));
- bzero(minirootname, sizeof(minirootname));
- gets(line);
- if (line[0] == '\0')
- goto name_of_miniroot;
- (void)strcat(minirootname, "le0a:");
- (void)strcat(minirootname, line);
- if ((sfd = open(minirootname, 0)) < 0) {
- printf("can't open %s\n", line);
- return;
- }
- break;
-
- case 't':
- case 'T':
- printf("Sorry, no tape support yet.\n");
- return;
-
- case 'd':
- case 'D':
- return;
-
- default:
- printf("Unknown source: %s\n", line);
- goto getsource;
- }
-
- /*
- * Have file descriptor, will copy.
- */
- if (fstat(sfd, &st) < 0) {
- printf("can't stat %s\n", line);
- goto done;
- }
-
- nblks = (int)(st.st_size / sizeof(block));
- printf("Copying %d blocks from %s to %s\n", nblks, line, diskname);
-
- for (i = 0; i < nblks; ++i) {
- if (read(sfd, block, sizeof(block)) != sizeof(block)) {
- printf("Short read, errno = %d\n", errno);
- goto done;
- }
- if ((*disk_ofp->f_dev->dv_strategy)(disk_ofp->f_devdata,
- F_WRITE, i, sizeof(block), block, &xfersize) ||
- xfersize != sizeof(block)) {
- printf("Bad write, errno = %d\n", errno);
- goto done;
- }
- }
-
- printf("Successfully copied miniroot image.\n");
- done:
- close(sfd);
- close(dfd);
-}
-
-/*
- * Boot the kernel from the miniroot image into single-user.
- */
-void
-bootmini()
-{
- char diskname[64], bootname[64];
- int i;
-
- getdiskname:
- printf("Disk to boot from? ");
- bzero(diskname, sizeof(diskname));
- bzero(bootname, sizeof(bootname));
- gets(diskname);
- if (diskname[0] == '\n' || diskname[0] == '\0')
- goto getdiskname;
-
- /*
- * devopen() is picky. Make sure it gets the sort of string it
- * wants.
- */
- (void)strcat(bootname, diskname);
- for (i = 0; bootname[i + 1] != '\0'; ++i)
- /* Nothing. */ ;
- if (bootname[i] < '0' || bootname[i] > '9') {
- printf("invalid disk name %s\n", diskname);
- goto getdiskname;
- }
- bootname[++i] = 'b'; bootname[++i] = ':';
- (void)strcat(bootname, kernel_name);
-
- howto = RB_SINGLE; /* _Always_ */
-
- printf("booting: %s -s\n", bootname);
- exec(bootname, lowram, howto);
- printf("boot: %s\n", strerror(errno));
-}
-
-/*
- * Reset the system.
- */
-void
-resetsys()
-{
-
- call_req_reboot();
- printf("panic: can't reboot, halting\n");
- asm("stop #0x2700");
-}
-
-void
-machdep_start(entry, howto, loadaddr, ssym, esym)
- char *entry;
- int howto;
- char *loadaddr;
- char *ssym, *esym;
-{
-
- 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));
- (*((int (*)())entry))();
-}
diff --git a/sys/arch/hp300/stand/tgets.c b/sys/arch/hp300/stand/tgets.c
index 1a814f0aa27..898d3efe607 100644
--- a/sys/arch/hp300/stand/tgets.c
+++ b/sys/arch/hp300/stand/tgets.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: tgets.c,v 1.2 1997/01/17 08:33:01 downsj Exp $ */
/* $NetBSD: tgets.c,v 1.4 1994/10/26 07:28:05 cgd Exp $ */
/*-
diff --git a/sys/arch/hp300/stand/volhdr.h b/sys/arch/hp300/stand/volhdr.h
index 7f30df058aa..edec02552ef 100644
--- a/sys/arch/hp300/stand/volhdr.h
+++ b/sys/arch/hp300/stand/volhdr.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: volhdr.h,v 1.2 1997/01/17 08:33:02 downsj Exp $ */
/* $NetBSD: volhdr.h,v 1.4 1994/10/26 07:28:08 cgd Exp $ */
/*