Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | /* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * The contents of this file constitute Original Code as defined in and * are subject to the Apple Public Source License Version 1.1 (the * "License"). You may not use this file except in compliance with the * License. Please obtain a copy of the License at * http://www.apple.com/publicsource and read it before using this file. * * This Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. * * @APPLE_LICENSE_HEADER_END@ */ /* * * IOSCSICommand.h * */ #ifndef _IOSCSIPARALLELCOMMAND_H #define _IOSCSIPARALLELCOMMAND_H class IOSCSIParallelDevice; class IOSCSIParallelCommand; class IOSyncer; class IOSCSIParallelCommand : public IOSCSICommand { OSDeclareDefaultStructors(IOSCSIParallelCommand) friend class IOSCSIParallelController; friend class IOSCSIParallelDevice; /*------------------Methods provided to IOCDBCommand users -------------------------*/ public: /* * Set/Get IOMemoryDescriptor object to I/O data buffer or sense data buffer. */ void setPointers( IOMemoryDescriptor *desc, UInt32 transferCount, bool isWrite, bool isSense = false ); void getPointers( IOMemoryDescriptor **desc, UInt32 *transferCount, bool *isWrite, bool isSense = false ); /* * Set/Get command timeout (mS) */ void setTimeout( UInt32 timeoutmS ); UInt32 getTimeout(); /* * Set async callback routine. Specifying no parameters indicates synchronous call. */ void setCallback( void *target = 0, CallbackFn callback = 0, void *refcon = 0 ); /* * Set/Get CDB information. (Generic CDB version) */ void setCDB( CDBInfo *cdbInfo ); void getCDB( CDBInfo *cdbInfo ); /* * Get CDB results. (Generic CDB version) */ IOReturn getResults( CDBResults *cdbResults ); /* * Get CDB Device this command is directed to. */ IOCDBDevice *getDevice( IOCDBDevice *deviceType ); /* * Command verbs */ bool execute( UInt32 *sequenceNumber = 0 ); void abort( UInt32 sequenceNumber ); void complete(); /* * Get pointers to client and command data. */ void *getCommandData(); void *getClientData(); /* * Get unique sequence number assigned to command. */ UInt32 getSequenceNumber(); /*------------------ Additional methods provided to IOSCSICommand users -------------------------*/ public: /* * Set/Get CDB information. (SCSI specific version). */ void setCDB( SCSICDBInfo *scsiCmd ); void getCDB( SCSICDBInfo *scsiCmd ); /* * Get/Set CDB results. (SCSI specific version). */ IOReturn getResults( SCSIResults *results ); void setResults( SCSIResults *results, SCSINegotiationResults *negotiationResults ); /* * Get SCSI Device this command is directed to. */ IOSCSIParallelDevice *getDevice( IOSCSIParallelDevice *deviceType ); /* * Get SCSI Target/Lun for this command. */ void getTargetLun( SCSITargetLun *targetLun ); /* * Get/Set queue routing for this command. */ void setQueueInfo( UInt32 forQueueType = kQTypeNormalQ, UInt32 forQueuePosition = kQPositionTail ); void getQueueInfo( UInt32 *forQueueType, UInt32 *forQueuePosition = 0 ); /* * Get command type / Get original command. * * These methods are provided for the controller class to identify and relate commands. * They are not usually of interest to the client side. */ UInt32 getCmdType(); IOSCSIParallelCommand *getOriginalCmd(); /* * Set to blank state, call prior to re-use of this object. */ void zeroCommand(); /*------------------Methods private to the IOSCSICommand class-------------------------*/ public: void free(); IOSCSIDevice *getDevice( IOSCSIDevice *deviceType ); void setResults( SCSIResults *results ); private: IOReturn adapterStatusToIOReturnCode( SCSIAdapterStatus adapterStatus ); IOReturn scsiStatusToIOReturnCode( UInt8 scsiStatus ); private: SCSICommandType cmdType; IOSCSIParallelController *controller; IOSCSIParallelDevice *device; queue_head_t *list; queue_chain_t nextCommand; SCSICDBInfo scsiCmd; SCSIResults results; UInt32 timeout; UInt32 timer; UInt8 queueType; UInt8 queuePosition; IOMemoryDescriptor *xferDesc; UInt32 xferCount; UInt32 xferDirection; UInt32 senseLength; IOMemoryDescriptor *senseData; IOSCSIParallelCommand *origCommand; union { struct { UInt32 reserved; IOSyncer * lock; } sync; struct { CallbackFn callback; void *target; void *refcon; } async; } completionInfo; UInt32 dataSize; void *dataArea; void *commandPrivateData; void *clientData; UInt32 sequenceNumber; }; #endif |