xref: /dflybsd-src/sys/dev/disk/ahci/atascsi.h (revision e0fb398bfbef1fb6d12dfb8308cdc83ce663cbc2)
1258223a3SMatthew Dillon /*
2258223a3SMatthew Dillon  * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
3258223a3SMatthew Dillon  *
4258223a3SMatthew Dillon  * Permission to use, copy, modify, and distribute this software for any
5258223a3SMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
6258223a3SMatthew Dillon  * copyright notice and this permission notice appear in all copies.
7258223a3SMatthew Dillon  *
8258223a3SMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9258223a3SMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10258223a3SMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11258223a3SMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12258223a3SMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13258223a3SMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14258223a3SMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15258223a3SMatthew Dillon  *
16258223a3SMatthew Dillon  * $OpenBSD: atascsi.h,v 1.33 2009/02/16 21:19:06 miod Exp $
17258223a3SMatthew Dillon  */
18258223a3SMatthew Dillon 
19258223a3SMatthew Dillon struct atascsi;
20258223a3SMatthew Dillon struct scsi_link;
21258223a3SMatthew Dillon 
22258223a3SMatthew Dillon /*
23258223a3SMatthew Dillon  * ATA commands
24258223a3SMatthew Dillon  */
25258223a3SMatthew Dillon 
26*e0fb398bSTim #define ATA_C_DATA_SET_MANAGEMENT 0x06 /* Data Set Management command */
273209f581SMatthew Dillon #define ATA_C_SATA_FEATURE_ENA	0x10
28258223a3SMatthew Dillon #define ATA_C_READDMA_EXT	0x25
29258223a3SMatthew Dillon #define ATA_C_READ_LOG_EXT	0x2f
30258223a3SMatthew Dillon #define ATA_C_WRITEDMA_EXT	0x35
31258223a3SMatthew Dillon #define ATA_C_READ_FPDMA	0x60
32258223a3SMatthew Dillon #define ATA_C_WRITE_FPDMA	0x61
333209f581SMatthew Dillon #define ATA_C_SATA_FEATURE_DIS	0x90
34258223a3SMatthew Dillon #define ATA_C_PACKET		0xa0
35fd8bd957SMatthew Dillon #define ATA_C_ATAPI_IDENTIFY	0xa1
36258223a3SMatthew Dillon #define ATA_C_READDMA		0xc8
37258223a3SMatthew Dillon #define ATA_C_WRITEDMA		0xca
381980eff3SMatthew Dillon #define ATA_C_READ_PM		0xe4
391980eff3SMatthew Dillon #define ATA_C_WRITE_PM		0xe8
40258223a3SMatthew Dillon #define ATA_C_FLUSH_CACHE	0xe7
41258223a3SMatthew Dillon #define ATA_C_FLUSH_CACHE_EXT	0xea /* lba48 */
42258223a3SMatthew Dillon #define ATA_C_IDENTIFY		0xec
43258223a3SMatthew Dillon #define ATA_C_SET_FEATURES	0xef
44258223a3SMatthew Dillon #define ATA_C_SEC_FREEZE_LOCK	0xf5
45258223a3SMatthew Dillon 
46258223a3SMatthew Dillon /*
473209f581SMatthew Dillon  * ATA SATA FEATURES subcommands
483209f581SMatthew Dillon  */
493209f581SMatthew Dillon #define ATA_SATAFT_NONZDMA	0x01	/* DMA non-zero buffer offset */
503209f581SMatthew Dillon #define ATA_SATAFT_DMAAAOPT	0x02	/* DMA AA optimization */
513209f581SMatthew Dillon #define ATA_SATAFT_DEVIPS	0x03	/* Device-initiated pwr state*/
523209f581SMatthew Dillon #define ATA_SATAFT_INORDER	0x04	/* in-order data delivery */
533209f581SMatthew Dillon #define ATA_SATAFT_ASYNCNOTIFY	0x05	/* Async notification */
543209f581SMatthew Dillon 
553209f581SMatthew Dillon /*
56258223a3SMatthew Dillon  * ATA SET FEATURES subcommands
57258223a3SMatthew Dillon  */
58*e0fb398bSTim #define ATA_SF_DSM_TRIM          0x01 /* TRIM DSM feature */
59258223a3SMatthew Dillon #define ATA_SF_WRITECACHE_EN	0x02
6069b3741eSMatthew Dillon #define ATA_SF_SETXFER		0x03
61258223a3SMatthew Dillon #define ATA_SF_LOOKAHEAD_EN	0xaa
62258223a3SMatthew Dillon 
63258223a3SMatthew Dillon struct ata_identify {
64258223a3SMatthew Dillon 	u_int16_t	config;		/*   0 */
65258223a3SMatthew Dillon 	u_int16_t	ncyls;		/*   1 */
66258223a3SMatthew Dillon 	u_int16_t	reserved1;	/*   2 */
67258223a3SMatthew Dillon 	u_int16_t	nheads;		/*   3 */
68258223a3SMatthew Dillon 	u_int16_t	track_size;	/*   4 */
69258223a3SMatthew Dillon 	u_int16_t	sector_size;	/*   5 */
70258223a3SMatthew Dillon 	u_int16_t	nsectors;	/*   6 */
71258223a3SMatthew Dillon 	u_int16_t	reserved2[3];	/*   7 vendor unique */
72258223a3SMatthew Dillon 	u_int8_t	serial[20];	/*  10 */
73258223a3SMatthew Dillon 	u_int16_t	buffer_type;	/*  20 */
74258223a3SMatthew Dillon 	u_int16_t	buffer_size;	/*  21 */
75258223a3SMatthew Dillon 	u_int16_t	ecc;		/*  22 */
76258223a3SMatthew Dillon 	u_int8_t	firmware[8];	/*  23 */
77258223a3SMatthew Dillon 	u_int8_t	model[40];	/*  27 */
78258223a3SMatthew Dillon 	u_int16_t	multi;		/*  47 */
79258223a3SMatthew Dillon 	u_int16_t	dwcap;		/*  48 */
80258223a3SMatthew Dillon 	u_int16_t	cap;		/*  49 */
81258223a3SMatthew Dillon 	u_int16_t	reserved3;	/*  50 */
82258223a3SMatthew Dillon 	u_int16_t	piomode;	/*  51 */
83258223a3SMatthew Dillon 	u_int16_t	dmamode;	/*  52 */
84258223a3SMatthew Dillon 	u_int16_t	validinfo;	/*  53 */
85258223a3SMatthew Dillon 	u_int16_t	curcyls;	/*  54 */
86258223a3SMatthew Dillon 	u_int16_t	curheads;	/*  55 */
87258223a3SMatthew Dillon 	u_int16_t	cursectrk;	/*  56 */
88258223a3SMatthew Dillon 	u_int16_t	curseccp[2];	/*  57 */
89258223a3SMatthew Dillon 	u_int16_t	mult2;		/*  59 */
90258223a3SMatthew Dillon 	u_int16_t	addrsec[2];	/*  60 */
91258223a3SMatthew Dillon 	u_int16_t	worddma;	/*  62 */
92258223a3SMatthew Dillon 	u_int16_t	dworddma;	/*  63 */
93258223a3SMatthew Dillon 	u_int16_t	advpiomode;	/*  64 */
94258223a3SMatthew Dillon 	u_int16_t	minmwdma;	/*  65 */
95258223a3SMatthew Dillon 	u_int16_t	recmwdma;	/*  66 */
96258223a3SMatthew Dillon 	u_int16_t	minpio;		/*  67 */
97258223a3SMatthew Dillon 	u_int16_t	minpioflow;	/*  68 */
98*e0fb398bSTim 	u_int16_t       support3;	/*  69 */
99*e0fb398bSTim #define ATA_SUPPORT_RZAT                0x0020
100*e0fb398bSTim #define ATA_SUPPORT_DRAT                0x4000
101*e0fb398bSTim 	u_int16_t	reserved4;	/*  70 */
102258223a3SMatthew Dillon 	u_int16_t	typtime[2];	/*  71 */
103258223a3SMatthew Dillon 	u_int16_t	reserved5[2];	/*  73 */
104258223a3SMatthew Dillon 	u_int16_t	qdepth;		/*  75 */
105258223a3SMatthew Dillon 	u_int16_t	satacap;	/*  76 */
106258223a3SMatthew Dillon 	u_int16_t	reserved6;	/*  77 */
107258223a3SMatthew Dillon 	u_int16_t	satafsup;	/*  78 */
108258223a3SMatthew Dillon 	u_int16_t	satafen;	/*  79 */
109258223a3SMatthew Dillon 	u_int16_t	majver;		/*  80 */
110258223a3SMatthew Dillon 	u_int16_t	minver;		/*  81 */
111258223a3SMatthew Dillon 	u_int16_t	cmdset82;	/*  82 */
112258223a3SMatthew Dillon 	u_int16_t	cmdset83;	/*  83 */
113258223a3SMatthew Dillon 	u_int16_t	cmdset84;	/*  84 */
114258223a3SMatthew Dillon 	u_int16_t	features85;	/*  85 */
115258223a3SMatthew Dillon 	u_int16_t	features86;	/*  86 */
116258223a3SMatthew Dillon 	u_int16_t	features87;	/*  87 */
117258223a3SMatthew Dillon #define ATA_ID_F87_WWN		(1<<8)
118258223a3SMatthew Dillon 	u_int16_t	ultradma;	/*  88 */
119258223a3SMatthew Dillon 	u_int16_t	erasetime;	/*  89 */
120258223a3SMatthew Dillon 	u_int16_t	erasetimex;	/*  90 */
121258223a3SMatthew Dillon 	u_int16_t	apm;		/*  91 */
122258223a3SMatthew Dillon 	u_int16_t	masterpw;	/*  92 */
123258223a3SMatthew Dillon 	u_int16_t	hwreset;	/*  93 */
124258223a3SMatthew Dillon 	u_int16_t	acoustic;	/*  94 */
125258223a3SMatthew Dillon 	u_int16_t	stream_min;	/*  95 */
126258223a3SMatthew Dillon 	u_int16_t	stream_xfer_d;	/*  96 */
127258223a3SMatthew Dillon 	u_int16_t	stream_lat;	/*  97 */
128258223a3SMatthew Dillon 	u_int16_t	streamperf[2];	/*  98 */
129258223a3SMatthew Dillon 	u_int16_t	addrsecxt[4];	/* 100 */
130258223a3SMatthew Dillon 	u_int16_t	stream_xfer_p;	/* 104 */
131*e0fb398bSTim 	u_int16_t	max_dsm_blocks;	/* 105 */
132258223a3SMatthew Dillon 	u_int16_t	phys_sect_sz;	/* 106 */
133258223a3SMatthew Dillon 	u_int16_t	seek_delay;	/* 107 */
134258223a3SMatthew Dillon 	u_int16_t	naa_ieee_oui;	/* 108 */
135258223a3SMatthew Dillon 	u_int16_t	ieee_oui_uid;	/* 109 */
136258223a3SMatthew Dillon 	u_int16_t	uid_mid;	/* 110 */
137258223a3SMatthew Dillon 	u_int16_t	uid_low;	/* 111 */
138258223a3SMatthew Dillon 	u_int16_t	resv_wwn[4];	/* 112 */
139258223a3SMatthew Dillon 	u_int16_t	incits;		/* 116 */
140258223a3SMatthew Dillon 	u_int16_t	words_lsec[2];	/* 117 */
141258223a3SMatthew Dillon 	u_int16_t	cmdset119;	/* 119 */
142258223a3SMatthew Dillon 	u_int16_t	features120;	/* 120 */
143258223a3SMatthew Dillon 	u_int16_t	padding2[6];
144258223a3SMatthew Dillon 	u_int16_t	rmsn;		/* 127 */
145258223a3SMatthew Dillon 	u_int16_t	securestatus;	/* 128 */
146fd8bd957SMatthew Dillon #define ATA_SECURE_LOCKED		(1<<2)
147fd8bd957SMatthew Dillon #define ATA_SECURE_FROZEN		(1<<3)
148258223a3SMatthew Dillon 	u_int16_t	vendor[31];	/* 129 */
149*e0fb398bSTim 	u_int16_t	padding3[9];	/* 160 */
150*e0fb398bSTim 	u_int16_t	support_dsm;	/* 169 */
151*e0fb398bSTim #define ATA_SUPPORT_DSM_TRIM            0x0001
152*e0fb398bSTim 	u_int16_t	padding5[6];	/* 170 */
153258223a3SMatthew Dillon 	u_int16_t	curmedser[30];	/* 176 */
154258223a3SMatthew Dillon 	u_int16_t	sctsupport;	/* 206 */
155258223a3SMatthew Dillon 	u_int16_t	padding4[48];	/* 207 */
156258223a3SMatthew Dillon 	u_int16_t	integrity;	/* 255 */
157258223a3SMatthew Dillon } __packed;
158258223a3SMatthew Dillon 
159258223a3SMatthew Dillon /*
160258223a3SMatthew Dillon  * IDENTIFY DEVICE data
161258223a3SMatthew Dillon  */
162669fbbf7SMatthew Dillon #define ATA_IDENTIFY_SECURITY		(1 << 1)
163258223a3SMatthew Dillon #define ATA_IDENTIFY_WRITECACHE		(1 << 5)
164258223a3SMatthew Dillon #define ATA_IDENTIFY_LOOKAHEAD		(1 << 6)
165258223a3SMatthew Dillon 
166258223a3SMatthew Dillon /*
167258223a3SMatthew Dillon  * Frame Information Structures
168258223a3SMatthew Dillon  */
169258223a3SMatthew Dillon 
170258223a3SMatthew Dillon #define ATA_FIS_LENGTH		20
171258223a3SMatthew Dillon 
172258223a3SMatthew Dillon struct ata_fis_h2d {
173258223a3SMatthew Dillon 	u_int8_t		type;
174258223a3SMatthew Dillon #define ATA_FIS_TYPE_H2D		0x27
175258223a3SMatthew Dillon 	u_int8_t		flags;
176258223a3SMatthew Dillon #define ATA_H2D_FLAGS_CMD		(1<<7)
177258223a3SMatthew Dillon 	u_int8_t		command;
178258223a3SMatthew Dillon 	u_int8_t		features;
179258223a3SMatthew Dillon #define ATA_H2D_FEATURES_DMA		(1<<0)
180258223a3SMatthew Dillon #define ATA_H2D_FEATURES_DIR		(1<<2)
181258223a3SMatthew Dillon #define ATA_H2D_FEATURES_DIR_READ	(1<<2)
182258223a3SMatthew Dillon #define ATA_H2D_FEATURES_DIR_WRITE	(0<<2)
183258223a3SMatthew Dillon 
184258223a3SMatthew Dillon 	u_int8_t		lba_low;
185258223a3SMatthew Dillon 	u_int8_t		lba_mid;
186258223a3SMatthew Dillon 	u_int8_t		lba_high;
187258223a3SMatthew Dillon 	u_int8_t		device;
188258223a3SMatthew Dillon #define ATA_H2D_DEVICE_LBA		0x40
189258223a3SMatthew Dillon 
190258223a3SMatthew Dillon 	u_int8_t		lba_low_exp;
191258223a3SMatthew Dillon 	u_int8_t		lba_mid_exp;
192258223a3SMatthew Dillon 	u_int8_t		lba_high_exp;
193258223a3SMatthew Dillon 	u_int8_t		features_exp;
194258223a3SMatthew Dillon 
195258223a3SMatthew Dillon 	u_int8_t		sector_count;
196258223a3SMatthew Dillon 	u_int8_t		sector_count_exp;
197258223a3SMatthew Dillon 	u_int8_t		reserved0;
198258223a3SMatthew Dillon 	u_int8_t		control;
199cec85a37SMatthew Dillon #define ATA_FIS_CONTROL_SRST	0x04
2001980eff3SMatthew Dillon #define ATA_FIS_CONTROL_4BIT	0x08
201258223a3SMatthew Dillon 
202258223a3SMatthew Dillon 	u_int8_t		reserved1;
203258223a3SMatthew Dillon 	u_int8_t		reserved2;
204258223a3SMatthew Dillon 	u_int8_t		reserved3;
205258223a3SMatthew Dillon 	u_int8_t		reserved4;
206258223a3SMatthew Dillon } __packed;
207258223a3SMatthew Dillon 
208258223a3SMatthew Dillon struct ata_fis_d2h {
209258223a3SMatthew Dillon 	u_int8_t		type;
210258223a3SMatthew Dillon #define ATA_FIS_TYPE_D2H		0x34
211258223a3SMatthew Dillon 	u_int8_t		flags;
212258223a3SMatthew Dillon #define ATA_D2H_FLAGS_INTR		(1<<6)
213258223a3SMatthew Dillon 	u_int8_t		status;
214258223a3SMatthew Dillon 	u_int8_t		error;
215258223a3SMatthew Dillon 
216258223a3SMatthew Dillon 	u_int8_t		lba_low;
217258223a3SMatthew Dillon 	u_int8_t		lba_mid;
218258223a3SMatthew Dillon 	u_int8_t		lba_high;
219258223a3SMatthew Dillon 	u_int8_t		device;
220258223a3SMatthew Dillon 
221258223a3SMatthew Dillon 	u_int8_t		lba_low_exp;
222258223a3SMatthew Dillon 	u_int8_t		lba_mid_exp;
223258223a3SMatthew Dillon 	u_int8_t		lba_high_exp;
224258223a3SMatthew Dillon 	u_int8_t		reserved0;
225258223a3SMatthew Dillon 
226258223a3SMatthew Dillon 	u_int8_t		sector_count;
227258223a3SMatthew Dillon 	u_int8_t		sector_count_exp;
228258223a3SMatthew Dillon 	u_int8_t		reserved1;
229258223a3SMatthew Dillon 	u_int8_t		reserved2;
230258223a3SMatthew Dillon 
231258223a3SMatthew Dillon 	u_int8_t		reserved3;
232258223a3SMatthew Dillon 	u_int8_t		reserved4;
233258223a3SMatthew Dillon 	u_int8_t		reserved5;
234258223a3SMatthew Dillon 	u_int8_t		reserved6;
235258223a3SMatthew Dillon } __packed;
236258223a3SMatthew Dillon 
237258223a3SMatthew Dillon /*
238258223a3SMatthew Dillon  * SATA log page 10h -
239258223a3SMatthew Dillon  * looks like a D2H FIS, with errored tag number in first byte.
240258223a3SMatthew Dillon  */
241258223a3SMatthew Dillon struct ata_log_page_10h {
242258223a3SMatthew Dillon 	struct ata_fis_d2h	err_regs;
243258223a3SMatthew Dillon #define ATA_LOG_10H_TYPE_NOTQUEUED	0x80
244258223a3SMatthew Dillon #define ATA_LOG_10H_TYPE_TAG_MASK	0x1f
245258223a3SMatthew Dillon 	u_int8_t		reserved[256 - sizeof(struct ata_fis_d2h)];
246258223a3SMatthew Dillon 	u_int8_t		vendor_specific[255];
247258223a3SMatthew Dillon 	u_int8_t		checksum;
248258223a3SMatthew Dillon } __packed;
249258223a3SMatthew Dillon 
250258223a3SMatthew Dillon /*
251258223a3SMatthew Dillon  * SATA registers
252258223a3SMatthew Dillon  */
253258223a3SMatthew Dillon 
254258223a3SMatthew Dillon #define SATA_SStatus_DET		0x00f
255258223a3SMatthew Dillon #define SATA_SStatus_DET_NODEV		0x000
256258223a3SMatthew Dillon #define SATA_SStatus_DET_NOPHY		0x001
257258223a3SMatthew Dillon #define SATA_SStatus_DET_DEV		0x003
258258223a3SMatthew Dillon #define SATA_SStatus_DET_OFFLINE	0x008
259258223a3SMatthew Dillon 
260258223a3SMatthew Dillon #define SATA_SStatus_SPD		0x0f0
261258223a3SMatthew Dillon #define SATA_SStatus_SPD_NONE		0x000
262258223a3SMatthew Dillon #define SATA_SStatus_SPD_1_5		0x010
263258223a3SMatthew Dillon #define SATA_SStatus_SPD_3_0		0x020
264258223a3SMatthew Dillon 
265258223a3SMatthew Dillon #define SATA_SStatus_IPM		0xf00
266258223a3SMatthew Dillon #define SATA_SStatus_IPM_NODEV		0x000
267258223a3SMatthew Dillon #define SATA_SStatus_IPM_ACTIVE		0x100
268258223a3SMatthew Dillon #define SATA_SStatus_IPM_PARTIAL	0x200
269258223a3SMatthew Dillon #define SATA_SStatus_IPM_SLUMBER	0x600
270258223a3SMatthew Dillon 
271258223a3SMatthew Dillon #define SATA_SIGNATURE_PORT_MULTIPLIER	0x96690101
272258223a3SMatthew Dillon #define SATA_SIGNATURE_ATAPI		0xeb140101
273258223a3SMatthew Dillon #define SATA_SIGNATURE_DISK		0x00000101
274258223a3SMatthew Dillon 
275258223a3SMatthew Dillon /*
276258223a3SMatthew Dillon  * ATA interface
277258223a3SMatthew Dillon  */
278258223a3SMatthew Dillon 
2791980eff3SMatthew Dillon struct ahci_port;
2801980eff3SMatthew Dillon 
281258223a3SMatthew Dillon struct ata_port {
2821980eff3SMatthew Dillon 	struct ata_identify	at_identify;	/* only if ATA_PORT_T_DISK */
2831980eff3SMatthew Dillon 	struct ahci_port	*at_ahci_port;
2841980eff3SMatthew Dillon 	int			at_type;
285258223a3SMatthew Dillon #define ATA_PORT_T_NONE			0
286258223a3SMatthew Dillon #define ATA_PORT_T_DISK			1
287258223a3SMatthew Dillon #define ATA_PORT_T_ATAPI		2
2881980eff3SMatthew Dillon #define ATA_PORT_T_PM			3
2891980eff3SMatthew Dillon 	int			at_features;
2901980eff3SMatthew Dillon #define ATA_PORT_F_WCACHE		(1 << 0)
2911980eff3SMatthew Dillon #define ATA_PORT_F_RAHEAD		(1 << 1)
2921980eff3SMatthew Dillon #define ATA_PORT_F_FRZLCK		(1 << 2)
2933209f581SMatthew Dillon #define ATA_PORT_F_RESCAN		(1 << 3) /* re-check on bus scan */
2941980eff3SMatthew Dillon 	int			at_probe;
2953209f581SMatthew Dillon #define ATA_PROBE_NEED_INIT		0
2963209f581SMatthew Dillon #define ATA_PROBE_NEED_HARD_RESET	1
2973209f581SMatthew Dillon #define ATA_PROBE_NEED_SOFT_RESET	2
2983209f581SMatthew Dillon #define ATA_PROBE_NEED_IDENT		3
2993209f581SMatthew Dillon #define ATA_PROBE_GOOD			4
3001980eff3SMatthew Dillon #define ATA_PROBE_FAILED		7
3011980eff3SMatthew Dillon 	int			at_ncqdepth;
3021980eff3SMatthew Dillon 	u_int64_t		at_capacity;	/* only if ATA_PORT_T_DISK */
3031980eff3SMatthew Dillon 	int			at_target;	/* port multiplier port */
3041980eff3SMatthew Dillon 	char			at_name[16];
305258223a3SMatthew Dillon };
306258223a3SMatthew Dillon 
307258223a3SMatthew Dillon struct ata_xfer {
308258223a3SMatthew Dillon 	struct ata_fis_h2d	*fis;
309258223a3SMatthew Dillon 	struct ata_fis_d2h	rfis;
310258223a3SMatthew Dillon 	u_int8_t		*packetcmd;
311258223a3SMatthew Dillon 	u_int8_t		tag;
312258223a3SMatthew Dillon 
313258223a3SMatthew Dillon 	void			*data;
314258223a3SMatthew Dillon 	size_t			datalen;
315258223a3SMatthew Dillon 	size_t			resid;
316258223a3SMatthew Dillon 
317258223a3SMatthew Dillon 	void			(*complete)(struct ata_xfer *);
318258223a3SMatthew Dillon 	u_int			timeout;
319258223a3SMatthew Dillon 
320258223a3SMatthew Dillon 	int			flags;
321258223a3SMatthew Dillon #define ATA_F_READ			(1<<0)
322258223a3SMatthew Dillon #define ATA_F_WRITE			(1<<1)
323258223a3SMatthew Dillon #define ATA_F_NOWAIT			(1<<2)
324258223a3SMatthew Dillon #define ATA_F_POLL			(1<<3)
325258223a3SMatthew Dillon #define ATA_F_PIO			(1<<4)
326258223a3SMatthew Dillon #define ATA_F_PACKET			(1<<5)
327258223a3SMatthew Dillon #define ATA_F_NCQ			(1<<6)
328258223a3SMatthew Dillon #define ATA_F_TIMEOUT_RUNNING		(1<<7)
3293209f581SMatthew Dillon #define ATA_F_TIMEOUT_DESIRED		(1<<8)
330f4553de1SMatthew Dillon #define ATA_F_TIMEOUT_EXPIRED		(1<<9)
33112feb904SMatthew Dillon #define ATA_F_AUTOSENSE			(1<<10)
33212feb904SMatthew Dillon #define ATA_F_EXCLUSIVE			(1<<11)
333492bffafSMatthew Dillon #define ATA_F_SILENT			(1<<12)
3341067474aSMatthew Dillon #define ATA_FMT_FLAGS			"\020" 				\
335492bffafSMatthew Dillon 					"\015SILENT"			\
33612feb904SMatthew Dillon 					"\014EXCLUSIVE"			\
33712feb904SMatthew Dillon 					"\013AUTOSENSE"			\
3381067474aSMatthew Dillon 					"\012EXPIRED"			\
3391067474aSMatthew Dillon 					"\011DESIRED" "\010TRUNNING"	\
340258223a3SMatthew Dillon 					"\007NCQ" "\006PACKET"		\
341258223a3SMatthew Dillon 					"\005PIO" "\004POLL" "\003NOWAIT" \
342258223a3SMatthew Dillon 					"\002WRITE" "\001READ"
343258223a3SMatthew Dillon 
344258223a3SMatthew Dillon 	volatile int		state;
345258223a3SMatthew Dillon #define ATA_S_SETUP			0
346258223a3SMatthew Dillon #define ATA_S_PENDING			1
347258223a3SMatthew Dillon #define ATA_S_COMPLETE			2
348258223a3SMatthew Dillon #define ATA_S_ERROR			3
349258223a3SMatthew Dillon #define ATA_S_TIMEOUT			4
350258223a3SMatthew Dillon #define ATA_S_ONCHIP			5
351258223a3SMatthew Dillon #define ATA_S_PUT			6
352258223a3SMatthew Dillon 
353258223a3SMatthew Dillon 	void			*atascsi_private;
3541980eff3SMatthew Dillon 	struct ata_port         *at;	/* NULL if direct-attached */
355258223a3SMatthew Dillon };
356258223a3SMatthew Dillon 
357