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 _LINUX_HDREG_H
20#define _LINUX_HDREG_H
21#include <linux/types.h>
22#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8))
23#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
24#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
25#define IDE_DRIVE_TASK_NO_DATA 0
26#define IDE_DRIVE_TASK_INVALID - 1
27#define IDE_DRIVE_TASK_SET_XFER 1
28#define IDE_DRIVE_TASK_IN 2
29#define IDE_DRIVE_TASK_OUT 3
30#define IDE_DRIVE_TASK_RAW_WRITE 4
31#define IDE_TASKFILE_STD_IN_FLAGS 0xFE
32#define IDE_HOB_STD_IN_FLAGS 0x3C
33#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
34#define IDE_HOB_STD_OUT_FLAGS 0x3C
35typedef unsigned char task_ioreg_t;
36typedef unsigned long sata_ioreg_t;
37typedef union ide_reg_valid_s {
38  unsigned all : 16;
39  struct {
40    unsigned data : 1;
41    unsigned error_feature : 1;
42    unsigned sector : 1;
43    unsigned nsector : 1;
44    unsigned lcyl : 1;
45    unsigned hcyl : 1;
46    unsigned select : 1;
47    unsigned status_command : 1;
48    unsigned data_hob : 1;
49    unsigned error_feature_hob : 1;
50    unsigned sector_hob : 1;
51    unsigned nsector_hob : 1;
52    unsigned lcyl_hob : 1;
53    unsigned hcyl_hob : 1;
54    unsigned select_hob : 1;
55    unsigned control_hob : 1;
56  } b;
57} ide_reg_valid_t;
58typedef struct ide_task_request_s {
59  __u8 io_ports[8];
60  __u8 hob_ports[8];
61  ide_reg_valid_t out_flags;
62  ide_reg_valid_t in_flags;
63  int data_phase;
64  int req_cmd;
65  unsigned long out_size;
66  unsigned long in_size;
67} ide_task_request_t;
68typedef struct ide_ioctl_request_s {
69  ide_task_request_t * task_request;
70  unsigned char * out_buffer;
71  unsigned char * in_buffer;
72} ide_ioctl_request_t;
73struct hd_drive_cmd_hdr {
74  __u8 command;
75  __u8 sector_number;
76  __u8 feature;
77  __u8 sector_count;
78};
79typedef struct hd_drive_task_hdr {
80  __u8 data;
81  __u8 feature;
82  __u8 sector_count;
83  __u8 sector_number;
84  __u8 low_cylinder;
85  __u8 high_cylinder;
86  __u8 device_head;
87  __u8 command;
88} task_struct_t;
89typedef struct hd_drive_hob_hdr {
90  __u8 data;
91  __u8 feature;
92  __u8 sector_count;
93  __u8 sector_number;
94  __u8 low_cylinder;
95  __u8 high_cylinder;
96  __u8 device_head;
97  __u8 control;
98} hob_struct_t;
99#define TASKFILE_NO_DATA 0x0000
100#define TASKFILE_IN 0x0001
101#define TASKFILE_MULTI_IN 0x0002
102#define TASKFILE_OUT 0x0004
103#define TASKFILE_MULTI_OUT 0x0008
104#define TASKFILE_IN_OUT 0x0010
105#define TASKFILE_IN_DMA 0x0020
106#define TASKFILE_OUT_DMA 0x0040
107#define TASKFILE_IN_DMAQ 0x0080
108#define TASKFILE_OUT_DMAQ 0x0100
109#define TASKFILE_P_IN 0x0200
110#define TASKFILE_P_OUT 0x0400
111#define TASKFILE_P_IN_DMA 0x0800
112#define TASKFILE_P_OUT_DMA 0x1000
113#define TASKFILE_P_IN_DMAQ 0x2000
114#define TASKFILE_P_OUT_DMAQ 0x4000
115#define TASKFILE_48 0x8000
116#define TASKFILE_INVALID 0x7fff
117#define WIN_NOP 0x00
118#define CFA_REQ_EXT_ERROR_CODE 0x03
119#define WIN_SRST 0x08
120#define WIN_DEVICE_RESET 0x08
121#define WIN_RECAL 0x10
122#define WIN_RESTORE WIN_RECAL
123#define WIN_READ 0x20
124#define WIN_READ_ONCE 0x21
125#define WIN_READ_LONG 0x22
126#define WIN_READ_LONG_ONCE 0x23
127#define WIN_READ_EXT 0x24
128#define WIN_READDMA_EXT 0x25
129#define WIN_READDMA_QUEUED_EXT 0x26
130#define WIN_READ_NATIVE_MAX_EXT 0x27
131#define WIN_MULTREAD_EXT 0x29
132#define WIN_WRITE 0x30
133#define WIN_WRITE_ONCE 0x31
134#define WIN_WRITE_LONG 0x32
135#define WIN_WRITE_LONG_ONCE 0x33
136#define WIN_WRITE_EXT 0x34
137#define WIN_WRITEDMA_EXT 0x35
138#define WIN_WRITEDMA_QUEUED_EXT 0x36
139#define WIN_SET_MAX_EXT 0x37
140#define CFA_WRITE_SECT_WO_ERASE 0x38
141#define WIN_MULTWRITE_EXT 0x39
142#define WIN_WRITE_VERIFY 0x3C
143#define WIN_VERIFY 0x40
144#define WIN_VERIFY_ONCE 0x41
145#define WIN_VERIFY_EXT 0x42
146#define WIN_FORMAT 0x50
147#define WIN_INIT 0x60
148#define WIN_SEEK 0x70
149#define CFA_TRANSLATE_SECTOR 0x87
150#define WIN_DIAGNOSE 0x90
151#define WIN_SPECIFY 0x91
152#define WIN_DOWNLOAD_MICROCODE 0x92
153#define WIN_STANDBYNOW2 0x94
154#define WIN_STANDBY2 0x96
155#define WIN_SETIDLE2 0x97
156#define WIN_CHECKPOWERMODE2 0x98
157#define WIN_SLEEPNOW2 0x99
158#define WIN_PACKETCMD 0xA0
159#define WIN_PIDENTIFY 0xA1
160#define WIN_QUEUED_SERVICE 0xA2
161#define WIN_SMART 0xB0
162#define CFA_ERASE_SECTORS 0xC0
163#define WIN_MULTREAD 0xC4
164#define WIN_MULTWRITE 0xC5
165#define WIN_SETMULT 0xC6
166#define WIN_READDMA_QUEUED 0xC7
167#define WIN_READDMA 0xC8
168#define WIN_READDMA_ONCE 0xC9
169#define WIN_WRITEDMA 0xCA
170#define WIN_WRITEDMA_ONCE 0xCB
171#define WIN_WRITEDMA_QUEUED 0xCC
172#define CFA_WRITE_MULTI_WO_ERASE 0xCD
173#define WIN_GETMEDIASTATUS 0xDA
174#define WIN_ACKMEDIACHANGE 0xDB
175#define WIN_POSTBOOT 0xDC
176#define WIN_PREBOOT 0xDD
177#define WIN_DOORLOCK 0xDE
178#define WIN_DOORUNLOCK 0xDF
179#define WIN_STANDBYNOW1 0xE0
180#define WIN_IDLEIMMEDIATE 0xE1
181#define WIN_STANDBY 0xE2
182#define WIN_SETIDLE1 0xE3
183#define WIN_READ_BUFFER 0xE4
184#define WIN_CHECKPOWERMODE1 0xE5
185#define WIN_SLEEPNOW1 0xE6
186#define WIN_FLUSH_CACHE 0xE7
187#define WIN_WRITE_BUFFER 0xE8
188#define WIN_WRITE_SAME 0xE9
189#define WIN_FLUSH_CACHE_EXT 0xEA
190#define WIN_IDENTIFY 0xEC
191#define WIN_MEDIAEJECT 0xED
192#define WIN_IDENTIFY_DMA 0xEE
193#define WIN_SETFEATURES 0xEF
194#define EXABYTE_ENABLE_NEST 0xF0
195#define WIN_SECURITY_SET_PASS 0xF1
196#define WIN_SECURITY_UNLOCK 0xF2
197#define WIN_SECURITY_ERASE_PREPARE 0xF3
198#define WIN_SECURITY_ERASE_UNIT 0xF4
199#define WIN_SECURITY_FREEZE_LOCK 0xF5
200#define WIN_SECURITY_DISABLE 0xF6
201#define WIN_READ_NATIVE_MAX 0xF8
202#define WIN_SET_MAX 0xF9
203#define DISABLE_SEAGATE 0xFB
204#define SMART_READ_VALUES 0xD0
205#define SMART_READ_THRESHOLDS 0xD1
206#define SMART_AUTOSAVE 0xD2
207#define SMART_SAVE 0xD3
208#define SMART_IMMEDIATE_OFFLINE 0xD4
209#define SMART_READ_LOG_SECTOR 0xD5
210#define SMART_WRITE_LOG_SECTOR 0xD6
211#define SMART_WRITE_THRESHOLDS 0xD7
212#define SMART_ENABLE 0xD8
213#define SMART_DISABLE 0xD9
214#define SMART_STATUS 0xDA
215#define SMART_AUTO_OFFLINE 0xDB
216#define SMART_LCYL_PASS 0x4F
217#define SMART_HCYL_PASS 0xC2
218#define SETFEATURES_EN_8BIT 0x01
219#define SETFEATURES_EN_WCACHE 0x02
220#define SETFEATURES_DIS_DEFECT 0x04
221#define SETFEATURES_EN_APM 0x05
222#define SETFEATURES_EN_SAME_R 0x22
223#define SETFEATURES_DIS_MSN 0x31
224#define SETFEATURES_DIS_RETRY 0x33
225#define SETFEATURES_EN_AAM 0x42
226#define SETFEATURES_RW_LONG 0x44
227#define SETFEATURES_SET_CACHE 0x54
228#define SETFEATURES_DIS_RLA 0x55
229#define SETFEATURES_EN_RI 0x5D
230#define SETFEATURES_EN_SI 0x5E
231#define SETFEATURES_DIS_RPOD 0x66
232#define SETFEATURES_DIS_ECC 0x77
233#define SETFEATURES_DIS_8BIT 0x81
234#define SETFEATURES_DIS_WCACHE 0x82
235#define SETFEATURES_EN_DEFECT 0x84
236#define SETFEATURES_DIS_APM 0x85
237#define SETFEATURES_EN_ECC 0x88
238#define SETFEATURES_EN_MSN 0x95
239#define SETFEATURES_EN_RETRY 0x99
240#define SETFEATURES_EN_RLA 0xAA
241#define SETFEATURES_PREFETCH 0xAB
242#define SETFEATURES_EN_REST 0xAC
243#define SETFEATURES_4B_RW_LONG 0xBB
244#define SETFEATURES_DIS_AAM 0xC2
245#define SETFEATURES_EN_RPOD 0xCC
246#define SETFEATURES_DIS_RI 0xDD
247#define SETFEATURES_EN_SAME_M 0xDD
248#define SETFEATURES_DIS_SI 0xDE
249#define SECURITY_SET_PASSWORD 0xBA
250#define SECURITY_UNLOCK 0xBB
251#define SECURITY_ERASE_PREPARE 0xBC
252#define SECURITY_ERASE_UNIT 0xBD
253#define SECURITY_FREEZE_LOCK 0xBE
254#define SECURITY_DISABLE_PASSWORD 0xBF
255struct hd_geometry {
256  unsigned char heads;
257  unsigned char sectors;
258  unsigned short cylinders;
259  unsigned long start;
260};
261#define HDIO_GETGEO 0x0301
262#define HDIO_GET_UNMASKINTR 0x0302
263#define HDIO_GET_MULTCOUNT 0x0304
264#define HDIO_GET_QDMA 0x0305
265#define HDIO_SET_XFER 0x0306
266#define HDIO_OBSOLETE_IDENTITY 0x0307
267#define HDIO_GET_KEEPSETTINGS 0x0308
268#define HDIO_GET_32BIT 0x0309
269#define HDIO_GET_NOWERR 0x030a
270#define HDIO_GET_DMA 0x030b
271#define HDIO_GET_NICE 0x030c
272#define HDIO_GET_IDENTITY 0x030d
273#define HDIO_GET_WCACHE 0x030e
274#define HDIO_GET_ACOUSTIC 0x030f
275#define HDIO_GET_ADDRESS 0x0310
276#define HDIO_GET_BUSSTATE 0x031a
277#define HDIO_TRISTATE_HWIF 0x031b
278#define HDIO_DRIVE_RESET 0x031c
279#define HDIO_DRIVE_TASKFILE 0x031d
280#define HDIO_DRIVE_TASK 0x031e
281#define HDIO_DRIVE_CMD 0x031f
282#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
283#define HDIO_SET_MULTCOUNT 0x0321
284#define HDIO_SET_UNMASKINTR 0x0322
285#define HDIO_SET_KEEPSETTINGS 0x0323
286#define HDIO_SET_32BIT 0x0324
287#define HDIO_SET_NOWERR 0x0325
288#define HDIO_SET_DMA 0x0326
289#define HDIO_SET_PIO_MODE 0x0327
290#define HDIO_SCAN_HWIF 0x0328
291#define HDIO_UNREGISTER_HWIF 0x032a
292#define HDIO_SET_NICE 0x0329
293#define HDIO_SET_WCACHE 0x032b
294#define HDIO_SET_ACOUSTIC 0x032c
295#define HDIO_SET_BUSSTATE 0x032d
296#define HDIO_SET_QDMA 0x032e
297#define HDIO_SET_ADDRESS 0x032f
298enum {
299  BUSSTATE_OFF = 0,
300  BUSSTATE_ON,
301  BUSSTATE_TRISTATE
302};
303#define __NEW_HD_DRIVE_ID
304struct hd_driveid {
305  unsigned short config;
306  unsigned short cyls;
307  unsigned short reserved2;
308  unsigned short heads;
309  unsigned short track_bytes;
310  unsigned short sector_bytes;
311  unsigned short sectors;
312  unsigned short vendor0;
313  unsigned short vendor1;
314  unsigned short vendor2;
315  unsigned char serial_no[20];
316  unsigned short buf_type;
317  unsigned short buf_size;
318  unsigned short ecc_bytes;
319  unsigned char fw_rev[8];
320  unsigned char model[40];
321  unsigned char max_multsect;
322  unsigned char vendor3;
323  unsigned short dword_io;
324  unsigned char vendor4;
325  unsigned char capability;
326  unsigned short reserved50;
327  unsigned char vendor5;
328  unsigned char tPIO;
329  unsigned char vendor6;
330  unsigned char tDMA;
331  unsigned short field_valid;
332  unsigned short cur_cyls;
333  unsigned short cur_heads;
334  unsigned short cur_sectors;
335  unsigned short cur_capacity0;
336  unsigned short cur_capacity1;
337  unsigned char multsect;
338  unsigned char multsect_valid;
339  unsigned int lba_capacity;
340  unsigned short dma_1word;
341  unsigned short dma_mword;
342  unsigned short eide_pio_modes;
343  unsigned short eide_dma_min;
344  unsigned short eide_dma_time;
345  unsigned short eide_pio;
346  unsigned short eide_pio_iordy;
347  unsigned short words69_70[2];
348  unsigned short words71_74[4];
349  unsigned short queue_depth;
350  unsigned short words76_79[4];
351  unsigned short major_rev_num;
352  unsigned short minor_rev_num;
353  unsigned short command_set_1;
354  unsigned short command_set_2;
355  unsigned short cfsse;
356  unsigned short cfs_enable_1;
357  unsigned short cfs_enable_2;
358  unsigned short csf_default;
359  unsigned short dma_ultra;
360  unsigned short trseuc;
361  unsigned short trsEuc;
362  unsigned short CurAPMvalues;
363  unsigned short mprc;
364  unsigned short hw_config;
365  unsigned short acoustic;
366  unsigned short msrqs;
367  unsigned short sxfert;
368  unsigned short sal;
369  unsigned int spg;
370  unsigned long long lba_capacity_2;
371  unsigned short words104_125[22];
372  unsigned short last_lun;
373  unsigned short word127;
374  unsigned short dlf;
375  unsigned short csfo;
376  unsigned short words130_155[26];
377  unsigned short word156;
378  unsigned short words157_159[3];
379  unsigned short cfa_power;
380  unsigned short words161_175[15];
381  unsigned short words176_205[30];
382  unsigned short words206_254[49];
383  unsigned short integrity_word;
384};
385#define IDE_NICE_DSC_OVERLAP (0)
386#define IDE_NICE_ATAPI_OVERLAP (1)
387#define IDE_NICE_1 (3)
388#define IDE_NICE_0 (2)
389#define IDE_NICE_2 (4)
390#endif
391