All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PATCH 02/31] hw/ppc.c: use LOG_IRQ instead of #ifdefs
Date: Fri, 12 Dec 2008 13:08:41 -0200	[thread overview]
Message-ID: <1229094550-2022-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1229094550-2022-1-git-send-email-ehabkost@redhat.com>

Use the new LOG_IRQ macro.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 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

  parent reply	other threads:[~2008-12-12 15:10 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12 15:08 [Qemu-devel] [PATCH 00/31] Logging code cleanup, take 2 Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 01/31] hw/ppc.c: LOG_IRQ macro Eduardo Habkost
2008-12-12 15:08 ` Eduardo Habkost [this message]
2008-12-12 15:08 ` [Qemu-devel] [PATCH 03/31] hw/ppc.c: LOG_TB macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 04/31] hw/ppc.c: use LOG_TB instead of #ifdefs Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 05/31] vl.c: LOG_IOPORT macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 06/31] vl.c: use LOG_IOPORT instead of #ifdefs Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 07/31] kqemu.c: LOG_INT macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 08/31] kqemu.c: use LOG_INT instead of #ifdefs Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 09/31] kqemu.c: LOG_INT_STATE macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 10/31] kqemu.c: use LOG_INT_STATE instead of #ifdefs Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 11/31] kqemu.c: kill remaining DEBUG #ifdefs Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 12/31] target-i386/op_helper.c: LOG_PCALL macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 13/31] target-i386/op_helper.c: LOG_PCALL_STATE macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 14/31] target-i386/op_helper.c: use LOG_PCALL instead of #ifdefs Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 15/31] target-i386/op_helper.c: use LOG_PCALL/LOG_PCALL_STATE Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 16/31] target-cris/translate.c: LOG_DIS macro Eduardo Habkost
2008-12-12 18:59   ` Stuart Brady
2008-12-12 15:08 ` [Qemu-devel] [PATCH 17/31] target-cris: replace D(fprintf(logfile, ...)) macros with D_LOG(...) Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 18/31] target-mips/translate.c: LOG_DISAS macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 19/31] target-ppc/helper.c: LOG_MMU macro Eduardo Habkost
2008-12-12 15:08 ` [Qemu-devel] [PATCH 20/31] target-ppc/helper.c: LOG_SWTLB macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 21/31] target-ppc/helper.c: convert commented-out debug code to LOG_SWTLB Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 22/31] target-ppc/helper.c: LOG_BATS macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 23/31] target-ppc/helper.c: LOG_SLB macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 24/31] target-ppc/helper.c: LOG_EXCP macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 25/31] target-ppc/helper.c: remaining LOG_BATS & LOG_MMU conversions Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 26/31] target-ppc/helper.c: LOG_MMU_STATE macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 27/31] target-ppc/op_helper.c: LOG_SWTLB macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 28/31] target-ppc/translate.c: LOG_DISAS macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 29/31] hw/ppc4xx_devs.c: LOG_UIC macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 30/31] target-alpha/translate.c: LOG_DISAS macro Eduardo Habkost
2008-12-12 15:09 ` [Qemu-devel] [PATCH 31/31] linux-user/vm86.c: LOG_VM86 macro Eduardo Habkost
2008-12-12 16:25 ` [Qemu-devel] [PATCH 00/31] Logging code cleanup, take 2 Blue Swirl
2008-12-12 16:54   ` Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1229094550-2022-3-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.