From: "Volker Rümelin" <vr_qemu@t-online.de>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [PATCH 04/10] pckbd: split out interrupt line changing code
Date: Wed, 5 May 2021 21:21:27 +0200 [thread overview]
Message-ID: <20210505192133.7480-4-vr_qemu@t-online.de> (raw)
In-Reply-To: <aed90d92-4e34-6f33-005f-10cf176e5483@t-online.de>
Split out the interrupt line changing code from kbd_update_irq().
This is a preparation for the next patch. There is no functional
change.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
hw/input/pckbd.c | 32 ++++++++++++++++++++++----------
1 file 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)
--
2.26.2
next prev parent reply other threads:[~2021-05-05 19:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 19:20 [PATCH 00/10] PS/2 controller related fixes Volker Rümelin
2021-05-05 19:21 ` [PATCH 01/10] ps2: fix mouse stream corruption Volker Rümelin
2021-05-05 19:21 ` [PATCH 02/10] ps2: don't raise an interrupt if queue is full Volker Rümelin
2021-05-06 6:15 ` Philippe Mathieu-Daudé
2021-05-05 19:21 ` [PATCH 03/10] ps2: don't deassert irq twice if queue is empty Volker Rümelin
2021-05-06 6:32 ` Philippe Mathieu-Daudé
2021-05-05 19:21 ` Volker Rümelin [this message]
2021-05-06 6:17 ` [PATCH 04/10] pckbd: split out interrupt line changing code Philippe Mathieu-Daudé
2021-05-05 19:21 ` [PATCH 05/10] pckbd: don't update OBF flags if KBD_STAT_OBF is set Volker Rümelin
2021-05-05 19:21 ` [PATCH 06/10] pckbd: PS/2 keyboard throttle Volker Rümelin
2021-05-05 19:21 ` [PATCH 07/10] pckbd: add state variable for interrupt source Volker Rümelin
2021-05-05 19:21 ` [PATCH 08/10] pckbd: add controller response queue Volker Rümelin
2021-05-05 19:21 ` [PATCH 09/10] pckbd: correctly disable PS/2 communication Volker Rümelin
2021-05-06 6:27 ` Philippe Mathieu-Daudé
2021-05-06 18:06 ` Volker Rümelin
2021-05-05 19:21 ` [PATCH 10/10] pckbd: remove duplicated keyboard and mouse defines Volker Rümelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210505192133.7480-4-vr_qemu@t-online.de \
--to=vr_qemu@t-online.de \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).