From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
"Andreas Färber" <andreas.faerber@web.de>,
qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH] pc87312: Replace register_ioport_*() with MemoryRegion
Date: Fri, 11 Jan 2013 22:00:41 +0100 [thread overview]
Message-ID: <1357938041-4189-1-git-send-email-andreas.faerber@web.de> (raw)
Prepare an instance_init function for the MemoryRegion init.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Hervé Poussineau <hpoussin@reactos.org>
---
hw/pc87312.c | 26 ++++++++++++++++++++++----
hw/pc87312.h | 2 ++
2 Dateien geändert, 24 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
diff --git a/hw/pc87312.c b/hw/pc87312.c
index 6a17afd..97fabfa 100644
--- a/hw/pc87312.c
+++ b/hw/pc87312.c
@@ -194,7 +194,8 @@ static void pc87312_hard_reset(PC87312State *s)
pc87312_soft_reset(s);
}
-static void pc87312_ioport_write(void *opaque, uint32_t addr, uint32_t val)
+static void pc87312_io_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned int size)
{
PC87312State *s = opaque;
@@ -213,7 +214,7 @@ static void pc87312_ioport_write(void *opaque, uint32_t addr, uint32_t val)
}
}
-static uint32_t pc87312_ioport_read(void *opaque, uint32_t addr)
+static uint64_t pc87312_io_read(void *opaque, hwaddr addr, unsigned int size)
{
PC87312State *s = opaque;
uint32_t val;
@@ -241,6 +242,16 @@ static uint32_t pc87312_ioport_read(void *opaque, uint32_t addr)
return val;
}
+static const MemoryRegionOps pc87312_io_ops = {
+ .read = pc87312_io_read,
+ .write = pc87312_io_write,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .valid = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
+};
+
static int pc87312_post_load(void *opaque, int version_id)
{
PC87312State *s = opaque;
@@ -270,6 +281,7 @@ static int pc87312_init(ISADevice *dev)
s = PC87312(dev);
bus = isa_bus_from_device(dev);
pc87312_hard_reset(s);
+ isa_register_ioport(dev, &s->io, s->iobase);
if (is_parallel_enabled(s)) {
chr = parallel_hds[0];
@@ -337,11 +349,16 @@ static int pc87312_init(ISADevice *dev)
trace_pc87312_info_ide(get_ide_iobase(s));
}
- register_ioport_write(s->iobase, 2, 1, pc87312_ioport_write, s);
- register_ioport_read(s->iobase, 2, 1, pc87312_ioport_read, s);
return 0;
}
+static void pc87312_initfn(Object *obj)
+{
+ PC87312State *s = PC87312(obj);
+
+ memory_region_init_io(&s->io, &pc87312_io_ops, s, "pc87312", 2);
+}
+
static const VMStateDescription vmstate_pc87312 = {
.name = "pc87312",
.version_id = 1,
@@ -376,6 +393,7 @@ static const TypeInfo pc87312_type_info = {
.name = TYPE_PC87312,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(PC87312State),
+ .instance_init = pc87312_initfn,
.class_init = pc87312_class_init,
};
diff --git a/hw/pc87312.h b/hw/pc87312.h
index 7ca7912..7b9e6f6 100644
--- a/hw/pc87312.h
+++ b/hw/pc87312.h
@@ -56,6 +56,8 @@ typedef struct PC87312State {
uint32_t base;
} ide;
+ MemoryRegion io;
+
uint8_t read_id_step;
uint8_t selected_index;
--
1.7.10.4
next reply other threads:[~2013-01-11 21:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 21:00 Andreas Färber [this message]
2013-01-13 9:46 ` [Qemu-devel] [PATCH] pc87312: Replace register_ioport_*() with MemoryRegion Hervé Poussineau
2013-01-14 13:43 ` Andreas Färber
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=1357938041-4189-1-git-send-email-andreas.faerber@web.de \
--to=andreas.faerber@web.de \
--cc=hpoussin@reactos.org \
--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).