omap l4 updates
cover omap l4 updates
The following three patches are part of the memory API conversion queue; while I don't think there's anything contentious in there, it's not the usual convert-to-memory-API fare.
The patches remove a bunch of dead code that has not been in use for more than three years, so they should be quite safe.
Avi Kivity (3):
omap: remove L4_MUX_HACK
omap: eliminate l4_register_io_memory
omap_l4: add memory API variant of omap_l4_attach()
hw/omap.h | 12 ++-- hw/omap2.c | 14 ++-- hw/omap_dss.c | 16 +++--- hw/omap_gptimer.c | 4 +- hw/omap_i2c.c | 4 +- hw/omap_l4.c | 159 ++++++++++----------------------------------------- hw/omap_mmc.c | 4 +- hw/omap_spi.c | 4 +- hw/omap_synctimer.c | 5 +- hw/omap_tap.c | 5 +- 10 files changed, 65 insertions(+), 162 deletions(-)
Signature · 1 line
1.7.7.1
PATCH 1/3 omap: remove L4_MUX_HACK
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.
--- hw/omap.h | 3 - hw/omap_l4.c | 118 ---------------------------------------------------------- 2 files changed, 0 insertions(+), 121 deletions(-)
hw/omap.h +0 -3
@@ -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 */
hw/omap_l4.c +0 -118
149 lines not on this page · raw message
Signature · 1 line
1.7.7.1
Re: [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK
Quoted 5 lines · 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 <[email protected]>
PATCH 2/3 omap: eliminate l4_register_io_memory
In reply to Avi KivityThis is a trivial wrapper around cpu_register_io_memory(), adding no value. Inline it into all callers.
--- hw/omap.h | 2 -- hw/omap2.c | 12 ++++++------ hw/omap_dss.c | 16 ++++++++-------- hw/omap_gptimer.c | 4 ++-- hw/omap_i2c.c | 4 ++-- hw/omap_l4.c | 12 ++---------- hw/omap_mmc.c | 4 ++-- hw/omap_spi.c | 4 ++-- hw/omap_synctimer.c | 5 +++-- hw/omap_tap.c | 5 +++-- 10 files changed, 30 insertions(+), 38 deletions(-)
hw/omap.h +0 -2
@@ -96,8 +96,6 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region, int iotype);target_phys_addr_t omap_l4_region_base (struct omap_target_agent_s *ta,int region); -int l4_register_io_memory (CPUReadMemoryFunc *const *mem_read, -CPUWriteMemoryFunc *const *mem_write,void *opaque);/* OMAP2 SDRAM controller */ struct omap_sdrc_s ;
hw/omap2.c +6 -6
@@ -784,8 +784,8 @@ static void omap_sti_fifo_write(void *opaque, target_phys_addr_t addr, s->chr = chr ?:qemu_chr_new ("null" ,"null" ,NULL ); - iomemtype =l4_register_io_memory (omap_sti_readfn, - omap_sti_writefn, s); + iomemtype =cpu_register_io_memory (omap_sti_readfn, + omap_sti_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype); iomemtype = cpu_register_io_memory(omap_sti_fifo_readfn,
@@ -1798,8 +1798,8 @@ static void omap_prcm_coldreset(struct omap_prcm_s *s) s->mpu = mpu;omap_prcm_coldreset (s); - iomemtype =l4_register_io_memory (omap_prcm_readfn, - omap_prcm_writefn, s); + iomemtype =cpu_register_io_memory (omap_prcm_readfn, + omap_prcm_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype);omap_l4_attach (ta,1 , iomemtype);
@@ -2168,8 +2168,8 @@ static void omap_sysctl_reset(struct omap_sysctl_s *s) s->mpu = mpu;omap_sysctl_reset (s); - iomemtype =l4_register_io_memory (omap_sysctl_readfn, - omap_sysctl_writefn, s); + iomemtype =cpu_register_io_memory (omap_sysctl_readfn, + omap_sysctl_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype);return s;
hw/omap_dss.c +8 -8
@@ -1037,14 +1037,14 @@ struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta, s->drq = drq;omap_dss_reset (s); - iomemtype[0 ] =l4_register_io_memory (omap_diss1_readfn, - omap_diss1_writefn, s); - iomemtype[1 ] =l4_register_io_memory (omap_disc1_readfn, - omap_disc1_writefn, s); - iomemtype[2 ] =l4_register_io_memory (omap_rfbi1_readfn, - omap_rfbi1_writefn, s); - iomemtype[3 ] =l4_register_io_memory (omap_venc1_readfn, - omap_venc1_writefn, s); + iomemtype[0 ] =cpu_register_io_memory (omap_diss1_readfn, + omap_diss1_writefn, s,DEVICE_NATIVE_ENDIAN ); + iomemtype[1 ] =cpu_register_io_memory (omap_disc1_readfn, + omap_disc1_writefn, s,DEVICE_NATIVE_ENDIAN ); + iomemtype[2 ] =cpu_register_io_memory (omap_rfbi1_readfn, + omap_rfbi1_writefn, s,DEVICE_NATIVE_ENDIAN ); + iomemtype[3 ] =cpu_register_io_memory (omap_venc1_readfn, + omap_venc1_writefn, s,DEVICE_NATIVE_ENDIAN ); iomemtype[4 ] =cpu_register_io_memory (omap_im3_readfn, omap_im3_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype[0 ]);
hw/omap_gptimer.c +2 -2
@@ -476,8 +476,8 @@ struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,omap_gp_timer_reset (s);omap_gp_timer_clk_setup (s); - iomemtype =l4_register_io_memory (omap_gp_timer_readfn, - omap_gp_timer_writefn, s); + iomemtype =cpu_register_io_memory (omap_gp_timer_readfn, + omap_gp_timer_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype);return s;
hw/omap_i2c.c +2 -2
@@ -457,8 +457,8 @@ struct omap_i2c_s *omap2_i2c_init(struct omap_target_agent_s *ta, s->bus =i2c_init_bus (NULL ,"i2c" );omap_i2c_reset (s); - iomemtype =l4_register_io_memory (omap_i2c_readfn, - omap_i2c_writefn, s); + iomemtype =cpu_register_io_memory (omap_i2c_readfn, + omap_i2c_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype);return s;
hw/omap_l4.c +2 -10
@@ -20,14 +20,6 @@#include "hw.h" #include "omap.h" -int l4_register_io_memory (CPUReadMemoryFunc *const *mem_read, -CPUWriteMemoryFunc *const *mem_write, -void *opaque) -{ -return cpu_register_io_memory (mem_read, mem_write, opaque, -DEVICE_NATIVE_ENDIAN ); -} -struct omap_l4_s {target_phys_addr_t base;int ta_num;
@@ -132,8 +124,8 @@ struct omap_target_agent_s *omap_l4ta_get(struct omap_l4_s *bus, ta->status =0x00000000 ; ta->control =0x00000200 ;/* XXX 01000200 for L4TAO */ - iomemtype =l4_register_io_memory (omap_l4ta_readfn, - omap_l4ta_writefn, ta); + iomemtype =cpu_register_io_memory (omap_l4ta_readfn, + omap_l4ta_writefn, ta,DEVICE_NATIVE_ENDIAN ); ta->base =omap_l4_attach (ta, info->ta_region, iomemtype);return ta;
hw/omap_mmc.c +2 -2
@@ -612,8 +612,8 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,omap_mmc_reset (s); - iomemtype =l4_register_io_memory (omap_mmc_readfn, - omap_mmc_writefn, s); + iomemtype =cpu_register_io_memory (omap_mmc_readfn, + omap_mmc_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype);/* Instantiate the storage */
hw/omap_spi.c +2 -2
@@ -327,8 +327,8 @@ struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum, }omap_mcspi_reset (s); - iomemtype =l4_register_io_memory (omap_mcspi_readfn, - omap_mcspi_writefn, s); + iomemtype =cpu_register_io_memory (omap_mcspi_readfn, + omap_mcspi_writefn, s,DEVICE_NATIVE_ENDIAN );omap_l4_attach (ta,0 , iomemtype);return s;
hw/omap_synctimer.c +3 -2
@@ -89,8 +89,9 @@ struct omap_synctimer_s *omap_synctimer_init(struct omap_target_agent_s *ta,struct omap_synctimer_s *s =g_malloc0 (sizeof (*s));omap_synctimer_reset (s); -omap_l4_attach (ta,0 ,l4_register_io_memory ( - omap_synctimer_readfn, omap_synctimer_writefn, s)); +omap_l4_attach (ta,0 ,cpu_register_io_memory ( + omap_synctimer_readfn, omap_synctimer_writefn, s, +DEVICE_NATIVE_ENDIAN ));return s; }
hw/omap_tap.c +3 -2
@@ -107,6 +107,7 @@ static void omap_tap_write(void *opaque, target_phys_addr_t addr,void omap_tap_init (struct omap_target_agent_s *ta,struct omap_mpu_state_s *mpu) { -omap_l4_attach (ta,0 ,l4_register_io_memory ( - omap_tap_readfn, omap_tap_writefn, mpu)); +omap_l4_attach (ta,0 ,cpu_register_io_memory ( + omap_tap_readfn, omap_tap_writefn, mpu, +DEVICE_NATIVE_ENDIAN )); }
Signature · 1 line
1.7.7.1
PATCH 3/3 omap_l4: add memory API variant of omap_l4_attach()
In reply to Avi KivityAlso add omap_l4_region_size(), since memory API functions need the size during initialization.
--- hw/omap.h | 7 ++++++- hw/omap2.c | 2 +- hw/omap_l4.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-)
hw/omap.h +6 -1
@@ -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 ;
hw/omap2.c +1 -1
@@ -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);
hw/omap_l4.c +28 -1
@@ -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; +}
Signature · 1 line
1.7.7.1
Re: [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach()
Quoted 2 lines · Avi Kivity
Also add
omap_l4_region_size(), since memory API functions need the size during initialization.
Logically it should be one of the omap_l4_* functions that set the size for the region instead of the target agents because this is where all the memory map is hardcoded. However with the current memory api I see that it's more straight forward to go this way.
Cheers
Quoted 113 lines
Signed-off-by Avi Kivity <[email protected]>---
hw/omap.h | 7 ++++++-
hw/omap2.c | 2 +-
hw/omap_l4.c | 29 ++++++++++++++++++++++++++++-3 files changed, 35 insertions(+), 3 deletions(-)hw/omap.h +2
-1@@ -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(hw/omap.h +4
-0@@ -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;hw/omap2.c +1
-1@@ -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);hw/omap_l4.c +3
-1@@ -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;hw/omap_l4.c +24
-1@@ -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
Quoted 11 lines · Avi Kivity
The following three patches are part of the memory API conversion queue; while I don't think there's anything contentious in there, it's not the usual convert-to-memory-API fare.
The patches remove a bunch of dead code that has not been in use for more than three years, so they should be quite safe.
Avi Kivity (3):
omap: removeL4_MUX_HACK
omap: eliminatel4_register_io_memory
omap_l4: add memory API variant ofomap_l4_attach()
These look OK to me; an ack from Andrzej would be good too.
(checkpatch will whine about your use of __FUNCTION__ which might be nice to fix if you have to do a v2 for some other reason.)
-- PMM