Changeset 547 for soft/giet_vm/giet_kernel
- Timestamp:
- Apr 5, 2015, 12:09:09 AM (10 years ago)
- Location:
- soft/giet_vm/giet_kernel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/exc_handler.c
r528 r547 32 32 // Initialize the exception vector indexed by the CR XCODE field 33 33 /////////////////////////////////////////////////////////////////////////////////// 34 35 __attribute__((section(".kdata"))) 34 36 const _exc_func_t _cause_vector[16] = 35 37 { … … 52 54 }; 53 55 54 static const char * exc_type[] =55 {56 "strange unknown cause",57 "illegal read address",58 "illegal write address",59 "inst bus error",60 "data bus error",61 "breakpoint",62 "reserved instruction",63 "illegal coproc access",64 "arithmetic overflow",65 };66 67 56 /////////////////////////////////////////////// 68 57 static void _display_cause( unsigned int type ) … … 77 66 78 67 68 const char * mips32_exc_str[] = { "strange unknown cause ", 69 "illegal read address ", 70 "illegal write address ", 71 "inst bus error ", 72 "data bus error ", 73 "breakpoint ", 74 "reserved instruction ", 75 "illegal coproc access ", 76 "arithmetic overflow "}; 77 79 78 _printf("\n[GIET] Exception for task %d on processor[%d,%d,%d] at cycle %d\n" 80 79 " - type : %s\n" … … 83 82 "...Task desactivated\n", 84 83 task, x, y, lpid, _get_proctime(), 85 exc_type[type], _get_epc(), _get_bvar() );84 mips32_exc_str[type], _get_epc(), _get_bvar() ); 86 85 87 86 // goes to sleeping state -
soft/giet_vm/giet_kernel/irq_handler.c
r528 r547 18 18 #include <mmc_driver.h> 19 19 #include <bdv_driver.h> 20 #include <hba_driver.h> 20 21 #include <dma_driver.h> 21 #include <s pi_driver.h>22 #include <sdc_driver.h> 22 23 #include <mwr_driver.h> 23 24 #include <mapping_info.h> … … 51 52 // irq_handler.h / mapping.py / xml_driver.c 52 53 ///////////////////////////////////////////////////////////////////////// 53 __attribute__((section(".kdata"))) 54 char* _isr_type_name[] = { "DEFAULT", 55 "TICK" , 56 "TTY_RX" , 57 "TTY_TX" , 58 "BDV" , 59 "TIMER" , 60 "WAKUP" , 61 "NIC_RX" , 62 "NIC_TX" , 63 "CMA" , 64 "MMC" , 65 "DMA" , 66 "SPI" , 67 "MWR" , 68 "HBA" }; 54 55 __attribute__((section(".kdata"))) 56 char* _isr_type_str[] = { "DEFAULT", 57 "TICK" , 58 "TTY_RX" , 59 "TTY_TX" , 60 "BDV" , 61 "TIMER" , 62 "WAKUP" , 63 "NIC_RX" , 64 "NIC_TX" , 65 "CMA" , 66 "MMC" , 67 "DMA" , 68 "SPI" , 69 "MWR" , 70 "HBA" }; 71 72 __attribute__((section(".kdata"))) 73 char* _irq_type_str[] = { "HWI", 74 "WTI", 75 "PTI" }; 69 76 70 77 //////////////////// … … 84 91 mapping_periph_t* pic = NULL; 85 92 86 // scan external peripherals to find XCU93 // scan external peripherals to find PIC 87 94 unsigned int min = cluster[cluster_io].periph_offset ; 88 95 unsigned int max = min + cluster[cluster_io].periphs ; … … 184 191 _pic_init( irq_id , wti_addr, cluster_xy ); 185 192 186 // initializes the WTI interrupt vector entry for XCU 187 _schedulers[x][y][p]->wti_vector[wti_id] = isr_channel<<16 | isr_type; 193 // initializes the WTI interrupt vector entry for target XCU 194 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 195 psched->wti_vector[wti_id] = isr_channel<<16 | isr_type; 196 197 #if GIET_DEBUG_IRQS 198 _printf("\n[DEBUG IRQS] _ext_irq_alloc() for P[%d,%d,%d] at cycle %d\n" 199 " wti_id = %d / isr_type = %s / channel = %d / pic_input = %d\n", 200 x , y , p , _get_proctime() , 201 wti_id , _isr_type_str[isr_type] , isr_channel , irq_id ); 202 #endif 188 203 189 204 } // end ext_irq_alloc() … … 265 280 channel = (entry>>16) & 0x00007FFF; 266 281 267 #if GIET_DEBUG_IRQS // we don't take the TTY lock to avoid deadlocks 268 char* irq_type_str[] = { "HWI", "WTI", "PTI" }; 269 _puts("\n[IRQS DEBUG] Processor["); 270 _putd(x); 271 _puts(","); 272 _putd(y); 273 _puts(","); 274 _putd(lpid); 275 _puts("] enters _irq_demux() at cycle "); 276 _putd(_get_proctime() ); 277 _puts("\n "); 278 _puts(irq_type_str[irq_type] ); 279 _puts(" : irq_id = "); 280 _putd(irq_id); 281 _puts(" / isr_type = "); 282 _putd(isr_type); 283 _puts(" / channel = "); 284 _putd(channel); 285 _puts("\n"); 282 #if GIET_DEBUG_IRQS // we don't take the TTY lock to avoid deadlocks 283 _nolock_printf("\n[DEBUG IRQS] _irq_demux() Processor[%d,%d,%d] enters at cycle %d\n" 284 " irq_type = %s / irq_id = %d / isr_type = %s / channel = %d\n", 285 x , y , lpid , _get_proctime() , 286 _irq_type_str[irq_type] , irq_id , _isr_type_str[isr_type] , channel ); 286 287 #endif 287 288 288 289 // ISR call 289 290 if ( isr_type == ISR_TICK ) _isr_tick ( irq_type, irq_id, channel ); 290 else if ( isr_type == ISR_WAKUP ) _isr_wakup ( irq_type, irq_id, channel );291 else if ( isr_type == ISR_BDV ) _bdv_isr ( irq_type, irq_id, channel );292 else if ( isr_type == ISR_CMA ) _cma_isr ( irq_type, irq_id, channel );293 291 else if ( isr_type == ISR_TTY_RX ) _tty_rx_isr ( irq_type, irq_id, channel ); 294 292 else if ( isr_type == ISR_TTY_TX ) _tty_tx_isr ( irq_type, irq_id, channel ); 293 else if ( isr_type == ISR_BDV ) _bdv_isr ( irq_type, irq_id, channel ); 294 else if ( isr_type == ISR_TIMER ) _timer_isr ( irq_type, irq_id, channel ); 295 else if ( isr_type == ISR_WAKUP ) _isr_wakup ( irq_type, irq_id, channel ); 295 296 else if ( isr_type == ISR_NIC_RX ) _nic_rx_isr ( irq_type, irq_id, channel ); 296 297 else if ( isr_type == ISR_NIC_TX ) _nic_tx_isr ( irq_type, irq_id, channel ); 297 else if ( isr_type == ISR_ TIMER ) _timer_isr( irq_type, irq_id, channel );298 else if ( isr_type == ISR_CMA ) _cma_isr ( irq_type, irq_id, channel ); 298 299 else if ( isr_type == ISR_MMC ) _mmc_isr ( irq_type, irq_id, channel ); 299 300 else if ( isr_type == ISR_DMA ) _dma_isr ( irq_type, irq_id, channel ); 300 else if ( isr_type == ISR_S PI ) _spi_isr ( irq_type, irq_id, channel );301 else if ( isr_type == ISR_SDC ) _sdc_isr ( irq_type, irq_id, channel ); 301 302 else if ( isr_type == ISR_MWR ) _mwr_isr ( irq_type, irq_id, channel ); 303 else if ( isr_type == ISR_HBA ) _hba_isr ( irq_type, irq_id, channel ); 302 304 else 303 305 { 304 306 _printf("\n[GIET ERROR] in _irq_demux() :" 305 307 " illegal ISR type on processor[%d,%d,%d] at cycle %d\n" 306 " - irq_type = % d\n"308 " - irq_type = %s\n" 307 309 " - irq_id = %d\n" 308 " - isr_type = %x\n", 309 x, y, lpid, _get_proctime(), irq_type, irq_id, isr_type ); 310 " - isr_type = %s\n", 311 x, y, lpid, _get_proctime(), 312 _irq_type_str[irq_type] , irq_id , _isr_type_str[isr_type] ); 313 _exit(); 310 314 } 311 315 } -
soft/giet_vm/giet_kernel/irq_handler.h
r528 r547 31 31 ISR_MMC = 10, 32 32 ISR_DMA = 11, 33 ISR_S PI= 12,33 ISR_SDC = 12, 34 34 ISR_MWR = 13, 35 35 ISR_HBA = 14, … … 47 47 extern unsigned char _wti_alloc_two[X_SIZE][Y_SIZE][NB_PROCS_MAX]; 48 48 extern unsigned char _wti_alloc_ter[X_SIZE][Y_SIZE][NB_PROCS_MAX]; 49 50 // ISR type names 51 extern char* _isr_type_str[GIET_ISR_TYPE_MAX]; 52 53 // IRQ type names 54 extern char* _irq_type_str[3]; 49 55 50 56 /////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_kernel/kernel_init.c
r536 r547 18 18 #include <fat32.h> 19 19 #include <xcu_driver.h> 20 #include <nic_driver.h> 21 #include <hba_driver.h> 20 22 #include <mmc_driver.h> 21 23 #include <ctx_handler.h> … … 144 146 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 145 147 unsigned int p = gpid & ((1<<P_WIDTH)-1); 146 147 //////////////////////////////////////////////////////////////////////////// 148 // Step 0 : P[0,0,0] initialises various global vaiables 149 //////////////////////////////////////////////////////////////////////////// 148 unsigned int unused; 149 150 //////////////////////////////////////////////////////////////////////////// 151 // Step 0 : P[0,0,0] initialises global variables and peripherals 152 //////////////////////////////////////////////////////////////////////////// 150 153 151 154 if ( gpid == 0 ) 152 155 { 153 // distributed kernel heap initialisation156 ////// distributed kernel heap initialisation 154 157 _heap_init(); 155 158 156 159 #if GIET_DEBUG_INIT 157 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes kernel HEAP init\n", 158 x, y, p ); 159 #endif 160 // distributed lock for TTY0 160 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes kernel heap init\n", x, y, p ); 161 #endif 162 ////// distributed lock for TTY0 161 163 _sqt_lock_init( &_tty0_sqt_lock ); 162 164 163 165 #if GIET_DEBUG_INIT 164 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes TTY0 lock init\n", 165 x , y , p ); 166 #endif 167 // distributed kernel barrier between all processors 166 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes TTY0 lock init\n", x , y , p ); 167 #endif 168 ////// distributed kernel barrier between all processors 168 169 _sqt_barrier_init( &_all_procs_barrier ); 169 170 170 171 #if GIET_DEBUG_INIT 171 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes barrier init\n", 172 x , y , p ); 173 #endif 174 175 #if USE_PIC 176 177 // _ext_irq_index[isr][channel] initialisation 178 _ext_irq_init(); 179 180 // routing HBA IRQ to proc[0,0,0] EXT_IRQ_ONE 181 unsigned int unused = 0; 182 if ( USE_IOC_HBA ) _ext_irq_alloc( ISR_HBA , 0 , &unused ); 183 184 #if GIET_DEBUG_INIT 185 _nolock_printf("\n[DEBUG KERNEL_INIT] P[%d,%d,%d] completes ext_irq init\n", 186 x , y , p ); 187 #endif 188 189 #endif // USE_PIC 190 191 // release other processors 172 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes barrier init\n", x , y , p ); 173 #endif 174 175 ////// _ext_irq_index[isr][channel] initialisation 176 if ( USE_PIC ) _ext_irq_init(); 177 178 #if GIET_DEBUG_INIT 179 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes ext_irq init\n", x , y , p ); 180 #endif 181 182 ////// NIC peripheral initialization 183 if ( USE_NIC ) _nic_global_init( 1, // broadcast accepted 184 1, // bypass activated 185 0, // tdm non activated 186 0 ); // tdm period 187 #if GIET_DEBUG_INIT 188 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes NIC init\n", x , y , p ); 189 #endif 190 191 ////// HBA peripheral initialisation 192 if ( USE_IOC_HBA ) 193 { 194 _hba_init(); 195 196 // routing HBA IRQ to proc[0,0,0] 197 _ext_irq_alloc( ISR_HBA , 0 , &unused ); 198 } 199 200 #if GIET_DEBUG_INIT 201 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes HBA init\n", x , y , p ); 202 #endif 203 204 ////// release other processors 192 205 _kernel_init_done = 1; 193 206 } … … 209 222 210 223 #if GIET_DEBUG_INIT 211 _printf("\n[DEBUG K ERNEL_INIT] P[%d,%d,%d] initialises SCHED array\n"224 _printf("\n[DEBUG KINIT] P[%d,%d,%d] initialises SCHED array\n" 212 225 " - scheduler vbase = %x\n" 213 226 " - tasks = %d\n", … … 255 268 256 269 #if GIET_DEBUG_INIT 257 _printf("\n[DEBUG K ERNEL_INIT] P[%d,%d,%d] initialises PTABS arrays"270 _printf("\n[DEBUG KINIT] P[%d,%d,%d] initialises PTABS arrays" 258 271 " and context for task %d \n" 259 272 " - ptabs_vaddr[%d][%d][%d] = %x\n" … … 297 310 298 311 #if GIET_DEBUG_INIT 299 _printf("\n[DEBUG K ERNEL_INIT] P[%d,%d,%d] initializes idle_task and starts TICK\n",312 _printf("\n[DEBUG KINIT] P[%d,%d,%d] initializes idle_task and starts TICK\n", 300 313 x, y, p ); 301 314 #endif … … 306 319 307 320 #if GIET_DEBUG_INIT 308 _printf("\n[DEBUG K ERNEL_INIT] P[%d,%d,%d] completes kernel FAT init\n",321 _printf("\n[DEBUG KINIT] P[%d,%d,%d] completes kernel FAT init\n", 309 322 x, y, p ); 310 323 #endif … … 334 347 335 348 #if GIET_DEBUG_INIT 336 _printf("\n[DEBUG K ERNEL_INIT] P[%d,%d,%d] jumps to user code at cycle %d\n"349 _printf("\n[DEBUG KINIT] P[%d,%d,%d] jumps to user code at cycle %d\n" 337 350 " ltid = %d / sp = %x / sr = %x / ptpr = %x / epc = %x\n", 338 351 x , y , p , _get_proctime() , -
soft/giet_vm/giet_kernel/sys_handler.c
r536 r547 22 22 #include <giet_config.h> 23 23 #include <mapping_info.h> 24 #include <irq_handler.h> 24 25 #include <io.h> 25 26 … … 517 518 else 518 519 { 519 _set_context_slot( CTX_TTY_ID, channel ); 520 return 0; 521 } 520 } 521 522 // allocate a WTI mailbox to the calling proc if external IRQ 523 unsigned int unused; 524 if ( USE_PIC ) _ext_irq_alloc( ISR_TTY_RX , channel , &unused ); 525 526 // update calling task index 527 _set_context_slot( CTX_TTY_ID, channel ); 528 529 return 0; 522 530 } 523 531 … … 700 708 unsigned int thread = _get_context_slot( CTX_TRDID_ID ); 701 709 _printf("\n[GIET DEBUG NIC] Task %d enters sys_nic_alloc() at cycle %d\n" 702 " nic_channel = %d / cma_channel = %d\n"710 " nic_channel = %d / cma_channel = %d\n", 703 711 thread , _get_proctime() , nic_channel , cma_channel ); 704 712 #endif … … 754 762 755 763 #if GIET_DEBUG_NIC 756 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_start()" 757 " allocates container in cluster[%d,%d] : vaddr = %x / paddr = %l\n", 764 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_alloc()" 765 " allocates container in cluster[%d,%d]\n" 766 " vaddr = %x / paddr = %l\n", 758 767 thread , cx , cy , vaddr , cont_paddr ); 759 768 #endif … … 781 790 782 791 #if GIET_DEBUG_NIC 783 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_start()" 784 " get NIC chbuf : paddr = %l\n", 792 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_alloc() get NIC chbuf : paddr = %l\n", 785 793 thread , nic_chbuf_pbase ); 786 794 #endif … … 793 801 794 802 #if GIET_DEBUG_NIC 795 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_ start()"796 " get kernel chbuf :vaddr = %x / paddr = %l\n",803 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_alloc() get kernel chbuf\n" 804 " vaddr = %x / paddr = %l\n", 797 805 thread , vaddr , ker_chbuf_pbase ); 798 806 #endif … … 851 859 #if GIET_DEBUG_NIC 852 860 unsigned int thread = _get_context_slot( CTX_TRDID_ID ); 853 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_start() at cycle %d "854 " get NIC channel = %d / CMA channel = %d\n",861 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_start() at cycle %d\n" 862 " get NIC channel = %d / CMA channel = %d\n", 855 863 thread, _get_proctime(), nic_channel, cma_channel ); 856 864 #endif … … 969 977 970 978 #if GIET_DEBUG_NIC 971 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() read buf fer descriptor%d\n"972 " at cycle = %d /paddr = %l / buffer descriptor = %l\n",979 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() read buf_desc %d at cycle %d\n" 980 " paddr = %l / buffer descriptor = %l\n", 973 981 thread, index, _get_proctime(), buffer_desc_paddr, buffer_descriptor ); 974 982 #endif … … 993 1001 NIC_CONTAINER_SIZE ); 994 1002 #if GIET_DEBUG_NIC 995 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() transfer "996 " kernel buffer %lto user buffer %l at cycle %d\n",1003 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() transfer kernel buffer %l\n" 1004 " to user buffer %l at cycle %d\n", 997 1005 thread , kernel_buffer_paddr , user_buffer_paddr , _get_proctime() ); 998 1006 #endif
Note: See TracChangeset
for help on using the changeset viewer.