Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Modules/i386/include/IOKit/storage/ata/IOATAStorageDefines.h

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
30extern "C" {
31#endif
32
33/*
34 * Important word offsets in device identify data as
35 * defined in ATA-5 standard
36 */
37
38enum
39{
40kATAIdentifyConfiguration= 0,
41kATAIdentifyLogicalCylinderCount = 1,
42kATAIdentifyLogicalHeadCount= 3,
43kATAIdentifySectorsPerTrack= 6,
44kATAIdentifySerialNumber= 10,
45kATAIdentifyFirmwareRevision= 23,
46kATAIdentifyModelNumber= 27,
47kATAIdentifyMultipleSectorCount= 47,
48kATAIdentifyDriveCapabilities= 49,
49kATAIdentifyDriveCapabilitiesExtended= 50,
50kATAIdentifyPIOTiming= 51,
51kATAIdentifyExtendedInfoSupport= 53,
52kATAIdentifyCurrentCylinders= 54,
53kATAIdentifyCurrentHeads= 55,
54kATAIdentifyCurrentSectors= 56,
55kATAIdentifyCurrentCapacity= 57,
56kATAIdentifyCurrentMultipleSectors= 59,
57kATAIdentifyLBACapacity= 60,
58kATAIdentifySingleWordDMA= 62,
59kATAIdentifyMultiWordDMA= 63,
60kATAIdentifyAdvancedPIOModes= 64,
61kATAIdentifyMinMultiWordDMATime= 65,
62kATAIdentifyRecommendedMultiWordDMATime= 66,
63kATAIdentifyMinPIOTime= 67,
64kATAIdentifyMinPIOTimeWithIORDY= 68,
65kATAIdentifyQueueDepth= 75,
66kATAIdentifyMajorVersion= 80,
67kATAIdentifyMinorVersion= 81,
68kATAIdentifyCommandSetSupported= 82,
69kATAIdentifyCommandSetSupported2= 83,
70kATAIdentifyCommandExtension1= 84,
71kATAIdentifyCommandExtension2= 85,
72kATAIdentifyCommandsEnabled= 86,
73kATAIdentifyCommandsDefault= 87,
74kATAIdentifyUltraDMASupported= 88,
75kATAIdentifyPhysicalLogicalSectorSize= 106,
76kATAIdentifyWordsPerLogicalSector1= 117,
77kATAIdentifyWordsPerLogicalSector2= 118,
78kATAIdentifyLogicalSectorAlignment= 209,
79kATAIdentifyIntegrity= 255
80};
81
82
83/*
84 * Important bits in device identify data
85 * as defined in ATA-5 standard
86 */
87
88enum
89{
90// Configuration field (word 0)
91kFixedDeviceBit= 6,// Fixed disk indicator bit
92kRemoveableMediaBit= 7,// Removable media indicator bit
93kNonMagneticDriveBit= 15,// Non-magnetic drive indicator bit
94
95kFixedDeviceMask= (1 << kFixedDeviceBit),// Mask for fixed disk indicator
96kRemoveableMediaMask= (1 << kRemoveableMediaBit),// Mask for removable media indicator
97kNonMagneticDriveMask= (1 << kNonMagneticDriveBit),// Mask for non-magnetic drive indicator
98
99// Capabilities field (word 49)
100kDMABit= 8,// DMA supported bit
101kLBABit= 9,// LBA supported bit
102kIORDYDisableBit= 10,// IORDY can be disabled bit
103kIORDYBit= 11,// IORDY supported bit
104kStandbyTimerBit= 13,// Standby timer supported bit
105
106kDMASupportedMask= (1 << kDMABit),// Mask for DMA supported
107kLBASupportedMask= (1 << kLBABit),// Mask for LBA supported
108kDMADisableMask= (1 << kIORDYDisableBit),// Mask for DMA supported
109kIORDYSupportedMask= (1 << kIORDYBit),// Mask for IORDY supported
110kStandbySupportedMask= (1 << kStandbyTimerBit),// Mask for Standby Timer supported
111
112// Extensions field (word 53)
113kCurFieldsValidBit= 0,// Bit to show words 54-58 are valid
114kExtFieldsValidBit= 1,// Bit to show words 64-70 are valid
115kCurFieldsValidMask= (1 << kCurFieldsValidBit),// Mask for current fields valid
116kExtFieldsValidMask= (1 << kExtFieldsValidBit),// Extension word valid
117
118// Advanced PIO Transfer Modes field (word 64)
119kMode3Bit= 0,// Bit to indicate mode 3 is supported
120kMode3Mask= (1 << kMode3Bit),// Mask for mode 3 support
121
122// Integrity of Identify data (word 255)
123kChecksumValidCookie= 0xA5// Bits 7:0 if device supports feature
124
125};
126
127
128/* String size constants */
129enum
130{
131kSizeOfATAModelString = 40,
132kSizeOfATARevisionString= 8
133};
134
135/* ATA Command timeout constants ( in milliseconds ) */
136enum
137{
138kATATimeout10Seconds= 10000,
139kATATimeout30Seconds= 30000,
140kATATimeout45Seconds= 45000,
141kATATimeout1Minute= 60000,
142kATADefaultTimeout= kATATimeout30Seconds
143};
144
145
146/* Retry constants */
147enum
148{
149kATAZeroRetries= 0,
150kATADefaultRetries= 4
151};
152
153/* max number of blocks supported in ATA transaction */
154enum
155{
156kIOATASectorCount8Bit= 8,
157kIOATASectorCount16Bit= 16
158};
159
160enum
161{
162kIOATAMaximumBlockCount8Bit= (1 << kIOATASectorCount8Bit),
163kIOATAMaximumBlockCount16Bit= (1 << kIOATASectorCount16Bit),
164
165// For backwards compatibility
166kIOATAMaxBlocksPerXfer= kIOATAMaximumBlockCount8Bit
167};
168
169
170
171/* Power Management time constants (in seconds) */
172enum
173{
174kSecondsInAMinute= 60,
175k5Minutes= 5 * kSecondsInAMinute
176};
177
178/* Bits for features published in Word 82 of device identify data */
179enum
180{
181kATASupportsSMARTBit= 0,
182kATASupportsPowerManagementBit = 3,
183kATASupportsWriteCacheBit= 5
184};
185
186/* Masks for features published in Word 82 of device identify data */
187enum
188{
189kATASupportsSMARTMask= (1 << kATASupportsSMARTBit),
190kATASupportsPowerManagementMask = (1 << kATASupportsPowerManagementBit),
191kATASupportsWriteCacheMask= (1 << kATASupportsWriteCacheBit)
192};
193
194/* Bits for features published in Word 83 of device identify data */
195enum
196{
197kATASupportsCompactFlashBit= 2,
198kATASupportsAdvancedPowerManagementBit = 3,
199
200kATASupports48BitAddressingBit= 10,
201
202kATASupportsFlushCacheBit= 12,
203kATASupportsFlushCacheExtendedBit= 13
204};
205
206/* Masks for features published in Word 83 of device identify data */
207enum
208{
209kATASupportsCompactFlashMask= (1 << kATASupportsCompactFlashBit),
210kATASupportsAdvancedPowerManagementMask = (1 << kATASupportsAdvancedPowerManagementBit),
211
212kATASupports48BitAddressingMask= (1 << kATASupports48BitAddressingBit),
213
214kATASupportsFlushCacheMask= (1 << kATASupportsFlushCacheBit),
215kATASupportsFlushCacheExtendedMask= (1 << kATASupportsFlushCacheExtendedBit),
216
217// Mask to ensure data is valid
218kIdentifyWordValidationMask= 0xC000,
219kIdentifyWordValid= 0x4000
220};
221
222/* Bits for features published in Word 84 of device identify data */
223enum
224{
225kATAForceUnitAccessFeatureBit= 6,
226};
227
228/* Masks for features published in Word 84 of device identify data */
229enum
230{
231kATAForceUnitAccessFeatureMask= (1 << kATAForceUnitAccessFeatureBit),
232};
233
234/* Bits for features published in Word 85 of device identify data */
235enum
236{
237kATAWriteCacheEnabledBit= 5
238};
239
240/* Masks for features published in Word 85 of device identify data */
241enum
242{
243kATAWriteCacheEnabledMask= (1 << kATAWriteCacheEnabledBit)
244};
245
246
247/* Bits for features published in Word 106 of device identify data */
248enum
249{
250kATAPhysicalLogicalEnabledBit0= 15,
251kATAPhysicalLogicalEnabledBit1= 14,
252kATAMultipleLogicalSectorsBit= 13,
253kATAValidLogicalSectorSizeBit= 12
254};
255
256/* Masks for features published in Word 106 of device identify data */
257enum
258{
259kATAPhysicalLogicalEnabledMask= (1 << kATAPhysicalLogicalEnabledBit0) | (1 << kATAPhysicalLogicalEnabledBit1),
260kATAPhysicalLogicalEnabledValue= (0 << kATAPhysicalLogicalEnabledBit0) | (1 << kATAPhysicalLogicalEnabledBit1),
261kATAMultipleLogicalSectorsMask= (1 << kATAMultipleLogicalSectorsBit),
262kATAValidLogicalSectorSizeMask= (1 << kATAValidLogicalSectorSizeBit),
263kATAPhysicalSectorSizeMask= 0xF,
264kATALogicalSectorAlignmentMask= 0x3FFF
265};
266
267// Property table keys
268#define kIOATASupportedFeaturesKey"ATA Features"
269
270/* ATA supported features */
271enum
272{
273kIOATAFeaturePowerManagement= 0x01,/* OBSOLETE */
274kIOATAFeatureWriteCache= 0x02,/* OBSOLETE */
275kIOATAFeatureAdvancedPowerManagement = 0x04,
276kIOATAFeatureCompactFlash= 0x08,
277kIOATAFeature48BitLBA= 0x10,
278kIOATAFeatureSMART= 0x20
279};
280
281/* ATA Advanced Power Management settings (valid settings range from 1-254),
282the settings below are the more common settings */
283enum
284{
285kIOATAMaxPerformance= 0xFE,
286kIOATADefaultPerformance = 0x80,
287kIOATAMaxPowerSavings= 0x01
288};
289
290/* ATA Transfer Mode bit masks */
291enum
292{
293kATAEnableUltraDMAModeMask = 0x40,
294kATAEnableMultiWordDMAModeMask= 0x20,
295kATAEnablePIOModeMask= 0x08
296};
297
298
299typedef uint32_tATAOperationType;
300enum
301{
302kATAOperationTypeRead= 0,
303kATAOperationTypeWrite= 1,
304kATAOperationTypeFlushCache= 2,
305kATAOperationTypeSMART= 3,
306kATAOperationTypeConfiguration= 4,
307kATAOperationTypePowerManagement= 5,
308kATAOperationTypeSMS= 6
309};
310
311#if defined(KERNEL)
312
313typedef 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

Archive Download this file

Revision: 1621