Ignore:
Timestamp:
Apr 26, 2017, 2:08:13 PM (5 years ago)
Author:
alain
Message:

Introduce dev_fbf, dev dma, dev_iob

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_iob.c

    r1 r3  
    11/*
    2  * dev_iox.c - IOX (bridge to external I/O) generic device API implementation.
     2 * dev_iob.c - IOB (bridge to external I/O) generic device API implementation.
    33 *
    44 * Authors   Alain Greiner  (2017)
     
    1414 * ALMOS-MKH is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of
    16  * MERCHANTABILITY or FITNESS FOR A PARTIOXLAR PURPOSE.  See the GNU
     16 * MERCHANTABILITY or FITNESS FOR A PARTIOBLAR PURPOSE.  See the GNU
    1717 * General Public License for more details.
    1818 *
     
    2626#include <hal_special.h>
    2727#include <remote_spinlock.h>
    28 #include <device.h>
     28#include <chdev.h>
    2929#include <printk.h>
    3030#include <soclib_iob.h>
    31 #include <dev_iox.h>
     31#include <dev_iob.h>
    3232
    33 //////////////////////////////////
    34 void dev_iox_init( xptr_t dev_xp )
     33////////////////////////////////////
     34void dev_iob_init( chdev_t * chdev )
    3535{
    36     // get IOX device descriptor cluster and local pointer
    37     cxy_t      dev_cxy = GET_CXY( dev_xp );
    38     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
    39 
    40     // get implementation from device descriptor
    41     uint32_t  impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) );
     36    // get implementation
     37    uint32_t  impl = chdev->impl;
    4238
    4339    // call driver init function
    44     if( impl == IMPL_IOX_IOB )
     40    if( impl == IMPL_IOB_TSR )
    4541    {
    46         soclib_iob_init( dev_xp );
     42        soclib_iob_init( chdev );
    4743    }
    4844    else
    4945    {
    50         printk("\n[PANIC] in %s: undefined IOX device implementation\n", __FUNCTION__ );
    51         hal_core_sleep();
     46        assert( false , __FUNCTION__ , "undefined IOB device implementation\n" );
    5247    }
    5348}
    5449
    5550//////////////////////////////////////////
    56 void dev_iox_iommu_enable( xptr_t dev_xp )
     51void dev_iob_iommu_enable( xptr_t dev_xp )
    5752{
    58     // get IOX device descriptor cluster and local pointer
    59     cxy_t      dev_cxy = GET_CXY( dev_xp );
    60     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
     53    // get IOB chdev descriptor cluster and local pointer
     54    cxy_t     dev_cxy = GET_CXY( dev_xp );
     55    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    6156
    62     // get implementation from device descriptor
     57    // get implementation from chdev descriptor
    6358    uint32_t  impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) );
    6459
    6560    // call driver function
    66     if( impl == IMPL_IOX_IOB )
     61    if( impl == IMPL_IOB_TSR )
    6762    {
    6863        remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     
    7267    else
    7368    {
    74         printk("\n[PANIC] in %s: undefined IOX device implementation\n", __FUNCTION__ );
     69        printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ );
    7570        hal_core_sleep();
    7671    }
     
    7873
    7974///////////////////////////////////////////
    80 void dev_iox_iommu_disable( xptr_t dev_xp )
     75void dev_iob_iommu_disable( xptr_t dev_xp )
    8176{
    82     // get IOX device descriptor cluster and local pointer
    83     cxy_t      dev_cxy = GET_CXY( dev_xp );
    84     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
     77    // get IOB chdev descriptor cluster and local pointer
     78    cxy_t     dev_cxy = GET_CXY( dev_xp );
     79    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    8580
    86     // get implementation from device descriptor
     81    // get implementation from chdev descriptor
    8782    uint32_t  impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) );
    8883
    8984    // call driver function
    90     if( impl == IMPL_IOX_IOB )
     85    if( impl == IMPL_IOB_TSR )
    9186    {
    9287        remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     
    9691    else
    9792    {
    98         printk("\n[PANIC] in %s: undefined IOX device implementation\n", __FUNCTION__ );
     93        printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ );
    9994        hal_core_sleep();
    10095    }
     
    10297
    10398////////////////////////////////////////
    104 void dev_iox_set_ptpr( xptr_t    dev_xp,
     99void dev_iob_set_ptpr( xptr_t    dev_xp,
    105100                       uint32_t  wdata )
    106101{
    107     // get IOX device descriptor cluster and local pointer
    108     cxy_t      dev_cxy = GET_CXY( dev_xp );
    109     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
     102    // get IOB chdev descriptor cluster and local pointer
     103    cxy_t     dev_cxy = GET_CXY( dev_xp );
     104    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    110105
    111     // get implementation from device descriptor
     106    // get implementation from chdev descriptor
    112107    uint32_t  impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) );
    113108
    114109    // call driver function
    115     if( impl == IMPL_IOX_IOB )
     110    if( impl == IMPL_IOB_TSR )
    116111    {
    117112        remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     
    121116    else
    122117    {
    123         printk("\n[PANIC] in %s: undefined IOX device implementation\n", __FUNCTION__ );
     118        printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ );
    124119        hal_core_sleep();
    125120    }
     
    127122                       
    128123////////////////////////////////////////
    129 void dev_iox_inval_page( xptr_t  dev_xp,
     124void dev_iob_inval_page( xptr_t  dev_xp,
    130125                         vpn_t   vpn )
    131126{
    132     // get IOX device descriptor cluster and local pointer
    133     cxy_t      dev_cxy = GET_CXY( dev_xp );
    134     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
     127    // get IOB chdev descriptor cluster and local pointer
     128    cxy_t     dev_cxy = GET_CXY( dev_xp );
     129    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    135130
    136     // get implementation from device descriptor
     131    // get implementation from chdev descriptor
    137132    uint32_t  impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) );
    138133
    139134    // call driver function
    140     if( impl == IMPL_IOX_IOB )
     135    if( impl == IMPL_IOB_TSR )
    141136    {
    142137        remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     
    146141    else
    147142    {
    148         printk("\n[PANIC] in %s: undefined IOX device implementation\n", __FUNCTION__ );
     143        printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ );
    149144        hal_core_sleep();
    150145    }
     
    152147
    153148///////////////////////////////////////////
    154 void dev_iox_get_status( xptr_t     dev_xp,
     149void dev_iob_get_status( xptr_t     dev_xp,
    155150                         uint32_t * error,
    156151                         uint32_t * bvar,
    157152                         uint32_t * srcid )
    158153{
    159     // get IOX device descriptor cluster and local pointer
    160     cxy_t      dev_cxy = GET_CXY( dev_xp );
    161     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
     154    // get IOB chdev descriptor cluster and local pointer
     155    cxy_t     dev_cxy = GET_CXY( dev_xp );
     156    chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    162157
    163     // get implementation from device descriptor
     158    // get implementation from chdev descriptor
    164159    uint32_t  impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) );
    165160
    166161    // call driver function
    167     if( impl == IMPL_IOX_IOB )
     162    if( impl == IMPL_IOB_TSR )
    168163    {
    169164        remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );
     
    175170    else
    176171    {
    177         printk("\n[PANIC] in %s: undefined IOX device implementation\n", __FUNCTION__ );
     172        printk("\n[PANIC] in %s: undefined IOB device implementation\n", __FUNCTION__ );
    178173        hal_core_sleep();
    179174    }
Note: See TracChangeset for help on using the changeset viewer.