Supports the Integrate Device Electronics (IDE) CD-ROM devices.
#include <sys/devinfo.h> #include <sys/ide.h> #include <sys/idecdrom.h>
Typical CD-ROM drive operations are implemented using the open, close, read, and ioctl subroutines.
The openx subroutine is intended primarily for use by the utilities.
The ext parameter passed to the openx subroutine selects the operation to be used for the target device. The /usr/include/sys/idecdrom.h file defines possible values for the ext parameter.
The ext parameter can contain any combination of the following flag values logically ORed together:
IDE_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.
ioctl subroutine operations that are used for the idecdrom device driver are:
The IDE_CDIORDSE operation is provided for diagnostic use. It allows the limited use of the target device while operating in an active system environment. The arg parameter to the IDE_CDIOROSE 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 ATA Packet Interface for CD-ROMS Specification for the format of the request-sense data for a particular device.
Note: The IDE_CDIORDSE operation can be substituted for the DKIORDSE operation when issuing a read command to obtain sense data from a CD-ROM device.
If a CD-ROM has not been configured for different data modes, 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.
If the IDE_CDMODE 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.
IDE CD-ROM drives on AIX have the following hardware requirements:
Possible errno values for ioctl, open, read, and write subroutines when using the idecdrom device driver include:
EACCES | Indicates one of the following circumstances: |
EBUSY | An attempt was made to open a session in exclusive access mode on a device already opened. |
EFAULT | Indicates an illegal user address. |
EFORMAT | Indicates the target device has unformatted media or media in an incompatible format. |
EINPROGRESS | Indicates 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 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 no media is in the drive. |
ENXIO | Indicates one of the following circumstances: |
EPERM | Indicates the attempted subroutine requires appropriate authority. |
ESTALE | Indicates a read-only disk was ejected (without first being closed by the user) and then either reinserted or replaced with a second disk. |
ETIMEDOUT | Indicates an I/O operation has exceeded the given timer value. |
EWRPROTECT | Indicates one of the following circumstances: |
IDE CD-ROM drives return the following errors:
ABORTED COMMAND | Indicates the device ended the command. |
GOOD COMPLETION | Indicates the command completed successfully. |
HARDWARE ERROR | Indicates an unrecoverable hardware failure occurred during command execution or during a self-test. |
ILLEGAL REQUEST | Indicates an illegal command or command parameter. |
MEDIUM ERROR | Indicates the command ended with an unrecovered media error condition. |
NOT READY | Indicates the logical unit is offline or media is missing. |
RECOVERED ERROR | Indicates the command was successful after some recovery was applied. |
UNIT ATTENTION | Indicates the device has been reset or the power has been turned on. |
The fields defined in the error record template for CD-ROM media errors are:
Comment | Indicates CD-ROM read media error. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error should be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry should 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: |
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. |
Note: The Detail_Data field in the err_rec structure contains the idecdrom_error_rec structure. The err_rec structure is defined in the /usr/include/sys/errids.h file. The idecdrom_error_rec structure is defined in the /usr/include/sys/ide.h file.
The idecdrom_error_rec structure contains the following fields:
req_sense_data | Contains the request-sense information from the particular device that had the error, if it is valid. |
reserved2 | Contains the segment count, which is the number of megabytes read from the device at the time the error occurred. |
reserved3 | Contains the number of bytes read since the segment count was last increased. |
Refer to the ATA Packet Interface for CD-ROMs Specification for the format of the request-sense data for a particular device.
The fields defined in the error record template for CD-ROM hardware errors, as well as hard-aborted command errors are:
Comment | Indicates CD-ROM hardware error. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error should be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry should 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. |
Fail_Causes | Equals the following values: |
Fail_Actions | Equals a value of 0000, which indicates problem-determination procedures should be performed. |
Detail_Data | Equals a value of 156, 11, HEX. This value indicates hexadecimal format. |
Note: The Detail_Data field in the err_rec structure contains the idecdrom_error_rec structure. The err_rec structure is defined in the /usr/include/sys/errids.h file. The idecdrom_error_rec structure is defined in the /usr/include/sys/ide.h file.
The idecdrom_error_rec structure contains the following fields:
req_sense_data | Contains the request-sense information from the particular device that had the error, if it is valid. |
reserved2 | Contains the segment count, which is the number of megabytes read from the device at the time the error occurred. |
reserved3 | Contains the number of bytes read since the segment count was last increased. |
Refer to the ATA Packet Interface for CD-ROMs Specification for the format of the request-sense data for a particular device.
The fields defined in the error record template for CD-ROM media errors recovered errors are:
Comment | Indicates CD-ROM recovered error. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error should be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry should 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: |
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. |
Note: The Detail_Data field in the err_rec structure contains the idecdrom_error_rec structure. The err_rec structure is defined in the /usr/include/sys/errids.h file. The idecdrom_error_rec structure is defined in the /usr/include/sys/ide.h file.
The idecdrom_error_rec structure contains the following fields:
req_sense_data | Contains the request-sense information from the particular device that had the error, if it is valid. |
reserved2 | Contains the segment count, which is the number of megabytes read from the device at the time the error occurred. |
reserved3 | Contains the number of bytes read since the segment count was last increased. |
Refer to the ATA Packet Interface for CD-ROMs Specification for the format of the request-sense data for a particular device.
The fields defined in the error record template for CD-ROM media errors unknown errors are:
Comment | Indicates CD-ROM unknown failure. |
Class | Equals a value of H, which indicates a hardware error. |
Report | Equals a value of True, which indicates this error should be included when an error report is generated. |
Log | Equals a value of True, which indicates an error log entry should 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: |
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. |
Note: The Detail_Data field in the err_rec structure contains the idecdrom_error_rec structure. The err_rec structure is defined in the /usr/include/sys/errids.h file. The idecdrom_error_rec structure is defined in the /usr/include/sys/ide.h file.
The idecdrom_error_rec structure contains the following fields:
req_sense_data | Contains the request-sense information from the particular device that had the error, if it is valid. |
reserved2 | Contains the segment count, which is the number of megabytes read from the device at the time the error occurred. |
reserved3 | Contains the number of bytes read since the segment count was last increased. |
Refer to the ATA Packet Interface for CD-ROMs Specification for the format of the request-sense data for a particular device.
The idecdrom IDE device driver uses raw and block special files in performing its functions.
Attention: Data corruption, loss of data, or loss of system integrity (system crash) will occur if devices supporting paging, logical volumes, or mounted file systems are accessed using block special files. Block special files are provided for logical volumes and disk devices and are solely for system use in managing file systems, paging devices, and logical volumes. These files should not be used for other purposes.
The special files used by the idecdrom, device driver include the following:
/dev/rcd0, /dev/rcd1,..., /dev/rcdn | Provide an interface to allow IDE device drivers character access (raw I/O access and control functions) to IDE CD-ROM disks. |
/dev/cd0, /dev/cd1,..., /dev/cdn | Provide an interface to allow IDE device drivers block I/O access to IDE CD-ROM disks. |
The prefix r on a special file name indicates the drive is accessed as a raw device rather than a block device. Performing raw I/O with a CD-ROM drive requires that all data transfers be in multiples of the device block size. Also, 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.
Special Files Overview in AIX Version 4 Files Reference.
IDE Subsystem Overview in Aix Version 4.1 Kernel Extensions And Device Support Programming Concepts.
A Typical IDE Driver Transaction Sequence in AIX Version 4.1 Kernel Extensions and Device Support Programming Concepts.
Required IDE Adapter Device Driver ioctl Commands in AIX Version 4.1 Kernel Extensions and Device Support Programming Concepts.
Understanding the Execution of Initiator I/O Requests in AIX Version 4.1 Kernel Extensions and Device Support Programming Concepts.
IDE Error Recovery in AIX Version 4.1 Kernel Extensions and Device Support Programming Concepts.
ataide_buf Structure in AIX Version 4.1 Kernel Extensions and Device Support Programming Concepts.
The close subroutine, ioctl or ioctlx subroutine, open, openx, create subroutine, read, readx, readv, or readvx subroutine, write, writex, writev, or writevx subroutine.