Changeset 436


Ignore:
Timestamp:
Nov 3, 2014, 10:48:54 AM (10 years ago)
Author:
alain
Message:

Introducing dynamic allocation of peripheral channel (for TIM, TTY, CMA, NIC)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_boot/boot.c

    r433 r436  
    6363
    6464#include <giet_config.h>
     65#include <mapping_info.h>
    6566#include <mwmr_channel.h>
    6667#include <barrier.h>
     
    668669// For the vseg defined by the vseg pointer, this function register all PTEs
    669670// in one or several page tables.
    670 // It is a global vseg (system vseg) if (vspace_id == 0xFFFFFFFF).
     671// It is a global vseg (kernel vseg) if (vspace_id == 0xFFFFFFFF).
    671672// The number of involved PTABs depends on the "local" and "global" attributes:
    672673//  - PTEs are replicated in all vspaces for a global vseg.
     
    848849//
    849850// For each vseg, the mapping is done in two steps:
    850 //
    851 // A) mapping : the boot_vseg_map() function allocates contiguous BPPs
     851// 1) mapping : the boot_vseg_map() function allocates contiguous BPPs
    852852//    or SPPs (if the vseg is not associated to a peripheral), and register
    853853//    the physical base address in the vseg pbase field. It initialises the
    854854//    _ptabs_vaddr and _ptabs_paddr arrays if the vseg is a PTAB.
    855855//
    856 // B) page table initialisation : the boot_vseg_pte() function initialise
     856// 2) page table initialisation : the boot_vseg_pte() function initialise
    857857//    the PTEs (both PTE1 and PTE2) in one or several page tables:
    858858//    - PTEs are replicated in all vspaces for a global vseg.
     
    865865//   4) all private vsegs in user space.
    866866///////////////////////////////////////////////////////////////////////////////
    867 void _ptabs_init()
     867void boot_ptabs_init()
    868868{
    869869    mapping_header_t*   header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
     
    877877    if (header->vspaces == 0 )
    878878    {
    879         _puts("\n[BOOT ERROR] in _ptabs_init() : mapping ");
     879        _puts("\n[BOOT ERROR] in boot_ptabs_init() : mapping ");
    880880        _puts( header->name );
    881881        _puts(" contains no vspace\n");
     
    12781278    unsigned int lpid;          // local processor index (for several loops)
    12791279
    1280     // TTY, NIC, CMA, HBA, user timer, and WTI channel allocators to user tasks:
    1281     // - TTY[0] is reserved for the kernel
    1282     // - In all clusters the first NB_PROCS_MAX timers
    1283     //   are reserved for the kernel (context switch)
    1284     unsigned int alloc_tty_channel = 1;              // global
    1285     unsigned int alloc_nic_channel = 0;              // global
    1286     unsigned int alloc_cma_channel = 0;              // global
    1287     unsigned int alloc_hba_channel = 0;              // global
    1288     unsigned int alloc_tim_channel[X_SIZE*Y_SIZE];   // one per cluster
    1289 
    1290     // WTI allocators to processors
    1291     // In all clusters, first NB_PROCS_MAX WTIs are for WAKUP
     1280    // WTI allocators to processors (for HWIs translated to WTIs) 
     1281    // In all clusters the first NB_PROCS_MAX WTIs are reserved for WAKUP
    12921282    unsigned int alloc_wti_channel[X_SIZE*Y_SIZE];   // one per cluster
    12931283
     
    13201310_puts("]\n");
    13211311#endif
    1322         alloc_tim_channel[cluster_id] = NB_PROCS_MAX;
    13231312        alloc_wti_channel[cluster_id] = NB_PROCS_MAX;
    13241313
     
    13501339            }
    13511340
    1352             // scan peripherals to find the ICU/XCU and the PIC component
     1341            // scan peripherals to find the XCU and the PIC component
    13531342
    13541343            xcu = NULL; 
     
    13571346                  periph_id++ )
    13581347            {
    1359                 if( (periph[periph_id].type == PERIPH_TYPE_XCU) ||
    1360                     (periph[periph_id].type == PERIPH_TYPE_ICU) )
     1348                if( periph[periph_id].type == PERIPH_TYPE_XCU )
    13611349                {
    13621350                    xcu = &periph[periph_id];
     
    13791367            if ( xcu == NULL )
    13801368            {         
    1381                 _puts("\n[BOOT ERROR] No ICU / XCU component in cluster[");
     1369                _puts("\n[BOOT ERROR] No XCU component in cluster[");
    13821370                _putd( x );
    13831371                _puts(",");
     
    16501638            unsigned int ctx_ptab = _ptabs_vaddr[vspace_id][x][y];
    16511639
    1652             // ctx_tty : TTY terminal global index provided by the global allocator
    1653             //           Each user terminal is a private ressource: the number of
    1654             //           requested terminal cannot be larger than NB_TTY_CHANNELS.             
    1655             unsigned int ctx_tty = 0xFFFFFFFF;
    1656             if (task[task_id].use_tty)
    1657             {
    1658                 if (alloc_tty_channel >= NB_TTY_CHANNELS)
    1659                 {
    1660                     _puts("\n[BOOT ERROR] TTY channel index too large for task ");
    1661                     _puts(task[task_id].name);
    1662                     _puts(" in vspace ");
    1663                     _puts(vspace[vspace_id].name);
    1664                     _puts("\n");
    1665                     _exit();
    1666                 }
    1667                 ctx_tty = alloc_tty_channel;
    1668                 alloc_tty_channel++;
    1669              }
    1670 
    1671             // ctx_nic : NIC channel global index provided by the global allocator
    1672             //           Each channel is a private ressource: the number of
    1673             //           requested channels cannot be larger than NB_NIC_CHANNELS.
    1674             unsigned int ctx_nic = 0xFFFFFFFF;
    1675             if (task[task_id].use_nic)
    1676             {
    1677                 if (alloc_nic_channel >= NB_NIC_CHANNELS)
    1678                 {
    1679                     _puts("\n[BOOT ERROR] NIC channel index too large for task ");
    1680                     _puts(task[task_id].name);
    1681                     _puts(" in vspace ");
    1682                     _puts(vspace[vspace_id].name);
    1683                     _puts("\n");
    1684                     _exit();
    1685                 }
    1686                 ctx_nic = alloc_nic_channel;
    1687                 alloc_nic_channel++;
    1688             }
    1689 
    1690             // ctx_cma : CMA channel global index provided by the global allocator
    1691             //           Each channel is a private ressource: the number of
    1692             //           requested channels cannot be larger than NB_NIC_CHANNELS.
    1693             unsigned int ctx_cma = 0xFFFFFFFF;
    1694             if (task[task_id].use_cma)
    1695             {
    1696                 if (alloc_cma_channel >= NB_CMA_CHANNELS)
    1697                 {
    1698                     _puts("\n[BOOT ERROR] CMA channel index too large for task ");
    1699                     _puts(task[task_id].name);
    1700                     _puts(" in vspace ");
    1701                     _puts(vspace[vspace_id].name);
    1702                     _puts("\n");
    1703                     _exit();
    1704                 }
    1705                 ctx_cma = alloc_cma_channel;
    1706                 alloc_cma_channel++;
    1707             }
    1708 
    1709             // ctx_hba : HBA channel global index provided by the global allocator
    1710             //           Each channel is a private ressource: the number of
    1711             //           requested channels cannot be larger than NB_NIC_CHANNELS.
    1712             unsigned int ctx_hba = 0xFFFFFFFF;
    1713             if (task[task_id].use_hba)
    1714             {
    1715                 if (alloc_hba_channel >= NB_IOC_CHANNELS)
    1716                 {
    1717                     _puts("\n[BOOT ERROR] IOC channel index too large for task ");
    1718                     _puts(task[task_id].name);
    1719                     _puts(" in vspace ");
    1720                     _puts(vspace[vspace_id].name);
    1721                     _puts("\n");
    1722                     _exit();
    1723                 }
    1724                 ctx_hba = alloc_hba_channel;
    1725                 alloc_hba_channel++;
    1726             }
    1727             // ctx_tim : TIMER local channel index provided by the cluster allocator
    1728             //           Each timer is a private ressource
    1729             unsigned int ctx_tim = 0xFFFFFFFF;
    1730             if (task[task_id].use_tim)
    1731             {
    1732                 unsigned int cluster_id = task[task_id].clusterid;
    1733 
    1734                 if ( alloc_tim_channel[cluster_id] >= NB_TIM_CHANNELS )
    1735                 {
    1736                     _puts("\n[BOOT ERROR] local TIMER index too large for task ");
    1737                     _puts(task[task_id].name);
    1738                     _puts(" in vspace ");
    1739                     _puts(vspace[vspace_id].name);
    1740                     _puts("\n");
    1741                     _exit();
    1742                 }
    1743                 ctx_tim =  alloc_tim_channel[cluster_id];
    1744                 alloc_tim_channel[cluster_id]++;
    1745             }
    17461640            // ctx_epc : Get the virtual address of the memory location containing
    17471641            // the task entry point : the start_vector is stored by GCC in the seg_data
     
    17781672            psched->current = 0;
    17791673
    1780             // initializes the task context in scheduler
     1674            // initializes the task context
    17811675            psched->context[ltid][CTX_CR_ID]    = 0;
    17821676            psched->context[ltid][CTX_SR_ID]    = ctx_sr;
     
    17841678            psched->context[ltid][CTX_EPC_ID]   = ctx_epc;
    17851679            psched->context[ltid][CTX_PTPR_ID]  = ctx_ptpr;
    1786             psched->context[ltid][CTX_TTY_ID]   = ctx_tty;
    1787             psched->context[ltid][CTX_CMA_ID]   = ctx_cma;
    1788             psched->context[ltid][CTX_HBA_ID]   = ctx_hba;
    1789             psched->context[ltid][CTX_NIC_ID]   = ctx_nic;
    1790             psched->context[ltid][CTX_TIM_ID]   = ctx_tim;
    17911680            psched->context[ltid][CTX_PTAB_ID]  = ctx_ptab;
    17921681            psched->context[ltid][CTX_LTID_ID]  = ltid;
     
    17951684            psched->context[ltid][CTX_VSID_ID]  = vspace_id;
    17961685            psched->context[ltid][CTX_RUN_ID]   = 1;
     1686
     1687            psched->context[ltid][CTX_TTY_ID]   = 0xFFFFFFFF;
     1688            psched->context[ltid][CTX_FBCMA_ID] = 0xFFFFFFFF;
     1689            psched->context[ltid][CTX_RXCMA_ID] = 0xFFFFFFFF;
     1690            psched->context[ltid][CTX_TXCMA_ID] = 0xFFFFFFFF;
     1691            psched->context[ltid][CTX_NIC_ID]   = 0xFFFFFFFF;
     1692            psched->context[ltid][CTX_HBA_ID]   = 0xFFFFFFFF;
     1693            psched->context[ltid][CTX_TIM_ID]   = 0xFFFFFFFF;
    17971694
    17981695#if BOOT_DEBUG_SCHED
     
    18151712_puts("\n  - ctx[PTPR]   = ");
    18161713_putx( psched->context[ltid][CTX_PTPR_ID] );
    1817 _puts("\n  - ctx[TTY]    = ");
    1818 _putx( psched->context[ltid][CTX_TTY_ID] );
    1819 _puts("\n  - ctx[NIC]    = ");
    1820 _putx( psched->context[ltid][CTX_NIC_ID] );
    1821 _puts("\n  - ctx[CMA]    = ");
    1822 _putx( psched->context[ltid][CTX_CMA_ID] );
    1823 _puts("\n  - ctx[IOC]    = ");
    1824 _putx( psched->context[ltid][CTX_HBA_ID] );
    1825 _puts("\n  - ctx[TIM]    = ");
    1826 _putx( psched->context[ltid][CTX_TIM_ID] );
    18271714_puts("\n  - ctx[PTAB]   = ");
    18281715_putx( psched->context[ltid][CTX_PTAB_ID] );
     
    21202007                _puts(" in file ");
    21212008                _puts( pathname );
    2122                 _puts(" not found \n");   
     2009                _puts(" not found: \n");   
     2010                _puts(" check consistency between the .py and .ld files...\n");
    21232011                _exit();
    21242012            }
     
    25152403
    25162404        // Build page tables
    2517         _ptabs_init();
     2405        boot_ptabs_init();
    25182406
    25192407        _puts("\n[BOOT] Page tables initialised at cycle ");
Note: See TracChangeset for help on using the changeset viewer.