Changeset 215 for soft/giet_vm/boot


Ignore:
Timestamp:
Sep 17, 2012, 10:47:46 AM (12 years ago)
Author:
karaoui
Message:

New components are now mandotory in the XML description:

The files giet_vsegs.ld and hard_config.h are now autogenerated by the xml2bin tool.

File:
1 edited

Legend:

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

    r210 r215  
    187187                   : "$26" );
    188188}
     189
     190//////////////////////////////////////////////////////////////////////////////
     191// boot_scheduler_get_itvector()
     192// This function get an interrupt vector slot in a scheduler, after a temporary
     193// desactivation of the DTLB (because we use the scheduler physical address).
     194// - gpid   : global processor/scheduler index
     195// - slotid : context slot index
     196// - return the content of the slot
     197//////////////////////////////////////////////////////////////////////////////
     198unsigned int boot_scheduler_get_itvector( unsigned int gpid,
     199                                         unsigned int slotid)
     200{
     201    unsigned int value;
     202
     203    // get scheduler physical address
     204    static_scheduler_t*     psched = boot_schedulers_paddr[gpid];
     205   
     206    // get slot physical address
     207    unsigned int*           pslot  = &(psched->interrupt_vector[slotid]);
     208
     209    asm volatile ( "li      $26,    0xB     \n"
     210                   "mtc2    $26,    $1      \n"     /* desactivate DTLB */
     211                   "lw      %0,     0(%1)   \n"     /* *pslot <= value  */
     212                   "li      $26,    0xF     \n"
     213                   "mtc2    $26,    $1      \n"     /* activate DTLB    */
     214                   : "=r"(value)
     215                   : "r"(pslot)
     216                   : "$26" );
     217    return value;
     218}
     219
    189220//////////////////////////////////////////////////////////////////////////////
    190221// boot_scheduler_get_tasks()
     
    286317void boot_puts(const char *buffer)
    287318{
    288     unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base +
    289                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     319    unsigned int* tty_address = (unsigned int*) &seg_tty_base;
    290320    unsigned int n;
    291321
     
    915945            if ( periph[periph_id].type == PERIPH_TYPE_TIM )
    916946            {
    917                 if ( periph[periph_id].channels != (NB_PROCS_MAX + NB_TIMERS_MAX) )
     947                if ( periph[periph_id].channels > NB_TIMERS_MAX )
    918948                {
    919949                    boot_puts("\n[BOOT ERROR] Too much user timers in cluster ");
     
    13121342
    13131343            //////// vci_io_bridge component
    1314             else if ( (type == PERIPH_TYPE_IOB) && GIET_IOMMU_ACTIVE )
     1344            else if ( (type == PERIPH_TYPE_IOB) && IOMMU_ACTIVE )
    13151345            {
    13161346                // get the iommu page table physical address
     
    14351465    {
    14361466        alloc_fbdma_channel[cluster_id] = 0;
    1437         alloc_timer_channel[cluster_id] = NB_PROCS_MAX;
     1467        alloc_timer_channel[cluster_id] = 0;
    14381468    }
    14391469               
     
    15601590            unsigned int ctx_ptpr = (unsigned int)boot_ptabs_paddr[vspace_id] >> 13;
    15611591
     1592            // compute gpid = global processor index
     1593            unsigned int gpid = task[task_id].clusterid*NB_PROCS_MAX +
     1594                                task[task_id].proclocid;
     1595
    15621596            // ctx_ptab : page_table virtual base address
    15631597            unsigned int ctx_ptab = (unsigned int)boot_ptabs_vaddr[vspace_id];
     
    16021636            {
    16031637                unsigned int cluster_id = task[task_id].clusterid;
    1604                 if ( alloc_timer_channel[cluster_id] >= NB_TIMERS_MAX )
     1638                unsigned int allocated = alloc_timer_channel[cluster_id];
     1639
     1640                if ( allocated >= NB_TIMERS_MAX )
    16051641                {
    16061642                    boot_puts("\n[BOOT ERROR] local TIMER index too large for task ");
     
    16111647                    boot_exit();
    16121648                }
    1613                 ctx_timer = cluster_id*NB_TIMERS_MAX + alloc_timer_channel[cluster_id];
    1614                 alloc_timer_channel[cluster_id]++;
     1649               
     1650                //assert(allocated >= 0);
     1651                char found = 0;
     1652                for( irq_id = 0; irq_id < 32; irq_id++)//look at the isr_timer isr channel
     1653                {
     1654                    unsigned int isr = boot_scheduler_get_itvector(gpid, irq_id) && 0x000000FF;
     1655                    if(isr == ISR_TIMER)
     1656                    {
     1657                        if(allocated == 0)
     1658                        {
     1659                            found = 1;
     1660                            alloc_timer_channel[cluster_id]++;
     1661                            ctx_timer = cluster_id*NB_TIMERS_MAX + alloc_timer_channel[cluster_id];
     1662                            break;
     1663                        }else
     1664                            allocated--;
     1665                    }
     1666                }
     1667
     1668                if(!found)
     1669                {
     1670                    boot_puts("\n[BOOT ERROR] No user timer available for task ");
     1671                    boot_puts( task[task_id].name );
     1672                    boot_puts(" in vspace ");
     1673                    boot_puts( vspace[vspace_id].name );
     1674                    boot_puts("\n");
     1675                    boot_exit();
     1676                }
     1677
    16151678            }
    16161679
     
    16421705            unsigned int vobj_id = task[task_id].vobjlocid + vspace[vspace_id].vobj_offset;
    16431706            unsigned int ctx_sp = vobj[vobj_id].vaddr + vobj[vobj_id].length;
    1644 
    1645             // compute gpid = global processor index
    1646             unsigned int gpid = task[task_id].clusterid*NB_PROCS_MAX +
    1647                                 task[task_id].proclocid;
    16481707
    16491708            // In the code below, we access the scheduler with specific access
Note: See TracChangeset for help on using the changeset viewer.