Changeset 13 for trunk


Ignore:
Timestamp:
May 3, 2017, 1:21:35 PM (8 years ago)
Author:
alain
Message:

Few changes in the boot_info structure.

Location:
trunk/tools
Files:
3 edited

Legend:

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

    r6 r13  
    2626
    2727#include <hal_types.h>
    28 #include <almos_config.h>
     28#include <kernel_config.h>
    2929
    3030/*********************************************************************************************
     
    7070{
    7171    uint64_t    base;                 /*! segment physical base address                     */
    72     uint64_t    size;                 /*! channel size (bytes)                              */
    7372    uint32_t    type;                 /*! peripheral type (func | impl)                     */
    7473    uint32_t    channels;             /*! number of channels                                */
     
    111110        uint32_t      cores_nr;                      /*! number of local cores in               */
    112111    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
    115116    uint32_t      pages_nr;                      /*! number of 4 Kbytes pages               */
    116117    uint32_t      pages_offset;                  /*! number of pages allocated for kernel   */
  • trunk/tools/bootloader_tsar/boot.c

    r6 r13  
    7272#include <hal_types.h>
    7373
    74 #include <almos_config.h>
     74#include <kernel_config.h>
    7575#include <boot_config.h>
    7676
     
    349349    boot_device_t      * boot_dev;
    350350
    351 #if DEBUG_BOOT_INFO
    352 boot_printf("\n[BOOT INFO] %s : enter for cluster %x at cycle %d\n",
    353             __FUNCTION__ , cxy , boot_get_proctime() );
    354 #endif
    355 
    356351    // get pointer on ARCHINFO header  and on the four arch_info arrays
    357352    header       = (archinfo_header_t*)ARCHINFO_BASE;
     
    398393    }
    399394
    400     // loop on all arch-info peripherals in IO_cluster,
     395    // loop on arch-info peripherals in io_cluster,
    401396    // to initialize the boot_info array of external peripherals
    402397
    403398#if DEBUG_BOOT_INFO
    404 boot_printf("\n[BOOT INFO] %s : External peripherals\n", __FUNCTION__ );
     399boot_printf("\n[BOOT INFO] %s : external peripherals at cycle %d\n",
     400            __FUNCTION__ , cxy , boot_get_proctime() );
    405401#endif
    406402
     
    420416            boot_dev->type     = device->type;
    421417            boot_dev->base     = device->base;
    422             boot_dev->size     = device->size;
    423418            boot_dev->channels = device->channels;
    424419            boot_dev->param0   = device->arg0;   
     
    429424
    430425            device_id++;
    431         }
    432426
    433427#if DEBUG_BOOT_INFO
     
    436430            device->channels , device->irqs );   
    437431#endif
     432        }
    438433   
    439434        // Initialize array of irq descriptors for PIC
     
    460455            }
    461456        }
    462     }
     457    }   // end loop on io_cluster peripherals
    463458
    464459    // initialize number of external peripherals
     
    492487    boot_info->cores_nr = core_id;
    493488
    494     // loop on all peripherals in my_cluster to initialise
    495     // boot_info array of internal peripherals in my_cluster
     489    // initialise internal devices (RAM, XCU, MMC, DMA)
     490    // set default values, then scan all local devices
    496491
    497492#if DEBUG_BOOT_INFO
     
    499494#endif
    500495
    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
    502501    for (device = &device_base[my_cluster->device_offset];
    503502         device < &device_base[my_cluster->device_offset + my_cluster->devices];
    504503         device++ )
    505504    {
    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)
    511506        {
    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
     532boot_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;
    513539
    514540            boot_dev->type     = device->type;
    515541            boot_dev->base     = device->base;
    516             boot_dev->size     = device->size;
    517542            boot_dev->channels = device->channels;
    518543            boot_dev->param0   = device->arg0;   
     
    521546            boot_dev->param3   = device->arg3;   
    522547            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
     550boot_printf("  - XCU : base = %l / size = %l / channels = %d / irqs = %d\n",
     551            device->base , device->size , device->channels , device->irqs );   
     552#endif
     553
    569554            for (irq_id = 0; irq_id < CONFIG_MAX_HWIS_PER_ICU; irq_id++)
    570555            {
     
    588573            }
    589574        }
    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
     585boot_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
     599boot_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
    594604
    595605    // set boot_info signature
     
    694704    unsigned int     core_id;        // Iterator on cores
    695705
    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    {
    706711
    707712#if DEBUG_BOOT_WAKUP
     
    709714             boot_info->cxy , core_id , boot_get_proctime() );
    710715#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 );
    715717    }
    716718} // boot_wake_local_cores()
     
    884886    }
    885887
    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,
    891906    // reset the BEV bit in status register,
    892907    // register "boot_info" argument in a0,
     
    900915                  "move  $29,  %1            \n"
    901916                  "jr    %2                  \n"
    902                   :: "r"(boot_info) , "r"(stack_ptr) , "r"(kernel_entry) );
     917                  :: "r"(boot_info) , "r"(sp) , "r"(kernel_entry) );
    903918
    904919} // boot_loader()
  • trunk/tools/bootloader_tsar/boot_config.h

    r6 r13  
    1010#define DEBUG_BOOT_ELF      0
    1111#define DEBUG_BOOT_IOC      0
    12 #define DEBUG_BOOT_WAKUP    1
     12#define DEBUG_BOOT_WAKUP    0
    1313#define DEBUG_BOOT_FAT32    0
    1414
Note: See TracChangeset for help on using the changeset viewer.