[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts

Required IDE Adapter Device Driver ioctl Commands

Various ioctl operations must be performed for proper operation of the IDE adapter device driver. The ioctl operations described here are the minimum set of commands the IDE adapter device driver must implement to support IDE device drivers. Other operations may be required in the IDE adapter device driver to support, for example, system management facilities. IDE device driver writers also need to understand these ioctl operations.

Every IDE adapter device driver must support the IOCINFO ioctl operation. The structure to be returned to the caller is the devinfo structure, including the ide union definition for the IDE adapter found in the /usr/include/sys/devinfo.h file. The IDE device driver should request the IOCINFO ioctl operation (probably during its open routine) to get the maximum transfer size of the adapter.

Note: The IDE adapter device driver ioctl operations can only be called from the process level. They cannot be executed from a call on any more favored priority levels. Attempting to call them from a more favored priority level can result in a system crash.

ioctl Commands

The following IDEIOSTART and IDEIOSTOP operations must be sent by the IDE device driver (for the open and close routines, respectively) for each device. They cause the IDE adapter device driver to allocate and initialize internal resources. The IDEIORESET operation is provided for clearing device hard errors. The IDEIOGTHW operation is supported by IDE adapter device drivers that support gathered write commands to target devices.

Except where noted otherwise, the arg parameter for each of the ioctl operations described here must contain a long integer. In this field, the least significant byte is the IDE device ID value. (The upper three bytes are reserved and should be set to 0.) This provides the information required to allocate or deallocate resources and perform IDE bus operations for the ioctl operation requested.

The following information is provided on the various ioctl operations:

IDEIOSTART
                            This operation allocates and initializes IDE device-dependent information local to the IDE adapter device driver. Run this operation only on the first open of a device. Subsequent IDEIOSTART commands to the same device fail unless an intervening IDEIOSTOP command is issued.

The following values for the errno global variable are supported:

0
                            Indicates successful completion.
EIO Indicates lack of resources or other error-preventing device allocation.
EINVAL Indicates that the selected IDE device ID is already in use.
ETIMEDOUT Indicates that the command did not complete.
IDEIOSTOP
                            This operation deallocates resources local to the IDE adapter device driver for this IDE device. This should be run on the last close of an IDE device. If an IDEIOSTART operation has not been previously issued, this command is unsuccessful.

The following values for the errno global variable should be supported:

0
                            Indicates successful completion.
EIO Indicates error preventing device deallocation.
EINVAL Indicates that the selected IDE device ID has not been started.
ETIMEDOUT Indicates that the command did not complete.
IDEIORESET
                            This operation causes the IDE adapter device driver to send an ATAPI device reset to the specified IDE device ID.

The IDE device driver should use this command only when directed to do a forced open. This occurs in for the situation when the device needs to be reset to clear an error condition.

Note: In normal system operation, this command should not be issued, as it would reset all devices connected to the controller. If an IDEIOSTART operation has not been previously issued, this command is unsuccessful.

The following values for the errno global variable are supported:

0
                            Indicates successful completion.
EIO Indicates an unrecovered I/O error occurred.
EINVAL Indicates that the selected IDE device ID has not been started.
ETIMEDOUT Indicates that the command did not complete.
IDEIOGTHW
                            This operation is only supported by IDE adapter device drivers that support gathered write commands. The purpose of the operation is to indicate support for gathered writes to IDE device drivers that intend to use this facility. If the IDE adapter device driver does not support gathered write commands, it must fail the operation. The IDE device driver should call this operation from its open routine for a particular device instance. If the operation is unsuccessful, the IDE device driver should not attempt to run a gathered write command.

The arg parameter to the IDEIOGTHW is set to NULL by the caller to indicate that no input parameter is passed:

The following values for the errno global variable are supported.

0
                            Indicates successful completion and in particular that the adapter driver supports gathered writes.
EINVAL Indicates that the IDE adapter device driver does not support gathered writes.

Related Information

IDE Adapter Device Driver, idecdrom IDE Device Driver, idedisk IDE Device Driver, IDEIOIDENT (Identify Device) IDE Adapter Device Driver ioctl Operation, IDEIOINQU (Inquiry) IDE Adapter Device Driver ioctl Operation, IDEIOREAD (Read) IDE Adapter Device Driver ioctl Operation, IDEIOSTART (Start IDE) Adapter Device Driver ioctl Operation, IDEIOSTOP (Stop) Device IDE Adapter Device Driver ioctl Operation, IDEIOSTUNIT (Start Unit) IDE Adapter Device Driver ioctl Operation, and IDEIOTUR (Test Unit Ready) IDE Adapter Device Driver ioctl Operation in AIX Version 4.3 Technical Reference: Kernel and Subsystems Volume 2.

Related Information

Execution of I/O Requests.

IDE Error Recovery.


[ Previous | Next | Contents | Home | Search ]