| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 1 | /**************************************************************************** | 
 | 2 |  **************************************************************************** | 
 | 3 |  *** | 
 | 4 |  ***   This header was automatically generated from a Linux kernel header | 
 | 5 |  ***   of the same name, to make information necessary for userspace to | 
 | 6 |  ***   call into the kernel available to libc.  It contains only constants, | 
 | 7 |  ***   structures, and macros generated from the original header, and thus, | 
 | 8 |  ***   contains no copyrightable information. | 
 | 9 |  *** | 
 | 10 |  ***   To edit the content of this header, modify the corresponding | 
 | 11 |  ***   source file (e.g. under external/kernel-headers/original/) then | 
 | 12 |  ***   run bionic/libc/kernel/tools/update_all.py | 
 | 13 |  *** | 
 | 14 |  ***   Any manual change here will be lost the next time this script will | 
 | 15 |  ***   be run. You've been warned! | 
 | 16 |  *** | 
 | 17 |  **************************************************************************** | 
 | 18 |  ****************************************************************************/ | 
 | 19 | #ifndef _UAPI_LINUX_FD_H | 
 | 20 | #define _UAPI_LINUX_FD_H | 
 | 21 | #include <linux/ioctl.h> | 
 | 22 | #include <linux/compiler.h> | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 23 | struct floppy_struct { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 24 |   unsigned int size, sect, head, track, stretch; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 25 | #define FD_STRETCH 1 | 
 | 26 | #define FD_SWAPSIDES 2 | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 27 | #define FD_ZEROBASED 4 | 
 | 28 | #define FD_SECTBASEMASK 0x3FC | 
 | 29 | #define FD_MKSECTBASE(s) (((s) ^ 1) << 2) | 
 | 30 | #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 31 |   unsigned char gap, rate, | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 32 | #define FD_2M 0x4 | 
 | 33 | #define FD_SIZECODEMASK 0x38 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 34 | #define FD_SIZECODE(floppy) (((((floppy)->rate & FD_SIZECODEMASK) >> 3) + 2) % 8) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 35 | #define FD_SECTSIZE(floppy) ((floppy)->rate & FD_2M ? 512 : 128 << FD_SIZECODE(floppy)) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 36 | #define FD_PERP 0x40 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 37 |   spec1, fmt_gap; | 
 | 38 |   const char * name; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 39 | }; | 
 | 40 | #define FDCLRPRM _IO(2, 0x41) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 41 | #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) | 
 | 42 | #define FDSETMEDIAPRM FDSETPRM | 
 | 43 | #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) | 
 | 44 | #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 45 | #define FDDEFMEDIAPRM FDDEFPRM | 
 | 46 | #define FDGETMEDIAPRM FDGETPRM | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 47 | #define FDMSGON _IO(2, 0x45) | 
 | 48 | #define FDMSGOFF _IO(2, 0x46) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 49 | #define FD_FILL_BYTE 0xF6 | 
 | 50 | struct format_descr { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 51 |   unsigned int device, head, track; | 
 | 52 | }; | 
 | 53 | #define FDFMTBEG _IO(2, 0x47) | 
 | 54 | #define FDFMTTRK _IOW(2, 0x48, struct format_descr) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 55 | #define FDFMTEND _IO(2, 0x49) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 56 | struct floppy_max_errors { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 57 |   unsigned int abort, read_track, reset, recal, reporting; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 58 | }; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 59 | #define FDSETEMSGTRESH _IO(2, 0x4a) | 
 | 60 | #define FDFLUSH _IO(2, 0x4b) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 61 | #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) | 
 | 62 | #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 63 | typedef char floppy_drive_name[16]; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 64 | #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) | 
 | 65 | struct floppy_drive_params { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 66 |   signed char cmos; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 67 |   unsigned long max_dtr; | 
 | 68 |   unsigned long hlt; | 
 | 69 |   unsigned long hut; | 
 | 70 |   unsigned long srt; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 71 |   unsigned long spinup; | 
 | 72 |   unsigned long spindown; | 
 | 73 |   unsigned char spindown_offset; | 
 | 74 |   unsigned char select_delay; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 75 |   unsigned char rps; | 
 | 76 |   unsigned char tracks; | 
 | 77 |   unsigned long timeout; | 
 | 78 |   unsigned char interleave_sect; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 79 |   struct floppy_max_errors max_errors; | 
 | 80 |   char flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 81 | #define FTD_MSG 0x10 | 
 | 82 | #define FD_BROKEN_DCL 0x20 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 83 | #define FD_DEBUG 0x02 | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 84 | #define FD_SILENT_DCL_CLEAR 0x4 | 
 | 85 | #define FD_INVERTED_DCL 0x80 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 86 |   char read_track; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 87 |   short autodetect[8]; | 
 | 88 |   int checkfreq; | 
 | 89 |   int native_format; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 90 | }; | 
 | 91 | enum { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 92 |   FD_NEED_TWADDLE_BIT, | 
 | 93 |   FD_VERIFY_BIT, | 
 | 94 |   FD_DISK_NEWCHANGE_BIT, | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 95 |   FD_UNUSED_BIT, | 
 | 96 |   FD_DISK_CHANGED_BIT, | 
 | 97 |   FD_DISK_WRITABLE_BIT, | 
 | 98 |   FD_OPEN_SHOULD_FAIL_BIT | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 99 | }; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 100 | #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 101 | #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) | 
 | 102 | struct floppy_drive_struct { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 103 |   unsigned long flags; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 104 | #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 105 | #define FD_VERIFY (1 << FD_VERIFY_BIT) | 
 | 106 | #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) | 
 | 107 | #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 108 | #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 109 |   unsigned long spinup_date; | 
 | 110 |   unsigned long select_date; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 111 |   unsigned long first_read_date; | 
 | 112 |   short probed_format; | 
 | 113 |   short track; | 
 | 114 |   short maxblock; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 115 |   short maxtrack; | 
 | 116 |   int generation; | 
 | 117 |   int keep_data; | 
 | 118 |   int fd_ref; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 119 |   int fd_device; | 
 | 120 |   unsigned long last_checked; | 
 | 121 |   char * dmabuf; | 
 | 122 |   int bufblocks; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 123 | }; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 124 | #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 125 | #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) | 
 | 126 | enum reset_mode { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 127 |   FD_RESET_IF_NEEDED, | 
 | 128 |   FD_RESET_IF_RAWCMD, | 
 | 129 |   FD_RESET_ALWAYS | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 130 | }; | 
 | 131 | #define FDRESET _IO(2, 0x54) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 132 | struct floppy_fdc_state { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 133 |   int spec1; | 
 | 134 |   int spec2; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 135 |   int dtr; | 
 | 136 |   unsigned char version; | 
 | 137 |   unsigned char dor; | 
 | 138 |   unsigned long address; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 139 |   unsigned int rawcmd : 2; | 
 | 140 |   unsigned int reset : 1; | 
 | 141 |   unsigned int need_configure : 1; | 
 | 142 |   unsigned int perp_mode : 2; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 143 |   unsigned int has_fifo : 1; | 
 | 144 |   unsigned int driver_version; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 145 | #define FD_DRIVER_VERSION 0x100 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 146 |   unsigned char track[4]; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 147 | }; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 148 | #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 149 | struct floppy_write_errors { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 150 |   unsigned int write_errors; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 151 |   unsigned long first_error_sector; | 
 | 152 |   int first_error_generation; | 
 | 153 |   unsigned long last_error_sector; | 
 | 154 |   int last_error_generation; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 155 |   unsigned int badness; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 156 | }; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 157 | #define FDWERRORCLR _IO(2, 0x56) | 
 | 158 | #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) | 
 | 159 | #define FDHAVEBATCHEDRAWCMD | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 160 | struct floppy_raw_cmd { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 161 |   unsigned int flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 162 | #define FD_RAW_READ 1 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 163 | #define FD_RAW_WRITE 2 | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 164 | #define FD_RAW_NO_MOTOR 4 | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 165 | #define FD_RAW_DISK_CHANGE 4 | 
 | 166 | #define FD_RAW_INTR 8 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 167 | #define FD_RAW_SPIN 0x10 | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 168 | #define FD_RAW_NO_MOTOR_AFTER 0x20 | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 169 | #define FD_RAW_NEED_DISK 0x40 | 
 | 170 | #define FD_RAW_NEED_SEEK 0x80 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 171 | #define FD_RAW_MORE 0x100 | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 172 | #define FD_RAW_STOP_IF_FAILURE 0x200 | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 173 | #define FD_RAW_STOP_IF_SUCCESS 0x400 | 
 | 174 | #define FD_RAW_SOFTFAILURE 0x800 | 
 | 175 | #define FD_RAW_FAILURE 0x10000 | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 176 | #define FD_RAW_HARDFAILURE 0x20000 | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 177 |   void __user * data; | 
 | 178 |   char * kernel_data; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 179 |   struct floppy_raw_cmd * next; | 
 | 180 |   long length; | 
 | 181 |   long phys_length; | 
 | 182 |   int buffer_length; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 183 |   unsigned char rate; | 
 | 184 |   unsigned char cmd_count; | 
 | 185 |   unsigned char cmd[16]; | 
 | 186 |   unsigned char reply_count; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 187 |   unsigned char reply[16]; | 
 | 188 |   int track; | 
 | 189 |   int resultcode; | 
 | 190 |   int reserved1; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 191 |   int reserved2; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 192 | }; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 193 | #define FDRAWCMD _IO(2, 0x58) | 
 | 194 | #define FDTWADDLE _IO(2, 0x59) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 195 | #define FDEJECT _IO(2, 0x5a) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 196 | #endif |