Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/atari/dev Convert to new device buffer queue interf...



details:   https://anonhg.NetBSD.org/src/rev/76e6e32839de
branches:  trunk
changeset: 535123:76e6e32839de
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Aug 10 21:49:14 2002 +0000

description:
Convert to new device buffer queue interface.

Approved by: Leo Weppelman <leo%netbsd.org@localhost>

diffstat:

 sys/arch/atari/dev/fd.c   |  17 ++++++++---------
 sys/arch/atari/dev/hdfd.c |  18 +++++++++---------
 2 files changed, 17 insertions(+), 18 deletions(-)

diffs (158 lines):

diff -r 59adbb534065 -r 76e6e32839de sys/arch/atari/dev/fd.c
--- a/sys/arch/atari/dev/fd.c   Sat Aug 10 21:38:06 2002 +0000
+++ b/sys/arch/atari/dev/fd.c   Sat Aug 10 21:49:14 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.37 2001/07/26 22:55:13 wiz Exp $      */
+/*     $NetBSD: fd.c,v 1.38 2002/08/10 21:49:14 hannken Exp $  */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -132,7 +132,7 @@
 struct fd_softc {
        struct device   sc_dv;          /* generic device info          */
        struct disk     dkdev;          /* generic disk info            */
-       struct buf_queue bufq;          /* queue of buf's               */
+       struct bufq_state bufq;         /* queue of buf's               */
        struct callout  sc_motor_ch;
        int             unit;           /* unit for atari controlling hw*/
        int             nheads;         /* number of heads in use       */
@@ -506,7 +506,7 @@
 
                type = FLP_TYPE(dev);
 
-               BUFQ_INIT(&sc->bufq);
+               bufq_alloc(&sc->bufq, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
                sc->unit        = DISKUNIT(dev);
                sc->part        = RAW_PART;
                sc->nheads      = fdtypes[type].nheads;
@@ -629,7 +629,7 @@
         * queue the buf and kick the low level code
         */
        sps = splbio();
-       disksort_blkno(&sc->bufq, bp);  /* XXX disksort_cylinder */
+       BUFQ_PUT(&sc->bufq, bp);        /* XXX disksort_cylinder */
        if (!lock_stat) {
                if (fd_state & FLP_MON)
                        callout_stop(&sc->sc_motor_ch);
@@ -715,7 +715,7 @@
 {
        struct buf      *bp;
 
-       bp           = BUFQ_FIRST(&sc->bufq);
+       bp           = BUFQ_PEEK(&sc->bufq);
        sc->sector   = bp->b_blkno;     /* Start sector for I/O         */
        sc->io_data  = bp->b_data;      /* KVA base for I/O             */
        sc->io_bytes = bp->b_bcount;    /* Transfer size in bytes       */
@@ -753,10 +753,9 @@
                 * Finish current transaction.
                 */
                sps = splbio();
-               bp = BUFQ_FIRST(&sc->bufq);
+               bp = BUFQ_GET(&sc->bufq);
                if (bp == NULL)
                        panic("fddone");
-               BUFQ_REMOVE(&sc->bufq, bp);
                splx(sps);
 
 #ifdef FLP_DEBUG
@@ -782,7 +781,7 @@
                        i = 0;
                if((sc1 = fd_cd.cd_devs[i]) == NULL)
                        continue;
-               if (BUFQ_FIRST(&sc1->bufq) != NULL)
+               if (BUFQ_PEEK(&sc1->bufq) != NULL)
                        break;
                if(i == sc->unit) {
                        callout_reset(&sc->sc_motor_ch, FLP_MONDELAY,
@@ -1023,7 +1022,7 @@
                                return;
                        }
 
-                       bp = BUFQ_FIRST(&sc->bufq);
+                       bp = BUFQ_PEEK(&sc->bufq);
 
                        bp->b_error  = EIO;
                        bp->b_flags |= B_ERROR;
diff -r 59adbb534065 -r 76e6e32839de sys/arch/atari/dev/hdfd.c
--- a/sys/arch/atari/dev/hdfd.c Sat Aug 10 21:38:06 2002 +0000
+++ b/sys/arch/atari/dev/hdfd.c Sat Aug 10 21:49:14 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hdfd.c,v 1.29 2001/11/21 17:33:27 wiz Exp $    */
+/*     $NetBSD: hdfd.c,v 1.30 2002/08/10 21:49:15 hannken Exp $        */
 
 /*-
  * Copyright (c) 1996 Leo Weppelman
@@ -241,7 +241,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 */
 };
 
@@ -496,7 +496,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;
@@ -609,7 +609,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);
@@ -662,17 +662,17 @@
         * another drive is waiting to be serviced, since there is a long motor
         * startup delay whenever we switch.
         */
+       (void)BUFQ_GET(&fd->sc_q);
        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);
 
        biodone(bp);
        /* turn off motor 5s from now */
@@ -904,7 +904,7 @@
        s = splbio();
        fdcstatus(&fd->sc_dev, 0, "timeout");
 
-       if (BUFQ_FIRST(&fd->sc_q) != NULL)
+       if (BUFQ_PEEK(&fd->sc_q) != NULL)
                fdc->sc_state++;
        else
                fdc->sc_state = DEVIDLE;
@@ -949,7 +949,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);
@@ -1237,7 +1237,7 @@
        struct buf *bp;
 
        fd = fdc->sc_drives.tqh_first;
-       bp = BUFQ_FIRST(&fd->sc_q);
+       bp = BUFQ_PEEK(&fd->sc_q);
 
        if (fd->sc_opts & FDOPT_NORETRY)
            goto fail;



Home | Main Index | Thread Index | Old Index