Changeset 14 for trunk/kernel/devices/dev_icu.c
- Timestamp:
- May 3, 2017, 1:23:24 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_icu.c
r3 r14 82 82 if( irq_type == HWI_TYPE ) 83 83 { 84 assert( (irq_index < icu->ext.icu.hwi_nr) , __FUNCTION__ , "illegal HWI" ); 85 } 86 if( irq_type == WTI_TYPE ) 87 { 88 assert( (irq_index < icu->ext.icu.wti_nr) , __FUNCTION__ , "illegal WTI" ); 89 } 90 if( irq_type == PTI_TYPE ) 91 { 92 assert( (irq_index < icu->ext.icu.pti_nr) , __FUNCTION__ , "illegal PTI" ); 84 if( irq_index >= icu->ext.icu.hwi_nr ) 85 { 86 printk("\n[PANIC] in %s : illegal HWI index = %d / max = %d\n", 87 __FUNCTION__ , irq_index , icu->ext.icu.hwi_nr ); 88 hal_core_sleep(); 89 } 90 } 91 else if( irq_type == WTI_TYPE ) 92 { 93 if( irq_index >= icu->ext.icu.wti_nr ) 94 { 95 printk("\n[PANIC] in %s : illegal WTI index = %d / max = %d\n", 96 __FUNCTION__ , irq_index , icu->ext.icu.wti_nr ); 97 hal_core_sleep(); 98 } 99 } 100 else // irq_type == PTI_TYPE 101 { 102 if( irq_index >= icu->ext.icu.pti_nr ) 103 { 104 printk("\n[PANIC] in %s : illegal PTI index = %d / max = %d\n", 105 __FUNCTION__ , irq_index , icu->ext.icu.pti_nr ); 106 hal_core_sleep(); 107 } 93 108 } 94 109 } // end dev_icu_check_irq() … … 107 122 dev_icu_check_irq( icu , irq_type , irq_index ); 108 123 109 // (1)call implementation specific ICU driver to enable IRQ124 // call implementation specific ICU driver to enable IRQ 110 125 if( icu->impl == IMPL_ICU_XCU ) 111 126 { 112 soclib_xcu_enable_irq( icu , 1<<irq_index , irq_type , lid ); 113 } 114 115 // (2) get selected core local pointer, and register 116 // source chdev pointer in relevant interrupt vector 117 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 118 core_set_irq_vector_entry( core , irq_type , irq_index , src_chdev ); 119 120 // (3) register IRQ type and index in source chdev descriptor 121 src_chdev->irq_type = irq_type; 122 src_chdev->irq_id = irq_index; 123 127 soclib_xcu_enable_irq( icu , 1<<irq_index , irq_type , lid ); 128 } 129 130 // This is only done for an HWI, or for a WTI that is not an IPI 131 if( (irq_type != PTI_TYPE) && (src_chdev != NULL) ) 132 { 133 // get selected core local pointer, and register 134 // source chdev pointer in relevant interrupt vector 135 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 136 core_set_irq_vector_entry( core , irq_type , irq_index , src_chdev ); 137 138 // (3) register IRQ type and index in source chdev descriptor 139 src_chdev->irq_type = irq_type; 140 src_chdev->irq_id = irq_index; 141 } 124 142 } // end dev_icu_enable_irq() 125 143 … … 136 154 dev_icu_check_irq( icu , irq_type , irq_index ); 137 155 138 // (1)call the implementation specific ICU driver to disable IRQ156 // call the implementation specific ICU driver to disable IRQ 139 157 if( icu->impl == IMPL_ICU_XCU ) 140 158 { … … 142 160 } 143 161 144 // (2) get selected remote core local pointer, and remove 145 // the source chdev xptr from relevant interrupt vector 146 147 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 148 core_set_irq_vector_entry( core , irq_type , irq_index , NULL ); 149 162 // This is only done for HWI or WTI that are not IPI 163 if( irq_type != PTI_TYPE ) 164 { 165 // get selected remote core local pointer, and remove 166 // the source chdev xptr from relevant interrupt vector 167 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 168 core_set_irq_vector_entry( core , irq_type , irq_index , NULL ); 169 } 150 170 } // end dev_icu_disable_irq() 171 172 /////////////////////////////////////// 173 void dev_icu_get_masks( lid_t lid, 174 uint32_t * hwi_mask, 175 uint32_t * wti_mask, 176 uint32_t * pti_mask ) 177 { 178 // get local pointer on local ICU chdev 179 xptr_t icu_xp = chdev_dir.icu[local_cxy]; 180 chdev_t * icu = (chdev_t *)GET_PTR( icu_xp ); 181 182 if( icu->impl == IMPL_ICU_XCU ) 183 { 184 soclib_xcu_get_masks( icu , lid , hwi_mask , wti_mask , pti_mask ); 185 } 186 } 151 187 152 188 ////////////////////////////////////////////// … … 312 348 dev_icu_ack_timer( index ); 313 349 314 // TODO execute all actions related to TICK event 315 core_clock( core ); 350 if( index < LOCAL_CLUSTER->cores_nr ) // its a TICK event 351 { 352 // TODO execute all actions related to TICK event 353 core_clock( core ); 354 } 355 else 356 { 357 printk("\n[WARNING] in %s : no handler for PTI %d on core %d in cluster %x\n", 358 __FUNCTION__ , index , core->lid , local_cxy ); 359 core->spurious_irqs ++; 360 dev_icu_disable_irq( core->lid , PTI_TYPE , index ); 361 } 316 362 } 317 363 } // end dev_icu_irq_handler() … … 340 386 // release lock 341 387 spinlock_unlock( lock ); 342 388 343 389 return index; 344 390 } // end dev_icu_wti_alloc()
Note: See TracChangeset
for help on using the changeset viewer.