aboutsummaryrefslogtreecommitdiff
path: root/hw/nios2
diff options
context:
space:
mode:
Diffstat (limited to 'hw/nios2')
-rw-r--r--hw/nios2/10m50_devboard.c13
-rw-r--r--hw/nios2/cpu_pic.c31
2 files changed, 2 insertions, 42 deletions
diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
index 5c13b74..a14fc31 100644
--- a/hw/nios2/10m50_devboard.c
+++ b/hw/nios2/10m50_devboard.c
@@ -52,7 +52,7 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
ram_addr_t tcm_size = 0x1000; /* 1 kiB, but QEMU limit is 4 kiB */
ram_addr_t ram_base = 0x08000000;
ram_addr_t ram_size = 0x08000000;
- qemu_irq *cpu_irq, irq[32];
+ qemu_irq irq[32];
int i;
/* Physical TCM (tb_ram_1k) with alias at 0xc0000000 */
@@ -75,17 +75,8 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
/* Create CPU -- FIXME */
cpu = NIOS2_CPU(cpu_create(TYPE_NIOS2_CPU));
-
- /* Register: CPU interrupt controller (PIC) */
- cpu_irq = nios2_cpu_pic_init(cpu);
-
- /* Register: Internal Interrupt Controller (IIC) */
- dev = qdev_new("altera,iic");
- object_property_add_const_link(OBJECT(dev), "cpu", OBJECT(cpu));
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]);
for (i = 0; i < 32; i++) {
- irq[i] = qdev_get_gpio_in(dev, i);
+ irq[i] = qdev_get_gpio_in_named(DEVICE(cpu), "IRQ", i);
}
/* Register: Altera 16550 UART */
diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c
index 5ea7e52..3fb621c 100644
--- a/hw/nios2/cpu_pic.c
+++ b/hw/nios2/cpu_pic.c
@@ -26,32 +26,6 @@
#include "boot.h"
-static void nios2_pic_cpu_handler(void *opaque, int irq, int level)
-{
- Nios2CPU *cpu = opaque;
- CPUNios2State *env = &cpu->env;
- CPUState *cs = CPU(cpu);
- int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD;
-
- if (type == CPU_INTERRUPT_HARD) {
- env->irq_pending = level;
-
- if (level && (env->regs[CR_STATUS] & CR_STATUS_PIE)) {
- env->irq_pending = 0;
- cpu_interrupt(cs, type);
- } else if (!level) {
- env->irq_pending = 0;
- cpu_reset_interrupt(cs, type);
- }
- } else {
- if (level) {
- cpu_interrupt(cs, type);
- } else {
- cpu_reset_interrupt(cs, type);
- }
- }
-}
-
void nios2_check_interrupts(CPUNios2State *env)
{
if (env->irq_pending &&
@@ -60,8 +34,3 @@ void nios2_check_interrupts(CPUNios2State *env)
cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD);
}
}
-
-qemu_irq *nios2_cpu_pic_init(Nios2CPU *cpu)
-{
- return qemu_allocate_irqs(nios2_pic_cpu_handler, cpu, 2);
-}