Ignore:
Timestamp:
Jul 17, 2017, 11:41:25 AM (7 years ago)
Author:
alain
Message:

Change dev_pic_enable_irq() and dev_pic_disable_irq() prototypes
to handle remote IRQs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/drivers/soclib_pic.c

    r204 r205  
    6868inline uint32_t * soclib_pic_xcu_base()
    6969{
    70     return ((soclib_pic_cluster_t *)LOCAL_CLUSTER->pic_extend)->xcu_base;
    71 
    72 }  // end soclib_pic_xcu_base()
     70    return ((soclib_pic_cluster_t *)(LOCAL_CLUSTER->pic_extend))->xcu_base;
     71}
     72
     73/////////////////////////////////////////////////////////
     74inline uint32_t * soclib_pic_remote_xcu_base( cxy_t cxy )
     75{
     76    soclib_pic_cluster_t * extend;
     77
     78    // get extended pointer on PIC extension in remote cluster
     79    extend = hal_remote_lpt( XPTR( cxy , &cluster_manager.pic_extend ) );
     80
     81        return (uint32_t *)hal_remote_lpt( XPTR( cxy , &extend->xcu_base ) );
     82                 
     83}
    7384
    7485
     
    397408}  // end soclib_pic_bind_irq();
    398409
    399 //////////////////////////////////////////
    400 void soclib_pic_enable_irq( lid_t     lid,
    401                             chdev_t * src_chdev )
    402 {
    403     // get local pointer on XCU segment base
    404     uint32_t * seg_xcu_ptr = soclib_pic_xcu_base();
     410///////////////////////////////////////
     411void soclib_pic_enable_irq( lid_t  lid,
     412                            xptr_t src_chdev_xp )
     413{
     414    // get cluster and local pointer on remote src_chdev
     415    cxy_t     src_chdev_cxy = GET_CXY( src_chdev_xp );
     416    chdev_t * src_chdev_ptr = (chdev_t *)GET_PTR( src_chdev_xp );
     417
     418    // get local pointer on remote XCU segment base
     419    uint32_t * seg_xcu_ptr = soclib_pic_remote_xcu_base( src_chdev_cxy );
    405420
    406421    // get the source chdev IRQ type and index
    407     uint32_t irq_type = src_chdev->irq_type;
    408     uint32_t irq_id   = src_chdev->irq_id;
     422    uint32_t irq_type = hal_remote_lw( XPTR( src_chdev_cxy , &src_chdev_ptr->irq_type ) );
     423    uint32_t irq_id   = hal_remote_lw( XPTR( src_chdev_cxy , &src_chdev_ptr->irq_id ) );
    409424
    410425    if( irq_type == SOCLIB_TYPE_HWI )
    411426    {
    412          // enable this HWI in local XCU controller
    413         seg_xcu_ptr[(XCU_MSK_HWI_ENABLE << 5) | lid] = (1 << irq_id);
     427        // enable this HWI in remote XCU controller
     428        hal_remote_sw( XPTR( src_chdev_cxy ,
     429                       &seg_xcu_ptr[(XCU_MSK_HWI_ENABLE << 5) | lid] ) , (1 << irq_id) );
    414430    }
    415431    else if( irq_type == SOCLIB_TYPE_WTI )
    416432    {
    417          // enable this WTI in local XCU controller
    418         seg_xcu_ptr[(XCU_MSK_WTI_ENABLE << 5) | lid] = 1 << irq_id;
     433        // enable this WTI in local XCU controller
     434        hal_remote_sw( XPTR( src_chdev_cxy ,
     435                       &seg_xcu_ptr[(XCU_MSK_WTI_ENABLE << 5) | lid] ) , (1 << irq_id) );
    419436    }
    420437    else
     
    424441} // end soclib_pic_enable_irq()
    425442
    426 ///////////////////////////////////////////
    427 void soclib_pic_disable_irq( lid_t     lid,
    428                              chdev_t * src_chdev )
    429 {
    430     // get local pointer on XCU segment base
    431     uint32_t * seg_xcu_ptr = soclib_pic_xcu_base();
     443////////////////////////////////////////
     444void soclib_pic_disable_irq( lid_t  lid,
     445                             xptr_t src_chdev_xp )
     446{
     447    // get cluster and local pointer on remote src_chdev
     448    cxy_t     src_chdev_cxy = GET_CXY( src_chdev_xp );
     449    chdev_t * src_chdev_ptr = (chdev_t *)GET_PTR( src_chdev_xp );
     450
     451    // get local pointer on remote XCU segment base
     452    uint32_t * seg_xcu_ptr = soclib_pic_remote_xcu_base( src_chdev_cxy );
    432453
    433454    // get the source chdev IRQ type and index
    434     uint32_t irq_type = src_chdev->irq_type;
    435     uint32_t irq_id   = src_chdev->irq_id;
     455    uint32_t irq_type = hal_remote_lw( XPTR( src_chdev_cxy , &src_chdev_ptr->irq_type ) );
     456    uint32_t irq_id   = hal_remote_lw( XPTR( src_chdev_cxy , &src_chdev_ptr->irq_id ) );
    436457
    437458    if( irq_type == SOCLIB_TYPE_HWI )
    438459    {
    439          // disable this HWI in local XCU controller
    440         seg_xcu_ptr[(XCU_MSK_HWI_DISABLE << 5) | lid] = 1 << irq_id;
     460        // enable this HWI in remote XCU controller
     461        hal_remote_sw( XPTR( src_chdev_cxy ,
     462                       &seg_xcu_ptr[(XCU_MSK_HWI_DISABLE << 5) | lid] ) , (1 << irq_id) );
    441463    }
    442464    else if( irq_type == SOCLIB_TYPE_WTI )
    443465    {
    444          // disable this WTI in local XCU controller
    445         seg_xcu_ptr[(XCU_MSK_WTI_DISABLE << 5) | lid] = 1 << irq_id;
     466        // enable this WTI in local XCU controller
     467        hal_remote_sw( XPTR( src_chdev_cxy ,
     468                       &seg_xcu_ptr[(XCU_MSK_WTI_DISABLE << 5) | lid] ) , (1 << irq_id) );
    446469    }
    447470    else
Note: See TracChangeset for help on using the changeset viewer.