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