diff --git a/share/man/man4/fdc.4 b/share/man/man4/fdc.4 index 774dc3f18cd6..937be2077b26 100644 --- a/share/man/man4/fdc.4 +++ b/share/man/man4/fdc.4 @@ -1,390 +1,396 @@ .\" .\" Copyright (c) 1994 Wilko Bulte .\" Copyright (c) 2001 Joerg Wunsch .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 10, 2023 +.Dd November 16, 2025 .Dt FDC 4 .Os .Sh NAME .Nm fdc .Nd "PC architecture floppy disk controller driver" .Sh SYNOPSIS .Cd device fdc .Pp In .Pa /boot/device.hints : .Cd hint.fdc.0.at="isa" .Cd hint.fdc.0.port="0x3F0" .Cd hint.fdc.0.irq="6" .Cd hint.fdc.0.drq="2" .Cd hint.fdc.0.flags="0x0" .Cd hint.fd.0.at="fdc0" .Cd hint.fd.0.drive="0" .Cd hint.fd.0.flags="0x0" .Cd hint.fd.1.at="fdc0" .Cd hint.fd.1.drive="1" .Cd hint.fd.1.flags="0x0" +.Sh DEPRECATION NOTICE +The +.Nm +driver is deprecated and may not be present in +.Fx 16.0 +and later. .Sh DESCRIPTION .Ss Device Usage This driver provides access to floppy disk drives. Floppy disks using either FM (single-density) or MFM (double or high-density) recording can be handled. .Pp Floppy disk controllers can connect up to four drives each. The .Nm driver can currently handle up to two drives per controller (or four drives on ACPI). Upon driver initialization, an attempt is made to find out the type of the floppy controller in use. The known controller types are either the original NE765 or i8272 chips, or alternatively .Em enhanced controllers that are compatible with the NE72065 or i82077 chips. These enhanced controllers (among other enhancements) implement a FIFO for floppy data transfers that will automatically be enabled once an enhanced chip has been detected. This FIFO activation can be disabled using the per-controller flags value of .Ar 0x1 . .Pp By default, this driver creates a single device node .Pa /dev/fd Ns Ar N for each attached drive with number .Ar N . For historical reasons, device nodes that use a trailing UFS-style partition letter (ranging from .Sq a through .Sq h ) can also be accessed, which will be implemented as symbolic links to the main device node. .Pp Accessing the main device node will attempt to autodetect the density of the available medium for multi-density devices. Thus it is possible to use either a 720 KB medium or a 1440 KB medium in a high-density 3.5 inch standard floppy drive. Normally, this autodetection will only happen once at the first call to .Xr open 2 for the device after inserting the medium. This assumes the drive offers proper changeline support so media changes can be detected by the driver. To indicate a drive that does not have the changeline support, this can be overridden using the per-drive device flags value of .Ar 0x10 (causing each call to .Xr open 2 to perform the autodetection). .Pp When trying to use a floppy device with special-density media, other device nodes can be created, of the form .Pa /dev/fd Ns Ar N . Ns Ar MMMM , where .Ar N is the drive number, and .Ar 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 how to assign these numbers. The two common policies are to either implement subdevices numbered 1 through 15, or to use a number that describes the medium density in kilobytes. Initially, each of those devices will be configured to the maximal density that is 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 .Xr fdcontrol 8 . .Pp Drive types are configured using the lower four bits of the per-drive device flags. The following values can be specified: .Bl -tag -width 2n -offset indent .It Ar 1 5.25 inch double-density device with 40 cylinders (360 KB native capacity) .It Ar 2 5.25 inch high-density device with 80 cylinders (1200 KB native capacity) .It Ar 3 3.5 inch double-density device with 80 cylinders (720 KB native capacity) .It Ar 4 3.5 inch high-density device with 80 cylinders (1440 KB native capacity) .It Ar 5 3.5 inch extra-density device with 80 cylinders (2880 KB native capacity, usage currently restricted to at most 1440 KB media) .It Ar 6 Same as type 5, available for compatibility with some BIOSes .El .Pp 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. .Pp 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 to be there so the driver autoconfiguration will work even if the drive is currently not present. For that purpose, a per-drive device flags value of .Ar 0x20 needs to be specified. .Ss Programming Interface In addition to the normal read and write functionality, the .Nm driver offers a number of configurable options using .Xr ioctl 2 . In order to access any of this functionality, programmers need to include the header file .In sys/fdcio.h into their programs. The call to .Xr open 2 can be performed in two possible ways. When opening the device without the .Dv 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 .Xr ioctl 2 commands. .Pp When opening the device with .Dv 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 .Xr 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. .Dv 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 .Dv FD_STYPE command (see below). Operations that are not allowed on the half-opened descriptor will cause an error value of .Er EAGAIN . .Pp The following .Xr ioctl 2 commands are currently available: .Bl -tag -width ".Dv FD_READID" .It Dv FD_FORM Used to format a floppy disk medium. Third argument is a pointer to a .Vt "struct fd_formb" specifying which track to format, and which parameters to fill into the ID fields of the floppy disk medium. .It Dv FD_GTYPE Returns the current density definition record for the selected device. Third argument is a pointer to .Vt "struct fd_type" . .It Dv FD_STYPE Adjusts the density definition of the selected device. Third argument is a pointer to .Vt "struct fd_type" . For the fixed-density subdevices (1 through 15 per drive), this operation is restricted to a process with superuser privileges. For the auto-selecting subdevice 0, 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 to open the device using .Dv O_NONBLOCK , and thus to later adjust the density using .Dv FD_STYPE ) . .It Dv FD_GOPTS Obtain the current drive options. Third argument is a pointer to .Vt int , containing a bitwise union of the following possible flag values: .Bl -tag -width ".Dv FDOPT_NOERRLOG" .It Dv FDOPT_NORETRY Do not automatically retry operations upon failure. .It Dv FDOPT_NOERRLOG Do not cause .Dq "hard error" kernel logs for failed I/O operations. .It Dv FDOPT_NOERROR Do not indicate I/O errors when returning from .Xr read 2 or .Xr write 2 system calls. The caller is assumed to use .Dv FD_GSTAT calls 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. .It Dv FDOPT_AUTOSEL Device performs automatic density selection. Unlike the above flags, this one is read-only. .El .It Dv FD_SOPTS Set device options, see above for their meaning. Third argument is a pointer to .Vt int . Drive options will always be cleared when closing the descriptor. .It Dv FD_CLRERR Clear the internal low-level error counter. Normally, controller-level I/O errors are only logged up to .Dv FDC_ERRMAX errors (currently defined to 100). This command resets the counter. Requires superuser privileges. .It Dv FD_READID Read one sector ID field from the floppy disk medium. Third argument is a pointer to .Vt "struct fdc_readid" , where the read data will be returned. Can be used to analyze a floppy disk medium. .It Dv FD_GSTAT Return the recent floppy disk controller status, if available. Third argument is a pointer to .Vt "struct fdc_status" , where the status registers (ST0, ST1, ST2, C, H, R, and N) are being returned. .Er EINVAL will be caused if no recent status is available. .It Dv FD_GDTYPE Returns the floppy disk drive type. Third argument is a pointer to .Vt "enum 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. .El .Sh SYSCTL VARIABLES .Bl -tag -width "debug.fdc.debugflags" .It Dv debug.fdc.debugflags Selectively enable debugging by setting one or more flags. .Bl -tag -width "0x40" .It Dv 0x01 Dump device registers on reset. .It Dv 0x02 When an IO operation completes, print the number of retries when that number is greater than zero. .It Dv 0x04 Print when the number of retries exceeds .Dv debug.fdc.retries .Pq Dv EIO . Print when the option .Dv FDOPT_NOERROR is set and an error would have returned from a write operation. .It Dv 0x08 Print detailed IO command information. .It Dv 0x10 Print status registers. .It Dv 0x20 Print detailed status registers when interrupts complete. Print the source code line number close to the source of a non-zero return from a thread worker operation. .It Dv 0x40 Print when the disk appears to be lost. Print cylinder, head, sector, and sector shift information after a request to read an ID field. Notify whether a disk probe resulted in finding a disk. When detecting the density of media present, indicate whether the autosensing was successful, and if so, the size of the medium in kilobytes. Print detailed type information when setting the drive type. .It Dv 0x80 Print when an unknown IOCTL is used. .El .It Dv debug.fdc.fifo For enhanced controllers, allows a non-default FIFO threshold setting. The default is 8 bytes. .It Dv debug.fdc.retries Maximum number of retries to attempt. The default is 10. .It Dv debug.fdc.spec1 Specification byte one (step-rate + head unload). The default step rate is 6 ms. The default head unload time is 240 ms. .It Dv debug.fdc.spec2 Specification byte two (head load time + no-dma). The default head load time is 16 ms, and no-dma is 0 .Pq disabled . .It Dv debug.fdc.settle Head settling time in .Sy settle / hz seconds. The default value is set during device attach. .El .Sh FILES .Bl -tag -width ".Pa /dev/fd*" -compact .It Pa /dev/fd* floppy disk device nodes .El .Sh SEE ALSO .Xr fdread 1 , .Xr fdwrite 1 , .Xr ioctl 2 , .Xr open 2 , .Xr read 2 , .Xr write 2 , .Xr fdcontrol 8 , .Xr fdformat 8 .Sh AUTHORS .An -nosplit This man page was initially written by .An Wilko Bulte , and later vastly rewritten by .An J\(:org Wunsch . diff --git a/usr.sbin/fdcontrol/fdcontrol.8 b/usr.sbin/fdcontrol/fdcontrol.8 index 23c3a2ee20de..cbf8864d5fe7 100644 --- a/usr.sbin/fdcontrol/fdcontrol.8 +++ b/usr.sbin/fdcontrol/fdcontrol.8 @@ -1,308 +1,313 @@ .\" Copyright (C) 1994, 2001 by Joerg Wunsch, Dresden .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT .\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE .\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH .\" DAMAGE. .\" -.Dd April 7, 2017 +.Dd November 16, 2025 .Dt FDCONTROL 8 .Os .Sh NAME .Nm fdcontrol .Nd display and modify floppy disk parameters .Sh SYNOPSIS .Nm .Op Fl F .Op Fl d Ar dbg .Op Fl f Ar fmt .Op Fl s Ar fmtstr .Op Fl v .Ar device +.Sh DEPRECATION NOTICE +.Nm +is deprecated and may not be present in +.Fx 16.0 +and later. .Sh DESCRIPTION The .Nm utility allows the modification of the run-time behavior of the .Xr fdc 4 driver for the device specified by .Ar device . .Pp Commands are implemented to query the current device density settings as well as the underlying device hardware as registered with the driver, to manipulate debugging levels, and to adjust the device density settings. All the operations that manipulate the kernel settings are restricted to the superuser (by the device driver), while all inquiry requests only require read access to .Ar device . .Pp The .Ar device argument should always be given as a full path name, e.g.\& .Pa /dev/fd0 . .Ss Inquiry Commands Running the .Nm utility without any of the optional flags will report the drive type that is registered with the device driver. In the shortest form, a single string describing the drive type will be returned. Possible values are: .Dq Li 360K , .Dq Li 1.2M , .Dq Li 720K , .Dq Li 1.44M , .Dq Li 2.88M , or .Dq Li unknown . This information is primarily intended to be easily parsable by scripts. .Pp In order to add some descriptive text that makes the output better human readable, the flag .Fl v can be added. .Pp Specifying flag .Fl F will report the device's density settings in a form that is suitable as input to the .Fl s Ar fmtstr option (see below). Again, together with .Fl v , some more text will be returned, including the total capacity of the density settings in kilobytes. .Ss Debug Control The .Xr fdc 4 control utilities support two different options how to specify device density settings. The first form uses .Fl f Ar fmt to specify the format of the medium in kilobytes. Depending on the underlying drive type, the value is compared against a table of known commonly used device density settings for that drive, and if a match is found, those settings will be used. Currently, the following values for the respective drive types are acceptable: .Bl -item .It 2.88M and 1.44M drives: .Bd -ragged -offset indent -compact .TS lB lB lB lB lB lB lB r l l l l l l. KB sectrac secsize ncyls speed heads flags 1721 21 2 (512) 82 500 2 MFM 1476 18 2 (512) 82 500 2 MFM 1440 18 2 (512) 80 500 2 MFM 1200 15 2 (512) 80 500 2 MFM 820 10 2 (512) 82 250 2 MFM 800 10 2 (512) 80 250 2 MFM 720 9 2 (512) 80 250 2 MFM .TE .Ed .It 1.2M drives: .Bd -ragged -offset indent -compact .TS lB lB lB lB lB lB lB r l l l l l l. KB sectrac secsize ncyls speed heads flags 1200 15 2 (512) 80 500 2 MFM 1232 8 3 (1024) 77 500 2 MFM 1476 18 2 (512) 82 500 2 MFM 1440 18 2 (512) 80 500 2 MFM 1200 15 2 (512) 80 500 2 MFM 820 10 2 (512) 82 300 2 MFM 800 10 2 (512) 80 300 2 MFM 720 9 2 (512) 80 300 2 MFM 360 9 2 (512) 40 300 2 MFM,2STEP 640 8 2 (512) 80 300 2 MFM .TE .Ed .It 720K drives: .Bd -ragged -offset indent -compact .TS lB lB lB lB lB lB lB r l l l l l l. KB sectrac secsize ncyls speed heads flags 720 9 2 (512) 80 250 2 MFM .TE .Ed .It 360K drives: .Bd -ragged -offset indent -compact .TS lB lB lB lB lB lB lB r l l l l l l. KB sectrac secsize ncyls speed heads flags 360 9 2 (512) 40 250 2 MFM .TE .Ed .El .Pp The second form to specify a device density uses .Fl s Ar fmtstr to explicitly specify each parameter in detail. The argument .Ar fmtstr is a comma-separated list of values of the form: .Pp .Sm off .Ar sectrac , secsize , datalen , gap , ncyls , speed , .Ar heads , f_gap , f_inter , offs2 , flags .Sm on .Pp The meaning of the parameters is: .Bl -tag -width ".Ar secsize" .It Ar sectrac The number of sectors per track. .It Ar secsize The sector size code, 0 = 128 bytes (or less), 1 = 256 bytes, 2 = 512 bytes, 3 = 1024 bytes. .It Ar datalen The actual sector size if the size code is 0, or the (ignored) value 0xFF for larger size codes. .It Ar gap The length of the gap 3 parameter for read/write operations. .It Ar ncyls The number of cylinders. .It Ar speed The transfer speed in kilobytes per second. Can be 250, 300, 500, or 1000, but each drive type only supports a subset of these values. .It Ar heads The number of heads. .It Ar f_gap The length of the gap 3 when formatting media. .It Ar f_inter The sector interleave to be applied when formatting. 0 means no interleave, 1 means 1:1 etc. .It Ar offs2 The offset of the sector numbers on side 2 (i.e., head number 1). Normally, sector numbering on both sides starts with 1. .It Ar flags A list from one of the following flag values: .Pp .Bl -tag -width ".Cm +perpend" -compact .It Cm +mfm Use MFM encoding. .It Cm -mfm Use FM (single-density) encoding. .It Cm +2step Use 2 steps per each cylinder (for accessing 40-cylinder media in 80-cylinder drives). .It Cm -2step Do not use 2 steps per cylinder, i.e., access each physical cylinder of the drive. .It Cm +perpend Use perpendicular recording (for 2.88 MB media, currently not supported). .It Cm -perpend Use longitudinal recording. .El .El .Pp For any missing parameter, the current value will be used, so only actual changes need to be specified. Thus to turn off a flag bit (like .Cm +mfm which is the default for all drive types), the form with a leading minus sign must explicitly be used. .Sh EXAMPLES A simple inquiry about the drive type: .Bd -literal -offset indent $ fdcontrol /dev/fd0 1.44M .Ed .Pp Same as above, but with verbose output. Note that the result is about the .Em "drive type" , as opposed to a .Em "device density" , so it is independent from the actual subdevice being used for .Ar device . .Bd -literal -offset indent $ fdcontrol -v /dev/fd0 /dev/fd0: 1.44M drive (3.5" high-density) .Ed .Pp Inquiry about the density settings: .Bd -literal -offset indent $ fdcontrol -F /dev/fd0 18,512,0xff,0x1b,80,500,2,0x6c,1,0,+mfm .Ed .Pp The verbose flag makes this human readable: .Bd -literal -offset indent /dev/fd0: 1440 KB media type Format: 18,512,0xff,0x1b,80,500,2,0x6c,1,0,+mfm Sector size: 512 Sectors/track: 18 Heads/cylinder: 2 Cylinders/disk: 80 Transfer rate: 500 kbps Sector gap: 27 Format gap: 108 Interleave: 1 Side offset: 0 Flags .Ed .Pp As indicated, trailing commas in the parameter list may be omitted. .Pp In order to access archaic 160 KB single-density (FM encoded) 5.25 media in a modern 1.2M drive, something like the following definition would be needed. (Note that not all controller hardware is actually capable of handling FM encoding at all.) .Bd -literal # fdcontrol -s 16,128,0x80,0x2,40,300,,0x10,,,-mfm,+2step /dev/fd1.1 .Ed .Pp It is still possible to hook up 8" drives to most modern floppy controllers, given the right cable magic. (On PC hardware, tell the BIOS that it is a 5.25" drive.) The classical 128/26/2/77 format can be read with this entry .Bd -literal -offset indent fdcontrol -s 26,128,0x80,0x2,77,500,2,0x10,,,-mfm /dev/fd0 .Ed .Sh SEE ALSO .Xr fdc 4 .Sh HISTORY The .Nm utility appeared in .Fx 2.0 , and was vastly overhauled in .Fx 5.0 . .Sh AUTHORS The program and this man page was contributed by .An J\(:org Wunsch , Dresden. diff --git a/usr.sbin/fdformat/fdformat.8 b/usr.sbin/fdformat/fdformat.8 index bf18f93f5e87..72ec2bd2be5c 100644 --- a/usr.sbin/fdformat/fdformat.8 +++ b/usr.sbin/fdformat/fdformat.8 @@ -1,203 +1,208 @@ .\" Copyright (C) 1993, 1994, 1995, 2001 by Joerg Wunsch, Dresden .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE .\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 23, 2020 +.Dd November 16, 2025 .Dt FDFORMAT 8 .Os .Sh NAME .Nm fdformat .Nd format floppy disks .Sh SYNOPSIS .Nm .Op Fl F Ar fill .Op Fl f Ar fmt .Op Fl s Ar fmtstr .Op Fl nqvy .Ar device +.Sh DEPRECATION NOTICE +.Nm +is deprecated and may not be present in +.Fx 16.0 +and later. .Sh DESCRIPTION The .Nm utility formats a floppy disk at .Ar device , where .Ar device may either be given as a full path name of a device node for a floppy disk drive (e.g.,\& .Pa /dev/fd0 ) , or using an abbreviated name that will be looked up under .Pa /dev (e.g.,\& .Dq Li fd0 ) . .Pp The options are as follows: .Bl -tag -width ".Fl s Ar fmtstr" .It Fl F Ar fill Use .Ar fill as the fill byte for newly formatted sectors. The .Ar fill argument must be a number in the range 0 through 255 using common C language notation. The default value is .Dq Li 0xf6 . .It Fl f Ar fmt Specify the density settings for a .Ar fmt kilobyte format, as described in .Xr fdcontrol 8 . .It Fl s Ar fmtstr Specify the density settings using explicit parameters, as described in .Xr fdcontrol 8 . .It Fl n Do not verify floppy after formatting. .It Fl q Suppress any normal output from the command, and do not ask the user for a confirmation whether to format the floppy disk at .Ar device . .It Fl v Do not format, verify only. .It Fl y Do not ask for confirmation whether to format the floppy disk but still report formatting status. .El .Pp For non-autoselecting subdevices, neither .Fl f Ar fmt nor .Fl s Ar fmtstr may be specified, since the preconfigured media density settings from the kernel driver will always be used. However, if .Ar device is a device with automatic media density selection (see .Xr fdc 4 ) , both methods can be used to override the density settings for the newly formatted medium (without permanently changing the density settings of .Ar device ) . .Pp If the .Fl q flag has not been specified, the user is asked for a confirmation of the intended formatting process. In order to continue, an answer of .Ql y must be given. .Pp Note that .Nm does only perform low-level formatting. In order to create a file system on the medium, see the commands .Xr newfs 8 for a .Tn UFS file system, or .Xr newfs_msdos 8 for an .Tn MS-DOS (FAT) file system. .Sh EXIT STATUS An exit status of 0 is returned upon successful operation. Exit status 1 is returned on any errors during floppy formatting, and an exit status of 2 reflects invalid arguments given to the program (along with an appropriate information written to diagnostic output). .Sh EXAMPLES To format a new double-sided, high-density (HD) 1.44 MB disk inserted in the first floppy disk drive, issue: .Pp .Dl "/usr/sbin/fdformat -f 1440 /dev/fd0" .Pp After low-level formatting the disk with .Nm , create a disk label so that the system can determine the size and geometry of the disk. The supported geometry values are listed in .Pa /etc/disktab , and we will use .Va fd1440 for this example. To write the disk label, use .Xr bsdlabel 8 : .Pp .Dl "/sbin/bsdlabel -B -w /dev/fd0 fd1440" .Pp The floppy is now ready to be high-level formatted with a file system. To format the floppy disk with FAT, issue: .Pp .Dl "/sbin/newfs_msdos /dev/fd0" .Sh DIAGNOSTICS Unless .Fl q has been specified, a single letter is printed to standard output to inform the user about the progress of work. First, an .Ql F is printed when the track is being formatted, then a .Ql V while it is being verified, and if an error has been detected, it will finally change to .Ql E . Detailed status information (cylinder, head and sector number, and the exact cause of the error) will be printed for up to 10 errors after the entire formatting process has completed. .Sh SEE ALSO .Xr fdc 4 , .Xr bsdlabel 8 , .Xr fdcontrol 8 , .Xr newfs 8 , .Xr newfs_msdos 8 .Sh HISTORY The .Nm utility has been developed for .Bx 386 0.1 and upgraded to the new .Xr fdc 4 floppy disk driver. It later became part of the .Fx 1.1 system. Starting with .Fx 5.0 , it uses the unified density specifications as described in .Xr fdcontrol 8 . .Sh AUTHORS .An -nosplit The program has been contributed by .An J\(:org Wunsch , Dresden, with changes by .An Serge Vakulenko and .An Andrey A. Chernov , Moscow. diff --git a/usr.sbin/fdread/fdread.1 b/usr.sbin/fdread/fdread.1 index c0036906bee6..83892877b48b 100644 --- a/usr.sbin/fdread/fdread.1 +++ b/usr.sbin/fdread/fdread.1 @@ -1,231 +1,236 @@ .\" .\" Copyright (c) 2001 Joerg Wunsch .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd May 14, 2001 +.Dd November 16, 2025 .Dt FDREAD 1 .Os .Sh NAME .Nm fdread .Nd read floppy disks .Sh SYNOPSIS .Nm .Op Fl qr .Op Fl d Ar device .Op Fl f Ar fillbyte .Op Fl o Ar file .Nm .Op Fl d Ar device .Fl I Ar numsects .Op Fl t Ar trackno +.Sh DEPRECATION NOTICE +.Nm +is deprecated and may not be present in +.Fx 16.0 +and later. .Sh DESCRIPTION The .Nm utility reads floppy disks. Effective read blocking based on the track size is performed, and floppy-specific error recovery of otherwise bad blocks can be enabled. .Pp The .Nm utility will always read an entire floppy medium, and write its contents to the respective output file. Unlike other tools like .Xr dd 1 , .Nm automatically uses a read block size that is more efficient than reading single blocks (usually one track of data at a time), but falls back to reading single floppy sectors in case of an input/output error occurred, in order to obtain as much valid data as possible. While .Nm is working, kernel error reporting for floppy errors is turned off, so the console and/or syslog are not flooded with kernel error messages. .Pp The .Nm utility accepts the following options: .Bl -tag -width indent .It Fl q Turn on quiet mode. By default, the medium parameters of the device are being written to standard error output, progress will be indicated by the approximate number of kilobytes read so far, and errors will be printed out in detail, including the information about the location of recovered data in the output. In quiet mode, none of these messages will be generated. .It Fl r Enable error recovery. By default, .Nm stops after the first unrecovered read error, much like .Xr dd 1 does. In recovery mode, however, one of two recovery actions will be taken: .Bl -bullet .It If the error was a CRC error in the data field, the kernel is told to ignore the error, and data are transferred to the output file anyway. .Bf -emphasis Note that this will cause the erroneous data to be included in the output file! .Ef Still, this is the best recovery action that can be taken at all. .It All other errors are really fatal (usually, the FDC did not find the sector ID fields), thus a dummy block with fill bytes will be included in the output file. .El .Pp Unless operating in quiet mode, the action taken and the location of the error in the output file will be displayed. .It Fl d Ar device Specify the input floppy device, defaulting to .Pa /dev/fd0 . The parameter .Ar device must be a valid floppy disk device. .It Fl f Ar fillbyte Value of the fill byte used for dummy blocks in the output file in recovery mode. Defaults to .Ql 0xf0 . (Mnemonic: .Dq foo . ) The value can be specified using the usual C language notation of the number base. .It Fl o Ar file Specify the output file to be .Ar file . By default, the data will be written to standard output. .It Fl I Ar numsects Read .Ar numsects sector ID fields, and write out their contents to standard output. Each sector ID field contains recorded values for the cylinder number .Pq Ql C , the head number .Pq Ql H , the record number (sector number starting with 1) .Pq Ql R , and the .Em sector shift value (0 = 128 bytes, 1 = 256 bytes, 2 = 512 bytes, 3 = 1024 bytes) .Pq Ql N . The .Fl I option is mutually exclusive with all other options except .Fl d Ar device and .Fl t Ar trackno . .It Fl t Ar trackno Specify the track number (cylinder number * number of heads + head number) to read the sector ID fields from; only allowed together with the .Fl I Ar numsects option. .El .Sh FILES .Bl -tag -width /dev/fd0 .It Pa /dev/fd0 Default device to read from. .El .Sh EXIT STATUS The .Nm utility sets the exit value according to .Xr sysexits 3 . In recovery mode, the exit value will be set to .Dv EX_IOERR if any error occurred during processing (even in quiet mode). .Sh DIAGNOSTICS Unless running in quiet mode, upon encountering an error, the status of the floppy disc controller (FDC) will be printed out, both in hexadecimal form, followed by a textual description that translates those values into a human-readable form for the most common error cases that can happen in a PC environment. .Pp The FDC error status includes the three FDC status registers .Ql ST0 , .Ql ST1 , and .Ql ST2 , as well as the location of the error (physical cylinder, head, and sector number, plus the .Dq sector shift value , respectively). See the manual for the NE765 or compatible for details about the status register contents. .Pp The FDC's status is then examined to determine whether the error is deemed to be recoverable. If error recovery was requested, the location of the bad block in the output file is indicated by its (hexadecimal) bounds. Also, a summary line indicating the total number of transfer errors will be printed before exiting. .Sh SEE ALSO .Xr dd 1 , .Xr fdwrite 1 , .Xr sysexits 3 , .Xr fdc 4 , .Xr fdcontrol 8 .Sh HISTORY The .Nm utility was written mainly to provide a means of recovering at least some of the data on bad media, and to obviate the need to invoke .Xr dd 1 with too many hard to memorize options that might be useful to handle a floppy. .Pp The command appeared in .Fx 5.0 . .Sh AUTHORS Program and man page by .An J\(:org Wunsch . .Sh BUGS Concurrent traffic on the second floppy drive located at the same FDC will make error recovery attempts pointless, since the FDC status obtained after a read error occurred cannot be guaranteed to actually belong to the erroneous transfer. Thus using option .Fl r is only reliable if .Ar device is the only active drive on that controller. .Pp No attempt beyond the floppy error retry mechanism of .Xr fdc 4 is made in order to see whether bad sectors could still be read without errors by trying multiple times. .Pp Bits that are (no longer) available on the floppy medium cannot be guessed by .Nm . diff --git a/usr.sbin/fdwrite/fdwrite.1 b/usr.sbin/fdwrite/fdwrite.1 index 9d188de02d83..4773cfa20d9a 100644 --- a/usr.sbin/fdwrite/fdwrite.1 +++ b/usr.sbin/fdwrite/fdwrite.1 @@ -1,127 +1,132 @@ .\" .\" ---------------------------------------------------------------------------- .\" "THE BEER-WARE LICENSE" (Revision 42): .\" wrote this file. As long as you retain this notice you .\" can do whatever you want with this stuff. If we meet some day, and you think .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp .\" ---------------------------------------------------------------------------- .\" .\" -.Dd September 16, 1993 +.Dd November 16, 2025 .Dt FDWRITE 1 .Os .Sh NAME .Nm fdwrite .Nd format and write floppy disks .Sh SYNOPSIS .Nm .Op Fl v .Op Fl y .Op Fl f Ar inputfile .Op Fl d Ar device +.Sh DEPRECATION NOTICE +.Nm +is deprecated and may not be present in +.Fx 16.0 +and later. .Sh DESCRIPTION The .Nm utility formats and writes one and more floppy disks. Any floppy disk device capable of formatting can be used. .Pp The .Nm utility will ask the user (on .Pa /dev/tty ) to insert a new floppy and press return. The device will then be opened, and queried for its parameters, then each track will be formatted, written with data from the .Ar inputfile , read back and compared. When the floppy disk is filled, the process is repeated, with the next disk. This continues until the program is interrupted or EOF is encountered on the .Ar inputfile . .Pp The options are as follows: .Bl -tag -width 10n -offset indent .It Fl v Toggle verbosity on stdout. Default is ``on''. After .Ar device is opened first time the format will be printed. During operation progress will be reported with the number of tracks remaining on the current floppy disk, and the letters I, Z, F, W, R and C, which indicates completion of Input, Zero-fill, Format Write, Read and Compare of current track respectively. .It Fl y Do not ask for presence of a floppy disk in the drive. This non-interactive flag is useful for shell scripts. .It Fl f Ar inputfile Input file to read. If none is given, stdin is assumed. .It Fl d Ar device The name of the floppy device to write to. Default is .Pa /dev/fd0 . .El .Pp The .Nm utility actually closes the .Ar device while it waits for the user to press return, it is thus quite possible to use the drive for other purposes at this time and later resume writing with the next floppy. .Pp The parameters returned from .Ar device are used for formatting. If custom formatting is needed, please use .Xr fdformat 8 instead. .Sh EXAMPLES The .Nm utility was planned as a tool to make life easier when writing a set of floppies, one such use could be to write a tar-archive: .Pp .Dl tar cf - . | gzip -9 | fdwrite -d /dev/fd0.1720 -v .Pp The main difference from using .Xr tar 1 Ns 's multivolume facility is of course the formatting of the floppies, which here is done on the fly, thus reducing the amount of work for the floppy-jockey. .Sh SEE ALSO .Xr fdformat 8 .Sh HISTORY The .Nm utility was written while waiting for ``make world'' to complete. Some of the code was taken from .Xr fdformat 8 . .Sh AUTHORS The program has been contributed by .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . .Sh BUGS Diagnostics are less than complete at present. .Pp If a floppy is sick, and the .Ar inputfile is seekable, it should ask the user to frisbee the disk, insert another, and rewind to the right spot and continue. .Pp This concept could be extended to cover non-seekable input also by employing a temporary file. .Pp An option (defaulting to zero) should allow the user to ask for retries in case of failure. .Pp At present a suitable tool for reading back a multivolume set of floppies is missing. Programs like .Xr tar 1 for instance, will do the job, if the data has not been compressed. One can always trust .Xr dd 1 to help out in this situation of course.