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