RTEMS Logo

RTEMS 4.10.2 On-Line Library


ATA Driver Initialization

PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

12.3: Initialization

The ata_initialize routine is responsible for ATA driver initialization. The main goal of the initialization is to detect and register in the system all ATA devices attached to IDE controllers successfully initialized by the IDE Controller driver.

In the implementation of the driver, the following actions are performed:

rtems_device_driver ata_initialize(
  rtems_device_major_number  major,
  rtems_device_minor_number  minor,
  void                      *arg
)
{
   initialize internal ATA driver data structure

   for each IDE controller successfully initialized by the IDE Controller
       driver
     if the controller is interrupt driven
       set up interrupt handler

     obtain information about ATA devices attached to the controller
     with help of EXECUTE DEVICE DIAGNOSTIC command

     for each ATA device detected on the controller
       obtain device parameters with help of DEVICE IDENTIFY command

       register new ATA device as new block device in the system
}

Special processing of ATA commands is required because of absence of multitasking environment during the driver initialization.

Detected ATA devices are registered in the system as physical block devices (see libblock library description). Device names are formed based on IDE controller minor number device is attached to and device number on the controller (0 - Master, 1 - Slave). In current implementation 64 minor numbers are reserved for each ATA device which allows to support up to 63 logical partitions per device.

controller minor    device number    device name    ata device minor
      0                  0             hda                0
      0                  1             hdb               64
      1                  0             hdc              128
      1                  1             hdd              172
     ...                ...            ...


PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

Copyright © 1988-2008 OAR Corporation