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>
23struct floppy_struct {
24  unsigned int size, sect, head, track, stretch;
25#define FD_STRETCH 1
26#define FD_SWAPSIDES 2
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)
31  unsigned char gap, rate,
32#define FD_2M 0x4
33#define FD_SIZECODEMASK 0x38
34#define FD_SIZECODE(floppy) (((((floppy)->rate & FD_SIZECODEMASK) >> 3) + 2) % 8)
35#define FD_SECTSIZE(floppy) ((floppy)->rate & FD_2M ? 512 : 128 << FD_SIZECODE(floppy))
36#define FD_PERP 0x40
37  spec1, fmt_gap;
38  const char * name;
39};
40#define FDCLRPRM _IO(2, 0x41)
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)
45#define FDDEFMEDIAPRM FDDEFPRM
46#define FDGETMEDIAPRM FDGETPRM
47#define FDMSGON _IO(2, 0x45)
48#define FDMSGOFF _IO(2, 0x46)
49#define FD_FILL_BYTE 0xF6
50struct format_descr {
51  unsigned int device, head, track;
52};
53#define FDFMTBEG _IO(2, 0x47)
54#define FDFMTTRK _IOW(2, 0x48, struct format_descr)
55#define FDFMTEND _IO(2, 0x49)
56struct floppy_max_errors {
57  unsigned int abort, read_track, reset, recal, reporting;
58};
59#define FDSETEMSGTRESH _IO(2, 0x4a)
60#define FDFLUSH _IO(2, 0x4b)
61#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
62#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
63typedef char floppy_drive_name[16];
64#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
65struct floppy_drive_params {
66  signed char cmos;
67  unsigned long max_dtr;
68  unsigned long hlt;
69  unsigned long hut;
70  unsigned long srt;
71  unsigned long spinup;
72  unsigned long spindown;
73  unsigned char spindown_offset;
74  unsigned char select_delay;
75  unsigned char rps;
76  unsigned char tracks;
77  unsigned long timeout;
78  unsigned char interleave_sect;
79  struct floppy_max_errors max_errors;
80  char flags;
81#define FTD_MSG 0x10
82#define FD_BROKEN_DCL 0x20
83#define FD_DEBUG 0x02
84#define FD_SILENT_DCL_CLEAR 0x4
85#define FD_INVERTED_DCL 0x80
86  char read_track;
87  short autodetect[8];
88  int checkfreq;
89  int native_format;
90};
91enum {
92  FD_NEED_TWADDLE_BIT,
93  FD_VERIFY_BIT,
94  FD_DISK_NEWCHANGE_BIT,
95  FD_UNUSED_BIT,
96  FD_DISK_CHANGED_BIT,
97  FD_DISK_WRITABLE_BIT,
98  FD_OPEN_SHOULD_FAIL_BIT
99};
100#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
101#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
102struct floppy_drive_struct {
103  unsigned long flags;
104#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
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)
108#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
109  unsigned long spinup_date;
110  unsigned long select_date;
111  unsigned long first_read_date;
112  short probed_format;
113  short track;
114  short maxblock;
115  short maxtrack;
116  int generation;
117  int keep_data;
118  int fd_ref;
119  int fd_device;
120  unsigned long last_checked;
121  char * dmabuf;
122  int bufblocks;
123};
124#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
125#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
126enum reset_mode {
127  FD_RESET_IF_NEEDED,
128  FD_RESET_IF_RAWCMD,
129  FD_RESET_ALWAYS
130};
131#define FDRESET _IO(2, 0x54)
132struct floppy_fdc_state {
133  int spec1;
134  int spec2;
135  int dtr;
136  unsigned char version;
137  unsigned char dor;
138  unsigned long address;
139  unsigned int rawcmd : 2;
140  unsigned int reset : 1;
141  unsigned int need_configure : 1;
142  unsigned int perp_mode : 2;
143  unsigned int has_fifo : 1;
144  unsigned int driver_version;
145#define FD_DRIVER_VERSION 0x100
146  unsigned char track[4];
147};
148#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
149struct floppy_write_errors {
150  unsigned int write_errors;
151  unsigned long first_error_sector;
152  int first_error_generation;
153  unsigned long last_error_sector;
154  int last_error_generation;
155  unsigned int badness;
156};
157#define FDWERRORCLR _IO(2, 0x56)
158#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
159#define FDHAVEBATCHEDRAWCMD
160struct floppy_raw_cmd {
161  unsigned int flags;
162#define FD_RAW_READ 1
163#define FD_RAW_WRITE 2
164#define FD_RAW_NO_MOTOR 4
165#define FD_RAW_DISK_CHANGE 4
166#define FD_RAW_INTR 8
167#define FD_RAW_SPIN 0x10
168#define FD_RAW_NO_MOTOR_AFTER 0x20
169#define FD_RAW_NEED_DISK 0x40
170#define FD_RAW_NEED_SEEK 0x80
171#define FD_RAW_MORE 0x100
172#define FD_RAW_STOP_IF_FAILURE 0x200
173#define FD_RAW_STOP_IF_SUCCESS 0x400
174#define FD_RAW_SOFTFAILURE 0x800
175#define FD_RAW_FAILURE 0x10000
176#define FD_RAW_HARDFAILURE 0x20000
177  void __user * data;
178  char * kernel_data;
179  struct floppy_raw_cmd * next;
180  long length;
181  long phys_length;
182  int buffer_length;
183  unsigned char rate;
184  unsigned char cmd_count;
185  unsigned char cmd[16];
186  unsigned char reply_count;
187  unsigned char reply[16];
188  int track;
189  int resultcode;
190  int reserved1;
191  int reserved2;
192};
193#define FDRAWCMD _IO(2, 0x58)
194#define FDTWADDLE _IO(2, 0x59)
195#define FDEJECT _IO(2, 0x5a)
196#endif
197