1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun #ifndef _UAPI_LINUX_FD_H 3*4882a593Smuzhiyun #define _UAPI_LINUX_FD_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <linux/ioctl.h> 6*4882a593Smuzhiyun #include <linux/compiler.h> 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun /* New file layout: Now the ioctl definitions immediately follow the 9*4882a593Smuzhiyun * definitions of the structures that they use */ 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun /* 12*4882a593Smuzhiyun * Geometry 13*4882a593Smuzhiyun */ 14*4882a593Smuzhiyun struct floppy_struct { 15*4882a593Smuzhiyun unsigned int size, /* nr of sectors total */ 16*4882a593Smuzhiyun sect, /* sectors per track */ 17*4882a593Smuzhiyun head, /* nr of heads */ 18*4882a593Smuzhiyun track, /* nr of tracks */ 19*4882a593Smuzhiyun stretch; /* bit 0 !=0 means double track steps */ 20*4882a593Smuzhiyun /* bit 1 != 0 means swap sides */ 21*4882a593Smuzhiyun /* bits 2..9 give the first sector */ 22*4882a593Smuzhiyun /* number (the LSB is flipped) */ 23*4882a593Smuzhiyun #define FD_STRETCH 1 24*4882a593Smuzhiyun #define FD_SWAPSIDES 2 25*4882a593Smuzhiyun #define FD_ZEROBASED 4 26*4882a593Smuzhiyun #define FD_SECTBASEMASK 0x3FC 27*4882a593Smuzhiyun #define FD_MKSECTBASE(s) (((s) ^ 1) << 2) 28*4882a593Smuzhiyun #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun unsigned char gap, /* gap1 size */ 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun rate, /* data rate. |= 0x40 for perpendicular */ 33*4882a593Smuzhiyun #define FD_2M 0x4 34*4882a593Smuzhiyun #define FD_SIZECODEMASK 0x38 35*4882a593Smuzhiyun #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) 36*4882a593Smuzhiyun #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \ 37*4882a593Smuzhiyun 512 : 128 << FD_SIZECODE(floppy) ) 38*4882a593Smuzhiyun #define FD_PERP 0x40 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun spec1, /* stepping rate, head unload time */ 41*4882a593Smuzhiyun fmt_gap; /* gap2 size */ 42*4882a593Smuzhiyun const char * name; /* used only for predefined formats */ 43*4882a593Smuzhiyun }; 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun /* commands needing write access have 0x40 set */ 47*4882a593Smuzhiyun /* commands needing super user access have 0x80 set */ 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun #define FDCLRPRM _IO(2, 0x41) 50*4882a593Smuzhiyun /* clear user-defined parameters */ 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) 53*4882a593Smuzhiyun #define FDSETMEDIAPRM FDSETPRM 54*4882a593Smuzhiyun /* set user-defined parameters for current media */ 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) 57*4882a593Smuzhiyun #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) 58*4882a593Smuzhiyun #define FDDEFMEDIAPRM FDDEFPRM 59*4882a593Smuzhiyun #define FDGETMEDIAPRM FDGETPRM 60*4882a593Smuzhiyun /* set/get disk parameters */ 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun #define FDMSGON _IO(2,0x45) 64*4882a593Smuzhiyun #define FDMSGOFF _IO(2,0x46) 65*4882a593Smuzhiyun /* issue/don't issue kernel messages on media type change */ 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun /* 69*4882a593Smuzhiyun * Formatting (obsolete) 70*4882a593Smuzhiyun */ 71*4882a593Smuzhiyun #define FD_FILL_BYTE 0xF6 /* format fill byte. */ 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun struct format_descr { 74*4882a593Smuzhiyun unsigned int device,head,track; 75*4882a593Smuzhiyun }; 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun #define FDFMTBEG _IO(2,0x47) 78*4882a593Smuzhiyun /* begin formatting a disk */ 79*4882a593Smuzhiyun #define FDFMTTRK _IOW(2,0x48, struct format_descr) 80*4882a593Smuzhiyun /* format the specified track */ 81*4882a593Smuzhiyun #define FDFMTEND _IO(2,0x49) 82*4882a593Smuzhiyun /* end formatting a disk */ 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun /* 86*4882a593Smuzhiyun * Error thresholds 87*4882a593Smuzhiyun */ 88*4882a593Smuzhiyun struct floppy_max_errors { 89*4882a593Smuzhiyun unsigned int 90*4882a593Smuzhiyun abort, /* number of errors to be reached before aborting */ 91*4882a593Smuzhiyun read_track, /* maximal number of errors permitted to read an 92*4882a593Smuzhiyun * entire track at once */ 93*4882a593Smuzhiyun reset, /* maximal number of errors before a reset is tried */ 94*4882a593Smuzhiyun recal, /* maximal number of errors before a recalibrate is 95*4882a593Smuzhiyun * tried */ 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun /* 98*4882a593Smuzhiyun * Threshold for reporting FDC errors to the console. 99*4882a593Smuzhiyun * Setting this to zero may flood your screen when using 100*4882a593Smuzhiyun * ultra cheap floppies ;-) 101*4882a593Smuzhiyun */ 102*4882a593Smuzhiyun reporting; 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun }; 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun #define FDSETEMSGTRESH _IO(2,0x4a) 107*4882a593Smuzhiyun /* set fdc error reporting threshold */ 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun #define FDFLUSH _IO(2,0x4b) 110*4882a593Smuzhiyun /* flush buffers for media; either for verifying media, or for 111*4882a593Smuzhiyun * handling a media change without closing the file descriptor */ 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) 114*4882a593Smuzhiyun #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) 115*4882a593Smuzhiyun /* set/get abortion and read_track threshold. See also floppy_drive_params 116*4882a593Smuzhiyun * structure */ 117*4882a593Smuzhiyun 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun typedef char floppy_drive_name[16]; 120*4882a593Smuzhiyun #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) 121*4882a593Smuzhiyun /* get drive type: 5 1/4 or 3 1/2 */ 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun 124*4882a593Smuzhiyun /* 125*4882a593Smuzhiyun * Drive parameters (user modifiable) 126*4882a593Smuzhiyun */ 127*4882a593Smuzhiyun struct floppy_drive_params { 128*4882a593Smuzhiyun signed char cmos; /* CMOS type */ 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms 131*4882a593Smuzhiyun * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). 132*4882a593Smuzhiyun */ 133*4882a593Smuzhiyun unsigned long max_dtr; /* Step rate, usec */ 134*4882a593Smuzhiyun unsigned long hlt; /* Head load/settle time, msec */ 135*4882a593Smuzhiyun unsigned long hut; /* Head unload time (remnant of 136*4882a593Smuzhiyun * 8" drives) */ 137*4882a593Smuzhiyun unsigned long srt; /* Step rate, usec */ 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun unsigned long spinup; /* time needed for spinup (expressed 140*4882a593Smuzhiyun * in jiffies) */ 141*4882a593Smuzhiyun unsigned long spindown; /* timeout needed for spindown */ 142*4882a593Smuzhiyun unsigned char spindown_offset; /* decides in which position the disk 143*4882a593Smuzhiyun * will stop */ 144*4882a593Smuzhiyun unsigned char select_delay; /* delay to wait after select */ 145*4882a593Smuzhiyun unsigned char rps; /* rotations per second */ 146*4882a593Smuzhiyun unsigned char tracks; /* maximum number of tracks */ 147*4882a593Smuzhiyun unsigned long timeout; /* timeout for interrupt requests */ 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun unsigned char interleave_sect; /* if there are more sectors, use 150*4882a593Smuzhiyun * interleave */ 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun struct floppy_max_errors max_errors; 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun char flags; /* various flags, including ftd_msg */ 155*4882a593Smuzhiyun /* 156*4882a593Smuzhiyun * Announce successful media type detection and media information loss after 157*4882a593Smuzhiyun * disk changes. 158*4882a593Smuzhiyun * Also used to enable/disable printing of overrun warnings. 159*4882a593Smuzhiyun */ 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun #define FTD_MSG 0x10 162*4882a593Smuzhiyun #define FD_BROKEN_DCL 0x20 163*4882a593Smuzhiyun #define FD_DEBUG 0x02 164*4882a593Smuzhiyun #define FD_SILENT_DCL_CLEAR 0x4 165*4882a593Smuzhiyun #define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware 166*4882a593Smuzhiyun considerations */ 167*4882a593Smuzhiyun 168*4882a593Smuzhiyun char read_track; /* use readtrack during probing? */ 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun /* 171*4882a593Smuzhiyun * Auto-detection. Each drive type has eight formats which are 172*4882a593Smuzhiyun * used in succession to try to read the disk. If the FDC cannot lock onto 173*4882a593Smuzhiyun * the disk, the next format is tried. This uses the variable 'probing'. 174*4882a593Smuzhiyun */ 175*4882a593Smuzhiyun 176*4882a593Smuzhiyun #define FD_AUTODETECT_SIZE 8 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun short autodetect[FD_AUTODETECT_SIZE]; /* autodetected formats */ 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun int checkfreq; /* how often should the drive be checked for disk 181*4882a593Smuzhiyun * changes */ 182*4882a593Smuzhiyun int native_format; /* native format of this drive */ 183*4882a593Smuzhiyun }; 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun enum { 186*4882a593Smuzhiyun FD_NEED_TWADDLE_BIT, /* more magic */ 187*4882a593Smuzhiyun FD_VERIFY_BIT, /* inquire for write protection */ 188*4882a593Smuzhiyun FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet 189*4882a593Smuzhiyun * to clear media change status */ 190*4882a593Smuzhiyun FD_UNUSED_BIT, 191*4882a593Smuzhiyun FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */ 192*4882a593Smuzhiyun FD_DISK_WRITABLE_BIT, /* disk is writable */ 193*4882a593Smuzhiyun FD_OPEN_SHOULD_FAIL_BIT 194*4882a593Smuzhiyun }; 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) 197*4882a593Smuzhiyun #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) 198*4882a593Smuzhiyun /* set/get drive parameters */ 199*4882a593Smuzhiyun 200*4882a593Smuzhiyun 201*4882a593Smuzhiyun /* 202*4882a593Smuzhiyun * Current drive state (not directly modifiable by user, readonly) 203*4882a593Smuzhiyun */ 204*4882a593Smuzhiyun struct floppy_drive_struct { 205*4882a593Smuzhiyun unsigned long flags; 206*4882a593Smuzhiyun /* values for these flags */ 207*4882a593Smuzhiyun #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) 208*4882a593Smuzhiyun #define FD_VERIFY (1 << FD_VERIFY_BIT) 209*4882a593Smuzhiyun #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) 210*4882a593Smuzhiyun #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) 211*4882a593Smuzhiyun #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) 212*4882a593Smuzhiyun 213*4882a593Smuzhiyun unsigned long spinup_date; 214*4882a593Smuzhiyun unsigned long select_date; 215*4882a593Smuzhiyun unsigned long first_read_date; 216*4882a593Smuzhiyun short probed_format; 217*4882a593Smuzhiyun short track; /* current track */ 218*4882a593Smuzhiyun short maxblock; /* id of highest block read */ 219*4882a593Smuzhiyun short maxtrack; /* id of highest half track read */ 220*4882a593Smuzhiyun int generation; /* how many diskchanges? */ 221*4882a593Smuzhiyun 222*4882a593Smuzhiyun /* 223*4882a593Smuzhiyun * (User-provided) media information is _not_ discarded after a media change 224*4882a593Smuzhiyun * if the corresponding keep_data flag is non-zero. Positive values are 225*4882a593Smuzhiyun * decremented after each probe. 226*4882a593Smuzhiyun */ 227*4882a593Smuzhiyun int keep_data; 228*4882a593Smuzhiyun 229*4882a593Smuzhiyun /* Prevent "aliased" accesses. */ 230*4882a593Smuzhiyun int fd_ref; 231*4882a593Smuzhiyun int fd_device; 232*4882a593Smuzhiyun unsigned long last_checked; /* when was the drive last checked for a disk 233*4882a593Smuzhiyun * change? */ 234*4882a593Smuzhiyun 235*4882a593Smuzhiyun char *dmabuf; 236*4882a593Smuzhiyun int bufblocks; 237*4882a593Smuzhiyun }; 238*4882a593Smuzhiyun 239*4882a593Smuzhiyun #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) 240*4882a593Smuzhiyun #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) 241*4882a593Smuzhiyun /* get drive state: GET returns the cached state, POLL polls for new state */ 242*4882a593Smuzhiyun 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun /* 245*4882a593Smuzhiyun * reset FDC 246*4882a593Smuzhiyun */ 247*4882a593Smuzhiyun enum reset_mode { 248*4882a593Smuzhiyun FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */ 249*4882a593Smuzhiyun FD_RESET_IF_RAWCMD, /* obsolete */ 250*4882a593Smuzhiyun FD_RESET_ALWAYS /* reset always */ 251*4882a593Smuzhiyun }; 252*4882a593Smuzhiyun #define FDRESET _IO(2, 0x54) 253*4882a593Smuzhiyun 254*4882a593Smuzhiyun 255*4882a593Smuzhiyun /* 256*4882a593Smuzhiyun * FDC state 257*4882a593Smuzhiyun */ 258*4882a593Smuzhiyun struct floppy_fdc_state { 259*4882a593Smuzhiyun int spec1; /* spec1 value last used */ 260*4882a593Smuzhiyun int spec2; /* spec2 value last used */ 261*4882a593Smuzhiyun int dtr; 262*4882a593Smuzhiyun unsigned char version; /* FDC version code */ 263*4882a593Smuzhiyun unsigned char dor; 264*4882a593Smuzhiyun unsigned long address; /* io address */ 265*4882a593Smuzhiyun unsigned int rawcmd:2; 266*4882a593Smuzhiyun unsigned int reset:1; 267*4882a593Smuzhiyun unsigned int need_configure:1; 268*4882a593Smuzhiyun unsigned int perp_mode:2; 269*4882a593Smuzhiyun unsigned int has_fifo:1; 270*4882a593Smuzhiyun unsigned int driver_version; /* version code for floppy driver */ 271*4882a593Smuzhiyun #define FD_DRIVER_VERSION 0x100 272*4882a593Smuzhiyun /* user programs using the floppy API should use floppy_fdc_state to 273*4882a593Smuzhiyun * get the version number of the floppy driver that they are running 274*4882a593Smuzhiyun * on. If this version number is bigger than the one compiled into the 275*4882a593Smuzhiyun * user program (the FD_DRIVER_VERSION define), it should be prepared 276*4882a593Smuzhiyun * to bigger structures 277*4882a593Smuzhiyun */ 278*4882a593Smuzhiyun 279*4882a593Smuzhiyun unsigned char track[4]; 280*4882a593Smuzhiyun /* Position of the heads of the 4 units attached to this FDC, 281*4882a593Smuzhiyun * as stored on the FDC. In the future, the position as stored 282*4882a593Smuzhiyun * on the FDC might not agree with the actual physical 283*4882a593Smuzhiyun * position of these drive heads. By allowing such 284*4882a593Smuzhiyun * disagreement, it will be possible to reset the FDC without 285*4882a593Smuzhiyun * incurring the expensive cost of repositioning all heads. 286*4882a593Smuzhiyun * Right now, these positions are hard wired to 0. */ 287*4882a593Smuzhiyun 288*4882a593Smuzhiyun }; 289*4882a593Smuzhiyun 290*4882a593Smuzhiyun #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) 291*4882a593Smuzhiyun 292*4882a593Smuzhiyun 293*4882a593Smuzhiyun /* 294*4882a593Smuzhiyun * Asynchronous Write error tracking 295*4882a593Smuzhiyun */ 296*4882a593Smuzhiyun struct floppy_write_errors { 297*4882a593Smuzhiyun /* Write error logging. 298*4882a593Smuzhiyun * 299*4882a593Smuzhiyun * These fields can be cleared with the FDWERRORCLR ioctl. 300*4882a593Smuzhiyun * Only writes that were attempted but failed due to a physical media 301*4882a593Smuzhiyun * error are logged. write(2) calls that fail and return an error code 302*4882a593Smuzhiyun * to the user process are not counted. 303*4882a593Smuzhiyun */ 304*4882a593Smuzhiyun 305*4882a593Smuzhiyun unsigned int write_errors; /* number of physical write errors 306*4882a593Smuzhiyun * encountered */ 307*4882a593Smuzhiyun 308*4882a593Smuzhiyun /* position of first and last write errors */ 309*4882a593Smuzhiyun unsigned long first_error_sector; 310*4882a593Smuzhiyun int first_error_generation; 311*4882a593Smuzhiyun unsigned long last_error_sector; 312*4882a593Smuzhiyun int last_error_generation; 313*4882a593Smuzhiyun 314*4882a593Smuzhiyun unsigned int badness; /* highest retry count for a read or write 315*4882a593Smuzhiyun * operation */ 316*4882a593Smuzhiyun }; 317*4882a593Smuzhiyun 318*4882a593Smuzhiyun #define FDWERRORCLR _IO(2, 0x56) 319*4882a593Smuzhiyun /* clear write error and badness information */ 320*4882a593Smuzhiyun #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) 321*4882a593Smuzhiyun /* get write error and badness information */ 322*4882a593Smuzhiyun 323*4882a593Smuzhiyun 324*4882a593Smuzhiyun /* 325*4882a593Smuzhiyun * Raw commands 326*4882a593Smuzhiyun */ 327*4882a593Smuzhiyun /* new interface flag: now we can do them in batches */ 328*4882a593Smuzhiyun #define FDHAVEBATCHEDRAWCMD 329*4882a593Smuzhiyun 330*4882a593Smuzhiyun struct floppy_raw_cmd { 331*4882a593Smuzhiyun unsigned int flags; 332*4882a593Smuzhiyun #define FD_RAW_READ 1 333*4882a593Smuzhiyun #define FD_RAW_WRITE 2 334*4882a593Smuzhiyun #define FD_RAW_NO_MOTOR 4 335*4882a593Smuzhiyun #define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */ 336*4882a593Smuzhiyun #define FD_RAW_INTR 8 /* wait for an interrupt */ 337*4882a593Smuzhiyun #define FD_RAW_SPIN 0x10 /* spin up the disk for this command */ 338*4882a593Smuzhiyun #define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command 339*4882a593Smuzhiyun * completion */ 340*4882a593Smuzhiyun #define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */ 341*4882a593Smuzhiyun #define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */ 342*4882a593Smuzhiyun 343*4882a593Smuzhiyun /* more "in" flags */ 344*4882a593Smuzhiyun #define FD_RAW_MORE 0x100 /* more records follow */ 345*4882a593Smuzhiyun #define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */ 346*4882a593Smuzhiyun #define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */ 347*4882a593Smuzhiyun #define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure 348*4882a593Smuzhiyun * detection too */ 349*4882a593Smuzhiyun 350*4882a593Smuzhiyun /* more "out" flags */ 351*4882a593Smuzhiyun #define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */ 352*4882a593Smuzhiyun #define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */ 353*4882a593Smuzhiyun 354*4882a593Smuzhiyun void __user *data; 355*4882a593Smuzhiyun char *kernel_data; /* location of data buffer in the kernel */ 356*4882a593Smuzhiyun struct floppy_raw_cmd *next; /* used for chaining of raw cmd's 357*4882a593Smuzhiyun * within the kernel */ 358*4882a593Smuzhiyun long length; /* in: length of dma transfer. out: remaining bytes */ 359*4882a593Smuzhiyun long phys_length; /* physical length, if different from dma length */ 360*4882a593Smuzhiyun int buffer_length; /* length of allocated buffer */ 361*4882a593Smuzhiyun 362*4882a593Smuzhiyun unsigned char rate; 363*4882a593Smuzhiyun 364*4882a593Smuzhiyun #define FD_RAW_CMD_SIZE 16 365*4882a593Smuzhiyun #define FD_RAW_REPLY_SIZE 16 366*4882a593Smuzhiyun #define FD_RAW_CMD_FULLSIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_REPLY_SIZE) 367*4882a593Smuzhiyun 368*4882a593Smuzhiyun /* The command may take up the space initially intended for the reply 369*4882a593Smuzhiyun * and the reply count. Needed for long 82078 commands such as RESTORE, 370*4882a593Smuzhiyun * which takes 17 command bytes. 371*4882a593Smuzhiyun */ 372*4882a593Smuzhiyun 373*4882a593Smuzhiyun unsigned char cmd_count; 374*4882a593Smuzhiyun union { 375*4882a593Smuzhiyun struct { 376*4882a593Smuzhiyun unsigned char cmd[FD_RAW_CMD_SIZE]; 377*4882a593Smuzhiyun unsigned char reply_count; 378*4882a593Smuzhiyun unsigned char reply[FD_RAW_REPLY_SIZE]; 379*4882a593Smuzhiyun }; 380*4882a593Smuzhiyun unsigned char fullcmd[FD_RAW_CMD_FULLSIZE]; 381*4882a593Smuzhiyun }; 382*4882a593Smuzhiyun int track; 383*4882a593Smuzhiyun int resultcode; 384*4882a593Smuzhiyun 385*4882a593Smuzhiyun int reserved1; 386*4882a593Smuzhiyun int reserved2; 387*4882a593Smuzhiyun }; 388*4882a593Smuzhiyun 389*4882a593Smuzhiyun #define FDRAWCMD _IO(2, 0x58) 390*4882a593Smuzhiyun /* send a raw command to the fdc. Structure size not included, because of 391*4882a593Smuzhiyun * batches */ 392*4882a593Smuzhiyun 393*4882a593Smuzhiyun #define FDTWADDLE _IO(2, 0x59) 394*4882a593Smuzhiyun /* flicker motor-on bit before reading a sector. Experimental */ 395*4882a593Smuzhiyun 396*4882a593Smuzhiyun 397*4882a593Smuzhiyun #define FDEJECT _IO(2, 0x5a) 398*4882a593Smuzhiyun /* eject the disk */ 399*4882a593Smuzhiyun 400*4882a593Smuzhiyun 401*4882a593Smuzhiyun 402*4882a593Smuzhiyun #endif /* _UAPI_LINUX_FD_H */ 403