xref: /freebsd/usr.sbin/fdcontrol/fdcontrol.8 (revision 38a029c121ed338f0be98434b62855c6c2c58dca)
1.\"
2.\" Copyright (C) 1994, 2001 by Joerg Wunsch, Dresden
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY
15.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
20.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
24.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25.\" DAMAGE.
26.\"
27.\" $FreeBSD$
28.\"
29.Dd December 25, 2001
30.Os
31.Dt FDCONTROL 8
32.Sh NAME
33.Nm fdcontrol
34.Nd display and modify floppy disk parameters
35.Sh SYNOPSIS
36.Nm
37.Op Fl F
38.Op Fl d Ar dbg
39.Op Fl f Ar fmt
40.Op Fl s Ar fmtstr
41.Op Fl v
42.Ar device
43.Sh DESCRIPTION
44The
45.Nm
46utility allows the modification of the run-time behavior of the
47.Xr fdc 4
48driver for the device specified by
49.Ar device .
50.Pp
51Commands are implemented to query the current device density settings
52as well as the underlying device hardware as registered with the
53driver, to manipulate debugging levels, and to adjust the device
54density settings.
55All the operations that manipulate the kernel
56settings are restricted to the superuser (by the device driver), while
57all inquiry requests only require read access to
58.Ar device .
59.Pp
60The
61.Ar device
62argument should always be given as a full path name, e.g.\&
63.Pa /dev/fd0 .
64.Ss Inquiry Commands
65Running the
66.Nm
67utility without any of the optional flags will report the drive type
68that is registered with the device driver.
69In the shortest form, a single string describing the drive type will
70be returned.
71Possible values are:
72.Dq Li 360K ,
73.Dq Li 1.2M ,
74.Dq Li 720K ,
75.Dq Li 1.44M ,
76.Dq Li 2.88M ,
77or
78.Dq Li unknown .
79This information is primarily intended to be easily parsable by
80scripts.
81.Pp
82In order to add some descriptive text that makes the output better
83human readable, the flag
84.Fl v
85can be added.
86.Pp
87Specifying flag
88.Fl F
89will report the device's density settings in a form that is suitable
90as input to the
91.Fl s Ar fmtstr
92option (see below).
93Again, together with
94.Fl v ,
95some more text will be returned, including the total capacity of the
96density settings in kilobytes.
97.Ss Debug Control
98If the
99.Xr fdc 4
100driver was configured with the
101.Dv FDC_DEBUG
102option, by default, device debugging information is still disabled
103since it could produce huge amounts of kernel messages.
104It needs to
105be turned on using
106.Nm
107together with
108.Dq Fl d Li 1 ,
109usually immediately before starting an operation on the respective
110device the debug information is wanted for, and later turned off again
111using
112.Dq Fl d Li 0 .
113Note that debugging levels are a driver's global option that will
114affect any drives and controllers using the
115.Xr fdc 4
116driver, regardless which
117.Ar device
118was specified on the
119.Nm
120command line.
121.Ss Density Control
122The
123.Xr fdc 4
124control utilities support two different options how to specify device
125density settings.
126The first form uses
127.Fl f Ar fmt
128to specify the format of the medium in kilobytes.
129Depending on the
130underlying drive type, the value is compared against a table of known
131commonly used device density settings for that drive, and if a match
132is found, those settings will be used.
133Currently, the following
134values for the respective drive types are acceptable:
135.Bl -item
136.It
1372.88M and 1.44M drives:
138.Bd -ragged -offset indent -compact
139.TS
140lB lB lB lB lB lB lB
141r l l l l l l.
142KB	sectrac	secsize	ncyls	speed	heads	flags
1431721	21	2 (512)	82	500	2	MFM
1441476	18	2 (512)	82	500	2	MFM
1451440	18	2 (512)	80	500	2	MFM
1461200	15	2 (512)	80	500	2	MFM
147820	10	2 (512)	82	250	2	MFM
148800	10	2 (512)	80	250	2	MFM
149720	9	2 (512)	80	250	2	MFM
150.TE
151.Ed
152.It
1531.2M drives:
154.Bd -ragged -offset indent -compact
155.TS
156lB lB lB lB lB lB lB
157r l l l l l l.
158KB	sectrac	secsize	ncyls	speed	heads	flags
1591200	15	2 (512)	80	500	2	MFM
1601232	8	3 (1024)	77	500	2	MFM
1611476	18	2 (512)	82	500	2	MFM
1621440	18	2 (512)	80	500	2	MFM
1631200	15	2 (512)	80	500	2	MFM
164820	10	2 (512)	82	300	2	MFM
165800	10	2 (512)	80	300	2	MFM
166720	9	2 (512)	80	300	2	MFM
167360	9	2 (512)	40	300	2	MFM,2STEP
168640	8	2 (512)	80	300	2	MFM
169.TE
170.Ed
171.It
172720K drives:
173.Bd -ragged -offset indent -compact
174.TS
175lB lB lB lB lB lB lB
176r l l l l l l.
177KB	sectrac	secsize	ncyls	speed	heads	flags
178720	9	2 (512)	80	250	2	MFM
179.TE
180.Ed
181.It
182360K drives:
183.Bd -ragged -offset indent -compact
184.TS
185lB lB lB lB lB lB lB
186r l l l l l l.
187KB	sectrac	secsize	ncyls	speed	heads	flags
188360	9	2 (512)	40	250	2	MFM
189.TE
190.Ed
191.El
192.Pp
193The second form to specify a device density uses
194.Fl s Ar fmtstr
195to explicitly specify each parameter in detail.
196The argument
197.Ar fmtstr
198is a comma-separated list of values of the form:
199.Pp
200.Sm off
201.Ar sectrac , secsize , datalen , gap , ncyls , speed ,
202.Ar heads , f_gap , f_inter , offs2 , flags
203.Sm on
204.Pp
205The meaning of the parameters is:
206.Bl -tag -width ".Ar secsize"
207.It Ar sectrac
208The number of sectors per track.
209.It Ar secsize
210The sector size code, 0 = 128 bytes (or less), 1 = 256 bytes, 2 = 512
211bytes, 3 = 1024 bytes.
212.It Ar datalen
213The actual sector size if the size code is 0, or the (ignored) value
2140xFF for larger size codes.
215.It Ar gap
216The length of the gap 3 parameter for read/write operations.
217.It Ar ncyls
218The number of cylinders.
219.It Ar speed
220The transfer speed in kilobytes per second.
221Can be 250, 300, 500, or
2221000, but each drive type only supports a subset of these values.
223.It Ar heads
224The number of heads.
225.It Ar f_gap
226The length of the gap 3 when formatting media.
227.It Ar f_inter
228The sector interleave to be applied when formatting.
2290 means no
230interleave, 1 means 1:1 etc.
231.It Ar offs2
232The offset of the sector numbers on side 2 (i.e. head number 1).
233Normally, sector numbering on both sides starts with 1.
234.It Ar flags
235A list from one of the following flag values:
236.Pp
237.Bl -tag -width ".Cm +perpend" -compact
238.It Cm +mfm
239Use MFM encoding.
240.It Cm -mfm
241Use FM (single-density) encoding.
242.It Cm +2step
243Use 2 steps per each cylinder (for accessing 40-cylinder media in
24480-cylinder drives).
245.It Cm -2step
246Do not use 2 steps per cylinder, i.e. access each physical cylinder
247of the drive.
248.It Cm +perpend
249Use perpendicular recording (for 2.88 MB media, currently not
250supported).
251.It Cm -perpend
252Use longitudinal recording.
253.El
254.El
255.Pp
256For any missing parameter, the current value will be used, so only
257actual changes need to be specified.
258Thus to turn off a flag bit
259(like
260.Cm +mfm
261which is the default for all drive types), the form with a leading
262minus sign must explicitly be used.
263.Sh EXAMPLES
264A simple inquiry about the drive type:
265.Bd -literal
266$ fdcontrol /dev/fd0
2671.44M
268.Ed
269.Pp
270Same as above, but with verbose output.
271Note that the result is about
272the
273.Em "drive type" ,
274as opposed to a
275.Em "device density" ,
276so it is independent from the actual subdevice being used for
277.Ar device .
278.Bd -literal
279$ fdcontrol -v /dev/fd1.360
280/dev/fd1.360: 1.2M drive (5.25" high-density)
281.Ed
282.\" " <- this one is for Emacs :)
283.Pp
284Inquiry about the density settings of a particular subdevice.
285.Bd -literal
286$ fdcontrol -F /dev/fd0.720
28718,512,0xff,0x1b,80,500,2,0x6c,1,0,+mfm
288.Ed
289.Pp
290Note that just accessing a new subdevice for the first time will clone
291this device using the default density settings for the drive type, as
292explained in
293.Xr fdc 4 .
294Thus, albeit the device name in the example above suggests a 720 KB
295media density, it has actually been initialized (by the driver) to
2961440 KB.
297So, in order to adjust it for standard 720 KB double-density
298media, one of the following
299.Nm
300commands needs to be run:
301.Bd -literal
302# fdcontrol -s 9,,,0x20,,250,,0x50 /dev/fd0.720
303# fdcontrol -f 720 /dev/fd0.720
304.Ed
305.Pp
306As indicated, trailing commas in the parameter list may be omitted.
307.Pp
308In order to access archaic 160 KB single-density (FM encoded) 5.25
309media in a modern 1.2M drive, something like the following definition
310would be needed.
311(Note that not all controller hardware is actually
312capable of handling FM encoding at all.)
313.Bd -literal
314# fdcontrol -s 16,128,0x80,0x2,40,300,,0x10,,,-mfm,+2step /dev/fd1.1
315.Ed
316.Sh SEE ALSO
317.Xr fdc 4
318.Sh HISTORY
319The
320.Nm
321utility appeared in
322.Fx 2.0 ,
323and was vastly overhauled in
324.Fx 5.0 .
325.Sh AUTHORS
326The program and this man page was contributed by
327.An J\(:org Wunsch ,
328Dresden.
329