| | 1 | = GIET-VM / HBA Driver = |
| | 2 | |
| | 3 | [[PageOutline]] |
| | 4 | |
| | 5 | The [source:soft/giet_vm/giet_drivers/hba_driver.c hba_driver.c] and [source:soft/giet_vm/giet_drivers/hba_driver.h hba_driver.h] files define the HBA driver. |
| | 6 | |
| | 7 | The ''vci_multi_ahci'' component is a multi-channels, block oriented, external mass storage controller respecting the AHCI standard. |
| | 8 | |
| | 9 | 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. |
| | 10 | |
| | 11 | The addressable registers map is defined [source:soft/giet_vm/giet_drivers/hba_driver.h here]. |
| | 12 | |
| | 13 | === unsigned int '''_hba_init'' ( unsigned int channel ) === |
| | 14 | This function initializes for a given channel |
| | 15 | * the HBA hardware registers, |
| | 16 | * the command list pointer, |
| | 17 | * the command lists physical addresse, |
| | 18 | * the command tables physical addresses array, |
| | 19 | |
| | 20 | === unsigned int '''_hba_write'''( unsigned int channel, unsigned int mode, unsigned int lba, unsigned long long paddr, unsigned int count ) === |
| | 21 | This function register a write command in Command List and Command Table for a single physical buffer, and updates the HBA_PXCI register. |
| | 22 | * channel : channel index |
| | 23 | * mode : BOOT / KERNEL / USER |
| | 24 | * lba : logic bloc address on device |
| | 25 | * paddr : memory buffer physical base address |
| | 26 | * count : number of blocs |
| | 27 | Returns 0 if success, > 0 if error. |
| | 28 | |
| | 29 | === unsigned int '''_hba_read'''( unsigned int channel, unsigned int mode, unsigned int lba, unsigned long long paddr, unsigned int count ) === |
| | 30 | This function register a read command in Command List and Command Table for a single physical buffer, and updates the HBA_PXCI register. |
| | 31 | * channel : channel index |
| | 32 | * mode : BOOT / KERNEL / USER |
| | 33 | * lba : logic bloc address on device |
| | 34 | * paddr : memory buffer physical base address |
| | 35 | * count : number of blocs |
| | 36 | Returns 0 if success, > 0 if error. |
| | 37 | |
| | 38 | === unsigned int '''_hba_get_block_size''' () === |
| | 39 | This function returns the block_size of HBA controller |
| | 40 | |
| | 41 | === unsigned int '''_hba_get_status'''( unsigned int channel ) === |
| | 42 | This function returns the content of the HBA_PXIS register for a given channel, and reset this register to acknoledge IRQ. |
| | 43 | Return 0 if success, > 0 if error |
| | 44 | |