Ignore:
Timestamp:
Mar 26, 2014, 6:44:44 PM (10 years ago)
Author:
alain
Message:

Introducing a major release, to suppoort the tsar_generic_leti platform
and the various (external or internal) peripherals configurations.
The map.xml format has been modified, in order to support the new
vci_iopic componentand a new policy for peripherals initialisation.
The IRQs are nom described in the XICU and IOPIC components
(and not anymore in the processors).
To enforce this major change, the map.xml file signature changed:
The signature value must be: 0xDACE2014

This new release has been tested on the tsar_generic_leti platform
for the following mappings:

  • 4c_4p_sort_leti
  • 4c_4p_sort_leti_ext
  • 4c_4p_transpose_leti
  • 4c_4p_transpose_leti_ext
  • 4c_1p_four_leti_ext
File:
1 edited

Legend:

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

    r293 r295  
    6868///////////////////////////////////////////////////////////////////////////////////////
    6969
    70 // for vobjs initialisation
    7170#include <giet_config.h>
    7271#include <mwmr_channel.h>
     
    8079#include <nic_driver.h>
    8180#include <ioc_driver.h>
     81#include <pic_driver.h>
    8282#include <mwr_driver.h>
    8383#include <ctx_handler.h>
     
    874874        _putx( curr->length );
    875875        _puts(" / vbase ");
    876         _putl( curr->vbase );
     876        _putx( curr->vbase );
    877877        _puts(" / pbase ");
    878878        _putl( curr->pbase );
     
    894894        boot_vspace_pt_build(vspace_id);
    895895
    896         _puts("\n[BOOT] Page Table for vspace ");
     896        _puts("\n[BOOT] Page Table for vspace \"");
    897897        _puts( vspace[vspace_id].name );
    898         _puts(" completed at cycle ");
     898        _puts("\" completed at cycle ");
    899899        _putd( _get_proctime() );
    900900        _puts("\n");
     
    11491149    mapping_task_t*    task    = _get_task_base(header);
    11501150    mapping_vobj_t*    vobj    = _get_vobj_base(header);
    1151     mapping_proc_t*    proc    = _get_proc_base(header);
     1151    mapping_periph_t*  periph  = _get_periph_base(header);
    11521152    mapping_irq_t*     irq     = _get_irq_base(header);
    11531153
    11541154    unsigned int cluster_id;    // cluster index in mapping_info
    1155     unsigned int proc_id;       // processor index in mapping_info
     1155    unsigned int periph_id;     // peripheral index in mapping_info
    11561156    unsigned int irq_id;        // irq index in mapping_info
    11571157    unsigned int vspace_id;     // vspace index in mapping_info
     
    11631163    //   are reserved for the kernel (context switch)
    11641164
    1165     unsigned int alloc_tty_channel = 0;            // TTY channel allocator
    1166     unsigned int alloc_nic_channel = 0;            // NIC channel allocator
    1167     unsigned int alloc_cma_channel = 0;            // CMA channel allocator
    1168     unsigned int alloc_hba_channel = 0;            // IOC channel allocator
    1169     unsigned int alloc_tim_channel[X_SIZE*Y_SIZE]; // user TIMER allocators
    1170 
    1171     if (NB_TTY_CHANNELS > 1) alloc_tty_channel++;
     1165    unsigned int alloc_tty_channel = 1;             // TTY channel allocator
     1166    unsigned int alloc_nic_channel = 0;             // NIC channel allocator
     1167    unsigned int alloc_cma_channel = 0;             // CMA channel allocator
     1168    unsigned int alloc_hba_channel = 0;             // HBA channel allocator
     1169    unsigned int alloc_tim_channel[X_SIZE*Y_SIZE];  // user TIMER allocators
    11721170
    11731171    /////////////////////////////////////////////////////////////////////////
     
    11981196        alloc_tim_channel[cluster_id] = NB_PROCS_MAX;
    11991197
    1200         unsigned int  lpid;          // processor local index in cluster
    1201         unsigned int  sched_vbase;   // schedulers segment virtual base address
    1202         unsigned int  sched_length;  // schedulers segment length
    1203         unsigned int  nprocs;        // number of processors in cluster
    1204 
    1205         nprocs = cluster[cluster_id].procs;
    1206 
    12071198        // checking processors number
    1208         if ( nprocs > NB_PROCS_MAX )
     1199        if ( cluster[cluster_id].procs > NB_PROCS_MAX )
    12091200        {
    12101201            _puts("\n[BOOT ERROR] Too much processors in cluster[");
     
    12161207        }
    12171208 
    1218         // get scheduler array virtual base address and length
    1219         boot_get_sched_vaddr( cluster_id, &sched_vbase, &sched_length );
    1220 
    1221         // each processor scheduler requires 4 Kbytes
    1222         if ( sched_length < (nprocs<<12) )
    1223         {
    1224             _puts("\n[BOOT ERROR] Schedulers segment too small in cluster[");
    1225             _putd( x );
    1226             _puts(",");
    1227             _putd( y );
    1228             _puts("]\n");
    1229             _exit();
    1230         }
    1231 
    1232         // loop on processors
    1233         for ( proc_id = cluster[cluster_id].proc_offset, lpid = 0 ;
    1234               proc_id < cluster[cluster_id].proc_offset + cluster[cluster_id].procs;
    1235               proc_id++, lpid++ )
    1236         {
    1237             // current processor scheduler pointer : psched
    1238             static_scheduler_t* psched = (static_scheduler_t*)(sched_vbase+(lpid<<12));
    1239 
    1240             // set the schedulers pointers array
    1241             _schedulers[cluster_xy * NB_PROCS_MAX + lpid] = psched;
     1209        static_scheduler_t* psched;  // schedulers array base address in cluster
     1210
     1211        // no schedulers initialisation if nprocs == 0
     1212        if ( cluster[cluster_id].procs > 0 )
     1213        {
     1214            // get scheduler array virtual base address and length
     1215            unsigned int        sched_vbase;   // schedulers segment virtual base address
     1216            unsigned int        sched_length;  // schedulers segment length
     1217            boot_get_sched_vaddr( cluster_id, &sched_vbase, &sched_length );
     1218
     1219            if ( sched_length < (cluster[cluster_id].procs<<12) ) // 4 Kbytes per scheduler
     1220            {
     1221                _puts("\n[BOOT ERROR] Schedulers segment too small in cluster[");
     1222                _putd( x );
     1223                _puts(",");
     1224                _putd( y );
     1225                _puts("]\n");
     1226                _exit();
     1227            }
     1228
     1229            psched = (static_scheduler_t*)sched_vbase;
     1230
     1231            // scan cluster peripherals to find the ICU/XCU
     1232            unsigned int found = 0;
     1233            for ( periph_id = cluster[cluster_id].periph_offset ;
     1234                  periph_id < cluster[cluster_id].periph_offset + cluster[cluster_id].periphs;
     1235                  periph_id++ )
     1236            {
     1237                if( (periph[periph_id].type == PERIPH_TYPE_XCU) ||
     1238                    (periph[periph_id].type == PERIPH_TYPE_ICU) )
     1239                {
     1240                    found = 1;
     1241                    break;
     1242                }
     1243            }
     1244            if ( found == 0 )
     1245            {         
     1246                _puts("\n[BOOT ERROR] No ICU / XCU component in cluster[");
     1247                _putd( x );
     1248                _puts(",");
     1249                _putd( y );
     1250                _puts("]\n");
     1251                _exit();
     1252            }
     1253
     1254            // loop on schedulers for default values initialisation
     1255            unsigned int lpid;
     1256            for ( lpid = 0 ; lpid < cluster[cluster_id].procs ; lpid++ )
     1257            {
     1258                // set the schedulers pointers array
     1259                _schedulers[cluster_xy * NB_PROCS_MAX + lpid] =
     1260                      (static_scheduler_t*)&psched[lpid];
    12421261
    12431262#if BOOT_DEBUG_SCHED
    1244 _puts("\nProc_");
     1263_puts("\nProc[");
    12451264_putd( x );
    1246 _puts("_");
     1265_puts(",");
    12471266_putd( y );
    1248 _puts("_");
     1267_puts(",");
    12491268_putd( lpid );
    1250 _puts(" : scheduler virtual base address = ");
    1251 _putx( sched_vbase + (lpid<<12) );
    1252 _puts("\n");
    1253 #endif
    1254 
    1255             // initialise the "tasks" variable : default value is 0
    1256             psched->tasks = 0;
    1257 
    1258             // initialise the "current" variable : default value is idle_task
    1259             psched->current = IDLE_TASK_INDEX;
    1260 
    1261             // initialise interrupt_vector with default value (valid bit = 0)
    1262             unsigned int slot;
    1263             for (slot = 0; slot < 32; slot++) psched->interrupt_vector[slot] = 0;
    1264 
    1265             // initialise interrupt vector with the IRQs actually allocated
    1266             for (irq_id = proc[proc_id].irq_offset;
    1267                  irq_id < proc[proc_id].irq_offset + proc[proc_id].irqs;
    1268                  irq_id++)
     1269_puts("] : scheduler virtual base address = ");
     1270_putx( (unsigned int)&psched[lpid] );
     1271_puts("\n");
     1272#endif
     1273                // initialise the "tasks" and "current" variables default values
     1274                psched[lpid].tasks   = 0;
     1275                psched[lpid].current = IDLE_TASK_INDEX;
     1276
     1277                // initialise HWI / PTI / SWI vectors (valid bit = 0)
     1278                unsigned int slot;
     1279                for (slot = 0; slot < 32; slot++)
     1280                {
     1281                    psched[lpid].hwi_vector[slot] = 0;
     1282                    psched[lpid].pti_vector[slot] = 0;
     1283                    psched[lpid].wti_vector[slot] = 0;
     1284                }
     1285
     1286                // initializes the idle_task context in scheduler:
     1287                // - the SR slot is 0xFF03 because this task run in kernel mode.
     1288                // - it uses the page table of vspace[0]
     1289                // - it uses the kernel TTY terminal
     1290                // - slots containing addresses (SP, RA, EPC, PTAB, PTPR)
     1291                //   must be re-initialised by kernel_parallel_init()
     1292
     1293                psched[lpid].context[IDLE_TASK_INDEX][CTX_CR_ID]    = 0;
     1294                psched[lpid].context[IDLE_TASK_INDEX][CTX_SR_ID]    = 0xFF03;
     1295                psched[lpid].context[IDLE_TASK_INDEX][CTX_PTPR_ID]  = _ptabs_paddr[0]>>13;
     1296                psched[lpid].context[IDLE_TASK_INDEX][CTX_PTAB_ID]  = _ptabs_vaddr[0];
     1297                psched[lpid].context[IDLE_TASK_INDEX][CTX_TTY_ID]   = 0;
     1298                psched[lpid].context[IDLE_TASK_INDEX][CTX_LTID_ID]  = IDLE_TASK_INDEX;
     1299                psched[lpid].context[IDLE_TASK_INDEX][CTX_VSID_ID]  = 0;
     1300                psched[lpid].context[IDLE_TASK_INDEX][CTX_RUN_ID]   = 1;
     1301            }
     1302
     1303           
     1304            // loop on irqs for actual HWI / PTI / WTI vectors initialisation     
     1305            for ( irq_id = periph[periph_id].irq_offset ;
     1306                  irq_id < periph[periph_id].irq_offset + periph[periph_id].irqs ;
     1307                  irq_id++ )
    12691308            {
    1270                 unsigned int type    = irq[irq_id].type;
    1271                 unsigned int icu_id  = irq[irq_id].icuid;
    1272                 unsigned int isr_id  = irq[irq_id].isr;
     1309                unsigned int lpid    = irq[irq_id].dstid;
     1310                unsigned int dstx    = irq[irq_id].dstx;
     1311                unsigned int dsty    = irq[irq_id].dsty;
     1312                if ( (dstx != x) || (dsty != y) )
     1313                {
     1314                    _puts("\n[BOOT ERROR] Bad IRQ cluster coordinates in cluster[");
     1315                    _putd( x );
     1316                    _puts(",");
     1317                    _putd( y );
     1318                    _puts("]\n - dstx  = ");
     1319                    _putd( dstx );
     1320                    _puts("\n - dsty  = ");
     1321                    _putd( dsty );
     1322                    _puts("\n - x     = ");
     1323                    _putd( x );
     1324                    _puts("\n - y     = ");
     1325                    _putd( y );
     1326                    _puts("\n");
     1327                    _exit();
     1328                }
     1329                if ( lpid >= cluster[cluster_id].procs )
     1330                {
     1331                    _puts("\n[BOOT ERROR] Bad IRQ processor index in cluster[");
     1332                    _putd( x );
     1333                    _puts(",");
     1334                    _putd( y );
     1335                    _puts("]\n");
     1336                    _exit();
     1337                }
     1338                unsigned int type    = irq[irq_id].srctype;
     1339                unsigned int index   = irq[irq_id].srcid;
     1340                unsigned int isr     = irq[irq_id].isr;
    12731341                unsigned int channel = irq[irq_id].channel;
    12741342
    1275                 unsigned int value = ((isr_id  & 0xFF)        ) |
    1276                                      ((type    & 0xFF)   <<  8) |
     1343                unsigned int entry = ((isr & 0xFFFF)          ) |
    12771344                                     ((channel & 0x7FFF) << 16) |
    12781345                                     0x80000000;                    // Valid entry
    12791346
    1280                 psched->interrupt_vector[icu_id] = value;
     1347                if      (type == IRQ_TYPE_HWI) psched[lpid].hwi_vector[index] = entry;
     1348                else if (type == IRQ_TYPE_PTI) psched[lpid].pti_vector[index] = entry;
     1349                else if (type == IRQ_TYPE_WTI) psched[lpid].wti_vector[index] = entry;
    12811350
    12821351#if BOOT_DEBUG_SCHED
    1283 _puts("- IRQ : icu = ");
    1284 _putd(icu_id);
    1285 _puts(" / type = ");
    1286 _putd(type);
     1352_puts("- IRQ : type = ");
     1353_putd( type );
     1354_puts(" / index = ");
     1355_putd( index );
    12871356_puts(" / isr = ");
    1288 _putd(isr_id);
     1357_putd( isr );
    12891358_puts(" / channel = ");
    1290 _putd(channel);
    1291 _puts(" => vector_entry = ");
    1292 _putx( value );
    1293 _puts("\n");
    1294 #endif
    1295             }
    1296 
    1297             // initializes the idle_task context in scheduler:
    1298             // - the SR slot is 0xFF03 because this task run in kernel mode.
    1299             // - it uses the page table of vspace[0]
    1300             // - it uses the kernel TTY terminal
    1301             // - slots containing addresses (SP, RA, EPC, PTAB, PTPR)
    1302             //   must be re-initialised by kernel_parallel_init()
    1303 
    1304             psched->context[IDLE_TASK_INDEX][CTX_CR_ID]    = 0;
    1305             psched->context[IDLE_TASK_INDEX][CTX_SR_ID]    = 0xFF03;
    1306             psched->context[IDLE_TASK_INDEX][CTX_PTPR_ID]  = _ptabs_paddr[0]>>13;
    1307             psched->context[IDLE_TASK_INDEX][CTX_PTAB_ID]  = _ptabs_vaddr[0];
    1308             psched->context[IDLE_TASK_INDEX][CTX_TTY_ID]   = 0;
    1309             psched->context[IDLE_TASK_INDEX][CTX_LTID_ID]  = IDLE_TASK_INDEX;
    1310             psched->context[IDLE_TASK_INDEX][CTX_VSID_ID]  = 0;
    1311             psched->context[IDLE_TASK_INDEX][CTX_RUN_ID]   = 1;
    1312 
    1313         } // end for procs
     1359_putd( channel );
     1360_puts("\n");
     1361#endif
     1362
     1363            } // end for irqs
     1364        } // end if nprocs > 0
    13141365    } // end for clusters
    13151366
    13161367    ///////////////////////////////////////////////////////////////////
    1317     // Step 2 : loop on the vspaces and the tasks
    1318     //          to initialise the schedulers and the task contexts.
     1368    // Step 2 : loop on the vspaces and the tasks  to complete
     1369    //          the schedulers and task contexts initialisation.
    13191370
    13201371    for (vspace_id = 0; vspace_id < header->vspaces; vspace_id++)
     
    13291380             task_id++)
    13301381        {
    1331 
    1332             // compute the cluster coordinates
     1382            // compute the cluster coordinates & local processor index
    13331383            unsigned int x          = cluster[task[task_id].clusterid].x;
    13341384            unsigned int y          = cluster[task[task_id].clusterid].y;
    13351385            unsigned int cluster_xy = (x<<Y_WIDTH) + y;
     1386            unsigned int lpid       = task[task_id].proclocid;                 
    13361387
    13371388#if BOOT_DEBUG_SCHED
     
    13471398#endif
    13481399            // compute gpid (global processor index) and scheduler base address
    1349             unsigned int gpid = cluster_xy * NB_PROCS_MAX + task[task_id].proclocid;
     1400            unsigned int gpid = cluster_xy * NB_PROCS_MAX + lpid;
    13501401            static_scheduler_t* psched = _schedulers[gpid];
    13511402
     
    13601411
    13611412            // ctx_tty : TTY terminal global index provided by the global allocator
     1413            //           Each user terminal is a private ressource: the number of
     1414            //           requested terminal cannot be larger than NB_TTY_CHANNELS.             
    13621415            unsigned int ctx_tty = 0xFFFFFFFF;
    13631416            if (task[task_id].use_tty)
     
    13651418                if (alloc_tty_channel >= NB_TTY_CHANNELS)
    13661419                {
    1367                     _puts("\n[BOOT ERROR] TTY index too large for task ");
     1420                    _puts("\n[BOOT ERROR] TTY channel index too large for task ");
    13681421                    _puts(task[task_id].name);
    13691422                    _puts(" in vspace ");
     
    13731426                }
    13741427                ctx_tty = alloc_tty_channel;
    1375                 if (NB_TTY_CHANNELS > 1) alloc_tty_channel++;
    1376             }
     1428                alloc_tty_channel++;
     1429             }
     1430
    13771431            // ctx_nic : NIC channel global index provided by the global allocator
     1432            //           Each channel is a private ressource: the number of
     1433            //           requested channels cannot be larger than NB_NIC_CHANNELS.
    13781434            unsigned int ctx_nic = 0xFFFFFFFF;
    13791435            if (task[task_id].use_nic)
     
    13911447                alloc_nic_channel++;
    13921448            }
     1449
    13931450            // ctx_cma : CMA channel global index provided by the global allocator
     1451            //           Each channel is a private ressource: the number of
     1452            //           requested channels cannot be larger than NB_NIC_CHANNELS.
    13941453            unsigned int ctx_cma = 0xFFFFFFFF;
    13951454            if (task[task_id].use_cma)
     
    14071466                alloc_cma_channel++;
    14081467            }
     1468
    14091469            // ctx_hba : HBA channel global index provided by the global allocator
     1470            //           Each channel is a private ressource: the number of
     1471            //           requested channels cannot be larger than NB_NIC_CHANNELS.
    14101472            unsigned int ctx_hba = 0xFFFFFFFF;
    14111473            if (task[task_id].use_hba)
    14121474            {
    1413                 if (alloc_hba_channel >= NB_HBA_CHANNELS)
     1475                if (alloc_hba_channel >= NB_IOC_CHANNELS)
    14141476                {
    14151477                    _puts("\n[BOOT ERROR] IOC channel index too large for task ");
     
    14231485                alloc_hba_channel++;
    14241486            }
    1425             // ctx_tim : TIM local channel index provided by the cluster allocator
     1487            // ctx_tim : TIMER local channel index provided by the cluster allocator
     1488            //           Each timer is a private ressource
    14261489            unsigned int ctx_tim = 0xFFFFFFFF;
    14271490            if (task[task_id].use_tim)
     
    14381501                    _exit();
    14391502                }
    1440 
    1441                 // checking that there is an ISR_TIMER installed
    1442                 unsigned int found = 0;
    1443                 for ( irq_id = 0 ; irq_id < 32 ; irq_id++ ) 
    1444                 {
    1445                     unsigned int entry   = psched->interrupt_vector[irq_id];
    1446                     unsigned int isr     = entry & 0x000000FF;
    1447                     unsigned int channel = entry>>16;
    1448                     if ( (isr == ISR_TIMER) && (channel == alloc_tim_channel[cluster_id]) )
    1449                     {
    1450                         found     = 1;
    1451                         ctx_tim =  alloc_tim_channel[cluster_id];
    1452                         alloc_tim_channel[cluster_id]++;
    1453                         break;
    1454                     }
    1455                 }
    1456                 if (!found)
    1457                 {
    1458                     _puts("\n[BOOT ERROR] No ISR_TIMER installed for task ");
    1459                     _puts(task[task_id].name);
    1460                     _puts(" in vspace ");
    1461                     _puts(vspace[vspace_id].name);
    1462                     _puts("\n");
    1463                     _exit();
    1464                 }
     1503                ctx_tim =  alloc_tim_channel[cluster_id];
     1504                alloc_tim_channel[cluster_id]++;
    14651505            }
    14661506            // ctx_epc : Get the virtual address of the memory location containing
     
    15201560_puts("\nTask ");
    15211561_putd( task_id );
    1522 _puts(" allocated to processor ");
    1523 _putd( gpid );
    1524 _puts("\n  - ctx[LTID]   = ");
     1562_puts(" allocated to processor[");
     1563_putd( x )
     1564_puts(",");
     1565_putd( y )
     1566_puts(",");
     1567_putd( lpid )
     1568_puts("]\n  - ctx[LTID]   = ");
    15251569_putd( psched->context[ltid][CTX_LTID_ID] );
    15261570_puts("\n  - ctx[SR]     = ");
     
    15331577_putx( psched->context[ltid][CTX_PTPR_ID] );
    15341578_puts("\n  - ctx[TTY]    = ");
    1535 _putd( psched->context[ltid][CTX_TTY_ID] );
     1579_putx( psched->context[ltid][CTX_TTY_ID] );
    15361580_puts("\n  - ctx[NIC]    = ");
    1537 _putd( psched->context[ltid][CTX_NIC_ID] );
     1581_putx( psched->context[ltid][CTX_NIC_ID] );
    15381582_puts("\n  - ctx[CMA]    = ");
    1539 _putd( psched->context[ltid][CTX_CMA_ID] );
     1583_putx( psched->context[ltid][CTX_CMA_ID] );
    15401584_puts("\n  - ctx[IOC]    = ");
    1541 _putd( psched->context[ltid][CTX_HBA_ID] );
     1585_putx( psched->context[ltid][CTX_HBA_ID] );
    15421586_puts("\n  - ctx[TIM]    = ");
    1543 _putd( psched->context[ltid][CTX_TIM_ID] );
     1587_putx( psched->context[ltid][CTX_TIM_ID] );
    15441588_puts("\n  - ctx[PTAB]   = ");
    15451589_putx( psched->context[ltid][CTX_PTAB_ID] );
    15461590_puts("\n  - ctx[GTID]   = ");
    1547 _putd( psched->context[ltid][CTX_GTID_ID] );
     1591_putx( psched->context[ltid][CTX_GTID_ID] );
    15481592_puts("\n  - ctx[VSID]   = ");
    1549 _putd( psched->context[ltid][CTX_VSID_ID] );
     1593_putx( psched->context[ltid][CTX_VSID_ID] );
    15501594_puts("\n  - ctx[TRDID]  = ");
    1551 _putd( psched->context[ltid][CTX_TRDID_ID] );
     1595_putx( psched->context[ltid][CTX_TRDID_ID] );
    15521596_puts("\n");
    15531597#endif
     
    15651609    _ioc_init( 0 );
    15661610
    1567     int fd_id = _fat_open( IOC_BOOT_PA_MODE,
     1611    int fd_id = _fat_open( IOC_BOOT_MODE,
    15681612                           "map.bin",
    15691613                           0 );         // no creation
     
    15861630    if ( offset ) nblocks++;
    15871631
    1588     unsigned int ok = _fat_read( IOC_BOOT_PA_MODE,
     1632    unsigned int ok = _fat_read( IOC_BOOT_MODE,
    15891633                                 fd_id,
    15901634                                 (unsigned int*)( &seg_boot_mapping_base),
     
    17811825// The "preloader.elf" file is not loaded, because it has been burned in the ROM.
    17821826// The "boot.elf" file is not loaded, because it has been loaded by the preloader.
    1783 // It scans all vobjs defined in the map.bin data structure to collect
     1827// This function scans all vobjs defined in the map.bin data structure to collect
    17841828// all .elf files pathnames, and calls the load_one_elf_file() function to
    17851829// load all loadable segments at the virtual address found in the .elf file.
     
    18131857    }
    18141858
    1815     load_one_elf_file( IOC_BOOT_VA_MODE,
     1859    load_one_elf_file( IOC_BOOT_MODE,
    18161860                       vobj[vobj_id].binpath,
    18171861                       0 );                         // vspace 0
    18181862
    1819     _puts("\n[BOOT] File ");
     1863    _puts("\n[BOOT] File \"");
    18201864    _puts( vobj[vobj_id].binpath );
    1821     _puts(" loaded at cycle ");
     1865    _puts("\" loaded at cycle ");
    18221866    _putd( _get_proctime() );
    18231867    _puts("\n");
     
    18521896        }
    18531897
    1854         load_one_elf_file( IOC_BOOT_VA_MODE,
     1898        load_one_elf_file( IOC_BOOT_MODE,
    18551899                           vobj[vobj_id].binpath,
    18561900                           vspace_id );
    18571901
    1858         _puts("\n[BOOT] File ");
     1902        _puts("\n[BOOT] File \"");
    18591903        _puts( vobj[vobj_id].binpath );
    1860         _puts(" loaded at cycle ");
     1904        _puts("\" loaded at cycle ");
    18611905        _putd( _get_proctime() );
    18621906        _puts("\n");
     
    18821926    mapping_coproc_t * coproc   = _get_coproc_base(header);
    18831927    mapping_cp_port_t * cp_port = _get_cp_port_base(header);
     1928    mapping_irq_t * irq         = _get_irq_base(header);
    18841929
    18851930    unsigned int cluster_id;
     
    20012046                case PERIPH_TYPE_TTY:    // vci_multi_tty component
    20022047                {
     2048                    // nothing to do
    20032049#if BOOT_DEBUG_PERI
    20042050_puts("- TTY / channels = ");
     
    20252071_puts("\n");
    20262072#endif
     2073                    break;
     2074                }
     2075                case PERIPH_TYPE_PIC:    // vci_iopic component
     2076                {
     2077                         
     2078#if BOOT_DEBUG_PERI
     2079_puts("- PIC / channels = ");
     2080_putd(channels);
     2081_puts("\n");
     2082#endif
     2083                    // scan all HWI IRQs defined in mapping for PIC component,
     2084                    // and initialises addresses for WTI IRQs
     2085                    for ( channel_id = periph[periph_id].irq_offset ;
     2086                          channel_id < periph[periph_id].irq_offset + periph[periph_id].irqs ;
     2087                          channel_id++ )
     2088                    {
     2089                        unsigned int hwi_id  = irq[channel_id].srcid;  // HWI index in PIC
     2090                        unsigned int wti_id  = irq[channel_id].dstid;  // WTI index in XCU
     2091                        unsigned int x       = irq[channel_id].dstx;   // XCU X coordinate
     2092                        unsigned int y       = irq[channel_id].dsty;   // XCU Y coordinate
     2093                        unsigned int cluster = (x<<Y_WIDTH) + y;       // XCU cluster
     2094                        unsigned int vaddr;
     2095
     2096                        _xcu_get_wti_address( wti_id, &vaddr );
     2097
     2098                        _pic_init( hwi_id, vaddr, cluster );
     2099#if BOOT_DEBUG_PERI
     2100_puts("    hwi_index = ");
     2101_putd( hwi_id );
     2102_puts(" / wti_index = ");
     2103_putd( wti_id );
     2104_puts(" / vaddr = ");
     2105_putx( vaddr );
     2106_puts(" in cluster[");
     2107_putd( x );
     2108_puts(",");
     2109_putd( y );
     2110_puts("]\n");
     2111#endif
     2112                    }
    20272113                    break;
    20282114                }
     
    20892175void boot_init()
    20902176{
    2091     mapping_header_t* header     = (mapping_header_t *) & seg_boot_mapping_base;
    2092     unsigned int      gpid       = _get_procid();
    2093     unsigned int      cluster_xy = gpid / NB_PROCS_MAX;
    2094     unsigned int      lpid       = gpid % NB_PROCS_MAX;
     2177    mapping_header_t*  header     = (mapping_header_t *) & seg_boot_mapping_base;
     2178    mapping_cluster_t* cluster    = _get_cluster_base(header);
     2179    unsigned int       gpid       = _get_procid();
    20952180 
    20962181    if ( gpid == 0 )    // only Processor 0 does it
     
    21032188        boot_mapping_init();
    21042189
    2105         _puts("\n[BOOT] Mapping ");
     2190        _puts("\n[BOOT] Mapping \"");
    21062191        _puts( header->name );
    2107         _puts(" loaded at cycle ");
     2192        _puts("\" loaded at cycle ");
    21082193        _putd(_get_proctime());
    21092194        _puts("\n");
     
    21112196        // Building all page tables
    21122197        boot_pt_init();
    2113 
    2114         _puts("\n[BOOT] Page Tables initialisation completed at cycle ");
    2115         _putd(_get_proctime());
    2116         _puts("\n");
    21172198
    21182199        // Activating proc 0 MMU
     
    21342215        boot_schedulers_init();
    21352216
    2136         _puts("\n[BOOT] All schedulers initialised at cycle ");
     2217        _puts("\n[BOOT] Schedulers initialised at cycle ");
    21372218        _putd(_get_proctime());
    21382219        _puts("\n");
     
    21442225        boot_peripherals_init();
    21452226
    2146         _puts("\n[BOOT] All peripherals initialised at cycle ");
     2227        _puts("\n[BOOT] Non replicated peripherals initialised at cycle ");
    21472228        _putd(_get_proctime());
    21482229        _puts("\n");
     
    21512232        boot_elf_load();
    21522233
    2153         _puts("\n[BOOT] All ELF files loaded at cycle ");
    2154         _putd(_get_proctime());
    2155         _puts("\n");
    2156 
    21572234        // P0 starts all other processors
    2158         unsigned int x,y,p;
    2159         for (x = 0 ; x < X_SIZE ; x++)
    2160         {
    2161             for (y = 0 ; y < Y_SIZE ; y++)
     2235        unsigned int clusterid, p;
     2236
     2237        for ( clusterid = 0 ; clusterid < X_SIZE*Y_SIZE ; clusterid++ )
     2238        {
     2239            unsigned int nprocs     = cluster[clusterid].procs;
     2240            unsigned int xdest      = cluster[clusterid].x;
     2241            unsigned int ydest      = cluster[clusterid].y;
     2242            unsigned int cluster_xy = (xdest<<Y_WIDTH) + ydest;
     2243
     2244            for ( p = 0 ; p < nprocs; p++ )
    21622245            {
    2163                 for(p = 0; p < NB_PROCS_MAX; p++)
    2164                 {
    2165                     if ( (x != 0) || (y != 0) || (p != 0) )
    2166                     {
    2167                         _xcu_send_ipi( (x<<Y_WIDTH) + y,
    2168                                        p,
    2169                                        (unsigned int)boot_init );
    2170                     }
     2246                if ( (nprocs > 0) && ((clusterid != 0) || (p != 0)) )
     2247                {
     2248                    _xcu_send_wti( cluster_xy, p, (unsigned int)boot_init );
    21712249                }
    21722250            }
    21732251        }
     2252 
    21742253    }  // end monoprocessor boot
    21752254
     
    21862265        _set_mmu_ptpr( (unsigned int)(_ptabs_paddr[0]>>13) );
    21872266        _set_mmu_mode( 0xF );
    2188 
    2189         _tty_get_lock( 0 );
    2190         _puts("\n[BOOT] Processor[");
    2191         _putd( cluster_xy >> Y_WIDTH );
    2192         _puts(",");
    2193         _putd( cluster_xy & ((1<<Y_WIDTH)-1) );
    2194         _puts(",");
    2195         _putd( lpid );
    2196         _puts("] : MMU activation at cycle ");
    2197         _putd(_get_proctime());
    2198         _puts("\n");
    2199         _tty_release_lock( 0 );
    22002267    }
    22012268
    22022269    // all processors jump to kernel_init
    22032270    unsigned int kernel_entry = (unsigned int)&seg_kernel_init_base;
    2204 
    2205 #if GIET_DEBUG_INIT
    2206     _tty_get_lock( 0 );
    2207     _puts("\n[BOOT DEBUG] Processor[");
    2208     _putd( cluster_xy >> Y_WIDTH );
    2209     _puts(",");
    2210     _putd( cluster_xy & ((1<<Y_WIDTH)-1) );
    2211     _puts(",");
    2212     _putd( lpid );
    2213     _puts("] enters kernel at cycle ");
    2214     _putd( _get_proctime() );
    2215     _puts(" / kernel entry = ");
    2216     _putx( kernel_entry );
    2217     _puts("\n");
    2218     _tty_release_lock( 0 );
    2219 #endif
    2220 
    22212271    asm volatile( "jr   %0" ::"r"(kernel_entry) );
    22222272
Note: See TracChangeset for help on using the changeset viewer.