From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LB9ew-0007nO-3Y for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LB9en-0007bV-JB for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:23 -0500 Received: from [199.232.76.173] (port=50382 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LB9en-0007bA-6c for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:21 -0500 Received: from mx2.redhat.com ([66.187.237.31]:32976) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LB9ek-0001e0-VW for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:20 -0500 From: Eduardo Habkost Date: Fri, 12 Dec 2008 13:08:41 -0200 Message-Id: <1229094550-2022-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1229094550-2022-1-git-send-email-ehabkost@redhat.com> References: <1229094550-2022-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 02/31] hw/ppc.c: use LOG_IRQ instead of #ifdefs Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost Use the new LOG_IRQ macro. Signed-off-by: Eduardo Habkost --- hw/ppc.c | 180 ++++++++++--------------------------------------------------- 1 files changed, 30 insertions(+), 150 deletions(-) diff --git a/hw/ppc.c b/hw/ppc.c index f9f819c..01cb44c 100644 --- a/hw/ppc.c +++ b/hw/ppc.c @@ -54,13 +54,9 @@ static void ppc_set_irq (CPUState *env, int n_IRQ, int level) if (env->pending_interrupts == 0) cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); } -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: %p n_IRQ %d level %d => pending %08" PRIx32 + LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, env->pending_interrupts, env->interrupt_request); - } -#endif } /* PowerPC 6xx / 7xx internal IRQ controller */ @@ -69,24 +65,16 @@ static void ppc6xx_set_irq (void *opaque, int pin, int level) CPUState *env = opaque; int cur_level; -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: env %p pin %d level %d\n", __func__, + LOG_IRQ("%s: env %p pin %d level %d\n", __func__, env, pin, level); - } -#endif cur_level = (env->irq_input_state >> pin) & 1; /* Don't generate spurious events */ if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) { switch (pin) { case PPC6xx_INPUT_TBEN: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: %s the time base\n", + LOG_IRQ("%s: %s the time base\n", __func__, level ? "start" : "stop"); - } -#endif if (level) { cpu_ppc_tb_start(env); } else { @@ -94,22 +82,14 @@ static void ppc6xx_set_irq (void *opaque, int pin, int level) } case PPC6xx_INPUT_INT: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the external IRQ state to %d\n", + LOG_IRQ("%s: set the external IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_EXT, level); break; case PPC6xx_INPUT_SMI: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the SMI IRQ state to %d\n", + LOG_IRQ("%s: set the SMI IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_SMI, level); break; case PPC6xx_INPUT_MCP: @@ -118,12 +98,8 @@ static void ppc6xx_set_irq (void *opaque, int pin, int level) * 603/604/740/750: check HID0[EMCP] */ if (cur_level == 1 && level == 0) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: raise machine check state\n", + LOG_IRQ("%s: raise machine check state\n", __func__); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_MCK, 1); } break; @@ -132,22 +108,14 @@ static void ppc6xx_set_irq (void *opaque, int pin, int level) /* XXX: TODO: relay the signal to CKSTP_OUT pin */ /* XXX: Note that the only way to restart the CPU is to reset it */ if (level) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: stop the CPU\n", __func__); - } -#endif + LOG_IRQ("%s: stop the CPU\n", __func__); env->halted = 1; } break; case PPC6xx_INPUT_HRESET: /* Level sensitive - active low */ if (level) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: reset the CPU\n", __func__); - } -#endif + LOG_IRQ("%s: reset the CPU\n", __func__); env->interrupt_request |= CPU_INTERRUPT_EXITTB; /* XXX: TOFIX */ #if 0 @@ -158,21 +126,13 @@ static void ppc6xx_set_irq (void *opaque, int pin, int level) } break; case PPC6xx_INPUT_SRESET: -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the RESET IRQ state to %d\n", + LOG_IRQ("%s: set the RESET IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_RESET, level); break; default: /* Unknown pin - do nothing */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: unknown IRQ pin %d\n", __func__, pin); - } -#endif + LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin); return; } if (level) @@ -195,34 +155,22 @@ static void ppc970_set_irq (void *opaque, int pin, int level) CPUState *env = opaque; int cur_level; -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: env %p pin %d level %d\n", __func__, + LOG_IRQ("%s: env %p pin %d level %d\n", __func__, env, pin, level); - } -#endif cur_level = (env->irq_input_state >> pin) & 1; /* Don't generate spurious events */ if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) { switch (pin) { case PPC970_INPUT_INT: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the external IRQ state to %d\n", + LOG_IRQ("%s: set the external IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_EXT, level); break; case PPC970_INPUT_THINT: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the SMI IRQ state to %d\n", __func__, + LOG_IRQ("%s: set the SMI IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_THERM, level); break; case PPC970_INPUT_MCP: @@ -231,12 +179,8 @@ static void ppc970_set_irq (void *opaque, int pin, int level) * 603/604/740/750: check HID0[EMCP] */ if (cur_level == 1 && level == 0) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: raise machine check state\n", + LOG_IRQ("%s: raise machine check state\n", __func__); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_MCK, 1); } break; @@ -244,18 +188,10 @@ static void ppc970_set_irq (void *opaque, int pin, int level) /* Level sensitive - active low */ /* XXX: TODO: relay the signal to CKSTP_OUT pin */ if (level) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: stop the CPU\n", __func__); - } -#endif + LOG_IRQ("%s: stop the CPU\n", __func__); env->halted = 1; } else { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: restart the CPU\n", __func__); - } -#endif + LOG_IRQ("%s: restart the CPU\n", __func__); env->halted = 0; } break; @@ -263,40 +199,24 @@ static void ppc970_set_irq (void *opaque, int pin, int level) /* Level sensitive - active low */ if (level) { #if 0 // XXX: TOFIX -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: reset the CPU\n", __func__); - } -#endif + LOG_IRQ("%s: reset the CPU\n", __func__); cpu_reset(env); #endif } break; case PPC970_INPUT_SRESET: -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the RESET IRQ state to %d\n", + LOG_IRQ("%s: set the RESET IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_RESET, level); break; case PPC970_INPUT_TBEN: -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the TBEN state to %d\n", __func__, + LOG_IRQ("%s: set the TBEN state to %d\n", __func__, level); - } -#endif /* XXX: TODO */ break; default: /* Unknown pin - do nothing */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: unknown IRQ pin %d\n", __func__, pin); - } -#endif + LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin); return; } if (level) @@ -319,103 +239,63 @@ static void ppc40x_set_irq (void *opaque, int pin, int level) CPUState *env = opaque; int cur_level; -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: env %p pin %d level %d\n", __func__, + LOG_IRQ("%s: env %p pin %d level %d\n", __func__, env, pin, level); - } -#endif cur_level = (env->irq_input_state >> pin) & 1; /* Don't generate spurious events */ if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) { switch (pin) { case PPC40x_INPUT_RESET_SYS: if (level) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: reset the PowerPC system\n", + LOG_IRQ("%s: reset the PowerPC system\n", __func__); - } -#endif ppc40x_system_reset(env); } break; case PPC40x_INPUT_RESET_CHIP: if (level) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: reset the PowerPC chip\n", __func__); - } -#endif + LOG_IRQ("%s: reset the PowerPC chip\n", __func__); ppc40x_chip_reset(env); } break; case PPC40x_INPUT_RESET_CORE: /* XXX: TODO: update DBSR[MRR] */ if (level) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: reset the PowerPC core\n", __func__); - } -#endif + LOG_IRQ("%s: reset the PowerPC core\n", __func__); ppc40x_core_reset(env); } break; case PPC40x_INPUT_CINT: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the critical IRQ state to %d\n", + LOG_IRQ("%s: set the critical IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_CEXT, level); break; case PPC40x_INPUT_INT: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the external IRQ state to %d\n", + LOG_IRQ("%s: set the external IRQ state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_EXT, level); break; case PPC40x_INPUT_HALT: /* Level sensitive - active low */ if (level) { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: stop the CPU\n", __func__); - } -#endif + LOG_IRQ("%s: stop the CPU\n", __func__); env->halted = 1; } else { -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: restart the CPU\n", __func__); - } -#endif + LOG_IRQ("%s: restart the CPU\n", __func__); env->halted = 0; } break; case PPC40x_INPUT_DEBUG: /* Level sensitive - active high */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: set the debug pin state to %d\n", + LOG_IRQ("%s: set the debug pin state to %d\n", __func__, level); - } -#endif ppc_set_irq(env, PPC_INTERRUPT_DEBUG, level); break; default: /* Unknown pin - do nothing */ -#if defined(PPC_DEBUG_IRQ) - if (loglevel & CPU_LOG_INT) { - fprintf(logfile, "%s: unknown IRQ pin %d\n", __func__, pin); - } -#endif + LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin); return; } if (level) -- 1.5.5.GIT