Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (5 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

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

    r406 r407  
    4343extern  lapic_input_t  lapic_input;  // defined in dev_pic.h / allocated in kernel_init.c
    4444 
     45
     46
    4547//////////////////////////////////////////////////////////////////////////////////////
    4648//        SOCLIB PIC private functions
     
    127129                           &pti_status );
    128130
    129     irq_dmsg("\n[DMSG] %s : enter for core[%x,%d] / WTI = %x / HWI = %x / WTI = %x\n",
     131    irq_dmsg("\n[DBG] %s : core[%x,%d] enter / WTI = %x / HWI = %x / WTI = %x\n",
    130132             __FUNCTION__ , local_cxy , core->lid , wti_status , hwi_status , pti_status );
    131133
     
    140142            assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" );
    141143
    142             irq_dmsg("\n[DMSG] %s : core[%x,%d] received an IPI / cycle %d\n",
     144            irq_dmsg("\n[DBG] %s : core[%x,%d] received an IPI / cycle %d\n",
    143145             __FUNCTION__ , local_cxy , core->lid , hal_time_stamp() );
    144146
     
    168170            else                                 // call relevant ISR
    169171            {
    170                 irq_dmsg("\n[DMSG] %s : core[%x,%d] received external WTI %d / cycle %d\n",
     172                irq_dmsg("\n[DBG] %s : core[%x,%d] received external WTI %d / cycle %d\n",
    171173                __FUNCTION__ , local_cxy , core->lid , index , hal_time_stamp() );
    172174
     
    196198        else                    // call relevant ISR
    197199        {
    198             irq_dmsg("\n[DMSG] %s : core[%x,%d] received HWI %d / cycle %d\n",
     200            irq_dmsg("\n[DBG] %s : core[%x,%d] received HWI %d / cycle %d\n",
    199201            __FUNCTION__ , local_cxy , core->lid , index , hal_time_stamp() );
    200202
     
    208210        index = pti_status - 1;
    209211
    210         irq_dmsg("\n[DMSG] %s : core[%x,%d] received PTI %d / cycle %d\n",
     212        irq_dmsg("\n[DBG] %s : core[%x,%d] received PTI %d / cycle %d\n",
    211213        __FUNCTION__ , core->lid , local_cxy , index , hal_time_stamp() );
    212214
     
    248250    uint32_t * iopic_seg_ptr = (uint32_t *)GET_PTR( pic->base );
    249251
    250     // reset the IOPIC component registers : mask all input IRQs
     252    // reset the IOPIC component registers : disable all input IRQs
    251253    for( i = 0 ; i < CONFIG_MAX_EXTERNAL_IRQS ; i++ )
    252254    {
     
    364366    {
    365367        // get external IRQ index
    366         uint32_t  irq_id;   
    367         if     (  func == DEV_FUNC_IOC            ) irq_id = iopic_input.ioc[channel];
    368         else if(  func == DEV_FUNC_TXT            ) irq_id = iopic_input.txt[channel];
    369         else if( (func == DEV_FUNC_NIC) &&  is_rx ) irq_id = iopic_input.nic_rx[channel];
    370         else if( (func == DEV_FUNC_NIC) && !is_rx ) irq_id = iopic_input.nic_tx[channel];
    371         else if(  func == DEV_FUNC_IOB            ) irq_id = iopic_input.iob;
     368        uint32_t  hwi_id;   
     369        if     (  func == DEV_FUNC_IOC            ) hwi_id = iopic_input.ioc[channel];
     370        else if(  func == DEV_FUNC_TXT  &&  is_rx ) hwi_id = iopic_input.txt_rx[channel];
     371        else if(  func == DEV_FUNC_TXT  && !is_rx ) hwi_id = iopic_input.txt_tx[channel];
     372        else if( (func == DEV_FUNC_NIC) &&  is_rx ) hwi_id = iopic_input.nic_rx[channel];
     373        else if( (func == DEV_FUNC_NIC) && !is_rx ) hwi_id = iopic_input.nic_tx[channel];
     374        else if(  func == DEV_FUNC_IOB            ) hwi_id = iopic_input.iob;
    372375        else      assert( false , __FUNCTION__ , "illegal device functionnal type\n");
    373376
     
    385388        uint32_t lsb_wdata = (uint32_t)wti_xp;
    386389        uint32_t msb_wdata = (uint32_t)(wti_xp >> 32);
    387         xptr_t   lsb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+irq_id*IOPIC_SPAN+IOPIC_ADDRESS );
    388         xptr_t   msb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+irq_id*IOPIC_SPAN+IOPIC_EXTEND );
     390        xptr_t   lsb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_ADDRESS );
     391        xptr_t   msb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_EXTEND );
    389392        hal_remote_sw( lsb_xp , lsb_wdata );
    390393        hal_remote_sw( msb_xp , msb_wdata );
    391394
    392         // unmask IRQ in IOPIC
    393         hal_remote_sw( XPTR( seg_pic_cxy , seg_pic_ptr+irq_id*IOPIC_SPAN+IOPIC_MASK ), 1 );
     395        // enable IRQ in IOPIC
     396        hal_remote_sw( XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_MASK ), 1 );
    394397
    395398        // update the WTI interrupt vector for core[lid]
    396399        core_t * core = &LOCAL_CLUSTER->core_tbl[lid];
    397400        ((soclib_pic_core_t *)core->pic_extend)->wti_vector[wti_id] = src_chdev;
     401
     402pic_dmsg("\n[DBG] %s : %s / channel = %d / rx = %d / hwi_id = %d / wti_id = %d / cluster = %x\n",
     403__FUNCTION__ , chdev_func_str( func ) , channel , is_rx , hwi_id , wti_id , local_cxy );
     404
    398405    }
    399406    else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) )   // internal IRQ => HWI
     
    411418        core_t * core = &LOCAL_CLUSTER->core_tbl[lid];
    412419        ((soclib_pic_core_t *)core->pic_extend)->wti_vector[hwi_id] = src_chdev;
     420
     421pic_dmsg("\n[DBG] %s : %s / channel = %d / hwi_id = %d / cluster = %x\n",
     422__FUNCTION__ , chdev_func_str( func ) , channel , hwi_id , local_cxy );
     423
    413424    }
    414425    else
     
    494505
    495506    // set period value in XCU (in cycles)
    496     uint32_t cycles = period * SOCLIB_CYCLES_PER_MS * CONFIG_SCHED_TICK_MS_PERIOD;
     507    uint32_t cycles = period * SOCLIB_CYCLES_PER_MS;
    497508    base[(XCU_PTI_PER << 5) | lid] = cycles;
    498509
     
    525536}
    526537
    527 
    528 
     538/////////////////////////
     539void soclib_pic_ack_ipi()
     540{
     541    // get calling core local index
     542    lid_t      lid  = CURRENT_THREAD->core->lid;
     543
     544    // get pointer on local XCU segment base
     545    uint32_t * base = soclib_pic_xcu_base();
     546
     547    // acknowlege IPI
     548    uint32_t   ack  = base[(XCU_WTI_REG << 5) | lid];
     549
     550    // we must make a fake use for ack value to avoid a warning
     551    if( (ack + 1) == 0 ) panic("this should never happen");
     552}
     553   
     554
Note: See TracChangeset for help on using the changeset viewer.