This fixes the GRUB on Coreboot on HP EliteBooks by implementing
a 200 ms timeout. The GRUB used to hang.
Fixes: https://ticket.coreboot.org/issues/141
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
static void
keyboard_controller_wait_until_ready (void)
{
+ unsigned int i = 200;
+
/* 50 us would be enough but our current time resolution is 1ms. */
grub_millisleep (1);
- while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
+
+ while (!KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)))
+ {
+ grub_millisleep (1);
+
+ /* Timeout. */
+ if (!i--)
+ break;
+ }
}
static grub_uint8_t