1 |
13 |
serginhofr |
#ifndef _LINUX_HDREG_H
|
2 |
|
|
#define _LINUX_HDREG_H
|
3 |
|
|
|
4 |
|
|
#include <linux/types.h>
|
5 |
|
|
|
6 |
|
|
/*
|
7 |
|
|
* Command Header sizes for IOCTL commands
|
8 |
|
|
*/
|
9 |
|
|
|
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 |
|
|
|
14 |
|
|
#define IDE_DRIVE_TASK_NO_DATA 0
|
15 |
|
|
#define IDE_DRIVE_TASK_INVALID -1
|
16 |
|
|
#define IDE_DRIVE_TASK_SET_XFER 1
|
17 |
|
|
#define IDE_DRIVE_TASK_IN 2
|
18 |
|
|
#define IDE_DRIVE_TASK_OUT 3
|
19 |
|
|
#define IDE_DRIVE_TASK_RAW_WRITE 4
|
20 |
|
|
|
21 |
|
|
/*
|
22 |
|
|
* Define standard taskfile in/out register
|
23 |
|
|
*/
|
24 |
|
|
#define IDE_TASKFILE_STD_IN_FLAGS 0xFE
|
25 |
|
|
#define IDE_HOB_STD_IN_FLAGS 0x3C
|
26 |
|
|
#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
|
27 |
|
|
#define IDE_HOB_STD_OUT_FLAGS 0x3C
|
28 |
|
|
|
29 |
|
|
typedef unsigned char task_ioreg_t;
|
30 |
|
|
typedef unsigned long sata_ioreg_t;
|
31 |
|
|
|
32 |
|
|
typedef union ide_reg_valid_s {
|
33 |
|
|
unsigned all : 16;
|
34 |
|
|
struct {
|
35 |
|
|
unsigned data : 1;
|
36 |
|
|
unsigned error_feature : 1;
|
37 |
|
|
unsigned sector : 1;
|
38 |
|
|
unsigned nsector : 1;
|
39 |
|
|
unsigned lcyl : 1;
|
40 |
|
|
unsigned hcyl : 1;
|
41 |
|
|
unsigned select : 1;
|
42 |
|
|
unsigned status_command : 1;
|
43 |
|
|
|
44 |
|
|
unsigned data_hob : 1;
|
45 |
|
|
unsigned error_feature_hob : 1;
|
46 |
|
|
unsigned sector_hob : 1;
|
47 |
|
|
unsigned nsector_hob : 1;
|
48 |
|
|
unsigned lcyl_hob : 1;
|
49 |
|
|
unsigned hcyl_hob : 1;
|
50 |
|
|
unsigned select_hob : 1;
|
51 |
|
|
unsigned control_hob : 1;
|
52 |
|
|
} b;
|
53 |
|
|
} ide_reg_valid_t;
|
54 |
|
|
|
55 |
|
|
typedef struct ide_task_request_s {
|
56 |
|
|
__u8 io_ports[8];
|
57 |
|
|
__u8 hob_ports[8]; /* bytes 6 and 7 are unused */
|
58 |
|
|
ide_reg_valid_t out_flags;
|
59 |
|
|
ide_reg_valid_t in_flags;
|
60 |
|
|
int data_phase;
|
61 |
|
|
int req_cmd;
|
62 |
|
|
unsigned long out_size;
|
63 |
|
|
unsigned long in_size;
|
64 |
|
|
} ide_task_request_t;
|
65 |
|
|
|
66 |
|
|
typedef struct ide_ioctl_request_s {
|
67 |
|
|
ide_task_request_t *task_request;
|
68 |
|
|
unsigned char *out_buffer;
|
69 |
|
|
unsigned char *in_buffer;
|
70 |
|
|
} ide_ioctl_request_t;
|
71 |
|
|
|
72 |
|
|
struct hd_drive_cmd_hdr {
|
73 |
|
|
__u8 command;
|
74 |
|
|
__u8 sector_number;
|
75 |
|
|
__u8 feature;
|
76 |
|
|
__u8 sector_count;
|
77 |
|
|
};
|
78 |
|
|
|
79 |
|
|
typedef 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;
|
89 |
|
|
|
90 |
|
|
typedef struct hd_drive_hob_hdr {
|
91 |
|
|
__u8 data;
|
92 |
|
|
__u8 feature;
|
93 |
|
|
__u8 sector_count;
|
94 |
|
|
__u8 sector_number;
|
95 |
|
|
__u8 low_cylinder;
|
96 |
|
|
__u8 high_cylinder;
|
97 |
|
|
__u8 device_head;
|
98 |
|
|
__u8 control;
|
99 |
|
|
} hob_struct_t;
|
100 |
|
|
|
101 |
|
|
#define TASKFILE_NO_DATA 0x0000
|
102 |
|
|
|
103 |
|
|
#define TASKFILE_IN 0x0001
|
104 |
|
|
#define TASKFILE_MULTI_IN 0x0002
|
105 |
|
|
|
106 |
|
|
#define TASKFILE_OUT 0x0004
|
107 |
|
|
#define TASKFILE_MULTI_OUT 0x0008
|
108 |
|
|
#define TASKFILE_IN_OUT 0x0010
|
109 |
|
|
|
110 |
|
|
#define TASKFILE_IN_DMA 0x0020
|
111 |
|
|
#define TASKFILE_OUT_DMA 0x0040
|
112 |
|
|
#define TASKFILE_IN_DMAQ 0x0080
|
113 |
|
|
#define TASKFILE_OUT_DMAQ 0x0100
|
114 |
|
|
|
115 |
|
|
#define TASKFILE_P_IN 0x0200
|
116 |
|
|
#define TASKFILE_P_OUT 0x0400
|
117 |
|
|
#define TASKFILE_P_IN_DMA 0x0800
|
118 |
|
|
#define TASKFILE_P_OUT_DMA 0x1000
|
119 |
|
|
#define TASKFILE_P_IN_DMAQ 0x2000
|
120 |
|
|
#define TASKFILE_P_OUT_DMAQ 0x4000
|
121 |
|
|
#define TASKFILE_48 0x8000
|
122 |
|
|
#define TASKFILE_INVALID 0x7fff
|
123 |
|
|
|
124 |
|
|
/* ATA/ATAPI Commands pre T13 Spec */
|
125 |
|
|
#define WIN_NOP 0x00
|
126 |
|
|
/*
|
127 |
|
|
* 0x01->0x02 Reserved
|
128 |
|
|
*/
|
129 |
|
|
#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */
|
130 |
|
|
/*
|
131 |
|
|
* 0x04->0x07 Reserved
|
132 |
|
|
*/
|
133 |
|
|
#define WIN_SRST 0x08 /* ATAPI soft reset command */
|
134 |
|
|
#define WIN_DEVICE_RESET 0x08
|
135 |
|
|
/*
|
136 |
|
|
* 0x09->0x0F Reserved
|
137 |
|
|
*/
|
138 |
|
|
#define WIN_RECAL 0x10
|
139 |
|
|
#define WIN_RESTORE WIN_RECAL
|
140 |
|
|
/*
|
141 |
|
|
* 0x10->0x1F Reserved
|
142 |
|
|
*/
|
143 |
|
|
#define WIN_READ 0x20 /* 28-Bit */
|
144 |
|
|
#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */
|
145 |
|
|
#define WIN_READ_LONG 0x22 /* 28-Bit */
|
146 |
|
|
#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */
|
147 |
|
|
#define WIN_READ_EXT 0x24 /* 48-Bit */
|
148 |
|
|
#define WIN_READDMA_EXT 0x25 /* 48-Bit */
|
149 |
|
|
#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */
|
150 |
|
|
#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */
|
151 |
|
|
/*
|
152 |
|
|
* 0x28
|
153 |
|
|
*/
|
154 |
|
|
#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */
|
155 |
|
|
/*
|
156 |
|
|
* 0x2A->0x2F Reserved
|
157 |
|
|
*/
|
158 |
|
|
#define WIN_WRITE 0x30 /* 28-Bit */
|
159 |
|
|
#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */
|
160 |
|
|
#define WIN_WRITE_LONG 0x32 /* 28-Bit */
|
161 |
|
|
#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */
|
162 |
|
|
#define WIN_WRITE_EXT 0x34 /* 48-Bit */
|
163 |
|
|
#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */
|
164 |
|
|
#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */
|
165 |
|
|
#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */
|
166 |
|
|
#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */
|
167 |
|
|
#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */
|
168 |
|
|
/*
|
169 |
|
|
* 0x3A->0x3B Reserved
|
170 |
|
|
*/
|
171 |
|
|
#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */
|
172 |
|
|
/*
|
173 |
|
|
* 0x3D->0x3F Reserved
|
174 |
|
|
*/
|
175 |
|
|
#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */
|
176 |
|
|
#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */
|
177 |
|
|
#define WIN_VERIFY_EXT 0x42 /* 48-Bit */
|
178 |
|
|
/*
|
179 |
|
|
* 0x43->0x4F Reserved
|
180 |
|
|
*/
|
181 |
|
|
#define WIN_FORMAT 0x50
|
182 |
|
|
/*
|
183 |
|
|
* 0x51->0x5F Reserved
|
184 |
|
|
*/
|
185 |
|
|
#define WIN_INIT 0x60
|
186 |
|
|
/*
|
187 |
|
|
* 0x61->0x5F Reserved
|
188 |
|
|
*/
|
189 |
|
|
#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */
|
190 |
|
|
|
191 |
|
|
#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */
|
192 |
|
|
#define WIN_DIAGNOSE 0x90
|
193 |
|
|
#define WIN_SPECIFY 0x91 /* set drive geometry translation */
|
194 |
|
|
#define WIN_DOWNLOAD_MICROCODE 0x92
|
195 |
|
|
#define WIN_STANDBYNOW2 0x94
|
196 |
|
|
#define WIN_STANDBY2 0x96
|
197 |
|
|
#define WIN_SETIDLE2 0x97
|
198 |
|
|
#define WIN_CHECKPOWERMODE2 0x98
|
199 |
|
|
#define WIN_SLEEPNOW2 0x99
|
200 |
|
|
/*
|
201 |
|
|
* 0x9A VENDOR
|
202 |
|
|
*/
|
203 |
|
|
#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
|
204 |
|
|
#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
|
205 |
|
|
#define WIN_QUEUED_SERVICE 0xA2
|
206 |
|
|
#define WIN_SMART 0xB0 /* self-monitoring and reporting */
|
207 |
|
|
#define CFA_ERASE_SECTORS 0xC0
|
208 |
|
|
#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/
|
209 |
|
|
#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
|
210 |
|
|
#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
|
211 |
|
|
#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
|
212 |
|
|
#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
|
213 |
|
|
#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */
|
214 |
|
|
#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
|
215 |
|
|
#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */
|
216 |
|
|
#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
|
217 |
|
|
#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */
|
218 |
|
|
#define WIN_GETMEDIASTATUS 0xDA
|
219 |
|
|
#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */
|
220 |
|
|
#define WIN_POSTBOOT 0xDC
|
221 |
|
|
#define WIN_PREBOOT 0xDD
|
222 |
|
|
#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
|
223 |
|
|
#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
|
224 |
|
|
#define WIN_STANDBYNOW1 0xE0
|
225 |
|
|
#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
|
226 |
|
|
#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */
|
227 |
|
|
#define WIN_SETIDLE1 0xE3
|
228 |
|
|
#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
|
229 |
|
|
#define WIN_CHECKPOWERMODE1 0xE5
|
230 |
|
|
#define WIN_SLEEPNOW1 0xE6
|
231 |
|
|
#define WIN_FLUSH_CACHE 0xE7
|
232 |
|
|
#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
|
233 |
|
|
#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */
|
234 |
|
|
/* SET_FEATURES 0x22 or 0xDD */
|
235 |
|
|
#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */
|
236 |
|
|
#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
|
237 |
|
|
#define WIN_MEDIAEJECT 0xED
|
238 |
|
|
#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
|
239 |
|
|
#define WIN_SETFEATURES 0xEF /* set special drive features */
|
240 |
|
|
#define EXABYTE_ENABLE_NEST 0xF0
|
241 |
|
|
#define WIN_SECURITY_SET_PASS 0xF1
|
242 |
|
|
#define WIN_SECURITY_UNLOCK 0xF2
|
243 |
|
|
#define WIN_SECURITY_ERASE_PREPARE 0xF3
|
244 |
|
|
#define WIN_SECURITY_ERASE_UNIT 0xF4
|
245 |
|
|
#define WIN_SECURITY_FREEZE_LOCK 0xF5
|
246 |
|
|
#define WIN_SECURITY_DISABLE 0xF6
|
247 |
|
|
#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */
|
248 |
|
|
#define WIN_SET_MAX 0xF9
|
249 |
|
|
#define DISABLE_SEAGATE 0xFB
|
250 |
|
|
|
251 |
|
|
/* WIN_SMART sub-commands */
|
252 |
|
|
|
253 |
|
|
#define SMART_READ_VALUES 0xD0
|
254 |
|
|
#define SMART_READ_THRESHOLDS 0xD1
|
255 |
|
|
#define SMART_AUTOSAVE 0xD2
|
256 |
|
|
#define SMART_SAVE 0xD3
|
257 |
|
|
#define SMART_IMMEDIATE_OFFLINE 0xD4
|
258 |
|
|
#define SMART_READ_LOG_SECTOR 0xD5
|
259 |
|
|
#define SMART_WRITE_LOG_SECTOR 0xD6
|
260 |
|
|
#define SMART_WRITE_THRESHOLDS 0xD7
|
261 |
|
|
#define SMART_ENABLE 0xD8
|
262 |
|
|
#define SMART_DISABLE 0xD9
|
263 |
|
|
#define SMART_STATUS 0xDA
|
264 |
|
|
#define SMART_AUTO_OFFLINE 0xDB
|
265 |
|
|
|
266 |
|
|
/* Password used in TF4 & TF5 executing SMART commands */
|
267 |
|
|
|
268 |
|
|
#define SMART_LCYL_PASS 0x4F
|
269 |
|
|
#define SMART_HCYL_PASS 0xC2
|
270 |
|
|
|
271 |
|
|
/* WIN_SETFEATURES sub-commands */
|
272 |
|
|
#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */
|
273 |
|
|
#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
|
274 |
|
|
#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
|
275 |
|
|
#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */
|
276 |
|
|
#define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */
|
277 |
|
|
#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */
|
278 |
|
|
#define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */
|
279 |
|
|
#define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */
|
280 |
|
|
#define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */
|
281 |
|
|
#define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */
|
282 |
|
|
#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */
|
283 |
|
|
#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */
|
284 |
|
|
#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */
|
285 |
|
|
#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */
|
286 |
|
|
#define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */
|
287 |
|
|
#define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */
|
288 |
|
|
#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */
|
289 |
|
|
#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */
|
290 |
|
|
#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */
|
291 |
|
|
#define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */
|
292 |
|
|
#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */
|
293 |
|
|
#define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */
|
294 |
|
|
#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
|
295 |
|
|
#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
|
296 |
|
|
#define SETFEATURES_EN_REST 0xAC /* ATA-1 */
|
297 |
|
|
#define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */
|
298 |
|
|
#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */
|
299 |
|
|
#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
|
300 |
|
|
#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
|
301 |
|
|
#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */
|
302 |
|
|
#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */
|
303 |
|
|
|
304 |
|
|
/* WIN_SECURITY sub-commands */
|
305 |
|
|
|
306 |
|
|
#define SECURITY_SET_PASSWORD 0xBA
|
307 |
|
|
#define SECURITY_UNLOCK 0xBB
|
308 |
|
|
#define SECURITY_ERASE_PREPARE 0xBC
|
309 |
|
|
#define SECURITY_ERASE_UNIT 0xBD
|
310 |
|
|
#define SECURITY_FREEZE_LOCK 0xBE
|
311 |
|
|
#define SECURITY_DISABLE_PASSWORD 0xBF
|
312 |
|
|
|
313 |
|
|
struct hd_geometry {
|
314 |
|
|
unsigned char heads;
|
315 |
|
|
unsigned char sectors;
|
316 |
|
|
unsigned short cylinders;
|
317 |
|
|
unsigned long start;
|
318 |
|
|
};
|
319 |
|
|
|
320 |
|
|
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
|
321 |
|
|
#define HDIO_GETGEO 0x0301 /* get device geometry */
|
322 |
|
|
#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
|
323 |
|
|
#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
|
324 |
|
|
#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */
|
325 |
|
|
|
326 |
|
|
#define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */
|
327 |
|
|
|
328 |
|
|
#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
|
329 |
|
|
#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
|
330 |
|
|
#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
|
331 |
|
|
#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
|
332 |
|
|
#define HDIO_GET_DMA 0x030b /* get use-dma flag */
|
333 |
|
|
#define HDIO_GET_NICE 0x030c /* get nice flags */
|
334 |
|
|
#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
|
335 |
|
|
#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */
|
336 |
|
|
#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */
|
337 |
|
|
#define HDIO_GET_ADDRESS 0x0310 /* */
|
338 |
|
|
|
339 |
|
|
#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */
|
340 |
|
|
#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */
|
341 |
|
|
#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */
|
342 |
|
|
#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */
|
343 |
|
|
#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
|
344 |
|
|
#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
|
345 |
|
|
#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
|
346 |
|
|
|
347 |
|
|
/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
|
348 |
|
|
#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
|
349 |
|
|
#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
|
350 |
|
|
#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
|
351 |
|
|
#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
|
352 |
|
|
#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
|
353 |
|
|
#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
|
354 |
|
|
#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
|
355 |
|
|
#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
|
356 |
|
|
#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
|
357 |
|
|
#define HDIO_SET_NICE 0x0329 /* set nice flags */
|
358 |
|
|
#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
|
359 |
|
|
#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
|
360 |
|
|
#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
|
361 |
|
|
#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */
|
362 |
|
|
#define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */
|
363 |
|
|
|
364 |
|
|
/* bus states */
|
365 |
|
|
enum {
|
366 |
|
|
BUSSTATE_OFF = 0,
|
367 |
|
|
BUSSTATE_ON,
|
368 |
|
|
BUSSTATE_TRISTATE
|
369 |
|
|
};
|
370 |
|
|
|
371 |
|
|
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
|
372 |
|
|
/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */
|
373 |
|
|
/* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */
|
374 |
|
|
/* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */
|
375 |
|
|
/* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */
|
376 |
|
|
|
377 |
|
|
#define __NEW_HD_DRIVE_ID
|
378 |
|
|
|
379 |
|
|
/*
|
380 |
|
|
* Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec.
|
381 |
|
|
*
|
382 |
|
|
* If you change something here, please remember to update fix_driveid() in
|
383 |
|
|
* ide/probe.c.
|
384 |
|
|
*/
|
385 |
|
|
struct hd_driveid {
|
386 |
|
|
unsigned short config; /* lots of obsolete bit flags */
|
387 |
|
|
unsigned short cyls; /* Obsolete, "physical" cyls */
|
388 |
|
|
unsigned short reserved2; /* reserved (word 2) */
|
389 |
|
|
unsigned short heads; /* Obsolete, "physical" heads */
|
390 |
|
|
unsigned short track_bytes; /* unformatted bytes per track */
|
391 |
|
|
unsigned short sector_bytes; /* unformatted bytes per sector */
|
392 |
|
|
unsigned short sectors; /* Obsolete, "physical" sectors per track */
|
393 |
|
|
unsigned short vendor0; /* vendor unique */
|
394 |
|
|
unsigned short vendor1; /* vendor unique */
|
395 |
|
|
unsigned short vendor2; /* Retired vendor unique */
|
396 |
|
|
unsigned char serial_no[20]; /* 0 = not_specified */
|
397 |
|
|
unsigned short buf_type; /* Retired */
|
398 |
|
|
unsigned short buf_size; /* Retired, 512 byte increments
|
399 |
|
|
* 0 = not_specified
|
400 |
|
|
*/
|
401 |
|
|
unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */
|
402 |
|
|
unsigned char fw_rev[8]; /* 0 = not_specified */
|
403 |
|
|
unsigned char model[40]; /* 0 = not_specified */
|
404 |
|
|
unsigned char max_multsect; /* 0=not_implemented */
|
405 |
|
|
unsigned char vendor3; /* vendor unique */
|
406 |
|
|
unsigned short dword_io; /* 0=not_implemented; 1=implemented */
|
407 |
|
|
unsigned char vendor4; /* vendor unique */
|
408 |
|
|
unsigned char capability; /* (upper byte of word 49)
|
409 |
|
|
* 3: IORDYsup
|
410 |
|
|
* 2: IORDYsw
|
411 |
|
|
* 1: LBA
|
412 |
|
|
* 0: DMA
|
413 |
|
|
*/
|
414 |
|
|
unsigned short reserved50; /* reserved (word 50) */
|
415 |
|
|
unsigned char vendor5; /* Obsolete, vendor unique */
|
416 |
|
|
unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */
|
417 |
|
|
unsigned char vendor6; /* Obsolete, vendor unique */
|
418 |
|
|
unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */
|
419 |
|
|
unsigned short field_valid; /* (word 53)
|
420 |
|
|
* 2: ultra_ok word 88
|
421 |
|
|
* 1: eide_ok words 64-70
|
422 |
|
|
* 0: cur_ok words 54-58
|
423 |
|
|
*/
|
424 |
|
|
unsigned short cur_cyls; /* Obsolete, logical cylinders */
|
425 |
|
|
unsigned short cur_heads; /* Obsolete, l heads */
|
426 |
|
|
unsigned short cur_sectors; /* Obsolete, l sectors per track */
|
427 |
|
|
unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */
|
428 |
|
|
unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */
|
429 |
|
|
unsigned char multsect; /* current multiple sector count */
|
430 |
|
|
unsigned char multsect_valid; /* when (bit0==1) multsect is ok */
|
431 |
|
|
unsigned int lba_capacity; /* Obsolete, total number of sectors */
|
432 |
|
|
unsigned short dma_1word; /* Obsolete, single-word dma info */
|
433 |
|
|
unsigned short dma_mword; /* multiple-word dma info */
|
434 |
|
|
unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */
|
435 |
|
|
unsigned short eide_dma_min; /* min mword dma cycle time (ns) */
|
436 |
|
|
unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
|
437 |
|
|
unsigned short eide_pio; /* min cycle time (ns), no IORDY */
|
438 |
|
|
unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
|
439 |
|
|
unsigned short words69_70[2]; /* reserved words 69-70
|
440 |
|
|
* future command overlap and queuing
|
441 |
|
|
*/
|
442 |
|
|
unsigned short words71_74[4]; /* reserved words 71-74
|
443 |
|
|
* for IDENTIFY PACKET DEVICE command
|
444 |
|
|
*/
|
445 |
|
|
unsigned short queue_depth; /* (word 75)
|
446 |
|
|
* 15:5 reserved
|
447 |
|
|
* 4:0 Maximum queue depth -1
|
448 |
|
|
*/
|
449 |
|
|
unsigned short words76_79[4]; /* reserved words 76-79 */
|
450 |
|
|
unsigned short major_rev_num; /* (word 80) */
|
451 |
|
|
unsigned short minor_rev_num; /* (word 81) */
|
452 |
|
|
unsigned short command_set_1; /* (word 82) supported
|
453 |
|
|
* 15: Obsolete
|
454 |
|
|
* 14: NOP command
|
455 |
|
|
* 13: READ_BUFFER
|
456 |
|
|
* 12: WRITE_BUFFER
|
457 |
|
|
* 11: Obsolete
|
458 |
|
|
* 10: Host Protected Area
|
459 |
|
|
* 9: DEVICE Reset
|
460 |
|
|
* 8: SERVICE Interrupt
|
461 |
|
|
* 7: Release Interrupt
|
462 |
|
|
* 6: look-ahead
|
463 |
|
|
* 5: write cache
|
464 |
|
|
* 4: PACKET Command
|
465 |
|
|
* 3: Power Management Feature Set
|
466 |
|
|
* 2: Removable Feature Set
|
467 |
|
|
* 1: Security Feature Set
|
468 |
|
|
* 0: SMART Feature Set
|
469 |
|
|
*/
|
470 |
|
|
unsigned short command_set_2; /* (word 83)
|
471 |
|
|
* 15: Shall be ZERO
|
472 |
|
|
* 14: Shall be ONE
|
473 |
|
|
* 13: FLUSH CACHE EXT
|
474 |
|
|
* 12: FLUSH CACHE
|
475 |
|
|
* 11: Device Configuration Overlay
|
476 |
|
|
* 10: 48-bit Address Feature Set
|
477 |
|
|
* 9: Automatic Acoustic Management
|
478 |
|
|
* 8: SET MAX security
|
479 |
|
|
* 7: reserved 1407DT PARTIES
|
480 |
|
|
* 6: SetF sub-command Power-Up
|
481 |
|
|
* 5: Power-Up in Standby Feature Set
|
482 |
|
|
* 4: Removable Media Notification
|
483 |
|
|
* 3: APM Feature Set
|
484 |
|
|
* 2: CFA Feature Set
|
485 |
|
|
* 1: READ/WRITE DMA QUEUED
|
486 |
|
|
* 0: Download MicroCode
|
487 |
|
|
*/
|
488 |
|
|
unsigned short cfsse; /* (word 84)
|
489 |
|
|
* cmd set-feature supported extensions
|
490 |
|
|
* 15: Shall be ZERO
|
491 |
|
|
* 14: Shall be ONE
|
492 |
|
|
* 13:6 reserved
|
493 |
|
|
* 5: General Purpose Logging
|
494 |
|
|
* 4: Streaming Feature Set
|
495 |
|
|
* 3: Media Card Pass Through
|
496 |
|
|
* 2: Media Serial Number Valid
|
497 |
|
|
* 1: SMART selt-test supported
|
498 |
|
|
* 0: SMART error logging
|
499 |
|
|
*/
|
500 |
|
|
unsigned short cfs_enable_1; /* (word 85)
|
501 |
|
|
* command set-feature enabled
|
502 |
|
|
* 15: Obsolete
|
503 |
|
|
* 14: NOP command
|
504 |
|
|
* 13: READ_BUFFER
|
505 |
|
|
* 12: WRITE_BUFFER
|
506 |
|
|
* 11: Obsolete
|
507 |
|
|
* 10: Host Protected Area
|
508 |
|
|
* 9: DEVICE Reset
|
509 |
|
|
* 8: SERVICE Interrupt
|
510 |
|
|
* 7: Release Interrupt
|
511 |
|
|
* 6: look-ahead
|
512 |
|
|
* 5: write cache
|
513 |
|
|
* 4: PACKET Command
|
514 |
|
|
* 3: Power Management Feature Set
|
515 |
|
|
* 2: Removable Feature Set
|
516 |
|
|
* 1: Security Feature Set
|
517 |
|
|
* 0: SMART Feature Set
|
518 |
|
|
*/
|
519 |
|
|
unsigned short cfs_enable_2; /* (word 86)
|
520 |
|
|
* command set-feature enabled
|
521 |
|
|
* 15: Shall be ZERO
|
522 |
|
|
* 14: Shall be ONE
|
523 |
|
|
* 13: FLUSH CACHE EXT
|
524 |
|
|
* 12: FLUSH CACHE
|
525 |
|
|
* 11: Device Configuration Overlay
|
526 |
|
|
* 10: 48-bit Address Feature Set
|
527 |
|
|
* 9: Automatic Acoustic Management
|
528 |
|
|
* 8: SET MAX security
|
529 |
|
|
* 7: reserved 1407DT PARTIES
|
530 |
|
|
* 6: SetF sub-command Power-Up
|
531 |
|
|
* 5: Power-Up in Standby Feature Set
|
532 |
|
|
* 4: Removable Media Notification
|
533 |
|
|
* 3: APM Feature Set
|
534 |
|
|
* 2: CFA Feature Set
|
535 |
|
|
* 1: READ/WRITE DMA QUEUED
|
536 |
|
|
* 0: Download MicroCode
|
537 |
|
|
*/
|
538 |
|
|
unsigned short csf_default; /* (word 87)
|
539 |
|
|
* command set-feature default
|
540 |
|
|
* 15: Shall be ZERO
|
541 |
|
|
* 14: Shall be ONE
|
542 |
|
|
* 13:6 reserved
|
543 |
|
|
* 5: General Purpose Logging enabled
|
544 |
|
|
* 4: Valid CONFIGURE STREAM executed
|
545 |
|
|
* 3: Media Card Pass Through enabled
|
546 |
|
|
* 2: Media Serial Number Valid
|
547 |
|
|
* 1: SMART selt-test supported
|
548 |
|
|
* 0: SMART error logging
|
549 |
|
|
*/
|
550 |
|
|
unsigned short dma_ultra; /* (word 88) */
|
551 |
|
|
unsigned short trseuc; /* time required for security erase */
|
552 |
|
|
unsigned short trsEuc; /* time required for enhanced erase */
|
553 |
|
|
unsigned short CurAPMvalues; /* current APM values */
|
554 |
|
|
unsigned short mprc; /* master password revision code */
|
555 |
|
|
unsigned short hw_config; /* hardware config (word 93)
|
556 |
|
|
* 15: Shall be ZERO
|
557 |
|
|
* 14: Shall be ONE
|
558 |
|
|
* 13:
|
559 |
|
|
* 12:
|
560 |
|
|
* 11:
|
561 |
|
|
* 10:
|
562 |
|
|
* 9:
|
563 |
|
|
* 8:
|
564 |
|
|
* 7:
|
565 |
|
|
* 6:
|
566 |
|
|
* 5:
|
567 |
|
|
* 4:
|
568 |
|
|
* 3:
|
569 |
|
|
* 2:
|
570 |
|
|
* 1:
|
571 |
|
|
* 0: Shall be ONE
|
572 |
|
|
*/
|
573 |
|
|
unsigned short acoustic; /* (word 94)
|
574 |
|
|
* 15:8 Vendor's recommended value
|
575 |
|
|
* 7:0 current value
|
576 |
|
|
*/
|
577 |
|
|
unsigned short msrqs; /* min stream request size */
|
578 |
|
|
unsigned short sxfert; /* stream transfer time */
|
579 |
|
|
unsigned short sal; /* stream access latency */
|
580 |
|
|
unsigned int spg; /* stream performance granularity */
|
581 |
|
|
unsigned long long lba_capacity_2;/* 48-bit total number of sectors */
|
582 |
|
|
unsigned short words104_125[22];/* reserved words 104-125 */
|
583 |
|
|
unsigned short last_lun; /* (word 126) */
|
584 |
|
|
unsigned short word127; /* (word 127) Feature Set
|
585 |
|
|
* Removable Media Notification
|
586 |
|
|
* 15:2 reserved
|
587 |
|
|
* 1:0 00 = not supported
|
588 |
|
|
* 01 = supported
|
589 |
|
|
* 10 = reserved
|
590 |
|
|
* 11 = reserved
|
591 |
|
|
*/
|
592 |
|
|
unsigned short dlf; /* (word 128)
|
593 |
|
|
* device lock function
|
594 |
|
|
* 15:9 reserved
|
595 |
|
|
* 8 security level 1:max 0:high
|
596 |
|
|
* 7:6 reserved
|
597 |
|
|
* 5 enhanced erase
|
598 |
|
|
* 4 expire
|
599 |
|
|
* 3 frozen
|
600 |
|
|
* 2 locked
|
601 |
|
|
* 1 en/disabled
|
602 |
|
|
* 0 capability
|
603 |
|
|
*/
|
604 |
|
|
unsigned short csfo; /* (word 129)
|
605 |
|
|
* current set features options
|
606 |
|
|
* 15:4 reserved
|
607 |
|
|
* 3: auto reassign
|
608 |
|
|
* 2: reverting
|
609 |
|
|
* 1: read-look-ahead
|
610 |
|
|
* 0: write cache
|
611 |
|
|
*/
|
612 |
|
|
unsigned short words130_155[26];/* reserved vendor words 130-155 */
|
613 |
|
|
unsigned short word156; /* reserved vendor word 156 */
|
614 |
|
|
unsigned short words157_159[3];/* reserved vendor words 157-159 */
|
615 |
|
|
unsigned short cfa_power; /* (word 160) CFA Power Mode
|
616 |
|
|
* 15 word 160 supported
|
617 |
|
|
* 14 reserved
|
618 |
|
|
* 13
|
619 |
|
|
* 12
|
620 |
|
|
* 11:0
|
621 |
|
|
*/
|
622 |
|
|
unsigned short words161_175[15];/* Reserved for CFA */
|
623 |
|
|
unsigned short words176_205[30];/* Current Media Serial Number */
|
624 |
|
|
unsigned short words206_254[49];/* reserved words 206-254 */
|
625 |
|
|
unsigned short integrity_word; /* (word 255)
|
626 |
|
|
* 15:8 Checksum
|
627 |
|
|
* 7:0 Signature
|
628 |
|
|
*/
|
629 |
|
|
};
|
630 |
|
|
|
631 |
|
|
/*
|
632 |
|
|
* IDE "nice" flags. These are used on a per drive basis to determine
|
633 |
|
|
* when to be nice and give more bandwidth to the other devices which
|
634 |
|
|
* share the same IDE bus.
|
635 |
|
|
*/
|
636 |
|
|
#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
|
637 |
|
|
#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
|
638 |
|
|
#define IDE_NICE_1 (3) /* when probably won't affect us much */
|
639 |
|
|
#define IDE_NICE_0 (2) /* when sure that it won't affect us */
|
640 |
|
|
#define IDE_NICE_2 (4) /* when we know it's on our expense */
|
641 |
|
|
|
642 |
|
|
#endif /* _LINUX_HDREG_H */
|