This overview describes the interface between an Integrated Device Electronics (IDE) device driver and an IDE adapter device driver. It is directed toward those designing and writing an IDE device driver that interfaces with an existing IDE adapter device driver. It is also meant for those designing and writing an IDE adapter device driver that interfaces with existing IDE device drivers.
The main topics covered in this overview are:
This section frequently refers to both an IDE device driver and an IDE adapter device driver. These two distinct device drivers work together in a layered approach to support attachment of a range of IDE devices. The IDE adapter device driver is the lower device driver of the pair, and the IDE device driver is the upper device driver.
The IDE adapter device driver is the software interface to the system hardware. This hardware includes the IDE bus hardware plus any other system I/O hardware required to run an I/O request. The IDE adapter device driver hides the details of the I/O hardware from the IDE device driver. The design of the software interface allows a user with limited knowledge of the system hardware to write the upper device driver.
The IDE adapter device driver manages the IDE bus, but not the IDE devices. It can send and receive IDE commands, but it cannot interpret the contents of the command. The lower driver also provides recovery and logging for errors related to the IDE bus and system I/O hardware. Management of the device specifics is left to the IDE device driver. The interface of the two drivers allows the upper driver to communicate with different IDE bus adapters without requiring special code paths for each adapter.
The IDE device driver provides the rest of the operating system with the software interface to a given IDE device or device class. The upper layer recognizes which IDE commands are required to control a particular IDE device or device class. The IDE device driver builds I/O requests containing device IDE commands and sends them to the IDE adapter device driver in the sequence needed to operate the device successfully. The IDE device driver cannot manage adapter resources. Specifics about the adapter and system hardware are left to the lower layer.
The IDE device driver also provides command retries and logging for errors related to the IDE device it controls.
The operating system provides several kernel services allowing the IDE device driver to communicate with IDE adapter device driver entry points without having the actual name or address of those entry points. See Logical File System Kernel Services for more information.
The interface between the IDE device driver and the IDE adapter device driver is accessed through calls to the IDE adapter device driver open, close, ioctl, and strategy subroutines. I/O requests are queued to the IDE adapter device driver through calls to its strategy subroutine entry point.
Communication between the IDE device driver and the IDE adapter device driver for a particular I/O request uses the ataide_buf structure, which is passed to and from the strategy subroutine in the same way a standard driver uses a struct buf structure. The ataide_buf.ata structure represents the ATA or ATAPI command that the adapter driver must send to the specified IDE device. The ataide_buf.status_validity field in the ataide_buf.ata structure contains completion status returned to the IDE device driver.