2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
27 #ifndef _IOATASTANDARDCOMMAND_H
28 #define _IOATASTANDARDCOMMAND_H
30 class IOATAStandardDevice
;
31 class IOATAStandardCommand
;
33 class IOATAStandardDriver
;
35 class IOATAStandardCommand
: public IOATACommand
37 OSDeclareDefaultStructors(IOATAStandardCommand
)
39 friend class IOATAStandardController
;
40 friend class IOATAStandardDevice
;
41 friend class IOATAStandardDriver
;
43 /*------------------Methods provided to IOCDBCommand users -------------------------*/
46 * Set/Get IOMemoryDescriptor object to I/O data buffer or sense data buffer.
48 void setPointers( IOMemoryDescriptor
*desc
,
51 bool isSense
= false );
53 void getPointers( IOMemoryDescriptor
**desc
,
54 UInt32
*transferCount
,
56 bool isSense
= false );
58 * Set/Get command timeout (mS)
60 void setTimeout( UInt32 timeoutmS
);
64 * Set async callback routine. Specifying no parameters indicates synchronous call.
66 void setCallback( void *target
= 0, CallbackFn callback
= 0, void *refcon
= 0 );
69 * Set/Get CDB information. (Generic CDB version)
71 void setCDB( CDBInfo
*cdbInfo
);
72 void getCDB( CDBInfo
*cdbInfo
);
75 * Get CDB results. (Generic CDB version)
77 IOReturn
getResults( CDBResults
*cdbResults
);
80 * Get CDB Device this command is directed to.
82 IOCDBDevice
*getDevice( IOCDBDevice
*deviceType
);
83 // #define kIOCDBDevice ((IOCDBDevice *)0)
88 bool execute( UInt32
*sequenceNumber
= 0 );
89 void abort( UInt32 sequenceNumber
);
93 * Get pointers to client and command data.
95 void *getCommandData();
96 void *getClientData();
99 * Get unique sequence number assigned to command.
101 UInt32
getSequenceNumber();
103 /*------------------ Additional methods provided to IOATACommand users -------------------------*/
106 * Set/Get ATA taskfile information.
108 void setTaskfile( ATATaskfile
*taskfile
);
109 void getTaskfile( ATATaskfile
*taskfile
);
110 ATAProtocol
getProtocol();
111 UInt32
getResultMask();
115 * Set/Get CDB information. (ATA specific version).
117 void setCDB( ATACDBInfo
*ataCmd
);
118 void getCDB( ATACDBInfo
*ataCmd
);
121 * Get/Set CDB results. (ATA specific version).
123 IOReturn
getResults( ATAResults
*results
);
124 void setResults( ATAResults
*results
);
127 * Get ATA Device this command is directed to.
129 IOATAStandardDevice
*getDevice( IOATAStandardDevice
*deviceType
);
130 // #define kIOATADevice ((IOATADevice *)0)
134 * Get ATA Target/Lun for this command.
139 * Get/Set queue routing for this command.
141 void setQueueInfo( UInt32 forQueueType
= kATAQTypeNormalQ
, UInt32 forQueuePosition
= kATAQPositionTail
);
142 void getQueueInfo( UInt32
*forQueueType
, UInt32
*forQueuePosition
= 0 );
145 * Get command type / Get original command.
147 * These methods are provided for the controller class to identify and relate commands.
148 * They are not usually of interest to the client side.
151 IOATAStandardCommand
*getOriginalCmd();
153 /*------------------Methods private to the IOATACommand class-------------------------*/
155 IOATADevice
*getDevice( IOATADevice
*deviceType
);
159 ATACommandType cmdType
;
161 IOATAStandardController
*controller
;
162 IOATAStandardDevice
*device
;
165 queue_chain_t nextCommand
;
167 ATATaskfile taskfile
;
179 IOMemoryDescriptor
*xferDesc
;
181 UInt32 xferDirection
;
184 IOMemoryDescriptor
*senseData
;
186 IOATAStandardCommand
*origCommand
;
205 void *commandPrivateData
;
208 UInt32 sequenceNumber
;