Changeset 492 for trunk/hal


Ignore:
Timestamp:
Aug 22, 2018, 11:55:48 PM (6 years ago)
Author:
viala@…
Message:

Refactoring assert calling to conform with new assert macro.

Made with this command for the general case.
find ./kernel/ hal/ -name "*.c" | xargs sed -i -e '/assert(/ s/,[ ]*FUNCTION[ ]*,/,/'

And some done by hand.

Location:
trunk/hal
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/core/hal_context.c

    r459 r492  
    119119error_t hal_cpu_context_alloc( thread_t * thread )
    120120{
    121     assert( (sizeof(hal_cpu_context_t) <= CONFIG_CPU_CTX_SIZE) , __FUNCTION__ ,
     121    assert( (sizeof(hal_cpu_context_t) <= CONFIG_CPU_CTX_SIZE) ,
    122122    "illegal CPU context size" );
    123123
     
    146146    hal_cpu_context_t * context = (hal_cpu_context_t *)thread->cpu_context;
    147147
    148     assert( (context != NULL ), __FUNCTION__, "CPU context not allocated" );
     148    assert( (context != NULL ), "CPU context not allocated" );
    149149
    150150    // initialisation depends on thread type
     
    235235    else                           // current == child thread
    236236    {
    237         assert( (current == child_ptr) , __FUNCTION__ , "current = %x / child = %x\n");
     237        assert( (current == child_ptr) , "current = %x / child = %x\n");
    238238    }
    239239}  // end hal_cpu_context_fork()
     
    300300error_t hal_fpu_context_alloc( thread_t * thread )
    301301{
    302     assert( (sizeof(hal_fpu_context_t) <= CONFIG_FPU_CTX_SIZE) , __FUNCTION__ ,
     302    assert( (sizeof(hal_fpu_context_t) <= CONFIG_FPU_CTX_SIZE) ,
    303303    "illegal CPU context size" );
    304304
     
    322322    hal_fpu_context_t * context = thread->fpu_context;
    323323
    324     assert( (context != NULL) , __FUNCTION__ , "fpu context not allocated" );
     324    assert( (context != NULL) , "fpu context not allocated" );
    325325
    326326    memset( context , 0 , sizeof(hal_fpu_context_t) );
     
    331331                           thread_t * src )
    332332{
    333     assert( (src != NULL) , __FUNCTION__ , "src thread pointer is NULL\n");
    334     assert( (dst != NULL) , __FUNCTION__ , "dst thread pointer is NULL\n");
     333    assert( (src != NULL) , "src thread pointer is NULL\n");
     334    assert( (dst != NULL) , "dst thread pointer is NULL\n");
    335335
    336336    // get fpu context pointers
  • trunk/hal/tsar_mips32/core/hal_drivers.c

    r457 r492  
    4949                           uint32_t   impl )
    5050{
    51         assert( (impl == IMPL_TXT_TTY), __FUNCTION__ , "bad implementation" );
     51        assert( (impl == IMPL_TXT_TTY), "bad implementation" );
    5252
    5353        soclib_tty_init( txt );
     
    6262                           uint32_t   impl )
    6363{
    64     assert( (impl == IMPL_PIC_SCL), __FUNCTION__, "bad implementation" );
     64    assert( (impl == IMPL_PIC_SCL), "bad implementation" );
    6565
    6666        soclib_pic_init( pic );
     
    8585                           uint32_t   impl )
    8686{
    87         assert( (impl == IMPL_IOB_TSR), __FUNCTION__ , "bad implementation" );
     87        assert( (impl == IMPL_IOB_TSR), "bad implementation" );
    8888
    8989        soclib_iob_init( iob );
     
    116116    else
    117117    {
    118                 assert( false , __FUNCTION__ , "undefined IOC device implementation" );
     118                assert( false , "undefined IOC device implementation" );
    119119        }
    120120}
     
    128128                           uint32_t   impl )
    129129{
    130         assert( (impl == IMPL_MMC_TSR), __FUNCTION__ , "bad implementation" );
     130        assert( (impl == IMPL_MMC_TSR), "bad implementation" );
    131131 
    132132    soclib_mmc_init( mmc );
     
    141141                           uint32_t   impl )
    142142{
    143         assert( (impl == IMPL_NIC_CBF), __FUNCTION__ , "bad implementation" );
     143        assert( (impl == IMPL_NIC_CBF), "bad implementation" );
    144144 
    145145    soclib_nic_init( nic );
     
    154154                           uint32_t   impl )
    155155{
    156         assert( (impl == IMPL_DMA_SCL), __FUNCTION__ , "bad implementation" );
     156        assert( (impl == IMPL_DMA_SCL), "bad implementation" );
    157157 
    158158    soclib_dma_init( dma );
  • trunk/hal/tsar_mips32/core/hal_exception.c

    r481 r492  
    500500        hal_exception_dump( this , uzone , error );
    501501
    502         assert( false , __FUNCTION__ , "core[%x,%d] blocked\n", local_cxy, this->core->lid );
     502        assert( false , "Exception raised kernel panic see information below.\n" );
    503503    }
    504504
  • trunk/hal/tsar_mips32/core/hal_gpt.c

    r457 r492  
    140140
    141141    // check page size
    142     assert( (CONFIG_PPM_PAGE_SIZE == 4096) , __FUNCTION__ ,
     142    assert( (CONFIG_PPM_PAGE_SIZE == 4096) ,
    143143    "for TSAR, the page size must be 4 Kbytes\n" );
    144144
     
    283283    vpn_t      vpn;
    284284
    285     assert( (process != NULL) , __FUNCTION__ , "NULL process pointer\n");
     285    assert( (process != NULL) , "NULL process pointer\n");
    286286
    287287    // get pointer on gpt
     
    387387        pte1 = *pte1_ptr;
    388388
    389         assert( (pte1 == 0) , __FUNCTION__ ,
     389        assert( (pte1 == 0) ,
    390390                "try to set a big page in a mapped PT1 entry / PT1[%d] = %x\n", ix1 , pte1 );
    391391     
     
    441441        {
    442442            // This valid entry must be a PTD1
    443             assert( (pte1 & TSAR_MMU_SMALL) , __FUNCTION__ ,
     443            assert( (pte1 & TSAR_MMU_SMALL) ,
    444444            "try to set a small page in a big PT1 entry / PT1[%d] = %x\n", ix1 , pte1 );
    445445
     
    792792
    793793    // check src_pt1 and dst_pt1 existence
    794     assert( (src_pt1 != NULL) , __FUNCTION__ , "src_pt1 does not exist\n");
    795     assert( (dst_pt1 != NULL) , __FUNCTION__ , "dst_pt1 does not exist\n");
     794    assert( (src_pt1 != NULL) , "src_pt1 does not exist\n");
     795    assert( (dst_pt1 != NULL) , "dst_pt1 does not exist\n");
    796796
    797797    ix1 = TSAR_MMU_IX1_FROM_VPN( vpn );
     
    10101010            pt2     = (uint32_t*)GET_PTR( ppm_ppn2base( pt2_ppn ) );
    10111011
    1012             assert( (GET_CXY( ppm_ppn2base( pt2_ppn ) ) == gpt_cxy ), __FUNCTION__,
     1012            assert( (GET_CXY( ppm_ppn2base( pt2_ppn ) ) == gpt_cxy ),
    10131013            "PT2 and PT1 must be in the same cluster\n");
    10141014 
  • trunk/hal/tsar_mips32/drivers/soclib_bdv.c

    r451 r492  
    219219    else
    220220    {
    221         assert( false , __FUNCTION__ , "IOC_SYNC_READ should not use IRQ" );
     221        assert( false , "IOC_SYNC_READ should not use IRQ" );
    222222    }
    223223
  • trunk/hal/tsar_mips32/drivers/soclib_nic.c

    r451 r492  
    5353
    5454    // allocate memory for chbuf descriptor (one page)
    55     assert( (sizeof(nic_chbuf_t) <= CONFIG_PPM_PAGE_SIZE ) , __FUNCTION__ ,
     55    assert( (sizeof(nic_chbuf_t) <= CONFIG_PPM_PAGE_SIZE ) ,
    5656            "chbuf descriptor exceeds one page" );
    5757
     
    6262    nic_chbuf_t * chbuf = (nic_chbuf_t *)kmem_alloc( &req );
    6363
    64     assert( (chbuf != NULL) , __FUNCTION__ ,
     64    assert( (chbuf != NULL) ,
    6565             "cannot allocate chbuf descriptor" );
    6666
     
    7272    // allocate containers (one page per container)
    7373    // and complete chbuf descriptor initialization
    74     assert( (CONFIG_PPM_PAGE_SIZE == 4096) , __FUNCTION__ ,
     74    assert( (CONFIG_PPM_PAGE_SIZE == 4096) ,
    7575            "chbuf container must be 4 Kbytes" );
    7676
     
    7979        uint32_t * container = (uint32_t *)kmem_alloc( &req );   
    8080
    81         assert( (container != NULL) , __FUNCTION__ ,
     81        assert( (container != NULL) ,
    8282                "cannot allocate container" );
    8383       
  • trunk/hal/tsar_mips32/drivers/soclib_pic.c

    r481 r492  
    5757    soclib_pic_cluster_t * ext_ptr = LOCAL_CLUSTER->pic_extend;
    5858
    59     assert( (ext_ptr->first_free_wti < ext_ptr->wti_nr) , __FUNCTION__ ,
     59    assert( (ext_ptr->first_free_wti < ext_ptr->wti_nr) ,
    6060            "no free WTI found : too much external IRQs\n");
    6161
     
    146146        if( index < LOCAL_CLUSTER->cores_nr )   // it is an IPI
    147147        {
    148             assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" );
     148            assert( (index == core->lid) , "illegal IPI index" );
    149149
    150150#if DEBUG_HAL_IRQS
     
    229229        index = pti_status - 1;
    230230
    231         assert( (index == core->lid) , __FUNCTION__ , "unconsistent PTI index\n");
     231        assert( (index == core->lid) , "unconsistent PTI index\n");
    232232
    233233#if DEBUG_HAL_IRQS
     
    292292        core_ext_ptr = kmem_alloc( &req );
    293293
    294         assert( (core_ext_ptr != NULL) , __FUNCTION__ ,
     294        assert( (core_ext_ptr != NULL) ,
    295295                "cannot allocate memory for core extension\n");
    296296   
     
    309309    cluster_ext_ptr = kmem_alloc( &req );
    310310
    311     assert( (cluster_ext_ptr != NULL) , __FUNCTION__ ,
     311    assert( (cluster_ext_ptr != NULL) ,
    312312            "cannot allocate memory for cluster extension\n");
    313313
     
    381381        else if( (func == DEV_FUNC_NIC) && !is_rx ) hwi_id = iopic_input.nic_tx[channel];
    382382        else if(  func == DEV_FUNC_IOB            ) hwi_id = iopic_input.iob;
    383         else      assert( false , __FUNCTION__ , "illegal device functionnal type\n");
     383        else      assert( false , "illegal device functionnal type\n");
    384384
    385385        // get a WTI mailbox from local XCU descriptor 
     
    439439    else
    440440    {
    441         assert( false , __FUNCTION__ , "illegal device functionnal type\n" );
     441        assert( false , "illegal device functionnal type\n" );
    442442    }
    443443}  // end soclib_pic_bind_irq();
     
    474474    else
    475475    {
    476         assert( false , __FUNCTION__ , "illegal IRQ type\n" );
     476        assert( false , "illegal IRQ type\n" );
    477477    }
    478478} // end soclib_pic_enable_irq()
     
    509509    else
    510510    {
    511         assert( false , __FUNCTION__ , "illegal IRQ type\n" );
     511        assert( false , "illegal IRQ type\n" );
    512512    }
    513513} // end soclib_pic_enable_irq()
  • trunk/hal/tsar_mips32/drivers/soclib_tty.c

    r457 r492  
    233233    else
    234234    {
    235         assert( false , __FUNCTION__ , "illegal TXT command\n" );
     235        assert( false , "illegal TXT command\n" );
    236236    }
    237237
     
    329329               
    330330                // check process exist
    331                 assert( (owner_xp != XPTR_NULL) , __FUNCTION__,
     331                assert( (owner_xp != XPTR_NULL) ,
    332332                "TXT owner process not found\n" );
    333333
     
    387387
    388388                // check process exist
    389                 assert( (owner_xp != XPTR_NULL) , __FUNCTION__,
     389                assert( (owner_xp != XPTR_NULL) ,
    390390                "TXT owner process not found\n" );
    391391
  • trunk/hal/x86_64/drivers/pic_apic.c

    r482 r492  
    8080                irq_id = iopic_input.txt[channel];
    8181        else
    82                 assert(false, __FUNCTION__, "unsupported device\n");
     82                assert(false, "unsupported device\n");
    8383
    8484        /* get the ISR pointer */
     
    109109                irq_id = iopic_input.txt[channel];
    110110        else
    111                 assert(false, __FUNCTION__, "unsupported device\n");
     111                assert(false, "unsupported device\n");
    112112
    113113        /* enable the line */
     
    128128                irq_id = iopic_input.txt[channel];
    129129        else
    130                 assert(false, __FUNCTION__, "unsupported device\n");
     130                assert(false, "unsupported device\n");
    131131
    132132        /* disable the line */
Note: See TracChangeset for help on using the changeset viewer.