From 73c694565c6144e0c4e15041b5250a04a25107c3 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Mon, 13 Jan 2014 13:35:26 +1000 Subject: Microblaze: Convert Microblaze-pic handling to GPIOs This patch uses inbound GPIO lines (IRQ and FIR) for interrupts instead of using the old pic_cpu method, which doesn't correspond to real hardware. This creates the CPU's inbound IRQ and FIR GPIO lines and updates the Microblaze boards to use this new method. Signed-off-by: Alistair Francis Suggested-by: Peter Crosthwaite Reveiwed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: Edgar E. Iglesias --- target-microblaze/cpu.c | 21 +++++++++++++++++++++ target-microblaze/cpu.h | 4 ++++ 2 files changed, 25 insertions(+) (limited to 'target-microblaze') diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c index 0ef9aa4..f108c0b 100644 --- a/target-microblaze/cpu.c +++ b/target-microblaze/cpu.c @@ -4,6 +4,7 @@ * Copyright (c) 2009 Edgar E. Iglesias * Copyright (c) 2009-2012 PetaLogix Qld Pty Ltd. * Copyright (c) 2012 SUSE LINUX Products GmbH + * Copyright (c) 2009 Edgar E. Iglesias, Axis Communications AB. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,6 +34,21 @@ static void mb_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.sregs[SR_PC] = value; } +#ifndef CONFIG_USER_ONLY +static void microblaze_cpu_set_irq(void *opaque, int irq, int level) +{ + MicroBlazeCPU *cpu = opaque; + CPUState *cs = CPU(cpu); + int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD; + + if (level) { + cpu_interrupt(cs, type); + } else { + cpu_reset_interrupt(cs, type); + } +} +#endif + /* CPUClass::reset() */ static void mb_cpu_reset(CPUState *s) { @@ -111,6 +127,11 @@ static void mb_cpu_initfn(Object *obj) set_float_rounding_mode(float_round_nearest_even, &env->fp_status); +#ifndef CONFIG_USER_ONLY + /* Inbound IRQ and FIR lines */ + qdev_init_gpio_in(DEVICE(cpu), microblaze_cpu_set_irq, 2); +#endif + if (tcg_enabled() && !tcg_initialized) { tcg_initialized = true; mb_tcg_init(); diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index e1415f0..1df014e 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -48,6 +48,10 @@ typedef struct CPUMBState CPUMBState; /* MicroBlaze-specific interrupt pending bits. */ #define CPU_INTERRUPT_NMI CPU_INTERRUPT_TGT_EXT_3 +/* Meanings of the MBCPU object's two inbound GPIO lines */ +#define MB_CPU_IRQ 0 +#define MB_CPU_FIR 1 + /* Register aliases. R0 - R15 */ #define R_SP 1 #define SR_PC 0 -- cgit v1.1