qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Michael Walle" <michael@walle.cc>,
	"Jan Kiszka" <jan.kiszka@web.de>,
	"Andreas Färber" <afaerber@suse.de>,
	patches@linaro.org
Subject: [Qemu-devel] [PATCH v3 3/5] milkymist-minimac2: Just expose buffers as a sysbus mmio region
Date: Fri, 15 Mar 2013 14:34:21 +0000	[thread overview]
Message-ID: <1363358063-23973-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1363358063-23973-1-git-send-email-peter.maydell@linaro.org>

Just expose the register buffers memory as a standard sysbus mmio
region which the creator of the device can map, rather than
providing a qdev property which the creator has to set to the
base address and then doing the mapping in the device's own
init function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
---
 hw/milkymist-hw.h       |    2 +-
 hw/milkymist-minimac2.c |    5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/milkymist-hw.h b/hw/milkymist-hw.h
index ced1c5f..aa0865f 100644
--- a/hw/milkymist-hw.h
+++ b/hw/milkymist-hw.h
@@ -177,10 +177,10 @@ static inline DeviceState *milkymist_minimac2_create(hwaddr base,
 
     qemu_check_nic_model(&nd_table[0], "minimac2");
     dev = qdev_create(NULL, "milkymist-minimac2");
-    qdev_prop_set_taddr(dev, "buffers_base", buffers_base);
     qdev_set_nic_properties(dev, &nd_table[0]);
     qdev_init_nofail(dev);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
+    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, buffers_base);
     sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, rx_irq);
     sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, tx_irq);
 
diff --git a/hw/milkymist-minimac2.c b/hw/milkymist-minimac2.c
index c20ff90..29618e8 100644
--- a/hw/milkymist-minimac2.c
+++ b/hw/milkymist-minimac2.c
@@ -96,7 +96,6 @@ struct MilkymistMinimac2State {
     NICState *nic;
     NICConf conf;
     char *phy_model;
-    hwaddr buffers_base;
     MemoryRegion buffers;
     MemoryRegion regs_region;
 
@@ -475,7 +474,7 @@ static int milkymist_minimac2_init(SysBusDevice *dev)
     s->rx1_buf = s->rx0_buf + MINIMAC2_BUFFER_SIZE;
     s->tx_buf = s->rx1_buf + MINIMAC2_BUFFER_SIZE;
 
-    sysbus_add_memory(dev, s->buffers_base, &s->buffers);
+    sysbus_init_mmio(dev, &s->buffers);
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_milkymist_minimac2_info, &s->conf,
@@ -517,8 +516,6 @@ static const VMStateDescription vmstate_milkymist_minimac2 = {
 };
 
 static Property milkymist_minimac2_properties[] = {
-    DEFINE_PROP_TADDR("buffers_base", MilkymistMinimac2State,
-    buffers_base, 0),
     DEFINE_NIC_PROPERTIES(MilkymistMinimac2State, conf),
     DEFINE_PROP_STRING("phy_model", MilkymistMinimac2State, phy_model),
     DEFINE_PROP_END_OF_LIST(),
-- 
1.7.9.5

  parent reply	other threads:[~2013-03-15 14:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15 14:34 [Qemu-devel] [PATCH v3 0/5] Remove sysbus_add_memory and sysbus_del_memory Peter Maydell
2013-03-15 14:34 ` [Qemu-devel] [PATCH v3 1/5] sysbus: make SysBusDeviceClass::init optional Peter Maydell
2013-03-15 14:34 ` [Qemu-devel] [PATCH v3 2/5] musicpal: qdevify musicpal-misc Peter Maydell
2013-03-28 15:14   ` Andreas Färber
2013-03-15 14:34 ` Peter Maydell [this message]
2013-03-15 14:34 ` [Qemu-devel] [PATCH v3 4/5] milkymist-softusb: Don't map RAM memory regions in the device itself Peter Maydell
2013-03-28 17:55   ` Anthony Liguori
2013-03-28 18:31     ` Michael Walle
2013-03-28 18:33       ` Peter Maydell
2013-03-28 18:37         ` Michael Walle
2013-03-15 14:34 ` [Qemu-devel] [PATCH v3 5/5] sysbus: Remove sysbus_add_memory and sysbus_del_memory Peter Maydell
2013-03-15 16:00 ` [Qemu-devel] [PATCH v3 0/5] " Paolo Bonzini
2013-03-15 16:09   ` Peter Maydell
2013-03-15 16:19     ` Paolo Bonzini
2013-03-28 11:25 ` Peter Maydell
2013-03-28 15:15   ` Andreas Färber
2013-03-28 15:24     ` Peter Maydell
2013-03-28 15:38       ` Paolo Bonzini
2013-03-28 15:56       ` Anthony Liguori
2013-03-28 17:16         ` Peter Maydell
2013-04-01 20:48 ` Anthony Liguori

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=1363358063-23973-4-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=afaerber@suse.de \
    --cc=jan.kiszka@web.de \
    --cc=michael@walle.cc \
    --cc=patches@linaro.org \
    --cc=pbonzini@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).