SCSITask.h Reference

Declared in
SCSITask.h

Overview

SCSITask typedefs and constants used inside the kernel and user space.

Note that the SCSITaskIdentifier is an opaque object and that directly casting the SCSITaskIdentifier to any other type is discouraged. The SCSITask implementation changes when necessary to accomodate architectural changes, performance improvements, and bug fixes.

Device and protocol layer drivers that need to access information contained in a SCSITask should use the appropriate accessor methods in IOSCSIPrimaryCommandsDevice.h or IOSCSIProtocolServices.h

Included Headers

  • <IOKit/IOTypes.h>

  • <CoreFoundation/CoreFoundation.h>

  • <libkern/c++/OSObject.h>

Callbacks

See the Overview section above for header-level documentation.

SCSITaskCompletion

typedef void ( *SCSITaskCompletion )(
   SCSITaskIdentifier completedTask );

Discussion

This is the typedef for completion routines that work with SCSITaskIdentifiers.

Availability
  • Available in OS X v10.6 and later.
Declared In
SCSITask.h

Data Types

See the Overview section above for header-level documentation.

SCSIDeviceIdentifier

64-bit number to represent a SCSI Device.

typedef UInt64 SCSIDeviceIdentifier;
Discussion

If the identifier can either be that of an initiator or a target, SCSIDeviceIdentifier should be used.

Availability
  • Available in OS X v10.2 and later.
Declared In
SCSITask.h

SCSIInitiatorIdentifier

64-bit number to represent a SCSI Initiator Device.

typedef SCSIDeviceIdentifier SCSIInitiatorIdentifier;
Discussion

If the identifier is for an initiator only and not a target, then SCSIInitiatorIdentifier should be used.

Availability
  • Available in OS X v10.2 and later.
Declared In
SCSITask.h

SCSIServiceResponse

Attributes for task service response.

typedef enum SCSIServiceResponse {
   /*!
   */
   kSCSIServiceResponse_Request_In_Process = 0,
   /*!
   */
   kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE = 1,
   /*!
   */
   kSCSIServiceResponse_TASK_COMPLETE = 2,
   /*!
   */
   kSCSIServiceResponse_LINK_COMMAND_COMPLETE = 3,
   /*!
   */
   kSCSIServiceResponse_FUNCTION_COMPLETE = 4,
   /*!
   */
   kSCSIServiceResponse_FUNCTION_REJECTED = 5
} SCSIServiceResponse;
Constants
kSCSIServiceResponse_Request_In_Process

Not defined in SAM specification, but is a service response used for asynchronous commands that are not yet completed.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE

The service request failed because of a delivery or target failure.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSIServiceResponse_TASK_COMPLETE

The task completed.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSIServiceResponse_LINK_COMMAND_COMPLETE

The linked command completed.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSIServiceResponse_FUNCTION_COMPLETE

The task management function completed.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSIServiceResponse_FUNCTION_REJECTED

The task management function was rejected.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

Discussion

The Service Response represents the execution status of a service request made to a Protocol Services Driver. The Service Response can only be modified by the SCSI Protocol Layer. The SCSI Application Layer can only read the state.

Availability
  • Available in OS X v10.0 and later.
Declared In
SCSITask.h

SCSITaggedTaskIdentifier

64-bit number to represent a unique task identifier.

typedef UInt64 SCSITaggedTaskIdentifier;
Discussion

The Tagged Task Identifier is used when a Task has a Task Attribute other than SIMPLE. The SCSI Application Layer client that controls the Logical Unit for which a Task is intended is required to guarantee that the Task Tag Identifier is unique. Zero cannot be used a a Tag value as this is used to when a Tagged Task Identifier value is needed for a Task with a SIMPLE attribute.

Availability
  • Available in OS X v10.2 and later.
Declared In
SCSITask.h

SCSITargetIdentifier

64-bit number to represent a SCSI Target Device.

typedef SCSIDeviceIdentifier SCSITargetIdentifier;
Discussion

If the identifier is for a target only and not an initiator, then SCSITargetIdentifier should be used.

Availability
  • Available in OS X v10.2 and later.
Declared In
SCSITask.h

SCSITaskAttribute

Attributes for task delivery.

typedef enum SCSITaskAttribute {
   kSCSITask_SIMPLE = 0,
   kSCSITask_ORDERED = 1,
   kSCSITask_HEAD_OF_QUEUE = 2,
   kSCSITask_ACA = 3
} SCSITaskAttribute;
Constants
kSCSITask_SIMPLE

The task has a simple attribute.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITask_ORDERED

The task has an ordered attribute.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITask_HEAD_OF_QUEUE

The task has a head-of-queue attribute.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITask_ACA

The task has an auto-contingent-allegiance attribute.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

Discussion

The Task Attribute defines how this task should be managed when determing order for queueing and submission to the appropriate device server. The Task Attribute is set by the SCSI Application Layer and cannot be modified by the SCSI Protocol Layer.

Availability
  • Available in OS X v10.0 and later.
Declared In
SCSITask.h

SCSITaskIdentifier

typedef OSObject * SCSITaskIdentifier;
Discussion

This is an opaque object that represents a task. This is used so that drivers for both the SCSI Protocol Layer and the SCSI Application Layer cannot modify the SCSITask object directly but must instead use the inherited methods to do so. This allows the implementation of SCSITask to change without directly impacting device and protocol layer drivers. In addition, it prevents changing of properties that are not allowed to be changed by a given layer.

Availability
  • Available in OS X v10.6 and later.
Declared In
SCSITask.h

SCSITaskMode

typedef enum SCSITaskMode {
   kSCSITaskMode_CommandExecution = 1,
   kSCSITaskMode_Autosense = 2
} SCSITaskMode;
Discussion

The SCSI Task mode is used by the SCSI Protocol Layer to indicate what mode the task is executing.

Availability
  • Available in OS X v10.6 and later.
Declared In
SCSITask.h

SCSITaskState

Attributes for task state.

typedef enum SCSITaskState {
   kSCSITaskState_NEW_TASK = 0,
   kSCSITaskState_ENABLED = 1,
   kSCSITaskState_BLOCKED = 2,
   kSCSITaskState_DORMANT = 3,
   kSCSITaskState_ENDED = 4
} SCSITaskState;
Constants
kSCSITaskState_NEW_TASK

The task state is new task.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskState_ENABLED

The task is enabled and queued.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskState_BLOCKED

The task is blocked.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskState_DORMANT

The task is dormant.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskState_ENDED

The task is complete.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

Discussion

The Task State represents the current state of the task. The state is set to NEW_TASK when the task is created. The SCSI Protocol Layer will then adjust the state as the task is queued and during execution. The SCSI Application Layer can examine the state to monitor the progress of a task. The Task State can only be modified by the SCSI Protocol Layer. The SCSI Application Layer can only read the state.

Availability
  • Available in OS X v10.0 and later.
Declared In
SCSITask.h

SCSITaskStatus

Attributes for task status.

typedef enum SCSITaskStatus {
   /*!
   */
   kSCSITaskStatus_GOOD = 0x00,
   /*!
   */
   kSCSITaskStatus_CHECK_CONDITION = 0x02,
   /*!
   */
   kSCSITaskStatus_CONDITION_MET = 0x04,
   /*!
   */
   kSCSITaskStatus_BUSY = 0x08,
   /*!
   */
   kSCSITaskStatus_INTERMEDIATE = 0x10,
   /*!
   */
   kSCSITaskStatus_INTERMEDIATE_CONDITION_MET = 0x14,
   /*!
   */
   kSCSITaskStatus_RESERVATION_CONFLICT = 0x18,
   /*!
   */
   kSCSITaskStatus_TASK_SET_FULL = 0x28,
   /*!
   */
   kSCSITaskStatus_ACA_ACTIVE = 0x30,
   /*!
   */
   kSCSITaskStatus_TaskTimeoutOccurred = 0x01,
   /*!
   */
   kSCSITaskStatus_ProtocolTimeoutOccurred = 0x02,
   /*!
   */
   kSCSITaskStatus_DeviceNotResponding = 0x03,
   /*!
   */
   kSCSITaskStatus_DeviceNotPresent = 0x04,
   /*!
   */
   kSCSITaskStatus_DeliveryFailure = 0x05,
   /*!
   */
   kSCSITaskStatus_No_Status = 0xFF
} SCSITaskStatus;
Constants
kSCSITaskStatus_GOOD

The task completed with a status of GOOD.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_CHECK_CONDITION

The task completed with a status of CHECK_CONDITION. Additional information about the condition should be available in the sense data.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_CONDITION_MET

The task completed with a status of CONDITION_MET.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_BUSY

The task completed with a status of BUSY. The device server might need time to process a request and a delay may be required.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_INTERMEDIATE

The task completed with a status of INTERMEDIATE.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_INTERMEDIATE_CONDITION_MET

The task completed with a status of INTERMEDIATE_CONDITION_MET.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_RESERVATION_CONFLICT

The task completed with a status of RESERVATION_CONFLICT.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_TASK_SET_FULL

The task completed with a status of TASK_SET_FULL. The device server may need to complete a task before the initiator sends another.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_ACA_ACTIVE

The task completed with a status of ACA_ACTIVE. The device server may need the initiator to clear the Auto-Contingent Allegiance condition before it will respond to new commands.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSITaskStatus_TaskTimeoutOccurred

If a task is aborted by the SCSI Protocol Layer due to it exceeding the timeout value specified by the task, the task status shall be set to kSCSITaskStatus_TaskTimeoutOccurred.

Available in OS X v10.3 and later.

Declared in SCSITask.h.

kSCSITaskStatus_ProtocolTimeoutOccurred

If a task is aborted by the SCSI Protocol Layer due to it exceeding a timeout value specified by the support for the protocol or a related specification, the task status shall be set to kSCSITaskStatus_ProtocolTimeoutOccurred.

Available in OS X v10.3 and later.

Declared in SCSITask.h.

kSCSITaskStatus_DeviceNotResponding

If a task is unable to be delivered due to a failure of the device not accepting the task or the device acknowledging the attempt to send it the device the task status shall be set to kSCSITaskStatus_DeviceNotResponding. This will allow the SCSI Application driver to perform the necessary steps to try to recover the device. This shall only be reported after the SCSI Protocol Layer driver has attempted all protocol specific attempts to recover the device.

Available in OS X v10.3 and later.

Declared in SCSITask.h.

kSCSITaskStatus_DeviceNotPresent

If the task is unable to be delivered because the device has been detached, the task status shall be set to kSCSITaskStatus_DeviceNotPresent. This will allow the SCSI Application Layer to halt the sending of tasks to the device and, if supported, perform any device failover or system cleanup.

Available in OS X v10.3 and later.

Declared in SCSITask.h.

kSCSITaskStatus_DeliveryFailure

If the task is unable to be delivered to the device due to a failure in the SCSI Protocol Layer, such as a bus reset or communications error, but the device is is known to be functioning properly, the task status shall be set to kSCSITaskStatus_DeliveryFailure. This can also be reported if the task could not be delivered due to a protocol error that has since been corrected.

Available in OS X v10.3 and later.

Declared in SCSITask.h.

kSCSITaskStatus_No_Status

This status is not defined by the SCSI specifications, but is here to provide a status that can be returned in cases where there is not status available from the device or protocol, for example, when the service response is neither TASK_COMPLETED nor LINK_COMMAND_COMPLETE or when the service response is SERVICE_DELIVERY_OR_TARGET_FAILURE and the reason for failure could not be determined.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

Discussion

The Task Status represents the completion status of the task which provides the SCSI Application Layer with additional information about how to procede in handling a completed task.

The SCSI Architecture Model specification only defines task status values for when a task completes with a service response of either TASK_COMPLETED or LINK_COMMAND_COMPLETE.

Since additional information will aid in error recovery when a task fails to be completed by a device due to a service response of kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE, additional values have been defined that can be returned by the SCSI Protocol Layer to inform the SCSI Application Layer of the cause of the delivery failure.

The Task Status can only be modified by the SCSI Protocol Layer. The SCSI Application Layer can only read the status

Availability
  • Available in OS X v10.0 and later.
Declared In
SCSITask.h

Constants

See the Overview section above for header-level documentation.

Command Descriptor Block Size

enum {
   /*!
   */
   kSCSICDBSize_Maximum = 16,
   /*!
   */
   kSCSICDBSize_6Byte = 6,
   /*!
   */
   kSCSICDBSize_10Byte = 10,
   /*!
   */
   kSCSICDBSize_12Byte = 12,
   /*!
   */
   kSCSICDBSize_16Byte = 16
};
Constants
kSCSICDBSize_Maximum

This is the largest size a Command Descriptor Block can be as specified in SPC-2.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSICDBSize_6Byte

Use this for a 6-byte CDB.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSICDBSize_10Byte

Use this for a 10-byte CDB.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSICDBSize_12Byte

Use this for a 12-byte CDB.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSICDBSize_16Byte

Use this for a 16-byte CDB.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

Discussion

Command Descriptor Block Size constants.

Data Transfer Direction

enum {
   /*!
   */
   kSCSIDataTransfer_NoDataTransfer = 0x00,
   /*!
   */
   kSCSIDataTransfer_FromInitiatorToTarget = 0x01,
   /*!
   */
   kSCSIDataTransfer_FromTargetToInitiator = 0x02
};
Constants
kSCSIDataTransfer_NoDataTransfer

Use this for tasks that transfer no data.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSIDataTransfer_FromInitiatorToTarget

Use this for tasks that transfer data from the initiator to the target.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

kSCSIDataTransfer_FromTargetToInitiator

Use this for tasks that transfer data from the target to the initiator.

Available in OS X v10.0 and later.

Declared in SCSITask.h.

Discussion

DataTransferDirection constants.

Untagged Task Identifier

enum {
   kSCSIUntaggedTaskIdentifier = 0
};
Constants
kSCSIUntaggedTaskIdentifier

This value means the task is untagged.

Available in OS X v10.2 and later.

Declared in SCSITask.h.

Discussion

The Untagged Task Identifier is used to indicate no unique tag is associated with the Task.