qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 5/7] qdev/prop: convert m48t59
Date: Mon, 13 Jul 2009 15:13:08 +0200	[thread overview]
Message-ID: <1247490790-15783-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1247490790-15783-1-git-send-email-kraxel@redhat.com>


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/m48t59.c |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/hw/m48t59.c b/hw/m48t59.c
index 798d292..7e53dce 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -43,11 +43,11 @@
 struct m48t59_t {
     SysBusDevice busdev;
     /* Model parameters */
-    int type; // 2 = m48t02, 8 = m48t08, 59 = m48t59
+    uint32_t type; // 2 = m48t02, 8 = m48t08, 59 = m48t59
     /* Hardware parameters */
     qemu_irq IRQ;
     uint32_t io_base;
-    uint16_t size;
+    uint32_t size;
     /* RTC management */
     time_t   time_offset;
     time_t   stop_time;
@@ -623,9 +623,9 @@ m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base,
     m48t59_t *d;
 
     dev = qdev_create(NULL, "m48t59");
-    qdev_set_prop_int(dev, "type", type);
-    qdev_set_prop_int(dev, "size", size);
-    qdev_set_prop_int(dev, "io_base", io_base);
+    qdev_prop_set_uint32(dev, "type", type);
+    qdev_prop_set_uint32(dev, "size", size);
+    qdev_prop_set_uint32(dev, "io_base", io_base);
     qdev_init(dev);
     s = sysbus_from_qdev(dev);
     sysbus_connect_irq(s, 0, IRQ);
@@ -647,11 +647,8 @@ static void m48t59_init1(SysBusDevice *dev)
     m48t59_t *s = FROM_SYSBUS(m48t59_t, dev);
     int mem_index;
 
-    s->size = qdev_get_prop_int(&dev->qdev, "size", -1);
     s->buffer = qemu_mallocz(s->size);
     sysbus_init_irq(dev, &s->IRQ);
-    s->io_base = qdev_get_prop_int(&dev->qdev, "io_base", 0);
-    s->type = qdev_get_prop_int(&dev->qdev, "type", -1);
 
     mem_index = cpu_register_io_memory(nvram_read, nvram_write, s);
     sysbus_init_mmio(dev, s->size, mem_index);
@@ -666,9 +663,33 @@ static void m48t59_init1(SysBusDevice *dev)
     register_savevm("m48t59", -1, 1, m48t59_save, m48t59_load, s);
 }
 
+static SysBusDeviceInfo m48t59_info = {
+    .init = m48t59_init1,
+    .qdev.name  = "m48t59",
+    .qdev.size  = sizeof(m48t59_t),
+    .qdev.props = (Property[]) {
+        {
+            .name   = "size",
+            .info   = &qdev_prop_uint32,
+            .offset = offsetof(m48t59_t, size),
+            .defval = (uint32_t[]) { -1 },
+        },{
+            .name   = "type",
+            .info   = &qdev_prop_uint32,
+            .offset = offsetof(m48t59_t, type),
+            .defval = (uint32_t[]) { -1 },
+        },{
+            .name   = "io_base",
+            .info   = &qdev_prop_hex32,
+            .offset = offsetof(m48t59_t, io_base),
+        },
+        {/* end of list */}
+    }
+};
+
 static void m48t59_register_devices(void)
 {
-    sysbus_register_dev("m48t59", sizeof(m48t59_t), m48t59_init1);
+    sysbus_register_withprop(&m48t59_info);
 }
 
 device_init(m48t59_register_devices)
-- 
1.6.2.5

  parent reply	other threads:[~2009-07-13 13:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 13:13 [Qemu-devel] [PATCH v2 0/7] qdev: property fixups Gerd Hoffmann
2009-07-13 13:13 ` [Qemu-devel] [PATCH 1/7] qdev/prop: make uint32 accept both hex and decimal Gerd Hoffmann
2009-07-13 13:13 ` [Qemu-devel] [PATCH 2/7] qdev/prop: add 16bit integer type Gerd Hoffmann
2009-07-13 13:13 ` [Qemu-devel] [PATCH 3/7] qdev/prop: unstatic and rename prop_ptr() Gerd Hoffmann
2009-07-13 13:13 ` [Qemu-devel] [PATCH 4/7] qdev/prop: add property for target_phys_addr_t Gerd Hoffmann
2009-07-13 13:13 ` Gerd Hoffmann [this message]
2009-07-13 13:13 ` [Qemu-devel] [PATCH 6/7] qdev/prop: convert tcx Gerd Hoffmann
2009-07-13 13:13 ` [Qemu-devel] [PATCH 7/7] qdev/prop: convert eccmemctl Gerd Hoffmann
2009-07-13 15:02 ` [Qemu-devel] [PATCH v2 0/7] qdev: property fixups Blue Swirl

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=1247490790-15783-6-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).