Ignore:
Timestamp:
Jun 26, 2017, 3:15:11 PM (7 years ago)
Author:
alain
Message:

bloup

Location:
trunk/tools/bootloader_tsar
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/bootloader_tsar/boot.c

    r13 r50  
    2626 *                                                                          *
    2727 * It supports clusterised shared memory multi-processor architectures,     *
    28  * where each processor is identified by a composite index [cxy,lid],       *
     28 * where each processor core is identified by a composite index [cxy,lid]   *
    2929 * with one physical memory bank per cluster.                               *
    3030 *                                                                          *
    3131 * The 'boot.elf' file (containing the boot-loader binary code) is stored   *
    32  * on disk and is loaded into memory by bscpu (whose index is [0,0]),       *
    33  * executing the generic preloader.                                         *
     32 * on disk and is loaded into memory by core[0,0] (cxy = 0 / lid = 0),      *
     33 * and is copied in each other cluter by the local CP0 (lid = 0].           *
    3434 *                                                                          *
    35  * 1) The boot-loader first phase is executed by bscpu only, while          *
     35 * 1) The boot-loader first phase is executed by core[0,0], while           *
    3636 *    all other cores are waiting in the preloader.                         *
    3737 *    It does the following tasks:                                          *
    38  *      - load into the memory bank of cluster (0,0) the 'arch_info.bin'    *
     38 *      - load into the memory bank of cluster 0 the 'arch_info.bin'        *
    3939 *        file (containing the hardware architecture description) and the   *
    4040 *        'kernel.elf' file, at temporary locations,                        *   
     
    4747 *                                                                          *
    4848 * 2) The boot-loader second phase is then executed in parallel by all      *
    49  *    CP0s (other than bscpu). Each CP0 performs the following tasks:       *
     49 *    CP0s (other than core[0,0]). Each CP0 performs the following tasks:   *
    5050 *      - copies into the memory bank of the local cluster the 'boot.elf',  *
    5151 *        the 'arch_info.bin' (at the same addresses as the 'boot.elf' and  *
     
    5959 * 3) The boot-loader third phase is executed in parallel by all cores.     *
    6060 *    After passing the global barrier the bscpu:                           *
    61  *      - activates the CPi of cluster(0,0),                                *
     61 *      - activates the CPi of cluster(0),                                  *
    6262 *      - blocks on the local barrier waiting for all local CPi to report   *
    6363 *        completion on the local barrier,                                  *
     
    346346    archinfo_irq_t     * irq;
    347347    uint32_t             irq_id;
    348  
     348    uint32_t             end;
     349    uint32_t             rsvd_pages;
    349350    boot_device_t      * boot_dev;
    350351
     
    364365    boot_info->io_cxy       = header->io_cxy;
    365366
    366     // Initialize kernel segments
     367    // Initialize kernel segments from global variables
    367368    boot_info->kernel_code_start = seg_kcode_base;
    368369    boot_info->kernel_code_end   = seg_kcode_base + seg_kcode_size;
     
    505506        if (device->type == DEV_TYPE_RAM_SCL)
    506507        {
    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 );
     508            // set number of physical memory pages
     509            boot_info->pages_nr   = device->size >> CONFIG_PPM_PAGE_SHIFT;
     510
     511#if DEBUG_BOOT_INFO
     512boot_printf("  - RAM : %x pages\n", boot_info->pages_nr );
    534513#endif
    535514        }
     
    602581        }
    603582    }  // end loop on local peripherals
     583
     584    // Get the top address of the kernel segments
     585    end = (boot_info->kernel_code_end > boot_info->kernel_data_end ) ?
     586          boot_info->kernel_code_end : boot_info->kernel_data_end;
     587
     588    // Get the number of pages reserved to kernel segments
     589    rsvd_pages = ( (end & CONFIG_PPM_PAGE_MASK) == 0 ) ?
     590                 (end >> CONFIG_PPM_PAGE_SHIFT) : (end >> CONFIG_PPM_PAGE_SHIFT) + 1;
     591
     592    // set the kernel code "reserved zonz"
     593    boot_info->rsvd_nr = 1;
     594    boot_info->rsvd[0].first_page = 0;
     595    boot_info->rsvd[0].npages     = rsvd_pages;
     596
     597#if DEBUG_BOOT_INFO
     598boot_printf("\n[BOOT INFO] %s : Kernel Reserved Zone / base = 0 / npages = %d at cycle %d\n",
     599            __FUNCTION__ , rsvd_pages ,boot_get_proctime() );
     600#endif
    604601
    605602    // set boot_info signature
  • trunk/tools/bootloader_tsar/boot_config.h

    r23 r50  
    77
    88// Debug options
    9 #define DEBUG_BOOT_INFO     0
     9#define DEBUG_BOOT_INFO     1
    1010#define DEBUG_BOOT_ELF      0
    1111#define DEBUG_BOOT_IOC      0
Note: See TracChangeset for help on using the changeset viewer.