|
|
1.1 ! root 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: * IOSCSICommand.h ! 25: * ! 26: */ ! 27: #ifndef _IOSCSIPARALLELCOMMAND_H ! 28: #define _IOSCSIPARALLELCOMMAND_H ! 29: ! 30: class IOSCSIParallelDevice; ! 31: class IOSCSIParallelCommand; ! 32: class IOSyncer; ! 33: ! 34: class IOSCSIParallelCommand : public IOSCSICommand ! 35: { ! 36: OSDeclareDefaultStructors(IOSCSIParallelCommand) ! 37: ! 38: friend class IOSCSIParallelController; ! 39: friend class IOSCSIParallelDevice; ! 40: ! 41: /*------------------Methods provided to IOCDBCommand users -------------------------*/ ! 42: public: ! 43: /* ! 44: * Set/Get IOMemoryDescriptor object to I/O data buffer or sense data buffer. ! 45: */ ! 46: void setPointers( IOMemoryDescriptor *desc, ! 47: UInt32 transferCount, ! 48: bool isWrite, ! 49: bool isSense = false ); ! 50: ! 51: void getPointers( IOMemoryDescriptor **desc, ! 52: UInt32 *transferCount, ! 53: bool *isWrite, ! 54: bool isSense = false ); ! 55: /* ! 56: * Set/Get command timeout (mS) ! 57: */ ! 58: void setTimeout( UInt32 timeoutmS ); ! 59: UInt32 getTimeout(); ! 60: ! 61: /* ! 62: * Set async callback routine. Specifying no parameters indicates synchronous call. ! 63: */ ! 64: void setCallback( void *target = 0, CallbackFn callback = 0, void *refcon = 0 ); ! 65: ! 66: /* ! 67: * Set/Get CDB information. (Generic CDB version) ! 68: */ ! 69: void setCDB( CDBInfo *cdbInfo ); ! 70: void getCDB( CDBInfo *cdbInfo ); ! 71: ! 72: /* ! 73: * Get CDB results. (Generic CDB version) ! 74: */ ! 75: IOReturn getResults( CDBResults *cdbResults ); ! 76: ! 77: /* ! 78: * Get CDB Device this command is directed to. ! 79: */ ! 80: IOCDBDevice *getDevice( IOCDBDevice *deviceType ); ! 81: // #define kIOCDBDevice ((IOCDBDevice *)0) ! 82: ! 83: /* ! 84: * Command verbs ! 85: */ ! 86: bool execute( UInt32 *sequenceNumber = 0 ); ! 87: void abort( UInt32 sequenceNumber ); ! 88: void complete(); ! 89: ! 90: /* ! 91: * Get pointers to client and command data. ! 92: */ ! 93: void *getCommandData(); ! 94: void *getClientData(); ! 95: ! 96: /* ! 97: * Get unique sequence number assigned to command. ! 98: */ ! 99: UInt32 getSequenceNumber(); ! 100: ! 101: /*------------------ Additional methods provided to IOSCSICommand users -------------------------*/ ! 102: public: ! 103: /* ! 104: * Set/Get CDB information. (SCSI specific version). ! 105: */ ! 106: void setCDB( SCSICDBInfo *scsiCmd ); ! 107: void getCDB( SCSICDBInfo *scsiCmd ); ! 108: ! 109: /* ! 110: * Get/Set CDB results. (SCSI specific version). ! 111: */ ! 112: IOReturn getResults( SCSIResults *results ); ! 113: void setResults( SCSIResults *results ); ! 114: ! 115: /* ! 116: * Get SCSI Device this command is directed to. ! 117: */ ! 118: IOSCSIDevice *getDevice( IOSCSIDevice *deviceType ); ! 119: // #define kIOSCSIDevice ((IOSCSIDevice *)0) ! 120: ! 121: ! 122: /* ! 123: * Get SCSI Target/Lun for this command. ! 124: */ ! 125: void getTargetLun( SCSITargetLun *targetLun ); ! 126: ! 127: /* ! 128: * Get/Set queue routing for this command. ! 129: */ ! 130: void setQueueInfo( UInt32 forQueueType = kQTypeNormalQ, UInt32 forQueuePosition = kQPositionTail ); ! 131: void getQueueInfo( UInt32 *forQueueType, UInt32 *forQueuePosition = 0 ); ! 132: ! 133: /* ! 134: * Get command type / Get original command. ! 135: * ! 136: * These methods are provided for the controller class to identify and relate commands. ! 137: * They are not usually of interest to the client side. ! 138: */ ! 139: UInt32 getCmdType(); ! 140: IOSCSICommand *getOriginalCmd(); ! 141: ! 142: /*------------------Methods private to the IOSCSICommand class-------------------------*/ ! 143: public: ! 144: void free(); ! 145: ! 146: private: ! 147: SCSICommandType cmdType; ! 148: ! 149: IOSCSIParallelController *controller; ! 150: IOSCSIParallelDevice *device; ! 151: ! 152: queue_head_t *list; ! 153: queue_chain_t nextCommand; ! 154: ! 155: SCSICDBInfo scsiCmd; ! 156: SCSIResults results; ! 157: ! 158: UInt32 timeout; ! 159: UInt32 timer; ! 160: ! 161: UInt8 queueType; ! 162: UInt8 queuePosition; ! 163: ! 164: IOMemoryDescriptor *xferDesc; ! 165: UInt32 xferCount; ! 166: UInt32 xferDirection; ! 167: ! 168: UInt32 senseLength; ! 169: IOMemoryDescriptor *senseData; ! 170: ! 171: IOSCSIParallelCommand *origCommand; ! 172: ! 173: union ! 174: { ! 175: struct ! 176: { ! 177: UInt32 reserved; ! 178: IOSyncer * lock; ! 179: } sync; ! 180: struct ! 181: { ! 182: CallbackFn callback; ! 183: void *target; ! 184: void *refcon; ! 185: } async; ! 186: } completionInfo; ! 187: ! 188: UInt32 dataSize; ! 189: void *dataArea; ! 190: void *commandPrivateData; ! 191: void *clientData; ! 192: ! 193: UInt32 sequenceNumber; ! 194: }; ! 195: ! 196: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.