Re: [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK

2011-11-26 Thread andrzej zaborowski
On 24 November 2011 16:57, Avi Kivity a...@redhat.com wrote:
 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 a...@redhat.com

Reviewed-by: Andrzej Zaborowski balr...@gmail.com



[Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK

2011-11-24 Thread Avi Kivity
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 a...@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 *) *