From: Marc Jones marc.jones@se-eng.com Date: Wed, 24 Sep 2014 15:14:41 -0600
Some devices don’t have legacy interrupt support, but still need to use a legacy keyboard. This patch adds a KBC check and manual call to the keyboard service if there is a key waiting in the KBC.
BUG=chrome-os-partner:30836 BRANCH=None TEST=Build and boot Rambi SeaBIOS.
Change-Id: I11033d29ec26b5a772588a0aa1a35678ab05a462 Signed-off-by: Marc Jones marc.jones@se-eng.com Reviewed-on: https://chromium-review.googlesource.com/219803 Reviewed-by: Mike Loptien mike.loptien@se-eng.com Tested-by: Mike Loptien mike.loptien@se-eng.com Reviewed-by: Duncan Laurie dlaurie@chromium.org Reviewed-on: https://chromium-review.googlesource.com/227501 Commit-Queue: Stefan Reinauer reinauer@chromium.org Tested-by: Stefan Reinauer reinauer@chromium.org Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- src/Kconfig | 5 +++++ src/boot.c | 3 +++ src/kbd.c | 12 ++++++++++++ 3 files changed, 20 insertions(+)
diff --git a/src/Kconfig b/src/Kconfig index 6606ce4..d389ede 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -440,6 +440,11 @@ menu "BIOS interfaces" default y help Support for int15c2 mouse calls. + config KBC_POLL + bool "Poll the keyboad controller for keys" + default n + help + Poll for keys when interrupts are not available.
config S3_RESUME bool "S3 resume" diff --git a/src/boot.c b/src/boot.c index afeb36a..3beecee 100644 --- a/src/boot.c +++ b/src/boot.c @@ -631,7 +631,10 @@ get_keystroke_full(int msec) return get_raw_keystroke(); if (irqtimer_check(end)) return -1; + if (!CONFIG_KBC_POLL) yield_toirq(); + else + msleep(5); } }
diff --git a/src/kbd.c b/src/kbd.c index 3f08d32..5726274 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -252,6 +252,18 @@ handle_16(struct bregs *regs) // XXX - set_leds should be called from irq handler set_leds();
+ // If interrupts are not enabled do KBC polling. + // Check the KBC for a key on every keyboard service function (INT16). + // If interrupts are working the KBC status port should always be empty. + // (Yes, there is a race condition, but it is recoverable). + if (CONFIG_PS2PORT && CONFIG_KBC_POLL) { + u8 v = inb(PORT_PS2_STATUS); + if ((v & I8042_STR_OBF) && !(v & I8042_STR_AUXDATA)) { + v = inb(PORT_PS2_DATA); + process_key(v); + } + } + switch (regs->ah) { case 0x00: handle_1600(regs); break; case 0x01: handle_1601(regs); break;
Some devices don’t have legacy interrupt support, but still need to use a legacy keyboard. This patch adds a KBC check and manual call to the keyboard service if there is a key waiting in the KBC.
diff --git a/src/Kconfig b/src/Kconfig index 6606ce4..d389ede 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -440,6 +440,11 @@ menu "BIOS interfaces" default y help Support for int15c2 mouse calls.
- config KBC_POLL
bool "Poll the keyboad controller for keys"
default n
help
Poll for keys when interrupts are not available.
Note we already have CONFIG_HARDWARE_IRQ. So, do we actually need this new config option?
cheers, Gerd
Disabling hardware IRQ is sufficient on Baytrail ChromeOS devices like Rambi, so I'd say no
On Tue, Mar 17, 2020, 9:34 AM Gerd Hoffmann kraxel@redhat.com wrote:
Some devices don’t have legacy interrupt support, but still need to use a legacy keyboard. This patch adds a KBC check and manual call to the keyboard service if there is a key waiting in the KBC.
diff --git a/src/Kconfig b/src/Kconfig index 6606ce4..d389ede 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -440,6 +440,11 @@ menu "BIOS interfaces" default y help Support for int15c2 mouse calls.
- config KBC_POLL
bool "Poll the keyboad controller for keys"
default n
help
Poll for keys when interrupts are not available.
Note we already have CONFIG_HARDWARE_IRQ. So, do we actually need this new config option?
cheers, Gerd _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org