1 /* 2 * Generic ARM Programmable Interrupt Controller support. 3 * 4 * Copyright (c) 2006 CodeSourcery. 5 * Written by Paul Brook 6 * 7 * This code is licenced under the LGPL 8 */ 9 10 #include "hw/hw.h" 11 #include "hw/i386/pc.h" 12 #include "hw/arm/arm.h" 13 14 /* Stub functions for hardware that doesn't exist. */ 15 void pic_info(Monitor *mon) 16 { 17 } 18 19 void irq_info(Monitor *mon) 20 { 21 } 22 23 24 /* Input 0 is IRQ and input 1 is FIQ. */ 25 static void arm_pic_cpu_handler(void *opaque, int irq, int level) 26 { 27 CPUOldState *env = (CPUOldState *)opaque; 28 CPUState *cpu = ENV_GET_CPU(env); 29 switch (irq) { 30 case ARM_PIC_CPU_IRQ: 31 if (level) 32 cpu_interrupt(cpu, CPU_INTERRUPT_HARD); 33 else 34 cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); 35 break; 36 case ARM_PIC_CPU_FIQ: 37 if (level) 38 cpu_interrupt(cpu, CPU_INTERRUPT_FIQ); 39 else 40 cpu_reset_interrupt(cpu, CPU_INTERRUPT_FIQ); 41 break; 42 default: 43 hw_error("arm_pic_cpu_handler: Bad interrput line %d\n", irq); 44 } 45 } 46 47 qemu_irq *arm_pic_init_cpu(CPUOldState *env) 48 { 49 return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2); 50 } 51