Changeset 683 for trunk/kernel/kern/kernel_init.c
- Timestamp:
- Jan 13, 2021, 12:36:17 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/kernel_init.c
r669 r683 3 3 * 4 4 * Authors : Mohamed Lamine Karaoui (2015) 5 * Alain Greiner (2016,2017,2018,2019,2020)5 * Alain Greiner (2016,2017,2018,2019,2020) 6 6 * 7 7 * Copyright (c) Sorbonne Universites … … 46 46 #include <memcpy.h> 47 47 #include <ppm.h> 48 #include <kcm.h> 48 49 #include <page.h> 49 50 #include <chdev.h> … … 379 380 if( func == DEV_FUNC_MMC ) 380 381 { 381 382 // check channels383 if( channels != 1 )384 {385 printk("\n[PANIC] in %s : MMC device must be single channel\n",386 __FUNCTION__ );387 hal_core_sleep();388 }389 390 382 // create chdev in local cluster 391 383 chdev_ptr = chdev_create( func, … … 394 386 false, // direction 395 387 base ); 396 397 // check memory398 388 if( chdev_ptr == NULL ) 399 389 { … … 403 393 } 404 394 395 #if (DEBUG_KERNEL_INIT & 0x1) 396 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 397 printk("\n[%s] created chdev[%x,%x] for MMC\n", 398 __FUNCTION__ , local_cxy , chdev_ptr ); 399 #endif 405 400 // make MMC specific initialisation 406 401 dev_mmc_init( chdev_ptr ); … … 423 418 #if( DEBUG_KERNEL_INIT & 0x1 ) 424 419 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 425 printk("\n[%s] : created MMC in cluster %x / chdev = %x\n",420 printk("\n[%s] initialised chdev[%x,%x] for MMC\n", 426 421 __FUNCTION__ , local_cxy , chdev_ptr ); 427 422 #endif … … 439 434 false, // direction 440 435 base ); 441 442 // check memory443 436 if( chdev_ptr == NULL ) 444 437 { … … 448 441 } 449 442 443 #if (DEBUG_KERNEL_INIT & 0x1) 444 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 445 printk("\n[%s] cxy %x : created chdev[%x,%x] for DMA[%d]\n", 446 __FUNCTION__ , local_cxy , chdev_ptr , channel ); 447 #endif 450 448 // make DMA specific initialisation 451 449 dev_dma_init( chdev_ptr ); … … 457 455 #if( DEBUG_KERNEL_INIT & 0x1 ) 458 456 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 459 printk("\n[%s] : created DMA[%d] in cluster %x / chdev = %x\n",460 __FUNCTION__ , channel , local_cxy , chdev_ptr);457 printk("\n[%s] initialised chdev[%x,%x] for DMA[%d]\n", 458 __FUNCTION__ , local_cxy , chdev_ptr , channel ); 461 459 #endif 462 460 } … … 471 469 // These chdev descriptors are distributed on all clusters, using a modulo on a global 472 470 // index, identically computed in all clusters. 473 // This function is executed in all clusters by the core[0] core, that computes a global index474 // for all external chdevs. Each core[0] core creates only the chdevs that must be placed in475 // the local cluster, because the global index matches the local index.471 // This function is executed in all clusters by the core[0], that computes a global index 472 // for all external chdevs. Each core[0] core creates only the chdevs that must be placed 473 // in the local cluster, because the global index matches the local index. 476 474 // The relevant entries in all copies of the devices directory are initialised. 477 475 /////////////////////////////////////////////////////////////////////////////////////////// … … 499 497 dev_tbl = info->ext_dev; 500 498 501 // initializes global index (PIC is already placed in cluster 0 499 // initializes global index (PIC is already placed in cluster 0) 502 500 ext_chdev_gid = 1; 503 501 … … 529 527 530 528 // check external device functionnal type 531 if( (func != DEV_FUNC_IOB) && (func != DEV_FUNC_IOC) && (func != DEV_FUNC_TXT) && 532 (func != DEV_FUNC_NIC) && (func != DEV_FUNC_FBF) ) 529 if( (func != DEV_FUNC_IOB) && 530 (func != DEV_FUNC_IOC) && 531 (func != DEV_FUNC_TXT) && 532 (func != DEV_FUNC_NIC) && 533 (func != DEV_FUNC_FBF) ) 533 534 { 534 535 printk("\n[PANIC] in %s : undefined peripheral type\n", … … 537 538 } 538 539 539 // loop son channels540 // loop on channels 540 541 for( channel = 0 ; channel < channels ; channel++ ) 541 542 { … … 547 548 548 549 // all kernel instances compute the target cluster for all chdevs, 549 // computingthe global index ext_chdev_gid[func,channel,direction]550 // and the global index ext_chdev_gid[func,channel,direction] 550 551 cxy_t target_cxy; 551 552 while( 1 ) … … 568 569 if( target_cxy == local_cxy ) 569 570 { 570 571 #if( DEBUG_KERNEL_INIT & 0x3 )572 if( hal_time_stamp() > DEBUG_KERNEL_INIT )573 printk("\n[%s] : found chdev %s / channel = %d / rx = %d / cluster %x\n",574 __FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy );575 #endif576 571 chdev = chdev_create( func, 577 572 impl, … … 587 582 } 588 583 584 #if (DEBUG_KERNEL_INIT & 0x1) 585 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 586 printk("\n[%s] created chdev[%x,%x] for %s[%d] / is_rx %d\n", 587 __FUNCTION__ , local_cxy , chdev , chdev_func_str(func) , channel , rx ); 588 #endif 589 589 // make device type specific initialisation 590 590 if ( func == DEV_FUNC_IOB ) dev_iob_init( chdev ); … … 621 621 } 622 622 623 #if( DEBUG_KERNEL_INIT & 0x3)623 #if( DEBUG_KERNEL_INIT & 1 ) 624 624 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 625 printk("\n[%s] : created chdev %s / channel = %d / rx = %d / cluster %x / chdev = %x\n", 626 __FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy , chdev ); 627 #endif 625 printk("\n[%s] initialised chdev[%x,%x] for %s\n", 626 __FUNCTION__ , local_cxy, chdev , chdev->name ); 627 #endif 628 628 629 } // end if match 629 630 … … 637 638 638 639 /////////////////////////////////////////////////////////////////////////////////////////// 639 // This function is called by core[0] in cluster 0to allocate memory and initialize the PIC640 // This function is called by core[0][0] to allocate memory and initialize the PIC 640 641 // device, namely the informations attached to the external IOPIC controller, that 641 642 // must be replicated in all clusters (struct iopic_input). … … 1102 1103 // and allocates memory for the corresponding chdev descriptors. 1103 1104 if( core_lid == 0 ) internal_devices_init( info ); 1104 1105 1105 1106 1106 // All core[0]s contribute to initialise external peripheral chdev descriptors. … … 1494 1494 " - core descriptor : %d bytes\n" 1495 1495 " - scheduler : %d bytes\n" 1496 " - socket 1496 " - socket descriptor : %d bytes\n" 1497 1497 " - rpc fifo : %d bytes\n" 1498 1498 " - page descriptor : %d bytes\n" … … 1501 1501 " - ppm manager : %d bytes\n" 1502 1502 " - kcm manager : %d bytes\n" 1503 " - khm manager : %d bytes\n"1504 1503 " - vmm manager : %d bytes\n" 1505 1504 " - vfs inode : %d bytes\n" … … 1529 1528 sizeof( ppm_t ), 1530 1529 sizeof( kcm_t ), 1531 sizeof( khm_t ),1532 1530 sizeof( vmm_t ), 1533 1531 sizeof( vfs_inode_t ), … … 1546 1544 #endif 1547 1545 1546 // number of cycles per TICK (depends on the actual system clock frequency 1547 uint32_t cycles_per_tick = cluster->sys_clk / CONFIG_SCHED_TICKS_PER_SECOND; 1548 1548 1549 // each core activates its private TICK IRQ 1549 dev_pic_enable_timer( CONFIG_SCHED_TICK_MS_PERIOD);1550 dev_pic_enable_timer( cycles_per_tick ); 1550 1551 1551 1552 /////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.