Mathew King has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37455 )
Change subject: libpayload/drivers/i8042: If configured ignore all i8042 init failures ......................................................................
libpayload/drivers/i8042: If configured ignore all i8042 init failures
Ensure that when LP_PC_KEYBOARD_IGNORE_INIT_FAILURE is set all init failures are ignored.
BUG=b:145130110 TEST=Draillion keyboard is usable on every boot.
Change-Id: Ifb1c908b11afb8098a6cbbfa8a3d4391cabacd0f Signed-off-by: Mathew King mathewk@chromium.org --- M payloads/libpayload/drivers/i8042/keyboard.c 1 file changed, 14 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/55/37455/1
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c index f9932ed..e4ed261 100644 --- a/payloads/libpayload/drivers/i8042/keyboard.c +++ b/payloads/libpayload/drivers/i8042/keyboard.c @@ -312,9 +312,18 @@ .input_type = CONSOLE_INPUT_TYPE_EC, };
+static int keyboard_init_cmd(unsigned char cmd, const char *msg) +{ + if (!keyboard_cmd(cmd) && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE)) { + printf("ERROR: Keyboard %s failed!\n", msg); + return 0; + } + + return 1; +} + void keyboard_init(void) { - unsigned int ret; map = &keyboard_layouts[0];
/* Initialized keyboard controller. */ @@ -329,34 +338,22 @@ i8042_cmd(I8042_CMD_EN_KB);
/* Set scancode set 1 */ - ret = keyboard_cmd(I8042_KBCMD_SET_SCANCODE); - if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE)) { - printf("ERROR: Keyboard set scancode failed!\n"); + if (!keyboard_init_cmd(I8042_KBCMD_SET_SCANCODE, "set scancode")) return; - }
- ret = keyboard_cmd(I8042_SCANCODE_SET_1); - if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE)) { - printf("ERROR: Keyboard scancode set#1 failed!\n"); + if (!keyboard_init_cmd(I8042_SCANCODE_SET_1, "scancode set#1")) return; - }
/* * Set default parameters. * Fix for broken QEMU ps/2 make scancodes. */ - ret = keyboard_cmd(0xf6); - if (!ret) { - printf("ERROR: Keyboard set default params failed!\n"); + if (!keyboard_init_cmd(I8042_KBCMD_SET_DEFAULT, "set default params")) return; - }
/* Enable scanning */ - ret = keyboard_cmd(I8042_KBCMD_EN); - if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE)) { - printf("ERROR: Keyboard enable scanning failed!\n"); + if (!keyboard_init_cmd(I8042_KBCMD_EN, "enable scanning")) return; - }
console_add_input_driver(&cons); }