From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel <qemu-devel@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Subject: [Qemu-devel] [PATCH v4 1/2] integrator/cp: Model CP control registers as sysbus device
Date: Tue, 24 Feb 2015 08:03:48 +0100 [thread overview]
Message-ID: <54EC2254.1050404@siemens.com> (raw)
In-Reply-To: <CAEgOgz6AsXHcXzDL2Rw61xVaKgD0GNnGnhQs2H-7Gb4fBx6d-g@mail.gmail.com>
No new features yet, just encapsulation.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Changes in v4:
- fixed up type name as Peter suggested
hw/arm/integratorcp.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index 8c48b68..5c44c34 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -406,6 +406,18 @@ static int icp_pic_init(SysBusDevice *sbd)
/* CP control registers. */
+#define TYPE_ICP_CONTROL_REGS "icp-ctrl-regs"
+#define ICP_CONTROL_REGS(obj) \
+ OBJECT_CHECK(ICPCtrlRegsState, (obj), TYPE_ICP_CONTROL_REGS)
+
+typedef struct ICPCtrlRegsState {
+ /*< private >*/
+ SysBusDevice parent_obj;
+ /*< public >*/
+
+ MemoryRegion iomem;
+} ICPCtrlRegsState;
+
static uint64_t icp_control_read(void *opaque, hwaddr offset,
unsigned size)
{
@@ -444,15 +456,14 @@ static const MemoryRegionOps icp_control_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static void icp_control_init(hwaddr base)
+static void icp_control_init(Object *obj)
{
- MemoryRegion *io;
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
+ ICPCtrlRegsState *s = ICP_CONTROL_REGS(obj);
- io = (MemoryRegion *)g_malloc0(sizeof(MemoryRegion));
- memory_region_init_io(io, NULL, &icp_control_ops, NULL,
- "control", 0x00800000);
- memory_region_add_subregion(get_system_memory(), base, io);
- /* ??? Save/restore. */
+ memory_region_init_io(&s->iomem, OBJECT(s), &icp_control_ops, s,
+ "icp_ctrl_regs", 0x00800000);
+ sysbus_init_mmio(sbd, &s->iomem);
}
@@ -541,7 +552,7 @@ static void integratorcp_init(MachineState *machine)
sysbus_create_simple("pl031", 0x15000000, pic[8]);
sysbus_create_simple("pl011", 0x16000000, pic[1]);
sysbus_create_simple("pl011", 0x17000000, pic[2]);
- icp_control_init(0xcb000000);
+ sysbus_create_simple(TYPE_ICP_CONTROL_REGS, 0xcb000000, NULL);
sysbus_create_simple("pl050_keyboard", 0x18000000, pic[3]);
sysbus_create_simple("pl050_mouse", 0x19000000, pic[4]);
sysbus_create_simple(TYPE_INTEGRATOR_DEBUG, 0x1a000000, 0);
@@ -606,10 +617,18 @@ static const TypeInfo icp_pic_info = {
.class_init = icp_pic_class_init,
};
+static const TypeInfo icp_ctrl_regs_info = {
+ .name = TYPE_ICP_CONTROL_REGS,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(ICPCtrlRegsState),
+ .instance_init = icp_control_init,
+};
+
static void integratorcp_register_types(void)
{
type_register_static(&icp_pic_info);
type_register_static(&core_info);
+ type_register_static(&icp_ctrl_regs_info);
}
type_init(integratorcp_register_types)
--
2.1.4
next prev parent reply other threads:[~2015-02-24 7:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-23 12:21 [Qemu-devel] [PATCH v3 0/2] integrator/cp: Working SD card support Jan Kiszka
2015-02-23 12:21 ` [Qemu-devel] [PATCH v3 1/2] integrator/cp: Model CP control registers as sysbus device Jan Kiszka
2015-02-24 1:29 ` Peter Crosthwaite
2015-02-24 7:03 ` Jan Kiszka [this message]
2015-02-24 7:07 ` [Qemu-devel] [PATCH v4 " Peter Crosthwaite
2015-03-10 16:03 ` Peter Maydell
2015-03-10 16:11 ` Jan Kiszka
2015-03-10 16:12 ` Peter Maydell
2015-02-23 12:21 ` [Qemu-devel] [PATCH v3 2/2] integrator/cp: Implement CARDIN and WPROT signals Jan Kiszka
2015-02-24 1:30 ` Peter Crosthwaite
-- strict thread matches above, loose matches on Subject: below --
2015-03-10 16:27 [Qemu-devel] [PATCH v4 0/2] integrator/cp: Working SD card support Jan Kiszka
2015-03-10 16:27 ` [Qemu-devel] [PATCH v4 1/2] integrator/cp: Model CP control registers as sysbus device Jan Kiszka
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=54EC2254.1050404@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.maydell@linaro.org \
--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).