Ignore:
Timestamp:
Oct 5, 2018, 12:02:49 AM (6 years ago)
Author:
alain
Message:

omplete restructuration of kernel locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/fs/devfs.c

    r494 r568  
    5252#endif
    5353
    54 ///////////////////////////////
     54/////////////////////////////////////
    5555devfs_ctx_t * devfs_ctx_alloc( void )
    5656{
     
    9191{
    9292    error_t  error;
    93 
    94 #if DEBUG_DEVFS_INIT
    95 uint32_t cycle = (uint32_t)hal_get_cycles();
    96 if( DEBUG_DEVFS_INIT < cycle )
    97 printk("\n[DBG] %s : thread %x enter at cycle %d\n",
    98 __FUNCTION__ , CURRENT_THREAD , cycle );
    99 #endif
    10093
    10194    // creates DEVFS "dev" inode in cluster 0
     
    110103    assert( (error == 0) , "cannot create <dev>\n" );
    111104
    112 #if( DEBUG_DEVFS_INIT & 1 )
    113 if( DEBUG_DEVFS_INIT < cycle )
    114 printk("\n[DBG] %s : created <dev> inode at cycle %d\n", __FUNCTION__, cycle );
     105#if DEBUG_DEVFS_INIT
     106uint32_t cycle = (uint32_t)hal_get_cycles();
     107if( DEBUG_DEVFS_INIT < cycle )
     108printk("\n[DBG] %s : thread %x in process %x created <dev> inode / cycle %d\n",
     109__FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid ,cycle );
    115110#endif
    116111
     
    129124cycle = (uint32_t)hal_get_cycles();
    130125if( DEBUG_DEVFS_INIT < cycle )
    131 printk("\n[DBG] %s : thread %x exit at cycle %d\n",
    132 __FUNCTION__ , CURRENT_THREAD , cycle );
     126printk("\n[DBG] %s : thread %x in process %x created <external> inode / cycle %d\n",
     127__FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid , cycle );
    133128#endif
    134129
     
    147142    uint32_t      channel;
    148143
    149 #if DEBUG_DEVFS_INIT
    150 uint32_t cycle = (uint32_t)hal_get_cycles();
    151 if( DEBUG_DEVFS_INIT < cycle )
    152 printk("\n[DBG] %s : thread %x enter at cycle %d\n",
    153 __FUNCTION__ , CURRENT_THREAD , cycle );
    154 #endif
    155 
    156     // create "internal" directory linked to "dev"
     144    // create "internal" directory
    157145    snprintf( node_name , 16 , "internal_%x" , local_cxy );
    158146    vfs_add_child_in_parent( local_cxy,
     
    163151                             NULL,
    164152                             devfs_internal_inode_xp );
     153#if DEBUG_DEVFS_INIT
     154uint32_t cycle = (uint32_t)hal_get_cycles();
     155trdid_t  trdid = CURRENT_THREAD->trdid;
     156pid_t    pid   = CURRENT_THREAD->process->pid;
     157if( DEBUG_DEVFS_INIT < cycle )
     158printk("\n[DBG] %s : thread %x in process %x created <%s> in cluster %x / cycle %d\n",
     159__FUNCTION__, trdid, pid, node_name, local_cxy, cycle );
     160#endif
    165161
    166162    // create MMC chdev inode
     
    176172                                 GET_PTR( chdev_xp ),
    177173                                 &inode_xp );
     174#if DEBUG_DEVFS_INIT
     175cycle = (uint32_t)hal_get_cycles();
     176if( DEBUG_DEVFS_INIT < cycle )
     177printk("\n[DBG] %s : thread %x in process %x created <mmc> inode in cluster %x\n",
     178__FUNCTION__, trdid, pid, local_cxy, cycle );
     179#endif
     180
    178181    }
    179182
     
    192195                                     GET_PTR( chdev_xp ),
    193196                                     &inode_xp );
     197#if DEBUG_DEVFS_INIT
     198cycle = (uint32_t)hal_get_cycles();
     199if( DEBUG_DEVFS_INIT < cycle )
     200printk("\n[DBG] %s : thread %x in process %x created <dma[%d]> inode in cluster %x\n",
     201__FUNCTION__, trdid, pid, channel, local_cxy, cycle );
     202#endif
    194203        }
    195204    }
     
    210219                                     GET_PTR( chdev_xp ),
    211220                                     &inode_xp );
     221#if DEBUG_DEVFS_INIT
     222cycle = (uint32_t)hal_get_cycles();
     223if( DEBUG_DEVFS_INIT < cycle )
     224printk("\n[DBG] %s : thread %x in process %x created <iob> inode in cluster %x\n",
     225__FUNCTION__, trdid, pid, local_cxy, cycle );
     226#endif
    212227        }
    213228    }
     
    228243                                     GET_PTR( chdev_xp ),
    229244                                     &inode_xp );
     245#if DEBUG_DEVFS_INIT
     246cycle = (uint32_t)hal_get_cycles();
     247if( DEBUG_DEVFS_INIT < cycle )
     248printk("\n[DBG] %s : thread %x in process %x created <pic> inode in cluster %x\n",
     249__FUNCTION__, trdid, pid, local_cxy, cycle );
     250#endif
    230251        }
    231252    }
     
    248269                                         GET_PTR( chdev_xp ),
    249270                                         &inode_xp );
     271#if DEBUG_DEVFS_INIT
     272cycle = (uint32_t)hal_get_cycles();
     273if( DEBUG_DEVFS_INIT < cycle )
     274printk("\n[DBG] %s : thread %x in process %x created <txt_rx[%d]> inode in cluster %x\n",
     275__FUNCTION__, trdid, pid, channel, local_cxy, cycle );
     276#endif
    250277            }
    251278        }
     
    269296                                         GET_PTR( chdev_xp ),
    270297                                         &inode_xp );
     298#if DEBUG_DEVFS_INIT
     299cycle = (uint32_t)hal_get_cycles();
     300if( DEBUG_DEVFS_INIT < cycle )
     301printk("\n[DBG] %s : thread %x in process %x created <txt_tx[%d]> inode in cluster %x\n",
     302__FUNCTION__, trdid, pid, channel, local_cxy, cycle );
     303#endif
    271304            }
    272305        }
     
    290323                                         GET_PTR( chdev_xp ),
    291324                                         &inode_xp );
     325#if DEBUG_DEVFS_INIT
     326cycle = (uint32_t)hal_get_cycles();
     327if( DEBUG_DEVFS_INIT < cycle )
     328printk("\n[DBG] %s : thread %x in process %x created <ioc[%d]> inode in cluster %x\n",
     329__FUNCTION__, trdid, pid, channel, local_cxy, cycle );
     330#endif
    292331            }
    293332        }
     
    295334
    296335    // create a FBF inode in each cluster containing a FBF chdev
    297     for( channel = 0 ; channel < CONFIG_MAX_IOC_CHANNELS ; channel++ )
     336    for( channel = 0 ; channel < CONFIG_MAX_FBF_CHANNELS ; channel++ )
    298337    {
    299338        chdev_xp = chdev_dir.fbf[channel];
     
    311350                                         GET_PTR( chdev_xp ),
    312351                                         &inode_xp );
     352#if DEBUG_DEVFS_INIT
     353cycle = (uint32_t)hal_get_cycles();
     354if( DEBUG_DEVFS_INIT < cycle )
     355printk("\n[DBG] %s : thread %x in process %x created <fbf[%d]> inode in cluster %x\n",
     356__FUNCTION__, trdid, pid, channel, local_cxy, cycle );
     357#endif
    313358            }
    314359        }
     
    332377                                         GET_PTR( chdev_xp ),
    333378                                         &inode_xp );
     379#if DEBUG_DEVFS_INIT
     380cycle = (uint32_t)hal_get_cycles();
     381if( DEBUG_DEVFS_INIT < cycle )
     382printk("\n[DBG] %s : thread %x in process %x created <nic_rx[%d]> inode in cluster %x\n",
     383__FUNCTION__, trdid, pid, channel, local_cxy, cycle );
     384#endif
    334385            }
    335386        }
     
    353404                                         GET_PTR( chdev_xp ),
    354405                                         &inode_xp );
    355             }
    356         }
    357     }
    358 
    359 #if DEBUG_DEVFS_INIT
    360 cycle = (uint32_t)hal_get_cycles();
    361 if( DEBUG_DEVFS_INIT < cycle )
    362 printk("\n[DBG] %s : thread %x exit at cycle %d\n",
    363 __FUNCTION__ , CURRENT_THREAD , cycle );
    364 #endif
    365 
     406#if DEBUG_DEVFS_INIT
     407cycle = (uint32_t)hal_get_cycles();
     408if( DEBUG_DEVFS_INIT < cycle )
     409printk("\n[DBG] %s : thread %x in process %x created <nic_tx[%d]> inode in cluster %x\n",
     410__FUNCTION__, trdid, pid, channel, local_cxy, cycle );
     411#endif
     412            }
     413        }
     414    }
    366415}  // end devfs_local_init()
    367416
     
    408457
    409458    // get chdev functionnal type and channel
    410     func    = hal_remote_lw( XPTR( chdev_cxy , &chdev_ptr->func ) );
    411     channel = hal_remote_lw( XPTR( chdev_cxy , &chdev_ptr->channel ) );
     459    func    = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->func ) );
     460    channel = hal_remote_l32( XPTR( chdev_cxy , &chdev_ptr->channel ) );
    412461
    413462    // action depends on "func" and "to_buffer"
Note: See TracChangeset for help on using the changeset viewer.