Skip to content

Commit e3778c8

Browse files
shentokphilmd
authored andcommitted
hw/gpio/imx_gpio: Turn DPRINTF() into trace events
While at it add a trace event for input GPIO events. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Tested-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Bernhard Beschow <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
1 parent e589c0e commit e3778c8

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

hw/gpio/imx_gpio.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "migration/vmstate.h"
2525
#include "qemu/log.h"
2626
#include "qemu/module.h"
27+
#include "trace.h"
2728

2829
#ifndef DEBUG_IMX_GPIO
2930
#define DEBUG_IMX_GPIO 0
@@ -34,14 +35,6 @@ typedef enum IMXGPIOLevel {
3435
IMX_GPIO_LEVEL_HIGH = 1,
3536
} IMXGPIOLevel;
3637

37-
#define DPRINTF(fmt, args...) \
38-
do { \
39-
if (DEBUG_IMX_GPIO) { \
40-
fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_GPIO, \
41-
__func__, ##args); \
42-
} \
43-
} while (0)
44-
4538
static const char *imx_gpio_reg_name(uint32_t reg)
4639
{
4740
switch (reg) {
@@ -111,6 +104,8 @@ static void imx_gpio_set(void *opaque, int line, int level)
111104
IMXGPIOState *s = IMX_GPIO(opaque);
112105
IMXGPIOLevel imx_level = level ? IMX_GPIO_LEVEL_HIGH : IMX_GPIO_LEVEL_LOW;
113106

107+
trace_imx_gpio_set(DEVICE(s)->canonical_path, line, imx_level);
108+
114109
imx_gpio_set_int_line(s, line, imx_level);
115110

116111
/* this is an input signal, so set PSR */
@@ -200,7 +195,8 @@ static uint64_t imx_gpio_read(void *opaque, hwaddr offset, unsigned size)
200195
break;
201196
}
202197

203-
DPRINTF("(%s) = 0x%" PRIx32 "\n", imx_gpio_reg_name(offset), reg_value);
198+
trace_imx_gpio_read(DEVICE(s)->canonical_path, imx_gpio_reg_name(offset),
199+
reg_value);
204200

205201
return reg_value;
206202
}
@@ -210,8 +206,8 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value,
210206
{
211207
IMXGPIOState *s = IMX_GPIO(opaque);
212208

213-
DPRINTF("(%s, value = 0x%" PRIx32 ")\n", imx_gpio_reg_name(offset),
214-
(uint32_t)value);
209+
trace_imx_gpio_write(DEVICE(s)->canonical_path, imx_gpio_reg_name(offset),
210+
value);
215211

216212
switch (offset) {
217213
case DR_ADDR:

hw/gpio/trace-events

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# See docs/devel/tracing.rst for syntax documentation.
22

3+
# imx_gpio.c
4+
imx_gpio_read(const char *id, const char *reg, uint32_t value) "%s:[%s] -> 0x%" PRIx32
5+
imx_gpio_write(const char *id, const char *reg, uint32_t value) "%s:[%s] <- 0x%" PRIx32
6+
imx_gpio_set(const char *id, int line, int level) "%s:[%d] <- %d"
7+
38
# npcm7xx_gpio.c
49
npcm7xx_gpio_read(const char *id, uint64_t offset, uint64_t value) " %s offset: 0x%04" PRIx64 " value 0x%08" PRIx64
510
npcm7xx_gpio_write(const char *id, uint64_t offset, uint64_t value) "%s offset: 0x%04" PRIx64 " value 0x%08" PRIx64

0 commit comments

Comments
 (0)