coreboot-kgpe-d16/payloads/libpayload/drivers
Nico Huber a160d93dda libpayload/keyboard: Revise keyboard_cmd() error handling
Even if we are careful, it's still possible that we read spurious
data from the keyboard, e.g. keystrokes. Namely, when we send the
reset/disable command, there is a race before the command is pro-
cessed.

So we should always process data from the keyboard in a loop. We
break it, when an ACK (0xfa) or a NAK (0xfe) is received, and warn
on unexpected data unless it might be due to the mentioned race.

This also gives us the opportunity to use command-specific timeouts
which we take from Linux: 1s for the keyboard self-test (as there
are keyboards that perform the test before acking the command) and
200ms for all other commands.

Change-Id: I60a2643a8ff4b9231c63bf970c8749c97c7d8926
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47083
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-12-24 08:18:41 +00:00
..
i8042 libpayload/keyboard: Revise keyboard_cmd() error handling 2020-12-24 08:18:41 +00:00
serial payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
storage libpayload: storage.c: remove unneeded #if CONFIG() 2020-11-09 07:23:20 +00:00
timer treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
udc payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
usb libpayload/usb: Fix printf format string mismatches in debug messages 2020-11-22 22:34:52 +00:00
video payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
Makefile.inc treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
cbmem_console.c libpayload: Cache physical cbmem console address 2020-08-24 09:12:47 +00:00
hid.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
mouse_cursor.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
nvram.c payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
options.c libpayload: use PRIu64 type to print u64 2020-09-30 10:16:44 +00:00
pci.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
speaker.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00