From 9d52e9079da4f28abd788faf39e64fbf4b305561 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 1 Apr 2011 15:15:19 +1100 Subject: Add POWER7 support for ppc This adds emulation support for the recent POWER7 cpu to qemu. It's far from perfect - it's missing a number of POWER7 features so far, including any support for VSX or decimal floating point instructions. However, it's close enough to boot a kernel with the POWER7 PVR. Signed-off-by: David Gibson Signed-off-by: Alexander Graf --- hw/ppc.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'hw/ppc.c') diff --git a/hw/ppc.c b/hw/ppc.c index b55a84883e..dabb816510 100644 --- a/hw/ppc.c +++ b/hw/ppc.c @@ -247,6 +247,41 @@ void ppc970_irq_init (CPUState *env) env->irq_inputs = (void **)qemu_allocate_irqs(&ppc970_set_irq, env, PPC970_INPUT_NB); } + +/* POWER7 internal IRQ controller */ +static void power7_set_irq (void *opaque, int pin, int level) +{ + CPUState *env = opaque; + int cur_level; + + LOG_IRQ("%s: env %p pin %d level %d\n", __func__, + env, pin, level); + cur_level = (env->irq_input_state >> pin) & 1; + + switch (pin) { + case POWER7_INPUT_INT: + /* Level sensitive - active high */ + LOG_IRQ("%s: set the external IRQ state to %d\n", + __func__, level); + ppc_set_irq(env, PPC_INTERRUPT_EXT, level); + break; + default: + /* Unknown pin - do nothing */ + LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin); + return; + } + if (level) { + env->irq_input_state |= 1 << pin; + } else { + env->irq_input_state &= ~(1 << pin); + } +} + +void ppcPOWER7_irq_init (CPUState *env) +{ + env->irq_inputs = (void **)qemu_allocate_irqs(&power7_set_irq, env, + POWER7_INPUT_NB); +} #endif /* defined(TARGET_PPC64) */ /* PowerPC 40x internal IRQ controller */ -- cgit v1.2.3 From 8b2715a01e5dee434fbe070c3c855133203b2845 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sat, 9 Apr 2011 14:25:25 +0000 Subject: ppc: remove a write-only variable Remove a write-only variable, spotted by GCC 4.6.0: /src/qemu/hw/ppc.c: In function 'power7_set_irq': /src/qemu/hw/ppc.c:255:9: error: variable 'cur_level' set but not used [-Werror=unused-but-set-variable] Acked-by: Alexander Graf Signed-off-by: Blue Swirl --- hw/ppc.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'hw/ppc.c') diff --git a/hw/ppc.c b/hw/ppc.c index dabb816510..18733289db 100644 --- a/hw/ppc.c +++ b/hw/ppc.c @@ -252,11 +252,9 @@ void ppc970_irq_init (CPUState *env) static void power7_set_irq (void *opaque, int pin, int level) { CPUState *env = opaque; - int cur_level; LOG_IRQ("%s: env %p pin %d level %d\n", __func__, env, pin, level); - cur_level = (env->irq_input_state >> pin) & 1; switch (pin) { case POWER7_INPUT_INT: -- cgit v1.2.3