Changeset 309 for soft/giet_vm/giet_boot/boot.c
- Timestamp:
- Apr 21, 2014, 5:28:07 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_boot/boot.c
r299 r309 31 31 // - The structure of the various multi-threaded software applications: 32 32 // number of tasks, communication channels. 33 // - The mapping: placementof virtual objects (vobj) in the virtual segments (vseg),33 // - The mapping: grouping of virtual objects (vobj) in the virtual segments (vseg), 34 34 // placement of virtual segments (vseg) in the physical segments (pseg), placement 35 35 // of software tasks on the processors, … … 857 857 858 858 #if BOOT_DEBUG_PT 859 mapping_vseg_t* curr; 860 mapping_pseg_t* pseg = _get_pseg_base(header); 861 unsigned int pseg_id; 859 mapping_vseg_t* curr; 860 mapping_pseg_t* pseg = _get_pseg_base(header); 861 mapping_cluster_t* cluster = _get_cluster_base(header); 862 unsigned int pseg_id; 862 863 for( pseg_id = 0 ; pseg_id < header->psegs ; pseg_id++ ) 863 864 { 865 unsigned int cluster_id = pseg[pseg_id].clusterid; 864 866 _puts("\n[BOOT DEBUG] ****** vsegs mapped on pseg "); 865 867 _puts( pseg[pseg_id].name ); 866 _putd( pseg[pseg_id].clusterid); 867 _puts(" ******\n"); 868 _puts(" in cluster["); 869 _putd( cluster[cluster_id].x ); 870 _puts(","); 871 _putd( cluster[cluster_id].y ); 872 _puts("] ******\n"); 868 873 for( curr = (mapping_vseg_t*)pseg[pseg_id].next_vseg ; 869 874 curr != 0 ; … … 951 956 case VOBJ_TYPE_MWMR: // storage capacity is (vobj.length/4 - 5) words 952 957 { 958 #if BOOT_DEBUG_VOBJS 959 _puts("MWMR : "); 960 _puts(vobj[vobj_id].name); 961 _puts(" / vaddr = "); 962 _putx(vobj[vobj_id].vaddr); 963 _puts(" / paddr = "); 964 _putl(vobj[vobj_id].paddr); 965 _puts(" / length = "); 966 _putx(vobj[vobj_id].length); 967 _puts("\n"); 968 #endif 953 969 mwmr_channel_t* mwmr = (mwmr_channel_t *) (vobj[vobj_id].vaddr); 954 970 mwmr->ptw = 0; … … 959 975 mwmr->lock = 0; 960 976 #if BOOT_DEBUG_VOBJS 961 _puts("MWMR : "); 962 _puts(vobj[vobj_id].name); 963 _puts(" / depth = "); 977 _puts(" fifo depth = "); 964 978 _putd(mwmr->depth); 965 979 _puts(" / width = "); … … 974 988 _puts("ELF : "); 975 989 _puts(vobj[vobj_id].name); 990 _puts(" / vaddr = "); 991 _putx(vobj[vobj_id].vaddr); 992 _puts(" / paddr = "); 993 _putl(vobj[vobj_id].paddr); 976 994 _puts(" / length = "); 977 995 _putx(vobj[vobj_id].length); … … 983 1001 { 984 1002 #if BOOT_DEBUG_VOBJS 985 _puts("BLOB 1003 _puts("BLOB : "); 986 1004 _puts(vobj[vobj_id].name); 1005 _puts(" / vaddr = "); 1006 _putx(vobj[vobj_id].vaddr); 1007 _puts(" / paddr = "); 1008 _putl(vobj[vobj_id].paddr); 987 1009 _puts(" / length = "); 988 1010 _putx(vobj[vobj_id].length); … … 993 1015 case VOBJ_TYPE_BARRIER: // init is the number of participants 994 1016 { 1017 #if BOOT_DEBUG_VOBJS 1018 _puts("BARRIER : "); 1019 _puts(vobj[vobj_id].name); 1020 _puts(" / vaddr = "); 1021 _putx(vobj[vobj_id].vaddr); 1022 _puts(" / paddr = "); 1023 _putl(vobj[vobj_id].paddr); 1024 _puts(" / length = "); 1025 _putx(vobj[vobj_id].length); 1026 _puts("\n"); 1027 #endif 995 1028 giet_barrier_t* barrier = (giet_barrier_t *) (vobj[vobj_id].vaddr); 996 1029 barrier->count = vobj[vobj_id].init; 997 1030 barrier->init = vobj[vobj_id].init; 998 1031 #if BOOT_DEBUG_VOBJS 999 _puts("BARRIER : "); 1000 _puts(vobj[vobj_id].name); 1001 _puts(" / init_value = "); 1032 _puts(" init_value = "); 1002 1033 _putd(barrier->init); 1003 1034 _puts("\n"); … … 1007 1038 case VOBJ_TYPE_LOCK: // init value is "not taken" 1008 1039 { 1009 unsigned int* lock = (unsigned int *) (vobj[vobj_id].vaddr);1010 *lock = 0;1011 1040 #if BOOT_DEBUG_VOBJS 1012 1041 _puts("LOCK : "); 1013 1042 _puts(vobj[vobj_id].name); 1014 _puts("\n"); 1015 #endif 1016 break; 1017 } 1018 case VOBJ_TYPE_BUFFER: // nothing to initialise 1019 { 1020 #if BOOT_DEBUG_VOBJS 1021 _puts("BUFFER : "); 1022 _puts(vobj[vobj_id].name); 1043 _puts(" / vaddr = "); 1044 _putx(vobj[vobj_id].vaddr); 1023 1045 _puts(" / paddr = "); 1024 1046 _putl(vobj[vobj_id].paddr); … … 1027 1049 _puts("\n"); 1028 1050 #endif 1051 unsigned int* lock = (unsigned int *) (vobj[vobj_id].vaddr); 1052 *lock = 0; 1029 1053 break; 1030 1054 } 1055 case VOBJ_TYPE_BUFFER: // nothing to initialise 1056 { 1057 #if BOOT_DEBUG_VOBJS 1058 _puts("BUFFER : "); 1059 _puts(vobj[vobj_id].name); 1060 _puts(" / vaddr = "); 1061 _putx(vobj[vobj_id].vaddr); 1062 _puts(" / paddr = "); 1063 _putl(vobj[vobj_id].paddr); 1064 _puts(" / length = "); 1065 _putx(vobj[vobj_id].length); 1066 _puts("\n"); 1067 #endif 1068 break; 1069 } 1031 1070 case VOBJ_TYPE_MEMSPACE: 1032 1071 { 1033 giet_memspace_t* memspace = (giet_memspace_t *) vobj[vobj_id].vaddr;1034 memspace->buffer = (void *) vobj[vobj_id].vaddr + 8;1035 memspace->size = vobj[vobj_id].length - 8;1036 1072 #if BOOT_DEBUG_VOBJS 1037 1073 _puts("MEMSPACE : "); … … 1039 1075 _puts(" / vaddr = "); 1040 1076 _putx(vobj[vobj_id].vaddr); 1077 _puts(" / paddr = "); 1078 _putl(vobj[vobj_id].paddr); 1041 1079 _puts(" / length = "); 1042 1080 _putx(vobj[vobj_id].length); 1043 _puts(" / buffer = "); 1081 _puts("\n"); 1082 #endif 1083 giet_memspace_t* memspace = (giet_memspace_t *) vobj[vobj_id].vaddr; 1084 memspace->buffer = (void *) vobj[vobj_id].vaddr + 8; 1085 memspace->size = vobj[vobj_id].length - 8; 1086 #if BOOT_DEBUG_VOBJS 1087 _puts(" buffer vbase = "); 1044 1088 _putx((unsigned int)memspace->buffer); 1045 1089 _puts(" / size = "); … … 1051 1095 case VOBJ_TYPE_PTAB: // nothing to initialize 1052 1096 { 1053 ptab_found = 1;1054 1097 #if BOOT_DEBUG_VOBJS 1055 1098 _puts("PTAB : "); 1056 1099 _puts(vobj[vobj_id].name); 1100 _puts(" / vaddr = "); 1101 _putx(vobj[vobj_id].vaddr); 1102 _puts(" / paddr = "); 1103 _putl(vobj[vobj_id].paddr); 1057 1104 _puts(" / length = "); 1058 1105 _putx(vobj[vobj_id].length); 1059 1106 _puts("\n"); 1060 1107 #endif 1108 ptab_found = 1; 1061 1109 break; 1062 1110 } 1063 1111 case VOBJ_TYPE_CONST: 1064 1112 { 1065 unsigned int* addr = (unsigned int *) vobj[vobj_id].vaddr;1066 *addr = vobj[vobj_id].init;1067 1113 #if BOOT_DEBUG_VOBJS 1068 1114 _puts("CONST : "); 1069 1115 _puts(vobj[vobj_id].name); 1070 _puts(" / Paddr :"); 1116 _puts(" / vaddr = "); 1117 _putx(vobj[vobj_id].vaddr); 1118 _puts(" / paddr = "); 1071 1119 _putl(vobj[vobj_id].paddr); 1120 _puts(" / length = "); 1121 _putx(vobj[vobj_id].length); 1072 1122 _puts(" / init = "); 1123 _putx(vobj[vobj_id].init); 1124 _puts("\n"); 1125 #endif 1126 unsigned int* addr = (unsigned int *) vobj[vobj_id].vaddr; 1127 *addr = vobj[vobj_id].init; 1128 1129 #if BOOT_DEBUG_VOBJS 1130 _puts(" init = "); 1073 1131 _putx(*addr); 1074 1132 _puts("\n"); … … 1213 1271 if ( cluster[cluster_id].procs > 0 ) 1214 1272 { 1215 // get scheduler array virtual base address and length 1273 // get scheduler array virtual base address and length from mapping 1216 1274 unsigned int sched_vbase; // schedulers segment virtual base address 1217 1275 unsigned int sched_length; // schedulers segment length … … 1303 1361 1304 1362 1305 // loop on irqs for actual HWI / PTI / WTI vectors initialisation1363 // loop on irqs in ICU for actual HWI / PTI / WTI vectors initialisation 1306 1364 for ( irq_id = periph[periph_id].irq_offset ; 1307 1365 irq_id < periph[periph_id].irq_offset + periph[periph_id].irqs ; … … 1309 1367 { 1310 1368 unsigned int lpid = irq[irq_id].dstid; 1311 unsigned int dstx = irq[irq_id].dstx;1312 unsigned int dsty = irq[irq_id].dsty;1313 if ( (dstx != x) || (dsty != y) )1314 {1315 _puts("\n[BOOT ERROR] Bad IRQ cluster coordinates in cluster[");1316 _putd( x );1317 _puts(",");1318 _putd( y );1319 _puts("]\n - dstx = ");1320 _putd( dstx );1321 _puts("\n - dsty = ");1322 _putd( dsty );1323 _puts("\n - x = ");1324 _putd( x );1325 _puts("\n - y = ");1326 _putd( y );1327 _puts("\n");1328 _exit();1329 }1330 1369 if ( lpid >= cluster[cluster_id].procs ) 1331 1370 { … … 1392 1431 _puts(" in vspace "); 1393 1432 _puts( vspace[vspace_id].name ); 1394 _puts(" running on cluster["); 1395 _putd( x ); 1396 _puts(","); 1397 _putd( y ); 1398 _puts("]\n"); 1433 _puts("\n"); 1399 1434 #endif 1400 1435 // compute gpid (global processor index) and scheduler base address … … 1562 1597 _putd( task_id ); 1563 1598 _puts(" allocated to processor["); 1564 _putd( x ) 1599 _putd( x ); 1565 1600 _puts(","); 1566 _putd( y ) 1601 _putd( y ); 1567 1602 _puts(","); 1568 _putd( lpid ) 1603 _putd( lpid ); 1569 1604 _puts("]\n - ctx[LTID] = "); 1570 1605 _putd( psched->context[ltid][CTX_LTID_ID] ); … … 1970 2005 } 1971 2006 #if BOOT_DEBUG_PERI 1972 _puts("- IOC /channels = ");2007 _puts("- IOC : channels = "); 1973 2008 _putd(channels); 1974 2009 _puts("\n"); … … 1983 2018 } 1984 2019 #if BOOT_DEBUG_PERI 1985 _puts("- CMA /channels = ");2020 _puts("- CMA : channels = "); 1986 2021 _putd(channels); 1987 2022 _puts("\n"); … … 1996 2031 } 1997 2032 #if BOOT_DEBUG_PERI 1998 _puts("- NIC /channels = ");2033 _puts("- NIC : channels = "); 1999 2034 _putd(channels); 2000 2035 _puts("\n"); … … 2006 2041 // nothing to do 2007 2042 #if BOOT_DEBUG_PERI 2008 _puts("- TTY /channels = ");2043 _puts("- TTY : channels = "); 2009 2044 _putd(channels); 2010 2045 _puts("\n"); … … 2018 2053 2019 2054 #if BOOT_DEBUG_PERI 2020 _puts("- IOB /channels = ");2055 _puts("- IOB : channels = "); 2021 2056 _putd(channels); 2022 2057 _puts(" / XICU_BASE = "); … … 2033 2068 // TODO 2034 2069 // get the iommu page table physical address 2035 // define IPI address mapping the IOC interrupt2036 2070 // set IOMMU page table address 2037 2071 // pseg_base[IOB_IOMMU_PTPR] = ptab_pbase; … … 2045 2079 2046 2080 #if BOOT_DEBUG_PERI 2047 _puts("- PIC /channels = ");2081 _puts("- PIC : channels = "); 2048 2082 _putd(channels); 2049 _puts("\n"); 2050 #endif 2051 // scan all HWI IRQs defined in mapping for PIC component, 2083 _puts(" at cycle "); 2084 _putd(_get_proctime()); 2085 _puts("\n"); 2086 #endif 2087 // scan all IRQs defined in mapping for PIC component, 2052 2088 // and initialises addresses for WTI IRQs 2053 2089 for ( channel_id = periph[periph_id].irq_offset ; … … 2055 2091 channel_id++ ) 2056 2092 { 2057 unsigned int hwi_id = irq[channel_id].srcid; // HWI index in PIC2058 unsigned int wti_id = irq[channel_id].dstid; // WTI index in XCU2059 unsigned int x = irq[channel_id].dstx; // XCU X coordinate2060 unsigned int y = irq[channel_id].dsty; // XCU Y coordinate2061 unsigned int cluster = (x<<Y_WIDTH) + y; // XCU cluster2093 unsigned int hwi_id = irq[channel_id].srcid; // HWI index in PIC 2094 unsigned int wti_id = irq[channel_id].dstid; // WTI index in XCU 2095 unsigned int x = irq[channel_id].dstx; // XCU X coordinate 2096 unsigned int y = irq[channel_id].dsty; // XCU Y coordinate 2097 unsigned int cluster_xy = (x<<Y_WIDTH) + y; // XCU cluster 2062 2098 unsigned int vaddr; 2063 2099 2064 2100 _xcu_get_wti_address( wti_id, &vaddr ); 2065 2101 2066 _pic_init( hwi_id, vaddr, cluster );2102 _pic_init( hwi_id, vaddr, cluster_xy ); 2067 2103 #if BOOT_DEBUG_PERI 2068 2104 _puts(" hwi_index = ");
Note: See TracChangeset
for help on using the changeset viewer.