xref: /illumos-gate/usr/src/uts/common/sys/scsi/adapters/pmcs/ata.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  *
21  *
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 /*
26  * Misc ATA definitions
27  */
28 #ifndef	_ATA_H
29 #define	_ATA_H
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include "ata8-acs.h"
35 #include "atapi7v3.h"
36 
37 /*
38  * IDENTIFY Data
39  */
40 typedef struct {
41 	uint16_t	word0;
42 	uint16_t	word1;
43 	uint16_t	word2;
44 	uint16_t	word3;
45 	uint16_t	word4;
46 	uint16_t	word5;
47 	uint16_t	word6;
48 	uint16_t	word7;
49 	uint16_t	word8;
50 	uint16_t	word9;
51 	uint16_t	serial_number[10];
52 	uint16_t	word20;
53 	uint16_t	word21;
54 	uint16_t	word22;
55 	uint16_t	firmware_revision[4];
56 	uint16_t	model_number[20];
57 	uint16_t	word47;
58 	uint16_t	word48;
59 	uint16_t	word49;
60 	uint16_t	word50;
61 	uint16_t	word51;
62 	uint16_t	word52;
63 	uint16_t	word53;
64 	uint16_t	word54;
65 	uint16_t	word55;
66 	uint16_t	word56;
67 	uint16_t	word57;
68 	uint16_t	word58;
69 	uint16_t	word59;
70 	uint16_t	word60;
71 	uint16_t	word61;
72 	uint16_t	word62;
73 	uint16_t	word63;
74 	uint16_t	word64;
75 	uint16_t	word65;
76 	uint16_t	word66;
77 	uint16_t	word67;
78 	uint16_t	word68;
79 	uint16_t	word69;
80 	uint16_t	word70;
81 	uint16_t	word71;
82 	uint16_t	word72;
83 	uint16_t	word73;
84 	uint16_t	word74;
85 	uint16_t	word75;
86 	uint16_t	word76;
87 	uint16_t	word77;
88 	uint16_t	word78;
89 	uint16_t	word79;
90 	uint16_t	word80;
91 	uint16_t	word81;
92 	uint16_t	word82;
93 	uint16_t	word83;
94 	uint16_t	word84;
95 	uint16_t	word85;
96 	uint16_t	word86;
97 	uint16_t	word87;
98 	uint16_t	word88;
99 	uint16_t	word89;
100 	uint16_t	word90;
101 	uint16_t	word91;
102 	uint16_t	word92;
103 	uint16_t	word93;
104 	uint16_t	word94;
105 	uint16_t	word95;
106 	uint16_t	word96;
107 	uint16_t	word97;
108 	uint16_t	word98;
109 	uint16_t	word99;
110 	uint16_t	word100;
111 	uint16_t	word101;
112 	uint16_t	word102;
113 	uint16_t	word103;
114 	uint16_t	word104;
115 	uint16_t	word105;
116 	uint16_t	word106;
117 	uint16_t	word107;
118 	uint16_t	word108;
119 	uint16_t	word109;
120 	uint16_t	word110;
121 	uint16_t	word111;
122 	uint16_t	word112;
123 	uint16_t	word113;
124 	uint16_t	word114;
125 	uint16_t	word115;
126 	uint16_t	word116;
127 	uint16_t	word117;
128 	uint16_t	word118;
129 	uint16_t	word119;
130 	uint16_t	word120;
131 	uint16_t	word121;
132 	uint16_t	word122;
133 	uint16_t	word123;
134 	uint16_t	word124;
135 	uint16_t	word125;
136 	uint16_t	word126;
137 	uint16_t	word127;
138 	uint16_t	word128;
139 	uint16_t	word129;
140 	uint16_t	word130;
141 	uint16_t	word131;
142 	uint16_t	word132;
143 	uint16_t	word133;
144 	uint16_t	word134;
145 	uint16_t	word135;
146 	uint16_t	word136;
147 	uint16_t	word137;
148 	uint16_t	word138;
149 	uint16_t	word139;
150 	uint16_t	word140;
151 	uint16_t	word141;
152 	uint16_t	word142;
153 	uint16_t	word143;
154 	uint16_t	word144;
155 	uint16_t	word145;
156 	uint16_t	word146;
157 	uint16_t	word147;
158 	uint16_t	word148;
159 	uint16_t	word149;
160 	uint16_t	word150;
161 	uint16_t	word151;
162 	uint16_t	word152;
163 	uint16_t	word153;
164 	uint16_t	word154;
165 	uint16_t	word155;
166 	uint16_t	word156;
167 	uint16_t	word157;
168 	uint16_t	word158;
169 	uint16_t	word159;
170 	uint16_t	word160;
171 	uint16_t	word161;
172 	uint16_t	word162;
173 	uint16_t	word163;
174 	uint16_t	word164;
175 	uint16_t	word165;
176 	uint16_t	word166;
177 	uint16_t	word167;
178 	uint16_t	word168;
179 	uint16_t	word169;
180 	uint16_t	word170;
181 	uint16_t	word171;
182 	uint16_t	word172;
183 	uint16_t	word173;
184 	uint16_t	word174;
185 	uint16_t	word175;
186 	uint16_t	word176;
187 	uint16_t	word177;
188 	uint16_t	word178;
189 	uint16_t	word179;
190 	uint16_t	word180;
191 	uint16_t	word181;
192 	uint16_t	word182;
193 	uint16_t	word183;
194 	uint16_t	word184;
195 	uint16_t	word185;
196 	uint16_t	word186;
197 	uint16_t	word187;
198 	uint16_t	word188;
199 	uint16_t	word189;
200 	uint16_t	word190;
201 	uint16_t	word191;
202 	uint16_t	word192;
203 	uint16_t	word193;
204 	uint16_t	word194;
205 	uint16_t	word195;
206 	uint16_t	word196;
207 	uint16_t	word197;
208 	uint16_t	word198;
209 	uint16_t	word199;
210 	uint16_t	word200;
211 	uint16_t	word201;
212 	uint16_t	word202;
213 	uint16_t	word203;
214 	uint16_t	word204;
215 	uint16_t	word205;
216 	uint16_t	word206;
217 	uint16_t	word207;
218 	uint16_t	word208;
219 	uint16_t	word209;
220 	uint16_t	word210;
221 	uint16_t	word211;
222 	uint16_t	word212;
223 	uint16_t	word213;
224 	uint16_t	word214;
225 	uint16_t	word215;
226 	uint16_t	word216;
227 	uint16_t	word217;
228 	uint16_t	word218;
229 	uint16_t	word219;
230 	uint16_t	word220;
231 	uint16_t	word221;
232 	uint16_t	word222;
233 	uint16_t	word223;
234 	uint16_t	word224;
235 	uint16_t	word225;
236 	uint16_t	word226;
237 	uint16_t	word227;
238 	uint16_t	word228;
239 	uint16_t	word229;
240 	uint16_t	word230;
241 	uint16_t	word231;
242 	uint16_t	word232;
243 	uint16_t	word233;
244 	uint16_t	word234;
245 	uint16_t	word235;
246 	uint16_t	word236;
247 	uint16_t	word237;
248 	uint16_t	word238;
249 	uint16_t	word239;
250 	uint16_t	word240;
251 	uint16_t	word241;
252 	uint16_t	word242;
253 	uint16_t	word243;
254 	uint16_t	word244;
255 	uint16_t	word245;
256 	uint16_t	word246;
257 	uint16_t	word247;
258 	uint16_t	word248;
259 	uint16_t	word249;
260 	uint16_t	word250;
261 	uint16_t	word251;
262 	uint16_t	word252;
263 	uint16_t	word253;
264 	uint16_t	word254;
265 	uint16_t	word255;
266 } ata_identify_t;
267 
268 #define	LBA_CAPACITY(ati)						\
269 	((LE_16(ati->word83) & (1 << 10)) == 0)?			\
270 	(LE_16(ati->word60) | ((LE_16(ati->word61)) << 16)) :		\
271 	((LE_16(ati->word100)) | ((LE_16(ati->word101)) << 16) |	\
272 	(((uint64_t)LE_16(ati->word102)) << 32) |			\
273 	(((uint64_t)LE_16(ati->word103)) << 48))
274 
275 
276 #ifdef	__cplusplus
277 }
278 #endif
279 #endif	/* _ATA_H */
280