Changes in kernel/arch/ia32/src/interrupt.c [d19b3fc:2a103b5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/interrupt.c
rd19b3fc r2a103b5 39 39 #include <debug.h> 40 40 #include <panic.h> 41 #include <arch/drivers/i8259.h> 41 #include <genarch/drivers/i8259/i8259.h> 42 #include <genarch/pic/pic_ops.h> 42 43 #include <halt.h> 43 44 #include <cpu.h> … … 61 62 */ 62 63 63 void (*disable_irqs_function)(uint16_t irqmask) = NULL; 64 void (*enable_irqs_function)(uint16_t irqmask) = NULL; 65 void (*eoi_function)(void) = NULL; 66 const char *irqs_info = NULL; 64 pic_ops_t *pic_ops = NULL; 67 65 68 66 void istate_decode(istate_t *istate) … … 88 86 istate_from_uspace(istate) ? istate->esp : 89 87 (uint32_t) &istate->esp); 90 }91 92 static void trap_virtual_eoi(void)93 {94 if (eoi_function)95 eoi_function();96 else97 panic("No eoi_function.");98 99 88 } 100 89 … … 179 168 istate_t *istate __attribute__((unused))) 180 169 { 181 trap_virtual_eoi();170 pic_ops->eoi(0); 182 171 tlb_shootdown_ipi_recv(); 183 172 } … … 192 181 bool ack = false; 193 182 assert(inum < IRQ_COUNT); 194 assert( (inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1));183 assert(inum != IRQ_PIC1); 195 184 196 185 irq_t *irq = irq_dispatch_and_lock(inum); … … 202 191 if (irq->preack) { 203 192 /* Send EOI before processing the interrupt */ 204 trap_virtual_eoi();193 pic_ops->eoi(inum); 205 194 ack = true; 206 195 } … … 208 197 irq_spinlock_unlock(&irq->lock, false); 209 198 } else { 210 /*211 * Spurious interrupt.212 */213 199 #ifdef CONFIG_DEBUG 214 printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum); 200 log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id, 201 inum); 215 202 #endif 216 203 } 217 204 218 205 if (!ack) 219 trap_virtual_eoi(); 206 pic_ops->eoi(inum); 207 } 208 209 static void pic_spurious(unsigned int n, istate_t *istate) 210 { 211 unsigned int inum = n - IVT_IRQBASE; 212 if (!pic_ops->is_spurious(inum)) { 213 /* This is actually not a spurious IRQ, so proceed as usual. */ 214 irq_interrupt(n, istate); 215 return; 216 } 217 pic_ops->handle_spurious(n); 218 #ifdef CONFIG_DEBUG 219 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id, 220 inum); 221 #endif 220 222 } 221 223 … … 228 230 229 231 for (i = 0; i < IRQ_COUNT; i++) { 230 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 232 if ((i != IRQ_PIC0_SPUR) && (i != IRQ_PIC1_SPUR) && 233 (i != IRQ_PIC1)) 231 234 exc_register(IVT_IRQBASE + i, "irq", true, 232 235 (iroutine_t) irq_interrupt); … … 239 242 exc_register(VECTOR_GP, "gp_fault", true, (iroutine_t) gp_fault); 240 243 exc_register(VECTOR_XM, "simd_fp", true, (iroutine_t) simd_fp_exception); 244 exc_register(VECTOR_PIC0_SPUR, "pic0_spurious", true, 245 (iroutine_t) pic_spurious); 246 exc_register(VECTOR_PIC1_SPUR, "pic1_spurious", true, 247 (iroutine_t) pic_spurious); 241 248 242 249 #ifdef CONFIG_SMP … … 246 253 } 247 254 248 void trap_virtual_enable_irqs(uint16_t irqmask)249 {250 if (enable_irqs_function)251 enable_irqs_function(irqmask);252 else253 panic("No enable_irqs_function.");254 }255 256 void trap_virtual_disable_irqs(uint16_t irqmask)257 {258 if (disable_irqs_function)259 disable_irqs_function(irqmask);260 else261 panic("No disable_irqs_function.");262 }263 264 255 /** @} 265 256 */
Note:
See TracChangeset
for help on using the changeset viewer.