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