From owner-freebsd-hackers Mon Jan 23 23:02:12 1995 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id XAA18709 for hackers-outgoing; Mon, 23 Jan 1995 23:02:12 -0800 Received: from ns.gte.com (ns.gte.com [132.197.8.9]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id XAA18703 for ; Mon, 23 Jan 1995 23:02:10 -0800 Received: from bunny.gte.com by ns.gte.com (5.65c/IDA-1.4.4) id AA01809; Tue, 24 Jan 1995 02:00:09 -0500 Received: by bunny.gte.com (8.6.9/GTEL2.19) id CAA28324; Tue, 24 Jan 1995 02:01:32 -0500 Received: from localhost by genesis.nred.ma.us (8.3/genesis0.0) id XAA03010; Mon, 23 Jan 1995 23:45:53 -0800 Date: Mon, 23 Jan 1995 23:45:53 -0800 From: steve2@genesis.nred.ma.us (Steve Gerakines) Message-Id: <199501240745.XAA03010@genesis.nred.ma.us> To: freebsd-hackers@FreeBSD.org Subject: Floppy tape probe patch Sender: hackers-owner@FreeBSD.org Precedence: bulk Here's a set of patches against -current that should fix the probe issues that were brought up. The "output in input" messages should be gone and people without tape drives should not see any drive activity. Test it out and let me know how it goes. I am mostly interested in hearing from the people that said it caused problems for them. Two other things. Joerg is correct. The floppy tape is using unit 0 to address the drive in the GENERIC kernel. id_unit was always used to address the drive, while the id_physid number was used only to identify the tape drive config entry. Also, the ft driver brought out the output on input messages because it is polling for a seek or recalibrate completion by sending sense interrupt commands to the fdc. The fd driver doesn't see them because it doesn't poll, it just waits a long time and hopes that it finished. This is impractical for ft because the the probe would take too long. Although I'm glad the messages in the fd driver pointed out what was happening, as far as I can tell ft wasn't really doing anything wrong. Seems to me fd is reporting a bit too much for a non-debug mode. - Steve steve2@genesis.nred.ma.us ---- snip snip snip ---- *** fd.c.orig Mon Jan 23 22:20:24 1995 --- fd.c Mon Jan 23 22:22:44 1995 *************** *** 259,265 **** 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 *); #endif /* autoconfig functions */ --- 259,265 ---- 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); #endif /* autoconfig functions */ *************** *** 535,541 **** fdcu_t fdcu = dev->id_unit; fdc_p fdc = fdc_data + fdcu; fd_p fd; ! int fdsu, st0, st3, i; struct isa_device *fdup; int ic_type = 0; --- 535,541 ---- fdcu_t fdcu = dev->id_unit; fdc_p fdc = fdc_data + fdcu; fd_p fd; ! int fdsu, st0, st3, i, unithasfd; struct isa_device *fdup; int ic_type = 0; *************** *** 578,584 **** #if NFT > 0 /* If BIOS says no floppy, or > 2nd device */ /* Probe for and attach a floppy tape. */ ! if (ftattach(dev, fdup)) continue; if (fdsu < DRVS_PER_CTLR) fd->type = NO_TYPE; --- 578,590 ---- #if NFT > 0 /* If BIOS says no floppy, or > 2nd device */ /* Probe for and attach a floppy tape. */ ! /* 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 (ftattach(dev, fdup, unithasfd)) continue; if (fdsu < DRVS_PER_CTLR) fd->type = NO_TYPE; *** ft.c.orig Mon Jan 23 21:11:40 1995 --- ft.c Mon Jan 23 22:35:11 1995 *************** *** 19,24 **** --- 19,27 ---- * ft.c - QIC-40/80 floppy tape driver * $Id: ft.c,v 1.15 1994/12/04 03:10:09 jkh 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 * scheme. Added support for drives that do not automatically perform *************** *** 432,439 **** * Probe/attach floppy tapes. */ int ! ftattach(isadev, fdup) struct isa_device *isadev, *fdup; { fdcu_t fdcu = isadev->id_unit; /* fdc active unit */ fdc_p fdc = fdc_data + fdcu; /* pointer to controller structure */ --- 435,443 ---- * Probe/attach floppy tapes. */ int ! 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 */ *************** *** 490,496 **** --- 494,505 ---- /* * 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; *************** *** 1469,1483 **** case FTCMD_RECAL: case FTCMD_SEEK: for (retries = 0; retries < 10000; retries++) { out_fdc(fdcu, NE7CMD_SENSEI); st0 = in_fdc(fdcu); pcn = in_fdc(fdcu); if (st0 & 0x20) { ft->sts_wait = FTSTS_INTERRUPT; ft->pcn = pcn; goto intrdone; } - DELAY(100); } break; } --- 1478,1493 ---- 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; } } break; } *************** *** 1664,1669 **** --- 1674,1680 ---- 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")); *************** *** 1673,1682 **** (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; outb(fdc->baseport+FDOUT, FDO_FRST | FDO_FDMAEN | mbits); (void)ftintr_wait(ftu, FTCMD_RESET, hz/10); --- 1684,1692 ---- (void)ftintr_wait(ftu, FTCMD_RESET, hz/10); /* raise reset, enable DMA, motor on if needed */ ! 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); ---- EOF EOF EOF ----