Changeset 452 for soft/giet_vm/giet_boot/boot.c
- Timestamp:
- Nov 11, 2014, 4:24:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_boot/boot.c
r436 r452 999 999 1000 1000 /////////////////////////////////////////////////////////////////////////////// 1001 // This function initializes all private vobjs defined in the vspaces, 1002 // such as mwmr channels, barriers and locks, because these vobjs 1003 // are not known, and not initialized by the compiler. 1001 // This function initializes the private vobjs that have the CONST type. 1004 1002 // The MMU is supposed to be activated... 1005 1003 /////////////////////////////////////////////////////////////////////////////// … … 1030 1028 vobj_id++) 1031 1029 { 1032 switch (vobj[vobj_id].type) 1033 { 1034 case VOBJ_TYPE_MWMR: // storage capacity is (vobj.length/4 - 5) words 1035 { 1036 #if BOOT_DEBUG_VOBJS 1037 _puts("MWMR : "); 1038 _puts(vobj[vobj_id].name); 1039 _puts(" / vaddr = "); 1040 _putx(vobj[vobj_id].vaddr); 1041 _puts(" / paddr = "); 1042 _putl(vobj[vobj_id].paddr); 1043 _puts(" / length = "); 1044 _putx(vobj[vobj_id].length); 1045 _puts("\n"); 1046 #endif 1047 mwmr_channel_t* mwmr = (mwmr_channel_t *) (vobj[vobj_id].vbase); 1048 mwmr->ptw = 0; 1049 mwmr->ptr = 0; 1050 mwmr->sts = 0; 1051 mwmr->width = vobj[vobj_id].init; 1052 mwmr->depth = (vobj[vobj_id].length >> 2) - 6; 1053 mwmr->lock = 0; 1054 #if BOOT_DEBUG_VOBJS 1055 _puts(" fifo depth = "); 1056 _putd(mwmr->depth); 1057 _puts(" / width = "); 1058 _putd(mwmr->width); 1059 _puts("\n"); 1060 #endif 1061 break; 1062 } 1063 case VOBJ_TYPE_ELF: // initialisation done by the loader 1064 { 1065 #if BOOT_DEBUG_VOBJS 1066 _puts("ELF : "); 1067 _puts(vobj[vobj_id].name); 1068 _puts(" / vaddr = "); 1069 _putx(vobj[vobj_id].vaddr); 1070 _puts(" / paddr = "); 1071 _putl(vobj[vobj_id].paddr); 1072 _puts(" / length = "); 1073 _putx(vobj[vobj_id].length); 1074 _puts("\n"); 1075 #endif 1076 break; 1077 } 1078 case VOBJ_TYPE_BLOB: // initialisation done by the loader 1079 { 1080 #if BOOT_DEBUG_VOBJS 1081 _puts("BLOB : "); 1082 _puts(vobj[vobj_id].name); 1083 _puts(" / vaddr = "); 1084 _putx(vobj[vobj_id].vaddr); 1085 _puts(" / paddr = "); 1086 _putl(vobj[vobj_id].paddr); 1087 _puts(" / length = "); 1088 _putx(vobj[vobj_id].length); 1089 _puts("\n"); 1090 #endif 1091 break; 1092 } 1093 case VOBJ_TYPE_BARRIER: // init is the number of participants 1094 { 1095 #if BOOT_DEBUG_VOBJS 1096 _puts("BARRIER : "); 1097 _puts(vobj[vobj_id].name); 1098 _puts(" / vaddr = "); 1099 _putx(vobj[vobj_id].vaddr); 1100 _puts(" / paddr = "); 1101 _putl(vobj[vobj_id].paddr); 1102 _puts(" / length = "); 1103 _putx(vobj[vobj_id].length); 1104 _puts("\n"); 1105 #endif 1106 giet_barrier_t* barrier = (giet_barrier_t *) (vobj[vobj_id].vbase); 1107 barrier->count = vobj[vobj_id].init; 1108 barrier->ntasks = vobj[vobj_id].init; 1109 barrier->sense = 0; 1110 #if BOOT_DEBUG_VOBJS 1111 _puts(" init_value = "); 1112 _putd(barrier->init); 1113 _puts("\n"); 1114 #endif 1115 break; 1116 } 1117 case VOBJ_TYPE_LOCK: // init value is "not taken" 1118 { 1119 #if BOOT_DEBUG_VOBJS 1120 _puts("LOCK : "); 1121 _puts(vobj[vobj_id].name); 1122 _puts(" / vaddr = "); 1123 _putx(vobj[vobj_id].vaddr); 1124 _puts(" / paddr = "); 1125 _putl(vobj[vobj_id].paddr); 1126 _puts(" / length = "); 1127 _putx(vobj[vobj_id].length); 1128 _puts("\n"); 1129 #endif 1130 unsigned int* lock = (unsigned int *) (vobj[vobj_id].vbase); 1131 *lock = 0; 1132 break; 1133 } 1134 case VOBJ_TYPE_BUFFER: // nothing to initialise 1135 { 1136 #if BOOT_DEBUG_VOBJS 1137 _puts("BUFFER : "); 1138 _puts(vobj[vobj_id].name); 1139 _puts(" / vaddr = "); 1140 _putx(vobj[vobj_id].vaddr); 1141 _puts(" / paddr = "); 1142 _putl(vobj[vobj_id].paddr); 1143 _puts(" / length = "); 1144 _putx(vobj[vobj_id].length); 1145 _puts("\n"); 1146 #endif 1147 break; 1148 } 1149 case VOBJ_TYPE_MEMSPACE: 1150 { 1151 #if BOOT_DEBUG_VOBJS 1152 _puts("MEMSPACE : "); 1153 _puts(vobj[vobj_id].name); 1154 _puts(" / vaddr = "); 1155 _putx(vobj[vobj_id].vaddr); 1156 _puts(" / paddr = "); 1157 _putl(vobj[vobj_id].paddr); 1158 _puts(" / length = "); 1159 _putx(vobj[vobj_id].length); 1160 _puts("\n"); 1161 #endif 1162 giet_memspace_t* memspace = (giet_memspace_t *) vobj[vobj_id].vbase; 1163 memspace->buffer = (void *) vobj[vobj_id].vbase + 8; 1164 memspace->size = vobj[vobj_id].length - 8; 1165 #if BOOT_DEBUG_VOBJS 1166 _puts(" buffer vbase = "); 1167 _putx((unsigned int)memspace->buffer); 1168 _puts(" / size = "); 1169 _putx(memspace->size); 1170 _puts("\n"); 1171 #endif 1172 break; 1173 } 1174 case VOBJ_TYPE_CONST: 1175 { 1030 if ( (vobj[vobj_id].type) == VOBJ_TYPE_CONST ) 1031 { 1176 1032 #if BOOT_DEBUG_VOBJS 1177 1033 _puts("CONST : "); 1178 1034 _puts(vobj[vobj_id].name); 1179 _puts(" / vaddr = ");1035 _puts(" / vaddr = "); 1180 1036 _putx(vobj[vobj_id].vaddr); 1181 _puts(" / paddr = ");1037 _puts(" / paddr = "); 1182 1038 _putl(vobj[vobj_id].paddr); 1183 _puts(" / length = "); 1184 _putx(vobj[vobj_id].length); 1185 _puts(" / init = "); 1039 _puts(" / value = "); 1186 1040 _putx(vobj[vobj_id].init); 1187 1041 _puts("\n"); 1188 1042 #endif 1189 unsigned int* addr = (unsigned int *) vobj[vobj_id].vbase; 1190 *addr = vobj[vobj_id].init; 1191 1192 #if BOOT_DEBUG_VOBJS 1193 _puts(" init = "); 1194 _putx(*addr); 1195 _puts("\n"); 1196 #endif 1197 break; 1198 } 1199 default: 1200 { 1201 _puts("\n[BOOT ERROR] in boot_vobjs_init() : Illegal vobj type "); 1202 _putd( vobj[vobj_id].type ); 1203 _puts(" in vspace "); 1204 _puts( vspace[vspace_id].name ); 1205 _puts("\n"); 1206 _exit(); 1207 } 1208 } // end switch type 1209 } // end loop on vobjs 1210 } // end loop on vspaces 1043 unsigned int* addr = (unsigned int *) vobj[vobj_id].vbase; 1044 *addr = vobj[vobj_id].init; 1045 } 1046 } 1047 } 1211 1048 } // end boot_vobjs_init() 1212 1049 … … 1673 1510 1674 1511 // initializes the task context 1675 psched->context[ltid][CTX_CR_ID] = 0; 1676 psched->context[ltid][CTX_SR_ID] = ctx_sr; 1677 psched->context[ltid][CTX_SP_ID] = ctx_sp; 1678 psched->context[ltid][CTX_EPC_ID] = ctx_epc; 1679 psched->context[ltid][CTX_PTPR_ID] = ctx_ptpr; 1680 psched->context[ltid][CTX_PTAB_ID] = ctx_ptab; 1681 psched->context[ltid][CTX_LTID_ID] = ltid; 1682 psched->context[ltid][CTX_GTID_ID] = task_id; 1683 psched->context[ltid][CTX_TRDID_ID] = thread_id; 1684 psched->context[ltid][CTX_VSID_ID] = vspace_id; 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; 1512 psched->context[ltid][CTX_CR_ID] = 0; 1513 psched->context[ltid][CTX_SR_ID] = ctx_sr; 1514 psched->context[ltid][CTX_SP_ID] = ctx_sp; 1515 psched->context[ltid][CTX_EPC_ID] = ctx_epc; 1516 psched->context[ltid][CTX_PTPR_ID] = ctx_ptpr; 1517 psched->context[ltid][CTX_PTAB_ID] = ctx_ptab; 1518 psched->context[ltid][CTX_LTID_ID] = ltid; 1519 psched->context[ltid][CTX_GTID_ID] = task_id; 1520 psched->context[ltid][CTX_TRDID_ID] = thread_id; 1521 psched->context[ltid][CTX_VSID_ID] = vspace_id; 1522 psched->context[ltid][CTX_RUN_ID] = 1; 1523 1524 psched->context[ltid][CTX_TTY_ID] = 0xFFFFFFFF; 1525 psched->context[ltid][CTX_CMA_FB_ID] = 0xFFFFFFFF; 1526 psched->context[ltid][CTX_CMA_RX_ID] = 0xFFFFFFFF; 1527 psched->context[ltid][CTX_CMA_TX_ID] = 0xFFFFFFFF; 1528 psched->context[ltid][CTX_NIC_RX_ID] = 0xFFFFFFFF; 1529 psched->context[ltid][CTX_NIC_TX_ID] = 0xFFFFFFFF; 1530 psched->context[ltid][CTX_TIM_ID] = 0xFFFFFFFF; 1531 psched->context[ltid][CTX_HBA_ID] = 0xFFFFFFFF; 1694 1532 1695 1533 #if BOOT_DEBUG_SCHED … … 2423 2261 _putd(_get_proctime()); 2424 2262 _puts("\n"); 2425 2263 2426 2264 // Initialise schedulers 2427 2265 boot_schedulers_init();
Note: See TracChangeset
for help on using the changeset viewer.