From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-trivial@nongnu.org, "Guan Xuetao" <gxt@mprc.pku.edu.cn>,
"Michael Tokarev" <mjt@tls.msk.ru>,
"Laurent Vivier" <lvivier@redhat.com>
Subject: [Qemu-devel] [PATCH 2/6] hw/dma/puv3_gpio: Convert from DPRINTF() macro to trace event
Date: Wed, 12 Dec 2018 18:30:03 +0100 [thread overview]
Message-ID: <20181212173007.11407-3-lvivier@redhat.com> (raw)
In-Reply-To: <20181212173007.11407-1-lvivier@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
Makefile.objs | 1 +
hw/gpio/puv3_gpio.c | 15 +++++++--------
hw/gpio/trace-events | 6 ++++++
3 files changed, 14 insertions(+), 8 deletions(-)
create mode 100644 hw/gpio/trace-events
diff --git a/Makefile.objs b/Makefile.objs
index 1e1ff387d7..fbc3bad1e1 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -243,6 +243,7 @@ trace-events-subdirs += hw/vfio
trace-events-subdirs += hw/virtio
trace-events-subdirs += hw/watchdog
trace-events-subdirs += hw/xen
+trace-events-subdirs += hw/gpio
trace-events-subdirs += io
trace-events-subdirs += linux-user
trace-events-subdirs += migration
diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c
index 445afccf9f..1b52b2c291 100644
--- a/hw/gpio/puv3_gpio.c
+++ b/hw/gpio/puv3_gpio.c
@@ -11,9 +11,8 @@
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "hw/sysbus.h"
-
-#undef DEBUG_PUV3
#include "hw/unicore32/puv3.h"
+#include "trace.h"
#define TYPE_PUV3_GPIO "puv3_gpio"
#define PUV3_GPIO(obj) OBJECT_CHECK(PUV3GPIOState, (obj), TYPE_PUV3_GPIO)
@@ -46,9 +45,9 @@ static uint64_t puv3_gpio_read(void *opaque, hwaddr offset,
ret = s->reg_GPIR;
break;
default:
- DPRINTF("Bad offset 0x%x\n", offset);
+ trace_puv3_gpio_read_bad(offset);
}
- DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
+ trace_puv3_gpio_read(offset, ret);
return ret;
}
@@ -58,7 +57,7 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,
{
PUV3GPIOState *s = opaque;
- DPRINTF("offset 0x%x, value 0x%x\n", offset, value);
+ trace_puv3_gpio_write(offset, value);
switch (offset) {
case 0x04:
s->reg_GPDR = value;
@@ -67,14 +66,14 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,
if (s->reg_GPDR & value) {
s->reg_GPLR |= value;
} else {
- DPRINTF("Write gpio input port error!");
+ trace_puv3_gpio_write_error();
}
break;
case 0x0c:
if (s->reg_GPDR & value) {
s->reg_GPLR &= ~value;
} else {
- DPRINTF("Write gpio input port error!");
+ trace_puv3_gpio_write_error();
}
break;
case 0x10: /* GRER */
@@ -85,7 +84,7 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,
s->reg_GPIR = value;
break;
default:
- DPRINTF("Bad offset 0x%x\n", offset);
+ trace_puv3_gpio_write_bad(offset);
}
}
diff --git a/hw/gpio/trace-events b/hw/gpio/trace-events
new file mode 100644
index 0000000000..5708899a79
--- /dev/null
+++ b/hw/gpio/trace-events
@@ -0,0 +1,6 @@
+# hw/gpio/puv3_gpio.c
+puv3_gpio_read_bad(unsigned offset) "Bad offset 0x%x"
+puv3_gpio_read(unsigned offset, uint32_t value) "offset 0x%x, value 0x%x"
+puv3_gpio_write(unsigned offset, uint64_t value) "offset 0x%x, value 0x%" PRIx64
+puv3_gpio_write_error(void) "Write gpio input port error!"
+puv3_gpio_write_bad(unsigned offset) "Bad offset 0x%x"
--
2.19.2
next prev parent reply other threads:[~2018-12-12 17:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 17:30 [Qemu-devel] [PATCH 0/6] unicore32/puv3: Convert from DPRINTF() macro to trace event Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 1/6] hw/dma/puv3_dma: " Laurent Vivier
2018-12-12 17:30 ` Laurent Vivier [this message]
2018-12-12 17:30 ` [Qemu-devel] [PATCH 3/6] hw/dma/puv3_intc: " Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 4/6] hw/misc/puv3_pm: " Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 5/6] hw/timer/puv3_ost: " Laurent Vivier
2018-12-12 17:30 ` [Qemu-devel] [PATCH 6/6] unicore32/puv3: remove definition of DPRINTF Laurent Vivier
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=20181212173007.11407-3-lvivier@redhat.com \
--to=lvivier@redhat.com \
--cc=f4bug@amsat.org \
--cc=gxt@mprc.pku.edu.cn \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).