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