Get generic kernels to be as forgiving of users with lossy hardware
[unix-history] / sys / i386 / include / ioctl_fd.h
CommitLineData
9629be3e 1/*
c021c298
AC
2 * Copyright (C) 1992-1993 by Joerg Wunsch, Dresden
3 * All rights reserved.
9629be3e 4 *
c021c298
AC
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.
9629be3e 13 *
c021c298
AC
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
9629be3e
AC
25 */
26
27#ifndef _IOCTL_FD_H
28#define _IOCTL_FD_H
29
30#include <sys/types.h>
31#include <sys/ioctl.h>
32
33#define FD_FORMAT_VERSION 110 /* used to validate before formatting */
34#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */
35 /* 2.88 MB drives */
36
37struct fd_formb {
38 int format_version; /* == FD_FORMAT_VERSION */
39 int cyl, head;
40 int transfer_rate; /* fdreg.h: FDC_???KBPS */
41
42 union {
43 struct fd_form_data {
44 /*
45 * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS
46 * it is hardware-dependant since it exactly
47 * matches the byte sequence to write to FDC
48 * during its `format track' operation
49 */
50 u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */
51 u_char nsecs; /* must be <= FD_MAX_NSEC */
52 u_char gaplen; /* GAP 3 length; usually 84 */
53 u_char fillbyte; /* usually 0xf6 */
54 struct fd_idfield_data {
55 /*
56 * data to write into id fields;
57 * for obscure formats, they mustn't match
58 * the real values (but mostly do)
59 */
60 u_char cylno; /* 0 thru 79 (or 39) */
61 u_char headno; /* 0, or 1 */
62 u_char secno; /* starting at 1! */
63 u_char secsize; /* usually 2 */
64 } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */
65 } structured;
66 u_char raw[1]; /* to have continuous indexed access */
67 } format_info;
68};
69
70/* make life easier */
71# define fd_formb_secshift format_info.structured.secshift
72# define fd_formb_nsecs format_info.structured.nsecs
73# define fd_formb_gaplen format_info.structured.gaplen
74# define fd_formb_fillbyte format_info.structured.fillbyte
75/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */
76# define fd_formb_cylno(i) format_info.structured.idfields[i].cylno
77# define fd_formb_headno(i) format_info.structured.idfields[i].headno
78# define fd_formb_secno(i) format_info.structured.idfields[i].secno
79# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize
80
81struct fd_type {
82 int sectrac; /* sectors per track */
83 int secsize; /* size code for sectors */
84 int datalen; /* data len when secsize = 0 */
85 int gap; /* gap len between sectors */
86 int tracks; /* total num of tracks */
87 int size; /* size of disk in sectors */
88 int steptrac; /* steps per cylinder */
89 int trans; /* transfer speed code */
90 int heads; /* number of heads */
7709c715
AC
91 int f_gap; /* format gap len */
92 int f_inter; /* format interleave factor */
9629be3e
AC
93};
94
95#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */
96#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */
97
98#endif /* !def _IOCTL_FD_H */