xref: /openbmc/linux/include/linux/fd.h (revision 9e49184c)
11da177e4SLinus Torvalds #ifndef _LINUX_FD_H
21da177e4SLinus Torvalds #define _LINUX_FD_H
31da177e4SLinus Torvalds 
41da177e4SLinus Torvalds #include <linux/ioctl.h>
51da177e4SLinus Torvalds #include <linux/compiler.h>
61da177e4SLinus Torvalds 
71da177e4SLinus Torvalds /* New file layout: Now the ioctl definitions immediately follow the
81da177e4SLinus Torvalds  * definitions of the structures that they use */
91da177e4SLinus Torvalds 
101da177e4SLinus Torvalds /*
111da177e4SLinus Torvalds  * Geometry
121da177e4SLinus Torvalds  */
131da177e4SLinus Torvalds struct floppy_struct {
141da177e4SLinus Torvalds 	unsigned int	size,		/* nr of sectors total */
151da177e4SLinus Torvalds 			sect,		/* sectors per track */
161da177e4SLinus Torvalds 			head,		/* nr of heads */
171da177e4SLinus Torvalds 			track,		/* nr of tracks */
189e49184cSKeith Wansbrough 			stretch;	/* bit 0 !=0 means double track steps */
199e49184cSKeith Wansbrough 					/* bit 1 != 0 means swap sides */
209e49184cSKeith Wansbrough 					/* bits 2..9 give the first sector */
219e49184cSKeith Wansbrough 					/*  number (the LSB is flipped) */
221da177e4SLinus Torvalds #define FD_STRETCH 1
231da177e4SLinus Torvalds #define FD_SWAPSIDES 2
241da177e4SLinus Torvalds #define FD_ZEROBASED 4
259e49184cSKeith Wansbrough #define FD_SECTBASEMASK 0x3FC
269e49184cSKeith Wansbrough #define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
279e49184cSKeith Wansbrough #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
281da177e4SLinus Torvalds 
291da177e4SLinus Torvalds 	unsigned char	gap,		/* gap1 size */
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds 			rate,		/* data rate. |= 0x40 for perpendicular */
321da177e4SLinus Torvalds #define FD_2M 0x4
331da177e4SLinus Torvalds #define FD_SIZECODEMASK 0x38
341da177e4SLinus Torvalds #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8)
351da177e4SLinus Torvalds #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \
361da177e4SLinus Torvalds 			     512 : 128 << FD_SIZECODE(floppy) )
371da177e4SLinus Torvalds #define FD_PERP 0x40
381da177e4SLinus Torvalds 
391da177e4SLinus Torvalds 			spec1,		/* stepping rate, head unload time */
401da177e4SLinus Torvalds 			fmt_gap;	/* gap2 size */
411da177e4SLinus Torvalds 	const char	* name; /* used only for predefined formats */
421da177e4SLinus Torvalds };
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds /* commands needing write access have 0x40 set */
461da177e4SLinus Torvalds /* commands needing super user access have 0x80 set */
471da177e4SLinus Torvalds 
481da177e4SLinus Torvalds #define FDCLRPRM _IO(2, 0x41)
491da177e4SLinus Torvalds /* clear user-defined parameters */
501da177e4SLinus Torvalds 
511da177e4SLinus Torvalds #define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
521da177e4SLinus Torvalds #define FDSETMEDIAPRM FDSETPRM
531da177e4SLinus Torvalds /* set user-defined parameters for current media */
541da177e4SLinus Torvalds 
551da177e4SLinus Torvalds #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct)
561da177e4SLinus Torvalds #define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
571da177e4SLinus Torvalds #define FDDEFMEDIAPRM FDDEFPRM
581da177e4SLinus Torvalds #define FDGETMEDIAPRM FDGETPRM
591da177e4SLinus Torvalds /* set/get disk parameters */
601da177e4SLinus Torvalds 
611da177e4SLinus Torvalds 
621da177e4SLinus Torvalds #define	FDMSGON  _IO(2,0x45)
631da177e4SLinus Torvalds #define	FDMSGOFF _IO(2,0x46)
641da177e4SLinus Torvalds /* issue/don't issue kernel messages on media type change */
651da177e4SLinus Torvalds 
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds /*
681da177e4SLinus Torvalds  * Formatting (obsolete)
691da177e4SLinus Torvalds  */
701da177e4SLinus Torvalds #define FD_FILL_BYTE 0xF6 /* format fill byte. */
711da177e4SLinus Torvalds 
721da177e4SLinus Torvalds struct format_descr {
731da177e4SLinus Torvalds 	unsigned int device,head,track;
741da177e4SLinus Torvalds };
751da177e4SLinus Torvalds 
761da177e4SLinus Torvalds #define FDFMTBEG _IO(2,0x47)
771da177e4SLinus Torvalds /* begin formatting a disk */
781da177e4SLinus Torvalds #define	FDFMTTRK _IOW(2,0x48, struct format_descr)
791da177e4SLinus Torvalds /* format the specified track */
801da177e4SLinus Torvalds #define FDFMTEND _IO(2,0x49)
811da177e4SLinus Torvalds /* end formatting a disk */
821da177e4SLinus Torvalds 
831da177e4SLinus Torvalds 
841da177e4SLinus Torvalds /*
851da177e4SLinus Torvalds  * Error thresholds
861da177e4SLinus Torvalds  */
871da177e4SLinus Torvalds struct floppy_max_errors {
881da177e4SLinus Torvalds 	unsigned int
891da177e4SLinus Torvalds 	  abort,      /* number of errors to be reached before aborting */
901da177e4SLinus Torvalds 	  read_track, /* maximal number of errors permitted to read an
911da177e4SLinus Torvalds 		       * entire track at once */
921da177e4SLinus Torvalds 	  reset,      /* maximal number of errors before a reset is tried */
931da177e4SLinus Torvalds 	  recal,      /* maximal number of errors before a recalibrate is
941da177e4SLinus Torvalds 		       * tried */
951da177e4SLinus Torvalds 
961da177e4SLinus Torvalds 	  /*
971da177e4SLinus Torvalds 	   * Threshold for reporting FDC errors to the console.
981da177e4SLinus Torvalds 	   * Setting this to zero may flood your screen when using
991da177e4SLinus Torvalds 	   * ultra cheap floppies ;-)
1001da177e4SLinus Torvalds 	   */
1011da177e4SLinus Torvalds 	  reporting;
1021da177e4SLinus Torvalds 
1031da177e4SLinus Torvalds };
1041da177e4SLinus Torvalds 
1051da177e4SLinus Torvalds #define FDSETEMSGTRESH	_IO(2,0x4a)
1061da177e4SLinus Torvalds /* set fdc error reporting threshold */
1071da177e4SLinus Torvalds 
1081da177e4SLinus Torvalds #define FDFLUSH  _IO(2,0x4b)
1091da177e4SLinus Torvalds /* flush buffers for media; either for verifying media, or for
1101da177e4SLinus Torvalds  * handling a media change without closing the file descriptor */
1111da177e4SLinus Torvalds 
1121da177e4SLinus Torvalds #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
1131da177e4SLinus Torvalds #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
1141da177e4SLinus Torvalds /* set/get abortion and read_track threshold. See also floppy_drive_params
1151da177e4SLinus Torvalds  * structure */
1161da177e4SLinus Torvalds 
1171da177e4SLinus Torvalds 
1181da177e4SLinus Torvalds typedef char floppy_drive_name[16];
1191da177e4SLinus Torvalds #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
1201da177e4SLinus Torvalds /* get drive type: 5 1/4 or 3 1/2 */
1211da177e4SLinus Torvalds 
1221da177e4SLinus Torvalds 
1231da177e4SLinus Torvalds /*
1241da177e4SLinus Torvalds  * Drive parameters (user modifiable)
1251da177e4SLinus Torvalds  */
1261da177e4SLinus Torvalds struct floppy_drive_params {
1271da177e4SLinus Torvalds 	signed char cmos;		/* CMOS type */
1281da177e4SLinus Torvalds 
1291da177e4SLinus Torvalds 	/* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms
1301da177e4SLinus Torvalds 	 * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA).
1311da177e4SLinus Torvalds 	 */
1321da177e4SLinus Torvalds 	unsigned long max_dtr;		/* Step rate, usec */
1331da177e4SLinus Torvalds 	unsigned long hlt;     		/* Head load/settle time, msec */
1341da177e4SLinus Torvalds 	unsigned long hut;     		/* Head unload time (remnant of
1351da177e4SLinus Torvalds 					 * 8" drives) */
1361da177e4SLinus Torvalds 	unsigned long srt;     		/* Step rate, usec */
1371da177e4SLinus Torvalds 
1381da177e4SLinus Torvalds 	unsigned long spinup;		/* time needed for spinup (expressed
1391da177e4SLinus Torvalds 					 * in jiffies) */
1401da177e4SLinus Torvalds 	unsigned long spindown;		/* timeout needed for spindown */
1411da177e4SLinus Torvalds 	unsigned char spindown_offset;	/* decides in which position the disk
1421da177e4SLinus Torvalds 					 * will stop */
1431da177e4SLinus Torvalds 	unsigned char select_delay;	/* delay to wait after select */
1441da177e4SLinus Torvalds 	unsigned char rps;		/* rotations per second */
1451da177e4SLinus Torvalds 	unsigned char tracks;		/* maximum number of tracks */
1461da177e4SLinus Torvalds 	unsigned long timeout;		/* timeout for interrupt requests */
1471da177e4SLinus Torvalds 
1481da177e4SLinus Torvalds 	unsigned char interleave_sect;	/* if there are more sectors, use
1491da177e4SLinus Torvalds 					 * interleave */
1501da177e4SLinus Torvalds 
1511da177e4SLinus Torvalds 	struct floppy_max_errors max_errors;
1521da177e4SLinus Torvalds 
1531da177e4SLinus Torvalds 	char flags;			/* various flags, including ftd_msg */
1541da177e4SLinus Torvalds /*
1551da177e4SLinus Torvalds  * Announce successful media type detection and media information loss after
1561da177e4SLinus Torvalds  * disk changes.
1571da177e4SLinus Torvalds  * Also used to enable/disable printing of overrun warnings.
1581da177e4SLinus Torvalds  */
1591da177e4SLinus Torvalds 
1601da177e4SLinus Torvalds #define FTD_MSG 0x10
1611da177e4SLinus Torvalds #define FD_BROKEN_DCL 0x20
1621da177e4SLinus Torvalds #define FD_DEBUG 0x02
1631da177e4SLinus Torvalds #define FD_SILENT_DCL_CLEAR 0x4
1641da177e4SLinus Torvalds #define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware
1651da177e4SLinus Torvalds 				considerations */
1661da177e4SLinus Torvalds 
1671da177e4SLinus Torvalds 	char read_track;		/* use readtrack during probing? */
1681da177e4SLinus Torvalds 
1691da177e4SLinus Torvalds /*
1701da177e4SLinus Torvalds  * Auto-detection. Each drive type has eight formats which are
1711da177e4SLinus Torvalds  * used in succession to try to read the disk. If the FDC cannot lock onto
1721da177e4SLinus Torvalds  * the disk, the next format is tried. This uses the variable 'probing'.
1731da177e4SLinus Torvalds  */
1741da177e4SLinus Torvalds 	short autodetect[8];		/* autodetected formats */
1751da177e4SLinus Torvalds 
1761da177e4SLinus Torvalds 	int checkfreq; /* how often should the drive be checked for disk
1771da177e4SLinus Torvalds 			* changes */
1781da177e4SLinus Torvalds 	int native_format; /* native format of this drive */
1791da177e4SLinus Torvalds };
1801da177e4SLinus Torvalds 
1811da177e4SLinus Torvalds enum {
1821da177e4SLinus Torvalds 	FD_NEED_TWADDLE_BIT,	/* more magic */
1831da177e4SLinus Torvalds 	FD_VERIFY_BIT,		/* inquire for write protection */
1841da177e4SLinus Torvalds 	FD_DISK_NEWCHANGE_BIT,	/* change detected, and no action undertaken yet
1851da177e4SLinus Torvalds 				 * to clear media change status */
1861da177e4SLinus Torvalds 	FD_UNUSED_BIT,
1871da177e4SLinus Torvalds 	FD_DISK_CHANGED_BIT,	/* disk has been changed since last i/o */
1881da177e4SLinus Torvalds 	FD_DISK_WRITABLE_BIT	/* disk is writable */
1891da177e4SLinus Torvalds };
1901da177e4SLinus Torvalds 
1911da177e4SLinus Torvalds #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
1921da177e4SLinus Torvalds #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
1931da177e4SLinus Torvalds /* set/get drive parameters */
1941da177e4SLinus Torvalds 
1951da177e4SLinus Torvalds 
1961da177e4SLinus Torvalds /*
1971da177e4SLinus Torvalds  * Current drive state (not directly modifiable by user, readonly)
1981da177e4SLinus Torvalds  */
1991da177e4SLinus Torvalds struct floppy_drive_struct {
2001da177e4SLinus Torvalds 	unsigned long flags;
2011da177e4SLinus Torvalds /* values for these flags */
2021da177e4SLinus Torvalds #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
2031da177e4SLinus Torvalds #define FD_VERIFY (1 << FD_VERIFY_BIT)
2041da177e4SLinus Torvalds #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
2051da177e4SLinus Torvalds #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
2061da177e4SLinus Torvalds #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
2071da177e4SLinus Torvalds 
2081da177e4SLinus Torvalds 	unsigned long spinup_date;
2091da177e4SLinus Torvalds 	unsigned long select_date;
2101da177e4SLinus Torvalds 	unsigned long first_read_date;
2111da177e4SLinus Torvalds 	short probed_format;
2121da177e4SLinus Torvalds 	short track; /* current track */
2131da177e4SLinus Torvalds 	short maxblock; /* id of highest block read */
2141da177e4SLinus Torvalds 	short maxtrack; /* id of highest half track read */
2151da177e4SLinus Torvalds 	int generation; /* how many diskchanges? */
2161da177e4SLinus Torvalds 
2171da177e4SLinus Torvalds /*
2181da177e4SLinus Torvalds  * (User-provided) media information is _not_ discarded after a media change
2191da177e4SLinus Torvalds  * if the corresponding keep_data flag is non-zero. Positive values are
2201da177e4SLinus Torvalds  * decremented after each probe.
2211da177e4SLinus Torvalds  */
2221da177e4SLinus Torvalds 	int keep_data;
2231da177e4SLinus Torvalds 
2241da177e4SLinus Torvalds 	/* Prevent "aliased" accesses. */
2251da177e4SLinus Torvalds 	int fd_ref;
2261da177e4SLinus Torvalds 	int fd_device;
2271da177e4SLinus Torvalds 	unsigned long last_checked; /* when was the drive last checked for a disk
2281da177e4SLinus Torvalds 			   * change? */
2291da177e4SLinus Torvalds 
2301da177e4SLinus Torvalds 	char *dmabuf;
2311da177e4SLinus Torvalds 	int bufblocks;
2321da177e4SLinus Torvalds };
2331da177e4SLinus Torvalds 
2341da177e4SLinus Torvalds #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
2351da177e4SLinus Torvalds #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
2361da177e4SLinus Torvalds /* get drive state: GET returns the cached state, POLL polls for new state */
2371da177e4SLinus Torvalds 
2381da177e4SLinus Torvalds 
2391da177e4SLinus Torvalds /*
2401da177e4SLinus Torvalds  * reset FDC
2411da177e4SLinus Torvalds  */
2421da177e4SLinus Torvalds enum reset_mode {
2431da177e4SLinus Torvalds 	FD_RESET_IF_NEEDED,	/* reset only if the reset flags is set */
2441da177e4SLinus Torvalds 	FD_RESET_IF_RAWCMD,	/* obsolete */
2451da177e4SLinus Torvalds 	FD_RESET_ALWAYS		/* reset always */
2461da177e4SLinus Torvalds };
2471da177e4SLinus Torvalds #define FDRESET _IO(2, 0x54)
2481da177e4SLinus Torvalds 
2491da177e4SLinus Torvalds 
2501da177e4SLinus Torvalds /*
2511da177e4SLinus Torvalds  * FDC state
2521da177e4SLinus Torvalds  */
2531da177e4SLinus Torvalds struct floppy_fdc_state {
2541da177e4SLinus Torvalds 	int spec1;		/* spec1 value last used */
2551da177e4SLinus Torvalds 	int spec2;		/* spec2 value last used */
2561da177e4SLinus Torvalds 	int dtr;
2571da177e4SLinus Torvalds 	unsigned char version;	/* FDC version code */
2581da177e4SLinus Torvalds 	unsigned char dor;
2591da177e4SLinus Torvalds 	unsigned long address;	/* io address */
2601da177e4SLinus Torvalds 	unsigned int rawcmd:2;
2611da177e4SLinus Torvalds 	unsigned int reset:1;
2621da177e4SLinus Torvalds 	unsigned int need_configure:1;
2631da177e4SLinus Torvalds 	unsigned int perp_mode:2;
2641da177e4SLinus Torvalds 	unsigned int has_fifo:1;
2651da177e4SLinus Torvalds 	unsigned int driver_version;	/* version code for floppy driver */
2661da177e4SLinus Torvalds #define FD_DRIVER_VERSION 0x100
2671da177e4SLinus Torvalds /* user programs using the floppy API should use floppy_fdc_state to
2681da177e4SLinus Torvalds  * get the version number of the floppy driver that they are running
2691da177e4SLinus Torvalds  * on. If this version number is bigger than the one compiled into the
2701da177e4SLinus Torvalds  * user program (the FD_DRIVER_VERSION define), it should be prepared
2711da177e4SLinus Torvalds  * to bigger structures
2721da177e4SLinus Torvalds  */
2731da177e4SLinus Torvalds 
2741da177e4SLinus Torvalds 	unsigned char track[4];
2751da177e4SLinus Torvalds 	/* Position of the heads of the 4 units attached to this FDC,
2761da177e4SLinus Torvalds 	 * as stored on the FDC. In the future, the position as stored
2771da177e4SLinus Torvalds 	 * on the FDC might not agree with the actual physical
2781da177e4SLinus Torvalds 	 * position of these drive heads. By allowing such
2791da177e4SLinus Torvalds 	 * disagreement, it will be possible to reset the FDC without
2801da177e4SLinus Torvalds 	 * incurring the expensive cost of repositioning all heads.
2811da177e4SLinus Torvalds 	 * Right now, these positions are hard wired to 0. */
2821da177e4SLinus Torvalds 
2831da177e4SLinus Torvalds };
2841da177e4SLinus Torvalds 
2851da177e4SLinus Torvalds #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
2861da177e4SLinus Torvalds 
2871da177e4SLinus Torvalds 
2881da177e4SLinus Torvalds /*
2891da177e4SLinus Torvalds  * Asynchronous Write error tracking
2901da177e4SLinus Torvalds  */
2911da177e4SLinus Torvalds struct floppy_write_errors {
2921da177e4SLinus Torvalds 	/* Write error logging.
2931da177e4SLinus Torvalds 	 *
2941da177e4SLinus Torvalds 	 * These fields can be cleared with the FDWERRORCLR ioctl.
2951da177e4SLinus Torvalds 	 * Only writes that were attempted but failed due to a physical media
2961da177e4SLinus Torvalds 	 * error are logged.  write(2) calls that fail and return an error code
2971da177e4SLinus Torvalds 	 * to the user process are not counted.
2981da177e4SLinus Torvalds 	 */
2991da177e4SLinus Torvalds 
3001da177e4SLinus Torvalds 	unsigned int write_errors;  /* number of physical write errors
3011da177e4SLinus Torvalds 				     * encountered */
3021da177e4SLinus Torvalds 
3031da177e4SLinus Torvalds 	/* position of first and last write errors */
3041da177e4SLinus Torvalds 	unsigned long first_error_sector;
3051da177e4SLinus Torvalds 	int           first_error_generation;
3061da177e4SLinus Torvalds 	unsigned long last_error_sector;
3071da177e4SLinus Torvalds 	int           last_error_generation;
3081da177e4SLinus Torvalds 
3091da177e4SLinus Torvalds 	unsigned int badness; /* highest retry count for a read or write
3101da177e4SLinus Torvalds 			       * operation */
3111da177e4SLinus Torvalds };
3121da177e4SLinus Torvalds 
3131da177e4SLinus Torvalds #define FDWERRORCLR  _IO(2, 0x56)
3141da177e4SLinus Torvalds /* clear write error and badness information */
3151da177e4SLinus Torvalds #define FDWERRORGET  _IOR(2, 0x17, struct floppy_write_errors)
3161da177e4SLinus Torvalds /* get write error and badness information */
3171da177e4SLinus Torvalds 
3181da177e4SLinus Torvalds 
3191da177e4SLinus Torvalds /*
3201da177e4SLinus Torvalds  * Raw commands
3211da177e4SLinus Torvalds  */
3221da177e4SLinus Torvalds /* new interface flag: now we can do them in batches */
3231da177e4SLinus Torvalds #define FDHAVEBATCHEDRAWCMD
3241da177e4SLinus Torvalds 
3251da177e4SLinus Torvalds struct floppy_raw_cmd {
3261da177e4SLinus Torvalds 	unsigned int flags;
3271da177e4SLinus Torvalds #define FD_RAW_READ 1
3281da177e4SLinus Torvalds #define FD_RAW_WRITE 2
3291da177e4SLinus Torvalds #define FD_RAW_NO_MOTOR 4
3301da177e4SLinus Torvalds #define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
3311da177e4SLinus Torvalds #define FD_RAW_INTR 8    /* wait for an interrupt */
3321da177e4SLinus Torvalds #define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
3331da177e4SLinus Torvalds #define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command
3341da177e4SLinus Torvalds 				    * completion */
3351da177e4SLinus Torvalds #define FD_RAW_NEED_DISK 0x40  /* this command needs a disk to be present */
3361da177e4SLinus Torvalds #define FD_RAW_NEED_SEEK 0x80  /* this command uses an implied seek (soft) */
3371da177e4SLinus Torvalds 
3381da177e4SLinus Torvalds /* more "in" flags */
3391da177e4SLinus Torvalds #define FD_RAW_MORE 0x100  /* more records follow */
3401da177e4SLinus Torvalds #define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */
3411da177e4SLinus Torvalds #define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */
3421da177e4SLinus Torvalds #define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure
3431da177e4SLinus Torvalds 				  * detection too */
3441da177e4SLinus Torvalds 
3451da177e4SLinus Torvalds /* more "out" flags */
3461da177e4SLinus Torvalds #define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */
3471da177e4SLinus Torvalds #define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */
3481da177e4SLinus Torvalds 
3491da177e4SLinus Torvalds 	void __user *data;
3501da177e4SLinus Torvalds 	char *kernel_data; /* location of data buffer in the kernel */
3511da177e4SLinus Torvalds 	struct floppy_raw_cmd *next; /* used for chaining of raw cmd's
3521da177e4SLinus Torvalds 				      * within the kernel */
3531da177e4SLinus Torvalds 	long length; /* in: length of dma transfer. out: remaining bytes */
3541da177e4SLinus Torvalds 	long phys_length; /* physical length, if different from dma length */
3551da177e4SLinus Torvalds 	int buffer_length; /* length of allocated buffer */
3561da177e4SLinus Torvalds 
3571da177e4SLinus Torvalds 	unsigned char rate;
3581da177e4SLinus Torvalds 	unsigned char cmd_count;
3591da177e4SLinus Torvalds 	unsigned char cmd[16];
3601da177e4SLinus Torvalds 	unsigned char reply_count;
3611da177e4SLinus Torvalds 	unsigned char reply[16];
3621da177e4SLinus Torvalds 	int track;
3631da177e4SLinus Torvalds 	int resultcode;
3641da177e4SLinus Torvalds 
3651da177e4SLinus Torvalds 	int reserved1;
3661da177e4SLinus Torvalds 	int reserved2;
3671da177e4SLinus Torvalds };
3681da177e4SLinus Torvalds 
3691da177e4SLinus Torvalds #define FDRAWCMD _IO(2, 0x58)
3701da177e4SLinus Torvalds /* send a raw command to the fdc. Structure size not included, because of
3711da177e4SLinus Torvalds  * batches */
3721da177e4SLinus Torvalds 
3731da177e4SLinus Torvalds #define FDTWADDLE _IO(2, 0x59)
3741da177e4SLinus Torvalds /* flicker motor-on bit before reading a sector. Experimental */
3751da177e4SLinus Torvalds 
3761da177e4SLinus Torvalds 
3771da177e4SLinus Torvalds #define FDEJECT _IO(2, 0x5a)
3781da177e4SLinus Torvalds /* eject the disk */
3791da177e4SLinus Torvalds 
3801da177e4SLinus Torvalds #endif
381