From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: richard.henderson@linaro.org, deller@gmx.de, mst@redhat.com,
pbonzini@redhat.com, peter.maydell@linaro.org,
hpoussin@reactos.org, aleksandar.rikalo@syrmia.com,
f4bug@amsat.org, jiaxun.yang@flygoat.com, qemu-arm@nongnu.org,
qemu-devel@nongnu.org
Subject: [PATCH v2 18/54] pckbd: checkpatch fixes
Date: Fri, 24 Jun 2022 14:40:33 +0100 [thread overview]
Message-ID: <20220624134109.881989-19-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20220624134109.881989-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
---
hw/input/pckbd.c | 150 ++++++++++++++++++++++++++++++-----------------
1 file changed, 97 insertions(+), 53 deletions(-)
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 45c40fe3f3..c18a1a7fae 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -39,49 +39,86 @@
#include "trace.h"
-/* Keyboard Controller Commands */
-#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */
-#define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */
-#define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */
-#define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */
-#define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */
-#define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */
-#define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */
-#define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */
-#define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */
-#define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */
-#define KBD_CCMD_READ_INPORT 0xC0 /* read input port */
-#define KBD_CCMD_READ_OUTPORT 0xD0 /* read output port */
-#define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */
-#define KBD_CCMD_WRITE_OBUF 0xD2
-#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if
- initiated by the auxiliary device */
-#define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */
-#define KBD_CCMD_DISABLE_A20 0xDD /* HP vectra only ? */
-#define KBD_CCMD_ENABLE_A20 0xDF /* HP vectra only ? */
-#define KBD_CCMD_PULSE_BITS_3_0 0xF0 /* Pulse bits 3-0 of the output port P2. */
-#define KBD_CCMD_RESET 0xFE /* Pulse bit 0 of the output port P2 = CPU reset. */
-#define KBD_CCMD_NO_OP 0xFF /* Pulse no bits of the output port P2. */
+/* Keyboard Controller Commands */
+
+/* Read mode bits */
+#define KBD_CCMD_READ_MODE 0x20
+/* Write mode bits */
+#define KBD_CCMD_WRITE_MODE 0x60
+/* Get controller version */
+#define KBD_CCMD_GET_VERSION 0xA1
+/* Disable mouse interface */
+#define KBD_CCMD_MOUSE_DISABLE 0xA7
+/* Enable mouse interface */
+#define KBD_CCMD_MOUSE_ENABLE 0xA8
+/* Mouse interface test */
+#define KBD_CCMD_TEST_MOUSE 0xA9
+/* Controller self test */
+#define KBD_CCMD_SELF_TEST 0xAA
+/* Keyboard interface test */
+#define KBD_CCMD_KBD_TEST 0xAB
+/* Keyboard interface disable */
+#define KBD_CCMD_KBD_DISABLE 0xAD
+/* Keyboard interface enable */
+#define KBD_CCMD_KBD_ENABLE 0xAE
+/* read input port */
+#define KBD_CCMD_READ_INPORT 0xC0
+/* read output port */
+#define KBD_CCMD_READ_OUTPORT 0xD0
+/* write output port */
+#define KBD_CCMD_WRITE_OUTPORT 0xD1
+#define KBD_CCMD_WRITE_OBUF 0xD2
+/* Write to output buffer as if initiated by the auxiliary device */
+#define KBD_CCMD_WRITE_AUX_OBUF 0xD3
+/* Write the following byte to the mouse */
+#define KBD_CCMD_WRITE_MOUSE 0xD4
+/* HP vectra only ? */
+#define KBD_CCMD_DISABLE_A20 0xDD
+/* HP vectra only ? */
+#define KBD_CCMD_ENABLE_A20 0xDF
+/* Pulse bits 3-0 of the output port P2. */
+#define KBD_CCMD_PULSE_BITS_3_0 0xF0
+/* Pulse bit 0 of the output port P2 = CPU reset. */
+#define KBD_CCMD_RESET 0xFE
+/* Pulse no bits of the output port P2. */
+#define KBD_CCMD_NO_OP 0xFF
/* Status Register Bits */
-#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */
-#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */
-#define KBD_STAT_SELFTEST 0x04 /* Self test successful */
-#define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */
-#define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */
-#define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */
-#define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */
-#define KBD_STAT_PERR 0x80 /* Parity error */
+
+/* Keyboard output buffer full */
+#define KBD_STAT_OBF 0x01
+/* Keyboard input buffer full */
+#define KBD_STAT_IBF 0x02
+/* Self test successful */
+#define KBD_STAT_SELFTEST 0x04
+/* Last write was a command write (0=data) */
+#define KBD_STAT_CMD 0x08
+/* Zero if keyboard locked */
+#define KBD_STAT_UNLOCKED 0x10
+/* Mouse output buffer full */
+#define KBD_STAT_MOUSE_OBF 0x20
+/* General receive/xmit timeout */
+#define KBD_STAT_GTO 0x40
+/* Parity error */
+#define KBD_STAT_PERR 0x80
/* Controller Mode Register Bits */
-#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */
-#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */
-#define KBD_MODE_SYS 0x04 /* The system flag (?) */
-#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */
-#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */
-#define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */
-#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */
-#define KBD_MODE_RFU 0x80
+
+/* Keyboard data generate IRQ1 */
+#define KBD_MODE_KBD_INT 0x01
+/* Mouse data generate IRQ12 */
+#define KBD_MODE_MOUSE_INT 0x02
+/* The system flag (?) */
+#define KBD_MODE_SYS 0x04
+/* The keylock doesn't affect the keyboard if set */
+#define KBD_MODE_NO_KEYLOCK 0x08
+/* Disable keyboard interface */
+#define KBD_MODE_DISABLE_KBD 0x10
+/* Disable mouse interface */
+#define KBD_MODE_DISABLE_MOUSE 0x20
+/* Scan code conversion to PC format */
+#define KBD_MODE_KCC 0x40
+#define KBD_MODE_RFU 0x80
/* Output Port Bits */
#define KBD_OUT_RESET 0x01 /* 1=normal mode, 0=reset */
@@ -89,7 +126,8 @@
#define KBD_OUT_OBF 0x10 /* Keyboard output buffer full */
#define KBD_OUT_MOUSE_OBF 0x20 /* Mouse output buffer full */
-/* OSes typically write 0xdd/0xdf to turn the A20 line off and on.
+/*
+ * OSes typically write 0xdd/0xdf to turn the A20 line off and on.
* We make the default value of the outport include these four bits,
* so that the subsection is rarely necessary.
*/
@@ -133,8 +171,10 @@ typedef struct KBDState {
hwaddr mask;
} KBDState;
-/* XXX: not generating the irqs if KBD_MODE_DISABLE_KBD is set may be
- incorrect, but it avoids having to simulate exact delays */
+/*
+ * 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_lines(KBDState *s)
{
int irq_kbd_level, irq_mouse_level;
@@ -302,21 +342,23 @@ static void kbd_write_command(void *opaque, hwaddr addr,
trace_pckbd_kbd_write_command(val);
- /* Bits 3-0 of the output port P2 of the keyboard controller may be pulsed
+ /*
+ * Bits 3-0 of the output port P2 of the keyboard controller may be pulsed
* low for approximately 6 micro seconds. Bits 3-0 of the KBD_CCMD_PULSE
* command specify the output port bits to be pulsed.
* 0: Bit should be pulsed. 1: Bit should not be modified.
* The only useful version of this command is pulsing bit 0,
* which does a CPU reset.
*/
- if((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) {
- if(!(val & 1))
+ if ((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) {
+ if (!(val & 1)) {
val = KBD_CCMD_RESET;
- else
+ } else {
val = KBD_CCMD_NO_OP;
+ }
}
- switch(val) {
+ switch (val) {
case KBD_CCMD_READ_MODE:
kbd_queue(s, s->mode, 0);
break;
@@ -409,7 +451,7 @@ static void kbd_write_data(void *opaque, hwaddr addr,
trace_pckbd_kbd_write_data(val);
- switch(s->write_cmd) {
+ switch (s->write_cmd) {
case 0:
ps2_write_keyboard(s->kbd, val);
/* sending data to the keyboard reenables PS/2 communication */
@@ -607,7 +649,7 @@ static const VMStateDescription vmstate_kbd = {
VMSTATE_UINT8(pending_tmp, KBDState),
VMSTATE_END_OF_LIST()
},
- .subsections = (const VMStateDescription*[]) {
+ .subsections = (const VMStateDescription * []) {
&vmstate_kbd_outport,
&vmstate_kbd_extended_state,
NULL
@@ -619,10 +661,11 @@ static uint64_t kbd_mm_readfn(void *opaque, hwaddr addr, unsigned size)
{
KBDState *s = opaque;
- if (addr & s->mask)
+ if (addr & s->mask) {
return kbd_read_status(s, 0, 1) & 0xff;
- else
+ } else {
return kbd_read_data(s, 0, 1) & 0xff;
+ }
}
static void kbd_mm_writefn(void *opaque, hwaddr addr,
@@ -630,10 +673,11 @@ static void kbd_mm_writefn(void *opaque, hwaddr addr,
{
KBDState *s = opaque;
- if (addr & s->mask)
+ if (addr & s->mask) {
kbd_write_command(s, 0, value & 0xff, 1);
- else
+ } else {
kbd_write_data(s, 0, value & 0xff, 1);
+ }
}
--
2.30.2
next prev parent reply other threads:[~2022-06-24 13:59 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-24 13:40 [PATCH v2 00/54] PS2 device QOMification - part 1 Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 01/54] ps2: checkpatch fixes Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 02/54] ps2: QOMify PS2State Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 03/54] ps2: QOMify PS2KbdState Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 04/54] ps2: QOMify PS2MouseState Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 05/54] ps2: move QOM type definitions from ps2.c to ps2.h Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 06/54] ps2: improve function prototypes in ps2.c and ps2.h Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 07/54] ps2: introduce PS2DeviceClass Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 08/54] ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset() Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 09/54] ps2: remove duplicate setting of scancode_set in ps2_kbd_init() Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 10/54] ps2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 11/54] ps2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 12/54] ps2: don't use vmstate_register() in ps2_kbd_init() Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 13/54] ps2: don't use vmstate_register() in ps2_mouse_init() Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 14/54] pl050: checkpatch fixes Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 15/54] pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 16/54] lasips2: spacing fixes Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 17/54] lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq() Mark Cave-Ayland
2022-06-24 13:40 ` Mark Cave-Ayland [this message]
2022-06-24 13:40 ` [PATCH v2 19/54] pckbd: move KBDState from pckbd.c to i8042.h Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 20/54] pckbd: move ISAKBDState " Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 21/54] pckbd: introduce new I8042_MMIO QOM type Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 22/54] pckbd: implement i8042_mmio_reset() for I8042_MMIO device Mark Cave-Ayland
2022-06-24 15:07 ` Peter Maydell
2022-06-24 13:40 ` [PATCH v2 23/54] pckbd: add mask qdev property to " Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 24/54] pckbd: add size " Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 25/54] pckbd: implement i8042_mmio_realize() function Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 26/54] pckbd: implement i8042_mmio_init() function Mark Cave-Ayland
2022-06-24 15:07 ` Peter Maydell
2022-06-24 13:40 ` [PATCH v2 27/54] pckbd: alter i8042_mm_init() to return a I8042_MMIO device Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 28/54] pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 29/54] pckbd: more vmstate_register() from i8042_mm_init() to i8042_mmio_realize() Mark Cave-Ayland
2022-06-24 15:07 ` Peter Maydell
2022-06-24 13:40 ` [PATCH v2 30/54] pckbd: move ps2_kbd_init() and ps2_mouse_init() " Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 31/54] ps2: make ps2_raise_irq() function static Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 32/54] ps2: use ps2_raise_irq() instead of calling update_irq() directly Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 33/54] ps2: introduce ps2_lower_irq() " Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 34/54] ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq() Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 35/54] pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 36/54] pl050: switch over from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-24 15:08 ` Peter Maydell
2022-06-24 13:40 ` [PATCH v2 37/54] pl050: add QEMU interface comment Mark Cave-Ayland
2022-06-24 15:08 ` Peter Maydell
2022-06-24 13:40 ` [PATCH v2 38/54] lasips2: QOMify LASIPS2State Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 39/54] lasips2: move lasips2 QOM types from lasips2.c to lasips2.h Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 40/54] lasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS2 device Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 41/54] lasips2: implement lasips2_init() function Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 42/54] lasips2: move mapping of LASIPS2 registers to HPPA machine Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 43/54] lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init() Mark Cave-Ayland
2022-06-24 13:40 ` [PATCH v2 44/54] lasips2: add base property Mark Cave-Ayland
2022-06-24 15:09 ` Peter Maydell
2022-06-24 13:41 ` [PATCH v2 45/54] lasips2: implement lasips2_realize() Mark Cave-Ayland
2022-06-24 13:41 ` [PATCH v2 46/54] lasips2: use sysbus IRQ for output IRQ Mark Cave-Ayland
2022-06-24 15:10 ` Peter Maydell
2022-06-24 13:41 ` [PATCH v2 47/54] lasips2: switch over from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-24 15:10 ` Peter Maydell
2022-06-26 10:14 ` Mark Cave-Ayland
2022-06-24 13:41 ` [PATCH v2 48/54] lasips2: add QEMU interface comment Mark Cave-Ayland
2022-06-24 15:11 ` Peter Maydell
2022-06-24 13:41 ` [PATCH v2 49/54] pckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-24 13:41 ` [PATCH v2 50/54] pckbd: add QEMU interface comment for I8042_MMIO device Mark Cave-Ayland
2022-06-24 15:11 ` Peter Maydell
2022-06-24 13:41 ` [PATCH v2 51/54] pckbd: add i8042_reset() function to I8042 device Mark Cave-Ayland
2022-06-24 13:41 ` [PATCH v2 52/54] pckbd: switch I8042 device from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-24 13:41 ` [PATCH v2 53/54] pckbd: add QEMU interface comment for I8042 device Mark Cave-Ayland
2022-06-24 15:12 ` Peter Maydell
2022-06-24 13:41 ` [PATCH v2 54/54] ps2: remove update_irq() function and update_arg parameter Mark Cave-Ayland
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=20220624134109.881989-19-mark.cave-ayland@ilande.co.uk \
--to=mark.cave-ayland@ilande.co.uk \
--cc=aleksandar.rikalo@syrmia.com \
--cc=deller@gmx.de \
--cc=f4bug@amsat.org \
--cc=hpoussin@reactos.org \
--cc=jiaxun.yang@flygoat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.