2 .\" Copyright (c) 1994 Wilko Bulte
3 .\" Copyright (c) 2001 Joerg Wunsch
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. The name of the author may not be used to endorse or promote products
15 .\" derived from this software without specific prior written permission
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 .Nd "PC architecture floppy disk controller driver"
41 .Pa /boot/device.hints :
42 .Cd hint.fdc.0.at="isa"
43 .Cd hint.fdc.0.port="0x3F0"
44 .Cd hint.fdc.0.irq="6"
45 .Cd hint.fdc.0.drq="2"
46 .Cd hint.fdc.0.flags="0x0"
47 .Cd hint.fd.0.at="fdc0"
48 .Cd hint.fd.0.drive="0"
49 .Cd hint.fd.0.flags="0x0"
50 .Cd hint.fd.1.at="fdc0"
51 .Cd hint.fd.1.drive="1"
52 .Cd hint.fd.1.flags="0x0"
55 This driver provides access to floppy disk drives.
57 either FM (single-density) or MFM (double or high-density) recording
60 Floppy disk controllers can connect up to four drives each.
63 driver can currently handle up to two drives per controller (or four
66 driver initialization, an attempt is made to find out the type of the
67 floppy controller in use.
68 The known controller types are either the
69 original NE765 or i8272 chips, or alternatively
71 controllers that are compatible with the NE72065 or i82077 chips.
72 These enhanced controllers (among other enhancements) implement a FIFO
73 for floppy data transfers that will automatically be enabled once an
74 enhanced chip has been detected.
75 This FIFO activation can be disabled
76 using the per-controller flags value of
79 By default, this driver creates a single device node
81 for each attached drive with number
83 For historical reasons, device nodes that use a trailing UFS-style
84 partition letter (ranging from
88 can also be accessed, which will be implemented as symbolic links to
91 Accessing the main device node will attempt to autodetect the density
92 of the available medium for multi-density devices.
94 possible to use either a 720 KB medium or a 1440 KB medium in a
95 high-density 3.5 inch standard floppy drive.
97 autodetection will only happen once at the first call to
99 for the device after inserting the medium.
100 This assumes the drive
101 offers proper changeline support so media changes can be detected by
103 To indicate a drive that does not have the changeline support,
104 this can be overridden using the per-drive device flags value of
106 (causing each call to
108 to perform the autodetection).
110 When trying to use a floppy device with special-density media, other
111 device nodes can be created, of the form
112 .Pa /dev/fd Ns Ar N . Ns Ar MMMM ,
115 is the drive number, and
117 is a number between one and four digits describing the device density.
118 Up to 15 additional subdevices per drive can be created that way.
120 administrator is free to decide on a policy how to assign these
122 The two common policies are to either implement subdevices
123 numbered 1 through 15, or to use a number that describes the medium
124 density in kilobytes.
125 Initially, each of those devices will be
126 configured to the maximal density that is possible for the drive type
127 (like 1200 KB for 5.25 inch HD drives or 1440 KB for 3.5 inch HD
129 The desired density to be used on that subdevice needs to be
133 Drive types are configured using the lower four bits of the per-drive
135 The following values can be specified:
136 .Bl -tag -width 2n -offset indent
138 5.25 inch double-density device with 40 cylinders (360 KB native
141 5.25 inch high-density device with 80 cylinders (1200 KB native
144 3.5 inch double-density device with 80 cylinders (720 KB native
147 3.5 inch high-density device with 80 cylinders (1440 KB native
150 3.5 inch extra-density device with 80 cylinders (2880 KB native
151 capacity, usage currently restricted to at most 1440 KB media)
153 Same as type 5, available for compatibility with some BIOSes
156 On IA32 architectures, the drive type can be specified as 0 for the
158 In that case, the CMOS configuration memory will be
159 consulted to obtain the value for that drive.
160 The ACPI probe automatically determines these values via the _FDE and
161 _FDI methods, but this can be overriden by specifying a drive type hint.
163 Normally, each configured drive will be probed at initialization
164 time, using a short seek sequence.
165 This is intended to find out about
166 drives that have been configured but are actually missing or
167 otherwise not responding.
168 (The ACPI probe method does not perform this seek.)
169 In some environments (like laptops with
170 detachable drives), it might be desirable to bypass this drive probe,
171 and pretend a drive to be there so the driver autoconfiguration will
172 work even if the drive is currently not present.
174 per-drive device flags value of
176 needs to be specified.
178 .Ss Programming Interface
179 In addition to the normal read and write functionality, the
181 driver offers a number of configurable options using
183 In order to access any of this functionality, programmers need to
184 include the header file
189 can be performed in two possible ways.
190 When opening the device
193 flag set, the device is opened in a normal way, which would cause the
194 main device nodes to perform automatic media density selection, and which
195 will yield a file descriptor that is fully available for any I/O operation
196 or any of the following
200 When opening the device with
202 set, automatic media density selection will be bypassed, and the device
203 remains in a half-opened state.
204 No actual I/O operations are possible, but
207 commands described below can be performed.
208 This mode is intended for
209 access to the device without the requirement to have an accessible
210 media present, like for status inquiries to the drive, or in order to
213 needs to be cleared before I/O operations are possible on the descriptor,
214 which requires a prior specification of the density using the
217 Operations that are not allowed on the half-opened
218 descriptor will cause an error value of
223 commands are currently available:
224 .Bl -tag -width ".Dv FD_READID"
226 Used to format a floppy disk medium.
227 Third argument is a pointer to a
228 .Vt "struct fd_formb"
229 specifying which track to format, and which parameters to fill into
230 the ID fields of the floppy disk medium.
232 Returns the current density definition record for the selected device.
233 Third argument is a pointer to
234 .Vt "struct fd_type" .
236 Adjusts the density definition of the selected device.
239 .Vt "struct fd_type" .
240 For the fixed-density subdevices (1 through 15 per drive), this
241 operation is restricted to a process with superuser privileges.
243 the auto-selecting subdevice 0, the operation is temporarily allowed
244 to any process, but this setting will be lost again upon the next
246 This can be used when formatting a new medium (which
247 will require to open the device using
249 and thus to later adjust the density using
252 Obtain the current drive options.
253 Third argument is a pointer to
255 containing a bitwise union of the following possible flag values:
256 .Bl -tag -width ".Dv FDOPT_NOERRLOG"
258 Do not automatically retry operations upon failure.
259 .It Dv FDOPT_NOERRLOG
262 kernel logs for failed I/O operations.
264 Do not indicate I/O errors when returning from
269 The caller is assumed to use
271 calls in order to inquire about the success of each operation.
273 is intended to allow even erroneous data from bad blocks to be
274 retrieved using normal I/O operations.
276 Device performs automatic density selection.
277 Unlike the above flags,
278 this one is read-only.
281 Set device options, see above for their meaning.
285 Drive options will always be cleared when closing the descriptor.
287 Set the driver debug level.
288 Third argument is a pointer to
290 level 0 turns off all debugging.
291 Only applicable if the driver has
293 .Cd "options FDC_DEBUG" .
295 Clear the internal low-level error counter.
296 Normally, controller-level
297 I/O errors are only logged up to
299 errors (currently defined to 100).
300 This command resets the counter.
301 Requires superuser privileges.
303 Read one sector ID field from the floppy disk medium.
306 .Vt "struct fdc_readid" ,
307 where the read data will be returned.
308 Can be used to analyze a floppy
311 Return the recent floppy disk controller status, if available.
313 argument is a pointer to
314 .Vt "struct fdc_status" ,
315 where the status registers (ST0, ST1, ST2, C, H, R, and N) are being
318 will be caused if no recent status is available.
320 Returns the floppy disk drive type.
321 Third argument is a pointer to
322 .Vt "enum fd_drivetype" .
323 This type is the same as being used in the per-drive configuration
324 flags, or in the CMOS configuration data or ACPI namespace on IA32 systems.
327 .Bl -tag -width ".Pa /dev/fd*" -compact
329 floppy disk device nodes
342 This man page was initially written by
344 and later vastly rewritten by