blob: 4d72d6954396759ff716c0a6d31276d13bb0a6f0 [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;
Christopher Ferris8177cdf2020-08-03 11:53:55 -070087#define FD_AUTODETECT_SIZE 8
88 short autodetect[FD_AUTODETECT_SIZE];
Tao Baod7db5942015-01-28 10:07:51 -080089 int checkfreq;
90 int native_format;
Ben Cheng655a7c02013-10-16 16:09:24 -070091};
92enum {
Tao Baod7db5942015-01-28 10:07:51 -080093 FD_NEED_TWADDLE_BIT,
94 FD_VERIFY_BIT,
95 FD_DISK_NEWCHANGE_BIT,
Tao Baod7db5942015-01-28 10:07:51 -080096 FD_UNUSED_BIT,
97 FD_DISK_CHANGED_BIT,
98 FD_DISK_WRITABLE_BIT,
99 FD_OPEN_SHOULD_FAIL_BIT
Ben Cheng655a7c02013-10-16 16:09:24 -0700100};
Christopher Ferris38062f92014-07-09 15:33:25 -0700101#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
Ben Cheng655a7c02013-10-16 16:09:24 -0700102#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
103struct floppy_drive_struct {
Tao Baod7db5942015-01-28 10:07:51 -0800104 unsigned long flags;
Christopher Ferris38062f92014-07-09 15:33:25 -0700105#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
Ben Cheng655a7c02013-10-16 16:09:24 -0700106#define FD_VERIFY (1 << FD_VERIFY_BIT)
107#define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
108#define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
Christopher Ferris38062f92014-07-09 15:33:25 -0700109#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
Tao Baod7db5942015-01-28 10:07:51 -0800110 unsigned long spinup_date;
111 unsigned long select_date;
Tao Baod7db5942015-01-28 10:07:51 -0800112 unsigned long first_read_date;
113 short probed_format;
114 short track;
115 short maxblock;
Tao Baod7db5942015-01-28 10:07:51 -0800116 short maxtrack;
117 int generation;
118 int keep_data;
119 int fd_ref;
Tao Baod7db5942015-01-28 10:07:51 -0800120 int fd_device;
121 unsigned long last_checked;
122 char * dmabuf;
123 int bufblocks;
Ben Cheng655a7c02013-10-16 16:09:24 -0700124};
Christopher Ferris38062f92014-07-09 15:33:25 -0700125#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
Ben Cheng655a7c02013-10-16 16:09:24 -0700126#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
127enum reset_mode {
Tao Baod7db5942015-01-28 10:07:51 -0800128 FD_RESET_IF_NEEDED,
129 FD_RESET_IF_RAWCMD,
130 FD_RESET_ALWAYS
Ben Cheng655a7c02013-10-16 16:09:24 -0700131};
132#define FDRESET _IO(2, 0x54)
Christopher Ferris38062f92014-07-09 15:33:25 -0700133struct floppy_fdc_state {
Tao Baod7db5942015-01-28 10:07:51 -0800134 int spec1;
135 int spec2;
Tao Baod7db5942015-01-28 10:07:51 -0800136 int dtr;
137 unsigned char version;
138 unsigned char dor;
139 unsigned long address;
Tao Baod7db5942015-01-28 10:07:51 -0800140 unsigned int rawcmd : 2;
141 unsigned int reset : 1;
142 unsigned int need_configure : 1;
143 unsigned int perp_mode : 2;
Tao Baod7db5942015-01-28 10:07:51 -0800144 unsigned int has_fifo : 1;
145 unsigned int driver_version;
Ben Cheng655a7c02013-10-16 16:09:24 -0700146#define FD_DRIVER_VERSION 0x100
Tao Baod7db5942015-01-28 10:07:51 -0800147 unsigned char track[4];
Tao Baod7db5942015-01-28 10:07:51 -0800148};
Christopher Ferris38062f92014-07-09 15:33:25 -0700149#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
Ben Cheng655a7c02013-10-16 16:09:24 -0700150struct floppy_write_errors {
Tao Baod7db5942015-01-28 10:07:51 -0800151 unsigned int write_errors;
Tao Baod7db5942015-01-28 10:07:51 -0800152 unsigned long first_error_sector;
153 int first_error_generation;
154 unsigned long last_error_sector;
155 int last_error_generation;
Tao Baod7db5942015-01-28 10:07:51 -0800156 unsigned int badness;
Christopher Ferris38062f92014-07-09 15:33:25 -0700157};
Ben Cheng655a7c02013-10-16 16:09:24 -0700158#define FDWERRORCLR _IO(2, 0x56)
159#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
160#define FDHAVEBATCHEDRAWCMD
Christopher Ferris38062f92014-07-09 15:33:25 -0700161struct floppy_raw_cmd {
Tao Baod7db5942015-01-28 10:07:51 -0800162 unsigned int flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700163#define FD_RAW_READ 1
Tao Baod7db5942015-01-28 10:07:51 -0800164#define FD_RAW_WRITE 2
Christopher Ferris38062f92014-07-09 15:33:25 -0700165#define FD_RAW_NO_MOTOR 4
Ben Cheng655a7c02013-10-16 16:09:24 -0700166#define FD_RAW_DISK_CHANGE 4
167#define FD_RAW_INTR 8
Tao Baod7db5942015-01-28 10:07:51 -0800168#define FD_RAW_SPIN 0x10
Christopher Ferris38062f92014-07-09 15:33:25 -0700169#define FD_RAW_NO_MOTOR_AFTER 0x20
Ben Cheng655a7c02013-10-16 16:09:24 -0700170#define FD_RAW_NEED_DISK 0x40
171#define FD_RAW_NEED_SEEK 0x80
Tao Baod7db5942015-01-28 10:07:51 -0800172#define FD_RAW_MORE 0x100
Christopher Ferris38062f92014-07-09 15:33:25 -0700173#define FD_RAW_STOP_IF_FAILURE 0x200
Ben Cheng655a7c02013-10-16 16:09:24 -0700174#define FD_RAW_STOP_IF_SUCCESS 0x400
175#define FD_RAW_SOFTFAILURE 0x800
176#define FD_RAW_FAILURE 0x10000
Christopher Ferris38062f92014-07-09 15:33:25 -0700177#define FD_RAW_HARDFAILURE 0x20000
Tao Baod7db5942015-01-28 10:07:51 -0800178 void __user * data;
179 char * kernel_data;
Tao Baod7db5942015-01-28 10:07:51 -0800180 struct floppy_raw_cmd * next;
181 long length;
182 long phys_length;
183 int buffer_length;
Tao Baod7db5942015-01-28 10:07:51 -0800184 unsigned char rate;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700185#define FD_RAW_CMD_SIZE 16
186#define FD_RAW_REPLY_SIZE 16
187#define FD_RAW_CMD_FULLSIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_REPLY_SIZE)
Tao Baod7db5942015-01-28 10:07:51 -0800188 unsigned char cmd_count;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700189 union {
190 struct {
191 unsigned char cmd[FD_RAW_CMD_SIZE];
192 unsigned char reply_count;
193 unsigned char reply[FD_RAW_REPLY_SIZE];
194 };
195 unsigned char fullcmd[FD_RAW_CMD_FULLSIZE];
196 };
Tao Baod7db5942015-01-28 10:07:51 -0800197 int track;
198 int resultcode;
199 int reserved1;
Tao Baod7db5942015-01-28 10:07:51 -0800200 int reserved2;
Christopher Ferris38062f92014-07-09 15:33:25 -0700201};
Ben Cheng655a7c02013-10-16 16:09:24 -0700202#define FDRAWCMD _IO(2, 0x58)
203#define FDTWADDLE _IO(2, 0x59)
Tao Baod7db5942015-01-28 10:07:51 -0800204#define FDEJECT _IO(2, 0x5a)
Christopher Ferris38062f92014-07-09 15:33:25 -0700205#endif