summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-11-01 20:13:27 +0100
committerHung-Te Lin <hungte@chromium.org>2020-12-24 08:20:01 +0000
commit777c5997475f4b79f977fb52ba130acda900325e (patch)
tree32e4a6be3661881bd1b1d054ccdd5fd07408ef8f
parent260dd9eb7e91de3a14ba095eccc7766c6ed61b2f (diff)
libpayload/keyboard: Add timestamp to track time spent in a state
Will be used to time out in states that don't always advance. Change-Id: I28235e7638d8157cedf81fd915a41d28a1fc070b Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47087 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--payloads/libpayload/drivers/i8042/keyboard.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index dcba031268..114e18bc40 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -245,6 +245,7 @@ static enum keyboard_state {
} keyboard_state;
static uint64_t keyboard_time;
+static uint64_t state_time;
static void keyboard_poll(void)
{
@@ -334,8 +335,10 @@ static void keyboard_poll(void)
break;
}
- if (keyboard_state != next_state)
+ if (keyboard_state != next_state) {
keyboard_state = next_state;
+ state_time = timer_us(0);
+ }
}
bool keyboard_havechar(void)
@@ -489,7 +492,7 @@ void keyboard_init(void)
i8042_cmd(I8042_CMD_EN_KB);
keyboard_state = STATE_DISABLE_SCAN;
- keyboard_time = timer_us(0);
+ keyboard_time = state_time = timer_us(0);
console_add_input_driver(&cons);
}