Changeset 215 for soft/giet_vm/sys
- Timestamp:
- Sep 17, 2012, 10:47:46 AM (12 years ago)
- Location:
- soft/giet_vm/sys
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/common.c
r207 r215 158 158 void _puts(char* buffer) 159 159 { 160 unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base + 161 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 160 unsigned int* tty_address = (unsigned int*) &seg_tty_base; 162 161 unsigned int n; 163 162 -
soft/giet_vm/sys/drivers.c
r213 r215 17 17 // 18 18 // The following global parameters must be defined in the giet_config.h file: 19 // - CLUSTER_IO_ID20 19 // - CLUSTER_SIZE 21 20 // - NB_CLUSTERS … … 48 47 49 48 #if !defined(NB_CLUSTERS) 50 # error: You must define NB_CLUSTERS in 'giet_config.h'file49 # error: You must define NB_CLUSTERS in the configs file 51 50 #endif 52 51 53 52 #if !defined(NB_PROCS_MAX) 54 # error: You must define NB_PROCS_MAX in 'giet_config.h'file53 # error: You must define NB_PROCS_MAX in the configs file 55 54 #endif 56 55 … … 60 59 61 60 #if !defined(CLUSTER_SIZE) 62 # error: You must define CLUSTER_SIZE in 'giet_config.h'file61 # error: You must define CLUSTER_SIZE in the configs file 63 62 #endif 64 63 65 64 #if !defined(NB_TTYS) 66 # error: You must define NB_TTYS in 'giet_config.h'file65 # error: You must define NB_TTYS in the configs file 67 66 #endif 68 67 … … 84 83 85 84 #if !defined(NB_IOCS) 86 # error: You must define NB_IOCS in 'giet_config.h'file85 # error: You must define NB_IOCS in the configs file 87 86 #endif 88 87 89 88 #if ( NB_IOCS > 1 ) 90 89 # error: NB_IOCS cannot be larger than 1 90 #endif 91 92 #if !defined( USE_XICU ) 93 # error: You must define USE_XICU in the configs file 94 #endif 95 96 #if !defined( IOMMU_ACTIVE ) 97 # error: You must define IOMMU_ACTIVE in the configs file 91 98 #endif 92 99 … … 98 105 ////////////////////////////////////////////////////////////////////////////// 99 106 // The timers can be implemented in a vci_timer component or in a vci_xicu 100 // component (depending on the GIET_USE_XICU parameter).107 // component (depending on the USE_XICU parameter). 101 108 // There is one timer (or xicu) component per cluster. 102 109 // There is two types of timers: … … 132 139 if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1; 133 140 134 #if GIET_USE_XICU141 #if USE_XICU 135 142 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 136 143 (cluster_id * CLUSTER_SIZE) ); … … 160 167 if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1; 161 168 162 #if GIET_USE_XICU169 #if USE_XICU 163 170 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 164 171 (cluster_id * CLUSTER_SIZE) ); … … 189 196 if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1; 190 197 191 #if GIET_USE_XICU198 #if USE_XICU 192 199 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 193 200 (cluster_id * (unsigned)CLUSTER_SIZE) ); … … 260 267 } 261 268 262 unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base + 263 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 269 unsigned int* tty_address = (unsigned int*) &seg_tty_base; 264 270 265 271 for (nwritten = 0; nwritten < length; nwritten++) … … 322 328 323 329 // compute terminal base address 324 unsigned int *tty_address = (unsigned int*)( (char*)&seg_tty_base + 325 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 330 unsigned int *tty_address = (unsigned int*) &seg_tty_base; 326 331 327 332 *buffer = (unsigned char)tty_address[tty_id*TTY_SPAN + TTY_READ]; … … 355 360 unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 356 361 (cluster_id * (unsigned)CLUSTER_SIZE) ); 357 #if GIET_USE_XICU362 #if USE_XICU 358 363 if ( is_timer ) icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value; 359 364 else icu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value; … … 381 386 unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 382 387 (cluster_id * (unsigned)CLUSTER_SIZE) ); 383 #if GIET_USE_XICU388 #if USE_XICU 384 389 unsigned int prio = icu_address[XICU_REG(XICU_PRIO, proc_id)]; 385 390 unsigned int pti_ok = (prio & 0x00000001); … … 420 425 return 1; 421 426 422 unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base + 423 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 427 unsigned int* gcd_address = (unsigned int*) &seg_gcd_base; 424 428 425 429 gcd_address[register_index] = value; // write word … … 438 442 return 1; 439 443 440 unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base + 441 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 444 unsigned int* gcd_address = (unsigned int*) &seg_gcd_base; 442 445 443 446 *buffer = gcd_address[register_index]; // read word … … 530 533 if ( (unsigned int)user_vaddr & 0x3 ) return 1; 531 534 532 unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base + 533 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 535 unsigned int* ioc_address = (unsigned int*) &seg_ioc_base ; 534 536 535 537 unsigned int block_size = ioc_address[BLOCK_DEVICE_BLOCK_SIZE]; … … 561 563 if ( ix2 == 0 ) ppn_first = ppn; 562 564 563 if ( GIET_IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space565 if ( IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space 564 566 { 565 567 // check buffer length < 2 Mbytes … … 588 590 589 591 // compute buffer base address for IOC depending on IOMMU activation 590 if ( GIET_IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);592 if ( IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF); 591 593 else addr = (ppn_first << 12) | (user_vaddr & 0xFFF); 592 594 … … 622 624 623 625 // unmap the buffer from IOMMU page table if IOMMU is activated 624 if ( GIET_IOMMU_ACTIVE ) 625 { 626 unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base + 627 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 626 if ( IOMMU_ACTIVE ) 627 { 628 unsigned int* iob_address = (unsigned int*) &seg_iob_base; 628 629 629 630 for ( ix2 = 0 ; ix2 < _ioc_iommu_npages ; ix2++ ) … … 691 692 { 692 693 // get IOC base address 693 unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base + 694 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 694 unsigned int* ioc_address = (unsigned int*) &seg_ioc_base; 695 695 696 696 *status = ioc_address[BLOCK_DEVICE_STATUS]; // read status & reset IRQ … … 891 891 892 892 // compute frame buffer pbase address 893 unsigned int fb_vaddr = (unsigned int)&seg_fbf_base + 894 (CLUSTER_IO_ID * (unsigned int)CLUSTER_SIZE) + offset; 893 unsigned int fb_vaddr = (unsigned int)&seg_fbf_base + offset; 895 894 896 895 ko = _v2p_translate( (page_table_t*)user_ptab, … … 962 961 if ( ix2 == 0 ) ppn_first = ppn; 963 962 964 if ( GIET_IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space963 if ( IOMMU_ACTIVE ) // the user buffer must be remapped in the I/0 space 965 964 { 966 965 // check buffer length < 2 Mbytes … … 1071 1070 1072 1071 // unmap the buffer from IOMMU page table if IOMMU is activated 1073 if ( GIET_IOMMU_ACTIVE ) 1074 { 1075 unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base + 1076 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 1072 if ( IOMMU_ACTIVE ) 1073 { 1074 unsigned int* iob_address = (unsigned int*) &seg_iob_base; 1077 1075 1078 1076 unsigned int ix1 = _dma_iommu_ix1 + dma_id; -
soft/giet_vm/sys/irq_handler.c
r213 r215 18 18 #include <ctx_handler.h> 19 19 #include <hwr_mapping.h> 20 21 #if NB_TIMERS_MAX 22 extern volatile unsigned char _user_timer_event[NB_CLUSTERS*NB_TIMERS_MAX] ; 23 #endif 20 24 21 25 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/sys/kernel_init.c
r207 r215 48 48 unsigned int _idle_stack[NB_CLUSTERS*NB_PROCS_MAX*64]; 49 49 50 void _sys_exit() 51 { 52 while(1); 53 } 54 50 55 ////////////////////////////////////////////////////////////////////////////////// 51 56 // This function is the entry point for the last step of the boot sequence. … … 127 132 unsigned int pti_mask = 0; 128 133 134 unsigned int isr_switch_channel = 0xFFFFFFFF; 135 129 136 for ( irq_id = 0 ; irq_id < 32 ; irq_id++ ) 130 137 { … … 136 143 hwi_mask = hwi_mask | 0x1<< irq_id; 137 144 } 138 else if ( (isr == ISR_SWITCH) || (isr == ISR_TIMER))145 else if ( (isr == ISR_SWITCH) ) 139 146 { 147 pti_mask = pti_mask | 0x1<< irq_id; 148 isr_switch_channel = irq_id; 149 } 150 else if ( (isr == ISR_TIMER) ) 151 { 140 152 pti_mask = pti_mask | 0x1<< irq_id; 141 153 } … … 159 171 if ( tasks > 1 ) 160 172 { 173 if(isr_switch_channel == 0xFFFFFFFF) 174 { 175 _puts("\n[GIET ERROR] ISR_SWITCH not found on proc "); 176 _putd( proc_id); 177 _puts("\n"); 178 _sys_exit(); 179 } 161 180 _timer_start( cluster_id, 162 proc_id,181 isr_switch_channel, 163 182 GIET_TICK_VALUE ); 164 183 -
soft/giet_vm/sys/sys_handler.c
r207 r215 139 139 } 140 140 141 ///////////////////////////////////////////////////////////////////////////// 142 // _vobj_get_vbase() 143 // This function writes in vobj_buffer the virtual base address of a vobj 144 // identified by the (vspace_name / vobj_name ) couple. 145 // The vobj_type argument is redundant, and for checking purpose. 146 // returns 0: success, else: failed. 147 ///////////////////////////////////////////////////////////////////////////// 148 unsigned int _vobj_get_vbase( char* vspace_name, 149 char* vobj_name, 150 unsigned int vobj_type, 151 unsigned int* vobj_vaddr ) 141 int _get_vobj( char* vspace_name, char* vobj_name, unsigned int vobj_type, mapping_vobj_t** res_vobj) 152 142 { 153 143 mapping_header_t* header = (mapping_header_t*)&seg_mapping_base; … … 175 165 return -1; //wrong type 176 166 177 *vobj_vaddr = (unsigned int)vobj[vobj_id].vaddr; 167 *res_vobj = &vobj[vobj_id]; 168 178 169 return 0; 179 170 } … … 182 173 } 183 174 return -2; //not found 184 } 185 175 176 } 177 ///////////////////////////////////////////////////////////////////////////// 178 // _vobj_get_vbase() 179 // This function writes in vobj_vaddr the virtual base address of a vobj 180 // identified by the (vspace_name / vobj_name ) couple. 181 // The vobj_type argument is here only for the purpose of checking . 182 // returns 0: success, else: failed. 183 ///////////////////////////////////////////////////////////////////////////// 184 unsigned int _vobj_get_vbase( char* vspace_name, 185 char* vobj_name, 186 unsigned int vobj_type, 187 unsigned int* vobj_vaddr ) 188 { 189 mapping_vobj_t* res_vobj; 190 unsigned int ret; 191 if( (ret = _get_vobj(vspace_name, vobj_name, vobj_type, &res_vobj)) ) 192 { 193 return ret; 194 } 195 196 *vobj_vaddr = res_vobj->vaddr; 197 198 return 0; 199 } 200 201 ///////////////////////////////////////////////////////////////////////////// 202 // _vobj_get_length() 203 // This function writes in vobj_length the virtual base address of a vobj 204 // identified by the (vspace_name / vobj_name ) couple. 205 // The vobj_type argument is here only for the purpose of checking . 206 // returns 0: success, else: failed. 207 ///////////////////////////////////////////////////////////////////////////// 208 unsigned int _vobj_get_length(char* vspace_name, 209 char* vobj_name, 210 unsigned int vobj_type, 211 unsigned int* vobj_length ) 212 { 213 214 mapping_vobj_t* res_vobj; 215 unsigned int ret; 216 if( (ret = _get_vobj(vspace_name, vobj_name, vobj_type, &res_vobj)) ) 217 { 218 return ret; 219 } 220 221 *vobj_length = res_vobj->length; 222 223 return 0; 224 }
Note: See TracChangeset
for help on using the changeset viewer.