From 56a2308964e22e26ef62fcc6ce64c1e85bec3f51 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 25 Mar 2000 21:20:23 +0000 Subject: [PATCH] Fix floppy driver after my isadma changes. --- sys/dev/fdc/fdc.c | 19 ++++++++++++------- sys/isa/fd.c | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 5f29e052e364..1d59f3fec23e 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -1643,7 +1643,7 @@ static int fdcpio(fdc_p fdc, long flags, caddr_t addr, u_int count) static int fdstate(fdc_p fdc) { - int read, format, head, i, sec = 0, sectrac, st0, cyl, st3; + int read, format, head, i, sec = 0, sectrac, st0, cyl, st3, idf; unsigned blknum = 0, b_cylinder = 0; fdu_t fdu = fdc->fdu; fd_p fd; @@ -1680,6 +1680,10 @@ fdstate(fdc_p fdc) if (fdc->fd && (fd != fdc->fd)) device_printf(fd->dev, "confused fd pointers\n"); read = bp->b_iocmd == BIO_READ; + if (read) + idf = ISADMA_READ; + else + idf = ISADMA_WRITE; format = bp->b_flags & B_FORMAT; if (format) { finfo = (struct fd_formb *)bp->b_data; @@ -1826,7 +1830,7 @@ fdstate(fdc_p fdc) fd->track = b_cylinder; if (!(fdc->flags & FDC_NODMA)) - isa_dmastart(bp->b_flags, bp->b_data+fd->skip, + isa_dmastart(idf, bp->b_data+fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); sectrac = fd->ft->sectrac; sec = blknum % (sectrac * fd->ft->heads); @@ -1841,7 +1845,7 @@ fdstate(fdc_p fdc) { /* stuck controller? */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); @@ -1898,7 +1902,7 @@ fdstate(fdc_p fdc) finfo->fd_formb_fillbyte, 0)) { /* controller fell over */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); @@ -1935,7 +1939,7 @@ fdstate(fdc_p fdc) 0)) { /* the beast is sleeping again */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); @@ -1974,7 +1978,7 @@ fdstate(fdc_p fdc) if (fd_read_status(fdc, fd->fdsu)) { if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, bp->b_data + fd->skip, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); if (fdc->retry < 6) @@ -1988,7 +1992,7 @@ fdstate(fdc_p fdc) case IOTIMEDOUT: if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, bp->b_data + fd->skip, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); if (fdc->status[0] & NE7_ST0_IC) { if ((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_AT @@ -2228,6 +2232,7 @@ fdformat(dev, finfo, p) BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); bp->b_flags = B_PHYS | B_FORMAT; + bp->b_iocmd = BIO_WRITE; /* * calculate a fake blkno, so fdstrategy() would initiate a diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 5f29e052e364..1d59f3fec23e 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -1643,7 +1643,7 @@ static int fdcpio(fdc_p fdc, long flags, caddr_t addr, u_int count) static int fdstate(fdc_p fdc) { - int read, format, head, i, sec = 0, sectrac, st0, cyl, st3; + int read, format, head, i, sec = 0, sectrac, st0, cyl, st3, idf; unsigned blknum = 0, b_cylinder = 0; fdu_t fdu = fdc->fdu; fd_p fd; @@ -1680,6 +1680,10 @@ fdstate(fdc_p fdc) if (fdc->fd && (fd != fdc->fd)) device_printf(fd->dev, "confused fd pointers\n"); read = bp->b_iocmd == BIO_READ; + if (read) + idf = ISADMA_READ; + else + idf = ISADMA_WRITE; format = bp->b_flags & B_FORMAT; if (format) { finfo = (struct fd_formb *)bp->b_data; @@ -1826,7 +1830,7 @@ fdstate(fdc_p fdc) fd->track = b_cylinder; if (!(fdc->flags & FDC_NODMA)) - isa_dmastart(bp->b_flags, bp->b_data+fd->skip, + isa_dmastart(idf, bp->b_data+fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); sectrac = fd->ft->sectrac; sec = blknum % (sectrac * fd->ft->heads); @@ -1841,7 +1845,7 @@ fdstate(fdc_p fdc) { /* stuck controller? */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); @@ -1898,7 +1902,7 @@ fdstate(fdc_p fdc) finfo->fd_formb_fillbyte, 0)) { /* controller fell over */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); @@ -1935,7 +1939,7 @@ fdstate(fdc_p fdc) 0)) { /* the beast is sleeping again */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); @@ -1974,7 +1978,7 @@ fdstate(fdc_p fdc) if (fd_read_status(fdc, fd->fdsu)) { if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, bp->b_data + fd->skip, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); if (fdc->retry < 6) @@ -1988,7 +1992,7 @@ fdstate(fdc_p fdc) case IOTIMEDOUT: if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(bp->b_flags, bp->b_data + fd->skip, + isa_dmadone(idf, bp->b_data + fd->skip, format ? bp->b_bcount : fdblk, fdc->dmachan); if (fdc->status[0] & NE7_ST0_IC) { if ((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_AT @@ -2228,6 +2232,7 @@ fdformat(dev, finfo, p) BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); bp->b_flags = B_PHYS | B_FORMAT; + bp->b_iocmd = BIO_WRITE; /* * calculate a fake blkno, so fdstrategy() would initiate a