Changeset 436 for soft/giet_vm
- Timestamp:
- Nov 3, 2014, 10:48:54 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_boot/boot.c
r433 r436 63 63 64 64 #include <giet_config.h> 65 #include <mapping_info.h> 65 66 #include <mwmr_channel.h> 66 67 #include <barrier.h> … … 668 669 // For the vseg defined by the vseg pointer, this function register all PTEs 669 670 // in one or several page tables. 670 // It is a global vseg ( systemvseg) if (vspace_id == 0xFFFFFFFF).671 // It is a global vseg (kernel vseg) if (vspace_id == 0xFFFFFFFF). 671 672 // The number of involved PTABs depends on the "local" and "global" attributes: 672 673 // - PTEs are replicated in all vspaces for a global vseg. … … 848 849 // 849 850 // 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 852 852 // or SPPs (if the vseg is not associated to a peripheral), and register 853 853 // the physical base address in the vseg pbase field. It initialises the 854 854 // _ptabs_vaddr and _ptabs_paddr arrays if the vseg is a PTAB. 855 855 // 856 // B) page table initialisation : the boot_vseg_pte() function initialise856 // 2) page table initialisation : the boot_vseg_pte() function initialise 857 857 // the PTEs (both PTE1 and PTE2) in one or several page tables: 858 858 // - PTEs are replicated in all vspaces for a global vseg. … … 865 865 // 4) all private vsegs in user space. 866 866 /////////////////////////////////////////////////////////////////////////////// 867 void _ptabs_init()867 void boot_ptabs_init() 868 868 { 869 869 mapping_header_t* header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE; … … 877 877 if (header->vspaces == 0 ) 878 878 { 879 _puts("\n[BOOT ERROR] in _ptabs_init() : mapping ");879 _puts("\n[BOOT ERROR] in boot_ptabs_init() : mapping "); 880 880 _puts( header->name ); 881 881 _puts(" contains no vspace\n"); … … 1278 1278 unsigned int lpid; // local processor index (for several loops) 1279 1279 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 1292 1282 unsigned int alloc_wti_channel[X_SIZE*Y_SIZE]; // one per cluster 1293 1283 … … 1320 1310 _puts("]\n"); 1321 1311 #endif 1322 alloc_tim_channel[cluster_id] = NB_PROCS_MAX;1323 1312 alloc_wti_channel[cluster_id] = NB_PROCS_MAX; 1324 1313 … … 1350 1339 } 1351 1340 1352 // scan peripherals to find the ICU/XCU and the PIC component1341 // scan peripherals to find the XCU and the PIC component 1353 1342 1354 1343 xcu = NULL; … … 1357 1346 periph_id++ ) 1358 1347 { 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 ) 1361 1349 { 1362 1350 xcu = &periph[periph_id]; … … 1379 1367 if ( xcu == NULL ) 1380 1368 { 1381 _puts("\n[BOOT ERROR] No ICU /XCU component in cluster[");1369 _puts("\n[BOOT ERROR] No XCU component in cluster["); 1382 1370 _putd( x ); 1383 1371 _puts(","); … … 1650 1638 unsigned int ctx_ptab = _ptabs_vaddr[vspace_id][x][y]; 1651 1639 1652 // ctx_tty : TTY terminal global index provided by the global allocator1653 // Each user terminal is a private ressource: the number of1654 // 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 allocator1672 // Each channel is a private ressource: the number of1673 // 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 allocator1691 // Each channel is a private ressource: the number of1692 // 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 allocator1710 // Each channel is a private ressource: the number of1711 // 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 allocator1728 // Each timer is a private ressource1729 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 }1746 1640 // ctx_epc : Get the virtual address of the memory location containing 1747 1641 // the task entry point : the start_vector is stored by GCC in the seg_data … … 1778 1672 psched->current = 0; 1779 1673 1780 // initializes the task context in scheduler1674 // initializes the task context 1781 1675 psched->context[ltid][CTX_CR_ID] = 0; 1782 1676 psched->context[ltid][CTX_SR_ID] = ctx_sr; … … 1784 1678 psched->context[ltid][CTX_EPC_ID] = ctx_epc; 1785 1679 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;1791 1680 psched->context[ltid][CTX_PTAB_ID] = ctx_ptab; 1792 1681 psched->context[ltid][CTX_LTID_ID] = ltid; … … 1795 1684 psched->context[ltid][CTX_VSID_ID] = vspace_id; 1796 1685 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; 1797 1694 1798 1695 #if BOOT_DEBUG_SCHED … … 1815 1712 _puts("\n - ctx[PTPR] = "); 1816 1713 _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] );1827 1714 _puts("\n - ctx[PTAB] = "); 1828 1715 _putx( psched->context[ltid][CTX_PTAB_ID] ); … … 2120 2007 _puts(" in file "); 2121 2008 _puts( pathname ); 2122 _puts(" not found \n"); 2009 _puts(" not found: \n"); 2010 _puts(" check consistency between the .py and .ld files...\n"); 2123 2011 _exit(); 2124 2012 } … … 2515 2403 2516 2404 // Build page tables 2517 _ptabs_init();2405 boot_ptabs_init(); 2518 2406 2519 2407 _puts("\n[BOOT] Page tables initialised at cycle ");
Note: See TracChangeset
for help on using the changeset viewer.