Ignore:
Timestamp:
Jul 27, 2017, 12:23:29 AM (4 years ago)
Author:
alain
Message:

1) Introduce independant command fields for the various devices in the thread descriptor.
2) Introduce a new dev_pic_enable_ipi() function in the generic PIC device
3) Fix two bugs identified by Maxime in the scheduler initialisation, and in the sched_select().
4) fix several bugs in the TSAR hal_kentry.S.
5) Introduce a third kgiet segment (besides kdata and kcode) in the TSAR bootloader.

File:
1 edited

Legend:

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

    r205 r279  
    8383}
    8484
    85 
    86 //////////////////////////////////////////
    87 uint32_t soclib_pic_ack_timer( lid_t lid )
    88 {
    89     // get local XCU segment base
    90         uint32_t * base = soclib_pic_xcu_base();
    91 
    92     // read from register
    93         return base[(XCU_PTI_ACK << 5) | lid];
    94 
    95 }  // end soclib_pic_ack_timer()
    96 
    9785///////////////////////////////////////////
    9886void soclib_pic_xcu_status( lid_t      lid,
     
    113101}
    114102
     103////////////////////////////////////////////////////
     104inline uint32_t soclib_pic_xcu_ack( uint32_t * reg )
     105{
     106    return *reg;
     107}
     108
    115109/////////////////////////////
    116110void soclib_pic_irq_handler()
     
    120114    uint32_t   pti_status;   // PTI index + 1  / no pending PTI if 0
    121115    chdev_t  * src_chdev;    // pointer on source chdev descriptor
    122     uint32_t   index;        // IRQ index
     116    uint32_t   index;        // WTI / HWI / PTI index
     117    uint32_t   ack;          // XCU acknowledge requires a read...
    123118
    124119    core_t * core = CURRENT_THREAD->core;
     
    130125                           &pti_status );
    131126
     127    irq_dmsg("\n[INFO] %s : enter / WTI_STS = %x / HWI_STS = %x / WTI_STS = %x\n",
     128             __FUNCTION__ , wti_status , hwi_status , pti_status );
     129
    132130    // analyse status and handle up to 3 pending IRQ (one WTI, one HWI, one PTI)
    133131
     
    140138            assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" );
    141139
    142             // TODO acknowledge WTI [AG]
    143 
    144             // TODO force scheduling [AG]
     140            // acknowledge WTI
     141            uint32_t * base = soclib_pic_xcu_base();
     142            ack = base[(XCU_WTI_REG << 5) | core->lid];
     143
     144            // force scheduling
     145            sched_yield();
    145146        }
    146147        else                                    // it is an external device
     
    156157                    core->spurious_irqs ++;
    157158
    158                 // TODO disable this WTI in local XCU [AG]
     159                // disable WTI in local XCU controller
     160                uint32_t * base = soclib_pic_xcu_base();
     161                base[(XCU_MSK_WTI_DISABLE << 5) | core->lid] = 1 << core->lid;
    159162            }
    160163            else                                 // call relevant ISR
     
    183186                core->spurious_irqs ++;
    184187
    185             // TODO disable this HWI in local XCU [AG]
     188            // disable HWI in local XCU controller
     189            uint32_t * base = soclib_pic_xcu_base();
     190            base[(XCU_MSK_HWI_DISABLE << 5) | core->lid] = 1 << core->lid;
    186191                }
    187192        else                    // call relevant ISR
     
    205210
    206211        // acknowledge PTI
    207         soclib_pic_ack_timer( index );
    208 
    209         // TODO execute all actions related to TICK event
     212        uint32_t * base = soclib_pic_xcu_base();
     213        ack = base[(XCU_PTI_ACK << 5) | core->lid];
     214
     215        // execute all actions related to TICK event
    210216        core_clock( core );
    211217        }
     
    431437    else if( irq_type == SOCLIB_TYPE_WTI )
    432438    {
    433         // enable this WTI in local XCU controller
     439        // enable this WTI in remote XCU controller
    434440        hal_remote_sw( XPTR( src_chdev_cxy ,
    435441                       &seg_xcu_ptr[(XCU_MSK_WTI_ENABLE << 5) | lid] ) , (1 << irq_id) );
     
    464470    else if( irq_type == SOCLIB_TYPE_WTI )
    465471    {
    466         // enable this WTI in local XCU controller
     472        // enable this WTI in remote XCU controller
    467473        hal_remote_sw( XPTR( src_chdev_cxy ,
    468474                       &seg_xcu_ptr[(XCU_MSK_WTI_DISABLE << 5) | lid] ) , (1 << irq_id) );
     
    486492    base[(XCU_PTI_PER << 5) | lid] = period;
    487493
    488     // enable the PTI in local XCU controller
     494    // enable PTI in local XCU controller
    489495    base[(XCU_MSK_PTI_ENABLE << 5) | lid] = 1 << lid;
     496}
     497
     498////////////////////////////
     499void soclib_pic_enable_ipi()
     500{
     501    // calling core local index
     502    lid_t  lid = CURRENT_CORE->lid;
     503
     504    // get XCU segment base
     505    uint32_t * base = soclib_pic_xcu_base();
     506
     507    // enable WTI in local XCU controller
     508    base[(XCU_MSK_WTI_ENABLE << 5) | lid] = 1 << lid;
    490509}
    491510
Note: See TracChangeset for help on using the changeset viewer.