1 FDIO(7I) Ioctl Requests FDIO(7I)
2
3 NAME
4 fdio - floppy disk control operations
5
6 SYNOPSIS
7 #include <sys/fdio.h>
8
9 DESCRIPTION
10 The Solaris floppy driver supports a set of ioctl(2) requests for getting
11 and setting the floppy drive characteristics. Basic to these ioctl(2)
12 requests are the definitions in <sys/fdio.h>.
13
14 IOCTLS
15 The following ioctl(2) requests are available on the Solaris floppy
16 driver.
17
18 FDDEFGEOCHAR x86 based systems: This ioctl(2) forces the floppy driver
19 to restore the diskette and drive characteristics and
20 geometry, and partition information to default values based
21 on the device configuration.
22
23 FDGETCHANGE The argument is a pointer to an int. This ioctl(2) returns
24 the status of the diskette-changed signal from the floppy
25 interface. The following defines are provided for
26 cohesion.
27
28 Note: For x86 based systems, use FDGC_DETECTED (which is available only
29 on x86 based systems) instead of FDGC_HISTORY.
30
31 /*
32 * Used by FDGETCHANGE, returned state of the sense disk change bit.
33 */
34 #define FDGC_HISTORY 0x01 /*
35 * disk has changed since insertion or
36 * last FDGETCHANGE call
37 */
38 #define FDGC_CURRENT 0x02 /*
39 * if set, indicates drive has floppy,
40 * otherwise, drive is empty
41 */
42 #define FDGC_CURWPROT 0x10 /* current state of write protect */
43 #define FDGC_DETECTED 0x20 /* previous state of DISK CHANGE */
44
45 FDIOGCHAR The argument is a pointer to an fd_char structure (described
46 below). This ioctl(2) gets the characteristics of the floppy
47 diskette from the floppy controller.
48
49 FDIOSCHAR The argument is a pointer to an fd_char structure (described
50 below). This ioctl(2) sets the characteristics of the floppy
51 diskette for the floppy controller. Typical values in the
52 fd_char structure for a high density diskette:
53
54 Field Value
55 fdc_medium 0
56 fdc_transfer_rate 500
57 fdc_ncyl 80
58 fdc_nhead 2
59 fdc_sec_size 512
60 fdc_secptrack 18
61 fdc_steps -1 { This field doesn't apply. }
62
63 /*
64 * Floppy characteristics
65 */
66 struct fd_char {
67 uchar_t fdc_medium; /* equals 1 if floppy is medium density format */
68 int fdc_transfer_rate; /* transfer rate */
69 int fdc_ncyl; /* number of cylinders */
70 int fdc_nhead; /* number of heads */
71 int fdc_sec_size; /* sector size */
72 int fdc_secptrack; /* sectors per track */
73 int fdc_steps; /* no. of steps per data track */
74 };
75
76 FDGETDRIVECHAR The argument to this ioctl(2) is a pointer to an fd_drive
77 structure (described below). This ioctl(2) gets the
78 characteristics of the floppy drive from the floppy
79 controller.
80
81 FDSETDRIVECHAR x86 based systems: The argument to this ioctl(2) is a
82 pointer to an fd_drive structure (described below). This
83 ioctl(2) sets the characteristics of the floppy drive for
84 the floppy controller. Only fdd_steprate,
85 fdd_headsettle, fdd_motoron, and fdd_motoroff are
86 actually used by the floppy disk driver.
87
88 /*
89 * Floppy Drive characteristics
90 */
91 struct fd_drive {
92 int fdd_ejectable; /* does the drive support eject? */
93 int fdd_maxsearch; /* size of per-unit search table */
94 int fdd_writeprecomp; /* cyl to start write precompensation */
95 int fdd_writereduce; /* cyl to start recucing write current */
96 int fdd_stepwidth; /* width of step pulse in 1 us units */
97 int fdd_steprate; /* step rate in 100 us units */
98 int fdd_headsettle; /* delay, in 100 us units */
99 int fdd_headload; /* delay, in 100 us units */
100 int fdd_headunload; /* delay, in 100 us units */
101 int fdd_motoron; /* delay, in 100 ms units */
102 int fdd_motoroff; /* delay, in 100 ms units */
103 int fdd_precomplevel; /* bit shift, in nano-secs */
104 int fdd_pins; /* defines meaning of pin 1, 2, 4 and 34 */
105 int fdd_flags; /* TRUE READY, Starting Sector #, & Motor On */
106 };
107
108 FDGETSEARCH Not available.
109
110 FDSETSEARCH Not available.
111
112 FDEJECT SPARC: This ioctl(2) requests the floppy drive to eject the
113 diskette.
114
115 FDIOCMD The argument is a pointer to an fd_cmd structure (described
116 below). This ioctl(2) allows access to the floppy diskette
117 using the floppy device driver. Only the FDCMD_WRITE,
118 FDCMD_READ, and FDCMD_FORMAT_TRACK commands are currently
119 available.
120
121 struct fd_cmd {
122 ushort_t fdc_cmd; /* command to be executed */
123 int fdc_flags; /* execution flags (x86 only) */
124 daddr_t fdc_blkno; /* disk address for command */
125 int fdc_secnt; /* sector count for command */
126 caddr_t fdc_bufaddr; /* user's buffer address */
127 uint_t fdc_buflen; /* size of user's buffer */
128 };
129
130 Please note that the fdc_buflen field is currently unused. The fdc_secnt
131 field is used to calculate the transfer size, and the buffer is assumed
132 to be large enough to accommodate the transfer.
133
134 /*
135 * Floppy commands
136 */
137 #define FDCMD_WRITE 1
138 #define FDCMD_READ 2
139 #define FDCMD_SEEK 3
140 #define FDCMD_REZERO 4
141 #define FDCMD_FORMAT_UNIT 5
142 #define FDCMD_FORMAT_TRACK 6
143
144 FDRAW The argument is a pointer to an fd_raw structure (described
145 below). This ioctl(2) allows direct control of the floppy drive
146 using the floppy controller. Refer to the appropriate floppy-
147 controller data sheet for full details on required command bytes
148 and returned result bytes. The following commands are supported.
149
150 /*
151 * Floppy raw commands
152 */
153 #define FDRAW_SPECIFY 0x03
154 #define FDRAW_READID 0x0a (x86 only)
155 #define FDRAW_SENSE_DRV 0x04
156 #define FDRAW_REZERO 0x07
157 #define FDRAW_SEEK 0x0f
158 #define FDRAW_SENSE_INT 0x08 (x86 only)
159 #define FDRAW_FORMAT 0x0d
160 #define FDRAW_READTRACK 0x02
161 #define FDRAW_WRCMD 0x05
162 #define FDRAW_RDCMD 0x06
163 #define FDRAW_WRITEDEL 0x09
164 #define FDRAW_READDEL 0x0c
165
166 Please note that when using FDRAW_SEEK or FDRAW_REZERO, the driver
167 automatically issues a FDRAW_SENSE_INT command to clear the interrupt
168 from the FDRAW_SEEK or the FDRAW_REZERO. The result bytes returned by
169 these commands are the results from the DRAW_SENSE_INT command. Please
170 see the floppy-controller data sheet for more details on FDRAW_SENSE_INT.
171
172 /*
173 * Used by FDRAW
174 */
175 struct fd_raw {
176 char fdr_cmd[10]; /* user-supplied command bytes */
177 short fdr_cnum; /* number of command bytes */
178 char fdr_result[10]; /* controller-supplied result bytes */
179 ushort_t fdr_nbytes; /* number to transfer if read/write command */
180 char *fdr_addr; /* where to transfer if read/write command */
181 };
182
183 SEE ALSO
184 ioctl(2), fd(7D), dkio(7I), hdio(7I)
185
186 illumos October 22, 2017 illumos