summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdc/fdc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/fdc/fdc.c')
-rw-r--r--sys/dev/fdc/fdc.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 85305f4..a2aac72 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.101 1997/09/16 07:45:45 joerg Exp $
+ * $Id: fd.c,v 1.102 1997/09/17 20:16:14 tegge Exp $
*
*/
@@ -170,6 +170,8 @@ static struct fd_data {
#ifdef notyet
int dkunit; /* disk stats unit number */
#endif
+ struct callout_handle toffhandle;
+ struct callout_handle tohandle;
#ifdef DEVFS
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
@@ -534,7 +536,7 @@ fdattach(struct isa_device *dev)
fdc->state = DEVIDLE;
/* reset controller, turn motor off, clear fdout mirror reg */
outb(fdc->baseport + FDOUT, ((fdc->fdout = 0)));
- TAILQ_INIT(&fdc->head);
+ bufq_init(&fdc->head);
/* check for each floppy drive */
for (fdup = isa_biotab_fdc; fdup->id_driver != 0; fdup++) {
@@ -673,6 +675,8 @@ fdattach(struct isa_device *dev)
fd->fdc = fdc;
fd->fdsu = fdsu;
fd->options = 0;
+ callout_handle_init(&fd->toffhandle);
+ callout_handle_init(&fd->tohandle);
printf("fd%d: ", fdu);
switch (fdt) {
@@ -843,7 +847,7 @@ fd_turnoff(void *arg1)
* and nothing is queued on it.
*/
if (fd->fdc->state != DEVIDLE && fd->fdc->fdu == fdu) {
- timeout(fd_turnoff, arg1, 4 * hz);
+ fd->toffhandle = timeout(fd_turnoff, arg1, 4 * hz);
return;
}
@@ -1154,8 +1158,8 @@ fdstrategy(struct buf *bp)
}
bp->b_pblkno = bp->b_blkno;
s = splbio();
- tqdisksort(&fdc->head, bp);
- untimeout(fd_turnoff, (caddr_t)fdu); /* a good idea */
+ bufqdisksort(&fdc->head, bp);
+ untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
fdstart(fdcu);
splx(s);
return;
@@ -1195,7 +1199,7 @@ fd_timeout(void *arg1)
struct buf *bp;
int s;
- bp = TAILQ_FIRST(&fdc_data[fdcu].head);
+ bp = bufq_first(&fdc_data[fdcu].head);
/*
* Due to IBM's brain-dead design, the FDC has a faked ready
@@ -1282,7 +1286,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
struct fd_formb *finfo = NULL;
size_t fdblk;
- bp = TAILQ_FIRST(&fdc->head);
+ bp = bufq_first(&fdc->head);
if(!bp) {
/***********************************************\
* nothing left for this controller to do *
@@ -1321,7 +1325,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
TRACE1("fd%d", fdu);
TRACE1("[%s]", fdstates[fdc->state]);
TRACE1("(0x%x)", fd->flags);
- untimeout(fd_turnoff, (caddr_t)fdu);
+ untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle);
timeout(fd_turnoff, (caddr_t)fdu, 4 * hz);
switch (fdc->state)
{
@@ -1526,10 +1530,10 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
}
}
fdc->state = IOCOMPLETE;
- timeout(fd_timeout, (caddr_t)fdcu, hz);
+ fd->tohandle = timeout(fd_timeout, (caddr_t)fdcu, hz);
return(0); /* will return later */
case IOCOMPLETE: /* IO DONE, post-analyze */
- untimeout(fd_timeout, (caddr_t)fdcu);
+ untimeout(fd_timeout, (caddr_t)fdcu, fd->tohandle);
if (fd_read_status(fdc, fd->fdsu))
{
@@ -1579,7 +1583,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
{
/* ALL DONE */
fd->skip = 0;
- TAILQ_REMOVE(&fdc->head, bp, b_act);
+ bufq_remove(&fdc->head, bp);
biodone(bp);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
@@ -1689,7 +1693,7 @@ retrier(fdcu)
fdc_p fdc = fdc_data + fdcu;
register struct buf *bp;
- bp = TAILQ_FIRST(&fdc->head);
+ bp = bufq_first(&fdc->head);
if(fd_data[FDUNIT(minor(bp->b_dev))].options & FDOPT_NORETRY)
goto fail;
@@ -1733,7 +1737,7 @@ retrier(fdcu)
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid += bp->b_bcount - fdc->fd->skip;
- TAILQ_REMOVE(&fdc->head, bp, b_act);
+ bufq_remove(&fdc->head, bp);
fdc->fd->skip = 0;
biodone(bp);
fdc->state = FINDWORK;
OpenPOWER on IntegriCloud