summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Lai <ericr_lai@compal.corp-partner.google.com>2019-12-12 13:15:30 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-12-13 09:05:07 +0000
commitd1613f5681f17c02e5219342a0edc39e4aed685d (patch)
treef888bd074a1fa776bb80fefe8659990a4ede6f51
parent98b72dadf07bf8694f78384d21a4add7ac76c1f2 (diff)
libpayload/drivers/i8042: Add error handling
Add error handling on I8042_CMD_WR_CMD_BYTE failure. BUG=b:145130110 TEST=Draillion keyboard is usable on every boot. Signed-off-by: Eric Lai <ericr_lai@compal.corp-partner.google.com> Change-Id: I56c472ae7e399d4862c6e41b70f53a21d718157d Reviewed-on: https://review.coreboot.org/c/coreboot/+/37664 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--payloads/libpayload/drivers/i8042/keyboard.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index 4b4a56987a..79455cfe7b 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -318,10 +318,14 @@ static int enable_translated(void)
if (!i8042_cmd(I8042_CMD_RD_CMD_BYTE)) {
int cmd = i8042_read_data_ps2();
cmd |= I8042_CMD_BYTE_XLATE;
- if (!i8042_cmd(I8042_CMD_WR_CMD_BYTE))
+ if (!i8042_cmd(I8042_CMD_WR_CMD_BYTE)) {
i8042_write_data(cmd);
+ } else {
+ printf("ERROR: i8042_cmd WR_CMD failed!\n");
+ return 0;
+ }
} else {
- printf("ERROR: Keyboard i8042_cmd failed!\n");
+ printf("ERROR: i8042_cmd RD_CMD failed!\n");
return 0;
}
return 1;