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