diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-08-20 15:14:25 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-08-20 15:14:25 +0000 |
commit | 1b67be7b750ed0f074d730bf1164a82fe1bcf83b (patch) | |
tree | b948c22d12f559b0c58f576fc7da5d69acc1c8ef /usr.sbin/fdformat | |
parent | 0f81131e63eb10706519803242117a8a09dff5c4 (diff) | |
download | src-1b67be7b750ed0f074d730bf1164a82fe1bcf83b.tar.gz src-1b67be7b750ed0f074d730bf1164a82fe1bcf83b.zip |
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).
Notes
Notes:
svn path=/head/; revision=134081
Diffstat (limited to 'usr.sbin/fdformat')
-rw-r--r-- | usr.sbin/fdformat/fdformat.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c index dd92a86a5077..8e29e40fc857 100644 --- a/usr.sbin/fdformat/fdformat.c +++ b/usr.sbin/fdformat/fdformat.c @@ -268,13 +268,8 @@ main(int argc, char **argv) parse_fmt(fmtstring, type, fdt, &newft); fdt = newft; } - if (fdopts & FDOPT_AUTOSEL) { - if (ioctl(fd, FD_STYPE, &fdt) < 0) - err(EX_OSERR, "ioctl(FD_STYPE)"); - } else if (fmtstring || format) { - errx(EX_USAGE, - "-f fmt or -s fmtstr is only allowed for autoselecting devices"); - } + if (ioctl(fd, FD_STYPE, &fdt) < 0) + err(EX_OSERR, "ioctl(FD_STYPE)"); if ((flags = fcntl(fd, F_GETFL, 0)) == -1) err(EX_OSERR, "fcntl(F_GETFL)"); flags &= ~O_NONBLOCK; |