VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/ide.h@ 10140

Last change on this file since 10140 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.6 KB
Line 
1/** @file
2 *
3 * VBox storage devices:
4 * ATA/ATAPI declarations
5 */
6
7/*
8 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __IDE_h__
24#define __IDE_h__
25
26
27/* Bits of HD_STATUS */
28#define ATA_STAT_ERR 0x01
29#define ATA_STAT_INDEX 0x02
30#define ATA_STAT_ECC 0x04 /* Corrected error */
31#define ATA_STAT_DRQ 0x08
32#define ATA_STAT_SEEK 0x10
33#define ATA_STAT_SRV 0x10
34#define ATA_STAT_WRERR 0x20
35#define ATA_STAT_READY 0x40
36#define ATA_STAT_BUSY 0x80
37
38/* Bits for HD_ERROR */
39#define MARK_ERR 0x01 /* Bad address mark */
40#define TRK0_ERR 0x02 /* couldn't find track 0 */
41#define ABRT_ERR 0x04 /* Command aborted */
42#define MCR_ERR 0x08 /* media change request */
43#define ID_ERR 0x10 /* ID field not found */
44#define MC_ERR 0x20 /* media changed */
45#define ECC_ERR 0x40 /* Uncorrectable ECC error */
46#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
47#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
48
49/* Bits for uATARegDevCtl. */
50#define ATA_DEVCTL_DISABLE_IRQ 0x02
51#define ATA_DEVCTL_RESET 0x04
52#define ATA_DEVCTL_HOB 0x80
53
54
55/* ATA/ATAPI Commands (as of ATA/ATAPI-8 draft T13/1699D Revision 3a).
56 * Please keep this in sync with g_apszATACmdNames. */
57typedef enum ATACMD
58{
59 ATA_NOP = 0x00,
60 ATA_CFA_REQUEST_EXTENDED_ERROR_CODE = 0x03,
61 ATA_DEVICE_RESET = 0x08,
62 ATA_RECALIBRATE = 0x10,
63 ATA_READ_SECTORS = 0x20,
64 ATA_READ_SECTORS_WITHOUT_RETRIES = 0x21,
65 ATA_READ_LONG = 0x22,
66 ATA_READ_LONG_WITHOUT_RETRIES = 0x23,
67 ATA_READ_SECTORS_EXT = 0x24,
68 ATA_READ_DMA_EXT = 0x25,
69 ATA_READ_DMA_QUEUED_EXT = 0x26,
70 ATA_READ_NATIVE_MAX_ADDRESS_EXT = 0x27,
71 ATA_READ_MULTIPLE_EXT = 0x29,
72 ATA_READ_STREAM_DMA_EXT = 0x2a,
73 ATA_READ_STREAM_EXT = 0x2b,
74 ATA_READ_LOG_EXT = 0x2f,
75 ATA_WRITE_SECTORS = 0x30,
76 ATA_WRITE_SECTORS_WITHOUT_RETRIES = 0x31,
77 ATA_WRITE_LONG = 0x32,
78 ATA_WRITE_LONG_WITHOUT_RETRIES = 0x33,
79 ATA_WRITE_SECTORS_EXT = 0x34,
80 ATA_WRITE_DMA_EXT = 0x35,
81 ATA_WRITE_DMA_QUEUED_EXT = 0x36,
82 ATA_SET_MAX_ADDRESS_EXT = 0x37,
83 ATA_CFA_WRITE_SECTORS_WITHOUT_ERASE = 0x38,
84 ATA_WRITE_MULTIPLE_EXT = 0x39,
85 ATA_WRITE_STREAM_DMA_EXT = 0x3a,
86 ATA_WRITE_STREAM_EXT = 0x3b,
87 ATA_WRITE_VERIFY = 0x3c,
88 ATA_WRITE_DMA_FUA_EXT = 0x3d,
89 ATA_WRITE_DMA_QUEUED_FUA_EXT = 0x3e,
90 ATA_WRITE_LOG_EXT = 0x3f,
91 ATA_READ_VERIFY_SECTORS = 0x40,
92 ATA_READ_VERIFY_SECTORS_WITHOUT_RETRIES = 0x41,
93 ATA_READ_VERIFY_SECTORS_EXT = 0x42,
94 ATA_WRITE_UNCORRECTABLE_EXT = 0x45,
95 ATA_READ_LOG_DMA_EXT = 0x47,
96 ATA_FORMAT_TRACK = 0x50,
97 ATA_CONFIGURE_STREAM = 0x51,
98 ATA_WRITE_LOG_DMA_EXT = 0x57,
99 ATA_TRUSTED_RECEIVE = 0x5c,
100 ATA_TRUSTED_RECEIVE_DMA = 0x5d,
101 ATA_TRUSTED_SEND = 0x5e,
102 ATA_TRUSTED_SEND_DMA = 0x5f,
103 ATA_READ_FPDMA_QUEUED = 0x60,
104 ATA_WRITE_FPDMA_QUEUED = 0x61,
105 ATA_SEEK = 0x70,
106 ATA_CFA_TRANSLATE_SECTOR = 0x87,
107 ATA_EXECUTE_DEVICE_DIAGNOSTIC = 0x90,
108 ATA_INITIALIZE_DEVICE_PARAMETERS = 0x91,
109 ATA_DOWNLOAD_MICROCODE = 0x92,
110 ATA_STANDBY_IMMEDIATE__ALT = 0x94,
111 ATA_IDLE_IMMEDIATE__ALT = 0x95,
112 ATA_STANDBY__ALT = 0x96,
113 ATA_IDLE__ALT = 0x97,
114 ATA_CHECK_POWER_MODE__ALT = 0x98,
115 ATA_SLEEP__ALT = 0x99,
116 ATA_PACKET = 0xa0,
117 ATA_IDENTIFY_PACKET_DEVICE = 0xa1,
118 ATA_SERVICE = 0xa2,
119 ATA_SMART = 0xb0,
120 ATA_DEVICE_CONFIGURATION_OVERLAY = 0xb1,
121 ATA_NV_CACHE = 0xb6,
122 ATA_CFA_ERASE_SECTORS = 0xc0,
123 ATA_READ_MULTIPLE = 0xc4,
124 ATA_WRITE_MULTIPLE = 0xc5,
125 ATA_SET_MULTIPLE_MODE = 0xc6,
126 ATA_READ_DMA_QUEUED = 0xc7,
127 ATA_READ_DMA = 0xc8,
128 ATA_READ_DMA_WITHOUT_RETRIES = 0xc9,
129 ATA_WRITE_DMA = 0xca,
130 ATA_WRITE_DMA_WITHOUT_RETRIES = 0xcb,
131 ATA_WRITE_DMA_QUEUED = 0xcc,
132 ATA_CFA_WRITE_MULTIPLE_WITHOUT_ERASE = 0xcd,
133 ATA_WRITE_MULTIPLE_FUA_EXT = 0xce,
134 ATA_CHECK_MEDIA_CARD_TYPE = 0xd1,
135 ATA_GET_MEDIA_STATUS = 0xda,
136 ATA_ACKNOWLEDGE_MEDIA_CHANGE = 0xdb,
137 ATA_BOOT_POST_BOOT = 0xdc,
138 ATA_BOOT_PRE_BOOT = 0xdd,
139 ATA_MEDIA_LOCK = 0xde,
140 ATA_MEDIA_UNLOCK = 0xdf,
141 ATA_STANDBY_IMMEDIATE = 0xe0,
142 ATA_IDLE_IMMEDIATE = 0xe1,
143 ATA_STANDBY = 0xe2,
144 ATA_IDLE = 0xe3,
145 ATA_READ_BUFFER = 0xe4,
146 ATA_CHECK_POWER_MODE = 0xe5,
147 ATA_SLEEP = 0xe6,
148 ATA_FLUSH_CACHE = 0xe7,
149 ATA_WRITE_BUFFER = 0xe8,
150 ATA_WRITE_SAME = 0xe9,
151 ATA_FLUSH_CACHE_EXT = 0xea,
152 ATA_IDENTIFY_DEVICE = 0xec,
153 ATA_MEDIA_EJECT = 0xed,
154 ATA_IDENTIFY_DMA = 0xee,
155 ATA_SET_FEATURES = 0xef,
156 ATA_SECURITY_SET_PASSWORD = 0xf1,
157 ATA_SECURITY_UNLOCK = 0xf2,
158 ATA_SECURITY_ERASE_PREPARE = 0xf3,
159 ATA_SECURITY_ERASE_UNIT = 0xf4,
160 ATA_SECURITY_FREEZE_LOCK = 0xf5,
161 ATA_SECURITY_DISABLE_PASSWORD = 0xf6,
162 ATA_READ_NATIVE_MAX_ADDRESS = 0xf8,
163 ATA_SET_MAX = 0xf9
164} ATACMD;
165
166#ifdef DEBUG
167static const char * const g_apszATACmdNames[256] =
168{
169 "NOP", /* 0x00 */
170 "", /* 0x01 */
171 "", /* 0x02 */
172 "CFA REQUEST EXTENDED ERROR CODE", /* 0x03 */
173 "", /* 0x04 */
174 "", /* 0x05 */
175 "", /* 0x06 */
176 "", /* 0x07 */
177 "DEVICE RESET", /* 0x08 */
178 "", /* 0x09 */
179 "", /* 0x0a */
180 "", /* 0x0b */
181 "", /* 0x0c */
182 "", /* 0x0d */
183 "", /* 0x0e */
184 "", /* 0x0f */
185 "RECALIBRATE", /* 0x10 */
186 "", /* 0x11 */
187 "", /* 0x12 */
188 "", /* 0x13 */
189 "", /* 0x14 */
190 "", /* 0x15 */
191 "", /* 0x16 */
192 "", /* 0x17 */
193 "", /* 0x18 */
194 "", /* 0x19 */
195 "", /* 0x1a */
196 "", /* 0x1b */
197 "", /* 0x1c */
198 "", /* 0x1d */
199 "", /* 0x1e */
200 "", /* 0x1f */
201 "READ SECTORS", /* 0x20 */
202 "READ SECTORS WITHOUT RETRIES", /* 0x21 */
203 "READ LONG", /* 0x22 */
204 "READ LONG WITHOUT RETRIES", /* 0x23 */
205 "READ SECTORS EXT", /* 0x24 */
206 "READ DMA EXT", /* 0x25 */
207 "READ DMA QUEUED EXT", /* 0x26 */
208 "READ NATIVE MAX ADDRESS EXT", /* 0x27 */
209 "", /* 0x28 */
210 "READ MULTIPLE EXT", /* 0x29 */
211 "READ STREAM DMA EXT", /* 0x2a */
212 "READ STREAM EXT", /* 0x2b */
213 "", /* 0x2c */
214 "", /* 0x2d */
215 "", /* 0x2e */
216 "READ LOG EXT", /* 0x2f */
217 "WRITE SECTORS", /* 0x30 */
218 "WRITE SECTORS WITHOUT RETRIES", /* 0x31 */
219 "WRITE LONG", /* 0x32 */
220 "WRITE LONG WITHOUT RETRIES", /* 0x33 */
221 "WRITE SECTORS EXT", /* 0x34 */
222 "WRITE DMA EXT", /* 0x35 */
223 "WRITE DMA QUEUED EXT", /* 0x36 */
224 "SET MAX ADDRESS EXT", /* 0x37 */
225 "CFA WRITE SECTORS WITHOUT ERASE", /* 0x38 */
226 "WRITE MULTIPLE EXT", /* 0x39 */
227 "WRITE STREAM DMA EXT", /* 0x3a */
228 "WRITE STREAM EXT", /* 0x3b */
229 "WRITE VERIFY", /* 0x3c */
230 "WRITE DMA FUA EXT", /* 0x3d */
231 "WRITE DMA QUEUED FUA EXT", /* 0x3e */
232 "WRITE LOG EXT", /* 0x3f */
233 "READ VERIFY SECTORS", /* 0x40 */
234 "READ VERIFY SECTORS WITHOUT RETRIES", /* 0x41 */
235 "READ VERIFY SECTORS EXT", /* 0x42 */
236 "", /* 0x43 */
237 "", /* 0x44 */
238 "WRITE UNCORRECTABLE EXT", /* 0x45 */
239 "", /* 0x46 */
240 "READ LOG DMA EXT", /* 0x47 */
241 "", /* 0x48 */
242 "", /* 0x49 */
243 "", /* 0x4a */
244 "", /* 0x4b */
245 "", /* 0x4c */
246 "", /* 0x4d */
247 "", /* 0x4e */
248 "", /* 0x4f */
249 "FORMAT TRACK", /* 0x50 */
250 "CONFIGURE STREAM", /* 0x51 */
251 "", /* 0x52 */
252 "", /* 0x53 */
253 "", /* 0x54 */
254 "", /* 0x55 */
255 "", /* 0x56 */
256 "WRITE LOG DMA EXT", /* 0x57 */
257 "", /* 0x58 */
258 "", /* 0x59 */
259 "", /* 0x5a */
260 "", /* 0x5b */
261 "TRUSTED RECEIVE", /* 0x5c */
262 "TRUSTED RECEIVE DMA", /* 0x5d */
263 "TRUSTED SEND", /* 0x5e */
264 "TRUSTED SEND DMA", /* 0x5f */
265 "READ FPDMA QUEUED", /* 0x60 */
266 "WRITE FPDMA QUEUED", /* 0x61 */
267 "", /* 0x62 */
268 "", /* 0x63 */
269 "", /* 0x64 */
270 "", /* 0x65 */
271 "", /* 0x66 */
272 "", /* 0x67 */
273 "", /* 0x68 */
274 "", /* 0x69 */
275 "", /* 0x6a */
276 "", /* 0x6b */
277 "", /* 0x6c */
278 "", /* 0x6d */
279 "", /* 0x6e */
280 "", /* 0x6f */
281 "SEEK", /* 0x70 */
282 "", /* 0x71 */
283 "", /* 0x72 */
284 "", /* 0x73 */
285 "", /* 0x74 */
286 "", /* 0x75 */
287 "", /* 0x76 */
288 "", /* 0x77 */
289 "", /* 0x78 */
290 "", /* 0x79 */
291 "", /* 0x7a */
292 "", /* 0x7b */
293 "", /* 0x7c */
294 "", /* 0x7d */
295 "", /* 0x7e */
296 "", /* 0x7f */
297 "", /* 0x80 */
298 "", /* 0x81 */
299 "", /* 0x82 */
300 "", /* 0x83 */
301 "", /* 0x84 */
302 "", /* 0x85 */
303 "", /* 0x86 */
304 "CFA TRANSLATE SECTOR", /* 0x87 */
305 "", /* 0x88 */
306 "", /* 0x89 */
307 "", /* 0x8a */
308 "", /* 0x8b */
309 "", /* 0x8c */
310 "", /* 0x8d */
311 "", /* 0x8e */
312 "", /* 0x8f */
313 "EXECUTE DEVICE DIAGNOSTIC", /* 0x90 */
314 "INITIALIZE DEVICE PARAMETERS", /* 0x91 */
315 "DOWNLOAD MICROCODE", /* 0x92 */
316 "", /* 0x93 */
317 "STANDBY IMMEDIATE ALT", /* 0x94 */
318 "IDLE IMMEDIATE ALT", /* 0x95 */
319 "STANDBY ALT", /* 0x96 */
320 "IDLE ALT", /* 0x97 */
321 "CHECK POWER MODE ALT", /* 0x98 */
322 "SLEEP ALT", /* 0x99 */
323 "", /* 0x9a */
324 "", /* 0x9b */
325 "", /* 0x9c */
326 "", /* 0x9d */
327 "", /* 0x9e */
328 "", /* 0x9f */
329 "PACKET", /* 0xa0 */
330 "IDENTIFY PACKET DEVICE", /* 0xa1 */
331 "SERVICE", /* 0xa2 */
332 "", /* 0xa3 */
333 "", /* 0xa4 */
334 "", /* 0xa5 */
335 "", /* 0xa6 */
336 "", /* 0xa7 */
337 "", /* 0xa8 */
338 "", /* 0xa9 */
339 "", /* 0xaa */
340 "", /* 0xab */
341 "", /* 0xac */
342 "", /* 0xad */
343 "", /* 0xae */
344 "", /* 0xaf */
345 "SMART", /* 0xb0 */
346 "DEVICE CONFIGURATION OVERLAY", /* 0xb1 */
347 "", /* 0xb2 */
348 "", /* 0xb3 */
349 "", /* 0xb4 */
350 "", /* 0xb5 */
351 "NV CACHE", /* 0xb6 */
352 "", /* 0xb7 */
353 "", /* 0xb8 */
354 "", /* 0xb9 */
355 "", /* 0xba */
356 "", /* 0xbb */
357 "", /* 0xbc */
358 "", /* 0xbd */
359 "", /* 0xbe */
360 "", /* 0xbf */
361 "CFA ERASE SECTORS", /* 0xc0 */
362 "", /* 0xc1 */
363 "", /* 0xc2 */
364 "", /* 0xc3 */
365 "READ MULTIPLE", /* 0xc4 */
366 "WRITE MULTIPLE", /* 0xc5 */
367 "SET MULTIPLE MODE", /* 0xc6 */
368 "READ DMA QUEUED", /* 0xc7 */
369 "READ DMA", /* 0xc8 */
370 "READ DMA WITHOUT RETRIES", /* 0xc9 */
371 "WRITE DMA", /* 0xca */
372 "WRITE DMA WITHOUT RETRIES", /* 0xcb */
373 "WRITE DMA QUEUED", /* 0xcc */
374 "CFA WRITE MULTIPLE WITHOUT ERASE", /* 0xcd */
375 "WRITE MULTIPLE FUA EXT", /* 0xce */
376 "", /* 0xcf */
377 "", /* 0xd0 */
378 "CHECK MEDIA CARD TYPE", /* 0xd1 */
379 "", /* 0xd2 */
380 "", /* 0xd3 */
381 "", /* 0xd4 */
382 "", /* 0xd5 */
383 "", /* 0xd6 */
384 "", /* 0xd7 */
385 "", /* 0xd8 */
386 "", /* 0xd9 */
387 "GET MEDIA STATUS", /* 0xda */
388 "ACKNOWLEDGE MEDIA CHANGE", /* 0xdb */
389 "BOOT POST BOOT", /* 0xdc */
390 "BOOT PRE BOOT", /* 0xdd */
391 "MEDIA LOCK", /* 0xde */
392 "MEDIA UNLOCK", /* 0xdf */
393 "STANDBY IMMEDIATE", /* 0xe0 */
394 "IDLE IMMEDIATE", /* 0xe1 */
395 "STANDBY", /* 0xe2 */
396 "IDLE", /* 0xe3 */
397 "READ BUFFER", /* 0xe4 */
398 "CHECK POWER MODE", /* 0xe5 */
399 "SLEEP", /* 0xe6 */
400 "FLUSH CACHE", /* 0xe7 */
401 "WRITE BUFFER", /* 0xe8 */
402 "WRITE SAME", /* 0xe9 */
403 "FLUSH CACHE EXT", /* 0xea */
404 "", /* 0xeb */
405 "IDENTIFY DEVICE", /* 0xec */
406 "MEDIA EJECT", /* 0xed */
407 "IDENTIFY DMA", /* 0xee */
408 "SET FEATURES", /* 0xef */
409 "", /* 0xf0 */
410 "SECURITY SET PASSWORD", /* 0xf1 */
411 "SECURITY UNLOCK", /* 0xf2 */
412 "SECURITY ERASE PREPARE", /* 0xf3 */
413 "SECURITY ERASE UNIT", /* 0xf4 */
414 "SECURITY FREEZE LOCK", /* 0xf5 */
415 "SECURITY DISABLE PASSWORD", /* 0xf6 */
416 "", /* 0xf7 */
417 "READ NATIVE MAX ADDRESS", /* 0xf8 */
418 "SET MAX", /* 0xf9 */
419 "", /* 0xfa */
420 "", /* 0xfb */
421 "", /* 0xfc */
422 "", /* 0xfd */
423 "", /* 0xfe */
424 "" /* 0xff */
425};
426#endif /* DEBUG */
427
428
429#define ATA_MODE_MDMA 0x20
430#define ATA_MODE_UDMA 0x40
431
432
433#define ATA_TRANSFER_ID(thismode, maxspeed, currmode) \
434 ( ((1 << (maxspeed + 1)) - 1) \
435 | ((((thismode ^ currmode) & 0xf8) == 0) ? 1 << ((currmode & 0x07) + 8) : 0))
436
437
438/* ATAPI defines */
439
440#define ATAPI_PACKET_SIZE 12
441
442
443#define ATAPI_INT_REASON_CD 0x01 /* 0 = data transfer */
444#define ATAPI_INT_REASON_IO 0x02 /* 1 = transfer to the host */
445#define ATAPI_INT_REASON_REL 0x04
446#define ATAPI_INT_REASON_TAG_MASK 0xf8
447
448
449#endif /* __IDE_h__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette