scdisk SCSI Device Driver
Purpose
Supports the small computer system interface (SCSI) hard disk, CD-ROM (compact-disc read-only memory), and read/write optical (optical memory) devices.
Syntax
#include <sys/devinfo.h>
#include <sys/scsi.h>
#include <sys/scdisk.h>
#include <sys/pcm.h>
#include <sys/mpio.h>
Device-Dependent Subroutines
Typical hard disk, CD-ROM, and read/write optical drive operations are implemented by using the open, close, read, write, and ioctl subroutines. The scdisk device driver has additional support added for MPIO capable devices.
open and close Subroutines
The open subroutine applies a reservation policy that is based on the ODM reserve_policy attribute. In the past, the open subroutine always applied an SCSI2 reserve. The open and close subroutines support working with multiple paths to a device if the device is an MPIO capable device.
The openx subroutine is intended primarily for use by diagnostic commands and utilities. Appropriate authority is required for execution. If an attempt is made to run the open subroutine without the proper authority, the subroutine returns a value of -1 and sets the errno global variable to a value of EPERM.
The ext parameter that is passed to the openx subroutine selects the operation to be used for the target device. The /usr/include/sys/scsi.h file defines possible values for the ext parameter.
The ext parameter can contain any combination of the following flag values logically ORed together:
Item | Description |
---|---|
SC_DIAGNOSTIC | Places the selected device in Diagnostic mode. This mode is
singularly entrant; that is, only one process at a time can open it.
When a device is in Diagnostic mode, SCSI operations are performed
during open or close operations, and error logging
process is disabled. In Diagnostic mode, only the close and ioctl subroutine
operations are accepted. All other device-supported subroutines return
a value of -1 and set the errno global variable to a value of EACCES.
A device can be opened in Diagnostic mode only if the target device is not currently opened. If an attempt is made to open a device in Diagnostic mode and the target device is already open, the subroutine returns a value of -1 and sets the errno global variable to a value of EACCES. |
SC_FORCED_OPEN_LUN | On a device that supports Lun Level Reset, the device is reset regardless of any reservation that is placed by another initiator before the open sequence takes place. If the device does not support Lun Level Reset, and both SC_FORCED_OPEN_LUN and SC_FORCE_OPEN flags are set, then a target reset occurs before the open sequence takes place. |
SC_FORCED_OPEN | Forces a bus device reset, regardless of whether another initiator has the device reserved. The SCSI bus device reset is sent to the device before the open sequence begins. In other respects, the open operation runs normally. |
SC_RETAIN_RESERVATION | Retains the reservation of the device after a close operation by not issuing the release. This flag prevents other initiators from using the device unless they break the host machine's reservation. |
SC_NO_RESERVE | Prevents the reservation of a device during an openx subroutine call to that device. This operation is provided so a device can be controlled by two processors that synchronize their activity by their own software means. |
SC_SINGLE | Places the selected device in Exclusive Access mode. Only one
process at a time can open a device in Exclusive Access mode. A device can be opened in Exclusive Access mode only if the device is not currently open. If an attempt is made to open a device in Exclusive Access mode and the device is already open, the subroutine returns a value of -1 and sets the errno global variable to a value of EBUSY. If the SC_DIAGNOSTIC flag is specified along with the SC_SINGLE flag, the device is placed in Diagnostic mode. |
SC_PR_SHARED_REGISTER | In a multi-initiator shared device environment, a Persistent
Reserve with service action Register and Ignore Key is
sent to the device as part of the open sequence. This feature is aimed
at the cluster environment, where an upper management software needs
to follow an advisory lock mechanism to control when the initiator
reads or writes. The device is required to support Persistent Reserve
(refer to SCSI Primary Command version 2 description of Persistent
Reserve). |
SCSI Options to the openx Subroutine in Kernel Extensions and Device Support Programming Concepts gives more specific information about the open operations.
readx and writex Subroutines
The readx and writex subroutines provide additional parameters which affect the raw data transfer. These subroutines pass the ext parameter, which specifies request options. The options are constructed by logically ORing zero or more of the following values:
Item | Description |
---|---|
HWRELOC | Indicates a request for hardware relocation (safe relocation only) |
UNSAFEREL | Indicates a request for unsafe hardware relocation |
WRITEV | Indicates a request for write verification |
ioctl Subroutine
ioctl subroutine operations that are used for the scdisk device driver are specific to the following categories:
- Hard disk and read/write optical devices only
- CD-ROM devices only
- Hard disk, CD-ROM, and read/write optical devices
Hard disk and read/write optical devices
The following ioctl operations are available for the hard disk and read/write optical devices:
Item | Description |
---|---|
DKIOWRSE | Provides a means for issuing a write command to the
device and obtaining the target-device sense data when an error occurs.
If the DKIOWRSE operation returns a value of -1 and the status_validity field
is set to a value of sc_valid_sense, valid sense data is returned.
Otherwise, target sense data is omitted. The DKIOWRSE operation is provided for diagnostic use. It allows the limited use of the target device when it is operating in an active system environment. The arg parameter to the DKIOWRSE operation contains the address of an sc_rdwrt structure. This structure is defined in the /usr/include/sys/scsi.h file. The devinfo structure defines the maximum transfer size for a write operation. If an attempt is made to transfer more than the maximum, the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device. |
DKLOGSENSE | Provides a means to issue the LOG SENSE command
on devices that is successfully opened. Any application that issues
this ioctl operation must pass the address of the struct
sc_log_sense (defined in /usr/include/sys/scsi.h) and
the structure is filled as follows:
If the requested log page is SCSI_BSR_LOG_PAGE (defined in /usr/include/sys/scsi.h) then the log_data points to the struct sc_bsr_log_data allocated by the caller. The caller also allocates the memory for the struct sc_bms_log_data such that total of sizeof struct sc_bsr_log_data and memory allocated for the struct sc_bms_log_data is equal to the allocation_length. Otherwise (for log pages other than SCSI_BSR_LOG_PAGE), it points to a chunk of memory equal to allocation_length. Following is the example code for filling the sc_log_sense structure:
|
The DKLOGSENSE ioctl operation
returns the following data by using the struct sc_log_sense (rc=0 indicates
success):
|
|
DKLOGSELECT | Provides a means to issue the LOG SELECT command. Any
application that issues the DKLOGSELECT ioctl operation
is expected to pass the address of the DKLOGSELECT (defined
in /usr/include/sys/scsi.h) filled as follows:
Following is an example for filling the sc_log_select structure
to clear the SCSI_BSR_LOG_PAGE data**.
This ioctl operation
returns the following data by using the struct sc_log_select (rc=0 indicates
success) adapter_status,scsi_status, sense_key, scsi_asc,
and scsi_ascq fields reporting the error completion status
of the LOG SELECT command. |
CD-ROM Devices Only
The following ioctl operation is available for CD-ROM devices only:
Item | Description |
---|---|
CDIOCMD | Allows SCSI commands to be issued directly to the attached
CD-ROM device. The CDIOCMD operation preserves binary compatibility
for CD-ROM applications that were compiled on earlier releases of
the operating system. It is recommended that newly written CD-ROM
applications use the DKIOCMD operation instead. For the CDIOCMD operation,
the device must be opened in Diagnostic mode. The CDIOCMD operation
parameter specifies the address of a sc_iocmd structure. This
structure is defined in the /usr/include/sys/scsi.h file. If this operation is attempted on a device other than CD-ROM, it is interpreted as a DKIORDSE operation. In this case, the arg parameter is treated as an sc_rdwrt structure. If the CDIOCMD operation is attempted on a device not in Diagnostic mode, the subroutine returns a value of -1 and sets the errno global variable to a value of EACCES. Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device. Note: Diagnostic mode is required
only for the CDIOCMD and DKIOCMD operations.
|
Hard disk, CD-ROM, and read/write optical devices
The following ioctl operations are available for hard disk, CD-ROM, and read/write optical devices:
Item | Description |
---|---|
IOCINFO | Returns the devinfo structure that is defined in the /usr/include/sys/devinfo.h file. The IOCINFO operation is the only operation that is defined for all device drivers that use the ioctl subroutine. The remaining operations are all specific to hard disk, CD-ROM, and read/write optical devices. |
DKIORDSE | Provides a means for issuing a read command to the device
and obtaining the target-device sense data when an error occurs.
If the DKIORDSE operation returns a value of -1 and the status_validity field
is set to a value of sc_valid_sense, valid sense data is returned.
Otherwise, target sense data is omitted. The DKIORDSE operation is provided for diagnostic use. It allows the limited use of the target device when it is operating in an active system environment. The arg parameter to the DKIORDSE operation contains the address of an sc_rdwrt structure. This structure is defined in the /usr/include/sys/scsi.h file. The devinfo structure defines the maximum transfer size for a read operation. If an attempt is made to transfer more than the maximum, the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device. Note: The CDIORDSE operation
might be substituted for the DKIORDSE operation when you issue
a read command to and obtain sense data from a CD-ROM device. DKIORDSE is
the recommended operation.
|
DKIOCMD | When the device is successfully opened in the Diagnostic mode,
the DKIOCMD operation provides the means for issuing any SCSI
command to the specified device. If the DKIOCMD operation
is issued when the device is not in Diagnostic mode, the subroutine
returns a value of -1 and sets the errno global variable to a value
of EACCES. The device driver performs no error recovery or
logging on failures of this operation. The SCSI status byte and the adapter status bytes are returned through the arg parameter, which contains the address of a sc_iocmd structure (defined in the /usr/include/sys/scsi.h file). If the DKIOCMD operation fails, the subroutine returns a value of -1 and sets the errno global variable to a nonzero value. In this case, the caller must evaluate the returned status bytes to determine why the operation was unsuccessful and what recovery actions must be taken. The devinfo structure defines the maximum transfer size for the command. If an attempt is made to transfer more than the maximum, the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device. Note: Diagnostic
mode is required only for the CDIOCMD and DKIOCMD operations.
|
DKPMR | Issues a SCSI prevent media removal command when the device is successfully opened. This command prevents media from being ejected until the device is closed, powered off and back on, or until a DKAMR operation is issued. The arg parameter for the DKPMR operation is null. If the DKPMR operation is successful, the subroutine returns a value of 0. If the device is a SCSI hard disk, the DKPMR operation fails, and the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. If the DKPMR operation fails for any other reason, the subroutine returns a value of -1 and sets the errno global variable to a value of EIO. |
DKAMR | Issues an allow media removal command when the device is successfully opened. As a result media can be ejected by using either the drive's eject button or the DKEJECT operation. The arg parameter for this ioctl is null. If the DKAMR operation is successful, the subroutine returns a value of 0. If the device is a SCSI hard disk, the DKAMR operation fails, and the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. For any other failure of this operation, the subroutine returns a value of -1 and sets the errno global variable to a value of EIO. |
DKEJECT | Issues an eject media command to the drive when the device is successfully opened. The arg parameter for this operation is null. If the DKEJECT operation is successful, the subroutine returns a value of 0. If the device is a SCSI hard disk, the DKEJECT operation fails, and the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. For any other failure of this operation, the subroutine returns a value of -1 and sets the errno global variable to a value of EIO. |
DKFORMAT | Issues a format unit command to the specified device when
the device is successfully opened. If the arg parameter for this operation is null, the format unit sets the format options valid (FOV) bit to 0 (that is, it uses the drive's default setting). If the arg parameter for the DKFORMAT operation is not null, the first byte of the defect list header is set to the value specified in the first byte addressed by the arg parameter. It allows the creation of applications to format a particular type of read/write optical media uniquely. The driver initially tries to set the FmtData and CmpLst bits to 0. If that fails, the driver tries the remaining 3 permutations of these bits. If all four permutations fail, this operation fails, and the subroutine sets the errno global variable to a value of EIO. If the DKFORMAT operation is specified for a hard disk, the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. If the DKFORMAT operation is attempted when the device is not in Exclusive Access mode, the subroutine returns a value of -1 and sets the errno global variable to a value of EACCES. If the media is write-protected, the subroutine returns a value of -1 and sets the errno global variable to a value of EWRPROTECT. If the format unit exceeds its timeout value, the subroutine returns a value of -1 and sets the errno global variable to a value of ETIMEDOUT. For any other failure of this operation, the subroutine returns a value of -1 and sets the errno global variable to a value of EIO. |
DKAUDIO | Issues play audio commands to the specified device and controls
the volume on the device's output ports. Play audio commands include:
play, pause, resume, stop, determine the number of tracks, and determine
the status of a current audio operation. The DKAUDIO operation
plays audio only through the CD-ROM drive's output ports. The arg parameter
of this operation is the address of a cd_audio_cmds structure,
which is defined in the /usr/include/sys/scdisk.h file. Exclusive
Access mode is required. If DKAUDIO operation is attempted when the device's audio-supported attribute is set to No, the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. If the DKAUDIO operation fails, the subroutine returns a value of -1 and sets the errno global variable to a nonzero value. In this case, the caller must evaluate the returned status bytes to determine why the operation failed and what recovery actions must be taken. |
DK_CD_MODE | Determines or changes the CD-ROM data mode for the specified
device. The CD-ROM data mode specifies what block size and special
file are used for data read across the SCSI bus from the device.
The DK_CD_MODE operation supports the following CD-ROM data
modes:
The DK_CD_MODE arg parameter contains the address of the mode_form_op structure that is defined in the /usr/include/sys/scdisk.h file. To have the DK_CD_MODE operation determine or change the CD-ROM data mode, set the action field of the change_mode_form structure to one of the following values:
If a CD-ROM is not configured for different data modes (through mode-select density codes), and an attempt is made to change the CD-ROM data mode (by setting the action field of the change_mode_form structure set to CD_CHG_MODE), the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. Attempts to change the CD-ROM mode to any of the DVD modes also results in a return value of -1 and the errno global variable set to EINVAL. If the DK_CD_MODE operation for CD_CHG_MODE is attempted when the device is not in Exclusive Access mode, the subroutine returns a value of -1 and sets the errno global variable to a value of EACCES. For any other failure of this operation, the subroutine returns a value of -1 and sets the errno global variable to a value of EIO. |
DK_PASSTHRU | When the device is successfully opened, the DK_PASSTHRU operation
provides the means for issuing any SCSI command to the specified device.
The device driver will perform limited error recovery if this operation
fails. The DK_PASSTHRU operation differs from the DKIOCMD operation
in that it does not require an openx command with the ext argument
of SC_DIAGNOSTIC. Because of this, a DK_PASSTHRU operation
can be issued to devices that are in use by other operations. The SCSI status byte and the adapter status bytes are returned through the arg parameter, which contains the address of a sc_passthru structure (defined in the /usr/include/sys/scsi.h file). If the DK_PASSTHRU operation fails, the subroutine returns a value of -1 and sets the errno global variable to a nonzero value. If this happens the caller must evaluate the returned status bytes to determine why the operation was unsuccessful and what recovery actions must be taken. |
If a DK_PASSTHRU operation fails because
a field in the sc_passthru structure has an invalid value,
the subroutine returns a value of -1 and set the errno global variable
to EINVAL. The einval_arg field is set to the field
number (starting with 1 for the version field) of the field that had
an invalid value. A value of 0 for the einval_arg field indicates
that no additional information on the failure is available. DK_PASSTHRU operations are further subdivided into requests which quiesce other I/O requests before issuing the request and requests that do not quiesce I/O requests. These subdivisions are based on the devflags field of the sc_passthru structure. When the devflags field of the sc_passthru structure has a value of SC_MIX_IO, the DK_PASSTHRU operation will be mixed with other I/O requests. SC_MIX_IO requests that write data to devices are prohibited and will fail. When this happens -1 is returned, and the errno global variable is set to EINVAL. When the devflags field of the sc_passthru structure has a value of SC_QUIESCE_IO, all other I/O requests will be quiesced before the DK_PASSTHRU request is issued to the device. If an SC_QUIESCE_IO request has its timeout_value field set to 0, the DK_PASSTHRU request will be failed with a return code of -1, the errno global variable will be set to EINVAL, and the einval_arg field will be set to a value of SC_PASSTHRU_INV_TO (defined in the /usr/include/sys/scsi.h file). If an SC_QUIESCE_IO request has a nonzero timeout value that is too large for the device, the DK_PASSTHRU request will be failed with a return code of -1, the errno global variable will be set to EINVAL, the einval_arg field will be set to a value of SC_PASSTHRU_INV_TO (defined in the /usr/include/sys/scsi.h file), and the timeout_value will be set to the largest allowed value. |
|
The version field of the sc_passthru structure
can be set to the value of SC_VERSION_2, and the user can provide
the following fields:
|
|
The devinfo structure defines the maximum
transfer size for the command. If an attempt is made to transfer more
than the maximum transfer size, the subroutine returns a value of
-1, sets the errno global variable to a value of EINVAL, and
sets the einval_arg field to a value of SC_PASSTHRU_INV_D_LEN (defined
in the /usr/include/sys/scsi.h file). Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device. |
|
DKPRES_READKEYS | When the device is successfully opened, the DKPRES_READKEYS operation provides a means to read the Persistent Reserve Registration Keys on the device. The arg parameter to the DKPRES_READKEYS contains the address of the dk_pres_in structure. This structure is defined in /usr/include/sys/scdisk.h. The user must provide a buffer area and size for the registered keys to be returned. The returned_length variable sets the number of bytes returned. In a shared-access or clustered environment, this operation identifies all registered keys for a particular lun. Note: For the DKPRES_READKEYS operation and following
Persistent Reserve related operation, the interpretation of the returned
value and scsi status is as follows:
|
DKPRES_READRES | When the device is successfully opened, the DKPRES_READRES operation provides a means to read the Persistent Reserve Reservation Keys on the device. The arg parameter to the DKPRES_READKEYS contains the address of the dk_pres_in structure. This structure is defined in /usr/include/sys/scdisk.h. The user must provide a buffer area and size for the reservation information to be returned. The returned_length variable sets the number of bytes returned. In a shared-access or clustered environment, this operation identifies the primary initiator that holds the reservation. |
DKPRES_CLEAR | When the device is successfully opened, the DKPRES_CLEAR operation provides a means to clear all Persistent Reserve Reservation Keys and Registration Keys on the device. The arg parameter to DKPRES_CLEAR contains the address of the dk_pres_clear structure. This structure is defined in /usr/include/sys/scdisk.h. Attention: Attention: Exercise care when issuing the DKPRES_CLEAR operation.
This operation leaves the device unreserved, which could allow a foreign
initiator to access the device.
|
DKPRES_PREEMPT | When the device is successfully opened, the DKPRES_PREEMPT operation provides a means to preempt a Persistent Reserve Reservation Key or Registration Key on the device. The arg parameter to the DKPRES_PREEMPT contains the address of the dk_pres_preempt structure. This structure is defined in /usr/include/sys/scdisk.h. The user must provide the second party initiator key on the device to be preempted. If the second party initiator holds the reservation to the device, then the initiator that issues the preemption becomes the owner of the reservation. Otherwise, the second party initiator access is revoked. In order for this operation to succeed, the initiator must be registered with the device first before any preemption can occur. In a shared-access or clustered environment, this operation is used to preempt any operative or inoperative initiator, or any initiator that is not recognized to be part of the shared group. |
DKPRES_PREEMPT_ABORT | This operation is the same as the DKPRES_PREEMPT, except the device follows the SCSI Primary Command Specification in aborting tasks that belong to the preempted initiator. |
DKPRES_REGISTER | When the device is successfully opened, the DKPRES_REGISTER operation provides a means to register a Key with the device. The Key is extracted from ODM Customize Attribute and passed to the device driver during configuration. The arg parameter to the DKPRES_REGISTER contains the address of the dk_pres_register structure. This structure is defined in /usr/include/sys/scdisk.h. In a shared-access or clustered environment, this operation attempts a registration with the device, then follows with a read reservation to determine whether the device is reserved. If the device is not reserved, then a reservation is placed with the device. |
DK_RWBUFFER | When the device is successfully opened, the DK_RWBUFFER operation provides the means
for issuing one or more SCSI Write Buffer commands to the specified device. The device driver
performs full error recovery upon failures of this operation. The DK_RWBUFFER operation
differs from the DKIOCMD operation in that it does not require an exclusive open of the
device (for example, openx with the ext argument of SC_DIAGNOSTIC). Thus, a
DK_RWBUFFER operation can be issued to devices that are in use by others. It can be used with
the DK_PASSTHRU
ioctl operation, which (like DK_RWBUFFER) does not require an exclusive open of the
device. The arg parameter contains the address of a sc_rwbuffer structure (defined in the /usr/include/sys/scsi.h file). Before the DK_RWBUFFER ioctl is invoked, the fields of this structure must be set according to the required behavior. The mode field corresponds to the mode field of the SCSI Command Descriptor Block (CDB) as defined in the SCSI Primary Commands (SPC) Specification. Supported modes are listed in the header file /usr/include/sys/scsi.h. The device driver quiesces all other I/O requests from the initiator that issues the Write Buffer ioctl until the entire operation completes. Once the write buffer ioctl completes, all quiesced I/O requests are resumed. |
The SCSI status byte and the adapter status bytes are returned through the arg parameter, which contains the address of a sc_rwbuffer structure (defined in the /usr/include/sys/scsi.h file). If the DK_RWBUFFER operation fails, the subroutine returns a value of -1 and sets the errno global variable to a nonzero value. In this case, the caller must evaluate the returned status bytes to determine why the operation was unsuccessful and what recovery actions must be taken. If a DK_RWBUFFER operation fails because a field in the sc_rwbuffer structure has an invalid value, the subroutine returns a value of -1 and set the errno global variable to EINVAL. |
|
The DK_RWBUFFER ioctl allows the user to issue multiple SCSI Write Buffer commands (CDBs) to the device through a single ioctl invocation. It is useful for applications such as microcode download where the user provides a pointer to the entire microcode image, but, because of size restrictions of the device buffers, desires that the images be sent in fragments until the entire download is complete. If the DK_RWBUFFER ioctl is invoked with the fragment_size member of the sc_rwbuffer struct equal to data_length, a single Write Buffer command is issued to the device with the buffer_offset and buffer_ID of the SCSI CDB set to the values provided in the sc_rwbuffer struct. |
|
If data_length is greater than fragment_size and fragment_size is a nonzero value, multiple write buffer is issued to the device. The number of Write Buffer commands (SCSI CDBs) issued is calculated by dividing the data_length by the required fragment_size. This value is incremented by 1 if the data_length is not an even multiple of fragment_size, and the final data transfer is the size of this residual amount. For each Write Buffer command that is issued, the buffer_offset is set to the value provided in the sc_rwbuffer struct (microcode downloads to SCSD devices requires this value to be set to 0). |
|
For the first command issued, the buffer_ID is set to the value
provided in the sc_rwbuffer struct. For each subsequent Write Buffer command that is issued,
the buffer_ID is incremented by 1 until all fragments are sent. Writing to noncontiguous
buffer_IDs through a single DK_RWBUFFER ioctl is not supported. If this functionality
is wanted, multiple DK_RWBUFFER ioctls must be issued with the buffer_ID set
appropriately for each invocation. Note: No I/O request is quiesced between ioctl
invocations.
|
|
If fragment_size is set to zero, an errno of EINVAL is returned. If the desire is to send the entire buffer with one SCSI Write buffer command, this field must be set equal to data_length. An error of EINVAL is also returned if the fragment_size is greater than the data_length. |
|
The Parameter List Length (fragment_size) plus the Buffer Offset cannot exceed the capacity of the specified buffer of the device. It is the responsibility of the caller of the Write Buffer ioctl to ensure that the fragment_size setting satisfies this requirement. A fragment_size larger than the device can accommodate results in a SCSI error at the device, and the Write Buffer ioctl reports this error but take no action to recover. |
|
The devinfo structure defines the maximum transfer size for the command. If an attempt is made to transfer more than the maximum transfer size, the subroutine returns a value of -1 and sets the errno global variable to a value of EINVAL. Refer to the Small Computer System Interface (SCSI) Specification for the format of the request sense data for a particular device. |
|
DKPATHIOCMD | This command is only available for MPIO capable devices. The DKPATHIOCMD command takes as input a pointer argument which points to a single scdisk_pathiocmd structure. The DKPATHIOCMD command behaves exactly like the DKIOCMD command, except that the input path is used rather than normal path selection. The DKPATHIOCMD path is used for the DKIOCMD command regardless of any path specified by a DKPATHFORCE ioctl command. A path cannot be unconfigured while it is being forced. |
DKPATHFORCE | This command is only available for MPIO capable devices. The DKPATHFORCE command takes as input a ushort path id. The path id must correspond to one of the path ids in CuPath ODM. The path id specifies a path to be used for all subsequent I/O commands, overriding any previous DKPATHFORCE path. A zero argument specifies that path forcing is terminated and that normal MPIO path selection is to be resumed. I/O commands sent in with the DKPATHIOCMD command overrides the DKPATHFORCE option and send the I/O command down the path that is specified in scdisk_pathiocmd structure. |
DKPATHRWBUFFER | This command is only available for MPIO capable devices. The DKPATHRWBUFFER command takes as input a pointer argument which points to a single scdisk_pathiocmd structure. The DKPATHRWBUFFER command behaves exactly like the DKRWBUFFER command, except that the input path is used rather than normal path selection. The DKPATHRWBUFFER path is used for the DKRWBUFFER command regardless of any path that is specified by a DKPATHFORCE ioctl command. |
DKPATHPASSTHRU | This command is only available for MPIO capable devices. The DKPATHPASSTHRU command takes as input a pointer argument which points to a single scdisk_pathiocmd structure. The DKPATHPASSTHRU command behaves exactly like the DKPASSTHRU command, except that the input path is used rather than normal path selection. The DKPATHPASSTHRU path is used for the DKPASSTHRU command regardless of any path that is specified by a DKPATHFORCE ioctl command. |
DKPCMPASSTHRU | This command is only available for MPIO capable devices. The DKPCMPASSTHRU command takes as input a structure which is PCM-specific, it is not defined by AIX®. The PCM-specific structure is passed to the PCM directly. This structure can be used to move information to or from a PCM. |
Device Requirements
SCSI hard disk, CD-ROM, and read/write optical drives have the following hardware requirements:
- SCSI hard disks and read/write optical drives must support a block size of 512 bytes per block.
- If mode sense is supported, the write-protection (WP) bit must also be supported for SCSI hard disks and read/write optical drives.
- SCSI hard disks and read/write optical drives must report the hardware retry count in bytes 16 and 17 of the request sense data for recovered errors. If the hard disk or read/write optical drive does not support it, the system error log might indicate premature drive failure.
- SCSI CD-ROM and read/write optical drives must support the 10-byte SCSI read command.
- SCSI hard disks and read/write optical drives must support the SCSI write and verify command and the 6-byte SCSI write command.
- To use the format command operation on read/write optical media, the drive must support setting the format options valid (FOV) bit to 0 for the defect list header of the SCSI format unit command. If the drive does not support this, the user can write an application for the drive so that it formats media by using the DKFORMAT operation.
- If a SCSI CD-ROM drive uses CD_ROM Data Mode 1, it must support a block size of 512 bytes per block.
- If a SCSI CD-ROM drive uses CD_ROM data Mode 2 Form 1, it must support a block size of 2048 bytes per block.
- If a SCSI CD-ROM drive uses CD_ROM data Mode 2 Form 2, it must support a block size of 2336 bytes per block.
- If a SCSI CD-ROM drive uses CD_DA mode, it must support a block size of 2352 bytes per block.
- To control volume by using the DKAUDIO (play audio) operation, the device must support SCSI-2 mode data page 0xE.
- To use the DKAUDIO (play audio) operation, the device
must support the following SCSI-2 optional commands:
- read subchannel
- pause resume
- play audio MSF
- play audio track index
- read TOC
Error Conditions
Possible errno values for ioctl, open, read, and write subroutines when you use the scdisk device driver include:
Item | Description |
---|---|
EACCES | Indicates one of the following circumstances:
|
EBUSY | Indicates one of the following circumstances:
|
EFAULT | Indicates an invalid user address. |
EFORMAT | Indicates that the target device has unformatted media or media in an incompatible format. |
EINPROGRESS | Indicates that a CD-ROM drive has a play-audio operation in progress. |
EINVAL | Indicates one of the following circumstances:
|
EIO | Indicates one of the following circumstances:
|
EMEDIA | Indicates one of the following circumstances:
|
EMFILE | Indicates that an open operation was attempted for an adapter that already has the maximum permissible number of opened devices. |
ENODEV | Indicates one of the following circumstances:
|
ENOTREADY | Indicates that no media is in the drive. |
ENXIO | Indicates one of the following circumstances:
|
EPERM | Indicates that the attempted subroutine requires appropriate authority. |
ESTALE | Indicates that a read-only optical disk was ejected (without first being closed by the user) and then either reinserted or replaced with a second optical disk. |
ETIMEDOUT | Indicates an I/O operation exceeded the specified timer value. |
EWRPROTECT | Indicates one of the following circumstances:
|
Reliability and Serviceability Information
SCSI hard disk devices, CD-ROM drives, and read/write optical drives return the following errors:
Item | Description |
---|---|
ABORTED COMMAND | Indicates that the device ended the command |
ADAPTER ERRORS | Indicates that the adapter returned an error |
GOOD COMPLETION | Indicates that the command completed successfully |
HARDWARE ERROR | Indicates that an unrecoverable hardware failure occurred during command execution or during a self-test |
ILLEGAL REQUEST | Indicates an incorect command or command parameter |
MEDIUM ERROR | Indicates that the command ended with an unrecoverable media error condition |
NOT READY | Indicates that the logical unit is offline or media is missing |
RECOVERED ERROR | Indicates that the command was successful after some recovery was applied |
UNIT ATTENTION | Indicates that the device is reset or the power is turned on |
Error Record Values for Media Errors
The fields that are defined in the error record template for hard disk, CD-ROM, and read/write optical media errors are:
Item | Description |
---|---|
Comment | Indicates hard disk, CD-ROM, or read/write optical media error. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error must be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry must be created when this error occurs. |
Alert | Equals a value of False, which indicates this error is not alertable. |
Err_Type | Equals a value of Perm, which indicates a permanent failure. |
Err_Desc | Equals a value of 1312, which indicates a disk operation failure. |
Prob_Causes | Equals a value of 5000, which indicates media. |
User_Causes | Equals a value of 5100, which indicates the media is defective. |
User_Actions | Equals the following values:
|
Inst_Causes | None. |
Inst_Actions | None. |
Fail_Causes | Equals the following values:
|
Fail_Actions | Equals the following values:
|
Detail_Data | Equals a value of 156, 11, HEX. This value indicates hexadecimal
format.
|
Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device.
Error Record Values for Hardware Errors
The fields that are defined in the error record template for hard disk, CD-ROM, and read/write optical hardware errors, as well as hard-aborted command errors are:
Item | Description |
---|---|
Comment | Indicates hard disk, CD-ROM, or read/write optical hardware error. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error must be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry must be created when this error occurs. |
Alert | Equal to a value of FALSE, which indicates this error is not alertable. |
Err_Type | Equals a value of Perm, which indicates a permanent failure. |
Err_Desc | Equals a value of 1312, which indicates a disk operation failure. |
Prob_Causes | Equals a value of 6310, which indicates disk drive. |
User_Causes | None. |
User_Actions | None. |
Inst_Causes | None. |
Inst_Actions | None. |
Fail_Causes | Equals the following values:
|
Fail_Actions | Equals a value of 0000, which indicates problem-determination procedures must be performed. |
Detail_Data | Equals a value of 156, 11, HEX. This value indicates hexadecimal
format.
|
Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device.
Error Record Values for Adapter-Detected Hardware Failures
The fields that are defined in the error record template for hard disk, CD-ROM, and read/write optical media errors adapter-detected hardware errors are:
Item | Description |
---|---|
Comment | Indicates adapter-detected hard disk, CD-ROM, or read/write optical hardware failure. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error must be included when an error report is generated. |
Log | Equals a value of True, which indicates an error-log entry must be created when this error occurs. |
Alert | Equal to a value of FALSE, which indicates this error is not alertable. |
Err_Type | Equals a value of Perm, which indicates a permanent failure. |
Err_Desc | Equals a value of 1312, which indicates a disk operation failure. |
Prob_Causes | Equals the following values:
|
User_Causes | None. |
User_Actions | None. |
Inst_Causes | None. |
Inst_Actions | None. |
Fail_Causes | Equals the following values:
|
Fail_Actions | Equals a value of 0000, which indicates problem-determination procedures must be performed. |
Detail_Data | Equals a value of 156, 11, HEX. This value indicates hexadecimal
format.
|
Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device.
Error Record Values for Recovered Errors
The fields that are defined in the error record template for hard disk, CD-ROM, and read/write optical media errors recovered errors are:
Item | Description |
---|---|
Comment | Indicates hard disk, CD-ROM, or read/write optical recovered error. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error must be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry must be created when this error occurs. |
Alert | Equal to a value of FALSE, which indicates this error is not alertable. |
Err_Type | Equals a value of Temp, which indicates a temporary failure. |
Err_Desc | Equals a value of 1312, which indicates a physical volume operation failure. |
Prob_Causes | Equals the following values:
|
User_Causes | Equals a value of 5100, which indicates media is defective. |
User_Actions | Equals the following values:
|
Inst_Causes | None. |
Inst_Actions | None. |
Fail_Causes | Equals the following values:
|
Fail_Actions | Equals the following values:
|
Detail_Data | Equals a value of 156, 11, HEX. This value indicates hexadecimal
format.
|
Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device.
Error Record Values for Unknown Errors
The fields that are defined in the error record template for hard disk, CD-ROM, and read/write optical media errors unknown errors are:
Item | Description |
---|---|
Comment | Indicates hard disk, CD-ROM, or read/write optical unknown failure. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error must be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry must be created when this error occurs. |
Alert | Equal to a value of FALSE, which indicates this error is not alertable. |
Err_Type | Equals a value of Unkn, which indicates the type of error is unknown. |
Err_Desc | Equals a value of FE00, which indicates an undetermined error. |
Prob_Causes | Equals the following values:
|
User_Causes | None. |
User_Actions | None. |
Inst_Causes | None. |
Inst_Actions | None. |
Fail_Causes | Equals a value of FFFF, which indicates the failure causes are unknown. |
Fail_Actions | Equals the following values:
|
Detail_Data | Equals a value of 156, 11, HEX. This value indicates hexadecimal
format.
|
Refer to the Small Computer System Interface (SCSI) Specification for the format of the request-sense data for a particular device.
Special Files
The scdisk SCSI device driver uses raw and block special files in performing its functions.
The special files that are used by the scdisk device driver include the following (listed by type of device):
- Hard disk devices:
Item Description /dev/rhdisk0, /dev/rhdisk1,..., /dev/rhdiskn Provides an interface to allow SCSI device drivers character access (raw I/O access and control functions) to SCSI hard disks. /dev/hdisk0, /dev/hdisk1,..., /dev/hdiskn Provides an interface to allow SCSI device drivers block I/O access to SCSI hard disks. - CD-ROM devices:
Item Description /dev/rcd0, /dev/rcd1,..., /dev/rcdn Provides an interface to allow SCSI device drivers character access (raw I/O access and control functions) to SCSI CD-ROM disks. /dev/cd0, /dev/cd1,..., /dev/cdn Provides an interface to allow SCSI device drivers block I/O access to SCSI CD-ROM disks. - Read/write optical devices:
Item Description /dev/romd0, /dev/romd1,..., /dev/romdn Provides an interface to allow SCSI device drivers character access (raw I/O access and control functions) to SCSI read/write optical devices. /dev/omd0, /dev/omd1,..., /dev/omdn Provides an interface to allow SCSI device drivers block I/O access to SCSI read/write optical devices. Note: The prefix r on a special file name indicates that the drive is accessed as a raw device rather than a block device. Performing raw I/O with a hard disk, CD-ROM, or read/write optical drive requires that all data transfers be in multiples of the device block size. All lseek subroutines that are made to the raw device driver must result in a file pointer value that is a multiple of the device block size.