close to working
This commit is contained in:
parent
4b3d50f976
commit
c4006c3d35
|
@ -14,10 +14,11 @@ options OLD_EXEC
|
|||
options TIMEZONE = "-600", DST = 2
|
||||
options DEVPAGER, SWAPPAGER, VNODEPAGER
|
||||
#options MSDOSFS
|
||||
options ETHER
|
||||
#options ETHER
|
||||
maxusers 2
|
||||
|
||||
config netbsd root on id0a swap on id0b
|
||||
config sdnetbsd root on sd1c swap on id0b
|
||||
#config wdnetbsd root on wd0a swap on wd0b
|
||||
|
||||
pseudo-device sl
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# from: @(#)Makefile.hp300 8.2 (Berkeley) 1/23/94
|
||||
# $Id: Makefile.da30,v 1.2 1994/06/18 12:09:38 paulus Exp $
|
||||
# $Id: Makefile.da30,v 1.3 1994/07/08 12:02:08 paulus Exp $
|
||||
#
|
||||
# Makefile for NetBSD
|
||||
#
|
||||
|
@ -27,6 +27,7 @@ CC= cc ${DEBUG}
|
|||
CPP= cpp
|
||||
LD= ld.old
|
||||
TOUCH= touch -f -c
|
||||
AWK= awk
|
||||
|
||||
# source tree is located via $S relative to the compilation directory
|
||||
S= ../../../..
|
||||
|
@ -78,7 +79,7 @@ LDX=-X
|
|||
.else
|
||||
LDX=-x
|
||||
.endif
|
||||
SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o vnode_if.o ${LIBKERN}
|
||||
SYSTEM_OBJ= locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN}
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
|
||||
SYSTEM_LD_HEAD= rm -f $@
|
||||
SYSTEM_LD= ${LD} ${LDX} -T 0 -P 1000 -n -o $@ -e start ${SYSTEM_OBJ} vers.o
|
||||
|
@ -154,9 +155,7 @@ param.c: $S/conf/param.c
|
|||
param.o: param.c Makefile
|
||||
${CC} -c ${CFLAGS} ${PARAM} param.c
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
|
||||
%RULES
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* from: Utah $Hdr: locore.s 1.66 92/12/22$
|
||||
*
|
||||
* from: @(#)locore.s 8.5 (Berkeley) 11/14/93
|
||||
* $Id: locore.s,v 1.2 1994/06/18 12:09:55 paulus Exp $
|
||||
* $Id: locore.s,v 1.3 1994/07/08 12:02:14 paulus Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -657,10 +657,6 @@ Ldorte1:
|
|||
_Umap: .long 0
|
||||
.globl _kstack, _Umap
|
||||
|
||||
#define RELOC(var, ar) \
|
||||
lea var,ar
|
||||
/* addl a5,ar */
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*
|
||||
|
@ -681,21 +677,18 @@ start:
|
|||
movl sp@(4),d6 | get bootdev
|
||||
movl sp@(16),d7 | get boothowto
|
||||
movl #0,a5 | RAM starts at 0
|
||||
RELOC(tmpstk, a0)
|
||||
movl a0,sp | give ourselves a temporary stack
|
||||
lea tmpstk,sp | give ourselves a temporary stack
|
||||
|
||||
RELOC(_edata,a0) | clear out BSS
|
||||
lea _edata,a0 | clear out BSS
|
||||
movl #_end-4,d0 | (must be <= 256 kB)
|
||||
subl #_edata,d0
|
||||
lsrl #2,d0
|
||||
1: clrl a0@+
|
||||
dbra d0,1b
|
||||
|
||||
RELOC(_esym, a0)
|
||||
clrl a0@ | no symbol table, yet
|
||||
clrl _esym | no symbol table, yet
|
||||
|
||||
RELOC(_lowram, a0)
|
||||
movl a5,a0@ | store start of physical memory
|
||||
movl a5,_lowram | store start of physical memory
|
||||
movl #CACHE_OFF,d0
|
||||
movc d0,cacr | clear and disable on-chip cache(s)
|
||||
|
||||
|
@ -706,6 +699,9 @@ start:
|
|||
clrb a0@(4) | clear ictrl1
|
||||
movb #0x7c,a0@ | reset interrupt bits
|
||||
|
||||
/* for now, use the ROM monitor's vector for trap #14. */
|
||||
movel ROM+0xB8,0xB8
|
||||
|
||||
/* initialize source/destination control registers for movs */
|
||||
moveq #FC_USERD,d0 | user space
|
||||
movc d0,sfc | as source
|
||||
|
@ -715,16 +711,13 @@ start:
|
|||
movl #RAMSIZE,d1 | last page
|
||||
moveq #PGSHIFT,d2
|
||||
lsrl d2,d1 | convert to page (click) number
|
||||
RELOC(_maxmem, a0)
|
||||
movl d1,a0@ | save as maxmem
|
||||
RELOC(_physmem, a0)
|
||||
movl d1,a0@ | and physmem
|
||||
movl d1,_maxmem | save as maxmem
|
||||
movl d1,_physmem | and physmem
|
||||
|
||||
/* configure kernel and proc0 VA space so we can get going */
|
||||
.globl _Sysseg, _pmap_bootstrap, _avail_start
|
||||
#ifdef DDB
|
||||
RELOC(_esym,a0) | end of static kernel test/data/syms
|
||||
movl a0@,d5
|
||||
movl _esym,d5 | end of static kernel test/data/syms
|
||||
jne Lstart2
|
||||
#endif
|
||||
movl #_end,d5 | end of static kernel text/data
|
||||
|
@ -742,20 +735,16 @@ Lstart2:
|
|||
* Enable the MMU.
|
||||
* Since the kernel is mapped logical == physical, we just turn it on.
|
||||
*/
|
||||
RELOC(_Sysseg, a0) | system segment table addr
|
||||
movl a0@,d1 | read value (a KVA)
|
||||
addl a5,d1 | convert to PA
|
||||
RELOC(_protorp, a0)
|
||||
movl _Sysseg,d1 | system segment table addr
|
||||
lea _protorp,a0
|
||||
movl #0x80000202,a0@ | nolimit + share global + 4 byte PTEs
|
||||
movl d1,a0@(4) | + segtable address
|
||||
pmove a0@,srp | load the supervisor root pointer
|
||||
movl #0x80000002,a0@ | reinit upper half for CRP loads
|
||||
|
||||
/*
|
||||
movl #0x82c0aa00,a7@- | value to load TC with
|
||||
pmove a7@,tc | load it
|
||||
addql #4,sp
|
||||
*/
|
||||
|
||||
/*
|
||||
* Should be running mapped from this point on
|
||||
|
@ -806,7 +795,7 @@ Lstart2:
|
|||
clrw sp@- | vector offset/frame type
|
||||
clrl sp@- | PC - filled in by "execve"
|
||||
movw #PSL_USER,sp@- | in user mode
|
||||
clrw sp@- | pad SR to longword
|
||||
clrl sp@- | pad and stack adjust
|
||||
lea sp@(-64),sp | construct space for D0-D7/A0-A7
|
||||
pea sp@ | addr of space for D0
|
||||
jbsr _main | main(firstaddr, r0)
|
||||
|
@ -814,7 +803,7 @@ Lstart2:
|
|||
movl sp@(60),a0 | grab and load
|
||||
movl a0,usp | user SP
|
||||
moveml sp@+,#0x7FFF | load most registers (all but SSP)
|
||||
addql #6,sp | pop SSP and align word
|
||||
addql #8,sp | pop SSP and stack adjust
|
||||
rte
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* from: Utah $Hdr: machdep.c 1.74 92/12/20$
|
||||
*
|
||||
* from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
* $Id: machdep.c,v 1.2 1994/06/18 12:09:56 paulus Exp $
|
||||
* $Id: machdep.c,v 1.3 1994/07/08 12:02:20 paulus Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -80,6 +80,7 @@
|
|||
#include <dev/cons.h>
|
||||
#include <da30/da30/isr.h>
|
||||
#include <net/netisr.h>
|
||||
#include "ether.h"
|
||||
|
||||
#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */
|
||||
#include <vm/vm_kern.h>
|
||||
|
@ -1009,10 +1010,12 @@ badbaddr(addr)
|
|||
netintr()
|
||||
{
|
||||
#ifdef INET
|
||||
#if NETHER > 0
|
||||
if (netisr & (1 << NETISR_ARP)) {
|
||||
netisr &= ~(1 << NETISR_ARP);
|
||||
arpintr();
|
||||
}
|
||||
#endif
|
||||
if (netisr & (1 << NETISR_IP)) {
|
||||
netisr &= ~(1 << NETISR_IP);
|
||||
ipintr();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* warranty, express or implied. The author makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
*
|
||||
* $Id: raw_diskio.c,v 1.2 1994/06/18 12:10:04 paulus Exp $
|
||||
* $Id: raw_diskio.c,v 1.3 1994/07/08 12:02:23 paulus Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -38,7 +38,7 @@ raw_disk_io(int dev, struct uio *uio, int blocksize)
|
|||
if( uio->uio_rw == UIO_READ )
|
||||
bp->b_flags |= B_READ;
|
||||
bp->b_dev = dev;
|
||||
bp->b_proc = uio->uio_procp;
|
||||
bp->b_proc = curproc;
|
||||
|
||||
while (uio->uio_resid != 0) {
|
||||
iov = uio->uio_iov;
|
||||
|
@ -71,9 +71,11 @@ rawio_piece(struct buf *bp, int blocksize,
|
|||
while( iov->iov_len != 0 ){
|
||||
bp->b_data = iov->iov_base;
|
||||
bp->b_flags &= ~B_DONE;
|
||||
bp->b_bufsize = iov->iov_len;
|
||||
bp->b_bcount = todo = min(iov->iov_len, MAXPHYS);
|
||||
bp->b_blkno = uio->uio_offset / blocksize;
|
||||
|
||||
++bp->b_proc->p_holdcnt;
|
||||
vslock(iov->iov_base, todo);
|
||||
vmapbuf(bp);
|
||||
|
||||
|
@ -85,6 +87,7 @@ rawio_piece(struct buf *bp, int blocksize,
|
|||
|
||||
vunmapbuf(bp);
|
||||
vsunlock(iov->iov_base, todo, uio->uio_rw == UIO_READ);
|
||||
--bp->b_proc->p_holdcnt;
|
||||
|
||||
done = todo - bp->b_resid;
|
||||
iov->iov_len -= done;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: id.c,v 1.2 1994/06/18 12:10:16 paulus Exp $
|
||||
* $Id: id.c,v 1.3 1994/07/08 12:02:28 paulus Exp $
|
||||
*/
|
||||
|
||||
#include "id.h"
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include <sys/uio.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <vm/vm.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <da30/da30/iio.h>
|
||||
|
@ -109,12 +110,19 @@ struct disk {
|
|||
u_long dk_openpart; /* all units open on this drive */
|
||||
short dk_wlabel; /* label writable? */
|
||||
int dk_flags;
|
||||
int dk_idle; /* how long since we did anything */
|
||||
struct disklabel dk_dd; /* device configuration data */
|
||||
};
|
||||
|
||||
/* Values for flags */
|
||||
#define NO_LABEL 1 /* don't look for label on disk */
|
||||
#define NO_BADSECT 2 /* don't look for bad sector table */
|
||||
#define STOPPED 4 /* disk has been put in standby mode */
|
||||
#define TIMINGOUT 8 /* have 10s timeout running */
|
||||
|
||||
#define B_STOP 0x10000000
|
||||
|
||||
int id_idle_timeout = 60; /* 10 minutes */
|
||||
|
||||
/*
|
||||
* This label is used as a default when initializing a new or raw disk.
|
||||
|
@ -164,8 +172,8 @@ struct idcsoftc {
|
|||
volatile struct idc *idc_adr;
|
||||
int idc_active;
|
||||
int idc_errcnt;
|
||||
struct buf *idc_actf;
|
||||
struct buf *idc_actl;
|
||||
struct idsoftc *idc_actf;
|
||||
struct idsoftc *idc_actl;
|
||||
};
|
||||
|
||||
struct cfdriver idccd = {
|
||||
|
@ -224,6 +232,7 @@ void idattach __P((struct device *, struct device *, void *));
|
|||
struct idsoftc {
|
||||
struct device id_dev;
|
||||
struct disk id_drive;
|
||||
struct idsoftc *id_actf;
|
||||
struct buf id_utab;
|
||||
struct buf id_rbuf;
|
||||
struct dkbad id_bad;
|
||||
|
@ -367,12 +376,12 @@ idustart(dv)
|
|||
bp = dp->b_actf;
|
||||
if (bp == NULL)
|
||||
return;
|
||||
dp->b_actf = NULL;
|
||||
dv->id_actf = NULL;
|
||||
if (cv->idc_actf == NULL) /* link unit into active list */
|
||||
cv->idc_actf = dp;
|
||||
cv->idc_actf = dv;
|
||||
else
|
||||
cv->idc_actl->b_actf = dp;
|
||||
cv->idc_actl = dp;
|
||||
cv->idc_actl->id_actf = dv;
|
||||
cv->idc_actl = dv;
|
||||
dp->b_active = 1; /* mark the drive as busy */
|
||||
}
|
||||
|
||||
|
@ -397,17 +406,29 @@ idstart(cv)
|
|||
int unit, s;
|
||||
|
||||
loop:
|
||||
dp = cv->idc_actf;
|
||||
if (dp == NULL)
|
||||
dv = cv->idc_actf;
|
||||
if (dv == NULL)
|
||||
return;
|
||||
dp = &dv->id_utab;
|
||||
bp = dp->b_actf;
|
||||
if (bp == NULL) {
|
||||
cv->idc_actf = dp->b_actf;
|
||||
cv->idc_actf = dv->id_actf;
|
||||
goto loop;
|
||||
}
|
||||
unit = idunit(bp->b_dev);
|
||||
dv = (struct idsoftc *) idcd.cd_devs[unit];
|
||||
du = &dv->id_drive;
|
||||
if (bp->b_flags & B_STOP) {
|
||||
idc->sdh = du->dk_sdh;
|
||||
if( (idc->csr & IDCS_READY) == 0 ){
|
||||
dp->b_actf = bp->b_actf;
|
||||
goto loop;
|
||||
}
|
||||
idc->csr = IDCC_STANDBY;
|
||||
cv->idc_active = 1;
|
||||
return;
|
||||
}
|
||||
du->dk_idle = 0;
|
||||
du->dk_flags &= ~STOPPED;
|
||||
if (DISKSTATE(du->dk_state) <= RDLABEL) {
|
||||
if (idcontrol(bp)) {
|
||||
dp->b_actf = bp->b_actf;
|
||||
|
@ -568,9 +589,9 @@ idintr(unit)
|
|||
#ifdef IDDEBUG
|
||||
printf("I ");
|
||||
#endif
|
||||
dp = cv->idc_actf;
|
||||
dv = cv->idc_actf;
|
||||
dp = &dv->id_utab;
|
||||
bp = dp->b_actf;
|
||||
dv = (struct idsoftc *) idcd.cd_devs[idunit(bp->b_dev)];
|
||||
du = &dv->id_drive;
|
||||
partch = idpart(bp->b_dev) + 'a';
|
||||
secsize = du->dk_dd.d_secsize;
|
||||
|
@ -579,6 +600,10 @@ idintr(unit)
|
|||
goto done;
|
||||
return 1;
|
||||
}
|
||||
if (bp->b_flags & B_STOP) {
|
||||
du->dk_flags |= STOPPED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if( (status & (IDCS_ERR | IDCS_ECCCOR)) != 0 ){
|
||||
id_errstat = idc->error; /* save error status */
|
||||
|
@ -723,13 +748,13 @@ iddone(cv)
|
|||
register struct disk *du;
|
||||
register struct buf *bp, *dp;
|
||||
|
||||
dp = cv->idc_actf;
|
||||
dv = cv->idc_actf;
|
||||
dp = &dv->id_utab;
|
||||
bp = dp->b_actf;
|
||||
dv = (struct idsoftc *) idcd.cd_devs[idunit(bp->b_dev)];
|
||||
du = &dv->id_drive;
|
||||
|
||||
du->dk_skip = 0;
|
||||
cv->idc_actf = dp->b_actf;
|
||||
cv->idc_actf = dv->id_actf;
|
||||
cv->idc_errcnt = 0;
|
||||
cv->idc_active = 0;
|
||||
dp->b_actf = bp->b_actf;
|
||||
|
@ -741,6 +766,34 @@ iddone(cv)
|
|||
idustart(dv); /* requeue disk if more io to do */
|
||||
}
|
||||
|
||||
void
|
||||
ididletimer(arg)
|
||||
void *arg;
|
||||
{
|
||||
register struct idsoftc *dv = (struct idsoftc *) arg;
|
||||
register struct disk *du = &dv->id_drive;
|
||||
register struct buf *bp;
|
||||
struct idcsoftc *cv;
|
||||
int s;
|
||||
|
||||
timeout(ididletimer, arg, 10*hz);
|
||||
s = splbio();
|
||||
if (++du->dk_idle >= id_idle_timeout && !(du->dk_flags & STOPPED)
|
||||
&& !dv->id_utab.b_active && dv->id_utab.b_actf == NULL) {
|
||||
bp = &dv->id_rbuf;
|
||||
bp->b_dev = du->dk_unit << 3;
|
||||
bp->b_flags = B_STOP | B_READ;
|
||||
bp->b_actf = NULL;
|
||||
dv->id_utab.b_actf = bp;
|
||||
idustart(dv);
|
||||
cv = (struct idcsoftc *) dv->id_dev.dv_parent;
|
||||
if (!cv->idc_active)
|
||||
idstart(cv);
|
||||
}
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize a drive.
|
||||
*/
|
||||
|
@ -793,6 +846,11 @@ idopen(dev, flags, fmt, p)
|
|||
du->dk_dd = dflt_sizes;
|
||||
idsetsdh(du);
|
||||
|
||||
if (!(du->dk_flags & TIMINGOUT)) {
|
||||
du->dk_flags |= TIMINGOUT;
|
||||
timeout(ididletimer, (void *) dv, 10*hz);
|
||||
}
|
||||
|
||||
/*
|
||||
* Recal, read of disk label will be done in idcontrol
|
||||
* during first read operation.
|
||||
|
@ -1174,9 +1232,8 @@ idformat(bp)
|
|||
#endif
|
||||
|
||||
int
|
||||
idsize(dev, blksize)
|
||||
idsize(dev)
|
||||
dev_t dev;
|
||||
int *blksize;
|
||||
{
|
||||
register unit = idunit(dev);
|
||||
register part = idpart(dev);
|
||||
|
@ -1194,7 +1251,6 @@ idsize(dev, blksize)
|
|||
if (val != 0)
|
||||
return (-1);
|
||||
}
|
||||
*blksize = du->dk_dd.d_secsize;
|
||||
return du->dk_dd.d_partitions[part].p_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)idreg.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: idreg.h,v 1.1 1994/02/22 23:50:28 paulus Exp $
|
||||
* $Id: idreg.h,v 1.2 1994/07/08 12:02:30 paulus Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -94,6 +94,7 @@ struct idc {
|
|||
#define IDCC_IDC 0x91 /* initialize drive command */
|
||||
|
||||
#define IDCC_EXTDCMD 0xE0 /* send extended command */
|
||||
#define IDCC_STANDBY 0xE2 /* stop the disk */
|
||||
#define IDCC_READP 0xEC /* read parameters from controller */
|
||||
#define IDCC_CACHEC 0xEF /* cache control */
|
||||
|
||||
|
@ -141,7 +142,7 @@ int idopen(dev_t, int, int, struct proc *);
|
|||
int idclose(dev_t dev, int flags, int fmt);
|
||||
int idioctl(dev_t, int, caddr_t, int, struct proc *);
|
||||
/* int idformat(struct buf *bp); */
|
||||
int idsize(dev_t, int *);
|
||||
int idsize(dev_t);
|
||||
int iddump(dev_t);
|
||||
|
||||
#endif KERNEL
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sd.c,v 1.2 1994/06/18 12:10:18 paulus Exp $
|
||||
* $Id: sd.c,v 1.3 1994/07/08 12:02:32 paulus Exp $
|
||||
*/
|
||||
/*
|
||||
* Preliminary version of a SCSI-disk driver.
|
||||
|
@ -37,6 +37,7 @@
|
|||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <da30/da30/iio.h>
|
||||
|
||||
|
@ -61,13 +62,16 @@ struct target {
|
|||
short isopen;
|
||||
char active;
|
||||
char we_label;
|
||||
short op;
|
||||
char op;
|
||||
char stopped;
|
||||
char scsi_id; /* info about the disk */
|
||||
char lun;
|
||||
char timingout;
|
||||
short status;
|
||||
short open_error;
|
||||
int nblocks;
|
||||
int blocksize;
|
||||
int idle;
|
||||
u_char *ptr; /* current SCSI pointers */
|
||||
u_long count;
|
||||
u_char *base_ptr; /* saved SCSI pointers */
|
||||
|
@ -78,16 +82,19 @@ struct target {
|
|||
int req_size; /* byte 5 of SCSI cmd */
|
||||
u_char *open_buf;
|
||||
u_char sense_data[8];
|
||||
struct target *actf;
|
||||
struct disklabel label;
|
||||
struct buf uq;
|
||||
};
|
||||
|
||||
/* Values for op field above */
|
||||
#define INQUIRY 0
|
||||
#define TESTREADY 1
|
||||
#define MODESENSE 2
|
||||
#define READLABEL 3
|
||||
#define BUFIO 4
|
||||
#define STARTUNIT 1
|
||||
#define TESTREADY 2
|
||||
#define MODESENSE 3
|
||||
#define READLABEL 4
|
||||
#define BUFIO 5
|
||||
#define STOP 6
|
||||
#define REQSENSE 8 /* ORed into above values */
|
||||
|
||||
/* Info about host adaptor (SBIC) */
|
||||
|
@ -98,6 +105,7 @@ struct host {
|
|||
short connected;
|
||||
struct target *first;
|
||||
struct target *last;
|
||||
int timingout;
|
||||
};
|
||||
|
||||
/* I/O register layout */
|
||||
|
@ -127,6 +135,9 @@ struct disklabel sd_default_label = {
|
|||
unsigned long sir_scsi;
|
||||
void sbic_int_routine();
|
||||
|
||||
int sd_show_starter;
|
||||
unsigned sd_idle_timeout = 30;
|
||||
|
||||
/*
|
||||
* Autoconfiguration stuff
|
||||
*/
|
||||
|
@ -310,12 +321,38 @@ sdustart(struct target *tp)
|
|||
{
|
||||
struct buf *bp;
|
||||
struct host *hp;
|
||||
unsigned idle;
|
||||
|
||||
if (tp->op != STOP) {
|
||||
idle = tp->idle;
|
||||
tp->idle = 0;
|
||||
} else if (tp->stopped) {
|
||||
tp->op = BUFIO;
|
||||
if (tp->uq.b_actf == NULL)
|
||||
return;
|
||||
}
|
||||
if( tp->active )
|
||||
return;
|
||||
hp = (struct host *) tp->dev.dv_parent;
|
||||
|
||||
if( (tp->op & REQSENSE) != 0 ){
|
||||
if (tp->stopped) {
|
||||
if (tp->op == STOP) {
|
||||
sdudone(tp, 0);
|
||||
return;
|
||||
}
|
||||
if (sd_show_starter) {
|
||||
printf("sd%d starting: op=%x idle=%d", tp->op, idle);
|
||||
if (tp->op == BUFIO)
|
||||
printf(" blk=%x bcount=%x", tp->uq.b_actf->b_ablkno,
|
||||
tp->uq.b_actf->b_bcount);
|
||||
printf("\n");
|
||||
}
|
||||
tp->count = 0;
|
||||
tp->reading = 0;
|
||||
tp->cmd = 0x1B; /* start/stop unit */
|
||||
tp->blk = 0;
|
||||
tp->req_size = 1;
|
||||
} else if( (tp->op & REQSENSE) != 0 ){
|
||||
tp->ptr = tp->sense_data;
|
||||
tp->count = sizeof(tp->sense_data);
|
||||
tp->reading = 1;
|
||||
|
@ -333,6 +370,14 @@ sdustart(struct target *tp)
|
|||
tp->req_size = 255;
|
||||
break;
|
||||
|
||||
case STARTUNIT:
|
||||
tp->count = 0;
|
||||
tp->reading = 0;
|
||||
tp->cmd = 0x1B; /* start/stop unit */
|
||||
tp->blk = 0;
|
||||
tp->req_size = 1;
|
||||
break;
|
||||
|
||||
case TESTREADY:
|
||||
tp->count = 0;
|
||||
tp->cmd = 0; /* Test Unit Ready */
|
||||
|
@ -370,17 +415,27 @@ sdustart(struct target *tp)
|
|||
tp->cmd = tp->reading? 8: 0xA; /* read or write cmd */
|
||||
tp->blk = bp->b_ablkno;
|
||||
tp->req_size = bp->b_bcount / tp->blocksize;
|
||||
break;
|
||||
|
||||
case STOP:
|
||||
tp->count = 0;
|
||||
tp->reading = 0;
|
||||
tp->cmd = 0x1B; /* start/stop unit */
|
||||
tp->blk = 0x10000; /* immediate completion flag */
|
||||
tp->req_size = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Link into host adaptor's queue of requests */
|
||||
tp->base_ptr = tp->ptr;
|
||||
tp->base_count = tp->count;
|
||||
tp->uq.b_actf = NULL;
|
||||
tp->actf = NULL;
|
||||
if( hp->first == NULL )
|
||||
hp->first = tp;
|
||||
else
|
||||
hp->last->uq.b_actf = (struct buf *) tp;
|
||||
hp->last->actf = tp;
|
||||
hp->last = tp;
|
||||
tp->active = 1;
|
||||
}
|
||||
|
@ -396,6 +451,12 @@ sdudone(struct target *tp, int err)
|
|||
unit = tp->dev.dv_unit;
|
||||
tp->active = 0;
|
||||
|
||||
if (tp->stopped) {
|
||||
tp->stopped = 0;
|
||||
sdustart(tp);
|
||||
return;
|
||||
}
|
||||
|
||||
if( (tp->op & REQSENSE) != 0 ){
|
||||
/* we just did a request sense command */
|
||||
tp->op &= ~REQSENSE;
|
||||
|
@ -443,6 +504,9 @@ sdudone(struct target *tp, int err)
|
|||
}
|
||||
break;
|
||||
|
||||
case STARTUNIT:
|
||||
break;
|
||||
|
||||
case TESTREADY:
|
||||
break;
|
||||
|
||||
|
@ -479,6 +543,12 @@ sdudone(struct target *tp, int err)
|
|||
}
|
||||
bp->b_resid = tp->count;
|
||||
biodone(bp);
|
||||
break;
|
||||
|
||||
case STOP:
|
||||
tp->stopped = 1;
|
||||
tp->op = BUFIO;
|
||||
break;
|
||||
}
|
||||
|
||||
if( tp->op < BUFIO && ++tp->op == BUFIO ){
|
||||
|
@ -514,8 +584,10 @@ int
|
|||
scsi_decode_sense(struct target *tp, int err)
|
||||
{
|
||||
|
||||
/* ignore unit attention condition on test-ready phase of open */
|
||||
if( tp->op == TESTREADY && err == 0 && (tp->sense_data[0] & 0x7F) == 0x70
|
||||
/* ignore unit attention condition on test-ready
|
||||
or start-unit phase of open */
|
||||
if( (tp->op == TESTREADY || tp->op == STARTUNIT)
|
||||
&& err == 0 && (tp->sense_data[0] & 0x7F) == 0x70
|
||||
&& (tp->sense_data[2] & 0x0F) == 6 )
|
||||
return 0;
|
||||
|
||||
|
@ -712,7 +784,7 @@ sbic_intr(hp)
|
|||
/* Unit operation is complete */
|
||||
hp->active = hp->connected = 0;
|
||||
if( (tp = hp->first) != NULL ){
|
||||
hp->first = (struct target *) tp->uq.b_actf;
|
||||
hp->first = tp->actf;
|
||||
tp->status = status;
|
||||
sdudone(tp, err);
|
||||
}
|
||||
|
@ -746,6 +818,29 @@ sbic_intr(hp)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
sd_idle(arg)
|
||||
caddr_t arg;
|
||||
{
|
||||
struct target *tp = (struct target *) arg;
|
||||
struct host *hp;
|
||||
|
||||
timeout(sd_idle, arg, 10*hz);
|
||||
if (tp->active || tp->op != BUFIO) {
|
||||
tp->idle = 0;
|
||||
return;
|
||||
}
|
||||
if (++tp->idle >= sd_idle_timeout) {
|
||||
tp->op = STOP;
|
||||
sdustart(tp);
|
||||
hp = (struct host *) tp->dev.dv_parent;
|
||||
if( !hp->active ){
|
||||
sbic_start(hp);
|
||||
sbic_poll(hp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a drive partition; initialize the drive if necessary.
|
||||
*/
|
||||
|
@ -761,6 +856,11 @@ sdopen(dev_t dev, int flags, int fmt)
|
|||
return ENXIO;
|
||||
hp = (struct host *) tp->dev.dv_parent;
|
||||
|
||||
if (!tp->timingout) {
|
||||
timeout(sd_idle, (caddr_t) tp, 10*hz);
|
||||
tp->timingout = 1;
|
||||
}
|
||||
|
||||
x = spl_scsi();
|
||||
if( tp->isopen++ > 0 ){
|
||||
if( tp->op < BUFIO && (flags & O_NDELAY) == 0 ){
|
||||
|
@ -875,9 +975,8 @@ sdioctl(dev_t dev, int cmd, caddr_t addr, int flag,
|
|||
return 0;
|
||||
}
|
||||
|
||||
sdsize(dev, blksize)
|
||||
sdsize(dev)
|
||||
dev_t dev;
|
||||
int *blksize;
|
||||
{
|
||||
int unit, part;
|
||||
daddr_t size;
|
||||
|
@ -894,7 +993,6 @@ sdsize(dev, blksize)
|
|||
sdclose(dev, 0, 0);
|
||||
}
|
||||
|
||||
*blksize = tp->blocksize;
|
||||
return tp->label.d_partitions[part].p_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: wd.c,v 1.2 1994/06/18 12:10:20 paulus Exp $
|
||||
* $Id: wd.c,v 1.3 1994/07/08 12:02:35 paulus Exp $
|
||||
*/
|
||||
|
||||
#include "wd.h"
|
||||
|
@ -293,8 +293,8 @@ struct wfcsoftc {
|
|||
volatile struct wdc *wfc_adr;
|
||||
int wfc_active;
|
||||
int wfc_errcnt;
|
||||
struct buf *wfc_actf;
|
||||
struct buf *wfc_actl;
|
||||
struct wfdsoftc *wfc_actf;
|
||||
struct wfdsoftc *wfc_actl;
|
||||
};
|
||||
|
||||
struct cfdriver wfccd = {
|
||||
|
@ -349,6 +349,7 @@ void fdattach __P((struct device *, struct device *, void *));
|
|||
struct wfdsoftc {
|
||||
struct device wfd_dev;
|
||||
struct disk wfd_drive;
|
||||
struct wfdsoftc *wfd_actf;
|
||||
struct buf wfd_utab;
|
||||
struct dkbad wfd_bad;
|
||||
struct evcnt wfd_xfer;
|
||||
|
@ -515,12 +516,12 @@ register struct wfdsoftc *dv;
|
|||
bp = dp->b_actf;
|
||||
if (bp == NULL)
|
||||
return;
|
||||
dp->b_actf = NULL;
|
||||
dv->wfd_actf = NULL;
|
||||
if (wfp->wfc_actf == NULL) /* link unit into active list */
|
||||
wfp->wfc_actf = dp;
|
||||
wfp->wfc_actf = dv;
|
||||
else
|
||||
wfp->wfc_actl->b_actf = dp;
|
||||
wfp->wfc_actl = dp;
|
||||
wfp->wfc_actl->wfd_actf = dv;
|
||||
wfp->wfc_actl = dv;
|
||||
dp->b_active = 1; /* mark the drive as busy */
|
||||
}
|
||||
|
||||
|
@ -545,12 +546,13 @@ struct wfcsoftc *wfp;
|
|||
int unit, s;
|
||||
|
||||
loop:
|
||||
dp = wfp->wfc_actf;
|
||||
dv = wfp->wfc_actf;
|
||||
if (dp == NULL)
|
||||
return;
|
||||
dp = &dv->wfd_utab;
|
||||
bp = dp->b_actf;
|
||||
if (bp == NULL) {
|
||||
wfp->wfc_actf = dp->b_actf;
|
||||
wfp->wfc_actf = dv->wfd_actf;
|
||||
goto loop;
|
||||
}
|
||||
unit = wdunit(bp->b_dev);
|
||||
|
@ -723,9 +725,9 @@ int unit;
|
|||
#ifdef WDDEBUG
|
||||
printf("I ");
|
||||
#endif
|
||||
dp = wfp->wfc_actf;
|
||||
dv = wfp->wfc_actf;
|
||||
dp = &dv->wfd_utab;
|
||||
bp = dp->b_actf;
|
||||
dv = (struct wfdsoftc *) wd_cfd(bp->b_dev)->cd_devs[wdunit(bp->b_dev)];
|
||||
du = &dv->wfd_drive;
|
||||
partch = wdpart(bp->b_dev) + 'a';
|
||||
secsize = du->dk_dd.d_secsize;
|
||||
|
@ -881,13 +883,13 @@ struct wfcsoftc *wfp;
|
|||
register struct disk *du;
|
||||
register struct buf *bp, *dp;
|
||||
|
||||
dp = wfp->wfc_actf;
|
||||
dv = wfp->wfc_actf;
|
||||
dp = &dv->wfd_utab;
|
||||
bp = dp->b_actf;
|
||||
dv = (struct wfdsoftc *) wd_cfd(bp->b_dev)->cd_devs[wdunit(bp->b_dev)];
|
||||
du = &dv->wfd_drive;
|
||||
|
||||
du->dk_skip = 0;
|
||||
wfp->wfc_actf = dp->b_actf;
|
||||
wfp->wfc_actf = dv->wfd_actf;
|
||||
wfp->wfc_errcnt = 0;
|
||||
wfp->wfc_active = 0;
|
||||
dp->b_actf = bp->b_actf;
|
||||
|
@ -1368,9 +1370,8 @@ wdformat(bp)
|
|||
}
|
||||
#endif
|
||||
|
||||
wdsize(dev, blksize)
|
||||
wdsize(dev)
|
||||
dev_t dev;
|
||||
int *blksize;
|
||||
{
|
||||
register unit = wdunit(dev);
|
||||
register part = wdpart(dev);
|
||||
|
@ -1387,7 +1388,6 @@ wdsize(dev, blksize)
|
|||
if (val < 0)
|
||||
return (-1);
|
||||
}
|
||||
*blksize = du->dk_dd.d_secsize;
|
||||
return du->dk_dd.d_partitions[part].p_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* from: Utah $Hdr: machparam.h 1.16 92/12/20$
|
||||
*
|
||||
* from: @(#)param.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: param.h,v 1.2 1994/06/18 12:10:30 paulus Exp $
|
||||
* $Id: param.h,v 1.3 1994/07/08 12:02:39 paulus Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -120,10 +120,10 @@
|
|||
#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
|
||||
|
||||
#ifndef LABELSECTOR
|
||||
#define LABELSECTOR (1024/DEV_BSIZE)
|
||||
#define LABELSECTOR 0
|
||||
#endif
|
||||
#ifndef LABELOFFSET
|
||||
#define LABELOFFSET 0
|
||||
#define LABELOFFSET 64
|
||||
#endif
|
||||
|
||||
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
*** spec_vnops.c.orig Thu Jun 9 20:16:12 1994
|
||||
--- spec_vnops.c Sat Jun 18 17:14:49 1994
|
||||
*** spec_vnops.c.orig Fri Jul 8 04:51:48 1994
|
||||
--- spec_vnops.c Fri Jul 8 04:52:44 1994
|
||||
***************
|
||||
*** 217,223 ****
|
||||
*** 218,224 ****
|
||||
struct proc *p = uio->uio_procp;
|
||||
struct buf *bp;
|
||||
daddr_t bn, nextbn;
|
||||
|
@ -9,7 +9,7 @@
|
|||
struct partinfo dpart;
|
||||
int n, on, majordev, (*ioctl)();
|
||||
int error = 0;
|
||||
--- 217,223 ----
|
||||
--- 218,224 ----
|
||||
struct proc *p = uio->uio_procp;
|
||||
struct buf *bp;
|
||||
daddr_t bn, nextbn;
|
||||
|
@ -18,7 +18,7 @@
|
|||
int n, on, majordev, (*ioctl)();
|
||||
int error = 0;
|
||||
***************
|
||||
*** 245,260 ****
|
||||
*** 246,261 ****
|
||||
if (uio->uio_offset < 0)
|
||||
return (EINVAL);
|
||||
bsize = BLKDEV_IOSIZE;
|
||||
|
@ -35,7 +35,7 @@
|
|||
on = uio->uio_offset % bsize;
|
||||
n = min((unsigned)(bsize - on), uio->uio_resid);
|
||||
if (vp->v_lastr + bscale == bn) {
|
||||
--- 245,265 ----
|
||||
--- 246,266 ----
|
||||
if (uio->uio_offset < 0)
|
||||
return (EINVAL);
|
||||
bsize = BLKDEV_IOSIZE;
|
||||
|
@ -58,7 +58,7 @@
|
|||
n = min((unsigned)(bsize - on), uio->uio_resid);
|
||||
if (vp->v_lastr + bscale == bn) {
|
||||
***************
|
||||
*** 299,305 ****
|
||||
*** 300,306 ****
|
||||
struct proc *p = uio->uio_procp;
|
||||
struct buf *bp;
|
||||
daddr_t bn;
|
||||
|
@ -66,7 +66,7 @@
|
|||
struct partinfo dpart;
|
||||
register int n, on;
|
||||
int error = 0;
|
||||
--- 304,310 ----
|
||||
--- 305,311 ----
|
||||
struct proc *p = uio->uio_procp;
|
||||
struct buf *bp;
|
||||
daddr_t bn;
|
||||
|
@ -75,7 +75,7 @@
|
|||
register int n, on;
|
||||
int error = 0;
|
||||
***************
|
||||
*** 326,341 ****
|
||||
*** 327,342 ****
|
||||
if (uio->uio_offset < 0)
|
||||
return (EINVAL);
|
||||
bsize = BLKDEV_IOSIZE;
|
||||
|
@ -92,7 +92,7 @@
|
|||
on = uio->uio_offset % bsize;
|
||||
n = min((unsigned)(bsize - on), uio->uio_resid);
|
||||
if (n == bsize)
|
||||
--- 331,349 ----
|
||||
--- 332,350 ----
|
||||
if (uio->uio_offset < 0)
|
||||
return (EINVAL);
|
||||
bsize = BLKDEV_IOSIZE;
|
||||
|
|
Loading…
Reference in New Issue