Changeset 407 for trunk/hal/tsar_mips32/drivers/soclib_pic.c
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_pic.c
r406 r407 43 43 extern lapic_input_t lapic_input; // defined in dev_pic.h / allocated in kernel_init.c 44 44 45 46 45 47 ////////////////////////////////////////////////////////////////////////////////////// 46 48 // SOCLIB PIC private functions … … 127 129 &pti_status ); 128 130 129 irq_dmsg("\n[D MSG] %s : enter for core[%x,%d]/ WTI = %x / HWI = %x / WTI = %x\n",131 irq_dmsg("\n[DBG] %s : core[%x,%d] enter / WTI = %x / HWI = %x / WTI = %x\n", 130 132 __FUNCTION__ , local_cxy , core->lid , wti_status , hwi_status , pti_status ); 131 133 … … 140 142 assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" ); 141 143 142 irq_dmsg("\n[D MSG] %s : core[%x,%d] received an IPI / cycle %d\n",144 irq_dmsg("\n[DBG] %s : core[%x,%d] received an IPI / cycle %d\n", 143 145 __FUNCTION__ , local_cxy , core->lid , hal_time_stamp() ); 144 146 … … 168 170 else // call relevant ISR 169 171 { 170 irq_dmsg("\n[D MSG] %s : core[%x,%d] received external WTI %d / cycle %d\n",172 irq_dmsg("\n[DBG] %s : core[%x,%d] received external WTI %d / cycle %d\n", 171 173 __FUNCTION__ , local_cxy , core->lid , index , hal_time_stamp() ); 172 174 … … 196 198 else // call relevant ISR 197 199 { 198 irq_dmsg("\n[D MSG] %s : core[%x,%d] received HWI %d / cycle %d\n",200 irq_dmsg("\n[DBG] %s : core[%x,%d] received HWI %d / cycle %d\n", 199 201 __FUNCTION__ , local_cxy , core->lid , index , hal_time_stamp() ); 200 202 … … 208 210 index = pti_status - 1; 209 211 210 irq_dmsg("\n[D MSG] %s : core[%x,%d] received PTI %d / cycle %d\n",212 irq_dmsg("\n[DBG] %s : core[%x,%d] received PTI %d / cycle %d\n", 211 213 __FUNCTION__ , core->lid , local_cxy , index , hal_time_stamp() ); 212 214 … … 248 250 uint32_t * iopic_seg_ptr = (uint32_t *)GET_PTR( pic->base ); 249 251 250 // reset the IOPIC component registers : maskall input IRQs252 // reset the IOPIC component registers : disable all input IRQs 251 253 for( i = 0 ; i < CONFIG_MAX_EXTERNAL_IRQS ; i++ ) 252 254 { … … 364 366 { 365 367 // get external IRQ index 366 uint32_t irq_id; 367 if ( func == DEV_FUNC_IOC ) irq_id = iopic_input.ioc[channel]; 368 else if( func == DEV_FUNC_TXT ) irq_id = iopic_input.txt[channel]; 369 else if( (func == DEV_FUNC_NIC) && is_rx ) irq_id = iopic_input.nic_rx[channel]; 370 else if( (func == DEV_FUNC_NIC) && !is_rx ) irq_id = iopic_input.nic_tx[channel]; 371 else if( func == DEV_FUNC_IOB ) irq_id = iopic_input.iob; 368 uint32_t hwi_id; 369 if ( func == DEV_FUNC_IOC ) hwi_id = iopic_input.ioc[channel]; 370 else if( func == DEV_FUNC_TXT && is_rx ) hwi_id = iopic_input.txt_rx[channel]; 371 else if( func == DEV_FUNC_TXT && !is_rx ) hwi_id = iopic_input.txt_tx[channel]; 372 else if( (func == DEV_FUNC_NIC) && is_rx ) hwi_id = iopic_input.nic_rx[channel]; 373 else if( (func == DEV_FUNC_NIC) && !is_rx ) hwi_id = iopic_input.nic_tx[channel]; 374 else if( func == DEV_FUNC_IOB ) hwi_id = iopic_input.iob; 372 375 else assert( false , __FUNCTION__ , "illegal device functionnal type\n"); 373 376 … … 385 388 uint32_t lsb_wdata = (uint32_t)wti_xp; 386 389 uint32_t msb_wdata = (uint32_t)(wti_xp >> 32); 387 xptr_t lsb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+ irq_id*IOPIC_SPAN+IOPIC_ADDRESS );388 xptr_t msb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+ irq_id*IOPIC_SPAN+IOPIC_EXTEND );390 xptr_t lsb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_ADDRESS ); 391 xptr_t msb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_EXTEND ); 389 392 hal_remote_sw( lsb_xp , lsb_wdata ); 390 393 hal_remote_sw( msb_xp , msb_wdata ); 391 394 392 // unmaskIRQ in IOPIC393 hal_remote_sw( XPTR( seg_pic_cxy , seg_pic_ptr+ irq_id*IOPIC_SPAN+IOPIC_MASK ), 1 );395 // enable IRQ in IOPIC 396 hal_remote_sw( XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_MASK ), 1 ); 394 397 395 398 // update the WTI interrupt vector for core[lid] 396 399 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 397 400 ((soclib_pic_core_t *)core->pic_extend)->wti_vector[wti_id] = src_chdev; 401 402 pic_dmsg("\n[DBG] %s : %s / channel = %d / rx = %d / hwi_id = %d / wti_id = %d / cluster = %x\n", 403 __FUNCTION__ , chdev_func_str( func ) , channel , is_rx , hwi_id , wti_id , local_cxy ); 404 398 405 } 399 406 else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) ) // internal IRQ => HWI … … 411 418 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 412 419 ((soclib_pic_core_t *)core->pic_extend)->wti_vector[hwi_id] = src_chdev; 420 421 pic_dmsg("\n[DBG] %s : %s / channel = %d / hwi_id = %d / cluster = %x\n", 422 __FUNCTION__ , chdev_func_str( func ) , channel , hwi_id , local_cxy ); 423 413 424 } 414 425 else … … 494 505 495 506 // set period value in XCU (in cycles) 496 uint32_t cycles = period * SOCLIB_CYCLES_PER_MS * CONFIG_SCHED_TICK_MS_PERIOD;507 uint32_t cycles = period * SOCLIB_CYCLES_PER_MS; 497 508 base[(XCU_PTI_PER << 5) | lid] = cycles; 498 509 … … 525 536 } 526 537 527 528 538 ///////////////////////// 539 void soclib_pic_ack_ipi() 540 { 541 // get calling core local index 542 lid_t lid = CURRENT_THREAD->core->lid; 543 544 // get pointer on local XCU segment base 545 uint32_t * base = soclib_pic_xcu_base(); 546 547 // acknowlege IPI 548 uint32_t ack = base[(XCU_WTI_REG << 5) | lid]; 549 550 // we must make a fake use for ack value to avoid a warning 551 if( (ack + 1) == 0 ) panic("this should never happen"); 552 } 553 554
Note: See TracChangeset
for help on using the changeset viewer.