0001
0002 #ifndef _UAPI_LINUX_FD_H
0003 #define _UAPI_LINUX_FD_H
0004
0005 #include <linux/ioctl.h>
0006 #include <linux/compiler.h>
0007
0008
0009
0010
0011
0012
0013
0014 struct floppy_struct {
0015 unsigned int size,
0016 sect,
0017 head,
0018 track,
0019 stretch;
0020
0021
0022
0023 #define FD_STRETCH 1
0024 #define FD_SWAPSIDES 2
0025 #define FD_ZEROBASED 4
0026 #define FD_SECTBASEMASK 0x3FC
0027 #define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
0028 #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
0029
0030 unsigned char gap,
0031
0032 rate,
0033 #define FD_2M 0x4
0034 #define FD_SIZECODEMASK 0x38
0035 #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8)
0036 #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \
0037 512 : 128 << FD_SIZECODE(floppy) )
0038 #define FD_PERP 0x40
0039
0040 spec1,
0041 fmt_gap;
0042 const char * name;
0043 };
0044
0045
0046
0047
0048
0049 #define FDCLRPRM _IO(2, 0x41)
0050
0051
0052 #define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
0053 #define FDSETMEDIAPRM FDSETPRM
0054
0055
0056 #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct)
0057 #define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
0058 #define FDDEFMEDIAPRM FDDEFPRM
0059 #define FDGETMEDIAPRM FDGETPRM
0060
0061
0062
0063 #define FDMSGON _IO(2,0x45)
0064 #define FDMSGOFF _IO(2,0x46)
0065
0066
0067
0068
0069
0070
0071 #define FD_FILL_BYTE 0xF6
0072
0073 struct format_descr {
0074 unsigned int device,head,track;
0075 };
0076
0077 #define FDFMTBEG _IO(2,0x47)
0078
0079 #define FDFMTTRK _IOW(2,0x48, struct format_descr)
0080
0081 #define FDFMTEND _IO(2,0x49)
0082
0083
0084
0085
0086
0087
0088 struct floppy_max_errors {
0089 unsigned int
0090 abort,
0091 read_track,
0092
0093 reset,
0094 recal,
0095
0096
0097
0098
0099
0100
0101
0102 reporting;
0103
0104 };
0105
0106 #define FDSETEMSGTRESH _IO(2,0x4a)
0107
0108
0109 #define FDFLUSH _IO(2,0x4b)
0110
0111
0112
0113 #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
0114 #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
0115
0116
0117
0118
0119 typedef char floppy_drive_name[16];
0120 #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
0121
0122
0123
0124
0125
0126
0127 struct floppy_drive_params {
0128 signed char cmos;
0129
0130
0131
0132
0133 unsigned long max_dtr;
0134 unsigned long hlt;
0135 unsigned long hut;
0136
0137 unsigned long srt;
0138
0139 unsigned long spinup;
0140
0141 unsigned long spindown;
0142 unsigned char spindown_offset;
0143
0144 unsigned char select_delay;
0145 unsigned char rps;
0146 unsigned char tracks;
0147 unsigned long timeout;
0148
0149 unsigned char interleave_sect;
0150
0151
0152 struct floppy_max_errors max_errors;
0153
0154 char flags;
0155
0156
0157
0158
0159
0160
0161 #define FTD_MSG 0x10
0162 #define FD_BROKEN_DCL 0x20
0163 #define FD_DEBUG 0x02
0164 #define FD_SILENT_DCL_CLEAR 0x4
0165 #define FD_INVERTED_DCL 0x80
0166
0167
0168 char read_track;
0169
0170
0171
0172
0173
0174
0175
0176 #define FD_AUTODETECT_SIZE 8
0177
0178 short autodetect[FD_AUTODETECT_SIZE];
0179
0180 int checkfreq;
0181
0182 int native_format;
0183 };
0184
0185 enum {
0186 FD_NEED_TWADDLE_BIT,
0187 FD_VERIFY_BIT,
0188 FD_DISK_NEWCHANGE_BIT,
0189
0190 FD_UNUSED_BIT,
0191 FD_DISK_CHANGED_BIT,
0192 FD_DISK_WRITABLE_BIT,
0193 FD_OPEN_SHOULD_FAIL_BIT
0194 };
0195
0196 #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
0197 #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
0198
0199
0200
0201
0202
0203
0204 struct floppy_drive_struct {
0205 unsigned long flags;
0206
0207 #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
0208 #define FD_VERIFY (1 << FD_VERIFY_BIT)
0209 #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
0210 #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
0211 #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
0212
0213 unsigned long spinup_date;
0214 unsigned long select_date;
0215 unsigned long first_read_date;
0216 short probed_format;
0217 short track;
0218 short maxblock;
0219 short maxtrack;
0220 int generation;
0221
0222
0223
0224
0225
0226
0227 int keep_data;
0228
0229
0230 int fd_ref;
0231 int fd_device;
0232 unsigned long last_checked;
0233
0234
0235 char *dmabuf;
0236 int bufblocks;
0237 };
0238
0239 #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
0240 #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
0241
0242
0243
0244
0245
0246
0247 enum reset_mode {
0248 FD_RESET_IF_NEEDED,
0249 FD_RESET_IF_RAWCMD,
0250 FD_RESET_ALWAYS
0251 };
0252 #define FDRESET _IO(2, 0x54)
0253
0254
0255
0256
0257
0258 struct floppy_fdc_state {
0259 int spec1;
0260 int spec2;
0261 int dtr;
0262 unsigned char version;
0263 unsigned char dor;
0264 unsigned long address;
0265 unsigned int rawcmd:2;
0266 unsigned int reset:1;
0267 unsigned int need_configure:1;
0268 unsigned int perp_mode:2;
0269 unsigned int has_fifo:1;
0270 unsigned int driver_version;
0271 #define FD_DRIVER_VERSION 0x100
0272
0273
0274
0275
0276
0277
0278
0279 unsigned char track[4];
0280
0281
0282
0283
0284
0285
0286
0287
0288 };
0289
0290 #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
0291
0292
0293
0294
0295
0296 struct floppy_write_errors {
0297
0298
0299
0300
0301
0302
0303
0304
0305 unsigned int write_errors;
0306
0307
0308
0309 unsigned long first_error_sector;
0310 int first_error_generation;
0311 unsigned long last_error_sector;
0312 int last_error_generation;
0313
0314 unsigned int badness;
0315
0316 };
0317
0318 #define FDWERRORCLR _IO(2, 0x56)
0319
0320 #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
0321
0322
0323
0324
0325
0326
0327
0328 #define FDHAVEBATCHEDRAWCMD
0329
0330 struct floppy_raw_cmd {
0331 unsigned int flags;
0332 #define FD_RAW_READ 1
0333 #define FD_RAW_WRITE 2
0334 #define FD_RAW_NO_MOTOR 4
0335 #define FD_RAW_DISK_CHANGE 4
0336 #define FD_RAW_INTR 8
0337 #define FD_RAW_SPIN 0x10
0338 #define FD_RAW_NO_MOTOR_AFTER 0x20
0339
0340 #define FD_RAW_NEED_DISK 0x40
0341 #define FD_RAW_NEED_SEEK 0x80
0342
0343
0344 #define FD_RAW_MORE 0x100
0345 #define FD_RAW_STOP_IF_FAILURE 0x200
0346 #define FD_RAW_STOP_IF_SUCCESS 0x400
0347 #define FD_RAW_SOFTFAILURE 0x800
0348
0349
0350
0351 #define FD_RAW_FAILURE 0x10000
0352 #define FD_RAW_HARDFAILURE 0x20000
0353
0354 void __user *data;
0355 char *kernel_data;
0356 struct floppy_raw_cmd *next;
0357
0358 long length;
0359 long phys_length;
0360 int buffer_length;
0361
0362 unsigned char rate;
0363
0364 #define FD_RAW_CMD_SIZE 16
0365 #define FD_RAW_REPLY_SIZE 16
0366 #define FD_RAW_CMD_FULLSIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_REPLY_SIZE)
0367
0368
0369
0370
0371
0372
0373 unsigned char cmd_count;
0374 union {
0375 struct {
0376 unsigned char cmd[FD_RAW_CMD_SIZE];
0377 unsigned char reply_count;
0378 unsigned char reply[FD_RAW_REPLY_SIZE];
0379 };
0380 unsigned char fullcmd[FD_RAW_CMD_FULLSIZE];
0381 };
0382 int track;
0383 int resultcode;
0384
0385 int reserved1;
0386 int reserved2;
0387 };
0388
0389 #define FDRAWCMD _IO(2, 0x58)
0390
0391
0392
0393 #define FDTWADDLE _IO(2, 0x59)
0394
0395
0396
0397 #define FDEJECT _IO(2, 0x5a)
0398
0399
0400
0401
0402 #endif