[  Previous  |
Next  |
Contents  |
Home  |
Search  ]
AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts
A Typical IDE Driver Transaction Sequence
A simplified sequence of events for a 
transaction between an IDE device driver and an IDE adapter device driver 
follows. In this sequence, routine names preceded by a dd_ are part of the 
IDE device driver, while those preceded by an ide_ are part of the IDE 
adapter device driver.
- The IDE device driver receives a call to 
its dd_strategy routine; any required internal queuing occurs in this 
routine. The dd_strategy entry point then triggers the operation by 
calling the dd_start entry point. The dd_start routine invokes 
the ide_strategy entry point by calling the 
devstrat kernel 
service with the relevant ataide_buf structure as a parameter.
- The ide_strategy entry point 
initially checks the ataide_buf structure for validity. These checks 
include validating the devno
 field, matching the IDE device ID 
to internal tables for configuration purposes, and validating the request 
size.
- The IDE adapter device driver does not 
queue transactions.  Only a single transaction is accepted per device (one 
master, one slave).  If no transaction is currently active, the 
ide_strategy routine immediately calls the ide_start routine 
with the new transaction.  If there is a current transaction for the same 
device, the new transaction is returned with an error indicated in the 
ataide_buf structure.  If there is a current transaction for the 
other device, the new transaction is queued to the inactive device.
- At each interrupt, the ide_intr interrupt
 handler verifies the current status. The IDE adapter device driver fills in 
 the ataide_buf status_validity
 field, updating the 
 ata.status
 and ata.errval
 fields as required. 
The IDE adapter device driver also fills in the bufstruct.b_resid
 
 field with the number of bytes not transferred from the request. If all the 
 data was transferred, the b_resid
 field is set to a value of 0. 
 When a transaction completes, the ide_intr routine causes the 
 ataide_buf entry to be removed from the device queue and calls the 
 iodone kernel service, passing the just dequeued ataide_buf 
 structure for the device as the parameter.  The ide_start routine is 
 then called again to process the next transaction on the device queue. The 
 iodone kernel service calls the IDE device driver dd_iodone 
 entry point, signaling the IDE device driver that the particular transaction 
 has completed.
- The IDE device driver dd_iodone 
routine investigates the I/O completion codes in the ataide_buf 
status entries and performs error recovery, if required. If the operation 
completed correctly, the IDE device driver dequeues the original buffer 
structures. It calls the iodone kernel service with the original 
buffer pointers to notify the originator of the request.
[  Previous  |
Next  |
Contents  |
Home  |
Search  ]