]> git.proxmox.com Git - qemu.git/blame - hw/arm_pic.c
msi: Guard msi/msix_write_config with msi_present
[qemu.git] / hw / arm_pic.c
CommitLineData
5fafdf24 1/*
cdbdb648
PB
2 * Generic ARM Programmable Interrupt Controller support.
3 *
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
6 *
8e31bf38 7 * This code is licensed under the LGPL
cdbdb648
PB
8 */
9
87ecb68b
PB
10#include "hw.h"
11#include "arm-misc.h"
cdbdb648 12
d537cf6c 13/* Input 0 is IRQ and input 1 is FIQ. */
cdbdb648
PB
14static void arm_pic_cpu_handler(void *opaque, int irq, int level)
15{
5ae93306 16 CPUARMState *env = (CPUARMState *)opaque;
cdbdb648
PB
17 switch (irq) {
18 case ARM_PIC_CPU_IRQ:
19 if (level)
d537cf6c 20 cpu_interrupt(env, CPU_INTERRUPT_HARD);
cdbdb648 21 else
d537cf6c 22 cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
cdbdb648
PB
23 break;
24 case ARM_PIC_CPU_FIQ:
25 if (level)
d537cf6c 26 cpu_interrupt(env, CPU_INTERRUPT_FIQ);
cdbdb648 27 else
d537cf6c 28 cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
cdbdb648
PB
29 break;
30 default:
47601f22 31 hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
cdbdb648
PB
32 }
33}
34
5ae93306 35qemu_irq *arm_pic_init_cpu(CPUARMState *env)
cdbdb648 36{
d537cf6c 37 return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);
cdbdb648 38}