IOSCSICommand



Member Functions

abort

Abstract: Aborts an executing SCSI Command.
public:

void abort( UInt32 sequenceNumber );

The client may invoke the abort() method to force the completion of an executing SCSI Command. The client must pass the sequence number provided when the execute() function was invoked.

Note: The abort function provides no status on whether or not a command has been successfully aborted. The client should wait for the command to actually complete to determine whether the abort completed successfully.

Parameters

NameDescription
sequenceNumberThe client must pass the sequence number assigned to the command when the client called the execute() function.

complete

Abstract: Indicates the IOSCSIController subclass (host adapter driver) has completed a SCSI command.
public:

void complete();

Once the complete() function is called, the controller subclass should make no further accesses to the IOSCSICommand being completed.

A IOSCSIDevice client would not normally call this function.


execute

Abstract: Submits a SCSI command to be executed.
public:

bool execute( UInt32 *sequenceNumber = 0 );

Once the execute() function is called, the client should not invoke any further functions on the SCSI Command with the exception of abort().

The execute() function optionally returns sets a unique sequence number token for the command. If the client intends to use the abort() method they must retain this sequence number token.

Parameters

NameDescription
sequenceNumberPointer to field (UInt32) to receive the sequence number assigned to the SCSI Command.

getCDB

Abstract: Gets the CDB component of a SCSI Command.
public:

void getCDB( SCSICDBInfo *scsiCmd );

Parameters

NameDescription
scsiCDBPointer to a SCSICDBInfo structure to receive the SCSI Command's cdb information.

getClientData

Abstract: Returns a pointer to the SCSI Command's client data area.
public:

void *getClientData();

The client may allocate storage in the SCSI Command for its own use. See IOSCSIDevice::allocateCmd().


getCmdType

Abstract: Obtains the underlying 'intent' of a SCSI Command.
public:

UInt32 getCmdType();

This function provides information on the intent of a SCSI Command. For example, since Aborts, Request Sense and normal Execute commands are all sent to the executeCommand() function, invoking getCmdType() will indicate whether a Request Sense, Abort or Normal I/O request is being processed.

It this information is not normally meaningful to IOSCSIDevice clients.


getDevice

Abstract: Returns the IOSCSIDevice this command is targeted to.
public:

IOSCSIDevice *getDevice( IOSCSIDevice *deviceType );

In some cases a IOSCSICommand is not associated with a specific target/lun. This would be the case for a SCSI Bus Reset. In this case getDevice() returns 0.

Parameters

NameDescription
deviceTypeThe caller should use value kIOSCSIDeviceType.

getOriginalCmd

Abstract: Obtains a 'related' SCSI Command.
public:

IOSCSICommand *getOriginalCmd();

In cases where a SCSI command is related to a previous command, this function will return the original command. For example, if a Request Sense command (CmdType = kSCSICommandReqSense)is processed, then this function can be used to obtain the original command that caused the check condition. If an Abort command (CmdType = kSCSICommandAbort) then this function can be used to obtain the original command the abort was issued against.


It this information is not normally meaningful to IOSCSIDevice clients.


getPointers

Abstract: Gets the data buffer component of a SCSI Command.
public:

void getPointers( IOMemoryDescriptor **desc, UInt32 *transferCount, bool *isWrite, bool isSense = false );

The client provides a set of pointers to fields to receive the IOSCSICommand's data/request sense buffer pointers.

Parameters

NameDescription
descPointer to a field (IOMemoryDescriptor *) to receive the IOSCSICommand's IOMemoryDescriptor pointer.
transferCountPointer to a field (UInt32) to receive the IOSCSICommand's maximum transfer count.
isWritePointer to a field (bool) to receive the IOSCSICommand's transfer direction.
isSenseIf isSense is set to true, the IOSCSICommand's data buffer information is returned. Otherwise, the IOSCSICommand's request sense buffer information is returned.

getQueueInfo

Abstract: Gets queuing information for the SCSI Command.
public:

void getQueueInfo( UInt32 *queueType, UInt32 *queuePosition = 0 );

Parameters

NameDescription
queueTypePointer to a field (UInt32) to receive the queue type previously set for this SCSI Command.
queuePositionPointer to a field (UInt32) to receive the queue position previously set for this SCSI Command.

getResults

Abstract: Gets results from a completed SCSI Command.
public:

IOReturn getResults( SCSIResults *results );

The getResults() function returns the value of the returnCode field of the command results. If the client is only interested in a pass/fail indication for the command, the client can pass (SCSIResult *)0 as a parameter.

Parameters

NameDescription
resultsPointer to a SCSIResults structure to receive the SCSI Commands completion information.

getSequenceNumber

Abstract: Returns the sequence number assigned to an executing command.
public:

UInt32 getSequenceNumber();

The caller should check the sequence number for 0. This indicates that the command has completed or has not been processed to the point where a sequence number has been assigned.


getTargetLun

Abstract: Returns the target/lun for the IOSCSIDevice this command is associated with.
public:

void getTargetLun( SCSITargetLun *targetLun );

Parameters

NameDescription
targetLunPointer to a SCSITargetLun structure to receive the target/lun information.

getTimeout

Abstract: Gets the timeout for the command in milliseconds.
public:

UInt32 getTimeout();

This function returns the command timeout previously set by setTimeout().

Parameters

NameDescription
timeoutCommand timeout in milliseconds.

setCDB

Abstract: Sets the CDB component of a SCSI Command.
public:

void setCDB( SCSICDBInfo *scsiCmd );

Parameters

NameDescription
scsiCDBPointer to a SCSICDBInfo structure.

setCallback

Abstract: Sets the callback routine to be invoked when the SCSI Command completes.
public:

void setCallback( void *target = 0, CallbackFn callback = 0, void *refcon = 0 );

Parameters

NameDescription
targetPointer to the object to be passed to the callback routine. This would usually be the client's (this) pointer.
callbackPointer to the client's function to process the completed command
refconPointer to the information required by the client's callback routine to process the completed command.

setPointers

Abstract: Sets the data buffer component of a SCSI Command.
public:

void setPointers( IOMemoryDescriptor *desc, UInt32 transferCount, bool isWrite, bool isSense=false );

The client provides an IOMemoryDescriptor object to corresponding to the client's data or request sense buffer, the maximum data transfer count and data transfer direction.

Parameters

NameDescription
descPointer to a IOMemoryDescriptor describing the client's I/O buffer.
transferCountMaximum data transfer count in bytes.
isWriteData transfer direction. (Defined with respect to the device, i.e. isWrite = true indicates the host is writing to the device.
isSenseIf isSense is set to true, the IOSCSICommand's data buffer information is set. Otherwise, the IOSCSICommand's request sense buffer information is set

setQueueInfo

Abstract: Sets queuing information for the SCSI Command.
public:

void setQueueInfo( UInt32 queueType = kQTypeNormalQ, UInt32 queuePosition = kQPositionTail );

Each IOSCSIDevice has two queues, a normal Q and a bypass Q. The treatment of the queues is esentially identical except that the bypass Q is given preference whenever it has commands available.

Usually, the client will use the normal Q for regular I/O commands and the bypass Q to send error recovery commands to the device.

Parameters

NameDescription
queueTypeSet to kQTypeNormalQ or kQTypeBypassQ to indicate which IOSCSIDevice queue the SCSI Command should be routed to.
queuePositionSet to kQPositionTail or kQPositionHead to indicate whether the SCSI Command should be added to the head to tail for the selected IOSCSIDevice queue.

setResults

Abstract: Sets the results component of a SCSI Command.
public:

void setResults( SCSIResults *results );

The setResults() function is used by the IOSCSIController subclass (host adapter driver) return results for a SCSI Command about to be completed.

Parameters

NameDescription
scsiResultsPointer to a SCSIResults structure containing completion information for the SCSI Command.

Completion information is copied into the command, so the caller may release the SCSIResults structure provided when this function returns.

setTimeout

Abstract: Sets the timeout for the command in milliseconds.
public:

void setTimeout( UInt32 timeoutmS );

The IOSCSIController class will abort a command which does not complete with in the time interval specified. The client should set the timeout parameter to zero if they want to suppress timing.

Parameters

NameDescription
timeoutCommand timeout in milliseconds.

© 2000 Apple Computer, Inc. — (Last Updated 2/23/2000)