Ignore:
Timestamp:
Jan 13, 2021, 12:47:53 AM (3 years ago)
Author:
alain
Message:

cosmetic

File:
1 edited

Legend:

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

    r679 r686  
    22 * soclib_pic.c - soclib PIC driver implementation.
    33 *
    4  * Author  Alain Greiner (2016,2017,2018,2019)
     4 * Author  Alain Greiner (2016,2017,2018,2019,2020)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    3939//////////////////////////////////////////////////////////////////////////////////////
    4040
    41 extern  chdev_directory_t chdev_dir;    // defined in chdev.h / allocated in kerneL-init.c
     41extern  chdev_directory_t chdev_dir;  // defined in chdev.h / allocated in kerneL-init.c
    4242
    4343extern  iopic_input_t  iopic_input;  // defined in dev_pic.h / allocated in kernel_init.c
     
    5858    soclib_pic_cluster_t * ext_ptr = LOCAL_CLUSTER->pic_extend;
    5959
    60     assert( __FUNCTION__, (ext_ptr->first_free_wti < ext_ptr->wti_nr) ,
    61             "no free WTI found : too much external IRQs\n");
     60assert( __FUNCTION__, (ext_ptr->first_free_wti < ext_ptr->wti_nr) ,
     61"no free WTI found : too much external IRQs");
    6262
    6363    // update WTI allocator
     
    147147        if( index < LOCAL_CLUSTER->cores_nr )   // it is an IPI
    148148        {
    149             assert( __FUNCTION__, (index == core->lid) , "illegal IPI index" );
     149
     150assert( __FUNCTION__, (index == core->lid),
     151"illegal IPI index" );
    150152
    151153#if DEBUG_HAL_IRQS
     
    170172                    {
    171173                printk("\n[WARNING] in %s : no handler for WTI %d on core %d in cluster %x\n",
    172                        __FUNCTION__ , index , core->lid , local_cxy );
    173 
    174                     core->spurious_irqs ++;
     174                 __FUNCTION__ , index , core->lid , local_cxy );
    175175
    176176                // disable WTI in local XCU controller
     
    204204                {
    205205            printk("\n[WARNING] in %s : no handler for HWI %d on core %d in cluster %x\n",
    206                    __FUNCTION__ , index , core->lid , local_cxy );
    207 
    208                 core->spurious_irqs ++;
     206            __FUNCTION__ , index , core->lid , local_cxy );
    209207
    210208            // disable HWI in local XCU controller
     
    230228        index = pti_status - 1;
    231229
    232         assert( __FUNCTION__, (index == core->lid) , "unconsistent PTI index\n");
     230assert( __FUNCTION__, (index == core->lid),
     231"unconsistent PTI index\n");
    233232
    234233#if DEBUG_HAL_IRQS
     
    278277    soclib_pic_cluster_t * cluster_ext_ptr;   
    279278    soclib_pic_core_t    * core_ext_ptr;
    280     kmem_req_t             req;
    281279    uint32_t               lid;
    282280    uint32_t               idx;
     
    288286    {
    289287        // allocate memory for core extension
    290         req.type     = KMEM_KCM;
    291         req.order    = bits_log2( sizeof(soclib_pic_core_t) );
    292         req.flags    = AF_KERNEL;
    293         core_ext_ptr = kmem_alloc( &req );
     288        core_ext_ptr = kmem_alloc( bits_log2( sizeof(soclib_pic_core_t)) , AF_KERNEL );
    294289
    295290        if( core_ext_ptr == NULL )
     
    308303
    309304    // allocate memory for cluster extension
    310     req.type        = KMEM_KCM;
    311     req.order       = bits_log2( sizeof(soclib_pic_cluster_t) );
    312     req.flags       = AF_KERNEL;
    313     cluster_ext_ptr = kmem_alloc( &req );
     305    cluster_ext_ptr = kmem_alloc( bits_log2( sizeof(soclib_pic_cluster_t) ), AF_KERNEL );
    314306
    315307    if( cluster_ext_ptr == NULL )
     
    319311    }
    320312   
    321 assert( __FUNCTION__, (cluster_ext_ptr != NULL) , "cannot allocate memory for cluster extension");
    322 
    323313    // get XCU characteristics from the XCU config register
    324314    uint32_t  config = xcu_base[XCU_CONFIG<<5];
     
    380370    bool_t   is_rx   = src_chdev->is_rx;
    381371
    382     if( (func == DEV_FUNC_IOC && impl == IMPL_IOC_BDV) || (func == DEV_FUNC_NIC) ||
    383         (func == DEV_FUNC_TXT && impl == IMPL_TXT_TTY) || (func == DEV_FUNC_IOB) ) // external IRQ => WTI
     372    if( ((func == DEV_FUNC_IOC) && (impl == IMPL_IOC_BDV)) ||
     373        (func == DEV_FUNC_NIC)                             ||
     374        ((func == DEV_FUNC_TXT) && (impl == IMPL_TXT_TTY)) ||
     375        (func == DEV_FUNC_IOB) ) // external IRQ => WTI
    384376    {
    385377        // get external IRQ index
    386378        uint32_t  hwi_id = 0;   
    387379        if     (  func == DEV_FUNC_IOC            ) hwi_id = iopic_input.ioc[channel];
    388         else if(  func == DEV_FUNC_TXT &&  is_rx ) hwi_id = iopic_input.txt_rx[channel];
    389         else if(  func == DEV_FUNC_TXT && !is_rx ) hwi_id = iopic_input.txt_tx[channel];
     380        else if( (func == DEV_FUNC_TXT) &&  is_rx ) hwi_id = iopic_input.txt_rx[channel];
     381        else if( (func == DEV_FUNC_TXT) && !is_rx ) hwi_id = iopic_input.txt_tx[channel];
    390382        else if( (func == DEV_FUNC_NIC) &&  is_rx ) hwi_id = iopic_input.nic_rx[channel];
    391383        else if( (func == DEV_FUNC_NIC) && !is_rx ) hwi_id = iopic_input.nic_tx[channel];
    392384        else if(  func == DEV_FUNC_IOB            ) hwi_id = iopic_input.iob;
    393         else      assert( __FUNCTION__, false , "illegal device functionnal type\n");
     385        else
     386        {
     387            printk("\n[WARNING] from %s : illegal device / func %s / is_rx %d\n",
     388            __FUNCTION__, chdev_func_str(func), is_rx );
     389        }
    394390
    395391        // get a WTI mailbox from local XCU descriptor 
     
    420416#if DEBUG_HAL_IRQS
    421417if( DEBUG_HAL_IRQS < cycle )
    422 printk("\n[DBG] %s : %s / channel = %d / rx = %d / hwi_id = %d / wti_id = %d / cluster = %x\n",
     418printk("\n[DBG] %s : %s / channel %d / rx %d / hwi_id %d / wti_id %d / cluster %x\n",
    423419__FUNCTION__ , chdev_func_str( func ) , channel , is_rx , hwi_id , wti_id , local_cxy );
    424420#endif
    425421
    426422    }
    427     else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) ||
     423    else if( (func == DEV_FUNC_DMA) ||
     424             (func == DEV_FUNC_MMC) ||
    428425             (func == DEV_FUNC_TXT && impl == IMPL_TXT_MTY) ||
    429426             (func == DEV_FUNC_IOC && impl == IMPL_IOC_SPI) )   // internal IRQ => HWI
     
    431428        // get internal IRQ index
    432429        uint32_t hwi_id;
    433         if( func == DEV_FUNC_DMA ) hwi_id = lapic_input.dma[channel];
     430        if( func == DEV_FUNC_DMA )      hwi_id = lapic_input.dma[channel];
    434431        else if (func == DEV_FUNC_TXT ) hwi_id = lapic_input.mtty;
    435432        else if (func == DEV_FUNC_IOC ) hwi_id = lapic_input.sdcard;
    436         else                       hwi_id = lapic_input.mmc;
     433        else                            hwi_id = lapic_input.mmc;
    437434
    438435        // register IRQ type and index in chdev
     
    453450    else
    454451    {
    455         assert( __FUNCTION__, false , "illegal device functionnal type\n" );
     452        printk("\n[WARNING] from %s : illegal device / func %s / is_rx %d / impl %d\n",
     453        __FUNCTION__, chdev_func_str(func), is_rx, impl );
    456454    }
    457455}  // end soclib_pic_bind_irq();
     
    477475        // in TSAR : XCU output [4*lid] is connected to core [lid]
    478476        hal_remote_s32( XPTR( src_chdev_cxy ,
    479                        &seg_xcu_ptr[ (XCU_MSK_HWI_ENABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
     477        &seg_xcu_ptr[ (XCU_MSK_HWI_ENABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
    480478    }
    481479    else if( irq_type == SOCLIB_TYPE_WTI )
     
    484482        // in TSAR : XCU output [4*lid] is connected to core [lid]
    485483        hal_remote_s32( XPTR( src_chdev_cxy ,
    486                        &seg_xcu_ptr[ (XCU_MSK_WTI_ENABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
     484        &seg_xcu_ptr[ (XCU_MSK_WTI_ENABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
    487485    }
    488486    else
    489487    {
    490         assert( __FUNCTION__, false , "illegal IRQ type\n" );
     488        printk("\n[WARNING] from %s : illegal IRQ type %d\n",
     489        __FUNCTION__, irq_type );
    491490    }
    492491} // end soclib_pic_enable_irq()
     
    512511        // in TSAR : XCU output [4*lid] is connected to core [lid]
    513512        hal_remote_s32( XPTR( src_chdev_cxy ,
    514                        &seg_xcu_ptr[(XCU_MSK_HWI_DISABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
     513        &seg_xcu_ptr[(XCU_MSK_HWI_DISABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
    515514    }
    516515    else if( irq_type == SOCLIB_TYPE_WTI )
     
    519518        // in TSAR : XCU output [4*lid] is connected to core [lid]
    520519        hal_remote_s32( XPTR( src_chdev_cxy ,
    521                        &seg_xcu_ptr[(XCU_MSK_WTI_DISABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
     520        &seg_xcu_ptr[(XCU_MSK_WTI_DISABLE << 5) | (lid<<2) ] ) , (1 << irq_id) );
    522521    }
    523522    else
    524523    {
    525         assert( __FUNCTION__, false , "illegal IRQ type\n" );
     524        printk("\n[WARNING] from %s : illegal IRQ type %d\n",
     525        __FUNCTION__, irq_type );
    526526    }
    527527} // end soclib_pic_enable_irq()
     
    570570}
    571571
    572 /////////////////////////
     572///////////////////////////////
    573573void soclib_pic_ack_ipi( void )
    574574{
     
    582582    uint32_t   ack  = base[ (XCU_WTI_REG << 5) | lid ];
    583583
    584     // we must make a fake use for ack value to avoid a warning
     584    // we make a fake use for ack value to avoid a warning
    585585    if( (ack + 1) == 0 ) asm volatile( "nop" );
    586586}
Note: See TracChangeset for help on using the changeset viewer.