qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK
Date: Thu, 24 Nov 2011 17:57:00 +0200	[thread overview]
Message-ID: <1322150222-12869-2-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1322150222-12869-1-git-send-email-avi@redhat.com>

This was introduced apparently to overcome a limitation on the number of
cpu_register_io_memory() calls.  477b24ef91175 (July 2008) removed use
of the hack, but retained the code.  This patch removes the code as well.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/omap.h    |    3 -
 hw/omap_l4.c |  118 ----------------------------------------------------------
 2 files changed, 0 insertions(+), 121 deletions(-)

diff --git a/hw/omap.h b/hw/omap.h
index 924618e..8bd1810 100644
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -1127,7 +1127,4 @@ inline static int debug_register_io_memory(CPUReadMemoryFunc * const *mem_read,
 #  define cpu_register_io_memory	debug_register_io_memory
 # endif
 
-/* Define when we want to reduce the number of IO regions registered.  */
-/*# define L4_MUX_HACK*/
-
 #endif /* hw_omap_h */
diff --git a/hw/omap_l4.c b/hw/omap_l4.c
index a4a8883..ebec874 100644
--- a/hw/omap_l4.c
+++ b/hw/omap_l4.c
@@ -20,89 +20,6 @@
 #include "hw.h"
 #include "omap.h"
 
-#ifdef L4_MUX_HACK
-static int omap_l4_io_entries;
-static int omap_cpu_io_entry;
-static struct omap_l4_entry {
-        CPUReadMemoryFunc * const *mem_read;
-        CPUWriteMemoryFunc * const *mem_write;
-        void *opaque;
-} *omap_l4_io_entry;
-static CPUReadMemoryFunc * const *omap_l4_io_readb_fn;
-static CPUReadMemoryFunc * const *omap_l4_io_readh_fn;
-static CPUReadMemoryFunc * const *omap_l4_io_readw_fn;
-static CPUWriteMemoryFunc * const *omap_l4_io_writeb_fn;
-static CPUWriteMemoryFunc * const *omap_l4_io_writeh_fn;
-static CPUWriteMemoryFunc * const *omap_l4_io_writew_fn;
-static void **omap_l4_io_opaque;
-
-int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
-                CPUWriteMemoryFunc * const *mem_write, void *opaque)
-{
-    omap_l4_io_entry[omap_l4_io_entries].mem_read = mem_read;
-    omap_l4_io_entry[omap_l4_io_entries].mem_write = mem_write;
-    omap_l4_io_entry[omap_l4_io_entries].opaque = opaque;
-
-    return omap_l4_io_entries ++;
-}
-
-static uint32_t omap_l4_io_readb(void *opaque, target_phys_addr_t addr)
-{
-    unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
-    return omap_l4_io_readb_fn[i](omap_l4_io_opaque[i], addr);
-}
-
-static uint32_t omap_l4_io_readh(void *opaque, target_phys_addr_t addr)
-{
-    unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
-    return omap_l4_io_readh_fn[i](omap_l4_io_opaque[i], addr);
-}
-
-static uint32_t omap_l4_io_readw(void *opaque, target_phys_addr_t addr)
-{
-    unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
-    return omap_l4_io_readw_fn[i](omap_l4_io_opaque[i], addr);
-}
-
-static void omap_l4_io_writeb(void *opaque, target_phys_addr_t addr,
-                uint32_t value)
-{
-    unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
-    return omap_l4_io_writeb_fn[i](omap_l4_io_opaque[i], addr, value);
-}
-
-static void omap_l4_io_writeh(void *opaque, target_phys_addr_t addr,
-                uint32_t value)
-{
-    unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
-    return omap_l4_io_writeh_fn[i](omap_l4_io_opaque[i], addr, value);
-}
-
-static void omap_l4_io_writew(void *opaque, target_phys_addr_t addr,
-                uint32_t value)
-{
-    unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
-    return omap_l4_io_writew_fn[i](omap_l4_io_opaque[i], addr, value);
-}
-
-static CPUReadMemoryFunc * const omap_l4_io_readfn[] = {
-    omap_l4_io_readb,
-    omap_l4_io_readh,
-    omap_l4_io_readw,
-};
-
-static CPUWriteMemoryFunc * const omap_l4_io_writefn[] = {
-    omap_l4_io_writeb,
-    omap_l4_io_writeh,
-    omap_l4_io_writew,
-};
-#else
 int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
                           CPUWriteMemoryFunc * const *mem_write,
                           void *opaque)
@@ -110,7 +27,6 @@ int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
     return cpu_register_io_memory(mem_read, mem_write, opaque,
                                   DEVICE_NATIVE_ENDIAN);
 }
-#endif
 
 struct omap_l4_s {
     target_phys_addr_t base;
@@ -126,23 +42,6 @@ struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num)
     bus->ta_num = ta_num;
     bus->base = base;
 
-#ifdef L4_MUX_HACK
-    omap_l4_io_entries = 1;
-    omap_l4_io_entry = g_malloc0(125 * sizeof(*omap_l4_io_entry));
-
-    omap_cpu_io_entry =
-            cpu_register_io_memory(omap_l4_io_readfn,
-                            omap_l4_io_writefn, bus, DEVICE_NATIVE_ENDIAN);
-# define L4_PAGES	(0xb4000 / TARGET_PAGE_SIZE)
-    omap_l4_io_readb_fn = g_malloc0(sizeof(void *) * L4_PAGES);
-    omap_l4_io_readh_fn = g_malloc0(sizeof(void *) * L4_PAGES);
-    omap_l4_io_readw_fn = g_malloc0(sizeof(void *) * L4_PAGES);
-    omap_l4_io_writeb_fn = g_malloc0(sizeof(void *) * L4_PAGES);
-    omap_l4_io_writeh_fn = g_malloc0(sizeof(void *) * L4_PAGES);
-    omap_l4_io_writew_fn = g_malloc0(sizeof(void *) * L4_PAGES);
-    omap_l4_io_opaque = g_malloc0(sizeof(void *) * L4_PAGES);
-#endif
-
     return bus;
 }
 
@@ -245,9 +144,6 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
 {
     target_phys_addr_t base;
     ssize_t size;
-#ifdef L4_MUX_HACK
-    int i;
-#endif
 
     if (region < 0 || region >= ta->regions) {
         fprintf(stderr, "%s: bad io region (%i)\n", __FUNCTION__, region);
@@ -257,21 +153,7 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
     base = ta->bus->base + ta->start[region].offset;
     size = ta->start[region].size;
     if (iotype) {
-#ifndef L4_MUX_HACK
         cpu_register_physical_memory(base, size, iotype);
-#else
-        cpu_register_physical_memory(base, size, omap_cpu_io_entry);
-        i = (base - ta->bus->base) / TARGET_PAGE_SIZE;
-        for (; size > 0; size -= TARGET_PAGE_SIZE, i ++) {
-            omap_l4_io_readb_fn[i] = omap_l4_io_entry[iotype].mem_read[0];
-            omap_l4_io_readh_fn[i] = omap_l4_io_entry[iotype].mem_read[1];
-            omap_l4_io_readw_fn[i] = omap_l4_io_entry[iotype].mem_read[2];
-            omap_l4_io_writeb_fn[i] = omap_l4_io_entry[iotype].mem_write[0];
-            omap_l4_io_writeh_fn[i] = omap_l4_io_entry[iotype].mem_write[1];
-            omap_l4_io_writew_fn[i] = omap_l4_io_entry[iotype].mem_write[2];
-            omap_l4_io_opaque[i] = omap_l4_io_entry[iotype].opaque;
-        }
-#endif
     }
 
     return base;
-- 
1.7.7.1

  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 ` Avi Kivity [this message]
2011-11-27  3:52   ` [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK 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 ` [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach() Avi Kivity
2011-11-27  4:19   ` 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-2-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).