grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks
@ 2023-04-23  9:59 Riku Viitanen
  2023-04-23 22:45 ` Vladimir 'phcoder' Serbinenko
  2023-04-28 13:38 ` Daniel Kiper
  0 siblings, 2 replies; 4+ messages in thread
From: Riku Viitanen @ 2023-04-23  9:59 UTC (permalink / raw)
  To: grub-devel@gnu.org

This fixes GRUB on Coreboot on HP EliteBooks by implementing
a 200ms timeout. GRUB used to hang. See: https://ticket.coreboot.org/issues/141
---
 grub-core/term/at_keyboard.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c
index 597111077..28d1d0a77 100644
--- a/grub-core/term/at_keyboard.c
+++ b/grub-core/term/at_keyboard.c
@@ -42,7 +42,16 @@ keyboard_controller_wait_until_ready (void)
 {
   /* 50 us would be enough but our current time resolution is 1ms.  */
   grub_millisleep (1);
-  while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
+
+  unsigned i = 200;
+  while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) {
+    grub_millisleep (1);
+
+    /* Timeout */
+    if (! i--) {
+      break;
+    }
+  }
 }
 
 static grub_uint8_t
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks
  2023-04-23  9:59 [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks Riku Viitanen
@ 2023-04-23 22:45 ` Vladimir 'phcoder' Serbinenko
  2023-04-28 13:38 ` Daniel Kiper
  1 sibling, 0 replies; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-04-23 22:45 UTC (permalink / raw)
  To: The development of GNU GRUB

LGTM

On Sun, Apr 23, 2023 at 3:39 PM Riku Viitanen via Grub-devel
<grub-devel@gnu.org> wrote:
>
> This fixes GRUB on Coreboot on HP EliteBooks by implementing
> a 200ms timeout. GRUB used to hang. See: https://ticket.coreboot.org/issues/141
> ---
>  grub-core/term/at_keyboard.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c
> index 597111077..28d1d0a77 100644
> --- a/grub-core/term/at_keyboard.c
> +++ b/grub-core/term/at_keyboard.c
> @@ -42,7 +42,16 @@ keyboard_controller_wait_until_ready (void)
>  {
>    /* 50 us would be enough but our current time resolution is 1ms.  */
>    grub_millisleep (1);
> -  while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
> +
> +  unsigned i = 200;
> +  while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) {
> +    grub_millisleep (1);
> +
> +    /* Timeout */
> +    if (! i--) {
> +      break;
> +    }
> +  }
>  }
>
>  static grub_uint8_t
> --
> 2.40.0
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



-- 
Regards
Vladimir 'phcoder' Serbinenko


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks
  2023-04-23  9:59 [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks Riku Viitanen
  2023-04-23 22:45 ` Vladimir 'phcoder' Serbinenko
@ 2023-04-28 13:38 ` Daniel Kiper
       [not found]   ` <2W2qlB65nrHB5tFX14PgPuTRjhVZnZvubg9ecvWkYBZBT07EVg4qu9UNBkFZ95a6qXDL4ed19YqFVtwUAWT759LKW7_n6PRGDyKOcMwExU0=@protonmail.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Kiper @ 2023-04-28 13:38 UTC (permalink / raw)
  To: Riku Viitanen; +Cc: grub-devel

On Sun, Apr 23, 2023 at 09:59:34AM +0000, Riku Viitanen via Grub-devel wrote:
> This fixes GRUB on Coreboot on HP EliteBooks by implementing
> a 200ms timeout. GRUB used to hang. See: https://ticket.coreboot.org/issues/141

Missing Signed-off-by. May I add it on your behalf?

Otherwise Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Fw: Re: [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks
       [not found]   ` <2W2qlB65nrHB5tFX14PgPuTRjhVZnZvubg9ecvWkYBZBT07EVg4qu9UNBkFZ95a6qXDL4ed19YqFVtwUAWT759LKW7_n6PRGDyKOcMwExU0=@protonmail.com>
@ 2023-04-30 20:42     ` Riku Viitanen
  0 siblings, 0 replies; 4+ messages in thread
From: Riku Viitanen @ 2023-04-30 20:42 UTC (permalink / raw)
  To: grub-devel@gnu.org, Daniel Kiper

I accidentally replied to Daniel Kiper only.

------- Forwarded Message -------
From: Riku Viitanen <riku.viitanen@protonmail.com>
Date: On Sunday, April 30th, 2023 at 15.26
Subject: Re: [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks
To: Daniel Kiper <dkiper@net-space.pl>


> On Friday, April 28th, 2023 at 16.38, Daniel Kiper dkiper@net-space.pl wrote:
> 
> > On Sun, Apr 23, 2023 at 09:59:34AM +0000, Riku Viitanen via Grub-devel wrote:
> > 
> > > This fixes GRUB on Coreboot on HP EliteBooks by implementing
> > > a 200ms timeout. GRUB used to hang. See: https://ticket.coreboot.org/issues/141
> > 
> > Missing Signed-off-by. May I add it on your behalf?
> > 
> > Otherwise Reviewed-by: Daniel Kiper daniel.kiper@oracle.com
> > 
> > Daniel
> 
> 
> You may.
> 
> Signed-off-by: Riku Viitanen riku.viitanen@protonmail.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-30 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-23  9:59 [PATCH] at_keyboard.c: add timeout to fix hang on hp elitebooks Riku Viitanen
2023-04-23 22:45 ` Vladimir 'phcoder' Serbinenko
2023-04-28 13:38 ` Daniel Kiper
     [not found]   ` <2W2qlB65nrHB5tFX14PgPuTRjhVZnZvubg9ecvWkYBZBT07EVg4qu9UNBkFZ95a6qXDL4ed19YqFVtwUAWT759LKW7_n6PRGDyKOcMwExU0=@protonmail.com>
2023-04-30 20:42     ` Fw: " Riku Viitanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).