xref: /linux/include/uapi/linux/fd.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells #ifndef _UAPI_LINUX_FD_H
3607ca46eSDavid Howells #define _UAPI_LINUX_FD_H
4607ca46eSDavid Howells 
5607ca46eSDavid Howells #include <linux/ioctl.h>
6607ca46eSDavid Howells #include <linux/compiler.h>
7607ca46eSDavid Howells 
8607ca46eSDavid Howells /* New file layout: Now the ioctl definitions immediately follow the
9607ca46eSDavid Howells  * definitions of the structures that they use */
10607ca46eSDavid Howells 
11607ca46eSDavid Howells /*
12607ca46eSDavid Howells  * Geometry
13607ca46eSDavid Howells  */
14607ca46eSDavid Howells struct floppy_struct {
15607ca46eSDavid Howells 	unsigned int	size,		/* nr of sectors total */
16607ca46eSDavid Howells 			sect,		/* sectors per track */
17607ca46eSDavid Howells 			head,		/* nr of heads */
18607ca46eSDavid Howells 			track,		/* nr of tracks */
19607ca46eSDavid Howells 			stretch;	/* bit 0 !=0 means double track steps */
20607ca46eSDavid Howells 					/* bit 1 != 0 means swap sides */
21607ca46eSDavid Howells 					/* bits 2..9 give the first sector */
22607ca46eSDavid Howells 					/*  number (the LSB is flipped) */
23607ca46eSDavid Howells #define FD_STRETCH 1
24607ca46eSDavid Howells #define FD_SWAPSIDES 2
25607ca46eSDavid Howells #define FD_ZEROBASED 4
26607ca46eSDavid Howells #define FD_SECTBASEMASK 0x3FC
27607ca46eSDavid Howells #define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
28607ca46eSDavid Howells #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
29607ca46eSDavid Howells 
30607ca46eSDavid Howells 	unsigned char	gap,		/* gap1 size */
31607ca46eSDavid Howells 
32607ca46eSDavid Howells 			rate,		/* data rate. |= 0x40 for perpendicular */
33607ca46eSDavid Howells #define FD_2M 0x4
34607ca46eSDavid Howells #define FD_SIZECODEMASK 0x38
35607ca46eSDavid Howells #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8)
36607ca46eSDavid Howells #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \
37607ca46eSDavid Howells 			     512 : 128 << FD_SIZECODE(floppy) )
38607ca46eSDavid Howells #define FD_PERP 0x40
39607ca46eSDavid Howells 
40607ca46eSDavid Howells 			spec1,		/* stepping rate, head unload time */
41607ca46eSDavid Howells 			fmt_gap;	/* gap2 size */
42607ca46eSDavid Howells 	const char	* name; /* used only for predefined formats */
43607ca46eSDavid Howells };
44607ca46eSDavid Howells 
45607ca46eSDavid Howells 
46607ca46eSDavid Howells /* commands needing write access have 0x40 set */
47607ca46eSDavid Howells /* commands needing super user access have 0x80 set */
48607ca46eSDavid Howells 
49607ca46eSDavid Howells #define FDCLRPRM _IO(2, 0x41)
50607ca46eSDavid Howells /* clear user-defined parameters */
51607ca46eSDavid Howells 
52607ca46eSDavid Howells #define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
53607ca46eSDavid Howells #define FDSETMEDIAPRM FDSETPRM
54607ca46eSDavid Howells /* set user-defined parameters for current media */
55607ca46eSDavid Howells 
56607ca46eSDavid Howells #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct)
57607ca46eSDavid Howells #define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
58607ca46eSDavid Howells #define FDDEFMEDIAPRM FDDEFPRM
59607ca46eSDavid Howells #define FDGETMEDIAPRM FDGETPRM
60607ca46eSDavid Howells /* set/get disk parameters */
61607ca46eSDavid Howells 
62607ca46eSDavid Howells 
63607ca46eSDavid Howells #define	FDMSGON  _IO(2,0x45)
64607ca46eSDavid Howells #define	FDMSGOFF _IO(2,0x46)
65607ca46eSDavid Howells /* issue/don't issue kernel messages on media type change */
66607ca46eSDavid Howells 
67607ca46eSDavid Howells 
68607ca46eSDavid Howells /*
69607ca46eSDavid Howells  * Formatting (obsolete)
70607ca46eSDavid Howells  */
71607ca46eSDavid Howells #define FD_FILL_BYTE 0xF6 /* format fill byte. */
72607ca46eSDavid Howells 
73607ca46eSDavid Howells struct format_descr {
74607ca46eSDavid Howells 	unsigned int device,head,track;
75607ca46eSDavid Howells };
76607ca46eSDavid Howells 
77607ca46eSDavid Howells #define FDFMTBEG _IO(2,0x47)
78607ca46eSDavid Howells /* begin formatting a disk */
79607ca46eSDavid Howells #define	FDFMTTRK _IOW(2,0x48, struct format_descr)
80607ca46eSDavid Howells /* format the specified track */
81607ca46eSDavid Howells #define FDFMTEND _IO(2,0x49)
82607ca46eSDavid Howells /* end formatting a disk */
83607ca46eSDavid Howells 
84607ca46eSDavid Howells 
85607ca46eSDavid Howells /*
86607ca46eSDavid Howells  * Error thresholds
87607ca46eSDavid Howells  */
88607ca46eSDavid Howells struct floppy_max_errors {
89607ca46eSDavid Howells 	unsigned int
90607ca46eSDavid Howells 	  abort,      /* number of errors to be reached before aborting */
91607ca46eSDavid Howells 	  read_track, /* maximal number of errors permitted to read an
92607ca46eSDavid Howells 		       * entire track at once */
93607ca46eSDavid Howells 	  reset,      /* maximal number of errors before a reset is tried */
94607ca46eSDavid Howells 	  recal,      /* maximal number of errors before a recalibrate is
95607ca46eSDavid Howells 		       * tried */
96607ca46eSDavid Howells 
97607ca46eSDavid Howells 	  /*
98607ca46eSDavid Howells 	   * Threshold for reporting FDC errors to the console.
99607ca46eSDavid Howells 	   * Setting this to zero may flood your screen when using
100607ca46eSDavid Howells 	   * ultra cheap floppies ;-)
101607ca46eSDavid Howells 	   */
102607ca46eSDavid Howells 	  reporting;
103607ca46eSDavid Howells 
104607ca46eSDavid Howells };
105607ca46eSDavid Howells 
106607ca46eSDavid Howells #define FDSETEMSGTRESH	_IO(2,0x4a)
107607ca46eSDavid Howells /* set fdc error reporting threshold */
108607ca46eSDavid Howells 
109607ca46eSDavid Howells #define FDFLUSH  _IO(2,0x4b)
110607ca46eSDavid Howells /* flush buffers for media; either for verifying media, or for
111607ca46eSDavid Howells  * handling a media change without closing the file descriptor */
112607ca46eSDavid Howells 
113607ca46eSDavid Howells #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
114607ca46eSDavid Howells #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
115607ca46eSDavid Howells /* set/get abortion and read_track threshold. See also floppy_drive_params
116607ca46eSDavid Howells  * structure */
117607ca46eSDavid Howells 
118607ca46eSDavid Howells 
119607ca46eSDavid Howells typedef char floppy_drive_name[16];
120607ca46eSDavid Howells #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
121607ca46eSDavid Howells /* get drive type: 5 1/4 or 3 1/2 */
122607ca46eSDavid Howells 
123607ca46eSDavid Howells 
124607ca46eSDavid Howells /*
125607ca46eSDavid Howells  * Drive parameters (user modifiable)
126607ca46eSDavid Howells  */
127607ca46eSDavid Howells struct floppy_drive_params {
128607ca46eSDavid Howells 	signed char cmos;		/* CMOS type */
129607ca46eSDavid Howells 
130607ca46eSDavid Howells 	/* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms
131607ca46eSDavid Howells 	 * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA).
132607ca46eSDavid Howells 	 */
133607ca46eSDavid Howells 	unsigned long max_dtr;		/* Step rate, usec */
134607ca46eSDavid Howells 	unsigned long hlt;     		/* Head load/settle time, msec */
135607ca46eSDavid Howells 	unsigned long hut;     		/* Head unload time (remnant of
136607ca46eSDavid Howells 					 * 8" drives) */
137607ca46eSDavid Howells 	unsigned long srt;     		/* Step rate, usec */
138607ca46eSDavid Howells 
139607ca46eSDavid Howells 	unsigned long spinup;		/* time needed for spinup (expressed
140607ca46eSDavid Howells 					 * in jiffies) */
141607ca46eSDavid Howells 	unsigned long spindown;		/* timeout needed for spindown */
142607ca46eSDavid Howells 	unsigned char spindown_offset;	/* decides in which position the disk
143607ca46eSDavid Howells 					 * will stop */
144607ca46eSDavid Howells 	unsigned char select_delay;	/* delay to wait after select */
145607ca46eSDavid Howells 	unsigned char rps;		/* rotations per second */
146607ca46eSDavid Howells 	unsigned char tracks;		/* maximum number of tracks */
147607ca46eSDavid Howells 	unsigned long timeout;		/* timeout for interrupt requests */
148607ca46eSDavid Howells 
149607ca46eSDavid Howells 	unsigned char interleave_sect;	/* if there are more sectors, use
150607ca46eSDavid Howells 					 * interleave */
151607ca46eSDavid Howells 
152607ca46eSDavid Howells 	struct floppy_max_errors max_errors;
153607ca46eSDavid Howells 
154607ca46eSDavid Howells 	char flags;			/* various flags, including ftd_msg */
155607ca46eSDavid Howells /*
156607ca46eSDavid Howells  * Announce successful media type detection and media information loss after
157607ca46eSDavid Howells  * disk changes.
158607ca46eSDavid Howells  * Also used to enable/disable printing of overrun warnings.
159607ca46eSDavid Howells  */
160607ca46eSDavid Howells 
161607ca46eSDavid Howells #define FTD_MSG 0x10
162607ca46eSDavid Howells #define FD_BROKEN_DCL 0x20
163607ca46eSDavid Howells #define FD_DEBUG 0x02
164607ca46eSDavid Howells #define FD_SILENT_DCL_CLEAR 0x4
165607ca46eSDavid Howells #define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware
166607ca46eSDavid Howells 				considerations */
167607ca46eSDavid Howells 
168607ca46eSDavid Howells 	char read_track;		/* use readtrack during probing? */
169607ca46eSDavid Howells 
170607ca46eSDavid Howells /*
171607ca46eSDavid Howells  * Auto-detection. Each drive type has eight formats which are
172607ca46eSDavid Howells  * used in succession to try to read the disk. If the FDC cannot lock onto
173607ca46eSDavid Howells  * the disk, the next format is tried. This uses the variable 'probing'.
174607ca46eSDavid Howells  */
1759c4c5a24SDenis Efremov 
1769c4c5a24SDenis Efremov #define FD_AUTODETECT_SIZE 8
1779c4c5a24SDenis Efremov 
1789c4c5a24SDenis Efremov 	short autodetect[FD_AUTODETECT_SIZE]; /* autodetected formats */
179607ca46eSDavid Howells 
180607ca46eSDavid Howells 	int checkfreq; /* how often should the drive be checked for disk
181607ca46eSDavid Howells 			* changes */
182607ca46eSDavid Howells 	int native_format; /* native format of this drive */
183607ca46eSDavid Howells };
184607ca46eSDavid Howells 
185607ca46eSDavid Howells enum {
186607ca46eSDavid Howells 	FD_NEED_TWADDLE_BIT,	/* more magic */
187607ca46eSDavid Howells 	FD_VERIFY_BIT,		/* inquire for write protection */
188607ca46eSDavid Howells 	FD_DISK_NEWCHANGE_BIT,	/* change detected, and no action undertaken yet
189607ca46eSDavid Howells 				 * to clear media change status */
190607ca46eSDavid Howells 	FD_UNUSED_BIT,
191607ca46eSDavid Howells 	FD_DISK_CHANGED_BIT,	/* disk has been changed since last i/o */
1927b7b68bbSJiri Kosina 	FD_DISK_WRITABLE_BIT,	/* disk is writable */
1937b7b68bbSJiri Kosina 	FD_OPEN_SHOULD_FAIL_BIT
194607ca46eSDavid Howells };
195607ca46eSDavid Howells 
196607ca46eSDavid Howells #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
197607ca46eSDavid Howells #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
198607ca46eSDavid Howells /* set/get drive parameters */
199607ca46eSDavid Howells 
200607ca46eSDavid Howells 
201607ca46eSDavid Howells /*
202607ca46eSDavid Howells  * Current drive state (not directly modifiable by user, readonly)
203607ca46eSDavid Howells  */
204607ca46eSDavid Howells struct floppy_drive_struct {
205607ca46eSDavid Howells 	unsigned long flags;
206607ca46eSDavid Howells /* values for these flags */
207607ca46eSDavid Howells #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
208607ca46eSDavid Howells #define FD_VERIFY (1 << FD_VERIFY_BIT)
209607ca46eSDavid Howells #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
210607ca46eSDavid Howells #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
211607ca46eSDavid Howells #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
212607ca46eSDavid Howells 
213607ca46eSDavid Howells 	unsigned long spinup_date;
214607ca46eSDavid Howells 	unsigned long select_date;
215607ca46eSDavid Howells 	unsigned long first_read_date;
216607ca46eSDavid Howells 	short probed_format;
217607ca46eSDavid Howells 	short track; /* current track */
218607ca46eSDavid Howells 	short maxblock; /* id of highest block read */
219607ca46eSDavid Howells 	short maxtrack; /* id of highest half track read */
220607ca46eSDavid Howells 	int generation; /* how many diskchanges? */
221607ca46eSDavid Howells 
222607ca46eSDavid Howells /*
223607ca46eSDavid Howells  * (User-provided) media information is _not_ discarded after a media change
224607ca46eSDavid Howells  * if the corresponding keep_data flag is non-zero. Positive values are
225607ca46eSDavid Howells  * decremented after each probe.
226607ca46eSDavid Howells  */
227607ca46eSDavid Howells 	int keep_data;
228607ca46eSDavid Howells 
229607ca46eSDavid Howells 	/* Prevent "aliased" accesses. */
230607ca46eSDavid Howells 	int fd_ref;
231607ca46eSDavid Howells 	int fd_device;
232607ca46eSDavid Howells 	unsigned long last_checked; /* when was the drive last checked for a disk
233607ca46eSDavid Howells 			   * change? */
234607ca46eSDavid Howells 
235607ca46eSDavid Howells 	char *dmabuf;
236607ca46eSDavid Howells 	int bufblocks;
237607ca46eSDavid Howells };
238607ca46eSDavid Howells 
239607ca46eSDavid Howells #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
240607ca46eSDavid Howells #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
241607ca46eSDavid Howells /* get drive state: GET returns the cached state, POLL polls for new state */
242607ca46eSDavid Howells 
243607ca46eSDavid Howells 
244607ca46eSDavid Howells /*
245607ca46eSDavid Howells  * reset FDC
246607ca46eSDavid Howells  */
247607ca46eSDavid Howells enum reset_mode {
248607ca46eSDavid Howells 	FD_RESET_IF_NEEDED,	/* reset only if the reset flags is set */
249607ca46eSDavid Howells 	FD_RESET_IF_RAWCMD,	/* obsolete */
250607ca46eSDavid Howells 	FD_RESET_ALWAYS		/* reset always */
251607ca46eSDavid Howells };
252607ca46eSDavid Howells #define FDRESET _IO(2, 0x54)
253607ca46eSDavid Howells 
254607ca46eSDavid Howells 
255607ca46eSDavid Howells /*
256607ca46eSDavid Howells  * FDC state
257607ca46eSDavid Howells  */
258607ca46eSDavid Howells struct floppy_fdc_state {
259607ca46eSDavid Howells 	int spec1;		/* spec1 value last used */
260607ca46eSDavid Howells 	int spec2;		/* spec2 value last used */
261607ca46eSDavid Howells 	int dtr;
262607ca46eSDavid Howells 	unsigned char version;	/* FDC version code */
263607ca46eSDavid Howells 	unsigned char dor;
264607ca46eSDavid Howells 	unsigned long address;	/* io address */
265607ca46eSDavid Howells 	unsigned int rawcmd:2;
266607ca46eSDavid Howells 	unsigned int reset:1;
267607ca46eSDavid Howells 	unsigned int need_configure:1;
268607ca46eSDavid Howells 	unsigned int perp_mode:2;
269607ca46eSDavid Howells 	unsigned int has_fifo:1;
270607ca46eSDavid Howells 	unsigned int driver_version;	/* version code for floppy driver */
271607ca46eSDavid Howells #define FD_DRIVER_VERSION 0x100
272607ca46eSDavid Howells /* user programs using the floppy API should use floppy_fdc_state to
273607ca46eSDavid Howells  * get the version number of the floppy driver that they are running
274607ca46eSDavid Howells  * on. If this version number is bigger than the one compiled into the
275607ca46eSDavid Howells  * user program (the FD_DRIVER_VERSION define), it should be prepared
276607ca46eSDavid Howells  * to bigger structures
277607ca46eSDavid Howells  */
278607ca46eSDavid Howells 
279607ca46eSDavid Howells 	unsigned char track[4];
280607ca46eSDavid Howells 	/* Position of the heads of the 4 units attached to this FDC,
281607ca46eSDavid Howells 	 * as stored on the FDC. In the future, the position as stored
282607ca46eSDavid Howells 	 * on the FDC might not agree with the actual physical
283607ca46eSDavid Howells 	 * position of these drive heads. By allowing such
284607ca46eSDavid Howells 	 * disagreement, it will be possible to reset the FDC without
285607ca46eSDavid Howells 	 * incurring the expensive cost of repositioning all heads.
286607ca46eSDavid Howells 	 * Right now, these positions are hard wired to 0. */
287607ca46eSDavid Howells 
288607ca46eSDavid Howells };
289607ca46eSDavid Howells 
290607ca46eSDavid Howells #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
291607ca46eSDavid Howells 
292607ca46eSDavid Howells 
293607ca46eSDavid Howells /*
294607ca46eSDavid Howells  * Asynchronous Write error tracking
295607ca46eSDavid Howells  */
296607ca46eSDavid Howells struct floppy_write_errors {
297607ca46eSDavid Howells 	/* Write error logging.
298607ca46eSDavid Howells 	 *
299607ca46eSDavid Howells 	 * These fields can be cleared with the FDWERRORCLR ioctl.
300607ca46eSDavid Howells 	 * Only writes that were attempted but failed due to a physical media
301607ca46eSDavid Howells 	 * error are logged.  write(2) calls that fail and return an error code
302607ca46eSDavid Howells 	 * to the user process are not counted.
303607ca46eSDavid Howells 	 */
304607ca46eSDavid Howells 
305607ca46eSDavid Howells 	unsigned int write_errors;  /* number of physical write errors
306607ca46eSDavid Howells 				     * encountered */
307607ca46eSDavid Howells 
308607ca46eSDavid Howells 	/* position of first and last write errors */
309607ca46eSDavid Howells 	unsigned long first_error_sector;
310607ca46eSDavid Howells 	int           first_error_generation;
311607ca46eSDavid Howells 	unsigned long last_error_sector;
312607ca46eSDavid Howells 	int           last_error_generation;
313607ca46eSDavid Howells 
314607ca46eSDavid Howells 	unsigned int badness; /* highest retry count for a read or write
315607ca46eSDavid Howells 			       * operation */
316607ca46eSDavid Howells };
317607ca46eSDavid Howells 
318607ca46eSDavid Howells #define FDWERRORCLR  _IO(2, 0x56)
319607ca46eSDavid Howells /* clear write error and badness information */
320607ca46eSDavid Howells #define FDWERRORGET  _IOR(2, 0x17, struct floppy_write_errors)
321607ca46eSDavid Howells /* get write error and badness information */
322607ca46eSDavid Howells 
323607ca46eSDavid Howells 
324607ca46eSDavid Howells /*
325607ca46eSDavid Howells  * Raw commands
326607ca46eSDavid Howells  */
327607ca46eSDavid Howells /* new interface flag: now we can do them in batches */
328607ca46eSDavid Howells #define FDHAVEBATCHEDRAWCMD
329607ca46eSDavid Howells 
330607ca46eSDavid Howells struct floppy_raw_cmd {
331607ca46eSDavid Howells 	unsigned int flags;
332607ca46eSDavid Howells #define FD_RAW_READ 1
333607ca46eSDavid Howells #define FD_RAW_WRITE 2
334607ca46eSDavid Howells #define FD_RAW_NO_MOTOR 4
335607ca46eSDavid Howells #define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
336607ca46eSDavid Howells #define FD_RAW_INTR 8    /* wait for an interrupt */
337607ca46eSDavid Howells #define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
338607ca46eSDavid Howells #define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command
339607ca46eSDavid Howells 				    * completion */
340607ca46eSDavid Howells #define FD_RAW_NEED_DISK 0x40  /* this command needs a disk to be present */
341607ca46eSDavid Howells #define FD_RAW_NEED_SEEK 0x80  /* this command uses an implied seek (soft) */
342607ca46eSDavid Howells 
343607ca46eSDavid Howells /* more "in" flags */
344607ca46eSDavid Howells #define FD_RAW_MORE 0x100  /* more records follow */
345607ca46eSDavid Howells #define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */
346607ca46eSDavid Howells #define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */
347607ca46eSDavid Howells #define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure
348607ca46eSDavid Howells 				  * detection too */
349607ca46eSDavid Howells 
350607ca46eSDavid Howells /* more "out" flags */
351607ca46eSDavid Howells #define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */
352607ca46eSDavid Howells #define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */
353607ca46eSDavid Howells 
354607ca46eSDavid Howells 	void __user *data;
355607ca46eSDavid Howells 	char *kernel_data; /* location of data buffer in the kernel */
356607ca46eSDavid Howells 	struct floppy_raw_cmd *next; /* used for chaining of raw cmd's
357607ca46eSDavid Howells 				      * within the kernel */
358607ca46eSDavid Howells 	long length; /* in: length of dma transfer. out: remaining bytes */
359607ca46eSDavid Howells 	long phys_length; /* physical length, if different from dma length */
360607ca46eSDavid Howells 	int buffer_length; /* length of allocated buffer */
361607ca46eSDavid Howells 
362607ca46eSDavid Howells 	unsigned char rate;
363bd10a5f3SDenis Efremov 
364bd10a5f3SDenis Efremov #define FD_RAW_CMD_SIZE 16
365bd10a5f3SDenis Efremov #define FD_RAW_REPLY_SIZE 16
366bd10a5f3SDenis Efremov #define FD_RAW_CMD_FULLSIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_REPLY_SIZE)
367bd10a5f3SDenis Efremov 
368bd10a5f3SDenis Efremov 	/* The command may take up the space initially intended for the reply
369bd10a5f3SDenis Efremov 	 * and the reply count. Needed for long 82078 commands such as RESTORE,
370bd10a5f3SDenis Efremov 	 * which takes 17 command bytes.
371bd10a5f3SDenis Efremov 	 */
372bd10a5f3SDenis Efremov 
373607ca46eSDavid Howells 	unsigned char cmd_count;
374*0836275dSDenis Efremov 	union {
375*0836275dSDenis Efremov 		struct {
376bd10a5f3SDenis Efremov 			unsigned char cmd[FD_RAW_CMD_SIZE];
377607ca46eSDavid Howells 			unsigned char reply_count;
378bd10a5f3SDenis Efremov 			unsigned char reply[FD_RAW_REPLY_SIZE];
379*0836275dSDenis Efremov 		};
380*0836275dSDenis Efremov 		unsigned char fullcmd[FD_RAW_CMD_FULLSIZE];
381*0836275dSDenis Efremov 	};
382607ca46eSDavid Howells 	int track;
383607ca46eSDavid Howells 	int resultcode;
384607ca46eSDavid Howells 
385607ca46eSDavid Howells 	int reserved1;
386607ca46eSDavid Howells 	int reserved2;
387607ca46eSDavid Howells };
388607ca46eSDavid Howells 
389607ca46eSDavid Howells #define FDRAWCMD _IO(2, 0x58)
390607ca46eSDavid Howells /* send a raw command to the fdc. Structure size not included, because of
391607ca46eSDavid Howells  * batches */
392607ca46eSDavid Howells 
393607ca46eSDavid Howells #define FDTWADDLE _IO(2, 0x59)
394607ca46eSDavid Howells /* flicker motor-on bit before reading a sector. Experimental */
395607ca46eSDavid Howells 
396607ca46eSDavid Howells 
397607ca46eSDavid Howells #define FDEJECT _IO(2, 0x5a)
398607ca46eSDavid Howells /* eject the disk */
399607ca46eSDavid Howells 
400607ca46eSDavid Howells 
401607ca46eSDavid Howells 
402607ca46eSDavid Howells #endif /* _UAPI_LINUX_FD_H */
403