xref: /illumos-gate/usr/src/contrib/bhyve/sys/ata.h (revision 6960cd89)
1bf21cd93STycho Nightingale /*-
2*6960cd89SAndy Fiddaman  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*6960cd89SAndy Fiddaman  *
4bf21cd93STycho Nightingale  * Copyright (c) 2000 - 2008 Søren Schmidt <sos@FreeBSD.org>
5bf21cd93STycho Nightingale  * All rights reserved.
6bf21cd93STycho Nightingale  *
7bf21cd93STycho Nightingale  * Redistribution and use in source and binary forms, with or without
8bf21cd93STycho Nightingale  * modification, are permitted provided that the following conditions
9bf21cd93STycho Nightingale  * are met:
10bf21cd93STycho Nightingale  * 1. Redistributions of source code must retain the above copyright
11bf21cd93STycho Nightingale  *    notice, this list of conditions and the following disclaimer,
12bf21cd93STycho Nightingale  *    without modification, immediately at the beginning of the file.
13bf21cd93STycho Nightingale  * 2. Redistributions in binary form must reproduce the above copyright
14bf21cd93STycho Nightingale  *    notice, this list of conditions and the following disclaimer in the
15bf21cd93STycho Nightingale  *    documentation and/or other materials provided with the distribution.
16bf21cd93STycho Nightingale  *
27bf21cd93STycho Nightingale  *
284c87aefeSPatrick Mooney  * $FreeBSD$
29bf21cd93STycho Nightingale  */
30bf21cd93STycho Nightingale 
31bf21cd93STycho Nightingale #ifndef _SYS_ATA_H_
32bf21cd93STycho Nightingale #define _SYS_ATA_H_
33bf21cd93STycho Nightingale 
34bf21cd93STycho Nightingale #include <sys/ioccom.h>
35bf21cd93STycho Nightingale 
36bf21cd93STycho Nightingale /* ATA/ATAPI device parameters */
37bf21cd93STycho Nightingale struct ata_params {
38bf21cd93STycho Nightingale /*000*/ u_int16_t       config;         /* configuration info */
39bf21cd93STycho Nightingale #define ATA_PROTO_MASK                  0x8003
40bf21cd93STycho Nightingale #define ATA_PROTO_ATAPI                 0x8000
41bf21cd93STycho Nightingale #define ATA_PROTO_ATAPI_12              0x8000
42bf21cd93STycho Nightingale #define ATA_PROTO_ATAPI_16              0x8001
43bf21cd93STycho Nightingale #define ATA_PROTO_CFA                   0x848a
44bf21cd93STycho Nightingale #define ATA_ATAPI_TYPE_MASK             0x1f00
45bf21cd93STycho Nightingale #define ATA_ATAPI_TYPE_DIRECT           0x0000  /* disk/floppy */
46bf21cd93STycho Nightingale #define ATA_ATAPI_TYPE_TAPE             0x0100  /* streaming tape */
47bf21cd93STycho Nightingale #define ATA_ATAPI_TYPE_CDROM            0x0500  /* CD-ROM device */
48bf21cd93STycho Nightingale #define ATA_ATAPI_TYPE_OPTICAL          0x0700  /* optical disk */
49*6960cd89SAndy Fiddaman #define ATA_ATAPI_REMOVABLE             0x0080
50bf21cd93STycho Nightingale #define ATA_DRQ_MASK                    0x0060
51bf21cd93STycho Nightingale #define ATA_DRQ_SLOW                    0x0000  /* cpu 3 ms delay */
52bf21cd93STycho Nightingale #define ATA_DRQ_INTR                    0x0020  /* interrupt 10 ms delay */
53bf21cd93STycho Nightingale #define ATA_DRQ_FAST                    0x0040  /* accel 50 us delay */
54bf21cd93STycho Nightingale #define ATA_RESP_INCOMPLETE             0x0004
55bf21cd93STycho Nightingale 
56bf21cd93STycho Nightingale /*001*/ u_int16_t       cylinders;              /* # of cylinders */
57bf21cd93STycho Nightingale /*002*/ u_int16_t       specconf;		/* specific configuration */
58bf21cd93STycho Nightingale /*003*/ u_int16_t       heads;                  /* # heads */
59bf21cd93STycho Nightingale 	u_int16_t       obsolete4;
60bf21cd93STycho Nightingale 	u_int16_t       obsolete5;
61bf21cd93STycho Nightingale /*006*/ u_int16_t       sectors;                /* # sectors/track */
62bf21cd93STycho Nightingale /*007*/ u_int16_t       vendor7[3];
63bf21cd93STycho Nightingale /*010*/ u_int8_t        serial[20];             /* serial number */
64bf21cd93STycho Nightingale /*020*/ u_int16_t       retired20;
65bf21cd93STycho Nightingale 	u_int16_t       retired21;
66bf21cd93STycho Nightingale 	u_int16_t       obsolete22;
67bf21cd93STycho Nightingale /*023*/ u_int8_t        revision[8];            /* firmware revision */
68bf21cd93STycho Nightingale /*027*/ u_int8_t        model[40];              /* model name */
69bf21cd93STycho Nightingale /*047*/ u_int16_t       sectors_intr;           /* sectors per interrupt */
70*6960cd89SAndy Fiddaman /*048*/ u_int16_t       tcg;                    /* Trusted Computing Group */
71*6960cd89SAndy Fiddaman #define ATA_SUPPORT_TCG                 0x0001
72bf21cd93STycho Nightingale /*049*/ u_int16_t       capabilities1;
73bf21cd93STycho Nightingale #define ATA_SUPPORT_DMA                 0x0100
74bf21cd93STycho Nightingale #define ATA_SUPPORT_LBA                 0x0200
75*6960cd89SAndy Fiddaman #define ATA_SUPPORT_IORDYDIS            0x0400
76*6960cd89SAndy Fiddaman #define ATA_SUPPORT_IORDY               0x0800
77bf21cd93STycho Nightingale #define ATA_SUPPORT_OVERLAP             0x4000
78bf21cd93STycho Nightingale 
79bf21cd93STycho Nightingale /*050*/ u_int16_t       capabilities2;
80bf21cd93STycho Nightingale /*051*/ u_int16_t       retired_piomode;        /* PIO modes 0-2 */
81bf21cd93STycho Nightingale #define ATA_RETIRED_PIO_MASK            0x0300
82bf21cd93STycho Nightingale 
83bf21cd93STycho Nightingale /*052*/ u_int16_t       retired_dmamode;        /* DMA modes */
84bf21cd93STycho Nightingale #define ATA_RETIRED_DMA_MASK            0x0003
85bf21cd93STycho Nightingale 
86bf21cd93STycho Nightingale /*053*/ u_int16_t       atavalid;               /* fields valid */
87bf21cd93STycho Nightingale #define ATA_FLAG_54_58                  0x0001  /* words 54-58 valid */
88bf21cd93STycho Nightingale #define ATA_FLAG_64_70                  0x0002  /* words 64-70 valid */
89bf21cd93STycho Nightingale #define ATA_FLAG_88                     0x0004  /* word 88 valid */
90bf21cd93STycho Nightingale 
91bf21cd93STycho Nightingale /*054*/ u_int16_t       current_cylinders;
92bf21cd93STycho Nightingale /*055*/ u_int16_t       current_heads;
93bf21cd93STycho Nightingale /*056*/ u_int16_t       current_sectors;
94bf21cd93STycho Nightingale /*057*/ u_int16_t       current_size_1;
95bf21cd93STycho Nightingale /*058*/ u_int16_t       current_size_2;
96bf21cd93STycho Nightingale /*059*/ u_int16_t       multi;
97*6960cd89SAndy Fiddaman #define ATA_SUPPORT_BLOCK_ERASE_EXT     0x8000
98*6960cd89SAndy Fiddaman #define ATA_SUPPORT_OVERWRITE_EXT       0x4000
99*6960cd89SAndy Fiddaman #define ATA_SUPPORT_CRYPTO_SCRAMBLE_EXT 0x2000
100*6960cd89SAndy Fiddaman #define ATA_SUPPORT_SANITIZE            0x1000
101*6960cd89SAndy Fiddaman #define	ATA_SUPPORT_SANITIZE_ALLOWED	0x0800
102*6960cd89SAndy Fiddaman #define	ATA_SUPPORT_ANTIFREEZE_LOCK_EXT	0x0400
103bf21cd93STycho Nightingale #define ATA_MULTI_VALID                 0x0100
104bf21cd93STycho Nightingale 
105bf21cd93STycho Nightingale /*060*/ u_int16_t       lba_size_1;
106bf21cd93STycho Nightingale 	u_int16_t       lba_size_2;
107bf21cd93STycho Nightingale 	u_int16_t       obsolete62;
108bf21cd93STycho Nightingale /*063*/ u_int16_t       mwdmamodes;             /* multiword DMA modes */
109bf21cd93STycho Nightingale /*064*/ u_int16_t       apiomodes;              /* advanced PIO modes */
110bf21cd93STycho Nightingale 
111bf21cd93STycho Nightingale /*065*/ u_int16_t       mwdmamin;               /* min. M/W DMA time/word ns */
112bf21cd93STycho Nightingale /*066*/ u_int16_t       mwdmarec;               /* rec. M/W DMA time ns */
113bf21cd93STycho Nightingale /*067*/ u_int16_t       pioblind;               /* min. PIO cycle w/o flow */
114bf21cd93STycho Nightingale /*068*/ u_int16_t       pioiordy;               /* min. PIO cycle IORDY flow */
115bf21cd93STycho Nightingale /*069*/ u_int16_t       support3;
116bf21cd93STycho Nightingale #define ATA_SUPPORT_RZAT                0x0020
117bf21cd93STycho Nightingale #define ATA_SUPPORT_DRAT                0x4000
118*6960cd89SAndy Fiddaman #define ATA_ENCRYPTS_ALL_USER_DATA      0x0010  /* Self-encrypting drive */
1194c87aefeSPatrick Mooney #define	ATA_SUPPORT_ZONE_MASK		0x0003
1204c87aefeSPatrick Mooney #define	ATA_SUPPORT_ZONE_NR		0x0000
1214c87aefeSPatrick Mooney #define	ATA_SUPPORT_ZONE_HOST_AWARE	0x0001
1224c87aefeSPatrick Mooney #define	ATA_SUPPORT_ZONE_DEV_MANAGED	0x0002
123bf21cd93STycho Nightingale 	u_int16_t       reserved70;
124bf21cd93STycho Nightingale /*071*/ u_int16_t       rlsovlap;               /* rel time (us) for overlap */
125bf21cd93STycho Nightingale /*072*/ u_int16_t       rlsservice;             /* rel time (us) for service */
126bf21cd93STycho Nightingale 	u_int16_t       reserved73;
127bf21cd93STycho Nightingale 	u_int16_t       reserved74;
128bf21cd93STycho Nightingale /*075*/ u_int16_t       queue;
129bf21cd93STycho Nightingale #define ATA_QUEUE_LEN(x)                ((x) & 0x001f)
130bf21cd93STycho Nightingale 
131bf21cd93STycho Nightingale /*76*/  u_int16_t       satacapabilities;
132bf21cd93STycho Nightingale #define ATA_SATA_GEN1                   0x0002
133bf21cd93STycho Nightingale #define ATA_SATA_GEN2                   0x0004
134bf21cd93STycho Nightingale #define ATA_SATA_GEN3                   0x0008
135bf21cd93STycho Nightingale #define ATA_SUPPORT_NCQ                 0x0100
136bf21cd93STycho Nightingale #define ATA_SUPPORT_IFPWRMNGTRCV        0x0200
137bf21cd93STycho Nightingale #define ATA_SUPPORT_PHYEVENTCNT         0x0400
138bf21cd93STycho Nightingale #define ATA_SUPPORT_NCQ_UNLOAD          0x0800
139bf21cd93STycho Nightingale #define ATA_SUPPORT_NCQ_PRIO            0x1000
140bf21cd93STycho Nightingale #define ATA_SUPPORT_HAPST               0x2000
141bf21cd93STycho Nightingale #define ATA_SUPPORT_DAPST               0x4000
142bf21cd93STycho Nightingale #define ATA_SUPPORT_READLOGDMAEXT       0x8000
143bf21cd93STycho Nightingale 
144bf21cd93STycho Nightingale /*77*/  u_int16_t       satacapabilities2;
145bf21cd93STycho Nightingale #define ATA_SATA_CURR_GEN_MASK          0x0006
146bf21cd93STycho Nightingale #define ATA_SUPPORT_NCQ_STREAM          0x0010
147*6960cd89SAndy Fiddaman #define ATA_SUPPORT_NCQ_NON_DATA        0x0020
149bf21cd93STycho Nightingale #define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040
150bf21cd93STycho Nightingale /*78*/  u_int16_t       satasupport;
151bf21cd93STycho Nightingale #define ATA_SUPPORT_NONZERO             0x0002
152bf21cd93STycho Nightingale #define ATA_SUPPORT_AUTOACTIVATE        0x0004
153bf21cd93STycho Nightingale #define ATA_SUPPORT_IFPWRMNGT           0x0008
154bf21cd93STycho Nightingale #define ATA_SUPPORT_INORDERDATA         0x0010
155bf21cd93STycho Nightingale #define ATA_SUPPORT_ASYNCNOTIF          0x0020
156bf21cd93STycho Nightingale #define ATA_SUPPORT_SOFTSETPRESERVE     0x0040
157*6960cd89SAndy Fiddaman #define ATA_SUPPORT_NCQ_AUTOSENSE       0x0080
158bf21cd93STycho Nightingale /*79*/  u_int16_t       sataenabled;
159bf21cd93STycho Nightingale #define ATA_ENABLED_DAPST               0x0080
160bf21cd93STycho Nightingale 
161bf21cd93STycho Nightingale /*080*/ u_int16_t       version_major;
162bf21cd93STycho Nightingale /*081*/ u_int16_t       version_minor;
163bf21cd93STycho Nightingale 
164bf21cd93STycho Nightingale 	struct {
165bf21cd93STycho Nightingale /*082/085*/ u_int16_t   command1;
166bf21cd93STycho Nightingale #define ATA_SUPPORT_SMART               0x0001
167bf21cd93STycho Nightingale #define ATA_SUPPORT_SECURITY            0x0002
168bf21cd93STycho Nightingale #define ATA_SUPPORT_REMOVABLE           0x0004
169bf21cd93STycho Nightingale #define ATA_SUPPORT_POWERMGT            0x0008
170bf21cd93STycho Nightingale #define ATA_SUPPORT_PACKET              0x0010
171bf21cd93STycho Nightingale #define ATA_SUPPORT_WRITECACHE          0x0020
172bf21cd93STycho Nightingale #define ATA_SUPPORT_LOOKAHEAD           0x0040
173bf21cd93STycho Nightingale #define ATA_SUPPORT_RELEASEIRQ          0x0080
174bf21cd93STycho Nightingale #define ATA_SUPPORT_SERVICEIRQ          0x0100
175bf21cd93STycho Nightingale #define ATA_SUPPORT_RESET               0x0200
176bf21cd93STycho Nightingale #define ATA_SUPPORT_PROTECTED           0x0400
177bf21cd93STycho Nightingale #define ATA_SUPPORT_WRITEBUFFER         0x1000
178bf21cd93STycho Nightingale #define ATA_SUPPORT_READBUFFER          0x2000
179bf21cd93STycho Nightingale #define ATA_SUPPORT_NOP                 0x4000
180bf21cd93STycho Nightingale 
181bf21cd93STycho Nightingale /*083/086*/ u_int16_t   command2;
182bf21cd93STycho Nightingale #define ATA_SUPPORT_MICROCODE           0x0001
183bf21cd93STycho Nightingale #define ATA_SUPPORT_QUEUED              0x0002
184bf21cd93STycho Nightingale #define ATA_SUPPORT_CFA                 0x0004
185bf21cd93STycho Nightingale #define ATA_SUPPORT_APM                 0x0008
186bf21cd93STycho Nightingale #define ATA_SUPPORT_NOTIFY              0x0010
187bf21cd93STycho Nightingale #define ATA_SUPPORT_STANDBY             0x0020
188bf21cd93STycho Nightingale #define ATA_SUPPORT_SPINUP              0x0040
189bf21cd93STycho Nightingale #define ATA_SUPPORT_MAXSECURITY         0x0100
190bf21cd93STycho Nightingale #define ATA_SUPPORT_AUTOACOUSTIC        0x0200
191bf21cd93STycho Nightingale #define ATA_SUPPORT_ADDRESS48           0x0400
192bf21cd93STycho Nightingale #define ATA_SUPPORT_OVERLAY             0x0800
193bf21cd93STycho Nightingale #define ATA_SUPPORT_FLUSHCACHE          0x1000
194bf21cd93STycho Nightingale #define ATA_SUPPORT_FLUSHCACHE48        0x2000
195bf21cd93STycho Nightingale 
196bf21cd93STycho Nightingale /*084/087*/ u_int16_t   extension;
197bf21cd93STycho Nightingale #define ATA_SUPPORT_SMARTLOG		0x0001
198bf21cd93STycho Nightingale #define ATA_SUPPORT_SMARTTEST		0x0002
199bf21cd93STycho Nightingale #define ATA_SUPPORT_MEDIASN		0x0004
200bf21cd93STycho Nightingale #define ATA_SUPPORT_MEDIAPASS		0x0008
201bf21cd93STycho Nightingale #define ATA_SUPPORT_STREAMING		0x0010
202bf21cd93STycho Nightingale #define ATA_SUPPORT_GENLOG		0x0020
203bf21cd93STycho Nightingale #define ATA_SUPPORT_WRITEDMAFUAEXT	0x0040
204bf21cd93STycho Nightingale #define ATA_SUPPORT_WRITEDMAQFUAEXT	0x0080
205bf21cd93STycho Nightingale #define ATA_SUPPORT_64BITWWN		0x0100
206bf21cd93STycho Nightingale #define ATA_SUPPORT_UNLOAD		0x2000
207bf21cd93STycho Nightingale 	} __packed support, enabled;
208bf21cd93STycho Nightingale 
209bf21cd93STycho Nightingale /*088*/ u_int16_t       udmamodes;              /* UltraDMA modes */
210bf21cd93STycho Nightingale /*089*/ u_int16_t       erase_time;             /* time req'd in 2min units */
211bf21cd93STycho Nightingale /*090*/ u_int16_t       enhanced_erase_time;    /* time req'd in 2min units */
212bf21cd93STycho Nightingale /*091*/ u_int16_t       apm_value;
213bf21cd93STycho Nightingale /*092*/ u_int16_t       master_passwd_revision; /* password revision code */
214bf21cd93STycho Nightingale /*093*/ u_int16_t       hwres;
215bf21cd93STycho Nightingale #define ATA_CABLE_ID                    0x2000
216bf21cd93STycho Nightingale 
217bf21cd93STycho Nightingale /*094*/ u_int16_t       acoustic;
218bf21cd93STycho Nightingale #define ATA_ACOUSTIC_CURRENT(x)         ((x) & 0x00ff)
219bf21cd93STycho Nightingale #define ATA_ACOUSTIC_VENDOR(x)          (((x) & 0xff00) >> 8)
220bf21cd93STycho Nightingale 
221bf21cd93STycho Nightingale /*095*/ u_int16_t       stream_min_req_size;
222bf21cd93STycho Nightingale /*096*/ u_int16_t       stream_transfer_time;
223bf21cd93STycho Nightingale /*097*/ u_int16_t       stream_access_latency;
224bf21cd93STycho Nightingale /*098*/ u_int32_t       stream_granularity;
225bf21cd93STycho Nightingale /*100*/ u_int16_t       lba_size48_1;
226bf21cd93STycho Nightingale 	u_int16_t       lba_size48_2;
227bf21cd93STycho Nightingale 	u_int16_t       lba_size48_3;
228bf21cd93STycho Nightingale 	u_int16_t       lba_size48_4;
229bf21cd93STycho Nightingale 	u_int16_t       reserved104;
230bf21cd93STycho Nightingale /*105*/	u_int16_t       max_dsm_blocks;
231bf21cd93STycho Nightingale /*106*/	u_int16_t       pss;
232bf21cd93STycho Nightingale #define ATA_PSS_LSPPS			0x000F
233bf21cd93STycho Nightingale #define ATA_PSS_LSSABOVE512		0x1000
234bf21cd93STycho Nightingale #define ATA_PSS_MULTLS			0x2000
235bf21cd93STycho Nightingale #define ATA_PSS_VALID_MASK		0xC000
236bf21cd93STycho Nightingale #define ATA_PSS_VALID_VALUE		0x4000
237bf21cd93STycho Nightingale /*107*/ u_int16_t       isd;
238bf21cd93STycho Nightingale /*108*/ u_int16_t       wwn[4];
239bf21cd93STycho Nightingale 	u_int16_t       reserved112[5];
240bf21cd93STycho Nightingale /*117*/ u_int16_t       lss_1;
241bf21cd93STycho Nightingale /*118*/ u_int16_t       lss_2;
242bf21cd93STycho Nightingale /*119*/ u_int16_t       support2;
243bf21cd93STycho Nightingale #define ATA_SUPPORT_WRITEREADVERIFY	0x0002
244bf21cd93STycho Nightingale #define ATA_SUPPORT_WRITEUNCORREXT	0x0004
245bf21cd93STycho Nightingale #define ATA_SUPPORT_RWLOGDMAEXT		0x0008
246bf21cd93STycho Nightingale #define ATA_SUPPORT_MICROCODE3		0x0010
247bf21cd93STycho Nightingale #define ATA_SUPPORT_FREEFALL		0x0020
2484c87aefeSPatrick Mooney #define ATA_SUPPORT_SENSE_REPORT	0x0040
2494c87aefeSPatrick Mooney #define ATA_SUPPORT_EPC			0x0080
250*6960cd89SAndy Fiddaman #define ATA_SUPPORT_AMAX_ADDR		0x0100
251*6960cd89SAndy Fiddaman #define ATA_SUPPORT_DSN			0x0200
252bf21cd93STycho Nightingale /*120*/ u_int16_t       enabled2;
2534c87aefeSPatrick Mooney #define ATA_ENABLED_WRITEREADVERIFY	0x0002
2544c87aefeSPatrick Mooney #define ATA_ENABLED_WRITEUNCORREXT	0x0004
2554c87aefeSPatrick Mooney #define ATA_ENABLED_FREEFALL		0x0020
2564c87aefeSPatrick Mooney #define ATA_ENABLED_SENSE_REPORT	0x0040
2574c87aefeSPatrick Mooney #define ATA_ENABLED_EPC			0x0080
258*6960cd89SAndy Fiddaman #define ATA_ENABLED_DSN			0x0200
259bf21cd93STycho Nightingale 	u_int16_t       reserved121[6];
260bf21cd93STycho Nightingale /*127*/ u_int16_t       removable_status;
261bf21cd93STycho Nightingale /*128*/ u_int16_t       security_status;
262bf21cd93STycho Nightingale #define ATA_SECURITY_LEVEL		0x0100	/* 0: high, 1: maximum */
263bf21cd93STycho Nightingale #define ATA_SECURITY_ENH_SUPP		0x0020	/* enhanced erase supported */
264bf21cd93STycho Nightingale #define ATA_SECURITY_COUNT_EXP		0x0010	/* count expired */
265bf21cd93STycho Nightingale #define ATA_SECURITY_FROZEN		0x0008	/* security config is frozen */
266bf21cd93STycho Nightingale #define ATA_SECURITY_LOCKED		0x0004	/* drive is locked */
267bf21cd93STycho Nightingale #define ATA_SECURITY_ENABLED		0x0002	/* ATA Security is enabled */
268bf21cd93STycho Nightingale #define ATA_SECURITY_SUPPORTED		0x0001	/* ATA Security is supported */
269bf21cd93STycho Nightingale 
270bf21cd93STycho Nightingale 	u_int16_t       reserved129[31];
271bf21cd93STycho Nightingale /*160*/ u_int16_t       cfa_powermode1;
272bf21cd93STycho Nightingale 	u_int16_t       reserved161;
273bf21cd93STycho Nightingale /*162*/ u_int16_t       cfa_kms_support;
274bf21cd93STycho Nightingale /*163*/ u_int16_t       cfa_trueide_modes;
275bf21cd93STycho Nightingale /*164*/ u_int16_t       cfa_memory_modes;
276*6960cd89SAndy Fiddaman 	u_int16_t       reserved165[3];
277*6960cd89SAndy Fiddaman /*168*/ u_int16_t       form_factor;
278*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_MASK		0x000f
279*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_NOT_REPORTED	0x0000
280*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_5_25		0x0001
281*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_3_5		0x0002
282*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_2_5		0x0003
283*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_1_8		0x0004
284*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_SUB_1_8		0x0005
285*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_MSATA		0x0006
286*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_M_2		0x0007
287*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_MICRO_SSD	0x0008
288*6960cd89SAndy Fiddaman #define ATA_FORM_FACTOR_C_FAST		0x0009
289bf21cd93STycho Nightingale /*169*/	u_int16_t       support_dsm;
290bf21cd93STycho Nightingale #define ATA_SUPPORT_DSM_TRIM		0x0001
291*6960cd89SAndy Fiddaman /*170*/ u_int8_t        product_id[8];	/* Additional Product Identifier */
292*6960cd89SAndy Fiddaman 	u_int16_t       reserved174[2];
293bf21cd93STycho Nightingale /*176*/ u_int8_t        media_serial[60];
294bf21cd93STycho Nightingale /*206*/ u_int16_t       sct;
2954c87aefeSPatrick Mooney 	u_int16_t       reserved207[2];
296bf21cd93STycho Nightingale /*209*/ u_int16_t       lsalign;
297bf21cd93STycho Nightingale /*210*/ u_int16_t       wrv_sectors_m3_1;
298bf21cd93STycho Nightingale 	u_int16_t       wrv_sectors_m3_2;
299bf21cd93STycho Nightingale /*212*/ u_int16_t       wrv_sectors_m2_1;
300bf21cd93STycho Nightingale 	u_int16_t       wrv_sectors_m2_2;
301bf21cd93STycho Nightingale /*214*/ u_int16_t       nv_cache_caps;
302bf21cd93STycho Nightingale /*215*/ u_int16_t       nv_cache_size_1;
303bf21cd93STycho Nightingale 	u_int16_t       nv_cache_size_2;
304bf21cd93STycho Nightingale /*217*/ u_int16_t       media_rotation_rate;
305bf21cd93STycho Nightingale #define ATA_RATE_NOT_REPORTED		0x0000
306bf21cd93STycho Nightingale #define ATA_RATE_NON_ROTATING		0x0001
307bf21cd93STycho Nightingale 	u_int16_t       reserved218;
308bf21cd93STycho Nightingale /*219*/ u_int16_t       nv_cache_opt;
309bf21cd93STycho Nightingale /*220*/ u_int16_t       wrv_mode;
310bf21cd93STycho Nightingale 	u_int16_t       reserved221;
311bf21cd93STycho Nightingale /*222*/ u_int16_t       transport_major;
312bf21cd93STycho Nightingale /*223*/ u_int16_t       transport_minor;
313bf21cd93STycho Nightingale 	u_int16_t       reserved224[31];
314bf21cd93STycho Nightingale /*255*/ u_int16_t       integrity;
315*6960cd89SAndy Fiddaman } __packed __aligned(2);
316bf21cd93STycho Nightingale 
317bf21cd93STycho Nightingale /* ATA Dataset Management */
318bf21cd93STycho Nightingale #define ATA_DSM_BLK_SIZE	512
319bf21cd93STycho Nightingale #define ATA_DSM_BLK_RANGES	64
320bf21cd93STycho Nightingale #define ATA_DSM_RANGE_SIZE	8
321bf21cd93STycho Nightingale #define ATA_DSM_RANGE_MAX	65535
322bf21cd93STycho Nightingale 
323bf21cd93STycho Nightingale /*
324bf21cd93STycho Nightingale  * ATA Device Register
325bf21cd93STycho Nightingale  *
326bf21cd93STycho Nightingale  * bit 7 Obsolete (was 1 in early ATA specs)
327bf21cd93STycho Nightingale  * bit 6 Sets LBA/CHS mode. 1=LBA, 0=CHS
328bf21cd93STycho Nightingale  * bit 5 Obsolete (was 1 in early ATA specs)
329bf21cd93STycho Nightingale  * bit 4 1 = Slave Drive, 0 = Master Drive
330bf21cd93STycho Nightingale  * bit 3-0 In LBA mode, 27-24 of address. In CHS mode, head number
331bf21cd93STycho Nightingale */
332bf21cd93STycho Nightingale 
333bf21cd93STycho Nightingale #define ATA_DEV_MASTER		0x00
334bf21cd93STycho Nightingale #define ATA_DEV_SLAVE		0x10
335bf21cd93STycho Nightingale #define ATA_DEV_LBA		0x40
336bf21cd93STycho Nightingale 
337bf21cd93STycho Nightingale /* ATA limits */
338bf21cd93STycho Nightingale #define ATA_MAX_28BIT_LBA	268435455UL
339bf21cd93STycho Nightingale 
340bf21cd93STycho Nightingale /* ATA Status Register */
3414c87aefeSPatrick Mooney #define ATA_STATUS_ERROR		0x01
3424c87aefeSPatrick Mooney #define ATA_STATUS_SENSE_AVAIL		0x02
3434c87aefeSPatrick Mooney #define ATA_STATUS_ALIGN_ERR		0x04
3444c87aefeSPatrick Mooney #define ATA_STATUS_DATA_REQ		0x08
3454c87aefeSPatrick Mooney #define ATA_STATUS_DEF_WRITE_ERR	0x10
3464c87aefeSPatrick Mooney #define ATA_STATUS_DEVICE_FAULT		0x20
3474c87aefeSPatrick Mooney #define ATA_STATUS_DEVICE_READY		0x40
3484c87aefeSPatrick Mooney #define ATA_STATUS_BUSY			0x80
349bf21cd93STycho Nightingale 
350bf21cd93STycho Nightingale /* ATA Error Register */
351bf21cd93STycho Nightingale #define ATA_ERROR_ABORT		0x04
352bf21cd93STycho Nightingale #define ATA_ERROR_ID_NOT_FOUND	0x10
353bf21cd93STycho Nightingale 
354bf21cd93STycho Nightingale /* ATA HPA Features */
355bf21cd93STycho Nightingale #define ATA_HPA_FEAT_MAX_ADDR	0x00
356bf21cd93STycho Nightingale #define ATA_HPA_FEAT_SET_PWD	0x01
357bf21cd93STycho Nightingale #define ATA_HPA_FEAT_LOCK	0x02
358bf21cd93STycho Nightingale #define ATA_HPA_FEAT_UNLOCK	0x03
359bf21cd93STycho Nightingale #define ATA_HPA_FEAT_FREEZE	0x04
360bf21cd93STycho Nightingale 
361bf21cd93STycho Nightingale /* ATA transfer modes */
362bf21cd93STycho Nightingale #define ATA_MODE_MASK           0x0f
363bf21cd93STycho Nightingale #define ATA_DMA_MASK            0xf0
364bf21cd93STycho Nightingale #define ATA_PIO                 0x00
365bf21cd93STycho Nightingale #define ATA_PIO0                0x08
366bf21cd93STycho Nightingale #define ATA_PIO1                0x09
367bf21cd93STycho Nightingale #define ATA_PIO2                0x0a
368bf21cd93STycho Nightingale #define ATA_PIO3                0x0b
369bf21cd93STycho Nightingale #define ATA_PIO4                0x0c
370bf21cd93STycho Nightingale #define ATA_PIO_MAX             0x0f
371bf21cd93STycho Nightingale #define ATA_DMA                 0x10
372bf21cd93STycho Nightingale #define ATA_WDMA0               0x20
373bf21cd93STycho Nightingale #define ATA_WDMA1               0x21
374bf21cd93STycho Nightingale #define ATA_WDMA2               0x22
375bf21cd93STycho Nightingale #define ATA_UDMA0               0x40
376bf21cd93STycho Nightingale #define ATA_UDMA1               0x41
377bf21cd93STycho Nightingale #define ATA_UDMA2               0x42
378bf21cd93STycho Nightingale #define ATA_UDMA3               0x43
379bf21cd93STycho Nightingale #define ATA_UDMA4               0x44
380bf21cd93STycho Nightingale #define ATA_UDMA5               0x45
381bf21cd93STycho Nightingale #define ATA_UDMA6               0x46
382bf21cd93STycho Nightingale #define ATA_SA150               0x47
383bf21cd93STycho Nightingale #define ATA_SA300               0x48
3844c87aefeSPatrick Mooney #define ATA_SA600               0x49
385bf21cd93STycho Nightingale #define ATA_DMA_MAX             0x4f
386bf21cd93STycho Nightingale 
387bf21cd93STycho Nightingale /* ATA commands */
388bf21cd93STycho Nightingale #define ATA_NOP                         0x00    /* NOP */
389bf21cd93STycho Nightingale #define         ATA_NF_FLUSHQUEUE       0x00    /* flush queued cmd's */
390bf21cd93STycho Nightingale #define         ATA_NF_AUTOPOLL         0x01    /* start autopoll function */
391bf21cd93STycho Nightingale #define ATA_DATA_SET_MANAGEMENT		0x06
392bf21cd93STycho Nightingale #define 	ATA_DSM_TRIM		0x01
393bf21cd93STycho Nightingale #define ATA_DEVICE_RESET                0x08    /* reset device */
394bf21cd93STycho Nightingale #define ATA_READ                        0x20    /* read */
395bf21cd93STycho Nightingale #define ATA_READ48                      0x24    /* read 48bit LBA */
396bf21cd93STycho Nightingale #define ATA_READ_DMA48                  0x25    /* read DMA 48bit LBA */
397bf21cd93STycho Nightingale #define ATA_READ_DMA_QUEUED48           0x26    /* read DMA QUEUED 48bit LBA */
398bf21cd93STycho Nightingale #define ATA_READ_NATIVE_MAX_ADDRESS48   0x27    /* read native max addr 48bit */
399bf21cd93STycho Nightingale #define ATA_READ_MUL48                  0x29    /* read multi 48bit LBA */
400bf21cd93STycho Nightingale #define ATA_READ_STREAM_DMA48           0x2a    /* read DMA stream 48bit LBA */
401bf21cd93STycho Nightingale #define ATA_READ_LOG_EXT                0x2f    /* read log ext - PIO Data-In */
402bf21cd93STycho Nightingale #define ATA_READ_STREAM48               0x2b    /* read stream 48bit LBA */
403bf21cd93STycho Nightingale #define ATA_WRITE                       0x30    /* write */
404bf21cd93STycho Nightingale #define ATA_WRITE48                     0x34    /* write 48bit LBA */
405bf21cd93STycho Nightingale #define ATA_WRITE_DMA48                 0x35    /* write DMA 48bit LBA */
406bf21cd93STycho Nightingale #define ATA_WRITE_DMA_QUEUED48          0x36    /* write DMA QUEUED 48bit LBA*/
407bf21cd93STycho Nightingale #define ATA_SET_MAX_ADDRESS48           0x37    /* set max address 48bit */
408bf21cd93STycho Nightingale #define ATA_WRITE_MUL48                 0x39    /* write multi 48bit LBA */
409bf21cd93STycho Nightingale #define ATA_WRITE_STREAM_DMA48          0x3a
410bf21cd93STycho Nightingale #define ATA_WRITE_STREAM48              0x3b
411bf21cd93STycho Nightingale #define ATA_WRITE_DMA_FUA48             0x3d
412bf21cd93STycho Nightingale #define ATA_WRITE_DMA_QUEUED_FUA48      0x3e
413bf21cd93STycho Nightingale #define ATA_WRITE_LOG_EXT               0x3f
414bf21cd93STycho Nightingale #define ATA_READ_VERIFY                 0x40
415bf21cd93STycho Nightingale #define ATA_READ_VERIFY48               0x42
4164c87aefeSPatrick Mooney #define ATA_WRITE_UNCORRECTABLE48       0x45    /* write uncorrectable 48bit LBA */
4174c87aefeSPatrick Mooney #define         ATA_WU_PSEUDO           0x55    /* pseudo-uncorrectable error */
4184c87aefeSPatrick Mooney #define         ATA_WU_FLAGGED          0xaa    /* flagged-uncorrectable error */
419bf21cd93STycho Nightingale #define ATA_READ_LOG_DMA_EXT            0x47    /* read log DMA ext - PIO Data-In */
4204c87aefeSPatrick Mooney #define	ATA_ZAC_MANAGEMENT_IN		0x4a	/* ZAC management in */
4214c87aefeSPatrick Mooney #define		ATA_ZM_REPORT_ZONES	0x00	/* report zones */
422*6960cd89SAndy Fiddaman #define	ATA_WRITE_LOG_DMA_EXT		0x57	/* WRITE LOG DMA EXT */
423*6960cd89SAndy Fiddaman #define	ATA_TRUSTED_NON_DATA		0x5b	/* TRUSTED NON-DATA */
424*6960cd89SAndy Fiddaman #define	ATA_TRUSTED_RECEIVE		0x5c	/* TRUSTED RECEIVE */
425*6960cd89SAndy Fiddaman #define	ATA_TRUSTED_RECEIVE_DMA		0x5d	/* TRUSTED RECEIVE DMA */
426*6960cd89SAndy Fiddaman #define	ATA_TRUSTED_SEND		0x5e	/* TRUSTED SEND */
427*6960cd89SAndy Fiddaman #define	ATA_TRUSTED_SEND_DMA		0x5f	/* TRUSTED SEND DMA */
428bf21cd93STycho Nightingale #define ATA_READ_FPDMA_QUEUED           0x60    /* read DMA NCQ */
429bf21cd93STycho Nightingale #define ATA_WRITE_FPDMA_QUEUED          0x61    /* write DMA NCQ */
4304c87aefeSPatrick Mooney #define ATA_NCQ_NON_DATA		0x63	/* NCQ non-data command */
4314c87aefeSPatrick Mooney #define		ATA_ABORT_NCQ_QUEUE	0x00	/* abort NCQ queue */
4324c87aefeSPatrick Mooney #define		ATA_DEADLINE_HANDLING	0x01	/* deadline handling */
4334c87aefeSPatrick Mooney #define		ATA_SET_FEATURES	0x05	/* set features */
4344c87aefeSPatrick Mooney #define		ATA_ZERO_EXT		0x06	/* zero ext */
4354c87aefeSPatrick Mooney #define		ATA_NCQ_ZAC_MGMT_OUT	0x07	/* NCQ ZAC mgmt out no data */
436bf21cd93STycho Nightingale #define ATA_SEND_FPDMA_QUEUED           0x64    /* send DMA NCQ */
4374c87aefeSPatrick Mooney #define		ATA_SFPDMA_DSM		0x00	/* Data set management */
4384c87aefeSPatrick Mooney #define			ATA_SFPDMA_DSM_TRIM	0x01	/* Set trim bit in auxiliary */
4394c87aefeSPatrick Mooney #define		ATA_SFPDMA_HYBRID_EVICT	0x01	/* Hybrid Evict */
4404c87aefeSPatrick Mooney #define		ATA_SFPDMA_WLDMA	0x02	/* Write Log DMA EXT */
4414c87aefeSPatrick Mooney #define		ATA_SFPDMA_ZAC_MGMT_OUT	0x03	/* NCQ ZAC mgmt out w/data */
4424c87aefeSPatrick Mooney #define ATA_RECV_FPDMA_QUEUED           0x65    /* receive DMA NCQ */
4434c87aefeSPatrick Mooney #define		ATA_RFPDMA_RL_DMA_EXT	0x00	/* Read Log DMA EXT */
4444c87aefeSPatrick Mooney #define		ATA_RFPDMA_ZAC_MGMT_IN	0x02	/* NCQ ZAC mgmt in w/data */
445bf21cd93STycho Nightingale #define ATA_SEP_ATTN                    0x67    /* SEP request */
446bf21cd93STycho Nightingale #define ATA_SEEK                        0x70    /* seek */
447*6960cd89SAndy Fiddaman #define	ATA_AMAX_ADDR			0x78	/* Accessible Max Address */
448*6960cd89SAndy Fiddaman #define		ATA_AMAX_ADDR_GET	0x00	/* GET NATIVE MAX ADDRESS EXT */
449*6960cd89SAndy Fiddaman #define		ATA_AMAX_ADDR_SET	0x01	/* SET ACCESSIBLE MAX ADDRESS EXT */
450*6960cd89SAndy Fiddaman #define		ATA_AMAX_ADDR_FREEZE	0x02	/* FREEZE ACCESSIBLE MAX ADDRESS EXT */
4514c87aefeSPatrick Mooney #define	ATA_ZAC_MANAGEMENT_OUT		0x9f	/* ZAC management out */
4524c87aefeSPatrick Mooney #define		ATA_ZM_CLOSE_ZONE	0x01	/* close zone */
4534c87aefeSPatrick Mooney #define		ATA_ZM_FINISH_ZONE	0x02	/* finish zone */
4544c87aefeSPatrick Mooney #define		ATA_ZM_OPEN_ZONE	0x03	/* open zone */
4554c87aefeSPatrick Mooney #define		ATA_ZM_RWP		0x04	/* reset write pointer */
456*6960cd89SAndy Fiddaman #define	ATA_DOWNLOAD_MICROCODE		0x92	/* DOWNLOAD MICROCODE */
457*6960cd89SAndy Fiddaman #define	ATA_DOWNLOAD_MICROCODE_DMA	0x93	/* DOWNLOAD MICROCODE DMA */
458bf21cd93STycho Nightingale #define ATA_PACKET_CMD                  0xa0    /* packet command */
459bf21cd93STycho Nightingale #define ATA_ATAPI_IDENTIFY              0xa1    /* get ATAPI params*/
460bf21cd93STycho Nightingale #define ATA_SERVICE                     0xa2    /* service command */
461bf21cd93STycho Nightingale #define ATA_SMART_CMD                   0xb0    /* SMART command */
462*6960cd89SAndy Fiddaman #define	ATA_SANITIZE			0xb4	/* sanitize device */
463bf21cd93STycho Nightingale #define ATA_CFA_ERASE                   0xc0    /* CFA erase */
464bf21cd93STycho Nightingale #define ATA_READ_MUL                    0xc4    /* read multi */
465bf21cd93STycho Nightingale #define ATA_WRITE_MUL                   0xc5    /* write multi */
466bf21cd93STycho Nightingale #define ATA_SET_MULTI                   0xc6    /* set multi size */
467bf21cd93STycho Nightingale #define ATA_READ_DMA_QUEUED             0xc7    /* read DMA QUEUED */
468bf21cd93STycho Nightingale #define ATA_READ_DMA                    0xc8    /* read DMA */
469bf21cd93STycho Nightingale #define ATA_WRITE_DMA                   0xca    /* write DMA */
470bf21cd93STycho Nightingale #define ATA_WRITE_DMA_QUEUED            0xcc    /* write DMA QUEUED */
471bf21cd93STycho Nightingale #define ATA_WRITE_MUL_FUA48             0xce
472bf21cd93STycho Nightingale #define ATA_STANDBY_IMMEDIATE           0xe0    /* standby immediate */
473bf21cd93STycho Nightingale #define ATA_IDLE_IMMEDIATE              0xe1    /* idle immediate */
474bf21cd93STycho Nightingale #define ATA_STANDBY_CMD                 0xe2    /* standby */
475bf21cd93STycho Nightingale #define ATA_IDLE_CMD                    0xe3    /* idle */
476bf21cd93STycho Nightingale #define ATA_READ_BUFFER                 0xe4    /* read buffer */
477bf21cd93STycho Nightingale #define ATA_READ_PM                     0xe4    /* read portmultiplier */
4784c87aefeSPatrick Mooney #define ATA_CHECK_POWER_MODE            0xe5    /* device power mode */
479bf21cd93STycho Nightingale #define ATA_SLEEP                       0xe6    /* sleep */
480bf21cd93STycho Nightingale #define ATA_FLUSHCACHE                  0xe7    /* flush cache to disk */
481*6960cd89SAndy Fiddaman #define	ATA_WRITE_BUFFER		0xe8    /* write buffer */
482bf21cd93STycho Nightingale #define ATA_WRITE_PM                    0xe8    /* write portmultiplier */
483*6960cd89SAndy Fiddaman #define	ATA_READ_BUFFER_DMA		0xe9    /* read buffer DMA */
484bf21cd93STycho Nightingale #define ATA_FLUSHCACHE48                0xea    /* flush cache to disk */
485*6960cd89SAndy Fiddaman #define	ATA_WRITE_BUFFER_DMA		0xeb    /* write buffer DMA */
486bf21cd93STycho Nightingale #define ATA_ATA_IDENTIFY                0xec    /* get ATA params */
487bf21cd93STycho Nightingale #define ATA_SETFEATURES                 0xef    /* features command */
488bf21cd93STycho Nightingale #define         ATA_SF_ENAB_WCACHE      0x02    /* enable write cache */
489bf21cd93STycho Nightingale #define         ATA_SF_DIS_WCACHE       0x82    /* disable write cache */
4904c87aefeSPatrick Mooney #define         ATA_SF_SETXFER          0x03    /* set transfer mode */
4914c87aefeSPatrick Mooney #define		ATA_SF_APM		0x05	/* Enable APM feature set */
492bf21cd93STycho Nightingale #define         ATA_SF_ENAB_PUIS        0x06    /* enable PUIS */
493bf21cd93STycho Nightingale #define         ATA_SF_DIS_PUIS         0x86    /* disable PUIS */
494bf21cd93STycho Nightingale #define         ATA_SF_PUIS_SPINUP      0x07    /* PUIS spin-up */
4954c87aefeSPatrick Mooney #define		ATA_SF_WRV		0x0b	/* Enable Write-Read-Verify */
4964c87aefeSPatrick Mooney #define 	ATA_SF_DLC		0x0c	/* Enable device life control */
4974c87aefeSPatrick Mooney #define 	ATA_SF_SATA		0x10	/* Enable use of SATA feature */
4984c87aefeSPatrick Mooney #define 	ATA_SF_FFC		0x41	/* Free-fall Control */
4994c87aefeSPatrick Mooney #define 	ATA_SF_MHIST		0x43	/* Set Max Host Sect. Times */
5004c87aefeSPatrick Mooney #define 	ATA_SF_RATE		0x45	/* Set Rate Basis */
5014c87aefeSPatrick Mooney #define 	ATA_SF_EPC		0x4A	/* Extended Power Conditions */
502bf21cd93STycho Nightingale #define         ATA_SF_ENAB_RCACHE      0xaa    /* enable readahead cache */
503bf21cd93STycho Nightingale #define         ATA_SF_DIS_RCACHE       0x55    /* disable readahead cache */
504bf21cd93STycho Nightingale #define         ATA_SF_ENAB_RELIRQ      0x5d    /* enable release interrupt */
505bf21cd93STycho Nightingale #define         ATA_SF_DIS_RELIRQ       0xdd    /* disable release interrupt */
506bf21cd93STycho Nightingale #define         ATA_SF_ENAB_SRVIRQ      0x5e    /* enable service interrupt */
507bf21cd93STycho Nightingale #define         ATA_SF_DIS_SRVIRQ       0xde    /* disable service interrupt */
5084c87aefeSPatrick Mooney #define 	ATA_SF_LPSAERC		0x62	/* Long Phys Sect Align ErrRep*/
5094c87aefeSPatrick Mooney #define 	ATA_SF_DSN		0x63	/* Device Stats Notification */
510bf21cd93STycho Nightingale #define ATA_SECURITY_SET_PASSWORD       0xf1    /* set drive password */
511bf21cd93STycho Nightingale #define ATA_SECURITY_UNLOCK             0xf2    /* unlock drive using passwd */
512bf21cd93STycho Nightingale #define ATA_SECURITY_ERASE_PREPARE      0xf3    /* prepare to erase drive */
513bf21cd93STycho Nightingale #define ATA_SECURITY_ERASE_UNIT         0xf4    /* erase all blocks on drive */
514bf21cd93STycho Nightingale #define ATA_SECURITY_FREEZE_LOCK        0xf5    /* freeze security config */
515bf21cd93STycho Nightingale #define ATA_SECURITY_DISABLE_PASSWORD   0xf6    /* disable drive password */
516bf21cd93STycho Nightingale #define ATA_READ_NATIVE_MAX_ADDRESS     0xf8    /* read native max address */
517bf21cd93STycho Nightingale #define ATA_SET_MAX_ADDRESS             0xf9    /* set max address */
518bf21cd93STycho Nightingale 
519bf21cd93STycho Nightingale /* ATAPI commands */
520bf21cd93STycho Nightingale #define ATAPI_TEST_UNIT_READY           0x00    /* check if device is ready */
521bf21cd93STycho Nightingale #define ATAPI_REZERO                    0x01    /* rewind */
522bf21cd93STycho Nightingale #define ATAPI_REQUEST_SENSE             0x03    /* get sense data */
523bf21cd93STycho Nightingale #define ATAPI_FORMAT                    0x04    /* format unit */
524bf21cd93STycho Nightingale #define ATAPI_READ                      0x08    /* read data */
525bf21cd93STycho Nightingale #define ATAPI_WRITE                     0x0a    /* write data */
526bf21cd93STycho Nightingale #define ATAPI_WEOF                      0x10    /* write filemark */
527bf21cd93STycho Nightingale #define         ATAPI_WF_WRITE          0x01
528bf21cd93STycho Nightingale #define ATAPI_SPACE                     0x11    /* space command */
529bf21cd93STycho Nightingale #define         ATAPI_SP_FM             0x01
530bf21cd93STycho Nightingale #define         ATAPI_SP_EOD            0x03
531bf21cd93STycho Nightingale #define ATAPI_INQUIRY			0x12	/* get inquiry data */
532bf21cd93STycho Nightingale #define ATAPI_MODE_SELECT               0x15    /* mode select */
533bf21cd93STycho Nightingale #define ATAPI_ERASE                     0x19    /* erase */
534bf21cd93STycho Nightingale #define ATAPI_MODE_SENSE                0x1a    /* mode sense */
535bf21cd93STycho Nightingale #define ATAPI_START_STOP                0x1b    /* start/stop unit */
536bf21cd93STycho Nightingale #define         ATAPI_SS_LOAD           0x01
537bf21cd93STycho Nightingale #define         ATAPI_SS_RETENSION      0x02
538bf21cd93STycho Nightingale #define         ATAPI_SS_EJECT          0x04
539bf21cd93STycho Nightingale #define ATAPI_PREVENT_ALLOW             0x1e    /* media removal */
540bf21cd93STycho Nightingale #define ATAPI_READ_FORMAT_CAPACITIES    0x23    /* get format capacities */
541bf21cd93STycho Nightingale #define ATAPI_READ_CAPACITY             0x25    /* get volume capacity */
542bf21cd93STycho Nightingale #define ATAPI_READ_BIG                  0x28    /* read data */
543bf21cd93STycho Nightingale #define ATAPI_WRITE_BIG                 0x2a    /* write data */
544bf21cd93STycho Nightingale #define ATAPI_LOCATE                    0x2b    /* locate to position */
545bf21cd93STycho Nightingale #define ATAPI_READ_POSITION             0x34    /* read position */
546bf21cd93STycho Nightingale #define ATAPI_SYNCHRONIZE_CACHE         0x35    /* flush buf, close channel */
547bf21cd93STycho Nightingale #define ATAPI_WRITE_BUFFER              0x3b    /* write device buffer */
548bf21cd93STycho Nightingale #define ATAPI_READ_BUFFER               0x3c    /* read device buffer */
549bf21cd93STycho Nightingale #define ATAPI_READ_SUBCHANNEL           0x42    /* get subchannel info */
550bf21cd93STycho Nightingale #define ATAPI_READ_TOC                  0x43    /* get table of contents */
551bf21cd93STycho Nightingale #define ATAPI_PLAY_10                   0x45    /* play by lba */
552bf21cd93STycho Nightingale #define ATAPI_PLAY_MSF                  0x47    /* play by MSF address */
553bf21cd93STycho Nightingale #define ATAPI_PLAY_TRACK                0x48    /* play by track number */
554bf21cd93STycho Nightingale #define ATAPI_PAUSE                     0x4b    /* pause audio operation */
555bf21cd93STycho Nightingale #define ATAPI_READ_DISK_INFO            0x51    /* get disk info structure */
556bf21cd93STycho Nightingale #define ATAPI_READ_TRACK_INFO           0x52    /* get track info structure */
557bf21cd93STycho Nightingale #define ATAPI_RESERVE_TRACK             0x53    /* reserve track */
558bf21cd93STycho Nightingale #define ATAPI_SEND_OPC_INFO             0x54    /* send OPC structurek */
559bf21cd93STycho Nightingale #define ATAPI_MODE_SELECT_BIG           0x55    /* set device parameters */
560bf21cd93STycho Nightingale #define ATAPI_REPAIR_TRACK              0x58    /* repair track */
561bf21cd93STycho Nightingale #define ATAPI_READ_MASTER_CUE           0x59    /* read master CUE info */
562bf21cd93STycho Nightingale #define ATAPI_MODE_SENSE_BIG            0x5a    /* get device parameters */
563bf21cd93STycho Nightingale #define ATAPI_CLOSE_TRACK               0x5b    /* close track/session */
564bf21cd93STycho Nightingale #define ATAPI_READ_BUFFER_CAPACITY      0x5c    /* get buffer capicity */
565bf21cd93STycho Nightingale #define ATAPI_SEND_CUE_SHEET            0x5d    /* send CUE sheet */
566bf21cd93STycho Nightingale #define ATAPI_SERVICE_ACTION_IN         0x96	/* get service data */
567bf21cd93STycho Nightingale #define ATAPI_BLANK                     0xa1    /* blank the media */
568bf21cd93STycho Nightingale #define ATAPI_SEND_KEY                  0xa3    /* send DVD key structure */
569bf21cd93STycho Nightingale #define ATAPI_REPORT_KEY                0xa4    /* get DVD key structure */
570bf21cd93STycho Nightingale #define ATAPI_PLAY_12                   0xa5    /* play by lba */
571bf21cd93STycho Nightingale #define ATAPI_LOAD_UNLOAD               0xa6    /* changer control command */
572bf21cd93STycho Nightingale #define ATAPI_READ_STRUCTURE            0xad    /* get DVD structure */
573bf21cd93STycho Nightingale #define ATAPI_PLAY_CD                   0xb4    /* universal play command */
574bf21cd93STycho Nightingale #define ATAPI_SET_SPEED                 0xbb    /* set drive speed */
575bf21cd93STycho Nightingale #define ATAPI_MECH_STATUS               0xbd    /* get changer status */
576bf21cd93STycho Nightingale #define ATAPI_READ_CD                   0xbe    /* read data */
577bf21cd93STycho Nightingale #define ATAPI_POLL_DSC                  0xff    /* poll DSC status bit */
578bf21cd93STycho Nightingale 
579bf21cd93STycho Nightingale struct ata_ioc_devices {
580bf21cd93STycho Nightingale     int                 channel;
581bf21cd93STycho Nightingale     char                name[2][32];
582bf21cd93STycho Nightingale     struct ata_params   params[2];
583bf21cd93STycho Nightingale };
584bf21cd93STycho Nightingale 
585bf21cd93STycho Nightingale /* pr channel ATA ioctl calls */
586bf21cd93STycho Nightingale #define IOCATAGMAXCHANNEL       _IOR('a',  1, int)
587bf21cd93STycho Nightingale #define IOCATAREINIT            _IOW('a',  2, int)
588bf21cd93STycho Nightingale #define IOCATAATTACH            _IOW('a',  3, int)
589bf21cd93STycho Nightingale #define IOCATADETACH            _IOW('a',  4, int)
590bf21cd93STycho Nightingale #define IOCATADEVICES           _IOWR('a',  5, struct ata_ioc_devices)
591bf21cd93STycho Nightingale 
592bf21cd93STycho Nightingale /* ATAPI request sense structure */
593bf21cd93STycho Nightingale struct atapi_sense {
594bf21cd93STycho Nightingale     u_int8_t	error;				/* current or deferred errors */
595bf21cd93STycho Nightingale #define	ATA_SENSE_VALID			0x80
596bf21cd93STycho Nightingale 
597bf21cd93STycho Nightingale     u_int8_t	segment;			/* segment number */
598bf21cd93STycho Nightingale     u_int8_t	key;				/* sense key */
599bf21cd93STycho Nightingale #define ATA_SENSE_KEY_MASK		0x0f    /* sense key mask */
600bf21cd93STycho Nightingale #define ATA_SENSE_NO_SENSE		0x00    /* no specific sense key info */
601bf21cd93STycho Nightingale #define ATA_SENSE_RECOVERED_ERROR 	0x01    /* command OK, data recovered */
602bf21cd93STycho Nightingale #define ATA_SENSE_NOT_READY		0x02    /* no access to drive */
603bf21cd93STycho Nightingale #define ATA_SENSE_MEDIUM_ERROR		0x03    /* non-recovered data error */
604bf21cd93STycho Nightingale #define ATA_SENSE_HARDWARE_ERROR	0x04    /* non-recoverable HW failure */
605bf21cd93STycho Nightingale #define ATA_SENSE_ILLEGAL_REQUEST	0x05    /* invalid command param(s) */
606bf21cd93STycho Nightingale #define ATA_SENSE_UNIT_ATTENTION	0x06    /* media changed */
607bf21cd93STycho Nightingale #define ATA_SENSE_DATA_PROTECT		0x07    /* write protect */
608bf21cd93STycho Nightingale #define ATA_SENSE_BLANK_CHECK		0x08    /* blank check */
609bf21cd93STycho Nightingale #define ATA_SENSE_VENDOR_SPECIFIC	0x09    /* vendor specific skey */
610bf21cd93STycho Nightingale #define ATA_SENSE_COPY_ABORTED		0x0a    /* copy aborted */
611bf21cd93STycho Nightingale #define ATA_SENSE_ABORTED_COMMAND	0x0b    /* command aborted, try again */
612bf21cd93STycho Nightingale #define ATA_SENSE_EQUAL			0x0c    /* equal */
613bf21cd93STycho Nightingale #define ATA_SENSE_VOLUME_OVERFLOW	0x0d    /* volume overflow */
614bf21cd93STycho Nightingale #define ATA_SENSE_MISCOMPARE		0x0e    /* data dont match the medium */
615bf21cd93STycho Nightingale #define ATA_SENSE_RESERVED		0x0f
616bf21cd93STycho Nightingale #define	ATA_SENSE_ILI			0x20;
617bf21cd93STycho Nightingale #define	ATA_SENSE_EOM			0x40;
618bf21cd93STycho Nightingale #define	ATA_SENSE_FILEMARK		0x80;
619bf21cd93STycho Nightingale 
620bf21cd93STycho Nightingale     u_int32_t   cmd_info;		/* cmd information */
621bf21cd93STycho Nightingale     u_int8_t	sense_length;		/* additional sense len (n-7) */
622bf21cd93STycho Nightingale     u_int32_t   cmd_specific_info;	/* additional cmd spec info */
623bf21cd93STycho Nightingale     u_int8_t    asc;			/* additional sense code */
624bf21cd93STycho Nightingale     u_int8_t    ascq;			/* additional sense code qual */
625bf21cd93STycho Nightingale     u_int8_t    replaceable_unit_code;	/* replaceable unit code */
626bf21cd93STycho Nightingale     u_int8_t	specific;		/* sense key specific */
627bf21cd93STycho Nightingale #define	ATA_SENSE_SPEC_VALID	0x80
628bf21cd93STycho Nightingale #define	ATA_SENSE_SPEC_MASK	0x7f
629*6960cd89SAndy Fiddaman 
630bf21cd93STycho Nightingale     u_int8_t	specific1;		/* sense key specific */
631bf21cd93STycho Nightingale     u_int8_t	specific2;		/* sense key specific */
632bf21cd93STycho Nightingale } __packed;
633bf21cd93STycho Nightingale 
6344c87aefeSPatrick Mooney /*
6354c87aefeSPatrick Mooney  * SET FEATURES subcommands
6364c87aefeSPatrick Mooney  */
6374c87aefeSPatrick Mooney 
6384c87aefeSPatrick Mooney /*
6394c87aefeSPatrick Mooney  * SET FEATURES command
6404c87aefeSPatrick Mooney  * Extended Power Conditions subcommand -- ATA_SF_EPC (0x4A)
6414c87aefeSPatrick Mooney  * These values go in the LBA 3:0.
6424c87aefeSPatrick Mooney  */
6434c87aefeSPatrick Mooney #define ATA_SF_EPC_RESTORE	0x00	/* Restore Power Condition Settings */
6444c87aefeSPatrick Mooney #define ATA_SF_EPC_GOTO		0x01	/* Go To Power Condition */
6454c87aefeSPatrick Mooney #define ATA_SF_EPC_SET_TIMER	0x02	/* Set Power Condition Timer */
6464c87aefeSPatrick Mooney #define ATA_SF_EPC_SET_STATE	0x03	/* Set Power Condition State */
6474c87aefeSPatrick Mooney #define ATA_SF_EPC_ENABLE	0x04	/* Enable the EPC feature set */
6484c87aefeSPatrick Mooney #define ATA_SF_EPC_DISABLE	0x05	/* Disable the EPC feature set */
6494c87aefeSPatrick Mooney #define ATA_SF_EPC_SET_SOURCE	0x06	/* Set EPC Power Source */
6504c87aefeSPatrick Mooney 
6514c87aefeSPatrick Mooney /*
6524c87aefeSPatrick Mooney  * SET FEATURES command
6534c87aefeSPatrick Mooney  * Extended Power Conditions subcommand -- ATA_SF_EPC (0x4A)
6544c87aefeSPatrick Mooney  * Power Condition ID field
6554c87aefeSPatrick Mooney  * These values go in the count register.
6564c87aefeSPatrick Mooney  */
6574c87aefeSPatrick Mooney #define ATA_EPC_STANDBY_Z	0x00	/* Substate of PM2:Standby */
6584c87aefeSPatrick Mooney #define ATA_EPC_STANDBY_Y	0x01	/* Substate of PM2:Standby */
6594c87aefeSPatrick Mooney #define ATA_EPC_IDLE_A		0x81	/* Substate of PM1:Idle */
6604c87aefeSPatrick Mooney #define ATA_EPC_IDLE_B		0x82	/* Substate of PM1:Idle */
6614c87aefeSPatrick Mooney #define ATA_EPC_IDLE_C		0x83	/* Substate of PM1:Idle */
6624c87aefeSPatrick Mooney #define ATA_EPC_ALL		0xff	/* All supported power conditions */
6634c87aefeSPatrick Mooney 
6644c87aefeSPatrick Mooney /*
6654c87aefeSPatrick Mooney  * SET FEATURES command
6664c87aefeSPatrick Mooney  * Extended Power Conditions subcommand -- ATA_SF_EPC (0x4A)
6674c87aefeSPatrick Mooney  * Restore Power Conditions Settings subcommand
6684c87aefeSPatrick Mooney  * These values go in the LBA register.
6694c87aefeSPatrick Mooney  */
6704c87aefeSPatrick Mooney #define ATA_SF_EPC_RST_DFLT	0x40	/* 1=Rst from Default, 0= from Saved */
6714c87aefeSPatrick Mooney #define ATA_SF_EPC_RST_SAVE	0x10	/* 1=Save on completion */
6724c87aefeSPatrick Mooney 
6734c87aefeSPatrick Mooney /*
6744c87aefeSPatrick Mooney  * SET FEATURES command
6754c87aefeSPatrick Mooney  * Extended Power Conditions subcommand -- ATA_SF_EPC (0x4A)
6764c87aefeSPatrick Mooney  * Got To Power Condition subcommand
6774c87aefeSPatrick Mooney  * These values go in the LBA register.
6784c87aefeSPatrick Mooney  */
6794c87aefeSPatrick Mooney #define ATA_SF_EPC_GOTO_DELAY	0x02000000	/* Delayed entry bit */
6804c87aefeSPatrick Mooney #define ATA_SF_EPC_GOTO_HOLD	0x01000000	/* Hold Power Cond bit */
6814c87aefeSPatrick Mooney 
6824c87aefeSPatrick Mooney /*
6834c87aefeSPatrick Mooney  * SET FEATURES command
6844c87aefeSPatrick Mooney  * Extended Power Conditions subcommand -- ATA_SF_EPC (0x4A)
6854c87aefeSPatrick Mooney  * Set Power Condition Timer subcommand
6864c87aefeSPatrick Mooney  * These values go in the LBA register.
6874c87aefeSPatrick Mooney  */
6884c87aefeSPatrick Mooney #define ATA_SF_EPC_TIMER_MASK	0x00ffff00	/* Timer field */
6894c87aefeSPatrick Mooney #define ATA_SF_EPC_TIMER_SHIFT	8
6904c87aefeSPatrick Mooney #define ATA_SF_EPC_TIMER_SEC	0x00000080	/* Timer units, 1=sec, 0=.1s */
6914c87aefeSPatrick Mooney #define ATA_SF_EPC_TIMER_EN	0x00000020	/* Enable/disable cond. */
6924c87aefeSPatrick Mooney #define ATA_SF_EPC_TIMER_SAVE	0x00000010	/* Save settings on comp.  */
6934c87aefeSPatrick Mooney 
6944c87aefeSPatrick Mooney /*
6954c87aefeSPatrick Mooney  * SET FEATURES command
6964c87aefeSPatrick Mooney  * Extended Power Conditions subcommand -- ATA_SF_EPC (0x4A)
6974c87aefeSPatrick Mooney  * Set Power Condition State subcommand
6984c87aefeSPatrick Mooney  * These values go in the LBA register.
6994c87aefeSPatrick Mooney  */
7004c87aefeSPatrick Mooney #define ATA_SF_EPC_SETCON_EN	0x00000020	/* Enable power cond. */
7014c87aefeSPatrick Mooney #define ATA_SF_EPC_SETCON_SAVE	0x00000010	/* Save settings on comp */
7024c87aefeSPatrick Mooney 
7034c87aefeSPatrick Mooney /*
7044c87aefeSPatrick Mooney  * SET FEATURES command
7054c87aefeSPatrick Mooney  * Extended Power Conditions subcommand -- ATA_SF_EPC (0x4A)
7064c87aefeSPatrick Mooney  * Set EPC Power Source subcommand
7074c87aefeSPatrick Mooney  * These values go in the count register.
7084c87aefeSPatrick Mooney  */
7094c87aefeSPatrick Mooney #define ATA_SF_EPC_SRC_UNKNOWN	0x0000	/* Unknown source */
7104c87aefeSPatrick Mooney #define ATA_SF_EPC_SRC_BAT	0x0001	/* battery source */
7114c87aefeSPatrick Mooney #define ATA_SF_EPC_SRC_NOT_BAT	0x0002	/* not battery source */
7124c87aefeSPatrick Mooney 
7134c87aefeSPatrick Mooney #define	ATA_LOG_DIRECTORY	0x00	/* Directory of all logs */
7144c87aefeSPatrick Mooney #define	ATA_POWER_COND_LOG	0x08	/* Power Conditions Log */
7154c87aefeSPatrick Mooney #define	ATA_PCL_IDLE		0x00	/* Idle Power Conditions Page */
7164c87aefeSPatrick Mooney #define	ATA_PCL_STANDBY		0x01	/* Standby Power Conditions Page */
7174c87aefeSPatrick Mooney #define	ATA_IDENTIFY_DATA_LOG	0x30	/* Identify Device Data Log */
7184c87aefeSPatrick Mooney #define	ATA_IDL_PAGE_LIST	0x00	/* List of supported pages */
7194c87aefeSPatrick Mooney #define	ATA_IDL_IDENTIFY_DATA	0x01	/* Copy of Identify Device data */
7204c87aefeSPatrick Mooney #define	ATA_IDL_CAPACITY	0x02	/* Capacity */
7214c87aefeSPatrick Mooney #define	ATA_IDL_SUP_CAP		0x03	/* Supported Capabilities */
7224c87aefeSPatrick Mooney #define	ATA_IDL_CUR_SETTINGS	0x04	/* Current Settings */
7234c87aefeSPatrick Mooney #define	ATA_IDL_ATA_STRINGS	0x05	/* ATA Strings */
7244c87aefeSPatrick Mooney #define	ATA_IDL_SECURITY	0x06	/* Security */
7254c87aefeSPatrick Mooney #define	ATA_IDL_PARALLEL_ATA	0x07	/* Parallel ATA */
726*6960cd89SAndy Fiddaman #define	ATA_IDL_SERIAL_ATA	0x08	/* Serial ATA */
7274c87aefeSPatrick Mooney #define	ATA_IDL_ZDI		0x09	/* Zoned Device Information */
7284c87aefeSPatrick Mooney 
7294c87aefeSPatrick Mooney struct ata_gp_log_dir {
7304c87aefeSPatrick Mooney 	uint8_t header[2];
7314c87aefeSPatrick Mooney #define	ATA_GP_LOG_DIR_VERSION		0x0001
7324c87aefeSPatrick Mooney 	uint8_t num_pages[255*2];	/* Number of log pages at address */
7334c87aefeSPatrick Mooney };
7344c87aefeSPatrick Mooney 
7354c87aefeSPatrick Mooney /*
7364c87aefeSPatrick Mooney  * ATA Power Conditions log descriptor
7374c87aefeSPatrick Mooney  */
7384c87aefeSPatrick Mooney struct ata_power_cond_log_desc {
7394c87aefeSPatrick Mooney 	uint8_t reserved1;
7404c87aefeSPatrick Mooney 	uint8_t flags;
7414c87aefeSPatrick Mooney #define ATA_PCL_COND_SUPPORTED		0x80
7424c87aefeSPatrick Mooney #define ATA_PCL_COND_SAVEABLE		0x40
7434c87aefeSPatrick Mooney #define ATA_PCL_COND_CHANGEABLE		0x20
7444c87aefeSPatrick Mooney #define ATA_PCL_DEFAULT_TIMER_EN	0x10
7454c87aefeSPatrick Mooney #define ATA_PCL_SAVED_TIMER_EN		0x08
7464c87aefeSPatrick Mooney #define ATA_PCL_CURRENT_TIMER_EN	0x04
7474c87aefeSPatrick Mooney #define ATA_PCL_HOLD_PC_NOT_SUP		0x02
7484c87aefeSPatrick Mooney 	uint8_t reserved2[2];
7494c87aefeSPatrick Mooney 	uint8_t default_timer[4];
7504c87aefeSPatrick Mooney 	uint8_t saved_timer[4];
7514c87aefeSPatrick Mooney 	uint8_t current_timer[4];
7524c87aefeSPatrick Mooney 	uint8_t nom_time_to_active[4];
7534c87aefeSPatrick Mooney 	uint8_t min_timer[4];
7544c87aefeSPatrick Mooney 	uint8_t max_timer[4];
7554c87aefeSPatrick Mooney 	uint8_t num_transitions_to_pc[4];
7564c87aefeSPatrick Mooney 	uint8_t hours_in_pc[4];
7574c87aefeSPatrick Mooney 	uint8_t reserved3[28];
7584c87aefeSPatrick Mooney };
7594c87aefeSPatrick Mooney 
7604c87aefeSPatrick Mooney /*
7614c87aefeSPatrick Mooney  * ATA Power Conditions Log (0x08), Idle power conditions page (0x00)
7624c87aefeSPatrick Mooney  */
7634c87aefeSPatrick Mooney struct ata_power_cond_log_idle {
7644c87aefeSPatrick Mooney 	struct ata_power_cond_log_desc idle_a_desc;
7654c87aefeSPatrick Mooney 	struct ata_power_cond_log_desc idle_b_desc;
7664c87aefeSPatrick Mooney 	struct ata_power_cond_log_desc idle_c_desc;
7674c87aefeSPatrick Mooney 	uint8_t reserved[320];
7684c87aefeSPatrick Mooney };
7694c87aefeSPatrick Mooney 
7704c87aefeSPatrick Mooney /*
7714c87aefeSPatrick Mooney  * ATA Power Conditions Log (0x08), Standby power conditions page (0x01)
7724c87aefeSPatrick Mooney  */
7734c87aefeSPatrick Mooney struct ata_power_cond_log_standby {
7744c87aefeSPatrick Mooney 	uint8_t reserved[384];
7754c87aefeSPatrick Mooney 	struct ata_power_cond_log_desc standby_y_desc;
7764c87aefeSPatrick Mooney 	struct ata_power_cond_log_desc standby_z_desc;
7774c87aefeSPatrick Mooney };
7784c87aefeSPatrick Mooney 
7794c87aefeSPatrick Mooney /*
7804c87aefeSPatrick Mooney  * ATA IDENTIFY DEVICE data log (0x30) page 0x00
7814c87aefeSPatrick Mooney  * List of Supported IDENTIFY DEVICE data pages.
7824c87aefeSPatrick Mooney  */
7834c87aefeSPatrick Mooney struct ata_identify_log_pages {
7844c87aefeSPatrick Mooney 	uint8_t header[8];
7854c87aefeSPatrick Mooney #define	ATA_IDLOG_REVISION	0x0000000000000001
7864c87aefeSPatrick Mooney 	uint8_t entry_count;
7874c87aefeSPatrick Mooney 	uint8_t entries[503];
7884c87aefeSPatrick Mooney };
7894c87aefeSPatrick Mooney 
7904c87aefeSPatrick Mooney /*
7914c87aefeSPatrick Mooney  * ATA IDENTIFY DEVICE data log (0x30)
7924c87aefeSPatrick Mooney  * Capacity (Page 0x02).
7934c87aefeSPatrick Mooney  */
7944c87aefeSPatrick Mooney struct ata_identify_log_capacity {
7954c87aefeSPatrick Mooney 	uint8_t header[8];
7964c87aefeSPatrick Mooney #define	ATA_CAP_HEADER_VALID	0x8000000000000000
7974c87aefeSPatrick Mooney #define	ATA_CAP_PAGE_NUM_MASK	0x0000000000ff0000
7984c87aefeSPatrick Mooney #define	ATA_CAP_PAGE_NUM_SHIFT	16
7994c87aefeSPatrick Mooney #define ATA_CAP_REV_MASK	0x00000000000000ff
8004c87aefeSPatrick Mooney 	uint8_t capacity[8];
8014c87aefeSPatrick Mooney #define	ATA_CAP_CAPACITY_VALID	0x8000000000000000
8024c87aefeSPatrick Mooney #define	ATA_CAP_ACCESSIBLE_CAP	0x0000ffffffffffff
8034c87aefeSPatrick Mooney 	uint8_t phys_logical_sect_size[8];
8044c87aefeSPatrick Mooney #define	ATA_CAP_PL_VALID	0x8000000000000000
8054c87aefeSPatrick Mooney #define	ATA_CAP_LTOP_REL_SUP	0x4000000000000000
8064c87aefeSPatrick Mooney #define	ATA_CAP_LOG_SECT_SUP	0x2000000000000000
8074c87aefeSPatrick Mooney #define	ATA_CAP_ALIGN_ERR_MASK	0x0000000000300000
8084c87aefeSPatrick Mooney #define	ATA_CAP_LTOP_MASK	0x00000000000f0000
8094c87aefeSPatrick Mooney #define	ATA_CAP_LOG_SECT_OFF	0x000000000000ffff
8104c87aefeSPatrick Mooney 	uint8_t logical_sect_size[8];
8114c87aefeSPatrick Mooney #define	ATA_CAP_LOG_SECT_VALID	0x8000000000000000
8124c87aefeSPatrick Mooney #define	ATA_CAP_LOG_SECT_SIZE	0x00000000ffffffff
8134c87aefeSPatrick Mooney 	uint8_t nominal_buffer_size[8];
8144c87aefeSPatrick Mooney #define	ATA_CAP_NOM_BUF_VALID	0x8000000000000000
8154c87aefeSPatrick Mooney #define	ATA_CAP_NOM_BUF_SIZE	0x7fffffffffffffff
8164c87aefeSPatrick Mooney 	uint8_t reserved[472];
8174c87aefeSPatrick Mooney };
8184c87aefeSPatrick Mooney 
8194c87aefeSPatrick Mooney /*
8204c87aefeSPatrick Mooney  * ATA IDENTIFY DEVICE data log (0x30)
8214c87aefeSPatrick Mooney  * Supported Capabilities (Page 0x03).
8224c87aefeSPatrick Mooney  */
8234c87aefeSPatrick Mooney 
8244c87aefeSPatrick Mooney struct ata_identify_log_sup_cap {
8254c87aefeSPatrick Mooney 	uint8_t header[8];
8264c87aefeSPatrick Mooney #define	ATA_SUP_CAP_HEADER_VALID	0x8000000000000000
8274c87aefeSPatrick Mooney #define	ATA_SUP_CAP_PAGE_NUM_MASK	0x0000000000ff0000
8284c87aefeSPatrick Mooney #define	ATA_SUP_CAP_PAGE_NUM_SHIFT	16
8294c87aefeSPatrick Mooney #define ATA_SUP_CAP_REV_MASK		0x00000000000000ff
8304c87aefeSPatrick Mooney 	uint8_t sup_cap[8];
8314c87aefeSPatrick Mooney #define	ATA_SUP_CAP_VALID		0x8000000000000000
8324c87aefeSPatrick Mooney #define	ATA_SC_SET_SECT_CONFIG_SUP	0x0002000000000000 /* Set Sect Conf*/
8334c87aefeSPatrick Mooney #define	ATA_SC_ZERO_EXT_SUP		0x0001000000000000 /* Zero EXT */
8344c87aefeSPatrick Mooney #define	ATA_SC_SUCC_NCQ_SENSE_SUP	0x0000800000000000 /* Succ. NCQ Sns */
8354c87aefeSPatrick Mooney #define	ATA_SC_DLC_SUP			0x0000400000000000 /* DLC */
8364c87aefeSPatrick Mooney #define	ATA_SC_RQSN_DEV_FAULT_SUP	0x0000200000000000 /* Req Sns Dev Flt*/
8374c87aefeSPatrick Mooney #define	ATA_SC_DSN_SUP			0x0000100000000000 /* DSN */
8384c87aefeSPatrick Mooney #define	ATA_SC_LP_STANDBY_SUP		0x0000080000000000 /* LP Standby */
8394c87aefeSPatrick Mooney #define	ATA_SC_SET_EPC_PS_SUP		0x0000040000000000 /* Set EPC PS */
8404c87aefeSPatrick Mooney #define	ATA_SC_AMAX_ADDR_SUP		0x0000020000000000 /* AMAX Addr */
8414c87aefeSPatrick Mooney #define	ATA_SC_DRAT_SUP			0x0000008000000000 /* DRAT */
8424c87aefeSPatrick Mooney #define	ATA_SC_LPS_MISALGN_SUP		0x0000004000000000 /* LPS Misalign */
8434c87aefeSPatrick Mooney #define	ATA_SC_RB_DMA_SUP		0x0000001000000000 /* Read Buf DMA */
8444c87aefeSPatrick Mooney #define	ATA_SC_WB_DMA_SUP		0x0000000800000000 /* Write Buf DMA */
8454c87aefeSPatrick Mooney #define	ATA_SC_DNLD_MC_DMA_SUP		0x0000000200000000 /* DL MCode DMA */
8464c87aefeSPatrick Mooney #define	ATA_SC_28BIT_SUP		0x0000000100000000 /* 28-bit */
8474c87aefeSPatrick Mooney #define	ATA_SC_RZAT_SUP			0x0000000080000000 /* RZAT */
8484c87aefeSPatrick Mooney #define	ATA_SC_NOP_SUP			0x0000000020000000 /* NOP */
8494c87aefeSPatrick Mooney #define	ATA_SC_READ_BUFFER_SUP		0x0000000010000000 /* Read Buffer */
8504c87aefeSPatrick Mooney #define	ATA_SC_WRITE_BUFFER_SUP		0x0000000008000000 /* Write Buffer */
8514c87aefeSPatrick Mooney #define	ATA_SC_READ_LOOK_AHEAD_SUP	0x0000000002000000 /* Read Look-Ahead*/
8524c87aefeSPatrick Mooney #define	ATA_SC_VOLATILE_WC_SUP		0x0000000001000000 /* Volatile WC */
8534c87aefeSPatrick Mooney #define	ATA_SC_SMART_SUP		0x0000000000800000 /* SMART */
8544c87aefeSPatrick Mooney #define	ATA_SC_FLUSH_CACHE_EXT_SUP	0x0000000000400000 /* Flush Cache Ext */
8554c87aefeSPatrick Mooney #define	ATA_SC_48BIT_SUP		0x0000000000100000 /* 48-Bit */
8564c87aefeSPatrick Mooney #define	ATA_SC_SPINUP_SUP		0x0000000000040000 /* Spin-Up */
8574c87aefeSPatrick Mooney #define	ATA_SC_PUIS_SUP			0x0000000000020000 /* PUIS */
8584c87aefeSPatrick Mooney #define	ATA_SC_APM_SUP			0x0000000000010000 /* APM */
8594c87aefeSPatrick Mooney #define	ATA_SC_DL_MICROCODE_SUP		0x0000000000004000 /* DL Microcode */
8604c87aefeSPatrick Mooney #define	ATA_SC_UNLOAD_SUP		0x0000000000002000 /* Unload */
8614c87aefeSPatrick Mooney #define	ATA_SC_WRITE_FUA_EXT_SUP	0x0000000000001000 /* Write FUA EXT */
8624c87aefeSPatrick Mooney #define	ATA_SC_GPL_SUP			0x0000000000000800 /* GPL */
8634c87aefeSPatrick Mooney #define	ATA_SC_STREAMING_SUP		0x0000000000000400 /* Streaming */
8644c87aefeSPatrick Mooney #define	ATA_SC_SMART_SELFTEST_SUP	0x0000000000000100 /* SMART self-test */
8654c87aefeSPatrick Mooney #define	ATA_SC_SMART_ERR_LOG_SUP	0x0000000000000080 /* SMART Err Log */
8664c87aefeSPatrick Mooney #define	ATA_SC_EPC_SUP			0x0000000000000040 /* EPC */
8674c87aefeSPatrick Mooney #define	ATA_SC_SENSE_SUP		0x0000000000000020 /* Sense data */
8684c87aefeSPatrick Mooney #define	ATA_SC_FREEFALL_SUP		0x0000000000000010 /* Free-Fall */
8694c87aefeSPatrick Mooney #define	ATA_SC_DM_MODE3_SUP		0x0000000000000008 /* DM Mode 3 */
8704c87aefeSPatrick Mooney #define	ATA_SC_GPL_DMA_SUP		0x0000000000000004 /* GPL DMA */
8714c87aefeSPatrick Mooney #define ATA_SC_WRITE_UNCOR_SUP		0x0000000000000002 /* Write uncorr.  */
8724c87aefeSPatrick Mooney #define ATA_SC_WRV_SUP			0x0000000000000001 /* WRV */
8734c87aefeSPatrick Mooney 	uint8_t download_code_cap[8];
8744c87aefeSPatrick Mooney #define ATA_DL_CODE_VALID		0x8000000000000000
8754c87aefeSPatrick Mooney #define	ATA_DLC_DM_OFFSETS_DEFER_SUP	0x0000000400000000
8764c87aefeSPatrick Mooney #define	ATA_DLC_DM_IMMED_SUP		0x0000000200000000
8774c87aefeSPatrick Mooney #define	ATA_DLC_DM_OFF_IMMED_SUP	0x0000000100000000
8784c87aefeSPatrick Mooney #define	ATA_DLC_DM_MAX_XFER_SIZE_MASK	0x00000000ffff0000
8794c87aefeSPatrick Mooney #define	ATA_DLC_DM_MAX_XFER_SIZE_SHIFT	16
8804c87aefeSPatrick Mooney #define	ATA_DLC_DM_MIN_XFER_SIZE_MASK	0x000000000000ffff
8814c87aefeSPatrick Mooney 	uint8_t nom_media_rotation_rate[8];
8824c87aefeSPatrick Mooney #define	ATA_NOM_MEDIA_ROTATION_VALID	0x8000000000000000
8834c87aefeSPatrick Mooney #define	ATA_ROTATION_MASK		0x000000000000ffff
8844c87aefeSPatrick Mooney 	uint8_t form_factor[8];
8854c87aefeSPatrick Mooney #define	ATA_FORM_FACTOR_VALID		0x8000000000000000
8864c87aefeSPatrick Mooney #define	ATA_FF_MASK			0x000000000000000f
8874c87aefeSPatrick Mooney #define	ATA_FF_NOT_REPORTED		0x0000000000000000 /* Not reported */
8884c87aefeSPatrick Mooney #define	ATA_FF_525_IN			0x0000000000000001 /* 5.25 inch */
8894c87aefeSPatrick Mooney #define	ATA_FF_35_IN			0x0000000000000002 /* 3.5 inch */
8904c87aefeSPatrick Mooney #define	ATA_FF_25_IN			0x0000000000000003 /* 2.5 inch */
8914c87aefeSPatrick Mooney #define	ATA_FF_18_IN			0x0000000000000004 /* 1.8 inch */
8924c87aefeSPatrick Mooney #define	ATA_FF_LT_18_IN			0x0000000000000005 /* < 1.8 inch */
8934c87aefeSPatrick Mooney #define	ATA_FF_MSATA			0x0000000000000006 /* mSATA */
8944c87aefeSPatrick Mooney #define	ATA_FF_M2			0x0000000000000007 /* M.2 */
8954c87aefeSPatrick Mooney #define	ATA_FF_MICROSSD			0x0000000000000008 /* MicroSSD */
8964c87aefeSPatrick Mooney #define	ATA_FF_CFAST			0x0000000000000009 /* CFast */
8974c87aefeSPatrick Mooney 	uint8_t wrv_sec_cnt_mode3[8];
8984c87aefeSPatrick Mooney #define ATA_WRV_MODE3_VALID		0x8000000000000000
8994c87aefeSPatrick Mooney #define ATA_WRV_MODE3_COUNT		0x00000000ffffffff
9004c87aefeSPatrick Mooney 	uint8_t wrv_sec_cnt_mode2[8];
9014c87aefeSPatrick Mooney #define	ATA_WRV_MODE2_VALID		0x8000000000000000
9024c87aefeSPatrick Mooney #define ATA_WRV_MODE2_COUNT		0x00000000ffffffff
9034c87aefeSPatrick Mooney 	uint8_t wwn[16];
9044c87aefeSPatrick Mooney 	/* XXX KDM need to figure out how to handle 128-bit fields */
9054c87aefeSPatrick Mooney 	uint8_t dsm[8];
9064c87aefeSPatrick Mooney #define	ATA_DSM_VALID			0x8000000000000000
9074c87aefeSPatrick Mooney #define	ATA_LB_MARKUP_SUP		0x000000000000ff00
9084c87aefeSPatrick Mooney #define	ATA_TRIM_SUP			0x0000000000000001
9094c87aefeSPatrick Mooney 	uint8_t util_per_unit_time[16];
9104c87aefeSPatrick Mooney 	/* XXX KDM need to figure out how to handle 128-bit fields */
9114c87aefeSPatrick Mooney 	uint8_t util_usage_rate_sup[8];
9124c87aefeSPatrick Mooney #define	ATA_UTIL_USAGE_RATE_VALID	0x8000000000000000
9134c87aefeSPatrick Mooney #define	ATA_SETTING_RATE_SUP		0x0000000000800000
9144c87aefeSPatrick Mooney #define	ATA_SINCE_POWERON_SUP		0x0000000000000100
9154c87aefeSPatrick Mooney #define	ATA_POH_RATE_SUP		0x0000000000000010
9164c87aefeSPatrick Mooney #define	ATA_DATE_TIME_RATE_SUP		0x0000000000000001
9174c87aefeSPatrick Mooney 	uint8_t zoned_cap[8];
9184c87aefeSPatrick Mooney #define	ATA_ZONED_VALID			0x8000000000000000
9194c87aefeSPatrick Mooney #define	ATA_ZONED_MASK			0x0000000000000003
9204c87aefeSPatrick Mooney 	uint8_t sup_zac_cap[8];
9214c87aefeSPatrick Mooney #define	ATA_SUP_ZAC_CAP_VALID		0x8000000000000000
9224c87aefeSPatrick Mooney #define	ATA_ND_RWP_SUP			0x0000000000000010 /* Reset Write Ptr*/
9234c87aefeSPatrick Mooney #define	ATA_ND_FINISH_ZONE_SUP		0x0000000000000008 /* Finish Zone */
9244c87aefeSPatrick Mooney #define	ATA_ND_CLOSE_ZONE_SUP		0x0000000000000004 /* Close Zone */
9254c87aefeSPatrick Mooney #define	ATA_ND_OPEN_ZONE_SUP		0x0000000000000002 /* Open Zone */
9264c87aefeSPatrick Mooney #define	ATA_REPORT_ZONES_SUP		0x0000000000000001 /* Report Zones */
9274c87aefeSPatrick Mooney 	uint8_t reserved[392];
9284c87aefeSPatrick Mooney };
9294c87aefeSPatrick Mooney 
9304c87aefeSPatrick Mooney /*
9314c87aefeSPatrick Mooney  * ATA Identify Device Data Log Zoned Device Information Page (0x09).
9324c87aefeSPatrick Mooney  * Current as of ZAC r04a, August 25, 2015.
9334c87aefeSPatrick Mooney  */
9344c87aefeSPatrick Mooney struct ata_zoned_info_log {
9354c87aefeSPatrick Mooney 	uint8_t header[8];
9364c87aefeSPatrick Mooney #define	ATA_ZDI_HEADER_VALID	0x8000000000000000
9374c87aefeSPatrick Mooney #define	ATA_ZDI_PAGE_NUM_MASK	0x0000000000ff0000
9384c87aefeSPatrick Mooney #define	ATA_ZDI_PAGE_NUM_SHIFT	16
9394c87aefeSPatrick Mooney #define ATA_ZDI_REV_MASK	0x00000000000000ff
9404c87aefeSPatrick Mooney 	uint8_t zoned_cap[8];
9414c87aefeSPatrick Mooney #define	ATA_ZDI_CAP_VALID	0x8000000000000000
9424c87aefeSPatrick Mooney #define	ATA_ZDI_CAP_URSWRZ	0x0000000000000001
9434c87aefeSPatrick Mooney 	uint8_t zoned_settings[8];
9444c87aefeSPatrick Mooney #define	ATA_ZDI_SETTINGS_VALID	0x8000000000000000
9454c87aefeSPatrick Mooney 	uint8_t optimal_seq_zones[8];
9464c87aefeSPatrick Mooney #define	ATA_ZDI_OPT_SEQ_VALID	0x8000000000000000
9474c87aefeSPatrick Mooney #define	ATA_ZDI_OPT_SEQ_MASK	0x00000000ffffffff
9484c87aefeSPatrick Mooney 	uint8_t optimal_nonseq_zones[8];
9494c87aefeSPatrick Mooney #define	ATA_ZDI_OPT_NS_VALID	0x8000000000000000
9504c87aefeSPatrick Mooney #define	ATA_ZDI_OPT_NS_MASK	0x00000000ffffffff
9514c87aefeSPatrick Mooney 	uint8_t max_seq_req_zones[8];
9524c87aefeSPatrick Mooney #define	ATA_ZDI_MAX_SEQ_VALID	0x8000000000000000
9534c87aefeSPatrick Mooney #define	ATA_ZDI_MAX_SEQ_MASK	0x00000000ffffffff
9544c87aefeSPatrick Mooney 	uint8_t version_info[8];
9554c87aefeSPatrick Mooney #define	ATA_ZDI_VER_VALID	0x8000000000000000
9564c87aefeSPatrick Mooney #define	ATA_ZDI_VER_ZAC_SUP	0x0100000000000000
9574c87aefeSPatrick Mooney #define	ATA_ZDI_VER_ZAC_MASK	0x00000000000000ff
9584c87aefeSPatrick Mooney 	uint8_t reserved[456];
9594c87aefeSPatrick Mooney };
9604c87aefeSPatrick Mooney 
961bf21cd93STycho Nightingale struct ata_ioc_request {
962bf21cd93STycho Nightingale     union {
963bf21cd93STycho Nightingale 	struct {
964bf21cd93STycho Nightingale 	    u_int8_t            command;
965bf21cd93STycho Nightingale 	    u_int8_t            feature;
966bf21cd93STycho Nightingale 	    u_int64_t           lba;
967bf21cd93STycho Nightingale 	    u_int16_t           count;
968bf21cd93STycho Nightingale 	} ata;
969bf21cd93STycho Nightingale 	struct {
970bf21cd93STycho Nightingale 	    char                ccb[16];
971bf21cd93STycho Nightingale 	    struct atapi_sense	sense;
972bf21cd93STycho Nightingale 	} atapi;
973bf21cd93STycho Nightingale     } u;
974bf21cd93STycho Nightingale     caddr_t             data;
975bf21cd93STycho Nightingale     int                 count;
976bf21cd93STycho Nightingale     int                 flags;
977bf21cd93STycho Nightingale #define ATA_CMD_CONTROL                 0x01
978bf21cd93STycho Nightingale #define ATA_CMD_READ                    0x02
979bf21cd93STycho Nightingale #define ATA_CMD_WRITE                   0x04
980bf21cd93STycho Nightingale #define ATA_CMD_ATAPI                   0x08
981bf21cd93STycho Nightingale 
982bf21cd93STycho Nightingale     int                 timeout;
983bf21cd93STycho Nightingale     int                 error;
984bf21cd93STycho Nightingale };
985bf21cd93STycho Nightingale 
986bf21cd93STycho Nightingale struct ata_security_password {
987bf21cd93STycho Nightingale 	u_int16_t		ctrl;
988bf21cd93STycho Nightingale #define ATA_SECURITY_PASSWORD_USER	0x0000
989bf21cd93STycho Nightingale #define ATA_SECURITY_PASSWORD_MASTER	0x0001
990bf21cd93STycho Nightingale #define ATA_SECURITY_ERASE_NORMAL	0x0000
991bf21cd93STycho Nightingale #define ATA_SECURITY_ERASE_ENHANCED	0x0002
992bf21cd93STycho Nightingale #define ATA_SECURITY_LEVEL_HIGH		0x0000
993bf21cd93STycho Nightingale #define ATA_SECURITY_LEVEL_MAXIMUM	0x0100
994bf21cd93STycho Nightingale 
995bf21cd93STycho Nightingale 	u_int8_t		password[32];
996bf21cd93STycho Nightingale 	u_int16_t		revision;
997bf21cd93STycho Nightingale 	u_int16_t		reserved[238];
998bf21cd93STycho Nightingale };
999bf21cd93STycho Nightingale 
1000bf21cd93STycho Nightingale /* pr device ATA ioctl calls */
1001bf21cd93STycho Nightingale #define IOCATAREQUEST           _IOWR('a', 100, struct ata_ioc_request)
1002bf21cd93STycho Nightingale #define IOCATAGPARM             _IOR('a', 101, struct ata_params)
1003bf21cd93STycho Nightingale #define IOCATAGMODE             _IOR('a', 102, int)
1004bf21cd93STycho Nightingale #define IOCATASMODE             _IOW('a', 103, int)
1005bf21cd93STycho Nightingale 
1006bf21cd93STycho Nightingale #define IOCATAGSPINDOWN		_IOR('a', 104, int)
1007bf21cd93STycho Nightingale #define IOCATASSPINDOWN		_IOW('a', 105, int)
1008bf21cd93STycho Nightingale 
1009bf21cd93STycho Nightingale struct ata_ioc_raid_config {
1010bf21cd93STycho Nightingale 	    int                 lun;
1011bf21cd93STycho Nightingale 	    int                 type;
1012bf21cd93STycho Nightingale #define AR_JBOD                         0x0001
1013bf21cd93STycho Nightingale #define AR_SPAN                         0x0002
1014bf21cd93STycho Nightingale #define AR_RAID0                        0x0004
1015bf21cd93STycho Nightingale #define AR_RAID1                        0x0008
1016bf21cd93STycho Nightingale #define AR_RAID01                       0x0010
1017bf21cd93STycho Nightingale #define AR_RAID3                        0x0020
1018bf21cd93STycho Nightingale #define AR_RAID4                        0x0040
1019bf21cd93STycho Nightingale #define AR_RAID5                        0x0080
1020bf21cd93STycho Nightingale 
1021bf21cd93STycho Nightingale 	    int                 interleave;
1022bf21cd93STycho Nightingale 	    int                 status;
1023bf21cd93STycho Nightingale #define AR_READY                        1
1024bf21cd93STycho Nightingale #define AR_DEGRADED                     2
1025bf21cd93STycho Nightingale #define AR_REBUILDING                   4
1026bf21cd93STycho Nightingale 
1027bf21cd93STycho Nightingale 	    int                 progress;
1028bf21cd93STycho Nightingale 	    int                 total_disks;
1029bf21cd93STycho Nightingale 	    int                 disks[16];
1030bf21cd93STycho Nightingale };
1031bf21cd93STycho Nightingale 
1032bf21cd93STycho Nightingale struct ata_ioc_raid_status {
1033bf21cd93STycho Nightingale 	    int                 lun;
1034bf21cd93STycho Nightingale 	    int                 type;
1035bf21cd93STycho Nightingale 	    int                 interleave;
1036bf21cd93STycho Nightingale 	    int                 status;
1037bf21cd93STycho Nightingale 	    int                 progress;
1038bf21cd93STycho Nightingale 	    int                 total_disks;
1039bf21cd93STycho Nightingale 	    struct {
1040bf21cd93STycho Nightingale 		    int		state;
1041bf21cd93STycho Nightingale #define AR_DISK_ONLINE			0x01
1042bf21cd93STycho Nightingale #define AR_DISK_PRESENT			0x02
1043bf21cd93STycho Nightingale #define AR_DISK_SPARE			0x04
1044bf21cd93STycho Nightingale 		    int		lun;
1045bf21cd93STycho Nightingale 	    } disks[16];
1046bf21cd93STycho Nightingale };
1047bf21cd93STycho Nightingale 
1048bf21cd93STycho Nightingale /* ATA RAID ioctl calls */
1049bf21cd93STycho Nightingale #define IOCATARAIDCREATE        _IOWR('a', 200, struct ata_ioc_raid_config)
1050bf21cd93STycho Nightingale #define IOCATARAIDDELETE        _IOW('a', 201, int)
1051bf21cd93STycho Nightingale #define IOCATARAIDSTATUS        _IOWR('a', 202, struct ata_ioc_raid_status)
1052bf21cd93STycho Nightingale #define IOCATARAIDADDSPARE      _IOW('a', 203, struct ata_ioc_raid_config)
1053bf21cd93STycho Nightingale #define IOCATARAIDREBUILD       _IOW('a', 204, int)
1054bf21cd93STycho Nightingale 
1055bf21cd93STycho Nightingale #endif /* _SYS_ATA_H_ */