Changeset 215 for soft/giet_vm/boot/boot_init.c
- Timestamp:
- Sep 17, 2012, 10:47:46 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/boot/boot_init.c
r210 r215 187 187 : "$26" ); 188 188 } 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 ////////////////////////////////////////////////////////////////////////////// 198 unsigned 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 189 220 ////////////////////////////////////////////////////////////////////////////// 190 221 // boot_scheduler_get_tasks() … … 286 317 void boot_puts(const char *buffer) 287 318 { 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; 290 320 unsigned int n; 291 321 … … 915 945 if ( periph[periph_id].type == PERIPH_TYPE_TIM ) 916 946 { 917 if ( periph[periph_id].channels != (NB_PROCS_MAX + NB_TIMERS_MAX))947 if ( periph[periph_id].channels > NB_TIMERS_MAX ) 918 948 { 919 949 boot_puts("\n[BOOT ERROR] Too much user timers in cluster "); … … 1312 1342 1313 1343 //////// vci_io_bridge component 1314 else if ( (type == PERIPH_TYPE_IOB) && GIET_IOMMU_ACTIVE )1344 else if ( (type == PERIPH_TYPE_IOB) && IOMMU_ACTIVE ) 1315 1345 { 1316 1346 // get the iommu page table physical address … … 1435 1465 { 1436 1466 alloc_fbdma_channel[cluster_id] = 0; 1437 alloc_timer_channel[cluster_id] = NB_PROCS_MAX;1467 alloc_timer_channel[cluster_id] = 0; 1438 1468 } 1439 1469 … … 1560 1590 unsigned int ctx_ptpr = (unsigned int)boot_ptabs_paddr[vspace_id] >> 13; 1561 1591 1592 // compute gpid = global processor index 1593 unsigned int gpid = task[task_id].clusterid*NB_PROCS_MAX + 1594 task[task_id].proclocid; 1595 1562 1596 // ctx_ptab : page_table virtual base address 1563 1597 unsigned int ctx_ptab = (unsigned int)boot_ptabs_vaddr[vspace_id]; … … 1602 1636 { 1603 1637 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 ) 1605 1641 { 1606 1642 boot_puts("\n[BOOT ERROR] local TIMER index too large for task "); … … 1611 1647 boot_exit(); 1612 1648 } 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 1615 1678 } 1616 1679 … … 1642 1705 unsigned int vobj_id = task[task_id].vobjlocid + vspace[vspace_id].vobj_offset; 1643 1706 unsigned int ctx_sp = vobj[vobj_id].vaddr + vobj[vobj_id].length; 1644 1645 // compute gpid = global processor index1646 unsigned int gpid = task[task_id].clusterid*NB_PROCS_MAX +1647 task[task_id].proclocid;1648 1707 1649 1708 // In the code below, we access the scheduler with specific access
Note: See TracChangeset
for help on using the changeset viewer.