From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Andreas Färber" <andreas.faerber@web.de>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH 1/4] m48t59: move ISA ports/memory regions registration to QOM constructor
Date: Mon, 19 Jan 2015 22:59:29 +0100 [thread overview]
Message-ID: <1421704772-10394-2-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1421704772-10394-1-git-send-email-hpoussin@reactos.org>
-device m48t59_isa can now be used to create a fully functional nvram.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
hw/timer/m48t59.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
index 31509d5..967a313 100644
--- a/hw/timer/m48t59.c
+++ b/hw/timer/m48t59.c
@@ -658,10 +658,9 @@ M48t59State *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
d = SYSBUS_M48T59(dev);
state = &d->state;
sysbus_connect_irq(s, 0, IRQ);
- memory_region_init_io(&d->io, OBJECT(d), &m48t59_io_ops, state,
- "m48t59", 4);
if (io_base != 0) {
- memory_region_add_subregion(get_system_io(), io_base, &d->io);
+ memory_region_add_subregion(get_system_io(), io_base,
+ sysbus_mmio_get_region(dev, 1));
}
if (mem_base != 0) {
sysbus_mmio_map(s, 0, mem_base);
@@ -687,11 +686,6 @@ M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
d = ISA_M48T59(isadev);
s = &d->state;
- memory_region_init_io(&d->io, OBJECT(d), &m48t59_io_ops, s, "m48t59", 4);
- if (io_base != 0) {
- isa_register_ioport(isadev, &d->io, io_base);
- }
-
return s;
}
@@ -715,19 +709,28 @@ static void m48t59_isa_realize(DeviceState *dev, Error **errp)
isa_init_irq(isadev, &s->IRQ, 8);
m48t59_realize_common(s, errp);
+ memory_region_init_io(&d->io, OBJECT(dev), &m48t59_io_ops, s, "m48t59", 4);
+ if (s->io_base != 0) {
+ isa_register_ioport(isadev, &d->io, s->io_base);
+ }
+
+ return 0;
}
static int m48t59_init1(SysBusDevice *dev)
{
M48t59SysBusState *d = SYSBUS_M48T59(dev);
+ Object *o = OBJECT(dev);
M48t59State *s = &d->state;
Error *err = NULL;
sysbus_init_irq(dev, &s->IRQ);
- memory_region_init_io(&s->iomem, OBJECT(d), &nvram_ops, s,
- "m48t59.nvram", s->size);
+ memory_region_init_io(&s->iomem, o, &nvram_ops, s, "m48t59.nvram",
+ s->size);
+ memory_region_init_io(&d->io, o, &m48t59_io_ops, s, "m48t59", 4);
sysbus_init_mmio(dev, &s->iomem);
+ sysbus_init_mmio(dev, &d->io);
m48t59_realize_common(s, &err);
if (err != NULL) {
error_free(err);
@@ -751,8 +754,6 @@ static void m48t59_isa_class_init(ObjectClass *klass, void *data)
dc->realize = m48t59_isa_realize;
dc->reset = m48t59_reset_isa;
dc->props = m48t59_isa_properties;
- /* Reason: needs to be wired up by m48t59_init_isa() */
- dc->cannot_instantiate_with_device_add_yet = true;
}
static const TypeInfo m48t59_isa_info = {
--
1.7.10.4
next prev parent reply other threads:[~2015-01-19 22:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 21:59 [Qemu-devel] [PATCH 0/4] timer/m48t59: QOM'ify Hervé Poussineau
2015-01-19 21:59 ` Hervé Poussineau [this message]
2015-01-19 21:59 ` [Qemu-devel] [PATCH 2/4] m48t59: register a QOM type for each nvram type we support Hervé Poussineau
2015-01-19 21:59 ` [Qemu-devel] [PATCH 3/4] m48t59: add a Nvram interface Hervé Poussineau
2015-01-19 21:59 ` [Qemu-devel] [PATCH 4/4] m48t59: let init functions return a Nvram object Hervé Poussineau
2015-02-01 18:09 ` [Qemu-devel] [PATCH 0/4] timer/m48t59: QOM'ify Mark Cave-Ayland
2015-02-05 13:24 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
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=1421704772-10394-2-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=andreas.faerber@web.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).