[Qemu-devel] [RFC PATCH v2 12/22] hw/isa/superio: Add a keyboard/mouse controller (8042)

Philippe Mathieu-Daudé posted 22 patches 7 years, 7 months ago
[Qemu-devel] [RFC PATCH v2 12/22] hw/isa/superio: Add a keyboard/mouse controller (8042)
Posted by Philippe Mathieu-Daudé 7 years, 7 months ago
Since the PC87312 inherits this abstract model, we remove the I8042
instance in the PREP machine.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/isa/superio.h | 1 +
 hw/isa/isa-superio.c     | 3 +++
 hw/ppc/prep.c            | 1 -
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
index e8007b9eee..2fc33bf3d3 100644
--- a/include/hw/isa/superio.h
+++ b/include/hw/isa/superio.h
@@ -30,6 +30,7 @@ typedef struct ISASuperIODevice {
     ISADevice *parallel[MAX_PARALLEL_PORTS];
     ISADevice *serial[MAX_SERIAL_PORTS];
     ISADevice *floppy;
+    ISADevice *kbc;
 } ISASuperIODevice;
 
 typedef struct ISASuperIOFuncs {
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 22bf79d3c3..6a24ac0259 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -17,6 +17,7 @@
 #include "sysemu/blockdev.h"
 #include "chardev/char.h"
 #include "hw/isa/superio.h"
+#include "hw/input/i8042.h"
 #include "hw/char/serial.h"
 #include "trace.h"
 
@@ -139,6 +140,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
                                     k->floppy.get_irq(sio, 0) : -1);
     }
 
+    /* Keyboard, mouse */
+    sio->kbc = isa_create_simple(bus, TYPE_I8042);
 }
 
 static void isa_superio_class_init(ObjectClass *oc, void *data)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 610ec7ec32..96d319b87c 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -642,7 +642,6 @@ static void ppc_prep_init(MachineState *machine)
                      hd[2 * i],
 		     hd[2 * i + 1]);
     }
-    isa_create_simple(isa_bus, TYPE_I8042);
 
     cpu = POWERPC_CPU(first_cpu);
     sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];
-- 
2.16.2


Re: [Qemu-devel] [RFC PATCH v2 12/22] hw/isa/superio: Add a keyboard/mouse controller (8042)
Posted by David Gibson 7 years, 7 months ago
On Mon, Mar 05, 2018 at 06:19:18PM -0300, Philippe Mathieu-Daudé wrote:
> Since the PC87312 inherits this abstract model, we remove the I8042
> instance in the PREP machine.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  include/hw/isa/superio.h | 1 +
>  hw/isa/isa-superio.c     | 3 +++
>  hw/ppc/prep.c            | 1 -
>  3 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
> index e8007b9eee..2fc33bf3d3 100644
> --- a/include/hw/isa/superio.h
> +++ b/include/hw/isa/superio.h
> @@ -30,6 +30,7 @@ typedef struct ISASuperIODevice {
>      ISADevice *parallel[MAX_PARALLEL_PORTS];
>      ISADevice *serial[MAX_SERIAL_PORTS];
>      ISADevice *floppy;
> +    ISADevice *kbc;
>  } ISASuperIODevice;
>  
>  typedef struct ISASuperIOFuncs {
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> index 22bf79d3c3..6a24ac0259 100644
> --- a/hw/isa/isa-superio.c
> +++ b/hw/isa/isa-superio.c
> @@ -17,6 +17,7 @@
>  #include "sysemu/blockdev.h"
>  #include "chardev/char.h"
>  #include "hw/isa/superio.h"
> +#include "hw/input/i8042.h"
>  #include "hw/char/serial.h"
>  #include "trace.h"
>  
> @@ -139,6 +140,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
>                                      k->floppy.get_irq(sio, 0) : -1);
>      }
>  
> +    /* Keyboard, mouse */
> +    sio->kbc = isa_create_simple(bus, TYPE_I8042);
>  }
>  
>  static void isa_superio_class_init(ObjectClass *oc, void *data)
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index 610ec7ec32..96d319b87c 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -642,7 +642,6 @@ static void ppc_prep_init(MachineState *machine)
>                       hd[2 * i],
>  		     hd[2 * i + 1]);
>      }
> -    isa_create_simple(isa_bus, TYPE_I8042);
>  
>      cpu = POWERPC_CPU(first_cpu);
>      sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson