Ignore:
Timestamp:
Apr 26, 2017, 2:10:21 PM (7 years ago)
Author:
alain
Message:

Introduce the chdev_t structure in place of device_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/drivers/soclib/soclib_hba.c

    r1 r4  
    2424#include <printk.h>
    2525#include <hal_special.h>
    26 #include <device.h>
     26#include <chdev.h>
    2727#include <dev_ioc.h>
    2828#include <soclib_hba.h>
     
    5454spinlock_t         hba_lock;
    5555
    56 /////////////////////////////////////
    57 void soclib_hba_init( xptr_t dev_xp )
     56///////////////////////////////////////
     57void soclib_hba_init( chdev_t * chdev )
    5858{
    59     // get IOC device descriptor cluster and local pointer
    60     cxy_t      dev_cxy  = GET_CXY( dev_xp );
    61     device_t * dev_ptr  = (device_t *)GET_PTR( dev_xp );
    62  
    6359    // get hardware device base address
    64         xptr_t     hba_xp = (xptr_t)hal_remote_lwd( XPTR( dev_cxy , &dev_ptr->base ) );
     60        xptr_t  hba_xp = chdev->base;
    6561
    6662    // get hardware device cluster and local pointer
     
    7369
    7470    // set device descriptor extension
    75     hal_remote_sw( XPTR( dev_cxy , &dev_ptr->ext.ioc.size  ) , block_size );
    76     hal_remote_sw( XPTR( dev_cxy , &dev_ptr->ext.ioc.count ) , block_count );
     71    chdev->ext.ioc.size  = block_size;
     72    chdev->ext.ioc.count = block_count;
    7773
    7874        // reset SOCLIB_HBA driver global variables
     
    10298
    10399    // get command arguments and extended pointer on IOC device
    104     to_mem    =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->dev.ioc.to_mem ) );
    105     lba       =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->dev.ioc.lba    ) );
    106     count     =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->dev.ioc.count  ) );
    107     buf_xp    = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->dev.ioc.buf_xp ) );
    108     dev_xp    = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->dev.ioc.dev_xp ) );
     100    to_mem    =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.to_mem ) );
     101    lba       =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.lba    ) );
     102    count     =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.count  ) );
     103    buf_xp    = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.ioc.buf_xp ) );
     104    dev_xp    = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.ioc.dev_xp ) );
    109105
    110106    // get IOC device cluster and local pointer
    111     cxy_t      dev_cxy = GET_CXY( dev_xp );
    112     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
     107    cxy_t     dev_cxy = GET_CXY( dev_xp );
     108    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    113109
    114110    // get extended pointer on SOCLIB-HBA peripheral
     
    218214
    219215
    220 ////////////////////////////////////////////////////////////////
    221 void __attribute__ ((noinline)) soclib_hba_isr( device_t * dev )
     216/////////////////////////////////////////////////////////////////
     217void __attribute__ ((noinline)) soclib_hba_isr( chdev_t * chdev )
    222218{
    223219    // get extended pointer on client thread
    224     xptr_t root      = XPTR( local_cxy , &dev->wait_root );
     220    xptr_t root      = XPTR( local_cxy , &chdev->wait_root );
    225221    xptr_t client_xp = XLIST_FIRST_ELEMENT( root , thread_t , wait_list );
    226222
     
    230226
    231227    // get SOCLIB_HBA device cluster and local pointer
    232     cxy_t      hba_cxy  = GET_CXY( dev->base );
    233     uint32_t * hba_ptr  = (uint32_t *)GET_PTR( dev->base );
     228    cxy_t      hba_cxy  = GET_CXY( chdev->base );
     229    uint32_t * hba_ptr  = (uint32_t *)GET_PTR( chdev->base );
    234230
    235231    // get HBA_PXIS_REG and HBA_PXIS_REG current values
     
    253249            if( error && (iter == fault_id ) )
    254250            {
    255                 hal_remote_sw( XPTR( client_cxy , &client_ptr->dev.ioc.error ) , 1 );
     251                hal_remote_sw( XPTR( client_cxy , &client_ptr->command.ioc.error ) , 1 );
    256252            }
    257253            else
    258254            {
    259                 hal_remote_sw( XPTR( client_cxy , &client_ptr->dev.ioc.error ) , 0 );
     255                hal_remote_sw( XPTR( client_cxy , &client_ptr->command.ioc.error ) , 0 );
    260256            }
    261257
Note: See TracChangeset for help on using the changeset viewer.