* [Qemu-devel] [PATCH] pc87312: Replace register_ioport_*() with MemoryRegion
@ 2013-01-11 21:00 Andreas Färber
2013-01-13 9:46 ` Hervé Poussineau
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Färber @ 2013-01-11 21:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Hervé Poussineau, Andreas Färber, qemu-ppc
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH] pc87312: Replace register_ioport_*() with MemoryRegion
2013-01-11 21:00 [Qemu-devel] [PATCH] pc87312: Replace register_ioport_*() with MemoryRegion Andreas Färber
@ 2013-01-13 9:46 ` Hervé Poussineau
2013-01-14 13:43 ` Andreas Färber
0 siblings, 1 reply; 3+ messages in thread
From: Hervé Poussineau @ 2013-01-13 9:46 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-ppc, qemu-devel
Andreas Färber a écrit :
> 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(-)
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Hervé
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] pc87312: Replace register_ioport_*() with MemoryRegion
2013-01-13 9:46 ` Hervé Poussineau
@ 2013-01-14 13:43 ` Andreas Färber
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2013-01-14 13:43 UTC (permalink / raw)
To: Hervé Poussineau; +Cc: qemu-ppc, qemu-devel
Am 13.01.2013 10:46, schrieb Hervé Poussineau:
> Andreas Färber a écrit :
>> 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(-)
>
> Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Thanks, applied to prep-up (since we have a pending bugfix for 1.4 now
and no conflict with memory-ioport queue):
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/prep-up
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-14 13:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 21:00 [Qemu-devel] [PATCH] pc87312: Replace register_ioport_*() with MemoryRegion Andreas Färber
2013-01-13 9:46 ` Hervé Poussineau
2013-01-14 13:43 ` Andreas Färber
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).