FD(4) —
NAME
fd − diskette interface
SYNOPSIS
For the IBM RT PC:
controller fdc0 at iocc0 csr 0xf00003f2 priority 6
device fd0 at fdc0 drive 0
For the IBM 6152 Academic System:
controller fdc0 at iocc0 csr 0x000003f2 priority 6
device fd0 at fdc0 drive 0
device fd1 at fdc0 drive 1
DESCRIPTION
On the IBM RT PC, the fd device provides access to an IBM-PC/AT 1.2M diskette drive or an IBM-PC/AT 360k diskette drive through the diskette function of the IBM Personal Computer AT Fixed Disk and Diskette Adapter, the ESDI adapter, or the E-ESDI adapter. The disk drive uses 5.25-inch, double-sided, soft-sectored, and either double-density or high-capacity diskettes.
On the IBM 6152 Academic System, the fd device provides access to an System/2 1.4m diskette drive. The disk drive uses 3.5 inch, low or high density diskettes.
System/2 diskettes contain 80 cylinders with 2 tracks (heads) per cylinder. High density diskettes contain 18 sectors per track (2880 total sectors) and low density diskettes contain 9 sectors per track (1440 total sectors). The sector size is 512 bytes for both diskette types.
Standard PC-DOS diskettes (360k) contain 40x2 tracks, each with 9 sectors (for a total of 720 sectors). PC/AT high-capacity diskettes (1.2M) contain 80x2 tracks, each with 15 sectors (for a total of 2400 sectors). The sector size is 512 bytes for both diskette types.
When the device is opened, the density of the diskette currently in the drive is automatically determined. If there is no diskette in the drive, open will fail.
Raw I/O requests must start on a sector boundary, involve an integral number of complete sectors, and not go off the end of the diskette.
NOTES
Even though the storage capacity of diskettes is small, it is possible to make filesystems on them. For example, the command
% newfs /dev/fd0
makes a filesystem on fd0. (Using tar(1) instead of newfs(8) gives a more efficient utilization of the available space for file storage.)
A few ioctl(2) calls apply to the fd devices, and have the form
#include <machineio/fdio.h>
ioctl(fildes, code, arg)
int ∗arg;
The applicable codes are:
FDIOC_FORMATFormat the diskette at the density specified by the arg argument (0=360k or 1=1.2M on the IBM RT PC, 0=720K or 1=1.4M on the IBM 6152 Academic System).
FDIOC_GETDENS
Return the density of the diskette (0=360k or 1=1.2M on the IBM RT PC, 0=720K or 1=1.4M on the IBM 6152 Academic System).
FDIOC_RESETReset the adapter.
You can open a drive for formatting using the flag FDO_FORMAT. If this flag is set, and the diskette in the drive has not been formatted, the open will successfully complete, but no other operations (except close and ioctl) may be performed.
There are older PC-DOS diskette formats that are not supported by fd(4).
ERRORS
The following errors may be returned by the driver:
[ENXIO] Nonexistent drive (on open); offset is too large or not on a sector boundary or byte count is not a multiple of the sector size (on read or write); bad (undefined) ioctl code. Drive not ready; usually because no diskette is in the drive or the drive door is open.
[EIO] A physical error other than “not ready”, probably bad media or unknown format.
[EBUSY] Drive is being used to format a diskette (on open); drive is in use by someone else (on format ioctl).
[EBADF]No write access (on format), or wrong density; the latter can happen only if the diskette is changed without closing the device (i.e. calling close(2)).
FILES
/dev/fd[01]
/dev/rfd[01]
SEE ALSO
tar(1), fdformat(8R), flcopy(8R), mkfs(8), newfs(8)
DIAGNOSTICS
For the IBM RT PC:
fd%d: hard error, trk=%d, sec=%d, Sr0=0x%b, Sr1=0x%b, Sr2=0x%b, Sr3=0x%b, Cyl=%d, Sec=%d, Head=%d, St=%d, state=%s. An unrecoverable error was encountered. The track and physical sector numbers, the device registers and the extended error status are displayed.
fd%d: state %d (reset). The driver entered an invalid state.
fd%d: timeout. Lost interrupt.
fd%d: write protected. The driver detected a drive containing a write-protected diskette. (On open only.)
fd%d: door open or hardware fault. Autodensity failed because the drive failed to interrupt. (On open only.)
fd%d: bad or unformatted diskette. Autodensity could not read the diskette. (On open only.)
For the IBM 6152 Academic System:
fd%d: hard error, BIOS error=0x%b, trk=%d, Sec=%d, Head=%d, state=%s. An unrecoverable error was encountered. The System/2 BIOS error code, track, sector, head and state are displayed.
fd%d: state %d (reset). The driver entered an invalid state.
fd%d: timeout. Lost interrupt.
fd%d: write protected. The driver detected a drive containing a write-protected diskette. (On open only.)
fd%d: door open or hardware fault. Autodensity failed due to an unrecoverable error. (On open only.)
fd%d: pc timeout. The device driver timed out waiting for the PC to accept a command.
BUGS
Diskettes written at 360k on a 1.2M drive are not guaranteed readable by a 360k drive on an IBM PC, PC/XT or PC/AT; they are readable by the 1.2M drive on a PC/AT.
PRPQs 5799-WZQ/5799-PFF: IBM/4.3 — Dec 1987