]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/ata/ata-device/ATACommand.h
d1581a2df15b896a3b0719e74fd418f5ac46f44f
[apple/xnu.git] / iokit / IOKit / ata / ata-device / ATACommand.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 *
24 * ATACommand.h
25 *
26 */
27
28 #ifndef _ATACOMMAND_H
29 #define _ATACOMMAND_H
30
31
32 enum ATADeviceType
33 {
34 kATADeviceNone,
35 kATADeviceATA,
36 kATADeviceATAPI,
37 };
38
39
40 enum ATATimingProtocol
41 {
42 kATATimingPIO = (1 << 0),
43 kATATimingDMA = (1 << 1),
44 kATATimingUltraDMA33 = (1 << 2),
45 kATATimingUltraDMA66 = (1 << 3),
46 kATAMaxTimings = 4,
47
48 };
49
50 enum ATAProtocol
51 {
52 kATAProtocolNone = 0,
53 kATAProtocolSetRegs = (1 << 0),
54 kATAProtocolPIO = (1 << 1),
55 kATAProtocolDMA = (1 << 2),
56 kATAProtocolDMAQueued = (1 << 3),
57 kATAProtocolDMAQueuedRelease = (1 << 4),
58
59 kATAProtocolATAPIPIO = (1 << 16),
60 kATAProtocolATAPIDMA = (1 << 17),
61 };
62
63
64
65 typedef struct ATATiming
66 {
67 enum ATATimingProtocol timingProtocol;
68
69 UInt32 featureSetting;
70
71 UInt32 mode;
72 UInt32 minDataAccess;
73 UInt32 minDataCycle;
74 UInt32 minCmdAccess;
75 UInt32 minCmdCycle;
76 UInt32 reserved_3[9];
77 } ATATiming;
78
79
80 enum ATATagType
81 {
82 kATATagTypeNone = 0,
83 kATATagTypeSimple,
84 };
85
86 enum ATAReturnCode
87 {
88 kATAReturnSuccess,
89 kATAReturnNotSupported,
90 kATAReturnNoResource,
91 kATAReturnRetryPIO,
92 kATAReturnBusyError,
93 kATAReturnInterruptTimeout,
94 kATAReturnStatusError,
95 kATAReturnProtocolError,
96 kATAReturnDMAError,
97 kATAReturnBusReset,
98 };
99
100 #define ATARegtoMask(reg) (1<<(reg))
101
102 typedef struct ATATaskfile
103 {
104 enum ATAProtocol protocol;
105
106 UInt32 flags;
107
108 UInt8 tagType;
109 UInt32 tag;
110
111 UInt32 resultmask;
112
113 UInt32 regmask;
114 UInt32 ataRegs[kMaxATARegs];
115
116 } ATATaskfile;
117
118
119 enum ATACmdFlags
120 {
121 kATACmdFlagTimingChanged = 0x00000001,
122 };
123
124 typedef struct ATACDBInfo
125 {
126
127 UInt32 cdbFlags;
128
129 UInt32 cdbLength;
130 UInt8 cdb[16];
131
132 UInt32 reserved[16];
133 } ATACDBInfo;
134
135
136 enum ATACDBFlags
137 {
138 };
139
140 typedef struct ATAResults
141 {
142 IOReturn returnCode;
143
144 UInt32 bytesTransferred;
145
146 enum ATAReturnCode adapterStatus;
147
148 Boolean requestSenseDone;
149 UInt32 requestSenseLength;
150
151 UInt32 ataRegs[kMaxATARegs];
152
153 UInt32 reserved[16];
154 } ATAResults;
155
156
157 #endif