From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
To: Jean-Christophe Dubois <jcd@tribudubois.net>
Cc: Peter Maydell <peter.maydell@linaro.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 4/8] i.MX: Standardize i.MX AVIC debug
Date: Tue, 20 Oct 2015 16:13:12 -0700 [thread overview]
Message-ID: <CAPokK=qWkCQQ-m2-2E_V_pYiVFhFkhdR7uivS9GLYPYS5V9fYg@mail.gmail.com> (raw)
In-Reply-To: <2bc3924a82a0e98562cdce9c2002a3c692eda874.1445375687.git.jcd@tribudubois.net>
On Tue, Oct 20, 2015 at 2:20 PM, Jean-Christophe Dubois
<jcd@tribudubois.net> wrote:
> The goal is to have debug code always compiled during build.
>
> Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
> ---
> hw/intc/imx_avic.c | 40 ++++++++++++++++------------------------
> 1 file changed, 16 insertions(+), 24 deletions(-)
>
> diff --git a/hw/intc/imx_avic.c b/hw/intc/imx_avic.c
> index 96c376b..11960aa 100644
> --- a/hw/intc/imx_avic.c
> +++ b/hw/intc/imx_avic.c
> @@ -17,27 +17,17 @@
>
> #include "hw/intc/imx_avic.h"
>
> -#define DEBUG_INT 1
> -#undef DEBUG_INT /* comment out for debugging */
> -
> -#ifdef DEBUG_INT
> -#define DPRINTF(fmt, args...) \
> -do { printf("%s: " fmt , TYPE_IMX_AVIC, ##args); } while (0)
> -#else
> -#define DPRINTF(fmt, args...) do {} while (0)
> +#ifndef DEBUG_IMX_AVIC
> +#define DEBUG_IMX_AVIC 0
> #endif
>
> -/*
> - * Define to 1 for messages about attempts to
> - * access unimplemented registers or similar.
> - */
> -#define DEBUG_IMPLEMENTATION 1
> -#if DEBUG_IMPLEMENTATION
> -# define IPRINTF(fmt, args...) \
> - do { fprintf(stderr, "%s: " fmt, TYPE_IMX_AVIC, ##args); } while (0)
> -#else
> -# define IPRINTF(fmt, args...) do {} while (0)
> -#endif
> +#define DPRINTF(fmt, args...) \
> + do { \
> + if (DEBUG_IMX_AVIC) { \
> + fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_AVIC, \
> + __func__, ##args); \
> + } \
> + } while (0)
>
> static const VMStateDescription vmstate_imx_avic = {
> .name = TYPE_IMX_AVIC,
> @@ -115,8 +105,8 @@ static uint64_t imx_avic_read(void *opaque,
> {
> IMXAVICState *s = (IMXAVICState *)opaque;
>
> + DPRINTF("read(offset = 0x%x)\n", (int)(offset >> 2));
>
> - DPRINTF("read(offset = 0x%x)\n", offset >> 2);
> switch (offset >> 2) {
> case 0: /* INTCNTL */
> return s->intcntl;
> @@ -213,7 +203,8 @@ static uint64_t imx_avic_read(void *opaque,
> return 0x4;
>
> default:
> - IPRINTF("%s: Bad offset 0x%x\n", __func__, (int)offset);
> + qemu_log_mask(LOG_GUEST_ERROR, "%s[%s]: Bad register at offset %d\n",
> + TYPE_IMX_AVIC, __func__, (int)offset);
> return 0;
> }
> }
> @@ -225,8 +216,8 @@ static void imx_avic_write(void *opaque, hwaddr offset,
>
> /* Vector Registers not yet supported */
> if (offset >= 0x100 && offset <= 0x2fc) {
> - IPRINTF("%s to vector register %d ignored\n", __func__,
> - (unsigned int)((offset - 0x100) >> 2));
> + qemu_log_mask(LOG_UNIMP, "%s[%s]: vector %d ignored\n",
> + TYPE_IMX_AVIC, __func__, (int)((offset - 0x100) >> 2));
> return;
> }
>
> @@ -305,7 +296,8 @@ static void imx_avic_write(void *opaque, hwaddr offset,
> return;
>
> default:
> - IPRINTF("%s: Bad offset %x\n", __func__, (int)offset);
> + qemu_log_mask(LOG_GUEST_ERROR, "%s[%s]: Bad register at offset %d\n",
> + TYPE_IMX_AVIC, __func__, (int)offset);
> }
> imx_avic_update(s);
Same comments as P1.
Regards,
Peter
> }
> --
> 2.1.4
>
next prev parent reply other threads:[~2015-10-20 23:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 21:19 [Qemu-devel] [PATCH 0/8] i.MX: Standardize debug code Jean-Christophe Dubois
2015-10-20 21:19 ` [Qemu-devel] [PATCH 1/8] i.MX: Standardize i.MX serial debug Jean-Christophe Dubois
2015-10-20 23:02 ` Peter Crosthwaite
2015-10-20 21:19 ` [Qemu-devel] [PATCH 2/8] i.MX: Standardize i.MX GPIO debug Jean-Christophe Dubois
2015-10-20 21:19 ` [Qemu-devel] [PATCH 3/8] i.MX: Standardize i.MX I2C debug Jean-Christophe Dubois
2015-10-20 23:12 ` Peter Crosthwaite
2015-10-20 21:20 ` [Qemu-devel] [PATCH 4/8] i.MX: Standardize i.MX AVIC debug Jean-Christophe Dubois
2015-10-20 23:13 ` Peter Crosthwaite [this message]
2015-10-20 21:20 ` [Qemu-devel] [PATCH 5/8] i.MX: Standardize i.MX CCM debug Jean-Christophe Dubois
2015-10-20 21:20 ` [Qemu-devel] [PATCH 6/8] i.MX: Standardize i.MX FEC debug Jean-Christophe Dubois
2015-10-20 21:20 ` [Qemu-devel] [PATCH 7/8] i.MX: Standardize i.MX EPIT debug Jean-Christophe Dubois
2015-10-20 21:20 ` [Qemu-devel] [PATCH 8/8] i.MX: Standardize i.MX GPT debug Jean-Christophe Dubois
2015-10-20 23:17 ` Peter Crosthwaite
2015-10-20 23:10 ` [Qemu-devel] [PATCH 0/8] i.MX: Standardize debug code Peter Crosthwaite
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='CAPokK=qWkCQQ-m2-2E_V_pYiVFhFkhdR7uivS9GLYPYS5V9fYg@mail.gmail.com' \
--to=crosthwaitepeter@gmail.com \
--cc=crosthwaite.peter@gmail.com \
--cc=jcd@tribudubois.net \
--cc=peter.maydell@linaro.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).