blob: f3c2d50ef3f2e232db53ae464a204fb8a3f7ce5f [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
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 Cheng655a7c02013-10-16 16:09:24 -070023struct floppy_struct {
Tao Baod7db5942015-01-28 10:07:51 -080024 unsigned int size, sect, head, track, stretch;
Ben Cheng655a7c02013-10-16 16:09:24 -070025#define FD_STRETCH 1
26#define FD_SWAPSIDES 2
Ben Cheng655a7c02013-10-16 16:09:24 -070027#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 Baod7db5942015-01-28 10:07:51 -080031 unsigned char gap, rate,
Ben Cheng655a7c02013-10-16 16:09:24 -070032#define FD_2M 0x4
33#define FD_SIZECODEMASK 0x38
Tao Baod7db5942015-01-28 10:07:51 -080034#define FD_SIZECODE(floppy) (((((floppy)->rate & FD_SIZECODEMASK) >> 3) + 2) % 8)
Tao Baod7db5942015-01-28 10:07:51 -080035#define FD_SECTSIZE(floppy) ((floppy)->rate & FD_2M ? 512 : 128 << FD_SIZECODE(floppy))
Ben Cheng655a7c02013-10-16 16:09:24 -070036#define FD_PERP 0x40
Tao Baod7db5942015-01-28 10:07:51 -080037 spec1, fmt_gap;
38 const char * name;
Ben Cheng655a7c02013-10-16 16:09:24 -070039};
40#define FDCLRPRM _IO(2, 0x41)
Ben Cheng655a7c02013-10-16 16:09:24 -070041#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 Cheng655a7c02013-10-16 16:09:24 -070045#define FDDEFMEDIAPRM FDDEFPRM
46#define FDGETMEDIAPRM FDGETPRM
Tao Baod7db5942015-01-28 10:07:51 -080047#define FDMSGON _IO(2, 0x45)
48#define FDMSGOFF _IO(2, 0x46)
Ben Cheng655a7c02013-10-16 16:09:24 -070049#define FD_FILL_BYTE 0xF6
50struct format_descr {
Tao Baod7db5942015-01-28 10:07:51 -080051 unsigned int device, head, track;
52};
53#define FDFMTBEG _IO(2, 0x47)
54#define FDFMTTRK _IOW(2, 0x48, struct format_descr)
Tao Baod7db5942015-01-28 10:07:51 -080055#define FDFMTEND _IO(2, 0x49)
Ben Cheng655a7c02013-10-16 16:09:24 -070056struct floppy_max_errors {
Tao Baod7db5942015-01-28 10:07:51 -080057 unsigned int abort, read_track, reset, recal, reporting;
Ben Cheng655a7c02013-10-16 16:09:24 -070058};
Tao Baod7db5942015-01-28 10:07:51 -080059#define FDSETEMSGTRESH _IO(2, 0x4a)
60#define FDFLUSH _IO(2, 0x4b)
Ben Cheng655a7c02013-10-16 16:09:24 -070061#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
62#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
Tao Baod7db5942015-01-28 10:07:51 -080063typedef char floppy_drive_name[16];
Ben Cheng655a7c02013-10-16 16:09:24 -070064#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
65struct floppy_drive_params {
Tao Baod7db5942015-01-28 10:07:51 -080066 signed char cmos;
Tao Baod7db5942015-01-28 10:07:51 -080067 unsigned long max_dtr;
68 unsigned long hlt;
69 unsigned long hut;
70 unsigned long srt;
Tao Baod7db5942015-01-28 10:07:51 -080071 unsigned long spinup;
72 unsigned long spindown;
73 unsigned char spindown_offset;
74 unsigned char select_delay;
Tao Baod7db5942015-01-28 10:07:51 -080075 unsigned char rps;
76 unsigned char tracks;
77 unsigned long timeout;
78 unsigned char interleave_sect;
Tao Baod7db5942015-01-28 10:07:51 -080079 struct floppy_max_errors max_errors;
80 char flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070081#define FTD_MSG 0x10
82#define FD_BROKEN_DCL 0x20
Tao Baod7db5942015-01-28 10:07:51 -080083#define FD_DEBUG 0x02
Ben Cheng655a7c02013-10-16 16:09:24 -070084#define FD_SILENT_DCL_CLEAR 0x4
85#define FD_INVERTED_DCL 0x80
Tao Baod7db5942015-01-28 10:07:51 -080086 char read_track;
Tao Baod7db5942015-01-28 10:07:51 -080087 short autodetect[8];
88 int checkfreq;
89 int native_format;
Ben Cheng655a7c02013-10-16 16:09:24 -070090};
91enum {
Tao Baod7db5942015-01-28 10:07:51 -080092 FD_NEED_TWADDLE_BIT,
93 FD_VERIFY_BIT,
94 FD_DISK_NEWCHANGE_BIT,
Tao Baod7db5942015-01-28 10:07:51 -080095 FD_UNUSED_BIT,
96 FD_DISK_CHANGED_BIT,
97 FD_DISK_WRITABLE_BIT,
98 FD_OPEN_SHOULD_FAIL_BIT
Ben Cheng655a7c02013-10-16 16:09:24 -070099};
Christopher Ferris38062f92014-07-09 15:33:25 -0700100#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
Ben Cheng655a7c02013-10-16 16:09:24 -0700101#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
102struct floppy_drive_struct {
Tao Baod7db5942015-01-28 10:07:51 -0800103 unsigned long flags;
Christopher Ferris38062f92014-07-09 15:33:25 -0700104#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
Ben Cheng655a7c02013-10-16 16:09:24 -0700105#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 Ferris38062f92014-07-09 15:33:25 -0700108#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
Tao Baod7db5942015-01-28 10:07:51 -0800109 unsigned long spinup_date;
110 unsigned long select_date;
Tao Baod7db5942015-01-28 10:07:51 -0800111 unsigned long first_read_date;
112 short probed_format;
113 short track;
114 short maxblock;
Tao Baod7db5942015-01-28 10:07:51 -0800115 short maxtrack;
116 int generation;
117 int keep_data;
118 int fd_ref;
Tao Baod7db5942015-01-28 10:07:51 -0800119 int fd_device;
120 unsigned long last_checked;
121 char * dmabuf;
122 int bufblocks;
Ben Cheng655a7c02013-10-16 16:09:24 -0700123};
Christopher Ferris38062f92014-07-09 15:33:25 -0700124#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
Ben Cheng655a7c02013-10-16 16:09:24 -0700125#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
126enum reset_mode {
Tao Baod7db5942015-01-28 10:07:51 -0800127 FD_RESET_IF_NEEDED,
128 FD_RESET_IF_RAWCMD,
129 FD_RESET_ALWAYS
Ben Cheng655a7c02013-10-16 16:09:24 -0700130};
131#define FDRESET _IO(2, 0x54)
Christopher Ferris38062f92014-07-09 15:33:25 -0700132struct floppy_fdc_state {
Tao Baod7db5942015-01-28 10:07:51 -0800133 int spec1;
134 int spec2;
Tao Baod7db5942015-01-28 10:07:51 -0800135 int dtr;
136 unsigned char version;
137 unsigned char dor;
138 unsigned long address;
Tao Baod7db5942015-01-28 10:07:51 -0800139 unsigned int rawcmd : 2;
140 unsigned int reset : 1;
141 unsigned int need_configure : 1;
142 unsigned int perp_mode : 2;
Tao Baod7db5942015-01-28 10:07:51 -0800143 unsigned int has_fifo : 1;
144 unsigned int driver_version;
Ben Cheng655a7c02013-10-16 16:09:24 -0700145#define FD_DRIVER_VERSION 0x100
Tao Baod7db5942015-01-28 10:07:51 -0800146 unsigned char track[4];
Tao Baod7db5942015-01-28 10:07:51 -0800147};
Christopher Ferris38062f92014-07-09 15:33:25 -0700148#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
Ben Cheng655a7c02013-10-16 16:09:24 -0700149struct floppy_write_errors {
Tao Baod7db5942015-01-28 10:07:51 -0800150 unsigned int write_errors;
Tao Baod7db5942015-01-28 10:07:51 -0800151 unsigned long first_error_sector;
152 int first_error_generation;
153 unsigned long last_error_sector;
154 int last_error_generation;
Tao Baod7db5942015-01-28 10:07:51 -0800155 unsigned int badness;
Christopher Ferris38062f92014-07-09 15:33:25 -0700156};
Ben Cheng655a7c02013-10-16 16:09:24 -0700157#define FDWERRORCLR _IO(2, 0x56)
158#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
159#define FDHAVEBATCHEDRAWCMD
Christopher Ferris38062f92014-07-09 15:33:25 -0700160struct floppy_raw_cmd {
Tao Baod7db5942015-01-28 10:07:51 -0800161 unsigned int flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700162#define FD_RAW_READ 1
Tao Baod7db5942015-01-28 10:07:51 -0800163#define FD_RAW_WRITE 2
Christopher Ferris38062f92014-07-09 15:33:25 -0700164#define FD_RAW_NO_MOTOR 4
Ben Cheng655a7c02013-10-16 16:09:24 -0700165#define FD_RAW_DISK_CHANGE 4
166#define FD_RAW_INTR 8
Tao Baod7db5942015-01-28 10:07:51 -0800167#define FD_RAW_SPIN 0x10
Christopher Ferris38062f92014-07-09 15:33:25 -0700168#define FD_RAW_NO_MOTOR_AFTER 0x20
Ben Cheng655a7c02013-10-16 16:09:24 -0700169#define FD_RAW_NEED_DISK 0x40
170#define FD_RAW_NEED_SEEK 0x80
Tao Baod7db5942015-01-28 10:07:51 -0800171#define FD_RAW_MORE 0x100
Christopher Ferris38062f92014-07-09 15:33:25 -0700172#define FD_RAW_STOP_IF_FAILURE 0x200
Ben Cheng655a7c02013-10-16 16:09:24 -0700173#define FD_RAW_STOP_IF_SUCCESS 0x400
174#define FD_RAW_SOFTFAILURE 0x800
175#define FD_RAW_FAILURE 0x10000
Christopher Ferris38062f92014-07-09 15:33:25 -0700176#define FD_RAW_HARDFAILURE 0x20000
Tao Baod7db5942015-01-28 10:07:51 -0800177 void __user * data;
178 char * kernel_data;
Tao Baod7db5942015-01-28 10:07:51 -0800179 struct floppy_raw_cmd * next;
180 long length;
181 long phys_length;
182 int buffer_length;
Tao Baod7db5942015-01-28 10:07:51 -0800183 unsigned char rate;
184 unsigned char cmd_count;
185 unsigned char cmd[16];
186 unsigned char reply_count;
Tao Baod7db5942015-01-28 10:07:51 -0800187 unsigned char reply[16];
188 int track;
189 int resultcode;
190 int reserved1;
Tao Baod7db5942015-01-28 10:07:51 -0800191 int reserved2;
Christopher Ferris38062f92014-07-09 15:33:25 -0700192};
Ben Cheng655a7c02013-10-16 16:09:24 -0700193#define FDRAWCMD _IO(2, 0x58)
194#define FDTWADDLE _IO(2, 0x59)
Tao Baod7db5942015-01-28 10:07:51 -0800195#define FDEJECT _IO(2, 0x5a)
Christopher Ferris38062f92014-07-09 15:33:25 -0700196#endif