ata.h revision 127021
174298Ssos/*-
2127021Ssos * Copyright (c) 2000 - 2004 S�ren Schmidt <sos@FreeBSD.org>
374298Ssos * All rights reserved.
474298Ssos *
574298Ssos * Redistribution and use in source and binary forms, with or without
674298Ssos * modification, are permitted provided that the following conditions
774298Ssos * are met:
874298Ssos * 1. Redistributions of source code must retain the above copyright
974298Ssos *    notice, this list of conditions and the following disclaimer,
1074298Ssos *    without modification, immediately at the beginning of the file.
1174298Ssos * 2. Redistributions in binary form must reproduce the above copyright
1274298Ssos *    notice, this list of conditions and the following disclaimer in the
1374298Ssos *    documentation and/or other materials provided with the distribution.
1474298Ssos * 3. The name of the author may not be used to endorse or promote products
1574298Ssos *    derived from this software without specific prior written permission.
1674298Ssos *
1774298Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1874298Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1974298Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2074298Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2174298Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2274298Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2374298Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2474298Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2574298Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2674298Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2774298Ssos *
2874298Ssos * $FreeBSD: head/sys/sys/ata.h 127021 2004-03-15 13:17:24Z sos $
2974298Ssos */
3074298Ssos
3174298Ssos#ifndef _SYS_ATA_H_
3274298Ssos#define _SYS_ATA_H_
3374298Ssos
3474298Ssos#include <sys/ioccom.h>
3574298Ssos
36119404Ssos/* ATA/ATAPI device parameters */
3793881Ssosstruct ata_params {
38119404Ssos/*000*/ u_int16_t	config; 		/* configuration info */
39119404Ssos#define ATA_PROTO_MASK			0x8003
40119404Ssos#define ATA_PROTO_ATA			0x0002
41119404Ssos#define ATA_PROTO_ATAPI_12		0x8000
42119404Ssos#define ATA_PROTO_ATAPI_16		0x8001
43119404Ssos#define ATA_ATAPI_TYPE_MASK		0x1f00
44119404Ssos#define ATA_ATAPI_TYPE_DIRECT		0x0000	/* disk/floppy */
45119404Ssos#define ATA_ATAPI_TYPE_TAPE		0x0100	/* streaming tape */
46119404Ssos#define ATA_ATAPI_TYPE_CDROM		0x0500	/* CD-ROM device */
47119404Ssos#define ATA_ATAPI_TYPE_OPTICAL		0x0700	/* optical disk */
48119404Ssos#define ATA_DRQ_MASK			0x0060
49119404Ssos#define ATA_DRQ_SLOW			0x0000  /* cpu 3 ms delay */
50119404Ssos#define ATA_DRQ_INTR			0x0020  /* interrupt 10 ms delay */
51119404Ssos#define ATA_DRQ_FAST			0x0040  /* accel 50 us delay */
5293881Ssos
5384584Ssos/*001*/	u_int16_t	cylinders;		/* # of cylinders */
5484584Ssos	u_int16_t	reserved2;
5584584Ssos/*003*/	u_int16_t	heads;			/* # heads */
5684584Ssos	u_int16_t	obsolete4;
5784584Ssos	u_int16_t	obsolete5;
5884584Ssos/*006*/	u_int16_t	sectors;		/* # sectors/track */
5984584Ssos/*007*/	u_int16_t	vendor7[3];
6084584Ssos/*010*/	u_int8_t	serial[20];		/* serial number */
61119404Ssos/*020*/	u_int16_t	retired20;
6284584Ssos	u_int16_t	retired21;
6384584Ssos	u_int16_t	obsolete22;
6484584Ssos/*023*/	u_int8_t	revision[8];		/* firmware revision */
6584584Ssos/*027*/	u_int8_t	model[40];		/* model name */
66119404Ssos/*047*/	u_int16_t	sectors_intr;		/* sectors per interrupt */
6784584Ssos/*048*/	u_int16_t	usedmovsd;		/* double word read/write? */
68119404Ssos/*049*/	u_int16_t	capabilities1;
69119404Ssos#define ATA_SUPPORT_DMA			0x0100
70119404Ssos#define ATA_SUPPORT_LBA			0x0200
71119404Ssos#define ATA_SUPPORT_OVERLAP		0x4000
7293881Ssos
73119404Ssos/*050*/	u_int16_t	capabilities2;
74119404Ssos/*051*/	u_int16_t	retired_piomode;	/* PIO modes 0-2 */
75119877Ssos#define ATA_RETIRED_PIO_MASK		0x0300
7674298Ssos
77119404Ssos/*052*/	u_int16_t	retired_dmamode;	/* DMA modes */
78119404Ssos#define ATA_RETIRED_DMA_MASK		0x0003
7974298Ssos
8084584Ssos/*053*/	u_int16_t	atavalid;		/* fields valid */
81119404Ssos#define ATA_FLAG_54_58			0x0001	/* words 54-58 valid */
82119404Ssos#define ATA_FLAG_64_70			0x0002	/* words 64-70 valid */
83119404Ssos#define ATA_FLAG_88			0x0004	/* word 88 valid */
8474298Ssos
85119404Ssos/*054*/	u_int16_t	obsolete54[5];
86119404Ssos/*059*/	u_int16_t	multi;
87119404Ssos#define	ATA_MULTI_VALID			0x0100
8893881Ssos
8993899Ssos/*060*/	u_int16_t	lba_size_1;
9093899Ssos	u_int16_t	lba_size_2;
9184584Ssos	u_int16_t	obsolete62;
9284584Ssos/*063*/	u_int16_t	mwdmamodes;		/* multiword DMA modes */
9384584Ssos/*064*/	u_int16_t	apiomodes;		/* advanced PIO modes */
9474298Ssos
9584584Ssos/*065*/	u_int16_t	mwdmamin;		/* min. M/W DMA time/word ns */
9684584Ssos/*066*/	u_int16_t	mwdmarec;		/* rec. M/W DMA time ns */
9784584Ssos/*067*/	u_int16_t	pioblind;		/* min. PIO cycle w/o flow */
9884584Ssos/*068*/	u_int16_t	pioiordy;		/* min. PIO cycle IORDY flow */
9984584Ssos	u_int16_t	reserved69;
10084584Ssos	u_int16_t	reserved70;
10184584Ssos/*071*/	u_int16_t	rlsovlap;		/* rel time (us) for overlap */
10284584Ssos/*072*/	u_int16_t	rlsservice;		/* rel time (us) for service */
10384584Ssos	u_int16_t	reserved73;
10484584Ssos	u_int16_t	reserved74;
105119404Ssos/*075*/	u_int16_t	queue;
106119404Ssos#define	ATA_QUEUE_LEN(x)		((x) & 0x001f)
10774298Ssos
108127021Ssos	u_int16_t	satacapabilities;
109127021Ssos#define ATA_SATA_GEN1			0x0002
110127021Ssos#define ATA_SATA_GEN2			0x0004
111127021Ssos#define ATA_SUPPORT_NCQ			0x0100
112127021Ssos#define ATA_SUPPORT_IFPWRMNGTRCV	0x0200
113127021Ssos
11484584Ssos	u_int16_t	reserved77;
115127021Ssos	u_int16_t	satasupport;
116127021Ssos#define ATA_SUPPORT_NONZERO		0x0002
117127021Ssos#define ATA_SUPPORT_AUTOACTIVATE	0x0004
118127021Ssos#define ATA_SUPPORT_IFPWRMNGT		0x0008
119127021Ssos#define ATA_SUPPORT_INORDERDATA		0x0010
120127021Ssos	u_int16_t	sataenabled;
121127021Ssos
12284584Ssos/*080*/	u_int16_t	version_major;
12384584Ssos/*081*/	u_int16_t	version_minor;
124119404Ssos
12584584Ssos	struct {
126119404Ssos/*082/085*/ u_int16_t	command1;
127119404Ssos#define ATA_SUPPORT_SMART		0x0001
128119404Ssos#define ATA_SUPPORT_SECURITY		0x0002
129119404Ssos#define ATA_SUPPORT_REMOVABLE		0x0004
130119404Ssos#define ATA_SUPPORT_POWERMGT		0x0008
131119404Ssos#define ATA_SUPPORT_PACKET		0x0010
132119404Ssos#define ATA_SUPPORT_WRITECACHE		0x0020
133119404Ssos#define ATA_SUPPORT_LOOKAHEAD		0x0040
134119404Ssos#define ATA_SUPPORT_RELEASEIRQ		0x0080
135119404Ssos#define ATA_SUPPORT_SERVICEIRQ		0x0100
136119404Ssos#define ATA_SUPPORT_RESET		0x0200
137119404Ssos#define ATA_SUPPORT_PROTECTED		0x0400
138119404Ssos#define ATA_SUPPORT_WRITEBUFFER		0x1000
139119404Ssos#define ATA_SUPPORT_READBUFFER		0x2000
140119404Ssos#define ATA_SUPPORT_NOP			0x4000
14184584Ssos
142119404Ssos/*083/086*/ u_int16_t	command2;
143119404Ssos#define ATA_SUPPORT_MICROCODE		0x0001
144119404Ssos#define ATA_SUPPORT_QUEUED		0x0002
145119404Ssos#define ATA_SUPPORT_CFA			0x0004
146119404Ssos#define ATA_SUPPORT_APM			0x0008
147119404Ssos#define ATA_SUPPORT_NOTIFY		0x0010
148119404Ssos#define ATA_SUPPORT_STANDBY		0x0020
149119404Ssos#define ATA_SUPPORT_SPINUP		0x0040
150119404Ssos#define ATA_SUPPORT_MAXSECURITY		0x0100
151119404Ssos#define ATA_SUPPORT_AUTOACOUSTIC	0x0200
152119404Ssos#define ATA_SUPPORT_ADDRESS48		0x0400
153119404Ssos#define ATA_SUPPORT_OVERLAY		0x0800
154119404Ssos#define ATA_SUPPORT_FLUSHCACHE		0x1000
155119404Ssos#define ATA_SUPPORT_FLUSHCACHE48	0x2000
15684584Ssos
157119404Ssos/*084/087*/ u_int16_t	extension;
15884584Ssos	} support, enabled;
15984584Ssos
16084584Ssos/*088*/	u_int16_t	udmamodes;		/* UltraDMA modes */
16184584Ssos/*089*/	u_int16_t	erase_time;
16284584Ssos/*090*/	u_int16_t	enhanced_erase_time;
16384584Ssos/*091*/	u_int16_t	apm_value;
16484584Ssos/*092*/	u_int16_t	master_passwd_revision;
165119404Ssos/*093*/	u_int16_t	hwres;
166119404Ssos#define ATA_CABLE_ID			0x2000
16784584Ssos
168119404Ssos/*094*/	u_int16_t	acoustic;
169119404Ssos#define	ATA_ACOUSTIC_CURRENT(x)		((x) & 0x00ff)
170119404Ssos#define	ATA_ACOUSTIC_VENDOR(x)		(((x) & 0xff00) >> 8)
17184584Ssos
17284584Ssos/*095*/	u_int16_t	stream_min_req_size;
17384584Ssos/*096*/	u_int16_t	stream_transfer_time;
17484584Ssos/*097*/	u_int16_t	stream_access_latency;
17584584Ssos/*098*/	u_int32_t	stream_granularity;
17693881Ssos/*100*/	u_int16_t	lba_size48_1;
17793881Ssos	u_int16_t	lba_size48_2;
17893881Ssos	u_int16_t	lba_size48_3;
17993881Ssos	u_int16_t	lba_size48_4;
18084584Ssos	u_int16_t	reserved104[23];
18184584Ssos/*127*/	u_int16_t	removable_status;
18284584Ssos/*128*/	u_int16_t	security_status;
18384584Ssos	u_int16_t	reserved129[31];
18484584Ssos/*160*/	u_int16_t	cfa_powermode1;
18584584Ssos	u_int16_t	reserved161[14];
18684584Ssos/*176*/	u_int16_t	media_serial[30];
18784584Ssos	u_int16_t	reserved206[49];
18884584Ssos/*255*/	u_int16_t	integrity;
18974298Ssos};
19074298Ssos
191119404Ssos/* ATA transfer modes */
19282560Ssos#define ATA_MODE_MASK		0x0f
19382560Ssos#define ATA_DMA_MASK		0xf0
19476740Ssos#define ATA_PIO			0x00
19576740Ssos#define ATA_PIO0		0x08
19682560Ssos#define ATA_PIO1		0x09
19782560Ssos#define ATA_PIO2		0x0a
19882560Ssos#define ATA_PIO3		0x0b
19982560Ssos#define ATA_PIO4		0x0c
200111187Ssos#define ATA_PIO_MAX		0x0f
20182560Ssos#define ATA_DMA			0x10
202111187Ssos#define ATA_WDMA0		0x20
203111187Ssos#define ATA_WDMA1		0x21
20482560Ssos#define ATA_WDMA2		0x22
205111187Ssos#define ATA_UDMA0		0x40
206111187Ssos#define ATA_UDMA1		0x41
20782560Ssos#define ATA_UDMA2		0x42
208111187Ssos#define ATA_UDMA3		0x43
20982560Ssos#define ATA_UDMA4		0x44
21082560Ssos#define ATA_UDMA5		0x45
21184584Ssos#define ATA_UDMA6		0x46
212115134Ssos#define ATA_SA150		0x47
213111187Ssos#define ATA_DMA_MAX		0x4f
21474298Ssos
215119404Ssos/* ATA commands */
216119404Ssos#define	ATA_NOP				0x00	/* NOP command */
217119404Ssos#define		ATA_NF_FLUSHQUEUE	0x00	/* flush queued cmd's */
218119404Ssos#define		ATA_NF_AUTOPOLL		0x01	/* start autopoll function */
219119404Ssos#define	ATA_ATAPI_RESET			0x08	/* reset ATAPI device */
220119404Ssos#define	ATA_READ			0x20	/* read command */
221119404Ssos#define	ATA_READ48			0x24	/* read command */
222119404Ssos#define	ATA_READ_DMA48			0x25	/* read w/DMA command */
223119404Ssos#define	ATA_READ_DMA_QUEUED48	 	0x26	/* read w/DMA QUEUED command */
224119404Ssos#define	ATA_READ_MUL48			0x29	/* read multi command */
225119404Ssos#define	ATA_WRITE			0x30	/* write command */
226119404Ssos#define	ATA_WRITE48			0x34	/* write command */
227119404Ssos#define	ATA_WRITE_DMA48			0x35	/* write w/DMA command */
228119404Ssos#define	ATA_WRITE_DMA_QUEUED48		0x36	/* write w/DMA QUEUED command */
229119404Ssos#define	ATA_WRITE_MUL48			0x39	/* write multi command */
230119404Ssos#define	ATA_PACKET_CMD			0xa0	/* packet command */
231119404Ssos#define	ATA_ATAPI_IDENTIFY		0xa1	/* get ATAPI params*/
232119404Ssos#define	ATA_SERVICE			0xa2	/* service command */
233119404Ssos#define	ATA_READ_MUL			0xc4	/* read multi command */
234119404Ssos#define	ATA_WRITE_MUL			0xc5	/* write multi command */
235119404Ssos#define	ATA_SET_MULTI			0xc6	/* set multi size command */
236119404Ssos#define	ATA_READ_DMA_QUEUED		0xc7	/* read w/DMA QUEUED command */
237119404Ssos#define	ATA_READ_DMA			0xc8	/* read w/DMA command */
238119404Ssos#define	ATA_WRITE_DMA			0xca	/* write w/DMA command */
239119404Ssos#define	ATA_WRITE_DMA_QUEUED		0xcc	/* write w/DMA QUEUED command */
240119404Ssos#define	ATA_SLEEP			0xe6	/* sleep command */
241119404Ssos#define	ATA_FLUSHCACHE			0xe7	/* flush cache to disk */
242119404Ssos#define	ATA_FLUSHCACHE48		0xea	/* flush cache to disk */
243119404Ssos#define	ATA_ATA_IDENTIFY		0xec	/* get ATA params */
244119404Ssos#define	ATA_SETFEATURES			0xef	/* features command */
245119404Ssos#define		ATA_SF_SETXFER		0x03	/* set transfer mode */
246119404Ssos#define		ATA_SF_ENAB_WCACHE	0x02	/* enable write cache */
247119404Ssos#define		ATA_SF_DIS_WCACHE	0x82	/* disable write cache */
248119404Ssos#define		ATA_SF_ENAB_RCACHE	0xaa	/* enable readahead cache */
249119404Ssos#define		ATA_SF_DIS_RCACHE	0x55	/* disable readahead cache */
250119404Ssos#define		ATA_SF_ENAB_RELIRQ	0x5d	/* enable release interrupt */
251119404Ssos#define		ATA_SF_DIS_RELIRQ	0xdd	/* disable release interrupt */
252119404Ssos#define		ATA_SF_ENAB_SRVIRQ	0x5e	/* enable service interrupt */
253119404Ssos#define		ATA_SF_DIS_SRVIRQ	0xde	/* disable service interrupt */
254119404Ssos
255119404Ssos/* ATAPI commands */
256119404Ssos#define ATAPI_TEST_UNIT_READY		0x00	/* check if device is ready */
257119404Ssos#define ATAPI_REZERO			0x01	/* rewind */
258119404Ssos#define ATAPI_REQUEST_SENSE		0x03	/* get sense data */
259119404Ssos#define ATAPI_FORMAT			0x04	/* format unit */
260119404Ssos#define ATAPI_READ			0x08	/* read data */
261119404Ssos#define ATAPI_WRITE			0x0a	/* write data */
262119404Ssos#define ATAPI_WEOF			0x10	/* write filemark */
263119404Ssos#define 	ATAPI_WF_WRITE		0x01
264119404Ssos#define ATAPI_SPACE			0x11	/* space command */
265119404Ssos#define	    	ATAPI_SP_FM		0x01
266119404Ssos#define	    	ATAPI_SP_EOD		0x03
267119404Ssos#define ATAPI_MODE_SELECT		0x15	/* mode select */
268119404Ssos#define ATAPI_ERASE			0x19	/* erase */
269119404Ssos#define ATAPI_MODE_SENSE		0x1a	/* mode sense */
270119404Ssos#define ATAPI_START_STOP		0x1b	/* start/stop unit */
271119404Ssos#define	    	ATAPI_SS_LOAD		0x01
272119404Ssos#define	    	ATAPI_SS_RETENSION	0x02
273119404Ssos#define	    	ATAPI_SS_EJECT		0x04
274119404Ssos#define ATAPI_PREVENT_ALLOW		0x1e	/* media removal */
275119404Ssos#define ATAPI_READ_FORMAT_CAPACITIES	0x23	/* get format capacities */
276119404Ssos#define ATAPI_READ_CAPACITY		0x25	/* get volume capacity */
277119404Ssos#define ATAPI_READ_BIG			0x28	/* read data */
278119404Ssos#define ATAPI_WRITE_BIG			0x2a	/* write data */
279119404Ssos#define ATAPI_LOCATE			0x2b	/* locate to position */
280119404Ssos#define ATAPI_READ_POSITION		0x34	/* read position */
281119404Ssos#define ATAPI_SYNCHRONIZE_CACHE		0x35	/* flush buf, close channel */
282119404Ssos#define ATAPI_WRITE_BUFFER		0x3b	/* write device buffer */
283119404Ssos#define ATAPI_READ_BUFFER		0x3c	/* read device buffer */
284119404Ssos#define ATAPI_READ_SUBCHANNEL		0x42	/* get subchannel info */
285119404Ssos#define ATAPI_READ_TOC			0x43	/* get table of contents */
286119404Ssos#define ATAPI_PLAY_10			0x45	/* play by lba */
287119404Ssos#define ATAPI_PLAY_MSF			0x47	/* play by MSF address */
288119404Ssos#define ATAPI_PLAY_TRACK		0x48	/* play by track number */
289119404Ssos#define ATAPI_PAUSE			0x4b	/* pause audio operation */
290119404Ssos#define ATAPI_READ_DISK_INFO		0x51	/* get disk info structure */
291119404Ssos#define ATAPI_READ_TRACK_INFO		0x52	/* get track info structure */
292119404Ssos#define ATAPI_RESERVE_TRACK		0x53	/* reserve track */
293119404Ssos#define ATAPI_SEND_OPC_INFO		0x54	/* send OPC structurek */
294119404Ssos#define ATAPI_MODE_SELECT_BIG		0x55	/* set device parameters */
295119404Ssos#define ATAPI_REPAIR_TRACK		0x58	/* repair track */
296119404Ssos#define ATAPI_READ_MASTER_CUE		0x59	/* read master CUE info */
297119404Ssos#define ATAPI_MODE_SENSE_BIG		0x5a	/* get device parameters */
298119404Ssos#define ATAPI_CLOSE_TRACK		0x5b	/* close track/session */
299119404Ssos#define ATAPI_READ_BUFFER_CAPACITY	0x5c	/* get buffer capicity */
300119404Ssos#define ATAPI_SEND_CUE_SHEET		0x5d	/* send CUE sheet */
301119404Ssos#define ATAPI_BLANK			0xa1	/* blank the media */
302119404Ssos#define ATAPI_SEND_KEY			0xa3	/* send DVD key structure */
303119404Ssos#define ATAPI_REPORT_KEY		0xa4	/* get DVD key structure */
304119404Ssos#define ATAPI_PLAY_12			0xa5	/* play by lba */
305119404Ssos#define ATAPI_LOAD_UNLOAD		0xa6	/* changer control command */
306119404Ssos#define ATAPI_READ_STRUCTURE		0xad	/* get DVD structure */
307119404Ssos#define ATAPI_PLAY_CD			0xb4	/* universal play command */
308119404Ssos#define ATAPI_SET_SPEED			0xbb	/* set drive speed */
309119404Ssos#define ATAPI_MECH_STATUS		0xbd	/* get changer status */
310119404Ssos#define ATAPI_READ_CD			0xbe	/* read data */
311119404Ssos#define ATAPI_POLL_DSC			0xff	/* poll DSC status bit */
312119404Ssos
31376740Ssosstruct ata_cmd {
31482560Ssos    int				channel;
31582560Ssos    int				device;
31676740Ssos    int				cmd;
317119404Ssos#define ATAGMAXCHANNEL		0x0101
318119404Ssos#define ATAGPARM		0x0102
319119404Ssos#define ATAGMODE		0x0103
320119404Ssos#define ATASMODE		0x0104
321119404Ssos#define ATAREQUEST		0x0108
322119404Ssos#define ATAREINIT		0x0110
323119404Ssos#define ATAATTACH		0x0111
324119404Ssos#define ATADETACH		0x0112
325119404Ssos#define ATARAIDCREATE		0x0120
326119404Ssos#define ATARAIDDELETE		0x0121
327119404Ssos#define ATARAIDSTATUS		0x0122
328119404Ssos#define ATARAIDADDSPARE		0x0123
329119404Ssos#define ATARAIDREBUILD		0x0124
330119404Ssos#define ATAENCSTAT		0x0130
33174298Ssos
33276740Ssos    union {
333119404Ssos	int			maxchan;
334119404Ssos
33576740Ssos	struct {
33676740Ssos	    int			type[2];
33776740Ssos	    char		name[2][32];
33876740Ssos	    struct ata_params	params[2];
33976740Ssos	} param;
340119404Ssos
341119404Ssos	struct {
342119404Ssos	    int			mode[2];
343119404Ssos	} mode;
344119404Ssos
345119404Ssos	struct {
346119404Ssos	    union {
347119404Ssos		struct {
348119404Ssos	    	    u_int8_t            command;
349119404Ssos            	    u_int8_t            feature;
350119404Ssos            	    u_int64_t           lba;
351119404Ssos            	    u_int16_t           count;
352119404Ssos		} ata;
353119404Ssos		struct {
354119404Ssos	    	    char		ccb[16];
355119404Ssos		} atapi;
356119404Ssos	    } u;
357119404Ssos	    caddr_t		data;
358119404Ssos	    int			count;
359119404Ssos	    int			flags;
360119404Ssos#define ATA_CMD_CONTROL			0x01
361119404Ssos#define ATA_CMD_READ			0x02
362119404Ssos#define ATA_CMD_WRITE			0x04
363119404Ssos#define ATA_CMD_ATAPI			0x08
364119404Ssos
365119404Ssos	    int			timeout;
366119404Ssos	    int			error;
367119404Ssos	} request;
368119404Ssos
36993275Ssos	struct raid_setup {
37093275Ssos	    int			type;
37193662Ssos#define	AR_RAID0			1
37293662Ssos#define	AR_RAID1			2
37393662Ssos#define	AR_SPAN				4
37493662Ssos
37593275Ssos	    int			total_disks;
37693275Ssos	    int			disks[16];
37793275Ssos	    int			interleave;
37893275Ssos	    int			unit;
37993275Ssos	} raid_setup;
380119404Ssos
38193662Ssos	struct raid_status {
38293662Ssos	    int			type;
38393662Ssos	    int			total_disks;
38493662Ssos	    int			disks[16];
38593662Ssos	    int			interleave;
38693662Ssos	    int			status;
38793662Ssos#define	AR_READY			1
38893662Ssos#define	AR_DEGRADED			2
38993662Ssos#define	AR_REBUILDING			4
39093662Ssos
39193662Ssos	    int			progress;
39293662Ssos	} raid_status;
393119404Ssos
39482560Ssos	struct {
395119404Ssos	    int			disk;
396119404Ssos	} raid_spare;
397119404Ssos
398119404Ssos	struct {
39993433Ssos	    int			fan;
40093433Ssos	    int			temp;
40193433Ssos	    int			v05;
40293433Ssos	    int			v12;
40393433Ssos	} enclosure;
40476740Ssos    } u;
40574298Ssos};
40674298Ssos
40776740Ssos#define IOCATA			_IOWR('a',  1, struct ata_cmd)
40874298Ssos
40974298Ssos#endif /* _SYS_ATA_H_ */
410