aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2023-10-31 20:03:32 +0000
committerWarner Losh <imp@FreeBSD.org>2023-10-31 20:52:22 +0000
commit1fc478fb48e9a3ca31f9715164dac47038497a7e (patch)
tree1d7730fd73fafd439747d85b0703dfa1b81d7fc2
parent83823d063ab57db8d3954c1530d036f1ccdceb41 (diff)
bhyve: ps2 implement command 0xf6
Implement PS2 Keyboard command 0xf6, which is "SET DEFAULTS". This is the same as 0xf5 (DISABLE KEYBOARD), but without disabling the keyboard (since that resets all the defaults as a side effect). Normally, we clear the fifo when we re-enable the keyboard. However, since this leaves the keyboard enabled, clear the fifo as part of this command and send an ack. Linux's keyboard driver sends this command on reboot. Other commands enable / reset the kebyoard, so it doesn't matter too much this isn't implemented for booting, eg ubuntu. Sponsored by: Netflix Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D42384
-rw-r--r--usr.sbin/bhyve/amd64/ps2kbd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/amd64/ps2kbd.c b/usr.sbin/bhyve/amd64/ps2kbd.c
index 6fe36dbc4a55..c9e122b8bbd3 100644
--- a/usr.sbin/bhyve/amd64/ps2kbd.c
+++ b/usr.sbin/bhyve/amd64/ps2kbd.c
@@ -53,6 +53,7 @@
/* keyboard device commands */
#define PS2KC_RESET_DEV 0xff
+#define PS2KC_SET_DEFAULTS 0xf6
#define PS2KC_DISABLE 0xf5
#define PS2KC_ENABLE 0xf4
#define PS2KC_SET_TYPEMATIC 0xf3
@@ -300,6 +301,10 @@ ps2kbd_write(struct ps2kbd_softc *sc, uint8_t val)
fifo_put(sc, PS2KC_ACK);
fifo_put(sc, PS2KC_BAT_SUCCESS);
break;
+ case PS2KC_SET_DEFAULTS:
+ fifo_reset(sc);
+ fifo_put(sc, PS2KC_ACK);
+ break;
case PS2KC_DISABLE:
sc->enabled = false;
fifo_put(sc, PS2KC_ACK);