From nobody Thu Apr 18 12:47:04 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org ARC-Seal: i=1; a=rsa-sha256; t=1584376941; cv=none; d=zohomail.com; s=zohoarc; b=EOrleubSKlBmyHKKSuudfIe2o1jH0Tit7py2TeR/whmU1zpNYRTV0eY474dZ6+PpDU5WYGsmvz10GEQIAZ4YwXKpgMjkJESlivaW+KqoLKCUTGvL5Zr8jEia640KGdatbY+AxKCk+5c3i1lea00L2NHPwJEBYnwKXSi9bdVFyzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584376941; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:To; bh=A6Yd/rpPd7/uJSmor7g0dYqYXDRSsFuhaWXEQhtmeM0=; b=fVlZqktAghBhD0FE3+qggL0cqtM3oJMaR/Pi/ia+ccpzBeKKy9P5UFIG/huBKawa1pQs5E8k5ahvFj+oS84NnWddjyzkXCHn1yjp8blCGpPlJ1YKI6vjRrIyC4zj/03afSOiYPQ1rMVTbojPMctIu3zBgYJG2To90qWJ6H5Sais= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1584376941081265.97932524541693; Mon, 16 Mar 2020 09:42:21 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id CF752B01A80; Mon, 16 Mar 2020 16:42:16 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 0126CB01A3C for ; Mon, 16 Mar 2020 16:41:59 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 599CA20645A18; Mon, 16 Mar 2020 17:41:59 +0100 (CET) To: seabios@seabios.org From: Paul Menzel Message-ID: <135345f0-b6c0-af4c-151d-062dbf81f0f8@molgen.mpg.de> Date: Mon, 16 Mar 2020 17:41:58 +0100 MIME-Version: 1.0 Content-Language: en-US Message-ID-Hash: LUNRBPEFREPFDST6GZON4M7KAFVEWQ22 X-Message-ID-Hash: LUNRBPEFREPFDST6GZON4M7KAFVEWQ22 X-MailFrom: pmenzel@molgen.mpg.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Marc Jones X-Mailman-Version: 3.3.1 Precedence: list Subject: [SeaBIOS] [PATCH] kbd: Add option for keyboard polling List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: +++ X-Spam-Level: *** Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org From: Marc Jones Date: Wed, 24 Sep 2014 15:14:41 -0600 Some devices don=E2=80=99t 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=3Dchrome-os-partner:30836 BRANCH=3DNone TEST=3DBuild and boot Rambi SeaBIOS. Change-Id: I11033d29ec26b5a772588a0aa1a35678ab05a462 Signed-off-by: Marc Jones Reviewed-on: https://chromium-review.googlesource.com/219803 Reviewed-by: Mike Loptien Tested-by: Mike Loptien Reviewed-by: Duncan Laurie Reviewed-on: https://chromium-review.googlesource.com/227501 Commit-Queue: Stefan Reinauer Tested-by: Stefan Reinauer Signed-off-by: Paul Menzel --- 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=20 empty. + // (Yes, there is a race condition, but it is recoverable). + if (CONFIG_PS2PORT && CONFIG_KBC_POLL) { + u8 v =3D inb(PORT_PS2_STATUS); + if ((v & I8042_STR_OBF) && !(v & I8042_STR_AUXDATA)) { + v =3D inb(PORT_PS2_DATA); + process_key(v); + } + } + switch (regs->ah) { case 0x00: handle_1600(regs); break; case 0x01: handle_1601(regs); break; --=20 2.25.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org