[SeaBIOS] Problems with coreboot, GRUB payload and SeaBIOS (was: coreboot and `Timeout at i8042_flush:71!`)

Kevin O'Connor kevin at koconnor.net
Fri Feb 3 18:11:56 CET 2017


On Thu, Feb 02, 2017 at 09:21:17PM +0100, Paul Menzel wrote:
> Am Sonntag, den 29.01.2017, 14:18 -0500 schrieb Kevin O'Connor:
> > On Sun, Jan 29, 2017 at 10:08:10AM +0100, Paul Menzel wrote:
> > > coreboots board status repository has some SeaBIOS warnings, and I
> > > believe the keyboard doesn’t work in that case.
> > > 
> > > ```
> > > $ git grep 'Timeout at i8042_flush' origin/master --
> > > origin/master:amd/lamar/4.0-9540-gae5ab60/2015-04-30T02:12:19Z/coreboot_console.txt:WARNING - Timeout at i8042_flush:71!
> > 
> > I don't think that warning is a problem - it generally indicates that
> > a ps2 port isn't present.  So, I suspect most of these boards lack the
> > ps2 port.
> > 
> > [...]
> >
> > > I also experience this sometimes on a Lenovo X60, when I load the
> > > SeaBIOS ELF file from GRUB with the commands below.
> > > 
> > > ```
> > > > chainloader (cbfsdisk)/img/seabios
> > > > boot
> > > 
> > > ```
> > > 
> > > Every time, the keyboard doesn’t work – on the Lenovo X60 it’s
> > > connected over the PS/2 port – the error message `Timeout at
> > > i8042_flush:71!` can be seen.
> > > 
> > > Note, that it’s unlikely to be a timing issue, as the keyboard works in
> > > the GRUB payload *before*.
> > > 
> > > Any idea, what causes the problem, and is there a way to fix it?
> > 
> > I don't have much help.  The message appears after 16 bytes are read
> > from the port and the port still indcates data is available.  I can't
> > think of any valid situation where that would occur.
> > 
> > Is the problem reproducible?
> 
> I couldn’t reproduce the log message above. I think, I rebuild SeaBIOS
> with higher debug level, but I am not sure.
> 
> With that, I get a non-working keyboard in SeaBIOS, when loading
> SeaBIOS without timeout from GRUB. Then the problem can be reproduced
> each time despite having the file `etc/ps2-keyboard-spinup` with 3
> seconds in CBFS.
> 
> ```
> i8042 self test failed (got fa not 0x55)
> ```
> 
> Could it be that the keyboard is in an „unclean“ state from GRUB, which
> also still probed it?

Does the patch below help?

-Kevin


--- a/src/hw/ps2port.c
+++ b/src/hw/ps2port.c
@@ -449,11 +449,22 @@ ps2_check_event(void)
 static void
 ps2_keyboard_setup(void *data)
 {
-    /* flush incoming keys */
+    // flush incoming keys (also verifies port is likely present)
     int ret = i8042_flush();
     if (ret)
         return;
 
+    // Disable keyboard / mouse and drain any input they may have sent
+    ret = i8042_command(I8042_CMD_KBD_DISABLE, 0);
+    if (ret)
+        return;
+    ret = i8042_command(I8042_CMD_AUX_DISABLE, 0);
+    if (ret)
+        return;
+    ret = i8042_flush();
+    if (ret)
+        return;
+
     // Controller self-test.
     u8 param[2];
     ret = i8042_command(I8042_CMD_CTL_TEST, param);



More information about the SeaBIOS mailing list