wiki:hba_driver

Version 2 (modified by alain, 10 years ago) (diff)

--

GIET-VM / HBA Driver

The hba_driver.c and hba_driver.h files define the HBA driver.

The vci_multi_ahci component is a multi-channels, block oriented, external mass storage controller respecting the AHCI standard.

It is one of the physical disk driver that can be called by the generic IOC driver, and the SEG_IOC_BASE address must be defined in the hard_config.h file.

The addressable registers map is defined here.

unsigned int _hba_init ( unsigned int channel )

This function initializes for a given channel

  • the HBA hardware registers,
  • the command list pointer,
  • the command lists physical addresse,
  • the command tables physical addresses array,

unsigned int _hba_write( unsigned int channel, unsigned int mode, unsigned int lba, unsigned long long paddr, unsigned int count )

This function register a write command in Command List and Command Table for a single physical buffer, and updates the HBA_PXCI register.

  • channel : channel index
  • mode : BOOT / KERNEL / USER
  • lba : logic bloc address on device
  • paddr : memory buffer physical base address
  • count : number of blocs

Returns 0 if success, > 0 if error.

unsigned int _hba_read( unsigned int channel, unsigned int mode, unsigned int lba, unsigned long long paddr, unsigned int count )

This function register a read command in Command List and Command Table for a single physical buffer, and updates the HBA_PXCI register.

  • channel : channel index
  • mode : BOOT / KERNEL / USER
  • lba : logic bloc address on device
  • paddr : memory buffer physical base address
  • count : number of blocs

Returns 0 if success, > 0 if error.

unsigned int _hba_get_block_size ()

This function returns the block_size of HBA controller

unsigned int _hba_get_status( unsigned int channel )

This function returns the content of the HBA_PXIS register for a given channel, and reset this register to acknoledge IRQ. Return 0 if success, > 0 if error