Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Update for sys/buf.h/disksort_*() changes.
details: https://anonhg.NetBSD.org/src/rev/6b1bfbbd6fdc
branches: trunk
changeset: 480859:6b1bfbbd6fdc
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri Jan 21 23:28:59 2000 +0000
description:
Update for sys/buf.h/disksort_*() changes.
diffstat:
sys/arch/alpha/isa/fd.c | 44 +++++++++++-----------
sys/arch/amiga/dev/fd.c | 42 +++++++++++-----------
sys/arch/arm32/mainbus/fd.c | 44 +++++++++++-----------
sys/arch/atari/dev/fd.c | 21 +++++-----
sys/arch/atari/dev/hdfd.c | 44 +++++++++++-----------
sys/arch/atari/dev/md_root.c | 4 +-
sys/arch/bebox/isa/fd.c | 44 +++++++++++-----------
sys/arch/hp300/dev/ct.c | 39 +++++++------------
sys/arch/hp300/dev/mt.c | 56 ++++++++++-------------------
sys/arch/hp300/dev/rd.c | 48 ++++++++++++------------
sys/arch/hp300/dev/rdvar.h | 8 ++--
sys/arch/hp300/dev/scsi.c | 6 +--
sys/arch/hp300/dev/sd.c | 46 ++++++++++++------------
sys/arch/hp300/dev/sdvar.h | 8 ++--
sys/arch/hp300/dev/st.c | 36 ++++++------------
sys/arch/hp300/dev/stvar.h | 6 ++-
sys/arch/i386/isa/fd.c | 44 +++++++++++-----------
sys/arch/mac68k/obio/iwm_fd.c | 18 +++++----
sys/arch/mac68k/obio/iwm_fdvar.h | 5 +-
sys/arch/pica/dev/fd.c | 42 +++++++++++-----------
sys/arch/pmax/dev/rz.c | 58 ++++++++++++++----------------
sys/arch/pmax/dev/tz.c | 62 +++++++++++---------------------
sys/arch/sparc/dev/fd.c | 42 +++++++++++-----------
sys/arch/sparc64/dev/fd.c | 43 +++++++++++-----------
sys/arch/sparc64/sparc64/db_interface.c | 7 ++-
25 files changed, 381 insertions(+), 436 deletions(-)
diffs (truncated from 2826 to 300 lines):
diff -r 8041d357014e -r 6b1bfbbd6fdc sys/arch/alpha/isa/fd.c
--- a/sys/arch/alpha/isa/fd.c Fri Jan 21 23:22:24 2000 +0000
+++ b/sys/arch/alpha/isa/fd.c Fri Jan 21 23:28:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.5 1999/03/24 05:50:52 mrg Exp $ */
+/* $NetBSD: fd.c,v 1.6 2000/01/21 23:28:59 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -137,8 +137,6 @@
/* XXX misuse a flag to identify format operation */
#define B_FORMAT B_XXX
-#define b_cylin b_resid
-
enum fdc_state {
DEVIDLE = 0,
MOTORWAIT,
@@ -257,7 +255,8 @@
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct buf sc_q; /* head of buf chain */
+ struct buf_queue sc_q; /* pending I/O requests */
+ int sc_active; /* number of active I/O operations */
#if NRND > 0
rndsource_element_t rnd_source;
@@ -551,6 +550,7 @@
else
printf(": density unknown\n");
+ BUFQ_INIT(&fd->sc_q);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -626,18 +626,18 @@
bp->b_bcount = sz << DEV_BSHIFT;
}
- bp->b_cylin = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
+ bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
#ifdef FD_DEBUG
printf("fdstrategy: b_blkno %d b_bcount %ld blkno %d cylin %ld sz %d\n",
- bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylin, sz);
+ bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylinder, sz);
#endif
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- disksort(&fd->sc_q, bp);
+ disksort_cylinder(&fd->sc_q, bp);
untimeout(fd_motor_off, fd); /* a good idea */
- if (!fd->sc_q.b_active)
+ if (fd->sc_active == 0)
fdstart(fd);
#ifdef DIAGNOSTIC
else {
@@ -667,7 +667,7 @@
int active = fdc->sc_drives.tqh_first != 0;
/* Link into controller queue. */
- fd->sc_q.b_active = 1;
+ fd->sc_active = 1;
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
/* If controller not already active, start it. */
@@ -691,14 +691,14 @@
if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (bp->b_actf) {
+ if (BUFQ_NEXT(bp) != NULL)
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
- } else
- fd->sc_q.b_active = 0;
+ else
+ fd->sc_active = 0;
}
bp->b_resid = fd->sc_bcount;
fd->sc_skip = 0;
- fd->sc_q.b_actf = bp->b_actf;
+ BUFQ_REMOVE(&fd->sc_q, bp);
#if NRND > 0
rnd_add_uint32(&fd->rnd_source, bp->b_blkno);
@@ -947,7 +947,7 @@
#endif
fdcstatus(&fd->sc_dev, 0, "timeout");
- if (fd->sc_q.b_actf)
+ if (BUFQ_FIRST(&fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -992,11 +992,11 @@
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = fd->sc_q.b_actf;
+ bp = BUFQ_FIRST(&fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- fd->sc_q.b_active = 0;
+ fd->sc_active = 0;
goto loop;
}
@@ -1034,7 +1034,7 @@
/* fall through */
case DOSEEK:
doseek:
- if (fd->sc_cylin == bp->b_cylin)
+ if (fd->sc_cylin == bp->b_cylinder)
goto doio;
out_fdc(iot, ioh, NE7CMD_SPECIFY);/* specify command */
@@ -1043,7 +1043,7 @@
out_fdc(iot, ioh, NE7CMD_SEEK); /* seek function */
out_fdc(iot, ioh, fd->sc_drive); /* drive number */
- out_fdc(iot, ioh, bp->b_cylin * fd->sc_type->step);
+ out_fdc(iot, ioh, bp->b_cylinder * fd->sc_type->step);
fd->sc_cylin = -1;
fdc->sc_state = SEEKWAIT;
@@ -1140,14 +1140,14 @@
/* Make sure seek really happened. */
out_fdc(iot, ioh, NE7CMD_SENSEI);
if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 ||
- cyl != bp->b_cylin * fd->sc_type->step) {
+ cyl != bp->b_cylinder * fd->sc_type->step) {
#ifdef FD_DEBUG
fdcstatus(&fd->sc_dev, 2, "seek failed");
#endif
fdcretry(fdc);
goto loop;
}
- fd->sc_cylin = bp->b_cylin;
+ fd->sc_cylin = bp->b_cylinder;
goto doio;
case IOTIMEDOUT:
@@ -1185,7 +1185,7 @@
fd->sc_skip += fd->sc_nbytes;
fd->sc_bcount -= fd->sc_nbytes;
if (!finfo && fd->sc_bcount > 0) {
- bp->b_cylin = fd->sc_blkno / fd->sc_type->seccyl;
+ bp->b_cylinder = fd->sc_blkno / fd->sc_type->seccyl;
goto doseek;
}
fdfinish(fd, bp);
@@ -1260,7 +1260,7 @@
struct buf *bp;
fd = fdc->sc_drives.tqh_first;
- bp = fd->sc_q.b_actf;
+ bp = BUFQ_FIRST(&fd->sc_q);
if (fd->sc_opts & FDOPT_NORETRY)
goto fail;
diff -r 8041d357014e -r 6b1bfbbd6fdc sys/arch/amiga/dev/fd.c
--- a/sys/arch/amiga/dev/fd.c Fri Jan 21 23:22:24 2000 +0000
+++ b/sys/arch/amiga/dev/fd.c Fri Jan 21 23:28:59 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.41 1999/12/04 21:20:04 ragge Exp $ */
+/* $NetBSD: fd.c,v 1.42 2000/01/21 23:29:00 thorpej Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -68,7 +68,6 @@
#define FDBBSIZE (8192)
#define FDSBSIZE (8192)
-#define b_cylin b_resid
#define FDUNIT(dev) DISKUNIT(dev)
#define FDPART(dev) DISKPART(dev)
#define FDMAKEDEV(m, u, p) MAKEDISKDEV((m), (u), (p))
@@ -142,7 +141,8 @@
struct fd_softc {
struct device sc_dv; /* generic device info; must come first */
struct disk dkdev; /* generic disk info */
- struct buf bufq; /* queue of buf's */
+ struct buf_queue bufq; /* queue pending I/O operations */
+ struct buf curbuf; /* state of current I/O operation */
struct fdtype *type;
void *cachep; /* cached track data (write through) */
int cachetrk; /* cahced track -1 for none */
@@ -385,6 +385,8 @@
ap = auxp;
sc = (struct fd_softc *)dp;
+ BUFQ_INIT(&sc->bufq);
+
sc->curcyl = sc->cachetrk = -1;
sc->openpart = -1;
sc->type = ap->type;
@@ -660,7 +662,6 @@
{
struct disklabel *lp;
struct fd_softc *sc;
- struct buf *dp;
int unit, part, s;
unit = FDUNIT(bp->b_dev);
@@ -692,8 +693,7 @@
* queue the buf and kick the low level code
*/
s = splbio();
- dp = &sc->bufq;
- disksort(dp, bp);
+ disksort_cylinder(&sc->bufq, bp);
fdstart(sc);
splx(s);
return;
@@ -813,7 +813,7 @@
bp = (void *)geteblk((int)lp->d_secsize);
bp->b_dev = dev;
bp->b_blkno = 0;
- bp->b_cylin = 0;
+ bp->b_cylinder = 0;
bp->b_bcount = FDSECSIZE;
bp->b_flags = B_BUSY | B_READ;
fdstrategy(bp);
@@ -923,7 +923,7 @@
bp = (void *)geteblk((int)lp->d_secsize);
bp->b_dev = FDMAKEDEV(major(dev), FDUNIT(dev), RAW_PART);
bp->b_blkno = 0;
- bp->b_cylin = 0;
+ bp->b_cylinder = 0;
bp->b_bcount = FDSECSIZE;
bp->b_flags = B_BUSY | B_READ;
fdstrategy(bp);
@@ -935,7 +935,7 @@
dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
bcopy(lp, dlp, sizeof(struct disklabel));
bp->b_blkno = 0;
- bp->b_cylin = 0;
+ bp->b_cylinder = 0;
bp->b_flags = B_WRITE;
fdstrategy(bp);
error = biowait(bp);
@@ -1207,8 +1207,8 @@
/*
* get next buf if there.
*/
- dp = &sc->bufq;
- if ((bp = dp->b_actf) == NULL) {
+ dp = &sc->curbuf;
+ if ((bp = BUFQ_FIRST(&sc->bufq)) == NULL) {
#ifdef FDDEBUG
printf(" nothing to do\n");
#endif
@@ -1241,15 +1241,15 @@
for (;;) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
- if (bp->b_actf == NULL)
+ if (BUFQ_NEXT(bp) == NULL)
break;
biodone(bp);
- bp = bp->b_actf;
+ bp = BUFQ_NEXT(bp);
}
/*
* do fddone() on last buf to allow other units to start.
*/
- dp->b_actf = bp;
+ BUFQ_INSERT_HEAD(&sc->bufq, bp);
fddone(sc);
return;
}
@@ -1325,8 +1325,8 @@
struct buf *dp, *bp;
int trk, write;
- dp = &sc->bufq;
- bp = dp->b_actf;
+ dp = &sc->curbuf;
+ bp = BUFQ_FIRST(&sc->bufq);
dp->b_data += (dp->b_bcount - bp->b_resid);
dp->b_blkno += (dp->b_bcount - bp->b_resid) / FDSECSIZE;
dp->b_bcount = bp->b_resid;
@@ -1571,8 +1571,8 @@
if (sc->flags & FDF_MOTOROFF)
goto nobuf;
- dp = &sc->bufq;
- if ((bp = dp->b_actf) == NULL)
+ dp = &sc->curbuf;
+ if ((bp = BUFQ_FIRST(&sc->bufq)) == NULL)
panic ("fddone");
/*
* check for an error that may have occured
@@ -1612,7 +1612,7 @@
/*
* remove from queue.
*/
Home |
Main Index |
Thread Index |
Old Index