- Timestamp:
- May 3, 2017, 1:21:35 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/arch_info/boot_info.h
r6 r13 26 26 27 27 #include <hal_types.h> 28 #include < almos_config.h>28 #include <kernel_config.h> 29 29 30 30 /********************************************************************************************* … … 70 70 { 71 71 uint64_t base; /*! segment physical base address */ 72 uint64_t size; /*! channel size (bytes) */73 72 uint32_t type; /*! peripheral type (func | impl) */ 74 73 uint32_t channels; /*! number of channels */ … … 111 110 uint32_t cores_nr; /*! number of local cores in */ 112 111 boot_core_t core[CONFIG_MAX_LOCAL_CORES]; /*! array of core descriptors */ 113 uint32_t int_dev_nr; /*! number of local peripherals */ 114 boot_device_t int_dev[CONFIG_MAX_INT_DEV]; /*! array of internal peripherals */ 112 boot_device_t dev_icu; /*! embedded ICU peripheral */ 113 boot_device_t dev_mmc; /*! embedded MMC peripheral */ 114 boot_device_t dev_dma; /*! embedded DMA peripheral */ 115 115 116 uint32_t pages_nr; /*! number of 4 Kbytes pages */ 116 117 uint32_t pages_offset; /*! number of pages allocated for kernel */ -
trunk/tools/bootloader_tsar/boot.c
r6 r13 72 72 #include <hal_types.h> 73 73 74 #include < almos_config.h>74 #include <kernel_config.h> 75 75 #include <boot_config.h> 76 76 … … 349 349 boot_device_t * boot_dev; 350 350 351 #if DEBUG_BOOT_INFO352 boot_printf("\n[BOOT INFO] %s : enter for cluster %x at cycle %d\n",353 __FUNCTION__ , cxy , boot_get_proctime() );354 #endif355 356 351 // get pointer on ARCHINFO header and on the four arch_info arrays 357 352 header = (archinfo_header_t*)ARCHINFO_BASE; … … 398 393 } 399 394 400 // loop on a ll arch-info peripherals in IO_cluster,395 // loop on arch-info peripherals in io_cluster, 401 396 // to initialize the boot_info array of external peripherals 402 397 403 398 #if DEBUG_BOOT_INFO 404 boot_printf("\n[BOOT INFO] %s : External peripherals\n", __FUNCTION__ ); 399 boot_printf("\n[BOOT INFO] %s : external peripherals at cycle %d\n", 400 __FUNCTION__ , cxy , boot_get_proctime() ); 405 401 #endif 406 402 … … 420 416 boot_dev->type = device->type; 421 417 boot_dev->base = device->base; 422 boot_dev->size = device->size;423 418 boot_dev->channels = device->channels; 424 419 boot_dev->param0 = device->arg0; … … 429 424 430 425 device_id++; 431 }432 426 433 427 #if DEBUG_BOOT_INFO … … 436 430 device->channels , device->irqs ); 437 431 #endif 432 } 438 433 439 434 // Initialize array of irq descriptors for PIC … … 460 455 } 461 456 } 462 } 457 } // end loop on io_cluster peripherals 463 458 464 459 // initialize number of external peripherals … … 492 487 boot_info->cores_nr = core_id; 493 488 494 // loop on all peripherals in my_cluster to initialise495 // boot_info array of internal peripherals in my_cluster489 // initialise internal devices (RAM, XCU, MMC, DMA) 490 // set default values, then scan all local devices 496 491 497 492 #if DEBUG_BOOT_INFO … … 499 494 #endif 500 495 501 device_id = 0; 496 boot_info->pages_nr = 0; 497 boot_info->dev_icu.channels = 0; 498 boot_info->dev_mmc.channels = 0; 499 boot_info->dev_dma.channels = 0; 500 502 501 for (device = &device_base[my_cluster->device_offset]; 503 502 device < &device_base[my_cluster->device_offset + my_cluster->devices]; 504 503 device++ ) 505 504 { 506 // initialise one entry for each internal peripheral 507 if( (device->type == DEV_TYPE_RAM_SCL) || 508 (device->type == DEV_TYPE_ICU_XCU) || 509 (device->type == DEV_TYPE_MMC_TSR) || 510 (device->type == DEV_TYPE_DMA_SCL) ) 505 if (device->type == DEV_TYPE_RAM_SCL) 511 506 { 512 boot_dev = &boot_info->int_dev[device_id]; 507 // set total number of physical memory pages in cluster 508 boot_info->pages_nr = device->size >> CONFIG_PPM_PAGE_SHIFT; 509 510 // Get the last address allocated for the kernel segments 511 uint32_t end; 512 if( boot_info->kernel_code_end > boot_info->kernel_data_end ) 513 { 514 end = boot_info->kernel_code_end; 515 } 516 else 517 { 518 end = boot_info->kernel_data_end; 519 } 520 521 // Compute the number of pages allocated for the kernel. 522 if( (end & CONFIG_PPM_PAGE_MASK) == 0 ) 523 { 524 boot_info->pages_offset = end >> CONFIG_PPM_PAGE_SHIFT; 525 } 526 else 527 { 528 boot_info->pages_offset = (end >> CONFIG_PPM_PAGE_SHIFT) + 1; 529 } 530 531 #if DEBUG_BOOT_INFO 532 boot_printf(" - RAM : %x pages / first free page = %x\n", 533 boot_info->pages_nr , boot_info->pages_offset ); 534 #endif 535 } 536 else if (device->type == DEV_TYPE_ICU_XCU) 537 { 538 boot_dev = &boot_info->dev_icu; 513 539 514 540 boot_dev->type = device->type; 515 541 boot_dev->base = device->base; 516 boot_dev->size = device->size;517 542 boot_dev->channels = device->channels; 518 543 boot_dev->param0 = device->arg0; … … 521 546 boot_dev->param3 = device->arg3; 522 547 boot_dev->irqs = device->irqs; 523 524 device_id++; 525 } 526 527 #if DEBUG_BOOT_INFO 528 boot_printf(" - %s : base = %l / size = %l / channels = %d / irqs = %d\n", 529 device_type_str( device->type ) , device->base , device->size , 530 device->channels , device->irqs ); 531 #endif 532 533 // Initialize information about physical memory in cluster 534 if (device->type == DEV_TYPE_RAM_SCL) 535 { 536 // Compute total number of physical memory pages in cluster 537 boot_info->pages_nr = device->size >> CONFIG_PPM_PAGE_SHIFT; 538 539 // Get the last address allocated for the kernel segments 540 uint32_t end; 541 if( boot_info->kernel_code_end > boot_info->kernel_data_end ) 542 { 543 end = boot_info->kernel_code_end; 544 } 545 else 546 { 547 end = boot_info->kernel_data_end; 548 } 549 550 // Compute the number of pages allocated for the kernel. 551 if( (end & CONFIG_PPM_PAGE_MASK) == 0 ) 552 { 553 boot_info->pages_offset = end >> CONFIG_PPM_PAGE_SHIFT; 554 } 555 else 556 { 557 boot_info->pages_offset = (end >> CONFIG_PPM_PAGE_SHIFT) + 1; 558 } 559 560 #if DEBUG_BOOT_INFO 561 boot_printf(" . physical memory : %x pages / first free page = %x\n", 562 boot_info->pages_nr , boot_info->pages_offset ); 563 #endif 564 } 565 566 // Initialize array of irq descriptors for XCU 567 if (device->type == DEV_TYPE_ICU_XCU) 568 { 548 549 #if DEBUG_BOOT_INFO 550 boot_printf(" - XCU : base = %l / size = %l / channels = %d / irqs = %d\n", 551 device->base , device->size , device->channels , device->irqs ); 552 #endif 553 569 554 for (irq_id = 0; irq_id < CONFIG_MAX_HWIS_PER_ICU; irq_id++) 570 555 { … … 588 573 } 589 574 } 590 } 591 592 // initialize number of internal peripherals in my_cluster 593 boot_info->int_dev_nr = device_id; 575 else if( device->type == DEV_TYPE_MMC_TSR ) 576 { 577 boot_dev = &boot_info->dev_mmc; 578 579 boot_dev->type = device->type; 580 boot_dev->base = device->base; 581 boot_dev->channels = device->channels; 582 boot_dev->irqs = 0; 583 584 #if DEBUG_BOOT_INFO 585 boot_printf(" - MMC : base = %l / size = %l / channels = %d / irqs = %d\n", 586 device->base , device->size , device->channels , device->irqs ); 587 #endif 588 } 589 else if( device->type == DEV_TYPE_DMA_SCL ) 590 { 591 boot_dev = &boot_info->dev_dma; 592 593 boot_dev->type = device->type; 594 boot_dev->base = device->base; 595 boot_dev->channels = device->channels; 596 boot_dev->irqs = 0; 597 598 #if DEBUG_BOOT_INFO 599 boot_printf(" - DMA : base = %l / size = %l / channels = %d / irqs = %d\n", 600 device->base , device->size , device->channels , device->irqs ); 601 #endif 602 } 603 } // end loop on local peripherals 594 604 595 605 // set boot_info signature … … 694 704 unsigned int core_id; // Iterator on cores 695 705 696 // loop on devices to find XCU 697 for (device = &boot_info->int_dev[0]; 698 device < &boot_info->int_dev[boot_info->int_dev_nr]; 699 device++) 700 { 701 if (device->type == DEV_TYPE_ICU_XCU) 702 { 703 // loop on cores 704 for (core_id = 1; core_id < boot_info->cores_nr; core_id++) 705 { 706 device = &boot_info->dev_icu; 707 708 // loop on cores 709 for (core_id = 1; core_id < boot_info->cores_nr; core_id++) 710 { 706 711 707 712 #if DEBUG_BOOT_WAKUP … … 709 714 boot_info->cxy , core_id , boot_get_proctime() ); 710 715 #endif 711 boot_remote_sw((xptr_t) (device->base + (core_id << 2)), 712 (uint32_t)boot_entry); 713 } 714 } 716 boot_remote_sw( (xptr_t)(device->base + (core_id << 2)) , (uint32_t)boot_entry ); 715 717 } 716 718 } // boot_wake_local_cores() … … 884 886 } 885 887 886 // Each core compute address of a temporary kernel stack 887 // in the upper part of the local cluster memory... 888 uint32_t stack_ptr = ((boot_info->pages_nr - lid) << 12) - 16; 889 890 // All cores initialise stack pointer, 888 // Ech core compute stack pointer to the kernel idle-thread descriptor. 889 // The array of idle-thread descriptors is allocated in the kdata segment, 890 // just after the boot_info structure 891 892 uint32_t sp; 893 uint32_t base; 894 uint32_t offset = sizeof( boot_info_t ); 895 uint32_t pmask = CONFIG_PPM_PAGE_MASK; 896 uint32_t psize = CONFIG_PPM_PAGE_SIZE; 897 898 // compute base address of idle thread descriptors array 899 if( offset & pmask ) base = seg_kdata_base + (offset & ~pmask) + psize; 900 else base = seg_kdata_base + offset; 901 902 // compute stack pointer 903 sp = base + ((lid + 1) * CONFIG_THREAD_DESC_SIZE) - 16; 904 905 // Each cores initialise stack pointer, 891 906 // reset the BEV bit in status register, 892 907 // register "boot_info" argument in a0, … … 900 915 "move $29, %1 \n" 901 916 "jr %2 \n" 902 :: "r"(boot_info) , "r"(s tack_ptr) , "r"(kernel_entry) );917 :: "r"(boot_info) , "r"(sp) , "r"(kernel_entry) ); 903 918 904 919 } // boot_loader() -
trunk/tools/bootloader_tsar/boot_config.h
r6 r13 10 10 #define DEBUG_BOOT_ELF 0 11 11 #define DEBUG_BOOT_IOC 0 12 #define DEBUG_BOOT_WAKUP 112 #define DEBUG_BOOT_WAKUP 0 13 13 #define DEBUG_BOOT_FAT32 0 14 14
Note: See TracChangeset
for help on using the changeset viewer.