FDC(4)
πΎ FDC(4) β the floppy disk controller driver, bestie πΎ
okay so, this is fdc, the PC architecture floppy disk controller driver. Yes, floppies. Yes, still. And honestly? It's giving retro main character energy and I'm obsessed π
β¨ SYNOPSIS β¨
device fdc
and then in /boot/device.hints:
hint.fdc.0.at="isa"
hint.fdc.0.port="0x3F0"
hint.fdc.0.irq="6"
hint.fdc.0.drq="2"
hint.fdc.0.flags="0x0"
hint.fd.0.at="fdc0"
hint.fd.0.drive="0"
hint.fd.0.flags="0x0"
hint.fd.1.at="fdc0"
hint.fd.1.drive="1"
hint.fd.1.flags="0x0"
πΈ DESCRIPTION πΈ
π Device Usage π
So this driver is your plug for floppy disk drives, fr fr. It can handle floppies using either FM (single-density) or MFM (double or high-density) recording. Two vibes, one driver. Slay.
Floppy disk controllers can connect up to four drives each. The fdc driver can currently handle up to two drives per controller (or four drives on ACPI). When the driver initializes, it tries to figure out which type of floppy controller you've got going on. The known controller types are either the original NE765 or i8272 chips, or the enhanced ones that are compatible with the NE72065 or i82077 chips. Those enhanced controllers (among other glow-ups) implement a FIFO for floppy data transfers that gets automatically enabled once an enhanced chip has been detected. If you wanna turn that FIFO activation off, use the per-controller flags value of 0x1.
By default, this driver creates a single device node /dev/fdN for each attached drive with number N. And for historical reasons (iykyk), device nodes that use a trailing UFS-style partition letter (ranging from 'a' through 'h') can also be accessed β and those are implemented as symbolic links to the main device node. Cute, right? π
Accessing the main device node will attempt to autodetect the density of the available medium for multi-density devices. So like, you can use either a 720 KB medium or a 1440 KB medium in a high-density 3.5 inch standard floppy drive. Normally this autodetection only happens once, at the first call to open(2) for the device after you insert the medium. This assumes the drive offers proper changeline support so media changes can actually be detected by the driver. To flag a drive that does not have changeline support, override it with the per-drive device flags value of 0x10 β which causes every call to open(2) to perform the autodetection. Every. Single. One.
When you're trying to use a floppy device with special-density media, you can create other device nodes of the form /dev/fdN.MMMM, where N is the drive number and MMMM is a number between one and four digits describing the device density. Up to 15 additional subdevices per drive can be created that way. The administrator is free to decide on a policy for how to assign these numbers. The two common policies are: either implement subdevices numbered 1 through 15, or use a number that describes the medium density in kilobytes. Initially, each of those devices will be configured to the maximal density that's possible for the drive type (like 1200 KB for 5.25 inch HD drives, or 1440 KB for 3.5 inch HD drives). The desired density to be used on that subdevice needs to be configured using fdcontrol(8). No cap.
Drive types are configured using the lower four bits of the per-drive device flags. Here's the whole menu, bestie:
1β 5.25 inch double-density device with 40 cylinders (360 KB native capacity)2β 5.25 inch high-density device with 80 cylinders (1200 KB native capacity)3β 3.5 inch double-density device with 80 cylinders (720 KB native capacity)4β 3.5 inch high-density device with 80 cylinders (1440 KB native capacity)5β 3.5 inch extra-density device with 80 cylinders (2880 KB native capacity, usage currently restricted to at most 1440 KB media)6β Same as type 5, available for compatibility with some BIOSes
On IA32 architectures, the drive type can be specified as 0 for the drives. In that case, the CMOS configuration memory will be consulted to obtain the value for that drive. The ACPI probe automatically determines these values via the _FDE and _FDI methods, but this can be overridden by specifying a drive type hint.
Normally, each configured drive will be probed at initialization time, using a short seek sequence. This is intended to find out about drives that have been configured but are actually missing or otherwise not responding. (The ACPI probe method does not perform this seek.) In some environments (like laptops with detachable drives), it might be desirable to bypass this drive probe and pretend a drive is there, so the driver autoconfiguration will work even if the drive is currently not present. For that purpose, you need to specify a per-drive device flags value of 0x20. Pretend drive era π
π¦ Programming Interface π¦
In addition to the normal read and write functionality, the fdc driver offers a number of configurable options using ioctl(2). To access any of this functionality, programmers need to include the header file <sys/fdcio.h> into their programs. The call to open(2) can be performed in two possible ways.
When opening the device without the O_NONBLOCK flag set, the device is opened in a normal way, which would cause the main device nodes to perform automatic media density selection, and which will yield a file descriptor that is fully available for any I/O operation or any of the following ioctl(2) commands.
When opening the device with O_NONBLOCK set, automatic media density selection will be bypassed, and the device remains in a half-opened state. No actual I/O operations are possible, but many of the ioctl(2) commands described below can be performed. This mode is intended for access to the device without the requirement to have an accessible media present β like for status inquiries to the drive, or in order to format a medium. O_NONBLOCK needs to be cleared before I/O operations are possible on the descriptor, which requires a prior specification of the density using the FD_STYPE command (see below). Operations that are not allowed on the half-opened descriptor will cause an error value of EAGAIN. Not me getting gatekept by my own file descriptor π
The following ioctl(2) commands are currently available:
FD_FORMβ Used to format a floppy disk medium. Third argument is a pointer to astruct fd_formbspecifying which track to format, and which parameters to fill into the ID fields of the floppy disk medium.FD_GTYPEβ Returns the current density definition record for the selected device. Third argument is a pointer tostruct fd_type.FD_STYPEβ Adjusts the density definition of the selected device. Third argument is a pointer tostruct fd_type. For the fixed-density subdevices (1through15per drive), this operation is restricted to a process with superuser privileges. For the auto-selecting subdevice0, the operation is temporarily allowed to any process, but this setting will be lost again upon the next autoselection. This can be used when formatting a new medium (which will require you to open the device usingO_NONBLOCK, and thus to later adjust the density usingFD_STYPE).FD_GOPTSβ Obtain the current drive options. Third argument is a pointer toint, containing a bitwise union of the following possible flag values:FDOPT_NORETRYβ Do not automatically retry operations upon failure.FDOPT_NOERRLOGβ Do not cause βhard errorβ kernel logs for failed I/O operations.FDOPT_NOERRORβ Do not indicate I/O errors when returning fromread(2)orwrite(2)system calls. The caller is assumed to useFD_GSTATcalls in order to inquire about the success of each operation. This is intended to allow even erroneous data from bad blocks to be retrieved using normal I/O operations.FDOPT_AUTOSELβ Device performs automatic density selection. Unlike the above flags, this one is read-only.
FD_SOPTSβ Set device options, see above for their meaning. Third argument is a pointer toint. Drive options will always be cleared when closing the descriptor.FD_CLRERRβ Clear the internal low-level error counter. Normally, controller-level I/O errors are only logged up toFDC_ERRMAXerrors (currently defined to100). This command resets the counter. Requires superuser privileges.FD_READIDβ Read one sector ID field from the floppy disk medium. Third argument is a pointer tostruct fdc_readid, where the read data will be returned. Can be used to analyze a floppy disk medium.FD_GSTATβ Return the recent floppy disk controller status, if available. Third argument is a pointer tostruct fdc_status, where the status registers (ST0,ST1,ST2,C,H,R, andN) are being returned.EINVALwill be caused if no recent status is available.FD_GDTYPEβ Returns the floppy disk drive type. Third argument is a pointer toenum fd_drivetype. This type is the same as being used in the per-drive configuration flags, or in the CMOS configuration data or ACPI namespace on IA32 systems.
π DEPRECATION NOTICE π
The PC Card attachment of this driver is scheduled for removal prior to the release of FreeBSD 13.0. Bestie, it's over. Mourn accordingly. π
π FILES π
/dev/fd*β floppy disk device nodes
π SEE ALSO π
fdformat(1), fdread(1), fdwrite(1), ioctl(2), open(2), read(2), write(2), fdcontrol(8)
π AUTHORS π
This man page was initially written by Wilko Bulte, and later vastly rewritten by JΓΆrg Wunsch. Kings, honestly. Periodt. π
and that's the whole page, bestie π this one shipped with Debian, dated April 7, 2017 β go forth and floppy responsibly π¦β¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1994 Wilko Bulte
- Copyright (c) 2001 Joerg Wunsch
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms