summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/stand
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/alpha/stand')
-rw-r--r--sys/arch/alpha/stand/Makefile6
-rw-r--r--sys/arch/alpha/stand/Makefile.inc9
-rw-r--r--sys/arch/alpha/stand/OSFpal.c26
-rw-r--r--sys/arch/alpha/stand/bbinfo.h14
-rw-r--r--sys/arch/alpha/stand/boot/Makefile102
-rw-r--r--sys/arch/alpha/stand/boot/TODO7
-rw-r--r--sys/arch/alpha/stand/boot/boot.c7
-rw-r--r--sys/arch/alpha/stand/boot/conf.c10
-rw-r--r--sys/arch/alpha/stand/boot/devopen.c (renamed from sys/arch/alpha/stand/boot/libsa/devopen.c)4
-rw-r--r--sys/arch/alpha/stand/boot/disk.c20
-rw-r--r--sys/arch/alpha/stand/boot/disk.h7
-rw-r--r--sys/arch/alpha/stand/boot/filesystem.c (renamed from sys/arch/alpha/stand/boot/libsa/filesystem.c)2
-rw-r--r--sys/arch/alpha/stand/boot/libsa/Makefile14
-rw-r--r--sys/arch/alpha/stand/boot/newvers.sh4
-rw-r--r--sys/arch/alpha/stand/boot/prom.c135
-rw-r--r--sys/arch/alpha/stand/boot/prom_disp.S116
-rw-r--r--sys/arch/alpha/stand/boot/version4
-rw-r--r--sys/arch/alpha/stand/bootxx.c122
-rw-r--r--sys/arch/alpha/stand/bootxx/Makefile85
-rw-r--r--sys/arch/alpha/stand/bootxx/TODO7
-rw-r--r--sys/arch/alpha/stand/bootxx/boot.c186
-rw-r--r--sys/arch/alpha/stand/bootxx/disk.c152
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/Makefile19
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/alloc.c110
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/bcopy.c72
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/devopen.c165
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/disklabel.c53
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/lseek.c89
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/open.c125
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/read.c93
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/strcmp.c62
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/strlen.c58
-rw-r--r--sys/arch/alpha/stand/bootxx/libsa/ufs.c690
-rw-r--r--sys/arch/alpha/stand/bootxx/stand.h98
-rw-r--r--sys/arch/alpha/stand/bootxx/start.S69
-rw-r--r--sys/arch/alpha/stand/headersize.c (renamed from sys/arch/alpha/stand/bootxx/headersize.c)4
-rw-r--r--sys/arch/alpha/stand/installboot.c389
-rw-r--r--sys/arch/alpha/stand/prom.c (renamed from sys/arch/alpha/stand/bootxx/prom.c)33
-rw-r--r--sys/arch/alpha/stand/prom_disp.S (renamed from sys/arch/alpha/stand/bootxx/prom_disp.S)10
-rw-r--r--sys/arch/alpha/stand/puts.c9
-rw-r--r--sys/arch/alpha/stand/start.S (renamed from sys/arch/alpha/stand/boot/start.S)23
-rw-r--r--sys/arch/alpha/stand/xxboot/Makefile13
-rw-r--r--sys/arch/alpha/stand/xxboot/makexxboot.c57
43 files changed, 718 insertions, 2562 deletions
diff --git a/sys/arch/alpha/stand/Makefile b/sys/arch/alpha/stand/Makefile
index f58b7cdd78e..9587f1fa0a5 100644
--- a/sys/arch/alpha/stand/Makefile
+++ b/sys/arch/alpha/stand/Makefile
@@ -1,7 +1,5 @@
-# $NetBSD: Makefile,v 1.2 1995/02/27 16:36:43 cgd Exp $
+# $NetBSD: Makefile,v 1.3 1995/11/23 02:38:45 cgd Exp $
-SUBDIR= boot xxboot bootxx
-
-obj:
+SUBDIR= boot bootxx installboot
.include <bsd.subdir.mk>
diff --git a/sys/arch/alpha/stand/Makefile.inc b/sys/arch/alpha/stand/Makefile.inc
new file mode 100644
index 00000000000..73c404a4bac
--- /dev/null
+++ b/sys/arch/alpha/stand/Makefile.inc
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile.inc,v 1.1 1995/11/23 02:38:48 cgd Exp $
+
+BINDIR= /usr/mdec
+
+PRIMARY_LOAD_ADDRESS= 20000000
+SECONDARY_LOAD_ADDRESS= 20020000
+
+CPPFLAGS+= -DPRIMARY_LOAD_ADDRESS="0x${PRIMARY_LOAD_ADDRESS}"
+CPPFLAGS+= -DSECONDARY_LOAD_ADDRESS="0x${SECONDARY_LOAD_ADDRESS}"
diff --git a/sys/arch/alpha/stand/OSFpal.c b/sys/arch/alpha/stand/OSFpal.c
new file mode 100644
index 00000000000..bfe46b2d727
--- /dev/null
+++ b/sys/arch/alpha/stand/OSFpal.c
@@ -0,0 +1,26 @@
+
+#include <sys/types.h>
+
+#include <machine/prom.h>
+#include <machine/rpb.h>
+
+void
+OSFpal()
+{
+ struct rpb *r;
+ struct ctb *t;
+ struct pcs *p;
+ long result;
+ int offset;
+
+ r = (struct rpb *)HWRPB_ADDR;
+ offset = r->rpb_pcs_size * cpu_number();
+ p = (struct pcs *)((u_int8_t *)r + r->rpb_pcs_off + offset);
+
+ printf("VMS PAL revision: 0x%lx\n",
+ p->pcs_palrevisions[PALvar_OpenVMS]);
+ printf("OSF PAL rev: 0x%lx\n", p->pcs_palrevisions[PALvar_OSF1]);
+ (void)switch_palcode();
+ printf("Switch to OSF PAL code succeeded.\n");
+}
+
diff --git a/sys/arch/alpha/stand/bbinfo.h b/sys/arch/alpha/stand/bbinfo.h
new file mode 100644
index 00000000000..8da100b28db
--- /dev/null
+++ b/sys/arch/alpha/stand/bbinfo.h
@@ -0,0 +1,14 @@
+
+struct bbinfoloc {
+ u_int64_t magic1;
+ u_int64_t start;
+ u_int64_t end;
+ u_int64_t magic2;
+};
+
+struct bbinfo {
+ int32_t cksum;
+ int32_t nblocks;
+ int32_t bsize;
+ int32_t blocks[1];
+};
diff --git a/sys/arch/alpha/stand/boot/Makefile b/sys/arch/alpha/stand/boot/Makefile
index 03d7c126bfa..23c3c283e7c 100644
--- a/sys/arch/alpha/stand/boot/Makefile
+++ b/sys/arch/alpha/stand/boot/Makefile
@@ -1,61 +1,51 @@
-# $NetBSD: Makefile,v 1.4 1995/06/28 00:58:44 cgd Exp $
-#
-# BSD Boot blocks for the Alpha
-#
-# XXX should generate a primary boot block, too...
-
-INCPATH=-I../../../.. -I.
-
-# Boot relocation address
-RELOC1= 20020000
-# Low memory test program relocation address
-#RELOC2= 20004000
-# High memory test program relocation address
-RELOC2= fffffc0000230000
-
-# Compiler and assembler flags used to generate boot blocks.
-#
-DEFS= -DSTANDALONE
-AFLAGS+=-DASSEMBLER ${INCPATH}
-CFLAGS= -mno-fp-regs ${INCPATH} ${DEFS}
-
-LIBS= libsa/libsa.a -lc
-SRCS= boot.c disk.c conf.c prom.c test.c
-
-all: boot
-
-libsa/libsa.a::
- cd libsa; make
-
-# This boot is supposed to be installed in this way:
-# cp boot <true_root_of_disk>/boot
-BOBJS= boot.o conf.o disk.o prom.o prom_disp.o prom_swpal.o vers.o
-boot: start.o ${BOBJS} ${LIBS}
- ${LD} -Ttext ${RELOC1} -N \
- -e start -o ${.TARGET} start.o ${BOBJS} ${LIBS}
-
-# This boot is supposed to be installed in this way:
-# cp test_boot <true_root_of_disk>/test_boot
-#
-# It is used presumably in this way:
-# boot -fi "test_boot" dka300
-TOBJS= prom.o prom_disp.o prom_swpal.o test.o
-test_boot: start.o ${TOBJS} ${LIBS}
- ${LD} -T ${RELOC2} -N -e start -o ${.TARGET} start.o ${TOBJS} ${LIBS}
-
-clean cleandir:
- rm -f .depend *.o *.exe *.i errs make.out core* vers.c
- rm -f a.out boot test_boot
- cd libsa && make cleandir
+# $NetBSD: Makefile,v 1.5 1995/11/23 02:39:20 cgd Exp $
+
+.PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa
+
+BOOT_PROG = boot
+BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS}
+
+BOOT_SRCS = start.S boot.c disk.c conf.c prom.c prom_disp.S OSFpal.c
+BOOT_SRCS+= alloc.c bzero.c close.c dev.c devopen.c disklabel.c
+BOOT_SRCS+= getfile.c gets.c ioctl.c lseek.c open.c printf.c read.c
+BOOT_SRCS+= strcmp.c ufs.c write.c bcopy.c filesystem.c strlen.c
+BOOT_SRCS+= ntohl.c prom_swpal.S
+BOOT_OBJS = ${BOOT_SRCS:N*.h:R:S/$/.o/g}
+
+HEADERSIZE_PROG = headersize
+
+AFLAGS += -DASSEMBLER
+CPPFLAGS += -I${.CURDIR}/../.. -I${.CURDIR}/../../../..
+CFLAGS = -Werror -mno-fp-regs -g -DCOMPAT_UFS
+
+CLEANFILES+= vers.c vers.o
+
+.PATH: ${.CURDIR}/../../../../lib/libkern
+
+all: ${BOOT_PROG}
+
+${BOOT_PROG}: ${BOOT_OBJS} ${HEADERSIZE_PROG}
+ sh ${.CURDIR}/newvers.sh ${.CURDIR}/version
+ ${COMPILE.c} vers.c
+ ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.coff \
+ ${BOOT_OBJS} vers.o -lc # XXX
+ size ${BOOT_PROG}.coff
+ strip ${BOOT_PROG}.coff
+ dd if=${BOOT_PROG}.coff of=${BOOT_PROG} \
+ bs=`./${HEADERSIZE_PROG} < ${BOOT_PROG}.coff` skip=1
install:
- install -c -o root -g wheel -m 555 boot ${DESTDIR}/
+ install -c -o bin -g bin -m 444 ${BOOT_PROG} \
+ ${DESTDIR}${BINDIR}/${BOOT_PROG}
-depend: ${SRCS}
- mkdep -p ${INCPATH} ${DEFS} ${SRCS}
- cd libsa && make depend
+clean: _SUBDIRUSE
+ rm -f a.out [Ee]rrs mklog core *.core \
+ ${BOOT_PROG} ${BOOT_OBJS} ${CLEANFILES} \
+ ${BOOT_PROG}.coff ${HEADERSIZE_PROG}
-newvers:
- sh newvers.sh
+cleandir: _SUBDIRUSE clean
-vers.c: newvers
+.include "${.CURDIR}/../Makefile.inc"
+.include <bsd.obj.mk>
+.include <bsd.dep.mk>
+.include <bsd.subdir.mk>
diff --git a/sys/arch/alpha/stand/boot/TODO b/sys/arch/alpha/stand/boot/TODO
deleted file mode 100644
index 57c1ab2f87d..00000000000
--- a/sys/arch/alpha/stand/boot/TODO
+++ /dev/null
@@ -1,7 +0,0 @@
-$NetBSD: TODO,v 1.2 1995/02/16 02:32:53 cgd Exp $
-
-libsa/devopen.c should replace the PMAX source code, and
-they should then share it.
-
-Standalone programs should load against libkern, and sys/stand
-should lose things like strchr() in favor of the libkern versions.
diff --git a/sys/arch/alpha/stand/boot/boot.c b/sys/arch/alpha/stand/boot/boot.c
index 375b0070834..0abbb15e7e8 100644
--- a/sys/arch/alpha/stand/boot/boot.c
+++ b/sys/arch/alpha/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.3 1995/06/28 00:58:48 cgd Exp $ */
+/* $NetBSD: boot.c,v 1.4 1995/11/23 02:39:27 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -39,15 +39,16 @@
*/
#include <lib/libsa/stand.h>
+#include <lib/libkern/libkern.h>
#include <sys/param.h>
#include <sys/exec.h>
#include <machine/prom.h>
-#include "../../include/coff.h"
+#include "include/coff.h"
#define _KERNEL
-#include "../../include/pte.h"
+#include "include/pte.h"
static int aout_exec __P((int, struct exec *, u_int64_t *));
static int coff_exec __P((int, struct exechdr *, u_int64_t *));
diff --git a/sys/arch/alpha/stand/boot/conf.c b/sys/arch/alpha/stand/boot/conf.c
index 9cc3d1b6621..4e81e277451 100644
--- a/sys/arch/alpha/stand/boot/conf.c
+++ b/sys/arch/alpha/stand/boot/conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.2 1995/02/16 02:32:54 cgd Exp $ */
+/* $NetBSD: conf.c,v 1.3 1995/11/23 02:39:31 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,11 +41,11 @@
#include <lib/libsa/stand.h>
#include <lib/libsa/ufs.h>
-int errno;
-int noioctl __P((void));
+#include "disk.h"
+
+int diskopen __P((struct open_file *, ...)); /* XXX */
-int diskstrategy(), diskopen(), diskclose();
-#define diskioctl noioctl
+int errno;
struct devsw devsw[] = {
{ "disk", diskstrategy, diskopen, diskclose, diskioctl }, /*0*/
diff --git a/sys/arch/alpha/stand/boot/libsa/devopen.c b/sys/arch/alpha/stand/boot/devopen.c
index 78a8cc8efc1..33c5695b286 100644
--- a/sys/arch/alpha/stand/boot/libsa/devopen.c
+++ b/sys/arch/alpha/stand/boot/devopen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.2 1995/02/16 02:33:04 cgd Exp $ */
+/* $NetBSD: devopen.c,v 1.1 1995/11/23 02:39:37 cgd Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -57,7 +57,7 @@ devopen(f, fname, file)
char namebuf[20];
int rc;
- cp = fname;
+ cp = (char *)fname;
ncp = namebuf;
/* look for a string like '5/rz0/vmunix' or '5/rz3f/vmunix */
diff --git a/sys/arch/alpha/stand/boot/disk.c b/sys/arch/alpha/stand/boot/disk.c
index f03c0bc2daa..c80cc60a911 100644
--- a/sys/arch/alpha/stand/boot/disk.c
+++ b/sys/arch/alpha/stand/boot/disk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.c,v 1.2 1995/02/16 02:32:55 cgd Exp $ */
+/* $NetBSD: disk.c,v 1.3 1995/11/23 02:39:40 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,6 +45,8 @@
#include <machine/prom.h>
+#include "disk.h"
+
struct disk_softc {
int sc_fd; /* PROM channel number */
int sc_ctlr; /* controller number */
@@ -54,19 +56,24 @@ struct disk_softc {
};
int
-diskstrategy(devdata, rw, bn, reqcnt, addr, cnt)
+diskstrategy(devdata, rw, bn, reqcnt, addrvoid, cnt)
void *devdata;
int rw;
daddr_t bn;
- u_int reqcnt;
- char *addr;
- u_int *cnt; /* out: number of bytes transfered */
+ size_t reqcnt;
+ void *addrvoid;
+ size_t *cnt; /* out: number of bytes transfered */
{
+ char *addr = addrvoid;
struct disk_softc *sc;
struct partition *pp;
prom_return_t ret;
int s;
+ if ((reqcnt & 0xffffff) != reqcnt ||
+ reqcnt == 0)
+ asm("call_pal 0");
+
twiddle();
/* Partial-block transfers not handled. */
@@ -92,7 +99,8 @@ diskopen(f, ctlr, unit, part)
{
struct disklabel *lp;
prom_return_t ret;
- int cnt, devlen, i;
+ size_t cnt;
+ int devlen, i;
char *msg, buf[DEV_BSIZE], devname[32];
static struct disk_softc *sc;
diff --git a/sys/arch/alpha/stand/boot/disk.h b/sys/arch/alpha/stand/boot/disk.h
new file mode 100644
index 00000000000..c60583c11e2
--- /dev/null
+++ b/sys/arch/alpha/stand/boot/disk.h
@@ -0,0 +1,7 @@
+/* $NetBSD: disk.h,v 1.1 1995/11/23 02:39:42 cgd Exp $ */
+
+int diskstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
+/* int diskopen __P((struct open_file *, int, int, int)); */
+int diskclose __P((struct open_file *));
+
+#define diskioctl noioctl
diff --git a/sys/arch/alpha/stand/boot/libsa/filesystem.c b/sys/arch/alpha/stand/boot/filesystem.c
index 514e6e809bf..8f963e9e673 100644
--- a/sys/arch/alpha/stand/boot/libsa/filesystem.c
+++ b/sys/arch/alpha/stand/boot/filesystem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: filesystem.c,v 1.2 1995/02/16 02:33:05 cgd Exp $ */
+/* $NetBSD: filesystem.c,v 1.1 1995/11/23 02:39:46 cgd Exp $ */
/*
* Copyright (c) 1993 Philip A. Nelson.
diff --git a/sys/arch/alpha/stand/boot/libsa/Makefile b/sys/arch/alpha/stand/boot/libsa/Makefile
deleted file mode 100644
index c84169984f7..00000000000
--- a/sys/arch/alpha/stand/boot/libsa/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# $NetBSD: Makefile,v 1.2 1995/02/16 02:33:03 cgd Exp $
-
-LIB= sa
-SRCS= alloc.c bzero.c close.c dev.c devopen.c disklabel.c getfile.c \
- gets.c ioctl.c lseek.c open.c printf.c read.c strcmp.c ufs.c \
- write.c bcopy.c filesystem.c strlen.c ntohl.c
-
-.PATH: ../../../../../lib/libsa ../../../../../lib/libkern
-NOPIC=nopic
-NOPROFILE=noprofile
-
-.include <bsd.lib.mk>
-
-CFLAGS= -mno-fp-regs -I../../../../.. -I. -DCOMPAT_UFS
diff --git a/sys/arch/alpha/stand/boot/newvers.sh b/sys/arch/alpha/stand/boot/newvers.sh
index 8e4737c48a6..135bb35fd58 100644
--- a/sys/arch/alpha/stand/boot/newvers.sh
+++ b/sys/arch/alpha/stand/boot/newvers.sh
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $NetBSD: newvers.sh,v 1.1 1995/02/13 23:08:10 cgd Exp $
+# $NetBSD: newvers.sh,v 1.2 1995/11/23 02:39:48 cgd Exp $
#
# Copyright (c) 1984, 1986, 1990, 1993
# The Regents of the University of California. All rights reserved.
@@ -36,7 +36,7 @@
# @(#)newvers.sh 8.1 (Berkeley) 4/20/94
u=${USER-root} h=`hostname` t=`date`
-r=`head -1 version`
+r=`head -1 $1`
echo "char bootprog_name[] = \"NetBSD/Alpha boot\";" > vers.c
echo "char bootprog_rev[] = \"${r}\";" >> vers.c
diff --git a/sys/arch/alpha/stand/boot/prom.c b/sys/arch/alpha/stand/boot/prom.c
deleted file mode 100644
index 92e58cfefe3..00000000000
--- a/sys/arch/alpha/stand/boot/prom.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $NetBSD: prom.c,v 1.3 1995/06/28 00:58:49 cgd Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#include <sys/types.h>
-
-#include <machine/prom.h>
-#include <machine/rpb.h>
-
-int console;
-
-void
-init_prom_calls()
-{
- extern struct prom_vec prom_dispatch_v;
- struct rpb *r;
- struct crb *c;
- char buf[4];
-
- r = (struct rpb *)HWRPB_ADDR;
- c = (struct crb *)((u_int8_t *)r + r->rpb_crb_off);
-
- prom_dispatch_v.routine_arg = c->crb_v_dispatch;
- prom_dispatch_v.routine = c->crb_v_dispatch->code;
-
- /* Look for console tty. */
- prom_getenv(PROM_E_TTY_DEV, buf, 4);
- console = buf[0] - '0';
-}
-
-void
-OSFpal()
-{
- struct rpb *r;
- struct ctb *t;
- struct pcs *p;
- long result;
- int offset;
-
- r = (struct rpb *)HWRPB_ADDR;
- offset = r->rpb_pcs_size * cpu_number();
- p = (struct pcs *)((u_int8_t *)r + r->rpb_pcs_off + offset);
-
- printf("VMS PAL revision: 0x%lx\n",
- p->pcs_palrevisions[PALvar_OpenVMS]);
- printf("OSF PAL rev: 0x%lx\n", p->pcs_palrevisions[PALvar_OSF1]);
- (void)switch_palcode();
- printf("Switch to OSF PAL code succeeded.\n");
-}
-
-int
-getchar()
-{
- prom_return_t ret;
-
- for (;;) {
- ret.bits = prom_dispatch(PROM_R_GETC, console);
- if (ret.u.status == 0 || ret.u.status == 1)
- return (ret.u.retval);
- }
-}
-
-void
-putchar(c)
- int c;
-{
- prom_return_t ret;
- char cbuf;
-
- if (c == '\r' || c == '\n') {
- cbuf = '\r';
- do {
- ret.bits = prom_dispatch(PROM_R_PUTS, console,
- &cbuf, 1);
- } while ((ret.u.retval & 1) == 0);
- cbuf = '\n';
- } else
- cbuf = c;
- do {
- ret.bits = prom_dispatch(PROM_R_PUTS, console, &cbuf, 1);
- } while ((ret.u.retval & 1) == 0);
-}
-
-int
-prom_getenv(id, buf, len)
- int id, len;
- char *buf;
-{
- prom_return_t ret;
-
- ret.bits = prom_dispatch(PROM_R_GETENV, id, buf, len-1);
- if (ret.u.status & 0x4)
- ret.u.retval = 0;
- buf[ret.u.retval] = '\0';
-
- return (ret.u.retval);
-}
-
-int
-prom_open(dev, len)
- char *dev;
- int len;
-{
- prom_return_t ret;
-
- ret.bits = prom_dispatch(PROM_R_OPEN, dev, len);
- if (ret.u.status & 0x4)
- return (-1);
- else
- return (ret.u.retval);
-}
diff --git a/sys/arch/alpha/stand/boot/prom_disp.S b/sys/arch/alpha/stand/boot/prom_disp.S
deleted file mode 100644
index 8387dadc9b2..00000000000
--- a/sys/arch/alpha/stand/boot/prom_disp.S
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $NetBSD: prom_disp.S,v 1.2 1995/02/16 02:32:57 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#ifndef LOCORE
-#include "../../include/asm.h"
-#include "../../include/prom.h"
-#include "../../include/rpb.h"
-#endif
-
- .globl prom_dispatch_v
- .comm prom_dispatch_v 16
-
- .text
- .align 4
-
-/*
- * Dispatcher routine. Implements prom's calling machinery, saves our
- * callee-saved registers as required by C.
- */
-#define D_RA (7*8)
-#define D_S0 (8*8)
-#define D_S1 (9*8)
-#define D_S2 (10*8)
-#define D_S3 (11*8)
-#define D_S4 (12*8)
-#define D_S5 (13*8)
-#define D_S6 (14*8)
-#define DISPATCH_FRAME_SIZE (15*8)
-#define DISPATCH_REGS IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5|IM_S6
-
-NESTED(prom_dispatch, 5, DISPATCH_FRAME_SIZE, ra, DISPATCH_REGS, 0)
-
-/* ldgp gp, 0(pv)*/
- SETGP(pv)
-
- lda sp, -DISPATCH_FRAME_SIZE(sp)
- stq ra, D_RA(sp)
- stq s0, D_S0(sp)
- stq s1, D_S1(sp)
- stq s2, D_S2(sp)
- stq s3, D_S3(sp)
- stq s4, D_S4(sp)
- stq s5, D_S5(sp)
- stq s6, D_S6(sp)
-
- /* Lord have mercy because.. I would not. */
-/* #define STUPID_PROM_IS_32_BITS */
-#ifdef STUPID_PROM_IS_32_BITS
- ldah s0, 0x2000(zero) /* hack for hack */
- lda s0, (0x2000-8)(s0)
-
- stq sp, 0(s0)
- or s0, zero, sp
-#endif /* STUPID_PROM_IS_32_BITS */
-
- lda pv, prom_dispatch_v
- ldq v0, 0(pv) /* routine */
- ldq pv, 8(pv) /* routine_arg */
-
- jsr ra, (v0)
-
-#ifdef STUPID_PROM_IS_32_BITS
- ldah s0, 0x2000(zero) /* hack for hack */
- lda s0, (0x2000-8)(s0)
-
- ldq sp, 0(s0)
-#endif /* STUPID_PROM_IS_32_BITS */
-
- ldq ra, D_RA(sp)
- ldq s0, D_S0(sp)
- ldq s1, D_S1(sp)
- ldq s2, D_S2(sp)
- ldq s3, D_S3(sp)
- ldq s4, D_S4(sp)
- ldq s5, D_S5(sp)
- ldq s6, D_S6(sp)
- lda sp, DISPATCH_FRAME_SIZE(sp)
- RET
-END(prom_dispatch)
-
-#undef D_RA
-#undef D_S0
-#undef D_S1
-#undef D_S2
-#undef D_S3
-#undef D_S4
-#undef D_S5
-#undef D_S6
-#undef DISPATCH_FRAME_SIZE
-#undef DISPATCH_REGS
diff --git a/sys/arch/alpha/stand/boot/version b/sys/arch/alpha/stand/boot/version
index d6a53b8ab55..a7634431ffb 100644
--- a/sys/arch/alpha/stand/boot/version
+++ b/sys/arch/alpha/stand/boot/version
@@ -1,5 +1,7 @@
-$NetBSD: version,v 1.3 1995/06/28 00:58:52 cgd Exp $
+$NetBSD: version,v 1.4 1995/11/23 02:40:09 cgd Exp $
1.1: Initial version
1.2: don't forget the Id string!
1.3: make it work on AlphaStations
+1.4: Re-import from master sources.
+1.5: Complete rewrite of boot block code.
diff --git a/sys/arch/alpha/stand/bootxx.c b/sys/arch/alpha/stand/bootxx.c
new file mode 100644
index 00000000000..48c21f3c7fa
--- /dev/null
+++ b/sys/arch/alpha/stand/bootxx.c
@@ -0,0 +1,122 @@
+#include <sys/param.h>
+#include <machine/prom.h>
+
+#include "bbinfo.h"
+
+extern _end, start;
+
+struct bbinfoloc desc = {
+ 0xbabefacedeadbeef,
+ (u_int64_t)&start,
+ (u_int64_t)&_end,
+ 0xdeadbeeffacebabe
+};
+
+int
+open_dev(fd)
+ int *fd;
+{
+ prom_return_t ret;
+ char devname[64];
+ int devlen;
+
+ /*
+ * XXX
+ * We don't know what device names look like yet,
+ * so we can't change them.
+ */
+ ret.bits = prom_getenv(PROM_E_BOOTED_DEV, devname, sizeof(devname));
+ devlen = ret.u.retval;
+
+ ret.bits = prom_open(devname, devlen);
+ if (ret.u.status)
+ return 0;
+
+ *fd = ret.u.retval;
+
+ return 1;
+}
+
+int
+load_file(bbinfop, loadaddr)
+ struct bbinfo *bbinfop;
+ char *loadaddr;
+{
+ prom_return_t ret;
+ int32_t cksum, *int32p;
+ int i, n, fd, rv;
+ char *cp;
+
+ if (bbinfop->nblocks <= 0) {
+ puts("invalid number of blocks in boot program description\n");
+ return 0;
+ }
+ if (bbinfop->bsize < 4096 || bbinfop->bsize > MAXBSIZE) {
+ puts("invalid block size in boot program description\n");
+ return 0;
+ }
+
+ int32p = (int32_t *)&_end;
+ n = bbinfop->nblocks +
+ (sizeof(*bbinfop) / sizeof(bbinfop->blocks[0])) - 1;
+ if ((long)&_end - (long)&start + sizeof(bbinfop->blocks[0]) * n >
+ 15 * 512) {
+ puts("way too many blocks\n");
+ return 0;
+ }
+
+ for (i = 0, cksum = 0; i < n; i++)
+ cksum += *int32p++;
+ if (cksum != 0) {
+ puts("invalid checksum in boot program description\n");
+ return 0;
+ }
+
+ if (!open_dev(&fd)) {
+ puts("couldn't open disk device\n");
+ return 0;
+ }
+
+ cp = loadaddr;
+ rv = 1;
+ for (i = 0; i < bbinfop->nblocks; i++) {
+puts(".");
+ ret.bits = prom_read(fd, bbinfop->bsize, cp,
+ bbinfop->blocks[i]);
+puts("\b");
+ if (ret.u.status) {
+ rv = 0;
+ puts("BLOCK READ ERROR!\n");
+ break;
+ }
+ cp += bbinfop->bsize;
+ }
+ prom_close(fd);
+
+ return (rv);
+}
+
+void
+main()
+{
+ struct bbinfo *bbinfop;
+ char *loadaddr;
+ void (*entry) __P((void));
+
+ /* Init prom callback vector. */
+ init_prom_calls();
+
+ puts("\nNetBSD/Alpha primary boot...\n");
+
+ bbinfop = (struct bbinfo *)&_end;
+ loadaddr = (char *)SECONDARY_LOAD_ADDRESS;
+ if (!load_file(bbinfop, loadaddr)) {
+ puts("\nLOAD FAILED!\n\n");
+ return;
+ }
+
+ puts("Jumping to entry point...\n");
+ entry = (void (*)())loadaddr;
+ (*entry)();
+ puts("SECONDARY BOOT BLOCK RETURNED!\n");
+}
diff --git a/sys/arch/alpha/stand/bootxx/Makefile b/sys/arch/alpha/stand/bootxx/Makefile
index 75f5f9f8caa..937657352f7 100644
--- a/sys/arch/alpha/stand/bootxx/Makefile
+++ b/sys/arch/alpha/stand/bootxx/Makefile
@@ -1,67 +1,44 @@
-# $NetBSD: Makefile,v 1.3 1995/02/27 16:36:55 cgd Exp $
-#
-# BSD Boot blocks for the Alpha
-#
-# XXX should generate a primary boot block, too...
+# $NetBSD: Makefile,v 1.4 1995/11/23 02:40:29 cgd Exp $
-#INCPATH=-I../../.. -I.
-INCPATH=-I/sys -I. -I/sys/arch/alpha/stand
+.PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa
-# Boot relocation address
-RELOC1= 20000000
-# Low memory test program relocation address
-#RELOC2= 20004000
-# High memory test program relocation address
-RELOC2= fffffc0000230000
+BOOT_PROG = bootxx
+BOOT_RELOC = ${PRIMARY_LOAD_ADDRESS}
-# Compiler and assembler flags used to generate boot blocks.
-#
-DEFS= -DSMALL -DSTANDALONE
-AFLAGS+=-DASSEMBLER ${INCPATH}
-#CFLAGS= -O6 -mno-fp-regs ${INCPATH} ${DEFS}
-CFLAGS= -mno-fp-regs ${INCPATH} ${DEFS} -finline-functions -O6
+BOOT_SRCS = start.S bootxx.c prom.c prom_disp.S bzero.c puts.c
+BOOT_OBJS = ${BOOT_SRCS:N*.h:R:S/$/.o/g}
-LIBS= libsa/libsa.a -lc
-SRCS= boot.c conf.c prom.c test.c
+HEADERSIZE_PROG = headersize
-all: bootxx
+AFLAGS += -DASSEMBLER
+CPPFLAGS += -I${.CURDIR}/../.. -DPRIMARY_BOOTBLOCK
+CFLAGS = -Werror -mno-fp-regs -g
-libsa/libsa.a::
- cd libsa; make
+.PATH: ${.CURDIR}/../../../../lib/libkern
-# This boot is supposed to be installed in this way:
-# cp boot <true_root_of_disk>/boot
-BOBJS= boot.o prom.o prom_disp.o
-bootxx.coff: start.o ${BOBJS} ${LIBS}
- ${LD} -Ttext ${RELOC1} -N \
- -e start -o ${.TARGET} start.o ${BOBJS} ${LIBS}
+all: ${BOOT_PROG}
-bootxx: headersize bootxx.coff
- dd if=bootxx.coff of=bootxx.nohdr bs=`./headersize <bootxx.coff` skip=1
- dd if=bootxx.nohdr of=bootxx count=15
-
-# This boot is supposed to be installed in this way:
-# cp test_boot <true_root_of_disk>/test_boot
-#
-# It is used presumably in this way:
-# boot -fi "test_boot" dka300
-TOBJS= prom.o prom_disp.o prom_swpal.o test.o
-test_boot: start.o ${TOBJS} ${LIBS}
- ${LD} -T ${RELOC2} -N -e start -o ${.TARGET} start.o ${TOBJS} ${LIBS}
-
-clean cleandir:
- rm -f .depend *.o *.exe *.i errs make.out core* vers.c
- rm -f a.out boot test_boot bootxx bootxx.nohdr bootxx.coff headersize
- cd libsa && make cleandir
+${BOOT_PROG}: ${BOOT_OBJS} ${HEADERSIZE_PROG}
+ ${LD} -Ttext ${BOOT_RELOC} -N -e start -o ${BOOT_PROG}.coff \
+ ${BOOT_OBJS}
+ size ${BOOT_PROG}.coff
+ strip ${BOOT_PROG}.coff
+ dd if=${BOOT_PROG}.coff of=${BOOT_PROG}.nohdr \
+ bs=`./${HEADERSIZE_PROG} < ${BOOT_PROG}.coff` skip=1
+ dd if=${BOOT_PROG}.nohdr of=${BOOT_PROG} bs=`expr 15 \* 512` conv=sync
install:
- install -c -o bin -g bin -m 444 bootxx ${DESTDIR}/usr/mdec/bootsd
+ install -c -o bin -g bin -m 444 ${BOOT_PROG} \
+ ${DESTDIR}${BINDIR}/${BOOT_PROG}
-depend: ${SRCS}
- mkdep -p ${INCPATH} ${DEFS} ${SRCS}
- cd libsa && make depend
+clean: _SUBDIRUSE
+ rm -f a.out [Ee]rrs mklog core *.core \
+ ${BOOT_PROG} ${BOOT_OBJS} ${CLEANFILES} \
+ ${BOOT_PROG}.coff ${BOOT_PROG}.nohdr ${HEADERSIZE_PROG}
-newvers:
- sh newvers.sh
+cleandir: _SUBDIRUSE clean
-vers.c: newvers
+.include "${.CURDIR}/../Makefile.inc"
+.include <bsd.obj.mk>
+.include <bsd.dep.mk>
+.include <bsd.subdir.mk>
diff --git a/sys/arch/alpha/stand/bootxx/TODO b/sys/arch/alpha/stand/bootxx/TODO
deleted file mode 100644
index 34e314a9616..00000000000
--- a/sys/arch/alpha/stand/bootxx/TODO
+++ /dev/null
@@ -1,7 +0,0 @@
-$NetBSD: TODO,v 1.2 1995/02/16 02:33:07 cgd Exp $
-
-libsa/devopen.c should replace the PMAX source code, and
-they should then share it.
-
-Standalone programs should load against libkern, and sys/stand
-should lose things like strchr() in favor of the libkern versions.
diff --git a/sys/arch/alpha/stand/bootxx/boot.c b/sys/arch/alpha/stand/bootxx/boot.c
deleted file mode 100644
index 0d9cda391f6..00000000000
--- a/sys/arch/alpha/stand/bootxx/boot.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $NetBSD: boot.c,v 1.3 1995/06/28 00:58:58 cgd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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 "stand.h"
-
-#include <sys/param.h>
-#include <sys/exec.h>
-
-#include <machine/prom.h>
-
-#include "../include/coff.h"
-#define KERNEL
-#include "../include/pte.h"
-
-#include "libsa/open.c"
-
-#if 0
-static void aout_exec __P((int, struct exec *));
-#endif
-static void coff_exec __P((int, struct exechdr *));
-static void loadfile __P((char *));
-
-#if 0
-static inline int
-aout_exec(fd, aout, entryp)
- int fd;
- struct exec *aout;
- u_int64_t *entryp;
-{
- size_t sz;
-
- /* Check the magic number. */
- if (N_GETMAGIC(*aout) != OMAGIC)
- return (1);
-
- /* Read in text, data. */
- if (lseek(fd, (off_t)N_TXTOFF(*aout), SEEK_SET) < 0)
- return (1);
- sz = aout->a_text + aout->a_data;
- if (read(fd, aout->a_entry, sz) != sz)
- return (1);
-
- /* Zero out bss. */
- if (aout->a_bss != 0)
- bzero(aout->a_entry + sz, aout->a_bss);
-
- ffp_save = aout->a_entry + aout->a_text + aout->a_data + aout->a_bss;
- ffp_save = k0segtophys((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT;
- ffp_save += 2; /* XXX OSF/1 does this, no idea why. */
-
- *entryp = aout->a_entry;
- return (0);
-}
-#endif
-
-static inline void
-coff_exec(fd, coff)
- int fd;
- struct exechdr *coff;
-{
-
- /* Read in text. */
- (void)lseek(fd, N_COFFTXTOFF(coff->f, coff->a), 0);
- if (read(fd, coff->a.text_start, coff->a.tsize) != coff->a.tsize) {
-/*puts("text read failed\n");*/
- return;
- }
-
- /* Read in data. */
- if (coff->a.dsize != 0) {
- if (read(fd,
- coff->a.data_start, coff->a.dsize) != coff->a.dsize) {
-/*puts("data read failed\n");*/
- return;
- }
- }
-
- /* Zero out bss. */
- if (coff->a.bsize != 0)
- bzero(coff->a.bss_start, coff->a.bsize);
-
-#if 0
- ffp_save = coff->a.text_start + coff->a.tsize;
- if (ffp_save < coff->a.data_start + coff->a.dsize)
- ffp_save = coff->a.data_start + coff->a.dsize;
- if (ffp_save < coff->a.bss_start + coff->a.bsize)
- ffp_save = coff->a.bss_start + coff->a.bsize;
- ffp_save = k0segtophys((ffp_save + PGOFSET & ~PGOFSET)) >> PGSHIFT;
- ffp_save += 2; /* XXX OSF/1 does this, no idea why. */
-#endif
-
- {
- extern int diskdev;
- prom_close(diskdev);
- }
- (*(void (*)())coff->a.entry)();
-}
-
-/*
- * Open 'filename', read in program and return the entry point or -1 if error.
- */
-static inline void
-loadfile(fname)
- char *fname;
-{
- struct devices *dp;
- union {
- struct exec aout;
- struct exechdr coff;
- } hdr;
- ssize_t nr;
- int fd, rval;
-
- /* Open the file. */
- /* rval = 1; */
- if ((fd = open(fname, 0)) < 0) {
-/*puts("open failed\n");*/
- return;
- }
-
- /* Read the exec header. */
- if ((nr = read(fd, &hdr, sizeof(hdr))) != sizeof(hdr)) {
-/*puts("header read failed\n");*/
- return;
- }
-
-#if 0
- /* Exec a.out or COFF. */
- rval = N_COFFBADMAG(hdr.coff.a) ?
- aout_exec(fd, &hdr.aout, entryp) :
- coff_exec(fd, &hdr.coff, entryp);
-#endif
- coff_exec(fd, &hdr.coff);
-/*puts("coff_exec returned\n");*/
-}
-
-void
-main()
-{
-
- /* Init prom callback vector. */
- init_prom_calls();
-
- /* print a banner */
-/* puts("loading /boot...\n");*/
-
- loadfile("/boot");
-/* puts("couln't load /boot.\n");*/
-}
diff --git a/sys/arch/alpha/stand/bootxx/disk.c b/sys/arch/alpha/stand/bootxx/disk.c
deleted file mode 100644
index a7ab02f742b..00000000000
--- a/sys/arch/alpha/stand/bootxx/disk.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* $NetBSD: disk.c,v 1.3 1995/06/28 00:59:02 cgd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and Ralph Campbell.
- *
- * 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.
- *
- * @(#)rz.c 8.1 (Berkeley) 6/10/93
- */
-
-
-#if 0
-/*#include "stand.h"*/
-#include <sys/param.h>
-#include <machine/prom.h>
-#endif
-#include <sys/disklabel.h>
-
-#include "libsa/disklabel.c"
-
-struct disk_softc {
- int sc_fd; /* PROM channel number */
- int sc_ctlr; /* controller number */
- int sc_unit; /* disk unit number */
- int sc_part; /* disk partition number */
- struct disklabel sc_label; /* disk label for this disk */
-};
-
-int
-diskstrategy(devdata, rw, bn, reqcnt, addr, cnt)
- void *devdata;
- int rw;
- daddr_t bn;
- u_int reqcnt;
- char *addr;
- u_int *cnt; /* out: number of bytes transfered */
-{
- struct disk_softc *sc;
- struct partition *pp;
- prom_return_t ret;
- int s;
-
- /* Partial-block transfers not handled. */
- if (reqcnt & (DEV_BSIZE - 1)) {
- *cnt = 0;
- return (EINVAL);
- }
-
- sc = (struct disk_softc *)devdata;
- pp = &sc->sc_label.d_partitions[sc->sc_part];
-
- ret.bits = prom_read(sc->sc_fd, reqcnt, addr, bn + pp->p_offset);
- if (ret.u.status)
- return (EIO);
- *cnt = ret.u.retval;
- return (0);
-}
-
-int diskdev;
-
-static inline int
-diskopen(f, ctlr, unit, part)
- struct open_file *f;
- int ctlr, unit, part;
-{
- struct disklabel *lp;
- prom_return_t ret;
- int cnt, devlen, i;
- char *msg, buf[DEV_BSIZE], devname[32];
- struct disk_softc *sc;
-
-#if 0
- if (unit >= 8 || part >= 8)
- return (ENXIO);
-#endif
-
- /*
- * XXX
- * We don't know what device names look like yet,
- * so we can't change them.
- */
- ret.bits = prom_getenv(PROM_E_BOOTED_DEV, devname, sizeof(devname));
- devlen = ret.u.retval;
-
- ret.bits = prom_open(devname, devlen);
- if (ret.u.status)
- return (EIO);
-
- sc = alloc(sizeof(struct disk_softc));
- f->f_devdata = (void *)sc;
-
- diskdev = sc->sc_fd = ret.u.retval;
-#if 0
- sc->sc_ctlr = ctlr;
- sc->sc_unit = unit;
- sc->sc_part = part;
-#endif
-
- /* Try to read disk label and partition table information. */
- lp = &sc->sc_label;
- lp->d_secsize = DEV_BSIZE;
- lp->d_secpercyl = 1;
- lp->d_npartitions = MAXPARTITIONS;
- lp->d_partitions[part].p_offset = 0;
- lp->d_partitions[part].p_size = 0x7fffffff;
- i = diskstrategy(sc, F_READ,
- (daddr_t)LABELSECTOR, DEV_BSIZE, buf, &cnt);
- if (i || cnt != DEV_BSIZE) {
- goto bad;
- } else {
- msg = getdisklabel(buf, lp);
- if (msg) {
- goto bad;
- }
- }
-
- if (part >= lp->d_npartitions || lp->d_partitions[part].p_size == 0) {
-bad: free(sc, sizeof(struct disk_softc));
- return (ENXIO);
- }
- return (0);
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/Makefile b/sys/arch/alpha/stand/bootxx/libsa/Makefile
deleted file mode 100644
index 697e1aac980..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# $NetBSD: Makefile,v 1.2 1995/02/16 02:33:14 cgd Exp $
-
-LIB= sa
-#SRCS= alloc.c bzero.c close.c dev.c devopen.c disklabel.c getfile.c \
-# gets.c ioctl.c lseek.c open.c printf.c read.c strcmp.c ufs.c \
-# write.c bcopy.c filesystem.c strlen.c ntohl.c
-SRCS+= alloc.c bzero.c ufs.c read.c bcopy.c lseek.c #open.c
-
-#.PATH: ../../../../lib/libsa ../../../../lib/libkern
-#.PATH: /sys/lib/libsa /sys/lib/libkern
-.PATH: /sys/lib/libkern
-NOPIC=nopic
-NOPROFILE=noprofile
-
-.include <bsd.lib.mk>
-
-#CFLAGS= -mno-fp-regs -I../../../.. -I. -DCOMPAT_UFS
-#CFLAGS= -O6 -mno-fp-regs -I.. -I/sys -I. -DCOMPAT_UFS
-CFLAGS= -mno-fp-regs -I.. -I/sys -I. -DCOMPAT_UFS -finline-functions -O6
diff --git a/sys/arch/alpha/stand/bootxx/libsa/alloc.c b/sys/arch/alpha/stand/bootxx/libsa/alloc.c
deleted file mode 100644
index a71313f9a04..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/alloc.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $NetBSD: alloc.c,v 1.1 1995/02/13 23:08:35 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * The Mach Operating System project at Carnegie-Mellon University.
- *
- * 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.
- *
- * @(#)alloc.c 8.1 (Berkeley) 6/11/93
- *
- *
- * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Author: Alessandro Forin
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-
-/*
- * Dynamic memory allocator
- */
-struct fl {
- struct fl *next;
- unsigned size;
-} *freelist = (struct fl *)0;
-
-extern char _end[];
-static char *top = _end;
-
-void *
-alloc(size)
- unsigned size;
-{
- register struct fl *f = freelist, **prev;
-
- prev = &freelist;
- while (f && f->size < size) {
- prev = &f->next;
- f = f->next;
- }
- if (f == (struct fl *)0) {
- f = (struct fl *)top;
- top += ALIGN(size);
- } else
- *prev = f->next;
- bzero(f, size);
- return ((void *)f);
-}
-
-void
-free(ptr, size)
- void *ptr;
- unsigned size;
-{
- register struct fl *f = (struct fl *)ptr;
-
- f->size = ALIGN(size);
- f->next = freelist;
- freelist = f;
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/bcopy.c b/sys/arch/alpha/stand/bootxx/libsa/bcopy.c
deleted file mode 100644
index 4f1f4d0b2b2..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/bcopy.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $NetBSD: bcopy.c,v 1.1 1995/02/13 23:08:35 cgd Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)bcopy.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/types.h>
-
-/*
- * This is designed to be small, not fast.
- */
-void
-bcopy(s1, s2, n)
- const void *s1;
- void *s2;
- size_t n;
-{
- register const char *f = s1;
- register char *t = s2;
-
- if (f < t) {
- f += n;
- t += n;
- while (n-- > 0)
- *--t = *--f;
- } else
- while (n-- > 0)
- *t++ = *f++;
-}
-
-#if 0
-void *
-memcpy(s1, s2, n)
- void *s1;
- const void *s2;
- size_t n;
-{
- bcopy(s2, s1, n);
- return s1;
-}
-#endif
diff --git a/sys/arch/alpha/stand/bootxx/libsa/devopen.c b/sys/arch/alpha/stand/bootxx/libsa/devopen.c
deleted file mode 100644
index 321d02d0fa3..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/devopen.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/* $NetBSD: devopen.c,v 1.2 1995/02/16 02:33:15 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- *
- * @(#)devopen.c 8.1 (Berkeley) 6/10/93
- */
-
-#if 0
-#include "stand.h"
-#endif
-
-/*
- * Decode the string 'fname', open the device and return the remaining
- * file name if any.
- */
-static inline int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file; /* out */
-{
-#if 0
- register char *cp;
- register char *ncp;
- register struct devsw *dp;
- register int c, i;
- int ctlr = 0, unit = 0, part = 0;
- char namebuf[20];
- int rc;
-
- cp = fname;
- ncp = namebuf;
-
- /* look for a string like '5/rz0/vmunix' or '5/rz3f/vmunix */
- if ((c = *cp) >= '0' && c <= '9') {
- ctlr = c - '0';
- /* skip the '/' */
- if (*++cp != '/')
- return (ENXIO);
- cp++;
- while ((c = *cp) != '\0') {
- if (c == '/')
- break;
- if (c >= '0' && c <= '9') {
- /* read unit number */
- unit = c - '0';
-
- /* look for a partition */
- if ((c = *++cp) >= 'a' && c <= 'h') {
- part = c - 'a';
- c = *++cp;
- }
- if (c != '/')
- return (ENXIO);
- break;
- }
- if (ncp < namebuf + sizeof(namebuf) - 1)
- *ncp++ = c;
- cp++;
- }
- *ncp = '\0';
- /*
- * XXX
- * pulling strchr from the C library, should pull from libkern.
- */
- } else if (strchr(cp, '(')) {
- /* expect a string like 'rz(0,0,0)vmunix' */
- while ((c = *cp) != '\0') {
- if (c == '(') {
- cp++;
- break;
- }
- if (ncp < namebuf + sizeof(namebuf) - 1)
- *ncp++ = c;
- cp++;
- }
-
- /* get controller number */
- if ((c = *cp) >= '0' && c <= '9') {
- ctlr = c - '0';
- c = *++cp;
- }
-
- if (c == ',') {
- /* get SCSI device number */
- if ((c = *++cp) >= '0' && c <= '9') {
- unit = c - '0';
- c = *++cp;
- }
-
- if (c == ',') {
- /* get partition number */
- if ((c = *++cp) >= '0' && c <= '9') {
- part = c - '0';
- c = *++cp;
- }
- }
- }
- if (c != ')')
- return (ENXIO);
- cp++;
- *ncp = '\0';
- } else {
- dp = devsw;
- ctlr = unit = part = 0;
- goto fnd;
- }
-
- for (dp = devsw, i = 0; i < ndevs; dp++, i++)
- if (dp->dv_name && strcmp(namebuf, dp->dv_name) == 0)
- goto fnd;
- printf("Unknown device '%s'\nKnown devices are:", namebuf);
- for (dp = devsw, i = 0; i < ndevs; dp++, i++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- return (ENXIO);
-
-fnd:
- rc = (dp->dv_open)(f, ctlr, unit, part);
- if (rc)
- return (rc);
-
- f->f_dev = dp;
- if (file && *cp != '\0')
- *file = cp;
- return (0);
-#endif
-
- *file = fname;
- return (diskopen(f, 0, 0,0));
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/disklabel.c b/sys/arch/alpha/stand/bootxx/libsa/disklabel.c
deleted file mode 100644
index 70ee3c0ecaf..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/disklabel.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $NetBSD: disklabel.c,v 1.1 1995/02/13 23:08:38 cgd Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)disklabel.c 8.1 (Berkeley) 6/11/93
- */
-
-#if 0
-#include <sys/param.h>
-#include <sys/disklabel.h>
-#endif
-
-static inline char *
-getdisklabel(buf, lp)
- const char *buf;
- struct disklabel *lp;
-{
- struct disklabel *dlp, *elp;
- char *msg = (char *)0;
-
- *lp = *(struct disklabel *)(buf + LABELOFFSET);
- return (msg);
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/lseek.c b/sys/arch/alpha/stand/bootxx/libsa/lseek.c
deleted file mode 100644
index 445f4f03607..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/lseek.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $NetBSD: lseek.c,v 1.1 1995/02/13 23:08:39 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * The Mach Operating System project at Carnegie-Mellon University.
- *
- * 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.
- *
- * @(#)lseek.c 8.1 (Berkeley) 6/11/93
- *
- *
- * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Author: Alessandro Forin
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include "stand.h"
-
-off_t
-lseek(fd, offset, where)
- int fd;
- off_t offset;
- int where;
-{
- register struct open_file *f = &files[fd];
-
-#if 0
- if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
- return (-1);
- }
-
- /* seek is not supported on raw devices */
- if (f->f_flags & F_RAW) {
- return ((off_t)-1);
- }
-#endif
-
- return ufs_seek(f, offset, where);
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/open.c b/sys/arch/alpha/stand/bootxx/libsa/open.c
deleted file mode 100644
index 0af547acabe..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/open.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $NetBSD: open.c,v 1.1 1995/02/13 23:08:40 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * The Mach Operating System project at Carnegie-Mellon University.
- *
- * 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.
- *
- * @(#)open.c 8.1 (Berkeley) 6/11/93
- *
- *
- * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Author: Alessandro Forin
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#if 0
-#include "stand.h"
-#endif
-
-#include "../disk.c"
-#include "devopen.c"
-
-struct open_file files[SOPEN_MAX];
-
-
-/*
- * File primitives proper
- */
-
-static inline int
-open(fname, mode)
- const char *fname;
- int mode;
-{
- register struct open_file *f;
- register int fd, i, error;
- char *file;
-
- /* find a free file descriptor */
- for (fd = 0, f = files; fd < SOPEN_MAX; fd++, f++)
- if (f->f_flags == 0)
- goto fnd;
- return (-1);
-fnd:
- /*
- * Try to open the device.
- * Convert open mode (0,1,2) to F_READ, F_WRITE.
- */
- f->f_flags = /* 0 + */ 1;
- file = (char *)0;
- error = devopen(f, fname, &file);
-/*puts("just devopened\n");*/
- if (error)
- goto err;
-
- /* see if we opened a raw device; otherwise, 'file' is the file name. */
- if (file == (char *)0) {
- f->f_flags |= F_RAW;
-/*puts("was raw, return");*/
- return (0);
- }
-
- /* pass file name to the different filesystem open routines */
-/*puts("going to ufs_open: ");*/
-/*puts(file);*/
-/*puts("\n");*/
- error = ufs_open(file, f);
- if (error == 0)
- return (fd);
-
-err:
- f->f_flags = 0;
- return (-1);
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/read.c b/sys/arch/alpha/stand/bootxx/libsa/read.c
deleted file mode 100644
index 895b2ecdd7a..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/read.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $NetBSD: read.c,v 1.1 1995/02/13 23:08:41 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * The Mach Operating System project at Carnegie-Mellon University.
- *
- * 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.
- *
- * @(#)read.c 8.1 (Berkeley) 6/11/93
- *
- *
- * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Author: Alessandro Forin
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include "stand.h"
-
-int
-read(fd, dest, bcount)
- int fd;
- void *dest;
- u_int bcount;
-{
- register struct open_file *f = &files[fd];
- u_int resid;
-
-#if 0
- if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) {
- return (-1);
- }
-#endif
- if (f->f_flags & F_RAW) {
- if (diskstrategy(f->f_devdata, F_READ,
- (daddr_t)0, bcount, dest, &resid))
- return (-1);
- return (resid);
- }
- resid = bcount;
- if (ufs_read(f, dest, bcount, &resid))
- return (-1);
- return (bcount - resid);
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/strcmp.c b/sys/arch/alpha/stand/bootxx/libsa/strcmp.c
deleted file mode 100644
index 355a29134dd..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/strcmp.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $NetBSD: strcmp.c,v 1.1 1995/02/13 23:08:42 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#ifdef notdef
-static char *sccsid = "@(#)strcmp.c 5.5 (Berkeley) 1/26/91";
-#endif
-static char *rcsid = "$NetBSD: strcmp.c,v 1.1 1995/02/13 23:08:42 cgd Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#if 0
-#include <sys/cdefs.h>
-#include <string.h>
-#endif
-
-/*
- * Compare strings.
- */
-static inline int
-strcmp(s1, s2)
- register const char *s1, *s2;
-{
- while (*s1 == *s2++)
- if (*s1++ == 0)
- return (0);
- return (*(unsigned char *)s1 - *(unsigned char *)--s2);
-}
diff --git a/sys/arch/alpha/stand/bootxx/libsa/strlen.c b/sys/arch/alpha/stand/bootxx/libsa/strlen.c
deleted file mode 100644
index fb33e6ddac8..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/strlen.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $NetBSD: strlen.c,v 1.1 1995/02/13 23:08:43 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#ifdef notdef
-static char *sccsid = "@(#)strlen.c 5.5 (Berkeley) 1/26/91";
-#endif
-static char *rcsid = "$NetBSD: strlen.c,v 1.1 1995/02/13 23:08:43 cgd Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#if 0
-#include <sys/cdefs.h>
-/*#include <string.h>*/
-#include <lib/libkern/libkern.h>
-#endif
-
-static inline size_t
-strlen(str)
- const char *str;
-{
- register const char *s;
-
- for (s = str; *s; ++s);
- return(s - str);
-}
-
diff --git a/sys/arch/alpha/stand/bootxx/libsa/ufs.c b/sys/arch/alpha/stand/bootxx/libsa/ufs.c
deleted file mode 100644
index e8b4bb60c8a..00000000000
--- a/sys/arch/alpha/stand/bootxx/libsa/ufs.c
+++ /dev/null
@@ -1,690 +0,0 @@
-/* $NetBSD: ufs.c,v 1.1 1995/02/13 23:08:44 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * The Mach Operating System project at Carnegie-Mellon University.
- *
- * 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.
- *
- *
- * Copyright (c) 1990, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Author: David Golub
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * Stand-alone file reading package.
- */
-
-#include <string.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <ufs/ffs/fs.h>
-#include <ufs/ufs/dinode.h>
-#include <ufs/ufs/dir.h>
-#include <lib/libkern/libkern.h>
-
-#include "stand.h"
-
-#include "strcmp.c"
-#include "strlen.c"
-
-/*
- * In-core open file.
- */
-struct file {
- off_t f_seekp; /* seek pointer */
- struct fs *f_fs; /* pointer to super-block */
- struct dinode f_di; /* copy of on-disk inode */
- int f_nindir[NIADDR];
- /* number of blocks mapped by
- indirect block at level i */
- char *f_blk[NIADDR]; /* buffer for indirect block at
- level i */
- u_int f_blksize[NIADDR];
- /* size of buffer */
- daddr_t f_blkno[NIADDR];/* disk address of block in buffer */
- char *f_buf; /* buffer for data block */
- u_int f_buf_size; /* size of data block */
- daddr_t f_buf_blkno; /* block number of data block */
-};
-
-#ifdef COMPAT_UFS
-/*
- * Sanity checks for old file systems.
- *
- * XXX - goes away some day.
- */
-static inline void
-ffs_oldfscompat(fs)
- struct fs *fs;
-{
- int i;
-
- fs->fs_npsect = max(fs->fs_npsect, fs->fs_nsect); /* XXX */
- fs->fs_interleave = max(fs->fs_interleave, 1); /* XXX */
- if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */
- fs->fs_nrpos = 8; /* XXX */
- if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
- quad_t sizepb = fs->fs_bsize; /* XXX */
- /* XXX */
- fs->fs_maxfilesize = fs->fs_bsize * NDADDR - 1; /* XXX */
- for (i = 0; i < NIADDR; i++) { /* XXX */
- sizepb *= NINDIR(fs); /* XXX */
- fs->fs_maxfilesize += sizepb; /* XXX */
- } /* XXX */
- fs->fs_qbmask = ~fs->fs_bmask; /* XXX */
- fs->fs_qfmask = ~fs->fs_fmask; /* XXX */
- } /* XXX */
-}
-#endif
-
-/*
- * Read a new inode into a file structure.
- */
-static int
-read_inode(inumber, f)
- ino_t inumber;
- struct open_file *f;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct fs *fs = fp->f_fs;
- char *buf;
- u_int rsize;
- int rc;
-
- /*
- * Read inode and save it.
- */
- buf = alloc(fs->fs_bsize);
- rc = diskstrategy(f->f_devdata, F_READ,
- fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, buf, &rsize);
- if (rc || rsize != fs->fs_bsize)
- goto out;
-
- {
- register struct dinode *dp;
-
- dp = (struct dinode *)buf;
- fp->f_di = dp[ino_to_fsbo(fs, inumber)];
- }
-
- /*
- * Clear out the old buffers
- */
- {
- register int level;
-
- for (level = 0; level < NIADDR; level++)
- fp->f_blkno[level] = -1;
- fp->f_buf_blkno = -1;
- }
-out:
- free(buf, fs->fs_bsize);
- return (0);
-}
-
-/*
- * Given an offset in a file, find the disk block number that
- * contains that block.
- */
-static int
-block_map(f, file_block, disk_block_p)
- struct open_file *f;
- daddr_t file_block;
- daddr_t *disk_block_p; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct fs *fs = fp->f_fs;
- int level;
- int idx;
- daddr_t ind_block_num;
- daddr_t *ind_p;
- int rc;
-
- /*
- * Index structure of an inode:
- *
- * di_db[0..NDADDR-1] hold block numbers for blocks
- * 0..NDADDR-1
- *
- * di_ib[0] index block 0 is the single indirect block
- * holds block numbers for blocks
- * NDADDR .. NDADDR + NINDIR(fs)-1
- *
- * di_ib[1] index block 1 is the double indirect block
- * holds block numbers for INDEX blocks for blocks
- * NDADDR + NINDIR(fs) ..
- * NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
- *
- * di_ib[2] index block 2 is the triple indirect block
- * holds block numbers for double-indirect
- * blocks for blocks
- * NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
- * NDADDR + NINDIR(fs) + NINDIR(fs)**2
- * + NINDIR(fs)**3 - 1
- */
-
- if (file_block < NDADDR) {
- /* Direct block. */
- *disk_block_p = fp->f_di.di_db[file_block];
- return (0);
- }
-
- file_block -= NDADDR;
-
- /*
- * nindir[0] = NINDIR
- * nindir[1] = NINDIR**2
- * nindir[2] = NINDIR**3
- * etc
- */
- for (level = 0; level < NIADDR; level++) {
- if (file_block < fp->f_nindir[level])
- break;
- file_block -= fp->f_nindir[level];
- }
- if (level == NIADDR) {
- /* Block number too high */
- return (EFBIG);
- }
-
- ind_block_num = fp->f_di.di_ib[level];
-
- for (; level >= 0; level--) {
- if (ind_block_num == 0) {
- *disk_block_p = 0; /* missing */
- return (0);
- }
-
- if (fp->f_blkno[level] != ind_block_num) {
- if (fp->f_blk[level] == (char *)0)
- fp->f_blk[level] =
- alloc(fs->fs_bsize);
- rc = diskstrategy(f->f_devdata, F_READ,
- fsbtodb(fp->f_fs, ind_block_num),
- fs->fs_bsize,
- fp->f_blk[level],
- (u_int *)&fp->f_blksize[level]);
- if (rc)
- return (rc);
- if (fp->f_blksize[level] != fs->fs_bsize)
- return (EIO);
- fp->f_blkno[level] = ind_block_num;
- }
-
- ind_p = (daddr_t *)fp->f_blk[level];
-
- if (level > 0) {
- idx = file_block / fp->f_nindir[level - 1];
- file_block %= fp->f_nindir[level - 1];
- } else
- idx = file_block;
-
- ind_block_num = ind_p[idx];
- }
-
- *disk_block_p = ind_block_num;
-
- return (0);
-}
-
-/*
- * Read a portion of a file into an internal buffer. Return
- * the location in the buffer and the amount in the buffer.
- */
-static int
-buf_read_file(f, buf_p, size_p)
- struct open_file *f;
- char **buf_p; /* out */
- u_int *size_p; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct fs *fs = fp->f_fs;
- long off;
- register daddr_t file_block;
- daddr_t disk_block;
- long block_size;
- int rc;
-
- off = blkoff(fs, fp->f_seekp);
- file_block = lblkno(fs, fp->f_seekp);
- block_size = dblksize(fs, &fp->f_di, file_block);
-
- if (file_block != fp->f_buf_blkno) {
- rc = block_map(f, file_block, &disk_block);
- if (rc)
- return (rc);
-
- if (fp->f_buf == (char *)0)
- fp->f_buf = alloc(fs->fs_bsize);
-
- if (disk_block == 0) {
- bzero(fp->f_buf, block_size);
- fp->f_buf_size = block_size;
- } else {
- rc = diskstrategy(f->f_devdata, F_READ,
- fsbtodb(fs, disk_block),
- block_size, fp->f_buf, &fp->f_buf_size);
- if (rc)
- return (rc);
- }
-
- fp->f_buf_blkno = file_block;
- }
-
- /*
- * Return address of byte in buffer corresponding to
- * offset, and size of remainder of buffer after that
- * byte.
- */
- *buf_p = fp->f_buf + off;
- *size_p = block_size - off;
-
- /*
- * But truncate buffer at end of file.
- */
- if (*size_p > fp->f_di.di_size - fp->f_seekp)
- *size_p = fp->f_di.di_size - fp->f_seekp;
-
- return (0);
-}
-
-/*
- * Search a directory for a name and return its
- * i_number.
- */
-static inline int
-search_directory(name, f, inumber_p)
- char *name;
- struct open_file *f;
- ino_t *inumber_p; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct direct *dp;
- struct direct *edp;
- char *buf;
- u_int buf_size;
- int namlen, length;
- int rc;
-
- length = strlen(name);
-
- fp->f_seekp = 0;
- while (fp->f_seekp < fp->f_di.di_size) {
- rc = buf_read_file(f, &buf, &buf_size);
- if (rc)
- return (rc);
-
- dp = (struct direct *)buf;
- edp = (struct direct *)(buf + buf_size);
- while (dp < edp) {
- if (dp->d_ino == (ino_t)0)
- goto next;
-#if BYTE_ORDER == LITTLE_ENDIAN
- if (fp->f_fs->fs_maxsymlinklen <= 0)
- namlen = dp->d_type;
- else
-#endif
- namlen = dp->d_namlen;
- if (namlen == length &&
- !strcmp(name, dp->d_name)) {
- /* found entry */
- *inumber_p = dp->d_ino;
- return (0);
- }
- next:
- dp = (struct direct *)((char *)dp + dp->d_reclen);
- }
- fp->f_seekp += buf_size;
- }
- return (ENOENT);
-}
-
-/*
- * Open a file.
- */
-int
-ufs_open(path, f)
- char *path;
- struct open_file *f;
-{
- register char *cp, *ncp;
- register int c;
- ino_t inumber, parent_inumber;
- struct file *fp;
- struct fs *fs;
- int rc;
- u_int buf_size;
-#if 0
- int nlinks = 0;
- char namebuf[MAXPATHLEN+1];
-#endif
-
- /* allocate file system specific data structure */
- fp = alloc(sizeof(struct file));
- f->f_fsdata = (void *)fp;
-
- /* allocate space and read super block */
- fs = alloc(SBSIZE);
- fp->f_fs = fs;
- rc = diskstrategy(f->f_devdata, F_READ,
- SBLOCK, SBSIZE, (char *)fs, &buf_size);
- if (rc)
- goto out;
-
- if (buf_size != SBSIZE || fs->fs_magic != FS_MAGIC ||
- fs->fs_bsize > MAXBSIZE || fs->fs_bsize < sizeof(struct fs)) {
- rc = EINVAL;
- goto out;
- }
-#ifdef COMPAT_UFS
- ffs_oldfscompat(fs);
-#endif
-
- /*
- * Calculate indirect block levels.
- */
- {
- register int mult;
- register int level;
-
- mult = 1;
- for (level = 0; level < NIADDR; level++) {
- mult *= NINDIR(fs);
- fp->f_nindir[level] = mult;
- }
- }
-
- inumber = ROOTINO;
- if ((rc = read_inode(inumber, f)) != 0)
- goto out;
-
- cp = path;
- while (*cp) {
-
- /*
- * Remove extra separators
- */
- while (*cp == '/')
- cp++;
- if (*cp == '\0')
- break;
-
- /*
- * Check that current node is a directory.
- */
- if ((fp->f_di.di_mode & IFMT) != IFDIR) {
- rc = ENOTDIR;
- goto out;
- }
-
- /*
- * Get next component of path name.
- */
- {
- register int len = 0;
-
- ncp = cp;
- while ((c = *cp) != '\0' && c != '/') {
- if (++len > MAXNAMLEN) {
- rc = ENOENT;
- goto out;
- }
- cp++;
- }
- *cp = '\0';
- }
-
- /*
- * Look up component in current directory.
- * Save directory inumber in case we find a
- * symbolic link.
- */
- parent_inumber = inumber;
- rc = search_directory(ncp, f, &inumber);
- *cp = c;
- if (rc)
- goto out;
-
- /*
- * Open next component.
- */
- if ((rc = read_inode(inumber, f)) != 0)
- goto out;
-
-#if 0
- /*
- * Check for symbolic link.
- */
- if ((fp->i_mode & IFMT) == IFLNK) {
- int link_len = fp->f_di.di_size;
- int len;
-
- len = strlen(cp) + 1;
-
- if (fp->f_di.di_size >= MAXPATHLEN - 1 ||
- ++nlinks > MAXSYMLINKS) {
- rc = ENOENT;
- goto out;
- }
-
- strcpy(&namebuf[link_len], cp);
-
- if ((fp->i_flags & IC_FASTLINK) != 0) {
- bcopy(fp->i_symlink, namebuf, (unsigned) link_len);
- } else {
- /*
- * Read file for symbolic link
- */
- char *buf;
- u_int buf_size;
- daddr_t disk_block;
- register struct fs *fs = fp->f_fs;
-
- (void) block_map(f, (daddr_t)0, &disk_block);
- rc = device_read(&fp->f_dev,
- fsbtodb(fs, disk_block),
- blksize(fs, fp, 0),
- &buf, &buf_size);
- if (rc)
- goto out;
-
- bcopy((char *)buf, namebuf, (unsigned)link_len);
- free(buf, buf_size);
- }
-
- /*
- * If relative pathname, restart at parent directory.
- * If absolute pathname, restart at root.
- */
- cp = namebuf;
- if (*cp != '/')
- inumber = parent_inumber;
- else
- inumber = (ino_t)ROOTINO;
-
- if ((rc = read_inode(inumber, fp)) != 0)
- goto out;
- }
-#endif
- }
-
- /*
- * Found terminal component.
- */
- rc = 0;
-out:
- if (rc)
- free(fp, sizeof(struct file));
- return (rc);
-}
-
-int
-ufs_close(f)
- struct open_file *f;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- int level;
-
- f->f_fsdata = (void *)0;
- if (fp == (struct file *)0)
- return (0);
-
- for (level = 0; level < NIADDR; level++) {
- if (fp->f_blk[level])
- free(fp->f_blk[level], fp->f_fs->fs_bsize);
- }
- if (fp->f_buf)
- free(fp->f_buf, fp->f_fs->fs_bsize);
- free(fp->f_fs, SBSIZE);
- free(fp, sizeof(struct file));
- return (0);
-}
-
-/*
- * Copy a portion of a file into kernel memory.
- * Cross block boundaries when necessary.
- */
-int
-ufs_read(f, start, size, resid)
- struct open_file *f;
- char *start;
- u_int size;
- u_int *resid; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register u_int csize;
- char *buf;
- u_int buf_size;
- int rc = 0;
-
- while (size != 0) {
- if (fp->f_seekp >= fp->f_di.di_size)
- break;
-
- rc = buf_read_file(f, &buf, &buf_size);
- if (rc)
- break;
-
- csize = size;
- if (csize > buf_size)
- csize = buf_size;
-
- bcopy(buf, start, csize);
-
- fp->f_seekp += csize;
- start += csize;
- size -= csize;
- }
- if (resid)
- *resid = size;
- return (rc);
-}
-
-#if 0
-/*
- * Not implemented.
- */
-int
-ufs_write(f, start, size, resid)
- struct open_file *f;
- char *start;
- u_int size;
- u_int *resid; /* out */
-{
-
- return (EROFS);
-}
-#endif
-
-off_t
-ufs_seek(f, offset, where)
- struct open_file *f;
- off_t offset;
- int where;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
-
- switch (where) {
- case SEEK_SET:
- fp->f_seekp = offset;
- break;
- case SEEK_CUR:
- fp->f_seekp += offset;
- break;
- case SEEK_END:
- fp->f_seekp = fp->f_di.di_size - offset;
- break;
- default:
- return (-1);
- }
- return (fp->f_seekp);
-}
-
-#if 0
-int
-ufs_stat(f, sb)
- struct open_file *f;
- struct stat *sb;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
-
- /* only important stuff */
- sb->st_mode = fp->f_di.di_mode;
- sb->st_uid = fp->f_di.di_uid;
- sb->st_gid = fp->f_di.di_gid;
- sb->st_size = fp->f_di.di_size;
- return (0);
-}
-#endif
diff --git a/sys/arch/alpha/stand/bootxx/stand.h b/sys/arch/alpha/stand/bootxx/stand.h
deleted file mode 100644
index 66f93ebcad2..00000000000
--- a/sys/arch/alpha/stand/bootxx/stand.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $NetBSD: stand.h,v 1.1 1995/02/13 23:08:31 cgd Exp $ */
-
-/*-
- * Copyright (c) 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.
- *
- * @(#)stand.h 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-#include <sys/stat.h>
-#include <lib/libsa/saioctl.h>
-#include <lib/libsa/saerrno.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* where values for lseek(2) */
-#define SEEK_SET 0 /* set file offset to offset */
-#define SEEK_CUR 1 /* set file offset to current plus offset */
-#define SEEK_END 2 /* set file offset to EOF plus offset */
-
-struct open_file {
- int f_flags; /* see F_* below */
- void *f_devdata; /* device specific data */
- void *f_fsdata; /* file system specific data */
-};
-
-#define SOPEN_MAX 2
-extern struct open_file files[SOPEN_MAX];
-extern int nfsys;
-
-/* f_flags values */
-#define F_READ 0x0001 /* file opened for reading */
-#define F_WRITE 0x0002 /* file opened for writing */
-#define F_RAW 0x0004 /* raw device open - no file system */
-#define F_NODEV 0x0008 /* network open - no device */
-
-#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
-#define tolower(c) ((c) - 'A' + 'a')
-#define isspace(c) ((c) == ' ' || (c) == '\t')
-#define isdigit(c) ((c) >= '0' && (c) <= '9')
-
-int devopen __P((struct open_file *f, const char *fname, char **file));
-void *alloc __P((unsigned size));
-void free __P((void *ptr, unsigned size));
-struct disklabel;
-char *getdisklabel __P((const char *buf, struct disklabel *lp));
-
-void printf __P((const char *, ...));
-void gets __P((char *));
-__dead void panic __P((const char *, ...))
- __attribute__((noreturn));
-int getchar __P((void));
-int exec __P((char *, char *, int));
-int open __P((const char *,int));
-int close __P((int));
-int read __P((int, void *, u_int));
-int write __P((int, void *, u_int));
-
-int nodev(), noioctl();
-void nullsys();
-
-/* Machine dependent functions */
-void machdep_start __P((char *, int, char *, char *, char *));
-int machdep_exec __P((char *, char *, int));
-int getchar __P((void));
-void putchar __P((int));
diff --git a/sys/arch/alpha/stand/bootxx/start.S b/sys/arch/alpha/stand/bootxx/start.S
deleted file mode 100644
index d694bc84374..00000000000
--- a/sys/arch/alpha/stand/bootxx/start.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $NetBSD: start.S,v 1.2 1995/02/16 02:33:13 cgd Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#include "../include/asm.h"
-
-/*
- * start --
- * Entry point for boot/standalone programs.
- *
- * Arguments:
- * a0 long (first free physical page)
- *
- * This is where the prom comes to. Leaves all exception and interrupts
- * to prom, runs off prom's stack too. No return values.
- */
- .text
- .set noreorder /* don't reorder instructions */
-
-#define ENTRY_FRAME 32
-
-NESTED(start, 1, ENTRY_FRAME, ra, 0, 0)
- br pv,1f /* XXX I have no idea what this does. */
-1: SETGP(pv)
-
-#if 0
- lda sp,start /* start stack below text */
- lda sp,-ENTRY_FRAME(sp)
-#endif
- lda a0,_EDATA
- lda a1,_end
- subq a1,a0,a1
- CALL(bzero)
-
- CALL(main) /* transfer to C */
-
- call_pal PAL_halt /* halt if we ever return */
-END(start)
-
-/*
- * Dummy routine for GCC2.
- */
-LEAF(__main,0)
- RET
-END(__main)
diff --git a/sys/arch/alpha/stand/bootxx/headersize.c b/sys/arch/alpha/stand/headersize.c
index 11f8a963678..f586ff2d734 100644
--- a/sys/arch/alpha/stand/bootxx/headersize.c
+++ b/sys/arch/alpha/stand/headersize.c
@@ -1,4 +1,4 @@
-/* $NetBSD: headersize.c,v 1.2 1995/02/16 02:33:10 cgd Exp $ */
+/* $NetBSD: headersize.c,v 1.1 1995/11/23 02:38:59 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@@ -31,7 +31,7 @@
#include <sys/exec.h>
#include <machine/coff.h>
-#define HDR_BUFSIZE 8192
+#define HDR_BUFSIZE 512
main()
{
diff --git a/sys/arch/alpha/stand/installboot.c b/sys/arch/alpha/stand/installboot.c
new file mode 100644
index 00000000000..b0eb593395e
--- /dev/null
+++ b/sys/arch/alpha/stand/installboot.c
@@ -0,0 +1,389 @@
+/* $NetBSD: installboot.c,v 1.1 1995/11/23 02:39:02 cgd Exp $ */
+
+/*
+ * Copyright (c) 1994 Paul Kranenburg
+ * 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 Paul Kranenburg.
+ * 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.
+ */
+
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+#include <ufs/ufs/dinode.h>
+#include <ufs/ufs/dir.h>
+#include <ufs/ffs/fs.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "bbinfo.h"
+
+int verbose, nowrite, hflag;
+char *boot, *proto, *dev;
+
+struct bbinfoloc *bbinfolocp;
+struct bbinfo *bbinfop;
+int max_block_count;
+
+
+char *loadprotoblocks __P((char *, long *));
+int loadblocknums __P((char *, int));
+static void devread __P((int, void *, daddr_t, size_t, char *));
+static void usage __P((void));
+int main __P((int, char *[]));
+
+
+static void
+usage()
+{
+ fprintf(stderr,
+ "usage: installboot [-n] [-v] <boot> <proto> <device>\n");
+ exit(1);
+}
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int c;
+ int devfd;
+ char *protostore;
+ long protosize;
+ int mib[2];
+ size_t size;
+
+ while ((c = getopt(argc, argv, "vn")) != EOF) {
+ switch (c) {
+ case 'n':
+ /* Do not actually write the bootblock to disk */
+ nowrite = 1;
+ break;
+ case 'v':
+ /* Chat */
+ verbose = 1;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ if (argc - optind < 3) {
+ usage();
+ }
+
+ boot = argv[optind];
+ proto = argv[optind + 1];
+ dev = argv[optind + 2];
+
+ if (verbose) {
+ printf("boot: %s\n", boot);
+ printf("proto: %s\n", proto);
+ printf("device: %s\n", dev);
+ }
+
+ /* Load proto blocks into core */
+ if ((protostore = loadprotoblocks(proto, &protosize)) == NULL)
+ exit(1);
+
+ /* Open and check raw disk device */
+ if ((devfd = open(dev, O_RDONLY, 0)) < 0)
+ err(1, "open: %s", dev);
+
+ /* Extract and load block numbers */
+ if (loadblocknums(boot, devfd) != 0)
+ exit(1);
+
+ (void)close(devfd);
+
+ if (nowrite)
+ return 0;
+
+#if 0
+ /* Write patched proto bootblocks into the superblock */
+ if (protosize > SBSIZE - DEV_BSIZE)
+ errx(1, "proto bootblocks too big");
+#endif
+
+ if ((devfd = open(dev, O_RDWR, 0)) < 0)
+ err(1, "open: %s", dev);
+
+ if (lseek(devfd, DEV_BSIZE, SEEK_SET) != DEV_BSIZE)
+ err(1, "lseek bootstrap");
+
+ /* Sync filesystems (to clean in-memory superblock?) */
+ sync();
+ sleep(3);
+
+ if (write(devfd, protostore, protosize) != protosize)
+ err(1, "write bootstrap");
+
+ {
+
+#define BBPAD 0x1e0
+ struct bb {
+ char bb_pad[BBPAD]; /* disklabel lives in here, actually */
+ long bb_secsize; /* size of secondary boot block */
+ long bb_secstart; /* start of secondary boot block */
+ long bb_flags; /* unknown; always zero */
+ long bb_cksum; /* checksum of the the boot block, as longs. */
+ } bb;
+ long *lp, *ep;
+
+ if (lseek(devfd, 0, SEEK_SET) != 0)
+ err(1, "lseek label");
+
+ if (read(devfd, &bb, sizeof (bb)) != sizeof (bb))
+ err(1, "read label");
+
+ bb.bb_secsize = 15;
+ bb.bb_secstart = 1;
+ bb.bb_flags = 0;
+ bb.bb_cksum = 0;
+
+ for (lp = (long *)&bb, ep = &bb.bb_cksum; lp < ep; lp++)
+ bb.bb_cksum += *lp;
+
+ if (lseek(devfd, 0, SEEK_SET) != 0)
+ err(1, "lseek label 2");
+
+ if (write(devfd, &bb, sizeof bb) != sizeof bb)
+ err(1, "write label ");
+ }
+
+ (void)close(devfd);
+ return 0;
+}
+
+char *
+loadprotoblocks(fname, size)
+ char *fname;
+ long *size;
+{
+ int fd, sz;
+ char *bp;
+ struct stat statbuf;
+ struct exec *hp;
+ long off;
+ u_int64_t *matchp;
+
+ /*
+ * Read the prototype boot block into memory.
+ */
+ if ((fd = open(fname, O_RDONLY)) < 0) {
+ warn("open: %s", fname);
+ return NULL;
+ }
+ if (fstat(fd, &statbuf) != 0) {
+ warn("fstat: %s", fname);
+ close(fd);
+ return NULL;
+ }
+ sz = roundup(statbuf.st_size, DEV_BSIZE);
+ if ((bp = calloc(sz, 1)) == NULL) {
+ warnx("malloc: %s: no memory", fname);
+ close(fd);
+ return NULL;
+ }
+ if (read(fd, bp, statbuf.st_size) != statbuf.st_size) {
+ warn("read: %s", fname);
+ free(bp);
+ close(fd);
+ return NULL;
+ }
+ close(fd);
+
+ /*
+ * Find the magic area of the program, and figure out where
+ * the 'blocks' struct is, from that.
+ */
+ bbinfolocp = NULL;
+ for (matchp = (u_int64_t *)bp; (char *)matchp < bp + sz; matchp++) {
+ if (*matchp != 0xbabefacedeadbeef)
+ continue;
+ bbinfolocp = (struct bbinfoloc *)matchp;
+ if (bbinfolocp->magic1 == 0xbabefacedeadbeef &&
+ bbinfolocp->magic2 == 0xdeadbeeffacebabe)
+ break;
+ bbinfolocp = NULL;
+ }
+
+ if (bbinfolocp == NULL) {
+ warnx("%s: not a valid boot block?", fname);
+ return NULL;
+ }
+
+ bbinfop = (struct bbinfo *)(bp + bbinfolocp->end - bbinfolocp->start);
+ memset(bbinfop, 0, sz - (bbinfolocp->end - bbinfolocp->start));
+ max_block_count =
+ ((char *)bbinfop->blocks - bp) / sizeof (bbinfop->blocks[0]);
+
+ if (verbose) {
+ printf("boot block info locator at offset 0x%x\n",
+ (char *)bbinfolocp - bp);
+ printf("boot block info at offset 0x%x\n",
+ (char *)bbinfop - bp);
+ printf("max number of blocks: %d\n", max_block_count);
+ }
+
+ *size = sz;
+ return (bp);
+}
+
+static void
+devread(fd, buf, blk, size, msg)
+ int fd;
+ void *buf;
+ daddr_t blk;
+ size_t size;
+ char *msg;
+{
+ if (lseek(fd, dbtob(blk), SEEK_SET) != dbtob(blk))
+ err(1, "%s: devread: lseek", msg);
+
+ if (read(fd, buf, size) != size)
+ err(1, "%s: devread: read", msg);
+}
+
+static char sblock[SBSIZE];
+
+int
+loadblocknums(boot, devfd)
+char *boot;
+int devfd;
+{
+ int i, fd;
+ struct stat statbuf;
+ struct statfs statfsbuf;
+ struct fs *fs;
+ char *buf;
+ daddr_t blk, *ap;
+ struct dinode *ip;
+ int ndb;
+ int32_t cksum;
+
+ /*
+ * Open 2nd-level boot program and record the block numbers
+ * it occupies on the filesystem represented by `devfd'.
+ */
+ if ((fd = open(boot, O_RDONLY)) < 0)
+ err(1, "open: %s", boot);
+
+ if (fstatfs(fd, &statfsbuf) != 0)
+ err(1, "statfs: %s", boot);
+
+ if (strncmp(statfsbuf.f_fstypename, "ufs", MFSNAMELEN))
+ errx(1, "%s: must be on a UFS filesystem", boot);
+
+ if (fsync(fd) != 0)
+ err(1, "fsync: %s", boot);
+
+ if (fstat(fd, &statbuf) != 0)
+ err(1, "fstat: %s", boot);
+
+ close(fd);
+
+ /* Read superblock */
+ devread(devfd, sblock, btodb(SBOFF), SBSIZE, "superblock");
+ fs = (struct fs *)sblock;
+
+ /* Read inode */
+ if ((buf = malloc(fs->fs_bsize)) == NULL)
+ errx(1, "No memory for filesystem block");
+
+ blk = fsbtodb(fs, ino_to_fsba(fs, statbuf.st_ino));
+ devread(devfd, buf, blk, fs->fs_bsize, "inode");
+ ip = (struct dinode *)(buf) + ino_to_fsbo(fs, statbuf.st_ino);
+
+ /*
+ * Register filesystem block size.
+ */
+ bbinfop->bsize = fs->fs_bsize;
+
+ /*
+ * Get the block numbers; we don't handle fragments
+ */
+ ndb = howmany(ip->di_size, fs->fs_bsize);
+ if (ndb > max_block_count)
+ errx(1, "%s: Too many blocks", boot);
+
+ /*
+ * Register block count.
+ */
+ bbinfop->nblocks = ndb;
+
+ if (verbose)
+ printf("%s: block numbers: ", boot);
+ ap = ip->di_db;
+ for (i = 0; i < NDADDR && *ap && ndb; i++, ap++, ndb--) {
+ blk = fsbtodb(fs, *ap);
+ bbinfop->blocks[i] = blk;
+ if (verbose)
+ printf("%d ", blk);
+ }
+ if (verbose)
+ printf("\n");
+
+ if (ndb == 0)
+ goto checksum;
+
+ /*
+ * Just one level of indirections; there isn't much room
+ * for more in the 1st-level bootblocks anyway.
+ */
+ if (verbose)
+ printf("%s: block numbers (indirect): ", boot);
+ blk = ip->di_ib[0];
+ devread(devfd, buf, blk, fs->fs_bsize, "indirect block");
+ ap = (daddr_t *)buf;
+ for (; i < NINDIR(fs) && *ap && ndb; i++, ap++, ndb--) {
+ blk = fsbtodb(fs, *ap);
+ bbinfop->blocks[i] = blk;
+ if (verbose)
+ printf("%d ", blk);
+ }
+ if (verbose)
+ printf("\n");
+
+ if (ndb)
+ errx(1, "%s: Too many blocks", boot);
+
+checksum:
+ cksum = 0;
+ for (i = 0; i < bbinfop->nblocks +
+ (sizeof (*bbinfop) / sizeof (bbinfop->blocks[0])) - 1; i++) {
+ cksum += ((int32_t *)bbinfop)[i];
+ }
+ bbinfop->cksum = -cksum;
+
+ return 0;
+}
diff --git a/sys/arch/alpha/stand/bootxx/prom.c b/sys/arch/alpha/stand/prom.c
index 5038ef2321f..262f5f3828e 100644
--- a/sys/arch/alpha/stand/bootxx/prom.c
+++ b/sys/arch/alpha/stand/prom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.3 1995/06/28 00:59:04 cgd Exp $ */
+/* $NetBSD: prom.c,v 1.1 1995/11/23 02:39:07 cgd Exp $ */
/*
* Mach Operating System
@@ -31,11 +31,7 @@
#include <machine/prom.h>
#include <machine/rpb.h>
-#define PUTS 0
-
-#if PUTS
int console;
-#endif
void
init_prom_calls()
@@ -51,18 +47,28 @@ init_prom_calls()
prom_dispatch_v.routine_arg = c->crb_v_dispatch;
prom_dispatch_v.routine = c->crb_v_dispatch->code;
-#if PUTS
/* Look for console tty. */
prom_getenv(PROM_E_TTY_DEV, buf, 4);
console = buf[0] - '0';
-#endif
}
-#if PUTS
-static inline void
+int
+getchar()
+{
+ prom_return_t ret;
+
+ for (;;) {
+ ret.bits = prom_dispatch(PROM_R_GETC, console);
+ if (ret.u.status == 0 || ret.u.status == 1)
+ return (ret.u.retval);
+ }
+}
+
+void
putchar(c)
int c;
{
+ prom_return_t ret;
char cbuf;
if (c == '\r' || c == '\n') {
@@ -79,15 +85,6 @@ putchar(c)
} while ((ret.u.retval & 1) == 0);
}
-void
-puts(s)
- char *s;
-{
- while (*s)
- putchar(*s++);
-}
-#endif
-
int
prom_getenv(id, buf, len)
int id, len;
diff --git a/sys/arch/alpha/stand/bootxx/prom_disp.S b/sys/arch/alpha/stand/prom_disp.S
index b0ff78df367..aed575a0d98 100644
--- a/sys/arch/alpha/stand/bootxx/prom_disp.S
+++ b/sys/arch/alpha/stand/prom_disp.S
@@ -1,4 +1,4 @@
-/* $NetBSD: prom_disp.S,v 1.2 1995/02/16 02:33:12 cgd Exp $ */
+/* $NetBSD: prom_disp.S,v 1.1 1995/11/23 02:39:10 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -28,9 +28,9 @@
*/
#ifndef LOCORE
-#include "../include/asm.h"
-#include "../include/prom.h"
-#include "../include/rpb.h"
+#include "include/asm.h"
+#include "include/prom.h"
+#include "include/rpb.h"
#endif
.globl prom_dispatch_v
@@ -55,8 +55,6 @@
#define DISPATCH_REGS IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5|IM_S6
NESTED(prom_dispatch, 5, DISPATCH_FRAME_SIZE, ra, DISPATCH_REGS, 0)
-
-/* ldgp gp, 0(pv)*/
SETGP(pv)
lda sp, -DISPATCH_FRAME_SIZE(sp)
diff --git a/sys/arch/alpha/stand/puts.c b/sys/arch/alpha/stand/puts.c
new file mode 100644
index 00000000000..b3c2d9479a2
--- /dev/null
+++ b/sys/arch/alpha/stand/puts.c
@@ -0,0 +1,9 @@
+
+void
+puts(s)
+ char *s;
+{
+
+ while (*s)
+ putchar(*s++);
+}
diff --git a/sys/arch/alpha/stand/boot/start.S b/sys/arch/alpha/stand/start.S
index fe7b93a23dc..8d8001ffbdd 100644
--- a/sys/arch/alpha/stand/boot/start.S
+++ b/sys/arch/alpha/stand/start.S
@@ -1,4 +1,4 @@
-/* $NetBSD: start.S,v 1.2 1995/02/16 02:32:59 cgd Exp $ */
+/* $NetBSD: start.S,v 1.1 1995/11/23 02:39:15 cgd Exp $ */
/*
* Mach Operating System
@@ -26,7 +26,7 @@
* the rights to redistribute these changes.
*/
-#include "../../include/asm.h"
+#include "include/asm.h"
/*
* start --
@@ -44,14 +44,22 @@
#define ENTRY_FRAME 32
NESTED(start, 1, ENTRY_FRAME, ra, 0, 0)
- br pv,1f /* XXX I have no idea what this does. */
+ br pv,1f
1: SETGP(pv)
+#ifndef PRIMARY_BOOTBLOCK
lda sp,start /* start stack below text */
lda sp,-ENTRY_FRAME(sp)
+#endif
+
+ lda a0,_EDATA
+ lda a1,_end
+ subq a1,a0,a1
+ CALL(bzero)
CALL(main) /* transfer to C */
+XLEAF(halt, 0)
call_pal PAL_halt /* halt if we ever return */
END(start)
@@ -70,12 +78,3 @@ LEAF(cpu_number, 0)
call_pal PAL_VMS_mfpr_whami
RET
END(cpu_number)
-
-/*
- * halt
- * Halt
- */
-LEAF(halt, 0)
- call_pal PAL_halt
- RET
-END(halt)
diff --git a/sys/arch/alpha/stand/xxboot/Makefile b/sys/arch/alpha/stand/xxboot/Makefile
deleted file mode 100644
index 49c94548730..00000000000
--- a/sys/arch/alpha/stand/xxboot/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $NetBSD: Makefile,v 1.1 1995/02/13 23:08:46 cgd Exp $
-
-all: xxboot
-
-xxboot: makexxboot
- /bin/rm -f xxboot
- ./makexxboot > xxboot
-
-clean cleandir:
- /bin/rm -f xxboot makexxboot
-
-install:
- install -c -o bin -g bin -m 444 xxboot ${DESTDIR}/usr/mdec/sdboot
diff --git a/sys/arch/alpha/stand/xxboot/makexxboot.c b/sys/arch/alpha/stand/xxboot/makexxboot.c
deleted file mode 100644
index 07d52fffc72..00000000000
--- a/sys/arch/alpha/stand/xxboot/makexxboot.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: makexxboot.c,v 1.1 1995/02/13 23:08:47 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#define BBPAD 0x1e0
-struct bb {
- char bb_pad[BBPAD]; /* disklabel lives in here, actually */
- long bb_secsize; /* size of secondary boot block */
- long bb_secstart; /* start of secondary boot block */
- long bb_flags; /* unknown; always zero */
- long bb_cksum; /* checksum of the the boot block, as longs. */
-};
-
-main()
-{
- struct bb bb;
- long *lp, *ep;
-
- bzero(&bb, sizeof bb);
- bb.bb_secsize = 16;
- bb.bb_secstart = 1;
- bb.bb_flags = 0;
- bb.bb_cksum = 0;
-
- for (lp = (long *)&bb, ep = &bb.bb_cksum; lp < ep; lp++)
- bb.bb_cksum += *lp;
-
- if (write(1, &bb, sizeof bb) != sizeof bb)
- exit(1);
-
- exit(0);
-}