aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2022-05-14 13:15:17 +0200
committerHelge Deller <deller@gmx.de>2022-05-14 13:24:38 +0200
commitf5c0ce4a292a41aeee7cca238ceffc66ed4b0de6 (patch)
tree0d740e80e3456ef22e9977dff226097c5d8dab77
parent23c1205f77b4f8c6ea6816bb27f16a6ec013ec99 (diff)
downloadseabios-hppa-f5c0ce4a292a41aeee7cca238ceffc66ed4b0de6.zip
seabios-hppa-f5c0ce4a292a41aeee7cca238ceffc66ed4b0de6.tar.gz
seabios-hppa-f5c0ce4a292a41aeee7cca238ceffc66ed4b0de6.tar.bz2
parisc/lasips2: Fix lasips2_kbd_in() to return early without input
lasips2_kbd_in() is used to read input from an emulated PS/2 keyboard. Since there is no interrupt support durig PDC/IODC we need to poll the PS/2 status flags to see if a new key was pressed. In order to be able to poll regularily, exit the loop to read already pressed chars as soon as possible. This can be done by calling handle_16() with register ah = 0x11 to check if keys are queued up and exit if none are available. This patch fixes the problem that keys couldn't be read when using a graphical output (artist graphics). This patch fixes palo and other bootloaders to be able to use input from the emulated PS/2 keyboard. Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--src/parisc/lasips2.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/parisc/lasips2.c b/src/parisc/lasips2.c
index 119c214..e86cbff 100644
--- a/src/parisc/lasips2.c
+++ b/src/parisc/lasips2.c
@@ -19,12 +19,19 @@ int lasips2_kbd_in(char *c, int max)
struct bregs regs;
volatile int count = 0;
+ // check if PS2 reported new keys, if so queue them up.
while((readl(LASIPS2_KBD_STATUS) & LASIPS2_KBD_STATUS_RBNE)) {
process_key(readb(LASIPS2_KBD_DATA));
}
while(count < max) {
- memset(&regs, 0, sizeof(regs));
+ // check if some key is queued up already
+ regs.ah = 0x11;
+ regs.flags = 0;
+ handle_16(&regs);
+ if (regs.flags & F_ZF) // return if no key queued
+ break;
+ // read key from keyboard queue
regs.ah = 0x10;
handle_16(&regs);
if (!regs.ah)