From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach()
Date: Thu, 24 Nov 2011 17:57:02 +0200 [thread overview]
Message-ID: <1322150222-12869-4-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1322150222-12869-1-git-send-email-avi@redhat.com>
Also add omap_l4_region_size(), since memory API functions need
the size during initialization.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/omap.h | 7 ++++++-
hw/omap2.c | 2 +-
hw/omap_l4.c | 29 ++++++++++++++++++++++++++++-
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/hw/omap.h b/hw/omap.h
index d12f402..367ba11 100644
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -84,7 +84,8 @@ struct omap_target_agent_s {
uint32_t control;
uint32_t status;
};
-struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num);
+struct omap_l4_s *omap_l4_init(MemoryRegion *address_space,
+ target_phys_addr_t base, int ta_num);
struct omap_target_agent_s;
struct omap_target_agent_s *omap_l4ta_get(
@@ -94,8 +95,12 @@ struct omap_target_agent_s *omap_l4ta_get(
int cs);
target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
int iotype);
+target_phys_addr_t omap_l4_attach_region(struct omap_target_agent_s *ta,
+ int region, MemoryRegion *mr);
target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
int region);
+target_phys_addr_t omap_l4_region_size(struct omap_target_agent_s *ta,
+ int region);
/* OMAP2 SDRAM controller */
struct omap_sdrc_s;
diff --git a/hw/omap2.c b/hw/omap2.c
index 8a0fa73..5fc3fcf 100644
--- a/hw/omap2.c
+++ b/hw/omap2.c
@@ -2260,7 +2260,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
(sram_base = qemu_ram_alloc(NULL, "omap2.sram",
s->sram_size)) | IO_MEM_RAM);
- s->l4 = omap_l4_init(OMAP2_L4_BASE, 54);
+ s->l4 = omap_l4_init(sysmem, OMAP2_L4_BASE, 54);
/* Actually mapped at any 2K boundary in the ARM11 private-peripheral if */
cpu_irq = arm_pic_init_cpu(s->env);
diff --git a/hw/omap_l4.c b/hw/omap_l4.c
index a19ea70..a0bed5c 100644
--- a/hw/omap_l4.c
+++ b/hw/omap_l4.c
@@ -21,16 +21,19 @@
#include "omap.h"
struct omap_l4_s {
+ MemoryRegion *address_space;
target_phys_addr_t base;
int ta_num;
struct omap_target_agent_s ta[0];
};
-struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num)
+struct omap_l4_s *omap_l4_init(MemoryRegion *address_space,
+ target_phys_addr_t base, int ta_num)
{
struct omap_l4_s *bus = g_malloc0(
sizeof(*bus) + ta_num * sizeof(*bus->ta));
+ bus->address_space = address_space;
bus->ta_num = ta_num;
bus->base = base;
@@ -43,6 +46,12 @@ target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
return ta->bus->base + ta->start[region].offset;
}
+target_phys_addr_t omap_l4_region_size(struct omap_target_agent_s *ta,
+ int region)
+{
+ return ta->start[region].size;
+}
+
static uint32_t omap_l4ta_read(void *opaque, target_phys_addr_t addr)
{
struct omap_target_agent_s *s = (struct omap_target_agent_s *) opaque;
@@ -150,3 +159,21 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
return base;
}
+
+target_phys_addr_t omap_l4_attach_region(struct omap_target_agent_s *ta,
+ int region, MemoryRegion *mr)
+{
+ target_phys_addr_t base;
+
+ if (region < 0 || region >= ta->regions) {
+ fprintf(stderr, "%s: bad io region (%i)\n", __FUNCTION__, region);
+ exit(-1);
+ }
+
+ base = ta->bus->base + ta->start[region].offset;
+ if (mr) {
+ memory_region_add_subregion(ta->bus->address_space, base, mr);
+ }
+
+ return base;
+}
--
1.7.7.1
next prev parent reply other threads:[~2011-11-24 15:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 15:56 [Qemu-devel] [PATCH 0/3] omap l4 updates Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK Avi Kivity
2011-11-27 3:52 ` andrzej zaborowski
2011-11-24 15:57 ` [Qemu-devel] [PATCH 2/3] omap: eliminate l4_register_io_memory Avi Kivity
2011-11-24 15:57 ` Avi Kivity [this message]
2011-11-27 4:19 ` [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach() andrzej zaborowski
2011-11-24 16:22 ` [Qemu-devel] [PATCH 0/3] omap l4 updates Peter Maydell
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=1322150222-12869-4-git-send-email-avi@redhat.com \
--to=avi@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).