aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Rümelin <vr_qemu@t-online.de>2021-05-25 20:14:33 +0200
committerGerd Hoffmann <kraxel@redhat.com>2021-05-26 11:28:44 +0200
commitc3c4a96116ac6e7a1486a74eff7e5eae04c4fac2 (patch)
tree600b52b4b152114f78d6d60fabd5bfec2bddd9dc
parentcec3252416bb76d3c5cee178825a6321950cedec (diff)
pckbd: split out interrupt line changing code
Split out the interrupt line changing code from kbd_update_irq(). This is a preparation for the next patch. There is no functional change. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20210525181441.27768-4-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/input/pckbd.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index dde85ba6c6..90b33954a8 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -148,15 +148,34 @@ typedef struct KBDState {
hwaddr mask;
} KBDState;
-/* update irq and KBD_STAT_[MOUSE_]OBF */
/* XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be
incorrect, but it avoids having to simulate exact delays */
-static void kbd_update_irq(KBDState *s)
+static void kbd_update_irq_lines(KBDState *s)
{
int irq_kbd_level, irq_mouse_level;
irq_kbd_level = 0;
irq_mouse_level = 0;
+
+ if (s->status & KBD_STAT_OBF) {
+ if (s->status & KBD_STAT_MOUSE_OBF) {
+ if (s->mode & KBD_MODE_MOUSE_INT) {
+ irq_mouse_level = 1;
+ }
+ } else {
+ if ((s->mode & KBD_MODE_KBD_INT) &&
+ !(s->mode & KBD_MODE_DISABLE_KBD)) {
+ irq_kbd_level = 1;
+ }
+ }
+ }
+ qemu_set_irq(s->irq_kbd, irq_kbd_level);
+ qemu_set_irq(s->irq_mouse, irq_mouse_level);
+}
+
+/* update irq and KBD_STAT_[MOUSE_]OBF */
+static void kbd_update_irq(KBDState *s)
+{
s->status &= ~(KBD_STAT_OBF | KBD_STAT_MOUSE_OBF);
s->outport &= ~(KBD_OUT_OBF | KBD_OUT_MOUSE_OBF);
if (s->pending) {
@@ -166,16 +185,9 @@ static void kbd_update_irq(KBDState *s)
if (s->pending == KBD_PENDING_AUX) {
s->status |= KBD_STAT_MOUSE_OBF;
s->outport |= KBD_OUT_MOUSE_OBF;
- if (s->mode & KBD_MODE_MOUSE_INT)
- irq_mouse_level = 1;
- } else {
- if ((s->mode & KBD_MODE_KBD_INT) &&
- !(s->mode & KBD_MODE_DISABLE_KBD))
- irq_kbd_level = 1;
}
}
- qemu_set_irq(s->irq_kbd, irq_kbd_level);
- qemu_set_irq(s->irq_mouse, irq_mouse_level);
+ kbd_update_irq_lines(s);
}
static void kbd_update_kbd_irq(void *opaque, int level)