VirtualBox

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

Last change on this file since 37043 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.0 KB
Line 
1/* $Id: ide.h 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 * VBox storage devices: ATA/ATAPI declarations
4 */
5
6/*
7 * Copyright (C) 2006-2007 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___Storage_IDE_h
19#define ___Storage_IDE_h
20
21
22/* Bits of HD_STATUS */
23#define ATA_STAT_ERR 0x01
24#define ATA_STAT_INDEX 0x02
25#define ATA_STAT_ECC 0x04 /* Corrected error */
26#define ATA_STAT_DRQ 0x08
27#define ATA_STAT_SEEK 0x10
28#define ATA_STAT_SRV 0x10
29#define ATA_STAT_WRERR 0x20
30#define ATA_STAT_READY 0x40
31#define ATA_STAT_BUSY 0x80
32
33/* Bits for HD_ERROR */
34#define MARK_ERR 0x01 /* Bad address mark */
35#define TRK0_ERR 0x02 /* couldn't find track 0 */
36#define ABRT_ERR 0x04 /* Command aborted */
37#define MCR_ERR 0x08 /* media change request */
38#define ID_ERR 0x10 /* ID field not found */
39#define MC_ERR 0x20 /* media changed */
40#define ECC_ERR 0x40 /* Uncorrectable ECC error */
41#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
42#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
43
44/* Bits for uATARegDevCtl. */
45#define ATA_DEVCTL_DISABLE_IRQ 0x02
46#define ATA_DEVCTL_RESET 0x04
47#define ATA_DEVCTL_HOB 0x80
48
49
50/* ATA/ATAPI Commands (as of ATA/ATAPI-8 draft T13/1699D Revision 3a).
51 * Please keep this in sync with g_apszATACmdNames. */
52typedef enum ATACMD
53{
54 ATA_NOP = 0x00,
55 ATA_CFA_REQUEST_EXTENDED_ERROR_CODE = 0x03,
56 ATA_DEVICE_RESET = 0x08,
57 ATA_RECALIBRATE = 0x10,
58 ATA_READ_SECTORS = 0x20,
59 ATA_READ_SECTORS_WITHOUT_RETRIES = 0x21,
60 ATA_READ_LONG = 0x22,
61 ATA_READ_LONG_WITHOUT_RETRIES = 0x23,
62 ATA_READ_SECTORS_EXT = 0x24,
63 ATA_READ_DMA_EXT = 0x25,
64 ATA_READ_DMA_QUEUED_EXT = 0x26,
65 ATA_READ_NATIVE_MAX_ADDRESS_EXT = 0x27,
66 ATA_READ_MULTIPLE_EXT = 0x29,
67 ATA_READ_STREAM_DMA_EXT = 0x2a,
68 ATA_READ_STREAM_EXT = 0x2b,
69 ATA_READ_LOG_EXT = 0x2f,
70 ATA_WRITE_SECTORS = 0x30,
71 ATA_WRITE_SECTORS_WITHOUT_RETRIES = 0x31,
72 ATA_WRITE_LONG = 0x32,
73 ATA_WRITE_LONG_WITHOUT_RETRIES = 0x33,
74 ATA_WRITE_SECTORS_EXT = 0x34,
75 ATA_WRITE_DMA_EXT = 0x35,
76 ATA_WRITE_DMA_QUEUED_EXT = 0x36,
77 ATA_SET_MAX_ADDRESS_EXT = 0x37,
78 ATA_CFA_WRITE_SECTORS_WITHOUT_ERASE = 0x38,
79 ATA_WRITE_MULTIPLE_EXT = 0x39,
80 ATA_WRITE_STREAM_DMA_EXT = 0x3a,
81 ATA_WRITE_STREAM_EXT = 0x3b,
82 ATA_WRITE_VERIFY = 0x3c,
83 ATA_WRITE_DMA_FUA_EXT = 0x3d,
84 ATA_WRITE_DMA_QUEUED_FUA_EXT = 0x3e,
85 ATA_WRITE_LOG_EXT = 0x3f,
86 ATA_READ_VERIFY_SECTORS = 0x40,
87 ATA_READ_VERIFY_SECTORS_WITHOUT_RETRIES = 0x41,
88 ATA_READ_VERIFY_SECTORS_EXT = 0x42,
89 ATA_WRITE_UNCORRECTABLE_EXT = 0x45,
90 ATA_READ_LOG_DMA_EXT = 0x47,
91 ATA_FORMAT_TRACK = 0x50,
92 ATA_CONFIGURE_STREAM = 0x51,
93 ATA_WRITE_LOG_DMA_EXT = 0x57,
94 ATA_TRUSTED_RECEIVE = 0x5c,
95 ATA_TRUSTED_RECEIVE_DMA = 0x5d,
96 ATA_TRUSTED_SEND = 0x5e,
97 ATA_TRUSTED_SEND_DMA = 0x5f,
98 ATA_READ_FPDMA_QUEUED = 0x60,
99 ATA_WRITE_FPDMA_QUEUED = 0x61,
100 ATA_SEEK = 0x70,
101 ATA_CFA_TRANSLATE_SECTOR = 0x87,
102 ATA_EXECUTE_DEVICE_DIAGNOSTIC = 0x90,
103 ATA_INITIALIZE_DEVICE_PARAMETERS = 0x91,
104 ATA_DOWNLOAD_MICROCODE = 0x92,
105 ATA_STANDBY_IMMEDIATE__ALT = 0x94,
106 ATA_IDLE_IMMEDIATE__ALT = 0x95,
107 ATA_STANDBY__ALT = 0x96,
108 ATA_IDLE__ALT = 0x97,
109 ATA_CHECK_POWER_MODE__ALT = 0x98,
110 ATA_SLEEP__ALT = 0x99,
111 ATA_PACKET = 0xa0,
112 ATA_IDENTIFY_PACKET_DEVICE = 0xa1,
113 ATA_SERVICE = 0xa2,
114 ATA_SMART = 0xb0,
115 ATA_DEVICE_CONFIGURATION_OVERLAY = 0xb1,
116 ATA_NV_CACHE = 0xb6,
117 ATA_CFA_ERASE_SECTORS = 0xc0,
118 ATA_READ_MULTIPLE = 0xc4,
119 ATA_WRITE_MULTIPLE = 0xc5,
120 ATA_SET_MULTIPLE_MODE = 0xc6,
121 ATA_READ_DMA_QUEUED = 0xc7,
122 ATA_READ_DMA = 0xc8,
123 ATA_READ_DMA_WITHOUT_RETRIES = 0xc9,
124 ATA_WRITE_DMA = 0xca,
125 ATA_WRITE_DMA_WITHOUT_RETRIES = 0xcb,
126 ATA_WRITE_DMA_QUEUED = 0xcc,
127 ATA_CFA_WRITE_MULTIPLE_WITHOUT_ERASE = 0xcd,
128 ATA_WRITE_MULTIPLE_FUA_EXT = 0xce,
129 ATA_CHECK_MEDIA_CARD_TYPE = 0xd1,
130 ATA_GET_MEDIA_STATUS = 0xda,
131 ATA_ACKNOWLEDGE_MEDIA_CHANGE = 0xdb,
132 ATA_BOOT_POST_BOOT = 0xdc,
133 ATA_BOOT_PRE_BOOT = 0xdd,
134 ATA_MEDIA_LOCK = 0xde,
135 ATA_MEDIA_UNLOCK = 0xdf,
136 ATA_STANDBY_IMMEDIATE = 0xe0,
137 ATA_IDLE_IMMEDIATE = 0xe1,
138 ATA_STANDBY = 0xe2,
139 ATA_IDLE = 0xe3,
140 ATA_READ_BUFFER = 0xe4,
141 ATA_CHECK_POWER_MODE = 0xe5,
142 ATA_SLEEP = 0xe6,
143 ATA_FLUSH_CACHE = 0xe7,
144 ATA_WRITE_BUFFER = 0xe8,
145 ATA_WRITE_SAME = 0xe9,
146 ATA_FLUSH_CACHE_EXT = 0xea,
147 ATA_IDENTIFY_DEVICE = 0xec,
148 ATA_MEDIA_EJECT = 0xed,
149 ATA_IDENTIFY_DMA = 0xee,
150 ATA_SET_FEATURES = 0xef,
151 ATA_SECURITY_SET_PASSWORD = 0xf1,
152 ATA_SECURITY_UNLOCK = 0xf2,
153 ATA_SECURITY_ERASE_PREPARE = 0xf3,
154 ATA_SECURITY_ERASE_UNIT = 0xf4,
155 ATA_SECURITY_FREEZE_LOCK = 0xf5,
156 ATA_SECURITY_DISABLE_PASSWORD = 0xf6,
157 ATA_READ_NATIVE_MAX_ADDRESS = 0xf8,
158 ATA_SET_MAX = 0xf9
159} ATACMD;
160
161
162#define ATA_MODE_MDMA 0x20
163#define ATA_MODE_UDMA 0x40
164
165
166#define ATA_TRANSFER_ID(thismode, maxspeed, currmode) \
167 ( ((1 << (maxspeed + 1)) - 1) \
168 | ((((thismode ^ currmode) & 0xf8) == 0) ? 1 << ((currmode & 0x07) + 8) : 0))
169
170
171/* ATAPI defines */
172
173#define ATAPI_PACKET_SIZE 12
174
175
176#define ATAPI_INT_REASON_CD 0x01 /* 0 = data transfer */
177#define ATAPI_INT_REASON_IO 0x02 /* 1 = transfer to the host */
178#define ATAPI_INT_REASON_REL 0x04
179#define ATAPI_INT_REASON_TAG_MASK 0xf8
180
181#if defined(DEBUG) && defined(IN_RING3)
182const char * ATACmdText(uint8_t uCmd);
183#endif
184
185#endif /* !___Storage_IDE_h */
186
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