More conversions away from old_mmio
cover More conversions away from old_mmio
Half a dozen miscellaneous conversions away from old_mmio usage in the MemoryRegionOps struct. This leaves us with only 10 remaining in the tree.
NB: mips parts tested only via 'make check'.
thanks
-- PMM
Peter Maydell (6):
hw/sh/sh7750: Convert away from old_mmio hw/m68k/mcf5206: Convert away from old_mmio hw/block/pflash_cfi02: Convert away from old_mmio hw/watchdog/wdt_i6300esb: Convert away from old_mmio hw/input/pckbd: Convert away from old_mmio hw/char/parallel: Convert away from old_mmio
hw/block/pflash_cfi02.c | 97 +++++++------------------------------- hw/char/parallel.c | 50 +++++--------------- hw/input/pckbd.c | 14 +++--- hw/m68k/mcf5206.c | 48 ++++++++++++++----- hw/sh4/sh7750.c | 44 +++++++++++++---- hw/watchdog/wdt_i6300esb.c | 48 ++++++++++++++----- 6 files changed, 145 insertions(+), 156 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/6 hw/sh/sh7750: Convert away from old_mmio
Convert the sh7750 device away from using the old_mmio field of MemoryRegionOps. This device is used by the sh4 r2d board.
--- hw/sh4/sh7750.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-)
hw/sh4/sh7750.c +36 -8
@@ -451,15 +451,43 @@ static void sh7750_mem_writel(void *opaque, hwaddr addr, } } +static uint64_t sh7750_mem_readfn (void *opaque,hwaddr addr,unsigned size) +{ +switch (size) { +case 1 : +return sh7750_mem_readb (opaque, addr); +case 2 : +return sh7750_mem_readw (opaque, addr); +case 4 : +return sh7750_mem_readl (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void sh7750_mem_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +sh7750_mem_writeb (opaque, addr, value); +break ; +case 2 : +sh7750_mem_writew (opaque, addr, value); +break ; +case 4 : +sh7750_mem_writel (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps sh7750_mem_ops = { - .old_mmio = { - .read = {sh7750_mem_readb, - sh7750_mem_readw, - sh7750_mem_readl }, - .write = {sh7750_mem_writeb, - sh7750_mem_writew, - sh7750_mem_writel }, - }, + .read = sh7750_mem_readfn, + .write = sh7750_mem_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 1/6] hw/sh/sh7750: Convert away from old_mmio
Quoted 4 lines · Peter Maydell
Convert the sh7750 device away from using the
old_mmiofield of MemoryRegionOps. This device is used by the sh4 r2d board.Signed-off-by Peter Maydell <[email protected]>
Quoted 61 lines
--- hw/sh4/sh7750.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-)hw/sh4/sh7750.c +36
-8@@ -451,15 +451,43 @@ static void sh7750_mem_writel(void *opaque, hwaddr addr, } } +static uint64_t sh7750_mem_readfn (void *opaque,hwaddr addr,unsigned size) +{ +switch (size) { +case 1 : +return sh7750_mem_readb (opaque, addr); +case 2 : +return sh7750_mem_readw (opaque, addr); +case 4 : +return sh7750_mem_readl (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void sh7750_mem_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +sh7750_mem_writeb (opaque, addr, value); +break ; +case 2 : +sh7750_mem_writew (opaque, addr, value); +break ; +case 4 : +sh7750_mem_writel (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps sh7750_mem_ops = { - .old_mmio = { - .read = {sh7750_mem_readb, - sh7750_mem_readw, - sh7750_mem_readl }, - .write = {sh7750_mem_writeb, - sh7750_mem_writew, - sh7750_mem_writel }, - }, + .read = sh7750_mem_readfn, + .write = sh7750_mem_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
PATCH 2/6 hw/m68k/mcf5206: Convert away from old_mmio
In reply to Peter MaydellConvert the mcf5206 device away from using the old_mmio field of MemoryRegionOps. This device is used by the an5206 board.
--- hw/m68k/mcf5206.c | 48 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-)
hw/m68k/mcf5206.c +36 -12
@@ -513,19 +513,43 @@ static void m5206_mbar_writel(void *opaque, hwaddr offset,m5206_mbar_write (s, offset, value,4 ); } +static uint64_t m5206_mbar_readfn (void *opaque,hwaddr addr,unsigned size) +{ +switch (size) { +case 1 : +return m5206_mbar_readb (opaque, addr); +case 2 : +return m5206_mbar_readw (opaque, addr); +case 4 : +return m5206_mbar_readl (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void m5206_mbar_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +m5206_mbar_writeb (opaque, addr, value); +break ; +case 2 : +m5206_mbar_writew (opaque, addr, value); +break ; +case 4 : +m5206_mbar_writel (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps m5206_mbar_ops = { - .old_mmio = { - .read = { - m5206_mbar_readb, - m5206_mbar_readw, - m5206_mbar_readl, - }, - .write = { - m5206_mbar_writeb, - m5206_mbar_writew, - m5206_mbar_writel, - }, - }, + .read = m5206_mbar_readfn, + .write = m5206_mbar_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 2/6] hw/m68k/mcf5206: Convert away from old_mmio
Quoted 57 lines · Peter Maydell
Convert the mcf5206 device away from using the
old_mmiofield of MemoryRegionOps. This device is used by the an5206 board.Signed-off-by Peter Maydell <[email protected]>--- hw/m68k/mcf5206.c | 48 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-)hw/m68k/mcf5206.c +32
-8@@ -513,19 +513,43 @@ static void m5206_mbar_writel(void *opaque, hwaddr offset,m5206_mbar_write (s, offset, value,4 ); } +static uint64_t m5206_mbar_readfn (void *opaque,hwaddr addr,unsigned size) +{ +switch (size) { +case 1 : +return m5206_mbar_readb (opaque, addr); +case 2 : +return m5206_mbar_readw (opaque, addr); +case 4 : +return m5206_mbar_readl (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void m5206_mbar_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +m5206_mbar_writeb (opaque, addr, value); +break ; +case 2 : +m5206_mbar_writew (opaque, addr, value); +break ; +case 4 : +m5206_mbar_writel (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps m5206_mbar_ops = { - .old_mmio = { - .read = { - m5206_mbar_readb, - m5206_mbar_readw, - m5206_mbar_readl, - }, - .write = { - m5206_mbar_writeb,
hw/m68k/mcf5206.c static void m5206_mbar_writel(void *opaque, hwaddr offset, · line 554
Quoted 10 lines
hw/m68k/mcf5206.c +4
-4- m5206_mbar_writew, - m5206_mbar_writel, - }, - }, + .read = m5206_mbar_readfn, + .write = m5206_mbar_writefn, + .valid.min_access_size = 1, + .valid.max_access_size = 4, .endianness = DEVICE_NATIVE_ENDIAN, };
PATCH 3/6 hw/block/pflash_cfi02: Convert away from old_mmio
In reply to Peter MaydellConvert the pflash_cfi02 device away from using the old_mmio field of MemoryRegionOps.
--- hw/block/pflash_cfi02.c | 97 ++++++++--------------------------------- 1 file changed, 18 insertions(+), 79 deletions(-)
hw/block/pflash_cfi02.c +18 -79
@@ -494,102 +494,41 @@ static void pflash_write (pflash_t *pfl, hwaddr offset, pfl->cmd =0 ; } - -static uint32_t pflash_readb_be (void *opaque,hwaddr addr) +static uint64_t pflash_be_readfn (void *opaque,hwaddr addr,unsigned size) { -return pflash_read (opaque, addr,1 ,1 ); +return pflash_read (opaque, addr, size,1 ); } -static uint32_t pflash_readb_le (void *opaque,hwaddr addr) +static void pflash_be_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) { -return pflash_read (opaque, addr,1 ,0 ); +pflash_write (opaque, addr, value, size,1 ); } -static uint32_t pflash_readw_be (void *opaque,hwaddr addr) +static uint64_t pflash_le_readfn (void *opaque,hwaddr addr,unsigned size) { -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,2 ,1 ); +return pflash_read (opaque, addr, size,0 ); } -static uint32_t pflash_readw_le (void *opaque,hwaddr addr) +static void pflash_le_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) { -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,2 ,0 ); -} - -static uint32_t pflash_readl_be (void *opaque,hwaddr addr) -{ -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,4 ,1 ); -} - -static uint32_t pflash_readl_le (void *opaque,hwaddr addr) -{ -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,4 ,0 ); -} - -static void pflash_writeb_be (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_write (opaque, addr, value,1 ,1 ); -} - -static void pflash_writeb_le (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_write (opaque, addr, value,1 ,0 ); -} - -static void pflash_writew_be (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,2 ,1 ); -} - -static void pflash_writew_le (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,2 ,0 ); -} - -static void pflash_writel_be (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,4 ,1 ); -} - -static void pflash_writel_le (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,4 ,0 ); +pflash_write (opaque, addr, value, size,0 ); }static const MemoryRegionOps pflash_cfi02_ops_be = { - .old_mmio = { - .read = { pflash_readb_be, pflash_readw_be, pflash_readl_be, }, - .write = { pflash_writeb_be, pflash_writew_be, pflash_writel_be, }, - }, + .read = pflash_be_readfn, + .write = pflash_be_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };static const MemoryRegionOps pflash_cfi02_ops_le = { - .old_mmio = { - .read = { pflash_readb_le, pflash_readw_le, pflash_readl_le, }, - .write = { pflash_writeb_le, pflash_writew_le, pflash_writel_le, }, - }, + .read = pflash_le_readfn, + .write = pflash_le_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 3/6] hw/block/pflash_cfi02: Convert away from old_mmio
Quoted 7 lines · Peter Maydell
Convert the
pflash_cfi02device away from using theold_mmiofield of MemoryRegionOps.Signed-off-by Peter Maydell <[email protected]>--- hw/block/pflash_cfi02.c | 97 ++++++++--------------------------------- 1 file changed, 18 insertions(+), 79 deletions(-)
Re: [Qemu-devel] [PATCH 3/6] hw/block/pflash_cfi02: Convert away from old_mmio
In reply to Peter MaydellQuoted 4 lines · Peter Maydell
Convert the
pflash_cfi02device away from using theold_mmiofield of MemoryRegionOps.Signed-off-by Peter Maydell <[email protected]>
Quoted 130 lines
--- hw/block/pflash_cfi02.c | 97 ++++++++--------------------------------- 1 file changed, 18 insertions(+), 79 deletions(-)hw/block/pflash_cfi02.c +18
-79@@ -494,102 +494,41 @@ static void pflash_write (pflash_t *pfl, hwaddr offset, pfl->cmd =0 ; } - -static uint32_t pflash_readb_be (void *opaque,hwaddr addr) +static uint64_t pflash_be_readfn (void *opaque,hwaddr addr,unsigned size) { -return pflash_read (opaque, addr,1 ,1 ); +return pflash_read (opaque, addr, size,1 ); } -static uint32_t pflash_readb_le (void *opaque,hwaddr addr) +static void pflash_be_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) { -return pflash_read (opaque, addr,1 ,0 ); +pflash_write (opaque, addr, value, size,1 ); } -static uint32_t pflash_readw_be (void *opaque,hwaddr addr) +static uint64_t pflash_le_readfn (void *opaque,hwaddr addr,unsigned size) { -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,2 ,1 ); +return pflash_read (opaque, addr, size,0 ); } -static uint32_t pflash_readw_le (void *opaque,hwaddr addr) +static void pflash_le_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) { -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,2 ,0 ); -} - -static uint32_t pflash_readl_be (void *opaque,hwaddr addr) -{ -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,4 ,1 ); -} - -static uint32_t pflash_readl_le (void *opaque,hwaddr addr) -{ -pflash_t *pfl = opaque; - -return pflash_read (pfl, addr,4 ,0 ); -} - -static void pflash_writeb_be (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_write (opaque, addr, value,1 ,1 ); -} - -static void pflash_writeb_le (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_write (opaque, addr, value,1 ,0 ); -} - -static void pflash_writew_be (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,2 ,1 ); -} - -static void pflash_writew_le (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,2 ,0 ); -} - -static void pflash_writel_be (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,4 ,1 ); -} - -static void pflash_writel_le (void *opaque,hwaddr addr, -uint32_t value) -{ -pflash_t *pfl = opaque; - -pflash_write (pfl, addr, value,4 ,0 ); +pflash_write (opaque, addr, value, size,0 ); }static const MemoryRegionOps pflash_cfi02_ops_be = { - .old_mmio = { - .read = { pflash_readb_be, pflash_readw_be, pflash_readl_be, }, - .write = { pflash_writeb_be, pflash_writew_be, pflash_writel_be, }, - }, + .read = pflash_be_readfn, + .write = pflash_be_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };static const MemoryRegionOps pflash_cfi02_ops_le = { - .old_mmio = { - .read = { pflash_readb_le, pflash_readw_le, pflash_readl_le, }, - .write = { pflash_writeb_le, pflash_writew_le, pflash_writel_le, }, - }, + .read = pflash_le_readfn, + .write = pflash_le_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
PATCH 4/6 hw/watchdog/wdt_i6300esb: Convert away from old_mmio
In reply to Peter MaydellConvert the wdt_i6300esb device away from using the old_mmio field of MemoryRegionOps.
--- hw/watchdog/wdt_i6300esb.c | 48 ++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-)
hw/watchdog/wdt_i6300esb.c +36 -12
@@ -361,19 +361,43 @@ static void i6300esb_mem_writel(void *vp, hwaddr addr, uint32_t val) } } +static uint64_t i6300esb_mem_readfn (void *opaque,hwaddr addr,unsigned size) +{ +switch (size) { +case 1 : +return i6300esb_mem_readb (opaque, addr); +case 2 : +return i6300esb_mem_readw (opaque, addr); +case 4 : +return i6300esb_mem_readl (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void i6300esb_mem_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +i6300esb_mem_writeb (opaque, addr, value); +break ; +case 2 : +i6300esb_mem_writew (opaque, addr, value); +break ; +case 4 : +i6300esb_mem_writel (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps i6300esb_ops = { - .old_mmio = { - .read = { - i6300esb_mem_readb, - i6300esb_mem_readw, - i6300esb_mem_readl, - }, - .write = { - i6300esb_mem_writeb, - i6300esb_mem_writew, - i6300esb_mem_writel, - }, - }, + .read = i6300esb_mem_readfn, + .write = i6300esb_mem_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_LITTLE_ENDIAN , };
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 4/6] hw/watchdog/wdt_i6300esb: Convert away from old_mmio
Quoted 4 lines · Peter Maydell
Convert the
wdt_i6300esbdevice away from using theold_mmiofield of MemoryRegionOps.Signed-off-by Peter Maydell <[email protected]>
Quoted 65 lines
--- hw/watchdog/wdt_i6300esb.c | 48 ++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-)hw/watchdog/wdt_i6300esb.c +36
-12@@ -361,19 +361,43 @@ static void i6300esb_mem_writel(void *vp, hwaddr addr, uint32_t val) } } +static uint64_t i6300esb_mem_readfn (void *opaque,hwaddr addr,unsigned size) +{ +switch (size) { +case 1 : +return i6300esb_mem_readb (opaque, addr); +case 2 : +return i6300esb_mem_readw (opaque, addr); +case 4 : +return i6300esb_mem_readl (opaque, addr); +default : +g_assert_not_reached (); + } +} + +static void i6300esb_mem_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) +{ +switch (size) { +case 1 : +i6300esb_mem_writeb (opaque, addr, value); +break ; +case 2 : +i6300esb_mem_writew (opaque, addr, value); +break ; +case 4 : +i6300esb_mem_writel (opaque, addr, value); +break ; +default : +g_assert_not_reached (); + } +} +static const MemoryRegionOps i6300esb_ops = { - .old_mmio = { - .read = { - i6300esb_mem_readb, - i6300esb_mem_readw, - i6300esb_mem_readl, - }, - .write = { - i6300esb_mem_writeb, - i6300esb_mem_writew, - i6300esb_mem_writel, - }, - }, + .read = i6300esb_mem_readfn, + .write = i6300esb_mem_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_LITTLE_ENDIAN , };
PATCH 5/6 hw/input/pckbd: Convert away from old_mmio
In reply to Peter MaydellConvert the pckbd device away from using the old_mmio field of MemoryRegionOps. This change only affects the memory-mapped variant of the i8042, which is used by the Unicore32 'puv3' board and the MIPS Jazz boards 'magnum' and 'pica61'.
--- hw/input/pckbd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
hw/input/pckbd.c +8 -6
@@ -434,7 +434,7 @@ static const VMStateDescription vmstate_kbd = { };/* Memory mapped interface */ -static uint32_t kbd_mm_readb (void *opaque,hwaddr addr) +static uint64_t kbd_mm_readfn (void *opaque,hwaddr addr,unsigned size) {KBDState *s = opaque;
@@ -444,7 +444,8 @@ static uint32_t kbd_mm_readb (void *opaque, hwaddr addr)return kbd_read_data (s,0 ,1 ) &0xff ; } -static void kbd_mm_writeb (void *opaque,hwaddr addr,uint32_t value) +static void kbd_mm_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) {KBDState *s = opaque;
@@ -454,12 +455,13 @@ static void kbd_mm_writeb (void *opaque, hwaddr addr, uint32_t value)kbd_write_data (s,0 , value &0xff ,1 ); } +static const MemoryRegionOps i8042_mmio_ops = { + .read = kbd_mm_readfn, + .write = kbd_mm_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , - .old_mmio = { - .read = { kbd_mm_readb, kbd_mm_readb, kbd_mm_readb }, - .write = { kbd_mm_writeb, kbd_mm_writeb, kbd_mm_writeb }, - }, }; void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 5/6] hw/input/pckbd: Convert away from old_mmio
Quoted 6 lines · Peter Maydell
Convert the pckbd device away from using the
old_mmiofield of MemoryRegionOps. This change only affects the memory-mapped variant of the i8042, which is used by the Unicore32 'puv3' board and the MIPS Jazz boards 'magnum' and 'pica61'.Signed-off-by Peter Maydell <[email protected]>
Quoted 46 lines
--- hw/input/pckbd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)hw/input/pckbd.c +8
-6@@ -434,7 +434,7 @@ static const VMStateDescription vmstate_kbd = { };/* Memory mapped interface */ -static uint32_t kbd_mm_readb (void *opaque,hwaddr addr) +static uint64_t kbd_mm_readfn (void *opaque,hwaddr addr,unsigned size) {KBDState *s = opaque;@@ -444,7 +444,8 @@ static uint32_t kbd_mm_readb (void *opaque, hwaddr addr)return kbd_read_data (s,0 ,1 ) &0xff ; } -static void kbd_mm_writeb (void *opaque,hwaddr addr,uint32_t value) +static void kbd_mm_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) {KBDState *s = opaque;@@ -454,12 +455,13 @@ static void kbd_mm_writeb (void *opaque, hwaddr addr, uint32_t value)kbd_write_data (s,0 , value &0xff ,1 ); } +static const MemoryRegionOps i8042_mmio_ops = { + .read = kbd_mm_readfn, + .write = kbd_mm_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , - .old_mmio = { - .read = { kbd_mm_readb, kbd_mm_readb, kbd_mm_readb }, - .write = { kbd_mm_writeb, kbd_mm_writeb, kbd_mm_writeb }, - }, }; void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
PATCH 6/6 hw/char/parallel: Convert away from old_mmio
In reply to Peter MaydellConvert the parallel device away from using the old_mmio field of MemoryRegionOps. This change only affects the memory-mapped variant, which is used by the MIPS Jazz boards 'magnum' and 'pica61'.
--- hw/char/parallel.c | 50 ++++++++++------------------------------------ 1 file changed, 11 insertions(+), 39 deletions(-)
hw/char/parallel.c +11 -39
@@ -554,56 +554,28 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp) }/* Memory mapped interface */ -static uint32_t parallel_mm_readb (void *opaque,hwaddr addr) +static uint64_t parallel_mm_readfn (void *opaque,hwaddr addr,unsigned size) {ParallelState *s = opaque; -return parallel_ioport_read_sw (s, addr >> s->it_shift) &0xFF ; +return parallel_ioport_read_sw (s, addr >> s->it_shift) & +MAKE_64BIT_MASK (0 , size *8 ); } -static void parallel_mm_writeb (void *opaque, -hwaddr addr,uint32_t value) +static void parallel_mm_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) {ParallelState *s = opaque; -parallel_ioport_write_sw (s, addr >> s->it_shift, value &0xFF ); -} - -static uint32_t parallel_mm_readw (void *opaque,hwaddr addr) -{ -ParallelState *s = opaque; - -return parallel_ioport_read_sw (s, addr >> s->it_shift) &0xFFFF ; -} - -static void parallel_mm_writew (void *opaque, -hwaddr addr,uint32_t value) -{ -ParallelState *s = opaque; - -parallel_ioport_write_sw (s, addr >> s->it_shift, value &0xFFFF ); -} - -static uint32_t parallel_mm_readl (void *opaque,hwaddr addr) -{ -ParallelState *s = opaque; - -return parallel_ioport_read_sw (s, addr >> s->it_shift); -} - -static void parallel_mm_writel (void *opaque, -hwaddr addr,uint32_t value) -{ -ParallelState *s = opaque; - -parallel_ioport_write_sw (s, addr >> s->it_shift, value); +parallel_ioport_write_sw (s, addr >> s->it_shift, + value &MAKE_64BIT_MASK (0 , size *8 )); }static const MemoryRegionOps parallel_mm_ops = { - .old_mmio = { - .read = { parallel_mm_readb, parallel_mm_readw, parallel_mm_readl }, - .write = { parallel_mm_writeb, parallel_mm_writew, parallel_mm_writel }, - }, + .read = parallel_mm_readfn, + .write = parallel_mm_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 6/6] hw/char/parallel: Convert away from old_mmio
Quoted 5 lines · Peter Maydell
Convert the parallel device away from using the
old_mmiofield of MemoryRegionOps. This change only affects the memory-mapped variant, which is used by the MIPS Jazz boards 'magnum' and 'pica61'.Signed-off-by Peter Maydell <[email protected]>
Quoted 77 lines
--- hw/char/parallel.c | 50 ++++++++++------------------------------------ 1 file changed, 11 insertions(+), 39 deletions(-)hw/char/parallel.c +11
-39@@ -554,56 +554,28 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp) }/* Memory mapped interface */ -static uint32_t parallel_mm_readb (void *opaque,hwaddr addr) +static uint64_t parallel_mm_readfn (void *opaque,hwaddr addr,unsigned size) {ParallelState *s = opaque; -return parallel_ioport_read_sw (s, addr >> s->it_shift) &0xFF ; +return parallel_ioport_read_sw (s, addr >> s->it_shift) & +MAKE_64BIT_MASK (0 , size *8 ); } -static void parallel_mm_writeb (void *opaque, -hwaddr addr,uint32_t value) +static void parallel_mm_writefn (void *opaque,hwaddr addr, +uint64_t value,unsigned size) {ParallelState *s = opaque; -parallel_ioport_write_sw (s, addr >> s->it_shift, value &0xFF ); -} - -static uint32_t parallel_mm_readw (void *opaque,hwaddr addr) -{ -ParallelState *s = opaque; - -return parallel_ioport_read_sw (s, addr >> s->it_shift) &0xFFFF ; -} - -static void parallel_mm_writew (void *opaque, -hwaddr addr,uint32_t value) -{ -ParallelState *s = opaque; - -parallel_ioport_write_sw (s, addr >> s->it_shift, value &0xFFFF ); -} - -static uint32_t parallel_mm_readl (void *opaque,hwaddr addr) -{ -ParallelState *s = opaque; - -return parallel_ioport_read_sw (s, addr >> s->it_shift); -} - -static void parallel_mm_writel (void *opaque, -hwaddr addr,uint32_t value) -{ -ParallelState *s = opaque; - -parallel_ioport_write_sw (s, addr >> s->it_shift, value); +parallel_ioport_write_sw (s, addr >> s->it_shift, + value &MAKE_64BIT_MASK (0 , size *8 )); }static const MemoryRegionOps parallel_mm_ops = { - .old_mmio = { - .read = { parallel_mm_readb, parallel_mm_readw, parallel_mm_readl }, - .write = { parallel_mm_writeb, parallel_mm_writew, parallel_mm_writel }, - }, + .read = parallel_mm_readfn, + .write = parallel_mm_writefn, + .valid.min_access_size =1 , + .valid.max_access_size =4 , .endianness =DEVICE_NATIVE_ENDIAN , };
Quoted 9 lines · Peter Maydell
Half a dozen miscellaneous conversions away from
old_mmiousage in the MemoryRegionOps struct. This leaves us with only 10 remaining in the tree.NB: mips parts tested only via 'make check'.
thanks
-- PMM
Quoted 7 lines
Peter Maydell (6):
hw/sh/sh7750: Convert away fromold_mmiohw/m68k/mcf5206: Convert away fromold_mmiohw/block/pflash_cfi02: Convert away fromold_mmiohw/watchdog/wdt_i6300esb: Convert away fromold_mmiohw/input/pckbd: Convert away fromold_mmiohw/char/parallel: Convert away fromold_mmio
Ping for review on patches 1, 4, 5, 6, please?
thanks
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 7 lines · Peter Maydell
Peter Maydell (6):
hw/sh/sh7750: Convert away fromold_mmiohw/m68k/mcf5206: Convert away fromold_mmiohw/block/pflash_cfi02: Convert away fromold_mmiohw/watchdog/wdt_i6300esb: Convert away fromold_mmiohw/input/pckbd: Convert away fromold_mmiohw/char/parallel: Convert away fromold_mmioPing for review on patches 1, 4, 5, 6, please?
Thanks all for the review. I propose to put these in via target-arm.next for (my) convenience, though they're not really very arm-related.
thanks
-- PMM