summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/stand/Makefile143
-rw-r--r--sys/arch/i386/stand/as.c6
-rw-r--r--sys/arch/i386/stand/asbootblk.c6
-rw-r--r--sys/arch/i386/stand/bmap.c8
-rw-r--r--sys/arch/i386/stand/boot.c26
-rw-r--r--sys/arch/i386/stand/breadxx.c7
-rw-r--r--sys/arch/i386/stand/cga.c2
-rw-r--r--sys/arch/i386/stand/fd.c8
-rw-r--r--sys/arch/i386/stand/fdbootblk.S (renamed from sys/arch/i386/stand/fdbootblk.c)0
-rw-r--r--sys/arch/i386/stand/fs.c12
-rw-r--r--sys/arch/i386/stand/kbd.c2
-rw-r--r--sys/arch/i386/stand/prf.c2
-rw-r--r--sys/arch/i386/stand/saio.h2
-rw-r--r--sys/arch/i386/stand/srt0.S (renamed from sys/arch/i386/stand/srt0.c)14
-rw-r--r--sys/arch/i386/stand/trimhd.c70
-rw-r--r--sys/arch/i386/stand/wd.c39
-rw-r--r--sys/arch/i386/stand/wdbootblk.S (renamed from sys/arch/i386/stand/wdbootblk.c)8
17 files changed, 148 insertions, 207 deletions
diff --git a/sys/arch/i386/stand/Makefile b/sys/arch/i386/stand/Makefile
index b6d23347941..e18f59cbe94 100644
--- a/sys/arch/i386/stand/Makefile
+++ b/sys/arch/i386/stand/Makefile
@@ -1,118 +1,113 @@
# $NetBSD: Makefile,v 1.6 1996/02/01 22:31:28 mycroft Exp $
# @(#)Makefile 7.9 (Berkeley) 5/8/91
-DESTDIR=/usr
-LD=/usr/bin/ld
+S = ${.CURDIR}/../../..
+I386 = ${.CURDIR}/..
+RMHDR = ${.CURDIR}/../boot/rmaouthdr
STAND= /sys/stand
-INCPATH=-I/sys/sys -I/sys -I/sys/ufs -I${STAND}
+INCPATH=-I${.CURDIR} -I${S} -I${S}/arch -I${S}/ufs -I${S} -I${STAND}
VPATH= ${STAND}
-STANDDIR= ${DESTDIR}/mdec
+STANDDIR= ${DESTDIR}/usr/mdec
-CC= cc -traditional
-CPP= cpp -traditional ${INCPATH} -DSTANDALONE -DAT386
+AFLAGS+= -v -Wa,-a -D_LOCORE
+CFLAGS+= -m386 -O6 -D_STANDALONE -DAT386 -O ${INCPATH}
+CPPFLAGS+= ${INCPATH} -D_KERNEL -DRELOC=0x${RELOC}
+LDADD+= ${LIBC}
RELOC= 98000
RELOC2= 98200
-CFLAGS= -DSTANDALONE -DAT386 -O ${INCPATH}
+DRIVERS=cga.c fd.c kbd.c wd.c sd.c cd.c
+ZLIB= zlib.c
+BOOTS= fdbootblk.S wdbootblk.S sdbootblk.c cdbootblk.S
+SRCS= boot.c prf.c srt0.S ${BOOTS} ${ZLIB} ${DRIVERS}
-DRIVERS=cga.c fd.c kbd.c wd.c as.c
-SRCS= boot.c fdbootblk.c prf.c \
- srt0.c wdbootblk.c ${DRIVERS} ${SASRC}
+CLEANFILES+= *.o conf[fwsc]d.c bread[fwsc]d.c \
+ [fwsc]dboot boot[fwsc]d boot[fwsc]d.sym boot[fwsc]d.c
-ALL= wdboot bootwd fdboot bootfd asboot bootas
+WDOBJS= wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o wd.o breadwd.o clock.o
+FDOBJS= wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o fd.o breadfd.o clock.o
+SDOBJS= wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o sd.o breadsd.o clock.o
+CDOBJS= wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o cd.o breadcd.o clock.o
-all: ${ALL}
+.PATH: ${I386}/isa ${S}/net
-# startups
-
-srt0.o: srt0.c
- ${CPP} -E -D_LOCORE -DRELOC=0x${RELOC} srt0.c | ${AS} -o srt0.o
-
-wsrt0.o: srt0.c
- ${CPP} -E -D_LOCORE -DSMALL -DRELOC=0x${RELOC} -DREL srt0.c | \
- ${AS} -o wsrt0.o
+ALL= wdboot bootwd fdboot bootfd # sdboot bootsd cdboot bootcd
+all: ${ALL}
-relsrt0.o: srt0.c
- ${CPP} -E -D_LOCORE -DRELOC=0x${RELOC} -DREL srt0.c | ${AS} -o relsrt0.o
-
-# block 0 boots
-
-wdbootblk.o: wdbootblk.c
- ${CPP} -E -D_LOCORE -DRELOC=0x${RELOC} wdbootblk.c | ${AS} -o $@
+# startups
-fdbootblk.o: fdbootblk.c
- ${CPP} -E -D_LOCORE -DRELOC=0x${RELOC} fdbootblk.c | ${AS} -o $@
+wsrt0.o: ${.CURDIR}/srt0.S
+ ${CC} -c ${CPPFLAGS} ${AFLAGS} -DREL -DSMALL -o ${.TARGET} ${.CURDIR}/srt0.S
-asbootblk.o: asbootblk.c
- cc -c -O -DRELOC=0x${RELOC} ${INCPATH} asbootblk.c
+relsrt0.o: ${.CURDIR}/srt0.c
+ ${CC} -c ${CFLAGS} -DREL -o ${.TARGET} ${.CURDIR}/srt0.S
# getting booted from disc
-wdboot: wdbootblk.o trimhd
+wdboot: wdbootblk.o
${LD} -N -T ${RELOC} wdbootblk.o
- rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
-
-bootwd: wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o wd.o printf.o breadwd.o trimhd
- ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
- breadwd.o fs.o wd.o -lc
+ rm -f ${.TARGET}
+ strip a.out
+ ${RMHDR} a.out ${.TARGET}
+ rm -f a.out
+ ls -l ${.TARGET}
+
+bootwd.sym bootwd: ${WDOBJS}
+ ${LD} -T ${RELOC2} ${WDOBJS} ${LDADD}
+ cp a.out bootwd.sym
size a.out
- rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
+ rm -f $@; strip a.out; ${RMHDR} a.out $@; rm -f a.out; ls -l $@
-fdboot: fdbootblk.o trimhd
+fdboot: fdbootblk.o
${LD} -N -T ${RELOC} fdbootblk.o
- rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
+ rm -f $@; strip a.out; ${RMHDR} a.out $@; rm -f a.out; ls -l $@
-bootfd: wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o fd.o printf.o breadfd.o trimhd
- ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
- breadfd.o fs.o fd.o -lc
+bootfd.sym bootfd: ${FDOBJS}
+ ${LD} -N -T ${RELOC2} ${FDOBJS} ${LDADD}
+ cp a.out bootfd.sym
size a.out
- rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
+ rm -f $@; strip a.out; ${RMHDR} a.out $@; rm -f a.out; ls -l $@
-asboot: asbootblk.o trimhd
- ${LD} -N -T 7c00 asbootblk.o
- rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
+sdboot: sdbootblk.o
+ ${LD} -N -T 7c00 sdbootblk.o
+ rm -f $@; strip a.out; ${RMHDR} a.out $@; rm -f a.out; ls -l $@
-bootas: wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o as.o printf.o breadas.o trimhd
- ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
- breadas.o fs.o as.o -lc
+bootsd.sym bootsd: ${SDOBJS}
+ ${LD} -N -T ${RELOC2} ${SDOBJS} ${LDADD}
+ cp a.out bootsd.sym
size a.out
- rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
-
+ rm -f $@; strip a.out; ${RMHDR} a.out $@; rm -f a.out; ls -l $@
breadwd.o: breadwd.c breadxx.o
breadfd.o: breadfd.c breadxx.o
-breadas.o: breadas.c breadxx.o
+breadsd.o: breadsd.c breadxx.o
breadxx.o:
touch breadxx.o
-breadwd.c: breadxx.c
- rm -f breadwd.c
- sed -e 's/XX/wd/' -e 's/xx/wd/g' < breadxx.c >> breadwd.c
+breadwd.c: ${.CURDIR}/breadxx.c
+ @rm -f breadwd.c
+ sed -e 's/XX/wd/' -e 's/xx/wd/g' < ${.CURDIR}/breadxx.c >> breadwd.c
-breadfd.c: breadxx.c
+breadfd.c: ${.CURDIR}/breadxx.c
rm -f breadfd.c
- sed -e 's/XX/fd/' -e 's/xx/fd/g' < breadxx.c >> breadfd.c
-
-breadas.c: breadxx.c
- rm -f breadas.c
- sed -e 's/XX/as/' -e 's/xx/as/g' < breadxx.c >> breadas.c
+ sed -e 's/XX/fd/' -e 's/xx/fd/g' < ${.CURDIR}/breadxx.c >> breadfd.c
-trimhd: trimhd.c
- ${CC} ${CFLAGS} -s -o trimhd trimhd.c
+breadsd.c: ${.CURDIR}/breadxx.c
+ rm -f breadsd.c
+ sed -e 's/XX/as/' -e 's/xx/as/g' < ${.CURDIR}/breadxx.c >> breadsd.c
-clean:
- rm -f *.o *.exe *.i sm_*.c trimhd
- rm -f a.out bfd bwd fdb wdb ${ALL}
- rm -f boot[a-wyz]? boot[a-wyz]?? boot[a-wyz]?.c boot[a-wyz]??.c \
- conf[a-wyz]?.c conf[a-wyz]??.c bread[a-wyz]?.c
+#clean:
-cleandir: clean
- rm -f ${MAN} tags .depend
+.MAKE: make.out
+make.out::
+ rm -f ${OBJS}
+ ${MAKE} ${.MAKEFLAGS} ${OBJS} > make.out
-depend: ${SRCS}
- mkdep ${INCPATH} -DSTANDALONE ${SRCS} ${DUMMIES}
install: ${ALL}
- cp ${ALL} ${STANDDIR}
+ install -c ${ALL} ${STANDDIR}
+
+.include <bsd.prog.mk>
+
diff --git a/sys/arch/i386/stand/as.c b/sys/arch/i386/stand/as.c
index 2a3b6700f22..796b2650378 100644
--- a/sys/arch/i386/stand/as.c
+++ b/sys/arch/i386/stand/as.c
@@ -8,9 +8,9 @@
* Pace Willisson pace@blitz.com April 8, 1992
*/
-#include "param.h"
-#include "disklabel.h"
-#include "i386/isa/asreg.h"
+#include <sys/param.h>
+#include <sys/disklabel.h>
+#include <dev/isa/ahareg.h>
#include "saio.h"
#ifdef ASDEBUG
diff --git a/sys/arch/i386/stand/asbootblk.c b/sys/arch/i386/stand/asbootblk.c
index aae9e648e7c..f3ea79c233c 100644
--- a/sys/arch/i386/stand/asbootblk.c
+++ b/sys/arch/i386/stand/asbootblk.c
@@ -32,9 +32,9 @@
* as the master boot block.
*/
-#include "param.h"
-#include "disklabel.h"
-#include "i386/isa/asreg.h"
+#include <sys/param.h>
+#include <sys/disklabel.h>
+#include <dev/isa/ahareg.h>
/* RELOC should be defined with a -D flag to cc */
diff --git a/sys/arch/i386/stand/bmap.c b/sys/arch/i386/stand/bmap.c
index e1dbe7eea3d..64bf2924efd 100644
--- a/sys/arch/i386/stand/bmap.c
+++ b/sys/arch/i386/stand/bmap.c
@@ -35,10 +35,10 @@
* @(#)ufs_bmap.c 7.13 (Berkeley) 5/8/91
*/
-#include "param.h"
-#include "dinode.h"
-#include "fs.h"
-#include "errno.h"
+#include <sys/param.h>
+#include <ufs/ufs/dinode.h>
+#include <ufs/ffs/fs.h>
+#include <errno.h>
/*
* Bmap converts a the logical block number of a file
diff --git a/sys/arch/i386/stand/boot.c b/sys/arch/i386/stand/boot.c
index a9aad02da0c..3158f044202 100644
--- a/sys/arch/i386/stand/boot.c
+++ b/sys/arch/i386/stand/boot.c
@@ -49,12 +49,12 @@ static char sccsid[] = "@(#)boot.c 7.3 (Berkeley) 5/4/91";
static char rcsid[] = "$NetBSD: boot.c,v 1.6 1994/10/27 04:21:49 cgd Exp $";
#endif /* not lint */
-#include "param.h"
-#include "reboot.h"
+#include <sys/param.h>
+#include <sys/reboot.h>
#include <a.out.h>
#include "saio.h"
-#include "disklabel.h"
-#include "dinode.h"
+#include <sys/disklabel.h>
+#include <ufs/ufs/dinode.h>
/*
* Boot program, loaded by boot block from remaing 7.5K of boot area.
@@ -70,13 +70,20 @@ int retry = 0;
extern struct disklabel disklabel;
extern int bootdev, cyloffset;
static unsigned char *biosparams = (char *) 0x9ff00; /* XXX */
+/* XXX fake environ */
+char **environ = NULL;
+
+#ifndef HZ
+#define HZ 100
+#endif
+int hz = HZ;
/*
* Boot program... loads /boot out of filesystem indicated by arguements.
* We assume an autoboot unless we detect a misconfiguration.
*/
-main(dev, unit, off)
+boot(dev, unit, off)
{
register struct disklabel *lp;
register int io;
@@ -85,10 +92,15 @@ main(dev, unit, off)
extern int scsisn; /* XXX */
+ /* init system clock */
+ startrtclock();
+
/* are we a disk, if so look at disklabel and do things */
lp = &disklabel;
+#if 0
if (lp->d_type == DTYPE_SCSI) /* XXX */
off = htonl(scsisn); /* XXX */
+#endif
/*printf("cyl %x %x hd %x sect %x ", biosparams[0], biosparams[1], biosparams[2], biosparams[0xe]);
printf("dev %x unit %x off %d\n", dev, unit, off);*/
@@ -160,7 +172,7 @@ copyunix(io, howto, cyloff)
/*printf("mode %o ", fil.di_mode);*/
i = iread(&fil, 0, (char *)&x, sizeof x);
off = sizeof x;
- if (i != sizeof x || x.a_magic != 0413) {
+ if (i != sizeof x || N_GETMAGIC(x) != ZMAGIC) {
printf("Not an executable format");
return;
}
@@ -184,7 +196,7 @@ copyunix(io, howto, cyloff)
addr += x.a_data;
- if (addr + x.a_bss > (unsigned) &fil) {
+ if ((void *)(addr + x.a_bss) > (void *)&fil) {
printf("Warning: bss overlaps bootstrap");
x.a_bss = (unsigned)addr - (unsigned)&fil;
}
diff --git a/sys/arch/i386/stand/breadxx.c b/sys/arch/i386/stand/breadxx.c
index 616af2e9659..5662b6baabc 100644
--- a/sys/arch/i386/stand/breadxx.c
+++ b/sys/arch/i386/stand/breadxx.c
@@ -51,7 +51,7 @@
/*
* Interface to driver to obtain a block off the disk drive.
*/
-#include "param.h"
+#include <sys/param.h>
#include "saio.h"
@@ -61,8 +61,9 @@ struct iob iobuf;
bread(bdev, off, addr, sz)
char *addr;
{
-
-/*printf("bread %d %d %x %d\n", bdev, off, addr, sz);*/
+#ifdef DEBUG
+ printf("bread %d %d %x %d\n", bdev, off, addr, sz);
+#endif
iobuf.i_dev = 0;
iobuf.i_adapt = 0;
iobuf.i_ctlr = 0;
diff --git a/sys/arch/i386/stand/cga.c b/sys/arch/i386/stand/cga.c
index 47fdbf5daa8..06747704f54 100644
--- a/sys/arch/i386/stand/cga.c
+++ b/sys/arch/i386/stand/cga.c
@@ -38,7 +38,7 @@
* @(#)cga.c 5.3 (Berkeley) 4/28/91
*/
-#include "param.h"
+#include <sys/param.h>
#define COL 80
#define ROW 25
diff --git a/sys/arch/i386/stand/fd.c b/sys/arch/i386/stand/fd.c
index d5808d93ee0..bc14706de03 100644
--- a/sys/arch/i386/stand/fd.c
+++ b/sys/arch/i386/stand/fd.c
@@ -41,10 +41,10 @@
/****************************************************************************/
/* standalone fd driver */
/****************************************************************************/
-#include "param.h"
-#include "disklabel.h"
-#include "i386/isa/fdreg.h"
-#include "i386/isa/isa.h"
+#include <sys/param.h>
+#include <sys/disklabel.h>
+#include <dev/isa/isareg.h>
+#include <i386/isa/fdreg.h>
#include "saio.h"
#define NUMRETRY 10
diff --git a/sys/arch/i386/stand/fdbootblk.c b/sys/arch/i386/stand/fdbootblk.S
index e0f1fd05077..e0f1fd05077 100644
--- a/sys/arch/i386/stand/fdbootblk.c
+++ b/sys/arch/i386/stand/fdbootblk.S
diff --git a/sys/arch/i386/stand/fs.c b/sys/arch/i386/stand/fs.c
index bb964d93130..07b8146353b 100644
--- a/sys/arch/i386/stand/fs.c
+++ b/sys/arch/i386/stand/fs.c
@@ -50,10 +50,10 @@
* Routines to sift through a BSD fast filesystem. -wfj
*/
-#include "param.h"
-#include "fs.h"
-#include "dir.h"
-#include "dinode.h"
+#include <sys/param.h>
+#include <ufs/ffs/fs.h>
+#include <ufs/ufs/dir.h>
+#include <ufs/ufs/dinode.h>
#include "saio.h"
int bdev;
@@ -101,8 +101,8 @@ ilookup(dip, s) struct dinode *dip; char *s; {
fetchi(i, dip) struct dinode *dip; {
/*printf("fetchi %d %x\n", i, dip);*/
- bread(bdev, fsbtodb(fs, itod(fs, i)), abuf, fs->fs_bsize);
- bcopy (abuf + itoo(fs,i) * sizeof(struct dinode),
+ bread(bdev, fsbtodb(fs, ino_to_fsba(fs, i)), abuf, fs->fs_bsize);
+ bcopy (abuf + ino_to_fsbo(fs,i) * sizeof(struct dinode),
dip, sizeof(struct dinode));
/*printf("mode %o link %d uid %d gid %d size %d [ ",
dip->di_mode, dip->di_nlink, dip->di_uid, dip->di_gid, dip->di_size);
diff --git a/sys/arch/i386/stand/kbd.c b/sys/arch/i386/stand/kbd.c
index 134bd889f4a..4b4e19cf7cf 100644
--- a/sys/arch/i386/stand/kbd.c
+++ b/sys/arch/i386/stand/kbd.c
@@ -248,7 +248,7 @@ kbdreset()
inb(0x60);
}
-#ifdef notdef;
+#ifdef notdef
u_char getchar() {
u_char c;
diff --git a/sys/arch/i386/stand/prf.c b/sys/arch/i386/stand/prf.c
index 4a06fc56e67..97a89826063 100644
--- a/sys/arch/i386/stand/prf.c
+++ b/sys/arch/i386/stand/prf.c
@@ -38,7 +38,7 @@
* @(#)prf.c 7.4 (Berkeley) 5/4/91
*/
-#include "types.h"
+#include <sys/types.h>
putchar(c)
char c;
diff --git a/sys/arch/i386/stand/saio.h b/sys/arch/i386/stand/saio.h
index 0bc793dd0d3..7e66993e10e 100644
--- a/sys/arch/i386/stand/saio.h
+++ b/sys/arch/i386/stand/saio.h
@@ -60,7 +60,7 @@ struct iob {
int i_unit;
int i_cc;
int i_bn;
- int i_ma;
+ char *i_ma;
int i_boff;
int i_flgs;
#define F_WRITE 0x1
diff --git a/sys/arch/i386/stand/srt0.c b/sys/arch/i386/stand/srt0.S
index b5cf9247393..b09415bc2b8 100644
--- a/sys/arch/i386/stand/srt0.c
+++ b/sys/arch/i386/stand/srt0.S
@@ -47,7 +47,7 @@
.globl _end
.globl _edata
- .globl _main
+ .globl _boot
.globl __rtt
.globl _exit
.globl _bootdev
@@ -59,8 +59,8 @@
.globl _disklabel
_disklabel:
.space 512
- .globl _scsisn
- .set _scsisn, RELOC+0x60
+ #.set _scsisn, RELOC+0x60
+ #.globl _scsisn
#endif
.globl entry
@@ -74,7 +74,7 @@ _disklabel:
#movl $entry-RELOC,%esi # from beginning of ram
movl $0,%esi
#movl $entry,%edi # to relocated area
- movl $ RELOC,%edi # to relocated area
+ movl RELOC,%edi # to relocated area
# movl $_edata-RELOC,%ecx # this much
movl $64*1024,%ecx
cld
@@ -91,7 +91,7 @@ start:
#ifdef REL
leal 4(%esp),%eax /* ignore old pc */
- movl $ RELOC-3*4,%ebx
+ movl RELOC-3*4,%ebx
/* copy boot parameters */
pushl $3*4
pushl %ebx
@@ -102,7 +102,7 @@ start:
/* save old stack state */
movl %esp,savearea
movl %ebp,savearea+4
- movl $ RELOC-0x2400,%esp
+ movl RELOC-0x2400,%esp
#endif
/* clear memory as needed */
@@ -141,7 +141,7 @@ start:
call _kbdreset /* resets keyboard and gatea20 brain damage */
movl %esi,%esp
- call _main
+ call _boot
jmp 1f
.data
diff --git a/sys/arch/i386/stand/trimhd.c b/sys/arch/i386/stand/trimhd.c
deleted file mode 100644
index 1480f98d004..00000000000
--- a/sys/arch/i386/stand/trimhd.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $NetBSD: trimhd.c,v 1.3 1994/10/27 04:22:00 cgd Exp $ */
-
-/*
- * Copyright (c) 1989, 1990, 1991, 1992 William F. Jolitz, TeleMuse
- * 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 software is a component of "386BSD" developed by
- William F. Jolitz, TeleMuse.
- * 4. Neither the name of the developer nor the name "386BSD"
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
- * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
- * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
- * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
- * NOT MAKE USE THIS WORK.
- *
- * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
- * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
- * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES
- * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
- * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
- * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
- * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
- * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``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 DEVELOPER 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.
- *
- * Trim off the start of a file.
- */
-
-main(argc, argv) char *argv[]; {
- int val, rv, buf;
-
- if (argc != 2) return(1);
- if ((val = atoi(argv[1]))<= 0) return(1);
-
- buf = malloc(1024);
- read (0, buf, val);
- do {
- rv = read (0, buf, 1024);
- if (rv > 0)
- rv = write(1, buf, rv);
- } while (rv == 1024);
- if(rv > 0)
- return (0);
- else
- return (1);
-}
diff --git a/sys/arch/i386/stand/wd.c b/sys/arch/i386/stand/wd.c
index ce9540c47f0..7842e2e4402 100644
--- a/sys/arch/i386/stand/wd.c
+++ b/sys/arch/i386/stand/wd.c
@@ -40,11 +40,11 @@
/* device driver for winchester disk */
-#include "param.h"
-#include "dkbad.h"
-#include "disklabel.h"
-#include "i386/isa/isa.h"
-#include "i386/isa/wdreg.h"
+#include <sys/param.h>
+#include <sys/dkbad.h>
+#include <sys/disklabel.h>
+#include <dev/isa/isareg.h>
+#include <dev/isa/wdreg.h>
#include "saio.h"
#define SMALL
@@ -145,7 +145,7 @@ wdstrategy(io,func)
#endif
sector += io->i_boff;
- address = io->i_ma;
+ address = (char *)io->i_ma;
while (iosize > 0) {
if (wdio(func, unit, sector, address))
return(-1);
@@ -190,7 +190,7 @@ wdio(func, unit, blknm, addr)
* See if the current block is in the bad block list.
*/
if (blknm > BBSIZE/DEV_BSIZE) /* should be BBSIZE */
- for (bt_ptr = dkbad[unit].bt_bad; bt_ptr->bt_cyl != -1; bt_ptr++) {
+ for (bt_ptr = dkbad[unit].bt_bad; bt_ptr->bt_cyl != 0xffff; bt_ptr++) {
if (bt_ptr->bt_cyl > cylin)
/* Sorted list, and we passed our cylinder. quit. */
break;
@@ -235,10 +235,10 @@ retry:
/* Set up the SDH register (select drive). */
outb(wdc+wd_sdh, WDSD_IBM | (unit<<4) | (head & 0xf));
- while ((inb(wdc+wd_status) & WDCS_READY) == 0) ;
+ while ((inb(wdc+wd_status) & WDCS_DRDY) == 0) ;
outb(wdc+wd_command, opcode);
- while (opcode == WDCC_READ && (inb(wdc+wd_status) & WDCS_BUSY))
+ while (opcode == WDCC_READ && (inb(wdc+wd_status) & WDCS_BSY))
;
/* Did we get an error? */
if (opcode == WDCC_READ && (inb(wdc+wd_status) & WDCS_ERR))
@@ -254,7 +254,7 @@ retry:
/* Check data request (should be done). */
if (inb(wdc+wd_status) & WDCS_DRQ) goto error;
- while (opcode == WDCC_WRITE && (inb(wdc+wd_status) & WDCS_BUSY)) ;
+ while (opcode == WDCC_WRITE && (inb(wdc+wd_status) & WDCS_BSY)) ;
if (inb(wdc+wd_status) & WDCS_ERR) goto error;
@@ -297,19 +297,20 @@ wdinit(io)
#endif
/* reset controller */
- outb(wdc+wd_ctlr,6);
+ outb(wdc+wd_ctlr, WDCTL_RST|WDCTL_IDS);
DELAY(1000);
- outb(wdc+wd_ctlr,2);
+ outb(wdc+wd_ctlr, WDCTL_IDS);
DELAY(1000);
- while(inb(wdc+wd_status) & WDCS_BUSY); /* 06 Sep 92*/
- outb(wdc+wd_ctlr,8);
+ while(inb(wdc+wd_status) & WDCS_BSY); /* 06 Sep 92*/
+ outb(wdc+wd_ctlr, WDCTL_4BIT);
/* set SDH, step rate, do restore to recalibrate drive */
tryagainrecal:
outb(wdc+wd_sdh, WDSD_IBM | (unit << 4));
wdwait();
- outb(wdc+wd_command, WDCC_RESTORE | WD_STEP);
+ /* outb(wdc+wd_command, WDCC_RESTORE | WD_STEP);
wdwait();
+ */
if ((i = inb(wdc+wd_status)) & WDCS_ERR) {
printf("wd%d: recal status %b error %b\n",
unit, i, WDCS_BITS, inb(wdc+wd_error), WDERR_BITS);
@@ -331,7 +332,7 @@ tryagainrecal:
outb(wdc+wd_cyl_lo, 1224);
outb(wdc+wd_cyl_hi, 1224/256);
outb(wdc+wd_command, 0x91);
- while (inb(wdc+wd_status) & WDCS_BUSY) ;
+ while (inb(wdc+wd_status) & WDCS_BSY) ;
errcnt = 0;
retry:
@@ -394,7 +395,7 @@ retry:
outb(wdc+wd_sdh, WDSD_IBM | (unit << 4) + dd->d_ntracks-1);
outb(wdc+wd_seccnt, dd->d_nsectors);
outb(wdc+wd_command, 0x91);
- while (inb(wdc+wd_status) & WDCS_BUSY) ;
+ while (inb(wdc+wd_status) & WDCS_BSY) ;
dkbad[unit].bt_bad[0].bt_cyl = -1;
@@ -425,9 +426,9 @@ wdwait()
register wdc = wdcport;
register i = 0;
- while (inb(wdc+wd_status) & WDCS_BUSY)
+ while (inb(wdc+wd_status) & WDCS_BSY)
;
- while ((inb(wdc+wd_status) & WDCS_READY) == 0)
+ while ((inb(wdc+wd_status) & WDCS_DRDY) == 0)
if (i++ > 100000)
return(-1);
return(0);
diff --git a/sys/arch/i386/stand/wdbootblk.c b/sys/arch/i386/stand/wdbootblk.S
index a196d330e25..73cf95643b0 100644
--- a/sys/arch/i386/stand/wdbootblk.c
+++ b/sys/arch/i386/stand/wdbootblk.S
@@ -51,8 +51,10 @@
*
* No attempt is made to handle disk errors.
*/
-#include "i386/isa/isa.h"
-#include "i386/isa/wdreg.h"
+
+#include <dev/isa/isareg.h>
+#include <dev/isa/wdreg.h>
+
#define NOP inb $0x84,%al
#define BIOSRELOC 0x7c00
#define start RELOC+0x400
@@ -177,7 +179,7 @@ readblk:
movl $ IO_WD1+wd_status,%edx
NOP
inb %dx,%al
- testb $ WDCS_BUSY,%al
+ testb $ WDCS_BSY,%al
jnz readblk
testb $ WDCS_DRQ,%al
jz readblk