dev: Implement PS/2 keyboard echo and set scan code commands.

Don't actually let anyone set a scan code set other than 2, since that's
all our converter knows about. It's probably all anyone will want
anyway.

Change-Id: Ief2f35448adc80e30e8fdf13ef9d64d6f19447eb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55807
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2022-01-23 03:38:29 -08:00
parent 06117275fa
commit cc07c6d2f3

View File

@@ -128,9 +128,26 @@ PS2Keyboard::recv(const std::vector<uint8_t> &data)
return true;
}
case keyboard::DiagnosticEcho:
panic("Keyboard diagnostic echo unimplemented.\n");
send(keyboard::DiagnosticEcho);
return true;
case keyboard::AlternateScanCodes:
panic("Accessing alternate scan codes unimplemented.\n");
if (data.size() == 1) {
DPRINTF(PS2, "Got scan code set command.\n");
sendAck();
return false;
} else {
sendAck();
uint8_t scan_code = data[1];
if (scan_code == 0) {
DPRINTF(PS2, "Sending hard coded current scan code set 2.\n");
send(0x2);
} else {
DPRINTF(PS2, "Setting scan code set to %d.\n", scan_code);
panic_if(scan_code != 0x2,
"PS/2 scan code set %d not supported.", scan_code);
}
}
return true;
case keyboard::TypematicInfo:
if (data.size() == 1) {
DPRINTF(PS2, "Setting typematic info.\n");