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 6/6] qdev/prop: convert tcx
Date: Mon, 13 Jul 2009 11:36:05 +0200	[thread overview]
Message-ID: <1247477765-17026-7-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>
---
 hw/tcx.c |   49 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/hw/tcx.c b/hw/tcx.c
index d9b07cc..5c485c0 100644
--- a/hw/tcx.c
+++ b/hw/tcx.c
@@ -26,6 +26,7 @@
 #include "console.h"
 #include "pixel_ops.h"
 #include "sysbus.h"
+#include "qdev-addr.h"
 
 #define MAXX 1024
 #define MAXY 768
@@ -41,6 +42,7 @@ typedef struct TCXState {
     uint8_t *vram;
     uint32_t *vram24, *cplane;
     ram_addr_t vram_offset, vram24_offset, cplane_offset;
+    uint32_t vram_size;
     uint16_t width, height, depth;
     uint8_t r[256], g[256], b[256];
     uint32_t palette[256];
@@ -506,11 +508,11 @@ void tcx_init(target_phys_addr_t addr, int vram_size, int width, int height,
     SysBusDevice *s;
 
     dev = qdev_create(NULL, "SUNW,tcx");
-    qdev_set_prop_int(dev, "addr", addr);
-    qdev_set_prop_int(dev, "vram_size", vram_size);
-    qdev_set_prop_int(dev, "width", width);
-    qdev_set_prop_int(dev, "height", height);
-    qdev_set_prop_int(dev, "depth", depth);
+    qdev_prop_set_taddr(dev, "addr", addr);
+    qdev_prop_set_uint32(dev, "vram_size", vram_size);
+    qdev_prop_set_uint16(dev, "width", width);
+    qdev_prop_set_uint16(dev, "height", height);
+    qdev_prop_set_uint16(dev, "depth", depth);
     qdev_init(dev);
     s = sysbus_from_qdev(dev);
     /* 8-bit plane */
@@ -664,9 +666,44 @@ static void tcx24_screen_dump(void *opaque, const char *filename)
     return;
 }
 
+static SysBusDeviceInfo tcx_info = {
+    .init = tcx_init1,
+    .qdev.name  = "SUNW,tcx",
+    .qdev.size  = sizeof(TCXState),
+    .qdev.props = (Property[]) {
+        {
+            .name   = "addr",
+            .info   = &qdev_prop_taddr,
+            .offset = offsetof(TCXState, addr),
+            .defval = (target_phys_addr_t[]) { -1 },
+        },{
+            .name   = "vram_size",
+            .info   = &qdev_prop_hex32,
+            .offset = offsetof(TCXState, vram_size),
+            .defval = (uint32_t[]) { -1 },
+        },{
+            .name   = "width",
+            .info   = &qdev_prop_uint16,
+            .offset = offsetof(TCXState, width),
+            .defval = (uint16_t[]) { -1 },
+        },{
+            .name   = "height",
+            .info   = &qdev_prop_uint16,
+            .offset = offsetof(TCXState, height),
+            .defval = (uint16_t[]) { -1 },
+        },{
+            .name   = "depth",
+            .info   = &qdev_prop_uint16,
+            .offset = offsetof(TCXState, depth),
+            .defval = (uint16_t[]) { -1 },
+        },
+        {/* end of list */}
+    }
+};
+
 static void tcx_register_devices(void)
 {
-    sysbus_register_dev("SUNW,tcx", sizeof(TCXState), tcx_init1);
+    sysbus_register_withprop(&tcx_info);
 }
 
 device_init(tcx_register_devices)
-- 
1.6.2.5

      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 ` [Qemu-devel] [PATCH 4/6] qdev/prop: add property for target_phys_addr_t Gerd Hoffmann
2009-07-13  9:36 ` [Qemu-devel] [PATCH 5/6] qdev/prop: convert m48t59 Gerd Hoffmann
2009-07-13  9:36 ` Gerd Hoffmann [this message]

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-7-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).