[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 7/8] i.MX: Standardize i.MX EPIT debug
From: |
Jean-Christophe Dubois |
Subject: |
[Qemu-devel] [PATCH v2 7/8] i.MX: Standardize i.MX EPIT debug |
Date: |
Wed, 21 Oct 2015 23:35:56 +0200 |
The goal is to have debug code always compiled during build.
We standardize all debug output on the following format:
[QOM_TYPE_NAME]reporting_function: debug message
We also replace IPRINTF with qemu_log_mask(). The qemu_log_mask() output
is following the same format as the above debug.
Signed-off-by: Jean-Christophe Dubois <address@hidden>
---
Changes since v1:
* use HWADDR_PRIx for address formating
* standardize qemu_log_mask on same model.
hw/timer/imx_epit.c | 37 +++++++++++++++----------------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
index 9649851..3078a07 100644
--- a/hw/timer/imx_epit.c
+++ b/hw/timer/imx_epit.c
@@ -16,8 +16,17 @@
#include "hw/misc/imx_ccm.h"
#include "qemu/main-loop.h"
-#define DEBUG_TIMER 0
-#if DEBUG_TIMER
+#ifndef DEBUG_IMX_EPIT
+#define DEBUG_IMX_EPIT 0
+#endif
+
+#define DPRINTF(fmt, args...) \
+ do { \
+ if (DEBUG_IMX_EPIT) { \
+ fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_EPIT, \
+ __func__, ##args); \
+ } \
+ } while (0)
static char const *imx_epit_reg_name(uint32_t reg)
{
@@ -37,24 +46,6 @@ static char const *imx_epit_reg_name(uint32_t reg)
}
}
-# define DPRINTF(fmt, args...) \
- do { fprintf(stderr, "%s: " fmt , __func__, ##args); } while (0)
-#else
-# define DPRINTF(fmt, args...) do {} while (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, __func__, ##args); } while (0)
-#else
-# define IPRINTF(fmt, args...) do {} while (0)
-#endif
-
/*
* Exact clock frequencies vary from board to board.
* These are typical.
@@ -161,7 +152,8 @@ static uint64_t imx_epit_read(void *opaque, hwaddr offset,
unsigned size)
break;
default:
- IPRINTF("Bad offset %x\n", reg);
+ qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%"
+ HWADDR_PRIx "\n", TYPE_IMX_EPIT, __func__, offset);
break;
}
@@ -271,7 +263,8 @@ static void imx_epit_write(void *opaque, hwaddr offset,
uint64_t value,
break;
default:
- IPRINTF("Bad offset %x\n", reg);
+ qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%"
+ HWADDR_PRIx "\n", TYPE_IMX_EPIT, __func__, offset);
break;
}
--
2.1.4
- [Qemu-devel] [PATCH v2 0/8] i.MX: Standardize debug code, Jean-Christophe Dubois, 2015/10/21
- [Qemu-devel] [PATCH v2 1/8] i.MX: Standardize i.MX serial debug., Jean-Christophe Dubois, 2015/10/21
- [Qemu-devel] [PATCH v2 2/8] i.MX: Standardize i.MX GPIO debug, Jean-Christophe Dubois, 2015/10/21
- [Qemu-devel] [PATCH v2 3/8] i.MX: Standardize i.MX I2C debug, Jean-Christophe Dubois, 2015/10/21
- [Qemu-devel] [PATCH v2 4/8] i.MX: Standardize i.MX AVIC debug, Jean-Christophe Dubois, 2015/10/21
- [Qemu-devel] [PATCH v2 5/8] i.MX: Standardize i.MX CCM debug, Jean-Christophe Dubois, 2015/10/21
- [Qemu-devel] [PATCH v2 7/8] i.MX: Standardize i.MX EPIT debug,
Jean-Christophe Dubois <=
- [Qemu-devel] [PATCH v2 8/8] i.MX: Standardize i.MX GPT debug, Jean-Christophe Dubois, 2015/10/21
- [Qemu-devel] [PATCH v2 6/8] i.MX: Standardize i.MX FEC debug, Jean-Christophe Dubois, 2015/10/21