Changeset 50 for trunk/tools


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

bloup

Location:
trunk/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/arch_info/boot_info.h

    r13 r50  
    22 * boot_info.h - informations passed by the bootloader to the kernel in each cluster.
    33 *
    4  * Author  Alain Greiner (june 2016)
     4 * Author  Alain Greiner (june 2016,2017)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    8282
    8383/*********************************************************************************************
     84 * This structure defines a reserved zone in the physical address space of a given cluster.
     85 * A reserved zone is described as a set of contiguous small pages (4 Kbytes) covering the
     86 * reserved zone, that must be considered already allocated.
     87 ********************************************************************************************/
     88
     89typedef struct boot_rsvd_s
     90{
     91    ppn_t      first_page;            /*! first physical page index in cluster              */
     92    uint32_t   npages;                /*! number of small pages                             */
     93}
     94boot_rsvd_t;
     95
     96/*********************************************************************************************
    8497 * This structure defines the interface between the boot-loader and the kernel.
    8598 * In each cluster, the boot core build a local boot_info_t structure containing
     
    110123        uint32_t      cores_nr;                      /*! number of local cores in               */
    111124    boot_core_t   core[CONFIG_MAX_LOCAL_CORES];  /*! array of core descriptors              */ 
     125    uint32_t      rsvd_nr;                       /*! number of reserved zones               */
     126    boot_rsvd_t   rsvd[CONFIG_PPM_MAX_RSVD];     /*! array of reserved zones                */
    112127        boot_device_t dev_icu;                       /*! embedded ICU peripheral                */
    113128        boot_device_t dev_mmc;                       /*! embedded MMC peripheral                */
    114129        boot_device_t dev_dma;                       /*! embedded DMA peripheral                */
    115130
    116     uint32_t      pages_nr;                      /*! number of 4 Kbytes pages               */
    117     uint32_t      pages_offset;                  /*! number of pages allocated for kernel   */
     131    uint32_t      pages_offset;                  /*! first free page index (after kernel)   */
     132    uint32_t      pages_nr;                      /*! total number of physical pages in RAM  */
    118133
    119134    // kernel segments
    120135
    121     intptr_t      kernel_code_start;             /*! kernel code base address               */
    122     intptr_t      kernel_code_end;               /*! kernel code last address (excluded)    */
    123     intptr_t      kernel_data_start;             /*! kernel data base address               */
    124     intptr_t      kernel_data_end;               /*! kernel data last address (excluded)    */
     136    intptr_t      kernel_code_start;             /*! kernel code base paddr                 */
     137    intptr_t      kernel_code_end;               /*! kernel code last paddr (excluded)      */
     138    intptr_t      kernel_data_start;             /*! kernel data base paddr                 */
     139    intptr_t      kernel_data_end;               /*! kernel data last paddr (excluded)      */
    125140}
    126141boot_info_t;
  • 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.