qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 4/6] hppa: add emulation of LASI PS2 controllers


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v5 4/6] hppa: add emulation of LASI PS2 controllers
Date: Fri, 3 Jan 2020 07:15:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

Hi Sven,

On 12/20/19 10:15 PM, Sven Schnelle wrote:
Signed-off-by: Sven Schnelle <address@hidden>
---
  hw/hppa/Kconfig            |   1 +
  hw/hppa/lasi.c             |  10 +-
  hw/input/Kconfig           |   3 +
  hw/input/Makefile.objs     |   1 +
  hw/input/lasips2.c         | 289 +++++++++++++++++++++++++++++++++++++
  hw/input/ps2.c             |   5 +
  hw/input/trace-events      |   5 +
  include/hw/input/lasips2.h |  16 ++
  include/hw/input/ps2.h     |   1 +
  9 files changed, 330 insertions(+), 1 deletion(-)
  create mode 100644 hw/input/lasips2.c
  create mode 100644 include/hw/input/lasips2.h

diff --git a/hw/hppa/Kconfig b/hw/hppa/Kconfig
index 2a7b38d6d6..7f9be7f25c 100644
--- a/hw/hppa/Kconfig
+++ b/hw/hppa/Kconfig
@@ -11,3 +11,4 @@ config DINO
      select MC146818RTC
      select LSI_SCSI_PCI
      select LASI_82596
+    select LASIPS2

If these components are part of the LASI chipset, you don't need an specific Kconfig entry for each, you can simply use the LASI one.

Add a LASI entry in hw/hppa/Kconfig such:

config LASI
    bool
    select I82596_COMMON
    select PS2

If you disagree, can you rename LASIPS2 -> LASI_PS2?

diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c
index 51752589f3..d8d03f95c0 100644
--- a/hw/hppa/lasi.c
+++ b/hw/hppa/lasi.c
@@ -22,6 +22,7 @@
  #include "hw/net/lasi_82596.h"
  #include "hw/char/parallel.h"
  #include "hw/char/serial.h"
+#include "hw/input/lasips2.h"
  #include "exec/address-spaces.h"
  #include "migration/vmstate.h"
@@ -324,6 +325,7 @@ DeviceState *lasi_init(MemoryRegion *address_space)
                       lpt_irq, parallel_hds[0]);
/* Real time clock (RTC), it's only one 32-bit counter @9000 */
+
      s->rtc = time(NULL);
      s->rtc_ref = 0;
@@ -333,8 +335,14 @@ DeviceState *lasi_init(MemoryRegion *address_space)
                  lasi_get_irq(LASI_UART_HPA));
          serial_mm_init(address_space, LASI_UART_HPA + 0x800, 0,
                  serial_irq, 8000000 / 16,
-                serial_hd(1), DEVICE_NATIVE_ENDIAN);
+                serial_hd(0), DEVICE_NATIVE_ENDIAN);
      }
+
+    /* PS/2 Keyboard/Mouse */
+    qemu_irq ps2kbd_irq = qemu_allocate_irq(lasi_set_irq, s,
+            lasi_get_irq(LASI_PS2KBD_HPA));
+    lasips2_init(address_space, LASI_PS2KBD_HPA,  ps2kbd_irq);
+
      return dev;
  }
diff --git a/hw/input/Kconfig b/hw/input/Kconfig
index 287f08887b..25c77a1b87 100644
--- a/hw/input/Kconfig
+++ b/hw/input/Kconfig
@@ -41,3 +41,6 @@ config VHOST_USER_INPUT
config TSC210X
      bool
+
+config LASIPS2
+    select PS2
diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs
index a1bc502ed0..f98f635685 100644
--- a/hw/input/Makefile.objs
+++ b/hw/input/Makefile.objs
@@ -15,3 +15,4 @@ common-obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input.o
  obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o
  obj-$(CONFIG_PXA2XX) += pxa2xx_keypad.o
  obj-$(CONFIG_TSC210X) += tsc210x.o
+obj-$(CONFIG_LASIPS2) += lasips2.o
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
new file mode 100644
index 0000000000..1943671d1e
--- /dev/null
+++ b/hw/input/lasips2.c
@@ -0,0 +1,289 @@
+/*
+ * QEMU HP Lasi PS/2 interface emulation
+ *
+ * Copyright (c) 2019 Sven Schnelle
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "qemu/osdep.h"
+#include "qemu/log.h"
+#include "hw/qdev-properties.h"
+#include "hw/hw.h"
+#include "hw/input/ps2.h"
+#include "hw/input/lasips2.h"
+#include "hw/sysbus.h"
+#include "exec/hwaddr.h"
+#include "sysemu/sysemu.h"
+#include "trace.h"
+#include "exec/address-spaces.h"
+#include "migration/vmstate.h"
+#include "hw/irq.h"

<newline>

+struct LASIPS2State;
+typedef struct LASIPS2Port {
+    struct LASIPS2State *parent;
+    MemoryRegion reg;
+    void *dev;
+    uint8_t id;
+    uint8_t control;
+    uint8_t buf;
+    bool loopback_rbne;
+    bool irq;
+} LASIPS2Port;
[...]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]