[5/6] hw/input/pckbd: Convert away from old_mmio

Message ID 20180601141223.26630-6-peter.maydell@linaro.org
State Superseded
Headers show
Series
  • More conversions away from old_mmio
Related show

Commit Message

Peter Maydell June 1, 2018, 2:12 p.m.
Convert 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'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 hw/input/pckbd.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

-- 
2.17.1

Comments

Philippe Mathieu-Daudé June 11, 2018, 3:26 p.m. | #1
On 06/01/2018 11:12 AM, Peter Maydell wrote:
> Convert 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'.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>  hw/input/pckbd.c | 14 ++++++++------

>  1 file changed, 8 insertions(+), 6 deletions(-)

> 

> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c

> index f17f18e51b..f33e3fc63d 100644

> --- a/hw/input/pckbd.c

> +++ b/hw/input/pckbd.c

> @@ -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

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index f17f18e51b..f33e3fc63d 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -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,