[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/14] hw/gpio/imx_gpio: Turn DPRINTF() into trace events
From: |
Bernhard Beschow |
Subject: |
[PATCH 14/14] hw/gpio/imx_gpio: Turn DPRINTF() into trace events |
Date: |
Wed, 8 Jan 2025 10:25:38 +0100 |
While at it add a trace event for input GPIO events.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/gpio/imx_gpio.c | 16 +++++-----------
hw/gpio/trace-events | 5 +++++
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c
index 67c47a7280..f77132fe04 100644
--- a/hw/gpio/imx_gpio.c
+++ b/hw/gpio/imx_gpio.c
@@ -24,6 +24,7 @@
#include "migration/vmstate.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "trace.h"
#ifndef DEBUG_IMX_GPIO
#define DEBUG_IMX_GPIO 0
@@ -34,14 +35,6 @@ typedef enum IMXGPIOLevel {
IMX_GPIO_LEVEL_HIGH = 1,
} IMXGPIOLevel;
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX_GPIO) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_GPIO, \
- __func__, ##args); \
- } \
- } while (0)
-
static const char *imx_gpio_reg_name(uint32_t reg)
{
switch (reg) {
@@ -111,6 +104,8 @@ static void imx_gpio_set(void *opaque, int line, int level)
IMXGPIOState *s = IMX_GPIO(opaque);
IMXGPIOLevel imx_level = level ? IMX_GPIO_LEVEL_HIGH : IMX_GPIO_LEVEL_LOW;
+ trace_imx_gpio_set(s->iomem.addr, line, imx_level);
+
imx_gpio_set_int_line(s, line, imx_level);
/* this is an input signal, so set PSR */
@@ -200,7 +195,7 @@ static uint64_t imx_gpio_read(void *opaque, hwaddr offset,
unsigned size)
break;
}
- DPRINTF("(%s) = 0x%" PRIx32 "\n", imx_gpio_reg_name(offset), reg_value);
+ trace_imx_gpio_read(s->iomem.addr, imx_gpio_reg_name(offset), reg_value);
return reg_value;
}
@@ -210,8 +205,7 @@ static void imx_gpio_write(void *opaque, hwaddr offset,
uint64_t value,
{
IMXGPIOState *s = IMX_GPIO(opaque);
- DPRINTF("(%s, value = 0x%" PRIx32 ")\n", imx_gpio_reg_name(offset),
- (uint32_t)value);
+ trace_imx_gpio_write(s->iomem.addr, imx_gpio_reg_name(offset), value);
switch (offset) {
case DR_ADDR:
diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events
index b91cc7e9a4..9ddacc12e3 100644
--- a/hw/gpio/trace-events
+++ b/hw/gpio/trace-events
@@ -1,5 +1,10 @@
# See docs/devel/tracing.rst for syntax documentation.
+# imx_gpio.c
+imx_gpio_read(uint64_t base, const char *reg, uint32_t value) "0x%" PRIx64
":[%s] -> 0x%" PRIx32
+imx_gpio_write(uint64_t base, const char *reg, uint32_t value) "0x%" PRIx64
":[%s] <- 0x%" PRIx32
+imx_gpio_set(uint64_t base, int line, int level) "0x%" PRIx64 ":[%d] <- %d"
+
# npcm7xx_gpio.c
npcm7xx_gpio_read(const char *id, uint64_t offset, uint64_t value) " %s
offset: 0x%04" PRIx64 " value 0x%08" PRIx64
npcm7xx_gpio_write(const char *id, uint64_t offset, uint64_t value) "%s
offset: 0x%04" PRIx64 " value 0x%08" PRIx64
--
2.47.1
- Re: [PATCH 01/14] hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate, (continued)
- [PATCH 13/14] hw/misc/imx6_src: Convert DPRINTF() to trace events, Bernhard Beschow, 2025/01/08
- [PATCH 03/14] hw/char/imx_serial: Update all state before restarting ageing timer, Bernhard Beschow, 2025/01/08
- [PATCH 06/14] hw/gpio/imx_gpio: Don't clear input GPIO values upon reset, Bernhard Beschow, 2025/01/08
- [PATCH 07/14] hw/sd/sd: Remove legacy sd_set_cb() in favor of GPIOs, Bernhard Beschow, 2025/01/08
- [PATCH 05/14] hw/pci-host/designware: Expose MSI IRQ, Bernhard Beschow, 2025/01/08
- [PATCH 10/14] hw/timer/imx_gpt: Remove unused define, Bernhard Beschow, 2025/01/08
- [PATCH 14/14] hw/gpio/imx_gpio: Turn DPRINTF() into trace events,
Bernhard Beschow <=
- [PATCH 08/14] hw/sd/sd: Allow for inverting polarities of presence and write-protect GPIOs, Bernhard Beschow, 2025/01/08
- [PATCH 09/14] hw/char/imx_serial: Turn some DPRINTF() statements into trace events, Bernhard Beschow, 2025/01/08
- [PATCH 11/14] tests/qtest/libqos: Reuse TYPE_IMX_I2C define, Bernhard Beschow, 2025/01/08
- [PATCH 12/14] hw/i2c/imx_i2c: Convert DPRINTF() to trace events, Bernhard Beschow, 2025/01/08