floppycontrol
Hurricane Electric Internet Services
NAME
floppycontrol - floppy driver configuration utility
SYNOPSIS
floppycontrol [-p] [--pollstate] [--printfdstate]
[-a operation-abort-threshold] [-c read-track-threshold]
[-r recalibrate-threshold] [-R reset-threshold]
[-e reporting-threshold] [-f] [-x] [-d drive] [-F] [-T]
[--resetnow condition] [--debug] [--nodebug] [--messages]
[--nomessages] [--broken_dcl] [--working_dcl]
[--inverted_dcl] [--no_inverted_dcl] [--silent_dcl_clear]
[--noisy_dcl_clear] [-c cmos-type] [--hlt hlt] [--hut hut]
[--srt srt] [-o spindown] [-u spinup] [-s select-delay]
[--rps rotations-per-second] [-O spindown-offset] [--track
max-tracks] [--timeout seconds] [-C check-interval]
[-n native-format] [--autodetect autodetection-sequence]
[-P] [--clrwerror] [--printwerror] [-h]
DESCRIPTION
floppycontrol program is used to configure the floppy
driver.
OPTIONS
Many options have a long and a short form.
-h --help
Print a help screen.
-d drive --drive drive
Selects the drive to configure. The default is
drive 0 (/dev/fd0).
-f --flush
Flushes (throws away) the dirty data buffers asso-
ciated with this drive. -x --eject Ejects the
disk out of the drive (Sparc). The dirty buffers
are first committed to disk before ejecting it.
Fails if the disk is mounted. -F --formatend Is-
sues an end format ioctl. This might be needed af-
ter exiting a formatting program in an unclean way.
superformat is not subject to this.
--resetnow condition
Resets the FDC under condition . 0 resets the FDC
only if a reset is needed anyways, 1 resets the FDC
also if a raw command has been performed since the
last reset, and 2 resets the FDC unconditionally.
ERROR HANDLING OPTIONS
The following options are used to configure the behavior
of the floppy driver in case of read/write errors. They
may be used by any user who has write privileges for the
drive. Whenever the floppy driver encounters an error, a
retry counter is incremented, and if this value is bigger
than certain thresholds, certain actions (described below)
are performed before retrying, or the sectors are read in
a different way. The counter is reset when the read or
write finally succeeds, or when the driver gives up.
-a operation_abort_trshld --abort operation_abort_trshld
Tell the floppy driver to stop trying to read/write
a sector after operation_abort_trshld retries, and
signal the I/O error to the user.
-t read_track_trshld --readtrack read_track_trshld
Tell the floppy driver to switch from track-reading
mode to sector-at-a-time-mode after read_track_tr-
shld retries.
-r recalibrate_trshld --recalibrate recalibrate_trshld
Tell the floppy driver to recalibrate the drive af-
ter recalibrate_trshld retries.
-R reset_treshold --reset reset_threshold
Tell the floppy driver to reset the controller af-
ter reset_threshold retries. After a controller re-
set, all drives are recalibrated too.
-e error_report_trshld --reporting error_report_trshld
Tell the floppy driver to start printing error mes-
sages to the console after error_report_trshld re-
tries.
PRINTING OPTIONS
-T --type
Print out the drive name. This is used by the MAKE-
FLOPPIES(8) script. The drive name is a letter (de-
scribing the drive type) followed by the capacity
of the format in bytes. The letter is E for 3.5 ED
drives, H for 3.5 HD drives, D for 3.5 DD drives, h
for 5.25 HD drives and d for 5.25 DD drives. The
drive type letter corresponds to the oldest drive
type supporting this format (not necessarily the
type of this drive instance.) For the generic for-
mat nodes (/dev/fd0 et al.) the name of "native
format" of the drive is printed, and for the de-
fault formats, If a generic format has been rede-
fined, its name becomes "(null)".
-p --print
Prints out the current drive configuration. The
names of the various fields are the same as the
name of the option to set them.
-P --printstate
Prints out the cached internal state of the driver.
The first line lists various attributes about the
disk: drive present, disk present, and disk
writable. These are only updated when the drive is
accessed.
spinup is the time when the motor became switched
on for the last time.
select is the time when the drive became selected
for the last time
first_read is the time when the first read request
after the last spin up completed.
probed_fmt is the the index of the autodetected
format in the autodetection sequence for this
drive.
track is the track where the drive currently sits.
-1 means that the driver doesn't know, but the con-
troller does (a seek command must be issued). -2
means that the controller doesn't know either, but
is sure that it not beyond the 80th track. The
drive needs a recalibration. -3 means that the
head may be beyond the 80th track. The drive needs
two successive recalibrations, because at each re-
calibration, the controller only issues 80 move
head commands to the drive.
maxblock is the highest block number that has been
read. maxtrack is a boolean which is set when a
sector that is not on track 0/head 0 has been read.
These are used for smart invalidation of the buffer
cache on geometry change. The buffer cache of the
drive is only invalidated on geometry change when
this change actually implies that a block that has
already been read changes position. This optimiza-
tion is useful for mtools which changes the geome-
try after reading the boot sector.
generation is roughly the number of disk changes
noticed since boot. Disk changes are noticed if the
disk is actually changed, or if a flush command is
issued and for both cases if any I/O to/from the
disk occurs. (i.e. if you insert several disks, but
don't do any I/O to them, the generation number
stays the same.)
refs is number of open file descriptors for this
drive. It is always at least one, because floppy-
control's file descriptor is counted too.
device is format type (as derived from the minor
device number) which is currently being used.
last_checked is date (in jiffies) when the drive
was last checked for a disk change, and a disk was
actually in the drive.
--pollstate
Polls the drive and then prints out the internal
state of the driver. (--printstate only prints out
the cached information without actually polling the
drive for a disk change.)
--printfdcstate
Prints out the state of the controller where the
target drive is attached to.
spec1 and spec2 are the current values of those
registers.
rate is current data transfer rate
rawcmd is true if a raw command has been executed
since the last reset. If this is the case, a reset
will be triggered when a drive on the same FDC is
next opened.
dor is the value of the digital output register.
The 4 high bits are a bit mask describing which
drives are spinning, the 2 low bits describe the
selected drive, bit 2 is used to reset the FDC, and
bit 3 describes whether this FDC has hold of the
interrupt and the DMA. If you have two FDCs, bit 3
is only set on one of them.
version is the version of the FDC. See linux/in-
clude/linux/fdreg.h for a listing of the FDC ver-
sion numbers.
reset is true if a reset needs to be issued to the
FDC before processing the next request.
need_configure is true if this FDC needs configura-
tion by the FD_CONFIGURE command.
has_fifo is set if the FDC understands the FD_CON-
FIGURE command.
perp_mode describes the perpendicular mode of this
FDC. 0 is non-perpendicular mode, 2 is HD perpen-
dicular mode, 3 is ED perpendicular mode, and 1 is
unknown.
address is the address of the first I/O port of the
FDC. Normally, this is 0x3f0 for the first FDC and
0x370 for the second.
PRIVILEGED CONFIGURATION
Only the superuser may set the following parameters:
-A autodetect_seq --autodetect autodetect_seq
Set the autodetection sequence. The autodetection
sequence is a comma-separated list of at most eight
format descriptors. Each format descriptor is a
format number optionally followed by the letter t .
For drive 0, the format number is the minor device
number divided by 4.
This sequence is used by to find out the format of
a newly inserted disk. The formats are tried one
after the other, and the first matching format is
retained. To test the format, the driver tries to
read the first sector on the first track on the
first head when t is not given, or the whole first
track when t is given. Thus, autodetection cannot
detect the number of tracks. However, this informa-
tion is contained in the boot sector, which is now
accessible. The boot sector can then be used by
mtools to configure the correct number of tracks.
Example: 7,4,20t,21 means to try out the formats
whose minor device numbers are 28 (1.44M), 16
(720k) , 80 (1.82M), and 84 (1.99M), in this order.
For the 1.82M format, try to read the whole track
at once.
Reading the whole track at once allows you to dis-
tinguish between two formats which differ only in
the number of sectors. (The format with the most
sectors must be tried first.) With the new mtools,
it is no longer necessary to make this distinction,
because mtools can now figure out the number of
sectors by looking at the boot sector.
Reading the whole track at once may also speed up
the first read by 200 milliseconds. However, if you
try to read a disk which has less sectors than the
format, you lose some time.
I suggest that you put the most often used format
in the first place (barring other constraints), as
each format that is tried out takes 400 millisec-
onds.
--tracks max_tracks
Set the maximal numbers of physical tracks that
this drive may handle. If you have a drive which is
only able to handle 80 tracks (making strange nois-
es when you try to format or read a disk with more
than 80 tracks), use this option to prevent unpriv-
ileged users of damaging your drive by repeatedly
reading disks with more than 80 tracks.
If you trust your users and your disks, you don't
need this. With most drives you don't need to worry
anyways.
--debug
Switch debugging output on. The debugging informa-
tion includes timing information. This option might
be useful to fine-tune the timing options for your
local setups. (But for most normal purposes, the
default values are good enough.)
--nodebug
Switch debugging output off.
--messages
Print informational messages after autodetection,
geometry parameter clearing and dma over/underruns.
--nomessages
Don't print informational messages after these
events.
--broken_dcl
Assumes that the disk change line off the drive is
broken. Disk changes are assumed to happen whenever
the device node is first opened. The physical disk
change line is ignored.
Use this option if disk changes are either not de-
tected at all, or if disk changes are detected when
the disk was not changed. If this option fixes the
problem, I'd recommend checking the floppy cable
and the drive jumpers. Apparently the disk change
line is near the edge of the cable, and is the
first line to suffer if the cable is not inserted
straight, or if it is damaged. On some drives, the
disk change line may be chosen by jumper. Make sure
that your floppy controller board and your drive
agree which line is the disk change line. If every-
thing seems right with the jumpers and the cables,
or if the drive is known not to support the disk
change line, leave this option on.
--working_dcl
Assumes that the disk change line works all right.
Switching from broken to working may lead to unex-
pected results after the first disk change.
--inverted_dcl
Assumes that this disk drives uses an inverted disk
change line. Apparently this is the case for IBM
thinkpads.
--no_inverted_dcl
Assumes that this drive follows the standard con-
vention for the disk change line.
--noisy_dcl_clear
Switches off silent disk change line clearing for
this drive.
-ccmos_type --cmos cmos_type
Set the CMOS type of the floppy drive. This is use-
ful if for some reason the real CMOS type is wrong,
or if you have more than two drives. (It is impos-
sible to specify the types for more than two drives
in the "real" CMOS.) Right now, this CMOS parameter
is not yet used by the kernel, except for feeding
it back to other applications (for instance super-
format(1)).
-nnative_format --native_format native_format
Set the native format of this drive. The native
format of a drive is the highest standard format
available for this drive. (Example: For a 5 1/4 HD
drive it is the usual 1200K format.) This is format
is used to make up the format name for the generic
device (which is the name of the native format).
This drive name is used by the MAKEFLOPPIES(8)
script.
--hlt hlt
Set the head load time (in microseconds) for this
floppy drive.
--hut hut
Set the head unload time (in microseconds) for this
floppy drive.
--srt srt
Set the step rate (in microseconds) for this floppy
drive.
-isector_interleave --interleave sector_interleave
Set the number of sectors beyond which sector in-
terleaving will be used. This option will only be
used by the FDFMTTRK ioctl. The old fdformat(1)
uses this, but superformat(1) does not.
TIMING PARAMETERS
To set these parameters, you need superuser privileges.
All times are in tick units (10 milliseconds).
-uspinup-time --spinup spinup_time
Set the spinup time of the floppy drive. In order
to do read or write to the floppy disk, it must
spin. It takes a certain time for the motor to
reach enough speed to read or write. This parameter
describes this time. The floppy driver doesn't try
to access the drive before the spinup time has
elapsed. With modern controllers, you may set this
time to zero, as the controller itself enforces the
right delay.
-ospindown-time --spindown spindown_time
Set the spindown time of this floppy drive. The mo-
tor is not stopped immediately after the operation
completes, because there might be more operations
following. The spindown time is the time the driver
waits before switching off the motor.
-Ospindown-offset --spindown_offset spindown_offset
Set the spindown offset of this floppy drive. This
parameter is used to set the position in which the
disk stops. This is useful to minimize the next ac-
cess time. (If the first sector is just near the
head at the very moment at which the disk has
reached enough speed, you win 200 milliseconds
against the most unfavorable situation).
This is done by clocking the time where the first
I/O request completes, and using this time to cal-
culate the current position of the disk. This mech-
anism is not 100% reliable (If it fails, you may
lose 200 milliseconds).
-sselect_delay --select_delay select_delay
Set the select delay of this floppy drive. This is
the delay that the driver waits after selecting the
drive and issuing the first command to it. For mod-
ern controllers/drives, you may set this to zero.
-Ccheck-interval --checkfreq check_interval
Set the maximal disk change check interval. If a
read or write to the device is issued, and disk
change has not been checked for a longer time than
this interval, it is checked now.
WRITE ERROR REPORTING
Due to the buffer cache, write errors cannot always be re-
ported to the writing user program as soon as the write
system call returns. Indeed the actual writing may actu-
ally take place much later. If a write error is encoun-
tered, the floppy driver stores information about it in
its per drive write error structure. This write error
structure stays until explicitly cleared.
--clrwerror
Clears the write error structure.
--printwerror
Prints the contents of the write error structure.
write_errors is a count of how many write errors
have occurred since the structure was last cleared.
badness is the maximal number of retries that were
needed to complete an operation (reads, writes and
formats). first_error_sector is where the first
(chronologically) write error occurred. first_er-
ror_generation is the disk generation in which did
the first write error occurred. last_error_sector
and last_error_generation are similar.
FILES
/dev/fd* - Floppy devices
AUTHOR
Alain Knaff, Alain.Knaff@inrialpes.fr
SEE ALSO
superformat(1), getfdprm(1), fdrawcmd(1), mtools(1)
Hurricane Electric Internet Services
Copyright (C) 1998
Hurricane Electric.
All Rights Reserved.