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 _IOSCSIPARALLELCOMMAND_H
28 #define _IOSCSIPARALLELCOMMAND_H
30 class IOSCSIParallelDevice
;
31 class IOSCSIParallelCommand
;
34 class IOSCSIParallelCommand
: public IOSCSICommand
36 OSDeclareDefaultStructors(IOSCSIParallelCommand
)
38 friend class IOSCSIParallelController
;
39 friend class IOSCSIParallelDevice
;
41 /*------------------Methods provided to IOCDBCommand users -------------------------*/
44 * Set/Get IOMemoryDescriptor object to I/O data buffer or sense data buffer.
46 void setPointers( IOMemoryDescriptor
*desc
,
49 bool isSense
= false );
51 void getPointers( IOMemoryDescriptor
**desc
,
52 UInt32
*transferCount
,
54 bool isSense
= false );
56 * Set/Get command timeout (mS)
58 void setTimeout( UInt32 timeoutmS
);
62 * Set async callback routine. Specifying no parameters indicates synchronous call.
64 void setCallback( void *target
= 0, CallbackFn callback
= 0, void *refcon
= 0 );
67 * Set/Get CDB information. (Generic CDB version)
69 void setCDB( CDBInfo
*cdbInfo
);
70 void getCDB( CDBInfo
*cdbInfo
);
73 * Get CDB results. (Generic CDB version)
75 IOReturn
getResults( CDBResults
*cdbResults
);
78 * Get CDB Device this command is directed to.
80 IOCDBDevice
*getDevice( IOCDBDevice
*deviceType
);
85 bool execute( UInt32
*sequenceNumber
= 0 );
86 void abort( UInt32 sequenceNumber
);
90 * Get pointers to client and command data.
92 void *getCommandData();
93 void *getClientData();
96 * Get unique sequence number assigned to command.
98 UInt32
getSequenceNumber();
100 /*------------------ Additional methods provided to IOSCSICommand users -------------------------*/
103 * Set/Get CDB information. (SCSI specific version).
105 void setCDB( SCSICDBInfo
*scsiCmd
);
106 void getCDB( SCSICDBInfo
*scsiCmd
);
109 * Get/Set CDB results. (SCSI specific version).
111 IOReturn
getResults( SCSIResults
*results
);
112 void setResults( SCSIResults
*results
, SCSINegotiationResults
*negotiationResults
);
115 * Get SCSI Device this command is directed to.
117 IOSCSIParallelDevice
*getDevice( IOSCSIParallelDevice
*deviceType
);
121 * Get SCSI Target/Lun for this command.
123 void getTargetLun( SCSITargetLun
*targetLun
);
126 * Get/Set queue routing for this command.
128 void setQueueInfo( UInt32 forQueueType
= kQTypeNormalQ
, UInt32 forQueuePosition
= kQPositionTail
);
129 void getQueueInfo( UInt32
*forQueueType
, UInt32
*forQueuePosition
= 0 );
132 * Get command type / Get original command.
134 * These methods are provided for the controller class to identify and relate commands.
135 * They are not usually of interest to the client side.
138 IOSCSIParallelCommand
*getOriginalCmd();
141 * Set to blank state, call prior to re-use of this object.
145 /*------------------Methods private to the IOSCSICommand class-------------------------*/
149 IOSCSIDevice
*getDevice( IOSCSIDevice
*deviceType
);
150 void setResults( SCSIResults
*results
);
153 IOReturn
adapterStatusToIOReturnCode( SCSIAdapterStatus adapterStatus
);
154 IOReturn
scsiStatusToIOReturnCode( UInt8 scsiStatus
);
157 SCSICommandType cmdType
;
159 IOSCSIParallelController
*controller
;
160 IOSCSIParallelDevice
*device
;
163 queue_chain_t nextCommand
;
174 IOMemoryDescriptor
*xferDesc
;
176 UInt32 xferDirection
;
179 IOMemoryDescriptor
*senseData
;
181 IOSCSIParallelCommand
*origCommand
;
200 void *commandPrivateData
;
203 UInt32 sequenceNumber
;