From 80d01221fba6378750d13255544b1470c28a7cf4 Mon Sep 17 00:00:00 2001 From: rgrimes Date: Thu, 6 Apr 1995 07:20:16 +0000 Subject: Correct recalibrate/seek code at attach time so that we do not get all the ``fdc0: ready for output in input'' messages when probing for ft devices. Submitted by: Steve Gerakines --- sys/dev/fdc/fdc.c | 15 +++++++++++---- sys/i386/isa/fd.c | 15 +++++++++++---- sys/i386/isa/ft.c | 24 +++++++++++++++++------- sys/isa/fd.c | 15 +++++++++++---- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 8330f4f..9a6816f 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.54 1995/03/16 18:11:59 bde Exp $ + * $Id: fd.c,v 1.55 1995/03/26 19:28:18 rgrimes Exp $ * */ @@ -262,7 +262,7 @@ void ftstrategy(struct buf *); int ftioctl(dev_t, int, caddr_t, int, struct proc *); int ftdump(dev_t); int ftsize(dev_t); -int ftattach(struct isa_device *, struct isa_device *); +int ftattach(struct isa_device *, struct isa_device *, int); #endif /* autoconfig functions */ @@ -549,7 +549,7 @@ fdattach(struct isa_device *dev) fdcu_t fdcu = dev->id_unit; fdc_p fdc = fdc_data + fdcu; fd_p fd; - int fdsu, st0, st3, i; + int fdsu, st0, st3, i, unithasfd; struct isa_device *fdup; int ic_type = 0; @@ -591,7 +591,14 @@ fdattach(struct isa_device *dev) #if NFT > 0 /* If BIOS says no floppy, or > 2nd device */ /* Probe for and attach a floppy tape. */ - if ((dev->id_flags & FT_PROBE) && ftattach(dev, fdup)) + /* Tell FT if there was already a disk */ + /* with this unit number found. */ + + unithasfd = 0; + if (fdu < NFD && fd->type != NO_TYPE) + unithasfd = 1; + if ((dev->id_flags & FT_PROBE) && + ftattach(dev, fdup, unithasfd)) continue; if (fdsu < DRVS_PER_CTLR) fd->type = NO_TYPE; diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c index 8330f4f..9a6816f 100644 --- a/sys/i386/isa/fd.c +++ b/sys/i386/isa/fd.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.54 1995/03/16 18:11:59 bde Exp $ + * $Id: fd.c,v 1.55 1995/03/26 19:28:18 rgrimes Exp $ * */ @@ -262,7 +262,7 @@ void ftstrategy(struct buf *); int ftioctl(dev_t, int, caddr_t, int, struct proc *); int ftdump(dev_t); int ftsize(dev_t); -int ftattach(struct isa_device *, struct isa_device *); +int ftattach(struct isa_device *, struct isa_device *, int); #endif /* autoconfig functions */ @@ -549,7 +549,7 @@ fdattach(struct isa_device *dev) fdcu_t fdcu = dev->id_unit; fdc_p fdc = fdc_data + fdcu; fd_p fd; - int fdsu, st0, st3, i; + int fdsu, st0, st3, i, unithasfd; struct isa_device *fdup; int ic_type = 0; @@ -591,7 +591,14 @@ fdattach(struct isa_device *dev) #if NFT > 0 /* If BIOS says no floppy, or > 2nd device */ /* Probe for and attach a floppy tape. */ - if ((dev->id_flags & FT_PROBE) && ftattach(dev, fdup)) + /* Tell FT if there was already a disk */ + /* with this unit number found. */ + + unithasfd = 0; + if (fdu < NFD && fd->type != NO_TYPE) + unithasfd = 1; + if ((dev->id_flags & FT_PROBE) && + ftattach(dev, fdup, unithasfd)) continue; if (fdsu < DRVS_PER_CTLR) fd->type = NO_TYPE; diff --git a/sys/i386/isa/ft.c b/sys/i386/isa/ft.c index 81a00f6..64d26cf 100644 --- a/sys/i386/isa/ft.c +++ b/sys/i386/isa/ft.c @@ -17,7 +17,10 @@ * POSSIBILITY OF SUCH DAMAGE. * * ft.c - QIC-40/80 floppy tape driver - * $Id: ft.c,v 1.16 1995/03/26 19:28:22 rgrimes Exp $ + * $Id: ft.c,v 1.17 1995/03/28 07:55:26 bde Exp $ + * + * 01/19/95 ++sg + * Cleaned up recalibrate/seek code at attach time for FreeBSD 2.x. * * 06/07/94 v0.9 ++sg * Tape stuck on segment problem should be gone. Re-wrote buffering @@ -433,8 +436,9 @@ ft_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, * Probe/attach floppy tapes. */ int -ftattach(isadev, fdup) +ftattach(isadev, fdup, unithasfd) struct isa_device *isadev, *fdup; + int unithasfd; { fdcu_t fdcu = isadev->id_unit; /* fdc active unit */ fdc_p fdc = fdc_data + fdcu; /* pointer to controller structure */ @@ -491,7 +495,12 @@ ftattach(isadev, fdup) /* * FT_INSIGHT - insight style + * + * Since insight requires turning the drive motor on, we will not + * perform this probe if a floppy drive was already found with the + * the given unit and controller. */ + if (unithasfd) goto out; tape_start(ftu, 1); if (tape_status(ftu) >= 0) { ft->type = FT_INSIGHT; @@ -1470,15 +1479,16 @@ ftintr_wait(ftu_t ftu, int cmd, int ticks) case FTCMD_RECAL: case FTCMD_SEEK: for (retries = 0; retries < 10000; retries++) { + DELAY(100); out_fdc(fdcu, NE7CMD_SENSEI); st0 = in_fdc(fdcu); + if ((st0 & 0xc0) == 0x80) continue; pcn = in_fdc(fdcu); if (st0 & 0x20) { ft->sts_wait = FTSTS_INTERRUPT; ft->pcn = pcn; goto intrdone; } - DELAY(100); } break; } @@ -1665,6 +1675,7 @@ tape_start(ftu_t ftu, int motor) ft_p ft = &ft_data[ftu]; fdc_p fdc = ft->fdc; int s, mbits; + static int mbmotor[] = { FDO_MOEN0, FDO_MOEN1, FDO_MOEN2, FDO_MOEN3 }; s = splbio(); DPRT(("tape_start start\n")); @@ -1674,10 +1685,9 @@ tape_start(ftu_t ftu, int motor) (void)ftintr_wait(ftu, FTCMD_RESET, hz/10); /* raise reset, enable DMA, motor on if needed */ - if (motor) - mbits = (!ftu) ? FDO_MOEN0 : FDO_MOEN1; - else - mbits = 0; + mbits = ftu & 3; + if (motor && ftu < 4) + mbits |= mbmotor[ftu]; outb(fdc->baseport+FDOUT, FDO_FRST | FDO_FDMAEN | mbits); (void)ftintr_wait(ftu, FTCMD_RESET, hz/10); diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 8330f4f..9a6816f 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.54 1995/03/16 18:11:59 bde Exp $ + * $Id: fd.c,v 1.55 1995/03/26 19:28:18 rgrimes Exp $ * */ @@ -262,7 +262,7 @@ void ftstrategy(struct buf *); int ftioctl(dev_t, int, caddr_t, int, struct proc *); int ftdump(dev_t); int ftsize(dev_t); -int ftattach(struct isa_device *, struct isa_device *); +int ftattach(struct isa_device *, struct isa_device *, int); #endif /* autoconfig functions */ @@ -549,7 +549,7 @@ fdattach(struct isa_device *dev) fdcu_t fdcu = dev->id_unit; fdc_p fdc = fdc_data + fdcu; fd_p fd; - int fdsu, st0, st3, i; + int fdsu, st0, st3, i, unithasfd; struct isa_device *fdup; int ic_type = 0; @@ -591,7 +591,14 @@ fdattach(struct isa_device *dev) #if NFT > 0 /* If BIOS says no floppy, or > 2nd device */ /* Probe for and attach a floppy tape. */ - if ((dev->id_flags & FT_PROBE) && ftattach(dev, fdup)) + /* Tell FT if there was already a disk */ + /* with this unit number found. */ + + unithasfd = 0; + if (fdu < NFD && fd->type != NO_TYPE) + unithasfd = 1; + if ((dev->id_flags & FT_PROBE) && + ftattach(dev, fdup, unithasfd)) continue; if (fdsu < DRVS_PER_CTLR) fd->type = NO_TYPE; -- cgit v1.1