From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 4/6] qdev/prop: add property for target_phys_addr_t
Date: Mon, 13 Jul 2009 11:36:03 +0200 [thread overview]
Message-ID: <1247477765-17026-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1247477765-17026-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
Makefile.hw | 2 +-
hw/qdev-addr.c | 31 +++++++++++++++++++++++++++++++
hw/qdev-addr.h | 2 ++
3 files changed, 34 insertions(+), 1 deletions(-)
create mode 100644 hw/qdev-addr.c
create mode 100644 hw/qdev-addr.h
diff --git a/Makefile.hw b/Makefile.hw
index f7a9507..571e518 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -26,7 +26,7 @@ obj-y += m48t59.o escc.o
# SCSI layer
obj-y += lsi53c895a.o esp.o
-obj-y += dma-helpers.o sysbus.o
+obj-y += dma-helpers.o sysbus.o qdev-addr.o
all: $(HWLIB)
# Dummy command so that make thinks it has done something
diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c
new file mode 100644
index 0000000..f1bf2fa
--- /dev/null
+++ b/hw/qdev-addr.c
@@ -0,0 +1,31 @@
+#include "qdev.h"
+#include "qdev-addr.h"
+#include "targphys.h"
+
+/* --- target physical address --- */
+
+static int parse_taddr(DeviceState *dev, Property *prop, const char *str)
+{
+ target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop);
+
+ *ptr = strtoull(str, NULL, 16);
+ return 0;
+}
+
+static int print_taddr(DeviceState *dev, Property *prop, char *dest, size_t len)
+{
+ target_phys_addr_t *ptr = qdev_get_prop_ptr(dev, prop);
+ return snprintf(dest, len, "0x" TARGET_FMT_plx, *ptr);
+}
+
+PropertyInfo qdev_prop_taddr = {
+ .name = "taddr",
+ .size = sizeof(target_phys_addr_t),
+ .parse = parse_taddr,
+ .print = print_taddr,
+};
+
+int qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value)
+{
+ return qdev_prop_set(dev, name, &value, sizeof(value));
+}
diff --git a/hw/qdev-addr.h b/hw/qdev-addr.h
new file mode 100644
index 0000000..389c1d6
--- /dev/null
+++ b/hw/qdev-addr.h
@@ -0,0 +1,2 @@
+extern PropertyInfo qdev_prop_taddr;
+int qdev_prop_set_taddr(DeviceState *dev, const char *name, target_phys_addr_t value);
--
1.6.2.5
next prev parent reply other threads:[~2009-07-13 9:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 9:35 [Qemu-devel] [PATCH 0/6] qdev: property fixups Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 1/6] qdev/prop: make uint32 accept both hex and decimal Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 2/6] qdev/prop: add 16bit integer type Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 3/6] qdev/prop: unstatic and rename prop_ptr() Gerd Hoffmann
2009-07-13 9:36 ` Gerd Hoffmann [this message]
2009-07-13 9:36 ` [Qemu-devel] [PATCH 5/6] qdev/prop: convert m48t59 Gerd Hoffmann
2009-07-13 9:36 ` [Qemu-devel] [PATCH 6/6] qdev/prop: convert tcx Gerd Hoffmann
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=1247477765-17026-5-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--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).