If SeaBIOS is run as a payload via coreboot (and presumably as a
CSM), then it's possible the keyboard or mouse will still be
enabled.  This can lead to data being queued even after the flush
function attempts to clear the queue.

Disabling the keyboard/mouse prior to flushing is pretty standard
in DOS programming so it's not surprising that it's needed here.

I believe this problem manifests with the Chromebook Pixel.  People
have reported that sometimes the 'ESC to Select Boot Devices'
doesn't work.  I can reproduce this faithfully by holding 'Ctrl-L'
in the firmware screen during SeaBIOS initialization.

I can't test this fix on an actual Pixel because I don't know how
to update SeaBIOS but I have tested the patch under QEMU.

Signed-off-by: Anthony Liguori <aligu...@us.ibm.com>
---
 src/ps2port.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/ps2port.c b/src/ps2port.c
index 9b760fd..2169171 100644
--- a/src/ps2port.c
+++ b/src/ps2port.c
@@ -55,6 +55,12 @@ static int
 i8042_flush(void)
 {
     dprintf(7, "i8042_flush\n");
+
+    /* Disable the keyboard and mouse to prevent additional data from
+     * being queued. */
+    outb(0xad, PORT_PS2_STATUS);
+    outb(0xa7, PORT_PS2_STATUS);
+
     int i;
     for (i=0; i<I8042_BUFFER_SIZE; i++) {
         u8 status = inb(PORT_PS2_STATUS);
-- 
1.8.0


_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios

Reply via email to