Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Convert to new device buffer queue interface.
details: https://anonhg.NetBSD.org/src/rev/55c8abfecb1d
branches: trunk
changeset: 534375:55c8abfecb1d
user: hannken <hannken%NetBSD.org@localhost>
date: Tue Jul 23 20:49:54 2002 +0000
description:
Convert to new device buffer queue interface.
Approved by: Nathan J. Williams <nathanw%netbsd.org@localhost>
diffstat:
sys/arch/sun3/dev/fd.c | 18 +++++++++---------
sys/arch/sun3/dev/xd.c | 17 ++++++++---------
sys/arch/sun3/dev/xdvar.h | 4 ++--
sys/arch/sun3/dev/xy.c | 14 +++++++-------
sys/arch/sun3/dev/xyvar.h | 4 ++--
sys/dev/vme/xd.c | 19 +++++++++----------
sys/dev/vme/xdvar.h | 4 ++--
sys/dev/vme/xy.c | 16 ++++++++--------
sys/dev/vme/xyvar.h | 4 ++--
9 files changed, 49 insertions(+), 51 deletions(-)
diffs (truncated from 434 to 300 lines):
diff -r 3d47a3f636aa -r 55c8abfecb1d sys/arch/sun3/dev/fd.c
--- a/sys/arch/sun3/dev/fd.c Tue Jul 23 14:41:41 2002 +0000
+++ b/sys/arch/sun3/dev/fd.c Tue Jul 23 20:49:54 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.25 2001/09/05 14:03:48 tsutsui Exp $ */
+/* $NetBSD: fd.c,v 1.26 2002/07/23 20:49:54 hannken Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@@ -220,7 +220,7 @@
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct buf_queue sc_q; /* pending I/O requests */
+ struct bufq_state sc_q; /* pending I/O requests */
int sc_active; /* number of active I/O operations */
};
@@ -521,7 +521,7 @@
else
printf(": density unknown\n");
- BUFQ_INIT(&fd->sc_q);
+ bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -636,7 +636,7 @@
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- disksort_cylinder(&fd->sc_q, bp);
+ BUFQ_PUT(&fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -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 (BUFQ_NEXT(bp) != NULL) {
+ if (BUFQ_PEEK(&fd->sc_q) != NULL) {
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
} else
fd->sc_active = 0;
}
bp->b_resid = fd->sc_bcount;
fd->sc_skip = 0;
- BUFQ_REMOVE(&fd->sc_q, bp);
+ (void)BUFQ_GET(&fd->sc_q);
biodone(bp);
/* turn off motor 5s from now */
@@ -989,7 +989,7 @@
s = splbio();
fdcstatus(&fd->sc_dv, 0, "timeout");
- if (BUFQ_FIRST(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(&fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -1141,7 +1141,7 @@
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_FIRST(&fd->sc_q);
+ bp = BUFQ_PEEK(&fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1488,7 +1488,7 @@
struct buf *bp;
fd = fdc->sc_drives.tqh_first;
- bp = BUFQ_FIRST(&fd->sc_q);
+ bp = BUFQ_PEEK(&fd->sc_q);
fdc->sc_overruns = 0;
if (fd->sc_opts & FDOPT_NORETRY)
diff -r 3d47a3f636aa -r 55c8abfecb1d sys/arch/sun3/dev/xd.c
--- a/sys/arch/sun3/dev/xd.c Tue Jul 23 14:41:41 2002 +0000
+++ b/sys/arch/sun3/dev/xd.c Tue Jul 23 20:49:54 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xd.c,v 1.34 2001/09/05 14:03:49 tsutsui Exp $ */
+/* $NetBSD: xd.c,v 1.35 2002/07/23 20:49:54 hannken Exp $ */
/*
*
@@ -438,7 +438,7 @@
/* init queue of waiting bufs */
- BUFQ_INIT(&xdc->sc_wq);
+ bufq_alloc(&xdc->sc_wq, BUFQ_FCFS);
callout_init(&xdc->sc_tick_ch);
/*
@@ -1074,7 +1074,7 @@
/* first, give jobs in front of us a chance */
parent = xd->parent;
- while (parent->nfree > 0 && BUFQ_FIRST(&parent->sc_wq) != NULL)
+ while (parent->nfree > 0 && BUFQ_PEEK(&parent->sc_wq) != NULL)
if (xdc_startbuf(parent, NULL, NULL) != XD_ERR_AOK)
break;
@@ -1083,7 +1083,7 @@
* buffs will get picked up later by xdcintr().
*/
if (parent->nfree == 0) {
- BUFQ_INSERT_TAIL(&parent->sc_wq, bp);
+ BUFQ_PUT(&parent->sc_wq, bp);
splx(s);
return;
}
@@ -1131,7 +1131,7 @@
xdc_start(xdcsc, XDC_MAXIOPB);
/* fill up any remaining iorq's with queue'd buffers */
- while (xdcsc->nfree > 0 && BUFQ_FIRST(&xdcsc->sc_wq) != NULL)
+ while (xdcsc->nfree > 0 && BUFQ_PEEK(&xdcsc->sc_wq) != NULL)
if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
break;
@@ -1374,10 +1374,9 @@
/* get buf */
if (bp == NULL) {
- bp = BUFQ_FIRST(&xdcsc->sc_wq);
+ bp = BUFQ_GET(&xdcsc->sc_wq);
if (bp == NULL)
panic("xdc_startbuf bp");
- BUFQ_REMOVE(&xdcsc->sc_wq, bp);
xdsc = xdcsc->sc_drives[DISKUNIT(bp->b_dev)];
}
partno = DISKPART(bp->b_dev);
@@ -1418,7 +1417,7 @@
printf("%s: warning: out of DVMA space\n",
xdcsc->sc_dev.dv_xname);
XDC_FREE(xdcsc, rqno);
- BUFQ_INSERT_TAIL(&xdcsc->sc_wq, bp);
+ BUFQ_PUT(&xdcsc->sc_wq, bp);
return (XD_ERR_FAIL); /* XXX: need some sort of
* call-back scheme here? */
}
@@ -1619,7 +1618,7 @@
/* now that we've drained everything, start up any bufs that have
* queued */
- while (xdcsc->nfree > 0 && BUFQ_FIRST(&xdcsc->sc_wq) != NULL)
+ while (xdcsc->nfree > 0 && BUFQ_PEEK(&xdcsc->sc_wq) != NULL)
if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
break;
diff -r 3d47a3f636aa -r 55c8abfecb1d sys/arch/sun3/dev/xdvar.h
--- a/sys/arch/sun3/dev/xdvar.h Tue Jul 23 14:41:41 2002 +0000
+++ b/sys/arch/sun3/dev/xdvar.h Tue Jul 23 20:49:54 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xdvar.h,v 1.7 2000/03/23 06:46:17 thorpej Exp $ */
+/* $NetBSD: xdvar.h,v 1.8 2002/07/23 20:49:54 hannken Exp $ */
/*
*
@@ -153,7 +153,7 @@
struct xd_iorq *reqs; /* i/o requests */
struct xd_iopb *iopbase; /* iopb base addr (maps iopb->iorq) */
struct xd_iopb *dvmaiopb; /* iopb base in DVMA space, not kvm */
- struct buf_queue sc_wq; /* queue'd IOPBs for this controller */
+ struct bufq_state sc_wq; /* queue'd IOPBs for this controller */
char freereq[XDC_MAXIOPB]; /* free list (stack) */
char waitq[XDC_MAXIOPB]; /* wait queue */
u_char nfree; /* number of iopbs free */
diff -r 3d47a3f636aa -r 55c8abfecb1d sys/arch/sun3/dev/xy.c
--- a/sys/arch/sun3/dev/xy.c Tue Jul 23 14:41:41 2002 +0000
+++ b/sys/arch/sun3/dev/xy.c Tue Jul 23 20:49:54 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xy.c,v 1.35 2001/09/05 14:03:49 tsutsui Exp $ */
+/* $NetBSD: xy.c,v 1.36 2002/07/23 20:49:54 hannken Exp $ */
/*
*
@@ -505,7 +505,7 @@
xy->parent = xyc;
/* init queue of waiting bufs */
- BUFQ_INIT(&xy->xyq);
+ bufq_alloc(&xy->xyq, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
xy->xyrq = &xyc->reqs[xa->driveno];
xy->xy_drive = xa->driveno;
@@ -1036,7 +1036,7 @@
s = splbio(); /* protect the queues */
- disksort_blkno(&xy->xyq, bp); /* XXX disksort_cylinder */
+ BUFQ_PUT(&xy->xyq, bp); /* XXX disksort_cylinder */
/* start 'em up */
@@ -1645,7 +1645,7 @@
/* Sun3: map/unmap regardless of B_PHYS */
dvma_mapout(iorq->dbufbase,
iorq->buf->b_bcount);
- BUFQ_REMOVE(&iorq->xy->xyq, iorq->buf);
+ (void)BUFQ_GET(&iorq->xy->xyq);
disk_unbusy(&iorq->xy->sc_dk,
(iorq->buf->b_bcount -
iorq->buf->b_resid));
@@ -1691,9 +1691,9 @@
if (iorq == NULL) {
for (lcv = 0; lcv < XYC_MAXDEV ; lcv++) {
if ((xy = xycsc->sc_drives[lcv]) == NULL) continue;
- if (BUFQ_FIRST(&xy->xyq) == NULL) continue;
+ if (BUFQ_PEEK(&xy->xyq) == NULL) continue;
if (xy->xyrq->mode != XY_SUB_FREE) continue;
- xyc_startbuf(xycsc, xy, BUFQ_FIRST(&xy->xyq));
+ xyc_startbuf(xycsc, xy, BUFQ_PEEK(&xy->xyq));
}
}
xyc_submit_iorq(xycsc, iorq, XY_SUB_NOQ);
@@ -1823,7 +1823,7 @@
/* Sun3: map/unmap regardless of B_PHYS */
dvma_mapout(iorq->dbufbase,
iorq->buf->b_bcount);
- BUFQ_REMOVE(&iorq->xy->xyq, bp);
+ (void)BUFQ_GET(&iorq->xy->xyq);
disk_unbusy(&iorq->xy->sc_dk,
(bp->b_bcount - bp->b_resid));
iorq->mode = XY_SUB_FREE;
diff -r 3d47a3f636aa -r 55c8abfecb1d sys/arch/sun3/dev/xyvar.h
--- a/sys/arch/sun3/dev/xyvar.h Tue Jul 23 14:41:41 2002 +0000
+++ b/sys/arch/sun3/dev/xyvar.h Tue Jul 23 20:49:54 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xyvar.h,v 1.6 2000/03/23 06:46:17 thorpej Exp $ */
+/* $NetBSD: xyvar.h,v 1.7 2002/07/23 20:49:55 hannken Exp $ */
/*
*
@@ -116,7 +116,7 @@
u_char nsect; /* number of sectors per track */
u_char hw_spt; /* as above, but includes spare sectors */
struct xy_iorq *xyrq; /* this disk's ioreq structure */
- struct buf_queue xyq; /* queue'd I/O requests */
+ struct bufq_state xyq; /* queue'd I/O requests */
struct dkbad dkb; /* bad144 sectors */
};
diff -r 3d47a3f636aa -r 55c8abfecb1d sys/dev/vme/xd.c
--- a/sys/dev/vme/xd.c Tue Jul 23 14:41:41 2002 +0000
+++ b/sys/dev/vme/xd.c Tue Jul 23 20:49:54 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xd.c,v 1.40 2002/01/14 13:32:48 tsutsui Exp $ */
+/* $NetBSD: xd.c,v 1.41 2002/07/23 20:49:55 hannken Exp $ */
/*
*
@@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.40 2002/01/14 13:32:48 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.41 2002/07/23 20:49:55 hannken Exp $");
#undef XDC_DEBUG /* full debug */
#define XDC_DIAG /* extra sanity checks */
@@ -619,7 +619,7 @@
/* init queue of waiting bufs */
- BUFQ_INIT(&xdc->sc_wq);
+ bufq_alloc(&xdc->sc_wq, BUFQ_FCFS);
callout_init(&xdc->sc_tick_ch);
/*
@@ -1286,7 +1286,7 @@
/* first, give jobs in front of us a chance */
parent = xd->parent;
- while (parent->nfree > 0 && BUFQ_FIRST(&parent->sc_wq) != NULL)
+ while (parent->nfree > 0 && BUFQ_PEEK(&parent->sc_wq) != NULL)
if (xdc_startbuf(parent, NULL, NULL) != XD_ERR_AOK)
break;
@@ -1295,7 +1295,7 @@
*/
if (parent->nfree == 0) {
- BUFQ_INSERT_TAIL(&parent->sc_wq, bp);
+ BUFQ_PUT(&parent->sc_wq, bp);
splx(s);
return;
}
@@ -1347,7 +1347,7 @@
/* fill up any remaining iorq's with queue'd buffers */
- while (xdcsc->nfree > 0 && BUFQ_FIRST(&xdcsc->sc_wq) != NULL)
+ while (xdcsc->nfree > 0 && BUFQ_PEEK(&xdcsc->sc_wq) != NULL)
if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
Home |
Main Index |
Thread Index |
Old Index