Root/
Source at commit 1446 created 12 years 11 months ago. By jrcs, Fix multiboot | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1998-2008 Apple 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 | *␊ |
25 | *␉IOATABusCommand.h␊ |
26 | *␊ |
27 | */␊ |
28 | ␊ |
29 | #ifndef _IOATABUSCOMMAND_H␊ |
30 | #define _IOATABUSCOMMAND_H␊ |
31 | ␊ |
32 | #include <IOKit/IOTypes.h>␊ |
33 | #include "IOATATypes.h"␊ |
34 | #include "IOATACommand.h"␊ |
35 | ␊ |
36 | ␊ |
37 | class IOSyncer;␊ |
38 | ␊ |
39 | ␊ |
40 | /*!␊ |
41 | ␊ |
42 | @class IOATABusCommand␊ |
43 | ␊ |
44 | @discussion ATA Device (disk) drivers should use the superclass, IOATACommand ␊ |
45 | and may not derive or use any subclass of IOATACommand. ␊ |
46 | ␊ |
47 | IOATABusCommand is the subclass of IOATACommand used by ␊ |
48 | IOATAControllers. Controller classes may override this class to ␊ |
49 | provide additional fields as their needs dictate or may use this ␊ |
50 | as a concrete class if it is sufficient.␊ |
51 | ␊ |
52 | IOATAControllers are always paired with specific IOATADevices ␊ |
53 | and each specific subclass of IOATADevice is in turn the factory method ␊ |
54 | for IOATACommands for use by disk drivers.␊ |
55 | ␊ |
56 | In this manner, mass-storage device drivers (disk drivers, clients of ␊ |
57 | ATA bus controllers) see only the generalized interface of IOATADevice ␊ |
58 | and the generalized interface of IOATACommand. This provides isolation ␊ |
59 | from specific bus details for disk drivers and offers flexibility to ␊ |
60 | controllers to add per-command fields and state variables for their own ␊ |
61 | internal use.␊ |
62 | ␊ |
63 | */␊ |
64 | ␊ |
65 | class IOATABusCommand : public IOATACommand {␊ |
66 | ␊ |
67 | ␉OSDeclareDefaultStructors( IOATABusCommand );␊ |
68 | ␉␊ |
69 | ␉public:␊ |
70 | ␉␊ |
71 | ␉// data items for use by IOATAController␊ |
72 | ␉␊ |
73 | ␉/*! @var queueChain queue header for use by IOATAController. */␊ |
74 | ␉queue_chain_t␉queueChain; ␊ |
75 | ␊ |
76 | ␉/*! @var state state-semaphore for use by IOATAController */␊ |
77 | ␉UInt32 state;␊ |
78 | ␉␊ |
79 | ␉/*! @var syncer IOSyncer for use by IOATAController */␊ |
80 | ␉IOSyncer* syncer;␊ |
81 | ␊ |
82 | ␊ |
83 | ␊ |
84 | ␉/*!@function allocateCmd␊ |
85 | ␉@abstract factory method to create an instance of this class used by subclasses of IOATADevice␊ |
86 | ␉*/␊ |
87 | ␉static IOATABusCommand* allocateCmd(void);␊ |
88 | ␊ |
89 | ␉/*!@function zeroCommand␊ |
90 | ␉@abstract set to blank state, call prior to re-use of this object␊ |
91 | ␉*/␊ |
92 | ␉virtual void zeroCommand(void); ␉ ␉ ␉␊ |
93 | ␉␊ |
94 | ␉/*!@function getOpcode␊ |
95 | ␉@abstract return the command opcode␊ |
96 | ␉*/␊ |
97 | ␉virtual ataOpcode getOpcode( void ); ␊ |
98 | ␉␊ |
99 | ␉/*!@function getFlags␊ |
100 | ␉@abstract return the flags for this command.␊ |
101 | ␉*/␊ |
102 | ␉virtual ataFlags getFlags ( void ); ␊ |
103 | ␉␉␊ |
104 | ␉/*!@function getRegMask␊ |
105 | ␉@abstract get the register mask for desired regs␊ |
106 | ␉*/␊ |
107 | ␉virtual ataRegMask getRegMask( void );␊ |
108 | ␉␊ |
109 | ␉/*!@function getUnit␊ |
110 | ␉@abstract return the unit id (0 master, 1 slave)␊ |
111 | ␉*/␊ |
112 | ␉virtual ataUnitID getUnit( void ); ␊ |
113 | ␉␊ |
114 | ␉/*!@function getTimeoutMS␊ |
115 | ␉@abstract return the timeout value for this command␊ |
116 | ␉*/␊ |
117 | ␉virtual UInt32 getTimeoutMS (void ); ␊ |
118 | ␉␊ |
119 | ␉/*!@function setResult␊ |
120 | ␉@abstract set the result code␊ |
121 | ␉*/␊ |
122 | ␉virtual void setResult( IOReturn );␊ |
123 | ␊ |
124 | ␉/*!@function getCallbackPtr␊ |
125 | ␉@abstract return the callback pointer␊ |
126 | ␉*/␊ |
127 | ␉virtual IOATACompletionFunction* getCallbackPtr (void ); ␊ |
128 | ␉␊ |
129 | ␉␊ |
130 | ␉/*!@function executeCallback␊ |
131 | ␉@abstract call the completion callback function␊ |
132 | ␉*/␊ |
133 | ␉virtual void executeCallback(void);␊ |
134 | ␊ |
135 | ␉/*!@function getTaskFilePtr␊ |
136 | ␉@abstract return the taskfile structure pointer.␊ |
137 | ␉*/␊ |
138 | ␉virtual ataTaskFile* getTaskFilePtr(void);␊ |
139 | ␉␊ |
140 | ␉/*!@function getPacketSize␊ |
141 | ␉@abstract return the size of atapi packet if any.␊ |
142 | ␉*/␊ |
143 | ␉virtual UInt16 getPacketSize(void);␊ |
144 | ␉␊ |
145 | ␉/*!@function getPacketData␊ |
146 | ␉@abstract return pointer to the array of packet data. ␊ |
147 | ␉*/␊ |
148 | ␉virtual UInt16*␉getPacketData(void);␊ |
149 | ␉␊ |
150 | ␉/*!@function getTransferChunkSize␊ |
151 | ␉@abstract number of bytes between interrupts.␊ |
152 | ␉*/␊ |
153 | ␉virtual IOByteCount getTransferChunkSize(void);␊ |
154 | ␊ |
155 | ␉/*!@function setActualTransfer␊ |
156 | ␉@abstract set the byte count of bytes actually transferred.␊ |
157 | ␉*/␊ |
158 | ␉virtual void setActualTransfer ( IOByteCount bytesTransferred );␊ |
159 | ␉␊ |
160 | ␉/*!@function getBuffer␊ |
161 | ␉@abstract get pointer to the memory descriptor for this transaction␊ |
162 | ␉*/␊ |
163 | ␉virtual IOMemoryDescriptor* getBuffer ( void);␊ |
164 | ␉␊ |
165 | ␉/*!@function getPosition␊ |
166 | ␉@abstract the position within the memory buffer for the transaction.␊ |
167 | ␉*/␊ |
168 | ␉virtual IOByteCount getPosition (void);␊ |
169 | ␉␊ |
170 | ␉/*!@function getByteCount␊ |
171 | ␉@abstract return the byte count for this transaction to transfer.␊ |
172 | ␉*/␊ |
173 | ␉virtual IOByteCount getByteCount (void);␊ |
174 | ␉␊ |
175 | ␉/*!@function setCommandInUse␊ |
176 | ␉@abstract mark the command as being in progress.␊ |
177 | ␉*/␊ |
178 | ␉virtual void setCommandInUse( bool inUse = true);␊ |
179 | ␊ |
180 | ␊ |
181 | ␉protected:␊ |
182 | ␉␊ |
183 | ␉//␊ |
184 | ␉/*!@function init␊ |
185 | ␉@abstract Zeroes all data, returns false if allocation fails. protected.␊ |
186 | ␉*/␊ |
187 | ␉virtual bool init(); ␊ |
188 | ␊ |
189 | /*! @struct ExpansionData␊ |
190 | @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future.␊ |
191 | */␊ |
192 | struct ExpansionData { };␊ |
193 | ␊ |
194 | /*! @var reserved␊ |
195 | Reserved for future use. (Internal use only) */␊ |
196 | ExpansionData *reserved;␊ |
197 | ␊ |
198 | private:␊ |
199 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 0);␊ |
200 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 1);␊ |
201 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 2);␊ |
202 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 3);␊ |
203 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 4);␊ |
204 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 5);␊ |
205 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 6);␊ |
206 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 7);␊ |
207 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 8);␊ |
208 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 9);␊ |
209 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 10);␊ |
210 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 11);␊ |
211 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 12);␊ |
212 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 13);␊ |
213 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 14);␊ |
214 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 15);␊ |
215 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 16);␊ |
216 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 17);␊ |
217 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 18);␊ |
218 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 19);␊ |
219 | OSMetaClassDeclareReservedUnused(IOATABusCommand, 20);␊ |
220 | };␊ |
221 | ␊ |
222 | #include <IOKit/IODMACommand.h>␊ |
223 | ␊ |
224 | class IOATABusCommand64 : public IOATABusCommand␊ |
225 | {␊ |
226 | ␊ |
227 | ␉OSDeclareDefaultStructors( IOATABusCommand64 );␊ |
228 | ␉␊ |
229 | ␉public:␊ |
230 | ␉␊ |
231 | ␉// new features␊ |
232 | ␉static IOATABusCommand64* allocateCmd32(void);␉␊ |
233 | ␉virtual IODMACommand* GetDMACommand( void );␊ |
234 | ␉␊ |
235 | ␉␊ |
236 | ␉␊ |
237 | ␉// overrides for IODMACommand setup␊ |
238 | ␉virtual void zeroCommand(void); ␉ ␊ |
239 | ␉virtual void setBuffer ( IOMemoryDescriptor* inDesc);␊ |
240 | ␉virtual void setCommandInUse( bool inUse = true);␊ |
241 | ␉virtual void executeCallback(void);␊ |
242 | ␊ |
243 | ␊ |
244 | ␉protected:␊ |
245 | ␉IODMACommand* _dmaCmd;␊ |
246 | ␉virtual bool init(); ␊ |
247 | ␉virtual void free();␊ |
248 | };␊ |
249 | ␊ |
250 | #endif /*_IOATABUSCOMMAND_H*/␊ |
251 |