From owner-cvs-src@FreeBSD.ORG Fri Aug 20 15:14:26 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D64616A4CE; Fri, 20 Aug 2004 15:14:26 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0E46043D1F; Fri, 20 Aug 2004 15:14:26 +0000 (GMT) (envelope-from phk@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i7KFEPnx025189; Fri, 20 Aug 2004 15:14:25 GMT (envelope-from phk@repoman.freebsd.org) Received: (from phk@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i7KFEP5S025188; Fri, 20 Aug 2004 15:14:25 GMT (envelope-from phk) Message-Id: <200408201514.i7KFEP5S025188@repoman.freebsd.org> From: Poul-Henning Kamp Date: Fri, 20 Aug 2004 15:14:25 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/sys fdcio.h src/usr.sbin/fdcontrol fdcontrol.c src/usr.sbin/fdformat fdformat.c src/usr.sbin/fdread fdutil.c src/sys/dev/fdc fdc.c fdc_acpi.c fdc_isa.c fdc_pccard.c fdcvar.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2004 15:14:26 -0000 phk 2004-08-20 15:14:25 UTC FreeBSD src repository Modified files: sys/sys fdcio.h usr.sbin/fdcontrol fdcontrol.c usr.sbin/fdformat fdformat.c usr.sbin/fdread fdutil.c sys/dev/fdc fdc.c fdc_acpi.c fdc_isa.c fdc_pccard.c fdcvar.h Log: Rewrite of the floppy driver to make it MPsafe & GEOM friendly: Centralize the fdctl_wr() function by adding the offset in the resource to the softc structure. Bugfix: Read the drive-change signal from the correct place: same place as the ctl register. Remove the cdevsw{} related code and implement a GEOM class. Ditch the state-engine and park a thread on each controller to service the queue. Make the interrupt FAST & MPSAFE since it is just a simple wakeup(9) call. Rely on a per controller mutex to protect the bioqueues. Grab GEOMs topology lock when we have to and Giant when ISADMA needs it. Since all access to the hardware is isolated in the per controller thread, the rest of the driver is lock & Giant free. Create a per-drive queue where requests are parked while the motor spins up. When the motor is running the requests are purged to the per controller queue. This allows requests to other drives to be serviced during spin-up. Only setup the motor-off timeout when we finish the last request on the queue and cancel it when a new request arrives. This fixes the bug in the old code where the motor turned off while we were still retrying a request. Make the "drive-change" work reliably. Probe the drive on first opens. Probe with a recal and a seek to cyl=1 to reset the drive change line and check again to see if we have a media. When we see the media disappear we destroy the geom provider, create a new one, and flag that autodetection should happen next time we see a media (unless a specific format is configured). Add sysctl tunables for a lot of drive related parameters. If you spend a lot of time waiting for floppies you can grab the i82078 pdf from Intels web-page and try tuning these. Add sysctl debug.fdc.debugflags which will enable various kinds of debugging printfs. Add central definitions of our well known floppy formats. Simplify datastructures for autoselection of format and call the code at the right times. Bugfix: Remove at least one piece of code which would have made 2.88M floppies not work. Use implied seeks on enhanced controllers. Use multisector transfers on all controllers. Increase ISADMA bounce buffers accordingly. Fall back to single sector when retrying. Reset retry count on every successful transaction. Sort functions in a more sensible order and generally tidy up a fair bit here and there. Assorted related fixes and adjustments in userland utilities. WORKAROUNDS: Do allow r/w opens of r/o media but refuse actual write operations. This is necessary until the p4::phk_bufwork branch gets integrated (This problem relates to remounting not reopening devices, see sys/*/*/${fs}_vfsops.c for details). Keep PC98's private copy of the old floppy driver compiling and presumably working (see below). TODO (planned) Move probing of drives until after interrupts/timeouts work (like for ATA/SCSI drives). TODO (unplanned) This driver should be made to work on PC98 as well. Test on YE-DATA PCMCIA floppy drive. Fix 2.88M media. This is a MT5 candidate (depends on the bioq_takefirst() addition). Revision Changes Path 1.284 +1460 -1846 src/sys/dev/fdc/fdc.c 1.3 +1 -30 src/sys/dev/fdc/fdc_acpi.c 1.10 +12 -61 src/sys/dev/fdc/fdc_isa.c 1.9 +7 -16 src/sys/dev/fdc/fdc_pccard.c 1.4 +8 -61 src/sys/dev/fdc/fdcvar.h 1.18 +61 -33 src/sys/sys/fdcio.h 1.12 +15 -18 src/usr.sbin/fdcontrol/fdcontrol.c 1.22 +2 -7 src/usr.sbin/fdformat/fdformat.c 1.6 +49 -90 src/usr.sbin/fdread/fdutil.c