]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/scsi/scsi-device/IOSCSICommand.h
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / IOKit / scsi / scsi-device / IOSCSICommand.h
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 _IOSCSICOMMAND_H
28 #define _IOSCSICOMMAND_H
29
30 class IOSCSIDevice;
31 class IOSCSICommand;
32
33 class IOSCSICommand : public IOCDBCommand
34 {
35 OSDeclareAbstractStructors(IOSCSICommand)
36
37 /*------------------Methods provided to IOCDBCommand users -------------------------*/
38 public:
39 /*
40 * Set/Get IOMemoryDescriptor object to I/O data buffer or sense data buffer.
41 */
42 virtual void setPointers( IOMemoryDescriptor *desc,
43 UInt32 transferCount,
44 bool isWrite,
45 bool isSense = false ) = 0;
46
47 virtual void getPointers( IOMemoryDescriptor **desc,
48 UInt32 *transferCount,
49 bool *isWrite,
50 bool isSense = false ) = 0;
51 /*
52 * Set/Get command timeout (mS)
53 */
54 virtual void setTimeout( UInt32 timeoutmS ) = 0;
55 virtual UInt32 getTimeout() = 0;
56
57 /*
58 * Set async callback routine. Specifying no parameters indicates synchronous call.
59 */
60 virtual void setCallback( void *target = 0, CallbackFn callback = 0, void *refcon = 0 ) = 0;
61
62 /*
63 * Set/Get CDB information. (Generic CDB version)
64 */
65 virtual void setCDB( CDBInfo *cdbInfo ) = 0;
66 virtual void getCDB( CDBInfo *cdbInfo ) = 0;
67
68 /*
69 * Get CDB results. (Generic CDB version)
70 */
71 virtual IOReturn getResults( CDBResults *cdbResults ) = 0;
72
73 /*
74 * Get CDB Device this command is directed to.
75 */
76 virtual IOCDBDevice *getDevice( IOCDBDevice *deviceType ) = 0;
77
78 /*
79 * Command verbs
80 */
81 virtual bool execute( UInt32 *sequenceNumber = 0 ) = 0;
82 virtual void abort( UInt32 sequenceNumber ) = 0;
83 virtual void complete() = 0;
84
85 /*
86 * Get pointers to client and command data.
87 */
88 virtual void *getCommandData() = 0;
89 virtual void *getClientData() = 0;
90
91 /*
92 * Get unique sequence number assigned to command.
93 */
94 virtual UInt32 getSequenceNumber() = 0;
95
96 /*------------------ Additional methods provided to IOSCSICommand users -------------------------*/
97 public:
98 /*
99 * Set/Get CDB information. (SCSI specific version).
100 */
101 virtual void setCDB( SCSICDBInfo *scsiCmd ) = 0;
102 virtual void getCDB( SCSICDBInfo *scsiCmd ) = 0;
103
104 /*
105 * Get/Set CDB results. (SCSI specific version).
106 */
107 virtual IOReturn getResults( SCSIResults *results ) = 0;
108 virtual void setResults( SCSIResults *results ) = 0;
109
110 /*
111 * Get SCSI Device this command is directed to.
112 */
113 virtual IOSCSIDevice *getDevice( IOSCSIDevice *deviceType ) = 0;
114
115 /*
116 * Get SCSI Target/Lun for this command.
117 */
118 virtual void getTargetLun( SCSITargetLun *targetLun ) = 0;
119
120 /*
121 * Get/Set queue routing for this command.
122 */
123 virtual void setQueueInfo( UInt32 forQueueType = kQTypeNormalQ, UInt32 forQueuePosition = kQPositionTail ) = 0;
124 virtual void getQueueInfo( UInt32 *forQueueType, UInt32 *forQueuePosition = 0 ) = 0;
125
126 /*
127 * Set to blank state, call prior to re-use of this object.
128 */
129 virtual void zeroCommand() = 0;
130 };
131
132 #endif