xref: /illumos-gate/usr/src/uts/common/sys/fdmedia.h (revision 2d6eb4a5)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1995 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_FDMEDIA_H
28 #define	_SYS_FDMEDIA_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Default names for label
36  */
37 static char deflabel_35[] = {
38 	"3.5\" floppy cyl %d alt 0 hd %d sec %d"
39 };
40 static char deflabel_525[] = {
41 	"5.25\" floppy cyl %d alt 0 hd %d sec %d"
42 };
43 
44 /*
45  * default characteristics
46  */
47 static struct fdattr fdtypes[] = {
48 	{	/* [0] = struct fdattr fdattr_5H */
49 		360,		/* rotational speed */
50 		1,		/* interleave factor */
51 		0x1B,		/* gap 3 length */
52 		0x54		/* format gap 3 length */
53 	},
54 	{	/* [1] = struct fdattr fdattr_5Q */
55 		300,		/* rotational speed */
56 		1,		/* interleave factor */
57 		0x1B,		/* gap 3 length */
58 		0x54		/* format gap 3 length */
59 	},
60 	{	/* [2] = struct fdattr fdattr_5D9 */
61 		300,		/* rotational speed */
62 		1,		/* interleave factor */
63 		0x2A,		/* gap 3 length */
64 		0x50		/* format gap 3 length */
65 	},
66 	{	/* [3] = struct fdattr fdattr_5D8 */
67 		300,		/* rotational speed */
68 		1,		/* interleave factor */
69 		0x2A,		/* gap 3 length */
70 		0x50		/* format gap 3 length */
71 	},
72 	{	/* [4] = struct fdattr fdattr_5D4 */
73 		300,		/* rotational speed */
74 		1,		/* interleave factor */
75 		0x80,		/* gap 3 length */
76 		0xF0		/* format gap 3 length */
77 	},
78 	{	/* [5] = struct fdattr fdattr_5D16 */
79 		300,		/* rotational speed */
80 		1,		/* interleave factor */
81 		0x20,		/* gap 3 length */
82 		0x32		/* format gap 3 length */
83 	},
84 	{	/* [6] = struct fdattr fdattr_3E */
85 		300,		/* rotational speed */
86 		1,		/* interleave factor */
87 		0x1B,		/* gap 3 length */
88 		0x53		/* format gap 3 length */
89 	},
90 	{	/* [7] = struct fdattr fdattr_3H */
91 		300,		/* rotational speed */
92 		1,		/* interleave factor */
93 		0x1B,		/* gap 3 length */
94 		0x6C		/* format gap 3 length */
95 	},
96 	{	/* [8] = struct fdattr fdattr_3I */
97 		300,		/* rotational speed */
98 		1,		/* interleave factor */
99 		4,		/* gap 3 length */
100 		12		/* format gap 3 length */
101 	},
102 	{	/* [9] = struct fdattr fdattr_3M */
103 		360,		/* rotational speed */
104 		1,		/* interleave factor */
105 		0x35,		/* gap 3 length */
106 		0x74		/* format gap 3 length */
107 	},
108 	{	/* [10] = struct fdattr fdattr_3D */
109 		300,		/* rotational speed */
110 		1,		/* interleave factor */
111 		0x1B,		/* gap 3 length */
112 		0x50		/* format gap 3 length */
113 	}
114 };
115 
116 static int nfdtypes = sizeof (fdtypes) / sizeof (fdtypes[0]);
117 
118 
119 static struct fd_char dfc_80x36 = {
120 		3,		/* medium */
121 		1000,		/* transfer rate */
122 		80,		/* number of cylinders */
123 		2,		/* number of heads */
124 		512,		/* sector size */
125 		36,		/* sectors per track */
126 		1,		/* # steps per data track */
127 };
128 static struct fd_char dfc_80x21 = {
129 		3,		/* medium */
130 		500,		/* transfer rate */
131 		80,		/* number of cylinders */
132 		2,		/* number of heads */
133 		512,		/* sector size */
134 		21,		/* sectors per track */
135 		1,		/* # steps per data track */
136 };
137 static struct fd_char dfc_80x18 = {
138 		3,		/* medium */
139 		500,		/* transfer rate */
140 		80,		/* number of cylinders */
141 		2,		/* number of heads */
142 		512,		/* sector size */
143 		18,		/* sectors per track */
144 		1,		/* # steps per data track */
145 };
146 static struct fd_char dfc_80x15 = {
147 		5,		/* medium */
148 		500,		/* transfer rate */
149 		80,		/* number of cylinders */
150 		2,		/* number of heads */
151 		512,		/* sector size */
152 		15,		/* sectors per track */
153 		1,		/* # steps per data track */
154 };
155 static struct fd_char dfc_80x9 = {
156 		3,		/* medium */
157 		250,		/* transfer rate */
158 		80,		/* number of cylinders */
159 		2,		/* number of heads */
160 		512,		/* sector size */
161 		9,		/* sectors per track */
162 		1,		/* # steps per data track */
163 };
164 static struct fd_char dfc_77x8 = {
165 		3,		/* medium */
166 		500,		/* transfer rate */
167 		77,		/* number of cylinders */
168 		2,		/* number of heads */
169 		1024,		/* sector size */
170 		8,		/* sectors per track */
171 		1,		/* # steps per data track */
172 };
173 static struct fd_char dfc_40x16 = {
174 		5,		/* medium */
175 		250,		/* transfer rate */
176 		40,		/* number of cylinders */
177 		2,		/* number of heads */
178 		256,		/* sector size */
179 		16,		/* sectors per track */
180 		1,		/* # steps per data track */
181 };
182 static struct fd_char dfc_40x9 = {
183 		5,		/* medium */
184 		250,		/* transfer rate */
185 		40,		/* number of cylinders */
186 		2,		/* number of heads */
187 		512,		/* sector size */
188 		9,		/* sectors per track */
189 		1,		/* # steps per data track */
190 };
191 static struct fd_char dfc_40x8 = {
192 		5,		/* medium */
193 		250,		/* transfer rate */
194 		40,		/* number of cylinders */
195 		2,		/* number of heads */
196 		512,		/* sector size */
197 		8,		/* sectors per track */
198 		1,		/* # steps per data track */
199 };
200 static struct fd_char dfc_40x4 = {
201 		5,		/* medium */
202 		250,		/* transfer rate */
203 		40,		/* number of cylinders */
204 		2,		/* number of heads */
205 		1024,		/* sector size */
206 		4,		/* sectors per track */
207 		1,		/* # steps per data track */
208 };
209 
210 static struct fd_char *defchar[] = {
211 		&dfc_80x15,	/* FMT_5H */
212 		&dfc_80x9,	/* FMT_5Q */
213 		&dfc_40x9,	/* FMT_5D9 */
214 		&dfc_40x8,	/* FMT_5D8 */
215 		&dfc_40x4,	/* FMT_5D4 */
216 		&dfc_40x16,	/* FMT_5D16 */
217 		&dfc_80x36,	/* FMT_3E */
218 		&dfc_80x18,	/* FMT_3H */
219 		&dfc_80x21,	/* FMT_3I */
220 		&dfc_77x8,	/* FMT_3M */
221 		&dfc_80x9	/* FMT_3D */
222 };
223 
224 
225 static struct fd_drive dfd_350ED = {
226 		0,	/* ejectable,  does the drive support eject? */
227 		4,	/* maxsearch, size of per-unit search table */
228 		0,	/* cyl to start write precompensation */
229 		80,	/* cyl to start reducing write current */
230 		1,	/* step width pulse in 1 us units */
231 		30,	/* step rate in 100 us units */
232 		150,	/* head settle delay, in 100 us units */
233 		150,	/* head load delay, in 100 us units */
234 		2560,	/* head unload delay, in 100 us units */
235 		3,	/* motor on delay, in 100 ms units */
236 		20,	/* motor off delay, in 100 ms units */
237 		65,	/* precomp level, bit shift, in nano-secs */
238 		0,	/* pins, defines meaning of pin 1, 2, 4, and 34 */
239 		0,	/* flags, TRUE READY, Starting Sector #, & Motor On */
240 };
241 static struct fd_drive dfd_350HD = {
242 		0,	/* ejectable,  does the drive support eject? */
243 		4,	/* maxsearch, size of per-unit search table */
244 		0,	/* cyl to start write prcompensation */
245 		80,	/* cyl to start reducing write current */
246 		1,	/* step width pulse in 1 us units */
247 		30,	/* step rate in 100 us units */
248 		150,	/* head settle delay, in 100 us units */
249 		150,	/* head load delay, in 100 us units */
250 		2560,	/* head unload delay, in 100 us units */
251 		3,	/* motor on delay, in 100 ms units */
252 		20,	/* motor off delay, in 100 ms units */
253 		125,	/* precomp level, bit shift, in nano-secs */
254 		0,	/* pins, defines meaning of pin 1, 2, 4, and 34 */
255 		0,	/* flags, TRUE READY, Starting Sector #, & Motor On */
256 };
257 static struct fd_drive dfd_525HD = {
258 		0,	/* ejectable,  does the drive support eject? */
259 		6,	/* maxsearch, size of per-unit search table */
260 		43,	/* cyl to start write prcompensation */
261 		80,	/* cyl to start reducing write current */
262 		1,	/* step width pulse in 1 us units */
263 		30,	/* step rate in 100 us units */
264 		150,	/* head settle delay, in 100 us units */
265 		150,	/* head load delay, in 100 us units */
266 		2560,	/* head unload delay, in 100 us units */
267 		5,	/* motor on delay, in 100 ms units */
268 		20,	/* motor off delay, in 100 ms units */
269 		175,	/* precomp level, bit shift, in nano-secs */
270 		0,	/* pins, defines meaning of pin 1, 2, 4, and 34 */
271 		0,	/* flags, TRUE READY, Starting Sector #, & Motor On */
272 };
273 static struct fd_drive dfd_525DD = {
274 		0,	/* ejectable,  does the drive support eject? */
275 		4,	/* maxsearch, size of per-unit search table */
276 		22,	/* cyl to start write prcompensation */
277 		40,	/* cyl to start reducing write current */
278 		1,	/* step width pulse in 1 us units */
279 		60,	/* step rate in 100 us units */
280 		150,	/* head settle delay, in 100 us units */
281 		150,	/* head load delay, in 100 us units */
282 		2560,	/* head unload delay, in 100 us units */
283 		5,	/* motor on delay, in 100 ms units */
284 		20,	/* motor off delay, in 100 ms units */
285 		250,	/* precomp level, bit shift, in nano-secs */
286 		0,	/* pins, defines meaning of pin 1, 2, 4, and 34 */
287 		0,	/* flags, TRUE READY, Starting Sector #, & Motor On */
288 };
289 
290 /*
291  * Default partition maps
292  */
293 static struct partition dpt_80x36[NDKMAP] = {
294 		{ 0, 0, 0,	79*2*36 },	/* part 0 - all but last cyl */
295 		{ 0, 0, 79*2*36, 1*2*36 },	/* part 1 - just the last cyl */
296 		{ 0, 0, 0,	80*2*36 },	/* part 2 - "the whole thing" */
297 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
298 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
299 };
300 static struct partition dpt_80x21[NDKMAP] = {
301 		{ 0, 0, 0,	79*2*21 },	/* part 0 - all but last cyl */
302 		{ 0, 0, 79*2*21, 1*2*21 },	/* part 1 - just the last cyl */
303 		{ 0, 0, 0,	80*2*21 },	/* part 2 - "the whole thing" */
304 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
305 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
306 };
307 static struct partition dpt_80x18[NDKMAP] = {
308 		{ 0, 0, 0,	79*2*18 },	/* part 0 - all but last cyl */
309 		{ 0, 0, 79*2*18, 1*2*18 },	/* part 1 - just the last cyl */
310 		{ 0, 0, 0,	80*2*18 },	/* part 2 - "the whole thing" */
311 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
312 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
313 };
314 static struct partition dpt_80x15[NDKMAP] = {
315 		{ 0, 0, 0,	79*2*15 },	/* part 0 - all but last cyl */
316 		{ 0, 0, 79*2*15, 1*2*15 },	/* part 1 - just the last cyl */
317 		{ 0, 0, 0,	80*2*15 },	/* part 2 - "the whole thing" */
318 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
319 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
320 };
321 static struct partition dpt_80x9[NDKMAP] = {
322 		{ 0, 0, 0,	79*2*9 },	/* part 0 - all but last cyl */
323 		{ 0, 0, 79*2*9,	 1*2*9 },	/* part 1 - just the last cyl */
324 		{ 0, 0, 0,	80*2*9 },	/* part 2 - "the whole thing" */
325 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
326 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
327 };
328 static struct partition dpt_77x8[NDKMAP] = {
329 		/* double number of blocks since sector size is 1024 */
330 		{ 0, 0, 0,	 76*2*8*2 },	/* part 0 - all but last cyl */
331 		{ 0, 0, 76*2*8*2, 1*2*8*2 },	/* part 1 - just the last cyl */
332 		{ 0, 0, 0,	 77*2*8*2 },	/* part 2 - "the whole thing" */
333 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
334 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
335 };
336 static struct partition dpt_40x16[NDKMAP] = {
337 		/* halve number of blocks since sector size is 256 */
338 		{ 0, 0, 0,	 39*2*16/2 },	/* part 0 - all but last cyl */
339 		{ 0, 0, 39*2*16/2, 1*2*16/2 },	/* part 1 - just the last cyl */
340 		{ 0, 0, 0,	 40*2*16/2 },	/* part 2 - "the whole thing" */
341 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
342 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
343 };
344 static struct partition dpt_40x9[NDKMAP] = {
345 		{ 0, 0, 0,	39*2*9 },	/* part 0 - all but last cyl */
346 		{ 0, 0, 39*2*9,  1*2*9 },	/* part 1 - just the last cyl */
347 		{ 0, 0, 0,	40*2*9 },	/* part 2 - "the whole thing" */
348 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
349 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
350 };
351 static struct partition dpt_40x8[NDKMAP] = {
352 		/* double number of blocks since sector size is 1024 */
353 		{ 0, 0, 0,	 39*2*8*2 },	/* part 0 - all but last cyl */
354 		{ 0, 0, 39*2*8*2, 1*2*8*2 },	/* part 1 - just the last cyl */
355 		{ 0, 0, 0,	 40*2*8*2 },	/* part 2 - "the whole thing" */
356 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
357 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
358 };
359 static struct partition dpt_40x4[NDKMAP] = {
360 		{ 0, 0, 0,	39*2*4 },	/* part 0 - all but last cyl */
361 		{ 0, 0, 39*2*4,  1*2*4 },	/* part 1 - just the last cyl */
362 		{ 0, 0, 0,	40*2*4 },	/* part 2 - "the whole thing" */
363 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
364 		{ 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }
365 };
366 
367 static struct partition *fdparts[] = {
368 		dpt_80x15,	/* FMT_5H */
369 		dpt_80x9,	/* FMT_5Q */
370 		dpt_40x9,	/* FMT_5D9 */
371 		dpt_40x8,	/* FMT_5D8 */
372 		dpt_40x4,	/* FMT_5D4 */
373 		dpt_40x16,	/* FMT_5D16 */
374 		dpt_80x36,	/* FMT_3E */
375 		dpt_80x18,	/* FMT_3H */
376 		dpt_80x21,	/* FMT_3I */
377 		dpt_77x8,	/* FMT_3M */
378 		dpt_80x9	/* FMT_3D */
379 };
380 
381 #ifdef	__cplusplus
382 }
383 #endif
384 
385 #endif	/* !_SYS_FDMEDIA_H */
386