Root/
Source at commit 1166 created 13 years 10 days ago. By meklort, Fixed recent Makefile changes. Please do not use /Users/evan/SourceCode/tmp/chameleon/trunk or VPATH. the *only* time you should use /Users/evan/SourceCode/tmp/chameleon/trunk is when setting the SRCROOT variable. Also note that very soon make pkg is going to be removed. The pkg build script in trunk is very out of date. Instead please use the package maker at http://forge.voodooprojects.org/p/chameleonApplications/. Once this is ready for trunk it will be merged. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1998-2007 Apple Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. Please obtain a copy of the License at␊ |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
11 | * file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
18 | * Please see the License for the specific language governing rights and␊ |
19 | * limitations under the License.␊ |
20 | * ␊ |
21 | * @APPLE_LICENSE_HEADER_END@␊ |
22 | */␊ |
23 | ␊ |
24 | #ifndef _IOKIT_IO_ATA_STORAGE_DEFINES_H_␊ |
25 | #define _IOKIT_IO_ATA_STORAGE_DEFINES_H_␊ |
26 | ␊ |
27 | #include <stdint.h>␊ |
28 | ␊ |
29 | #ifdef __cplusplus␊ |
30 | extern "C" {␊ |
31 | #endif␊ |
32 | ␉␊ |
33 | /*␊ |
34 | * Important word offsets in device identify data as␊ |
35 | * defined in ATA-5 standard␊ |
36 | */␊ |
37 | ␉␊ |
38 | enum␊ |
39 | {␊ |
40 | ␉kATAIdentifyConfiguration␉␉␉␉= 0,␊ |
41 | ␉kATAIdentifyLogicalCylinderCount ␉␉= 1,␊ |
42 | ␉kATAIdentifyLogicalHeadCount␉␉␉= 3,␊ |
43 | ␉kATAIdentifySectorsPerTrack␉␉␉␉= 6,␊ |
44 | ␉kATAIdentifySerialNumber␉␉␉␉= 10,␊ |
45 | ␉kATAIdentifyFirmwareRevision␉␉␉= 23,␊ |
46 | ␉kATAIdentifyModelNumber␉␉␉␉␉= 27,␊ |
47 | ␉kATAIdentifyMultipleSectorCount␉␉␉= 47,␊ |
48 | ␉kATAIdentifyDriveCapabilities␉␉␉= 49,␊ |
49 | ␉kATAIdentifyDriveCapabilitiesExtended␉= 50,␊ |
50 | ␉kATAIdentifyPIOTiming␉␉␉␉␉= 51,␊ |
51 | ␉kATAIdentifyExtendedInfoSupport␉␉␉= 53,␊ |
52 | ␉kATAIdentifyCurrentCylinders␉␉␉= 54,␊ |
53 | ␉kATAIdentifyCurrentHeads␉␉␉␉= 55,␊ |
54 | ␉kATAIdentifyCurrentSectors␉␉␉␉= 56,␊ |
55 | ␉kATAIdentifyCurrentCapacity␉␉␉␉= 57,␊ |
56 | ␉kATAIdentifyCurrentMultipleSectors␉␉= 59,␊ |
57 | ␉kATAIdentifyLBACapacity␉␉␉␉␉= 60,␊ |
58 | ␉kATAIdentifySingleWordDMA␉␉␉␉= 62,␊ |
59 | ␉kATAIdentifyMultiWordDMA␉␉␉␉= 63,␊ |
60 | ␉kATAIdentifyAdvancedPIOModes␉␉␉= 64,␊ |
61 | ␉kATAIdentifyMinMultiWordDMATime␉␉␉= 65,␊ |
62 | ␉kATAIdentifyRecommendedMultiWordDMATime␉= 66,␊ |
63 | ␉kATAIdentifyMinPIOTime␉␉␉␉␉= 67,␊ |
64 | ␉kATAIdentifyMinPIOTimeWithIORDY␉␉␉= 68,␊ |
65 | ␉kATAIdentifyQueueDepth␉␉␉␉␉= 75,␊ |
66 | ␉kATAIdentifyMajorVersion␉␉␉␉= 80,␊ |
67 | ␉kATAIdentifyMinorVersion␉␉␉␉= 81,␊ |
68 | ␉kATAIdentifyCommandSetSupported␉␉␉= 82,␊ |
69 | ␉kATAIdentifyCommandSetSupported2␉␉= 83,␊ |
70 | ␉kATAIdentifyCommandExtension1␉␉␉= 84,␊ |
71 | ␉kATAIdentifyCommandExtension2␉␉␉= 85,␊ |
72 | ␉kATAIdentifyCommandsEnabled␉␉␉␉= 86,␊ |
73 | ␉kATAIdentifyCommandsDefault␉␉␉␉= 87,␊ |
74 | ␉kATAIdentifyUltraDMASupported␉␉␉= 88,␊ |
75 | ␉kATAIdentifyPhysicalLogicalSectorSize␉= 106,␊ |
76 | ␉kATAIdentifyWordsPerLogicalSector1␉␉= 117,␊ |
77 | ␉kATAIdentifyWordsPerLogicalSector2␉␉= 118,␊ |
78 | ␉kATAIdentifyLogicalSectorAlignment␉␉= 209,␊ |
79 | ␉kATAIdentifyIntegrity␉␉␉␉␉= 255␊ |
80 | };␊ |
81 | ␉␊ |
82 | ␊ |
83 | /* ␊ |
84 | * Important bits in device identify data␊ |
85 | * as defined in ATA-5 standard␊ |
86 | */␊ |
87 | ␊ |
88 | enum␊ |
89 | {␊ |
90 | ␉// Configuration field (word 0)␊ |
91 | ␉kFixedDeviceBit␉␉␉= 6,␉␉␉␉␉␉␉// Fixed disk indicator bit␊ |
92 | ␉kRemoveableMediaBit␉␉= 7,␉␉␉␉␉␉␉// Removable media indicator bit␊ |
93 | ␉kNonMagneticDriveBit␉= 15,␉␉␉␉␉␉␉// Non-magnetic drive indicator bit␊ |
94 | ␉␊ |
95 | ␉kFixedDeviceMask␉␉= (1 << kFixedDeviceBit),␉␉// Mask for fixed disk indicator␊ |
96 | ␉kRemoveableMediaMask␉= (1 << kRemoveableMediaBit),␉// Mask for removable media indicator␊ |
97 | ␉kNonMagneticDriveMask␉= (1 << kNonMagneticDriveBit),␉// Mask for non-magnetic drive indicator␊ |
98 | ␊ |
99 | ␉// Capabilities field (word 49)␊ |
100 | ␉kDMABit␉␉␉␉␉= 8,␉␉␉␉␉␉␉// DMA supported bit␊ |
101 | ␉kLBABit␉␉␉␉␉= 9,␉␉␉␉␉␉␉// LBA supported bit␊ |
102 | ␉kIORDYDisableBit␉␉= 10,␉␉␉␉␉␉␉// IORDY can be disabled bit␊ |
103 | ␉kIORDYBit␉␉␉␉= 11,␉␉␉␉␉␉␉// IORDY supported bit␊ |
104 | ␉kStandbyTimerBit␉␉= 13,␉␉␉␉␉␉␉// Standby timer supported bit␊ |
105 | ␊ |
106 | ␉kDMASupportedMask␉␉= (1 << kDMABit),␉␉␉␉// Mask for DMA supported␊ |
107 | ␉kLBASupportedMask␉␉= (1 << kLBABit),␉␉␉␉// Mask for LBA supported␊ |
108 | ␉kDMADisableMask␉␉␉= (1 << kIORDYDisableBit),␉␉// Mask for DMA supported␊ |
109 | ␉kIORDYSupportedMask␉␉= (1 << kIORDYBit),␉␉␉␉// Mask for IORDY supported␊ |
110 | ␉kStandbySupportedMask␉= (1 << kStandbyTimerBit),␉␉// Mask for Standby Timer supported␊ |
111 | ␊ |
112 | ␉// Extensions field (word 53)␊ |
113 | ␉kCurFieldsValidBit␉␉= 0,␉␉␉␉␉␉␉// Bit to show words 54-58 are valid␊ |
114 | ␉kExtFieldsValidBit␉␉= 1,␉␉␉␉␉␉␉// Bit to show words 64-70 are valid␊ |
115 | ␉kCurFieldsValidMask␉␉= (1 << kCurFieldsValidBit),␉// Mask for current fields valid␊ |
116 | ␉kExtFieldsValidMask␉␉= (1 << kExtFieldsValidBit),␉// Extension word valid␊ |
117 | ␊ |
118 | ␉// Advanced PIO Transfer Modes field (word 64)␊ |
119 | ␉kMode3Bit␉␉␉␉= 0,␉␉␉␉␉␉␉// Bit to indicate mode 3 is supported␊ |
120 | ␉kMode3Mask␉␉␉␉= (1 << kMode3Bit),␉␉␉␉// Mask for mode 3 support␊ |
121 | ␉␊ |
122 | ␉// Integrity of Identify data (word 255)␊ |
123 | ␉kChecksumValidCookie␉= 0xA5␉␉␉␉␉␉␉// Bits 7:0 if device supports feature␊ |
124 | ␉␊ |
125 | };␊ |
126 | ␊ |
127 | ␊ |
128 | /* String size constants */␊ |
129 | enum␊ |
130 | {␊ |
131 | ␉kSizeOfATAModelString ␉␉= 40,␊ |
132 | ␉kSizeOfATARevisionString␉= 8␊ |
133 | };␊ |
134 | ␊ |
135 | /* ATA Command timeout constants ( in milliseconds ) */␊ |
136 | enum␊ |
137 | {␊ |
138 | ␉kATATimeout10Seconds␉= 10000,␊ |
139 | ␉kATATimeout30Seconds␉= 30000,␊ |
140 | ␉kATATimeout45Seconds␉= 45000,␊ |
141 | ␉kATATimeout1Minute␉␉= 60000,␊ |
142 | ␉kATADefaultTimeout␉␉= kATATimeout30Seconds␊ |
143 | };␊ |
144 | ␊ |
145 | ␊ |
146 | /* Retry constants */␊ |
147 | enum␊ |
148 | {␊ |
149 | ␉kATAZeroRetries␉␉= 0,␊ |
150 | ␉kATADefaultRetries␉= 4␊ |
151 | };␊ |
152 | ␊ |
153 | /* max number of blocks supported in ATA transaction */␊ |
154 | enum␊ |
155 | {␊ |
156 | ␉kIOATASectorCount8Bit␉= 8,␊ |
157 | ␉kIOATASectorCount16Bit␉= 16␊ |
158 | };␊ |
159 | ␊ |
160 | enum␊ |
161 | {␊ |
162 | ␉kIOATAMaximumBlockCount8Bit␉␉= (1 << kIOATASectorCount8Bit),␊ |
163 | ␉kIOATAMaximumBlockCount16Bit␉= (1 << kIOATASectorCount16Bit),␊ |
164 | ␉␊ |
165 | ␉// For backwards compatibility␊ |
166 | ␉kIOATAMaxBlocksPerXfer␉␉␉= kIOATAMaximumBlockCount8Bit␊ |
167 | };␊ |
168 | ␊ |
169 | ␊ |
170 | ␊ |
171 | /* Power Management time constants (in seconds) */␊ |
172 | enum␊ |
173 | {␊ |
174 | ␉kSecondsInAMinute␉= 60,␊ |
175 | ␉k5Minutes␉␉␉= 5 * kSecondsInAMinute␊ |
176 | };␊ |
177 | ␊ |
178 | /* Bits for features published in Word 82 of device identify data */␊ |
179 | enum␊ |
180 | {␊ |
181 | ␉kATASupportsSMARTBit␉␉␉␉␉= 0,␊ |
182 | ␉kATASupportsPowerManagementBit ␉␉= 3,␊ |
183 | ␉kATASupportsWriteCacheBit␉␉␉␉= 5␊ |
184 | };␊ |
185 | ␊ |
186 | /* Masks for features published in Word 82 of device identify data */␊ |
187 | enum␊ |
188 | {␊ |
189 | ␉kATASupportsSMARTMask␉␉␉␉␉= (1 << kATASupportsSMARTBit),␊ |
190 | ␉kATASupportsPowerManagementMask ␉␉= (1 << kATASupportsPowerManagementBit),␊ |
191 | ␉kATASupportsWriteCacheMask␉␉␉␉= (1 << kATASupportsWriteCacheBit)␊ |
192 | };␊ |
193 | ␊ |
194 | /* Bits for features published in Word 83 of device identify data */␊ |
195 | enum␊ |
196 | {␊ |
197 | ␉kATASupportsCompactFlashBit␉␉␉␉= 2,␊ |
198 | ␉kATASupportsAdvancedPowerManagementBit ␉= 3,␊ |
199 | ␉␊ |
200 | ␉kATASupports48BitAddressingBit␉␉␉= 10,␊ |
201 | ␉␊ |
202 | ␉kATASupportsFlushCacheBit␉␉␉␉= 12,␊ |
203 | ␉kATASupportsFlushCacheExtendedBit␉␉= 13␊ |
204 | };␊ |
205 | ␊ |
206 | /* Masks for features published in Word 83 of device identify data */␊ |
207 | enum␊ |
208 | {␊ |
209 | ␉kATASupportsCompactFlashMask␉␉␉= (1 << kATASupportsCompactFlashBit),␊ |
210 | ␉kATASupportsAdvancedPowerManagementMask = (1 << kATASupportsAdvancedPowerManagementBit),␊ |
211 | ␉␊ |
212 | ␉kATASupports48BitAddressingMask␉␉␉= (1 << kATASupports48BitAddressingBit),␊ |
213 | ␉␊ |
214 | ␉kATASupportsFlushCacheMask␉␉␉␉= (1 << kATASupportsFlushCacheBit),␊ |
215 | ␉kATASupportsFlushCacheExtendedMask␉␉= (1 << kATASupportsFlushCacheExtendedBit),␊ |
216 | ␉␊ |
217 | ␉// Mask to ensure data is valid␊ |
218 | ␉kIdentifyWordValidationMask␉␉␉␉= 0xC000,␊ |
219 | ␉kIdentifyWordValid␉␉␉␉␉␉= 0x4000␊ |
220 | };␊ |
221 | ␊ |
222 | /* Bits for features published in Word 84 of device identify data */␊ |
223 | enum␊ |
224 | {␊ |
225 | ␉kATAForceUnitAccessFeatureBit␉␉␉= 6,␊ |
226 | };␊ |
227 | ␊ |
228 | /* Masks for features published in Word 84 of device identify data */␊ |
229 | enum␊ |
230 | {␊ |
231 | ␉kATAForceUnitAccessFeatureMask␉␉␉= (1 << kATAForceUnitAccessFeatureBit),␊ |
232 | };␊ |
233 | ␊ |
234 | /* Bits for features published in Word 85 of device identify data */␊ |
235 | enum␊ |
236 | {␊ |
237 | ␉kATAWriteCacheEnabledBit␉␉␉␉= 5␊ |
238 | };␊ |
239 | ␊ |
240 | /* Masks for features published in Word 85 of device identify data */␊ |
241 | enum␊ |
242 | {␊ |
243 | ␉kATAWriteCacheEnabledMask␉␉␉␉= (1 << kATAWriteCacheEnabledBit)␊ |
244 | };␊ |
245 | ␊ |
246 | ␊ |
247 | /* Bits for features published in Word 106 of device identify data */␊ |
248 | enum␊ |
249 | {␊ |
250 | ␉kATAPhysicalLogicalEnabledBit0␉␉␉= 15,␊ |
251 | ␉kATAPhysicalLogicalEnabledBit1␉␉␉= 14,␊ |
252 | ␉kATAMultipleLogicalSectorsBit␉␉␉= 13,␊ |
253 | ␉kATAValidLogicalSectorSizeBit␉␉␉= 12␉␊ |
254 | };␊ |
255 | ␊ |
256 | /* Masks for features published in Word 106 of device identify data */␊ |
257 | enum␊ |
258 | {␊ |
259 | ␉kATAPhysicalLogicalEnabledMask␉␉␉= (1 << kATAPhysicalLogicalEnabledBit0) | (1 << kATAPhysicalLogicalEnabledBit1),␊ |
260 | ␉kATAPhysicalLogicalEnabledValue␉␉␉= (0 << kATAPhysicalLogicalEnabledBit0) | (1 << kATAPhysicalLogicalEnabledBit1),␊ |
261 | ␉kATAMultipleLogicalSectorsMask␉␉␉= (1 << kATAMultipleLogicalSectorsBit),␊ |
262 | ␉kATAValidLogicalSectorSizeMask␉␉␉= (1 << kATAValidLogicalSectorSizeBit),␊ |
263 | ␉kATAPhysicalSectorSizeMask␉␉␉␉= 0xF,␊ |
264 | ␉kATALogicalSectorAlignmentMask␉␉␉= 0x3FFF␊ |
265 | };␊ |
266 | ␊ |
267 | // Property table keys␊ |
268 | #define kIOATASupportedFeaturesKey␉␉"ATA Features"␊ |
269 | ␊ |
270 | /* ATA supported features */␊ |
271 | enum␊ |
272 | {␊ |
273 | ␉kIOATAFeaturePowerManagement␉␉␉= 0x01,␉␉/* OBSOLETE */␊ |
274 | ␉kIOATAFeatureWriteCache␉␉␉␉␉= 0x02,␉␉/* OBSOLETE */␊ |
275 | ␉kIOATAFeatureAdvancedPowerManagement ␉= 0x04,␊ |
276 | ␉kIOATAFeatureCompactFlash␉␉␉␉= 0x08,␊ |
277 | ␉kIOATAFeature48BitLBA␉␉␉␉␉= 0x10,␊ |
278 | ␉kIOATAFeatureSMART␉␉␉␉␉␉= 0x20␊ |
279 | };␊ |
280 | ␊ |
281 | /* ATA Advanced Power Management settings (valid settings range from 1-254),␊ |
282 | the settings below are the more common settings */␊ |
283 | enum␊ |
284 | {␊ |
285 | ␉kIOATAMaxPerformance␉␉␉␉␉= 0xFE,␊ |
286 | ␉kIOATADefaultPerformance␉␉␉ ␉= 0x80,␊ |
287 | ␉kIOATAMaxPowerSavings␉␉␉␉␉= 0x01␊ |
288 | };␊ |
289 | ␊ |
290 | /* ATA Transfer Mode bit masks */␊ |
291 | enum␊ |
292 | {␊ |
293 | ␉kATAEnableUltraDMAModeMask ␉␉= 0x40,␊ |
294 | ␉kATAEnableMultiWordDMAModeMask␉= 0x20,␊ |
295 | ␉kATAEnablePIOModeMask␉␉␉= 0x08␊ |
296 | };␊ |
297 | ␊ |
298 | ␊ |
299 | typedef uint32_t␉ATAOperationType;␊ |
300 | enum␊ |
301 | {␊ |
302 | ␉kATAOperationTypeRead␉␉␉␉= 0,␊ |
303 | ␉kATAOperationTypeWrite␉␉␉␉= 1,␊ |
304 | ␉kATAOperationTypeFlushCache␉␉␉= 2,␊ |
305 | ␉kATAOperationTypeSMART␉␉␉␉= 3,␊ |
306 | ␉kATAOperationTypeConfiguration␉␉= 4,␊ |
307 | ␉kATAOperationTypePowerManagement␉= 5,␊ |
308 | ␉kATAOperationTypeSMS␉␉␉␉= 6␊ |
309 | };␊ |
310 | ␊ |
311 | #if defined(KERNEL)␊ |
312 | ␊ |
313 | typedef struct __ATAIORequest *␉ATARequestIdentifier;␊ |
314 | ␊ |
315 | #endif␉// defined(KERNEL)␊ |
316 | ␉␊ |
317 | #ifdef __cplusplus␊ |
318 | }␊ |
319 | #endif␊ |
320 | ␊ |
321 | #endif␉/* _IOKIT_IO_ATA_STORAGE_DEFINES_H_ */␊ |
322 |