convert some omap/palm devices from using old_mmio
cover convert some omap/palm devices from using old_mmio
This patchset converts a handful of old devices from the old_mmio fields in MemoryRegionOps. We don't have very many devices still using old_mmio, so it would be nice to get rid of the remainder and drop the field entirely at some point.
(You could argue that really we should mark some of these old boards as obsolete and eventually delete them. I don't actually have a test image for the palm stuff at all...)
thanks
-- PMM
Peter Maydell (6):
hw/arm/palm.c: Don't use old_mmio for static_ops hw/gpio/omap_gpio.c: Don't use old_mmio hw/timer/omap_synctimer.c: Don't use old_mmio hw/timer/omap_gptimer: Don't use old_mmio hw/i2c/omap_i2c.c: Don't use old_mmio hw/arm/omap2.c: Don't use old_mmio
hw/arm/omap2.c | 49 +++++++++++++++++++++++++++++++++++------------ hw/arm/palm.c | 30 ++++++++++------------------- hw/gpio/omap_gpio.c | 26 ++++++++++++------------- hw/i2c/omap_i2c.c | 44 ++++++++++++++++++++++++++++++------------ hw/timer/omap_gptimer.c | 49 +++++++++++++++++++++++++++++++++++------------ hw/timer/omap_synctimer.c | 35 +++++++++++++++++++-------------- 6 files changed, 149 insertions(+), 84 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/6 hw/arm/palm.c: Don't use old_mmio for static_ops
Update the static_ops functions to use new-style mmio rather than the legacy old_mmio functions.
--- hw/arm/palm.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-)
hw/arm/palm.c +10 -20
@@ -30,26 +30,16 @@#include "hw/loader.h" #include "exec/address-spaces.h" -static uint32_t static_readb (void *opaque,hwaddr offset) +static uint64_t static_read (void *opaque,hwaddr offset,unsigned size) { -uint32_t *val = (uint32_t *) opaque; -return *val >> ((offset &3 ) <<3 ); -} +uint32_t *val = (uint32_t *)opaque; +uint32_t sizemask =7 >> size; -static uint32_t static_readh (void *opaque,hwaddr offset) -{ -uint32_t *val = (uint32_t *) opaque; -return *val >> ((offset &1 ) <<3 ); -} - -static uint32_t static_readw (void *opaque,hwaddr offset) -{ -uint32_t *val = (uint32_t *) opaque; -return *val >> ((offset &0 ) <<3 ); +return *val >> ((offset & sizemask) <<3 ); } -static void static_write (void *opaque,hwaddr offset, -uint32_t value) +static void static_write (void *opaque,hwaddr offset,uint64_t value, +unsigned size) {#ifdef SPY printf("%s: value %08lx written at " PA_FMT "\n",
@@ -58,10 +48,10 @@ static void static_write(void *opaque, hwaddr offset, }static const MemoryRegionOps static_ops = { - .old_mmio = { - .read = { static_readb, static_readh, static_readw, }, - .write = { static_write, static_write, static_write, }, - }, + .read = static_read, + .write = static_write, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.7.4
Re: [Qemu-arm] [Qemu-devel] [PATCH 1/6] hw/arm/palm.c: Don't use old_mmio for static_ops
Quoted 7 lines · Peter Maydell
Update the
static_opsfunctions to use new-style mmio rather than the legacyold_mmiofunctions.Signed-off-by Peter Maydell <[email protected]>--- hw/arm/palm.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-)
r~
PATCH 2/6 hw/gpio/omap_gpio.c: Don't use old_mmio
In reply to Peter MaydellDrop the use of old_mmio in the omap2_gpio memory ops.
--- hw/gpio/omap_gpio.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
hw/gpio/omap_gpio.c +12 -14
@@ -525,17 +525,23 @@ static void omap2_gpio_module_write(void *opaque, hwaddr addr, } } -static uint32_t omap2_gpio_module_readp (void *opaque,hwaddr addr) +static uint64_t omap2_gpio_module_readp (void *opaque,hwaddr addr, +unsigned size) {return omap2_gpio_module_read (opaque, addr & ~3 ) >> ((addr &3 ) <<3 ); }static void omap2_gpio_module_writep (void *opaque,hwaddr addr, -uint32_t value) +uint64_t value,unsigned size) {uint32_t cur =0 ;uint32_t mask =0xffff ; +if (size ==4 ) { +omap2_gpio_module_write (opaque, addr, value); +return ; + } +switch (addr & ~3 ) {case 0x00 :/* GPIO_REVISION */ case 0x14 :/* GPIO_SYSSTATUS */
@@ -581,18 +587,10 @@ static void omap2_gpio_module_writep(void *opaque, hwaddr addr, }static const MemoryRegionOps omap2_gpio_module_ops = { - .old_mmio = { - .read = { - omap2_gpio_module_readp, - omap2_gpio_module_readp, - omap2_gpio_module_read, - }, - .write = { - omap2_gpio_module_writep, - omap2_gpio_module_writep, - omap2_gpio_module_write, - }, - }, + .read = omap2_gpio_module_readp, + .write = omap2_gpio_module_writep, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.7.4
Re: [Qemu-arm] [Qemu-devel] [PATCH 2/6] hw/gpio/omap_gpio.c: Don't use old_mmio
Quoted 6 lines · Peter Maydell
Drop the use of
old_mmioin theomap2_gpiomemory ops.Signed-off-by Peter Maydell <[email protected]>--- hw/gpio/omap_gpio.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
r~
PATCH 3/6 hw/timer/omap_synctimer.c: Don't use old_mmio
In reply to Peter MaydellDon't use the old_mmio in the memory region ops struct.
--- hw/timer/omap_synctimer.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
hw/timer/omap_synctimer.c +21 -14
@@ -68,25 +68,32 @@ static uint32_t omap_synctimer_readh(void *opaque, hwaddr addr) } } -static void omap_synctimer_write (void *opaque,hwaddr addr, -uint32_t value) +static uint64_t omap_synctimer_readfn (void *opaque,hwaddr addr, +unsigned size) +{ +switch (size) { +case 1 : +return omap_badwidth_read32 (opaque, addr); +case 2 : +return omap_synctimer_readh (opaque, addr); +case 4 : +return omap_synctimer_readw (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void omap_synctimer_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) {OMAP_BAD_REG (addr); }static const MemoryRegionOps omap_synctimer_ops = { - .old_mmio = { - .read = { - omap_badwidth_read32, - omap_synctimer_readh, - omap_synctimer_readw, - }, - .write = { - omap_badwidth_write32, - omap_synctimer_write, - omap_synctimer_write, - }, - }, + .read = omap_synctimer_readfn, + .write = omap_synctimer_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.7.4
Re: [Qemu-arm] [Qemu-devel] [PATCH 3/6] hw/timer/omap_synctimer.c: Don't use old_mmio
Quoted 6 lines · Peter Maydell
Don't use the
old_mmioin the memory region ops struct.Signed-off-by Peter Maydell <[email protected]>--- hw/timer/omap_synctimer.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
r~
PATCH 4/6 hw/timer/omap_gptimer: Don't use old_mmio
In reply to Peter MaydellDon't use the old_mmio struct in memory region ops.
--- hw/timer/omap_gptimer.c | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-)
hw/timer/omap_gptimer.c +37 -12
@@ -450,19 +450,44 @@ static void omap_gp_timer_writeh(void *opaque, hwaddr addr, s->writeh = (uint16_t ) value; } +static uint64_t omap_gp_timer_readfn (void *opaque,hwaddr addr, +unsigned size) +{ +switch (size) { +case 1 : +return omap_badwidth_read32 (opaque, addr); +case 2 : +return omap_gp_timer_readh (opaque, addr); +case 4 : +return omap_gp_timer_readw (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void omap_gp_timer_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +omap_badwidth_write32 (opaque, addr, value); +break ; +case 2 : +omap_gp_timer_writeh (opaque, addr, value); +break ; +case 4 : +omap_gp_timer_write (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps omap_gp_timer_ops = { - .old_mmio = { - .read = { - omap_badwidth_read32, - omap_gp_timer_readh, - omap_gp_timer_readw, - }, - .write = { - omap_badwidth_write32, - omap_gp_timer_writeh, - omap_gp_timer_write, - }, - }, + .read = omap_gp_timer_readfn, + .write = omap_gp_timer_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.7.4
Re: [Qemu-arm] [Qemu-devel] [PATCH 4/6] hw/timer/omap_gptimer: Don't use old_mmio
Quoted 6 lines · Peter Maydell
Don't use the
old_mmiostruct in memory region ops.Signed-off-by Peter Maydell <[email protected]>--- hw/timer/omap_gptimer.c | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-)
r~
PATCH 5/6 hw/i2c/omap_i2c.c: Don't use old_mmio
In reply to Peter MaydellDon't use old_mmio in the memory region ops struct.
--- hw/i2c/omap_i2c.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-)
hw/i2c/omap_i2c.c +32 -12
@@ -430,19 +430,39 @@ static void omap_i2c_writeb(void *opaque, hwaddr addr, } } +static uint64_t omap_i2c_readfn (void *opaque,hwaddr addr, +unsigned size) +{ +switch (size) { +case 2 : +return omap_i2c_read (opaque, addr); +default : +return omap_badwidth_read16 (opaque, addr); + } +} + +static void omap_i2c_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +/* Only the last fifo write can be 8 bit. */ +omap_i2c_writeb (opaque, addr, value); +break ; +case 2 : +omap_i2c_write (opaque, addr, value); +break ; +default : +omap_badwidth_write16 (opaque, addr, value); +break ; + } +} +static const MemoryRegionOps omap_i2c_ops = { - .old_mmio = { - .read = { - omap_badwidth_read16, - omap_i2c_read, - omap_badwidth_read16, - }, - .write = { - omap_i2c_writeb,/* Only the last fifo write can be 8 bit. */ - omap_i2c_write, - omap_badwidth_write16, - }, - }, + .read = omap_i2c_readfn, + .write = omap_i2c_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.7.4
Re: [Qemu-arm] [Qemu-devel] [PATCH 5/6] hw/i2c/omap_i2c.c: Don't use old_mmio
Quoted 6 lines · Peter Maydell
Don't use
old_mmioin the memory region ops struct.Signed-off-by Peter Maydell <[email protected]>--- hw/i2c/omap_i2c.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-)
r~
PATCH 6/6 hw/arm/omap2.c: Don't use old_mmio
In reply to Peter MaydellDon't use old_mmio in the memory region ops struct.
--- hw/arm/omap2.c | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-)
hw/arm/omap2.c +37 -12
@@ -2087,19 +2087,44 @@ static void omap_sysctl_write(void *opaque, hwaddr addr, } } +static uint64_t omap_sysctl_readfn (void *opaque,hwaddr addr, +unsigned size) +{ +switch (size) { +case 1 : +return omap_sysctl_read8 (opaque, addr); +case 2 : +return omap_badwidth_read32 (opaque, addr);/* TODO */ +case 4 : +return omap_sysctl_read (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void omap_sysctl_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +omap_sysctl_write8 (opaque, addr, value); +break ; +case 2 : +omap_badwidth_write32 (opaque, addr, value);/* TODO */ +break ; +case 4 : +omap_sysctl_write (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps omap_sysctl_ops = { - .old_mmio = { - .read = { - omap_sysctl_read8, - omap_badwidth_read32,/* TODO */ - omap_sysctl_read, - }, - .write = { - omap_sysctl_write8, - omap_badwidth_write32,/* TODO */ - omap_sysctl_write, - }, - }, + .read = omap_sysctl_readfn, + .write = omap_sysctl_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.7.4
Re: [Qemu-arm] [Qemu-devel] [PATCH 6/6] hw/arm/omap2.c: Don't use old_mmio
Quoted 6 lines · Peter Maydell
Don't use
old_mmioin the memory region ops struct.Signed-off-by Peter Maydell <[email protected]>--- hw/arm/omap2.c | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-)
r~
Quoted 4 lines · Peter Maydell
This patchset converts a handful of old devices from the
old_mmiofields in MemoryRegionOps. We don't have very many devices still usingold_mmio, so it would be nice to get rid of the remainder and drop the field entirely at some point.
That reminds me - the macio IDE controller still uses old_mmio accessors. I'm currently working around that area so I'll see if I can slip a conversion into my next patchset.
ATB,
Mark.