Changes between Version 12 and Version 13 of hba_driver


Ignore:
Timestamp:
May 21, 2015, 2:48:01 PM (10 years ago)
Author:
bellefin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • hba_driver

    v12 v13  
    77The ''vci_multi_ahci'' component is a multi-channels, block oriented, external mass storage controller respecting the AHCI standard. Each channel define an independant physical disk, but this driver supports only one channel, because the GIET-VM uses only one physical disk.
    88
    9 The '''Command List''' is a software FIFO that can contain up to 32 independant commands, posted by different user tasks. These independant transfers are handled by the HBA device in the same order as they have been written in the command list. There is no global lock protecting the the HBA device, but the command list being a shared structure, the driver uses a ''ptw'' pointer on the next free slot in the command list, and uses an ''_atomic_increment()'' to increment this  ''ptw'' pointer.
     9The '''Command List''' can contain up to 32 independant commands, posted by different user tasks. These independant transfers are handled by the HBA device, not necessarily in the same order as they have been written in the command list. The command list being a shared structure, the driver must use a lock to get a slot in the command list (except in boot mode when only one processor uses the HBA component). This slot is then allocated to the task until the command is completed.
    1010
    1111This driver implements two operating mode:
     
    1313 * In '''descheduling mode''', the calling task is descheduled, and the calling task global index is saved in the ''_hba_gtid[32]'' array, indexed by the command index. The task must be reactivated  when the command is completed. This mode is used, to handle the user system calls.
    1414
    15 As several user tasks can concurrently register commands in the command list, and there is only one HBA interrupt per channel, this interrupt is not linked to a specific command. In descheduling mode, the HBA IRQ is a "global" IRQ that is statically routed to processor P[0,0,0].  The associated global HBA_ISR send a WAKUP WTI to all tasks that have a completed command. This HBA_ISR uses a ''ptr'' pointer on the first active command in the Command List to identify the completed commands. The incrementation of this ''ptr'' pointer does not require ''_atomic_increment()'' as there is no concurrent access on this pointer.
     15As several user tasks can concurrently register commands in the command list, and there is only one HBA interrupt per channel, this interrupt is not linked to a specific command. In descheduling mode, the HBA IRQ is a "global" IRQ that is statically routed to processor P[x_io,y_io,0]. The associated global HBA_ISR send a WAKUP WTI to all tasks that have a completed command. In order to know which commands expect completion, the HBA_ISR uses the ''_hba_active_cmd'' table which indicates currently active commands.
    1616
    1717The SEG_IOC_BASE address must be defined in the hard_config.h file.
     
    7575
    7676 === unsigned int '''_hba_init'' ( ) ===
    77 This function checks the block size and desactivates interrupts. It initializes
    78 the HBA hardware registers, and the Command List.
     77This function checks the block size and desactivates interrupts. It initializes the HBA hardware registers, the Command List and the allocator lock (except in boot mode).
    7978Return 0 for success, > 0 if error.
    8079
    8180 === unsigned int '''_hba_access'''( unsigned int use_irq  ,  unsigned int to_mem  ,  unsigned int lba ,  unsigned long long paddr,  unsigned int count ) ===   
    82 This function register a command in the Command List (and associated Command Table) for a single physical buffer, and updates the HBA_PXCI register.
     81This function gets a command index and then registers the command in both the command list and the command table. It updates the HBA_PXCI register and the ''hba_active_cmd'' in descheduling mode. At the end the command slot is released.
    8382 * '''use_irq''': Boolean => request to use the descheduling mode if non zero
    8483 * '''to_mem''' :  Boolean => to memory transfer if non zero
     
    8988
    9089=== void '''_hba_isr'''( unsigned int irq_type , unsigned int irq_id , unsigned int channel ) ===
    91 This Interrupt Service routine is only used in the descheduling mode. It analyses the HBA_PXCI register, and for all completed commands, it saves the status value in the ''_hba_status[32]'' array, indexed by the command index, and activates the task waiting completion of this command.
     90This Interrupt Service routine is only used in the descheduling mode. After a reset of the HBA_PXIS register, it analyses the ''_hba_active_cmd'' table and the HBA_PXCI register. For all active and completed commands, it activates the task waiting completion of this command.
    9291 * '''irq_type''' : HWI / PTI / WTI
    9392 * '''irq-id'''     : index returned by XCU