Ignore:
Timestamp:
Mar 28, 2018, 2:40:29 PM (7 years ago)
Author:
alain
Message:

Fix various bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/kernel_init.c

    r436 r437  
    324324            }
    325325
    326 #if( CONFIG_KINIT_DEBUG & 0x1 )
    327 if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
     326#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
     327if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
    328328printk("\n[DBG] %s : created MMC in cluster %x / chdev = %x\n",
    329329__FUNCTION__ , local_cxy , chdev_ptr );
     
    353353                chdev_dir.dma[channel] = XPTR( local_cxy , chdev_ptr );
    354354
    355 #if( CONFIG_KINIT_DEBUG & 0x1 )
    356 if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
     355#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
     356if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
    357357printk("\n[DBG] %s : created DMA[%d] in cluster %x / chdev = %x\n",
    358358__FUNCTION__ , channel , local_cxy , chdev_ptr );
     
    488488                    }
    489489
    490 #if( CONFIG_KINIT_DEBUG & 0x1 )
    491 if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
     490#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
     491if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
    492492printk("\n[DBG] %s : create chdev %s / channel = %d / rx = %d / cluster %x / chdev = %x\n",
    493493__FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy , chdev );
     
    623623    }
    624624
    625 #if( CONFIG_KINIT_DEBUG & 0x1 )
    626 if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
     625#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
     626if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
    627627{
    628628    printk("\n[DBG] %s created PIC chdev in cluster %x at cycle %d\n",
     
    792792    thread->core = &LOCAL_CLUSTER->core_tbl[core_lid];
    793793
    794 #if CONFIG_LOCKS_DEBUG
     794    // each core initializes the idle thread lists of locks
    795795    list_root_init( &thread->locks_root );
    796796    xlist_root_init( XPTR( local_cxy , &thread->xlocks_root ) );
    797 #endif
     797    thread->local_locks = 0;
     798    thread->remote_locks = 0;
    798799
    799800    // CP0 in I/O cluster initialises TXT0 chdev descriptor
     
    804805                                        (info->x_size * info->y_size) );
    805806    barrier_wait( &local_barrier , info->cores_nr );
    806 
    807     if( (core_lid ==  0) && (local_cxy == 0) )
    808     kinit_dmsg("\n[DBG] %s : exit barrier 0 : TXT0 initialized / cycle %d\n",
    809     __FUNCTION__, hal_time_stamp() );
     807    /////////////////////////////////////////////////////////////////////////////////
     808
     809#if CONFIG_DEBUG_KERNEL_INIT
     810if( (core_lid ==  0) && (local_cxy == 0) )
     811printk("\n[DBG] %s : exit barrier 0 : TXT0 initialized / cycle %d\n",
     812__FUNCTION__, (uint32_t)hal_get_cycles() );
     813#endif
    810814
    811815    /////////////////////////////////////////////////////////////////////////////
     
    841845    /////////////////////////////////////////////////////////////////////////////////
    842846
    843     if( (core_lid ==  0) && (local_cxy == 0) )
    844     kinit_dmsg("\n[DBG] %s : exit barrier 1 : clusters initialised / cycle %d\n",
    845     __FUNCTION__, hal_time_stamp() );
     847#if CONFIG_DEBUG_KERNEL_INIT
     848if( (core_lid ==  0) && (local_cxy == 0) )
     849printk("\n[DBG] %s : exit barrier 1 : clusters initialised / cycle %d\n",
     850__FUNCTION__, (uint32_t)hal_get_cycles() );
     851#endif
    846852
    847853    /////////////////////////////////////////////////////////////////////////////////
     
    866872    ////////////////////////////////////////////////////////////////////////////////
    867873
    868     if( (core_lid ==  0) && (local_cxy == 0) )
    869     kinit_dmsg("\n[DBG] %s : exit barrier 2 : PIC initialised / cycle %d\n",
    870     __FUNCTION__, hal_time_stamp() );
     874#if CONFIG_DEBUG_KERNEL_INIT
     875if( (core_lid ==  0) && (local_cxy == 0) )
     876printk("\n[DBG] %s : exit barrier 2 : PIC initialised / cycle %d\n",
     877__FUNCTION__, (uint32_t)hal_get_cycles() );
     878#endif
    871879
    872880    ////////////////////////////////////////////////////////////////////////////////
     
    897905    /////////////////////////////////////////////////////////////////////////////////
    898906
    899     if( (core_lid ==  0) && (local_cxy == 0) )
    900     kinit_dmsg("\n[DBG] %s : exit barrier 3 : all chdev initialised / cycle %d\n",
    901                __FUNCTION__, hal_time_stamp());
    902 
     907#if CONFIG_DEBUG_KERNEL_INIT
     908if( (core_lid ==  0) && (local_cxy == 0) )
     909printk("\n[DBG] %s : exit barrier 3 : all chdev initialised / cycle %d\n",
     910__FUNCTION__, (uint32_t)hal_get_cycles() );
     911#endif
     912
     913#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
     914chdev_dir_display();
     915#endif
     916   
    903917    /////////////////////////////////////////////////////////////////////////////////
    904918    // STEP 4 : All cores enable IPI (Inter Procesor Interrupt),
     
    908922    /////////////////////////////////////////////////////////////////////////////////
    909923
    910 #if CONFIG_KINIT_DEBUG
    911 chdev_dir_display();
    912 #endif
    913    
    914924    // All cores enable the shared IPI channel
    915925    dev_pic_enable_ipi();
     
    932942    core->scheduler.idle = thread;
    933943
    934 #if CONFIG_KINIT_DEBUG
     944#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
    935945sched_display( core_lid );
    936946#endif
     
    10041014    /////////////////////////////////////////////////////////////////////////////////
    10051015
    1006     if( (core_lid ==  0) && (local_cxy == 0) )
    1007     kinit_dmsg("\n[DBG] %s : exit barrier 4 : VFS_root = %l in cluster 0 / cycle %d\n",
    1008                __FUNCTION__, vfs_root_inode_xp , hal_time_stamp());
     1016#if CONFIG_DEBUG_KERNEL_INIT
     1017if( (core_lid ==  0) && (local_cxy == 0) )
     1018printk("\n[DBG] %s : exit barrier 4 : VFS_root = %l in cluster 0 / cycle %d\n",
     1019__FUNCTION__, vfs_root_inode_xp , (uint32_t)hal_get_cycles());
     1020#endif
    10091021
    10101022    /////////////////////////////////////////////////////////////////////////////////
     
    10631075    /////////////////////////////////////////////////////////////////////////////////
    10641076
    1065     if( (core_lid ==  0) && (local_cxy == 0) )
    1066     kinit_dmsg("\n[DBG] %s : exit barrier 5 : VFS_root = %l in cluster IO / cycle %d\n",
    1067     __FUNCTION__, vfs_root_inode_xp , hal_time_stamp() );
     1077#if CONFIG_DEBUG_KERNEL_INIT
     1078if( (core_lid ==  0) && (local_cxy == io_cxy) )
     1079printk("\n[DBG] %s : exit barrier 5 : VFS_root = %l in cluster %x / cycle %d\n",
     1080__FUNCTION__, vfs_root_inode_xp , io_cxy , (uint32_t)hal_get_cycles());
     1081#endif
    10681082
    10691083    /////////////////////////////////////////////////////////////////////////////////
     
    10961110    /////////////////////////////////////////////////////////////////////////////////
    10971111
    1098     if( (core_lid ==  0) && (local_cxy == 0) )
    1099     kinit_dmsg("\n[DBG] %s : exit barrier 6 : dev_root = %l in cluster IO / cycle %d\n",
    1100     __FUNCTION__, devfs_dev_inode_xp , hal_time_stamp() );
     1112#if CONFIG_DEBUG_KERNEL_INIT
     1113if( (core_lid ==  0) && (local_cxy == io_cxy) )
     1114printk("\n[DBG] %s : exit barrier 6 : dev_root = %l in cluster %x / cycle %d\n",
     1115__FUNCTION__, devfs_dev_inode_xp , io_cxy , (uint32_t)hal_get_cycles() );
     1116#endif
    11011117
    11021118    /////////////////////////////////////////////////////////////////////////////////
     
    11331149    /////////////////////////////////////////////////////////////////////////////////
    11341150
     1151#if CONFIG_DEBUG_KERNEL_INIT
     1152if( (core_lid ==  0) && (local_cxy == 0) )
     1153printk("\n[DBG] %s : exit barrier 7 : dev_root = %l in cluster 0 / cycle %d\n",
     1154__FUNCTION__, devfs_dev_inode_xp , (uint32_t)hal_get_cycles() );
     1155#endif
     1156
     1157    /////////////////////////////////////////////////////////////////////////////////
     1158    // STEP 8 : CP0 in cluster 0 creates the first user process (process_init)
     1159    /////////////////////////////////////////////////////////////////////////////////
     1160
    11351161    if( (core_lid ==  0) && (local_cxy == 0) )
    1136     kinit_dmsg("\n[DBG] %s : exit barrier 7 : dev_root = %l in cluster 0 / cycle %d\n",
    1137     __FUNCTION__, devfs_dev_inode_xp , hal_time_stamp() );
    1138 
    1139     /////////////////////////////////////////////////////////////////////////////////
    1140     // STEP 8 : CP0 in cluster 0 creates the first user process (process_init)
    1141     /////////////////////////////////////////////////////////////////////////////////
    1142 
    1143     if( (core_lid ==  0) && (local_cxy == 0) )
    1144     {
    1145 
    1146 #if CONFIG_KINIT_DEBUG
     1162    {
     1163
     1164#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
    11471165vfs_display( vfs_root_inode_xp );
    11481166#endif
     
    11571175    /////////////////////////////////////////////////////////////////////////////////
    11581176
    1159     if( (core_lid ==  0) && (local_cxy == 0) )
    1160     kinit_dmsg("\n[DBG] %s : exit barrier 8 : process init created / cycle %d\n",
    1161     __FUNCTION__ , hal_time_stamp() );
     1177#if CONFIG_DEBUG_KERNEL_INIT
     1178if( (core_lid ==  0) && (local_cxy == 0) )
     1179printk("\n[DBG] %s : exit barrier 8 : process init created / cycle %d\n",
     1180__FUNCTION__ , (uint32_t)hal_get_cycles() );
     1181#endif
    11621182
    11631183    /////////////////////////////////////////////////////////////////////////////////
     
    11691189        print_banner( (info->x_size * info->y_size) , info->cores_nr );
    11701190
    1171 #if CONFIG_KINIT_DEBUG
    1172 
    1173         printk("\n\n***** memory fooprint for main kernel objects\n\n"
     1191#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
     1192printk("\n\n***** memory fooprint for main kernel objects\n\n"
    11741193                   " - thread descriptor  : %d bytes\n"
    11751194                   " - process descriptor : %d bytes\n"
Note: See TracChangeset for help on using the changeset viewer.